summaryrefslogtreecommitdiff
path: root/rc
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2025-04-29 08:25:48 +1000
committerMaxime Coste <mawww@kakoune.org>2025-04-29 08:25:48 +1000
commitd3e0782942e926f14d079f7c3d419e390a5d8a74 (patch)
tree14d235c954d9ca1410182b9bf02dbcf8393001f6 /rc
parentdea8d1ba36d77af59cf97cc72d2f91e6c6c73848 (diff)
parentd93b23b6a3c1e3c09a20bf95fa21cc71b3746c91 (diff)
Merge remote-tracking branch 'arrufat/go-new-line-comment'
Diffstat (limited to 'rc')
-rw-r--r--rc/filetype/go.kak10
1 files changed, 9 insertions, 1 deletions
diff --git a/rc/filetype/go.kak b/rc/filetype/go.kak
index 4f8407cd..923eebaa 100644
--- a/rc/filetype/go.kak
+++ b/rc/filetype/go.kak
@@ -135,7 +135,15 @@ define-command -hidden go-indent-on-closing-curly-brace %[
define-command -hidden go-insert-comment-on-new-line %[
evaluate-commands -no-hooks -draft -itersel %[
# copy // comments prefix and following white spaces
- try %{ execute-keys -draft <semicolon><c-s>kx s ^\h*\K/{2,}\h* <ret> y<c-o>P<esc> }
+ try %{
+ execute-keys -draft <semicolon><c-s>kx s ^\h*\K/{2,}\h* <ret> y<c-o>P<esc>
+ # check for empty comments and delete them
+ try %{
+ execute-keys kx<a-K>^\h*//+\h*$<ret>
+ } catch %{
+ execute-keys Jx_d
+ }
+ }
]
]