Sublime Text 3 set-up

Author
Published

August 1, 2016

I am a big fan of Sublime Text! It is a lightweight text editor, inexpensive license, and with contributions by hundreds of users, highly extensible and customizable. From a practical perspective, I prefer to use it instead of IDEs, such as Jupyter or RStudio, because I also write a lot of little bash/shell scripts or just one-liners embedded in markdown (my projects notebooks). Also, the pipeline I am using is based on groovy. Sometimes I write code in all 4 languages in a single day, and thus it is easy to see why I prefer a single development environment instead of having to memorize different shortcuts/layouts. Personally it makes my life easier. Also, I love the multi-line editing features of sublime text and the ability to search within projects, etc.

Recently I upgrade to version 3, and re-installed my most used packages. I will leave the list here for future reference, and in case someone else is interested.

Packages

Installed packages:

From the above the single most important one is SendREPL which allows me to send commands straight from the editor to the terminal (with tmux) with a keystroke ctrl+[enter]. It does not matter if in tmux there is an R terminal, python console, or pure ol’ bash. This flexibility is precious.

Extras

AcademicMarkdown code blocks do not highlight code in blocks labelled “bash”, but only has “shell”, or “sh”. This is in an issue when converting to html via pandoc. To solve this, I simple followed these instructions, and modified locally the file AcademicMarkdown.tmLanguage from:

        <key>fenced-shell</key>
        <dict>
            <key>begin</key>
            <string>^(\s*[`~]{3,})(sh|shell)\s*$</string>
            <key>end</key>
            <string>^(\1)\n</string>
            <key>name</key>
            <string>markup.raw.block.markdown markup.raw.block.fenced.markdown</string>
            <key>patterns</key>
            <array>
                <dict>
                    <key>include</key>
                    <string>source.shell</string>
                </dict>
            </array>
        </dict>

to

        <key>fenced-shell</key>
        <dict>
            <key>begin</key>
            <string>^(\s*[`~]{3,})(sh|shell|bash)\s*$</string>
            <key>end</key>
            <string>^(\1)\n</string>
            <key>name</key>
            <string>markup.raw.block.markdown markup.raw.block.fenced.markdown</string>
            <key>patterns</key>
            <array>
                <dict>
                    <key>include</key>
                    <string>source.shell</string>
                </dict>
            </array>
        </dict>

Note the inclusion of “bash” in the 4th line, and it now highlights fenced code labeled as “bash”. I am very proud of myself. It was fixed in the repo and a merge request sent in GitHub.

I was also having a hard-time getting the “comment code” shortcut to work. This is a know bug that should have been solved in my version (Build 3114) bit it isn’t. Adding this to the use keybindings file solved the issue:

{ "keys": ["ctrl+7"], "command": "toggle_comment", "args": { "block": false } },
{ "keys": ["ctrl+shift+7"], "command": "toggle_comment", "args": { "block": true } }

Groovy

There is some bug/feature in which lines are comment with “/ /”, or something like that, rather than with “//”, which I (and apparently others) prefer. The solution is here.

Reuse

Citation

BibTeX citation:
@online{domingues2016,
  author = {Domingues, António},
  title = {Sublime {Text} 3 Set-up},
  date = {2016-08-01},
  url = {https://amjdomingues.com/posts/2016-08-01-sublime-text-setup/},
  langid = {en}
}
For attribution, please cite this work as:
Domingues, António. 2016. “Sublime Text 3 Set-up.” August 1, 2016. https://amjdomingues.com/posts/2016-08-01-sublime-text-setup/.