Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
share|improve this question
1  
Did you search the script section of vim.org? Did you try something? –  romainl Feb 17 at 13:30
    
Yes ofc I searched. I almost finished writing my own script for that. –  tdi Feb 18 at 10:41

1 Answer 1

up vote 3 down vote accepted

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/
share|improve this answer
    
wow I inspired a plugin. thanks :) –  tdi Feb 22 at 10:48

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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