Quantcast

How can the cmd window be hidden?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

How can the cmd window be hidden?

zhang listar
Hi, all.
I am using gnu global with gvim on windows 7.
It woks fine and but a small problem bothes me.

I write the following code in vimrc:

au BufWritePost *.[ch],*.cpp call UpdateGtags(expand('<afile>'))
function! UpdateGtags(f)
     let dir = fnamemodify(a:f, ':p:h')
     exe 'silent !cd ' . dir . ' && global -u &> /dev/null &'
endfunction

But when I try to save content to gvim, a black window of cmd blinks,
and disappears.
I know it's vim calls it.

I want to let the cmd window run in the background. How can I do it?

Thanks in advance.

--
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 | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: How can the cmd window be hidden?

Ben Fritz
On Friday, May 11, 2012 2:02:24 AM UTC-5, zhang listar wrote:

> Hi, all.
> I am using gnu global with gvim on windows 7.
> It woks fine and but a small problem bothes me.
>
> I write the following code in vimrc:
>
> au BufWritePost *.[ch],*.cpp call UpdateGtags(expand('<afile>'))
> function! UpdateGtags(f)
>      let dir = fnamemodify(a:f, ':p:h')
>      exe 'silent !cd ' . dir . ' && global -u &> /dev/null &'
> endfunction
>
> But when I try to save content to gvim, a black window of cmd blinks,
> and disappears.
> I know it's vim calls it.
>
> I want to let the cmd window run in the background. How can I do it?
>

You can use !start /min or !start /b to run an asynchronous task minimized or with no window, respectively. If you do this, you may want to call back into Vim with the client-server function to let Vim know you're done. See:

http://vim.wikia.com/wiki/Execute_external_programs_asynchronously_under_Windows

--
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 | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: How can the cmd window be hidden?

Sergey Khorev
In reply to this post by zhang listar
> I write the following code in vimrc:
>
> au BufWritePost *.[ch],*.cpp call UpdateGtags(expand('<afile>'))
> function! UpdateGtags(f)
>     let dir = fnamemodify(a:f, ':p:h')
>     exe 'silent !cd ' . dir . ' && global -u &> /dev/null &'
> endfunction
>
> But when I try to save content to gvim, a black window of cmd blinks,
> and disappears.

Use system()

--
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 | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: How can the cmd window be hidden?

zhang listar
In reply to this post by Ben Fritz
2012/5/11 Ben Fritz <[hidden email]>:

> On Friday, May 11, 2012 2:02:24 AM UTC-5, zhang listar wrote:
>> Hi, all.
>> I am using gnu global with gvim on windows 7.
>> It woks fine and but a small problem bothes me.
>>
>> I write the following code in vimrc:
>>
>> au BufWritePost *.[ch],*.cpp call UpdateGtags(expand('<afile>'))
>> function! UpdateGtags(f)
>>      let dir = fnamemodify(a:f, ':p:h')
>>      exe 'silent !cd ' . dir . ' && global -u &> /dev/null &'
>> endfunction
>>
>> But when I try to save content to gvim, a black window of cmd blinks,
>> and disappears.
>> I know it's vim calls it.
>>
>> I want to let the cmd window run in the background. How can I do it?
>>
>
> You can use !start /min or !start /b to run an asynchronous task minimized or with no window, respectively. If you do this, you may want to call back into Vim with the client-server function to let Vim know you're done. See:
>
> http://vim.wikia.com/wiki/Execute_external_programs_asynchronously_under_Windows

Thanks for your attention.
The plugin asynccommand is good.

--
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 | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: How can the cmd window be hidden?

zhang listar
In reply to this post by Sergey Khorev
2012/5/12 Sergey Khorev <[hidden email]>:

>> I write the following code in vimrc:
>>
>> au BufWritePost *.[ch],*.cpp call UpdateGtags(expand('<afile>'))
>> function! UpdateGtags(f)
>>     let dir = fnamemodify(a:f, ':p:h')
>>     exe 'silent !cd ' . dir . ' && global -u &> /dev/null &'
>> endfunction
>>
>> But when I try to save content to gvim, a black window of cmd blinks,
>> and disappears.
>
> Use system()

Thanks a lot.
But it is the same using system()-a black window blocks gvim and
execute the command.
The plugin asynccommand is good.

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