110 lines
5.0 KiB
Markdown
110 lines
5.0 KiB
Markdown
#============================================================
|
|
# Neovim Command Reference (Core Commands)
|
|
#============================================================
|
|
|
|
|
|
#============================================================
|
|
# FILE & SESSION MANAGEMENT
|
|
#============================================================
|
|
:w (write) Save current buffer
|
|
:w <file> Write to <file> (does NOT rename buffer)
|
|
:sav (saveas) <file> Save to <file> and rename current buffer
|
|
:q (quit) Quit current window if no unsaved changes
|
|
:q! Force quit (discard changes)
|
|
:wq Write and quit current buffer
|
|
:wqa Write and quit all buffers
|
|
:qa Quit all windows
|
|
:qa! Quit all without saving
|
|
:e (edit) <file> Edit <file> in current window (new buffer)
|
|
:e! Revert buffer to last saved version (discard changes)
|
|
:enew Create new empty buffer
|
|
:r (read) <file> Read <file> into current buffer after cursor
|
|
:ter (terminal) Open terminal buffer
|
|
:clo (close) Close current window
|
|
|
|
|
|
#============================================================
|
|
# BUFFERS
|
|
#============================================================
|
|
:ls (buffers) List open buffers
|
|
:bn (bnext) Go to next buffer
|
|
:bp (bprev) Go to previous buffer
|
|
:b<num> Go to buffer by number
|
|
:b <file> Go to buffer by (partial) name
|
|
:bd (bdelete) [<num>] Delete current (or given) buffer
|
|
:bw (bwipeout) [<num>] Delete buffer and remove from memory
|
|
:bo (only) Close all windows except current
|
|
:e # Edit alternate (previous) buffer
|
|
:b# Switch to alternate buffer
|
|
:b% Re-edit current buffer (no-op)
|
|
:b$ Go to last buffer
|
|
|
|
|
|
#============================================================
|
|
# WINDOWS (SPLITS)
|
|
#============================================================
|
|
:sp (split) [<file>] Split horizontally (optionally open <file>)
|
|
:vsp (vsplit) [<file>] Split vertically (optionally open <file>)
|
|
:new Split with new empty buffer
|
|
:vnew Vertical split with new empty buffer
|
|
:close Close current window
|
|
:only Keep only current window open
|
|
|
|
|
|
#============================================================
|
|
# TABS
|
|
#============================================================
|
|
:tabnew [<file>] Open new tab (optionally edit <file>)
|
|
:tabn (tabnext) Go to next tab
|
|
:tabp (tabprev) Go to previous tab
|
|
:tabm (tabmove) <num> Move current tab to position <num>
|
|
:tabfirst Jump to first tab
|
|
:tablast Jump to last tab
|
|
:tabc (tabclose) Close current tab
|
|
:tabo (tabonly) Close all other tabs
|
|
:tabdo <cmd> Execute <cmd> in all tabs (e.g. :tabdo q)
|
|
|
|
|
|
#============================================================
|
|
# REGISTERS, MARKS & HISTORY
|
|
#============================================================
|
|
:reg (registers) Show register contents
|
|
:marks Show all marks
|
|
:ju (jumps) Show jump list
|
|
:changes Show change list
|
|
|
|
|
|
#============================================================
|
|
# SEARCH / GREP / QUICKFIX
|
|
#============================================================
|
|
:g/{pattern}/d Delete all lines matching {pattern}
|
|
:g!/{pattern}/d Delete all lines NOT matching {pattern}
|
|
:vim /{pattern}/ **/* Search for {pattern} recursively in all files
|
|
:cn (cnext) Jump to next quickfix entry
|
|
:cp (cprevious) Jump to previous quickfix entry
|
|
:cope (copen) Open quickfix window
|
|
:ccl (cclose) Close quickfix window
|
|
:cl (clist) List quickfix entries
|
|
|
|
|
|
#============================================================
|
|
# DIFF MODE
|
|
#============================================================
|
|
:diffthis Start diff mode for current window
|
|
:diffo (diffoff) Turn off diff mode
|
|
:diffu (diffupdate) Recalculate diff
|
|
:diffg (diffget) Get changes from other window
|
|
:diffpu (diffput) Send changes to other window
|
|
|
|
|
|
#============================================================
|
|
# NOTES & SYMBOLS
|
|
#============================================================
|
|
% Current buffer
|
|
# Alternate (last visited) buffer
|
|
$ Last buffer in list
|
|
+ Next buffer
|
|
- Previous buffer
|
|
" Most recently edited buffer (context dependent)
|
|
|