Tuesday, April 14, 2009

Set Hidden

If you've ever tried to type :only and had Vim refuse to hide existing buffers because they contain changes, you can use :set hidden to override this behavior. Just remember to keep the possibility of hidden modified buffers in mind when you're doing a :q!.

2 comments:

graywh said...

Most vim users will recommend using 'hidden'.

And the help for :q[uit]! explicitly states that it "Does not exit when there are changed hidden buffers."

joseph.gay said...

Hi, Travis. First, thanks for maintaining this blog! I've found many useful things here.

To add to the comment by graywh, finding :set hidden was a joy for me; I prefer to use a metaphor of buffers, swapping them using :b and smart completion. The ability to swap without saving is great.