Jelajahi Sumber

Fix tmux options for 2.1+

Changes:

- Window flag indicator (`#F`) no longer leaves a space when there are
  no flags. Use a conditional instead.

- Mouse options are compacted.
Weiyi Lou 10 tahun lalu
induk
melakukan
dca5434207
6 mengubah file dengan 26 tambahan dan 18 penghapusan
  1. 6 9
      tmux/tmux.conf
  2. 11 0
      tmux/tmux1.conf
  3. 4 0
      tmux/tmux2.conf
  4. 2 2
      tmux/tmuxcolours.conf
  5. 0 7
      tmux/tmuxcolours19.conf
  6. 3 0
      tmux/tmuxcolours2.conf

+ 6 - 9
tmux/tmux.conf

@@ -1,3 +1,5 @@
+# vim: ft=tmux
+
 # Use `Ctrl-A` as the tmux command prefix instead of `Ctrl-B`.
 unbind-key C-b
 set-option -g prefix C-a
@@ -22,15 +24,6 @@ set-option -g visual-activity on
 # current window, rather than the smallest session to which it is attached.
 set-window-option -g aggressive-resize on
 
-# Mouse Support! (for scrollback, and lazy manipulation of windows/panes)
-# At least with iTerm2, this plays very well with vim mouse support :D Yay!
-# Note: text-selection by default does a tmux copy (paste with prefix+]).
-# Hold alt/meta/option for system selection/copy.
-set-option -g mode-mouse on
-set-option -g mouse-select-pane
-set-option -g mouse-resize-pane on
-set-option -g mouse-select-window on
-
 # Act like vim.
 set-option -g status-keys vi
 set-window-option -g mode-keys vi # vi keys in copy mode (prefix+[)
@@ -94,5 +87,9 @@ bind-key C-s choose-session
 bind-key X kill-session
 # Remember prefix+$ for renaming sessions.
 
+# Version-specific configuration.
+if-shell '[[ `tmux -V | sed "s/[tmux |\.]//g"` < 21 ]]' 'source-file ~/dotfiles/tmux/tmux1.conf'
+if-shell '[[ `tmux -V | sed "s/[tmux |\.]//g"` -ge 21 ]]' 'source-file ~/dotfiles/tmux/tmux2.conf'
+
 # Colours and status line.
 source-file ~/dotfiles/tmux/tmuxcolours.conf

+ 11 - 0
tmux/tmux1.conf

@@ -0,0 +1,11 @@
+# vim: ft=tmux
+# Settings for tmux pre-2.1
+
+# Mouse Support! (for scrollback, and lazy manipulation of windows/panes)
+# At least with iTerm2, this plays very well with vim mouse support :D Yay!
+# Note: text-selection by default does a tmux copy (paste with prefix+]).
+# Hold alt/meta/option for system selection/copy.
+set-option -g mode-mouse on
+set-option -g mouse-select-pane
+set-option -g mouse-resize-pane on
+set-option -g mouse-select-window on

+ 4 - 0
tmux/tmux2.conf

@@ -0,0 +1,4 @@
+# vim: ft=tmux
+# Settings for tmux 2.1+
+
+set-option -g mouse on

+ 2 - 2
tmux/tmuxcolours.conf

@@ -1,4 +1,5 @@
 # vim: ft=tmux
+
 # Default status line options.
 set-option -g status on
 set-option -g status-utf8 on
@@ -49,5 +50,4 @@ set-option -g display-panes-colour colour166 #orange
 # clock
 set-window-option -g clock-mode-colour colour64 #green
 
-# Some instructions above are deprecated in 1.9+ so rewrite them where necessary.
-if-shell '[[ `tmux -V` == *1.9* ]]' 'source-file ~/dotfiles/tmux/tmuxcolours19.conf'
+if-shell '[[ `tmux -V | sed "s/[tmux |\.]//g"` -ge 21 ]]' 'source-file ~/dotfiles/tmux/tmuxcolours2.conf'

+ 0 - 7
tmux/tmuxcolours19.conf

@@ -1,7 +0,0 @@
-# vim: ft=tmux
-# Version 1.9 introduces the foo-style options, applicable to version 1.9+
-set -qg status-style fg=colour231,bg=colour234
-#set -qg window-status-last-style fg=colour31
-#set-window-option -qg window-status-style fg=colour249
-#set-window-option -qg window-status-activity-style fg=yellow,none
-#set-window-option -qg window-status-bell-style fg=red,none

+ 3 - 0
tmux/tmuxcolours2.conf

@@ -0,0 +1,3 @@
+# vim: ft=tmux
+
+set-option -g window-status-format "#[bg=colour234] #[fg=colour244]#I#[fg=red]#{?window_last_flag,=, }#[fg=colour249]#W "