From e6e3c8f65b00ea58071d9fd001df6254a2a92e18 Mon Sep 17 00:00:00 2001 From: darkskittlz Date: Tue, 17 Sep 2024 15:56:59 -0600 Subject: [PATCH] updated tmux.conf to work with Ubuntu, added in guicolors so that tmux doesn't mess up my highlights when using it --- tmux.conf | 300 ++++++++++++++++++++++++++++++----------------------- tmux.conf2 | 166 +++++++++++++++++++++++++++++ tmux.conf3 | 205 ------------------------------------ 3 files changed, 337 insertions(+), 334 deletions(-) create mode 100644 tmux.conf2 delete mode 100644 tmux.conf3 diff --git a/tmux.conf b/tmux.conf index 62f1402..7e96dad 100644 --- a/tmux.conf +++ b/tmux.conf @@ -1,36 +1,22 @@ -unbind r -set -sg escape-time 10 -set -gq allow-passthrough on -set -g mouse on -set -g @resurrect-strategy-nvim 'session' -set -g @resurrect-strategy-vim 'session' -set-option -sa terminal-features 'xterm-kitty' -# Set prefix -set -g prefix C-Space -unbind C-b -bind C-Space send-prefix +unbind r +bind r source-file ~/.config/tmux/tmux.conf \; display "Reloaded!" -set -sa terminal-overrides ",xterm*:Tc" +set -g terminal-overrides 'xterm*:Tc' +set -g default-terminal "xterm-256color" +# Set the prefix to `ctrl + space` instead of `ctrl + b` +unbind C-b +set -g prefix C-Space +bind-key C-Space send-prefix -# Smart pane switching with awareness of Vim splits. -# See: https://github.com/christoomey/vim-tmux-navigator -is_vim="ps -o state= -o comm= -t '#{pane_tty}' | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?\.?(view|n?vim?x?)(-wrapped)?(diff)?$'" -bind-key -n 'C-h' if-shell "$is_vim" 'send-keys C-h' 'select-pane -L' -bind-key -n 'C-j' if-shell "$is_vim" 'send-keys C-j' 'select-pane -D' -bind-key -n 'C-k' if-shell "$is_vim" 'send-keys C-k' 'select-pane -U' -bind-key -n 'C-l' if-shell "$is_vim" 'send-keys C-l' 'select-pane -R' -tmux_version='$(tmux -V | sed -En "s/^tmux ([0-9]+(.[0-9]+)?).*/\1/p")' -if-shell -b '[ "$(echo "$tmux_version < 3.0" | bc)" = 1 ]' \ - "bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\' 'select-pane -l'" -if-shell -b '[ "$(echo "$tmux_version >= 3.0" | bc)" = 1 ]' \ - "bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\\\' 'select-pane -l'" +set -sa terminal-overrides ".xterm*:Tc" +set -g mouse on -bind-key -T copy-mode-vi 'C-h' select-pane -L -bind-key -T copy-mode-vi 'C-j' select-pane -D -bind-key -T copy-mode-vi 'C-k' select-pane -U -bind-key -T copy-mode-vi 'C-l' select-pane -R -bind-key -T copy-mode-vi 'C-\' select-pane -l +bind-key -n M-H previous-window +bind-key -n M-L next-window + +# Binds backtick character to switch to marked pane with prefix + m +bind \` switch-client -t'{marked}' # Better split pane keybindings bind-key '\' split-window -h @@ -39,8 +25,18 @@ bind-key "_" split-window -fv -c "#{pane_current_path}" unbind '"' unbind % -bind-key -n M-H previous-window -bind-key -n M-L next-window + +#swap windows around +bind -r "<" swap-window -d -t -1 +bind -r ">" swap-window -d -t +1 + +# Set window and panes at 1, not 0 +set -g base-index 1 +set -g pane-base-index 1 +set-window-option -g renumber-windows on + +# Keep current path in newly created windows +bind c new-window -c "#{pane_current_path}" # Pane Resizing: Prefix + Ctrl-h/j/k/l bind -r C-j resize-pane -D 5 @@ -48,119 +44,165 @@ bind -r C-k resize-pane -U 5 bind -r C-h resize-pane -L 5 bind -r C-l resize-pane -R 5 - -#swap windows around -bind -r "<" swap-window -d -t -1 -bind -r ">" swap-window -d -t +1 - - # Move selected text up and down with alt-j/k unbind C-b set -g prefix C-Space bind-key C-Space send-prefix -# Tmux Bar Position -set-option -g status-position bottom +# Open panes in current directory +bind-key '"' split-window -v -c "#{pane_current_path}" +bind-key % split-window -h -c "#{pane_current_path}" + +# act like vim +setw -g mode-keys vi +bind-key h select-pane -L +bind-key j select-pane -D +bind-key k select-pane -U +bind-key l select-pane -R # Setup 'y' to yank (copy), just like Vim bind-key -T copy-mode-vi 'y' send -X copy-pipe-and-cancel "pbcopy" bind-key -T copy-mode-vi 'V' send -X select-line bind-key -T copy-mode-vi 'r' send -X rectangle-toggle +############################# +########## Settings +############################# -bind-key -n 'C-h' if-shell "$is_vim" 'send-keys C-h' { if -F '#{pane_at_left}' '' 'select-pane -L' } -bind-key -n 'C-j' if-shell "$is_vim" 'send-keys C-j' { if -F '#{pane_at_bottom}' '' 'select-pane -D' } -bind-key -n 'C-k' if-shell "$is_vim" 'send-keys C-k' { if -F '#{pane_at_top}' '' 'select-pane -U' } -bind-key -n 'C-l' if-shell "$is_vim" 'send-keys C-l' { if -F '#{pane_at_right}' '' 'select-pane -R' } -bind-key b set-option status - -bind-key -T copy-mode-vi 'C-h' if -F '#{pane_at_left}' '' 'select-pane -L' -bind-key -T copy-mode-vi 'C-j' if -F '#{pane_at_bottom}' '' 'select-pane -D' -bind-key -T copy-mode-vi 'C-k' if -F '#{pane_at_top}' '' 'select-pane -U' -bind-key -T copy-mode-vi 'C-l' if -F '#{pane_at_right}' '' 'select-pane -R' - -is_vim="ps -o state= -o comm= -t '#{pane_tty}' | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'" - -bind -n 'M-h' if-shell "$is_vim" 'send-keys M-h' 'resize-pane -L 1' -bind -n 'M-j' if-shell "$is_vim" 'send-keys M-j' 'resize-pane -D 1' -bind -n 'M-k' if-shell "$is_vim" 'send-keys M-k' 'resize-pane -U 1' -bind -n 'M-l' if-shell "$is_vim" 'send-keys M-l' 'resize-pane -R 1' - -bind-key -T copy-mode-vi M-h resize-pane -L 1 -bind-key -T copy-mode-vi M-j resize-pane -D 1 -bind-key -T copy-mode-vi M-k resize-pane -U 1 -bind-key -T copy-mode-vi M-l resize-pane -R 1 -bind '"' split-window -v -c "#{pane_current_path}" -bind % split-window -h -c "#{pane_current_path}" -bind c new-window -c "#{pane_current_path}" -bind r source-file ~/.config/tmux/tmux.conf \; display "Reloaded!" - -# Plugins -set -g @plugin 'christoomey/vim-tmux-navigator' -set -g @plugin 'catppuccin/tmux' -set -g @plugin 'niksingh710/minimal-tmux-status' -set -g @plugin 'tmux-plugins/tmux-yank' -set -g @plugin 'tmux-plugins/tpm' -set -g @plugin 'jimeh/tmuxifier' -set -g @plugin 'tmux-plugins/tmux-resurrect' -set -g @plugin 'tmux-plugins/tmux-continuum' - - -## Minimal Tmux Status - -set -g @minimal-tmux-status-right " " -set -g @minimal-tmux-status-right-extra "🌲🌲🌲" -set -g @minimal-tmux-indicator-str "πŸ‘»πŸ‘ΎπŸ€–" -set -g @minimal-tmux-expanded-icon " σ°Š“ " -set -g @minimal-tmux-show-expanded-icons-for-all-tabs true -set -g @minimal-tmux-bg "#29a298" -bind-key b set-option status - -# Focus events on -set-option -g focus-events on - -# set vi-mode -set-window-option -g mode-keys vi +# Refresh status line every 5 seconds - Good for when music is playing / update time etc +set -g status-interval 5 - -# keybindings -bind-key -T copy-mode-vi v send-keys -X begin-selection -bind-key -T copy-mode-vi C-v send-keys -X rectangle-toggle -bind-key -T copy-mode-vi y send-keys -X copy-selection-and-cancel - - -# start windows at 1 +# Start window and pane indices at 1. set -g base-index 1 -setw -g pane-base-index 1 -set-window-option -g pane-base-index 1 -set-option -g renumber-windows 1 - - -# navigation -set -g @tmux-nvim-navigation true -set -g @tmux-nvim-navigation-cycle true -set -g @tmux-nvim-navigation-keybinding-left 'C-h' -set -g @tmux-nvim-navigation-keybinding-down 'C-j' -set -g @tmux-nvim-navigation-keybinding-up 'C-k' -set -g @tmux-nvim-navigation-keybinding-right 'C-l' - - -# resize -set -g @tmux-nvim-resize true -set -g @tmux-nvim-resize-step-x 1 -set -g @tmux-nvim-resize-step-y 1 -set -g @tmux-nvim-resize-keybinding-left 'M-h' -set -g @tmux-nvim-resize-keybinding-down 'M-j' -set -g @tmux-nvim-resize-keybinding-up 'M-k' -set -g @tmux-nvim-resize-keybinding-right 'M-l' - - -# Undercurl -set -g default-terminal "${TERM}" -set -as terminal-overrides ',*:Smulx=\E[4::%p1%dm' # undercurl support -set -as terminal-overrides ',*:Setulc=\E[58::2::%p1%{65536}%/%d::%p1%{256}%/%{255}%&%d::%p1%{255}%&%d%;m' # underscore colours - needs tmux-3.0 +set -g pane-base-index 0 +# Length of tmux status line +set -g status-left-length 30 +set -g status-right-length 150 +set-option -g status "on" + +# Default statusbar color +set-option -g status-style bg=colour16,fg=colour255 # bg=bg1, fg=fg1 + +# Default window title colors +set-window-option -g window-status-style bg=colour214,fg=colour16 # bg=yellow, fg=bg1 + +# Default window with an activity alert +set-window-option -g window-status-activity-style bg=colour117,fg=colour255 # bg=bg1, fg=fg3 + +# Active window title colors +set-window-option -g window-status-current-style bg=red,fg=colour237 # fg=bg1 + +# Set active pane border color +set-option -g pane-active-border-style fg=colour214 + +# Set inactive pane border color +set-option -g pane-border-style fg=colour255 + +# Message info +set-option -g message-style bg=colour16,fg=colour207 # bg=bg2, fg=fg1 + +# Writing commands inactive +set-option -g message-command-style bg=colour239,fg=colour223 # bg=fg3, fg=bg1 + +# Pane number display +set-option -g display-panes-active-colour colour1 #fg2 +set-option -g display-panes-colour colour255 #bg1 + +# Clock +set-window-option -g clock-mode-colour colour109 + +# Bell +set-window-option -g window-status-bell-style bg=colour167,fg=colour235 # bg=red, fg=bg + +set-option -g status-left "\ +#[fg=colour7, bg=colour241]#{?client_prefix,#[bg=colour167],} ❐ #S \ +#[fg=colour241, bg=colour16]#{?client_prefix,#[fg=colour167],}ξ‚°#{?window_zoomed_flag, πŸ”,}" + +set-option -g status-right "\ +#[fg=colour27, bg=colour16] ξ‚²\ +#[fg=colour16, bg=colour27] #(~/dotfiles/tmux/scripts/music.sh) ξ‚²\ +#[fg=colour223, bg=colour16] #(~/dotfiles/tmux/scripts/uptime.sh) \ +#[fg=colour246, bg=colour16] ξ‚³ %b %d '%y\ +#[fg=colour109] ξ‚³ %H:%M \ +#[fg=colour248, bg=colour239]" + +set-window-option -g window-status-current-format "\ +#[fg=colour16, bg=colour27]ξ‚°\ +#[fg=colour255, bg=colour27] #I* ξ‚±\ +#[fg=colour255, bg=colour27, bold] #W \ +#[fg=colour27, bg=colour16]ξ‚°" + +set-window-option -g window-status-format "\ +#[fg=colour16,bg=colour239,noitalics]ξ‚°\ +#[fg=colour255,bg=colour239] #I ξ‚±\ +#[fg=colour255, bg=colour239] #W \ +#[fg=colour239, bg=colour16]ξ‚°" + +# Set the history limit so we get lots of scrollback. +setw -g history-limit 50000000 + +############################# +############# Tmux Vars +############################# + +# $(echo $USER) - shows the current username +# %a --> Day of week (Mon) +# %A --> Day of week Expanded (Monday) + +# %b --> Month (Jan) +# %d --> Day (31) +# %Y --> Year (2017) + +# %D --> Month/Day/Year (12/31/2017) +# %v --> Day-Month-Year (31-Dec-2017) + +# %r --> Hour:Min:Sec AM/PM (12:30:27 PM) +# %T --> 24 Hour:Min:Sec (16:30:27) +# %X --> Hour:Min:Sec (12:30:27) +# %R --> 24 Hour:Min (16:30) +# %H --> 24 Hour (16) +# %l --> Hour (12) +# %M --> Mins (30) +# %S --> Seconds (09) +# %p --> AM/PM (AM) + +# For a more complete list view: https://linux.die.net/man/3/strftime + +#colour0 (black) +#colour1 (red) +#colour2 (green) +#colour3 (yellow) +#colour4 (blue) +#colour7 (white) +#colour5 colour6 colour7 colour8 colour9 colour10 colour11 colour12 colour13 colour14 colour15 colour52 colour17 + +#D () +#F () +#H (hostname) +#I (window index) +#P () +#S (session index) +#T (pane title) +#W (currnet task like vim if editing a file in vim or zsh if running zsh) +# Smart pane switching with awareness of Vim splits. +# See: https://github.com/christoomey/vim-tmux-navigator +is_vim="ps -o state= -o comm= -t '#{pane_tty}' \ + | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'" +bind-key -n 'C-h' if-shell "$is_vim" 'send-keys C-h' 'select-pane -L' +bind-key -n 'C-j' if-shell "$is_vim" 'send-keys C-j' 'select-pane -D' +bind-key -n 'C-k' if-shell "$is_vim" 'send-keys C-k' 'select-pane -U' +bind-key -n 'C-l' if-shell "$is_vim" 'send-keys C-l' 'select-pane -R' +tmux_version='$(tmux -V | sed -En "s/^tmux ([0-9]+(.[0-9]+)?).*/\1/p")' +if-shell -b '[ "$(echo "$tmux_version < 3.0" | bc)" = 1 ]' \ + "bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\' 'select-pane -l'" +if-shell -b '[ "$(echo "$tmux_version >= 3.0" | bc)" = 1 ]' \ + "bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\\\' 'select-pane -l'" -run '/home/darkskittlz/.config/tmux/.tmux/plugins/tpm/tpm' +bind-key -T copy-mode-vi 'C-h' select-pane -L +bind-key -T copy-mode-vi 'C-j' select-pane -D +bind-key -T copy-mode-vi 'C-k' select-pane -U +bind-key -T copy-mode-vi 'C-l' select-pane -R +bind-key -T copy-mode-vi 'C-\' select-pane -l diff --git a/tmux.conf2 b/tmux.conf2 new file mode 100644 index 0000000..62f1402 --- /dev/null +++ b/tmux.conf2 @@ -0,0 +1,166 @@ +unbind r +set -sg escape-time 10 +set -gq allow-passthrough on +set -g mouse on +set -g @resurrect-strategy-nvim 'session' +set -g @resurrect-strategy-vim 'session' +set-option -sa terminal-features 'xterm-kitty' +# Set prefix +set -g prefix C-Space +unbind C-b +bind C-Space send-prefix + +set -sa terminal-overrides ",xterm*:Tc" + + +# Smart pane switching with awareness of Vim splits. +# See: https://github.com/christoomey/vim-tmux-navigator +is_vim="ps -o state= -o comm= -t '#{pane_tty}' | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?\.?(view|n?vim?x?)(-wrapped)?(diff)?$'" +bind-key -n 'C-h' if-shell "$is_vim" 'send-keys C-h' 'select-pane -L' +bind-key -n 'C-j' if-shell "$is_vim" 'send-keys C-j' 'select-pane -D' +bind-key -n 'C-k' if-shell "$is_vim" 'send-keys C-k' 'select-pane -U' +bind-key -n 'C-l' if-shell "$is_vim" 'send-keys C-l' 'select-pane -R' +tmux_version='$(tmux -V | sed -En "s/^tmux ([0-9]+(.[0-9]+)?).*/\1/p")' +if-shell -b '[ "$(echo "$tmux_version < 3.0" | bc)" = 1 ]' \ + "bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\' 'select-pane -l'" +if-shell -b '[ "$(echo "$tmux_version >= 3.0" | bc)" = 1 ]' \ + "bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\\\' 'select-pane -l'" + +bind-key -T copy-mode-vi 'C-h' select-pane -L +bind-key -T copy-mode-vi 'C-j' select-pane -D +bind-key -T copy-mode-vi 'C-k' select-pane -U +bind-key -T copy-mode-vi 'C-l' select-pane -R +bind-key -T copy-mode-vi 'C-\' select-pane -l + +# Better split pane keybindings +bind-key '\' split-window -h +bind-key "-" split-window -v -c "#{pane_current_path}" +bind-key "_" split-window -fv -c "#{pane_current_path}" +unbind '"' +unbind % + +bind-key -n M-H previous-window +bind-key -n M-L next-window + +# Pane Resizing: Prefix + Ctrl-h/j/k/l +bind -r C-j resize-pane -D 5 +bind -r C-k resize-pane -U 5 +bind -r C-h resize-pane -L 5 +bind -r C-l resize-pane -R 5 + + +#swap windows around +bind -r "<" swap-window -d -t -1 +bind -r ">" swap-window -d -t +1 + + +# Move selected text up and down with alt-j/k +unbind C-b +set -g prefix C-Space +bind-key C-Space send-prefix + +# Tmux Bar Position +set-option -g status-position bottom + + # Setup 'y' to yank (copy), just like Vim +bind-key -T copy-mode-vi 'y' send -X copy-pipe-and-cancel "pbcopy" +bind-key -T copy-mode-vi 'V' send -X select-line +bind-key -T copy-mode-vi 'r' send -X rectangle-toggle + + +bind-key -n 'C-h' if-shell "$is_vim" 'send-keys C-h' { if -F '#{pane_at_left}' '' 'select-pane -L' } +bind-key -n 'C-j' if-shell "$is_vim" 'send-keys C-j' { if -F '#{pane_at_bottom}' '' 'select-pane -D' } +bind-key -n 'C-k' if-shell "$is_vim" 'send-keys C-k' { if -F '#{pane_at_top}' '' 'select-pane -U' } +bind-key -n 'C-l' if-shell "$is_vim" 'send-keys C-l' { if -F '#{pane_at_right}' '' 'select-pane -R' } +bind-key b set-option status + +bind-key -T copy-mode-vi 'C-h' if -F '#{pane_at_left}' '' 'select-pane -L' +bind-key -T copy-mode-vi 'C-j' if -F '#{pane_at_bottom}' '' 'select-pane -D' +bind-key -T copy-mode-vi 'C-k' if -F '#{pane_at_top}' '' 'select-pane -U' +bind-key -T copy-mode-vi 'C-l' if -F '#{pane_at_right}' '' 'select-pane -R' + +is_vim="ps -o state= -o comm= -t '#{pane_tty}' | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'" + +bind -n 'M-h' if-shell "$is_vim" 'send-keys M-h' 'resize-pane -L 1' +bind -n 'M-j' if-shell "$is_vim" 'send-keys M-j' 'resize-pane -D 1' +bind -n 'M-k' if-shell "$is_vim" 'send-keys M-k' 'resize-pane -U 1' +bind -n 'M-l' if-shell "$is_vim" 'send-keys M-l' 'resize-pane -R 1' + +bind-key -T copy-mode-vi M-h resize-pane -L 1 +bind-key -T copy-mode-vi M-j resize-pane -D 1 +bind-key -T copy-mode-vi M-k resize-pane -U 1 +bind-key -T copy-mode-vi M-l resize-pane -R 1 +bind '"' split-window -v -c "#{pane_current_path}" +bind % split-window -h -c "#{pane_current_path}" +bind c new-window -c "#{pane_current_path}" +bind r source-file ~/.config/tmux/tmux.conf \; display "Reloaded!" + +# Plugins +set -g @plugin 'christoomey/vim-tmux-navigator' +set -g @plugin 'catppuccin/tmux' +set -g @plugin 'niksingh710/minimal-tmux-status' +set -g @plugin 'tmux-plugins/tmux-yank' +set -g @plugin 'tmux-plugins/tpm' +set -g @plugin 'jimeh/tmuxifier' +set -g @plugin 'tmux-plugins/tmux-resurrect' +set -g @plugin 'tmux-plugins/tmux-continuum' + + +## Minimal Tmux Status + +set -g @minimal-tmux-status-right " " +set -g @minimal-tmux-status-right-extra "🌲🌲🌲" +set -g @minimal-tmux-indicator-str "πŸ‘»πŸ‘ΎπŸ€–" +set -g @minimal-tmux-expanded-icon " σ°Š“ " +set -g @minimal-tmux-show-expanded-icons-for-all-tabs true +set -g @minimal-tmux-bg "#29a298" +bind-key b set-option status + +# Focus events on +set-option -g focus-events on + +# set vi-mode +set-window-option -g mode-keys vi + + +# keybindings +bind-key -T copy-mode-vi v send-keys -X begin-selection +bind-key -T copy-mode-vi C-v send-keys -X rectangle-toggle +bind-key -T copy-mode-vi y send-keys -X copy-selection-and-cancel + + +# start windows at 1 +set -g base-index 1 +setw -g pane-base-index 1 +set-window-option -g pane-base-index 1 +set-option -g renumber-windows 1 + + +# navigation +set -g @tmux-nvim-navigation true +set -g @tmux-nvim-navigation-cycle true +set -g @tmux-nvim-navigation-keybinding-left 'C-h' +set -g @tmux-nvim-navigation-keybinding-down 'C-j' +set -g @tmux-nvim-navigation-keybinding-up 'C-k' +set -g @tmux-nvim-navigation-keybinding-right 'C-l' + + +# resize +set -g @tmux-nvim-resize true +set -g @tmux-nvim-resize-step-x 1 +set -g @tmux-nvim-resize-step-y 1 +set -g @tmux-nvim-resize-keybinding-left 'M-h' +set -g @tmux-nvim-resize-keybinding-down 'M-j' +set -g @tmux-nvim-resize-keybinding-up 'M-k' +set -g @tmux-nvim-resize-keybinding-right 'M-l' + + +# Undercurl +set -g default-terminal "${TERM}" +set -as terminal-overrides ',*:Smulx=\E[4::%p1%dm' # undercurl support +set -as terminal-overrides ',*:Setulc=\E[58::2::%p1%{65536}%/%d::%p1%{256}%/%{255}%&%d::%p1%{255}%&%d%;m' # underscore colours - needs tmux-3.0 + + + + +run '/home/darkskittlz/.config/tmux/.tmux/plugins/tpm/tpm' diff --git a/tmux.conf3 b/tmux.conf3 deleted file mode 100644 index 447cfd3..0000000 --- a/tmux.conf3 +++ /dev/null @@ -1,205 +0,0 @@ -unbind r -bind r source-file ~/.config/tmux/tmux.conf \; display "Reloaded!" - -# Set the prefix to `ctrl + space` instead of `ctrl + b` -unbind C-b -set -g prefix C-Space -bind-key C-Space send-prefix - -set -sa terminal-overrides ".xterm*:Tc" -set -g mouse on - -bind-key -n M-H previous-window -bind-key -n M-L next-window - -# Binds backtick character to switch to marked pane with prefix + m -bind \` switch-client -t'{marked}' - -# Better split pane keybindings -bind-key '\' split-window -h -bind-key "-" split-window -v -c "#{pane_current_path}" -bind-key "_" split-window -fv -c "#{pane_current_path}" -unbind '"' -unbind % - - -#swap windows around -bind -r "<" swap-window -d -t -1 -bind -r ">" swap-window -d -t +1 - -# Set window and panes at 1, not 0 -set -g base-index 1 -set -g pane-base-index 1 -set-window-option -g renumber-windows on - -# Keep current path in newly created windows -bind c new-window -c "#{pane_current_path}" - -# Pane Resizing: Prefix + Ctrl-h/j/k/l -bind -r C-j resize-pane -D 5 -bind -r C-k resize-pane -U 5 -bind -r C-h resize-pane -L 5 -bind -r C-l resize-pane -R 5 - -# Move selected text up and down with alt-j/k -unbind C-b -set -g prefix C-Space -bind-key C-Space send-prefix - -# Open panes in current directory -bind-key '"' split-window -v -c "#{pane_current_path}" -bind-key % split-window -h -c "#{pane_current_path}" - -# act like vim -setw -g mode-keys vi -bind-key h select-pane -L -bind-key j select-pane -D -bind-key k select-pane -U -bind-key l select-pane -R - - # Setup 'y' to yank (copy), just like Vim -bind-key -T copy-mode-vi 'y' send -X copy-pipe-and-cancel "pbcopy" -bind-key -T copy-mode-vi 'V' send -X select-line -bind-key -T copy-mode-vi 'r' send -X rectangle-toggle - -############################# -########## Settings -############################# - -# Refresh status line every 5 seconds - Good for when music is playing / update time etc -set -g status-interval 5 - -# Start window and pane indices at 1. -set -g base-index 1 -set -g pane-base-index 0 - -# Length of tmux status line -set -g status-left-length 30 -set -g status-right-length 150 - -set-option -g status "on" - -# Default statusbar color -set-option -g status-style bg=colour16,fg=colour255 # bg=bg1, fg=fg1 - -# Default window title colors -set-window-option -g window-status-style bg=colour214,fg=colour16 # bg=yellow, fg=bg1 - -# Default window with an activity alert -set-window-option -g window-status-activity-style bg=colour117,fg=colour255 # bg=bg1, fg=fg3 - -# Active window title colors -set-window-option -g window-status-current-style bg=red,fg=colour237 # fg=bg1 - -# Set active pane border color -set-option -g pane-active-border-style fg=colour214 - -# Set inactive pane border color -set-option -g pane-border-style fg=colour255 - -# Message info -set-option -g message-style bg=colour16,fg=colour207 # bg=bg2, fg=fg1 - -# Writing commands inactive -set-option -g message-command-style bg=colour239,fg=colour223 # bg=fg3, fg=bg1 - -# Pane number display -set-option -g display-panes-active-colour colour1 #fg2 -set-option -g display-panes-colour colour255 #bg1 - -# Clock -set-window-option -g clock-mode-colour colour109 - -# Bell -set-window-option -g window-status-bell-style bg=colour167,fg=colour235 # bg=red, fg=bg - -set-option -g status-left "\ -#[fg=colour7, bg=colour241]#{?client_prefix,#[bg=colour167],} ❐ #S \ -#[fg=colour241, bg=colour16]#{?client_prefix,#[fg=colour167],}ξ‚°#{?window_zoomed_flag, πŸ”,}" - -set-option -g status-right "\ -#[fg=colour27, bg=colour16] ξ‚²\ -#[fg=colour16, bg=colour27] #(~/dotfiles/tmux/scripts/music.sh) ξ‚²\ -#[fg=colour223, bg=colour16] #(~/dotfiles/tmux/scripts/uptime.sh) \ -#[fg=colour246, bg=colour16] ξ‚³ %b %d '%y\ -#[fg=colour109] ξ‚³ %H:%M \ -#[fg=colour248, bg=colour239]" - -set-window-option -g window-status-current-format "\ -#[fg=colour16, bg=colour27]ξ‚°\ -#[fg=colour255, bg=colour27] #I* ξ‚±\ -#[fg=colour255, bg=colour27, bold] #W \ -#[fg=colour27, bg=colour16]ξ‚°" - -set-window-option -g window-status-format "\ -#[fg=colour16,bg=colour239,noitalics]ξ‚°\ -#[fg=colour255,bg=colour239] #I ξ‚±\ -#[fg=colour255, bg=colour239] #W \ -#[fg=colour239, bg=colour16]ξ‚°" - -# Set the history limit so we get lots of scrollback. -setw -g history-limit 50000000 - -############################# -############# Tmux Vars -############################# - -# $(echo $USER) - shows the current username -# %a --> Day of week (Mon) -# %A --> Day of week Expanded (Monday) - -# %b --> Month (Jan) -# %d --> Day (31) -# %Y --> Year (2017) - -# %D --> Month/Day/Year (12/31/2017) -# %v --> Day-Month-Year (31-Dec-2017) - -# %r --> Hour:Min:Sec AM/PM (12:30:27 PM) -# %T --> 24 Hour:Min:Sec (16:30:27) -# %X --> Hour:Min:Sec (12:30:27) -# %R --> 24 Hour:Min (16:30) -# %H --> 24 Hour (16) -# %l --> Hour (12) -# %M --> Mins (30) -# %S --> Seconds (09) -# %p --> AM/PM (AM) - -# For a more complete list view: https://linux.die.net/man/3/strftime - -#colour0 (black) -#colour1 (red) -#colour2 (green) -#colour3 (yellow) -#colour4 (blue) -#colour7 (white) -#colour5 colour6 colour7 colour8 colour9 colour10 colour11 colour12 colour13 colour14 colour15 colour52 colour17 - -#D () -#F () -#H (hostname) -#I (window index) -#P () -#S (session index) -#T (pane title) -#W (currnet task like vim if editing a file in vim or zsh if running zsh) - -# Smart pane switching with awareness of Vim splits. -# See: https://github.com/christoomey/vim-tmux-navigator -is_vim="ps -o state= -o comm= -t '#{pane_tty}' \ - | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'" -bind-key -n 'C-h' if-shell "$is_vim" 'send-keys C-h' 'select-pane -L' -bind-key -n 'C-j' if-shell "$is_vim" 'send-keys C-j' 'select-pane -D' -bind-key -n 'C-k' if-shell "$is_vim" 'send-keys C-k' 'select-pane -U' -bind-key -n 'C-l' if-shell "$is_vim" 'send-keys C-l' 'select-pane -R' -tmux_version='$(tmux -V | sed -En "s/^tmux ([0-9]+(.[0-9]+)?).*/\1/p")' -if-shell -b '[ "$(echo "$tmux_version < 3.0" | bc)" = 1 ]' \ - "bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\' 'select-pane -l'" -if-shell -b '[ "$(echo "$tmux_version >= 3.0" | bc)" = 1 ]' \ - "bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\\\' 'select-pane -l'" - -bind-key -T copy-mode-vi 'C-h' select-pane -L -bind-key -T copy-mode-vi 'C-j' select-pane -D -bind-key -T copy-mode-vi 'C-k' select-pane -U -bind-key -T copy-mode-vi 'C-l' select-pane -R -bind-key -T copy-mode-vi 'C-\' select-pane -l