1
0

more refinement

This commit is contained in:
2025-03-31 20:18:34 +02:00
parent cfb96ceb85
commit 7c500df9f3
17 changed files with 363 additions and 110 deletions

View File

@@ -4,20 +4,18 @@
tty=$1
# Construct process tree.
children=();
pids=( $(ps -o pid= -t $tty) )
children=()
pids=($(ps -o pid= -t $tty))
while read -r pid ppid
do
[[ -n pid && pid -ne ppid ]] && children[ppid]+=" $pid"
done <<< "$(ps -Ao pid=,ppid=)"
while read -r pid ppid; do
[[ -n $pid && $pid -ne $ppid ]] && children[ppid]+=" $pid"
done <<<"$(ps -Ao pid=,ppid=)"
# Get all descendant pids of processes in $tty with BFS
idx=0
while (( ${#pids[@]} > idx ))
do
pid=${pids[idx++]}
pids+=( ${children[pid]-} )
while ((${#pids[@]} > idx)); do
pid=${pids[idx++]}
pids+=(${children[pid]-})
done
# Check whether any child pids are vim

View File

@@ -31,6 +31,15 @@ bind-key -n C-S-Right swap-window -t +1\; select-window -t +1
setw -g mode-keys vi
set -g set-clipboard on
set -g focus-events on
# Increase scrollback buffer size
set -g history-limit 50000
# Improve terminal scrolling
set -ga terminal-overrides ',*:smcup@:rmcup@'
set-option -g default-shell $SHELL
set -g default-command "$SHELL -i"