Ubuntu/debian/deepin et Sublime Text 3 Configuring C + + Environment (one-click compile & Run, format code)

Source: Internet
Author: User
Tags sublime text

To configure the compilation environment:

Enter Sublime, then click Tools->build system->new Build System

Replace directly with the following

{      "shell_cmd": "g++ ' ${file} '-O ' ${file_path}/${file_base_name} '",      "File_regex": "^ (.. [^:]*]:([0-9]+):? ([0-9]+)?:? (. *) $ ",      " Working_dir ":" ${file_path} ",      " selector ":" Source.c, source.c++ ",        " variants ":      [          {              "name": "Build & Run",              "Shell_cmd": "X-terminal-emulator-  e bash-c \" g++ ' ${file} '-O ' ${file_path}/${ File_base_name} '; ' ${file_path}/${file_base_name} '; Read-p ' \npress ENTER or type command to continue ... ' "          },            {              " name ":" Build only ",              " Shell_cmd ":" g+ + ' ${file} '-O ' ${file_path}/${file_base_name} ' "          },            {"              name ":" Run only ",              " Shell_cmd ":" X-terminal-emulator-  e bash-c \ "' ${file_path}/${file_base_name} '; Read-p ' \npress ENTER or type command to Continu E ... ' \ ' "          }      ]  }  

Save the file, file name arbitrary

Before each use, we press CTRL+SHIFT+B to select the Compile option

Configure one-click compilation & Run shortcut keys

Click Preferences->key buildings-user

[      {"Keys": ["Ctrl+d"], "command": "Duplicate_line"},      {"Keys": ["Alt+up"], "command": "Swap_line_up"},      {" Keys ": [" Alt+down "]," command ":" Swap_line_down "},    {" Keys ": [" F9 "]," command ":" Build "," args ": {" Variant ":" Build & Amp Run "}},"  

Copy code, move up, move down, compile and run with one click

Installing the Format plugin

First you need to install the package Control

Click View->show Console, and then enter

Import Urllib.request,os; PF = ' package control.sublime-package '; IPP = Sublime.installed_packages_path (); Urllib.request.install_opener (Urllib.request.build_opener (Urllib.request.ProxyHandler ())); Open (Os.path.join (IPP, PF), ' WB '). Write (Urllib.request.urlopen (' http://sublime.wbond.net/' + pf.replace (', '%20 ')) . Read ())

  

After successful installation, press CTRL+SHIFT+P, then enter install, select Package Control:install

Then enter Coolformat and install

Click Preferences->browse Packages, then enter Coolformat, there is a Default.sublime-keymap open can modify shortcut keys

Ubuntu/debian/deepin et Sublime Text 3 Configuring C + + Environment (one-click compile & Run, format code)

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.