diff --git a/README b/README index 31ce923..a3e27ce 100644 --- a/README +++ b/README @@ -3,6 +3,9 @@ and # to search for it elsewhere in the file. For example, hit V, select a strange sequence of characters like "$! $!", and hit star. You'll find all other runs of "$! $!" in the file. +If you hit * ("\*" unless you changed the mapleader), vim will +recursively vimgrep for the word under the cursor or the visual selection. + Vim's default behavior is to just extend the visual selection to the next word that matches the word under the cursor. Doesn't seem very useful. diff --git a/plugin/visual-star-search.vim b/plugin/visual-star-search.vim index d8efcca..34897da 100644 --- a/plugin/visual-star-search.vim +++ b/plugin/visual-star-search.vim @@ -11,3 +11,6 @@ endfunction vmap * :call VSetSearch()// vmap # :call VSetSearch()?? +" recursively vimgrep if you hit leader-star +nmap * :execute "noautocmd grep -rw " . expand("") . " ." +vmap * :call VSetSearch():execute "noautocmd vimgrep /" . @/ . "/ **"