Re: xa and abandon unnamed buffers
- On 03/11/12 00:16, Chris Lott wrote:
> Is there a command that will write and exit all buffers *and* abandonAFAIK, there isn't. At least a cursory reading of ":help writing" and
> unnamed buffers? xa almost gets there, but it fails if there are
> unnamed buffers.
> Chris Lott <chris@...>
":help write-quit" doesn't reveal anything obvious.
You might try
which will prompt you to save or abandon any modified buffer, but I
suppose this is not what you want.
Or you could write a function to do it, maybe something like (untested)
for t in range(1, tabpagenr('$')
for b in tabpagebuflist(t)
\ && bufname(b) == ""
\ && getbufvar(b, '&mod')
exe 'bw!' b
command Xall call Xall()
If I haven't goofed, the first part wipes out all modified unnamed
buffers which are loaded (in a window or hidden), then the last
instruction (xall) writes all modified named buffers and quits Vim.
You won't get a warning if you've entered important stuff in an unnamed
buffer: it will be sent to never-never land, from where you won't be
able to get it back.
Please test this function thoroughly before deciding that it suits your
needs: it is a dangerous function if there are any bugs in it, and I
have NOT tested it myself.
TALL KNIGHT: Firstly. You must get us another shrubbery!
OTHER KNIGHTS: More shrubberies! More shrubberies for the ex-Knights of Ni!
ARTHUR: Not another shrubbery -
"Monty Python and the Holy Grail" PYTHON (MONTY)
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php