常用的sublime自动补全插件(sublimetext3自动补全代码)

安装homebrew /usr/bin/ruby-e"$(curl-fsSLhttps://raw.githubusercontent.com/Homebrew/install/master/install)" Bash 通过brewcask安装sublimetext brewcaskinstallsublime-text Bash 安装packagecontrol 在launchpad中打开Su…

安装homebrew

/usr/bin/ruby -e \"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)\"

Bash

通过brew cask安装sublime text

brew cask install sublime-text

Bash

安装package control

在launchpad中打开Sublime Text,按下control(ctrl)键+`或者View > Show Console中打开控制台,输入以下内容

import urllib.request,os,hashlib; h = \'df21e130d211cfc94d9b0905775a7c0f\' + \'1e3d39e33b79698005270310898eea76\'; 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)

如果是sublime text2输入下面的内容

import urllib2,os,hashlib; h = \'df21e130d211cfc94d9b0905775a7c0f\' + \'1e3d39e33b79698005270310898eea76\'; pf = \'Package Control.sublime-package\'; ipp = sublime.installed_packages_path(); os.makedirs( ipp ) if not os.path.exists(ipp) else None; urllib2.install_opener( urllib2.build_opener( urllib2.ProxyHandler()) ); by = urllib2.urlopen( \'http://packagecontrol.io/\' + pf.replace(\' \', \'%20\')).read(); dh = hashlib.sha256(by).hexdigest(); open( os.path.join( ipp, pf), \'wb\' ).write(by) if dh == h else None; print(\'Error validating download (got %s instead of %s), please try manual install\' % (dh, h) if dh != h else \'Please restart Sublime Text to finish installation\')

安装Codecs33与ConvertToUTF8

使sublime text支持utf-8编码
找到Tool->Command Palette,输入install package,选择第一个,回车,搜索codecs33与ConvertToUTF8,因为网络原因,可能需要等待一小会,可以在最底下的状态栏查看是否完成。

安装Clang-Complete

一款c/c++插件,支持补全、保存时检查错误,同上一步,搜索Clang-Complete并安装。
配置,因为这款插件有点老,自带的配置文件对应的头文件库文件很大一部分是不存在的,导致功能异常,需要自己改配置文件,
来到/Users/用户名/Library/Application Support/Sublime Text 3/Packages/Clang-Complete目录,可以在sublime text->Preferences->Browse Packages…找到这个目录。
打开cc.sublime-settings文件
找到大概34行左右,将include_options修改为下面的内容,可能需要提前安装好xcode,如果路径不对,可自行修改。

 \"include_options\":
[
\"-isystem\", \"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/8.0.0/include\",
\"-isystem\", \"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/\",
\"-isystem\", \"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/4.2.1\",
\"-F/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/\",
\"-isystem\", \"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1\",
\"-isystem\", \"/usr/include\",
\"-isystem\", \"/usr/include/c++/*\",
\"-isystem\", \"/usr/local/include\",
\"-isystem\", \"/usr/local/include/c++/*\",
//\"-isystem\", \"/usr/local/opt/llvm/include\",
\"-Wall\"
],

配置lua环境

#安装lua
brew install lua@5.3
#创建软链接
cd /usr/local/bin/
ln -s lua5.3 lua

这个时候在控制台已经是可以使用,但是在sublime中使用cmd+b调试lua,会提示[Errno 2] No such file or directory: ‘lua’,查看path路径,发现并没有/usr/local/bin目录,这时候需要通过包管理工具搜索并安装Fix Mac Path插件。

配置快捷键打开终端

安装Terminal插件,快捷键cmd+shift+t默认打开的是系统自带终端如果需要打开iterm,在 /Users/用户名/Library/Application Support/Sublime Text 3/Packages/Terminal目录找到Terminal.sublime-settings,在terminal后面填入iTerm2-v3.sh(“terminal”: “iTerm2-v3.sh”)。

本文来自投稿,不代表来拓客立场,如若转载,请注明出处:https://www.laituoke.com/ltk/6970.html