fzf.kak
fzf.kak copied to clipboard
Simplify approach to providing an alternative fzf file find invocation
- Revert some changes. Create a new str option
fzf_file_alternative_command. - Also provide a shortcut 'o' by default
Here is the sample kakrc configuration now using the simplified approach.
hook global ModuleLoaded fzf-file %{
set global fzf_file_command "rg -L --files"
set global fzf_file_alternative_command "rg -L --files --no-ignore"
}
P.S. As this commit reverts some changes of the previous commit cb07538a88dd51b1c03800d6c451d2d71e7b80a5 , it is also useful to see the following.
https://github.com/andreyorst/fzf.kak/compare/95b12b1fe93c6db0441c61062823231a28eed037..a1012402af3db8411144877437697fb678424a24
The above link compares this PR with the commit
commit 95b12b1fe93c6db0441c61062823231a28eed037
Author: Andrey Listopadov <[email protected]>
Date: Wed Mar 23 19:55:27 2022 +0300
fzf-grep file preview
The above diff is probably simpler to review.
hm, so instead of passing additional arguments to fzf-file this PR makes a separate command for that purpose? I think your previous method is more simple in a sense that it's just additional arguments, taht allow you to define your own versions of fzf-file and binding them to convenient keys, like "only search hidden files" or "only search current buffer's extension files". This one seems less flexible in this regard.
Here is my reasoning why this is a better approach:
- This method is simpler for the user. They don't need to define an explicit shortcut. Here the 'o' key is explicitly linked to the alternate command
- You may want to use "rg" as the tool normally but "ag" as the alternate tool. This approach will allow that
- Sometimes you are not able to undo the effect of a previous switch. Supposing your normal command has some switch
--abc. But now you need--xyz. Also it may be that--abcand--xyzmay be mutually exclusive -- you won't be able to specify--xyzif--abcis already there. However this simpler approach will allow that.
In general this approach allows an arbitrary alternative command and it's simpler for the end user...
Maybe we could have both ways, as they aren't mutually exclusive?