-1

As title. Sorry for being possibly a very simple question but could anyone rephrase the answer so it can be easily understood by a beginner?

0

2 Answers 2

4

You are using two different commands, :e and :n, that are thoroughly documented.

:help :edit_f says:

:e[dit] [++opt] [+cmd] {file}
                        Edit {file}.
                        This fails when changes have been made to the current
                        buffer, unless 'hidden' is set or 'autowriteall' is
                        set and the file can be written.
                        Also see |++opt| and |+cmd|.

while :help :next_f says:

Same as |:args_f|.

and :help :args_f says:

:ar[gs] [++opt] [+cmd] {arglist}            *:args_f*
                        Define {arglist} as the new argument list and edit
                        the first one.  This fails when changes have been made
                        and Vim does not want to |abandon| the current buffer.
                        Also see |++opt| and |+cmd|.

So…

  • :e filename edits filename,
  • :n filename sets the argument list to filename and edit filename.

If, in fine, both commands give you a filename buffer to edit, they have different side-effects. If you are confident those side-effects are irrelevant to you, then you can use them interchangeably. If not, use the command that does exactly what you want.

FWIW, the basics are introduced in chapter 7 of the user manual: :help usr_07.

1
  • Thank you for the detailed answer! I didn't know that : can still be appended after :h, now I learned it.
    – job_start
    Mar 13 at 20:13
1

In this case (just a single filename folliwing :e and :n) they're basically identical.

You can see the definitive builtin help :h edit_f and :h next_f (just few lines below :h :e and :h :n). Use Ctrl-] to jump between helps, and Ctrl-O to jump back.

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.