-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Binding to move search root to parent? #4186
Comments
export FZF_ALT_C_OPTS="
--bind "ctrl-u:reload(find .. -type d)"
"
Never mind, I just realize that although that works to show other directories, it won't cd into them because it expects the same path from where it started. So yeah, it needs to be updated from the script that sets NOTE: Updated snipped. It should work as long as find return a relative path e.g. |
Since version Reloading with a walker like this works, but there is an issue for adding a potential flag: #4062. source <(fzf --zsh)
export FZF_ALT_C_OPTS="--bind 'ctrl-u:reload:</dev/tty FZF_DEFAULT_COMMAND= fzf --filter= --walker dir --walker-root ..'"
The maintainer makes the call, but in the past, the saying went that the provided shell integration Footnotes |
Here's my take. read -d '' FZF_ALT_C_OPTS << 'EOF'
--bind 'ctrl-h:transform:
dir="${FZF_PROMPT%%> }"
dir="${dir:-.}"
dir="$(realpath "$dir/..")"
printf "top+change-prompt(%s> )" "$dir"
printf "+reload:</dev/tty fzf --filter %q --walker dir --walker-root %s" "" "$dir"
'
--bind 'ctrl-l:transform:
dir="${FZF_PROMPT%%> }"
if [[ -n $dir ]]; then
dir="$(realpath {})"
else
dir={}
fi
printf "top+change-prompt(%s> )" "$dir"
printf "+reload:</dev/tty fzf --filter %q --walker dir --walker-root %s" "" "$dir"
'
EOF
Since 80da077, this can be simplified as read -d '' FZF_ALT_C_OPTS << 'EOF'
--bind 'ctrl-h,ctrl-l:transform:
dir="${FZF_PROMPT%%> }"
if [[ $FZF_KEY = ctrl-h ]]; then
dir="${dir:-.}"
dir="$(realpath "$dir/..")"
elif [[ -n $dir ]]; then
dir="$(realpath {})"
else
dir={}
fi
printf "top+change-prompt(%s> )" "$dir"
printf "+reload:</dev/tty fzf --filter %q --walker dir --walker-root %s" "" "$dir"
'
EOF While I like this, it's not easy to make it the default because we can't guarantee that it is compatible with the user's |
Checklist
man fzf
)Output of
fzf --version
0.57.0 (0476a65)
OS
Shell
Problem / Steps to reproduce
Feature request: a binding to change the search root to the parent folder.
Use case: sometimes I enter fzf with alt-c or ctrl-t, and I then realize that the folder that I'm looking for is an ancestor or cousin. I then have to ctrl-c,
cd ../..
, and try again. It would be cool if there was a binding to restart fzf with..
as the new search root to make this quicker. My suggestion is alt-left because that's the binding for back in most browsers.I think this can be hacked together using the existing very powerful binding features, but I wanted to suggest making this a default binding since it would be really useful in a common use case.
The text was updated successfully, but these errors were encountered: