update tmux config

This commit is contained in:
vincent 2022-01-27 19:29:00 +01:00
parent 9db69604ef
commit a175b727e0
2 changed files with 105 additions and 124 deletions

105
tmux/.config/tmux/tmux.conf Normal file
View File

@ -0,0 +1,105 @@
#+----------+
#| Settings |
#+----------+
# Options
set-option -g base-index 1 # Start windows numbering at 1
set-option -g default-terminal "xterm-kitty" # Setting the correct term
set-option -g history-limit 30000 # Increase scrollback buffer size
set-option -g mouse on # Turn mouse-mode on
set-option -g renumber-windows on # Renumber windows when a window is closed
set-option -g set-titles on # Set the client terminal title
set-option -g status-interval 1 # Refresh status more often
set-option -g status-keys vi # Vi key bindings in tmux command prompt
#+--------------+
#| Key bindings #
#+--------------+
#+-------+
#| Theme |
#+-------+
# Window
set-option -g window-style "bg=black"
set-option -g window-active-style "bg=terminal"
# Status
set -g status-style "bg=black"
set -g status-left " #{session_name} "
set -g status-left-style "bg=cyan,fg=black"
set-window-option -g window-status-separator ""
set-window-option -g window-status-style "bg=terminal,fg=terminal"
set-window-option -g window-status-current-style "bg=brightwhite,fg=black"
set-window-option -g window-status-activity-style "bg=red,fg=black"
set-window-option -g window-status-format " #{window_index}: #{window_name} "
set-window-option -g window-status-current-format "\
#{?window_zoomed_flag,#[bg=yellow],}#{?client_prefix,#[bg=green],} \
#{window_index}: #{window_name} \
"
set -g status-right "\
#[fg=blue]#[bg=blue,fg=black] \
 %R \
#[bg=blue,fg=yellow]#[bg=yellow,fg=black] \
 %a, %b %d \
"
# Borders
set-option -g pane-border-style "bg=black,fg=#000000"
set-option -g pane-active-border-style "bg=black,fg=#000000"
#+--------------+
#| Key bindings #
#+--------------+
# Prefix
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix
#focus pane
bind-key -n M-h select-pane -L
bind-key -n M-l select-pane -R
bind-key -n M-k select-pane -U
bind-key -n M-j select-pane -D
bind-key -T copy-mode-vi M-h select-pane -L
bind-key -T copy-mode-vi M-j select-pane -D
bind-key -T copy-mode-vi M-k select-pane -U
bind-key -T copy-mode-vi M-l select-pane -R
bind-key -T copy-mode-vi M-` select-window -l
# Swap pane
bind-key -n M-H swap-pane -s '{left-of}'
bind-key -n M-J swap-pane -s '{down-of}'
bind-key -n M-K swap-pane -s '{up-of}'
bind-key -n M-L swap-pane -s '{right-of}'
# Focus window or create if not exist
bind-key -n M-1 if-shell 'tmux select-window -t :1' '' 'new-window -t :1'
bind-key -n M-2 if-shell 'tmux select-window -t :2' '' 'new-window -t :2'
bind-key -n M-3 if-shell 'tmux select-window -t :3' '' 'new-window -t :3'
bind-key -n M-4 if-shell 'tmux select-window -t :4' '' 'new-window -t :4'
bind-key -n M-5 if-shell 'tmux select-window -t :5' '' 'new-window -t :5'
bind-key -n M-6 if-shell 'tmux select-window -t :6' '' 'new-window -t :6'
bind-key -n M-7 if-shell 'tmux select-window -t :7' '' 'new-window -t :7'
bind-key -n M-8 if-shell 'tmux select-window -t :8' '' 'new-window -t :8'
bind-key -n M-9 if-shell 'tmux select-window -t :9' '' 'new-window -t :9'
# Automatically choose split direction with longest side scheme
bind-key -n M-Enter if-shell '[ "$(expr 25 \* #{pane_height} / 10 )" -lt "#{pane_width}" ]' \
'split-pane -h -c "#{pane_current_path}"' \
'split-pane -v -c "#{pane_current_path}"'
# Kill pane
bind-key -n M-Q kill-pane
# Copy mode
bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T copy-mode-vi y send-keys -X copy-selection-and-cancel
bind-key -n M-R source-file ~/.config/tmux/tmux.conf\; display-message "Config reloaded"

View File

@ -1,124 +0,0 @@
#on utilise alt + flèches our naviguer entre les panels
bind-key -n M-left select-pane -L
bind-key -n M-right select-pane -R
bind-key -n M-up select-pane -U
bind-key -n M-down select-pane -D
bind-key -n M-h select-pane -L
bind-key -n M-l select-pane -R
bind-key -n M-k select-pane -U
bind-key -n M-j select-pane -D
bind j select-pane -D
bind h select-pane -L
bind l select-pane -R
bind k select-pane -U
#On change les raccourcis pour faire du split vertical et horizontal
#On utilise la touche "|" (pipe) pour faire un split vertical
bind | split-window -h
#Et la touche "-" pour faire un split horizontal
bind - split-window -v
unbind '"'
unbind %
##################################
#Changements pratiques
##################################
#On permet l'utilisation de la souris pour changer de terminal et de panel
setw -g mouse on
set -g mouse on
bind -n WheelUpPane if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" "if -Ft= '#{pane_in_mode}' 'send-keys -M' 'select-pane -t=; copy-mode -e; send-keys -M'"
bind -n WheelDownPane select-pane -t= \; send-keys -M
bind -n C-WheelUpPane select-pane -t= \; copy-mode -e \; send-keys -M
bind -T copy-mode-vi C-WheelUpPane send-keys -X halfpage-up
bind -T copy-mode-vi C-WheelDownPane send-keys -X halfpage-down
bind -T copy-mode-emacs C-WheelUpPane send-keys -X halfpage-up
bind -T copy-mode-emacs C-WheelDownPane send-keys -X halfpage-down
# To copy, left click and drag to highlight text in yellow,
# once you release left click yellow text will disappear and will automatically be available in clibboard
# # Use vim keybindings in copy mode
setw -g mode-keys vi
# Update default binding of `Enter` to also use copy-pipe
unbind -T copy-mode-vi Enter
bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "xclip -selection c"
bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "xclip -in -selection clipboard"
bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'xclip -sel clip -i'
#Les fenêtres commencent par 1 et non par 0
set -g base-index 1
set -g history-limit 30000
bind r source-file ~/.tmux.conf \; display "Configuration Reloaded!"
######################
### DESIGN CHANGES ###
######################
# loud or quiet?
set -g visual-activity off
set -g visual-bell off
set -g visual-silence off
setw -g monitor-activity off
set -g bell-action none
# modes
setw -g clock-mode-colour colour5
setw -g mode-style 'fg=colour1 bg=colour18 bold'
# panes
set -g pane-border-style 'fg=colour19 bg=colour0'
set -g pane-active-border-style 'bg=colour0 fg=colour9'
# statusbar
set -g status-position bottom
set -g status-justify left
set -g status-style 'bg=colour18 fg=colour137 dim'
set -g status-left ''
set -g status-right '#[fg=colour233,bg=colour19] %d/%m #[fg=colour233,bg=colour8] %H:%M:%S '
set -g status-right-length 50
set -g status-left-length 20
setw -g window-status-current-style 'fg=colour1 bg=colour19 bold'
setw -g window-status-current-format ' #I#[fg=colour249]:#[fg=colour255]#W#[fg=colour249]#F '
setw -g window-status-style 'fg=colour9 bg=colour18'
setw -g window-status-format ' #I#[fg=colour237]:#[fg=colour250]#W#[fg=colour244]#F '
setw -g window-status-bell-style 'fg=colour255 bg=colour1 bold'
# messages
set -g message-style 'fg=colour232 bg=colour16 bold'
# status bar theme
#set -g status-bg 'colour235'
#set -g message-command-fg 'colour222'
#set -g status-justify 'centre'
#set -g status-left-length '100'
#set -g status 'on'
#set -g pane-active-border-fg 'colour154'
#set -g message-bg 'colour238'
#set -g status-right-length '100'
#set -g status-right-attr 'none'
#set -g message-fg 'colour222'
#set -g message-command-bg 'colour238'
#set -g status-attr 'none'
#set -g status-utf8 'on'
#set -g pane-border-fg 'colour238'
#set -g status-left-attr 'none'
#setw -g window-status-fg 'colour121'
#setw -g window-status-attr 'none'
#setw -g window-status-activity-bg 'colour235'
#setw -g window-status-activity-attr 'none'
#setw -g window-status-activity-fg 'colour154'
#setw -g window-status-separator ''
#setw -g window-status-bg 'colour235'
#set -g status-left '#[fg=colour232,bg=colour154] #S #[fg=colour154,bg=colour238,nobold,nounderscore,noitalics]#[fg=colour222,bg=colour238] #W #[fg=colour238,bg=colour235,nobold,nounderscore,noitalics]#[fg=colour121,bg=colour235] #(whoami)  #(uptime | cut -d " " -f 1,2,3) #[fg=colour235,bg=colour235,nobold,nounderscore,noitalics]'
#set -g status-right '#[fg=colour235,bg=colour235,nobold,nounderscore,noitalics]#[fg=colour121,bg=colour235] %r  %a  %Y #[fg=colour238,bg=colour235,nobold,nounderscore,noitalics]#[fg=colour222,bg=colour238] #H #[fg=colour154,bg=colour238,nobold,nounderscore,noitalics]#[fg=colour232,bg=colour154] #(rainbarf --battery --remaining --no-rgb) '
#setw -g window-status-format '#[fg=colour235,bg=colour235,nobold,nounderscore,noitalics]#[default] #I  #W #[fg=colour235,bg=colour235,nobold,nounderscore,noitalics]'
#setw -g window-status-current-format '#[fg=colour235,bg=colour238,nobold,nounderscore,noitalics]#[fg=colour222,bg=colour238] #I  #W  #F #[fg=colour238,bg=colour235,nobold,nounderscore,noitalics]'