-
Notifications
You must be signed in to change notification settings - Fork 548
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
Bind zoxide to a keypress on zsh #357
Comments
I have a similar issue but I find that I have to press enter twice. Once to select and then once to navigate. |
@omares AFAIK, that's because ZLE runs widgets in a subshell, so you can't function _run-cdi {
result="$(zoxide query -i)"
BUFFER="cd ${(q-)result}"
zle redisplay
} @tomtomdurrant the same limitation comes into play here, which is why the double-enter is necessary. |
I'm using What the following script does when you press
Put the following to zoxide_to_ranger () {
eval 'ranger "$(zoxide query -i)" --choosedir=$HOME/.rangerdir < $TTY'
LASTDIR=$(< ~/.rangerdir)
cd "$LASTDIR" || exit
local precmd
for precmd in $precmd_functions; do
$precmd
done
zle reset-prompt
}
zle -N zoxide_to_ranger
bindkey '^f' zoxide_to_ranger Reference:
Cheers! |
Hey, after browsing the fzf source code, I stumbled across their cd-widget code and adapted it to solve my initial problem and it works! This snippet shows the interactive zoxide selection when pressing CMD+G and changes directly into the selected directory after pressing enter, no need to re-confirm the cd.
|
Awesome !! Thanks |
Hey, I would like to bind the interactive version of zoxide to the key combination of ctrl+g in my z-shell.
I managed to make the keybind work, the interactive window pops up but the highlighted path is not navigated to when pressing enter. Has anybody experienced this? Not sure if it is my setup or an issue with zoxide.
The bindkey setup I have so far. The predefined aliases is changed to cd.
Thanks for your help!
The text was updated successfully, but these errors were encountered: