Fix Ruby <ret> mid-comment

Implementation is copied from Nim.
This commit is contained in:
Dmitry Matveyev 2021-06-06 00:38:36 +06:00
parent 02e625e8fb
commit fcc04384d1
5 changed files with 8 additions and 1 deletions

View File

@ -173,7 +173,7 @@ define-command -hidden ruby-indent-on-new-line %{
define-command -hidden ruby-insert-on-new-line %[ define-command -hidden ruby-insert-on-new-line %[
evaluate-commands -no-hooks -draft -itersel %[ evaluate-commands -no-hooks -draft -itersel %[
# copy _#_ comment prefix and following white spaces # copy _#_ comment prefix and following white spaces
try %{ execute-keys -draft k <a-x> s '^\h*\K#\h*' <ret> y j <a-x><semicolon> P } try %{ exec -draft k <a-x> s ^\h*#\h* <ret> y jgh P }
# wisely add end structure # wisely add end structure
evaluate-commands -save-regs x %[ evaluate-commands -save-regs x %[
try %{ execute-keys -draft k <a-x> s ^ \h + <ret> \" x y } catch %{ reg x '' } try %{ execute-keys -draft k <a-x> s ^ \h + <ret> \" x y } catch %{ reg x '' }

View File

@ -0,0 +1 @@
c<ret>

View File

@ -0,0 +1 @@
# Comment%( ) comment2

View File

@ -0,0 +1,2 @@
# Comment
# comment2

View File

@ -0,0 +1,3 @@
source "%val{runtime}/colors/default.kak"
source "%val{runtime}/rc/filetype/ruby.kak"
set buffer filetype ruby