vim grammar

2021-05-05  本文已影响0人  一口亅

verb + noun

Nouns (Motions)

h Left
j Down
k Up
l Right
w Move forward to the beginning of the next word
} Jump to the next paragraph
$ Go to the end of the line

Verbs (Operators)

y Yank text (copy),你可以用p(光标后)或p(光标前)粘贴它。
d Delete text and save to register
c Delete text, save to register, and start insert mode
gU 大写

Verb And Noun

y$ 复制从当前位置到行末
dw 删除从当前位置到下一个单词开始
c} 从你当前的位置更改到当前段落的结尾

也可以加数字
y2h 向左拉两个字符

dd, yy, and cc perform deletion, yank, and change on the entire line.

More Nouns (Text Objects)

i + object Inner text object
a + object Outer text object、

di( 删除括号内的但不删除括号
da( 删除括号和里面的文本

w         A word
p         A paragraph
s         A sentence
( or )    A pair of ( )
{ or }    A pair of { }
[ or ]    A pair of [ ]
< or >    A pair of < >
t         XML tags
"         A pair of " "
'         A Pair of ' '
`         A pair of ` `
:h text-objects

可组合性

Vim有一个过滤操作符(!),用于使用外部程序作为文本的过滤。

!}column -t -s "|"
!}column -t -s "|" | awk 'NR > 1 && /Ok/ {print $0}'
表格化并显示ok行
上一篇 下一篇

猜你喜欢

热点阅读