let mapleader = " " " move text buffer in visual mode vnoremap K :m '<-2gv=gv vnoremap J :m '>+1gv=gv " write and quit easier nnoremap w :w nnoremap z :wq nnoremap q :qa " windows commands nnoremap h :wincmd h nnoremap j wincmd j nnoremap k wincmd k nnoremap l wincmd l nnoremap pv :wincmd v :Ex :vertical resize 30 nnoremap ps :Rg nnoremap + :vertical resize +5 nnoremap - :vertical resize -5 " general custom commands command D filetype detect " commands for opening and compiling various document types command S silent !vshow '%:p' command C !compile "%" " general compile button map :w:!compile "%"; pkill -HUP mupdf " bibtex extra compiler map :w:!latexmk -pdf "%"; pkill -HUP mupdf map :noh map :set spell! map :w:!glosscompile "%"; pkill -HUP mupdf " jumper vnoremap /<++>"_c4l map /<++>"_c4l " copy from / to clipboard vnoremap "+y map "+P " Use to trigger completion. inoremap coc#refresh() " Use `[g` and `]g` to navigate diagnostics nmap [g (coc-diagnostic-prev) nmap ]g (coc-diagnostic-next) " Remap keys for gotos nmap gd (coc-definition) nmap gy (coc-type-definition) nmap gi (coc-implementation) nmap gr (coc-references) nmap rn (coc-rename) vmap f (coc-format-selected) " switch (back and forth) to (and from) the last opened file nmap b nmap f (coc-format-selected) noremap f :Fern . -drawer -reveal=% -toggle -width=35= function! FernInit() abort nmap \ (fern-my-open-expand-collapse) \ fern#smart#leaf( \ "\(fern-action-open:select)", \ "\(fern-action-expand:stay)", \ "\(fern-action-collapse)", \ ) nmap (fern-my-open-expand-collapse) nmap <2-LeftMouse> (fern-my-open-expand-collapse) nmap n (fern-action-new-path) nmap d (fern-action-remove) nmap m (fern-action-move) nmap M (fern-action-rename) nmap c (fern-action-hidden:toggle) nmap r (fern-action-reload) nmap g (fern-action-mark:toggle) nmap o (fern-action-open) nmap b (fern-action-open:split) nmap v (fern-action-open:vsplit) nmap h (fern-action-collapse) nmap l (fern-action-expand:stay) nmap < (fern-action-leave) nmap > (fern-action-enter) endfunction " use TAB to autocomplete w/ coc 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 `:Format` to format current buffer command! -nargs=0 Format :call CocAction('format') " Go to tab by number noremap 1 1gt noremap 2 2gt noremap 3 3gt noremap 4 4gt noremap 5 5gt noremap 6 6gt noremap 7 7gt noremap 8 8gt noremap 9 9gt noremap 0 :tablast " 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 buffer. nmap ac (coc-codeaction) " Apply AutoFix to problem on the current line. nmap qf (coc-fix-current) " Run the Code Lens action on the current line. nmap cl (coc-codelens-action)