Pasting inside delimiters without using visual selection

前端 未结 5 926
轻奢々
轻奢々 2020-12-21 18:09

In Vim, let\'s say I want to replace the contents of one String with the content of another.

Original input

var1 = \"January\"
var2          


        
5条回答
  •  抹茶落季
    2020-12-21 18:38

    I need this so often, I wrote a plugin to simplify and allow maximum speed: ReplaceWithRegister.

    This plugin offers a two-in-one gr command that replaces text covered by a {motion} / text object, entire line(s) or the current selection with the contents of a register; the old text is deleted into the black-hole register, i.e. it's gone. It transparently handles many corner cases and allows for a quick repeat via the standard . command. Should you not like it, its page has links to alternatives.

提交回复
热议问题