split window keyword lookup (shell)

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

split window keyword lookup (shell)

Jason Morehouse-3
Hello,  I've been using keywordprg to access the php manual online via
elinks.  I was wondering though if there is a way to map a key to open
the command  in a slit window?

Something like this (doesn't work!)
nmap <C-M> :new | :!elinks
"http://www.php.net/"<C-R>=expand("<cword>")<CR><CR>

Any ideas?
Thanks,
-Jason


Reply | Threaded
Open this post in threaded view
|

Re: split window keyword lookup (shell)

Mikołaj Machowski
Dnia niedziela, 2 pa?dziernika 2005 21:54, Jason Morehouse napisa?:
> Hello,  I've been using keywordprg to access the php manual online via
> elinks.  I was wondering though if there is a way to map a key to open
> the command  in a slit window?
>
> Something like this (doesn't work!)
> nmap <C-M> :new | :!elinks
> "http://www.php.net/"<C-R>=expand("<cword>")<CR><CR>

Where are you using Vim? Console or X environment?

In console you are almost lost - use screen program. To execute in
separate window Vim had to have shell emulation in window. Not
officially supported. There is vimshell patch:

http://www.wana.at/vimshell/


In X environment best solution could be (untested):

:call system("xterm -e elinks
'http://www.php.net/'".<c-r>=expand("<cword>")."' &")

m.

Reply | Threaded
Open this post in threaded view
|

Re: split window keyword lookup (shell)

Gary Johnson
In reply to this post by Jason Morehouse-3
On 2005-10-02, Jason Morehouse <[hidden email]> wrote:
> Hello,  I've been using keywordprg to access the php manual online via
> elinks.  I was wondering though if there is a way to map a key to open
> the command  in a slit window?
>
> Something like this (doesn't work!)
> nmap <C-M> :new | :!elinks
> "http://www.php.net/"<C-R>=expand("<cword>")<CR><CR>

You can't "run" the command in a vim window as you can in a shell
window, but you can dump the output of a command into a vim window.

Part of the problem with your mapping is that <cword> is not
expanded until after the new window has been opened and at that
point there is no longer a word under the cursor.

Try this.  I have tested it using 'echo' in place of 'elinks', so I
know the mapping works as I expect it to, but I don't know enough
about the behavior of 'elinks' to know whether it will do what you
want as is.


nmap <C-M> :exe 'new <bar> r!elinks "http://www.php.net/"'.expand("<cword>")<CR>

HTH,
Gary

--
Gary Johnson                 | Agilent Technologies
[hidden email]     | Wireless Division
                             | Spokane, Washington, USA