1

Is it possible, or does some function exists, to get the equivalent of the alt-q command, but in programming?

Suppose I've just written this in python:

group_parser.add_argument('-n',nargs=1, default=5,
help='specifies how many missing entries in a row are allowed before the whole row gets omitted.')

The following is a rather long line. Is it possible to have some sort of automation for getting the following output?

parser.add_argument('-n',nargs=1, default=5, 
                    help='specifies how many ' +
                    'missing entries in a row ' +
                    'are allowed before the whole row gets ' +
                    'omitted.')

In other words, a function that detects long input strings, and splits them up across multiple lines.

1
  • Obviously that kind of behaviour would be specific to each individual programming language. As a complete tangent, you might find the Keep Left formatting style an improvement when breaking lines.
    – phils
    Commented Jul 15, 2017 at 20:52

1 Answer 1

0

You should try multi-line. Out of the box it works sanely for many languages. You can cycle through many different indentation strategies.

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.