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

additional articles to journey through:

automatic python playlist creator
16 november 2012 | programming

Now that I've gotten back in the python groove somewhat, wanted to make a playlist script that recursively went through a folder, found all[...] files in a sub-folder and create a playlist from them. Implementation described and link to github repository.

graduate student resources
19 august 2015 | graduate school

Providing links to some articles and other resources that I have found useful while in graduate school. I'll continually update the list as[...] I find more.

long-term optical imaging of the spinal cord in awake, behaving animals
25 may 2023 | neuroscience

How does the spinal cord process sensory stimuli in awake animals? A brief overview of results from our recent preprint describing [...]a spinal implant chamber, fibrosis-inhibiting materials, computational methods, and end-to-end pipeline for large-scale bilateral recording from multiple segments of the spinal cord. This allowed us to conduct long-term (months to over a year) imaging of individual axons, microglia dynamics, and Ca2+ imaging of neurons—all in awake, behaving animals.

Several of the approaches described, such as fibrosis inhibition, are applicable to preparations and experiments beyond the spinal cord.

dreams
02 july 2012 | essay

I have been recording down many recent and very old dreams in a Word document, which has swelled to over 7,000+ words and contains near one[...] hundred stories. The plan is to clean-up and compile all these stories into one novella that has several characters exploring the dream-worlds with some overarching story to tie it all together. Should be a fun experiment.

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