reckoning.dev
Navigate back to the homepage
About Me
Code::Stats

Sublime Text Setup

Sadanand Singh
November 10th, 2017 · 3 min read

I have been using Sublime text as my primary editor for some time now. Here I wanted to share my current setup for the editor including all settings, packages, shortcut keys and themes.

UPDATE

This post has been updated with my latest sublime settings.

Packages

First thing you will need to install is the Package Control. This can be easily done by following the directions at their installation instructions.

Once you have installed the package manager and restarted sublime text, now you can install all other packages using the powerful command pallet. Hit ctrl + shift + P and type Install, choose Package Control : Install Package. Now you can search for any package that you wish to install, and then press Enter to install it.

Here is a list of packages that I currently use:

Alignment provides a simple key-binding for aligning multi-line and multiple selections.

Bracket Highlighter, as the name suggests, matches a variety of brackets such as: [], (), {}, "", '', <tag></tag>, and even custom brackets.

C++11 provides better coloring scheme and syntax highlighting for C++11 and beyond syntax.

Column Select plug-in provides an alternate behavior for Sublime keyboard column selection. The major differences are:

  • Allows reversing direction (go down too far, just go back up).
  • Added PageUp/PageDown, Home/End, and mouse selection.
  • Skip rows that are too short.
  • If you start at the end of a line, then it will stay at the end of each line.

AutoDocString makes writing documentation a breeze for python code. I typically use google docstring format, so I modify settings as follows:

1{
2 "style": "google",
3 "extra_class_newlines": false
4}

GitGutter is a handy plug-in to show information about files in a git repository. Main Features are:

  • Gutter Icons indicating inserted, modified or deleted lines
  • Diff Popup with details about modified lines
  • Status Bar Text with information about file and repository
  • Jumping Between Changes to easily navigate between modified lines

My custom settings are:

1// GitGutter Settings - User
2{
3 "show_line_annotation": "auto",
4 "diff_popup_default_mode": "diff"
5}

Jedi is a plugin that turns your SublimeText 3 into a rich featured Python development stack that boost your productivity and helps you to ensure the quality and style of your code. The plugin works out of the box with no configuration but, I prefer to specify the python interpreter explicitly.

1{
2 "python_interpreter": "/Users/sadanand/anaconda3/envs/py3.7-dev/bin/python3"
3}

Please note that autocompletion doesn’t work well for the import statements by default in sublime text 3. Please follow these instructions to make it work properly. You can download a copy of my completion file.

MagicPython is a package with preferences and syntax highlighter for cutting edge Python 3. It is meant to be a drop-in replacement for the default Python package. MagicPython correctly highlights all Python 3.5 and 3.6 syntax features, including type annotations, f-strings and regular expressions. It is built from scratch for robustness with an extensive test suite.

sublack is plugin to run black. Black is the uncompromising Python code formatter. Blackened code looks the same regardless of the project you’re reading. Formatting becomes transparent after a while and you can focus on the content instead. I prefer to use a line width of 99. By default black likes to convert all strings to double quotes, while I prefer single quotes. Following configuration is needed for these modifications:

1{
2 // ########################
3 // Black specific options #
4 // ########################
5
6 // line length
7 // uses black default, if not modified
8 "black_line_length": 99,
9
10 // If --fast given, skip temporary sanity checks.
11 "black_fast": false,
12
13 // prevent black from changing single quote to double quotes
14 // default is false
15 // add --black_skip_string_normalization
16 "black_skip_string_normalization": true,
17
18 // Don't normalize underscores in numeric literals.
19 "black_skip_numeric_underscore_normalization": false,
20
21 // force py36 syntax mode
22 "black_py36": null,
23
24 // ##########################
25 // Sublack specific options #
26 // ##########################
27
28 // full path and command to run black
29 "black_command": "/Users/sadanand/anaconda3/envs/py3.7-dev/bin/black",
30
31 // run black before saving document
32 "black_on_save": true,
33
34 // set debug mode. default is info.
35 // choices : debug > info > error
36 "black_log": "info",
37
38 // default encoding for never saved file, if not specified un first 2 lines (pep 263):
39 // default is "utf-8". Change this only if you want override default behaviour.
40 "black_default_encoding": "utf-8",
41
42 // use blackd server instead of black
43 "black_use_blackd": false,
44
45 // blackd server host
46 "black_blackd_host": "localhost",
47
48 // blackd server port, default is like black, should be string
49 "black_blackd_port": "45484",
50
51 // Start blackdserver on start. shuts down at sublimetext exit.
52 "black_blackd_autostart": false,
53
54 // Use pre-commit if possible
55 "black_use_precommit": false,
56
57 // Disable formatll command
58 "black_confirm_formatall": false
59}

