1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-12-28 22:22:41 +03:00

tweak style cpp.kak

This commit is contained in:
Maxime Coste 2013-11-14 00:11:27 +00:00
parent 323997041d
commit 9679b17b16

View File

@ -6,7 +6,7 @@ hook global BufSetOption mimetype=text/x-c(\+\+)? %{
set buffer filetype cpp set buffer filetype cpp
} }
def -hidden _cpp_indent_on_new_line %@ def -hidden _cpp_indent_on_new_line %~
eval -draft -itersel %_ eval -draft -itersel %_
# preserve previous line indent # preserve previous line indent
try %{ exec -draft k<a-x>s^\h+<ret>yj<a-h>P } try %{ exec -draft k<a-x>s^\h+<ret>yj<a-h>P }
@ -23,7 +23,7 @@ def -hidden _cpp_indent_on_new_line %@
# indent after if|else|while|for # indent after if|else|while|for
try %[ exec -draft <a-F>)MB<a-k>\`(if|else|while|for)\h*\(.*\)\n\h*\n\'<ret><a-space><space><a-gt> ] try %[ exec -draft <a-F>)MB<a-k>\`(if|else|while|for)\h*\(.*\)\n\h*\n\'<ret><a-space><space><a-gt> ]
_ _
@ ~
def -hidden _cpp_indent_on_closing_curly_brace %[ def -hidden _cpp_indent_on_closing_curly_brace %[
# deindent on insert } alone on a line # deindent on insert } alone on a line
@ -32,7 +32,7 @@ def -hidden _cpp_indent_on_closing_curly_brace %[
try %[ exec -draft "hm<space><a-?>(class|struct)<ret><a-k>\`(class|struct)[^{}\n]+(\n)?\s*\{\'<ret><a-space>ma;<esc>" ] try %[ exec -draft "hm<space><a-?>(class|struct)<ret><a-k>\`(class|struct)[^{}\n]+(\n)?\s*\{\'<ret><a-space>ma;<esc>" ]
] ]
hook global WinSetOption filetype=cpp %~ hook global WinSetOption filetype=cpp %[
addhl group cpp-highlight addhl group cpp-highlight
addhl -group cpp-highlight regex "\<(this|true|false|NULL|nullptr|)\>|\<-?\d+[fdiu]?|'((\\.)?|[^'\\])'" 0:value addhl -group cpp-highlight regex "\<(this|true|false|NULL|nullptr|)\>|\<-?\d+[fdiu]?|'((\\.)?|[^'\\])'" 0:value
addhl -group cpp-highlight regex "\<(void|int|char|unsigned|float|bool|size_t)\>" 0:type addhl -group cpp-highlight regex "\<(void|int|char|unsigned|float|bool|size_t)\>" 0:type
@ -47,7 +47,7 @@ hook global WinSetOption filetype=cpp %~
hook window InsertChar \n -id cpp-indent _cpp_indent_on_new_line hook window InsertChar \n -id cpp-indent _cpp_indent_on_new_line
hook window InsertChar \} -id cpp-indent _cpp_indent_on_closing_curly_brace hook window InsertChar \} -id cpp-indent _cpp_indent_on_closing_curly_brace
~ ]
hook global WinSetOption filetype=(?!cpp).* %{ hook global WinSetOption filetype=(?!cpp).* %{
rmhl cpp-highlight rmhl cpp-highlight