dotfiles/.tmux.conf
Asocia b745ed84fe Revert "Fix an issue about cursor style"
This reverts commit 7ac432d302.
Because the new cursor was ugly.
2021-05-02 02:04:15 +03:00

141 lines
5.7 KiB
Plaintext

# remap prefix to Control + Space
set -g prefix C-Space
bind C-Space send-prefix
unbind C-b
# 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
# vim like copy mode
bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T copy-mode-vi r send-keys -X rectangle-toggle
setw -g mode-keys vi
# Mouse support - set to on if you want to use the mouse
setw -g mouse on
# source the .tmux.conf file with prefix + r
bind r source-file ~/.tmux.conf \; display "Configuration Reloaded!"
bind-key - split-window -v
bind-key '\' split-window -h
bind-key _ split-window -fv
bind-key | split-window -fh
# set -g lock-after-time 300
# set -g lock-command "asciiquarium"
# bind-key "'" choose-window
# bind-key '"' choose-session
# kill current pane/window
bind-key q confirm-before kill-pane
bind-key Q confirm-before kill-window
bind-key C-q confirm-before kill-pane
# no prefix, just c-x
bind -n C-x setw synchronize-panes
# reorder windows
bind-key -n C-S-Left swap-window -t -1\; select-window -t -1
bind-key -n C-S-Right swap-window -t +1\; select-window -t +1
set -g default-terminal "xterm-256color"
# start session number from 1 rather than 0
# set -g base-index 1
# start pane number from 1 similar to windows
# setw -g pane-base-index 1
# highlight active pane
# set -g window-style 'fg=colour247,bg=colour236'
# set -g window-active-style 'fg=colour250,bg=black'
# set-option -g pane-active-border-style fg=red
# use <prefix> C-l to clear screen
bind C-l send-keys 'C-l'
# use <prefix> j for zooming the current pane
bind-key j resize-pane -Z
bind-key C-j resize-pane -Z
unbind z
# status bar theme
set -g status 'on'
set -g status-bg 'colour235'
set -g status-justify 'centre'
set -g status-style 'none'
set -g status-left-style 'none'
set -g status-left-length '100'
set -g status-right-style 'none'
set -g status-right-length '100'
set -g message-command-style fg='colour222',bg='colour238'
set -g message-style bg='colour238',fg='colour222'
set -g pane-active-border-style fg='colour154'
set -g pane-border-style fg='colour238'
setw -g window-status-style fg='colour121',bg='colour235','none'
setw -g window-status-activity-style bg='colour235',fg='colour154','none'
setw -g window-status-separator ''
set -g status-left '#[fg=colour232,bg=colour154] #S #[fg=colour154,bg=colour238,nobold,nounderscore,noitalics]#[fg=colour222,bg=colour238] #W #[fg=colour238,bg=colour235,nobold,nounderscore,noitalics] #[fg=colour235,bg=colour235,nobold,nounderscore,noitalics]'
# above status + whoami and uptime
# set -g status-left '#[fg=colour232,bg=colour154] #S #[fg=colour154,bg=colour238,nobold,nounderscore,noitalics]#[fg=colour222,bg=colour238] #W #[fg=colour238,bg=colour235,nobold,nounderscore,noitalics]#[fg=colour121,bg=colour235] #(whoami)  #(uptime | cut -d " " -f 1,2,3) #[fg=colour235,bg=colour235,nobold,nounderscore,noitalics]'
set -g status-right '#[fg=colour235,bg=colour235,nobold,nounderscore,noitalics]#[fg=colour121,bg=colour235] %R  %a  %h-%d #[fg=colour238,bg=colour235,nobold,nounderscore,noitalics]#[fg=colour222,bg=colour238] #{battery_color_charge_fg}#[bg=colour238]#{battery_icon} #{battery_percentage}#[fg=colour154,bg=colour238,nobold,nounderscore,noitalics] #{prefix_highlight}'
setw -g window-status-format '#[fg=colour235,bg=colour235,nobold,nounderscore,noitalics]#[default] #I  #W #[fg=colour235,bg=colour235,nobold,nounderscore,noitalics]'
setw -g window-status-current-format '#[fg=colour235,bg=colour238,nobold,nounderscore,noitalics]#[fg=colour222,bg=colour238] #I  #W  #F #[fg=colour238,bg=colour235,nobold,nounderscore,noitalics]'
set -g status-interval 1
set-option -g automatic-rename on
set-option -g automatic-rename-format '#{b:pane_current_path}'
# Plugin Customizations
set -g @prefix_highlight_fg 'colour232' # default is 'colour231'
set -g @prefix_highlight_bg 'colour154' # default is 'colour04'
set -g @prefix_highlight_sync_mode_attr 'fg=colour21,bg=colour154' # default is 'fg=default,bg=yellow'
set -g @prefix_highlight_copy_mode_attr 'fg=colour160,bg=colour154' # default is 'fg=default,bg=yellow'
set -g @prefix_highlight_show_copy_mode 'on'
set -g @prefix_highlight_show_sync_mode 'on'
set -g @prefix_highlight_sync_prompt 'SYNC'
set -g @resurrect-strategy-vim 'session'
set -g @batt_icon_status_charging '⚡'
# set -g @continuum-boot 'on'
# set -g @continuum-restore 'on'
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 'tmux-plugins/tmux-open'
set -g @plugin 'tmux-plugins/tmux-yank'
set -g @plugin 'tmux-plugins/tmux-copycat'
set -g @plugin 'tmux-plugins/tmux-prefix-highlight'
set -g @plugin 'tmux-plugins/tmux-battery'
run '~/.tmux/plugins/tpm/tpm'