Friday, September 27, 2019

Re: Best way to launch a URL from within VIM

cut and past works.

cut and past works...again
cut and past works...again
cut and past works...again
cut and past works...again

On 9/27/19 12:00 PM, Ni Va wrote:
> I use this :
>
> " Url
>> function! helper#job_out_cb(self, data) abort "{{{
>> let g:idx += 1
>> let g:data .= string(g:idx)
>> let g:data .= a:data
>> let self = a:self
>> try
>> let data = remove(self.lines, -1) . a:data
>> catch /.*/
>> echomsg 'begin'.string(a:data).'end'
>> endtry
>> let lines = split(a:data, "\n", 1)
>> " echomsg string(lines)
>> call extend(self.lines, lines)
>> endfunction "}}}
>> function! helper#job_exit_cb(self, data) abort "{{{
>> let a:self.running = 0
>> let a:self.error = a:data != 0
>> let self = a:self
>> let g:self = self
>> endfunction "}}}
>> function! helper#job_cb(fn, job, ch, data) "{{{
>> call call(a:fn, [a:job, a:data])
>> endfunction "}}}
>> fun! helper#openurl(...) "{{{
>> let cmd_browse = 'rundll32 url.dll,FileProtocolHandler '
>> let url_pat = '\w\+:\/\{2}[^ ''()]\+'
>> let url = matchstr(getline(line('.')), url_pat)
>> if url != ''
>> let g:job = job_start(cmd_browse.url, {
>> \ 'out_cb' : function('helper#job_cb', ['helper#job_out_cb' , {} ]),
>> \ 'exit_cb' : function('helper#job_cb', ['helper#job_exit_cb', {} ]),
>> \ 'out_mode': 'raw'
>> \})
>> else
>> echomsg 'sorry, no url found on this cursor''line'
>> endif
>> endfunction "}}}
>
>
>
> Le vendredi 27 septembre 2019 17:53:15 UTC+2, J S a écrit :
>>
>>>> I seek a simpler and, ideally, seamless (i.e., no "press any key"s) way.
>>
>>
>>> Isn't that what netrw's normal command `gx` provides?
>>
>> Bingo! We have a winner! gx does exactly what I want. Thanks.
>>
>> Note: All other commentary on this thread has been pretty much n/a.
>>
>


--
So many immigrant groups have swept through our town
that Brooklyn, like Atlantis, reaches mythological
proportions in the mind of the world - RI Safir 1998
http://www.mrbrklyn.com

DRM is THEFT - We are the STAKEHOLDERS - RI Safir 2002
http://www.nylxs.com - Leadership Development in Free Software
http://www2.mrbrklyn.com/resources - Unpublished Archive
http://www.coinhangout.com - coins!
http://www.brooklyn-living.com

Being so tracked is for FARM ANIMALS and and extermination camps,
but incompatible with living as a free human being. -RI Safir 2013

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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/fb16df53-3a75-d646-816b-2f38eb7369d3%40my.liu.edu.

No comments: