Due to the inconvenience I came across when I play around with config files, patch files, scripts etc, I decide to manage at least one main-stream editor proficiently. And I choose Vim because to the learning process with vimtutor is really a fun to me!
Some How-tos I found useful:
1. How to display with/without color?
Type ":syntax on" or ":syntax off". To change the color theme, type ":colorscheme" and <TAB> to complete your choice
2. How to copy/paste from vim to other application?
There are 2 registers in vim to hold the selection "* and "+. The first is for current selection(which e.g. you select in visual mode) and the second is for real clipboard. Both can be used to exchange info. For the current selection, e.g,
"*yy to yank a line and then "*p to paste it in vim or press the middle button of your mouse in other application. Of course you can just select in visual mode and vice versa
For the real clipboard, e.g,
*yy to yank a line and then "*p to paste it in vim or CTRL-v in other application. It’s just the normal clipboard like in windows.
3.How to move quickly to a word in one line?
Use the "f/F" and "t/T" and repeat it with ";" and ",". This is much faster than pressing "l" and "h".
4.How to get help?
Type":help [keyword]". You can use "CTRL-O" and "CTRL-]" to jump back and forth with hyperlinks or any word. Vim’s help system is very smart and friendly if you can spend a little time learning it. If you have questions, always try to figure it out by turning to help. You’ll find eventually you can solve all the problems on your own
To be continued…
June 9, 2009 at 7:08 pm |
Vim is awesome, one of my often used commands is like sed:
:%s/search/replace/g
Have fun!
June 10, 2009 at 11:07 am |
I would like also suggest / command for quick movement to a word by entering its first few characters (esp. convenient with the incsearch option turned on). It rocks combined with c or d, like d/foo will delete from cursor to the nearest occurence of “foo”.
Also the whole :h text-objects deserve reading as revealing the true nature of vim — combining editing and movement commands
June 10, 2009 at 5:10 pm |
Yeah yeah… I found f/F and t/T very convenient when moving back and forth in a line. Of course repeating it by using “;” and “,” .
June 10, 2009 at 2:44 pm |
There is a shortcut for yy, it’s Y.
June 12, 2009 at 3:26 pm |
Wow. I’ve been using Vim for years and consider myself and advanced user if not an expert.
I didn’t know until now about the yank to the clipboard thing. I alway just select and middle-click. Sometimes it works and sometimes it doesn’t
Thanks for yet another useful Vim command.
I like to use macros a lot and usually have @c for ‘comment’ (adds # at beginning of line) and @t to add a tab. It’s amazing how much repetitive work you can save with macros.