Skip to content

Commit

Permalink
Make \* recursively search for the word under the cursor or the visua…
Browse files Browse the repository at this point in the history
…l selection
  • Loading branch information
bronson committed Aug 14, 2010
1 parent b828a4e commit 7c71bf2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README
Expand Up @@ -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 <leader>* ("\*" 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.

Expand Down
3 changes: 3 additions & 0 deletions plugin/visual-star-search.vim
Expand Up @@ -11,3 +11,6 @@ endfunction
vmap * :<C-u>call <SID>VSetSearch()<CR>//<CR>
vmap # :<C-u>call <SID>VSetSearch()<CR>??<CR>
" recursively vimgrep if you hit leader-star
nmap <leader>* :execute "noautocmd grep -rw " . expand("<cword>") . " ."<CR>
vmap <leader>* :<C-u>call <SID>VSetSearch()<CR>:execute "noautocmd vimgrep /" . @/ . "/ **"<CR>

0 comments on commit 7c71bf2

Please sign in to comment.