安装sublime-text-3

添加sublime text 3的仓库:
sudo add-apt-repository ppa:webupd8team/sublime-text-3
根据提示按ENTER 继续,建立信任数据库

更新软件库
sudo apt update

安装Sublime Text 3
sudo apt install sublime-text-installer
等待软件安装成功……

安装Packeage Control(这步开始出现问题

第一种解决方法(在我这不成功)

在bash中输入subl后,按ctrl + `,调出命令输入窗口,然后输入以下命令。

1
2
3
4
5
6
7
8
import urllib.request,os,hashlib;
h = '2915d1851351e5ee549c20394736b442' + '8bc59f460fa1548d1514676163dafc88';
pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path();
urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) );
by = urllib.request.urlopen( 'http://packagecontrol.io/' + pf.replace(' ', '%20')).read();
dh = hashlib.sha256(by).hexdigest();
print('Error validating download (got %s instead of %s), please try manual install' % (dh, h))
if dh != h else open(os.path.join( ipp, pf), 'wb' ).write(by)

但是我这里尝试这种方法不成功,调试信息如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
File "./python3.3/urllib/request.py", line 1248, in do_open
File "./python3.3/http/client.py", line 1065, in request
File "./python3.3/http/client.py", line 1103, in _send_request
File "./python3.3/http/client.py", line 1061, in endheaders
File "./python3.3/http/client.py", line 906, in _send_output
File "./python3.3/http/client.py", line 844, in send
File "./python3.3/http/client.py", line 822, in connect
File "./python3.3/socket.py", line 435, in create_connection
File "./python3.3/socket.py", line 426, in create_connection
ConnectionRefusedError: [Errno 111] Connection refused

File "/home/dlyman/.config/sublime-text-3/Packages/tern_for_sublime/tern.py", line 264, in f
req = opener.open("http://" + localhost + ":" + str(port) + "/", json.dumps(doc).encode("utf-8"), 1)
File "./python3.3/urllib/request.py", line 469, in open
File "./python3.3/urllib/request.py", line 487, in _open
File "./python3.3/urllib/request.py", line 447, in _call_chain
File "./python3.3/urllib/request.py", line 1274, in http_open
File "./python3.3/urllib/request.py", line 1251, in do_open
urllib.error.URLError: <urlopen error [Errno 111] Connection refused>

手动进行安装

需要从git下载Package Control主文件到~/.config/sublime-text-3/Packages/

1
2
cd ~/.config/sublime-text-3/Packages/
git clone https://github.com/wbond/package_control_channel.git Package\ Control

然后进行下列步骤:

  1. 点击Preferences > Browse Packages菜单
  2. 进入打开的目录的上层目录,然后再进入Installed Packages目录
  3. 下载
    Package Control.sublime-package,并将该文件复制到Installed Packages目录
  4. 重启Sublime Text

解决无法输入中文问题

推荐的解决方法

  • Update and then upgrade your system to the newest
1
sudo apt-get update && sudo apt-get upgrade
  • 把这个repo克隆到你的电脑 :
1
git clone https://github.com/lyfeyaj/sublime-text-imfix.git
  • sublime-text-imfix 目录:
1
cd sublime-text-imfix
  • 运行下面这条命令 :
1
./sublime-imfix
  • Done! 重启sublime即可完成

解决Sublime包管理Package Control 报错 There Are No Packages Available For Installation

解决1:

网上说是因为IPV6的问题,导致无法访问sublime的官网,于是在host中添加如下对应ip

1
2
#sublime
#50.116.34.243 sublime.wbond.net

如解决1没有解决这个问题可以去 查找其他解决方法

参考源