Sublime Text 3 As Python IDE
Install Package Control
- Copy the Python code for Sublime Text 3 from here, click
View->Show Console
to open the ST3 console, Paste the code into the console, press Enter. Reboot ST3.
- Press
CMD + Shift + P
, and typingInstall Package
, and Press Enter. - Click
Sublime Text -> Preferences -> Settings-User
, to add
- Click
Sublime Text -> Preferences -> Settings -> Syntax Specific -User
, then add the following
1
2
3
4
5
6
7
8
9
10
11
12
13
14
{
// editor options
"draw_white_space": "all",
// tabs and whitespace
"auto_indent": true,
"rulers": [79],
"smart_indent": true,
"tab_size": 4,
"trim_automatic_white_space": true,
"use_tab_stops": true,
"word_wrap": true,
"wrap_width": 80
}
Then save the file as Python.sublime-settings
- Install Package
Soda Dark Theme
andFlatland
- Update the settings through
Sublime Text -> Preferences -> Settings User
:
1
2
3
4
{
"theme": "Flatland Dark.sublime-theme",
"color_scheme": "Packages/Theme - Flatland/Flatland Dark.tmTheme"
}
- Install SideBarEnhancements using Package Control
- Install Anacoda, the IDE-like features for Python, and set Anacoda.sublime-settings
Sublime Text -> Preferences -> Package Settings -> Anaconda --> Settings-User
as:
1
2
3
{
"anaconda_linting": false
}
Install Python environment with MiniConda
- Download Miniconda
- Install
sh Miniconda2-latest-MacOSX-x86_64.sh
- Create & User python Environment version 2.7
conda create --name python27 python=2.7
source activate python27
python --version
(deactivate)
- Use
which python
to get the path of python for future use. - Update the settings for Anacoda Plugin to use Python27 as:
1
2
3
4
{
"anaconda_linting": false,
"python_interpreter": "~/miniconda2/envs/python27/bin/python"
}
Install Syntac Checker and ST3 Plugins
- Install Syntax Checker
pyflakes
andpycodestyle
pip install pyflakes
pip install pycodestyle
- Install Syntax Checker ST3 Plugins
SublimeLinter-pyflakes
andSublimeLinter-pycodestyle
andSublimeLinter-json
using Package Control - Customize the linter settings
Sublime Text -> Preferences -> Package Settings -> SublimeLinter -> Settings-User
, add the follow code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// SublimeLinter Settings - User
{
"debug": false,
"linters":{
"pycodestyle": {
"disable": false,
"args": [],
"excludes": [],
"ignore": "E501,C0301,W0142,W0402,R0201,E1101,E1102,C0103,R0901,R0903,R0904,C1001,W0223,W0232,W0201,E1103,R0801,C0111",
"max-line-length": 80,
"select": ""
}
},
"paths": {
"linux": [],
"osx": ["~/miniconda2/envs/python27/bin"],
"windows": []
}
}
Keyboard Shortcut
- Goto Anything:
CMD + P
- Goto LineNumber:
^Ctrl + G
- Goto Symbol:
CMD + R
Install TerminalView
with Package Control
- Set the key binding:
1
2
3
4
[
{ "keys": ["ctrl+shift+t"], "command": "terminal_view_open" }
]
Install SFTP
with Package Control
- Right Click a folder name on the sidebar, select
SFTP/FTP -> Add Remote Mapping...
, to add a mapping file namedsftp-config.json
in the folder. - Edit fields accordingly, e.g.:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
{
// sftp, ftp or ftps
"type": "sftp",
"save_before_upload": true,
"upload_on_save": true,
"sync_down_on_open": true,
"sync_skip_deletes": false,
"sync_same_age": true,
"confirm_downloads": false,
"confirm_sync": true,
"confirm_overwrite_newer": false,
"host": "aaaaaaaaa",
"user": "xxxxx",
"password": "yyyyyy",
"port": "22",
"remote_path": "/u/pandu/pyspace/health/analyzer/"
}
Once the SFTP is set, one can edit locally and upload to remote server automatically, and debug on the remote server.
Modify the font size of ST3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
{
"auto_complete": false,
"color_scheme": "Packages/Theme - Flatland/Flatland Dark.tmTheme",
"font_size": 11,
"ignored_packages":
[
"Vintage"
],
"sublimelinter": false,
"tab_size": 2,
"theme": "Flatland Dark.sublime-theme",
"ui_scale": 1.3,
"word_wrap": true
}
Install sshpass
- Install
Homebrew
with
- Install
sshpass
- Settings
mkdir .bin
cat password > x
vim loginx
- save and quit
:q
chmod a+x loginx
- add
export PATH="~/.bin:$PATH"
into ~/.bash_profile source ~/.bash_profile
loginx
to connect
Iterm2 Prompt Color Scheme
- Set Color
- Set Hostname
Sublime Text 3 shortcut
- Creat a Symbol link to the binary file
$ ln -s /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl ~/.bin/subl
- Open a folder of file
$ subl ~/Documents/test
References
- https://realpython.com/setting-up-sublime-text-3-for-full-stack-python-development/
- https://conda.io/docs/user-guide/getting-started.html#managing-python
- https://conda.io/miniconda.html
- http://www.sublimetext.com/docs/3/osx_command_line.html