Switch buffers in vim without saving to a currently modified file

Ok, I'm a vim user with the Minibufexl plugin which shows buffer tabs, I've mapped Shift+J and Shift+K to switch between tabs. One thing that frequently frustrates me is while editing a file, and switching to another buffer, I HAVE to write to the current file and then switch.

Eg, I have foo.cpp and foo.h open in two buffers, and I'm editing foo.cpp and haven't saved it, I need to check foo.h to see a function definition. I then use either the alternate files quickly plugin (a.vim) or my shortcut above. This is where I have to save before switching, it gets annoying quickly.

I don't know which search query to use in the Googles so I'm asking here, my apologies if it's misleading.


Solution 1:

You want to have

set hidden

in your .vimrc file. Read a (little) more about the hidden option and hidden buffers