let mapleader ="," if ! filereadable(system('echo -n "${XDG_CONFIG_HOME:-$HOME/.config}/nvim/autoload/plug.vim"')) echo "Downloading junegunn/vim-plug to manage plugins..." silent !mkdir -p ${XDG_CONFIG_HOME:-$HOME/.config}/nvim/autoload/ silent !curl "https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim" > ${XDG_CONFIG_HOME:-$HOME/.config}/nvim/autoload/plug.vim autocmd VimEnter * PlugInstall endif call plug#begin(system('echo -n "${XDG_CONFIG_HOME:-$HOME/.config}/nvim/plugged"')) Plug 'tpope/vim-surround' Plug 'preservim/nerdtree' Plug 'junegunn/goyo.vim' Plug 'PotatoesMaster/i3-vim-syntax' Plug 'jreybert/vimagit' Plug 'lukesmithxyz/vimling' Plug 'vimwiki/vimwiki' Plug 'bling/vim-airline' Plug 'tpope/vim-commentary' Plug 'kovetskiy/sxhkd-vim' Plug 'ap/vim-css-color' Plug 'neoclide/coc.nvim', {'branch': 'release'} Plug 'lervag/vimtex' Plug 'terryma/vim-multiple-cursors' Plug 'dense-analysis/ale' Plug 'arcticicestudio/nord-vim' Plug 'tpope/vim-fugitive' Plug 'rhysd/vim-grammarous' " Plug 'goballooning/vim-live-latex-preview' call plug#end() " Integrated spell-check "set spell " set spellang = en,de nnoremap :set spell! inoremap :set spell! set bg=light set go=a set mouse=a set nohlsearch set clipboard+=unnamedplus colorscheme nord " Some basics: nnoremap c "_c set nocompatible filetype plugin on syntax on set encoding=utf-8 set number relativenumber " Enable autocompletion: set wildmode=longest,list,full " Disables automatic commenting on newline: autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o " Goyo plugin makes text more readable when writing prose: map f :Goyo \| set bg=light \| set linebreak " Spell-check set to o, 'o' for 'orthography': map o :setlocal spell! spelllang=en_us " Splits open at the bottom and right, which is non-retarded, unlike vim defaults. set splitbelow splitright " Nerd tree map n :NERDTreeToggle autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif " vimling: nm d :call ToggleDeadKeys() imap d :call ToggleDeadKeys()a nm i :call ToggleIPA() imap i :call ToggleIPA()a nm q :call ToggleProse() " Shortcutting split navigation, saving a keypress: map h map j map k map l " Replace ex mode with gq map Q gq " Check file in shellcheck: map s :!clear && shellcheck % " Open my bibliography file in split map b :vsp$BIB map r :vsp$REFER " Replace all is aliased to S. nnoremap S :%s//g " Compile document, be it groff/LaTeX/markdown/etc. map c :w! \| !compiler % " Open corresponding .pdf/.html or preview map p :!opout % " Runs a script that cleans out tex build files whenever I close out of a .tex file. autocmd VimLeave *.tex !texclear % " Copy selected text to system clipboard (requires gvim/nvim/vim-x11 installed): vnoremap "+y map "+P " Ensure files are read as what I want: let g:vimwiki_ext2syntax = {'.Rmd': 'markdown', '.rmd': 'markdown','.md': 'markdown', '.markdown': 'markdown', '.mdown': 'markdown'} map v :VimwikiIndex let g:vimwiki_list = [{'path': '~/vimwiki', 'syntax': 'markdown', 'ext': '.md'}] autocmd BufRead,BufNewFile /tmp/calcurse*,~/.calcurse/notes/* set filetype=markdown autocmd BufRead,BufNewFile *.ms,*.me,*.mom,*.man set filetype=groff autocmd BufRead,BufNewFile *.tex set filetype=tex " Save file as sudo on files that require root permission cnoremap w!! execute 'silent! write !sudo tee % >/dev/null' edit! " Enable Goyo by default for mutt writting autocmd BufRead,BufNewFile /tmp/neomutt* let g:goyo_width=80 autocmd BufRead,BufNewFile /tmp/neomutt* :Goyo | set bg=light autocmd BufRead,BufNewFile /tmp/neomutt* map ZZ :Goyo\|x! autocmd BufRead,BufNewFile /tmp/neomutt* map ZQ :Goyo\|q! " Automatically deletes all trailing whitespace and newlines at end of file on save. autocmd BufWritePre * %s/\s\+$//e autocmd BufWritepre * %s/\n\+\%$//e " When shortcut files are updated, renew bash and ranger configs with new material: autocmd BufWritePost files,directories !shortcuts " Run xrdb whenever Xdefaults or Xresources are updated. autocmd BufWritePost *Xresources,*Xdefaults !xrdb -merge % " Update binds when sxhkdrc is updated. autocmd BufWritePost *sxhkdrc !pkill -USR1 sxhkd " Turns off highlighting on the bits of code that are changed, so the line that is changed is highlighted but the actual text that has changed stands out on the line and is readable. if &diff highlight! link DiffText MatchParen endif " Navigating with guides inoremap /<++>"_c4l vnoremap /<++>"_c4l map /<++>"_c4l " Enable completion where available. " This setting must be set before ALE is loaded. " " You should not turn this setting on if you wish to use ALE as a completion " source for other completion plugins, like Deoplete. let g:ale_completion_enabled = 1 """"COC config " TextEdit might fail if hidden is not set. set hidden " Some servers have issues with backup files, see #649. set nobackup set nowritebackup " Give more space for displaying messages. set cmdheight=2 " Having longer updatetime (default is 4000 ms = 4 s) leads to noticeable " delays and poor user experience. set updatetime=300 " Don't pass messages to |ins-completion-menu|. set shortmess+=c " Always show the signcolumn, otherwise it would shift the text each time " diagnostics appear/become resolved. set signcolumn=no " Use tab for trigger completion with characters ahead and navigate. " NOTE: Use command ':verbose imap ' to make sure tab is not mapped by " other plugin before putting this into your config. "inoremap " \ pumvisible() ? "\" : " \ check_back_space() ? "\" : " \ coc#refresh() "inoremap pumvisible() ? "\" : "\" function! s:check_back_space() abort let col = col('.') - 1 return !col || getline('.')[col - 1] =~# '\s' endfunction " Use to trigger completion. inoremap \ pumvisible() ? "\" : \ check_back_space() ? "\" : \ coc#refresh() "inoremap pumvisible() ? "\" : "\" " Use to confirm completion, `u` means break undo chain at current " position. Coc only does snippet and additional edit on confirm. " could be remapped by other vim plugin, try `:verbose imap `. if exists('*complete_info') inoremap complete_info()["selected"] != "-1" ? "\" : "\u\" else inoremap pumvisible() ? "\" : "\u\" endif " Use `[g` and `]g` to navigate diagnostics nmap [g (coc-diagnostic-prev) nmap ]g (coc-diagnostic-next) " GoTo code navigation. nmap gd (coc-definition) nmap gy (coc-type-definition) nmap gi (coc-implementation) nmap gr (coc-references) " Use K to show documentation in preview window. nnoremap K :call show_documentation() function! s:show_documentation() if (index(['vim','help'], &filetype) >= 0) execute 'h '.expand('') else call CocAction('doHover') endif endfunction " Highlight the symbol and its references when holding the cursor. autocmd CursorHold * silent call CocActionAsync('highlight') " Symbol renaming. nmap rn (coc-rename) " Formatting selected code. xmap f (coc-format-selected) nmap f (coc-format-selected) augroup mygroup autocmd! " Setup formatexpr specified filetype(s). autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected') " Update signature help on jump placeholder. autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp') augroup end " Applying codeAction to the selected region. " Example: `aap` for current paragraph xmap a (coc-codeaction-selected) nmap a (coc-codeaction-selected) " Remap keys for applying codeAction to the current line. nmap ac (coc-codeaction) " Apply AutoFix to problem on the current line. nmap qf (coc-fix-current) " Introduce function text object " NOTE: Requires 'textDocument.documentSymbol' support from the language server. xmap if (coc-funcobj-i) xmap af (coc-funcobj-a) omap if (coc-funcobj-i) omap af (coc-funcobj-a) " Use for selections ranges. " NOTE: Requires 'textDocument/selectionRange' support from the language server. " coc-tsserver, coc-python are the examples of servers that support it. nmap (coc-range-select) xmap (coc-range-select) " Add `:Format` command to format current buffer. command! -nargs=0 Format :call CocAction('format') " Add `:Fold` command to fold current buffer. command! -nargs=? Fold :call CocAction('fold', ) " Add `:OR` command for organize imports of the current buffer. command! -nargs=0 OR :call CocAction('runCommand', 'editor.action.organizeImport') " Add (Neo)Vim's native statusline support. " NOTE: Please see `:h coc-status` for integrations with external plugins that " provide custom statusline: lightline.vim, vim-airline. set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')} " Mappings using CoCList: " Show all diagnostics. nnoremap a :CocList diagnostics " Manage extensions. nnoremap e :CocList extensions " Show commands. nnoremap c :CocList commands " Find symbol of current document. nnoremap o :CocList outline " Search workspace symbols. nnoremap s :CocList -I symbols " Do default action for next item. nnoremap j :CocNext " Do default action for previous item. nnoremap k :CocPrev " Resume latest coc list. nnoremap p :CocListResume """VimTex let g:vimtex_view_method = 'zathura' let g:latex_view_general_viewer = 'zathura' let g:vimtex_log_verbose = 0 let g:vimtex_quickfix_open_on_warning = 0 """Fix E10 error for some tex stuff: set nocompatible """LATEX " Word count: autocmd FileType tex map w :w !detex \| wc -w " Code snippets """autocmd FileType tex inoremap ,fr \begin{frame}\frametitle{}<++>\end{frame}<++>6kf}i autocmd FileType tex inoremap ,fi \begin{fitch}\end{fitch}<++>3kA autocmd FileType tex inoremap ,exe \begin{exe}\ex\end{exe}<++>3kA autocmd FileType tex inoremap ,bf \textbf{}<++>T{i autocmd FileType tex vnoremap , ``>2la}?\\{a autocmd FileType tex inoremap ,it \textit{}<++>T{i autocmd FileType tex inoremap ,ct \textcite{}<++>T{i autocmd FileType tex inoremap ,cp \parencite{}<++>T{i autocmd FileType tex inoremap ,glos {\gll<++>\\<++>\\\trans{``<++>''}}2k2bcw autocmd FileType tex inoremap ,x \begin{xlist}\ex\end{xlist}kA autocmd FileType tex inoremap ,ol \begin{enumerate}\end{enumerate}<++>3kA\item autocmd FileType tex inoremap ,ul \begin{itemize}\end{itemize}<++>3kA\item autocmd FileType tex inoremap ,li \item[] autocmd FileType tex inoremap ,ref \ref{}<++>T{i autocmd FileType tex inoremap ,tab \begin{tabular}<++>\end{tabular}<++>4kA{}i autocmd FileType tex inoremap ,ot \begin{tableau}\inp{<++>}\const{<++>}<++><++>\end{tableau}<++>5kA{}i autocmd FileType tex inoremap ,can \cand{}<++>T{i autocmd FileType tex inoremap ,con \const{}<++>T{i autocmd FileType tex inoremap ,v \vio{}<++>T{i autocmd FileType tex inoremap ,a \href{}{<++>}<++>2T{i autocmd FileType tex inoremap ,sc \textsc{}<++>T{i autocmd FileType tex inoremap ,chap \chapter{}<++>2kf}i autocmd FileType tex inoremap ,sec \section{}<++>2kf}i autocmd FileType tex inoremap ,ssec \subsection{}<++>2kf}i autocmd FileType tex inoremap ,sssec \subsubsection{}<++>2kf}i autocmd FileType tex inoremap ,st F{i*f}i autocmd FileType tex inoremap ,beg \begin{DELRN}<++>\end{DELRN}<++>4k0fR:MultipleCursorsFindDELRNc autocmd FileType tex inoremap ,up /usepackageo\usepackage{}i autocmd FileType tex nnoremap ,up /usepackageo\usepackage{}i autocmd FileType tex inoremap ,tt \texttt{}<++>T{i autocmd FileType tex inoremap ,bt {\blindtext} autocmd FileType tex inoremap ,nu $\varnothing$ autocmd FileType tex inoremap ,col \begin{columns}[T]\begin{column}{.5\textwidth}\end{column}\begin{column}{.5\textwidth}<++>\end{column}\end{columns}5kA autocmd FileType tex inoremap ,rn (\ref{})<++>F}i autocmd FileType tex inoremap ,fr \dfrac{}{<++>} <++> T{2hi autocmd FileType tex inoremap ,sqrt \sqrt{}<++> T{i autocmd FileType tex inoremap ,b( \left(\right)<++>T(i autocmd FileType tex inoremap ,bb \mathbb{}<++>T{i autocmd FileType tex inoremap ,b{ \left\{\right\}<++>T{i autocmd FileType tex inoremap ,b[ \left[\right]<++>T[i autocmd FileType tex inoremap ,rm \mathrm{}<++>T{i autocmd FileType tex inoremap ,abs \left\|\right\|<++>3ba autocmd FileType tex inoremap ,em \emph{}<++>T{i autocmd FileType tex inoremap ,tabb \begin{tabbing}\hspace*{3cm}\=\hspace*{3cm}\= \kill\end{tabbing}<++>3kA autocmd FileType tex inoremap ,txt \text{}<++>T{i autocmd FileType tex inoremap ,sfr \sfrac{}{<++>}<++>2T{i """HTML autocmd FileType html inoremap ,b <++>FbT>i autocmd FileType html inoremap ,it <++>FeT>i autocmd FileType html inoremap ,1

