Tmux: improve tmux-sessionizer-script
This commit is contained in:
parent
f481ef6cc5
commit
31ba966020
2 changed files with 31 additions and 15 deletions
|
@ -1,12 +1,23 @@
|
||||||
#!/usr/bin/bash
|
#!/usr/bin/bash
|
||||||
|
|
||||||
read -p "New session name: " SEL
|
HOMEDIR=~
|
||||||
if [[ -z $SEL ]]; then
|
SEL_DIR=$(find ~ -not -path "*/.*" -type d -print 2>/dev/null | fzf)
|
||||||
echo "No session name specified"
|
SEL_NAME=$(basename "$SEL_DIR")
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
SEL_NAME=$(tr "[:lower:]" "[:upper:]" <<< "$SEL")
|
|
||||||
WORK_DIR=$(find ~ -not -path "*/.*" -type d -print 2>/dev/null | fzf)
|
|
||||||
|
|
||||||
tmux new-session -d -s "$SEL_NAME" -c "$WORK_DIR"
|
if [[ -z "$SEL_DIR" ]] || [[ -n "$SEL_DIR" ]] && [[ "$SEL_DIR" == "$HOMEDIR" ]]; then
|
||||||
|
RET=0
|
||||||
|
while [[ $RET -eq 0 ]]; do
|
||||||
|
read -p "New session name: " SEL_NAME
|
||||||
|
if [[ -z "$SEL_NAME" ]]; then
|
||||||
|
clear
|
||||||
|
else
|
||||||
|
RET=1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
SEL_NAME=$(tr "[:lower:]" "[:upper:]" <<< "$SEL_NAME")
|
||||||
|
|
||||||
|
tmux new-session -d -s "$SEL_NAME" -c "$SEL_DIR"
|
||||||
tmux switch-client -t "$SEL_NAME"
|
tmux switch-client -t "$SEL_NAME"
|
||||||
|
|
||||||
|
|
|
@ -20,15 +20,16 @@ bind - split-window -v -c '#{pane_current_path}'
|
||||||
|
|
||||||
bind c new-window -c '#{pane_current_path}'
|
bind c new-window -c '#{pane_current_path}'
|
||||||
|
|
||||||
|
bind -r ^ last-window
|
||||||
bind -r h select-pane -L
|
bind -r h select-pane -L
|
||||||
bind -r j select-pane -D
|
bind -r j select-pane -D
|
||||||
bind -r k select-pane -U
|
bind -r k select-pane -U
|
||||||
bind -r l select-pane -R
|
bind -r l select-pane -R
|
||||||
|
|
||||||
bind -r H resize-pane -L 2
|
bind -r H resize-pane -L 4
|
||||||
bind -r J resize-pane -D 2
|
bind -r J resize-pane -D 4
|
||||||
bind -r K resize-pane -U 2
|
bind -r K resize-pane -U 4
|
||||||
bind -r L resize-pane -R 2
|
bind -r L resize-pane -R 4
|
||||||
|
|
||||||
bind -r n next-window
|
bind -r n next-window
|
||||||
bind -r p previous-window
|
bind -r p previous-window
|
||||||
|
@ -36,7 +37,13 @@ bind -r p previous-window
|
||||||
bind X confirm kill-window
|
bind X confirm kill-window
|
||||||
bind T confirm kill-session
|
bind T confirm kill-session
|
||||||
|
|
||||||
bind M set -g mouse
|
bind -r M set -g mouse
|
||||||
|
|
||||||
|
set-window-option -g mode-keys vi
|
||||||
|
bind -T copy-mode-vi v send-keys -X begin-selection
|
||||||
|
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'xclip -in -selection clipboard'
|
||||||
|
|
||||||
|
bind -r S run-shell "tmux new-window ~/.config/tmux/tmux-sessionizer"
|
||||||
|
|
||||||
set -g pane-border-indicators colour
|
set -g pane-border-indicators colour
|
||||||
set -g pane-active-border-style fg="#d8a657",bg=default
|
set -g pane-active-border-style fg="#d8a657",bg=default
|
||||||
|
@ -68,5 +75,3 @@ set -g cursor-style blinking-underline
|
||||||
|
|
||||||
set -g focus-events on
|
set -g focus-events on
|
||||||
set -g visual-bell off
|
set -g visual-bell off
|
||||||
|
|
||||||
set -g mouse on
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue