On Fri, Sep 4, 2009 at 7:06 PM, <[email protected]> wrote:
>
> Hi,
>
> No, I dont want other command sequences. I know those.
> I simply want a ":q" which stops when it would exit
> vim.

If the command I suggested makes sense to you, but you have to use the
built-in commands, then one option would be to use :cabbr to map q to
say, Q, and have Q execute the command. Something like this:

command Q :silent! bufdo bw
cnoreabbr q Q

Note that this causes q to expand to Q where ever you use it by itself
in the command-line, which means, the following command will not work
as you expect:

:%s/q/p/g

What will actually execute is:

:%s/Q/p/g

and to avoid that you have to remember to press <C-V>/ instead of / after q.

If you like this approach, but put off by the drawbacks, then consider
using a very smal plugin called cmdalias.vim
(http://www.vim.org/script.php?script_id=745) that makes sure the
abbreviation expands only when you type at the beginning. I am the
author of the plugin and it originated from my need to change the
behavior of :qa (see
http://vim.wikia.com/wiki/Tabclose_instead_of_quit-all). This is what
you would do with the plugin installed:

command! -bang Q :silent! bufdo bw
call CmdAlias('q', 'Q')

BTW, don't top post, our convention is to use bottom post.
-- 
HTH,
Hari

>
>
> Hari Krishna Dara <[email protected]> [09-09-05 00:35]:
>>
>> On Fri, Sep 4, 2009 at 12:27 PM, Derek Wyatt<[email protected]> wrote:
>> > Or does he want :%bd!
>> >
>> > I'm not quite sure :)
>> > Entered using opposable digits on my BlackBerry.
>>
>> I think he wants a way to get rid off all buffers without having to
>> restart? May be ":silent! bufdo bw" (untested) will do the trick. It
>> will leave any unmodified buffers in tact and wipeout the rest. If it
>> works, create a user command or menu item for it.
>> --
>> HTH,
>> Hari
>>
>> >
>> > -----Original Message-----
>> > From: [email protected]
>> >
>> > Date: Fri, 4 Sep 2009 19:27:10
>> > To: [email protected]<[email protected]>
>> > Subject: Re: quitstop
>> >
>> >
>> > :qa
>> > Sent via BlackBerry from T-Mobile
>> >
>> > -----Original Message-----
>> > From: [email protected]
>> >
>> > Date: Fri, 4 Sep 2009 21:20:33
>> > To: <[email protected]>
>> > Subject: quitstop
>> >
>> >
>> >
>> >
>> > Hi,
>> >
>> > I am wondering whether it is possible to do the following:
>> > Under normal circumstances, one can do a
>> > :q
>> > (all buffers unmodified) or
>> > :wq
>> > or
>> > :q!
>> > until all buffers are quit.
>> > The quit on the last buffer will end vim.
>> > Often, when loaded a lot of files to change a certain aspect
>> > of the software I want to get rid of all that files to start
>> > a new experience :)
>> > But I dont want to restart vim.
>> > Is it possible to stop quit when trying to quit vim instead of
>> > simply closing a buffer?
>> > If I want to quit vim, I want to say
>> > :exit
>> > for example, which in turn should not kill any modified buffer.
>> >
>> > Thank you very much for any help in advance!
>> > Have a nice weekend!
>> > mcc
>> >
>> >
>> >
>> >
>> >
>> > --
>> > Please don't send me any Word- or Powerpoint-Attachments
>> > unless it's absolutely neccessary. - Send simply Text.
>> > See http://www.gnu.org/philosophy/no-word-attachments.html
>> > In a world without fences and walls nobody needs gates and windows.
>> >
>> >
>> >
>> >
>> >
>> >
>> > >
>> >
>>
>>
> --
> Please don't send me any Word- or Powerpoint-Attachments
> unless it's absolutely neccessary. - Send simply Text.
> See http://www.gnu.org/philosophy/no-word-attachments.html
> In a world without fences and walls nobody needs gates and windows.
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to