sponsor Vim development Vim logo Vim Book Ad

replace_operator.vim : Replace text from register with a motion

 script karma  Rating 15/6, Downloaded by 629  Comments, bugs, improvements  Vim wiki

created by
Tom Ryder
script type
This plugin provides normal and visual mode mapping targets to replace the text bounded by a motion with the contents of a register, by default the unnamed register.

This allows you, for example, to select a set of lines and replace any other set of lines with it in one repeatable operation. The text you replace stacks up in the numbered registers as normal, if you do end up needing it back.

install details
Drop plugin/replace_operator.vim in your ~/.vim/plugin directory, and autoload/replace_operator.vim in ~/.vim/autoload. Add doc/replace_operator.txt in ~/.vim/doc if you want the help file. Otherwise, use your favourite Vim plugin package manager.

The normal and visual mode mapping targets are both named
<Plug>(RepeatOperator). There are no default key mappings; you should define
some yourself in your vimrc. For example:

        nmap <Leader>r <Plug>(ReplaceOperator)
        xmap <Leader>r <Plug>(ReplaceOperator)

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
vim-replace-operator-1.0.2.tar.gz 1.0.2 2018-12-29 7.0 Tom Ryder Switch to much simpler expression-mapping and visual replacement approach
ip used for rating:

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
Vim at Github