I've been learning vi (as an autodidact) for some weeks. Actually I'm not yet sure about if I'm using vi or vim (does the command vi
open vim if vim is installed?).
Now I'm trying to edit multiple files (more than two, in general). To do so I found useful the commands :ar
, :argadd
, :argd
and so on.
Then I read that another way is to use buffers, i.e. commands like :ls
, :b
, :sb
and so on.
At the moment I don't understand the difference very well (I searched on the web and found something; maybe everything is clear but.. maybe I'm too new to vi to understand what I found).
What I noticed is that if I navigate from a file to another using :n
, then the square brackets I see when entering :ar
have been transferred from the preceding to the following file.
If I use :b n
(n is the index of a buffer) the %a
and #
labels in the list :ls
correctly change, whereas if I enter :ar
, the brackets are still those before the :b
command.
To summarize, I noticed that when I navigate arguments, both :ls
and :ar
's outputs change; when I navigate buffers, only :ls
's output changes, that of :ar
remaining fixed.
Can anyone help me to understand practical differences between arguments and buffers?
- Which are the pros and cons of navigate files in the former or latter method?
- Is it possible (and convenient/easy?) to use both the methods?
- And other question I'm not even capable of formulate now (i.e. other information are welcomed).