fff icon indicating copy to clipboard operation
fff copied to clipboard

[FEATURE REQUEST] Shortcut to quick-open top files in the list in nvim plugin

Open versenilvis opened this issue 6 months ago • 6 comments

Image

  • As you can see here, I have some files that I open frequently but toggle fff with "ff" shortcut then typing the file name or using arrow key up/down is a bit slow to me, I want to add some shortcuts to this so I can open it quickly
  • This is a reallyyy small feature that I hope you can add it to fff because I dont want to add an entire plugin like snipe or harpoon just for this
  • Maybe we can use it with Alt-key or Ctrl-key (already have with j/k), so we can open it quickly

versenilvis avatar May 04 '26 10:05 versenilvis

Image

  • If you add this small feature I can replace harpoon with it completely, because when I open the folder, I often open it with neovim, then toggle fff and search for the file, I don't use file explorer

versenilvis avatar May 04 '26 10:05 versenilvis

Yeah it could be cool, to have it there and persisted. I actually thought to make a pinnacle labels for them

Do you want them to be pinned with certain text or just number?

dmtrKovalenko avatar May 04 '26 15:05 dmtrKovalenko

I still dont guess it you mean shortcut with text or number? there a small problem with this but order will be change depend on which file is open frequently , the shortcut will be change every time we open it too, do you have any solution for this for better experience? but I think a character is the best, because number is way too far on the keyboard to press it

versenilvis avatar May 04 '26 15:05 versenilvis

Just to align an idea:

  1. you assign some character bookmark to the file in the file picker
  2. you have a global keybind to jump to that file
  3. you can open a picker and narrow down to a single char
  4. we give bonuses to files that are labelled
  5. Labels persist between reruns

dmtrKovalenko avatar May 04 '26 16:05 dmtrKovalenko

yeah that's great, I think that's enough for me

versenilvis avatar May 04 '26 16:05 versenilvis

[triage-bot] DESIGN NEEDED:

Root cause

User wants quick keyboard access to frequently accessed files without searching. Current frecency-only ranking makes top files vary based on recent accesses — no stable positions for keyboard shortcuts. User currently uses Harpoon for this, wants integrated solution.

Why small fix not possible

Feature needs 5 architectural layers:

  1. Persistence layer: new LMDB database for bookmark storage (crates/fff-core/src/dbs/bookmarks.rs + dbs/mod.rs, ~200 LOC)
  2. FFI bindings: expose bookmark CRUD to Lua (crates/fff-nvim/src/lib.rs + lua_types.rs, ~150 LOC)
  3. Config expansion: new keymaps for bookmark set/unset/jump (lua/fff/conf.lua, ~50 LOC)
  4. UI rendering: display bookmark labels inline with file names (lua/fff/file_renderer.lua + picker_ui.lua, ~100 LOC)
  5. Score integration: boost bookmarked files in scoring (crates/fff-core/src/score.rs, ~50 LOC)
  6. Picker filtering: narrow to single bookmark via keymap (lua/fff/picker_ui.lua, ~100 LOC)

Estimated: 650+ LOC minimum, touches 12+ files across Rust/Lua boundary.

Proposed approach (from maintainer conversation #447)

Aligned spec from @dmtrKovalenko + @versenilvis:

  • User assigns character label to file while in picker (e.g., a, b, ;, not numbers since keyboard distance)
  • Global keybind jumps to bookmarked file directly (outside picker)
  • Picker narrow-down: press character in picker → filters to that bookmark instantly
  • Frecency boost: bookmarked files rank higher in results
  • Persistence: labels survive Neovim restarts (LMDB like frecency DB)

@dmtrKovalenko mentioned visual: "pinnacle labels" — implies inline badge/tag rendering beside filename.

Files/modules needing change

Rust:

  • crates/fff-core/src/dbs/bookmarks.rs (new) — bookmark storage with LMDB
  • crates/fff-core/src/dbs/mod.rs — register new DB
  • crates/fff-core/src/score.rs — add bookmark bonus to scoring
  • crates/fff-nvim/src/lib.rs — FFI functions: bookmark_set, bookmark_get, bookmark_delete, bookmark_list
  • crates/fff-nvim/src/lua_types.rs — return types for bookmark metadata

Lua:

  • lua/fff/conf.lua — new keymaps: bookmark_set, bookmark_unset, bookmark_jump_* (26 possible chars?)
  • lua/fff/picker_ui.lua — keymap handlers for bookmark ops + narrow filter by char
  • lua/fff/file_renderer.lua — render bookmark label inline (after filename or in margin)
  • lua/fff/main.lua — public API for bookmark_jump(char) callable from user config
  • lua/fff/core.lua — init new bookmark DB on startup

Docs:

  • README.md — document new keymaps + use case

Open questions

  1. Keybind namespace: Alt+char, Ctrl+char, or unmodified char in picker? Numbers Alt+1-9 easier to discover but maintainer discussion preferred characters.
  2. Bookmark scope: per-project (cwd-relative paths) or global (absolute paths)? Frecency DB uses absolute paths hashed.
  3. Label UI placement: inline suffix filename.rs [a], margin column, or sign column like git status?
  4. Conflict resolution: if user tries to bookmark file_b.rs with label a but file_a.rs already has a → overwrite or error?
  5. Max bookmarks: cap at 26 (a-z)? Include numbers/symbols?
  6. Global jump UX: separate command :FFFBookmarkJump a or reuse picker with instant filter?

Assigning @dmtrKovalenko for scoping decision — feature feasible but needs architecture plan before implementation.

gustav-fff avatar May 20 '26 17:05 gustav-fff