185 lines
5.6 KiB
Bash
185 lines
5.6 KiB
Bash
######################
|
|
### SETTINGS ###
|
|
######################
|
|
# escape time
|
|
set -sg escape-time 0
|
|
|
|
# loud or quiet?
|
|
setw -g monitor-activity off
|
|
|
|
# enable vi mode keys
|
|
setw -g mode-keys vi
|
|
|
|
# mouse control (clickable windows, panes, resizable panes)
|
|
set -g mouse on
|
|
|
|
# clipboard control
|
|
set -g set-clipboard on
|
|
set -g allow-passthrough
|
|
set -g history-limit 20000
|
|
set -g focus-events on
|
|
|
|
# terminal
|
|
set -g default-shell /bin/zsh
|
|
|
|
# screen colors
|
|
set -ga terminal-overrides ",*-256color*:Tc"
|
|
|
|
# Start with index 1
|
|
set -g base-index 1
|
|
setw -g pane-base-index 1
|
|
|
|
# pane title
|
|
setw -g pane-border-status top
|
|
setw -g pane-border-format ' #{=/-20/…:pane_title} [#{=/-20/…:pane_current_command}] #(pgrep -P "#{pane_pid}" | tr "\n" " ")#{pane_current_path} #{?alternate_on,<Alt Mode> ,}'
|
|
#set -g pane-border-format "#P: #{pane_current_command}"
|
|
|
|
|
|
# Automatically set window title
|
|
setw -g automatic-rename on
|
|
set -g set-titles on
|
|
|
|
######################
|
|
### KEYBINDS ###
|
|
######################
|
|
# Config that is very close to a i3 window manager's keybinding.
|
|
|
|
# Set new prefix
|
|
# Note : you can press super key by set M.
|
|
# (tested with tty only)
|
|
set -g prefix M-a
|
|
bind M-a send-prefix
|
|
|
|
# First remove *all* keybindings
|
|
unbind -a
|
|
|
|
# Basic bindings
|
|
bind ? list-keys
|
|
bind d detach-client
|
|
bind D choose-client
|
|
bind ø command-prompt
|
|
bind : command-prompt
|
|
#bind \ show-messages
|
|
|
|
# Copy mode
|
|
bind c copy-mode
|
|
|
|
# clipboard control
|
|
bind p paste-buffer
|
|
bind -T copy-mode-vi v send-keys -X begin-selection
|
|
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "xclip -i -f -selection primary | xclip -i -selection clipboard"
|
|
bind -T copy-mode-vi r send-keys -X rectangle-toggle
|
|
bind -T copy-mode-vi Escape send-keys -X cancel
|
|
bind -T copy-mode-vi q send-keys -X clear-selection
|
|
bind -T copy-mode MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "xclip -selection primary -filter | xclip -selection clipboard"
|
|
bind -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "xclip -selection primary -filter | xclip -selection clipboard"
|
|
|
|
# Rename window
|
|
bind , command-prompt "rename-window %%"
|
|
|
|
# Clock mode
|
|
bind t clock-mode
|
|
|
|
# Show pane numbers
|
|
bind i display-panes
|
|
|
|
# Config Reloads
|
|
bind r source-file ~/.config/tmux/tmux.conf \; refresh-client \; display-message "Config reloaded"
|
|
|
|
# resize controls
|
|
bind -r h resize-pane -L 10 \; display-message "Resize left"
|
|
bind -r l resize-pane -R 10 \; display-message "Resize right"
|
|
bind -r k resize-pane -U 10 \; display-message "Resize up"
|
|
bind -r j resize-pane -D 10 \; display-message "Resize down"
|
|
|
|
# zoom control
|
|
bind -n M-o resize-pane -Z
|
|
|
|
# split panes using | and -, make sure they open in the same path
|
|
bind v split-window -h -c "#{pane_current_path}"
|
|
bind s split-window -v -c "#{pane_current_path}"
|
|
bind V split-window -fh -c "#{pane_current_path}"
|
|
bind S split-window -fv -c "#{pane_current_path}"
|
|
|
|
# Change layouts
|
|
bind o rotate-window
|
|
bind Space next-layout
|
|
bind = select-layout even-horizontal
|
|
bind / select-layout even-vertical
|
|
bind K swap-pane -d -t "{up-of}"
|
|
bind J swap-pane -d -t "{down-of}"
|
|
bind H swap-pane -d -t "{left-of}"
|
|
bind L swap-pane -d -t "{right-of}"
|
|
|
|
# Choose Window
|
|
bind w choose-window
|
|
|
|
# Change current pane to next window
|
|
bind 1 join-pane -t :1 -h
|
|
bind 2 join-pane -t :2 -h
|
|
bind 3 join-pane -t :3 -h
|
|
bind 4 join-pane -t :4 -h
|
|
bind 5 join-pane -t :5 -h
|
|
bind 6 join-pane -t :6 -h
|
|
bind 7 join-pane -t :7 -h
|
|
bind 8 join-pane -t :8 -h
|
|
bind 9 join-pane -t :9 -h
|
|
bind 0 join-pane -t :10 -h
|
|
|
|
# Switch windows alt+number
|
|
bind -n M-1 if-shell 'tmux select-window -t :1' '' 'new-window -t :1'
|
|
bind -n M-2 if-shell 'tmux select-window -t :2' '' 'new-window -t :2'
|
|
bind -n M-3 if-shell 'tmux select-window -t :3' '' 'new-window -t :3'
|
|
bind -n M-4 if-shell 'tmux select-window -t :4' '' 'new-window -t :4'
|
|
bind -n M-5 if-shell 'tmux select-window -t :5' '' 'new-window -t :5'
|
|
bind -n M-6 if-shell 'tmux select-window -t :6' '' 'new-window -t :6'
|
|
bind -n M-7 if-shell 'tmux select-window -t :7' '' 'new-window -t :7'
|
|
bind -n M-8 if-shell 'tmux select-window -t :8' '' 'new-window -t :8'
|
|
bind -n M-9 if-shell 'tmux select-window -t :9' '' 'new-window -t :9'
|
|
bind -n M-0 if-shell 'tmux select-window -t :10' '' 'new-window -t :10'
|
|
|
|
# Kill Selected Pane
|
|
bind Q kill-pane
|
|
|
|
# clear selected pane
|
|
bind b send-keys -R \; clear-history \; send-keys Enter
|
|
|
|
# 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 -n M-h if-shell "$is_vim" "send-keys M-h" "select-pane -L"
|
|
bind -n M-j if-shell "$is_vim" "send-keys M-j" "select-pane -D"
|
|
bind -n M-k if-shell "$is_vim" "send-keys M-k" "select-pane -U"
|
|
bind -n M-l if-shell "$is_vim" "send-keys M-l" "select-pane -R"
|
|
bind M-h "select-pane -L"
|
|
bind M-j "select-pane -D"
|
|
bind M-k "select-pane -U"
|
|
bind M-l "select-pane -R"
|
|
#bind -n M-\ if-shell "$is_vim" "send-keys M-\\" "select-pane -l"
|
|
bind -T copy-mode-vi M-h select-pane -L
|
|
bind -T copy-mode-vi M-j select-pane -D
|
|
bind -T copy-mode-vi M-k select-pane -U
|
|
bind -T copy-mode-vi M-l select-pane -R
|
|
#bind -T copy-mode-vi M-\ select-pane -l
|
|
|
|
# fzf binding
|
|
set -g @tmux-fzf-launch-key 'f'
|
|
|
|
######################
|
|
### PLUGINS ###
|
|
######################
|
|
|
|
# various plugins
|
|
set -g @plugin 'tmux-plugins/tpm'
|
|
set -g @plugin 'tmux-plugins/tmux-sensible'
|
|
set -g @plugin 'tmux-plugins/tmux-yank'
|
|
set -g @plugin 'arcticicestudio/nord-tmux'
|
|
# set -g @plugin 'tmux-plugins/tmux-resurrect'
|
|
# set -g @plugin 'tmux-plugins/tmux-continuum'
|
|
# set -g @plugin 'odedlaz/tmux-onedark-theme'
|
|
# set -g @plugin 'seebi/tmux-colors-solarized'
|
|
# set -g @plugin 'jimeh/tmux-themepack'
|
|
|
|
# keep at bottom
|
|
run -b '~/.config/tmux/plugins/tpm/tpm'
|