3

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?

2
  • Can you be more specific? How do you open many different files? Are you using split windows or just separate buffers? When you say "q", do you mean typing :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...
    – filbranden
    Aug 31, 2019 at 18:18
  • Thank you for your comment. I open two files with 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 displays 2 files to edit. Sep 1, 2019 at 6:51

1 Answer 1

2

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.

1
  • Thank you for your answer, this answer does solve my problem during manipulating multiple files. Sep 5, 2019 at 14:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.