Reference

[1]無插件Vim編譯技巧

http://coolshell.cn/articles/11312.html

介紹了蠻多好用的技巧

 

 


 

Movement:

上-下-左-右 (normal mode):

k - j - h - l

 

Move to foreward word

w

 

Move to backward word

b

 

移動到當行的最前面(Move to forefront of line):

g^

 

移動到當行的最後面(Move to aftermost of line):

g$

 

Scroll up half a screen

<C-u>

 

Scroll down half a screen

<C-d>

將畫面切換到以游標置中的位置

zz

 

將畫面切換到以游標置頂的位置

zt

 

將畫面切換到以游標置底的位置

zb

 

回到游標的上一個位置

<C-O>

 

跳到游標的下一個位置

<C-I>

 

跳到該檔案的內容下(需有absolute path)

gf

 

Move to matched braces

%

Bookmark:

在vim可以使用a~z共27個英文字來設定bookmark.

Add a bookmark

ma

 

Go to a bookmark

`a

 

Window operation:

Move between windows

C-W <direction key>

 

Expand current window

C-W |

 

Equal size for all windows

C-W =

 

Word operation:

Search word

/word

 

Highlight all occurences of a word

*

 

Replace all words under a document

:%s/before/after/g

  • % means that we want to search whole document.

  • g means replace globally

 

Replace all words under a line

:s/before/after/g

 

Highlight the word searched

:hlsearch

 

Cancel the word highlighted

:noh

 

Delete a word

daw

 

Delete a word and enter insert mode

ciw

 

Character operation (in normal mode)

Delete a character

x

 

Replace a character

r <old><new>

 

Open file

Open another file

e fileName

 

Open a file vertically

Ve

 

Open a file horizonitally

He

 

Open a file by another page

Te

 

Jump to next page

gt

 

List the opened files in buffer

:ls

 

Jump to the file in buffer

:b <number>

arrow
arrow
    全站熱搜

    JerryCheng 發表在 痞客邦 留言(0) 人氣()