本文共 2584 字,大约阅读时间需要 8 分钟。
本地下载:
Install the GPG key:
wget -qO - https://download.sublimetext.com/sublimehq-pub.gpg | sudo apt-key add -
Ensure apt is set up to work with https sources:
sudo apt-get install apt-transport-https
Select the channel to use:
Stableecho "deb https://download.sublimetext.com/ apt/stable/" | sudo tee /etc/apt/sources.list.d/sublime-text.list
Dev
echo "deb https://download.sublimetext.com/ apt/dev/" | sudo tee /etc/apt/sources.list.d/sublime-text.list
Update apt sources and install Sublime Text
sudo apt-get updatesudo apt-get install sublime-text
import urllib.request,os; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); open(os.path.join(ipp, pf), 'wb').write(urllib.request.urlopen( 'http://sublime.wbond.net/' + pf.replace(' ','%20')).read())
将这样的操作和一个按键如F1绑定后,就会方便很多啦
e.g.打开Preferences->Key Bindings-User,复制以下代码:F1:运行Py程序;F2:打开Python Shell{"keys":["f2"], "caption": "SublimeREPL: Python", "command": "run_existing_window_command", "args": {"id": "repl_python", "file": "config/Python/Main.sublime-menu"}}, {"keys":["f1"], "caption": "SublimeREPL: Python - RUN current file", "command": "run_existing_window_command", "args": {"id": "repl_python_run", "file": "config/Python/Main.sublime-menu"}}
Sublime Text 是一款既简洁又强大的文本编辑器,然而其默认采用UTF8编码,这就造成了许多采用GBK编码的文件里的中文显示为乱码。
import urllib.request,os; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); open(os.path.join(ipp, pf), 'wb').write(urllib.request.urlopen( 'http://sublime.wbond.net/' + pf.replace(' ',' ')).read())
顺利的话,此时就可以在Preferences菜单下看到Package Settings和Package Control两个菜单了
转载地址:http://syvul.baihongyu.com/