简体   繁体   English

在命令行模式下重新映射CTRL-A

[英]Remap CTRL-A in command line mode

How can I remap my CTRL-A to CTRL-Q in the command line mode? 如何在命令行模式下将CTRL-A重新映射到CTRL-Q?

I use VIM within Tmux session (which has CTRL-A set as a prefix). 我在Tmux会话(将CTRL-A设置为前缀)中使用VIM。 When I try to insert all files which names match the pattern (ie for :bd command) I have to press CTRL-A twice (as it's also a prefix for tmux). 当我尝试插入名称与模式匹配的所有文件时(即:bd命令),我必须按两次CTRL-A(因为它也是tmux的前缀)。 I would like to use one key stroke <Ca> for that. 我想为此使用一个按键<Ca>

I've tried to put cnoremap <Cq> <Ca> to my .vimrc but it doesn't work. 我试图将cnoremap <Cq> <Ca>放到我的.vimrc中,但是它不起作用。 Any suggestions? 有什么建议么?

This works for me; 这对我有用; note that in the terminal, Ctrl-S and Ctrl-Q are special sequences for flow control. 请注意,在终端中, Ctrl-SCtrl-Q是用于流量控制的特殊序列。 See here for how to unconfigure that, or use another left-hand side for your mapping, eg <Cg> . 有关如何取消配置的信息,请参见此处 ,或者使用另一个左侧进行映射,例如<Cg>

Thank you guys for letting me know that is special key, I wasn't aware of that. 谢谢你们让我知道这是特殊的键,我没有意识到。

In that case I decided to use different key ( <Cb> ). 在那种情况下,我决定使用其他键( <Cb> )。 Key map for that: 关键图:

cnoremap <C-b> <C-a>

I know that <Cb> is for scrolling but I guess in command line mode it should be ok to use that key. 我知道<Cb>用于滚动,但是我猜想在命令行模式下可以使用该键。

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

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