4

Is there a way to copy the error message that YCM shows at the bottom of vim?

enter image description here

For example in the above image, it says:

unused parameter 'sortFunction'

I had an idea of using "howdoi [paste]" in another terminal and get a solution easily :)

2
  • $ howdoi won't help. You only need basic logic: you have an unused parameter so you have two solutions: remove it or use it.
    – romainl
    Commented Mar 22, 2015 at 9:42
  • 1
    @romainl no no , you took me wrong , I just wanted to demonstrate that case. Infact I've intentionally introduced that variable :p Commented Mar 22, 2015 at 9:47

1 Answer 1

6

If YCM uses the proper mechanisms, that message should be in either v:statusmsg or v:errmsg. You can put those values into the system clipboard via:

:let @+ = v:statusmsg
9
  • says Invalid register name: '+' and I tried with ' * ' too and it says same. Commented Mar 22, 2015 at 9:49
  • 1
    That means your Vim doesn't have clipboard support. You could launch the command directly from Vim: :! howdoi <C-R>=v:statusmsg<CR><CR> then. Commented Mar 22, 2015 at 9:52
  • 1
    Right; it would have to be a + in front. Is the message in one of those variables; have you checked that? Getting it out there is just secondary to your original question. Commented Mar 22, 2015 at 10:02
  • 2
    @AbhinavGauniyal You can check if YCM uses those variables by executing :echo v:statusmsg or :echo v:errmsg. If one of them contains the message you're looking for, use that variable. If both of them are empty, then YCM is not using these variables to store the error messages. Also, make sure you get the error message with YCM again as v:errmsg may get overwritten with newer error messages.
    – akshay
    Commented Mar 22, 2015 at 10:23
  • 1
    Then it's likely :echo. You could raise an issue at YCM's issue tracker to have that (trivially) changed to :echomsg. Commented Mar 22, 2015 at 10:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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