您的位置:首页 > 其它

C editing with Vim HOWTO

2010-03-18 16:11 253 查看
2 moving around

2.1 w, e, b keystrokes

2.2 {, }, [[, ]] keystrokes

2.3 % keystroke

3 jumping to random positions in C files

3.1 ctags

ctrl-] ctrl-t

3.2 marks

mj 'j

mA 'A upper-case register could span files

3.3 gd stroke

gd means Goto Declaration.

gD will take you to the global declaration of the variable under the cursor.

4. Auto-completing words

ctrl-p ctrl-n

if you want to include foo.h, you can type

#include "f ctrl-x ctrl-f"

:set dictionary=file

ctrl-x ctrl-k

5. Formatting automatically

5.2 Automatically indent code

:set cindent

6. multi-file editing

$vim file1 file2

:n :N

:e# //jump back,toggle between two files

:split :vs ctrl-w ctrl-w

7. Quickfix

:make :cn :cN

:set makeprg=gcc/ test.c
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: