Skip to content

Instantly share code, notes, and snippets.

@gregmark
Last active May 2, 2024 03:10
Show Gist options
  • Save gregmark/e49201df2de7b794239cdc0ed76bbe7d to your computer and use it in GitHub Desktop.
Save gregmark/e49201df2de7b794239cdc0ed76bbe7d to your computer and use it in GitHub Desktop.
VIM Cheats, gregmark I

VIM Help

CTRL-d - lists possible command completions 
TAB - cycles through possible command completions

Example:

:help tags (then CTRL-d and TAB)

Do :help i_ CTRL-d for insert commands, :help v_ for visual, etc.

VIM Navigation

Also, when in the help pages, CTRL-] jumps to subjects between |bars| and CTRL-T jumps back (and, of course, :q to quit).

VIM Pattern Match

Command Description
:g/pattern/d Delete all lines mathching pattern

VIM Splits

Command Description
Ctrl-W s Split window horizontally
Ctrl-W v Split window verticalally
Command Description
Ctrl-W _ Max out the height of the current split
10 Ctrl-W _ Minimize split to 10 lines
Ctrl-W | Max out the width of the current split
10 Ctrl-W | Minimize split to 10 columns
Ctrl-W = Normalize all split sizes, which is very handy when resizing terminal
Command Description
Ctrl-W w Switch windows
Ctrl-W x Exchange current window with next
Ctrl-W q Quit current split
Ctrl-W c Close current split

VIM % Commands

:w !diff % '' do a diff of the file you're editing to see what you have changed

Vim Terminal

Action Command
Ctrl-w N enter normal mode (for scrolling and editing, if enabled; re-enter term with i
:vert term open terminal in vertical window

VIM Special

Reload

:source ~/.vimrc

Atrribution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment