Sublime Text解决输入中文问题

阅读更多

Centos下解决sublime2/3不能输入中文的问题

一、下载中文字体”YaHei.Consolas.1.12.Revise.ttf”

链接:https://pan.baidu.com/s/1f23zgItgK0DPuGd9dfywzA 密码:hcuh

二、复制字体及安装编译

  • mkdir -p /usr/share/fonts/truetype/
  • cd /usr/share/fonts/truetype
  • cp YaHei.Consolas.1.12.Revise.ttf ./
  • mkfontscale
  • mkfontdir
  • fc-cache -fv

三、设置字体

四、安装InputHelper

  1. 下载离线文件 链接:https://pan.baidu.com/s/1VB2YAcIlfpalw7AI1ngZxA 密码:01dh
  2. 解压到pSublime Text Build 3083 x64\Data\Packages安装目录下并命名InputHelper
  3. 重启Sublime。之后”Ctrl+Shift+Z”,调出对话框,切换输入法,即可输入中文。输入后按enter打印在sublime上

五、出现的问题

备注:使用Ctrl + `调出控制台

Step1:“Ctrl+Shift+Z”再看输出:

    Traceback (most recent call last):
  File "/opt/sublime_text/sublime_plugin.py", line 549, in run_
    return self.run(edit)
  File "/home/join/.config/sublime-text-3/Packages/InputHelper/inputhelper.py", line 21, in run
    proc = subprocess.Popen(args, stdout=subprocess.PIPE)
  File "X/subprocess.py", line 818, in __init__
  File "X/subprocess.py", line 1416, in _execute_child
  PermissionError: [Errno 13] Permission denied
  • chmod 777 sublime-text-3/Packages/InputHelper/lib/linux_text_input_gui.py

Step2:然后”Ctrl+Shift+Z”果真弹出了对话框,但Sublime UI阻塞,但是未响应
cd 进入/sublime-text-3/Packages/InputHelper/lib/
python2.6 linux_text_input_gui.py
输入内容后回车,看到如下错误:
AttributeError: ‘gtk.Entry’ object has no attribute ‘get_buffer’
Traceback (most recent call last):
File “linux_text_input_gui.py”, line 14, in destroy
self.print_text()
File “linux_text_input_gui.py”, line 9, in print_text
buffer = self.textInput.get_buffer()
AttributeError: ‘gtk.Entry’ object has no attribute ‘get_buffer’

如果centos安装的是python2.6安装pygtk模块的话,则用以下解决方式,查看linux_text_input_gui.py文件得知给”linux_text_input_gui.py”的”SimpleTextInput::print_text()”添加打印,看”self.textInput”的属性。直接有”get_text”,所以做如下修改:

 def print_text(self): 
    # buffer = self.textInput.get_buffer() 
    # print(buffer.get_text()) 
     print(self.textInput.get_text())

问题解决

原文:https://blog.csdn.net/u014087707/article/details/51813595?utm_source=copy

sublime3 for linux软件下载地址:
链接:https://pan.baidu.com/s/19S85JI6TZ4quWk4Q1l6DfA 密码:4sxe

 

你可能感兴趣的:(subline,text)