mirror of
https://github.com/mawww/kakoune.git
synced 2024-11-27 02:23:26 +03:00
Make rust auto-indenter ignore most things inside comments.
Fixes #3352.
This commit is contained in:
parent
93a889bd44
commit
5024fe17f6
@ -74,15 +74,18 @@ define-command -hidden rust-trim-indent %{
|
||||
define-command -hidden rust-indent-on-new-line %~
|
||||
evaluate-commands -draft -itersel %<
|
||||
# copy // comments prefix and following white spaces
|
||||
try %{ execute-keys -draft k <a-x> s ^\h*\K//[!/]?\h* <ret> y gh j P }
|
||||
# preserve previous line indent
|
||||
try %{ execute-keys -draft <semicolon> K <a-&> }
|
||||
try %{
|
||||
execute-keys -draft k <a-x> s ^\h*\K//[!/]?\h* <ret> y gh j P
|
||||
} catch %|
|
||||
# preserve previous line indent
|
||||
try %{ execute-keys -draft <semicolon> K <a-&> }
|
||||
# indent after lines ending with { or (
|
||||
try %[ execute-keys -draft k <a-x> <a-k> [{(]\h*$ <ret> j <a-gt> ]
|
||||
# indent after lines ending with [{(].+ and move first parameter to own line
|
||||
try %< execute-keys -draft [c[({],[)}] <ret> <a-k> \A[({][^\n]+\n[^\n]*\n?\z <ret> L i<ret><esc> <gt> <a-S> <a-&> >
|
||||
|
|
||||
# filter previous line
|
||||
try %{ execute-keys -draft k : rust-trim-indent <ret> }
|
||||
# indent after lines ending with { or (
|
||||
try %[ execute-keys -draft k <a-x> <a-k> [{(]\h*$ <ret> j <a-gt> ]
|
||||
# indent after lines ending with [{(].+ and move first parameter to own line
|
||||
try %< execute-keys -draft [c[({],[)}] <ret> <a-k> \A[({][^\n]+\n[^\n]*\n?\z <ret> L i<ret><esc> <gt> <a-S> <a-&> >
|
||||
>
|
||||
~
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user