From b487984ecc61c6229cf92550030745c192fd3d0b Mon Sep 17 00:00:00 2001 From: Arnold Sommerfeld Date: Wed, 17 May 2023 18:44:48 +0100 Subject: first commit --- home/.config/tmux/tmux.conf | 87 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 home/.config/tmux/tmux.conf (limited to 'home/.config/tmux/tmux.conf') diff --git a/home/.config/tmux/tmux.conf b/home/.config/tmux/tmux.conf new file mode 100644 index 0000000..b3e3727 --- /dev/null +++ b/home/.config/tmux/tmux.conf @@ -0,0 +1,87 @@ +# List of plugins +set -g @plugin 'tmux-plugins/tpm' +set -g @plugin 'tmux-plugins/tmux-sensible' +set -g @plugin 'tmux-plugins/tmux-pain-control' +set -g @plugin 'christoomey/vim-tmux-navigator' +set -g @plugin 'tmux-plugins/tmux-sessionist' +set -g @plugin 'tmux-plugins/tmux-copycat' +set -g @plugin 'tmux-plugins/tmux-yank' +set -g @plugin 'tmux-plugins/tmux-urlview' +set -g @plugin 'lawabidingcactus/tmux-gruvbox-truecolor' +set -g @plugin 'tmux-plugins/tmux-resurrect' + +unbind C-b +set -g prefix ` +set -g prefix2 C-Space +# Start window numbering at 1 +set -g base-index 1 + +setw -g mode-keys vi + +bind-key R run-shell 'tmux source-file ~/.config/tmux/tmux.conf > /dev/null; \ + tmux display-message "Sourced tmux.conf!"' +## Join windows: s, j +bind-key j command-prompt -p "join pane from:" "join-pane -s '%%'" +bind-key s command-prompt -p "send pane to:" "join-pane -t '%%'" + +unbind-key -T copy-mode-vi v +unbind-key -T copy-mode-vi 'C-v' +bind-key -T copy-mode-vi v send -X begin-selection +bind-key -T copy-mode-vi 'C-v' send -X begin-selection \; send -X rectangle-toggle; +bind-key -T copy-mode-vi 'y' send -X copy-selection +bind-key -T copy-mode-vi 'C-e' send -X end-of-line +bind-key -T copy-mode-vi 'C-a' send -X start-of-line + +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' '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 + +set-option -g default-shell $SHELL + +set -g default-terminal tmux-256color +# determine if we should enable 256-colour support +if '[ $TERM = st-256color ]' "set -as terminal-overrides ',st*:Tc'" +## update the TERM variable of terminal emulator when creating a new session or attaching a existing session +set -g update-environment 'DISPLAY SSH_ASKPASS SSH_AGENT_PID SSH_CONNECTION WINDOWID XAUTHORITY TERM' + +# If you SSH into a host in a tmux window, you'll notice the window title of your terminal emulator remains to be user@localhost rather than user@server. To allow the title bar to adapt to whatever host you connect to, set the following in ~/.tmux.conf +set -g set-titles on +set -g set-titles-string "#T" + +set -g automatic-rename-format "#{?pane_in_mode,[tmux],#{?#{==:#{pane_current_command},zsh}, #{b:pane_current_path}, #{b:pane_current_path}:#{pane_current_command}}}#{?pane_dead,[dead],}" + +#https://github.com/neovim/neovim/wiki/FAQ#esc-in-tmux-or-gnu-screen-is-delayed +set -sg escape-time 0 + +set -g focus-events on + +set -g @resurrect-dir '$HOME/.local/share/tmux/resurrect' +# for vim +# set -g @resurrect-strategy-vim 'session' +# for neovim +# set -g @resurrect-strategy-nvim 'session' + +# set -g @resurrect-capture-pane-contents 'on' + +set -g @resurrect-save-shell-history 'off' + +set -g @resurrect-processes 'ssh aerc spt newsboat btop gomuks "python /usr/bin/ikhal"' + +set-environment -g TMUX_PLUGIN_MANAGER_PATH '~/.local/share/tmux/plugins' +if "test ! -d ~/.local/share/tmux/plugins/tpm" \ + "run 'git clone https://github.com/tmux-plugins/tpm ~/.local/share/tmux/plugins/tpm && ~/.local/share/tmux/plugins/tpm/bin/install_plugins'" +# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf) +run '~/.local/share/tmux/plugins/tpm/tpm' + +# The default key bindings include which is the readline key binding +# for clearing the screen. The following binding can be added to your +# ~/.tmux.conf file to provide an alternate mapping to clear-screen. +bind C-l send-keys 'C-l' -- cgit v1.2.3-70-g09d2