{clojure,lisp}.kak: handle doubled brackets

This commit is contained in:
Jason Felice 2020-01-03 14:56:21 -05:00
parent f2159750d2
commit 0ed3bd662c
10 changed files with 30 additions and 2 deletions

View File

@ -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>' }

View File

@ -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>' }

View File

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

View File

@ -0,0 +1,3 @@
((metafn 42)%( )(y 79))
([weird 42]%( )(y 79))
({map 42}%( )(y 79))

View File

@ -0,0 +1,6 @@
((metafn 42)
(y 79))
([weird 42]
(y 79))
({map 42}
(y 79))

View File

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

View File

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

View 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}))

View 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}))

View File

@ -0,0 +1,2 @@
source "%val{runtime}/rc/filetype/lisp.kak"
set buffer filetype lisp