4

In Shell-script[sh] mode, Emacs defaults to this style of indentation:

/this/is/an/example/command/broken/over_multiple_lines which \
                                                       causes \
                                                       an \
                                                       annoying \
                                                       indentation

I would like to change this so that each line is indented by only a single tab further than the original line:

/this/is/another example \
  which is indented \
  by a single tab \
  shown here \
  as two spaces

This is what the relevant section of my init.el says I have customised:

 '(sh-backslash-align t)
 '(sh-basic-offset 2)
 '(sh-indent-after-continuation nil)
 '(sh-indent-for-continuation 0)
 '(sh-indentation 2))

What variable am I missing to change the alignment indent to a single-tab indent?

  • You seem to be looking for the default behavior. Try bisecting your init file for the faulty setting. For the record, with these values for the 5 variables, I get no indentation at all after the continuation. – T. Verron Oct 25 '16 at 12:59
0

Open a file in shell-script-mode, run M-x customize-variable RET sh-indent-after-continuation, and see if you can set it to always. (This seems to be a relatively new option, Emacs 25.1+)

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.