Sublime Text 3 under C/D + + development environment construction

Source: Internet
Author: User
Tags sublime text linux mint

Sublime Text 3 under C/D + + development environment construction

The sublime Text was briefly introduced in the Linux Mint 171-week usage experience.

1.Sublime Text 3 Installation

Ubuntu, Linux Mint Software Manager has been able to find sublime Text 3, directly installed. Or go to the official website to download the. deb or Tarball installation package and install it manually.

2.Package Control Manager

The 1th thing that appeals to me is that this is great Extension Manager! The installation method is also very simple, in the St pressCtrl+`into the ST's console, and then go to the official web site to copy the ST3 installation commands to perform the installation can be completed. With it, in the St pressCtrl+Shift+P, enter install or remove, you can install, uninstall a variety of extensions, including various St plug-ins, themes and so on.

3. Recommended Required Extensions

Depending on the popularity statistics on the package control, the following extensions are recommended:

Name Description
Emmet Emmet (Ex-zen Coding) for Sublime Text
Sublimelinter Interactive Code linting Framework for Sublime Text 3
Sidebarenhancements Enhancements to Sublime Text Sidebar. Files and folders
Brackethighlighter Bracket and tag highlighter for Sublime Text
Sublimecodeintel Full-featured code Intelligence and Smart AutoComplete engine
HTML5 HTML5 Bundle for Sublime Text
Alignment Easy alignment of multiple selections and multi-line selections
Git Plugin for some Git integration to sublime text
Docblockr Simplifies writing DocBlock comments in Javascript, PHP, Coffeescript, Actionscript, C & C + +
ConvertToUTF8 A Sublime Text 2 & 3 plugin for editing and saving files encoded in GBK, BIG5, Euc-kr, EUC-JP, Shift_JIS, etc
All Autocomplete Extend Sublime autocompletion to find matches in all open files of the current window
Markdown Preview Markdown Preview and build plugin for sublime text 2/3
Markdownediting Powerful Markdown package for Sublime Text with better syntax understanding and good color schemes.

A brief breakdown of the purpose of the main extension:

    • Development Class : Emmet is the famous Zen Coding;brackethighlighter can highlight matching pairs of parentheses, Docblockr can automatically generate similar Javadoc comments; Auto-save inCtrl+Bautomatically save files at compile time.
    • Enhanced class : Sidebarenhancements can enrich the sidebar navigation menu, CONVERTTOUTF8 support compiling files such as Chinese, Syncedsidebar update the folders and files in the sidebar in real-time.
    • document class : Write Markdown with St is also very convenient, install Markdown preview and markdownediting two plugins ( Note: Be sure to configure ignored_packages globally: ["Markdown" ] To disable the ST default Markdown plugin , you can preview the MD file rendering in real time within St and in the browser; filediffs compare the differences between the two files.
    • Theme Class : Soda is the highest ranked theme, and Spacegray is the highest ranked scheme, the effect is really good; table editor is also required, the table above is compiled with it, The operation is similar to the table in Orgmode under Emacs, but the points to note are:
      • CtrlOpen with + +ShiftPTable Editor: Enable for current view.
      • Enter the header row first, enter the second line after entering|-, press thetabkey will enter the table editing mode.
      • The table must have a blank line between the text you entered earlier, or the table will be rendered as normal text.
4. Global configuration

In the menu bar Preferences->settings-user, we can do some global configuration of St, such as network agent, theme theme, scheme color matching, etc.:

    "theme": "Soda Dark.sublime-theme",
    "soda_classic_tabs": true,
    "soda_folder_icons": true,
    "color_scheme": "Packages/Theme - Spacegray/base16-eighties.dark.tmTheme",
    "http_proxy": "ip:8080",
    "proxy_password": "******",
    "proxy_username": "cdai",
    "ignored_packages": [ "Vintage", "Markdown" ],
    "file_exclude_patterns": [".tags", ".tags_sorted_by_file", "*.exe"] }
5.c/c++ Development Environment 5.1 Convention takes precedence over configuration

The 2nd thing that appeals to me is默认的开发环境配置that the idea is similar to the Convention over configuration in rails or STRUTS2, which intelligently configures the environment and configures itself if the user has special needs. Create a new hello.c file, St can automatically recognize the language and syntax highlighting. Best of allCtrlShift, after the + +Pinput run, select "Run Single file with g++" to automatically find the g++ (if it is already installed) and execute it. Download a Redis source package decompression, click on the "Open Folder" Select the Redis root add, and then the same ctrl+shift+p this time choose "make" that can be automatically compiled!

5.2 Development under Windows platform

The following is the focus of this article, with the C + + development as an example, focus on the Plug and C + + development and in the Windows 7 platform, how to use Cygwin or mingw to develop and cross-compile Linux programs.

5.2.1 Installing the expansion plug-in

Install the plug-in Sublimeclang smart prompt, C + + snippets code template first, or you can install the ctags yourself if necessary.

5.2.2 New Build System

The Windows platform is not part of the Convention mentioned above, so we need to configure our own compilation options. Open the Tools->build system->new Build System:

    "path": "D:\\cygwin64\\bin",
    "cmd": ["gcc", "-I", "D:\\cygwin64\\usr\\include", "${file}", "-o", "${file_path}/${file_base_name}", "-lm", "-Wall", "&", "start", "${file_path}/${file_base_name}.exe"],
    "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
    "working_dir": "${file_path}",
    "selector": "source.c",
     "shell": true,
    "variants": [
            "name": "Run::Cygwin",
            "cmd": [ "start", "${file_path}/${file_base_name}.exe"] }
    ] }

Simply explain:

    • Path is the bin directory of Cygwin or MinGW.
    • CMD is a series of commands that areCtrltriggered when + isBcompiled. Here the start Xxx.exe directly to the end of the command, so when theCtrl+Bcompile will be compiled first, and then automatically start a command line window (with the following shell:true option) run just compiled EXE program, very convenient!
    • The selector function is that when the Tools->build system is automatic, the current Build system is triggered based on the suffix name of the current source file. We want to only use Cygwin's GCC to deal with C, then write source.c on it.
    • The name of the variants is added to the Tools->build system menu. Of course, if the previous cmd command = compile + run, this menu item is not often used.
5.2.3 Configuration Sublimeclang

By default, clang cannot find a header file that comes with Cygwin or mingw, so you need to configure smart hints to be useful. Open Preferences->package Settings->sublimeclang->settings-user:__

  "show_output_panel": false,
    "dont_prepend_clang_includes": true,
    "inhibit_sublime_completions": false,
5.2.4 Configuration Ctags

Ctags is an old plug-in that enables function navigation and jump functionality, and it is divided into three steps in St:

    1. First download the installation package from Ctags's SourceForge official website, unzip it to a directory, and add the directory to the environment variable of Windows.
    2. In StCtrl+ +ShiftP, install the Ctags plugin via the package control.
    3. Right-click on the project root to see one moreCTags: Rebuild Tagsmenu. After execution, we can jump freely in our project!

Note: Rebuild tags will be generated under the root directory. tags and. Tags_sorted_by_file two index files. You can add a configuration to the Preferences->settings-user to hide it:
"file_exclude_patterns": [".tags", ".tags_sorted_by_file"]

Now it's done! A simple and fast, cool look sublime text can be used!

Sublime Text 3 under C/D + + development environment construction

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: 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.