-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
About shell integration on a dynamic prompt (in bash) #4476
Comments
Automatic shell integration is designed to be minimally invasive. And As for your question, the shell integration scripts are not meant to be To fix your issue, the bash script would probably need to be re-written Though I would suggest using one of the other supported shells for a |
Agree with you, I also think of a minimally invasive approach, like |
I have changed the kitty bash script to handle PROMPT_COMMAND. Please test. |
This outputs upon SSHing to remote system that has this new kitty.bash script. |
Thanks, it now works for me (I am using starship, locally and on the remote). Using However, Also not sure if it is relevant: I use zsh locally, bash on the remote. |
On Fri, Jan 14, 2022 at 05:53:08AM -0800, mpauper wrote:
However, `ctrl+shift+g` opens in the pager the output of the last command I ran locally before SSHing. Not sure if this is related or whether it should be another issue.
Works fine for me. Make sure on the remote system you set
KITTY_SHELL_INTEGRATION=enabled
before sourcing kitty.bash
|
Hmm, curious, for me Here is the relevant part in my remote .bashrc. The kitty.bash file referred to below is the one you just patched.
Should I start the Starship prompt after the Kitty integration part, or it doesn't matter? |
On your remote shell is _ksi_debug_print defined? |
Work great to me, thank you. |
Nope, it is unset. |
On Fri, Jan 14, 2022 at 08:59:03AM -0800, mpauper wrote:
> On your remote shell is _ksi_debug_print defined?
Nope, it is unset.
That means kitty.bash has not run.
Verify that for yourself by inserting some echos into the script
|
It does run. And I have noticed more strangeness. Bear with me: kitty.bash runsI have modified kitty.bash adding an echo at the end:
Now when I login:
Seems like kitty.bash is actually run twice? Starship is started before the kitty shell integrationRemote .bashrc content:
Then:
Starship is started after the kitty shell integrationRemote .bashrc content:
Then:
I hope there is nothing obvious I have done terribly wrong, if so, my apologies. Thanks for the help so far! |
That only tells you the file has been sourced not that _ksi_main has actually run. Look at where _ksi_debug_print is defined. Put an echo there. |
I can reproduce the issue with starships command duration if it is run before kitty.bash rather than after. But the rest of your issues I cannot reproduce. I dont know how starship command duration works, but since kitty has to run the history command to set the window title, so this is expected. You can add no-title to KITTY_SHELL_INTEGRATION to confirm. |
I took a look at the starship command timing issue and the way they've implemented it is rather fragile and overly complex. All they need to do is append |
Can you reproduce this issue? kitty --config=NONE -o shell=bash -o remember_window_size=no -o initial_window_height=10c
I briefly looked at the prompt mark and it is correct. (with dump_lines_with_attrs) But it still outputs everything that contains seq 10. |
That doesn't have anything to do with bash. It reproduces with any |
Hi @kovidgoyal, sorry for the late reply. I did not have access to the remote system these days.
I have done the following, adding an echo on line 22 before
Now when I SSH into remote:
It seems to be then, that Thanks for looking into this and into starship command duration thing. I'll take your word on your assessment, because my knowledge on the matter is not good enough to understand what you said. However, I am still pondering on these:
|
From all your symptoms, I am guessing something in your bashrc or |
I found that the https://sources.debian.org/src/bash/5.1-2/debian/skel.bashrc/#L69 Try to append it to the end of PS1. # _ksi_set_mark start_title ...
_ksi_prompt_command() {
# ...
PS1=${PS1//\\\[\\e\]133;k;start_title_kitty\\a\\\]*end_title_kitty\\a\\\]}
PS1="$PS1\[\e]133;k;start_title_kitty\a\]\[\e]2;\w\a\]\[\e]133;k;end_title_kitty\a\]"
# ...
}
# builtin unset _ksi_prompt[start_title_mark] ... Do you think there is a need for improvement here? |
This is definitely not a bug and probably pretty much your intention, but I'd love to know your opinion on this.
I have always left the
shell_integration
disabled in my config until today. You know, customizations usually take me a loads of time. However, I also had to let the whole month of testing this feature wasted by contributing nothing to the conversations, my apologies.In the end I decided to spend this weekend trying and realized that my bash prompt is not recognizable because of this (simplified):
I believe cross-platform prompt generators like oh-my-posh and starship have things done similarly as above. Therefore, our escape sequences prepending/appending is not sufficient as it runs only once in a session.
Indeed, this works for me (with mark feature):
However, this one doesn't work because we lost
KITTY_SHELL_INTEGRATION
on the run:As you can see, we can have a workaround at the shell configuration level but this makes me feel a bit uncomfortable because of the code repetition. So, what is your stance on this?
I haven't had a look at other shell since I'm only sticking with bash these days. I've searched in the RFC issue but couldn't find a similar talk. If this has been discussed and decided somewhere, please accept my apologies again and guide me on the way out. Thank you.
The text was updated successfully, but these errors were encountered: