Created
December 21, 2018 17:20
-
-
Save nulligor/ac4fd3e3d54300a5c8a54fe72190fc60 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Inspired from: https://github.com/nicknisi/dotfiles/tree/master/tmux | |
# set is an alias for set-option | |
# setw is an alias for set-window-option | |
################## COLORS ################## | |
# Colors: https://i.stack.imgur.com/e63et.png | |
tm_color_active=colour208 | |
tm_color_inactive=colour241 | |
tm_color_neutral=colour255 | |
################## GENERAL OPTIONS ################## | |
# More options: https://github.com/tmux/tmux/blob/master/options-table.c | |
# Automatically renumber tmux windows | |
set-option -g renumber-windows on | |
set-option -g mouse on | |
set-option -g status-left-length 32 | |
set-option -g status-right-length 150 | |
# Update status bar every minute | |
set-option -g status-interval 60 | |
# Enable RGB colour if running in xterm(1) | |
set-option -sa terminal-overrides ",xterm*:Tc" | |
# Number of lines of history to remember | |
set-option -g history-limit 100000 | |
# Required otherwise vim cannot display 256 colors | |
# Normally it's `tmux-256color` but for some reason on my new laptop I lose the feature `history-substring-search` brought by Prezto with xfce4-terminal | |
set-option -g default-terminal "screen-256color" | |
# default is black | |
set-option -g status-bg default | |
set-option -g status-fg $tm_color_neutral | |
set-option -g status-right-attr bold | |
# Pane border | |
set-option -g pane-border-fg $tm_color_inactive | |
set-option -g pane-active-border-fg $tm_color_active | |
# Pane number display | |
set-option -g display-panes-active-colour $tm_color_active | |
set-option -g display-panes-colour $tm_color_inactive | |
# Make pane index start with 1 | |
set-option -g base-index 1 | |
# vim mode for keys (i for insert, esc, etc) | |
set-window-option -g mode-keys vi | |
# The window (GUI) title of the terminal will be based on the curent tmux window | |
set-option -g set-titles on | |
set-option -g set-titles-string "#T - #W" | |
# No delay for ESC key | |
set-option -sg escape-time 0 | |
# Window titles | |
set-window-option -g window-status-attr none | |
set-window-option -g window-status-current-attr bold,underscore | |
set-window-option -g window-status-current-fg $tm_color_active | |
# #I: number; #W name | |
set-window-option -g window-status-format "#I #W" | |
set-window-option -g window-status-current-format "#I #W" | |
# Rather than constraining window size to the maximum size of any client | |
# connected to the *session*, constrain window size to the maximum size of any | |
# client connected to *that window*. Much more reasonable. | |
set-window-option -g aggressive-resize on | |
# Make window index start with 1 | |
set-window-option -g pane-base-index 1 | |
################## BINDINGS ################## | |
# All the bindings: https://github.com/tmux/tmux/blob/master/key-bindings.c | |
bind [ copy-mode | |
bind Escape copy-mode | |
bind -Tcopy-mode-vi v send -X begin-selection | |
bind -Tcopy-mode-vi y send -X copy-pipe 'xclip -in -selection clipboard' \; display-message "copied to system clipboard" | |
bind -Tcopy-mode-vi C-v send -X rectangle-toggle | |
bind ] paste-buffer | |
# Open new panes/windows in the same directory | |
bind '"' split-window -c "#{pane_current_path}" | |
bind % split-window -h -c "#{pane_current_path}" | |
bind c new-window -c "#{pane_current_path}" | |
# pane movement shortcuts | |
bind h select-pane -L | |
bind j select-pane -D | |
bind k select-pane -U | |
bind l select-pane -R | |
# ctrl-b, hold ctrl and k+ | |
# -r gives 500ms to press the key again | |
bind -r C-k resize-pane -U | |
bind -r C-j resize-pane -D | |
bind -r C-h resize-pane -L | |
bind -r C-l resize-pane -R | |
# Bind : to command-prompt like vim. This is the default in tmux already. | |
bind : command-prompt | |
################## LEFT STATUS BAR - TMUX SESSION ################## | |
# Diplay session name | |
set-option -g status-left " #[fg=colour200][#S] " | |
################## RIGHT STATUS BAR - EXTERNAL CONTENT ################## | |
tm_separator="#[fg=colour236]|" | |
tm_battery="#(~/git/dotfiles/scripts/getBatteryState.sh)" | |
tm_time='#[fg=colour190]%a %h-%d %H:%M:%S' | |
set-option -g status-right $tm_separator' '$tm_battery' '$tm_separator' '$tm_time' ' | |
set-option -gw xterm-keys on | |
bind-key -n C-Right send-keys C-Right |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment