Linux 从终端启动 Sublime 3,默认为 Sublime Text 2
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17644488/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Start Sublime 3 from terminal, when default is Sublime Text 2
提问by Joker
I am on Ubuntu 12.04 LTS. Calling sublime foo.txt
would normally open foo.txt
in Sublime Text 2. Recently I installed Sublime Text 3. In addition to this, I tried to remove Sublime Text 2 completely from my filesystem.
我在 Ubuntu 12.04 LTS 上。呼叫sublime foo.txt
通常会foo.txt
在 Sublime Text 2 中打开。最近我安装了Sublime Text 3。除此之外,我尝试从我的文件系统中完全删除 Sublime Text 2。
After doing this, my system still tries to open Sublime Text 2 when I use sublime
in my terminal. Clearly this is no good - because I removed Sublime Text 2. (at least partially).
I noticed the Sublime Text 2 icon is still in my applications list. If I try to remove it by clicking Uninstall
I get the following error:
执行此操作后,当我sublime
在终端中使用时,我的系统仍会尝试打开 Sublime Text 2 。显然这不好 - 因为我删除了 Sublime Text 2。(至少部分)。我注意到 Sublime Text 2 图标仍在我的应用程序列表中。如果我尝试通过单击将其删除,则会Uninstall
出现以下错误:
The files which should be removed are not part of any installed software.
The files which should be removed are not part of any installed software.
So how do I fully remove it from an Ubuntu system, and how do I make sublime
open Sublime Text 3?
那么如何从 Ubuntu 系统中完全删除它,以及如何sublime
打开 Sublime Text 3?
采纳答案by d_rail
When you run sublime
, your computer should run a bash file at /usr/bin/sublime(running which sublime
as Mike Li suggested will confirm the location. Open that up and edit it for Sublime Text 3. The contents of that file should be:
当你运行时sublime
,你的计算机应该在/usr/bin/sublime运行一个 bash 文件 (which sublime
按照 Mike Li 的建议运行将确认位置。打开它并为 Sublime Text 3 编辑它。该文件的内容应该是:
#!/bin/bash
/usr/lib/sublime-text-2/sublime_text --class=sublime-text-2 "$@"
Edit it as so: (On my computer the executable is called subime_text_3 instead of subime_text. Verifiy by opening /usr/lib/sublime-text-3.)
像这样编辑它:(在我的电脑上,可执行文件被称为 subime_text_3 而不是 subime_text。通过打开/usr/lib/sublime-text-3 来验证。)
#!/bin/bash
/usr/lib/sublime-text-3/sublime_text_3 --class=sublime-text-3 "$@"
Point it to the location of Sublime Text 3 on your system.
将其指向系统上 Sublime Text 3 的位置。
EditBuild 2221 (using the ppa) changed the installation directory from /usr/lib/sublime-text-2 to /opt/sublime_text_2
编辑Build 2221(使用ppa)将安装目录从 /usr/lib/sublime-text-2 更改为 /opt/sublime_text_2
回答by Alexandru Tetelea
sudo ln -s /opt/sublime_text/sublime_text /usr/bin/sublime
回答by Alexandru Tetelea
Type : sublin terminal to launch Sublime Text 3 from terminal.
在终端中键入 : subl以从终端启动 Sublime Text 3。
回答by Nirbhay Rana
No need to do extra configuration for this. Just use subl
commnad and it will open the sublime text editor.
无需为此做额外的配置。只需使用subl
commnad,它就会打开 sublime 文本编辑器。