0

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.

ng.newbie
  • 1,175
  • Your question is quite confusing, why isn't just :e file2 working? –  Feb 11 '20 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 '20 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. –  Feb 11 '20 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 '20 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 '20 at 14:59
  • @T_PAAMAYIM_NEKUDOTAYIM Hope this clarifies the issue. – ng.newbie Feb 11 '20 at 15:00
  • It's still too deep for me, sorry. You can use :n and :N after :e #. –  Feb 11 '20 at 15:04
  • @T_PAAMAYIM_NEKUDOTAYIM Well it doesn't for me. I get Only One file to edit. – ng.newbie Feb 11 '20 at 15:06

1 Answers1

2
:argadd file2

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

Yurko
  • 718