rsub is an implementation of TextMate 2’s rmate feature for Sublime Text, allowing files to be edited on a remote server using ssh port forwarding / tunneling. Please make sure you have installed a version of rmate and are using correct port forwarding.

SidebarEnhancements Provides enhancements to the operations on Sidebar of Files and Folders for Sublime Text. The main features are:

  • Provides delete as “move to trash”, open with.. and a clipboard.
  • Close, move, open and restore buffers affected by a rename/move command (even on folders).
  • Provides new file/folder, edit, open/run, reveal, find in selected/parent/project, cut, copy, paste, paste in parent, rename, move, delete, refresh etc.
  • Provides copy paths as URIs, URLs, content as UTF8, content as data:uri base64 ( nice for embedding into CSS! ), copy as tags img/a/script/style, duplicate etc.
  • Allows to display “file modified date” and “file size” on status bar.

FileIcons is a further enhancement to SidebarEnhancements plugin to provide fancy icons for different types of files and folders. Please follow instructions to make it work for your theme.

SublimeLinter and SublimeLinter-flake8 is plug-in that provides an interface to flake8. It will be used with files that have the Python syntax. SublimeLinter addon black for flake is tiny add-on package to make sublack fully compatible with flake linter.

1// SublimeLinter Settings - User
2{
3 "linters": {
4 "flake8": {
5 "executable": "/Users/sadanand/anaconda3/envs/py3.7-dev/bin/flake8",
6 "args": ["--max-line-length=99", "--exclude=.git,__pycache__,.direnv,node_modules"]
7 }
8 }
9}

Markdown Editing For writing markdown files, Agila theme provides alternative color schemes. We can take advantage of them by using the Markdown Editing package and modifying the user settings of MultiMarkdown.

1{
2 "auto_match_enabled": true,
3 "caret_extra_bottom": 3,
4 "caret_extra_top": 3,
5 "caret_style": "wide",
6 "color_scheme": "Packages/Agila Theme/Markdown/Oceanic Next Markdown.tmTheme",
7 "draw_centered": false,
8 "extensions": ["mmd", "md"],
9 "highlight_line": true,
10 "line_numbers": true,
11 "line_padding_bottom": 2,
12 "line_padding_top": 2,
13 "mde.auto_increment_ordered_list_number": true,
14 "mde.distraction_free_mode": {
15 "mde.keep_centered": true
16 },
17 "mde.keep_centered": false,
18 "mde.keymap_disable.fold_section": false,
19 "mde.keymap_disable.goto_next_heading": false,
20 "mde.keymap_disable.goto_previous_heading": false,
21 "mde.keymap_disable.list_back_links": true,
22 "mde.keymap_disable.make_page_reference": true,
23 "mde.keymap_disable.open_home_page": true,
24 "mde.keymap_disable.open_journal": true,
25 "mde.keymap_disable.open_page": true,
26 "mde.keymap_disable.reference_jump": false,
27 "mde.keymap_disable.reference_new_footnote": false,
28 "mde.keymap_disable.reference_new_inline_image": false,
29 "mde.keymap_disable.reference_new_inline_link": false,
30 "mde.keymap_disable.reference_new_reference": false,
31 "mde.keymap_disable.show_fold_all_sections": false,
32 "mde.lint": {
33 "disable": ["md013"],
34 "md003": "any",
35 "md004": "cyclic",
36 "md007": 0,
37 "md013": 0,
38 "md026": ".,;:!",
39 "md029": "any",
40 "md030": {
41 "ol_multi": 1,
42 "ol_single": 1,
43 "ul_multi": 1,
44 "ul_single": 1
45 },
46 "mdl": {
47 "additional_arguments": [],
48 "executable": ""
49 }
50 },
51 "mde.list_indent_auto_switch_bullet": true,
52 "mde.list_indent_bullets": ["*", "-", "+"],
53 "mde.match_header_hashes": false,
54 "mde.wikilinks.homepage": "HomePage",
55 "mde.wikilinks.markdown_extension": ".md",
56 "mde.wikilinks.templates": {
57 "default_page": "templates/PageTemplate.md"
58 },
59 "rulers": [100],
60 "tab_size": 4,
61 "translate_tabs_to_spaces": true,
62 "trim_trailing_white_space_on_save": false,
63 "word_wrap": true,
64 "wrap_width": 99
65}

