From 73da0681ef299948f77c3e1c3452145012f31a3e Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Thu, 15 Jun 2017 14:56:14 +1200 Subject: Remove color/colour templating from tmux.conf tmux 2.4 added support for globs, which makes all of this templating nastiness go away: A user who wants custom settings (such as me on my work system) can just drop overrides into ~/.tmux.conf.d/something.conf and go home. --- .gitignore | 2 - Makefile | 8 ---- README.markdown | 4 -- tmux/tmux.conf | 134 +++++++++++++++++++++++++++++++++++++++++++++++++++++ tmux/tmux.conf.mi5 | 130 --------------------------------------------------- 5 files changed, 134 insertions(+), 144 deletions(-) create mode 100644 tmux/tmux.conf delete mode 100644 tmux/tmux.conf.mi5 diff --git a/.gitignore b/.gitignore index 36c16182..c4a552f8 100644 --- a/.gitignore +++ b/.gitignore @@ -160,6 +160,4 @@ gnupg/gpg.conf gnupg/gpg.conf.m4 include/mktd.m4 man/man7/dotfiles.7df -tmux/tmux.conf -tmux/tmux.conf.m4 urxvt/ext/select diff --git a/Makefile b/Makefile index 50c1b939..20d14b28 100644 --- a/Makefile +++ b/Makefile @@ -245,8 +245,6 @@ clean distclean: gnupg/gpg.conf.m4 \ include/mktd.m4 \ man/man8/dotfiles.7df \ - tmux/tmux.conf \ - tmux/tmux.conf.m4 \ urxvt/ext/select .awk: @@ -309,12 +307,6 @@ MAILDIR = $(HOME)/Mail TMUX_BG = colour237 TMUX_FG = colour248 -tmux/tmux.conf: tmux/tmux.conf.m4 - m4 \ - -D TMUX_BG=$(TMUX_BG) \ - -D TMUX_FG=$(TMUX_FG) \ - tmux/tmux.conf.m4 > $@ - install: install-bin \ install-curl \ install-ex \ diff --git a/README.markdown b/README.markdown index 574d3ec3..36add541 100644 --- a/README.markdown +++ b/README.markdown @@ -327,10 +327,6 @@ Note that the configuration presently uses a hard-coded 256-color colorscheme, and uses non-login shells, with an attempt to control the environment to stop shells thinking they have access to an X display. -The configuration file is created with `mi5(1df)` to allow specifying a color -theme. This is just because I use a different color for my work session. The -default is a dark grey. - The shell scripts in `bin` include `tm(1df)`, a shortcut to make `attach` into the default command if no arguments are given and sessions do already exist. My `~/.inputrc` file binds Alt+M to run that, and Tmux in turn binds the same key diff --git a/tmux/tmux.conf b/tmux/tmux.conf new file mode 100644 index 00000000..4acf6a3d --- /dev/null +++ b/tmux/tmux.conf @@ -0,0 +1,134 @@ +# Strip out a lot of machine and X11 dependent crap from the initial +# environment +set-environment -gru COLORFGBG +set-environment -gru COLORTERM +set-environment -gru DISPLAY +set-environment -gru SSH_CLIENT +set-environment -gru SSH_CONNECTION +set-environment -gru SSH_TTY +set-environment -gru WINDOWID + +# Otherwise, use the environment we had when we started; don't touch it during +# a session unless I specifically ask +set-option -g update-environment '' + +# Setting this makes each new pane a non-login shell, which suits me better +set-option -g default-command "$SHELL" + +# Expect a 256-color terminal +set-option -g default-terminal 'screen-256color' + +# Change the prefix to ^A rather than the default of ^B, because I'm a godless +# GNU Screen refugee, and also I like using ^B in my shell and in Vim more +unbind-key C-b +set-option -g prefix C-a +bind-key a send-prefix + +# Repeating the prefix switches to the last window and back, a GNU Screen +# feature that's hardwired into my brain now +bind-key C-a last-window + +# Quick ways to kill single windows and the whole server +bind-key '/' confirm-before 'kill-window' +bind-key '\' confirm-before 'kill-server' + +# Slightly more intuitive way to split windows +bind-key '_' split-window -v +bind-key '|' split-window -h + +# Switch to the last active pane +bind-key Tab last-pane + +# Use the vi mode for tmux interaction behaviour in copy and choice modes +set-window-option -g mode-keys vi +bind-key -T copy-mode-vi v send -X begin-selection +bind-key -T copy-mode-vi y send -X copy-selection-and-cancel + +# Detach with Alt-M, no prefix required +bind-key -n M-m detach + +# Vim-like pane resizing +bind-key -r '+' resize-pane -U 5 +bind-key -r '-' resize-pane -D 5 +bind-key -r '<' resize-pane -L 5 +bind-key -r '>' resize-pane -R 5 + +# Vim-like pane switching +bind-key h select-pane -L +bind-key j select-pane -D +bind-key k select-pane -U +bind-key l select-pane -R + +# Join and break panes +bind-key J choose-window "join-pane -h -s '%%'" +bind-key B break-pane -d + +# Select only sessions in the choose-tree menu, not the whole tree of sessions +# and windows, I prefer to drill down +bind-key s choose-session + +# Session title on the left side of the status bar +set-option -g status-left '[#S] ' + +# Username, hostname, and the current date on the right side of the status bar +set-option -g status-right ' [#H] %F %T' + +# Update the status bar every second +set-option -g status-interval 1 + +# The first window in a session has index 1, rather than 0 +set-option -g base-index 1 + +# Don't worry about timeouts for key combinations, as I don't use Escape as +# meta and prefer things to be snappier +set-option -g escape-time 0 + +# Keep plenty of history +set-option -g history-limit 100000 + +# Don't interfere with my system clipboard +set-option -g set-clipboard off + +# Only force individual windows to the smallest attached terminal size, not +# whole sessions +set-window-option -g aggressive-resize on + +# If I don't set a title on a window, use the program name for the window title +set-window-option -g automatic-rename on + +# However, don't let terminal escape sequences rename my windows +set-window-option -g allow-rename off + +# Window titles are the window index, a colon, the window or command name, and +# any activity or alert indicators +set-window-option -g window-status-format "#I:#W#F" + +# Message dialogs are white on blue +set-option -g message-style "bg=colour18,fg=colour231" + +# Window choosers are white on blue +set-window-option -g mode-style "bg=colour18,fg=colour231" + +# Pane borders are always in the background color +set-option -g pane-border-style "fg=colour237" +set-option -g pane-active-border-style "fg=colour237" + +# Inactive windows have slightly washed-out system colours +set-option -g window-style "bg=colour232,fg=colour248" +set-option -g window-active-style "bg=colour0,fg=colour15" + +# The status bar has the defined background and foreground colours +set-option -g status-style "bg=colour237,fg=colour248" + +# Titles of windows default to black text with no embellishment +set-window-option -g window-status-style "fg=colour16" + +# The title of the active window is in white rather than black +set-window-option -g window-status-current-style "fg=colour231" + +# A window with a bell has a title with a red background until cleared +set-window-option -g window-status-bell-style "bg=colour9" + +# Source any configuration in the subdir if there is any +if-shell 'set -- "$HOME"/.tmux.conf.d/*;test -e "$1"' \ + 'source-file ~/.tmux.conf.d/*.conf' diff --git a/tmux/tmux.conf.mi5 b/tmux/tmux.conf.mi5 deleted file mode 100644 index 27ae1417..00000000 --- a/tmux/tmux.conf.mi5 +++ /dev/null @@ -1,130 +0,0 @@ -# Strip out a lot of machine and X11 dependent crap from the initial -# environment -set-environment -gru COLORFGBG -set-environment -gru COLORTERM -set-environment -gru DISPLAY -set-environment -gru SSH_CLIENT -set-environment -gru SSH_CONNECTION -set-environment -gru SSH_TTY -set-environment -gru WINDOWID - -# Otherwise, use the environment we had when we started; don't touch it during -# a session unless I specifically ask -set-option -g update-environment '' - -# Setting this makes each new pane a non-login shell, which suits me better -set-option -g default-command "$SHELL" - -# Expect a 256-color terminal -set-option -g default-terminal 'screen-256color' - -# Change the prefix to ^A rather than the default of ^B, because I'm a godless -# GNU Screen refugee, and also I like using ^B in my shell and in Vim more -unbind-key C-b -set-option -g prefix C-a -bind-key a send-prefix - -# Repeating the prefix switches to the last window and back, a GNU Screen -# feature that's hardwired into my brain now -bind-key C-a last-window - -# Quick ways to kill single windows and the whole server -bind-key '/' confirm-before 'kill-window' -bind-key '\' confirm-before 'kill-server' - -# Slightly more intuitive way to split windows -bind-key '_' split-window -v -bind-key '|' split-window -h - -# Switch to the last active pane -bind-key Tab last-pane - -# Use the vi mode for tmux interaction behaviour in copy and choice modes -set-window-option -g mode-keys vi -bind-key -T copy-mode-vi v send -X begin-selection -bind-key -T copy-mode-vi y send -X copy-selection-and-cancel - -# Detach with Alt-M, no prefix required -bind-key -n M-m detach - -# Vim-like pane resizing -bind-key -r '+' resize-pane -U 5 -bind-key -r '-' resize-pane -D 5 -bind-key -r '<' resize-pane -L 5 -bind-key -r '>' resize-pane -R 5 - -# Vim-like pane switching -bind-key h select-pane -L -bind-key j select-pane -D -bind-key k select-pane -U -bind-key l select-pane -R - -# Join and break panes -bind-key J choose-window "join-pane -h -s '%%'" -bind-key B break-pane -d - -# Select only sessions in the choose-tree menu, not the whole tree of sessions -# and windows, I prefer to drill down -bind-key s choose-session - -# Session title on the left side of the status bar -set-option -g status-left '[#S] ' - -# Username, hostname, and the current date on the right side of the status bar -set-option -g status-right ' [#H] %F %T' - -# Update the status bar every second -set-option -g status-interval 1 - -# The first window in a session has index 1, rather than 0 -set-option -g base-index 1 - -# Don't worry about timeouts for key combinations, as I don't use Escape as -# meta and prefer things to be snappier -set-option -g escape-time 0 - -# Keep plenty of history -set-option -g history-limit 100000 - -# Don't interfere with my system clipboard -set-option -g set-clipboard off - -# Only force individual windows to the smallest attached terminal size, not -# whole sessions -set-window-option -g aggressive-resize on - -# If I don't set a title on a window, use the program name for the window title -set-window-option -g automatic-rename on - -# However, don't let terminal escape sequences rename my windows -set-window-option -g allow-rename off - -# Window titles are the window index, a colon, the window or command name, and -# any activity or alert indicators -set-window-option -g window-status-format "#I:#W#F" - -# Message dialogs are white on blue -set-option -g message-style "bg=colour18,fg=colour231" - -# Window choosers are white on blue -set-window-option -g mode-style "bg=colour18,fg=colour231" - -# Pane borders are always in the background color -set-option -g pane-border-style "fg=<% TMUX_BG %>" -set-option -g pane-active-border-style "fg=<% TMUX_BG %>" - -# Inactive windows have slightly washed-out system colours -set-option -g window-style "bg=colour232,fg=colour248" -set-option -g window-active-style "bg=colour0,fg=colour15" - -# The status bar has the defined background and foreground colours -set-option -g status-style "bg=<% TMUX_BG %>,fg=<% TMUX_FG %>" - -# Titles of windows default to black text with no embellishment -set-window-option -g window-status-style "fg=colour16" - -# The title of the active window is in white rather than black -set-window-option -g window-status-current-style "fg=colour231" - -# A window with a bell has a title with a red background until cleared -set-window-option -g window-status-bell-style "bg=colour9" -- cgit v1.2.3