Skip to content

Support fish when running shell command #4350

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

Merged
merged 1 commit into from
Mar 6, 2025

Conversation

stefanhaller
Copy link
Collaborator

  • PR Description

This should allow using custom shell functions in lazygit's : prompt.

Fixes #4342.

@stefanhaller stefanhaller added the enhancement New feature or request label Mar 2, 2025
Copy link

codacy-production bot commented Mar 2, 2025

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
Report missing for 08751d61 66.67%
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (08751d6) Report Missing Report Missing Report Missing
Head commit (f28b6f4) 53202 46073 86.60%

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#4350) 3 2 66.67%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

Codacy stopped sending the deprecated coverage status on June 5th, 2024. Learn more

Footnotes

  1. Codacy didn't receive coverage data for the commit, or there was an error processing the received data. Check your integration for errors and validate that your coverage setup is correct.

@stefanhaller stefanhaller enabled auto-merge March 6, 2025 07:11

Verified

This commit was signed with the committer’s verified signature.
joostdebruijn Joost de Bruijn
This should allow using custom shell functions in lazygit's : prompt.
@stefanhaller stefanhaller force-pushed the support-fish-in-shell-commands branch from 67ec969 to f28b6f4 Compare March 6, 2025 07:11
@stefanhaller stefanhaller merged commit ddc14ef into master Mar 6, 2025
15 checks passed
@stefanhaller stefanhaller deleted the support-fish-in-shell-commands branch March 6, 2025 07:14
stefanhaller added a commit that referenced this pull request Apr 7, 2025
- **PR Description**

In version 0.45.0 we started to use an interactive shell for running
shell commands (see #4159). The idea was that this allows users to use
their aliases and shell functions in lazygit without having to do any
additional configuration.

Unfortunately, this hasn't worked out well. For some users this resulted
in lazygit hanging in the background upon trying to return from the
shell command; we tried various fixes for this (see #4126, #4159, and
#4350), but some users still have this problem (e.g. #4320).

Also, starting an interactive shell can be a lot slower than starting a
non-interactive one, depending on how much happens in the `.bashrc` or
`.zshrc` file. For example, on my machine calling `zsh -ic true` takes
600ms, whereas `zsh -c true` takes less than 2ms. This is too high of a
price to pay for using shell aliases, especially when _all_ users have
to pay it, even those who don't care about using their aliases in
lazygit.

This PR reverts all commits related to interactive shells, and instead
introduces a different approach: we let users specify a shell aliases
file that will be sourced before running a command. The downside is that
it doesn't work transparently out of the box, but requires
configuration, and it may also require that users restructure their
shell startup file(s) if they currently only have a single big one. The
advantage is that only users who actually want to use aliases or
functions are affected, and that we can now use this mechanism not only
for shell commands, but also for custom commands and for calling the
editor (some users have asked for this in the past).
@elythh
Copy link

elythh commented Apr 28, 2025

Edit File keybind seems to be broken on fish. Not sure if that's since this PR

image

@stefanhaller
Copy link
Collaborator Author

@elythh A fix for this was merged to master yesterday, see #4506.

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

Successfully merging this pull request may close these issues.

None yet

3 participants