-
Notifications
You must be signed in to change notification settings - Fork 572
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
jump_to_prompt feature is defeated by switching shells #255
Comments
Yes, this is expected. Ghostty does quite a lot of hoop jumping (same as Kitty) to setup shell integration and it doesn't persist into sub-shells (same as Kitty) unless you manually setup the shell integration there through dotfiles. Is there another terminal this does work with? Or are you used to just using the search-backwards functionality that Ghostty doesn't yet provide? |
The workflow that ghostty is competing with for me personally is described in #227 which is pretty awful, but actually better than what ghostty offers currently. Neither shift+page up/down to scroll works in ghostty, nor does it have a "find previous text" feature. I don't use kitty other than to run bork. I feel like this is one of those things where if you are a new user, it blows your mind how shitty the user experience is, but as you dig into it and become an expert on implementing a terminal and have to grapple with all the legacy garbage that the previous generation handed you, you lose that perspective and the limitation starts to become acceptable to you. IMO the beginner perspective is valuable here. If I had to do the same workaround in ghostty as I do in xfce4-terminal, I would be sad about that. edit: note that this also affects ssh sessions, regardless of which shell is being used remotely. |
I'm otherwise unsure if this issue itself is actionable. I think I described in Discord what the fundamental issues are regarding jump to prompt and requiring shell integration. Ghostty just can't detect that you're launching into another shell. Thoughts? |
ghostty is the parent process, so it can technically do anything, including editing the executable code of any child process, including bash, or replacing a process with its own puppet one, or even just setting |
Alright, I think I have a not-automatic-yet half-step that also isn't that bad. It only requires manual setup once and then all your nix shells will work. I've ported the Kitty bash shell integration: https://github.com/mitchellh/ghostty/blob/main/src/shell-integration/bash/ghostty.bash All you have to do is add this to your if [ -n "$GHOSTTY_RESOURCES_DIR" ]; then
builtin source "${GHOSTTY_RESOURCES_DIR}/shell-integration/bash/ghostty.bash"
fi You do NOT need to manually define Now all your |
I put that snippet at the top of my |
Hm, maybe the bash integration is sending the marks. I'll take a look. I admittedly didn't test jump to prompt, I only tested that cwd reporting, title changes, and cursor changes were working. |
Just tested it and it works for me but is kind of broken in |
I am unable to reproduce the jump_to_prompt feature working with bash (nix-shell no longer in the equation). What can I do to troubleshoot? |
I'm going to try to simplify the bash integration because I just ported Kitty's and don't understand it at all. And I'm being punished for that. I think I need to really dig in and think about this for a sec. |
Okay, I've dramatically simplified the bash script and actually understand wtf is going on. It works much better for me in nix-shell. Can you give it a shot? https://github.com/mitchellh/ghostty/blob/main/src/shell-integration/bash/ghostty.bash Ironically, this now needs to be included last. lol. Same snippet. (Edited previous comment to also note the snippet needs to be at the bottom) |
lmfao |
It works! And wow, this is a game changer. Thank you so much! |
🫡 I'm going to close this issue for now. I'd still love to investigate fancier ways to automate this but I think there is a decent answer here for most shells, and this issue also forced me to write some |
Here's an example terminal session:
This is my most common workflow; I prefer fish but I use nix-shell a lot so I'm unfortunately hanging out in bash all day.
Anyway if I do
jump_to_prompt:-1
here, it goes all the way up to the last fish prompt (line 2), rather than the last actual command prompt (in bash).The text was updated successfully, but these errors were encountered: