New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New shell integration not playing nicely with zsh plugins #4428
Comments
Works fine for me with ~/.zshrc
and shell integration enabled, with the following steps
|
My bad. I loaded a default I'm able to consistently replicate it, with this minimal source "$HOME/code/input/init.zsh"
source "$HOME/code/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" Clone the repos at: My assumption is that |
This will likely be hitting some zsh internal limit or the other. I am not familiar enough with zsh to guess what, but offhand have you tried the suggestion in the error and increased FUNCNEST? |
@kovidgoyal Yes. I've tried increasing |
Can confirm, editing FUNCEST does not help. |
well I can see nothing wrong in either the kitty code or the zimfw code, |
What change would occur between v0.23.1 to v0.24.0? |
@kovidgoyal Sadly it seems that this problem isn't isolated to source "$HOME/code/input/init.zsh"
source "$HOME/code/zsh-autosuggestions/zsh-autosuggestions.zsh"
source "$HOME/code/zsh-history-substring-search/zsh-history-substring-search.zsh" Relevant repos:
What makes this worse is that the repos involved here are extremely common within the |
@ldelossa You should read the changelog. Version |
somebody will need to do a deep dive on those plugins to see what it is they are doing, I really dont have the time for that, at least for now. But maybe later. |
I tried commenting out blocks of code and have so far found that I'm not seeing any errors after commenting out: https://github.com/kovidgoyal/kitty/blob/master/shell-integration/zsh/kitty-integration#L235 |
Removing and commenting out https://github.com/kovidgoyal/kitty/blob/master/shell-integration/zsh/kitty-integration#L204-L205 obviously fixes it too. |
Ah, I see. Yes feature looks very cool, but terminal breaking my zsh env is a big problem. Will stick to v0.23.1 until fix. Thanks for new features Kovid, they do look aweome! |
yes but there isnt anything actually wrong with that line. Its something the plugins are doing to zle-add-widget |
Ah, I think I know the issue. |
@kovidgoyal I just built from master, doesn't seem to be fixed for me. |
I tried the three plugins mentioned above and still have problems. I tried disabling shell integration and the kitty window was still closed instantly after startup. kitty --config=NONE -o shell_integration=disabled -o shell=zsh --hold I'm more curious as to why |
Yeah with all three as opposed to just two its not fixed, sadly. |
Is it possible that
Because it was closed by kitty itself. |
--hold works fine kitty --hold false what other character is kitty sending to the window?? You mean something in response to an escape code? You can check by modifying the hold() function in |
Yes. I mean when used with the problematic zsh rc. The program sends an escape code, then exits immediately due to an error, and the escape code returned by kitty is sent to the window and causes it ( I checked and confirmed that stdin received the data here, then exited. def hold(args: List[str]) -> None:
# ...
with suppress(BaseException):
# ...
sys.stdin.buffer.read(1) source /path/to/zimfw-input/init.zsh
source /path/to/zsh-history-substring-search.zsh |
I just built from |
Do you mean that all three plugins mentioned above are working correctly? I can only run zsh if I comment the following lines in the plugin. # if is-at-least 5.3; then
# autoload -Uz add-zle-hook-widget && \
# add-zle-hook-widget -Uz line-init start-application-mode && \
# add-zle-hook-widget -Uz line-finish stop-application-mode
# else
zle -N zle-line-init start-application-mode
zle -N zle-line-finish stop-application-mode
# fi |
Everything seems to be working fine on my setup with 69482b6. |
Ah, but I have |
Basically, the syntax/autosuggest/substring search plugins all rewrap all zle widgets. And that rewrap logic is broken by both zimfw and kitty calling add-zle-hook-widget. If both calls are present, then the rewrap logic creates an infinite recursion. If either one of those calls is removed, there is no infinite recursion. I dont know of a good way to fix this sorry. I guess you have to use either zimfw or kitty shell integration. Someday I might read that rewrap logic and try to figure out a workaround, but frankly shell script makes my eyes bleed. The only thing I can think of is to not dynamically create the functions used for zle widgets and instead set the at load time just once. This means a bit of a performance loss, but given the craziness that is the zsh ecosystem, maybe its the only way. Perhaps @romkatv can comment, since this is his code. |
And actually setting them at load time wont work since various other plugins clear the zle hooks on initialization, le sigh. So yeah totally out of ideas here. |
P.S. I really should've at least flagged the use of |
Cool, thanks. |
Sent #4437. |
Everything is working. Thanks a lot. The shell integration features are HUGELY helpful, and something I've been looking for, for a very long time. 🚀 |
Describe the bug
When running
kitty
with the new shell integrations somezsh
plugins start to errormaximum nested function level reached
.To Reproduce
Steps to reproduce the behavior:
kitty
@0.24.0
.zsh-autosuggestions
.source ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh
maximum nested function level reached
should be echoed on every new call.Screenshots
Environment details
The text was updated successfully, but these errors were encountered: