mirror of
https://github.com/mawww/kakoune.git
synced 2024-12-18 17:02:06 +03:00
parent
ec0f8fe574
commit
8c6af54db3
@ -31,7 +31,10 @@ define-command -hidden c-family-trim-autoindent %{
|
|||||||
define-command -hidden c-family-indent-on-newline %< evaluate-commands -draft -itersel %<
|
define-command -hidden c-family-indent-on-newline %< evaluate-commands -draft -itersel %<
|
||||||
execute-keys \;
|
execute-keys \;
|
||||||
try %<
|
try %<
|
||||||
# if previous line closed a paren, copy indent of the opening paren line
|
# if previous line is part of a comment, do nothing
|
||||||
|
execute-keys -draft <a-?>/\*<ret> <a-K>^\h*[^/*\h]<ret>
|
||||||
|
> catch %<
|
||||||
|
# else if previous line closed a paren, copy indent of the opening paren line
|
||||||
execute-keys -draft k<a-x> 1s(\))(\h+\w+)*\h*(\;\h*)?$<ret> m<a-\;>J <a-S> 1<a-&>
|
execute-keys -draft k<a-x> 1s(\))(\h+\w+)*\h*(\;\h*)?$<ret> m<a-\;>J <a-S> 1<a-&>
|
||||||
> catch %<
|
> catch %<
|
||||||
# else indent new lines with the same level as the previous one
|
# else indent new lines with the same level as the previous one
|
||||||
@ -74,7 +77,7 @@ define-command -hidden c-family-insert-on-closing-curly-brace %[
|
|||||||
try %[ execute-keys -itersel -draft hm<a-x>B<a-x><a-k>\A\h*(class|struct|union|enum)<ret> a\;<esc> ]
|
try %[ execute-keys -itersel -draft hm<a-x>B<a-x><a-k>\A\h*(class|struct|union|enum)<ret> a\;<esc> ]
|
||||||
]
|
]
|
||||||
|
|
||||||
define-command -hidden c-family-insert-on-newline %[ evaluate-commands -draft %[
|
define-command -hidden c-family-insert-on-newline %[ evaluate-commands -itersel -draft %[
|
||||||
execute-keys \;
|
execute-keys \;
|
||||||
try %[
|
try %[
|
||||||
evaluate-commands -draft %[
|
evaluate-commands -draft %[
|
||||||
@ -99,7 +102,7 @@ define-command -hidden c-family-insert-on-newline %[ evaluate-commands -draft %[
|
|||||||
try %[
|
try %[
|
||||||
# if the previous line is opening the comment, insert star preceeded by space
|
# if the previous line is opening the comment, insert star preceeded by space
|
||||||
execute-keys -draft k<a-x><a-k>^\h*/\*<ret>
|
execute-keys -draft k<a-x><a-k>^\h*/\*<ret>
|
||||||
execute-keys -draft i<space>*<space><esc>
|
execute-keys -draft i*<space><esc>
|
||||||
] catch %[
|
] catch %[
|
||||||
try %[
|
try %[
|
||||||
# if the next line is a comment line insert a star
|
# if the next line is a comment line insert a star
|
||||||
@ -117,9 +120,9 @@ define-command -hidden c-family-insert-on-newline %[ evaluate-commands -draft %[
|
|||||||
]
|
]
|
||||||
|
|
||||||
# trim trailing whitespace on the previous line
|
# trim trailing whitespace on the previous line
|
||||||
try %[ execute-keys -draft 1s(\h+)$<ret>d ]
|
try %[ execute-keys -draft s\h+$<ret> d ]
|
||||||
# align the new star with the previous one
|
# align the new star with the previous one
|
||||||
execute-keys J<a-x>1s^[^*]*(\*)<ret>&
|
execute-keys K<a-x>1s^[^*]*(\*)<ret>&
|
||||||
]
|
]
|
||||||
] ]
|
] ]
|
||||||
|
|
||||||
|
1
test/indent/c-family/comment-line-continuation/cmd
Normal file
1
test/indent/c-family/comment-line-continuation/cmd
Normal file
@ -0,0 +1 @@
|
|||||||
|
c<ret>bar<ret><ret><esc>
|
3
test/indent/c-family/comment-line-continuation/in
Normal file
3
test/indent/c-family/comment-line-continuation/in
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
/* foo%( )
|
||||||
|
|
||||||
|
// foo%( )
|
8
test/indent/c-family/comment-line-continuation/out
Normal file
8
test/indent/c-family/comment-line-continuation/out
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
/* foo
|
||||||
|
* bar
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
// foo
|
||||||
|
// bar
|
||||||
|
|
3
test/indent/c-family/comment-line-continuation/rc
Normal file
3
test/indent/c-family/comment-line-continuation/rc
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
source "%val{runtime}/colors/default.kak"
|
||||||
|
source "%val{runtime}/rc/core/c-family.kak"
|
||||||
|
set buffer filetype cpp
|
Loading…
Reference in New Issue
Block a user