2019-01-31 09:41:03 +01:00
|
|
|
#+TITLE: Tmux Configuration
|
2019-12-30 17:21:22 +01:00
|
|
|
:DRAWER:
|
2020-01-11 22:04:28 +01:00
|
|
|
#+STARTUP: overview
|
|
|
|
|
|
|
|
#+LANGUAGE: en
|
|
|
|
#+EMAIL: dehaeze.thomas@gmail.com
|
|
|
|
#+AUTHOR: Dehaeze Thomas
|
|
|
|
|
|
|
|
#+HTML_LINK_HOME: ./index.html
|
|
|
|
#+HTML_LINK_UP: ./index.html
|
|
|
|
|
2020-01-11 22:24:51 +01:00
|
|
|
#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="./css/htmlize.css"/>
|
|
|
|
#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="./css/readtheorg.css"/>
|
|
|
|
#+HTML_HEAD: <script type="text/javascript" src="./js/jquery.min.js"></script>
|
|
|
|
#+HTML_HEAD: <script type="text/javascript" src="./js/bootstrap.min.js"></script>
|
|
|
|
#+HTML_HEAD: <script type="text/javascript" src="./js/jquery.stickytableheaders.min.js"></script>
|
|
|
|
#+HTML_HEAD: <script type="text/javascript" src="./js/readtheorg.js"></script>
|
2020-01-11 22:04:28 +01:00
|
|
|
|
2019-01-31 09:41:03 +01:00
|
|
|
#+PROPERTY: header-args :tangle ~/.tmux.conf
|
|
|
|
#+PROPERTY: header-args+ :comments both :mkdirp yes
|
2019-12-30 17:21:22 +01:00
|
|
|
:END:
|
2019-01-31 09:41:03 +01:00
|
|
|
|
|
|
|
* Line
|
2019-05-16 21:13:08 +02:00
|
|
|
#+begin_src conf
|
|
|
|
# Activate the status bar
|
|
|
|
set -g status "on"
|
2019-01-31 09:41:03 +01:00
|
|
|
|
2019-05-16 21:13:08 +02:00
|
|
|
# default statusbar color
|
|
|
|
set-option -g status-style bg=colour237,fg=colour223 # bg=bg1, fg=fg1
|
2019-01-31 09:41:03 +01:00
|
|
|
|
2019-05-16 21:13:08 +02:00
|
|
|
# default window title colors
|
|
|
|
set-window-option -g window-status-style bg=colour214,fg=colour237 # bg=yellow, fg=bg1
|
2019-01-31 09:41:03 +01:00
|
|
|
|
2019-05-16 21:13:08 +02:00
|
|
|
# default window with an activity alert
|
|
|
|
set-window-option -g window-status-activity-style bg=colour237,fg=colour248 # bg=bg1, fg=fg3
|
2019-01-31 09:41:03 +01:00
|
|
|
|
2019-05-16 21:13:08 +02:00
|
|
|
# active window title colors
|
|
|
|
set-window-option -g window-status-current-style bg=red,fg=colour237 # fg=bg1
|
2019-01-31 09:41:03 +01:00
|
|
|
|
2019-05-16 21:13:08 +02:00
|
|
|
# pane border
|
|
|
|
set-option -g pane-active-border-style fg=colour250 #fg2
|
|
|
|
set-option -g pane-border-style fg=colour237 #bg1
|
2019-01-31 09:41:03 +01:00
|
|
|
|
2019-05-16 21:13:08 +02:00
|
|
|
# message infos
|
|
|
|
set-option -g message-style bg=colour239,fg=colour223 # bg=bg2, fg=fg1
|
2019-01-31 09:41:03 +01:00
|
|
|
|
2019-05-16 21:13:08 +02:00
|
|
|
# writing commands inactive
|
|
|
|
set-option -g message-command-style bg=colour239,fg=colour223 # bg=fg3, fg=bg1
|
2019-01-31 09:41:03 +01:00
|
|
|
|
2019-05-16 21:13:08 +02:00
|
|
|
# pane number display
|
|
|
|
set-option -g display-panes-active-colour colour250 #fg2
|
|
|
|
set-option -g display-panes-colour colour237 #bg1
|
2019-01-31 09:41:03 +01:00
|
|
|
|
2019-05-16 21:13:08 +02:00
|
|
|
# clock
|
|
|
|
set-window-option -g clock-mode-colour colour109 #blue
|
2019-01-31 09:41:03 +01:00
|
|
|
|
2019-05-16 21:13:08 +02:00
|
|
|
# bell
|
|
|
|
set-window-option -g window-status-bell-style bg=colour167,fg=colour235 # bg=red, fg=bg
|
2019-01-31 09:41:03 +01:00
|
|
|
|
2019-05-16 21:13:08 +02:00
|
|
|
## Theme settings mixed with colors (unfortunately, but there is no cleaner way)
|
|
|
|
set-option -g status-justify "left"
|
|
|
|
set-option -g status-left-style none
|
|
|
|
set-option -g status-left-length "80"
|
|
|
|
set-option -g status-right-style none
|
|
|
|
set-option -g status-right-length "80"
|
|
|
|
set-window-option -g window-status-separator ""
|
2019-01-31 09:41:03 +01:00
|
|
|
|
2019-05-16 21:13:08 +02:00
|
|
|
set-option -g status-left "#[fg=colour248, bg=colour241] #S #[fg=colour241, bg=colour237, nobold, noitalics, nounderscore]"
|
2019-12-15 10:50:49 +01:00
|
|
|
set-option -g status-right "#[fg=colour239, bg=colour237, nobold, nounderscore, noitalics]#[fg=colour246,bg=colour239] %Y-%m-%d %H:%M #[fg=colour248, bg=colour239, nobold, noitalics, nounderscore]#{?client_prefix,#[fg=colour124],}#[fg=colour237, bg=colour248]#{?client_prefix,#[bg=colour124],} #h "
|
2019-05-16 21:13:08 +02:00
|
|
|
|
|
|
|
set-window-option -g window-status-current-format "#[fg=colour237, bg=colour214, nobold, noitalics, nounderscore]#[fg=colour239, bg=colour214] #I #[fg=colour239, bg=colour214, bold] #W #[fg=colour214, bg=colour237, nobold, noitalics, nounderscore]"
|
|
|
|
set-window-option -g window-status-format "#[fg=colour237,bg=colour239,noitalics]#[fg=colour223,bg=colour239] #I #[fg=colour223, bg=colour239] #W #[fg=colour239, bg=colour237, noitalics]"
|
|
|
|
#+end_src
|
2019-12-15 10:50:49 +01:00
|
|
|
|
2019-01-31 09:41:03 +01:00
|
|
|
* Bindings
|
|
|
|
#+BEGIN_SRC conf
|
2019-04-04 10:27:43 +02:00
|
|
|
# Set prefix to 'C-Space'
|
|
|
|
unbind C-b
|
|
|
|
set -g prefix C-Space
|
|
|
|
|
|
|
|
# Reload the config using 'C-Space + r'
|
|
|
|
bind r source-file ~/.tmux.conf \; display-message "Config reloaded..."
|
|
|
|
|
|
|
|
# Simulate 'C-l' to clear the terminal
|
|
|
|
bind C-l send-keys C-l \; clear-history
|
|
|
|
|
|
|
|
# Open new panes with the path of the current pane.
|
|
|
|
unbind c
|
|
|
|
bind c new-window -c '#{pane_current_path}'
|
|
|
|
|
|
|
|
# Vim-like key bindings for pane navigation (default uses cursor keys).
|
|
|
|
unbind h
|
|
|
|
bind h select-pane -L
|
|
|
|
unbind j
|
|
|
|
bind j select-pane -D
|
|
|
|
unbind k
|
|
|
|
bind k select-pane -U
|
|
|
|
unbind l # normally used for last-window
|
|
|
|
bind l select-pane -R
|
|
|
|
|
|
|
|
# Move Panes
|
|
|
|
unbind L
|
|
|
|
bind L swap-pane -D
|
|
|
|
unbind H
|
|
|
|
bind H swap-pane -U
|
|
|
|
|
|
|
|
# Resizing (mouse also works).
|
|
|
|
unbind Left
|
|
|
|
bind -r Left resize-pane -L 5
|
|
|
|
unbind Right
|
|
|
|
bind -r Right resize-pane -R 5
|
|
|
|
unbind Down
|
|
|
|
bind -r Down resize-pane -D 5
|
|
|
|
unbind Up
|
|
|
|
bind -r Up resize-pane -U 5
|
|
|
|
|
|
|
|
# Fast toggle (normally prefix-l).
|
|
|
|
bind ^space last-window
|
|
|
|
|
|
|
|
# Intuitive window-splitting keys.
|
|
|
|
bind / split-window -h -c '#{pane_current_path}' # normally prefix-%
|
|
|
|
bind - split-window -v -c '#{pane_current_path}' # normally prefix-"
|
|
|
|
|
|
|
|
# Swap windows
|
|
|
|
bind-key -r "<" swap-window -t -1
|
|
|
|
bind-key -r ">" swap-window -t +1
|
|
|
|
|
|
|
|
# Smart pane switching with awareness of Vim splits
|
|
|
|
# See: https://github.com/christoomey/vim-tmux-navigator
|
|
|
|
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
|
|
|
|
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
|
|
|
|
bind-key -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L"
|
|
|
|
bind-key -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D"
|
|
|
|
bind-key -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U"
|
|
|
|
bind-key -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R"
|
|
|
|
|
|
|
|
# Set 'C-Space + v' to enter copy-mode
|
|
|
|
unbind [
|
|
|
|
bind-key v copy-mode
|
|
|
|
|
|
|
|
# Set 'C-Space + C-v' to paste
|
|
|
|
unbind ]
|
|
|
|
bind-key C-v paste-buffer
|
|
|
|
|
|
|
|
# Setup 'v' to begin selection as in Vim and 'y' to yank
|
|
|
|
bind-key -T copy-mode-vi 'v' send -X begin-selection
|
2019-07-20 16:29:27 +02:00
|
|
|
bind-key -T copy-mode-vi 'y' send -X copy-pipe-and-cancel "xsel -i -p && xsel -o -p | xsel -i -b"
|
2019-04-04 10:27:43 +02:00
|
|
|
bind-key -T copy-mode-vi 'Escape' send -X cancel
|
|
|
|
bind-key -T copy-mode-vi 'C-v' send-keys -X rectangle-toggle
|
2019-01-31 09:41:03 +01:00
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
* Settings
|
|
|
|
#+BEGIN_SRC conf
|
2019-04-04 10:27:43 +02:00
|
|
|
# Activity monitoring
|
|
|
|
set -g visual-activity off
|
2019-01-31 09:41:03 +01:00
|
|
|
|
2019-04-04 10:27:43 +02:00
|
|
|
# Automatically renumber window numbers on closing a pane (tmux >= 1.7).
|
|
|
|
set -g renumber-windows on
|
2019-01-31 09:41:03 +01:00
|
|
|
|
2019-04-04 10:27:43 +02:00
|
|
|
# Mouse can be used to select panes, select windows (by clicking on the status bar), resize panes
|
|
|
|
set -g mouse on
|
2019-01-31 09:41:03 +01:00
|
|
|
|
2019-04-04 10:27:43 +02:00
|
|
|
set -g default-terminal "screen-256color"
|
|
|
|
set -ga terminal-overrides ',xterm-256color:Tc'
|
2019-01-31 09:41:03 +01:00
|
|
|
|
2019-04-04 10:27:43 +02:00
|
|
|
set -g history-limit 262144
|
2019-01-31 09:41:03 +01:00
|
|
|
|
2019-04-04 10:27:43 +02:00
|
|
|
# Start window and pane numbering at 1, (0 is too hard to reach)
|
|
|
|
set -g base-index 1
|
|
|
|
set -g pane-base-index 1
|
2019-01-31 09:41:03 +01:00
|
|
|
|
2019-04-04 10:27:43 +02:00
|
|
|
# Don't wait for an escape sequence after seeing C-a
|
|
|
|
set -s escape-time 0
|
2019-01-31 09:41:03 +01:00
|
|
|
|
2019-04-04 10:27:43 +02:00
|
|
|
# Dynamically update iTerm tab and window titles
|
|
|
|
set -g set-titles on
|
2019-01-31 09:41:03 +01:00
|
|
|
|
2019-04-04 10:27:43 +02:00
|
|
|
# Needed as on tmux 1.9 and up (defaults to off)
|
|
|
|
set -g focus-events on
|
2019-01-31 09:41:03 +01:00
|
|
|
|
2019-04-04 10:27:43 +02:00
|
|
|
# But don't change tmux's own window titles
|
|
|
|
set-option -g allow-rename off
|
2019-01-31 09:41:03 +01:00
|
|
|
|
2019-04-04 10:27:43 +02:00
|
|
|
# Don't wrap searches; it's super confusing given tmux's reverse-ordering of position info in copy mode
|
|
|
|
set -w -g wrap-search off
|
2019-01-31 09:41:03 +01:00
|
|
|
|
2019-04-04 10:27:43 +02:00
|
|
|
# Restore pre-2.1 behavior of scrolling with the scrollwheel in Vim, less, copy mode etc, otherwise entering copy mode if not already in it.
|
|
|
|
bind-key -T root WheelUpPane \
|
|
|
|
if-shell -Ft= '#{?pane_in_mode,1,#{mouse_any_flag}}' \
|
|
|
|
'send -Mt=' \
|
|
|
|
'if-shell -Ft= "#{alternate_on}" "send -t= Up" "copy-mode -et="'
|
|
|
|
bind-key -T root WheelDownPane \
|
|
|
|
if-shell -Ft = '#{?pane_in_mode,1,#{mouse_any_flag}}' \
|
|
|
|
'send -Mt=' \
|
|
|
|
'if-shell -Ft= "#{alternate_on}" "send -t= Down" "send -Mt="'
|
2019-01-31 09:41:03 +01:00
|
|
|
|
2019-04-04 10:27:43 +02:00
|
|
|
# Stay in copy mode on drag end, but otherwise exit for mouse up.
|
|
|
|
# Requires patch from https://github.com/tmux/tmux/issues/326
|
|
|
|
# unbind-key -t vi-copy MouseDragEnd1Pane
|
|
|
|
# bind-key -t vi-copy MouseUp1Pane cancel
|
2019-01-31 09:41:03 +01:00
|
|
|
|
2019-04-04 10:27:43 +02:00
|
|
|
bind-key -n MouseDrag1Status swap-window -t=
|
|
|
|
# bind-key -n MouseDown3Status new-window -a -t=
|
2019-01-31 09:41:03 +01:00
|
|
|
|
2019-04-04 10:27:43 +02:00
|
|
|
bind-key -n MouseDrag1Status swap-window -t=
|
|
|
|
# bind-key -n MouseDown3Status new-window -a -t=
|
2019-01-31 09:41:03 +01:00
|
|
|
|
|
|
|
|
2019-04-04 10:27:43 +02:00
|
|
|
# #T = standard window title (last command, see ~/.bash_profile)
|
|
|
|
# #h = short hostname
|
|
|
|
# #S = session name
|
|
|
|
# #W = tmux window name
|
|
|
|
set -g set-titles-string "#T : #h > #S > #W"
|
2019-01-31 09:41:03 +01:00
|
|
|
|
2019-04-04 10:27:43 +02:00
|
|
|
# Show bells in window titles
|
|
|
|
set -g window-status-bell-style fg=yellow,bold,underscore
|
2019-05-16 21:13:08 +02:00
|
|
|
|
|
|
|
# Causes tmux to resize a window based on the smallest client actually viewing it, not on the smallest one attached to the entire session
|
|
|
|
set-window-option -g aggressive-resize
|
2019-01-31 09:41:03 +01:00
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
* Plugins
|
|
|
|
** Install plugins
|
|
|
|
#+BEGIN_SRC conf
|
2019-04-04 10:27:43 +02:00
|
|
|
set -g @plugin 'tmux-plugins/tpm'
|
|
|
|
# set -g @plugin 'tmux-plugins/tmux-sessionist'
|
|
|
|
# set -g @plugin 'tmux-plugins/tmux-resurrect'
|
|
|
|
# set -g @plugin 'tmux-plugins/tmux-continuum'
|
|
|
|
# set -g @plugin 'tmux-plugins/tmux-battery'
|
|
|
|
set -g @plugin 'nhdaly/tmux-better-mouse-mode'
|
|
|
|
set -g @plugin 'seebi/tmux-colors-solarized'
|
2019-01-31 09:41:03 +01:00
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
** Configuration
|
|
|
|
#+BEGIN_SRC conf
|
2019-04-04 10:27:43 +02:00
|
|
|
# =============================================================
|
|
|
|
# tmux-resurrect
|
|
|
|
# =============================================================
|
|
|
|
# for vim
|
|
|
|
set -g @resurrect-strategy-vim 'session'
|
|
|
|
# for neovim
|
|
|
|
set -g @resurrect-strategy-nvim 'session'
|
|
|
|
|
|
|
|
# Restoring pane contents
|
|
|
|
set -g @resurrect-capture-pane-contents 'on'
|
|
|
|
|
|
|
|
run-shell ~/.tmux/plugins/tmux-resurrect/resurrect.tmux
|
|
|
|
# =============================================================
|
|
|
|
|
|
|
|
|
|
|
|
# =============================================================
|
|
|
|
# tmux-continuum
|
|
|
|
# =============================================================
|
|
|
|
set -g @continuum-boot 'on'
|
|
|
|
set -g @continuum-boot-options 'iterm,fullscreen'
|
|
|
|
set -g @continuum-save-interval '15'
|
|
|
|
|
|
|
|
run-shell ~/.tmux/plugins/tmux-continuum/continuum.tmux
|
|
|
|
# =============================================================
|
|
|
|
|
|
|
|
|
|
|
|
# =============================================================
|
|
|
|
# tmux-battery
|
|
|
|
# =============================================================
|
|
|
|
set -g @batt_charged_icon "="
|
|
|
|
set -g @batt_charging_icon "+"
|
|
|
|
set -g @batt_discharging_icon "-"
|
|
|
|
set -g @batt_attached_icon "o"
|
|
|
|
# =============================================================
|
2019-01-31 09:41:03 +01:00
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
* Colors
|
|
|
|
#+BEGIN_SRC conf
|
2019-04-04 10:27:43 +02:00
|
|
|
set -g @colors-solarized 'light'
|
2019-01-31 09:41:03 +01:00
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
* Initialize TMUX plugin manager
|
|
|
|
#+BEGIN_SRC conf
|
2019-04-04 10:27:43 +02:00
|
|
|
run '~/.tmux/plugins/tpm/tpm'
|
2019-01-31 09:41:03 +01:00
|
|
|
#+END_SRC
|