.tmux: Binding |, - for Window Splits

Created on 21 Apr 2017  路  9Comments  路  Source: gpakosz/.tmux

I'd like to override the bindings for window splitting (prefix + < | > for vert, prefix + < - > for horizontal). Is this possible to do in .tmux.conf.local? I'm concerned about messing up _split_window().

enhancement

Most helpful comment

Hello @cagmz,

You can override bindings from .tmux.conf.local but your overrides won't be influenced by tmux_conf_new_pane_retain_current_path nor tmux_conf_new_pane_reconnect_ssh.

If you want auto ssh reconnection, bind your overrides to _split_window() otherwise bind them to tmux's split-window.

If you want to retain current pane path when splitting, bind your overrides along with -c '#{pane_current_path}'.

I have currently no better solution. The best solution would be to parse existing bindings and "augment" them but that's not trivial.

All 9 comments

Hello @cagmz,

You can override bindings from .tmux.conf.local but your overrides won't be influenced by tmux_conf_new_pane_retain_current_path nor tmux_conf_new_pane_reconnect_ssh.

If you want auto ssh reconnection, bind your overrides to _split_window() otherwise bind them to tmux's split-window.

If you want to retain current pane path when splitting, bind your overrides along with -c '#{pane_current_path}'.

I have currently no better solution. The best solution would be to parse existing bindings and "augment" them but that's not trivial.

Thanks for info. I prefer these bindings too

@kuba-gaj can you please try the upcoming branch? With this branch you don't need to bind prefix + | to run cut -c3- ~/.tmux.conf | shell -s _split_window ... yourself.

Steps to test:

  1. kill tmux (clients and server)
  2. checkout the upcoming branch
  3. edit your ~/.tmux.conf.local copy to add
bind - split-window -v
bind | split-window -h

Hopefully, by now, your own bindings for split-window obey both tmux_conf_new_pane_retain_current_path and tmux_conf_new_pane_reconnect_ssh.

@gpakosz Thank you very much for help.
I gave it a quick try and got:

'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' returned 127

Aw my bad, I forgot to properly escape | when re-injecting commands to tmux bind-key.

I force pushed the branch, can you please do

$ cd ~/.tmux
$ git fetch -p
$ git checkout upcoming
$ git reset --hard origin/upcoming

Then kill tmux (clients and server) and try again?

That fixed the errors but now both binds split window horizontally

Oh right that's because I first made a typo in the comment above but now it's corrected.

That should be

bind - split-window -v
bind | split-window -h

Oh and now I realize both of you @kuba-gaj and @cagmz would be interested in the upcoming enhancements, my bad 馃榾

lol don't know how i missed that. It now works as expected

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kmarhold picture kmarhold  路  3Comments

MadaraUchiha picture MadaraUchiha  路  6Comments

ww7 picture ww7  路  4Comments

mattysweeps picture mattysweeps  路  6Comments

nikolayzhmurov picture nikolayzhmurov  路  5Comments