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

more articles to enjoy:

passing command-line parameters to imagej
11 october 2013 | programming

The processes of passing command-line parameters to ImageJ plugins isn't the most direct. Illustrated is a simple solution to this problem,[...] full code included.

Email Signatures
19 October 2011 | designs

Some people have long, obnoxious email signatures. This is my response[...].

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.

review of mad max: fury road
02 june 2015 | movies

A gorgeously shot film that is hampered by a spartan story that never really goes anywhere and action that becomes repetitive by the end of[...] the first act.

©2006-2025 | Site created & coded by Biafra Ahanonu | Updated 21 October 2024
biafra ahanonu