KEYMAPS.md 4.5 KB

Neovim Keymaps (Current Setup)

Leader key: Space

Core Navigation (CoC)

Mode Key Action Plugin
Normal gd Go to definition coc.nvim
Normal gy Go to type definition coc.nvim
Normal gi Go to implementation coc.nvim
Normal gr Go to references coc.nvim
Normal K Hover documentation coc.nvim
Normal ]g Next diagnostic coc.nvim
Normal [g Previous diagnostic coc.nvim
Normal <leader>en Next diagnostic coc.nvim
Normal <leader>ep Previous diagnostic coc.nvim
Normal <leader>a :CocAction coc.nvim
Normal <leader>cl Run codelens action coc.nvim

Completion & Snippets (Insert/Visual)

Mode Key Action Plugin
Insert <Tab> Next popup item / trigger completion coc.nvim
Insert <S-Tab> Previous popup item coc.nvim
Insert <C-Space> Refresh completion coc.nvim
Insert <C-@> Refresh completion coc.nvim
Insert <C-l> Expand snippet coc-snippets
Insert <C-j> Expand/jump snippet coc-snippets
Visual <C-j> Select snippet placeholder coc-snippets

File / Search / Buffer Flow

Mode Key Action Plugin
Normal <leader>j Find files (:Files) fzf.vim
Normal <leader>r Ripgrep search (:Rg) fzf.vim
Normal <leader>b Buffers list (:Buffers) fzf.vim
Normal <leader>bb Buffers list (:Buffers) fzf.vim
Normal <leader>bd Close current buffer built-in
Normal <leader>bn Next buffer built-in
Normal <leader>bp Previous buffer built-in
Normal <leader>n Next buffer built-in
Normal <leader>p Previous buffer built-in
Normal <leader><Tab> Previous buffer built-in
Normal <leader>bsd Close all buffers except alternate/current custom
Normal <leader>f :Lfcd (open lf) lf.vim
Normal <leader><Return> Save file (:w!) built-in
Normal <leader>% Source current file built-in
Normal <leader>/ Clear search highlight (:noh) built-in
Normal <leader>F Format current buffer (:Format) conform.nvim

Quick Navigation (Harpoon / Hop)

Mode Key Action Plugin
Normal <leader>' Add file to harpoon harpoon
Normal <leader><leader> Toggle harpoon quick menu harpoon
Normal <leader>1..9 Jump to harpoon slot 1..9 harpoon
Normal <leader>h Hop to word hop.nvim
Normal <leader>l Hop to line hop.nvim
Normal <leader>m Toggle maximize window vim-maximizer

Git (coc-git + Telescope/Fugitive)

Mode Key Action Plugin
Normal <leader>gs Git status (:GitStatus) telescope custom command
Normal <leader>gb Blame at cursor coc-git
Normal <leader>gc Show commit coc-git
Normal <leader>gdc Diff cached coc-git
Normal <leader>gn Next changed hunk coc-git
Normal <leader>gp Previous changed hunk coc-git
Normal <leader>gg Stage hunk coc-git
Normal <leader>gu Undo hunk coc-git
Normal <leader>gU Unstage hunk coc-git
Normal <leader>gi Hunk info coc-git
Normal <leader>go Open remote in browser coc-git
Normal <leader>gy Copy remote URL coc-git
Normal <leader>gz Fold unchanged regions coc-git
Normal <leader>gt Toggle git gutters coc-git
Normal <leader>gP Push coc-git
Normal <leader>gen Previous conflict coc-git
Normal <leader>gep Next conflict coc-git
Operator/Visual ig / ag Inner/around git hunk textobject coc-git

Debugging (Vimspector, lazy loaded)

Mode Key Action Plugin
Normal <leader>vl Launch debugger vimspector
Normal <leader>vr Reset debugger vimspector
Normal <leader>ve Evaluate expression vimspector
Normal <leader>vw Add watch vimspector
Normal <leader>vo Show output vimspector
Normal/Visual <leader>vi Evaluate under cursor/selection vimspector

Useful habit order

  1. Use <leader>j, <leader>r, <leader>b all day.
  2. Use gd, gr, K, ]g for code navigation.
  3. Use <leader>gn, <leader>gp, <leader>gg, <leader>gu for git chunks.
  4. Add 2-3 files to Harpoon and jump with <leader>1..3.