find-extender-demo.gif

TL;DR
Use find-extender.nvim to jump to anywhere within the current line with exactly 4 keystrokes.

Introduction

Using leap.nvim to jump to any location within the buffers is great but for jumping within the current line, I didn’t have a good enough solution until now. I tried clever-f.vim and flit.nvim but they’re not precise enough. Let’s say I have the following line and have to get to WORD_fingWORD:

print("find FInd fInd find_extender WORDfiWORD wordfIword WORD_fingWORD")

find-extender-problem.gif

The annoyance is that when my eyes are on the target string, I’m not aware of all the possible matches preceding WORD_fingWORD. I end up having to press f 6 times to get to WORD_fingWORD. Obviously it’s an axaggerated example but you get the point.

Here comes the rescue: find-extender.nvim!

If you’re familar with leap, the tl;dr is that find-extender is basically leap but for the current line. Below is how find-extender solves the above problem:

find-extender-demo.gif

As you can see, precisely 4 keystrokes will take me to the target.

Getting Started

  1. Install with lazy.nvim:
-- Note: currently `leap.nvim`-similar functionality is only available in `alpha`
{ "TheSafdarAwan/find-extender.nvim", branch = "alpha" },
  1. Setup like below:
find_extender.setup({
  movments = {
    min_matches = 2,
    highlight_match = { fg = "#c0caf5", bg = "#545c7e" },
    lh = {
      enable = false,
      cursor_hl = { fg = "#545c7e", bg = "#ff9e64" },
    },
    leap = {
      enable = true,
      symbols = "hjkl;",
    },
  },
})
  1. Open a new buffer and will the following example, press fhe and the overlay hint
print("find FInd fInd find_extender WORDfiWORD wordfIword WORD_helloWORD")
^
cursor
  1. You’re already there like magic!

Conclusion

For navigation, I use the following plugins to get the job done. Jumping between:

This leap-like feature would not have existed if the author were not kind enough to implement this feature for me. Go give find-extender.nvim a star and a try. If you like leap I’m sure you’ll like find-extender!