T05: shell integration for zsh, bash, fish, PowerShell; installed at start
CI / platforms (windows-latest) (push) Failing after 8s
CI / macos (push) Failing after 8m47s
CI / platforms (ubuntu-24.04) (push) Canceled after 0s

This commit is contained in:
ZacharyZhang-NY committed 2026-10-14 12:24:31 -04:00
1 parent 8c6f242bf1
commit dfaf378418
12 files changed
+375 -4

No files matched your search

@@ -0,0 +1,18 @@
# ELYTerminal: load the usual startup files, report folder and title.
if [ -n "${ELY_BASH_LOGIN-}" ]; then
builtin unset ELY_BASH_LOGIN
[ -r /etc/profile ] && builtin source /etc/profile
for _ely_file in ~/.bash_profile ~/.bash_login ~/.profile; do
if [ -r "$_ely_file" ]; then
builtin source "$_ely_file"
break
fi
done
builtin unset _ely_file
else
[ -r ~/.bashrc ] && builtin source ~/.bashrc
fi
_ely_prompt() {
builtin printf '\e]7;file://%s\a\e]2;%s\a' "${PWD//\%/%25}" "${PWD##*/}"
}
PROMPT_COMMAND="_ely_prompt${PROMPT_COMMAND:+;$PROMPT_COMMAND}"
@@ -0,0 +1,12 @@
# ELYTerminal: restore XDG_DATA_DIRS, report the folder; fish_title keeps the title.
if test -n "$ELY_FISH_XDG_DATA_DIRS"
set -gx XDG_DATA_DIRS $ELY_FISH_XDG_DATA_DIRS
else
set -e XDG_DATA_DIRS
end
set -e ELY_FISH_XDG_DATA_DIRS
if status is-interactive
function _ely_prompt --on-event fish_prompt
printf '\e]7;file://%s\a' (string replace -a % %25 -- $PWD)
end
end
@@ -0,0 +1,13 @@
# ELYTerminal: wrap the prompt to report folder and title.
$global:ElyPrompt = $function:prompt
function global:prompt {
$folder = $executionContext.SessionState.Path.CurrentLocation
if ($folder.Provider.Name -eq 'FileSystem') {
$path = $folder.ProviderPath.Replace('\', '/').Replace('%', '%25')
if (-not $path.StartsWith('/')) { $path = "/$path" }
$leaf = Split-Path -Leaf $folder.ProviderPath
$esc, $bel = [char]27, [char]7
[Console]::Write("$esc]7;file://$path$bel$esc]2;$leaf$bel")
}
& $global:ElyPrompt
}
+19
View File
@@ -0,0 +1,19 @@
# ELYTerminal: restore ZDOTDIR, load the user's .zshenv, report folder and title.
if [[ -n "${ELY_ZSH_ZDOTDIR+set}" ]]; then
ZDOTDIR=$ELY_ZSH_ZDOTDIR
builtin unset ELY_ZSH_ZDOTDIR
else
builtin unset ZDOTDIR
fi
[[ -r "${ZDOTDIR:-$HOME}/.zshenv" ]] && builtin source "${ZDOTDIR:-$HOME}/.zshenv"
if [[ -o interactive ]]; then
_ely_precmd() {
builtin printf '\e]7;file://%s\a\e]2;%s\a' "${PWD//\%/%25}" "${${PWD:t}:-/}"
}
_ely_preexec() {
builtin printf '\e]2;%s\a' "${1//[[:cntrl:]]/}"
}
builtin autoload -Uz add-zsh-hook
add-zsh-hook precmd _ely_precmd
add-zsh-hook preexec _ely_preexec
fi