Skip to content

Instantly share code, notes, and snippets.

@sosmo
sosmo / magictools.vim
Last active August 29, 2015 14:13
Tools for searching and replacing text in Vim
" Tools for searching and replacing text in Vim
" Search for the current visual selection
fun! StarSearch(direction)
let old_reg = getreg('"')
let old_regtype = getregtype('"')
exe 'normal! gvy\<esc>gV'
let @/ = EscapeMagic(@")
call histadd("/", @/)