Skip to content

Latest commit

 

History

History
124 lines (107 loc) · 3.97 KB

README.nvim.md

File metadata and controls

124 lines (107 loc) · 3.97 KB

Neovim README

General keymap

  • <leader> is \ (backslash)
  • <leader>qq to close current pane
  • <leader>qa to quit vim
  • <leader>m to toggle mouse support (useful to allow select + copy)

Buffers

  • <leader> 1 through 9 to switch to buffer 1 through 9
    • <leader>] to switch to next buffer
    • <leader>[ to switch to previous buffer
    • <leader>s to save current buffer
    • <leader>w to close the current buffer by trying not to mess up the layout
    • <leader>wo to close all buffers except the current one
    • <leader>wa to close all buffers

Tabs

  • <leader>l] to switch to next tab
  • <leader>l[ to switch to previous tab
  • <leader>lw or <leader>lq to close current tab
  • <leader>ln to open a new tab
  • <leader>l1 through 5 to switch to tab 1 through 5

Fzf

  • <ctrl>p or <leader>ff fuzzy finding file names
  • <ctrl-l> or <leader>fs fuzzy find in current file
  • <ctrl-g> or <leader>fS fuzzy find in workspace (ripgrep)
  • <ctrl-b> or <leader>fb fuzzy find through buffers
  • <ctrl-\> fuzzy find through neovim commands
  • <leader>fk fuzzy find through keymaps
  • When open, <ctrl>q, sends matches to the quickfix list
  • See plugin.fzf.vim for more

Editing & navigation

  • <leader>y to yank to clipboard using bin/pbcopy util
  • <leader>p to paste from clipboard using bin/pbpaste util
  • <ctrl>o go back to previous cursor
  • <ctrl>i go forward to next cursor
  • <leader>cc comment
  • <leader>cu uncomment

Code / LSP

  • gD go to declaration
  • gd go to definition
  • gi find all implementations
  • go go to type definiton
  • K Displays hover information about a symbol
  • <space>rn rename symbol
  • <space>ca code action on code or block (ex: extract function)
  • gr list all references of a symbol (to quickfix)
  • <space>f format code

Git

  • <leader>gs show status pane
  • <leader>gu undo hunk
  • <leader>gs stage hunk
  • <leader>gdo diff view open
  • <leader>gdb diff view open, diffing against main branch
  • <leader>gdq diff view close

Diagnostics

  • <leader>ds or <leader>df Open diagnostic float
  • <leader>dn or ]d Go to next diagnostic
  • <leader>dp or [d Go to previous diagnostic
  • <leader>do Open diagnostic panel (Trouble)
  • <leader>dq Close diagnostic panel (Trouble)

Nvim tree

  • <ctrl>e to toggle filetree
  • In tree
    • g? to show help
    • <ctrl>] to CD into directory
    • - go up one directory
    • <ctrl>v Open in vertical split
    • <ctrl>x Open in horizontal split
    • I Toggle hidden files
    • r Rename file
    • d Delete file
    • a Add file or directory if it ends with /
    • c, x, v to copy, cut, paste files
    • f to find file, F to clear
    • q to close tree
    • E to expand all, W to collapse

Git

  • :Git or :G or <leader>fgs git status
  • <leader>fgb git branches
  • :Gdiff to see diff
  • :Gwrite stages current file
  • :Gcommit to commit
  • :Glog to show log
  • :Gblame to show blame

Quickfix

  • <leader>xo to open quickfix
  • <leader>xq to close quickfix
  • <leader>xn or ]x to go to next quickfix
  • <leader>xp or [x to go to prev quickfix
  • <leader>xf to find in quickfix

Testing

  • <leader>tc to run nearest / under cursor
  • <leader>tdc to debug nearest
  • <leader>tf to run file
  • <leader>tdf to debug file
  • <leader>tl to run last
  • <leader>tdl to debug last
  • <leader>ts to stop test
  • <leader>to to open output panel
  • <leader>tk to clear output panel
  • <leader>tq to close output panel

Misc

  • <leader>r to execute current buffer in a shell (normal mode)
  • <leader>r to execute current visual selection in a shell (visual mode)

Commands

  • Rename <file name> to rename current file
  • New <file name> to create a file in current buffer dir
  • Delete to delete current file