Tips & Tricks

CLion Demo Recording: Because C++ Can Be Competitive

As International Collegiate Programming Contest (ICPC) sponsors and continuous supporters of many educational initiatives, JetBrains thoroughly enjoyed the opportunity to run JetBrains Knowledge Day 2020 last week. This was a unique educational event to mark the beginning of the ICPC competitive season and academic year. Phil Nash, JetBrains C++ Tools developer advocate, gave a talk on using CLion since C++ is widely used in both competitive programming and education.

This talk introduces some of the CLion features that can supercharge your coding. It covers completions, including smart completions and live templates, generating tedious boilerplate C++ code quickly, and refactorings – all of which save you time and help keep you in the flow. Phil also adds a few words about testing (obviously, with Catch2) and the test-driven development (TDD) approach.

The recording of this talk is now publicly available:

The video highlights:

  • 00:00 – Intro
  • 00:35 – Start with a problem description
  • 02:10 – Introduce testing framework
  • 03:34 – Add a new file to the project
  • 04:50 – Add test cases
  • 08:30 – Add problem test checks by using multiple cursors
  • 10:28 – Coding with live templates
  • 17:21 – Save the changes with Local History
  • 19:17 – Optimize the code with refactoring
  • 23:54 – Easy navigation with Search Everywhere

And here are all the shortcuts introduced in the video:

Windows/ Linux macOS Command
Ctrl+F9 ⌘F9 Build
Alt+Insert ⌘N New (file)
Alt+Shift+Insert ⇧⌘8 Toggle Column Selection Mode
Ctrl+Delete ⌘⌫ Delete Line
Ctrl+Alt+S ⌘, Open Settings/ Preferences
Ctrl+W ⌥↑ Expand Selection
Ctrl+Alt+V ⌥⌘V Extract Variable
Ctrl+Shift+Enter ⇧⌘⏎ Complete Statement
Shift+F6 ⇧F6 Rename
Ctrl+F8 ⌘F8 Toggle Line Breakpoint
Shift+F9 ^D Start debugging
Ctrl+F2 ⌘F2 Stop debugging
Ctrl+W ⌥↑ Expand Selection
Ctrl+Shift+W ⌥↓ Reduce Selection
Ctrl+Shift+/ ⌘/ Comment/ Uncomment
Ctrl+Alt+T ⌥⌘T Surrounds-with templates
Ctrl+Shift+Up ⇧⌘↑ Move statement up
Ctrl+Alt+Shift+T ⌃T Refactor This
Ctrl+Alt+C ⌥⌘C Extract Constant
Ctrl+Alt+M ⌥⌘M Extract Method
Ctrl+Alt+N ⌥⌘N Inline (method/ variable)
Ctrl+Alt+P ⌥⌘P Extract Parameter
Ctrl+Shift+F ⇧⌘F Find In Path
Ctrl+Shift+R ⇧⌘R Replace In Path
Shift Shift Shift Shift Search Everywhere
Ctrl+Shift+A ⇧⌘A Find Action

If you are interested in other videos from the event, check out this playlist.

Your CLion team
JetBrains
The Drive to Develop

image description