Skip to content

Instantly share code, notes, and snippets.

@ihcsim
Last active November 19, 2017 17:54
Show Gist options
  • Save ihcsim/3a264f563948a9c7d52d to your computer and use it in GitHub Desktop.
Save ihcsim/3a264f563948a9c7d52d to your computer and use it in GitHub Desktop.
vim cheat list

vim Cheat Sheet

A list of vim commands I found helpful.

Table of Contents

Buffers

  • List all open buffers: :ls
  • List current directory: :pwd
  • Change to other directory: :cd
  • Split buffers horizontally: :sp <file> or ctrl-w s with :edit <file>
  • Split buffers vertically: :vsp <file> or ctrl-w v with :edit <file>
  • Close other buffers: only
  • Cycle through all buffers: ctrl-w w
  • Resizing buffers:
    • Increase size: ctrl-w +
    • Decrease size: ctrl-w -
    • Equal sizes : ctrl-w =
    • Maximize horizontally: ctrl-w _
    • Maximize vertically: ctrl-w |
  • Rotating buffers:
  • Rotate all buffers clockwise: ctrl-w r
  • Rotate all buffers anti-clockwise: ctrl-w R
  • Swap current windows with its immediate neighbour: ctrl-w x
  • Moving current buffer:
  • Move upward: ctrl-w K
  • Move downward: ctrl-w J
  • Move left: ctrl-w H
  • Move right: ctrl-w L

Tabs

  • Edit file in new tab: :tabedit <file>
  • Move a buffer into its tab: ctrl-w T
  • Close a tab: :tabclose
  • Close all other tabs: :tabonly
  • Rotate through all tabs closewise: gt
  • Rotate through all tabs anticlockwise: gT
  • Navigate directly to N-th tab: Ngt where N = 1,2,3,...
  • Re-ordering tabs
  • Move a tab to the end: :tabmove
  • Move a tab to the beginning: :tabmove 0
  • Move a tab to follow after tab 1: :tabmove 1

Command Line Windows

  • Open command-line windows: q: or :ctrl-f
  • Open command-line search windows: q\
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment