My editor of choice for C/C++: QtCreator + FakeVim

Even though I work with C/C++ projects that are not related to Qt technology, QtCreator has become my main code editor. Here I explain some of the main reasons why I prefer it over other alternatives.


I usually prefer a more “plain” editor over a full-blown IDE for programming. This is mainly because I work with embedded Linux systems, and I like to interact with the target device from terminal using for instance SSH and SCP. Usually the project and build are also handled using custom CMakeLists or Makefiles which are not tied to any particular IDE or its project file format. So for me the editor is for writing code. There are, however, some IDE features that I like to have:

  • Auto-completion that works for both standard libraries and project files
  • Easy navigation in large code base

For general purpose editing (scripts, git commit messages, etc.) I usually use neovim or Sublime Text. However,  I feel that navigating in a large project soon becomes quite awkward in these editors. It is possible to get plugins for both of them for auto-completion, project organization and much more, but still they aren’t exactly what I want.

For me the answer is QtCreator. Both the smart C/C++ auto-completion as well as project navigation (switching between source/header, following symbol under cursor, etc.) works without a hazzle or additional plugins. Topping it all off, the vim editing mode makes it really familiar to move around and edit.


On most Linux systems, the QtCreator can usually be found with the package manager. However, it is not likely the latest version. Installer for the most recent version can be found here.

To install, add execution rights to the file and run it from terminal. Then just follow the installation instructions:

$ chmod u+x 
$ ./

I also prefer the dark theme which can be enabled from Tools → Options → Environment → Interface tab.

Auto-complete and clang analyzer

The auto-completion in QtCreator works right out-of-the-box and it shows both standard libraries as well as symbols in the current project. It is also a real C/C++ auto-complete which suggests functions and symbols that are relevant in the current context. It is also able to show parameters and return values for suggestions. In some text editors the auto-completion just suggest all matching words in the current document or project.


Another useful feature is Clang code model. This feature parses the source files on the fly and provides similar warnings and error that are normally presented during compilation. This helps to catch errors such as typos, missing semicolons and unmatched parentheses immediately. It can also suggest fixes which are indicated using the lightbulb icon.


This feature is not enabled by default but it can easily be enabled from Help → About plugins menu.

FakeVim mode

One of my favourite features in QtCreator is the FakeVim mode. Since I already use vim for other general purpose editing, it is very convenient to be able to move around, select, yank and so on using the same key combinations. Even though the vim-mode is not very clearly visible in the editor, it is actually built into the QtCreator and works right out-of-the-box.

To enter vim-mode, just open a document and use Alt+v Alt+v key combination (the same combination is used to switch back to normal mode). This is also a great way to start learning vim, because you can always switch back easily if you need to.

The vim-mode has its own section in the settings (Tools → Options → FakeVim). Indentation settings such as tabulator size should be set to match the normal editing mode.

The vim-mode is not limited to moving around in single document. It is also possible to split the editing area using vim :split and :vsplit commands. Navigation between the splits works using Ctrl+w + h/j/k/l like in vim. To close a split, navigate to it and use :q command (Ctrl+w + q doesn’t seem to be supported).


Some of the QtCreator shortcuts are also available when the vim-mode is enabled. Especially useful commands are “Follow symbol under cursor, F2“, “Switch between function declaration/definition, Shift+F2″ and “Switch header/source, F4“.

There are also some limitations. Both the vim-mode and QtCreator have key combinations that require the control-key. If the control-key is interpreted by FakeVim (pass control key setting), QtCreator shortcuts like Ctrl+s to save do not work (in vim-mode you can save with :w command). If, in turn, the control key is passed to QtCreator, some vim key combinations are unavailable. Personally this has not been an issue for me since it is possible to do most operations with vim commands (or temporarily switch to normal mode with Alt+v Alt+v).

You are likely to also notice some other minor differences with the FakeVim and real vim (e.g. not all commands are supported). Still, the vim-like editing works well and it has been integrated smoothly to the rest of the editor. It is one of the main reasons I use this editor in my day-to-day work.


2 thoughts on “My editor of choice for C/C++: QtCreator + FakeVim

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s