赞
踩
Sublime Text is an awesome text editor. If you’ve never heard of it, you should check it out right now.
I’ve made this tutorial because there’s no installer for the Linux versions of Sublime Text. While that’s not a real problem, I feel there is a cleaner way to go around this. Also, this post will show you how to integrate Sublime Text to Unity (which, I’m glad to report, has now matured into a fully functional user interface).
So let’s get on with this. Here is my how to install Sublime Text on Ubuntu tutorial.
[This tutorial has been updated following feedback from AskUbuntu. Also, you need to do these steps using your login. Do not start by typing "sudo -s"!]
Download the tarfile that suits you best and extract it. Here’s the command to extract tar.bz2 files:
1.
tar
xf Sublime\ Text\ 2.0.1\ x64.
tar
.bz2
You’ll notice that I got the 64-bit version. The reason is that it’s lightning fast. So, go for that if you can!
You’ll get a “Sublime Text 2″ folder after extraction. This folder contains all the files that Sublime Text will need. So we have to move that folder somewhere more appropriate. Like the “/opt/” folder :
1.
sudo
mv
Sublime\ Text\ 2 /opt/
At some point you’d want to be able to call Sublime Text from the Terminal by just typing “sublime”. To do that, we’ll just create a symbolic link in “/usr/bin” like thus:
1.
sudo
ln
-s /opt/Sublime\ Text\ 2/sublime_text /usr/bin/sublime
Now that our files are at the right place, we need to create a launcher in Unity. To do this, we’re going to create a .desktop file in “/usr/share/applications”:
1.
sudo
sublime /usr/share/applications/sublime.desktop
And paste the following content:
[Desktop Entry]
Version=1.0
Name=Sublime Text 2
# Only KDE 4 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 2/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

Now you would probably want to open all text files with Sublime Text 2. The easiest way to do that is to open up the file associations list:
1.
sudo
sublime /usr/share/applications/defaults.list
And replace all occurrences of gedit.desktop with sublime.desktop.
转载地址:http://www.technoreply.com/how-to-install-sublime-text-2-on-ubuntu-12-04-unity/
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。