1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-11-29 01:24:52 +03:00

Add an option to auto-format Go buffers on write

This commit is contained in:
Frank LENORMAND 2015-07-22 12:02:10 +03:00
parent 5ed9fd2763
commit 6ee2acd674

View File

@ -59,6 +59,16 @@ def -hidden _golang-indent-on-closing-curly-brace %[
try %[ exec -itersel -draft <a-h><a-k>^\h+\}$<ret>hms\`|.\'<ret>1<a-&> ]
]
def golang-enable-gofmt %{
hook buffer -group golang-formatter BufWritePre .* %{
exec -draft %{%|"gofmt"<ret>}
}
}
def golang-disable-gofmt %{
rmhooks buffer golang-formatter
}
# Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
@ -74,6 +84,6 @@ hook global WinSetOption filetype=golang %{
hook global WinSetOption filetype=(?!golang).* %{
rmhl golang
rmhooks window golang-hooks
rmhooks window golang-indent
rmhooks window golang-hooks
rmhooks window golang-indent
}