Vim (@vim_tips) profile picture

Tips for using vim

Everywhere
Joined February 2014
Vim retweeted
System tests have finally taken strong hold at @Basecamp. Can't wait for us to level-up @Rails with great defaults for it in 5.1!
10
43
7
168
‘:e!’ to return to unmodified file
':g/foo/t$’ copy all lines containing ‘foo’ to end of file
‘:g/^\s*$/d’ delete all blank lines
2
1
‘:w %:p.coffee’ will save the file with .coffee added after the existing extension.
‘d/foobar’ delete until foobar match from cursor location
1
1
‘:sort’ to sort selected lines in visual mode
2
3
‘V}J’ to join visual blocks and ‘ggVGJ’ to join all lines in visual mode
2
2
"*y or “+y to copy text from one instance of vim and 'CTRL + v' to paste another instance of vim
1
2
‘CTRL+u’ to delete back to start of line in insert mode
‘gf’ to open a file name under cursor
3
2
Change whole line case 'guu' for lowercase 'gUU' for uppercase
5
1
‘:history’ lists the history of your recent commands
‘:%s/\s\+$//‘ to remove trailing whitespaces
3
1
‘:g/foo/d’ delete all lines containing ‘foo'
3
1
‘:g/rails\|ruby/‘ list all lines containing “ruby” or “rails”
3
1
`. jump to exact spot in last modification line
2
1
‘. to jump last modified line in a file
3
4