I have some text in a Vim variable ‘myvar’. I would like to use this

variable in a “:s” substitute command to replace a text ‘mytext’. How do I do this? You can use the ‘execute’ command to evaluate the variable:

    :execute '%s/mytext/' . myvar . '/'


Comments (1)

Pepsh Pepshinsky

Let’s see you to :help viminfo-file-name (option -i) :set viminfofile=NONE

Speak Your Mind