1

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 (i.e. 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 <C-a> for that.

I've tried to put cnoremap <C-q> <C-a> to my .vimrc but it doesn't work. Any suggestions?

Lucas
  • 502
  • 1
  • 5
  • 15
  • what do you want the `` to do in cmd mode? I don't understand. – Kent Jan 23 '15 at 14:47
  • Today I learned a new command. Thank you. You could also disable your terminal flow control by running `stty -ixon` (in your `~/.bashrc`) which would allow you to use the ``/`` keys – Peter Rincker Jan 23 '15 at 14:51
  • Thank you @PeterRincker, I wasn't aware this key controls terminal flow. – Lucas Jan 23 '15 at 16:16

2 Answers2

1

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, e.g. <C-g>.

Community
  • 1
  • 1
Ingo Karkat
  • 167,457
  • 16
  • 250
  • 324
0

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 (<C-b>). Key map for that:

cnoremap <C-b> <C-a>

I know that <C-b> is for scrolling but I guess in command line mode it should be ok to use that key.

Lucas
  • 502
  • 1
  • 5
  • 15