diff options
Diffstat (limited to '.config/tmux')
| -rw-r--r-- | .config/tmux/tmux.conf | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/.config/tmux/tmux.conf b/.config/tmux/tmux.conf new file mode 100644 index 0000000..6355a25 --- /dev/null +++ b/.config/tmux/tmux.conf @@ -0,0 +1,92 @@ +# Tmux configuration for vim-like keybindings + +setw -g mode-keys vi + +unbind [ +bind Escape copy-mode +unbind p +bind p paste-buffer +bind-key -T copy-mode-vi 'v' send -X begin-selection +bind-key -T copy-mode-vi 'y' send -X copy-selection-and-cancel + + +# splitting windows: tmux definition of vertical/horizontal split is reversed +# to vim's +bind s split-window -v +bind v split-window -h + +# vim-like resizing +bind < resize-pane -L 10 +bind > resize-pane -R 10 +bind + resize-pane -U 10 +bind - resize-pane -D 10 + +# vim-like command prompt +bind : command-prompt + +# Smart pane switching with awareness of vim splits +is_vim='echo "#{pane_current_command}" | grep -iqE "(^|\/)g?(view|n?vim?)(diff)?$"' +bind -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L" +bind -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D" +bind -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U" +bind -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R" + +# TokyoNight colors for Tmux + +set -g mode-style "fg=#7aa2f7,bg=#3b4261" + +set -g message-style "fg=#7aa2f7,bg=default" +set -g message-command-style "fg=#7aa2f7,bg=default" + +set -g pane-border-style "fg=#3b4261" +set -g pane-active-border-style "fg=#3b4261" + + +# top border style +set -g pane-border-format "" +setw -g pane-border-status bottom + + +# formatting and configuration for status text +set -g status-style "fg=#7aa2f7,bg=default" +setw -g window-status-activity-style "underscore,fg=#a9b1d6,bg=default" +setw -g window-status-separator "" +setw -g window-status-style "NONE,fg=#a9b1d6,bg=default" +set -g status-right "#{prefix_highlight} #[fg=#3b4261,bg=default,nobold,nounderscore,noitalics]#[fg=#7aa2f7,bg=#3b4261] %I:%M %p #[fg=#7aa2f7,bg=#3b4261,nobold,nounderscore,noitalics]#[fg=#1D202F,bg=#7aa2f7,bold]" +set -g status-left "#[fg=#1D202F,bg=#7aa2f7,bold] #S #[bg=#7aa2f7,bold]#[bg=default]" +set -g status-left-length 150 +set -g status-right-length 150 +set -g status-interval 5 +set -g status-justify left +set -g status-position bottom + +# window title +# tmux tab (window name) styling +set -g window-status-format "#[fg=#2a2e40]#[bg=#2a2e40,fg=#565d83] #I #W #[fg=#2a2e40,bg=default]" +set -g window-status-current-format "#[fg=#ffffff]#[fg=#1d202f,bg=#ffffff] #I #W #[fg=#ffffff,bg=default]" +# prevent auto window renaming once I renamed it +set -g allow-rename off + +set -g history-limit 40000 + +# enable true color mode (on mac and linux) +# see https://github.com/tmux/tmux/issues/2665#issuecomment-825017707 +# on mac, the terminfo must be updated as per https://gist.github.com/bbqtd/a4ac060d6f6b9ea6fe3aabe735aa9d95 +set-option -gs default-terminal "tmux-256color" + +set-option -gas terminal-overrides "*:Tc" # true color support +set-option -gas terminal-overrides "*:RGB" # true color support +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 +# https://github.com/neovim/neovim/wiki/FAQ#cursor-shape-doesnt-change-in-tmux +set -g -a terminal-overrides ',*:Ss=\E[%p1%d q:Se=\E[2 q' + +# additional support for alacritty +set -as terminal-features ",alacritty*:RGB" + +bind S display-popup -e -w 80% -h 80% nvim -c ":telescope tmux sessions quit_on_select=true" +bind W display-popup -E -w 80% -h 80% nvim -c ":Telescope tmux windows quit_on_select=true" + +set -sg escape-time 0 + +set-option -g focus-events on |
