[英]How does <Plug> work in Vim?
I didn't understand what <Plug>
does and how to use it. 我不明白
<Plug>
做了什么以及如何使用它。 I read the documentation but it is not clear to me. 我阅读了文档,但我不清楚。
<Plug>
is just a special, synthetic key that is never actually sent by the keyboard; <Plug>
只是一个特殊的合成键,从未实际由键盘发送; ie you cannot type it. 即你不能输入它。
With this, the :map
functionality that comes from old vi can be used as an abstraction layer for plugins. 有了这个,来自旧vi的
:map
功能可以用作插件的抽象层。
Instead of directly mapping plugin functionality to a fixed key, plugins define a <Plug>PluginNameFunctionName
mapping, which can then be freely remapped to the desired key by the user. 插件定义了
<Plug>PluginNameFunctionName
映射,而不是直接将插件功能映射到固定键,然后用户可以将其自由地重新映射到所需的键。 As Vim allows to check for existing mappings (via hasmapto()
), plugins can also define a default mapping if none was specified by the user. 由于Vim允许检查现有的映射(通过
hasmapto()
),如果用户没有指定插件,插件也可以定义默认映射。
<Plug>
<Plug>
:map
your own left-hand side to the <Plug>
-mapping(s) provided by the plugin :map
您自己的左侧映射到插件提供的<Plug>
--mapping(s) :help using-<Plug>
:help using-<Plug>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.