Skip to content

I wanted to mimic Telescope vim like keyboard binding #4311

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

Open
5 of 10 tasks
kirubeltadesse opened this issue Mar 13, 2025 · 1 comment
Open
5 of 10 tasks

I wanted to mimic Telescope vim like keyboard binding #4311

kirubeltadesse opened this issue Mar 13, 2025 · 1 comment

Comments

@kirubeltadesse
Copy link

kirubeltadesse commented Mar 13, 2025

Checklist

  • I have read through the manual page (man fzf)
  • I have searched through the existing issues
  • For bug reports, I have checked if the bug is reproducible in the latest version of fzf

Output of fzf --version

0.63.3 (brew)

OS

  • Linux
  • macOS
  • Windows
  • Etc.

Shell

  • bash
  • zsh
  • fish

Problem / Steps to reproduce

I wanted to mimic Vim-like keybinding that will use the following setup
escNormal Mode:
Disables search (you can navigate freely).
Changes prompt to NORMAL> .
Binds j (down) and k (up) for navigation.
Allows i to switch back to insert mode.
iInsert Mode:
Enables searching.
Unbinds j/k from navigation so you can type.
j and k (in Normal Mode):
Navigate up/down.

Then if you press esc in the Normal Mode it should turn off.

I tried using

# Use fd for finding files
export FZF_DEFAULT_COMMAND='fd --type f --strip-cwd-prefix --hidden --follow --exclude .git'

# Customize fzf options
export FZF_DEFAULT_OPTS="
  --preview 'bat --style=numbers --color=always {}' \
  --bind 'alt-j:preview-down' \
  --bind 'alt-k:preview-up' \
  --bind 'esc:abort' \
  --bind 'j:down' \
  --bind 'k:up' \
  --bind 'ctrl-u:preview-page-up' \
  --bind 'ctrl-d:preview-page-down' \
  --bind 'ctrl-i:toggle-preview' \
  --reverse"

# Enable extended mode
export FZF_DEFAULT_OPS="--extended"

# Use the same command for Ctrl+T (file search)
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"

But this blocked j and k from the insert mode. Please let me know if you have any suggestions!

@junegunn
Copy link
Owner

You might want to check out the mode switching example in https://junegunn.github.io/fzf/releases/0.59.0/#hiding-input-section

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