sublime text 3 配置说明

sublime text  这个编译器看第一眼我就喜欢上了,啊呸,就是好看。

但想要把她用起来花了我非常非常多的时间,说出来都是泪。

主要是装不上SublimeClang 这货,作为sublime上唯一好用的C/C++自动补全和检测错误插件

在sublime3 还在测试的时候,作者quarnster就停止更新了T_T;

期间各种尝试,都毫无反应,由于只支持到sublime2 ,只好用了半年sublime2 ;

新年sublime发表了sublime3 的正式版,开始了长长的配置之路;

来来去去好多次,每次都花我数天的时间,哎。。。

百度来百度去,不知所云,是所谓谷歌一下,你就知道;

在国外的sublime官方论坛上找到了这货,

Download sublimeclang git to the packages folder of ST3
1.git clone --recursive github.com/quarnster/SublimeClang13 SublimeClang
2.git pull && git submodule foreach --recursive git pull origin master

Copy the libcache.dll and libclang.dll files found in the sublimeclang installed with package control into Sublimeclang/internals/

If you want to compile the dll files all by yourself... then follow the steps in http://clang.llvm.org/get_started.html2 or ones i used below to compile libclang.dll
You need to have visual studio installed
1. svn co llvm.org/svn/llvm-project/llvm/trunk llvm
2. cd llvm\tools
3. svn co llvm.org/svn/llvm-project/cfe/trunk clang
4. Run CMake to generate the Visual Studio solution and project files:
- cd .... (back to where you started)
- mkdir build
- cd build
- Visual Studio 2008: cmake -G "Visual Studio 9 2008" ..\llvm
- Visual Studio 2010: cmake -G "Visual Studio 10" ..\llvm
- Visual Studio 2011: cmake -G "Visual Studio 11" ..\llvm
5.You should now have libclang.vcxproj in "build\tools\clang\tools\libclang" path.
6.Open the visual studio command prompt and move the path where the file in above step is mentioned
- msbuild libclang.vcxproj /m /p:Configuration=Release
7. This will generate the libclang.dll file in "build\bin\Release".
8.Download sublimeclang git to the packages folder of ST3
- git clone --recursive github.com/quarnster/SublimeClang13 SublimeClang
- git pull && git submodule foreach --recursive git pull origin master
9.Copy the generated dll file into "SublimeClang\internals"
10. cd SublimeClang/src
- mkdir build
- cd build
- cmake ..
11. Run msbuild libcache.vcxproj /m /p:Configuration=Release
12. This should generate libcache.dll file in "SublimeClang\src\build\Release"
13. Copy to "SublimeClang\internals"
14. This should get you going

Hope this helps and its not too long ... I am not an expert, so bear with the errrors............

网址:   https://forum.sublimetext.com/t/st3-sublime-clang/10679/10


也就是说:直接从SublimeClang网站上下载zip包后放到package文件夹下,解压出libclang.dll和libcache.dll放到SublimeClang/internals下就可以了(32位) 

对于64位,没有现成的libclang_64.dll和libcache_64.dll,你需要像上文中所说的那样自己完成下载源码并编译工作。。。


好了,我想知道32位和64位有什么差别吗,貌似是没有,那就用32位就可以了。


放上我的c++配置

{
    "cmd": ["g++", "${file}", "-std=c++11","-o", "${file_path}/${file_base_name}" ,"&&","start","C:/cb_console_runner.exe","${file_path}/${file_base_name}"],
    "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
    "working_dir": "${file_path}",
    "selector": "source.c, source.c++,source.cpp",
    "shell": true,
    "encoding": "cp936",
        "variants":
    [
        {
            "name": "Run",
            "cmd": ["start","C:/cb_console_runner.exe","${file_path}/${file_base_name}"]
        }
    ]
}

放上我的SublimeClang的配置

{
    "show_output_panel": false,
    "dont_prepend_clang_includes": true,
    "inhibit_sublime_completions": false,
    "hide_output_when_empty": true,
    "show_visual_error_marks": false,

	  "options":
[
    // "-m32",
    // //"-w",
    // "-ferror-limit=9",
    // "-fgnu-runtime",
    // "-fms-extensions",
    // "-nostdinc",
    "-std=c++11",
      "-std=gnu++11",
      "-std=g++11",
    // 此处填写自己pc中的实际位置和版本号.
    "-isystem", "C:\\MinGW\\lib\\gcc\\mingw32\\4.8.1\\include", 
    "-isystem", "C:\\MinGW\\lib\\gcc\\mingw32\\4.8.1\\include\\c++", 
    "-isystem", "C:\\MinGW\\lib\\gcc\\mingw32\\4.8.1\\include\\c++\\mingw32", 
    "-isystem", "C:\\MinGW\\include",
    "-D__GNUC__=4",
    "-D__GNUC_MINOR__=2",
    "-D__GNUC_PATCHLEVEL__=1",
    "-D__GXX_ABI_VERSION__=1002",
    "-Di386=1",
    "-D__i386=1",
    "-D__i386__=1",
    "-DWIN32=1",
    "-D_WIN32=1",
    "-D__WIN32=1",
    "-D__WIN32__=1",
    "-DWINNT=1",
    "-D__WINNT=1",
    "-D__WINNT__=1",
    "-D_X86_=1",
    "-D__MSVCRT__=1",
    "-D__MINGW32__=1",
    "-D__STDC_VERSION__=201112L"
],
}

放上sublimeasformat的配置

{
	"autoformat_on_save": true,
	"options_default": {
		"style": "allman",
	}
}

sublime自身的配置:
{
	//"font_face": "Comic Sans MS",
	"font_face": "Monaco",
	"font_size": 14,
	"ignored_packages":
	[
		"Vintage"
	]
}

[
{"keys": ["f5"], "command": "build"},
 { "keys": ["shift+space"], "command": "auto_complete" },
  { "keys": ["shift+space"], "command": "replace_completion_with_auto_complete", "context":
      [   
          { "key": "last_command", "operator": "equal", "operand": "insert_best_completion" },    
          { "key": "auto_complete_visible", "operator": "equal", "operand": false },   
          { "key": "setting.tab_completion", "operator": "equal", "operand": true }
      ]   
  }
]


重点推荐Monaco字体,等宽,清楚;按键配置实现一键编译,弹出窗口;


改造了cb_console_runner.exe可以多开程序,比codeblocks高得不知道到哪去了;(放在那里就改好路径)


这样,就基本上改造成了一个顺手的编辑器了。。。一些零散的插件不明白可以去https://forum.sublimetext.com上找找;


codeblocks16.01 有生之年更新系列: http://pan.baidu.com/s/1c0WB8q8   密码: cuv1


提取自codeblocks的mingw492:http://pan.baidu.com/s/1o7vZGF4  密码:2qgb


提供sublimeclang的包裹:http://pan.baidu.com/s/1mgVFmL6  密码: nbt5


字体和cb_console_runner.exe : http://pan.baidu.com/s/1o7m6ez4 密码: u3j4


打包好的sublime text 3 (3103) :http://pan.baidu.com/s/1pKfIAld  密码: ikaj


是完美的,连汉化后配置会变回preference的这个逼死强迫症的bug也被fix啦:


留图一张:


sublime text 3 配置说明_第1张图片



你可能感兴趣的:(sublime text 3 配置说明)