TPM
This commit is contained in:
parent
8589a263ff
commit
99e0f0c36e
11 changed files with 60 additions and 6 deletions
|
@ -1,6 +1,8 @@
|
||||||
#!/usr/bin/env fish
|
#!/usr/bin/env fish
|
||||||
|
|
||||||
set session_name $argv[1]
|
set session_name $argv[1]
|
||||||
set dir (set -q $argv[2] && echo $argv2 || pwd)
|
|
||||||
tmux new-session -D -s $session_name -c $dir || \
|
set d (set -q $argv[2] && echo $argv2 || pwd)
|
||||||
tmux attach-session -d -t $session_name
|
|
||||||
|
tmux new-session -D -s "$session_name" -c "$d" || \
|
||||||
|
tmux attach-session -d -t "$session_name" -c "$d"
|
||||||
|
|
9
common/bin/tmux-session-dir
Executable file
9
common/bin/tmux-session-dir
Executable file
|
@ -0,0 +1,9 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
# if inside a session, use the current session
|
||||||
|
# if not, a session must be specified after the dir
|
||||||
|
d="${1}"
|
||||||
|
[ -z "$d" ] && d="#{pane_current_path}"
|
||||||
|
target_session="${2}"
|
||||||
|
[ -n "$TMUX" ] && target_session="."
|
||||||
|
tmux attach-session -t "$target_session" -c "$d"
|
13
common/bin/tmux-session-preview
Executable file
13
common/bin/tmux-session-preview
Executable file
|
@ -0,0 +1,13 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
session_data="$1"
|
||||||
|
session_id="$(echo "$session_data" | cut -d':' -f1)"
|
||||||
|
|
||||||
|
S="$(tmux ls -F'#{session_id} #{session_name}: #{T:tree_mode_format}' | grep ^"$session_id")"
|
||||||
|
session_info="${S##$s}"
|
||||||
|
session_name="$(echo "$session_info" | cut -d ':' -f1)"
|
||||||
|
|
||||||
|
echo "RAW: $1"
|
||||||
|
echo "S: $S"
|
||||||
|
echo "INFO: $session_info"
|
||||||
|
echo "NAME: $session_name"
|
|
@ -7,7 +7,16 @@ t="tmux switch-client -t"
|
||||||
sess="$({ tmux display-message -p -F "$fmt" && tmux list-sessions -F "$fmt"; } \
|
sess="$({ tmux display-message -p -F "$fmt" && tmux list-sessions -F "$fmt"; } \
|
||||||
| awk '!seen[$1]++' \
|
| awk '!seen[$1]++' \
|
||||||
| column -t -s'|' \
|
| column -t -s'|' \
|
||||||
| fzf -q '$' --reverse --prompt 'switch session: ' -1 \
|
| fzf -q '$' --reverse --prompt 'switch session: ' -1 --preview "tmux-session-preview {}" \
|
||||||
| cut -d':' -f1)"
|
| cut -d':' -f1)"
|
||||||
|
|
||||||
|
[ -z "$sess" ] && exit 1
|
||||||
|
|
||||||
$t $sess
|
$t $sess
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# | while read w; do
|
||||||
|
# set W (tmux lsw -t"{}" -F'#{window_id}#{T:tree_mode_format}' | grep ^"$w")
|
||||||
|
# echo " ${W##$w}"
|
||||||
|
# end
|
||||||
|
|
|
@ -21,4 +21,4 @@ host/laptop/divvy-macbook
|
||||||
host/laptop/postmates-macbook
|
host/laptop/postmates-macbook
|
||||||
host/laptop/uber-macbook
|
host/laptop/uber-macbook
|
||||||
host/laptop/val-macbook
|
host/laptop/val-macbook
|
||||||
host/personal
|
host/layer/personal
|
||||||
|
|
|
@ -22,4 +22,6 @@ function fish_user_key_bindings
|
||||||
|
|
||||||
bind -M insert \cv edit_command_buffer
|
bind -M insert \cv edit_command_buffer
|
||||||
bind -M default \cv edit_command_buffer
|
bind -M default \cv edit_command_buffer
|
||||||
|
|
||||||
|
bind -M insert \cs tmuxswitcher
|
||||||
end
|
end
|
||||||
|
|
|
@ -62,7 +62,8 @@ bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel 'wl
|
||||||
bind-key K kill-pane
|
bind-key K kill-pane
|
||||||
bind-key C-S-k kill-window
|
bind-key C-S-k kill-window
|
||||||
|
|
||||||
# attempt at integrating nested tmux sessions nicely
|
# TODO: handle tmux nesting by being able to toggle the prefix (and indicate in status bar?)
|
||||||
|
|
||||||
# bind -T root F12 \
|
# bind -T root F12 \
|
||||||
# set prefix None \;\
|
# set prefix None \;\
|
||||||
# set key-table off \;\
|
# set key-table off \;\
|
||||||
|
@ -75,3 +76,5 @@ bind-key C-S-k kill-window
|
||||||
# set -u key-table \;\
|
# set -u key-table \;\
|
||||||
# set status on \;\
|
# set status on \;\
|
||||||
# refresh-client -S
|
# refresh-client -S
|
||||||
|
|
||||||
|
source-file "$ENV_PATH/*/tmux.d.conf"
|
||||||
|
|
0
host/desktop/tmux.d.conf
Normal file
0
host/desktop/tmux.d.conf
Normal file
13
host/layer/personal/tmux-tpm.conf
Normal file
13
host/layer/personal/tmux-tpm.conf
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
bind-key Z "display-message yotpm"
|
||||||
|
|
||||||
|
set -g @tpm_plugins ' \
|
||||||
|
tmux-plugins/tpm \
|
||||||
|
tmux-plugins/tmux-sensible \
|
||||||
|
tmux-plugins/tmux-resurrect \
|
||||||
|
tmux-plugins/tmux-continuum \
|
||||||
|
'
|
||||||
|
|
||||||
|
set -g @continuum-restore 'on'
|
||||||
|
set -g @continuum-boot 'on'
|
||||||
|
|
||||||
|
run '~/.tmux/plugins/tpm/tpm'
|
3
host/layer/personal/tmux.d.conf
Normal file
3
host/layer/personal/tmux.d.conf
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
bind-key Z "display-message yo"
|
||||||
|
|
||||||
|
if-shell -b "test -d $HOME/.tmux/plugins/tpm" "source-file $ENV_PATH/host-layer-personal/tmux-tpm.conf"
|
Reference in a new issue