vim

 


 

visual mode :

                     insert :

                                ctrl + v

                                select line

                                shift + i

                                key word

                                Esc


 

跳回上一個位置

ctrl + o


 

跳到下一個位置

ctrl + i


顯示完整的檔案路徑及檔名

1 + ctrl + g

 


 

swtich case

~

 


 

 

Word movement

w : moves to the start of the next word

e : moves to the next end of a word


 

Matching a paren

% : moves to the matching paren

      work for () and [] and {}


 

Moving to a character

fx : searches forward in the line for the single character x.

      Hint: "f" stands for "Find".

 The "F" command searches to the left

tx : works like the "fx" command, except it stops one character  before the searched character.

      Hint: "t" stands for "To".

  The "T  " command searches to the left

 

copy

y0 : copy from start of line to current.

y$ : copy from current to end of line.

p : paste

5p : paste 5 times

2yy : copy 2 lines

 


replace

range is the entire file,

search word1, then replace it by word2, need confirm

:1,$s/word1/word2/gc

 


 

gd 查區域變數
gD查全域變數
     追蹤某個變數宣告時,可以用gd或gD去跳轉

 

 


 

dd 刪一整行
dw 刪一個單字,非刪一個字母
dw 刪掉空白至最一個字出現
      ex
              before
              asss   _          ddddd
 
              after
              asss   ddddd
 
d$ 刪至行尾 (含游標的字元)
d^ 刪至行首 (不含游標的字元)

 

http://wen00072.github.io/blog/2018/02/15/vim-setup-for-trace-c-code/#vtr-set-vdplg-tr 

posted @ 2016-12-20 22:09  wangchangruei  阅读(164)  评论(0编辑  收藏  举报