Running Qt Creator in emacs-mode

In this blog post, you will learn how to run Qt Creator in emacs-mode or in layman terms how to configure GNU Emacs keybindings in Qt Creator.

Why I write this blog post

This mini-tutorial is a note to my future self, searching how to configure Qt Creator to behave like Emacs all over the internet after another system reset.

At the same time, it might serve useful for anyone else looking for the same thing on the web.

Now you might ask why I want to run Qt Creator in Emacs mode anyways. My answer is quite simple: Qt Creator is an excellent IDE, but I like Emacs as text editor better. Since I don’t want to switch between different key configurations all the time, it makes sense to configure Qt Creator to behave like Emacs.

Well, and after getting used to the Emacs Ctrl-Meta-Key fu, it kinda starts to feel natural navigate with Ctrl-n,p,f,b and to switch between frames with Ctrl-x-o.

Activating the emacs-mode

To activate the emacs-mode in Qt Creator is simple with a recent version of Qt Creator which also comes with the Qt SDK.

The EmacsKeys plugin by nsf provides the basis for the Emacs keybindings in Qt Creator. To activate it just open the About Plugins… window via the menu Help > About Plugins....

Then you need to add the checkmark next to the plugin in the Installed Plugins window. After restart Qt Creator you are ready to configure the Emacs keybindings.

If you have thought that you can use the Emacs key combinations right after activating the plugin, then you have made the same mistake as me after first activating the plugin.

The EmacsKeys plugin provides new command for Qt Creator so it can be configured to behave like Emacs. However, it does not touch the keyboard shortcuts at all.

Luckily you can configure the Qt Creator keyboard shortcuts quite easily via the settings menu Tools > Options... in Environment > Keyboard.

Setting all the Qt Creator Command to match a keybinding for something similar in Emacs requires some handwork. To save you some time configuring the keybindings all by yourself I uploaded a sane configuration to GitHub Gist: Emacs.kms.

Import the file and voila – you will be running Qt Creator in emacs-mode.

Conclusion

Configuring Qt Creator to work in emacs-mode is easy if you know how to do it and worth the effort. Now I can enjoy an almost mouse-free Qt Creator experience, especially useful when traveling.

I hope you have enjoyed reading this blog article and I would very much appreciate any feedback and comments.

Your
Machine Koder

One thought on “Running Qt Creator in emacs-mode”

Leave a Reply

Your email address will not be published. Required fields are marked *