Linux 解决Sublime无法输入中文
<p> 在开始下面的操作之前,请下载我提供给大家的文件。地址:<a class="btn btn-success" href="https://pan.baidu.com/share/init?surl=mgTHQRY" target="_blank">点此下载</a> 密钥:<span style="color: rgb(255, 0, 0);">wg05</span>。</p><p style="text-indent: 2em;">另外,在我博客的另一篇文章《<a href="http://www.only2fire.com/archives/52.html" target="_blank"><span style="color: rgb(255, 0, 0);">Linux Sublime安装以及中文乱码解决</span></a>》,已经介绍了在Linux中如何安装Sublime以及解决了Sublime显示中文乱码的问题,大家可以去看看。</p><p style="text-indent: 2em;">在安装了Sublime之后,输入英文和数字是没有问题的,但是想要输入中文,却不能够完成,现在就给大家讲讲如何来解决这个问题(我的电脑安装的是搜狗输入法,具体的安装过程可以参考我的博文《<a href="http://www.only2fire.com/archives/47.html" target="_blank"><span style="color: rgb(255, 0, 0);">Fedora安装搜狗输入法</span></a>》)。</p><p class="artical_littlestyle1">1、编译sublime_imfix.c</p><p style="text-indent: 2em;">sublime_imfix.c文件是我提供给大家的,具体的内容可以自行查看,这里只讲讲怎么编译。执行命令:<span style="color: rgb(255, 0, 0);">gcc -shared -o libsublime-imfix.so sublime_imfix.c `pkg-config –libs –cflags gtk+-2.0` -fPIC</span>(如果出现如下的错误:<span style="color: rgb(255, 0, 0);">fatal error: gtk/gtkimcontext.h: 没有那个文件或目录</span>,那么只需要执行命令:<span style="color: rgb(255, 0, 0);">apt-get install libgtk2.0-dev</span>,之后再编译sublime_imfix.c文件即可),编译生成一个共享库<span style="color: rgb(255, 0, 0);">libsublime-imfix.so</span>。<br/></p><p style="text-indent: 2em;">将libsublime-imfix.so拷贝到sublime_text所在文件夹,执行如下命令:<br/></p><p style="text-indent: 2em;"><span style="color: rgb(255, 0, 0);">mv libsublime-imfix.so /opt/sublime_text</span><br/></p><p style="text-indent: 2em;">接着,修改文件/usr/bin/subl的内容:<br/></p><p style="text-indent: 2em;"><span style="color: rgb(255, 0, 0);">vim /usr/bin/subl</span>,修改的内容如下:<br/></p><p style="text-indent: 2em;"><span style="color: rgb(0, 112, 192);">#!/bin/sh<br/></span></p><p style="text-indent: 2em;"><span style="color: rgb(0, 112, 192);">exec /opt/sublime_text/sublime_text “$@”</span><br/></p><p style="text-indent: 2em;">修改为:<br/></p><p style="text-indent: 2em;"><span style="color: rgb(0, 112, 192);">#!/bin/sh<br/></span></p><p style="text-indent: 2em;"><span style="color: rgb(0, 112, 192);">LD_PRELOAD=/opt/sublime_text/libsublime-imfix.so exec /opt/sublime_text/sublime_text “$@”</span></p><p style="text-align:center"><img src="/uploads/AilsonJack/2018.08.25/1535182753380695.png" onclick="preview_image('/uploads/AilsonJack/2018.08.25/1535182753380695.png')"/></p><p class="artical_littlestyle2">2、修改sublime_text.desktop文件</p><p style="text-indent: 2em;"><span style="color: rgb(255, 0, 0);">vim /usr/share/applications/sublime_text.desktop</span><br/></p><p style="text-indent: 2em;">将[Desktop Entry]中的字符串<br/></p><p style="text-indent: 2em;"><span style="color: rgb(0, 112, 192);">Exec=/opt/sublime_text/sublime_text %F</span>,修改为:<br/></p><p style="text-indent: 2em;"><span style="color: rgb(0, 112, 192);">Exec=bash -c “LD_PRELOAD=/opt/sublime_text/libsublime-imfix.so exec /opt/sublime_text/sublime_text %F”</span><br/></p><p style="text-indent: 2em;">将[Desktop Action Window]中的字符串<br/></p><p style="text-indent: 2em;"><span style="color: rgb(0, 112, 192);">Exec=/opt/sublime_text/sublime_text -n</span>,修改为:<br/></p><p style="text-indent: 2em;"><span style="color: rgb(0, 112, 192);">Exec=bash -c “LD_PRELOAD=/opt/sublime_text/libsublime-imfix.so exec /opt/sublime_text/sublime_text -n”</span><br/></p><p style="text-indent: 2em;">将[Desktop Action Document]中的字符串<br/></p><p style="text-indent: 2em;"><span style="color: rgb(0, 112, 192);">Exec=/opt/sublime_text/sublime_text –command new_file</span>,修改为:<br/></p><p style="text-indent: 2em;"><span style="color: rgb(0, 112, 192);">Exec=bash -c “LD_PRELOAD=/opt/sublime_text/libsublime-imfix.so exec /opt/sublime_text/sublime_text –command new_file”</span><br/></p><p style="text-indent: 2em;">我修改完成后的截图如下:<br/></p><p style="text-align:center"><img src="/uploads/AilsonJack/2018.08.25/1535182753406647.png" onclick="preview_image('/uploads/AilsonJack/2018.08.25/1535182753406647.png')"/></p><p style="text-indent: 2em;">注意:修改时请注意双引号””,否则会导致不能打开带有空格文件名的文件。<br/></p><p style="text-indent: 2em;">此处仅修改了<span style="color: rgb(0, 112, 192);">/usr/share/applications/sublime-text.desktop</span>,但可以正常使用了,opt/sublime_text/目录下的sublime-text.desktop可以修改,也可不修改。<br/></p><p style="text-indent: 2em;">打开Sublime软件,切换到中文输入法,能够在Sublime中输入中文了吧。</p><p style="text-align: center;"><img src="/uploads/AilsonJack/2018.08.25/1535182753363861.png" onclick="preview_image('/uploads/AilsonJack/2018.08.25/1535182753363861.png')"/></p>
你可能也喜欢:
暂无评论,要不要来个沙发
发表评论
JLink V9掉固件修复(灯不亮) 3Zephyr笔记2 - 在STM32F429上运行HelloWorld 2计算NandFlash要传入的行地址和列地址 1Linux MMC子系统 - 6.eMMC 5.1工作模式-设备识别模式 0Linux MMC子系统 - 5.eMMC 5.1工作模式-引导模式 0Linux MMC子系统 - 4.eMMC 5.1常用命令说明(2) 0
标签云
Linux嵌入式实用技巧ARM内核学习问题集合CC++编程语言阅读笔记汇编Linux内核完全注释Windows驱动开发计算机基础ARM11ARMv7-ASTM32IDESublimeLinux内核学习eMMCMMC子系统Ubuntu操作系统OfficeVMWareAPUEgccRTOS中断漫游世界随笔感悟开发工具软件应用编程VsCodearmccarmclang编译器ZephyrSPIJLink网卡驱动安装各种芯片库函数NFSμCOS内核sambaFlashUnix命令与脚本输入法Linux内核设计与实现gitRIFFWAVJATGFTPar8161安装centos有线上网μCGUI字库工程建立右键菜单网络文件系统Firefox百度NTFS文件系统CodeBlocksCentOS数据结构算法PhotoShop51KeilQTUltraEditscanfglibc宏定义UIDGID优先级娱乐天地SourceInsight磁盘扇区总线I2CPDFBComparePythonI2SFPUMakefileSWDCPUARP软件推荐FileZilla