diff options
Diffstat (limited to '.config')
| -rw-r--r-- | .config/tmux/tmux.conf | 260 |
1 files changed, 260 insertions, 0 deletions
diff --git a/.config/tmux/tmux.conf b/.config/tmux/tmux.conf new file mode 100644 index 0000000..8130c7f --- /dev/null +++ b/.config/tmux/tmux.conf @@ -0,0 +1,260 @@ +# +# _ __ +# | |_ _ __ ___ _ ___ __ ___ ___ _ __ / _| +# | __| '_ ` _ \| | | \ \/ / / __/ _ \| '_ \| |_ +# | |_| | | | | | |_| |> < | (_| (_) | | | | _| +# \__|_| |_| |_|\__,_/_/\_(_)___\___/|_| |_|_| +# + + +#―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― +# Setting the prefix from C-b to C-s +unbind C-b +set -g prefix C-s +# Ensure that we can send Ctrl-S to other apps +bind C-s send-prefix +#set -g prefix M-Space +#set -g prefix C-Space +#setting the delay between prefix and command +set-option -sg escape-time 10 +#set -s escape-time 0 +# Vi mode in tmux, can confirm this working by pressing <prefix>:list-keys -T copy-mode-vi +# <prefix>[ to enter copy-mode to allow copying text or view history buffer, including search with / and ?. Screenwise vertical movemont with <ctrl-f> or <ctrl-b> +set-window-option -g mode-keys vi +# Reload the file with Prefix r +#bind r source-file ~/.tmux.conf \; display "Reloaded!" +bind r source-file ~/.config/tmux/tmux.conf \; display "Reloaded!" +#set -g history-limit 10000 + +# use the mouse +#set-window-option -g mode-mouse on +#set -g mouse-select-pane on +#set -g mouse-resize-pane on +#set -g mouse-select-window on + +# pane movement +bind-key j command-prompt -p "send pane to:" "join-pane -t '%%'" + +# Pane resizing, default is D,U,L,R +bind -r H resize-pane -L 20 +bind -r J resize-pane -D 20 +bind -r K resize-pane -U 20 +bind -r L resize-pane -R 20 + +bind-key M-j resize-pane -D 5 +bind-key M-k resize-pane -U 5 +bind-key M-h resize-pane -L 5 +bind-key M-l resize-pane -R 5 + +# Hide a pane and bring it back with <prefix>! and <prefix>@ respectively +bind-key ! break-pane -d -n _hidden_pane +bind-key @ join-pane -s $.0 +# enable activity alerts +#setw -g monitor-activity on +#set -g visual-activity on + +# Update the status bar every sixty seconds +#set -g status-interval 60 + +# set colors for the active window +#setw -g window-status-current-fg white +#setw -g window-status-current-bg red +#setw -g window-status-current-attr bright +#set -g status-style fg="#000000",bg="#53E2AE" +#set -g pane-active-border-style bg=default,fg="#fe8019" +#set -g pane-border-style fg="#53E2AE" + +## COLOUR (Solarized light) + +## default statusbar colors +#set-option -g status-bg default +#set-option -g status-fg green +#set-option -g status-attr default +# +## default window title colors +#set-window-option -g window-status-fg magenta +#set-window-option -g window-status-bg default +#set-window-option -g window-status-attr dim +# +#set -g status-left-length 85 +#set -g status-left "#[fg=yellow bg=default]#h #[fg=blue] #S #[fg=yellow] #I " +#set -g window-status-current-format "#[fg=black,bold bg=default]│#[fg=white bg=cyan]#W#[fg=black,bold bg=default]│" +#set -g status-right "#[fg=magenta] #[bg=gray] %b %d %Y %l:%M %p" +#set -g status-justify centre + + +# active window title colors +#set-window-option -g window-status-current-fg cyan +#set-window-option -g window-status-current-bg default +#set-window-option -g window-status-current-attr bright + + +# pane border +# set-option -g pane-border-fg black +# set-option -g pane-border-bg black +# set-option -g pane-active-border-fg red +# set-option -g pane-active-border-bg default +# allow 'autoread' to work in neovim by focus events +# focus events enabled for terminals that support them +set-option -g focus-events on + +# super useful when using "grouped sessions" and multi-monitor setup +setw -g aggressive-resize on + + + +set -g mouse on + +# Vi mode in tmux, can confirm this working by pressing <prefix>:list-keys -T copy-mode-vi +# <prefix>[ to enter copy-mode to allow copying text or view history buffer, including search with / and ?. Screenwise vertical movemont with <ctrl-f> or <ctrl-b> +set-window-option -g mode-keys vi + + +# change selection <space> and enter to vi keybinding +#bind-key -T copy-mode-vi 'v' send -X begin-selection +#bind-key -T copy-mode-vi 'y' send -X copy-selection-and-cancel + +# X clipboard integration +# Vim style +#bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "xclip -i -sel clip > /dev/null" + +#for copying to sys clipboard +#bind -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "xclip -i -f -selection primary | xclip -i -selection clipboard" +#bind -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "xclip -i -f -selection primary | xclip -i -selection clipboard" +#bind -T copy-mode-vi C-c send-keys -X copy-pipe-and-cancel "xclip -i -f -selection primary | xclip -i -selection clipboard" + +# map copy mode to ctrl+alt+v +bind-key -n 'M-v' copy-mode + +bind-key -T copy-mode-vi v send -X begin-selection + +if-shell -b 'echo $XDG_SESSION_TYPE | grep -q x11' "\ + bind-key -T copy-mode-vi 'y' send-keys -X copy-pipe-and-cancel 'xclip -in -selection clipboard > /dev/null'; \ + bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel 'xclip -in -selection clipboard > /dev/null'; \ + bind-key C-M-v run 'xclip -out -selection clipboard | tmux load-buffer - ; tmux paste-buffer'" + +if-shell -b 'echo $XDG_SESSION_TYPE | grep -q wayland' "\ + bind-key -T copy-mode-vi 'y' send-keys -X copy-pipe-and-cancel 'wl-copy'; \ + bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel 'wl-copy'; \ + bind-key C-p run 'wl-paste --no-newline | tmux load-buffer - ; tmux paste-buffer'" "\ + \ + bind-key -T copy-mode-vi 'y' send-keys -X copy-pipe-and-cancel 'cat - >/dev/clipboard'; \ + bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel 'cat - >/dev/clipboard'; \ + bind-key C-M-v run 'cat /dev/clipboard | tmux load-buffer - ; tmux paste-buffer'" + + + + +# Vim style copy to clipboard +#bind-key p run "xclip -o -sel clip | tmux load-buffer - ; tmux paste-buffer" + + +# Change split <Prefix>% and <Prefix>" to <Prefix>| and <Prefix>- +bind v split-window -h -c "#{pane_current_path}" +bind h split-window -v -c "#{pane_current_path}" +#bind-key v split-window -h +#bind-key s split-window -v + + +# smart pane switching with awareness of vim splits +bind -n C-h run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-h) || tmux select-pane -L" +bind -n C-j run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-j) || tmux select-pane -D" +bind -n C-k run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-k) || tmux select-pane -U" +bind -n C-l run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-l) || tmux select-pane -R" +#bind -n C-\ run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys 'C-\\') || tmux select-pane -l" + +# use prefix + l to clear terminal +bind C-l send-keys 'C-l' +## set the default TERM +#set-option -g default-terminal "screen-256color" +#set-option -g default-terminal "tmux-256color" +#set -g default-terminal screen +# update the TERM variable of terminal emulator when creating a new session or attaching a existing session +#set -g update-environment 'DISPLAY SSH_ASKPASS SSH_AGENT_PID SSH_CONNECTION WINDOWID XAUTHORITY TERM' +# determine if we should enable 256-colour support +#if "[[ ${TERM} =~ 256color || ${TERM} == fbterm ]]" 'set -g default-terminal screen-256color' +#set -g default-terminal "tmux-256color" +#set -ga terminal-overrides ",xterm-256color:Tc" +#set-option -g default-terminal "tmux-256color" +set-option -sa terminal-overrides ",tmux-256color:Tc" +#set-option -sa terminal-overrides ",xterm*:Tc" +set-option -sa terminal-overrides ",xterm*:Tc,alacritty*:Tc" +# Enable RGB colour if running in xterm(1) +#set-option -sa terminal-overrides ",xterm*:Tc" +#set -ga terminal-overrides ",*256col*:Tc" + +## Detach from current session +#bind -n M-d detach-client +# +## Popup scratch session +#bind -n M-g display-popup -E "tmux new-session -A -s scratch" +# +## non-popup +#bind C-j new-window -n "session-switcher" "\ +# tmux list-sessions -F '#{?session_attached,,#{session_name}}' |\ +# sed '/^$/d' |\ +# fzf --reverse --header jump-to-session --preview 'tmux capture-pane -pt {}' |\ +# xargs tmux switch-client -t" +## popup +#bind C-j display-popup -E "\ +# tmux list-sessions -F '#{?session_attached,,#{session_name}}' |\ +# sed '/^$/d' |\ +# fzf --reverse --header jump-to-session --preview 'tmux capture-pane -pt {}' |\ +# xargs tmux switch-client -t" +#bind -n M-f display-popup -E "\ +# tmux list-sessions -F '#{?session_attached,,#{session_name}}' |\ +# sed '/^$/d' |\ +# fzf --reverse --header jump-to-session --preview 'tmux capture-pane -pt {}' |\ +# xargs tmux switch-client -t" +# +#bind -n M-? list-keys +#bind -n M-1 select-window -t :=1 +#bind -n M-2 select-window -t :=2 +#bind -n M-3 select-window -t :=3 +#bind -n M-4 select-window -t :=4 +#bind -n M-5 select-window -t :=5 +#bind -n M-6 select-window -t :=6 +#bind -n M-7 select-window -t :=7 +#bind -n M-8 select-window -t :=8 +#bind -n M-9 select-window -t :=9 +#bind -n M-0 select-window -t :=0 + +#set -g focus-events on +#set -g status-style bg=default +#set -g status-left-length 90 +#set -g status-right-length 90 +#set -g status-justify centre + +# list of plugins +set -g @plugin 'tmux-plugins/tpm' +#set -g @plugin 'tmux-plugins/tmux-sensible' +set -g @plugin 'tmux-plugins/tmux-resurrect' +set -g @plugin 'tmux-plugins/tmux-continuum' +set -g @plugin 'christoomey/vim-tmux-navigator' +#set -g @plugin 'tmux-plugins/tmux-yank' + +# Plugins settings +# Plugin to save and restore tmux sessions after restart +# * Save with: prefix + Ctrl-s +# * Restore with: prefix + Ctlr-r + # restore vim and nvim sessions as well + # for vim + set -g @resurrect-strategy-vim 'session' + # for neovim + set -g @resurrect-strategy-nvim 'session' +# Automatic restore + set -g @continuum-restore 'on' +# Change default save and restore keybindings + set -g @resurrect-save 'W' + set -g @resurrect-restore 'E' +# set -g @continuum-boot 'on' +## Restore Panes +# set -g @resurrect-capture-pane-contents 'on' +# This a hook for tmux-resurrect which tells it to kill session 0 before restoring the panels +set -g @resurrect-hook-pre-restore-pane-processes 'tmux switch-client -n && tmux kill-session -t=0' +# plugin uninstall + # Delete or comment out the plugin in .tmux.conf. + # Press <prefix> + alt + u to remove the plugin. +# TMUX plugin manager (keep at the bottom of tmux.conf) +#run -b '~/.tmux/plugins/tpm/tpm' +run -b '~/.config/tmux/plugins/tpm/tpm' |
