I have a file (FileA) opened in Vim to edit. I have one another file (FileCommands) that has some set of vim search and replace commands.

I am looking to load that FileCommands file, to do that search and replace it in the FileA that I have opened in Vim. I found some other ways to do which are non-interactive, but I am looking for a way to do it interactively only when I need it.


While editing FileA:

$ vim FileA

Use the :source command to run the commands in FileCommands as Vimscript commands:

:source FileCommands

See :help :source for more details.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.