Add fzf to tmux session switching

This commit is contained in:
flyingscorpio@clevo 2022-09-22 14:15:48 +02:00
parent 2d6db71cf0
commit 7571cd19e7

View file

@ -3,9 +3,9 @@ set-option -sa terminal-overrides ',xterm-256color:RGB'
set -g status-style 'bg=#333333 fg=#5eacd3'
unbind C-b
unbind-key C-b
set -g prefix C-a
bind C-a send-prefix
bind-key C-a send-prefix
set -sg escape-time 1
@ -16,39 +16,43 @@ set -g mode-keys vi
set -g history-limit 10000
# y and p as in vim
bind Escape copy-mode
unbind p
bind p paste-buffer
bind-key Escape copy-mode
unbind-key p
bind-key p paste-buffer
bind-key -T copy-mode-vi 'v' send -X begin-selection
bind-key -T copy-mode-vi 'y' send -X copy-selection
bind-key -T copy-mode-vi 'Space' send -X halfpage-down
bind-key -T copy-mode-vi 'Bspace' send -X halfpage-up
# extra commands for interacting with the ICCCM clipboard
bind C-c run "tmux save-buffer - | xclip -i -sel clipboard"
bind C-v run "tmux set-buffer \"$(xclip -o -sel clipboard)\"; tmux paste-buffer"
bind-key C-c run "tmux save-buffer - | xclip -i -sel clipboard"
bind-key C-v run "tmux set-buffer \"$(xclip -o -sel clipboard)\"; tmux paste-buffer"
# easy-to-remember split pane commands
bind | split-window -h
bind - split-window -v
unbind '"'
unbind %
bind-key | split-window -h
bind-key - split-window -v
unbind-key '"'
unbind-key %
# moving between panes with vim movement keys
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
bind-key h select-pane -L
bind-key j select-pane -D
bind-key k select-pane -U
bind-key l select-pane -R
# moving between windows with vim movement keys
bind -r C-h select-window -t :-
bind -r C-l select-window -t :+
bind-key -r C-h select-window -t :-
bind-key -r C-l select-window -t :+
# resize panes with vim movement keys
bind -r H resize-pane -L 5
bind -r J resize-pane -D 5
bind -r K resize-pane -U 5
bind -r L resize-pane -R 5
bind-key -r H resize-pane -L 5
bind-key -r J resize-pane -D 5
bind-key -r K resize-pane -U 5
bind-key -r L resize-pane -R 5
# fuzzy switch to session
unbind-key s
bind-key s run-shell -b "tmux switch-client -t $(tmux list-sessions | awk -F: '{print $1}' | fzf-tmux -w 100 | tr -d '\n')"
# plugins
set -g @plugin 'tmux-plugins/tpm'