Open freeo opened 2 years ago
I use zsh with zsh-autosuggestions on a remote machine and everything works fine. How does it break exactly?
As per documentation, I've added the extra configs to make the most of emacs/vterm integration by adding these lines to my zshrc:
if [[ "$INSIDE_EMACS" = 'vterm' ]] \
&& [[ -n ${EMACS_VTERM_PATH} ]] \
&& [[ -f ${EMACS_VTERM_PATH}/etc/emacs-vterm-zsh.sh ]]; then
source ${EMACS_VTERM_PATH}/etc/emacs-vterm-zsh.sh
[...]
The sourced script contains this line:
add-zsh-hook -Uz chpwd (){ print -Pn "\e]2;%m:%2~\a" }
When I comment this line, autosuggestions work as expected. Uncommenting this line-> no autosuggestions at all.
So this zsh-hook somehow interferes with the inner workings of autosuggestions. And since this hook isn't changing the vterm buffer title (which it should as per docs) I just want to undo this hook somehow, which is why I'm asking here. I couldn't find a way.
If the title in not changing, there is probably another problem.
If you just want to remove the hook, you don't really need the entire emacs-vterm-zsh.sh
. You can just copy and paste the parts that you like in your .zshrc
.
I was thinking of copy & pasting as well. But I like the idea of getting upstream changes to this file on updating vterm, that's why I was thinking towards overriding just this line.
But considering the title isn't even changing, let's investigate. Shall I generate some output that will help debug this?
It would be useful if you could verify that the problem appears with a clean Emacs and clean zsh. Maybe it is the interaction with some other plugins that is messing up things.
Having the same problem.
add-zsh-hook -Uz chpwd (){ print -Pn "\e]2;%m:%2~\a" }
seems to be redefining add-zsh-hook
.
When I load up vterm I get the following:
❯ type add-zsh-hook
add-zsh-hook is a shell function from /usr/share/zsh/5.8.1/functions/add-zsh-hook
❯ source $EMACS_VTERM_PATH/etc/emacs-vterm-zsh.sh
❯ type add-zsh-hook
add-zsh-hook is a shell function from /Users/seth/.emacs.d/.local/straight/build-28.2/vterm//etc/emacs-vterm-zsh.sh
❯ which add-zsh-hook
add-zsh-hook () {
print -Pn "\e]2;%m:%2~\a"
}
This looks very wrong.
it seems like it's similar issue with this one, https://github.com/teaxyz/cli/issues/281 (which contains a resolution or workaround depends on your view)
This file: ~/.emacs.d/.local/straight/repos/emacs-libvterm/etc/emacs-vterm-zsh.sh
contains this offending line: add-zsh-hook -Uz chpwd (){ print -Pn "\e]2;%m:%2~\a" }
This breaks this plugin: https://github.com/zsh-users/zsh-autosuggestions
I tried to remove/undo this hook with
add-zsh-hook -d ...
but all my attempts failed. I don't want to just comment this line out, as I don't want to version controlemacs-vterm-zsh.sh
Would like to request some help here...