Follow the link in vim with markdown syntax

Is it possible to use markdown links from vim with a keyboard shortcut? The links are as follows:

[foo](relative/path/to/file.pdf) [bar](www.some-webpage.com) 

I want to have a keyboard shortcut that opens links using the default application. Not sure if that matters, but I'm using OS X.

+5
source share
2 answers

Try gx when your cursor is on a link. netrw should open a link with an external handler (see :h netrw-gx ), which on Mac OS X will be open .

+5
source

I have combined support for this in Vim Markdown .

As explained in README, it works from any of the following cursor positions:

 [Example](http://example.com) ^ ^ ^^ ^ ^ 1 2 34 5 6 <http://example.com> ^ ^ ^ 1 2 3 

My implementation uses the syntax of each position to determine the URL. Entry Point: https://github.com/plasticboy/vim-markdown/blob/028a7613eadf84d4e75c2eaa87b1cc756774f9c5/ftplugin/mkd.vim#L472

+2
source

Source: https://habr.com/ru/post/1206843/


All Articles