How to bring `[I` Vim's behavior back

In Vim, the default behavior of [I shows a list of lines matching the word under the cursor. I noticed we are missing this binding in Doom.

Fortunately, we can do better than Vim’s behavior by leveraging occur capabilities (and embark if you happen to use it). This is what I came up:

 (require 'embark)

 (defun bk/occur-at-point ()
   (interactive)
   (embark--act #'occur (car (embark--targets))))

 (map! :n "[I" #'bk/occur-at-point)
3 Likes

The :completion vertico module has +vertico/search-symbol-at-point that does the same thing. SPC s S.

5 Likes

If you need to broaden your search, there’s also +default/search-project-for-symbol-at-point (SPC *) and +default/search-notes-for-symbol-at-point (SPC n *).

2 Likes

Great! Now I can bind this function to [I. Thanks

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.