commit dcc734f6f754fa292d24dfc7123aefed550992da Author: Gregory Pakosz Date: Mon Jul 23 10:25:24 2012 +0200 initial .tmux.conf diff --git a/.tmux.conf b/.tmux.conf new file mode 100644 index 0000000..dcdcd37 --- /dev/null +++ b/.tmux.conf @@ -0,0 +1,253 @@ +# cat << ►_◄ > /dev/null + + +# -- general ------------------------------------------------------------------- + +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 -s quiet on # disable various messages + +set -g prefix2 C-a # GNU-Screen compatible prefix +bind C-a send-prefix -2 + +# uncomment to force vi-style key bindings +# emacs is the default unless $EDITOR or $VISUAL contain 'vi' +#set -g status-keys vi +#setw -g mode-keys vi + +set -g status-utf8 on # expect UTF-8 +setw -g utf8 on + +set 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"' + +# reload configuration +bind r source-file ~/.tmux.conf \; display '~/.tmux.conf sourced' + + +# -- display ------------------------------------------------------------------- + +set -g base-index 1 # start windows numbering at 1 +setw -g pane-base-index 1 # make pane numbering consistent with windows + +setw -g automatic-rename on # rename window to reflect current program +# renumber windows when a window is closed, tmux > 1.6 +if '[ $(echo "$(tmux -V | cut -d' ' -f 2) > 1.6" | bc) -eq 1 ]' 'set -g renumber-windows on' + +set -g set-titles on # set terminal title +set -g set-titles-string '#h ❐ #S ● #I #W' + +set -g display-panes-time 800 # slightly longer pane indicators display time +set -g display-time 1000 # slightly longer status messages display time + +set -g status-interval 10 # redraw status line every 10 seconds + +# 24 hour clock +setw -g clock-mode-style 24 + +# easier show-messages binding, when ~ is a dead key +bind m show-messages + +# clear both screen and history +bind -n C-l send-keys C-l \; run 'tmux clear-history' + +# activity +set -g monitor-activity on +set -g visual-activity off + +# tmux theme, colors and status line +# available themes: +# - powerline (a powerline inspired theme) +# - powerline_patched_font (a powerline inspired theme using a patched font) +tmux_conf_theme=powerline + + +# -- navigation ---------------------------------------------------------------- + +# create new session +bind C-c new-session + +# split current window vertically +bind _ split-window -h +# split current window horizontally +bind - split-window -v + +# pane navigation +bind -r h select-pane -L # move left +bind -r j select-pane -D # move down +bind -r k select-pane -U # move up +bind -r l select-pane -R # move right +bind > swap-pane -D # swap current pane with the next one +bind < swap-pane -U # swap current pane with the previous one + +#set -g mouse-select-pane on # mouse can be used to select a pane + +# maximize current pane +bind + run 'cut -c3- ~/.tmux.conf | sh -s maximize_pane' + +# pane resizing +bind -r H resize-pane -L 2 +bind -r J resize-pane -D 2 +bind -r K resize-pane -U 2 +bind -r L resize-pane -R 2 +#set -g mouse-resize-pane on # mouse can be used to resize panes + +# window navigation +bind -r C-h previous-window # select previous window +bind -r C-l next-window # select next window +bind Space last-window # move to last active window +#set -g mouse-select-window on # mouse can be used to select a window + + +# -- copy mode ----------------------------------------------------------------- + +bind Enter copy-mode # enter copy mode +bind b list-buffers # list paster buffers +bind p paste-buffer # paste from the top pate buffer +bind P choose-buffer # choose which buffer to paste from + +# the following vi-copy bindings match my vim settings +# see https://github.com/gpakosz/.vim.git +bind -t vi-copy v begin-selection +bind -t vi-copy C-v rectangle-toggle +bind -t vi-copy y copy-selection +bind -t vi-copy Escape cancel +bind -t vi-copy H start-of-line +bind -t vi-copy L end-of-line + +# -- user defined -------------------------------------------------------------- + +source ~/.tmux.conf.local + + +# -- 8< ------------------------------------------------------------------------ + +run 'cut -c3- ~/.tmux.conf | sh -s apply_theme $tmux_conf_theme' +run 'for name in $(printenv | grep -Eo ^tmux_conf_[^=]+); do tmux setenv -gu $name; done;' + + +# ►_◄ + +# # exit the script if any statement returns a non-true return value +# set -e +# # exit the script on dereferencing uninitialised variables +# set -o nounset +# +# apply_theme() { +# case "$1" in +# powerline_patched_font) +# left_separator_light='⮁' +# left_separator_bold='⮀' +# right_separator_light='⮃' +# right_separator_bold='⮂' +# ;; +# powerline) +# left_separator_light='|' +# left_separator_bold=' ' +# right_separator_light='|' +# right_separator_bold=' ' +# ;; +# esac +# +# case "$1" in +# powerline*) +# +# # panes +# 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 +# #uncomment for fat borders +# #tmux set -g pane-border-bg $pane_border_fg \; set -g pane-active-border-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 +# +# # 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 +# +# # status line +# status_fg=colour253 # white +# status_bg=colour232 # dark gray +# tmux set -g status-fg $status_fg \; set -g status-bg $status_bg +# +# session_fg=colour16 # black +# session_bg=colour226 # yellow +# status_left="#[fg=$session_fg,bg=$session_bg,bold] ❐ #S #[fg=$session_bg,bg=$status_bg,nobold]$left_separator_bold" +# tmux set -g status-left-length 32 \; set -g status-left "$status_left" +# +# 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" +# +# window_status_current_fg=colour16 # black +# window_status_current_bg=colour39 # light blue +# window_status_current_format="#[fg=$window_status_bg,bg=$window_status_current_bg]$left_separator_bold#[fg=$window_status_current_fg,bg=$window_status_current_bg,noreverse,bold] #I $left_separator_light #W #[fg=$window_status_current_bg,bg=$status_bg,nobold]$left_separator_bold" +# 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" +# +# time_date_fg=colour245 # light gray +# time_date_bg=colour232 # dark gray +# whoami_fg=colour254 # white +# whoami_bg=colour160 # red +# host_fg=colour16 # black +# host_bg=colour254 # white +# status_right="#[fg=$time_date_fg]$right_separator_light %R $right_separator_light %d %b #[fg=$whoami_bg,bg=$time_date_bg,nobold]$right_separator_bold#[fg=$whoami_fg,bg=$whoami_bg,nobold] #(whoami) #[fg=$status_fg,nobold]$right_separator_bold#[fg=$host_fg,bg=$host_bg,bold] #h " +# tmux set -g status-right-length 64 \; set -g status-right "$status_right" +# +# +# # clock +# clock_mode_colour=colour39 # light blue +# tmux setw -g clock-mode-colour $clock_mode_colour +# ;; +# esac +# } +# +# circled_digit() { +# circled_digits='⓪①②③④⑤⑥⑦⑧⑨⑩⑪⑫⑬⑭⑮⑯⑰⑱⑲⑳' +# if [ $1 -lt 20 ] 2>/dev/null ; then +# echo ${circled_digits:$1:1} +# else +# echo $1 +# fi +# } +# +# maximize_pane() { +# __current_pane=$(tmux display -p '#D') +# +# __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 +# +# tmux new-window "exec maximized+ 2> /dev/null | tmux setw remain-on-exit on && printf '\033]2;%s\033\\' [+]${__current_pane}" +# __new_pane=$(tmux display -p '#D') +# tmux setw remain-on-exit off +# tmux swap-pane -s "${__current_pane}" -t "${__new_pane}" +# else +# ${__restore} +# fi +# } +# +# $@