Coder Social home page Coder Social logo

Lambda indentation about vim-cpp HOT 6 CLOSED

vim-jp avatar vim-jp commented on August 23, 2024
Lambda indentation

from vim-cpp.

Comments (6)

koron avatar koron commented on August 23, 2024

👍

from vim-cpp.

mattn avatar mattn commented on August 23, 2024

I want some example that can make sure broken indentation...

from vim-cpp.

x37v avatar x37v commented on August 23, 2024

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;
}

from vim-cpp.

oblitum avatar oblitum commented on August 23, 2024

👍

from vim-cpp.

crazymaster avatar crazymaster commented on August 23, 2024

This repository doesn't contains indent/cpp.vim. So please report it to vim-dev.

from vim-cpp.

crazymaster avatar crazymaster commented on August 23, 2024

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

from vim-cpp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.