I spend almost all day programming in Vim and I am sure that a lot of you do too. What features do you use that make your day to day coding that much better? One that I use is gv, which will let you reselect the previously selected text. It is great for reindenting!
closed as not constructive by 8088, Sathya♦ Aug 31 '11 at 4:07
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or specific expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, see the FAQ for guidance.
|
Normally, though, I use |
|||||||
|
|
I'm a former user of TextPad, and had memorized many of that program's accelerator keys. One of the first things I did in Vim was learning the map function to keep consistency (F5 search, F8 replace, etc.). I created my personal colorscheme, and borrowed alot from others' vimrc files. Viva Vim! Configurable to any degree. |
||||
|
|
Hitting the . key repeats the previous command. Lovely for, say, editing an |
||||
|
|
I heavily use following commands while writing or traversing C/Tcl/Perl code: copy-paste code
start selecting code using command
Code level traversals (requires coding style discipline)
Search
All the above commands can be prepend with a number to signify how many times to execute it. The realization of the power of this additional dimension comes slowly as one uses vim more and more and challenges oneself to improve. |
||||
|
|
|
ZZ save and exit (instead of :wq!) |
||||
|
|
|
|
|||||
|
|
Where to start... Here's the things I can recall I've used in the last 5 minutes or so.
|
||||
|
|
I am always using gq to re-do line breaks on email, text files, etc. Really useful when replying to email (I use pine) and editing multiple previous replies. |
||||
|
:%s/x/y/g This command replaces all instances of x in the current file with y. This is basically just a find and replace, but I use it so often since I've learned it at work that it has become invaluable. Also, /search string then n to navigate through all instances of the search string within the file. Great for doing manual tweaks a lot more easily, especially if you can't apply a rule to the entire file. |
|||||||||
|
|
The I've been asked to explain the tee trick. Basically, it allows you to save a text file with admin priveleges, even if you didn't start VIM as root:
|
|||||||
|
|
Use |
|||||
|
gv. :) – Nathan Long Feb 1 '11 at 17:41