I want to open a file invisibly such that I can operate using normal (programmatic) commands on it. How can it be achieved? Preferably, it should be hidden from the beginning.


  • 2
    You can load a file into a hidden buffer, but you cannot apply Normal or Ex commands to it (until it's finally shown in any window). So your question as it stands is invalid.
    – Matt
    Jun 29 '20 at 6:13
  • 2
    For any interaction with a buffer, it needs to be loaded and displayed in a window. So please mention what your actual goal is that you are trying to achieve. Jun 29 '20 at 9:15

If you are in a running vim instance and you need to add a new file you can use the argadd command (documented at :h :argadd).

For example if I start vim with vim foo and use :argadd bar. I can then use argdo [mycommand to apply a command on all the files in the argument list.

For more details on the argument list see :h arglist.

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.