Commit Graph

6 Commits

Author SHA1 Message Date
Simon Fowler
b2459f5ecb Remove the sh_auto_indent option.
We now auto indent by default, with the option to disable it handled by
the `diabled_hooks` mechanism.
2019-06-29 12:34:14 +10:00
Simon Fowler
04005b06b0 Add support for basic auto-indenting of sh code.
This attempts to support a simple formatting and intentation style for
plain sh syntax (and other sh-compatible code which doesn't stray too
far from portable sh).

The complexity of sh syntax means that we have to be opinionated -
attempting to be more flexible would require extensive context
awareness, and would require something more akin to a proper
autoformatting tool or a language server.

The formatting style used here makes use of vertical whitespace as the
primary delimiter, so that code ends up looking like this:

if [ $foo = "bar" ]; then
        thing1
else
        thing2
fi

for i in foo bar baz; do
        thing1
        thing2
done

case "$foo" in
        bar) thing1;;
        baz)
                thing1
                thing2
                ;;
esac

Since the formatting style used is very opinionated the 'sh_auto_indent'
option can be used to disable auto-indentation, with the default set to
'no'.
2019-06-20 13:19:15 +10:00
Justin Frank
80ac46e09d Fixed many of the filetype support modules to not use BufSetOption to load 2019-04-09 20:54:19 -07:00
Justin Frank
1fab727f2b Modified a bunch of language support files to use modules 2019-04-08 17:02:44 -07:00
Maxime Coste
4b98b89437 sh.kak: Use a region for shell expansions
Fixes #2763
2019-03-26 13:04:31 +11:00
Alex Leferry 2
c0dccdd90d Add categories in rc/
Closes #2783
2019-03-21 01:06:16 +01:00