Is there any way to get Vim to auto indent C++11 lambda functions correctly?

I have tried many different permutations of smartindent, cindent, etc. in .vimrc.

enter image description here

  • 1
    I think it's related to your standards such as old style C, camel case, and so on. please refer to your standard and adjust vim according to your standard, – PersianGulf Feb 21 '14 at 12:33
  • Please, don't post images of text. Are we supposed to re-type that complex code when testing? – Kusalananda Nov 14 '18 at 17:59

Here is piece of my ~/.vim/vimrc configuration file:

set cindent           " enable specific indenting for C code
set cino+=j1,(0,ws,Ws " enable partial c++11 (lambda) support

One workaround (not answer) is to declare the lambda and pass the func ptr into the receiving function... dilutes the convenience of lambdas though.

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.