Skip to content

Instantly share code, notes, and snippets.

@cecil
Created May 20, 2015 14:33
Show Gist options
  • Select an option

  • Save cecil/2eac53240f1fe3caf0d9 to your computer and use it in GitHub Desktop.

Select an option

Save cecil/2eac53240f1fe3caf0d9 to your computer and use it in GitHub Desktop.
vim regexp to replace an non-formatted list consisting of one item per line with a markdown formatted list of each item linked to google/youtube/bing/ddg search results for that item
%s/\(^.*\)/* [\1]\(https:\/\/www.google.com\/search\?q=\1\)/g
%s/\(^.*\)/* [\1]\(https:\/\/www.google.com\/search\?tbm=isch\&q=\1\)/g
%s/\(^.*\)/* [\1]\(https:\/\/www.youtube.com\/results\?search_query=\1\)/g
%s/\(^.*\)/* [\1]\(https:\/\/www.bing.com\/search\?q=\1\)/g
%s/\(^.*\)/* [\1]\(https:\/\/www.bing.com\/images\/search\?q=\1\)/g
%s/\(^.*\)/* [\1]\(https:\/\/www.bing.com\/videos\/search\?q=\1\)/g
%s/\(^.*\)/* [\1]\(https:\/\/www.duckduckgo.com\/\?q=\1\)/g
%s/\(^.*\)/* [\1]\(https:\/\/www.duckduckgo.com\/\?ia=images\&q=\1\)/g
%s/\(^.*\)/* [\1]\(https:\/\/www.duckduckgo.com\/\?ia=videos\&q=\1\)/g
example :
source :
cats
dogs
possible outputs :
* [cats](https://www.google.com/search?q=cats)
* [dogs](https://www.google.com/search?q=dogs)
* [cats](http://www.bing.com/search?q=cats)
* [cats](http://www.bing.com/search?q=dogs)
* [cats](https://duckduckgo.com/?q=cats)
* [dogs](https://duckduckgo.com/?q=dogs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment