Setting up Sublimetext3

In this blog post, I will talk about how I set up Sublimetext3 for my work. I recently changed my main work computer, and I spent quite some time to configure it. This is more of a self-note so I do not have to spend as much time next time I need to configure it on a new computer.

Install the Packages Control package

The very first task you need to complete after installing Sublimetext is to install the Packages Control package. Visit this website and follow the instruction. Once you install this package, it becomes very easy to install packages from inside Sublimetext using command palette (command+shift+p).

Install some utility packages to make your life easier

  • Colorsublime: let you install color themes from command palette
  • Seti_UI: great user interface
  • SideBarEnhancements: more actions available on the side bar
  • A File Icon: nice icons for various file types on the sidebar
  • Origami: let you create and destroy panes with easy short cut keys

Markdown editing

Markdown is a lightweight markup language that allows you to produce a neat-looking html file based on simple syntax (see here). For Markdown editing inside Sublimetext, I use the the MarkdownEditing package. Use command palette and search for the package, and install it. I like to use the MonokaiC color theme when editing a markdown file. Visit here for the instruction. After downloading ME-MonokaiC.tmTheme file, do not forget to change the setting so that you actually use the theme. Follow Preferences > Package Settings > Markdown Editing > Markdown GFM Settings - USER and place the following in the file.

    "color_scheme": "Packages/User/ME-MonokaiC.tmTheme",

Note that GFM is the default setting. There are two other markdown styles available from the package. If you want to use those styles, you can follow View > Syntax > Open all with current extension as ... > MarkdownEditing > your choice of style. Obviously, if you chose a style other than GFM, you need to put the above text block into its setting file.

Using R

Sublimetext can be a great IDE. Most R users use Rstudio. I use Sublimetext as the R code editor and use Rstudio’s console and plots panes to display outputs. First, install R-Box using package control. This provides nice syntax highlighting for not just R, but also Rcpp and Rmarkdown. It also will give you auto-completion much like Rstudio does. Now, install the SendCode package using package control. This package allows you to send the R code you wrote on Sublimetext to Rstudio to evaluate it. Before enabling that functionality, you need to follow Preferences > Package Settings > SendCode > Settings, and then paste the following in the file.

    "prog": "rstudio",
        "bracketed_paste_mode": true,
        "prog": "sublimerepl"
        "prog": "rstudio"

Now, invoke the command palette, type SendCode, and select SendCode: Choose Program, and then pick Rstudio Desktop. Now, you can send R code written on Sublimetext to Rstudio by simply selecting the lines (or even just the name of an R object) and hitting command+enter. The figure below is a screenshot of my desktop computer with Rstudio on the left as the outcome display and Sublimetext on the right as the editor.

Rstudio on the left and Sublimetext on the right

Rstudio on the left and Sublimetext on the right

I use Sublimetext as the editor because it is much faster and more convenient to write thanks to all its functionalities that are not available on Rstudio. Another compelling reason (at least for me) to use Sublimetext is that I never have to switch between multiple programs because I do virtually everything on Sublimetext, including write papers using Latex and creating lecture notes using Rmarkdown and Rnw.

Latex setup

There are two options for Sublimetext uses: LaTeXing and LatexTools. I use LaTeXing, but either works. Just pick whichever you want. Here, I will show you how to use the LaTeXing package. As usual, first install the package using package control. Then, install a Tex distribution (e.g., MacTeX). That’s it! By hitting command+b on the tex file you are working on, it will compile it to produce a pdf file.

knitr (Rmarkdown and Rnw)

You can knit using Sublimetext as well. I use this extensively to write a journal article (Rnw), lecture notes, and blog posts like this one (Rmarkdown). The LaTeXing package actually provides this functionality. Follow Preferences > Package Settings > LaTeXing > Settings - USER and place the following in the file.

    "knitr": true

Using Vim to edit

Enabling Vim-like editing

I use the Vintageous package for Vim-like editing. This allows you to efficiently move cursors around, copy lines, and take many other actions while editing text by hitting key(s) (A tutorial here if you are interested.). It has some learning curve, but once you learn how to use it, there is no turning back because it’s super efficient. To enable Vim-like editing, first install the Vintageous package. You then need to follow Preferences > Settings and put the following text in the file on the right.


By default, Vim functionality is suppressed. The above block release the functionality.


The VintageousPluginSurround is very handy as it lets you surround the selected letters with whatever choice of letter you want to surround them. When you write a computer program, you use () and [] a lot. So, this functionality is very useful.

Easily exit the insert mode

Follow Preferences > Key Bindings and put the following in the file on the right:

  "keys": ["j", "k"],
  "command": "_enter_normal_mode",
  "args": {"mode": "mode_insert"},
  "context": [{"key": "vi_insert_mode_aware"}]

Then, you can exit the insert mode by hitting j and k consecutively, instead of hitting the esc key, which is quite far from where your fingers usually sit. Many Vim uses seem to do this.

Easily move the cursor the front and end of a line

Create .vintageousrc file directly under the User folder (follow Preferences > Browse Packages ...). In the file, put the following:

:map gh ^
:map gl $

This will allow you to move the cursor to the (beginning) end of the line by hitting g and h (g and l) consecutively.