Friday 7 June 2013

Quick multi cursor support in sublime text 2

In a previous post i listed out all the podcasts i listen to. Whilst creating that list i had to do a little bit of text manipulation, i used some of the powerful multi cursor support from sublime text to do it.
I wanted all my links to be hyperlinks instead of just text.

Below is the screen cast of how i went from a long list of web addresses:
<h2>.net</h2>
http://www.hm.com/
http://www.dnr.com/
http://c9.msdn.com/
...

to a long list of hyper links:
<h2>.net</h2>
<a href="http://www.hm.com/">http://www.hm.com/</a>
<a href="http://www.dnr.com/">http://www.dnr.com/</a>
<a href="http://c9.msdn.com/">http://c9.msdn.com/</a>
...

The process

First do an incremental find (Ctrl+i)
Then select all matched (Alt+Enter)
Copy all selections into clipboard (Ctrl+c)
End
Type the end tag
Home Type the start tag
Paste the links again
Close the start tag

Sublime text 2, get to know it.

Sublime is really powerful, this is just a really simple demo of a simple real world use. ive used it to process hundreds of thousands of lines pulled from databases whilst selecting complex regular expression matches then using sort lines and unique lines to get a really good feel of the data.

I used APowersoft screen recorder to record the screen cast and Key Jedi to display the key strokes as i went.

No comments:

Post a Comment