• back to last cursor position

      ctrl-o
    
  • format the code

      gg=G
    
  • apply vim cmd inside a file

      /* vim: set XXX=XXX: */
    
  • fold

      :set foldmethod=XXX   methods(XXX) usually use 'indent' or 'marker'
    

    cmd:

    • zc fold
    • zC fold all
    • zo unfold
    • zO unfold all
    • [z goto current begin
    • ]z goto current end
    • zj goto next fold
    • zk goto last fold
  • undo

      u
    
  • redo

      ctrl-r
    
  • in C file goto header file

      gf   If you encounter "在路径中找不到头文件$#$#%@~", add your path:
    
      set path+=/your/path/1,/your/path/2   *WARNING*, your path is added in the tail, after default path `.` and    `/usr/include`. That means system search file from `.` first, then    `/usr/include`, finally your path. If sequence matters, do this:
    
      set path=.,/your/path/1,/your/path/2,/usr/include
    
Published at 02 December 2012