sublime text 2 有两种安装方式,一种是添加软件源,然后用命令安装。另外一种是下载安装包。解压手动安装。Sublime Text 2 入门及技巧
一、下载安装
1、在Sublime Text 2官方下载相应的版本
2、解压tar.bz2安装包
tar xf Sublime\ Text\ 2.0.\ x64.tar.bz2
3、把解压后的文件夹移动到/opt/目录下
sudo mv Sublime\ Text\ /opt/
4、添加软链接
sudo ln -s /opt/Sublime\ Text\ /sublime_text /usr/bin/sublime
5、在Launcher栏上添加Sublime图标
新建并编辑文件
sudo sublime /usr/share/applications/sublime.desktop
写入以下内容
[Desktop Entry]
Version=1.0
Name=Sublime Text
# Only KDE seems to use GenericName, so we reuse the KDE strings.
# From Ubuntu's language-pack-kde-XX-base packages, version 9.04-20090413.
GenericName=Text Editor Exec=sublime
Terminal=false
Icon=/opt/Sublime Text /Icon/48x48/sublime_text.png
Type=Application
Categories=TextEditor;IDE;Development
X-Ayatana-Desktop-Shortcuts=NewWindow [NewWindow Shortcut Group]
Name=New Window
Exec=sublime -n
TargetEnvironment=Unity
6、设置默认使用Sublime打开文件,在以下文件中找到gedit.desktop并用sublime.desktop替换,根据需要替换不同的文件默认打开程序
sudo sublime /usr/share/applications/defaults.list
7、需要进行配置,要不然在Sublime上执行Python命令时提示(IOError: [Errno 13] Permiso denegado: u'/home/housepc/.config/sublime-text-2/Installed Packages/Package Control.sublime-package' permiso denegado : "permission denied" )
更改文件权限
sudo chmod -R "/home/{youruser}/.config/sublime-text-2/Installed Packages/"
或者更改属主
sudo chown -R {youruser}:{youruser} "/home/{youruser}/.config/sublime-text-2"
二、使用源安装
依次执行命令
sudo add-apt-repository ppa:webupd8team/sublime-text-
sudo apt-get update
sudo apt-get install sublime-text
三、安装Package Control
Package Control,在打开 Sublime Text 2以后,按下快捷键 Ctrl + `,打开命令窗行,`这个按键在Tab键的上面。输入以下内容,并回车:
import urllib2,os; pf='Package Control.sublime-package'; ipp=sublime.installed_packages_path(); os.makedirs(ipp) if not os.path.exists(ipp) else None; urllib2.install_opener(urllib2.build_opener(urllib2.ProxyHandler())); open(os.path.join(ipp,pf),'wb').write(urllib2.urlopen('http://sublime.wbond.net/'+pf.replace(' ','%20')).read()); print 'Please restart Sublime Text to finish installation'
参考文档:
- http://www.cnblogs.com/yourihua/archive/2012/06/04/2529333.html
- http://www.technoreply.com/how-to-install-sublime-text-2-on-ubuntu-12-04-unity/
- http://askubuntu.com/questions/172698/how-do-i-install-sublime-text-2
- http://songfantasy.iteye.com/blog/1536184
- http://*.com/questions/12284166/cant-install-package-control-in-sublime-text-2