Lambda indentation
x37v opened this issue · 6 comments
x37v commented
vim indenting is very poor for c++ lambdas, if someone has an indent file to share that resolves that, that would be great!
koron commented
👍
mattn commented
I want some example that can make sure broken indentation...
x37v commented
Its actually not lambdas alone, its lambdas as passed to functions:
#include <functional>
#include <cstdlib>
void foo(std::function<bool(int)> f) {
f(rand());
}
int main(int argc, char * argv[]) {
int i = 0;
//indenting looks fine
auto f = [&i](int input) -> bool {
if (input) {
i = 12;
return true;
}
return false;
};
f(rand());
//really terrible indenting
foo([&i](int input) -> bool {
if (input) {
i = 12;
return true;
}
return false;
});
std::vector<int> v({2,3,4});
//really terrible indenting
for_each(v.begin(), v.end(), [](int x) {
if (x == 2)
cout << "2";
else {
cout << "not two" << endl;
}
});
return 0;
}
oblitum commented
👍
crazymaster commented
This repository doesn't contains indent/cpp.vim. So please report it to vim-dev.
crazymaster commented
Oops, it was reported to vim-dev.
https://groups.google.com/d/topic/vim_dev/Hr_vGp_-JxM/discussion
https://groups.google.com/d/topic/vim_dev/IAnQft51UEY/discussion