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

[Q] Is there a way to change navigation to arrow keys (as opposed to Ctrl + J/K) #490

Open
TGiles opened this issue Nov 21, 2024 · 2 comments
Labels
question Further information is requested

Comments

@TGiles
Copy link

TGiles commented Nov 21, 2024

When using fzf by itself in the terminal, arrow keys can be used to navigate the interface in addition to the Ctrl + J and K keybinds. I've been looking for a way to restore this behavior in fzf-tab, but I can't figure out the exact configuration to set or where I need to set a keybind for this. I'm relatively new to zsh and oh-my-zsh so might just be something very simple.

I installed fzf-tab via the oh-my-zsh installation steps

Here is a minimum reproducible .zshrc file:

export ZSH="$HOME/.oh-my-zsh"
plugins=(fzf fzf-tab)
source $ZSH/oh-my-zsh.sh

Here's my configuration for fzf-tab:

# disable sort when completing `git checkout`
zstyle ':completion:*:git-checkout:*' sort false
# set descriptions format to enable group support
# NOTE: don't use escape sequences (like '%F{red}%d%f') here, fzf-tab will ignore them
zstyle ':completion:*:descriptions' format '[%d]'
# set list-colors to enable filename colorizing
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
# force zsh not to show completion menu, which allows fzf-tab to capture the unambiguous prefix
zstyle ':completion:*' menu no
# preview directory's content with eza when completing cd
zstyle ':fzf-tab:complete:cd:*' fzf-preview 'eza -1 --color=always $realpath'
# custom fzf flags
# NOTE: fzf-tab does not follow FZF_DEFAULT_OPTS by default
# zstyle ':fzf-tab:*' fzf-flags --color=fg:1,fg+:2 --bind=tab:accept
zstyle ':fzf-tab:*' fzf-flags --color=fg:1,fg+:2
# To make fzf-tab follow FZF_DEFAULT_OPTS.
# NOTE: This may lead to unexpected behavior since some flags break this plugin. See Aloxaf/fzf-tab#455.
zstyle ':fzf-tab:*' use-fzf-default-opts yes
# switch group using `<` and `>`
zstyle ':fzf-tab:*' switch-group '<' '>'
zstyle ':fzf-tab:*' fzf-bindings 'down:down' 'up:up'

I'm running zsh 5.9.

I tried to bind down:down and pass that to fzf-tab, but no luck. I tried to provide the keybind code ^[OA to the fzf-flags --bind but fzf will crash due to an unrecognizable keycode. I'm not sure what else to try at this point 😂

Please let me know if there's any other information or steps that I can provide. Thanks!

@TGiles TGiles added the question Further information is requested label Nov 21, 2024
@Aloxaf
Copy link
Owner

Aloxaf commented Jan 8, 2025

Arrow keys should work out out of box. What's your fzf version? Can arrow keys work in fzf?

@TGiles
Copy link
Author

TGiles commented Jan 8, 2025

Arrow keys should work out out of box.
What's your fzf version?

~ » fzf --version
0.56.3 (add1aec)

I just updated to 0.57.0 (0476a65) and the issue is still present

Can arrow keys work in fzf?

When running fzf from a zsh terminal, the arrow keys work as expected.

I think I'm getting a different error now, still prevents me from using fzf-tab. I'm thinking this new error is due to some configuration of my system:
unsupported key: C:/Program Files/Git flashes very quickly and then disappears whenever I hit Tab when trying to complete any sort of arbitrary string.

Probably something to do with the space in the path if I had to guess. Anything else I should try or information I can get you? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants