In the context of shell-script-mode
, to set the "indentation size" the variable you're looking for is sh-basic-offset
. From C-h v sh-basic-offset
:
sh-basic-offset is a variable defined in ‘sh-script.el’.
Its value is 4
The default indentation increment.
This value is used for the ‘+’ and ‘-’ symbols in an indentation variable.
This variable has an alias: ‘sh-indentation’.
This variable is safe as a file local variable if its value
satisfies the predicate ‘integerp’.
You can customize this variable.
[back]
The variable for "indentation uses spaces" is indent-tabs-mode
, which is more of a "global" setting. From C-h v indent-tabs-mode
:
indent-tabs-mode is a variable defined in ‘C source code’.
Its value is nil
Indentation can insert tabs if this is non-nil.
Automatically becomes buffer-local when set.
This variable is safe as a file local variable if its value
satisfies the predicate ‘booleanp’.
You can customize this variable.
Probably introduced at or before Emacs version 18.
[back]
If you're familiar with Vim's modeline magic, Emacs has a similar facility via file local variables. For instance, one could add the following to the beginning of a shell script to configure "sh mode" for both Vim and Emacs.
#!/bin/sh
# -*- mode: shell-script; sh-shell: sh; sh-basic-offset: 4; indent-tabs-mode: nil -*-
# vim: set ts=4 sts=4 sw=4 et ft=sh: