Fix Ruby <ret> mid-comment
Implementation is copied from Nim.
This commit is contained in:
parent
02e625e8fb
commit
fcc04384d1
|
@ -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 '' }
|
||||||
|
|
1
test/indent/ruby/insert-comment-hash/cmd
Normal file
1
test/indent/ruby/insert-comment-hash/cmd
Normal file
|
@ -0,0 +1 @@
|
||||||
|
c<ret>
|
1
test/indent/ruby/insert-comment-hash/in
Normal file
1
test/indent/ruby/insert-comment-hash/in
Normal file
|
@ -0,0 +1 @@
|
||||||
|
# Comment%( ) comment2
|
2
test/indent/ruby/insert-comment-hash/out
Normal file
2
test/indent/ruby/insert-comment-hash/out
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
# Comment
|
||||||
|
# comment2
|
3
test/indent/ruby/insert-comment-hash/rc
Normal file
3
test/indent/ruby/insert-comment-hash/rc
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
source "%val{runtime}/colors/default.kak"
|
||||||
|
source "%val{runtime}/rc/filetype/ruby.kak"
|
||||||
|
set buffer filetype ruby
|
Loading…
Reference in New Issue
Block a user