35

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.

Kai
  • 353

2 Answers2

51

You want to have

set hidden

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

0

You might find it useful to use split windows. For example, while editing foo.c, execute

:split foo.h

That will open foo.h in a window above foo.c. You can move between windows with ^W^W (Ctrl-W Ctrl-W) and maximize the current window with ^W_. You can find more information on this by executing

:help windows
garyjohn
  • 36,494