Skip to content

I wanted to mimic Telescope vim like keyboard binding #4311

Open
@kirubeltadesse

Description

@kirubeltadesse

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions