Merge remote-tracking branch 'lenormf/rc/dlang.kak'

This commit is contained in:
Maxime Coste 2015-09-07 13:35:32 +01:00
commit 3b4bb8674c

View File

@ -16,8 +16,8 @@ addhl -group / regions -default code dlang \
string '"' (?<!\\)(\\\\)*" '' \ string '"' (?<!\\)(\\\\)*" '' \
verbatim_string ` ` '' \ verbatim_string ` ` '' \
verbatim_string_prefixed 'r"' '"' '' \ verbatim_string_prefixed 'r"' '"' '' \
token '#' '\n' '' \ token '#' '\n' '' \
disabled /\+ \+/ '' \ disabled /\+ \+/ '' \
comment /\* \*/ '' \ comment /\* \*/ '' \
comment '//' $ '' comment '//' $ ''
@ -71,16 +71,18 @@ def -hidden _dlang-indent-on-closing-curly-brace %[
] ]
decl str dlang_dfmt_options "" decl str dlang_dfmt_options ""
def dlang-enable-dfmt -docstring "Format the code using the dfmt utility upon saving" %{ def dlang-format-dfmt -docstring "Format the code using the dfmt utility" %{
hook buffer -group dlang-formatter BufWritePre .* %{ %sh{
%sh{ readonly x=$((kak_cursor_column - 1))
echo "exec -draft %{%|dfmt<space>${kak_opt_dlang_dfmt_options// /<space>}<ret>}" readonly y="${kak_cursor_line}"
}
echo "exec -draft %{%|dfmt<space>${kak_opt_dlang_dfmt_options// /<space>}<ret>}"
echo "exec gg ${y}g ${x}l"
} }
} }
def dlang-disable-dfmt -docstring "Disable automatic code formatting" %{ def dlang-disable-dfmt -docstring "Disable automatic code formatting" %{
rmhooks buffer dlang-formatter rmhooks buffer dlang-formatter
} }
# Initialization # Initialization
@ -94,10 +96,15 @@ hook global WinSetOption filetype=dlang %{
hook window InsertChar \n -group dlang-indent _dlang-indent-on-new-line hook window InsertChar \n -group dlang-indent _dlang-indent-on-new-line
hook window InsertChar \{ -group dlang-indent _dlang-indent-on-opening-curly-brace hook window InsertChar \{ -group dlang-indent _dlang-indent-on-opening-curly-brace
hook window InsertChar \} -group dlang-indent _dlang-indent-on-closing-curly-brace hook window InsertChar \} -group dlang-indent _dlang-indent-on-closing-curly-brace
alias global format-code dlang-format-dfmt
} }
hook global WinSetOption filetype=(?!dlang).* %{ hook global WinSetOption filetype=(?!dlang).* %{
rmhl dlang rmhl dlang
rmhooks window dlang-hooks rmhooks window dlang-hooks
rmhooks window dlang-indent rmhooks window dlang-indent
unalias global format-code
} }