From: Pass Automated Testing Suite Date: Tue, 28 Sep 2021 09:51:10 +0000 (+0200) Subject: add tmux conf X-Git-Url: https://git.beaudet.xyz/?a=commitdiff_plain;h=921ba69ec37738d25a63aac736502ade9c7e3706;p=dot.git add tmux conf --- diff --git a/.config/tmux/tmux.conf b/.config/tmux/tmux.conf new file mode 100644 index 0000000..0ce2ebd --- /dev/null +++ b/.config/tmux/tmux.conf @@ -0,0 +1,245 @@ +# +# _ __ +# | |_ _ __ ___ _ ___ __ ___ ___ _ __ / _| +# | __| '_ ` _ \| | | \ \/ / / __/ _ \| '_ \| |_ +# | |_| | | | | | |_| |> < | (_| (_) | | | | _| +# \__|_| |_| |_|\__,_/_/\_(_)___\___/|_| |_|_| +# +#―――――――――――――――――――――――――――――――――――――Waylon Walker――――――――――――――――――――――――――――― + +#――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― +setw -g mode-keys vi +set -g display-time 0 +bind -N "Join pane" @ choose-window 'join-pane -h -s "%%"' + +# set -g prefix C-Space +bind Space send-prefix +set -g prefix C-a + +# 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' |\ + fzf --reverse --header jump-to-session --preview 'tmux capture-pane -pt {}' |\ + xargs tmux switch-client -t" +bind C-k display-popup -E "\ + tmux list-sessions -F '#{?session_attached,,#{session_name}}' |\ + 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 -T prefix r source-file ~/.tmux.conf + +#――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-v split-window -h -c '#{pane_current_path}' +bind -n M-q kill-pane +bind -n M-Q kill-window + +bind -n M-z resize-pane -Z +bind -n M-c new-window -c '#{pane_current_path}' +bind -n M-o 'select-pane -t :.+; resize-pane -Z' +bind -n M-O rotate-window +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 +bind -n M-2 select-window -t :=2 +bind -n M-3 select-window -t :=3 +bind -n M-4 select-window -t :=4 +bind -n M-5 select-window -t :=5 +bind -n M-6 select-window -t :=6 +bind -n M-7 select-window -t :=7 +bind -n M-8 select-window -t :=8 +bind -n M-9 select-window -t :=9 +bind -n M-0 select-window -t :=0 + +# resize panes +#――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― +bind -n M-H resize-pane -L 2 +bind -n M-L resize-pane -R 2 +bind -n M-K resize-pane -U 2 +bind -n M-J resize-pane -D 2 + +# Select Layouts +#――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― +bind -n M-a select-layout main-vertical +bind -n M-A select-layout main-horizontal +# bind -n M-E select-layout even-vertical +# bind -n M-V select-layout even-horizontal + +# Mark and swap panes +#――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― +bind -n M-m select-pane -m # mark +bind -n M-M select-pane -M # unmark +bind -n M-, swap-pane # swap +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 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 -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 + +# 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 + + +# 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'" +# } + + +# source-file ~/.tmux.local.conf