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")
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:
As you can see, precisely 4 keystrokes will take me to the target.
Getting Started
- Install with lazy.nvim:
-- Note: currently `leap.nvim`-similar functionality is only available in `alpha`
{ "TheSafdarAwan/find-extender.nvim", branch = "alpha" },
- 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;",
},
},
})
- 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
- You’re already there like magic!
Conclusion
For navigation, I use the following plugins to get the job done. Jumping between:
- any location in the buffers: leap.nvim (For more, please see leap-nvim-next-gen-motion-Neovim-plugin)
- any char within the current line: find-extender.nvim
- tagged files: grapple.nvim (similar to harpoon)
jumplist
andchangelist
: portal.nvimmarks
: marks.nvim- file within the project directory:
:Telescope find_files()
- file content within the project directory:
:Telescope live_grep()
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
!