Thanks for all of your help.

For this problem, I think kill is not a choice. Because I want all of the
vim instances save or simply quit without save. And I realized things would
be done easily if there is a vim server. Thanks Google again. I found this:
http://ajayfromiiit.wordpress.com/2009/10/21/server-and-client-mode-in-vim/
and
http://vimdoc.sourceforge.net/htmldoc/remote.html

Still, this is not exactly what I am looking for, but it seems a handy
script can be created to do a similar work.

What I need is: One vim server manages one or more vim instances which may
be lunched within different windows/terminals.

Thanks.
BR
Wang, Mengjia





2011/3/17 ZyX <zyx....@gmail.com>

> Reply to message «How to close all files opened by different vim
> instances.»,
> sent 11:08:22 17 March 2011, Thursday
> by Forest Wang:
>
> <...>
> > vim c&
> > ...
> >
> > Than I realized I need to close all of them. So I had to close them one
> by
> > one:
> >
> > %1 and :qa!
> > %2 and :qa!
> > ...
> >
> > Is there a better way to close all files by issuing one command or one
> > script?
> If you are on zsh, you could use the following script:
>
>    emulate -L zsh
>    for job in ${(k)jobtexts[(R)vim*|view*]} ; do
>        kill -TERM "${${(s.=.)${(@s.:.)jobstates[$job]}[3]}[1]}"
>        # For unknown reason kill -TERM handling  is delayed
>        # until foregrounding, so doing it here. `kill -KILL' is not
>        # though
>        %$job
>    endfor
> Note that you could put this into function in ~/.zshrc, but you can't put
> it
> into separate script that will run in another process.
>
> Original message:
> > All,
> >
> > Say, in a terminal, I opened many files by invoking vim or gvim program
> > many times, like:
> >
> > vim a&
> > vim b&
> > vim c&
> > ...
> >
> > Than I realized I need to close all of them. So I had to close them one
> by
> > one:
> >
> > %1 and :qa!
> > %2 and :qa!
> > ...
> >
> > Is there a better way to close all files by issuing one command or one
> > script?
> >
> > Thanks.
> > BR
> > Wang, Mengjia
>

-- 
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

Reply via email to