如何在 Ubuntu 上安装 Sublime Text 编辑器


Sublime Text 是一款跨平台的源代码编辑器,具有 Python 应用程序编程接口 (API)。它原生支持许多编程语言和标记语言,并且其功能可以通过用户使用插件进行扩展,这些插件通常由社区构建和维护,并根据自由软件许可证发布。

本文介绍了“如何在 Ubuntu 上安装 Sublime Text 编辑器”。

功能

  • 并排编辑文件。

  • 它支持所有平台。

  • 它提供使用正则表达式查找和替换的功能。

  • 命令面板提供了对功能的快速访问。

  • “快速跳转”,快速导航到文件、符号或行。

  • 基于 Python 的插件 API。

  • 兼容 TextMate 的许多语言语法。

安装 Sublime

Sublime Text 有两个版本可供安装,要安装 Sublime 2,请使用以下命令 -

$ sudo add-apt-repository ppa:webupd8team/sublime-text-2

示例输出应如下所示 -

Sublime Text 2 packages - the .deb will automatically download the latest build from https://text.sublime.net.cn/dev or beta from https://text.sublime.net.cn/2 (Adobe Flash Player installer - style).

More info and feedback:
http://www.webupd8.org/2011/03/sublime-text-2-ubuntu-ppa.html
http://www.webupd8.org/2012/03/sublime-text-2-ppa-separate-development.html
   More info: https://launchpad.net/~webupd8team/+archive/ubuntu/sublime-text-2
Press [ENTER] to continue or ctrl-c to cancel adding it

gpg: keyring `/tmp/tmpsv1jnez9/secring.gpg' created
gpg: keyring `/tmp/tmpsv1jnez9/pubring.gpg' created
gpg: requesting key EEA14886 from hkp server keyserver.ubuntu.com
gpg: /tmp/tmpsv1jnez9/trustdb.gpg: trustdb created
gpg: key EEA14886: public key "Launchpad VLC" imported
gpg: no ultimately trusted keys found
gpg: Total number processed: 1
gpg:                imported: 1 (RSA: 1)
OK

要更新软件包索引,请使用以下命令 -

$ sudo apt-get update

示例输出应如下所示 -

Ign http://dl.google.com stable InRelease
Hit http://dl.google.com stable Release.gpg
Hit http://dl.google.com stable Release
Ign http://extras.ubuntu.com trusty InRelease
Get:1 http://security.ubuntu.com trusty-security InRelease [65.9 kB]
Hit http://dl.google.com stable/main amd64 Packages
Hit http://extras.ubuntu.com trusty Release.gpg
Hit http://extras.ubuntu.com trusty Release
Hit http://extras.ubuntu.com trusty/main Sources
Get:2 http://security.ubuntu.com trusty-security/main Sources [109 kB]
Hit http://extras.ubuntu.com trusty/main amd64 Packages
Get:3 http://ppa.launchpad.net trusty InRelease [15.5 kB]
Hit http://extras.ubuntu.com trusty/main i386 Packages
Get:4 http://security.ubuntu.com trusty-security/restricted Sources [4,035 B]
Hit http://ppa.launchpad.net trusty InRelease
Get:5 http://security.ubuntu.com trusty-security/universe Sources [34.0 kB]
Ign http://ppa.launchpad.net trusty InRelease
Ign http://in.archive.ubuntu.com trusty InRelease
Hit http://ppa.launchpad.net trusty InRelease
Get:6 http://security.ubuntu.com trusty-security/multiverse Sources [2,750 B]
Ign http://ppa.launchpad.net trusty InRelease
Get:7 http://security.ubuntu.com trusty-security/main amd64 Packages [444 kB]
Ign http://ppa.launchpad.net trusty InRelease
Get:8 http://ppa.launchpad.net trusty/main amd64 Packages [739 B]
Get:9 http://ppa.launchpad.net trusty/main i386 Packages [753 B]
Get:10 http://ppa.launchpad.net trusty/main Translation-en [357 B]
Ign http://extras.ubuntu.com trusty/main Translation-en_IN
Hit http://ppa.launchpad.net trusty/main amd64 Packages
Get:11 http://in.archive.ubuntu.com trusty-updates InRelease [65.9 kB]
Ign http://extras.ubuntu.com trusty/main Translation-en
Hit http://ppa.launchpad.net trusty/main i386 Packages
Hit http://ppa.launchpad.net trusty/main Translation-en
Get:12 http://security.ubuntu.com trusty-security/restricted amd64 Packages [13.0 kB]
Hit http://ppa.launchpad.net trusty Release.gpg
Get:13 http://security.ubuntu.com trusty-security/universe amd64 Packages [125 kB]
Hit http://ppa.launchpad.net trusty/main amd64 Packages
Hit http://ppa.launchpad.net trusty/main i386 Packages
Hit http://ppa.launchpad.net trusty/main Translation-en
Get:14 http://security.ubuntu.com trusty-security/multiverse amd64 Packages [4,991 B]
Hit http://ppa.launchpad.net trusty Release.gpg
Get:15 http://security.ubuntu.com trusty-security/main i386 Packages [417 kB]
Get:16 http://ppa.launchpad.net trusty Release.gpg [316 B]
Hit http://ppa.launchpad.net trusty Release
................................................................

要安装 Sublime Text 编辑器,请使用以下命令 -

$ sudo apt-get install sublime-text

示例输出应如下所示 -

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
   gtk2-engines-pixbuf libbs2b0 libopusfile0 libpyside1.2 libqmmp-misc
   libqmmpui0 libshiboken1.2 libsidplayfp libtidy-0.99-0 linux-headers-4.2.0-27
   linux-headers-4.2.0-27-generic linux-image-4.2.0-27-generic
   linux-image-extra-4.2.0-27-generic linux-signed-image-4.2.0-27-generic
   php7.0-opcache python-beautifulsoup python-feedparser python-html2text
   python-magic python-oauth2 python-pyside.qtcore python-pyside.qtgui
   python-pyside.qtnetwork python-pyside.qtwebkit python-pysqlite2 python-regex
   python-sqlalchemy python-sqlalchemy-ext python-support python-unity-singlet
   python-utidylib
Use 'apt-get autoremove' to remove them.
The following NEW packages will be installed:
   sublime-text
0 upgraded, 1 newly

要安装 Sublime 3,请使用以下命令 -

$ sudo add-apt-repository ppa:webupd8team/sublime-text-3
$ sudo apt-get update
$ sudo apt-get install sublime-text-installer

要打开 Sublime,请使用以下命令 -

$ subl

示例输出应如下所示 -

恭喜!现在,您已经了解了“如何在 Ubuntu 上安装 Sublime Text 编辑器”。我们将在下一篇文章中学习更多关于这些类型命令的知识。继续关注!

更新于: 2020年1月22日

474 次浏览

开启您的 职业生涯

通过完成课程获得认证

开始学习
广告