David Blume's GitList
Repositories
dotfiles.git
Code
Commits
Branches
Tags
Search
Tree:
4b9d37a
Branches
Tags
main
pathogen
remove-vim-airline
vim-airline-disabled
vim-powerline
dotfiles.git
.vim
plugin
visual-star-search.vim
Added file-line and visual-star-search. How could I forget?
David Blume
commited
4b9d37a
at 2015-11-27 20:51:14
visual-star-search.vim
Blame
History
Raw
" From http://got-ravings.blogspot.com/2008/07/vim-pr0n-visual-search-mappings.html " makes * and # work on visual mode too. function! s:VSetSearch(cmdtype) let temp = @s norm! gv"sy let @/ = '\V' . substitute(escape(@s, a:cmdtype.'\'), '\n', '\\n', 'g') let @s = temp endfunction xnoremap * :<C-u>call <SID>VSetSearch('/')<CR>/<C-R>=@/<CR><CR> xnoremap # :<C-u>call <SID>VSetSearch('?')<CR>?<C-R>=@/<CR><CR> " recursively vimgrep for word under cursor or selection if you hit leader-star nmap <leader>* :execute 'noautocmd vimgrep /\V' . substitute(escape(expand("<cword>"), '\'), '\n', '\\n', 'g') . '/ **'<CR> vmap <leader>* :<C-u>call <SID>VSetSearch()<CR>:execute 'noautocmd vimgrep /' . @/ . '/ **'<CR>