简体   繁体   English

你如何使Vim键映射类似于ZZ?

[英]How do you make Vim key mappings similar to ZZ?

In Vim you can save all your files and quit by typing ZZ . 在Vim中,您可以通过键入ZZ来保存所有文件并退出。 How can I create a similar mapping but for a different key? 如何为不同的密钥创建类似的映射? Some keys like h , j , k , and l it seems like this would not be possible. hjkl这样的一些键看起来似乎不可能。 Are there any keys that you could do a similar mapping to ZZ ? 是否有任何键可以与ZZ进行类似的映射?

Derobert is correct. Derobert是对的。 There is nothing special about the ZZ type of key combination. ZZ类型的组合键没有什么特别之处。

For example, you can create a key shortcut to save all your files without quitting when you type "__" (two underscores) by putting the following in your .vimrc: 例如,通过将以下内容放在.vimrc中,可以在键入“__”(两个下划线)时创建一个快捷方式来保存所有文件而不必退出:

nmap __ :wa<CR>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM