2

I always type more spaces between keywords, or between identifiers without awareness. How can I configure astyle configuration file to reduce them to only one space automatically? For example:

int       main(int argc, const    char *argv[]) {
    int x    = 4;
    return 0;
}

Would become:

int main(int argc, const char *argv[]) {
    int x = 4;
    return 0;
}
Casper Beyer
  • 2,203
  • 2
  • 22
  • 35
JoJo
  • 1,377
  • 3
  • 14
  • 28
  • Unfortunately, I don't think you can (I've had similar issues with various 3rd-party libraries lately). +1 anyway because I'd love to be proven wrong. – cf- Apr 22 '14 at 00:10
  • Just clean the stickiness from underneath your spacebar key. No 3rd-party libraries required. – Cody Gray - on strike Apr 22 '14 at 00:32
  • @CodyGray That's not particularly helpful when the code in question is coming from someone else, and manually cleaning up space-spam is time-consuming and somewhat annoying imho. – cf- Apr 22 '14 at 00:35
  • @CodyGray although I clean my keyboard, this problem still exists – JoJo Apr 22 '14 at 03:36
  • You might want to think about eliminating multiple spaces via `sed`, and then have `astyle` adding the indenting spaces again as a two-step process. – DevSolar May 22 '14 at 10:03

1 Answers1

0

Consider using clang-format in-place of astyle.

Casper Beyer
  • 2,203
  • 2
  • 22
  • 35
  • I'm a Vim guy myself so it's untested but [this](https://github.com/travisjeffery/ClangFormat-Xcode) plugin appears to do integrate it. – Casper Beyer Apr 22 '14 at 04:02