Windows键可以在Vim中映射吗? [英] Can Windows key be mapped in Vim?

查看:257
本文介绍了Windows键可以在Vim中映射吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Emacs中使用Windows键作为Meta是非常有用的,在Vim中有办法吗?

解决方案

即使必须在终端中,您也绝对可以使用它,尽管您必须将其用作元键(我发现没有办法单独使用它).

使用vim编辑.vimrc文件.假设您想在正常模式下重新映射Win+q退出vim. 只需添加您的映射,然后在尝试指示您的快捷方式时,按Ctrl+V,然后按Win+q.

这会在文件中添加类似于^X@sq的内容(但请勿直接键入^X特殊字符).

最后,您的行应如下所示:

nnoremap ^X@sq :q<CR>

保存并退出,再次启动vim,就是这样.

注意:Ctrl+v在插入模式下按原样插入跟随键/组合键.有关更多信息,请尝试在Vim中使用:help i_CTRL-V.

Using Windows key as Meta is very useful in Emacs, is there the way to do it in Vim?

解决方案

You definitely can, even in terminal, although you have to use it as a meta key (I found no way to use it on its own).

Edit your .vimrc file with vim. Say you want to remap Win+q in normal mode to quit vim. Simply add your mapping and, when trying to indicate your shortcut, press Ctrl+V, then Win+q.

This will add something similar to ^X@sq to your file (but do not type it directly, the ^X is a special character).

In the end your line should look like:

nnoremap ^X@sq :q<CR>

Save and quit, launch vim again, and that's it.

Note: Ctrl+v in insert mode inserts followoing key/combination of keys literally. For more info try :help i_CTRL-V in vim.

这篇关于Windows键可以在Vim中映射吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