The book "Unix in a Nutshell" discusses about accessing multiple files on pages 572-573. There seem to be very useful commands such as ":e", ":e #", ":e new_file", ":n files", ":args", ":prev" and ":n!". The commands confuse me:
":n Edit next file in the list of files."
":args Display list of files to be edited."
":prev Edit previous file in the list of files."
I cannot see no real list when I do ":args". There is only a small text at the corner. I would like to see all files that I accessed with ":e", ie a list of files in the buffer.
Where can I see the list when I do the command ":n files"? What are the commands ":prev" and ":n" supposed to do? I got the error message:
There is only one file to edit.
I’ve not read the book in mention, but I’ll try to explain how vim handles files.
Vim has buffers. You open every file with:
:e name_of_the_file.txt(loads file in a buffer, i.e. ‘opens file’)You can also:
:e *.txtUseful options while doing this are
:set laststatus=2(to always show the statusline):set wildmenu(to ease opening files)If you have standard vim with netrw plugin, you can:
:e .(for one of vim’s file managers, so to say)To manage buffers:
:lswill give you a list of currently opened buffers (files):bnext, and:bprevious(or:bnand:bp) enable you to cycle through buffers:bdcloses the buffer/file (buffer done)Other buffer types serve other purposes (yanking/pasting, temporary, vim’s internal, … etc.)