在vim中,有四個模式
1.Command-Line mode
一開始,開始vim時.均由此模式開始操作.
要編輯資料時,就進入insert mode下(參2)
或刪除資料時,就輸入刪除指令(參3)
for entering commands, e.g. :set number
2.Insert mode
Use only for typing;(由Command-Line mode下,按
1.Command-Line mode
一開始,開始vim時.均由此模式開始操作.
要編輯資料時,就進入insert mode下(參2)
或刪除資料時,就輸入刪除指令(參3)
for entering commands, e.g. :set number
2.Insert mode
Use only for typing;(由Command-Line mode下,按
- i : 在游標所在字元前開始輸入文字(insert)。
- I :在行首開始輸入文字。
- a:在游標所在字元後開始輸入文字(append)。
- A:在行尾開始輸入文字。
在此模式下,可以編輯,仍可移動遊標
3.刪除資料
- x:刪除目前遊標所指的字元 (可用u恢復
- dw:刪除其word
- cw:cw+insert mode
- dd:delete a line at the cursor
- dw:dd+insert mode
- r:取代目前的字元(x+i)
We have discussed about the function of
5.vISUAL SELECTION(可視選擇模式
一般情況下,你要使用剪下時,可直接使用d,(複製,y);(剪下並進入,insert mode.c)
但為了提示選區,可以使用v,(V)用強光提示.
ESC above, ESC can also be used to cancel a command, for example, if you wanna change a word but after typing c, you find out that the cursor is at the wrong position, you can use ESC to cancel the command. =item * Replacement5.vISUAL SELECTION(可視選擇模式
一般情況下,你要使用剪下時,可直接使用d,(複製,y);(剪下並進入,insert mode.c)
但為了提示選區,可以使用v,(V)用強光提示.
- 在可視選擇模式下
- 在非可視選擇模式下
- d{motion}:剪切motion指令跨過的字元到剪貼簿.如:dw,dfS
- y{motion}:複制
- c{motion}:同d,但會進入insert mode
- cc,yy,dd
- D:剪切游標位置到行尾的內容到剪貼薄
- Y:複制當行
- C:同D,但insert
- x:剪切當前字元
- s:同x,但insert mode
在vim稱為暫存器(register),:reg可以列出當前定義的所有register及內容
(" kyy:複制前行到暫存器k中....其暫存器的命名,最好是用小寫字母
沒有留言:
張貼留言