Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In ~/.tmux.conf, with

 bind-key v split-window "vim"

I can launch vim in a split window.

how I can use two keys in a tmux bind-key ?

 bind-key vG split-window "vim +$"
share|improve this question
up vote 2 down vote accepted

You cannot. tmux only allows single-key bindings (either alone, using bind-key -n, or following the prefix key).

However, you might try binding "v" to an invocation of command-prompt:

bind-key v command-prompt "tmux-vim.bash %%"

where tmux-vim.bash looks something like

if [ $1 = "G" ]; then
    tmux split-window "vim +$"

Then, after typing v to get to the command prompt, you would just type "G" and press Enter. "G" would be passed as the argument to tmux-vim.bash, and that script would take care of executing the tmux command you (originally) wanted to associate with "vG".

share|improve this answer
You'd think I would have remembered answering that well enough to link to it myself :) – chepner Jul 10 '12 at 12:32

As @chepner said, you cannot do this directly. What you can do is bind v to create a binding for G that does what you want and then unbinds itself.

bind-key v bind-key -n G split-window "vim +$" \\; unbind -n G

There are a couple of important things to note with this approach:

  1. This will conflict with existing top-level bindings (in this case G); If you want to have something bound to G and something else bound to vG your unbinding step needs to restore the original binding.
  2. tmux will segfault if your .tmux.conf includes a bind-key statement that is too long. If this becomes a problem, you can work around it by putting your context switching in bash scripts and then bind a key to run those scripts.

For a more involved example, see this gist.

share|improve this answer

Beyond the command-prompt approach suggested on the other answers, you can have a second set of mappings using a different prefix:

     prefix key
         Set the key accepted as a prefix key.

     prefix2 key
         Set a secondary key accepted as a prefix key.

Thus you could do the following:

set -g prefix C-v
bind-key G split-window "vim +$"

to map to c-v g instead of c-b vG. The downside is that it will shadow any default mapping, as it will also be accessible through c-b g.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.