skip to Main Content

I’m temporarily working on a different machine.
Every time I try and quit vim

:q!

after vim was started with more than one file on the command-line, vim is simply going to the next file.
I already copied my .vimrc into the home directory.

On both machines it is vim 7.4.

In case this was unclear:

I’m using vi/vim since 30 years and I always used the command I mentioned to quit. It never meant "go to the next file". So any answer that I suddenly need to use something different, needs to tell me, why it worked until now and why it still does on another machine.

2

Answers


  1. No. Vim is not "ignoring :q!.

    From :h :q in Vim 7.4:

    Quit without writing, also when currently visible
    buffers have changes.  Does not exit when this is the
    last window and there is a changed hidden buffer.
    In this case, the first changed hidden buffer becomes
    the current buffer.
    Use ":qall!" to exit always.
    
    Login or Signup to reply.
  2. Most likely you have hidden buffers turned on in this case of vim. That allows you to have multiple, unsaved files open (open files in vim are called buffers) and you can flip between them without having to save or abandon the changes. To see more, read up about set hidden.

    The important thing to know here, is that each file is asking you 1 by 1 if it’s safe to discard the changes and quit or if you want to save the changes and quit. Normally you would save with :w or quit with :q. Since you want to do this to ALL files and not just one, simply append a to the end of the command.

    :wa saves all open files.
    :qa quits all open files.
    :wqa saves and quits all open files.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search