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