I am using local and remote tmux sessions.
To send commands to the local tmux I use Ctrl-a
, and to the remote Ctrl-q
.
I have tried to disable the number increment that normally executes with Ctrl-a
in vim, but it now triggers with Ctrl-q
and i cannot find a way to disable it.
BTW this happens only when a particular tmux window does not nest a remote one.
Also, I think there still might be a combination of shortcuts in a remote tmux session that also triggers the increment.
So is there a way to completely disable the function? An ideal solution would be to override it with a function that does nothing. That's a very sneaky command, and I had some really terrible debugging experiences in the past because of this!
My tmux.conf:
..
unbind C-b
set -g prefix C-a
bind-key -n C-q send-prefix
...
Then in vim I try to disable both Ctrl-a and Ctrl-q with no-ops.
This is my vimrc:
...
map <Ctrl-A> <Nop>
map <Ctrl-Q> <Nop>
...
I have also tried putting entries for Ctrl-a
and Ctrl-q
but still Ctrl-q
does the increment.
I think the problem is because tmux receives Ctrl-q
and then sends it as prefix which is somehow not caught by my extra mappings.
Cheers, Paschalis
Why it doesn't work
Ctrl
is not a vim-recognized<>
notation to represent a keyboard's Control key.Recommendation
To disable Control-a triggering default vim auto-increment on a number:
In your
~/.vimrc
, as @Marth said, use<C-a>
:Save
:w
:so ~/.vimrc
for it to take effect.Warranty
Explanation
tmux.conf
is sending prefix, which you define as Ctrl-a, so Vim is only receiving Ctrl-aThus you successfully disable the auto-increment when you map Control-a to the do-nothing instruction
<Nop>
Further reading
:help <>