C editing with Vim HOWTO

来源:互联网 发布:最短路径算法dijkstra 编辑:程序博客网 时间:2024/05/18 02:04

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


 

 

 

原创粉丝点击