VI(M)的使用經驗起自文字終端機的時代,包括最早的行編輯器,到全螢幕編輯。晚近則是ECO時手動修改NETLIST的經驗,一 般的EDITOR碰到體積龐大的NETLIST(印象好像是幾百MB,或是GB等級),會轉不過來,或轉不動,但是VI卻依然輕鬆自如。VIM號稱是Linux的標準瑞士刀,從小型的EMBEDDED裝置到各式PC(包括MACOS),伺服器,都可見其蹤影。桌面環境,包括Windows,也有GVIM(視窗版)可用。可以說,以此一招,可以闖江湖矣!
最近的經驗是DDR4 Behavior Model的開發,環境則是 Red Hat Linux 桌面,這次算是比較長時間持續地使用,所以把VIM的一些經驗整理存參。
REF
最近的經驗是DDR4 Behavior Model的開發,環境則是 Red Hat Linux 桌面,這次算是比較長時間持續地使用,所以把VIM的一些經驗整理存參。
- Motion
- $ ## end of the line
- 0 ## start of the line
- ^ ## the 1st none-space char of the line
- g_ ## last none-space char of the line
- w,W ## next word/WORD start
- e,E ## next word/WORD end
- b,B ## prev word/WORD start
- ge,gE ## prev word/WORD end
- G ## end of the file
- gg ## start of the file
- fC ## find right occurrence of `C` on the current line
- FC ## find left occurrence of `C` on the current line
- ; ## find again on the current line
- :set number ## show line number
- :100 ## goto line 100
- 100G ## goto line 100
- 3w ## next 3 word
- /pattern ## search pattern forwardly
- ?pattern ## search pattern backwardly
- /\<word\> ## search word matched
- *,# ## search word matched at current cursor for/back
- n ## search, next forward one
- N ## search, next backward one
- ctrl+F ## page forward
- ctrl+B ## page backward
- text object: chunk of text, word, sentence, and paragraph
- aw a word (includes surrounding white space)
- iw inner word (does not include surrounding white space)
- it Applies to everything in current xml/html tag
- i{ Applies to everything inside nearest curly brackets
- as A sentence
- is inner sentence
- ap a paragraph
- ip inner paragraph
- Verbs(Command)
- x Delete character under the cursor
- r Replace character under cursor with another character
- s Delete character under cursor and move to insert mode
- d Delete text specified by motion
- c Delete text specified by motion and go into insert mode
- y Yank (copy) text specified by motion
- v Visual selection(V for line vs. character)
- Combining Verbs with Motions
d$
delete to the end of the linecf)
change through the next closing parenthesesyG
copy everything through the end of the file- ciw change in word
- daw dele a word
- ci( change inner ()
- yit copy the contents of an html tag
- yy yanks the current line
- dd deletes the current line
- cc changes the current line
- 一般型式
- 一次:
- 移動:
REF
沒有留言:
張貼留言