diff --git a/CHANGELOG.md b/CHANGELOG.md index c4142a7..a6cfa05 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Zsh: avoid inserting a trailing space when cancelling interactive Space-Tab completions. - Bash: avoid blanking the prompt when cancelling interactive Space-Tab completions. - Bash/Fish/Zsh: avoid drawing a new line when Space-Tab completion finds no matches. +- Tcsh: preserve any existing `precmd` alias instead of overwriting it. ## [0.9.9] - 2026-01-31 diff --git a/templates/tcsh.txt b/templates/tcsh.txt index fa00390..e892670 100644 --- a/templates/tcsh.txt +++ b/templates/tcsh.txt @@ -23,7 +23,15 @@ alias __zoxide_hook 'set __zoxide_pwd_tmp = "`{{ pwd_cmd }}`"; test "$__zoxide_p {%- endif %} # Initialize hook. -alias precmd ';__zoxide_hook' +set __zoxide_precmd = "`alias precmd`" +if ( "$__zoxide_precmd" !~ *__zoxide_hook* ) then + if ( "$__zoxide_precmd" == "" ) then + alias precmd '__zoxide_hook' + else + alias precmd "$__zoxide_precmd"';__zoxide_hook' + endif +endif +unset __zoxide_precmd {%- endif %}