Reputation: 21510
I just recently switched to using bash vi mode with set -o vi
setting in my .bash_profile
. But this leads a problem
I had a tmux mapping that would run the clear-history
command when I pressed <ctrl>+k
. This was the relevant mapping
bind -n C-k clear-history
This does not work in bash vi mode, probably because vi mode takes precedence. How do I resolve or work around this issue?
Upvotes: 2
Views: 934
Reputation: 172510
From this question, I have the following tmux mapping:
bind-key -n C-k send-keys -R \; send-keys Escape C-l a \; clear-history
There are many variants of this (each with pros and cons, and for different use cases); see the linked question.
Upvotes: 0
Reputation: 26905
You could change the key, this is what I use:
# reset & clear history
bind r send-keys -R \; send-keys C-l \; clear-history
You have to press ctrl+b+r
k
can indeed be used but if you also move across panels (ctrl + hkjl), it may become confusing.
In any case this work by just using ctrl+k
bind -n C-k send-keys C-l \; run-shell "sleep .3s; tmux clear-history"
Without using the sleep:
bind -n C-k send-keys -R \; send-keys C-l \; clear-history
Upvotes: 2