Sublime Text

Summary

When coding, writing up blog post, or doing any other task, I generally have used Notepad++. It is a great program that automatically detects, based on the extension, the type of code you are writing and parses the file accordingly. It is light and gets the job done, but it always felt like it could be taken to the next level. Enter Sublime Text 2, a program that seems to have everything I am looking for in a text editor and then some.

When coding, writing up blog posts, or doing any other tasks, I generally use Notepad++. It is a great program that automatically detects, based on the extension, the language you are coding in and parses the file accordingly. It is light and gets the job done, but it always felt like it could be taken to the next level. Enter Sublime Text 2, a program that seems to have everything I'm looking for in a text editor and then some.

For starters, Sublime Text is endlessly customizable and comes with several powerful features such as Snippets, Plugins, and Packages. Snippets allow you to execute a bit of code when you enter any sequence of letters followed by TAB. Else, you can do what I did and map the Snippet to a keyboard combo and BAM, you suddenly can be doing quick substitutions for repetitive bits of code all day long.

There are other superb features, like the ability to hold down CTRL and click the mouse in multiple locations. This creates multiple cursors that you can type in. Suppose there are several lines of code or in a document that you want to change. This allows you to do that and avoid having to deal with regular expressions if you forget the commands. There is CTRL+R that allows you to search your document by functions (alternatively you can type CTRL+P then @) or CTRL+P then type #, which gives you a list of different elements in your document (e.g. different tags if working with HTML). The same command and typing in a colon (or CTRL+G) allows you to jump around to any line in the document. There are a wealth of other features: Distraction Free mode, where everything disappears but the text; a built-in spell-checking that is an improvement over Notepad++'s ghetto one; and multi-column viewing, the ability to line-up multiple documents side-by-side without having to open new windows. And I've only begun to scratch the surface. More can be found on the official website.

Packages allow you to extend the functionality of Sublime Text 2 in different ways. For example, there is Sublime Package Control that allows simple installation of packages. You can browse packages at Sublime Text Packages or contribute via the Sublime Text GitHub group. Some packages allow you to align your documents while other add whole new features.

Notepad++ had a great plugin called WebEdit that allowed you to insert different HTML tags into your documents without having to type everything out. Sublime Text autocompletes many common functions in whatever language you are coding in, but selecting items and interting tags based on those selections was lacking. Thus, after switching to Sublime Text, I missed WebEdit's features and created HTMLEdit to resolve this problem. It has several of the basic tags built in with shortcuts using ALT + [first letter of tag]. It is currently being updated on the HTMLEdit GitHub repository. Below is a sampling of the code, quite simple really.

Javascript
  1. //Default keymap file.
  2. { 'keys': ['alt+a'], 'command': 'insert_snippet', 'args': {'name': 'Packages/HTML_Edit/URL.sublime-snippet' }},
  3. { 'keys': ['alt+s'], 'command': 'insert_snippet', 'args': {'name': 'Packages/HTML_Edit/STRONG.sublime-snippet' }},
  4. { 'keys': ['alt+p'], 'command': 'insert_snippet', 'args': {'name': 'Packages/HTML_Edit/PARA.sublime-snippet' }},
  5. { 'keys': ['alt+e'], 'command': 'insert_snippet', 'args': {'name': 'Packages/HTML_Edit/EMP.sublime-snippet' }},
  6. { 'keys': ['alt+i'], 'command': 'insert_snippet', 'args': {'name': 'Packages/HTML_Edit/IMG.sublime-snippet' }},
  7. { 'keys': ['alt+q'], 'command': 'toggle_setting', 'args': {'setting': 'spell_check'} }
XML
  1. <!--URL.sublime-snippet, insert a URL into page at SELECTION.-->
  2. <snippet>
  3.         <content>
  4.                 <![CDATA[<a href='${1:URL}' target='_blank'>${SELECTION}</a>]]>
  5.         </content>
  6. </snippet>

I'll continue using Sublime Text and report back on any interesting new features and other additions I find. The program is very portable due to instant detection of changes to packages and settings. All these changes can be made within Sublime Text and are easy-to-read plaintext files. Sublime Text 2 is superb and after more than a week using it, I decided to support further development by purchasing a license. Rare that. Give it a try: Sublime Text 2.

-biafra
bahanonu [at] alum.mit.edu

other entires to explore:

setting the record straight
02 june 2012 | short story

The sun beat down and I raised my hand to cover my eyes. It had been days, weeks, maybe even years. Who knew? I surely didn’t. T[...]he dry sands whipped our faces, blurring our vision and making us believe we saw things. Water, chief among them. Haha, it’s funny how that most abundant always seems to be the end of us. You either drown in it or die from not having it. No one wins. Someone told me that they’d managed to survive a month without water. I don’t believe it, but guess I’m about to find out. We’d seen other things. Silver buildings that rose into the sky, it blinded us and as we got close, a sandstorm would appear and when it was gone, so was the house. It is incredible what you imagine when under stress…

A return to writing short stories, this one focuses on the surreal memories of two hapless 'heroes'...

satellite-based videos: eastern europe during the russia-ukraine conflict
30 november 2022 | satellite

To visualize the nighttime lights of Eastern Europe, with a focus on times before and after the ongoing Russia-Ukraine conflict, I updated [...]my geoSatView R code originally built to view forest fires in the west coast of the United States to use satellite data from VNP46A1 and other datasets collected from the Suomi NPP VIIRS satellite.

I then created higher-quality movies in MATLAB by using the VNP46A2 Black Marble dataset collected by the same satellite, which has reduced cloud and other artifacts due to additional data processing. This allowed me to quantitate a permanent reduction in nighttime lights within Ukraine (in line with my initial hypothesis) and identify a multi-stage reduction of nighttime lights in Kiev's outer neighborhoods/metropolitan area that was greater than that seen in the city core/center. This highlights the utility of public satellite data to quickly test hypotheses and visualize large-scale changes.

I will go over how the Black Marble dataset is collected and processed along with how I created the movies and the advantages/disadvantages of each data source.

Using this platform and codebase, in follow-up posts I will look at 2021 Texas power crisis during the winter storms, vegetation changes in deforested areas or after conservation efforts, and other events.

social chair spring 2012
27 december 2011 | psk

My terms as social chair during Fall 2011 went quite well, but there were several things I was unsatisfied with. This presentation outlines[...] several different areas I would like to see improved.

©2006-2024 | Site created & coded by Biafra Ahanonu | Updated 17 April 2024
biafra ahanonu