Install SublimeText3 in Ubuntu14.04 and use the SublimeClang plug-in

Source: Internet
Author: User
SublimeText is a cross-platform editor that supports Windows, Linux, and Mac systems, supports code editing in various languages, works with the corresponding plug-ins, and learns from time, you will love it and greatly improve your coding efficiency. This article explains how to install SublimeText3 in Ubuntu14.04 and configure the SublimeClang plug-in to configure the C/C ++ development environment. 1. Download and install SublimeText3 to the official website

Sublime Text is a cross-platform editor that supports Windows, Linux, and Mac systems, supports code editing in various languages, works with the corresponding plug-ins, and learns from time, you will love it and greatly improve your coding efficiency. This article explains how to install SublimeText 3 in Ubuntu 14.04 and configure the SublimeClang plug-in to configure the C/C ++ development environment.

1. Download and install Sublime Text 3
Go to the official website http://www.sublimetext.com/3download 64-bit (64-bit system) of the. deb installation package (http://c758482.r82.cf2.rackcdn.com/sublime-text_build-3059_amd64.deb), download and double-click to install. After the installation, run subl to open the program. Now you can write the code. Before you start, it is recommended to write down some common shortcuts, refer to: http://www.linuxidc.com/Linux/2016-01/127343.htm

2. install Package Control

Package Control is a good tool for managing plug-ins. It can be used to install, delete, and disable corresponding plug-ins. Common plug-ins can be found above. The Source Code address is ~ /. Config/sublime-text-3/Packages/directory and name it Package Control. (You can also download the package directly on github, decompress the package, and copy it ~ /. Config/sublime-text-3/Packages/directory and name it Package Control ).

Cd ~ /. Config/sublime-text-3/Packages/

GitHub clone https://github.com/wbond/package_control_channel.git Package \ Control

Alternatively, open sublime_text and press the shortcut key ctrl + '(The key below Esc). In the pop-up command input window, enter the following information and press Enter:

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 (). 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 ()


Restart SublimeText 3 and press Ctrl + Shift + p. In the displayed input box, enter Package Control to view the option to Install Package, and select it later (check the status in the lower left corner) the plug-in query and installation window is displayed. Enter the plug-in you want and press Enter. For C/C ++ development, it is recommended to install C ++ snipptes, ConvertToUTF8, and SublimeAStyleFormatter plug-ins. the specific meaning of baidu is clear.

3. Install the powerful SublimeClang plug-in
SublimeClang is the only C/C ++ auto-completion plug-in Sublime Text. It has powerful functions and built-in syntax check functions. However, the author has stopped updating it recently, currently, it can only be found and automatically installed in the Package Control of Sublime Text 2. In SublimeText 3, it can only be manually installed through the source code. Its code line is in https://github.com/quarnster/sublimeclang. The installation steps are as follows:

Install related software
Sudo apt-get install cmake build-essential clang git
Cd ~ /. Config/sublime-text-3/Packages
Git clone-recursive https://github.com/quarnster/SublimeClang SublimeClang
Cd SublimeClang
Cp/usr/lib/x86_64-linux-gnu/libclang-3.4.so.1 internals/libclang. so # This step is important, if your clang library is not version 3.4, copy the library of the corresponding version to internals
Cd src
Mkdir build
Cd build
Cmake ..
Make

If everything succeeds, the libcache. so library file will be generated in the SublimeClang/internals directory. Restart Sublime Text, press the shortcut key Ctrl + '(The key below Esc) to open the built-in control output to see if there are any errors. If there are no errors, everything is OK. Next, configure your own file. Press ctrl + shift + p, enter sublimeclang settings in the pop-up input box, and then select the line with the User, enter the following information in the open file:

{
"Show_output_panel": false,
"Dont_prepend_clang_includes": true,
"Inhibit_sublime_completions": false,

"Options ":
[
"-Std = gnu ++ 11 ",
"-Isystem", "/usr/include ",
"-Isystem", "/usr/include/c ++ /*",
"-Isystem", "/usr/include/c ++/4.8 ",
"-Isystem", "/usr/include/c ++/4.8 /*",
"-Isystem", "/usr/include/boost ",
"-Isystem", "/usr/include/boost /**",
"-Isystem", "/usr/lib/gcc/x86_64-linux-gnu/4.8/include ",
"-Isystem", "/usr/lib/gcc/x86_64-linux-gnu/4.8/include /*"
]
}
Note: My gcc version is 4.8. If not, replace the corresponding version and save the current file after # include the corresponding header file, in the next operation, a faster prompt will be given to the function or variable contained in the header file.

4. engineering instance
In the menu bar, choose Project> Add Folder To Project... add your existing original code directory to Sublime Text, and then use Project-> Save Project... to save your project. For example, my machine has a C ++ project in/media/WinE/WorkStation/Swift. The code is stored in the Swift/base and swift/disruptor directories in swift, if you want to automatically prompt the content in these two directories when writing code, you need to modify the corresponding configuration. Project> Edit Project:

{
"Folders ":
[
{
"Follow_symlinks": true,
"Path": "/media/WinE/WorkStation/Swift"
}
],

"Settings ":
{
"Sublimeclang_options ":
[
"-I/media/WinE/WorkStation/Swift ",
"-I/media/WinE/WorkStation/Swift/swift/base ",
"-I/media/WinE/WorkStation/Swift/swift/disruptor ",
]
}
}

In summary, if you have any questions, please raise them and make progress together. I hope you will fall in love with a guy.

More about Sublime Text:

Ubuntu install code editor Sublime Text 3 (Build 3083) http://www.linuxidc.com/Linux/2015-03/115534.htm

Dynamic Graph Display 16 Sublime Text Shortcut Key Usage http://www.linuxidc.com/Linux/2014-12/110930.htm

Ubuntu 12.10 install and crack Sublime Text 2Http://www.linuxidc.com/Linux/2013-07/86898.htm

Ubuntu 13.04 install Sublime Text 2 http://www.linuxidc.com/Linux/2013-05/84228.htm

Code artifact-Sublime Text package management tools and extensions Daquan http://www.linuxidc.com/Linux/2013-10/91701.htm

How to Develop Sublime Text 2 plug-in http://www.linuxidc.com/Linux/2013-09/90046.htm

Install and crack Sublime Text 2 editor http://www.linuxidc.com/Linux/2013-08/89452.htm in Windows Mac Linux

Text Editor Sublime Text experience http://www.linuxidc.com/Linux/2013-08/89326.htm

Sublime Text: Click here
Sublime Text: Click here

This article permanently updates the link address: Http://www.linuxidc.com/Linux/2016-01/127342.htm

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.