{clojure,lisp}.kak: handle doubled brackets
This commit is contained in:
parent
f2159750d2
commit
0ed3bd662c
|
@ -208,7 +208,7 @@ define-command -hidden clojure-indent-on-new-line %{
|
||||||
execute-keys -draft '"wze<a-L>s.{' %sh{printf $(( kak_opt_indentwidth - 1 ))} '}\K.*<ret><a-;>;"i<a-Z><gt>'
|
execute-keys -draft '"wze<a-L>s.{' %sh{printf $(( kak_opt_indentwidth - 1 ))} '}\K.*<ret><a-;>;"i<a-Z><gt>'
|
||||||
} catch %{
|
} catch %{
|
||||||
# If not special and parameter appears on line 1, indent to parameter
|
# If not special and parameter appears on line 1, indent to parameter
|
||||||
execute-keys -draft '"wze<a-K>[\s()\[\]\{\}]<ret><a-l>s\h\K[^\s].*<ret><a-;>;"i<a-Z><gt>'
|
execute-keys -draft '"wz<a-K>[()[\]{}]<ret>e<a-K>[\s()\[\]\{\}]<ret><a-l>s\h\K[^\s].*<ret><a-;>;"i<a-Z><gt>'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
try %{ execute-keys -draft '[rl"i<a-Z><gt>' }
|
try %{ execute-keys -draft '[rl"i<a-Z><gt>' }
|
||||||
|
|
|
@ -69,7 +69,7 @@ define-command -hidden lisp-indent-on-new-line %{
|
||||||
execute-keys -draft '"wze<a-L>s.{' %sh{printf $(( kak_opt_indentwidth - 1 ))} '}\K.*<ret><a-;>;"i<a-Z><gt>'
|
execute-keys -draft '"wze<a-L>s.{' %sh{printf $(( kak_opt_indentwidth - 1 ))} '}\K.*<ret><a-;>;"i<a-Z><gt>'
|
||||||
} catch %{
|
} catch %{
|
||||||
# If not "special" form and parameter appears on line 1, indent to parameter
|
# If not "special" form and parameter appears on line 1, indent to parameter
|
||||||
execute-keys -draft '"wze<a-l>s\h\K[^\s].*<ret><a-;>;"i<a-Z><gt>'
|
execute-keys -draft '"wz<a-K>[()\[\]{}]<ret>e<a-l>s\h\K[^\s].*<ret><a-;>;"i<a-Z><gt>'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
try %{ execute-keys -draft '[rl"i<a-Z><gt>' }
|
try %{ execute-keys -draft '[rl"i<a-Z><gt>' }
|
||||||
|
|
1
test/indent/clojure/doubled-brackets/cmd
Normal file
1
test/indent/clojure/doubled-brackets/cmd
Normal file
|
@ -0,0 +1 @@
|
||||||
|
c<ret><esc>
|
3
test/indent/clojure/doubled-brackets/in
Normal file
3
test/indent/clojure/doubled-brackets/in
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
((metafn 42)%( )(y 79))
|
||||||
|
([weird 42]%( )(y 79))
|
||||||
|
({map 42}%( )(y 79))
|
6
test/indent/clojure/doubled-brackets/out
Normal file
6
test/indent/clojure/doubled-brackets/out
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
((metafn 42)
|
||||||
|
(y 79))
|
||||||
|
([weird 42]
|
||||||
|
(y 79))
|
||||||
|
({map 42}
|
||||||
|
(y 79))
|
3
test/indent/clojure/doubled-brackets/rc
Normal file
3
test/indent/clojure/doubled-brackets/rc
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
source "%val{runtime}/rc/filetype/lisp.kak"
|
||||||
|
source "%val{runtime}/rc/filetype/clojure.kak"
|
||||||
|
set buffer filetype clojure
|
1
test/indent/lisp/doubled-brackets/cmd
Normal file
1
test/indent/lisp/doubled-brackets/cmd
Normal file
|
@ -0,0 +1 @@
|
||||||
|
c<ret><esc>
|
4
test/indent/lisp/doubled-brackets/in
Normal file
4
test/indent/lisp/doubled-brackets/in
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
(let ((x 42)%( )(y 79)))
|
||||||
|
(let [(x 42)%( )(y 79)])
|
||||||
|
(let ([x 42]%( )[y 79]))
|
||||||
|
(let ({x 42}%( ){y 79}))
|
8
test/indent/lisp/doubled-brackets/out
Normal file
8
test/indent/lisp/doubled-brackets/out
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
(let ((x 42)
|
||||||
|
(y 79)))
|
||||||
|
(let [(x 42)
|
||||||
|
(y 79)])
|
||||||
|
(let ([x 42]
|
||||||
|
[y 79]))
|
||||||
|
(let ({x 42}
|
||||||
|
{y 79}))
|
2
test/indent/lisp/doubled-brackets/rc
Normal file
2
test/indent/lisp/doubled-brackets/rc
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
source "%val{runtime}/rc/filetype/lisp.kak"
|
||||||
|
set buffer filetype lisp
|
Loading…
Reference in New Issue
Block a user