10 years ago
Place the cursor over the word you want to change and press the key combo to populate the command-line with the right stub:
-- :'{,'}s/word/
to substitute word
in the current "paragraph",
-- :%s/word/
to substitute word
in the whole buffer.
You only have to type the replacement and press <CR>
.
nnoremap <key> :'{,'}s/\<<C-r>=expand('<cword>')<CR>\>/ nnoremap <KEY> :%s/\<<C-r>=expand('<cword>')<CR>\>/
Romain Lafourcade 10 years ago
set gdefault is my friend.
Chris Penner 10 years ago ✎
If you often forget to add the g flag after (so it ACTUALLY replaces every instance) then try this:
```nnoremap :%s/\<=expand('')>//g
nnoremap :%s/\<=expand('')>//g ```