5

I just started using ycm with clang-completer, which apparently can also do syntax checking.

It instantly reminded me why I avoided syntax checking in gVim: As soon as an error is found, the signs appear on the left in an extra column. By doing so they shift the window to the right to make place for the characters of the sign. As soon as I correct the error and it was just a single error in the file, the signs disappear and with it the sign column. This can become quite flashy, see the gif

enter image description here

How can I make it steady, so that the sign column stays, and just he signs disappear? I found the :sing unplace but don't know how to NOT execute it. Or maybe expand beforehand and don't expand anymore when signs are added?

3

You can do what some plugins do and create a dummy sign:

sign define Dummy
autocmd VimEnter,SessionLoadPost,BufRead * execute 'sign place 97349278 line=9999 name=Dummy buffer='.bufnr('%')

All this does is creates an empty sign on line 9999, which should be far enough from valid lines in a file you actually want to see signs in. It has to be set on a far off line since only one sign can occupy a line at a time. 97349278 is an ID for the sign, which I got by mashing the keyboard. All that matters is that it's unique.

I don't use YCM, but it might have an option to use a dummy sign. It may also remove your dummy sign, in which case, you'll have to look in its source to see how it can be prevented.

| improve this answer | |
4

Apart from the hack with adding a dummy sign (which is what most sign plugins do), there is nothing that can be done. If that bothers you, cheer at vim-dev, that my patch gets integraged. (Als available as issue 117)

| improve this answer | |
  • This would be a nice feature indeed, thanks for linking the patch as well. However, I couldn't apply it, because it doesn't seems to be applicable for 7.4. Do you have by any chance a patch for the current version of vim? Thanks again! – rikisa Jul 28 '16 at 16:49
  • 1
    @rikisa have updated it. Please also cheer at vim-dev if you find it useful. Thanks – Christian Brabandt Jul 29 '16 at 8:58
  • Just compiled with your patch. Works quiet well, left a comment on the corresponding issue. Cheers. – rikisa Jul 30 '16 at 11:23
  • 1
    BTW: the patch has been integrated as part of 7.4.2201 – Christian Brabandt May 3 '17 at 9:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.