Merge remote-tracking branch 'greenfork/improve-ruby-hooks'
This commit is contained in:
commit
682426bf7b
|
@ -156,7 +156,6 @@ define-command -hidden ruby-indent-on-char %{
|
|||
try %{ execute-keys -draft <a-x> <a-k> ^ \h * (elsif) $ <ret> <a-a> i <a-semicolon> <a-?> ^ \h * (if) <ret> <a-S> 1<a-&> }
|
||||
try %{ execute-keys -draft <a-x> <a-k> ^ \h * (when) $ <ret> <a-a> i <a-semicolon> <a-?> ^ \h * (case) <ret> <a-S> 1<a-&> }
|
||||
try %{ execute-keys -draft <a-x> <a-k> ^ \h * (rescue) $ <ret> <a-a> i <a-semicolon> <a-?> ^ \h * (begin|def) <ret> <a-S> 1<a-&> }
|
||||
try %{ execute-keys -draft <a-x> <a-k> ^ \h * (end) $ <ret> <a-a> i <a-semicolon> <a-?> ^ \h * (begin|case|class|def|for|if|module|unless|until|while) <ret> <a-S> 1<a-&> }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -174,7 +173,7 @@ define-command -hidden ruby-indent-on-new-line %{
|
|||
define-command -hidden ruby-insert-on-new-line %[
|
||||
evaluate-commands -no-hooks -draft -itersel %[
|
||||
# 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 %{ execute-keys -draft k <a-x> s ^\h*\K#\h* <ret> y jgi P }
|
||||
# wisely add end structure
|
||||
evaluate-commands -save-regs x %[
|
||||
try %{ execute-keys -draft k <a-x> s ^ \h + <ret> \" x y } catch %{ reg x '' }
|
||||
|
|
1
test/indent/ruby/deindent-on-if-else-end/cmd
Normal file
1
test/indent/ruby/deindent-on-if-else-end/cmd
Normal file
|
@ -0,0 +1 @@
|
|||
c<ret>elsif<ret>else
|
1
test/indent/ruby/deindent-on-if-else-end/in
Normal file
1
test/indent/ruby/deindent-on-if-else-end/in
Normal file
|
@ -0,0 +1 @@
|
|||
if%( )
|
4
test/indent/ruby/deindent-on-if-else-end/out
Normal file
4
test/indent/ruby/deindent-on-if-else-end/out
Normal file
|
@ -0,0 +1,4 @@
|
|||
if
|
||||
elsif
|
||||
else
|
||||
end
|
3
test/indent/ruby/deindent-on-if-else-end/rc
Normal file
3
test/indent/ruby/deindent-on-if-else-end/rc
Normal file
|
@ -0,0 +1,3 @@
|
|||
source "%val{runtime}/colors/default.kak"
|
||||
source "%val{runtime}/rc/filetype/ruby.kak"
|
||||
set buffer filetype ruby
|
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><esc><a-o>jo# comment3<ret>comment4<esc><a-o>jo# indented<ret>indented2<esc><a-o>jodef f<ret># comment<ret>comment2<esc>j<a-o>jodef f<ret># comment<esc>hhhi<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
|
18
test/indent/ruby/insert-comment-hash/out
Normal file
18
test/indent/ruby/insert-comment-hash/out
Normal file
|
@ -0,0 +1,18 @@
|
|||
# Comment
|
||||
# comment2
|
||||
|
||||
# comment3
|
||||
# comment4
|
||||
|
||||
# indented
|
||||
# indented2
|
||||
|
||||
def f
|
||||
# comment
|
||||
# comment2
|
||||
end
|
||||
|
||||
def f
|
||||
# comm
|
||||
# ent
|
||||
end
|
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
|
|
@ -0,0 +1 @@
|
|||
c<space><space>end
|
|
@ -0,0 +1,6 @@
|
|||
class MyClass
|
||||
def method
|
||||
%( )
|
||||
|
||||
expression
|
||||
end
|
|
@ -0,0 +1,6 @@
|
|||
class MyClass
|
||||
def method
|
||||
end
|
||||
|
||||
expression
|
||||
end
|
|
@ -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