Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[fish] Small clean-ups and optimizations #4259

Merged
merged 9 commits into from
Feb 19, 2025

Conversation

bitraid
Copy link
Contributor

@bitraid bitraid commented Feb 19, 2025

Minor all-around code improvements and clean-ups. No actual changes to the operation of the script. Tested to work with fish versions 3.1.2, 3.7.1 and 4.0b1-430-g5e38a2a46.

Independently of these changes, even though everything seems to work with the beta version 4.0 of fish, there is (again) one test that inconsistently fails (only with v4):

TestFish#test_ctrl_r_multiline [test/test_shell_integration.rb:137]:
Expected "" to include "\"foo".

Append all arguments after the first one, so that functions don't have
to pass all appending options as a single string. Also, output
everything as a single string (an array of one item).
The FZF_TMUX variable check has already been changed from numeric to
string, so there is no need to set it to 0 if it's empty or undefined.
The __fzf_get_dir function was called only once, and was basically a
single command in a while loop.
- Remove check/set of FZF_TMUX_HEIGHT variable. It is already done by
  __fzf_defaults.
- Remove unnecessary begin/end block.
- Simplify result variable check.
- Insert file names using a single call to commandline.
- Remove check/set of FZF_TMUX_HEIGHT variable. It is already done by
  __fzf_defaults.
- Remove unnecessary begin/end block.
- Pass all fzf options (except query) through FZF_DEFAULT_OPTS variable.
- Remove check/set of FZF_TMUX_HEIGHT variable. It is already done by
  __fzf_defaults.
- Remove unnecessary begin/end block.
- Simplify result variable check.
- Set the command line using a single call to commandline.
Use single check for each default command variable.
Move the helper functions to the top of the main function, and the main
function commands (bind command) to the bottom.
Copy link
Owner

@junegunn junegunn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, they all look good to me. Is there anything else you want to address?

@bitraid
Copy link
Contributor Author

bitraid commented Feb 19, 2025

Thanks, they all look good to me. Is there anything else you want to address?

No, I think that's all. Thanks!

@junegunn junegunn merged commit 91bc4f2 into junegunn:master Feb 19, 2025
5 checks passed
@junegunn
Copy link
Owner

Rebased and merged. Thanks!

@bitraid bitraid deleted the fish-cleanup branch February 19, 2025 23:54
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants