Add an option to auto-format Go buffers on write
This commit is contained in:
parent
5ed9fd2763
commit
6ee2acd674
|
@ -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-&> ]
|
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
|
# Initialization
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user