diff --git a/dotfiles/tmux.conf b/dotfiles/tmux.conf index b10f62f..62f1375 100644 --- a/dotfiles/tmux.conf +++ b/dotfiles/tmux.conf @@ -1,99 +1,110 @@ -# C-b is not acceptable -- Vim uses it -#set-option -g prefix C-a -#unbind-key C-b -#bind-key C-a last-window - -# Allows us to use C-a a to send commands to a TMUX session inside -# another TMUX session -#bind-key a send-prefix - -# Start numbering at 1 +# Prefix +set -g prefix C-Space +set -g prefix2 C-b +bind C-Space send-prefix + +# Reload config +bind q source-file ~/.config/tmux/tmux.conf \; display "Configuration reloaded" + +# Vi mode for copy +setw -g mode-keys vi +bind -T copy-mode-vi v send -X begin-selection +bind -T copy-mode-vi y send -X copy-selection-and-cancel + +# Pane Controls +bind -n M-Enter split-window -v -c "#{pane_current_path}" +bind -n M-S-Enter split-window -h -c "#{pane_current_path}" +bind -n M-Escape kill-pane + +bind h split-window -v -c "#{pane_current_path}" +bind v split-window -h -c "#{pane_current_path}" +bind x kill-pane + +bind -n C-M-Left select-pane -L +bind -n C-M-Right select-pane -R +bind -n C-M-Up select-pane -U +bind -n C-M-Down select-pane -D + +bind -n C-M-S-Left resize-pane -L 5 +bind -n C-M-S-Down resize-pane -D 5 +bind -n C-M-S-Up resize-pane -U 5 +bind -n C-M-S-Right resize-pane -R 5 + +# Window navigation +bind r command-prompt -I "#W" "rename-window -- '%%'" +bind c new-window -c "#{pane_current_path}" +bind k kill-window + +# Legacy window navigation with Shift + Arrows +bind -n S-Left select-window -t -1 +bind -n S-Right select-window -t +1 +bind -n S-Down new-window -c "#{pane_current_path}" +bind -n S-Up confirm-before -p "kill-window #W? (y/n)" kill-window + +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-Left select-window -t -1 +bind -n M-Right select-window -t +1 +bind -n M-S-Left swap-window -t -1 \; select-window -t -1 +bind -n M-S-Right swap-window -t +1 \; select-window -t +1 + +# Session controls +bind R command-prompt -I "#S" "rename-session -- '%%'" +bind C new-session -c "#{pane_current_path}" +bind K kill-session +bind P switch-client -p +bind N switch-client -n + +bind -n M-Up switch-client -p +bind -n M-Down switch-client -n + +# General +set -g default-terminal "tmux-256color" +set -ag terminal-overrides ",*:RGB" +set -g mouse on set -g base-index 1 - -# Allows for faster key repetition -set -s escape-time 0 - -# toggle status bar -bind-key b set-option status - -# set title bar -set -g set-titles on -# H = Hostname of server -# T -set -g set-titles-string '[#T | #H]' - +setw -g pane-base-index 1 +set -g renumber-windows on +set -g history-limit 50000 +set -g escape-time 0 +set -g focus-events on +set -g set-clipboard on +set -g allow-passthrough on setw -g aggressive-resize on - -# to work 256 color (if not work use 'tmux -2') -set -g default-terminal "screen-256color" -# to make ctrl-arrow, etc. work -set-window-option -g xterm-keys on - -# reload tmux configs -bind r source-file ~/.tmux.conf\; display-message "Config reloaded..." - -# open htop on split -bind '~' split-window 'exec htop' - -# set scroll buffer to n lines -set -g history-limit 10000 - -# SHIFT to move the windows -bind -n S-down new-window -bind -n S-left prev -bind -n S-right next -bind -n S-up confirm-before -p "kill-window #W? (y/n)" kill-window - -# set to split or vsplit -bind - split-window -bind | split-window -h - -# copy buffer tmux to clipboard - bind C-y run "tmux save-buffer - | pbcopy" - -# Enable Mouse -set -g mouse on - -# Toggle mouse on with ^B m -bind m \ - set -g mouse on \;\ - display 'Mouse: ON' - -# Toggle mouse off with ^B M - bind M \ - set -g mouse off \;\ - display 'Mouse: OFF' - -# Enable focus event (suggested by Vim Plugin: https://github.com/roxma/vim-tmux-clipboard) -set -g focus-events - -# wemux status bar style -set -g status-left-length 32 -set -g status-right-length 150 - -set -g status-style fg=white,bg=colour234,bg="colour236","none" -set -g window-status-activity-style bold -set -g pane-border-style fg=colour245,fg="colour239" -set -g pane-active-border-style fg=colour39,fg="colour103" -set -g message-style fg=colour16,bg=colour221,bold,bg="colour103",fg="colour236" - -# This tmux statusbar config was created by tmuxline.vim -# on Fri, 26 Sep 2014 - -set -g message-command-style fg="colour236",bg="colour103" -set -g status-justify "centre" -set -g status-left-length "100" -set -g status "on" -set -g status-right-length "100" -set -g status-right-style "none" -set -g status-left-style "none" -setw -g window-status-style fg="colour103","none",bg="colour236" -setw -g window-status-activity-style bg="colour236","underscore",fg="colour103" -setw -g window-status-separator "" -set -g status-left "#[fg=colour236,bg=colour103] #S #[fg=colour103,bg=colour239,nobold,nounderscore,noitalics]#[fg=colour253,bg=colour239] #F #[fg=colour239,bg=colour236,nobold,nounderscore,noitalics]#[fg=colour244,bg=colour236] #W #[fg=colour236,bg=colour236,nobold,nounderscore,noitalics]" -set -g status-right "#[fg=colour236,bg=colour236,nobold,nounderscore,noitalics]#[fg=colour244,bg=colour236] %a #[fg=colour239,bg=colour236,nobold,nounderscore,noitalics]#[fg=colour253,bg=colour239] %b %d  %R #[fg=colour103,bg=colour239,nobold,nounderscore,noitalics]#[fg=colour236,bg=colour103] #H " -setw -g window-status-format "#[fg=colour236,bg=colour236,nobold,nounderscore,noitalics]#[default] #I  #W #[fg=colour236,bg=colour236,nobold,nounderscore,noitalics]" -setw -g window-status-current-format "#[fg=colour236,bg=colour103,nobold,nounderscore,noitalics]#[fg=colour236,bg=colour103] #I  #W #[fg=colour103,bg=colour236,nobold,nounderscore,noitalics]" - -bind-key C-x setw synchronize-panes on \; set-window-option status-bg red \; display-message "pane sync on" -bind-key M-x setw synchronize-panes off \; set-window-option status-bg default \; display-message "pane sync off" +set -g detach-on-destroy off +set -g extended-keys on +set -g extended-keys-format csi-u +set -ag terminal-features "xterm-kitty:extkeys" +set -sg escape-time 10 + +# Status bar +set -g status-position top +set -g status-interval 5 +set -g status-left-length 30 +set -g status-right-length 50 +set -g window-status-separator "" +set -gw automatic-rename on +set -gw automatic-rename-format '#{b:pane_current_path}' +set -g set-titles on +set -g set-titles-string '#h:#W' + +# Theme +set -g status-style "bg=default,fg=default" +set -g status-left "#[fg=black,bg=blue,bold] #S #[bg=default] " +set -g status-right "#[fg=blue]#{?pane_in_mode,COPY ,}#{?client_prefix,PREFIX ,}#{?window_zoomed_flag,ZOOM ,}#[fg=brightblack]#h " +set -g window-status-format "#[fg=brightblack] #I:#W " +set -g window-status-current-format "#[fg=blue,bold] #I:#W " +set -g pane-border-style "fg=brightblack" +set -g pane-active-border-style "fg=blue" +set -g message-style "bg=default,fg=blue" +set -g message-command-style "bg=default,fg=blue" +set -g mode-style "bg=blue,fg=black" +setw -g clock-mode-colour blue