Skip to content

Instantly share code, notes, and snippets.

@joejag
Created April 11, 2012 20:56
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save joejag/2362518 to your computer and use it in GitHub Desktop.
Save joejag/2362518 to your computer and use it in GitHub Desktop.
VIM Cheatsheet for Joe
MOVEMENT
* Basic movement: h j k l (left, down,up, right)
* Word movement: w b (next, back) W B (ignore punct)
* Number powered movement: 3w
* Start of line: 0, end $
* Start doc: gg, end: G, line: 6G
* Next page: CTRL+f, Back page: CTRL+b, 1/2 versions: CTRL+d, CTRL+u
* Last postion in another file jumping: CTRL+0, CTRL+TAB (back, forward)
SEARCH
* Search /text, n and N to move
* Find a character: f[char] F[char] (next, previous), ; and , to repeat
* Matching parens: %
* Find word under cursor * and #
INSERT/DELETE
* Insert/Append start/end: I A
* Delete to end of line: D
* Clear current line; to insert mode: S
* Insert new line: o and O (below or above)
* Delete x, backspace X
* Replace under cursor: r
* Delete word with: d (like d2w for deleting 2 words)
VISUAL
* Visual mode: v (character orientated)
* Visual mode: V (line orientated)
* Visual mode: CTRL+V (Block visual select rectangles of text)
COPY/PASTE
* Copy current line: yy
* Paste copied text after cursor: p
COMMENTING OUT CODE
* Comment: CTRL+V (select lines) I#
* Uncomment: CTRL+V (select lines) X
MISC
* Repeat command with: .
* Undo: u, redo: CTRL+R
* Autocomplete word: CTRL+P
* open file: :e [file]
TABS
* New tab: :tabnew
* Switch tabs (forward): gt
* Switch tabs (backwards): gT
* Switch tabs (to tab number): {i}gt
* Open files: tab -p *.log
WINDOWS
* Ctrl-W s for horizontal splitting
* Ctrl-W v for vertical splitting
* Ctrl-w q to close one
* Change window: CTRL+W [direction]
LINKS
* Intro: http://blog.interlinked.org/tutorials/vim_tutorial.html
* Official: http://vimdoc.sourceforge.net/htmldoc/usr_toc.html
* Plugins: http://spf13.com/post/ultimate-vim-config
* Keyboard cheat sheet: http://walking-without-crutches.heroku.com/image/images/vi-vim-cheat-sheet.png
* Highest rated plugins: http://vim.sourceforge.net/scripts/script_search_results.php?order_by=rating
* Poster Cheatsheet: https://cdn.shopify.com/s/files/1/0165/4168/files/preview.png
VIMRC FOR INSPIRATION
* https://github.com/spf13/spf13-vim/blob/3.0/.vimrc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment