Skip to content

Allow override of rm and custom fzf options#49

Open
ollehu wants to merge 2 commits into
gazorby:mainfrom
ollehu:main
Open

Allow override of rm and custom fzf options#49
ollehu wants to merge 2 commits into
gazorby:mainfrom
ollehu:main

Conversation

@ollehu

@ollehu ollehu commented Oct 15, 2024

Copy link
Copy Markdown

It's not unusual to alias rm to something harmless when using, for example, trash to remove files/directories. This PR will enable the user to change that command. This PR also lets the user add additional argument to the fzf_cmd, something that was not working properly before (I believe?)

@ollehu ollehu force-pushed the main branch 2 times, most recently from 6ad7054 to 4e73098 Compare October 15, 2024 15:48
@ollehu ollehu changed the title Allow override of rm Allow override of rm and custom fzf options Oct 15, 2024
@ollehu

ollehu commented Oct 15, 2024

Copy link
Copy Markdown
Author

Ping @gazorby

@towry

towry commented Oct 17, 2024

Copy link
Copy Markdown

Hi, how to customize the fzf opts based on your change?

@ollehu

ollehu commented Oct 17, 2024

Copy link
Copy Markdown
Author

Hi, how to customize the fzf opts based on your change?

Sorry about that, just updated the README. You simply set the fifc_custom_fzf_opts variable. I, for example, do not like the hardcoded --exact flag, so I have set -U fifc_custom_fzf_opts +e in my config.

@towry

towry commented Oct 18, 2024

Copy link
Copy Markdown

To append a custom fzf command, for example to disable the --exact flag and increase the fuzziness

Thanks for your work, this is exactly the feature that I am missing. can't wait for this to be merged.

@towry

towry commented Oct 18, 2024

Copy link
Copy Markdown

I don't know if this error is caused by this change.

Expected a combining operator like '-a' at index 4                                                                                                                
 = directories _fifc_source_directories _fifc_comp_2 _fifc_comp_3 _fifc_comp_4 _fifc_comp_5 _fifc_comp_6 _fifc_comp_7 _fifc_comp_8 _fifc_comp_9[1]                                 
               ^                                                                                                                                                                   
/nix/store/2flxhkb7shp3r6s2h3n7b4db6q06ypfc-source/functions/_fifc_action.fish (line 1):                                                                                           
in function '_fifc_action' with arguments 'source'                                                                                                                                 
        called on line 1 of file /nix/store/2flxhkb7shp3r6s2h3n7b4db6q06ypfc-source/functions/_fifc.fish                                                                           
in command substitution                                                                                                                                                            
        called on line 25 of file /nix/store/2flxhkb7shp3r6s2h3n7b4db6q06ypfc-source/functions/_fifc.fish

@gazorby

gazorby commented Oct 19, 2024

Copy link
Copy Markdown
Owner

I don't know if this error is caused by this change.

Expected a combining operator like '-a' at index 4                                                                                                                
 = directories _fifc_source_directories _fifc_comp_2 _fifc_comp_3 _fifc_comp_4 _fifc_comp_5 _fifc_comp_6 _fifc_comp_7 _fifc_comp_8 _fifc_comp_9[1]                                 
               ^                                                                                                                                                                   
/nix/store/2flxhkb7shp3r6s2h3n7b4db6q06ypfc-source/functions/_fifc_action.fish (line 1):                                                                                           
in function '_fifc_action' with arguments 'source'                                                                                                                                 
        called on line 1 of file /nix/store/2flxhkb7shp3r6s2h3n7b4db6q06ypfc-source/functions/_fifc.fish                                                                           
in command substitution                                                                                                                                                            
        called on line 25 of file /nix/store/2flxhkb7shp3r6s2h3n7b4db6q06ypfc-source/functions/_fifc.fish

This PR has not been merged yet; this error must come from the last one I merged earlier this week.

@gazorby

gazorby commented Oct 19, 2024

Copy link
Copy Markdown
Owner

Hi @ollehu, Thanks for contributing!
fifc_custom_fzf_opts seems interesting, I will check this out this week.

* Remove hardcoded use of tab (\t) for _fifc
@ollehu

ollehu commented Oct 23, 2024

Copy link
Copy Markdown
Author

I don't know if this error is caused by this change.

Expected a combining operator like '-a' at index 4                                                                                                                
 = directories _fifc_source_directories _fifc_comp_2 _fifc_comp_3 _fifc_comp_4 _fifc_comp_5 _fifc_comp_6 _fifc_comp_7 _fifc_comp_8 _fifc_comp_9[1]                                 
               ^                                                                                                                                                                   
/nix/store/2flxhkb7shp3r6s2h3n7b4db6q06ypfc-source/functions/_fifc_action.fish (line 1):                                                                                           
in function '_fifc_action' with arguments 'source'                                                                                                                                 
        called on line 1 of file /nix/store/2flxhkb7shp3r6s2h3n7b4db6q06ypfc-source/functions/_fifc.fish                                                                           
in command substitution                                                                                                                                                            
        called on line 25 of file /nix/store/2flxhkb7shp3r6s2h3n7b4db6q06ypfc-source/functions/_fifc.fish

Did you get this using this PR or main? If using this PR, how did you trigger it?

@davxy

davxy commented Feb 26, 2025

Copy link
Copy Markdown

Any chance to have this merged?

@musjj

musjj commented Apr 25, 2025

Copy link
Copy Markdown

Are there any blockers here? Hope this will get merged soon.

@ollehu

ollehu commented Apr 25, 2025

Copy link
Copy Markdown
Author

Are there any blockers here? Hope this will get merged soon.

Not to my knowledge, awaiting approval from @gazorby

@musjj

musjj commented Apr 25, 2025

Copy link
Copy Markdown

I just tested this PR out and noticed a weird bug. This is my config, it binds Tab and Shift+Tab so that you can tab through the completions:

set -U fifc_custom_fzf_opts --bind tab:down --bind btab:up

First try to perform completions on flags:

cat -<Tab>

This works. But then, try to complete file paths:

cat <Tab>

The fzf option above no longer applies. Then try to do flag completion again. The fzf options also stops working there. Not sure why this is happening.

@musjj

musjj commented Apr 25, 2025

Copy link
Copy Markdown

Ok here's something easier to reproduce:

$ set -U fifc_custom_fzf_opts --bind tab:down

$ set --show fifc_custom_fzf_opts
$fifc_custom_fzf_opts: set in universal scope, exported, with 2 elements
$fifc_custom_fzf_opts[1]: |--bind|
$fifc_custom_fzf_opts[2]: |tab:down|

$ cat # press <Tab> here

$ set --show fifc_custom_fzf_opts
$fifc_custom_fzf_opts: set in universal scope, exported, with 1 elements
$fifc_custom_fzf_opts[1]: ||

Comment thread functions/_fifc_action.fish Outdated
@ollehu

ollehu commented Apr 25, 2025

Copy link
Copy Markdown
Author

Interesting, I was not able to reproduce your scenario in a clean WSL2 ubuntu installation

⋊> ~ set -U fifc_custom_fzf_opts --bind tab:down                                                                                                                                                                                    
⋊> ~ set --show fifc_custom_fzf_opts                                                                                                                                                                                                    
$fifc_custom_fzf_opts: set in universal scope, unexported, with 2 elements
$fifc_custom_fzf_opts[1]: |--bind|
$fifc_custom_fzf_opts[2]: |tab:down|
⋊> ~ cat                                                                                                                                                                                                                                some cat tabs ...                                                                                                                                                                                                                                      ⋊> ~ set --show fifc_custom_fzf_opts                                                                                                                                                                                                    
$fifc_custom_fzf_opts: set in universal scope, unexported, with 2 elements
$fifc_custom_fzf_opts[1]: |--bind|
$fifc_custom_fzf_opts[2]: |tab:down|
⋊> ~   

@musjj

musjj commented Apr 25, 2025

Copy link
Copy Markdown

That is strange. But in any case there is this branching logic that will eventually overwrite the user's fifc_custom_fzf_opts, though somehow it didn't get triggered in your case.

Perhaps it can be safely removed? It's working fine without it on my end, so far.

@ollehu

ollehu commented Apr 25, 2025

Copy link
Copy Markdown
Author

That is strange. But in any case there is this branching logic that will eventually overwrite the user's fifc_custom_fzf_opts, though somehow it didn't get triggered in your case.

Perhaps it can be safely removed? It's working fine without it on my end, so far.

Agreed. Good find, let's include it here then.

Co-authored-by: musjj <72612857+musjj@users.noreply.github.com>
@raoulmillais

Copy link
Copy Markdown

I'm now running @ollehu's fork and it's working great for me. No more weird things not working that I set in FZF_DEFAULT_OPTS after setting fifc_custom_opts instead 👍

@towry

towry commented Jun 4, 2025

Copy link
Copy Markdown

I use @ollehu fork too, works great, Thank you!

adam01110 added a commit to adam01110/FzFish that referenced this pull request Mar 13, 2026
xxxbrian added a commit to xxxbrian/fzf-tab.fish that referenced this pull request Mar 26, 2026
…es-v2

Rewrite upstream PR gazorby#49: configurable fzf options
@OddMagnet

Copy link
Copy Markdown

@gazorby is there anything keeping this PR from getting merged?

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

Successfully merging this pull request may close these issues.

7 participants