Shortcut Keys

Here is a summary of my key map:

1[
2 { "keys": ["shift+alt+a"], "command": "find_all_under" },
3 { "keys": ["control+v"], "command": "paste_and_indent" },
4 { "keys": ["control+shift+v"], "command": "paste" },
5 { "keys": ["ctrl+alt+;"], "command": "alignment" },
6 {
7 "keys": ["alt+shift+up"],
8 "command": "column_select",
9 "args": { "by": "lines", "forward": false }
10 },
11 {
12 "keys": ["alt+shift+down"],
13 "command": "column_select",
14 "args": { "by": "lines", "forward": true }
15 },
16 {
17 "keys": ["alt+shift+pageup"],
18 "command": "column_select",
19 "args": { "by": "pages", "forward": false }
20 },
21 {
22 "keys": ["alt+shift+pagedown"],
23 "command": "column_select",
24 "args": { "by": "pages", "forward": true }
25 },
26 {
27 "keys": ["alt+shift+home"],
28 "command": "column_select",
29 "args": { "by": "all", "forward": false }
30 },
31 {
32 "keys": ["alt+shift+end"],
33 "command": "column_select",
34 "args": { "by": "all", "forward": true }
35 }
36]

Theme and Color Scheme

I like a simple and clean UI for my editors. guna provides the perfect minimal theme that is adaptive to any color scheme you prefer. I prefer color schemes from the agila theme. The settings related to this can be found in my settings below.

User Settings / Preferences

Here is my complete set of settings for Sublime Text. Please feel free to leave comments below for any questions or suggestions.

1{
2 "always_show_minimap_viewport": true,
3 "auto_complete": true,
4 "bold_folder_labels": true,
5 "caret_extra_width": 1.5,
6 "color_scheme": "Packages/Agila Theme/Agila Oceanic Next.tmTheme",
7 "default_line_ending": "unix",
8 "drag_text": false,
9 "draw_white_space": "all",
10 "enable_tab_scrolling": false,
11 "font_face": "Roboto Mono",
12 "font_options": ["directwrite", "gray_antialias", "subpixel_antialias"],
13 "font_size": 16,
14 "hot_exit": false,
15 "ignored_packages": ["C++", "Markdown", "Vintage"],
16 "indent_guide_options": ["draw_normal", "draw_active"],
17 "line_padding_bottom": 3,
18 "line_padding_top": 3,
19 "overlay_scroll_bars": "enabled",
20 "remember_open_files": false,
21 "rulers": [100],
22 "scroll_past_end": true,
23 "soda_classic_tabs": true,
24 "soda_folder_icons": true,
25 "tab_completion": false,
26 "tab_size": 4,
27 "theme": "Guna.sublime-theme",
28 "translate_tabs_to_spaces": true,
29 "trim_trailing_white_space_on_save": true,
30 "word_wrap": true
31}

A Note From The Author

I write free resources for people learning machine learning, deep learning and programming. I turn down everyone who offers to put ads, affiliate links, and sponsored posts on my website.

Be the first to receive my latest content with the ability to opt-out at anytime.

More articles from reckoning.dev

My Deep Learning Workstation Setup

Lately, a lot of my friends have been asking about my deep learning workstation setup. In this post I am going to describe my hardware, OS…

December 31st, 2018 · 5 min read

Updating GatsbyJS Looks: A New Home with A New Look

First of all, apologies for a sudden update of the domain name - from datasciencevision.com to the new address reckoning.dev ! I let the…

September 2nd, 2019 · 3 min read
© 2014–2020 reckoning.dev
Link to $https://twitter.com/reckoningdevLink to $https://github.com/sadanand-singhLink to $https://www.linkedin.com/in/sadanandsingh/Link to $https://stackoverflow.com/users/13244305/reckoningdevLink to $https://www.facebook.com/sadanand4singh