mirror of
https://github.com/mawww/kakoune.git
synced 2024-11-25 10:32:19 +03:00
Take the formatting function out of the hook
This commit is contained in:
parent
f81e5593db
commit
0d348f880c
@ -59,14 +59,19 @@ 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 -docstring "Format the code using the gofmt utility upon saving" %{
|
||||
hook buffer -group golang-formatter BufWritePre .* %{
|
||||
exec -draft %{%|"gofmt"<ret>}
|
||||
def golang-format-gofmt -docstring "Format the code using the gofmt utility" %{
|
||||
%sh{
|
||||
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" %{
|
||||
rmhooks buffer golang-formatter
|
||||
rmhooks buffer golang-formatter
|
||||
}
|
||||
|
||||
# Initialization
|
||||
|
Loading…
Reference in New Issue
Block a user