<++>2kf<++>2kf<++>2kf

<++>02kf>a autocmd FileType html inoremap ,a href=""><++><++>14hi autocmd FileType html inoremap ,e target="_blank"href=""><++><++>14hi autocmd FileType html inoremap ,ul
<++>03kfo
  • F>a autocmd FileType html inoremap ,ol
    <++>03kf<++>Fcf"a autocmd FileType html inoremap ,td <++>Fdcit autocmd FileType html inoremap ,tr <++>kf<++>Fhcit autocmd FileType html inoremap ,tab
    O autocmd FileType html inoremap ,gr F>a autocmd FileType html inoremap ,rd F>a autocmd FileType html inoremap ,yl F>a autocmd FileType html inoremap ,dt
    <++>
    <++>2kcit autocmd FileType html inoremap ,dl
    <++>3kcc autocmd FileType html inoremap & & autocmd FileType html inoremap á á autocmd FileType html inoremap é é autocmd FileType html inoremap í í autocmd FileType html inoremap ó ó autocmd FileType html inoremap ú ú autocmd FileType html inoremap ä ä autocmd FileType html inoremap ë ë autocmd FileType html inoremap ï ï autocmd FileType html inoremap ö ö autocmd FileType html inoremap ü ü autocmd FileType html inoremap ã ã autocmd FileType html inoremap ẽ &etilde; autocmd FileType html inoremap ĩ ĩ autocmd FileType html inoremap õ õ autocmd FileType html inoremap ũ ũ autocmd FileType html inoremap ñ ñ autocmd FileType html inoremap à à autocmd FileType html inoremap è è autocmd FileType html inoremap ì ì autocmd FileType html inoremap ò ò autocmd FileType html inoremap ù ù """.bib autocmd FileType bib inoremap ,a @article{author={<++>},year={<++>},title={<++>},journal={<++>},volume={<++>},pages={<++>},}<++>8kA,i autocmd FileType bib inoremap ,b @book{author={<++>},year={<++>},title={<++>},publisher={<++>},}<++>6kA,i autocmd FileType bib inoremap ,c @incollection{author={<++>},title={<++>},booktitle={<++>},editor={<++>},year={<++>},publisher={<++>},}<++>8kA,i "MARKDOWN autocmd Filetype markdown,rmd map w yiWi[Ea](pa) autocmd Filetype markdown,rmd inoremap ,n --- autocmd Filetype markdown,rmd inoremap ,b ****<++>F*hi autocmd Filetype markdown,rmd inoremap ,s ~~~~<++>F~hi autocmd Filetype markdown,rmd inoremap ,e **<++>F*i autocmd Filetype markdown,rmd inoremap ,h ====<++>F=hi autocmd Filetype markdown,rmd inoremap ,i ![](<++>)<++>F[a autocmd Filetype markdown,rmd inoremap ,a [](<++>)<++>F[a autocmd Filetype markdown,rmd inoremap ,1 #<++>kA autocmd Filetype markdown,rmd inoremap ,2 ##<++>kA autocmd Filetype markdown,rmd inoremap ,3 ###<++>kA autocmd Filetype markdown,rmd inoremap ,l -------- autocmd Filetype markdown,rmd inoremap ,r ```{r}```2kO autocmd Filetype markdown,rmd inoremap ,p ```{python}```2kO autocmd Filetype mardown,rmd inoremap ,c ``````2kO """.xml autocmd FileType xml inoremap ,e <++>isPermaLink="false"><++>:put=strftime('%a, %d %b %Y %H:%M:%S %z')kJA<++>]]>?<enter>cit autocmd FileType xml inoremap ,a <a href="<++>"><++></a><++><Esc>F"ci"