mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-03-27 03:14:56 +01:00
perf(zellij): use --short flag for session name completion
Use `list-sessions --short --no-formatting` (zellij ≥0.44) to extract session names directly, falling back to sed parsing for older versions.
This commit is contained in:
parent
0f061a2d0d
commit
f1db1812cb
1 changed files with 7 additions and 3 deletions
|
|
@ -128,12 +128,16 @@ _omz_zellij_ls_raw() {
|
|||
command zellij list-sessions --no-formatting 2>/dev/null || command zellij list-sessions 2>/dev/null
|
||||
}
|
||||
|
||||
_omz_zellij_session_names() {
|
||||
# Use --short if available (zellij ≥0.44), fall back to sed parsing
|
||||
command zellij list-sessions --short --no-formatting 2>/dev/null \
|
||||
|| printf '%s\n' "$(_omz_zellij_ls_raw)" | LC_ALL=C sed -nE 's/^([^[:space:]]+).*/\1/p'
|
||||
}
|
||||
|
||||
_omz_zellij_all_sessions() {
|
||||
emulate -L zsh
|
||||
local out
|
||||
local -a sessions
|
||||
out="$(_omz_zellij_ls_raw)"
|
||||
sessions=("${(@f)$(printf '%s\n' "$out" | LC_ALL=C sed -nE 's/^([^[:space:]]+).*/\1/p')}")
|
||||
sessions=("${(@f)$(_omz_zellij_session_names)}")
|
||||
(( ${#sessions[@]} )) && compadd -Q -a sessions
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue