""""""""""""""""""""""""""""" " 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 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 " Enable / Disable GitGutter nnoremap d :GitGutterToggle " Stage Hunk in Git nnoremap hs :GitGutterStageHunk " Undo Hunk nnoremap hu :GitGutterUndoHunk " Preview Hunk nnoremap hp :GitGutterPreviewHunk " 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() ? "\" : "\"