Skip to content

Commit d6f5a4b

Browse files
committed
Add new mode & code sequences to shell integrations
1 parent 334357f commit d6f5a4b

2 files changed

Lines changed: 26 additions & 4 deletions

File tree

CodeEdit/ShellIntegration/codeedit_shell_integration.bash

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -443,14 +443,27 @@ _install_bash_preexec
443443
unset -f _install_bash_preexec
444444

445445
# -- BEGIN CODEEDIT CUSTOMIZATIONS --
446+
447+
__codeedit_status="$?"
448+
446449
__codeedit_preexec() {
447-
echo -ne "\033]0;${1}\007"
450+
builtin printf "\033]133;C\007"
451+
builtin printf "\033]0;%s\007" "$1"
448452
}
449453

450454
__codeedit_precmd() {
451-
echo -ne "\033]0;bash\007"
455+
builtin printf "\033]133;D;%s\007" "$?"
456+
builtin printf "\033]0;bash\007"
452457
}
453458

454459
preexec_functions+=(__codeedit_preexec)
455460
precmd_functions+=(__codeedit_precmd)
461+
462+
if [[ "$CE_SHELL_INTEGRATION_DISABLE_PROMPT" == "1" ]]; then
463+
unset HISTFILE
464+
PROMPT_COMMAND="echo -n ''"
465+
PS1="> "
466+
PS2=""
467+
fi;
468+
456469
# -- END CODEEDIT CUSTOMIZATIONS --

CodeEdit/ShellIntegration/codeedit_shell_integration_rc.zsh

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,25 @@ fi
4747
builtin autoload -Uz add-zsh-hook
4848

4949
__codeedit_preexec() {
50-
echo -n "\033]0;${1}\007"
50+
builtin printf "\033]133;C\007"
51+
builtin printf "\033]0;%s\007" "$1"
5152
}
5253

5354
__codeedit_precmd() {
54-
echo -n "\033]0;zsh\007"
55+
builtin printf "\033]133;D;%s\007" "$?"
56+
builtin printf "\033]0;zsh\007"
5557
}
5658

5759
add-zsh-hook preexec __codeedit_preexec
5860
add-zsh-hook precmd __codeedit_precmd
5961

62+
if [[ "$CE_SHELL_INTEGRATION_DISABLE_PROMPT" == "1" ]]; then
63+
unset HISTFILE
64+
PROMPT_COMMAND="echo -n ''"
65+
PS1="> "
66+
PS2=""
67+
fi
68+
6069
# Fix ZDOTDIR
6170

6271
if [[ $USER_ZDOTDIR != $CE_ZDOTDIR ]]; then

0 commit comments

Comments
 (0)