From 70a1687c7487bbe7397d1db71e04f4cb2380fc27 Mon Sep 17 00:00:00 2001 From: Oxbian Date: Thu, 29 Jun 2023 23:07:21 +0200 Subject: Updating lsp settings & documentation --- .vim/keymaps.vim | 136 +++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 113 insertions(+), 23 deletions(-) (limited to '.vim/keymaps.vim') diff --git a/.vim/keymaps.vim b/.vim/keymaps.vim index 993ef87..eef6409 100644 --- a/.vim/keymaps.vim +++ b/.vim/keymaps.vim @@ -2,46 +2,136 @@ " Keymaps """"""""""""""""""""""""""""" +"""""""""""""""""""" " Window movement +"""""""""""""""""""" + +" Go to the bottom window noremap j + +" Go to the top window noremap k + +" Go to the right window noremap l + +" Go to the left window noremap h +"""""""""""""""""""""""" " Remove highlighting -nnoremap h :nohlsearch +"""""""""""""""""""""""" + +nnoremap hl :nohlsearch " Save file nnoremap :w! +"""""""""""""""""""""""""" +" Buffer +""""""""""""""""""""""""" + +" Close the current buffer +map bd :Bclose:tabclosegT + +" Close all the buffers +map ba :bufdo bd + +" Go to the next buffer +map l :bnext + +" Go to the previous buffer +map h :bprevious + +"""""""""""""""""""""""""""" +" Tabs +""""""""""""""""""""""""""" + +" Open a new tab +map tn :tabnew + +" Close all others tab +map to :tabonly + +" Close current tab page +map tc :tabclose + +" Move tabs after another +map tm :tabmove + +" Go to the next tab +map t :tabnext + +" Let 'tl' toggle between this and the last accessed tab +let g:lasttab = 1 +nmap tl :exe "tabn ".g:lasttab +au TabLeave * let g:lasttab = tabpagenr() + +" Opens a new tab with the current buffer's path +" Super useful when editing files in the same directory +map te :tabedit =escape(expand("%:p:h"), " ")/ + +" Switch CWD to the directory of the open buffer +map cd :cd %:p:h:pwd + +" Specify the behavior when switching between buffers +try + set switchbuf=useopen,usetab,newtab + set stal=2 +catch +endtry + +" Return to last edit position when opening files (You want this!) +au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif + +"""""""""""""""""""""""" " NerdTree +""""""""""""""""""""""" + +" Toggle nerdtree nnoremap :NERDTreeToggle +"""""""""""""""""""" " GitGutter +"""""""""""""""""""" let g:gitgutter_enabled=1 " Enable by default gitgutter -nnoremap d :GitGutterToggle + +" Enable / Disable GitGutter +nnoremap d :GitGutterToggle + +" Stage Hunk in Git nnoremap hs :GitGutterStageHunk + +" Undo Hunk nnoremap hu :GitGutterUndoHunk + +" Preview Hunk nnoremap hp :GitGutterPreviewHunk -" Vsnip -" Expand -imap vsnip#expandable() ? '(vsnip-expand)' : '' -smap vsnip#expandable() ? '(vsnip-expand)' : '' - -" Expand or jump -imap vsnip#available(1) ? '(vsnip-expand-or-jump)' : '' -smap vsnip#available(1) ? '(vsnip-expand-or-jump)' : '' - -" Jump forward or backward -imap vsnip#jumpable(1) ? '(vsnip-jump-next)' : '' -smap vsnip#jumpable(1) ? '(vsnip-jump-next)' : '' -imap vsnip#jumpable(-1) ? '(vsnip-jump-prev)' : '' -smap vsnip#jumpable(-1) ? '(vsnip-jump-prev)' : '' - -" Select or cut text to use as $TM_SELECTED_TEXT in the next snippet. -" See https://github.com/hrsh7th/vim-vsnip/pull/50 -nmap s (vsnip-select-text) -xmap s (vsnip-select-text) -nmap S (vsnip-cut-text) -xmap S (vsnip-cut-text) +" Always show the status line +set laststatus=2 + +""""""""""""""""""""" +" Spell +""""""""""""""""""""" + +" Toggle and untoggle spell checking +map ss :setlocal spell! + +" Next word to spellcheck +map sn ]s + +" Previous word to spellcheck +map sp [s + +" Add word into the spellcheck dictionnary +map sa zg + +" show the list of alternatives for the word +map s? z= + +""""""""""""""""""" +" LSP +""""""""""""""""""" +inoremap pumvisible() ? "\" : "\" +inoremap pumvisible() ? "\" : "\" -- cgit v1.2.3