Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

How to use Quickfix feature of Vim for compilation

📅 2015-Mar-21 ⬩ ✍️ Ashwin Nanjappa ⬩ 📚 Archive

[caption id="attachment_6405" align="aligncenter" width="636"][Compile, view errors and fix them from inside Vim using Quickfix](https://codeyarns.files.wordpress.com/2015/03/20150321_quickfix.png) Compile, view errors and fix them from inside Vim using Quickfix[/caption]

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