Skip to content

Commit

Permalink
Faster shell startup without JJ autocomplete, inline tmux commands
Browse files Browse the repository at this point in the history
  • Loading branch information
willhbr committed Jan 6, 2025
1 parent d5f4836 commit 0094505
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 19 deletions.
6 changes: 3 additions & 3 deletions bin/show-tmux-popup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ session="$(tmux display -p '_popup_#S')"
if ! tmux has -t "$session" 2> /dev/null; then
parent_session="$(tmux display -p '#{session_id}')"
session_id="$(tmux new-session -c '#{pane_current_path}' -dP -s "$session" -F '#{session_id}' -e TMUX_PARENT_SESSION="$parent_session")"
tmux set-option -s -t "$session_id" key-table popup
tmux set-option -s -t "$session_id" status off
tmux set-option -s -t "$session_id" prefix None
tmux set-option -s -t "$session_id" key-table popup \; \
set-option -s -t "$session_id" status off \; \
set-option -s -t "$session_id" prefix None
session="$session_id"
fi

Expand Down
10 changes: 10 additions & 0 deletions shell/autoload/jj
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
if [ -z "$JJ_LOADED" ]; then
if [ -n "$ZSH_NAME" ]; then
source <(command jj util completion zsh)
else
source <(command jj util completion bash)
fi
JJ_LOADED=true
fi

command jj "$@"
12 changes: 6 additions & 6 deletions shell/autoload/mx
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,18 @@ if tmux has -t "$name" 2> /dev/null; then
if [ "$window_count" = 1 ]; then
tmux new-window -d "tmux wait-for '$wait_for'"
fi
tmux move-window -b -t "$name:{start}"
tmux switch -t "$name"
tmux move-window -b -t "$name:{start}" \; \
switch -t "$name" \; \
wait-for -S "$wait_for"
echo "switched to: $name"
tmux wait-for -S "$wait_for"
else
if [ "$window_count" = 1 ]; then
tmux rename-session "$name"
echo "renamed to: $name"
else
tmux new -s "$name" -d "tmux wait-for '$wait_for'"
tmux move-window -b -t "$name:{start}"
tmux switch -t "$name"
tmux new -s "$name" -d "tmux wait-for '$wait_for'" \; \
move-window -b -t "$name:{start}" \; \
switch -t "$name"
echo "new session: $name"
fi
tmux wait-for -S "$wait_for"
Expand Down
12 changes: 6 additions & 6 deletions shell/autoload/ssh
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ fi
if [ -n "$do_tmux" ]; then
local prefix="$(tmux display -p '#{prefix}')"
local status_mode="$(tmux display -p '#{status}')"
tmux set status off
tmux set key-table nested
tmux set prefix None
tmux set status off \; \
set key-table nested \; \
set prefix None
fi
command ssh "$@"
local res=$?
echo
echo -e "Back on \033[38;5;${HOST_COLOR}m$(hostname -s)\033[0m as $(whoami)"
if [ -n "$do_tmux" ]; then
tmux set status "$status_mode"
tmux set key-table root
tmux set prefix "$prefix"
tmux set status "$status_mode" \; \
set key-table root \; \
set prefix "$prefix"
fi
return $res
4 changes: 0 additions & 4 deletions zsh/completions.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,3 @@ complete-or-list() {
}
zle -N complete-or-list
bindkey '^I' complete-or-list

if is_defined jj; then
source <(jj util completion zsh)
fi

0 comments on commit 0094505

Please sign in to comment.