feat: codespace tab names and session widget improvements
Show friendly codespace name (without trailing random ID) in tmux tabs, prefixed with cs:. Add ctrl-n to session widget to start a new copilot session, and improve header labels and field display. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -12,6 +12,16 @@ case "$cmd" in
|
|||||||
*) name="$cmd" ;;
|
*) name="$cmd" ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
# In Codespaces, show friendly name without trailing random ID
|
||||||
|
# Codespace names: "adjective-noun-id" where id is alphanumeric gibberish
|
||||||
|
if [[ -n "$CODESPACE_NAME" ]]; then
|
||||||
|
friendly="${CODESPACE_NAME%-*}"
|
||||||
|
# If no hyphen was found, use full name
|
||||||
|
[[ "$friendly" == "$CODESPACE_NAME" ]] && friendly="$CODESPACE_NAME"
|
||||||
|
echo "cs:${friendly}"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
if (( ${#name} > max )); then
|
if (( ${#name} > max )); then
|
||||||
echo "${name:0:$max}…"
|
echo "${name:0:$max}…"
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -284,12 +284,20 @@ for line in sys.stdin:
|
|||||||
print(\">\", msg)
|
print(\">\", msg)
|
||||||
except: pass
|
except: pass
|
||||||
" 2>/dev/null
|
" 2>/dev/null
|
||||||
' --header 'enter=colby | ctrl-r=restricted | ctrl-s=continue latest' \
|
' --delimiter="|" --with-nth=1,3 \
|
||||||
--expect=ctrl-r,ctrl-s)"
|
--header 'enter=resume | ^r=restricted | ^s=latest | ^n=new' \
|
||||||
|
--expect=ctrl-r,ctrl-s,ctrl-n)"
|
||||||
local fzf_rc=$?
|
local fzf_rc=$?
|
||||||
[[ $fzf_rc -ne 0 && "$session" != ctrl-s* ]] && { zle reset-prompt; return; }
|
[[ $fzf_rc -ne 0 && "$session" != ctrl-s* && "$session" != ctrl-n* ]] && { zle reset-prompt; return; }
|
||||||
local key=$(echo "$session" | head -1)
|
local key=$(echo "$session" | head -1)
|
||||||
local line=$(echo "$session" | tail -1)
|
local line=$(echo "$session" | tail -1)
|
||||||
|
# Ctrl+N — new session
|
||||||
|
if [[ "$key" == "ctrl-n" ]]; then
|
||||||
|
BUFFER="colby"
|
||||||
|
zle reset-prompt
|
||||||
|
zle accept-line
|
||||||
|
return
|
||||||
|
fi
|
||||||
# Ctrl+S again — continue latest
|
# Ctrl+S again — continue latest
|
||||||
if [[ "$key" == "ctrl-s" ]]; then
|
if [[ "$key" == "ctrl-s" ]]; then
|
||||||
BUFFER="colby --continue"
|
BUFFER="colby --continue"
|
||||||
|
|||||||
Reference in New Issue
Block a user