vim 映射 ctrl-;
在我的例子中,右移按钮是 ;
我希望 Ctrl; 将光标向右移动 7 个字符。 我已经尝试了以下 .vimrc 映射,但它不起作用:
nmap
In my case the move-right button is ;
I want Ctrl; to move the cursor 7 characters to the right.
I've tried the below .vimrc mapping, but it doesn't work:
nmap <c-;> 7;
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
就像之前的评论所说,似乎“;”不能采用
形式。您可以测试输入 Ctrl+V + 键序列。
Ctrl+V + ; 仅给出
;
而 Ctrl+V + L 给出^L
。所以我认为 vim 无法识别
。您可以在关键代码帮助页面上获得更多信息:
Like previous comment says, it seems that ";" cannot be in the form
<C-;>
.You can test typing Ctrl+V + key sequence.
Ctrl+V + ; gives only
;
whereas Ctrl+V + L give^L
.So I suppose that vim cannot recognize
<C-;>
.You have some more information on the key codes help pages:
我不确定,但这可能是因为
没有映射到 ASCII 字符。仅@
、AZ
、[
、\
、]
、^与 Ctrl 组合使用时,
和_
映射到 ASCII 字符(分别为 0 到 31)。编辑
我做了一些搜索,发现这个线程。其中,据说
gvim.exe
按照我建议的方式工作:仅使用有效的控制字符,而不使用其他字符。有趣的是,vim.exe
的工作方式不同,您可以进行所需的映射。I am not sure, but it might be because
<C-;>
does not map to an ASCII character. Only@
,A-Z
,[
,\
,]
,^
and_
map to ASCII characters (0 through 31 respectively) when combined with Ctrl.EDIT
I did some searching and found this thread. In it, it is said that
gvim.exe
works the way I suggest: only use valid control characters, no other. Interestinglyvim.exe
works differently and you can do the mapping you want.正如其他人所说
无法映射。最好的解决方案是:
您可以重新映射常规光标键。
像这样的东西也可以工作:
调整窗口大小的其他侧面示例:
As others said
<c-;>
can't be mapped.The best solution is:
You can remap the regular cursor keys instead.
something like this also would work:
Other side example for resizing windows:
您可以使用 sxhkd + xkvbd 破解您的键盘。只是为了给你一个想法,我能够映射 C-LefMouse,这样我的系统就可以识别为 MiddleMouse:
~/.config/nvim/lua/core/utils
在我们的 mappings.lua 中,
想法是让 nvim 识别你的 Ctrl+ ;就好像它可以处理它一样,就像我对这个主要选择解决方案所做的那样。最终,这些想法可以帮助人们找到其他问题的解决方案。
You can hack your keyboard by using sxhkd + xkvbd. Just to give you an idea I was able to map C-LefMouse so my system recognize as if it was MiddleMouse:
~/.config/nvim/lua/core/utils
In our mappings.lua
The idea is to make nvim recognize your Ctrl+; as if it was something it can handle, similarly as I did with this primary selection solution. Eventually, these ideas could help someone figure out solutions for other issues.
在 KDE konsole 终端中,您可以添加按键绑定。
终端右键菜单-->编辑当前个人资料 -->键盘 -->编辑
我添加了这样的值:
然后您可以使用 Ctrl-V Ctrl-; 检查该值在终端。
如果成功打印
^[[9;8~
那么你可以使用 vim 键绑定中的值,像这样你还需要输入 Ctrl-V Ctrl-;为inoremap后的值
In KDE konsole terminal, you can add key bindings.
terminal right click menu --> Edit Current Profile --> keyboard --> Edit
I have added a value like this:
then you can check the value with Ctrl-V Ctrl-; in termnal.
if successfully printed
^[[9;8~
then you can use the value in vim key bindings something like thisyou also need to type Ctrl-V Ctrl-; for the value after inoremap