Profile_bird

Hey there! vimtips is using Twitter.

Twitter is a free service that lets you keep in touch with people through the exchange of quick, frequent answers to one simple question: What's happening? Join today to start receiving vimtips's tweets.

Already using Twitter
from your phone? Click here.

vimtips

  1. % matches opening and closing chars (){}[], and with matchit.vim, def/end, HTML tags, etc. as well! http://is.gd/N4W
  2. 40,50m30 will move lines 40 through 50 to line 30. Most visual mode commands can be used w/ line numbers. http://is.gd/cCHy
  3. :%s#.*(hours).*#1# will delete everything on a line except for the string 'hours'. http://is.gd/4xZW
  4. * # g* g# each searches for the word under the cursor (forwards/backwards) http://is.gd/7Onk
  5. In gvim, change the cursor depending on what mode you are in (normal, insert, etc): http://is.gd/9dq0
  6. ; is a motion to repeat last find with f. f' would find next quote. c; would change up to the next ' (via @techpickles) http://is.gd/qZIs
  7. From a command-line, vim scp://username@host//path/to/file to edit a remote file locally. (See http://is.gd/9dwq for dependencies.)
  8. /joe/+3 will search for joe and place the cursor three lines below the match. http://is.gd/4xZW
  9. /< CTRL-r >< CTRL-w > will pull the word under the cursor into search. http://is.gd/7Onk
  10. Basic commands 'f' and 't' (like first and 'til) are very powerful. See :help t or :help f. http://is.gd/cCHy
  11. Count the number of occurences of a word in a file with :%s/<word>//gn
  12. /.*fred&.*joe/ will search for fred AND joe, in any order. http://is.gd/4xZW
  13. /fred\_s*joe/ will search for fred AND joe with whitespace (including newline) in between. http://is.gd/4xZW
  14. /joe/e+1 will search for joe and place the cursor at the end of the match, plus on character. http://is.gd/4xZW
  15. < CTRL-n >< CTRL-p > offers word-completion while in insert mode. http://is.gd/7Onk
  16. :set foldmethod=syntax to make editing long files of code much easier. zo to open a fold. zc to close it. See more http://is.gd/9clX
  17. :vimgrep pattern **/*.txt will search all *.txt files in the current directory and its subdirectories for the pattern. http://is.gd/8epA
  18. /fred|joe/ will search for either fred OR joe. http://is.gd/4xZW
  19. :%s/^ \ n \{3}// will delete a block of 3 empty lines. (remove the spaces) http://is.gd/4xZW
  20. Ctrl-a, Ctrl-x will increment and decrement, respectively, the number under the cursor. http://is.gd/4xZW