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

Nushell compatibility #56

Closed
J-Kappes opened this issue Nov 17, 2023 · 8 comments
Closed

Nushell compatibility #56

J-Kappes opened this issue Nov 17, 2023 · 8 comments
Labels

Comments

@J-Kappes
Copy link
Contributor

J-Kappes commented Nov 17, 2023

Having your default shell set to nu causes issues due to the use of && in kitty_commands.lua. Could those be replaced with ; (my workaround) or the full_cmd be wrapped in echo "..." | sh? Or is there a more elegant solution for letting commands be interpreted by dash?

@mikesmithgh
Copy link
Owner

Hey @J-Kappes thanks for the issue and workaround. I'll take a look into this 👍 I have had some issues before with other shell (fish) compatibility around those as well. I think I need to have a more generalized approach

@mikesmithgh
Copy link
Owner

Reproduced:

brew install nushell
echo '/opt/homebrew/bin/nu' >> /etc/shells
chsh -s /opt/homebrew/bin/nu

==============================================================================
kitty-scrollback.nvim

ERROR: failed to execute remote Kitty command

*entrypoint:* |termopen()| |::| |exit_code| |~=| |0| 
*command:* kitty @ get-text --match="id:1" --ansi --clear-selection --add-cursor --extent=all | sed -E -e 's/�\[\?25.�\[.*;.*H�\[.*//g' -e 's/$/�[0m/g'  && kitty +runpy 'sys.stdout.flush()' && printf '�]2;'
*channel_id:* 3
*code:* 1
*stdout:*

  Error: nu::parser::shell_andand
    × The '&&' operator is not supported in Nushell
     ╭─[source:1:1]
   1 │ kitty @ get-text --match="id:1" --ansi --clear-selection --add-cursor --extent=all | sed -E -e 's/[\?25.[.*;.*H[.*//g' -e 's/$//g'  && kitty +runpy 'sys.stdout.flush()' && printf '�]2;'
     ·                                                                                                                                           ─┬
     ·                                                                                                                                            ╰── instead of '&&', use ';' or 'and'
     ╰────
    help: use ';' instead of the shell '&&', or 'and' instead of the boolean '&&'

*stderr:*
  <none>

@J-Kappes
Copy link
Contributor Author

J-Kappes commented Nov 22, 2023

I found another workaround. Add the following line before vim.fn.termopen:

  vim.cmd("let &shell='/bin/sh'")

I tried executing a Nushell specific command from within the scrollback afterward and it still worked, i.e. setting that variable doesn't affect which shell gets used interactively.

@mikesmithgh
Copy link
Owner

I found another workaround. Add the following line before vim.fn.termopen:

  vim.cmd("let &shell='/bin/sh'")

I tried executing a Nushell specific command from within the scrollback afterward and it still worked, i.e. setting that variable doesn't affect which shell gets used interactively.

Ohhh that is very clever! I think I may use that. Thanks for the share!

mikesmithgh pushed a commit that referenced this issue Nov 22, 2023
## [2.1.2](v2.1.1...v2.1.2) (2023-11-22)

### Bug Fixes

* set shell to sh before executing termopen ([#59](#59)) ([cabb1f2](cabb1f2)), closes [#56](#56)
@mikesmithgh
Copy link
Owner

🎉 This issue has been resolved in version 2.1.2 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@mikesmithgh
Copy link
Owner

Hey @J-Kappes, I just merged the approach of overriding shell. Thanks for the recommendation, let me know if this works or if you have any other issues.

@J-Kappes
Copy link
Contributor Author

The new release works for me, no problem 🎉

@mikesmithgh
Copy link
Owner

The new release works for me, no problem 🎉

awesome, thanks for looking into it 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants