Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
up vote 11 down vote accepted

You want to have

set hidden

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

share|improve this answer
    
your first link is just a redirect from vim.wikia.com to the vimdoc page in the second link. vim.wikia.com/wiki/… may also be of interest. – jamessan Jul 14 '10 at 17:47
    
Thanks, that really helped. – Kai Jul 14 '10 at 18:32
    
@jamessan - yes I know, but the page it redirects to has single quotes in the URL and I couldn't get it to appear properly using markdown, so I used the redirect address instead. – Hamish Downer Jul 15 '10 at 13:54

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
share|improve this answer
    
I used to do that a while ago but my pinky became sore quickly, and I didn't really want to remap Cntrl to Shift but if I move to a machine without my handy .vimrc file, I will absolutely follow your hint. Thanks. – Kai Jul 14 '10 at 18:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .