aboutsummaryrefslogtreecommitdiff
path: root/.config/tmux/tmux.conf
diff options
context:
space:
mode:
Diffstat (limited to '.config/tmux/tmux.conf')
-rw-r--r--.config/tmux/tmux.conf332
1 files changed, 332 insertions, 0 deletions
diff --git a/.config/tmux/tmux.conf b/.config/tmux/tmux.conf
new file mode 100644
index 0000000..b93a0fd
--- /dev/null
+++ b/.config/tmux/tmux.conf
@@ -0,0 +1,332 @@
+# ████████╗███╗ ███╗██╗ ██╗██╗ ██╗
+# ╚══██╔══╝████╗ ████║██║ ██║╚██╗██╔╝
+# ██║ ██╔████╔██║██║ ██║ ╚███╔╝
+# ██║ ██║╚██╔╝██║██║ ██║ ██╔██╗
+# ██║ ██║ ╚═╝ ██║╚██████╔╝██╔╝ ██╗
+# ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝
+#――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
+# 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>h and <Prefix>v and change current working directory
+bind v split-window -h -c "#{pane_current_path}"
+bind h split-window -v -c "#{pane_current_path}"
+
+
+# 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
+
+# Colors for pane borders(default)
+setw -g pane-border-style fg=white
+setw -g pane-active-border-style fg=green
+
+# Active pane normal, other shaded out
+setw -g window-style fg=colour240
+setw -g window-active-style fg=white
+
+
+#set -g focus-events on
+#set -g status-style bg=default
+# Set the position of window lists
+#set -g status-justify centre
+# Set the status bar position
+set -g status-position bottom # [top, bottom]
+set -g status on
+set -g status-interval 1
+
+
+#set-option -g status-style bg=default
+set -g status-style fg=#50fa7b,bg=default
+#set -g status-style fg=DeepSkyBlue1,bg=black
+#set -g status-style fg=black,bg=gray
+
+#set -g status-left-style default
+# Display the session name
+#set -g status-left "#[fg=green] ❐ #S #[default]"
+
+## Left
+#set -g status-left ''
+set -g status-left-length 60
+#set -g status-left "#[bg=#50fa7b,fg=black] ❐ #S #( ~/.config/tmux/left-status.sh ) #[fg=#50fa7b,bg=default]"
+#bind o run-shell "tmux-toggle-option.sh set-option status-left on off"
+#bind o set-option -g status-left "#[bg=#50fa7b,fg=black] ❐ #S #[fg=#50fa7b,bg=default]" \; display-message 'Status-left #{?status,off,on}'
+#set set-option status-left
+#bind o set-option status-left "#[bg=#50fa7b,fg=black] ❐ #S #[fg=#50fa7b,bg=default]" # toggle left-status script off
+#bind o run-shell "if [[ `tmux show-option -w status-left "#[bg=#50fa7b,fg=black] ❐ #S #( ~/.config/tmux/left-status.sh ) #[fg=#50fa7b,bg=default]" ]]; then set -g status-left "#[bg=50fa7b,fg=black] ❐ #S #[fg=#50fa7b,bg=default]" else set -g status-left "#[bg=#50fa7b,fg=black] ❐ #S #( ~/.config/tmux/left-status.sh ) #[fg=#50fa7b,bg=default]" fi
+#bind C-o set-option status-left "#[bg=#50fa7b,fg=black] ❐ #S #( ~/.config/tmux/left-status.sh ) #[fg=#50fa7b,bg=default]" # toggle left status script on
+#bind -T root o \
+# set-option status-left "#[bg=#50fa7b,fg=black] ❐ #S #( ~/.config/tmux/left-status.sh ) #[fg=#50fa7b,bg=default]" \;\ # toggle left status script on
+#
+#bind -T off o \
+# set-option status-left "#[bg=#50fa7b,fg=black] ❐ #S #[fg=#50fa7b,bg=default]" \;\ # toggle left-status script off
+
+#bind Space if -F '#{==:#{@lastlayout},eh}' 'selectl even-vertical; set -w @lastlayout ev' 'selectl even-horizontal; set -w @lastlayout eh'
+
+#set -g status-left
+
+set -g status-left "#[bg=#50fa7b,fg=black] ❐ #S #( ~/.config/tmux/left-status.sh ) #[fg=#50fa7b,bg=default]"
+#bind -Troot o set-g status-left "#[bg=#50fa7b,fg=black] ❐ #S #[fg=#50fa7b,bg=default]"
+#bind -Tempty o set-g status-left "#[bg=#50fa7b,fg=black] ❐ #S #( ~/.config/tmux/left-status.sh ) #[fg=#50fa7b,bg=default]"
+#set-hook -g status-left "#[bg=#50fa7b,fg=black] ❐ #S #( ~/.config/tmux/left-status.sh ) #[fg=#50fa7b,bg=default]"
+#bind o if -F '#{==:#{@set -g status-left "#[bg=#50fa7b,fg=black] ❐ #S #[fg=#50fa7b,bg=default]"}' 'set -g status-left "#[bg=#50fa7b,fg=black] ❐ #S #( ~/.config/tmux/left-status.sh ) #[fg=#50fa7b,bg=default]"'
+#set-hook -g after-select-layout "set -Fw @lastlayout '#{hook_argument_0}'"
+#bind o if -F '#{==:#{@lastlayout},even-horizontal}' 'selectl even-vertical' 'selectl even-horizontal'
+
+
+#set -g status-left "#[fg=DeepSkyBlue1] ❐ #S #( ~/.config/tmux/left-status.sh )"
+#set -g status-left "#[fg=black] ❐ #S #( ~/.config/tmux/left-status.sh )"
+
+# Highlight the current window.
+setw -g window-status-current-style fg=#50fa7b,bg=default,bright
+#setw -g window-status-current-style fg=DeepSkyBlue1,bg=black,bright
+#setw -g window-status-current-style fg=color235,bg=silver,bright
+set -g window-status-current-format ' #I:#W '
+#set -g status-format[0] '#[align=left] ❐ #S #( ~/.config/tmux/left-status.sh )#[align=absolute-centre]#[list=on] #I #W #[nolist]#[align=right] %H:%M %d-%m-%Y #H '
+set -g status-justify absolute-centre
+## Right
+# Set right side status bar length and style
+set-option -g status-right ""
+set -g status-right-length 60
+#set -g status-right-length 140
+#set -g status-right-style default
+#set -ag status-right "#[fg=black] %H:%M %d-%m-%Y #H "
+set -g status-right "#[fg=#50fa7b,bg=default] #{?client_prefix,#[reverse] Prefix #[noreverse] ,} #[bg=default,fg=#50fa7b]#[bg=#50fa7b,fg=black]#( ~/.config/tmux/right-status.sh ) %H:%M | %d-%b-%y "
+bind a run-shell ~/.config/tmux/tmux-toggle-option.sh
+
+#set -g status-right "#(vmstat -SM 1 2 | awk 'END {print \"cpu:\"100-$15\"%\" \" mem:\"512-$4-$5-$6\"M\"}')#[default] %R"
+#set -g status-right "#[fg=green] #22T | #(top -l 2 -FR -n 0 | egrep 'CPU|PhysMem' | awk 'FNR==3{print $8+$10}FNR==4{print $8}' ORS=%%/ | sed 's/..$//')/#(du -hs /var/vm | awk '{print $1}') | %a %b %d %Y %H:%M"
+#set -ag status-right "#[fg=DeepSkyBlue1] #( ~/.config/tmux/right-status.sh ) %H:%M %d-%m-%Y #H "
+#set -ag status-right "#[fg=black] #( ~/.config/tmux/right-status.sh ) %H:%M %d-%m-%Y #H "
+
+# 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'