I use fzf's :History: a lot to execute previous Vim commands, it's really handy.

I'd like to give Vim commands that I used more recently a better ranking so they appear as the best match when using :History:.

For example, I execute :History, type "lg", and see a couple of results:

1000  norm iLooking good
173  /LBS//gc
436  /lstGrepTestFile/lstGrepFileColor/gc

The bottom result (command number 436) is the best match according to fzf: When I hit enter, the command is executed.

But the command I really want to be the best match, instead of 436, is command number 1000: norm iLooking good.

This is also the command I execute the most often and also the most recently via fzf in Vim.

Currently, I have to move the selection in fzf's results two lines up to select the desired command.

Is there a way to prioritize commands in the output of fzf in Vim based on which one is the most recently used?

  • Instead of using History, create some mappings or commands for frequent tasks? (Just a thought) – D. Ben Knoble Jan 29 at 11:53
  • I use mappings too, but I'm running out of mnemonic keystrokes. – Matthias Braun Jan 29 at 13:17
  • 1
    That's fair; using <leader>/<localleader> and "prefixes" helped me organize a bit (and my plugin popsikey helps me not forget the mappings). Happy to Vi and Vim Chat more about the mappings/commands, but I don't have a FZF answer – D. Ben Knoble Jan 29 at 13:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.