diff --git a/.tmux.conf b/.tmux.conf index d4f063f..4689385 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -6,7 +6,7 @@ set -g default-terminal "screen-256color" # colors! setw -g xterm-keys on set -s escape-time 0 # fastest command sequences -set -s repeat-time 600 # increase repeat timeout +set -sg repeat-time 600 # increase repeat timeout set -s quiet on # disable various messages set -g prefix2 C-a # GNU-Screen compatible prefix @@ -20,7 +20,7 @@ bind C-a send-prefix -2 set -g status-utf8 on # expect UTF-8 setw -g utf8 on -set history-limit 5000 # boost history +set -g history-limit 5000 # boost history # edit configuration bind e new-window -n '~/.tmux.conf' '${EDITOR:-vim} ~/.tmux.conf && tmux source ~/.tmux.conf && tmux display "~/.tmux.conf sourced"' @@ -74,10 +74,13 @@ bind C-c new-session # find session bind C-f command-prompt -p find-session 'switch-client -t %%' -# split current window vertically -bind _ split-window -h -# split current window horizontally -bind - split-window -v +# split current window vertically, retain current path +bind '"' split-window -h -c "#{pane_current_path}" +bind _ split-window -h -c "#{pane_current_path}" +# split current window horizontally, retain current path +unbind % +bind % split-window -v -c "#{pane_current_path}" +bind - split-window -v -c "#{pane_current_path}" # pane navigation bind -r h select-pane -L # move left @@ -165,30 +168,30 @@ run 'for name in $(printenv | grep -Eo ^tmux_conf_[^=]+); do tmux setenv -gu $na # pane_border_fg=colour238 # light gray # pane_active_border_fg=colour39 # light blue # -# tmux set -g pane-border-fg $pane_border_fg \; set -g pane-active-border-fg $pane_active_border_fg +# tmux set -g pane-border-style fg=$pane_border_fg \; set -g pane-active-border-style fg=$pane_active_border_fg # #uncomment for fat borders -# #tmux set -g pane-border-bg $pane_border_fg \; set -g pane-active-border-bg $pane_active_border_fg +# #tmux set -ga pane-border-style bg=$pane_border_fg \; set -ga pane-active-border-style bg=$pane_active_border_fg # # display_panes_active_colour=colour39 # light blue # display_panes_colour=colour39 # light blue # tmux set -g display-panes-active-colour $display_panes_active_colour \; set -g display-panes-colour $display_panes_colour # # # messages -# message_attr=bold # message_fg=colour16 #black # message_bg=colour226 #yellow -# tmux set -g message-attr $message_attr \; set -g message-fg $message_fg \; set -g message-bg $message_bg +# message_attr=bold +# tmux set -g message-style fg=$message_fg,bg=$message_bg,$message_attr # # # windows mode -# mode_attr=bold # mode_fg=colour16 #black # mode_bg=colour226 #yellow -# tmux setw -g mode-attr $mode_attr \; set -g mode-fg $mode_fg \; set -g mode-bg $mode_bg +# mode_attr=bold +# tmux setw -g mode-style fg=$mode_fg,bg=$mode_bg,$mode_attr # # # status line # status_fg=colour253 # white # status_bg=colour232 # dark gray -# tmux set -g status-fg $status_fg \; set -g status-bg $status_bg +# tmux set -g status-style fg=$status_fg,bg=$status_bg # # session_fg=colour16 # black # session_bg=colour226 # yellow @@ -198,7 +201,7 @@ run 'for name in $(printenv | grep -Eo ^tmux_conf_[^=]+); do tmux setenv -gu $na # window_status_fg=colour245 # light gray # window_status_bg=colour232 # dark gray # window_status_format="#I #W" -# tmux setw -g window-status-fg "$window_status_fg" \; setw -g window-status-bg "$window_status_bg" \; setw -g window-status-format "$window_status_format" +# tmux setw -g window-status-style fg="$window_status_fg",bg="$window_status_bg" \; setw -g window-status-format "$window_status_format" # # window_status_current_fg=colour16 # black # window_status_current_bg=colour39 # light blue @@ -206,10 +209,10 @@ run 'for name in $(printenv | grep -Eo ^tmux_conf_[^=]+); do tmux setenv -gu $na # tmux setw -g window-status-current-format "$window_status_current_format" # tmux set -g status-justify left # -# window_status_activity_attr=underscore # window_status_activity_fg=default # window_status_activity_bg=default -# tmux setw -g window-status-activity-attr "$window_status_activity_attr" \; setw -g window-status-activity-fg "$window_status_activity_fg" \; setw -g window-status-activity-bg "$window_status_activity_bg" +# window_status_activity_attr=underscore +# tmux setw -g window-status-activity-style fg=$window_status_activity_fg,bg=$window_status_activity_bg,$window_status_activity_attr # # time_date_fg=colour245 # light gray # time_date_bg=colour232 # dark gray @@ -237,24 +240,24 @@ run 'for name in $(printenv | grep -Eo ^tmux_conf_[^=]+); do tmux setenv -gu $na # } # # maximize_pane() { -# __current_pane=$(tmux display -p '#D') -# +# tmux -V |grep -q '1.9a\?$' && tmux display "tmux 1.9 and 1.9a have a bug that prevent this feature from working" && return +# __current_pane=$(tmux display -p '#{pane_id}') +# # __dead_panes=$(tmux list-panes -s -F '#{pane_dead} #{pane_id} #{pane_title}' | grep -o '^1 %.\+%.\+$' || true) # __restore=$(echo "${__dead_panes}" | sed -n -E -e "s/^1 ${__current_pane} \[\+\](%[0-9]+)$/tmux swap-pane -s \1 -t ${__current_pane} \; kill-pane -t ${__current_pane}/p" -e "s/^1 (%[0-9]+) \[\+\]${__current_pane}$/tmux swap-pane -s \1 -t ${__current_pane} \; kill-pane -t \1/p" ) -# +# # if [ x"${__restore}" = x ] ; then # [ x"$(tmux list-panes | wc -l | sed 's/^ *//g')" = x1 ] && tmux display "Can't maximize with only one pane" && return -# # __window=$(tmux new-window -P "exec maximized+ 2> /dev/null | tmux setw remain-on-exit on && printf '\033]2;%s\033\\' [+]${__current_pane}") # __window=${__window%.*} -# +# # __guard=100 -# while ( [ x"$(tmux list-panes -t ${__window} -F '#S:#I #{pane_dead}')" != x"${__window} "1 ] && [ x"${__guard}" != x0 ] ) ; do sleep 0.01 ; _guard=$((__guard - 1)) ; done +# while ( [ x"$(tmux list-panes -t ${__window} -F '#{session_name}:#{window_index} #{pane_dead}')" != x"${__window} "1 ] && [ x"${__guard}" != x0 ] ) ; do sleep 0.01 ; _guard=$((__guard - 1)) ; done # if [ x"${__guard}" = 0 ] ; then # exit 1 # fi -# -# __new_pane=$(tmux display -p '#D') +# +# __new_pane=$(tmux display -p '#{pane_id}') # tmux setw remain-on-exit off \; swap-pane -s "${__current_pane}" -t "${__new_pane}" # else # ${__restore} diff --git a/README.md b/README.md index e92233b..14b23d9 100644 --- a/README.md +++ b/README.md @@ -5,12 +5,18 @@ Self-contained, opinionated `.tmux.conf` configuration file. ![Screenshot](screenshot.png) +The `master` branch targets tmux 1.9+. You may want to use the `1.7` or `1.8` +branch. + +**Please note that tmux 1.9 and 1.9a SEGFAULT when using the maximize pane +feature. As a consequence, the feature is disabled for those version.** + Features -------- - `C-a` acts as secondary prefix, while keeping default `C-b` prefix - visual theme inspired by [powerline](https://github.com/Lokaltog/powerline) - - [maximize any pane to a new window with `+`](http://pempek.net/articles/2013/04/14/maximizing-tmux-pane-new-window/) (tmux 1.6+) + - [maximize any pane to a new window with `+`](http://pempek.net/articles/2013/04/14/maximizing-tmux-pane-new-window/) (tmux 1.6+, except 1.9 and 1.9a) - mouse mode toggle with `m` - automatic usage of `reattach-to-user-namespace` if available - laptop battery status