2 août 2024

Nvim shortcuts

Here are the shortcuts I use with my Neovim config.

label mode shortcut command
Search n /
Reach previous / next paragraph (or function/bloc) n { / }
Insert before cursor / line n ì / I
Insert (add) before cursor / line n a / A
Insert (open) new line after / before n o / O
Insert (add) at end of word n ea
Left n, v h
Down n, v j
Up n, v k
Down (multilines) n gj
Up (multilines) n gk
Right n, v l
Backspace i <C>-h
Backspace word i <C>-w
Left pane n, v <C>-h
Down pane n, v <C>-j
Up pane n, v <C>-k
Right pane n, v <C>-l
Go to associate char n %
Go to first/last line n gg / G
copy to clipboard v <leader> y
scroll down n <crtl> b
scroll up n <crtl> f
show autocomplete i <crtl> espace
confirm autocomplete i <return>
scroll documentation back i <crtl> b
scroll documentation fw i <crtl> f
autocomplete abord i <crtl> e
Lists LSP references for word under the cursor n gr <cmd>Telescope lsp_references<CR>
Displays hover information about the symbol under the cursor n K vim.lsp.buf.hover
Jumps to the declaration of the symbol under the cursor n gD vim.lsp.buf.declaration
Goto the definition of the word under the cursor, if there’s only one, otherwise show all options in Telescope n gd <cmd>Telescope lsp_definitions<CR>
Jumps to the definition of the type of the symbol under the cursor n td vim.lsp.buf.type_definition
Goto the implementation of the word under the cursor if there’s only one, otherwise show all options in Telescope n gi <cmd>Telescope lsp_implementations<CR>
Displays signature information about the symbol under the cursor in a floating window n <C-k> vim.lsp.buf.signature_help
Add the folder at path to the workspace folders. If {path} is not provided, the user will be prompted for a path using input() n <leader>wa vim.lsp.buf.add_workspace_folder
Remove the folder at path from the workspace folders. If {path} is not provided, the user will be prompted for a path using input() n <leader>wr vim.lsp.buf.remove_workspace_folder
List workspace folders n <leader>wl vim.lsp.buf.list_workspace_folders()
Lists Diagnostics for current buffer n <leader>D <cmd>Telescope diagnostics bufnr=0<CR>
Show diagnostics in a floating window n <leader>d vim.diagnostic.open_float
Go to previous error n [d vim.diagnostic.goto_prev
Got to next error n ]d vim.diagnostic.goto_next
Add buffer diagnostics to the location list n <leader>l vim.diagnostic.setloclist
Selects a code action available at the current cursor position n, v ca vim.lsp.buf.code_action
restart lsp n <leader>rs :LspRestart<CR>
Renames all references to the symbol under the cursor (rename functions) n <leader>rn vim.lsp.buf.rename
Open Neotree filesystem on the left n <C-n> :Neotree filesystem reveal left<CR>
Close Neotree n <leader>q :Neotree close<CR>
Show open buffers on a float n <leader>bf :Neotree buffers reveal float<CR>
Show Git status n <leader>gst :Neotree git_status reveal float<CR>
Git add all (gst reveal) n A git_add_all
Git unstage (gst reveal) n gu git_unstage_file
Git add file (gst reveal) n ga git_add_file
git revert file (gst reveal) n gr git_revert_file
Git commit (gst reveal) n gc git_commit
Git push (gst reveal) n gp git_push
Git commit and push (gst reveal) n gg git_commit_and_push
Find files n <leader>p builtin.find_files
Search (in Neotree pane) n fg
Live Grep n <leader>fg builtin.live_grep
Autoindent n =
Show hidden files (neotree) n H
Split vertically n <C-w> v :vsplit
Split horizontally n <C-w> s :split
Increase/decrease width n <C-w> + SHIFT + >/<
Increase height n <C-w> + SHIFT + '+'
Decrease height n <C-w> + -

See also :