set-environment -g PATH "/usr/local/bin:/bin:/usr/bin" # remap prefix from 'C-b' to 'C-a' unbind C-b set-option -g prefix C-a bind-key C-a send-prefix set-option -g default-terminal "screen-256color" # split panes using | and - bind | split-window -h bind - split-window -v unbind '"' unbind % set-option -g default-shell /usr/bin/fish # window and pane index number starts at 1 set -g base-index 1 setw -g pane-base-index 1 # vi-mode set-window-option -g mode-keys vi bind-key -T copy-mode-vi v send-keys begin-selection bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'wl-copy' # reload config file (change file location to your the tmux.conf you want to use) bind r source-file /home/minhradz/.tmux.conf # is_vim="children=(); i=0; pids=( $(ps -o pid= -t '#{pane_tty}') ); \ # while read -r c p; do [[ -n c && c -ne p && p -ne 0 ]] && children[p]+=\" $\{c\}\"; done <<< \"$(ps -Ao pid=,ppid=)\"; \ # while (( $\{#pids[@]\} > i )); do pid=$\{pids[i++]\}; pids+=( $\{children[pid]-\} ); done; \ # ps -o state=,comm= -p \"$\{pids[@]\}\" | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|l?vim?x?)(diff)?$'" 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' { 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 -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' 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 # Enable mouse mode (tmux 2.1 and above) set -g mouse on # Neovim escape time set-option -sg escape-time 1 set-option -g focus-events on ###################### ### DESIGN CHANGES ### ###################### # loud or quiet? set -g visual-activity off set -g visual-bell off set -g visual-silence off setw -g monitor-activity off set -g bell-action none # List of plugins set -g @plugin 'tmux-plugins/tpm' set -g @plugin "arcticicestudio/nord-tmux" set -g @plugin 'tmux-plugins/tmux-resurrect' set -g @plugin 'tmux-plugins/tmux-continuum' # Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf) run -b '~/.tmux/plugins/tpm/tpm'