title: VIM Buffer/Window Hiding
body: <p>I'm writing a vim plugin which needs to do some special window management. What I want is as follows:</p>
  
  <p>On startup, the current window will be split in two and the newly created window will be used for user input and plugin output. Let's call this the I/O window.</p>
  
  <p>Occasionally the I/O window will need to be "replaced". That is, a new set of contents will replace the portion of the screen containing the I/O window. Call this the temporary window. However, the I/O window will remain saved somewhere. When the user leaves this temporary window (with :q or :q!) the contents of the I/O window will reappear in the original spot.</p>
  
  <p>How would I go about doing such a thing? I've been trying things and reading about buffers and windows for a some time now in the help pages but I still can't seem to figure it out.</p>
  
  <p>What I think should work is:</p>
  
  <ol>
  <li>:new to split the screen on startup.</li>
  <li>:set bufhidden=hide on the I/O window.</li>
  <li>:enew to display the temporary window.</li>
  </ol>
  
  <p>This works right up until the user does a :q from the temporary window. Instead of the screen remaining split, the top portion completely disappears. Attempting to quit from this point leads to errors about unsaved data.</p>
  
  <p>Thanks in advance.</p>