简体   繁体   中英

Remap CTRL-A in command line mode

How can I remap my CTRL-A to CTRL-Q in the command line mode?

I use VIM within Tmux session (which has CTRL-A set as a prefix). 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). I would like to use one key stroke <Ca> for that.

I've tried to put cnoremap <Cq> <Ca> to my .vimrc but it doesn't work. Any suggestions?

This works for me; note that in the terminal, Ctrl-S and Ctrl-Q are special sequences for flow control. See here for how to unconfigure that, or use another left-hand side for your mapping, eg <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> ). 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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