Sublime Text 3 set-up
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:
- package control, to manage all packages
- AcademicMarkdown, neat highlighting of markdown syntax.
- MarkdownEditing
- All Autocomplete auto complete using matches from any of the open files.
- BracketHighlighter extends the default bracket highlighting from sublime text.
- SublimeKnitr, requires R-Box, SendREPL and LaTeXing. knitr Markdown and LaTeX support.
- LaTeX-cwl, LateX commands auto-complete
- Spell checking, because tipos :)
- markdown-preview, build and preview markdown files in Sublime.
- SideBarEnhancements, copy, delete, rename and other file opearations from your side bar.
- SublimeLinter, verification of code quality for:
- lintr, R
- pep8, Python
- shellcheck, Shell
- R_comments, easy insertion of nicely formatted R comments.
- R-snippets, collection of R snippets.
- pythonpep8autoformat, formats old code with pep8 rules.
- python3, syntax highlighting.
- SublimeGit
- carlcalderon sublime color schemes, I prefer not so dark schemes, and use the Tyrann Kim or the Tyrann Alex.
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
@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}
}