Issue
How can unbind default prefix key in tmux?
I mean the default set by the user, Not necessarily C-b
I do not know what the user has set! So I have to discover the prefix with the command
solution should be in the zsh file and not in .tmux.conf
use
tmux
command takes precedence over Regex
for getting default prefix key I use
$ tmux send-prefix
^[w
when I pipe send-prefix
output to tmux unbind
command, the output is as follows
$ tmux send-prefix | xargs tmux unbind
^[`missing key
if the command return M-q
, I can unbind as following (but not return)
a_command | xargs tmux unbind
Other way is to use Regex for following output (but how?)
$ tmux list-keys | grep send-prefix
bind-key -T prefix M-q send-prefix
please help me...
Solution
Solved, by using awk
!
unbind prefix key
$ tmux list-keys | grep send-prefix
bind-key -T prefix M-q send-prefix
$ tmux list-keys | grep send-prefix | awk '{print $4}'
M-q
$ tmux list-keys | grep send-prefix | awk '{print $4}' | xargs tmux unbind
unbind prefix2 key
$ tmux show-options -g | grep prefix2
prefix2 M-t
$ tmux show-options -g | grep prefix2 | awk '{print $2}'
M-t
$ tmux show-options -g | grep prefix2 | awk '{print $2}' | xargs tmux unbind
if have multi output we can iterate by piping to while
tmux list-keys | grep send-prefix | awk '{print $4}' | while prefix_key line; do
tmux unbind $prefix_key
done
(Similarly for prefix2)
Answered By - njfamirm Answer Checked By - Terry (WPSolving Volunteer)