Thursday, November 8, 2012

Re: Clear the command line in vim?

On Thursday, November 8, 2012 9:02:22 AM UTC-6, Javier Garcia wrote:
> Hi,
>
> I want to automatize a process to debug PHP apps. So I'm using this plugin that after starting the debugging process (F5) it shows this message in the command line:
>
> waiting for a new connection on port 9000 for 5 seconds...
>
> So, inmediately after that throwing that message I would like to call a bash script that is in my home folder. So I create a key biding like this:
>
> map gm <F5> :!sh ~/refresh_browser.sh<enter>
>
> My problem: because of the message waiting ... is not possible to write commands in the command line.
>
> So, is there any way to clear the command line to remove the waiting.. message before executing the bash script? if not, what is your advice?
>
> Javi

I *think* what you're asking, is as follows:

1. You have a plugin which uses an external shell command to debug PHP
2. This external shell command busy-waits 5 seconds
3. Because of (2), Vim also is stuck waiting for the command to finish for those 5 seconds.
4. You want Vim to do something during the wait period, but Vim is stuck waiting for the external command to finish.

As I see it then, there are a couple ways to do this:

Method 1:
1. Edit your refresh_browser.sh script to first wait 1-2 seconds before taking action.
2. Call your refresh_browser.sh script BEFORE your plugin, but as a background task (using something like :!sh refresh_browser.sh & on unix or :!start sh refresh_browser.sh on Windows)

Method 2:
1. Edit the plugin to call the command that waits as a background task instead of a foreground one.
2. Edit the command that currently waits to call back into Vim when complete with the results. See http://vim.wikia.com/wiki/Execute_external_programs_asynchronously_under_Windows

Let us know in detail what you actually mean if I'm off-base here. I have no idea what else "not possible to write commands in the command line" might mean.

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

No comments: