Skip to content
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

Feature Request: fish shell support #23

Open
benpbolton opened this issue Jan 23, 2024 · 3 comments
Open

Feature Request: fish shell support #23

benpbolton opened this issue Jan 23, 2024 · 3 comments

Comments

@benpbolton
Copy link

The goal of this project seems to be in alignment with so much of fish shell's mission - in particular. In fact, the name and intent similarity immediately made me look to see if there was already a fisher plugin implementation of butterfish.

User Story

As an avid fan of fish shell, I would like to use butterfish, so that I can benefit from an even more friendly interactive shell.

@darinkishore
Copy link

Hi @bakks ! What would we need to support adding fish? I'm happy to start taking a look.

@bakks
Copy link
Owner

bakks commented May 27, 2024

👋 hello! I haven't had time to look at integrating fish and I'm not super familiar so it's hard to say what is necessary, but I'm happy to give you the outlines if you want to take a look. Happy to give feedback and work with a PR! Some things that might help:

  • Butterfish shell intercepts the io between the terminal and shell, for example if you press enter, that keypress will first go to butterfish, which might take action based on internal state, like if you've been typing an LLM prompt it will send that. So if there are differences between fish and other shells in that layer then changes will need to be made, but you'll have to experiment.
  • There a bit of shell-specific logic here. It's setting the shell prompt with the fish emoji and adding some special characters that butterfish uses later on to figure out when a shell prompt is printed, so it's important.

Anyway, have at it!

@tfriedel
Copy link

tfriedel commented Jul 27, 2024

I attempted to make it work with fish. Here's my current fork:
https://github.com/tfriedel/butterfish/tree/fish

I'm not completely happy with it.
Here are some of the current issues I observed:

  • it lags a lot more than regular fish in neovim. I.e. if I scroll in neovim I can watch the screen being rendered in chunks. This may also be an issue with regular butterfish in other shells.

  • the special prompt for fish, a fish function is printed when butterfish is started. Ideally it would be filtered out or loaded in the background.

  • when not in tmux, a "0" is printed after the prompt

  • the detection of capitalized prompts sometimes doesn't work. There is some piece of code in butterfish that checks the number of subprocesses to check if it should intercept and it assumes if more than the shell is running it shouldn't.
    However I use atuin with fish which adds better history. And atuin runs after each command.
    I added a workaround for this by copying atuin to atuin2 and I use atuin2 for adding to the history but the original atuin for interactive browsing of the history.
    Atuin2 is then whitelisted, like other shell commands.
    This is an ugly workaround and even with it, the problem of not detecting some capitalized prompts still appears.

  • I also (rarely) saw that the cursor was not in the right place (next to the prompt).

I was thinking there's maybe a better way to signal when fish shell is active than just counting child processes. Maybe some hook?

@tfriedel tfriedel mentioned this issue Jul 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants