I make use of the builtins in spf13. Today when I open multiple files with vim and want to close one of them with q it closes all these files, how can I close only a few of them without closing them all?
1 Answer
This is not specific to spf13, but it applies to all Vim. If you've loaded multiple files in the given manner, vim will issue such warning message because q
will try to quit Vim, but there are other files that haven't been edited yet.
Instead, after you're done editing with the current file, you can go to next file using :next
. If you want to go back to previous file, you can do :Next
, with capital N.
You can also use buffer commands, which is what I recommend. You can use :ls
to list all buffers, :bnext
, :bprev
, to go go to next/previous buffers, and :buffer 5
to go to 5th buffer, etc.
To close and unload the current buffer, you can also do :bdelete
(or :bd
for short), and keep other buffers.
-
Thank you for your answer, this answer does solve my problem during manipulating multiple files. Sep 5, 2019 at 14:32
:q
and pressing "Enter"? If you can get a specific example of what you do, what you see happens and what you'd like to see instead, that would make it easier to answer your question...vim -u NONE test14.sh test15.sh
and I want to exit the editing of one file but still editing the other one, so I type:q
. The result is I quit the vim and shell displays2 files to edit
.