I tried vim-multiple-cursors but it was just doing weird things and not replacing the right words, so after digging around for a while I came up with this:
Simply add it to ~/.vimrc.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
function! PoorMultiCursor() let word = expand('<cword>') if strlen(word) > 0 call inputsave() let repl = input('replace "'.word.'" with: ') call inputrestore() if strlen(repl) > 0 execute '%s/\<'.word.'\>/'.repl.'/g' endif endif endfunction " sublime text's ctrl+d / ctrl+alt+d (find all) inoremap <C-d> <C-o>:call PoorMultiCursor()<cr> nnoremap <C-d> :call PoorMultiCursor()<cr> |
Basically it's the same as using alt+f3 in Sublime Text.