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

This commit is contained in:
Maxime Coste 2015-09-06 20:09:59 +01:00
commit 3d7be57de7

View File

@ -61,14 +61,19 @@ def -hidden _golang-indent-on-closing-curly-brace %[
try %[ exec -itersel -draft <a-h><a-k>^\h+\}$<ret>hms\`|.\'<ret>1<a-&> ] try %[ exec -itersel -draft <a-h><a-k>^\h+\}$<ret>hms\`|.\'<ret>1<a-&> ]
] ]
def golang-enable-gofmt -docstring "Format the code using the gofmt utility upon saving" %{ def golang-format-gofmt -docstring "Format the code using the gofmt utility" %{
hook buffer -group golang-formatter BufWritePre .* %{ %sh{
exec -draft %{%|"gofmt"<ret>} readonly x=$((kak_cursor_column - 1))
readonly y="${kak_cursor_line}"
echo "exec -draft %{%|gofmt<ret>}"
echo "exec gg ${y}g ${x}l"
} }
} }
alias global format-code golang-format-gofmt
def golang-disable-gofmt -docstring "Disable automatic code formatting" %{ def golang-disable-gofmt -docstring "Disable automatic code formatting" %{
rmhooks buffer golang-formatter rmhooks buffer golang-formatter
} }
# Initialization # Initialization