However, I am still not satisfied with the code "tip assist" plugin in Sublime.
For this point, I would recommend Wing IDE since this is the only one I tried with acceptable "tip assist" functionality.
Setting up Sublime Text for Python development
Why Sublime Text?
Font choice
Installed plug-ins
apt-get
of Sublime packages.alt
and then clicking on a symbol. Very handy..py
files whenever they’re saved and displays pylint violations directly in the editor view. It also has a convenient shortcut that locally disables a pylint check by inserting a #pylint: disable
comment. This plug-in really sealed the deal for me.
Preferences files
Preferences.sublime-settings
configures Sublime’s look-and-feel and its built-in behavior. You can open the file for editing within Sublime via Preferences > Settings — User. I’m using the following settings:{
// Colors
"color_scheme": "Packages/Tomorrow Color Schemes/Tomorrow-Night.tmTheme",
"theme": "Soda Dark.sublime-theme",
// Font
"font_face": "Ubuntu Mono",
"font_size": 16.0,
"font_options": ["subpixel_antialias", "no_bold"],
"line_padding_bottom": 0,
"line_padding_top": 0,
// Cursor style - no blinking and slightly wider than default
"caret_style": "solid",
"wide_caret": true,
// Editor view look-and-feel
"draw_white_space": "all",
"fold_buttons": false,
"highlight_line": true,
"auto_complete": false,
"show_minimap": false,
// Editor behavior
"scroll_past_end": false,
"highlight_modified_tabs": true,
"find_selected_text": true,
// Word wrapping - follow PEP 8 recommendations
"rulers": [ 72, 79 ],
"word_wrap": true,
"wrap_width": 80,
// Whitespace - no tabs, trimming, end files with \n
"tab_size": 4,
"translate_tabs_to_spaces": true,
"trim_trailing_white_space_on_save": true,
"ensure_newline_at_eof_on_save": true,
// Sidebar - exclude distracting files and folders
"file_exclude_patterns":
[
".DS_Store",
"*.pid",
"*.pyc"
],
"folder_exclude_patterns":
[
".git",
"__pycache__",
"env",
"env3"
]
}
Pylinter.sublime-settings
configures the pylinter plug-in. I use the following settings to lint Python files automatically on save and to display graphical icons for lint violations:{
// Configure pylint's behavior
"pylint_rc": "/Users/daniel/dev/pylintrc",
// Show different icons for errors, warnings, etc.
"use_icons": true,
// Automatically run Pylinter when saving a Python document
"run_on_save": true,
// Don't hide pylint messages when moving the cursor
"message_stay": true
}
Key bindings
sublime-keymap
preferences files. I’ve made a few changes to the default bindings to better serve my existing TextMate / IntelliJ muscle memory. You may not need to make changes to the key bindings at all. But if you want to, modifying them is very easy and transferable across platforms. I use the following additional key bindings:[
// Rebind "go to file" to cmd+shift+O
{ "keys": ["super+shift+o"], "command": "show_overlay", "args": {
"overlay": "goto",
"show_files": true
}},
// Rebind swap line up/down to cmd+shift+up/down
{ "keys": ["super+shift+up"], "command": "swap_line_up" },
{ "keys": ["super+shift+down"], "command": "swap_line_down" },
// Delete a line with cmd+delete
{ "keys": ["super+backspace"], "command": "run_macro_file", "args": {
"file": "Packages/Default/Delete Line.sublime-macro"
}},
// Reindent selection with cmd+alt+L
{ "keys": ["super+alt+l"], "command": "reindent"}
]
Command line tools
mate
, Sublime Text includes a command line tool that allows you to open the editor from the shell. The tool called subl
is not enabled by default. To make it available from any shell do the following:ln -s /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl /usr/local/bin/subl
~/.profile
:export GIT_EDITOR="subl --wait --new-window"
Further inspiration
Autocomplete with Trie Tree -- code in python
10 years ago
Post a Comment