3

Is there some automatic script that changes text with http:// links to references for mutt or a vim plugin ? Say I have

Text text, hey there goes a http://example.com link, 
hey the second one http://example2.com/. Btw have 
you seen the http://example.com ? 

I want to automatically change it to:

Text text, hey there goes a [1] link, 
hey the second one [2]. Btw have 
you seen the [1] ? 

References

[1] http://example.com
[2] http://example2.com
2
  • 1
    Did you search the script section of vim.org? Did you try something?
    – romainl
    Feb 17 '14 at 13:30
  • Yes ofc I searched. I almost finished writing my own script for that.
    – Darek
    Feb 18 '14 at 10:41
3

that's an interesting use case! As I already provide a set of general pattern extraction commands in my ExtractMatches plugin, as well as extended substitution commands in the PatternsOnText plugin, I was able to leverage and combine the functionality of both.

My new ExtractLinks plugin aims to provide just what you're asking for (and customizations for Markdown and HTML), in the hope that you (and others) find this useful.

This text references http://www.vim.org/ and http://w3.org/.
:ExtractLinks
This text references [1] and [2].
:put
[1] http://www.vim.org/
[2] http://w3.org/
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.