工欲善其事, may be useful for clion tips

Source: Internet
Author: User
Tags sublime text
Time 2016-08-30 10:50:00 cescfangs original Http://fangs.in/post/cc/awesomeclion2 theme Git

Six months ago, I started using Clion, Shun with written a record of the use of clion skills, did not expect to publish in the book after reading the volume is still very high, incredibly also won the life of the first real play rewards, moved also decided to reorganize, plus this half of the actual use of the experience. This article will be introduced through the MAC version (in addition to the individual buttons, not much difference), add a demo animation. about Authorization

JetBrains family's products almost all support student license, all products. All products. All products. Important things to say three times a year authorization time, due to the need to re-verify Edu mailbox, the students are advised to activate this way, stamp here to apply, other capable users can purchase authorized support genuine. shortcut key Configuration

Clion default shortcut key style is Visual studio,windows users do not have to change, the MAC on the general use of ⌘ instead of control, in Setting->keymap modified into Xcode style can be, clion default to provide 8 kinds of style, but also Support User DIY.

Since I often use Sublime Text, I want to be able to keep the same shortcut keys in some common features, so I DIY some: Add selection for Next occurrence (multiple selection)->⌘+ D unselect Occ Urrence (deselect)->⌘+ U build (Compile)->⌘+ B Select Line at caret (select Cursor row)->⌘+ L code hint match pattern

Clion code hints and supplemental matches have all, None, and first three ways:

Mode Description Recommended degree
All Keyword exact match : Hand:
I The first character exactly matches : Ok_hand:
None case-insensitive, first character : Facepunch:

All require keywords to be exactly consistent (case, character order) to prompt, first letter as long as the key words (case-sensitive) or subscript matching will be prompted, and None is the most matching requirements of the most relaxed, case-insensitive, do not require a first word match, I personally like this kind of, lazy people gospel ~ ~

Smart Tips

The official name is intention, which differs from Auto-complete, and gives immediate hints based on the code you write, such as calling a function to omit writing a parameter. Bad is not only to prompt these questions or suggestions, but also to provide solutions, click on the left side of the small light bulb or press ⌥+ Enter (Windows is Alt + ENTER, shortcut keys refer to their own configuration) will be displayed after the confirmation of these prompts can be applied.

Quick Fixes

This function is a bit like a smart hint, but the difference is that quick fixes focus on small errors that are easy to come by, such as forgetting; , the judgment uses = and so on very easy to appear the small error, Clion also can show the small light bulb to cause your attention, the shortcut key and the intelligence prompt like, presses the ⌥+⏎ to be able to fix quickly.

Quick Comment

annotation function is one of the high-frequency operations in the process of knocking code, like Sublime Text, press ⌘+/will annotate the line of code with the cursor, press ⌘+⇧+/will complete the comment in the form of a block of code.

In addition, adding TODO to the contents of the annotation will automatically be clion as the code to be processed, and when you submit the code clion will prompt you to check the TODO's contents:

code Generation

This feature will help you automatically generate some code in a specific situation, such as class constructors and destructors, where you need to generate to press ⌘+ N, the most common use scenario is to declare the function in the header file and then go to the main file to define:

In addition you can ⌘+ J insert complete code block, default only for, ITER, itit, also can add custom code block in Setting->live Templates, for example, I created a code block of main () function, input main will be The code block that we added in the prompt box is really convenient.

Finally, there is a function of surround with, select any block of code to press ⌥+⌘+ T can optionally give these code package if for etc.

Use search function skillfully

Search is also a very useful function, clion search function is very powerful. Basic Search

For the basic search (and most commonly used), ⌘+ F believe that everyone is already very familiar with, ⇧+⌘+ f can be searched throughout the project, according to ⌥+ F7 can find a class, variables, functions, etc. in the text used in the place;

Project Navigation

For a large project, often need to clarify its hierarchy, clion for us to provide the project files, classes, etc. navigation search:

⌘+ O Search by name of class;

⇧+⌘+ O Search by file name;

⌥+⌘+ O Search by symbol name;

⌘+ B Search statement;

⌘+ U base class/function search;

This is really serious ah, press ⇧+⌘+ A and then enter the function you want to use, and then select it, especially when the shortcut keys too much can not remember when it is very practical ah.

Global Search

When you do not know what you want to search for is the top of what kind of time, try the search everywhere, only need to press two ⇧, you will be called search everywhere's searching box.

Debug Run

To be honest, many editors now have the ability and experience to edit code without losing the IDE, but the IDE has a lot of advantages in debugging and running the project, which is why many people choose the IDE instead of the code editor in a big project.

You can start at Run | Edit configurations the option to configure the debug run, and if you want to run a script before or after the build, you can add these additional configurations yourself.

On OS X, clion support GDB and LLDB, recommended to use LLDB, debugging process and a lot of IDE similar, you can create breakpoints, press the right top of the bug or ⌥+⌘+ U for debugging, you can row by line, the statement for debugging, Clion very human point is the debugging variables The value is displayed directly on the right in italics (this imposes a sub-item), and clion supports changing the value of the variable during debugging (select the variable in the Debug output box right click Set value or press F2).

PS. clion is not fast to debug, especially if the Windows platform experience is not as good as Visual Studio. Version Control

Clion supports common versioning systems such as git, mercurial, and Github with specific setup options that can be set in (Preferences-> Version Control), and in the case of Git, the visual form covers all the commonly used Function:

Limited to space, you can not record all the GIT operations, I believe that familiar with the operation of Git you will soon be able to get started. last

The above mentioned skill is I usually use when clion some experience, the usage habit varies from person to person, the so-called skill only has the frequent use to have the significance, I do not suggest to begin to remember those to be able to pull the cool to blow the sky the shortcut key. If you've ever used a jetbrains other product before, then I'm sure you'll soon be able to get started with clion, and if you're using his home product for the first time, this article might be of some use to you.

If you need to have a full understanding of Clion's functionality, you can access the official guide to JetBrains, which is part of the article that references this guide.

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.