literate-dotfiles/docs/tmux.html

344 lines
20 KiB
HTML

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<!-- 2021-01-01 ven. 20:09 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title>Tmux Configuration</title>
<meta name="generator" content="Org mode" />
<meta name="author" content="Dehaeze Thomas" />
<link rel="stylesheet" type="text/css" href="./dist/style.css"/>
<script type="text/javascript" src="./dist/script.js"></script>
</head>
<body>
<div id="org-div-home-and-up">
<a accesskey="h" href="./index.html"> UP </a>
|
<a accesskey="H" href="./index.html"> HOME </a>
</div><div id="content">
<h1 class="title">Tmux Configuration</h1>
<div id="table-of-contents">
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#org0839f62">Line</a></li>
<li><a href="#org38bb482">Bindings</a></li>
<li><a href="#org364f2d8">Settings</a></li>
<li><a href="#orgabc3f53">Plugins</a>
<ul>
<li><a href="#org20fa141">Install plugins</a></li>
<li><a href="#orgd295864">Configuration</a></li>
</ul>
</li>
<li><a href="#org6ad3f07">Colors</a></li>
<li><a href="#org1235a26">Initialize TMUX plugin manager</a></li>
</ul>
</div>
</div>
<div id="outline-container-org0839f62" class="outline-2">
<h2 id="org0839f62">Line</h2>
<div class="outline-text-2" id="text-org0839f62">
<div class="org-src-container">
<pre class="src src-conf"><span class="org-comment-delimiter"># </span><span class="org-comment">Activate the status bar</span>
set -g status <span class="org-string">"on"</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">default statusbar color</span>
<span class="org-variable-name">set-option -g status-style bg</span>=colour237,fg=colour223 <span class="org-comment-delimiter"># </span><span class="org-comment">bg=bg1, fg=fg1</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">default window title colors</span>
<span class="org-variable-name">set-window-option -g window-status-style bg</span>=colour214,fg=colour237 <span class="org-comment-delimiter"># </span><span class="org-comment">bg=yellow, fg=bg1</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">default window with an activity alert</span>
<span class="org-variable-name">set-window-option -g window-status-activity-style bg</span>=colour237,fg=colour248 <span class="org-comment-delimiter"># </span><span class="org-comment">bg=bg1, fg=fg3</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">active window title colors</span>
<span class="org-variable-name">set-window-option -g window-status-current-style bg</span>=red,fg=colour237 <span class="org-comment-delimiter"># </span><span class="org-comment">fg=bg1</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">pane border</span>
<span class="org-variable-name">set-option -g pane-active-border-style fg</span>=colour250 <span class="org-comment-delimiter">#</span><span class="org-comment">fg2</span>
<span class="org-variable-name">set-option -g pane-border-style fg</span>=colour237 <span class="org-comment-delimiter">#</span><span class="org-comment">bg1</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">message infos</span>
<span class="org-variable-name">set-option -g message-style bg</span>=colour239,fg=colour223 <span class="org-comment-delimiter"># </span><span class="org-comment">bg=bg2, fg=fg1</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">writing commands inactive</span>
<span class="org-variable-name">set-option -g message-command-style bg</span>=colour239,fg=colour223 <span class="org-comment-delimiter"># </span><span class="org-comment">bg=fg3, fg=bg1</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">pane number display</span>
set-option -g display-panes-active-colour colour250 <span class="org-comment-delimiter">#</span><span class="org-comment">fg2</span>
set-option -g display-panes-colour colour237 <span class="org-comment-delimiter">#</span><span class="org-comment">bg1</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">clock</span>
set-window-option -g clock-mode-colour colour109 <span class="org-comment-delimiter">#</span><span class="org-comment">blue</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">bell</span>
<span class="org-variable-name">set-window-option -g window-status-bell-style bg</span>=colour167,fg=colour235 <span class="org-comment-delimiter"># </span><span class="org-comment">bg=red, fg=bg</span>
<span class="org-comment-delimiter">## </span><span class="org-comment">Theme settings mixed with colors (unfortunately, but there is no cleaner way)</span>
set-option -g status-justify <span class="org-string">"left"</span>
set-option -g status-left-style none
set-option -g status-left-length <span class="org-string">"80"</span>
set-option -g status-right-style none
set-option -g status-right-length <span class="org-string">"80"</span>
set-window-option -g window-status-separator <span class="org-string">""</span>
set-option -g status-left <span class="org-string">"#[fg=colour248, bg=colour241] #S #[fg=colour241, bg=colour237, nobold, noitalics, nounderscore]&#57520;"</span>
set-option -g status-right <span class="org-string">"#[fg=colour239, bg=colour237, nobold, nounderscore, noitalics]&#57522;#[fg=colour246,bg=colour239] %Y-%m-%d &#57523; %H:%M #[fg=colour248, bg=colour239, nobold, noitalics, nounderscore]#{?client_prefix,#[fg=colour124],}&#57522;#[fg=colour237, bg=colour248]#{?client_prefix,#[bg=colour124],} #h "</span>
set-window-option -g window-status-current-format <span class="org-string">"#[fg=colour237, bg=colour214, nobold, noitalics, nounderscore]&#57520;#[fg=colour239, bg=colour214] #I &#57521;#[fg=colour239, bg=colour214, bold] #W #[fg=colour214, bg=colour237, nobold, noitalics, nounderscore]&#57520;"</span>
set-window-option -g window-status-format <span class="org-string">"#[fg=colour237,bg=colour239,noitalics]&#57520;#[fg=colour223,bg=colour239] #I &#57521;#[fg=colour223, bg=colour239] #W #[fg=colour239, bg=colour237, noitalics]&#57520;"</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-org38bb482" class="outline-2">
<h2 id="org38bb482">Bindings</h2>
<div class="outline-text-2" id="text-org38bb482">
<div class="org-src-container">
<pre class="src src-conf"><span class="org-comment-delimiter"># </span><span class="org-comment">Set prefix to 'C-Space'</span>
unbind C-b
set -g prefix C-Space
<span class="org-comment-delimiter"># </span><span class="org-comment">Reload the config using 'C-Space + r'</span>
bind r source-file ~/.tmux.conf \; display-message <span class="org-string">"Config reloaded..."</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">Simulate 'C-l' to clear the terminal</span>
bind C-l send-keys C-l \; clear-history
<span class="org-comment-delimiter"># </span><span class="org-comment">Open new panes with the path of the current pane.</span>
unbind c
bind c new-window -c <span class="org-string">'#{pane_current_path}'</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">Vim-like key bindings for pane navigation (default uses cursor keys).</span>
unbind h
bind h select-pane -L
unbind j
bind j select-pane -D
unbind k
bind k select-pane -U
unbind l <span class="org-comment-delimiter"># </span><span class="org-comment">normally used for last-window</span>
bind l select-pane -R
<span class="org-comment-delimiter"># </span><span class="org-comment">Move Panes</span>
unbind L
bind L swap-pane -D
unbind H
bind H swap-pane -U
<span class="org-comment-delimiter"># </span><span class="org-comment">Resizing (mouse also works).</span>
unbind Left
bind -r Left resize-pane -L <span class="org-highlight-numbers-number">5</span>
unbind Right
bind -r Right resize-pane -R <span class="org-highlight-numbers-number">5</span>
unbind Down
bind -r Down resize-pane -D <span class="org-highlight-numbers-number">5</span>
unbind Up
bind -r Up resize-pane -U <span class="org-highlight-numbers-number">5</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">Fast toggle (normally prefix-l).</span>
bind ^space last-window
<span class="org-comment-delimiter"># </span><span class="org-comment">Intuitive window-splitting keys.</span>
bind / split-window -h -c <span class="org-string">'#{pane_current_path}'</span> <span class="org-comment-delimiter"># </span><span class="org-comment">normally prefix-%</span>
bind - split-window -v -c <span class="org-string">'#{pane_current_path}'</span> <span class="org-comment-delimiter"># </span><span class="org-comment">normally prefix-"</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">Swap windows</span>
bind-key -r <span class="org-string">"&lt;"</span> swap-window -t -1
bind-key -r <span class="org-string">"&gt;"</span> swap-window -t +1
<span class="org-comment-delimiter"># </span><span class="org-comment">Smart pane switching with awareness of Vim splits</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">See: https://github.com/christoomey/vim-tmux-navigator</span>
<span class="org-variable-name">is_vim</span>=<span class="org-string">"ps -o state= -o comm= -t '#{pane_tty}' \</span>
<span class="org-string"> | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"</span>
bind-key -n C-h if-shell <span class="org-string">"$is_vim"</span> <span class="org-string">"send-keys C-h"</span> <span class="org-string">"select-pane -L"</span>
bind-key -n C-j if-shell <span class="org-string">"$is_vim"</span> <span class="org-string">"send-keys C-j"</span> <span class="org-string">"select-pane -D"</span>
bind-key -n C-k if-shell <span class="org-string">"$is_vim"</span> <span class="org-string">"send-keys C-k"</span> <span class="org-string">"select-pane -U"</span>
bind-key -n C-l if-shell <span class="org-string">"$is_vim"</span> <span class="org-string">"send-keys C-l"</span> <span class="org-string">"select-pane -R"</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">Set 'C-Space + v' to enter copy-mode</span>
unbind [
bind-key v copy-mode
<span class="org-comment-delimiter"># </span><span class="org-comment">Set 'C-Space + C-v' to paste</span>
unbind ]
bind-key C-v paste-buffer
<span class="org-comment-delimiter"># </span><span class="org-comment">Setup 'v' to begin selection as in Vim and 'y' to yank</span>
bind-key -T copy-mode-vi <span class="org-string">'v'</span> send -X begin-selection
bind-key -T copy-mode-vi <span class="org-string">'y'</span> send -X copy-pipe-and-cancel <span class="org-string">"xsel -i -p &amp;&amp; xsel -o -p | xsel -i -b"</span>
bind-key -T copy-mode-vi <span class="org-string">'Escape'</span> send -X cancel
bind-key -T copy-mode-vi <span class="org-string">'C-v'</span> send-keys -X rectangle-toggle
</pre>
</div>
</div>
</div>
<div id="outline-container-org364f2d8" class="outline-2">
<h2 id="org364f2d8">Settings</h2>
<div class="outline-text-2" id="text-org364f2d8">
<div class="org-src-container">
<pre class="src src-conf"><span class="org-comment-delimiter"># </span><span class="org-comment">Activity monitoring</span>
set -g visual-activity off
<span class="org-comment-delimiter"># </span><span class="org-comment">Automatically renumber window numbers on closing a pane (tmux &gt;= 1.7).</span>
set -g renumber-windows on
<span class="org-comment-delimiter"># </span><span class="org-comment">Mouse can be used to select panes, select windows (by clicking on the status bar), resize panes</span>
set -g mouse on
set -g default-terminal <span class="org-string">"screen-256color"</span>
set -ga terminal-overrides <span class="org-string">',xterm-256color:Tc'</span>
set -g history-limit <span class="org-highlight-numbers-number">262144</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">Start window and pane numbering at 1, (0 is too hard to reach)</span>
set -g base-index <span class="org-highlight-numbers-number">1</span>
set -g pane-base-index <span class="org-highlight-numbers-number">1</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">Don't wait for an escape sequence after seeing C-a</span>
set -s escape-time <span class="org-highlight-numbers-number">0</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">Dynamically update iTerm tab and window titles</span>
set -g set-titles on
<span class="org-comment-delimiter"># </span><span class="org-comment">Needed as on tmux 1.9 and up (defaults to off)</span>
set -g focus-events on
<span class="org-comment-delimiter"># </span><span class="org-comment">But don't change tmux's own window titles</span>
set-option -g allow-rename off
<span class="org-comment-delimiter"># </span><span class="org-comment">Don't wrap searches; it's super confusing given tmux's reverse-ordering of position info in copy mode</span>
set -w -g wrap-search off
<span class="org-comment-delimiter"># </span><span class="org-comment">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.</span>
bind-key -T root WheelUpPane \
<span class="org-variable-name">if-shell -Ft</span>= <span class="org-string">'#{?pane_in_mode,1,#{mouse_any_flag}}'</span> \
<span class="org-string">'send -Mt='</span> \
<span class="org-string">'if-shell -Ft= "#{alternate_on}" "send -t= Up" "copy-mode -et="'</span>
bind-key -T root WheelDownPane \
<span class="org-variable-name">if-shell -Ft</span> = <span class="org-string">'#{?pane_in_mode,1,#{mouse_any_flag}}'</span> \
<span class="org-string">'send -Mt='</span> \
<span class="org-string">'if-shell -Ft= "#{alternate_on}" "send -t= Down" "send -Mt="'</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">Stay in copy mode on drag end, but otherwise exit for mouse up.</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">Requires patch from https://github.com/tmux/tmux/issues/326</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">unbind-key -t vi-copy MouseDragEnd1Pane</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">bind-key -t vi-copy MouseUp1Pane cancel</span>
<span class="org-variable-name">bind-key -n MouseDrag1Status swap-window -t</span>=
<span class="org-comment-delimiter"># </span><span class="org-comment">bind-key -n MouseDown3Status new-window -a -t=</span>
<span class="org-variable-name">bind-key -n MouseDrag1Status swap-window -t</span>=
<span class="org-comment-delimiter"># </span><span class="org-comment">bind-key -n MouseDown3Status new-window -a -t=</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">#T = standard window title (last command, see ~/.bash_profile)</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">#h = short hostname</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">#S = session name</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">#W = tmux window name</span>
set -g set-titles-string <span class="org-string">"#T : #h &gt; #S &gt; #W"</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">Show bells in window titles</span>
<span class="org-variable-name">set -g window-status-bell-style fg</span>=yellow,bold,underscore
<span class="org-comment-delimiter"># </span><span class="org-comment">Causes tmux to resize a window based on the smallest client actually viewing it, not on the smallest one attached to the entire session</span>
set-window-option -g aggressive-resize
</pre>
</div>
</div>
</div>
<div id="outline-container-orgabc3f53" class="outline-2">
<h2 id="orgabc3f53">Plugins</h2>
<div class="outline-text-2" id="text-orgabc3f53">
</div>
<div id="outline-container-org20fa141" class="outline-3">
<h3 id="org20fa141">Install plugins</h3>
<div class="outline-text-3" id="text-org20fa141">
<div class="org-src-container">
<pre class="src src-conf">set -g @plugin <span class="org-string">'tmux-plugins/tpm'</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">set -g @plugin 'tmux-plugins/tmux-sessionist'</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">set -g @plugin 'tmux-plugins/tmux-resurrect'</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">set -g @plugin 'tmux-plugins/tmux-continuum'</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">set -g @plugin 'tmux-plugins/tmux-battery'</span>
set -g @plugin <span class="org-string">'nhdaly/tmux-better-mouse-mode'</span>
set -g @plugin <span class="org-string">'seebi/tmux-colors-solarized'</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-orgd295864" class="outline-3">
<h3 id="orgd295864">Configuration</h3>
<div class="outline-text-3" id="text-orgd295864">
<div class="org-src-container">
<pre class="src src-conf"><span class="org-comment-delimiter"># </span><span class="org-comment">=============================================================</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">tmux-resurrect</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">=============================================================</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">for vim</span>
set -g @resurrect-strategy-vim <span class="org-string">'session'</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">for neovim</span>
set -g @resurrect-strategy-nvim <span class="org-string">'session'</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">Restoring pane contents</span>
set -g @resurrect-capture-pane-contents <span class="org-string">'on'</span>
run-shell ~/.tmux/plugins/tmux-resurrect/resurrect.tmux
<span class="org-comment-delimiter"># </span><span class="org-comment">=============================================================</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">=============================================================</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">tmux-continuum</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">=============================================================</span>
set -g @continuum-boot <span class="org-string">'on'</span>
set -g @continuum-boot-options <span class="org-string">'iterm,fullscreen'</span>
set -g @continuum-save-interval <span class="org-string">'15'</span>
run-shell ~/.tmux/plugins/tmux-continuum/continuum.tmux
<span class="org-comment-delimiter"># </span><span class="org-comment">=============================================================</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">=============================================================</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">tmux-battery</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">=============================================================</span>
set -g @batt_charged_icon <span class="org-string">"="</span>
set -g @batt_charging_icon <span class="org-string">"+"</span>
set -g @batt_discharging_icon <span class="org-string">"-"</span>
set -g @batt_attached_icon <span class="org-string">"o"</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">=============================================================</span>
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-org6ad3f07" class="outline-2">
<h2 id="org6ad3f07">Colors</h2>
<div class="outline-text-2" id="text-org6ad3f07">
<div class="org-src-container">
<pre class="src src-conf">set -g @colors-solarized <span class="org-string">'light'</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-org1235a26" class="outline-2">
<h2 id="org1235a26">Initialize TMUX plugin manager</h2>
<div class="outline-text-2" id="text-org1235a26">
<div class="org-src-container">
<pre class="src src-conf">run <span class="org-string">'~/.tmux/plugins/tpm/tpm'</span>
</pre>
</div>
</div>
</div>
</div>
<div id="postamble" class="status">
<p class="author">Author: Dehaeze Thomas</p>
<p class="date">Created: 2021-01-01 ven. 20:09</p>
</div>
</body>
</html>