Cheatsheet
Movement
h,j,k,l: Move cursor left, down, up, rightw,b: Jump forwards / backwards single wordW,B: Jump forwards / backwards single ‘word’ (black separated)0,$: Jump to the start / end of the line^: Jump to the first non-blank character of the line%: Jump to matching character (e.g.,(),{},[])gg,G: Jump to the beginning / end of the filef_,F_: Jump to next / previous occurrence of_t_,T_: Jump to after next / previous occurrence of_;: Repeat last jump},{: Jump to next / previous paragraphzz: Centre cursor on screen<C-e>,<C-y>: Move screen down / up one line, without moving cursor<C-b>,<C-f>: Move screen down / up one page, moving cursor to the last / first line<C-d>,<C-u>: Move screen down / up half page
Insert / Edit
i,a: Insert mode before / after the cursorI,A: Insert mode at the beginning / end of the lineo,O: Insert a new line below / above the current line and enter insert moder: Replace a single character.R: Replace character until pressingESC.J,gJ: Join the line below to the current one, with / without single space inbetweencc(=S): Replace entire lineu,C-r: Undo / Redo.: Repeat last command
Visual
v: Start visual modeV: Start linewise visual modeo: Move to the other end of the marked areaa_,i_: Around / Inside_- e.g.,
aw: Around word,i(: Inside()
- e.g.,
y: Yank marked textd: Cut marked text~: Switch caseu,U: Change to lowercase / uppercase>,<: Shift text right / left<C-a>,<C-x>: Increment / decrement by[count]the number or alphabetic character in the highlighted textg<C-a>,g<C-x>: Same as<C-a>/<C-x>but if several lines are highlighted, each will be incremented / decremented by an additional[count]:set wrap: Wrap text around terminal
Macros / Registers
@_: Run macro in register_@@: Rerun last macro run
:reg: Show registers content"_y,"_p: Yank to / paste from register_"+y,"+p: Yank to / paste from system clipboard registerq_: Record macro to register_q: Stop recording
Search / Replace
/_,?_: Search forwards / backwards for pattern_n,N: Next / previous in search results:[range]s/{pattern}/{string}/[flags] [count]: For each line in[range]replace a match of{pattern}with{string}- Flags
c: Confirm each substitutione: When the search pattern fails, do not issue an error message and continue in maps as if no error occurredg: Replace all occurrences in the linei,I: Ignore / do not ignore case for the patternn: Report the number of matches, do not actually substitute
- Flags
<C-q>: Add search results to quickfix list (e.g., after telescope search):cdo {command}: Runs a command on each line in the quickfix list:cfdo {command}: Runs a command on each file in the quickfix list
Buffer
:enew: Open new empty buffer:bd: Close current buffer:bd {BUFNO}: Close a specific buffer with number{BUFNO}:bd!: Force close buffer without saving:bufdo bd: Close all buffers except the current one:bufdo bd!: Close all buffers except the current one without saving
Miscellaneous
Diff View
- Open the
diffview betweenfile1.txtandfile2.txtnvim -d file1.txt file2.txt
Neovim Related
Noice
:Noice: View notifications history:Noice telescope: View notifications history in Telescope