Skip to content

Neovim Keybindings

mech edited this page Jul 8, 2023 · 7 revisions

Legend:

<leader> = spacebar

<C-?> = Ctrl + <some character>

<CR> = Carrier Return

NeoVIM Default rebinds


General Keymaps

Mode Keybinding Function Description
i jk <ESC> “jk” now works the same as ESC key to save finger stretching
n <leader>ph :nohl<CR> Removes search highlights

Window Management

Mode Keybinding Function Description
n <leader>sv <C-w>v Split window vertically
n <leader>sh <C-w>s Split window horizontally
n <leader>se <C-w>= Make split windows equal width and height
n <leader>sx :close<CR> Close current split window
n <leader>to :tabnew<CR> Open new tab
n <leader>tx :tabclose<CR> Close current tab
n <leader>tn :tabn<CR> Go to next tab
n <leader>tp :tabp<CR> Go to previous tab

NVIM Plugin key bindings

Mode Keybinding Function Description
n gcc Line-comment toggle keymap
n gbc Block-comment toggle keymap
n/v gc Line-comment keymap
n/v gb Block-comment keymap
n/v gc0 Add comment on the line above
n/v gco Add comment on the line below
n/v gcA Add comment at the end of line
Mode Keybinding Function Description
n <leader>sm :MaximizerToggle<CR> Maximizes nvim window when screen split
Mode Keybinding Function Description
n <leader>e :NvimTreeToggle<CR> Opens file tree in nvim to add/delete/select files
Mode Keybinding Function Description
n <leader>ff :Telescope find_files<CR> Find files within current working directory, respects .gitignore
n <leader>fs :Telescope live_grep<CR> Find string in current working directory as you type
n <leader>fc :Telescope grep_string<CR> Find string under cursor in current working directory
n <leader>fb :Telescope buffers<CR> List open buffers in current neovim instance
n <leader>fh :Telescope help_tags<CR> List available help tags
<C-k> Move to previous result
<C-j> Move to next result
<C-q> Send selected to quick fix list
Mode Keybinding Function Description
<C-k> Previous suggestion
<C-j> Next suggestion
<C-b> Scroll docs down
<C-f> Scroll docs up
<C-Space> Show completion suggestions
<C-e> Close completion window
<CR> Select
Mode Keybinding Function Description
n gf :Lspsaga lsp_finder Show definition, references
n gD :lua vim.lsp.buf.declaration() Go to declaration
n gd :Lspsaga peek_definition See definition and make edits in window
n gi :lua vim.lsp.buf.implementation() Go to implementation
n <leader>ca :Lspsaga code_action See available code actions
n <leader>rn :Lspsaga rename Smart rename
n <leader>D :Lspsaga show_line_diagnostics Show diagnostics for line
n <leader>d :Lspsaga show_cursor_diagnostics Show diagnostics for cursor
n [d :Lspsaga diagnostic_jump_prev Jump to previous diagnostic in buffer
n ]d :Lspsaga diagnostic_jump_next Jump to next diagnostic in buffer
n K :Lspsaga hover_doc Show documentation for what is under cursor
n <leader>o :LSoutlineToggle See outline on right hand side
<C-f> Scroll down in lspsaga window
<C-b> Scroll up in lspsaga window