My Vim Tips

[url=http://www.brezeale.com/technical_notes/vim_notes.shtml]Very Useful Notes by Darin Brezeale[/url]

[Basic]
[list]
[*]:cd
[*]:pwd
[*]:e foo.c to edit another file
[*]:e # to jump back to the previous editing file
[*]Ctrl+L redraw whole screen
[/list]
[Compile]
[list]
[*]:make invoke make, and jump to first line of error automatically
[*]:set makeprg=gmake
[*]:set makeprg=gmake\ \CC=gcc296
[*]:clist error list
[*]:cfirst first line of error
[*]:clast last line of error
[*]:cn next line of error
[/list]
[Buffers]
[list]
[*]:buffers
[*]:ls list buffers
[*]:bd delete (close) a buffer
[/list]
[Navigate]
[list]
[*]:<num> go to line <num>
[*]]] / ][ next { / } in the first column
[*][[ / [] previous { / } in the first column
[*]% jump to corresponding brace, #ifdef and #endif
[/list]
[Bookmark]
[list]
[*]m<a-z> mark the position with the the single letter you supplied
[*]'<a-z> jump to the pos mark by the letter
[*]'' jump to the last jump pos
[/list]
[Search]
[list]
[*]/\t search (and may highlight) <Tab>
[*]* search the keyword under cursor
[*]# search previous keyword under cursor
[*]/<CR> redo the last search
[*]:set incsearch incremental search
[*]:set nois disable incremental search
[/list]
[Replace]
[list]
[*]:s/<search>/<replace>
[*]:25, 34 s/foo/bar/gc replace 'foo' between line 25 and 34 with 'bar'
[*] g for do it multi times per line
[*] c for confirmation
[*] region could also be selected in visual (block) mode and invoke through :s
[*]:1, $s/foo/bar/g global replace all foo with bar in current file
[*]%s/foo/bar/g same as above
[/list]
[Highlight]
[list]
[*]:set list display non-printable chars
[*]:set hlsearch highlight matched items
[*]:nohl no highlight when search
[/list]
[Ctags]
[list]
[*]:set tags=<comma separated expression> setup 'tags' file search path, usually './tags,tags,~/mytags'
[*]Ctrl-] jump to the definition of the symbol under cursor
[*]Ctrl-T jump back
[*]:ta /foo tag search for symbol 'foo', stop at the first match
[*]:tn tag search, next match
[*]:tselect select and jump from the tag list (also invoked through g then ctrl-])
[/list]
[Macro]
[list]
[*]q [i]register[/i] Start macro recording into the named register. For instance, qa starts recording and puts the macro into register a.
[*]q End recording.
[*]@register Replay the macro stored in the named register. For instance, @a replays the macro in register a.
[/list]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值