tmux/tmux.conf

265 lines
6.6 KiB
Plaintext
Raw Normal View History

##############--------------------------------------------------------------
##
## Fichier de configuration : ~/.tmux/tmux.conf
## 1.0: 14-09-11
##
## By Gardouille
##
## Ce fichier est lu automatiquement par tmux si il est placé dans le homedir
##
##
## Utilisation:
## tmux attach -d -t SESSION_ID
##
## Dépendances:
2017-05-04 15:07:42 +02:00
## physlock: lightweight Linux console locking tool (CTRL+b x).
2024-03-14 16:39:37 +01:00
## urlview|urlscan: Extracts URLs from text (CTRL+b u).
2017-05-04 15:07:42 +02:00
## cmatrix: Simulates the display from "The Matrix" used both with *physlock* (CTRL-b x).
2016-01-28 23:54:55 +01:00
### colors {{{
black="#000000"
lightblack="#151515"
blue="#0094cc"
grey="#909090"
darkgrey="#26221c"
lightgreen="#9fbc00"
green="#345f0c"
pink="#b00a44"
2022-06-09 07:46:59 +02:00
lightpink="#ff0675"
2016-01-28 23:54:55 +01:00
red="#ff0000"
darkred="#8f0000"
2022-06-09 07:46:59 +02:00
debianred="#e70a53"
2016-01-28 23:54:55 +01:00
white="#efefef"
### }}}
### global settings {{{
2016-01-28 23:54:55 +01:00
set -g default-terminal "screen-256color"
2023-08-16 08:17:59 +02:00
source-file ~/.tmux/themes/color.tmux
set-option -g history-limit 10000
2016-01-28 23:54:55 +01:00
### }}}
2016-01-28 01:11:03 +01:00
### statusbar {{{
# Centrer la liste des terminaux
#set -g status-justify centre
# Status line style for the currently active window
## BackGround, ForeGround and attribut
set -g window-status-current-style bg=black,dim,fg="${lightgreen}",bold
# Partie gauche de la barre
# vide
set -g status-left ""
# Si tmux est lancé hors de Xorg, on affiche des informations supplémentaires
## Partie gauche de la barre
# #H : le nom de la machine en vert
#if '[ -z "$DISPLAY" ]' 'set -g status-left "[#[fg=green]#H#[default]]"'
# Raffraichissement de la barre d'état toutes les X secondes
set -g status-interval 1
2016-01-28 01:11:03 +01:00
### }}}
2016-01-28 01:11:03 +01:00
### keybindings {{{
## Redéfinition des raccourcis:
# Renommer le terminal courant
unbind A
bind A command-prompt "rename-window %%"
# Aller au terminal précédent (CTRL+a)
unbind C-a
bind-key C-a last-window
unbind C-b
bind-key C-b last-window
# Aller au terminal suivant (CTRL+n)
unbind C-n
bind-key C-n next-window
# Aller au terminal précédent (CTRL+p)
unbind C-p
bind-key C-p previous-window
#Copy tmux buffer to CLIPBOARD
2015-05-19 22:46:38 +02:00
unbind C-y
2017-12-12 09:27:44 +01:00
bind-key C-y run-shell -b "tmux save-buffer - | xclip -i -selection clipboard"
bind-key y run-shell -b "tmux save-buffer - | xclip -i -selection clipboard"
#Copy CLIPBOARD to tmux buffer and paste-it in tmux
2015-05-19 22:46:38 +02:00
unbind C-v
bind-key C-v run "tmux set-buffer -- \"$(xclip -o -selection clipboard)\"; tmux paste-buffer"
bind-key v run "tmux set-buffer -- \"$(xclip -o -selection clipboard)\"; tmux paste-buffer"
# Copy-mode
unbind PPage
bind PPage copy-mode
2017-06-27 22:52:26 +02:00
bind-key ESCAPE copy-mode
2015-05-19 22:46:38 +02:00
# Paste buffer
unbind P
bind-key P run "tmux paste-buffer"
# Window selection by name
unbind b
bind-key b command-prompt "find-window -NT '%%'"
# Détacher tmux
unbind C-d
bind C-d detach
2015-05-19 22:09:02 +02:00
# Zoom/Unzoom a pane
unbind f
bind-key f resize-pane -Z
unbind C-f
bind-key C-f resize-pane -Z
# Verrouiller tmux
unbind C-x
bind C-x lock-server
unbind x
bind x lock-server
# Activer/Désactiver la synchronisation des panels
unbind C-s
bind C-s set-window-option synchronize-panes
# Present a menu of URLs to open from visible pane
bind-key u capture-pane \;\
save-buffer ~/.tmux/.tmux-buffer \;\
2024-03-14 16:39:37 +01:00
if 'command -v urlview' 'split-window -l 15 "urlview ~/.tmux/.tmux-buffer"' \;\
2024-03-14 16:59:12 +01:00
if 'command -v urlscan' 'split-window -l 15 "urlscan --compact --dedupe --nohelp ~/.tmux/.tmux-buffer"'
# Create a new session
unbind C-t
bind C-t command-prompt "new-session "
# reload tmux settings
unbind R
bind-key R source-file ~/.tmux/tmux.conf\; display-message "tmux config reloaded"
## Nouveaux raccourcis clavier pour les terminaux
# Aller au terminal n°{1,12} avec les touches F{1-12}
#bind ... selectw -t:0
#bind C-& selectw -t:0
bind F1 selectw -t:1
bind F2 selectw -t:2
bind F3 selectw -t:3
bind F4 selectw -t:4
bind F5 selectw -t:5
bind F6 selectw -t:6
bind F7 selectw -t:7
bind F8 selectw -t:8
bind F9 selectw -t:9
bind F10 selectw -t:10
bind F11 selectw -t:11
bind F12 selectw -t:12
# Pour basculer entre les différents terminaux, directement avec les touches F{1,12} (sans utiliser CTRL+a), on peut utiliser ça:
#bind -n F1 select-window -t 1
#bind -n F2 select-window -t 2
#bind -n F3 select-window -t 3
#bind -n F4 select-window -t 4
#bind -n F5 select-window -t 5
#bind -n F6 select-window -t 6
#bind -n F7 select-window -t 7
#bind -n F8 select-window -t 8
#bind -n F9 select-window -t 9
#bind -n F10 select-window -t 10
#bind -n F11 select-window -t 11
#bind -n F12 select-window -t 12
## Nouveaux raccourcis clavier pour les splits/panels
# split windows comme herbsluft + bépo
# Définition des splits comme dans vim (s: vertical et v: horizontal)
#bind s split-window -v
bind Enter split-window -h
unbind Space
bind Space split-window
# Permet de se déplacer entre les panels avec les touches hjkl
# h: gauche
# j: bas
# k: haut
# l: droite
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# Changer la réorganisation des panes
unbind .
bind . next-layout
# Redimentionnement des panels comme vim
# Possibilité de changer la valeur "2" par ce qu'on veut
# < : agrandissement vers la gauche
# > : agrandissement vers la droite
# - : agrandissement vers le bas
# + : agrandissement vers la haut
bind < resize-pane -L 2
bind > resize-pane -R 2
bind - resize-pane -D 2
bind + resize-pane -U 2
# Aller au panel suivant avec Tab
unbind Tab
bind Tab select-pane -t:.+
# Aller au panel précédent avec SHIFT+Tab
unbind BTab
bind BTab select-pane -t:.-
## Raccourcis clavier pour les sessions
# Proposer la liste des sessions avec choix possible
unbind _
bind _ switch-client -n
unbind C-_
bind C-_ choose-session
# toggle status bar
unbind c-h
bind c-h set -g status
# Load splits (with <prefix> + s + Extra key)
## Define a first key
unbind s
bind-key -T prefix s switch-client -T prefix_s
## Default s binding
bind-key -T prefix_s s choose-session
## Then splits
bind-key -T prefix_s i source-file ~/.tmux/splitAUTHENTICATION
bind-key -T prefix_s u source-file ~/.tmux/splitUPDATE
# Initialize sessions
bind I source-file ~/.tmux/splitWORKSTATION
2016-01-28 01:11:03 +01:00
### }}}
2016-01-28 01:11:03 +01:00
### Configuration {{{
# Numéroter les fenêtres et les splits à partir de 1
set -g base-index 1
set -g pane-base-index 1
# Verrouillage de la session après inactivité (en s)
set -g lock-after-time 1800
2017-05-04 15:07:42 +02:00
# pour que le lock marche sous linux (aptitude install physlock)
# Use both cmatrix (if available) and physlock
2023-05-30 08:56:29 +02:00
if 'command -v cmatrix' 'set -g lock-command "cmatrix -s && ~/bin/veille.sh"' 'set -g lock-command ~/bin/veille.sh'
2016-01-28 01:11:03 +01:00
### }}}
### session {{{
## If run a local session, source additionnal file to overload some config
if '[ -z "${SSH_TTY}" ]' 'source-file $HOME/.tmux/tmux.conf.local'
2016-01-28 01:11:03 +01:00
### }}}
2017-06-27 22:51:34 +02:00
### bepo {{{
if 'setxkbmap -print|grep bepo' 'source-file $HOME/.tmux/tmux.conf.bepo'
### }}}