Business Internet and Telephony, since 1985

Installing The Sublime Text Editor With Vim Style Behavior

Printer-friendly versionPrinter-friendly versionSend by emailSend by email Share this

Sublime Text is a relativley recent addition to the family of available text editors, having been introduced first in January of 2011. it is truly lightning fast, supports syntax highlighting for most common languages as well as code execution facilities so as to enable the user to run code snippets without having to exit to a shell.

Some of the major features that make this editor so attractive are the "goto anything" feature, the ability to select columns for editing, and a feature called "multi-select", which permits the editing of several cursor positions simultaneously, enabling the user to globally change entire variable names, or complete regions of repetitive text at the same time, for example.

Written in Python, Sublime runs on Linux, OS X, and Windows. In this tutorial, we're going to cover the installation of Sublime Text on your system and configure it to act like Vim...

Let's get started installing Sublime Text.

If you have sbopkg installed, then installation is simple in Slackware 14.0.

# sbopkg -s sublime_text

To install Sublime Text using SBo and pkgtools, we will make a couple of assumptions:

  1. That you keep your SlackBuilds in /usr/local/slackbuilds
  2. That you keep your package repo in /usr/local/packages
  3. That you are running a pure 64 bit version of Slackware.

If you keep your SBo's and packages in different locations (i.e., the default locations), simply make adjustments accordingly. When the SlackBuild script finishes you will be notified as to the whereabouts of your new package anyway.

# mkdir -p /usr/local/slackbuilds /usr/local/packages; cd /usr/local/slackbuilds
# wget
# tar zxvf sublime_text.tar.gz
# cd sublime_text
# wget

Change the following line in /usr/local/slackbuilds/sublime_text/sublime.SlackBuild from:




Now compile the source and create the package:

# chmod -v +x sublime.Slackbuild # in case it's not already executable
# ./sublime_text.SlackBuild

Now we install the package:

# installpkg /usr/local/packages/sublime_text-2.0.1-x86_64-1_SBo.tgz

In Xfce, Sublime Text should now appear alphabetically in the "Accessories" sub-menu under the main menu. The executable is located at /usr/bin/sublime_text, and you may want to create an alias to invoke it from the cli like so:

$ echo "alias slt='/usr/bin/sublime_text'" >> ~/.bashrc

 Before we move on, get a quick feel for Sublime Text's default editing. It looks a lot like Vim, but feels more pico with a little gvim like menu at the top. It has a file browser which you can enable in a sidebar, and on the very right hand side it shows a little snapshot (called the Mini Panel) of the document you're working on too. Let's make it act familiar now - like vi. The nicest thing about changing the default behavior of Sublime Text is that we're not going to lose any of the editors other keyboard shortcut features.

From the menu bar, go to Preferences ==> Settings - Default and change:

"ignored_packages": ["Vintage"]


"ignored_packages": []

Now that takes care of insert mode, but we need to enable ex, or command mode:

$ cd ~/.config/sublime-text-2/Installed\ Packages
$ wget

That last wget URL was truncated, so if you had any problems copying the URL here it is again so you can cut and paste it into your console:

There's just one last thing that might nag you. Vim and vi start in command mode - not insert mode. So let's change this default. We're going to change this default here at the user level, instead of the global default like we did in the last example. You should note that any changes you make under Preferences in Settings - Default will be overwritten each time you upgrade, while changes made in Settings - User will remain intact after product upgrades. For this reason, you may want to make sure that you go back later and set Vintage mode at the user level so you don't discover that you've lost your Vim key bindings following your next upgrade - Sublime Text has a rapid development cycle.

From the menu bar, go to Preferences ==> Settings - User and in between the curly braces of the document, add another line which will read:

"vintage_start_in_command_mode": true

NOTE: It should look like so:

This is what your user settings should look like before you save it.

Now save it with a <CTRL>+S and exit out of Sublime Text. I should warn you that whether your machine upbruptly loses power, or you gracefully exit out of Sublime Text, if you don't first close the files you're working on you'll find that upon opening the editor that all of the files you were previously working on are also opened - without the loss of any data. That's pretty slick!

Now let's try it out!

$ slt testfile.txt &

Simply enter "i" and you're in insert mode. Start typing!

Easy Peasy!

There's a lot of additional tweaks and features that you can take advantage of, so here's a few links for you to bookmark and keep handy as the development of Sublime Text continues to evolve:

The Sublime Text page showing How to enable Vintage Mode

The github project page for VintageEx, showing How to install/enable vi Command Mode

One of the major advantages of Sublime Text over that of Vim, is that once you enable Vintage and VintageEx mode capabilities, not only do you have a nice looking editor that acts (for the most part) like Vim, has menus and mouse support like gvim, with text drag and drop capabilities, but you also have the additional keyboard shortcut capabilities provided by Sublime Text that are available to you in the default, out of the box, installation.

To be fair, I should also point out that one of the disadvantages of Sublime Text is that this isn't Vim, and therefore, plugins are different, so your favorite plugins for Vim won't work. On the other hand, plugin support for Sublime Text was a major consideration early on during its development, so the extensibility is there for you to develop or install plugins as you please.

That having been said, the support for this editor from the contributing community is almost overwhelming. If you are looking for a particular color scheme it probably already exists - The solarized color scheme is included when you install Sublime Text, so if that's your fav, there's nothing to do there except to choose it. If you thought that the Vim community had a lot of offerings, you'll be pleasantly surprised at the sheer volume of choices you have for Sublime Text.

Although the VintageEx package is licensed under the MIT license, Sublime Text itself is NOT free software. You can install and evaluate it for free, but after you have finished with your trial installation it is expected that you purchase a license. There is, at this tiime, no expiration of the trial period, no adware Spamming you in the face, or nags to interupt your work. The title bar of the application says whether you're running a licensed or unregistered version of the editor.

There's good and bad, IMO, with the licensing schemata used for Sublime Text:

  • Good: You can install on as many machines as you like with a single license (For your own use)
  • Bad: The license is only valid for updates of minor point releases. Major updates require a new license

 All in all, Sublime Text is a really nice, Vim-like, editor. At least it is once you enable the features so that it acts like Vim yes

The advantages of being able to take advantage of both Vim-like behavior and the default features inherent within Sublime Text out of the box places it pretty high up there on our list of goto editors when running X, while that lack of console support still brings us back to Vim and Elvis more often than not.

Give it a whirl. Sublime Text does not disappoint, and it's always kewl to have more editors at your disposal, isn't it?

Below I've included a comprehensive video intro and course that highlights many of the features of Sublime Text that you'll want to investigate and master. Although this two and a half hour video tutorial is based on using Sublime Text on a Mac, most of the functionality is the same on Linux or Mac if you substitue <Ctrl> for the Command key on the Mac. i.e., use Control+Shift instead of Shit+Command.