Clear the command line in vim?

845 views
Skip to first unread message

Javier Garcia

unread,
Nov 8, 2012, 10:02:22 AM11/8/12
to vim...@googlegroups.com
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

Ben Fritz

unread,
Nov 8, 2012, 10:59:16 AM11/8/12
to vim...@googlegroups.com
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.

Javier Garcia

unread,
Nov 9, 2012, 6:13:23 PM11/9/12
to vim...@googlegroups.com
Thanks!! it is working now with your method 1.

Finally I create a key binding like this:

map gm :! ~/my_sript.sh &<enter><F5>

And this is the content of my_script.sh:

#!/bin/sh
xdotool windowfocus `xdotool search --name "Mozilla Firefox" | head -1`
sleep 2
xdotool key F5
xdotool windowactivate `xdotool search --name "GVIM" | head -1`
xdotool key F4 #to go to the breakpoint

Well when I said "not possible to write commands in the command line" I meant that while the message "wait.." is shown in the command line, I cat not write anything in the command line.

Javi

Reply all
Reply to author
Forward
0 new messages