To get these to work in a fresh install of sublime
, you first need to install Package Control. The packages should then all install automatically.
There are some extras to install (mainly linters). This assumes Python 3.6+:
sudo apt-get install libxml2-utils
pip install mypy
pip install pylint
pip install yapf
- A File Icon - file-specific icons in the sidebar
- SideBarEnhancements - sidebar does loads more stuff
- Monokai Extended - More Monokai highlighting (also to get Rainbowth to work...)
- HighlightWords - custom highlighting of e.g. TODO or DEBUG
- InsertDate - insert current data/time (bind to keyboard shortcuts)
- MarkdownEditing - robust syntax highlighting for Markdown
- Markdown Extended - more different Markdown syntax highlighting (does a better job of inline code highlighting, worse at bullets)
- MarkdownPreview - allows for easy Markdown preview in the browser
- MarkdownTOC - adds Markdown table of contents
- PlainTasks - nice todo lists
- Pandoc - convert between different markup formats
- Table Editor - makes editing text tables much better
- Rainbowth - Rainbow parantheses for Lisps
- Parinfer - Smart parentheses for Lisps
- BracketHighlighter - matches and highlights a variety of brackets
- Generic Config - generic highlighting of config files
- Git - git integration
- GitGutter - see git diff in gutter
- SublimeREPL - run interpreter inside Sublime
- AutoDocstring - insert/update docstrings
- Sublime JEDI - Code intel for Python
- Python Fix Imports - gets imports correctly ordered and formatted
- PyYapf Python Formatter - runs the YAPF
Python formatter. Note that in order for it to not break with dictionary unpacking
**my_dict
you need the Python3.6+ version ofyapf
. See here for instructions on how to set up Python3.6 and pip3.6. Then just do
pip3 uninstall yapf
pip3.6 install yapf
whereis yapf
- SublimeLinter-pylint - because you need a Python linter
- Hooks - allows you to bind custom commands to Sublime hooks
- Package Control - have to have this
- PackageResourceViewer - can view default snippets
- Carbon - making code snippets for presentations etc. (without having to print screen everything!)
As an example, consider running autoflake
on Python files you are editing. (autoflake
is a Python tool that trims used imports and variables.)
You will need the following Python script saved in your .config/sublime-text-3/Packages/User
folder (see here)
# autoflake.py
import sublime_plugin
import subprocess
class AutoflakeRemoveUnusedImportsCommand(sublime_plugin.TextCommand):
def run(self, edit, **kwargs):
subprocess.check_call([
# '/usr/local/bin/autoflake',
'/home/railton/environments/default_3/bin/autoflake',
'--in-place',
'--remove-all-unused-imports',
self.view.file_name(),
])
Append the following to Default.sublime-commands
to have it available via the command palette.
[
// ...
{ "caption": "Custom: Autoflake Remove Unused Imports", "command": "autoflake_remove_unused_imports" }
]
To do key binding, append the following to Default (Linux).sublime-keymap
:
[
// ...
{ "keys": ["ctrl+alt+g"], "command": "autoflake_remove_unused_imports",
"context": [
{ "key": "selector", "operator": "equal",
"operand": "source.python" }
]
}
]
To activate upon save you will need the Hooks
package, and to add the following to Preferences.sublime-settings
:
{
// ...
"on_post_save_user":
[
{
"command": "autoflake_remove_unused_imports"
}
],
}
N.B. don't actually do this as it can be pretty annoying - implementing it as a pre-commit hook is a much better idea (see this gist for more info).