Okay so I have already gone through this.

So I know you can edit multiple files in VIM if you open them up in the following way:

vim file1 file2

and you can change files using :n and :N.

But what if I wanted open up a new file using :edit and still use :n and :N.

So lets say we open a file in VIM using :

vim file1

and I am working on this file and I have to open up another file now called file2

Now :n and :N no longer work.

Why is that ?

I want to be able to use :n and :N after opening the file. Any way I can do that ?

Seems easy but I can't figure it out.

  • Your question is quite confusing, why isn't just :e file2 working?
    – user392879
    Feb 11, 2020 at 14:51
  • @T_PAAMAYIM_NEKUDOTAYIM Try doing :n or :N after opening using :e file2 and let me know if they work.
    – ng.newbie
    Feb 11, 2020 at 14:54
  • :e # works to go back to the last file. why :n ??? please clarify, step by step, what you're trying to do.
    – user392879
    Feb 11, 2020 at 14:55
  • @T_PAAMAYIM_NEKUDOTAYIM Yes but I want to use :n. Why can't I use that ? Why can't I get the same consistent behaviour ? Why use a different command ? I don't want to use :e #
    – ng.newbie
    Feb 11, 2020 at 14:57
  • @T_PAAMAYIM_NEKUDOTAYIM Open up any file in VIM using vim file1 and then try to edit another file. You edit it via :e as you said, BUT if you use :e you can't use :n for navigation. This does not make sense. That is what I am trying to do.
    – ng.newbie
    Feb 11, 2020 at 14:59

1 Answer 1

:argadd file2

You can find more info collected together at How can I edit multiple files in VIM?

  • YES this is what I was looking for. This exact command is not in link btw. Thanks.
    – ng.newbie
    Feb 11, 2020 at 15:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .