編輯利器 vim 培訓筆記--入門好幫手

轉載地址:

https://github.com/shawncplus/vim-classes

沒搞明白,爲什麼vim.org不能直接訪問,就是一個編輯器啊。

Joy of Painting[1] with Bob Ross[2]

[1] - Vim
[2] - Shawn Biddle

Modality

三種模式:插入,瀏覽,命令。
Insert  - Brush is on the canvas
Normal  - Brush is off the canvas
Command - Mixing your pallette

Starting Vim

vim <file>
vim, :e <file>  #已經進入vim, 輸入 :e 文件名, 編輯文件。

Pen to the page

i - Enter insert mode at cursor
I - Enter insert mode at first non-blank character
s - Delete character under cursor and enter insert mode
S - Delete line and begin insert at beginning of same line
a - Enter insert mode _after_ cursor
A - Enter insert mode at the end of the line
o - Enter insert mode on the next line
O - enter insert mode on the above line
C - Delete from cursor to end of line and begin insert

This is a test sentence

(Next class will cover 'c')

Picking up the brush

回到瀏覽模式按下面兩個之一
ESC
Ctrl+[

Scanning the canvas

移動:上下左右
    k
    ^
h <   > l
    v
    j

"Why hjkl and not jkl;?"

Because go to the next class

"They invented the mouse, why not use that?"

La la la la, I can't hear you

Getting from a to b: Motions

Basics: wWbBeE

w - Forward to the beginning of next word
W - Forward to the beginning of the next WORD
b - Backward to the next beginning of a word
B - Backward to the next beginning of a WORD
e - Forward to the next end of word
E - Forward to the next end of WORD

Slightly less basic: fFtT All follow [(n)um] syntax

[n]f<o> - Forward until (nth) (o)  (Inclusive)
[n]F<o> - Backward until (nth) (o) (Inclusive)
[n]t<o> - Forward until (nth) (o)  (Exclusive)
[n]T<o> - Backward until (nth) (o) (Exclusive)

abcdefg, abcdefg, abcdefg

Searching

/  - Forward
?  - Backward
*  - Word under cursor - forward  (bounded)
g* - Word under cursor - forward  (unbounded)
#  - Word under cursor - backward (bounded)
g# - Word under cursor - backward (unbounded)
n  - Next result, forward
N  - Next result, backward

(Note here to explain what bounded/unbounded mean)

Copy/Paste

y - Yank. Example: yw (yank word)
p - paste after cursor
P - paste before cursor

vim: set syn=mkd :

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章