Skip to content

Instantly share code, notes, and snippets.

@flov
Created July 10, 2012 00:47
Show Gist options
  • Save flov/3080241 to your computer and use it in GitHub Desktop.
Save flov/3080241 to your computer and use it in GitHub Desktop.
Learn Vim with it's most powerful commands, a brief description of the tips and tricks that I know and use day in day out
:r! echo '<p>PASTE IN</p>' | html2haml <--- Converts pasted code to haml
:r! rake routes <---- inserts output of rake routes in current file
Commands to explain:
- o, O, insert line below/above and change to insert mode
- A, go to insert mode at the end of line
- D, delete line from cursor till the end, does not jump into insert mode
- C, delete line from cursor till the end, jumps into insert mode
- f<character>/F<character> find next/previous character
- ci" ci' ci} ci) ca) ci) EXAMPLE: how to change what is inside the brackets in 'render_template(:edit)'
- difference between c, s and d: c changes the selected text and jumps to
insert mode, d deletes without going to insert mode, s substitutes whole
lines and does not jump into insert mode either
- Ctrl-Shift ^, loads the file in the window which has been loaded last
- Shift-j and pq, shift-j joins the line below with the current line, pg formats the text
- gg, G jump to the end/beginning of the file
- map jj to Ctrl-C to jump out of insert mode
- cd and e command
How to use . to repeat commands
How and when to use Ctrl-C with capslock
How to split windows and work in one window
Plugins to explain
Searching strings over files with Ack
Ctrl-P
Vim Fugitive
NERD Tree
MRU
:rextract
Rails plugin
Direct response on failing code in texteditor
All vim commands are related to the browser plugins vimium, vimperator
More:
Vimcasts
Vim Book
Vim Golf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment