Remove the sh_auto_indent option.

We now auto indent by default, with the option to disable it handled by
the `diabled_hooks` mechanism.
This commit is contained in:
Simon Fowler 2019-06-29 12:34:14 +10:00
parent ba75289eb5
commit b2459f5ecb

View File

@ -7,7 +7,7 @@ hook global WinSetOption filetype=sh %{
set-option window static_words %opt{sh_static_words} set-option window static_words %opt{sh_static_words}
hook window ModeChange insert:.* -group sh-trim-indent sh-trim-indent hook window ModeChange insert:.* -group sh-trim-indent sh-trim-indent
hook window InsertChar \n -group sh-indent maybe-sh-indent-on-new-line hook window InsertChar \n -group sh-indent sh-indent-on-new-line
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window sh-.+ } hook -once -always window WinSetOption filetype=.* %{ remove-hooks window sh-.+ }
} }
@ -18,9 +18,6 @@ hook -group sh-highlight global WinSetOption filetype=sh %{
provide-module sh %[ provide-module sh %[
declare-option -docstring "attempt to automatically indent shell code. Defaults to no." \
bool sh_auto_indent no
add-highlighter shared/sh regions add-highlighter shared/sh regions
add-highlighter shared/sh/code default-region group add-highlighter shared/sh/code default-region group
add-highlighter shared/sh/double_string region %{(?<!\\)(?:\\\\)*\K"} %{(?<!\\)(?:\\\\)*"} group add-highlighter shared/sh/double_string region %{(?<!\\)(?:\\\\)*\K"} %{(?<!\\)(?:\\\\)*"} group
@ -58,15 +55,6 @@ add-highlighter shared/sh/double_string/expansion regex \$(\w+|\{.+?\}) 0:value
# Commands # Commands
# ‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾
# Check sh_auto_indent option before attempting to auto-indent anything
define-command -hidden maybe-sh-indent-on-new-line %{
evaluate-commands %sh{
if [ "${kak_opt_sh_auto_indent}" = true ]; then
echo "sh-indent-on-new-line"
fi
}
}
define-command -hidden sh-trim-indent %{ define-command -hidden sh-trim-indent %{
# remove trailing white spaces # remove trailing white spaces
try %{ execute-keys -draft -itersel <a-x> s \h+$ <ret> d } try %{ execute-keys -draft -itersel <a-x> s \h+$ <ret> d }