YCM FixIt Feature

YouCompleteMe (YCM) is really an awsome plugin. But today this blog post is not about completion support, it’s about YCM’s FixIt feature. If you are developer and have seen already compiler errors like this:

expected ';' at end of declaration

then I’m sure you also thought already: “If the compiler knows already the solution for the problem, why it can’t fix it automatically?” Well, at least you might think so when using an IDE like Visual Studio.

As a Vim user it is more obvious that compiler and editor are two separate things and the compiler can’t fix it. But Vim with YCM can do exactly that. The command :YcmCompleter FixIt does exactly what we want. YCM shows the capability of doing so by adding the text (FixIt) to the error message. If you map this command to a keyboard shortcut like the following you can fix those issues with a single keypress:

" Apply YCM FixIt
map <F9> :YcmCompleter FixIt<CR>

Here is a short video to demonstrate the feature (click on the GIF to show in full size): ycm_syntax

0 Responses to “YCM FixIt Feature”

  1. Leave a Comment

Leave a Reply

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

WordPress.com Logo

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

Google photo

You are commenting using your Google 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 )

Connecting to %s

%d bloggers like this: