Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

How to use Quickfix feature of Vim for compilation

📅 2015-Mar-21 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ cmake, make, quickfix, vim ⬩ 📚 Archive

Compile, view errors and fix them from inside Vim using Quickfix

The Quickfix feature of Vim is great if you work regularly with source code of languages which need to be compiled, like C or C++. If you are coming from Visual Studio or Eclipse CDT, the Quickfix feature basically gives an IDE-like feel of the edit-compile-fix cycle. (The only missing piece is a visual debugger inside Vim.) For example, you can view the errors and warnings produced on compiling your code in the Quickfix window, jump to the location of the error or warning, fix them and compile the code again. All from within Vim! 😊

Here are some pointers on how I use Quickfix:

$ g++ main.cpp 2> errors.txt
$ vim -q errors.txt

Tried with: Vim 7.4 and Ubuntu 14.04


© 2023 Ashwin Nanjappa • All writing under CC BY-SA license • 🐘 Mastodon📧 Email