Books / Setting Up Development Environment on macOS / Chapter 9
Sublime Text
What is Sublime Text?
Sublime Text is a widely used editor that describes it self as a sophisticated text editor for code, markup and prose.
Installation
Install using Homebrew:
brew install --cask sublime-text
Or download the .dmg file and drag-and-drop it to the Applications folder.
Use CLI to open file
Let’s create a shortcut through which we can launch Sublime Text from the command-line
ln -s /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl /usr/local/bin/subl
Now you can open a file with subl myfile.py
or start a new project in the current directory with subl .
.
Pricing
Sublime Text is not free but it has an unlimited evaluation period that comes with notification pop-ups asking you to buy it, if you wish to remove the pop-ups you can purchase the tool here.
Preferences
This is an example of User Settings for a basic development but please feel free to modify or update as per your choice.
{
"auto_complete_delay": 5,
"auto_complete_selector": "source, text",
"color_scheme": "Packages/User/Monokai (SL).tmTheme",
"create_window_at_startup": false,
"folder_exclude_patterns":
[
".svn",
".git",
".DS_Store",
"__pycache__",
"*.pyc",
"*.pyo",
"*.exe",
"*.dll",
"*.obj",
"*.o",
"*.a",
"*.lib",
"*.so",
"*.dylib",
"*.ncb",
"*.sdf",
"*.suo",
"*.pdb",
"*.idb",
"*.psd"
],
"font_face": "Source Code Pro",
"font_size": 13,
"ignored_packages":
[
"Markdown",
"Vintage"
],
"open_files_in_new_window": false,
"rulers":
[
80
],
"translate_tabs_to_spaces": true,
"word_wrap": true
}
Packages
Install Package Control
The simplest method of installation is through the Sublime Text console. The console is accessed via View > Show Console
menu. Once open, paste the appropriate Python code for your version of Sublime Text into the console.
This snippet changes each version and older versions will return an error.
To get the current versions code, go to packagecontrol.io
SublimeLinter Settings
{
"user": {
"debug": false,
"delay": 0.25,
"error_color": "D02000",
"gutter_theme": "none",
"gutter_theme_excludes": [],
"lint_mode": "background",
"linters": {
"pep8": {
"@disable": false,
"args": [],
"disable": "",
"enable": "",
"excludes": [],
"ignore": "",
"max-line-length": null,
"rcfile": "",
"select": ""
}
},
"mark_style": "outline",
"no_column_highlights_line": false,
"paths": {
"linux": [],
"osx": [
"/usr/local/bin/"
],
"windows": []
},
"python_paths": {
"linux": [],
"osx": [
"/usr/local/bin/"
],
"windows": []
},
"rc_search_limit": 3,
"shell_timeout": 10,
"show_errors_on_save": false,
"show_marks_in_minimap": true,
"syntax_map": {
"html (django)": "html",
"html (rails)": "html",
"html 5": "html",
"php": "html",
"python django": "python"
},
"warning_color": "DDB700",
"wrap_find": true
}
}