Merge remote-tracking branch 'm-kru/go_kak_fix' into master

This commit is contained in:
Maxime Coste 2020-09-22 21:18:52 +10:00
commit 57208a5481
3 changed files with 15 additions and 2 deletions

View File

@ -134,7 +134,7 @@ define-command -hidden go-insert-on-new-line %[
try %[ execute-keys -draft k<a-x>s^\h+<ret>"xy ] catch %[ reg x '' ] try %[ execute-keys -draft k<a-x>s^\h+<ret>"xy ] catch %[ reg x '' ]
try %[ try %[
# Validate previous line and that it is not closed yet. # Validate previous line and that it is not closed yet.
execute-keys -draft k<a-x> <a-k>^<c-r>x.*\{\h*\(?\h*$<ret> J}iJ<a-x> <a-K>^<c-r>x(\)?\h*\})$<ret> execute-keys -draft k<a-x> <a-k>^<c-r>x.*\{\h*\(?\h*$<ret> j}iJ<a-x> <a-K>^<c-r>x\)?\h*\}<ret>
# Insert closing '}'. # Insert closing '}'.
execute-keys -draft o<c-r>x}<esc> execute-keys -draft o<c-r>x}<esc>
# Delete trailing '}' on the line below the '{'. # Delete trailing '}' on the line below the '{'.
@ -148,7 +148,7 @@ define-command -hidden go-insert-on-new-line %[
try %[ execute-keys -draft k<a-x>s^\h+<ret>"xy ] catch %[ reg x '' ] try %[ execute-keys -draft k<a-x>s^\h+<ret>"xy ] catch %[ reg x '' ]
try %[ try %[
# Validate previous line and that it is not closed yet. # Validate previous line and that it is not closed yet.
execute-keys -draft k<a-x> <a-k>^<c-r>x.*\(\h*$<ret> J}iJ<a-x> <a-K>^<c-r>x(\)\h*\}?)$<ret> execute-keys -draft k<a-x> <a-k>^<c-r>x.*\(\h*$<ret> J}iJ<a-x> <a-K>^<c-r>x\)<ret>
# Insert closing ')'. # Insert closing ')'.
execute-keys -draft o<c-r>x)<esc> execute-keys -draft o<c-r>x)<esc>
# Delete trailing ')' on the line below the '('. # Delete trailing ')' on the line below the '('.

View File

@ -41,3 +41,9 @@
12 12
{( {(
bar()%( ))} bar()%( ))}
13
a := []int{
someFunction(%( )
),
}

View File

@ -56,3 +56,10 @@
{( {(
bar() bar()
)} )}
13
a := []int{
someFunction(
),
}