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

Feature: Enable to use builtin walker in reload function or create new reload-walker function #4062

Open
petersladek opened this issue Oct 25, 2024 · 3 comments

Comments

@petersladek
Copy link

I am using ctrt+t shell integration and in FZF_CTRL_T_OPTS I have set up reload function to switch between Directories and Files. Right now, I have to use custom command (e.g. fd) to list directories/files in reload functions, but I would prefer to use built-in walker as it is much faster! It would be great if I could use built-in walker with arguments --walker or --walker-skip in reload() function, or bind new function e.g. reload-walker().

@junegunn
Copy link
Owner

I've given some thought about that, but it's not clear how we can support three walker options in a single "reload-walker" action. A workaround currently available is to start fzf with --filter '' so that it immediately prints the candidates from its walker.

fzf --bind 'ctrl-d:reload:</dev/tty fzf --filter "" --walker dir' \
    --bind 'ctrl-f:reload:</dev/tty fzf --filter "" --walker file'

(</dev/tty is needed to trigger walker)

@petersladek
Copy link
Author

Will try the workaround thanks!

@junegunn
Copy link
Owner

Admittedly, --filter '' < /dev/tty isn't pretty. Maybe we should provide a shortcut option for this.

# Start the built-in walker and print the list
fzf --walk

Or for better flexibility, we could just add --walker-force to replace < /dev/tty.

# Start built-in walker and print the list
fzf --walker-force --filter ''

# You can use --walker-force to use built-in walker even when
# * $FZF_DEFAULT_COMMAND is set
# * Standard input is not a tty device
export FZF_DEFAULT_COMMAND=ls
whoami | fzf --walker-force

These are just some initial ideas. I'm not going to rush into a decision.

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

No branches or pull requests

2 participants