diff --git a/src/rc/cpp.kak b/src/rc/cpp.kak index c5b0f422..6e957f01 100644 --- a/src/rc/cpp.kak +++ b/src/rc/cpp.kak @@ -25,8 +25,12 @@ hook global WinSetOption filetype=cpp %~ try %[ exec -draft k[{(]\h*$j ] # indent after lines ending with { or ( try %{ exec -draft ks\h+$d } # cleanup trailing white space son previous line try %{ exec -draft [(\`\([^\n]+\n[^\n]*\n?\'s\`..|.\'& } # align to opening paren of previous line + try %{ exec -draft ks^\h*\K(/{2,})yP } # copy // comments prefix _ @ - hook window InsertChar \} -id cpp-indent %[ try %[ exec -draft ^\h+\}$< ] ] # deindent on insert } alone on a line + hook window InsertChar \} -id cpp-indent %[ + try %[ exec -draft ^\h+\}$< ] # deindent on insert } alone on a line + try %[ exec -draft "hm(class|struct)\`(class|struct)[^{}\n]+(\n)?\s*\{\'ma;" ] # add ; after } if class or struct definition + ] ~ hook global WinSetOption filetype=(?!cpp).* %{