Starting in tmux 1.9 the default-path
option was removed, so you need to use the -c
option with new-window
, and split-window
(e.g. by rebinding the c
, "
, and %
bindings to include
-c '#{pane_current_path}'
). See some of the other answers to this question for details.
A relevant feature landed in the tmux SVN trunk in early February 2012. In tmux builds that include this code, tmux key bindings that invoke new-window
will create new a window with the same current working directory as the current pane’s active processes (as long as the default-path
session option is empty; it is by default). The same is true for the pane created by the split-window
command when it is invoked via a binding.
This uses special platform-specific code, so only certain OSes are supported at this time: Darwin (OS X), FreeBSD, Linux, OpenBSD, and Solaris.
This should be available in the next release of tmux (1.7?).
With tmux 1.4, I usually just use
tmux neww
in a shell that already has the desired current working directory.
If, however, I anticipate needing to create many windows with the same current working directory (or I want to be able to start them with the usual <prefix>c
key binding), then I set the default-path
session option via
tmux set-option default-path "$PWD"
in a shell that already has the desired current working directory (though you could obviously do it from any directory and just specify the value instead).
If default-path
is set to a non-empty value, its value will be used instead of “inheriting” the current working directory from command-line invocations of tmux neww
.
The tmux FAQ has an entry titled “How can I open a new window in the same directory as the current window?” that describes another approach; it is a bit convoluted though.
For releases prior to 2012: Issue the command only once, with all the desired prefix keys separated by commas:
set-option -g prefix C-a,C-b
For versions >= 1.6 (Released the day before your question, 23/01/2012) see the other answer.
Best Answer
Super_L
is an X keysym. Tmux runs in a terminal. It is up to your terminal emulator to transform a keysym into a character sequence. So you would have to configure both your terminal emulator and tmux.Looking at the tmux documentation, the prefix can only been a known key name with an optional modifier. So you can set the tmux prefix to a key combination you don't use, say
M-F12
, and get your terminal to send the character sequence forM-F12
when you pressSuper_L
. With a little more work, you could use a key that your keyboard probably doesn't have (tmux acceptsF13
throughF20
as key names, but they have to be declared in terminfo).On the terminal emulator side, you would have to arrange for
Super_L
to generate the key sequence\e\e[24~
(forM-F12
) or\e[34~
(forF20
) (where\e
is the escape character). How to do this depends on the terminal emulator (and some aren't configurable enough to do it). With xterm, it's done through X resources:You may hit a snag that
Super_L
is normally a modifier, and modifier keys don't always work when a non-modifier is required. If you don't wantSuper_L
to be a modifier, you can take its modifier away, or (less confusingly) use a different keysym for the physical key. This can be done through xmodmap (old-fashioned and simple to understand), through xkb (the modern, poorly-documented, powerful and complex way), or perhaps through your desktop environment's GUI configuration tool.