From: Pass Automated Testing Suite Date: Wed, 20 Oct 2021 21:25:02 +0000 (+0200) Subject: chore(tmux): add resurrect and tweaks to config X-Git-Url: https://git.beaudet.xyz/?a=commitdiff_plain;h=433d449426dbc7309722fad61ab413d2766edb46;p=dot.git chore(tmux): add resurrect and tweaks to config --- diff --git a/.config/tmux/tmux.conf b/.config/tmux/tmux.conf index 0ce2ebd..e8c0f96 100644 --- a/.config/tmux/tmux.conf +++ b/.config/tmux/tmux.conf @@ -1,40 +1,27 @@ -# -# _ __ -# | |_ _ __ ___ _ ___ __ ___ ___ _ __ / _| -# | __| '_ ` _ \| | | \ \/ / / __/ _ \| '_ \| |_ -# | |_| | | | | | |_| |> < | (_| (_) | | | | _| -# \__|_| |_| |_|\__,_/_/\_(_)___\___/|_| |_|_| -# -#―――――――――――――――――――――――――――――――――――――Waylon Walker――――――――――――――――――――――――――――― - -#――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― setw -g mode-keys vi -set -g display-time 0 +set -g display-time 3000 bind -N "Join pane" @ choose-window 'join-pane -h -s "%%"' -# set -g prefix C-Space -bind Space send-prefix +set -s escape-time 0 +set-option -g default-shell /usr/bin/zsh +set -g status-keys vi +set -g base-index 1 + +set -g detach-on-destroy off +set-option -g focus-events on +setw -g aggressive-resize on + set -g prefix C-a +bind -n M-r source-file $XDG_CONFIG_HOME/tmux/tmux.conf + # Copy and Paste on Linux bind -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "xclip -i -f -selection primary | xclip -i -selection clipboard" set-option -s set-clipboard off bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "xclip -selection clipboard -i" -# set-option -sa terminal-overrides ',xterm-256color:RGB' -# set-option -ga terminal-overrides ',xterm-256color:RGB' -# set -g default-terminal "screen-256color" -set-option -g focus-events on - -bind s set-option -g status -bind C-s set-option -g status - -bind -n M-[ copy-mode -bind -n M-V copy-mode - #――session switchers―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― bind-key j choose-tree -swZ -# bind C-j new-window -n "session-switcher" "tmux list-sessions | sed -E 's/:.*$//' | grep -v \"^$(tmux display-message -p '#S')\$\" | fzf --reverse | xargs tmux switch-client -t" -N 'session jumper' bind C-j display-popup -E "\ tmux list-sessions -F '#{?session_attached,,#{session_name}}' |\ sed '/^$/d' |\ @@ -45,62 +32,35 @@ bind C-k display-popup -E "\ sed '/^$/d' |\ fzf --reverse --header kill-session --preview 'tmux capture-pane -pt {}' |\ xargs tmux kill-session -t" -bind -n M-f display-popup -E "\ - tmux list-sessions -F '#{?session_attached,,#{session_name}}' |\ - sed '/^$/d' |\ - fzf --reverse --header jump-to-session --preview 'tmux capture-pane -pt {}' |\ - xargs tmux switch-client -t" -bind -n M-F display-popup -E "ta ~/git" -# bind C-w new-window -n "work-session-picker" "ta ~/work" -bind C-w display-popup -E "ta ~/work" -# bind C-g new-window -n "git-session-picker" "ta ~/git" bind C-g display-popup -E "ta ~/git" -# bind C-p new-window -n "git-session-picker" "ta ~/projects" -bind -n M-g display-popup -E "tmux new-session -A -s scratch" -bind -n M-G display-popup -E -h 95% -w 95% "tmux new-session -A -s scratch" bind k display-popup -E "\ tmux list-sessions -F '#{?session_attached,,#{session_name}}' |\ sed '/^$/d' |\ fzf --reverse -m --header=kill-session --preview 'tmux capture-pane -pt {}' |\ xargs -I {} tmux kill-session -t {}" -bind C-p display-popup -E "ta ~/project" -bind C-t new-session -A -s todo "cd ~/work/todo && nvim -O backlog.md doing.md done.md" -bind -n M-t new-session -A -s todo "cd ~/work/todo && nvim -O backlog.md doing.md done.md" -bind -n M-B switch-client -l bind -n M-\\ switch-client -l -bind -n M-i new-session -A -s waylonwalker_com "cd ~/git/waylonwalker.com/ && nvim" -bind i popup -E -h 95% -w 95% -x 100% "tmux new-session -A -s waylonwalker_com 'cd ~/git/waylonwalker.com/ && nvim'" -bind -n M-I popup -E "tmux new-session -A -s waylonwalker_com 'cd ~/git/waylonwalker.com/ && nvim'" -# bind -n M-o new-session -A -s images_waylonwalker_com "cd ~/git/images.waylonwalker.com/ && nvim" -# bind o popup 'tmux new-session -A -s images_waylonwalker_com "cd ~/git/images.waylonwalker.com/ && nvim"' -bind -n M-O popup 'tmux new-session -A -s images_waylonwalker_com "cd ~/git/images.waylonwalker.com/ && nvim"' bind C-n new-session bind-key C-b send-keys 'ta && exit' 'C-m' -bind -n M-w if-shell -F '#{m:*wiki*,#{session_name}}' { - # new-session -A -s "#(sed -i s/-wiki// #{session_name})" - switch-client -l - } { - display-message "switching to #{session_name}.wiki" - n-session - -s "#{session_nme}-wiki" -c "#{pne_current_pth}.wiki" "nvim" - } - +bind-key C-g if-shell -F '#{==:#{session_name},scratch}' { + detach-client +} { + display-popup "tmux new-session -As 'scratch'" +} -# bind -T prefix r source-file ~/.tmux.conf +bind C-p display-popup -h 80% -w 80% -E "ta -d $HOME/dev" +bind C-c display-popup -h 80% -w 80% -E "ta -d $HOME/.config" #――split―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― -bind -n M-P split-window - bind -n M-d detach-client bind -n M-h select-pane -L bind -n M-l select-pane -R bind -n M-k select-pane -U bind -n M-j select-pane -D -# bind -n M-space next-layout -bind -n M-s split-window -c '#{pane_current_path}' -bind -n M-Enter split-window -c '#{pane_current_path}' +bind -n M-Space split-window -c '#{pane_current_path}' +bind -n M-Enter split-window -h -c '#{pane_current_path}' bind -n M-v split-window -h -c '#{pane_current_path}' bind -n M-q kill-pane bind -n M-Q kill-window @@ -113,12 +73,6 @@ bind -n M-p previous-window bind -n M-P switch-client -p bind -n M-n next-window bind -n M-N switch-client -n -# bind -n M-Enter swap-pane -U -# bind -n M-{ swap-pane -U -# bind -n M-} swap-pane -D -bind -n M-r source-file ~/.config/tmux/tmux.conf -# bind -n M-, command-prompt -I #W "rename-window '%%'" -# bind -n M-w command-prompt "rename-window '%%'" bind -n M-W command-prompt "rename-session '%%'" bind -n M-? list-keys bind -n M-1 select-window -t :=1 @@ -132,6 +86,17 @@ bind -n M-8 select-window -t :=8 bind -n M-9 select-window -t :=9 bind -n M-0 select-window -t :=0 +bind -n M-! join-pane -t :=1 +bind -n M-@ join-pane -t :=2 +bind -n M-# join-pane -t :=3 +bind -n M-$ join-pane -t :=4 +bind -n M-% join-pane -t :=5 +bind -n M-! join-pane -t :=6 +bind -n M-! join-pane -t :=7 +bind -n M-! join-pane -t :=8 +bind -n M-! join-pane -t :=9 +bind -n M-! join-pane -t :=0 + # resize panes #――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― bind -n M-H resize-pane -L 2 @@ -157,89 +122,28 @@ bind -n M-< join-pane # Open app in split #――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― bind -n M-t split-window htop \; swap-pane -U -bind -n M-t popup -E -h 95% -w 95% -x 100% "htop" +bind -n M-t popup -E -h 95% -w 95% -x 100% "ytop" -bind -n C-M-p split-window python; -# bind -n M-g split-window git status \; -bind -n M-e split-window -c '#{pane_current_path}' vifm . .\; resize-pane -Z; -# bind C-k split-window -c '#{pane_current_path}' 'gitui'\; resize-pane -Z; +bind -n M-e display-popup -E -h 80% -w 80% "neomutt" +bind -n M-g display-popup -E "ncmpcpp" -bind -n M-e display-popup -d '#{pane_current_path}' -E vifm -# bind C-k display-popup -d '#{pane_current_path}' -E 'gitui' - - -# bind -n M-: command-prompt - -# Enable mouse control (clickable windows, panes, resizable panes) -set -g mouse on - -# run-shell "powerline-daemon -q" -# source "home/walkews/miniconda3/lib/python3.7/site-packages/powerline/bindings/tmux/powerline.conf" - -## COLOUR (Solarized light) # default statusbar colors #――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― -set-option -g status-bg default -set-option -g status-fg colour240 -# set-option -g status-attr default +# set-option -g status-bg default +# set-option -g status-fg default # default window title colors #――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― -set-window-option -g window-status-style fg=magenta -set-window-option -g window-status-style bg=default -set -g status-style bg=colour163 -set -g status-style bg=default - -# set-window-option -g window-status-attr dim - -set -g status-left-length 85 -# set -g status-left "#[fg=yellow bg=default]#h #[fg=colour135] #S" -set -g status-left "working on#[fg=colour163] #(echo #S | sed s/waylonwalker_com/blog✍️/ | sed s/kedro/🔶kedro/)" -# set -g window-status-current-format "#[fg=black,bold bg=default]│#[fg=white bg=cyan]#W#[fg=black,bold bg=default]│" -set -g window-status-current-format "#[fg=black,bold bg=default]│#[fg=colour135 bg=colour234]#W#[fg=black,bold bg=default]│" -set -g window-status-format "#W" -set-option -g automatic-rename-format "#{s/zsh/❯ shell:#{s/nvim/💜 nvim:#{pane_current_command}}}" -set -g status-right "#[fg=magenta] #[bg=gray] %b %d %Y %l:%M %p" -set -g status-right '#(gitmux "#{pane_current_path}")' -set -g status-right 'segment #[fg=colour163]#(cat ~/.config/title/title.txt | sed s/title:// | sed s/Kedro/🔶\ Kedro/ | sed s/^\ //)' -set -g status-justify centre - - -# active window title colors -#――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― -set-window-option -g window-status-current-style fg=cyan -set-window-option -g window-status-current-style bg=default -#set-window-option -g window-status-current-attr bright - - -# pane border -# set-option -g pane-border-fg black -# set-option -g pane-border-bg black -# set-option -g pane-active-border-fg red -# set-option -g pane-active-border-bg default - +set -g status-left-length 100 -# run-shell ~/.tmux/yank.tmux/yank.tmux -# set-option -g default-shell /usr/bin/zsh -set-option -g default-shell /usr/bin/zsh -set-option -sg escape-time 10 - - -bind -n M-m select-pane -m # mark -bind -n M-M select-pane -M # unmark - - -bind-key -n M-g if-shell -F '#{==:#{session_name},scratch}' { - detach-client - } { - display-popup -E "tmux new-session -A -s scratch" - } -# bind-key -n M-I if-shell -F '#{==:#{session_name},waylonwalker_com}' { -# detach-client -# } { -# display-popup -E "tmux new-session -A -s waylonwalker_com 'cd ~/git/waylonwalker.com/ && nvim'" -# } +if-shell '[ $TERM = "xterm-256color" ]' "set -g default-terminal 'screen-256color'" +if-shell '[ $TERM = "xterm-256color" ]' "set-option -sa terminal-overrides ',xterm-256color:RGB'" +# plugins +#――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― +run-shell $XDG_CONFIG_HOME/tmux/plugins/nord-tmux/nord.tmux -# source-file ~/.tmux.local.conf +run-shell $XDG_CONFIG_HOME/tmux/plugins/tmux-resurrect/resurrect.tmux +set -g @resurrect-strategy-nvim 'session' +set -g @resurrect-capture-pane-contents 'on'