Setting indentation size in sh-mode

If you want to tweak the indentation size for Emacs’ sh-mode you can do so conveniently via the variable sh-basic-offset.

For example you could add the following line to your initialization file:

(setq sh-basic-offset 2)

This variable used to be called sh-indentation but that name was made obsolete in Emacs 26.1.

For additional information, see the file lisp/progmodes/sh-script.el in Emacs’ source.

Author: Carl Winbäck
Published: 2022-07-27

Back to the main page