[英]Does Vim have a certain syntax to combine commands on command mode?
I noticed some syntaxes when i use vim 我在使用vim时注意到一些语法
for example 例如
[<motion>]<operator><motion>
e.g.
<gg><d><G> // delete from the top of file to the bottom of file
<d><G> // delete from the current line to the bottom of file
and for 和为
<operator><operator>
e.g.
<y><y> // inline copy
<d><d> // inline delete
<>><>> // inline right-indent
OK, something like these. 好,像这样
For the syntax or the way to combine the command i know just a few patterns. 对于语法或组合命令的方式,我只知道几种模式。
And for me i think there are so many ways to combine commands on vim it looks too messy for me 对我来说,我认为有很多方法可以在vim上组合命令,这对我来说太麻烦了
I think Vim should have a basis of command. 我认为Vim应该具有命令基础。
I would like to know that 我想知道
Does vim have a certain syntax to combine the commands? vim是否具有某种语法来组合命令?
Can you give me a further information about this? 您能给我进一步的信息吗?
Think of actions as sentences and commands as words in that sentence: verbs, objects, prepositional phrases, modifiers grouped in that sentence according to a grammar that (like most grammars) has its corner cases but makes a lot of sense overall. 将动作视为句子中的句子和命令,将其视为单词中的动词:动词,宾语,介词短语,修饰语在句子中根据一种语法分组(与大多数语法一样),这种语法有一些极端的情况,但总的来说很有意义。 Hell, Vim even has transitive and intransitive verbs! 地狱,Vim甚至有及物动词和不及物动词!
The basic rules are really quite simple: 基本规则非常简单:
{count}operator{motion}
{count}operator{text-object}
If you have a clear idea of the action you want to perform, using Vim's language is almost friction-less. 如果您对要执行的操作有清晰的了解,那么使用Vim的语言几乎可以轻松解决。
"Cut this block of lines and paste it below the function signature." “剪切这行代码并将其粘贴在函数签名下方。” could become: 可能成为:
dip " cut this paragraph
?func<CR> " move the cursor to the first func above
p " paste
instead of the incredibly convoluted: 而不是令人费解的:
<Home> " move the cursor to the start of the line
<Shift><Down><Down><Down> " select the block I want to move
<C-x> " to cut the selection
<Up><Up><Up><Up><Up><Up><Up> " move up to the target
<End> " move the cursor at the end of the line
<CR> " open a new line
<C-v> " (finally) paste those lines
(edit) (编辑)
The example above stands as a good illustration of the beauty of Vim's editing model: there's very little to none "delta" between what you think and what you actually do. 上面的示例很好地说明了Vim的编辑模型之美:您的想法与实际所做的事情之间几乎没有“增量”。 In more traditional editors, that "delta" can be huge because of all the completely unrelated steps necessary to perform a given task. 在更传统的编辑器中,由于执行给定任务所需的所有完全不相关的步骤,因此“增量”可能很大 。 Because using Vim is like speaking a language with your fingers, you only have to think in that language to be efficient. 因为使用Vim就像用手指说一种语言,所以您只需要以这种语言思考即可。 What you gain from that is more than speed. 您从中获得的不仅仅是速度。
(endedit) (EndEdit中)
"Paste 6 times." “粘贴6次。” becomes the awesome: 变得很棒:
6p " paste 6 times
instead of: 代替:
<C-v><C-v><C-v><C-v><C-v><C-v>
Other interesting rules: 其他有趣的规则:
bwe
) work on keyword characters-delimited words
, 小写运动( bwe
)适用于以关键字字符分隔的words
, BWE
) work on whitespace-delimited WORDS
, 大写运动( BWE
)适用于以空格分隔的WORDS
, FTP
) work just like their lowercase counterparts but in the opposite direction, 一些大写的运算符( FTP
)的工作方式与小写的运算符相反,但方向相反, IA
) work like their lowercase counterparts but on the extremities of the line, 一些大写操作员( IA
)的工作方式与小写操作员相同,但是在线路的末端, YCDVS
), like doubled lowercase operators ( yyddcc
) are shortcuts for very common operator{motion}
sentences… 其他一些大写的运算符( YCDVS
),例如加倍的小写运算符( yyddcc
)是非常常见的operator{motion}
句子的快捷方式… Glts has written an awesome article on the subject. Glts在该主题上写了一篇很棒的文章 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.