Merge remote-tracking branch 'lenormf/rc/c-family.kak-astyle'

This commit is contained in:
Maxime Coste 2015-10-21 09:51:21 +01:00
commit 64b7ccd107

View File

@ -68,6 +68,17 @@ def -hidden _c-family-indent-on-closing-curly-brace %[
try %[ exec -draft "hm;<a-?>(class|struct|union)<ret><a-k>\`(class|struct|union)[^{}\n]+(\n)?\s*\{\'<ret><a-;>ma;<esc>" ] try %[ exec -draft "hm;<a-?>(class|struct|union)<ret><a-k>\`(class|struct|union)[^{}\n]+(\n)?\s*\{\'<ret><a-;>ma;<esc>" ]
] ]
decl str c_astyle_options ""
def c-format-astyle -docstring "Format C/C++/Obj-C code using the astyle utility" %{
%sh{
readonly x=$((kak_cursor_column - 1))
readonly y="${kak_cursor_line}"
echo "exec -draft %{%|astyle<space>${kak_opt_c_astyle_options// /<space>}<ret>}"
echo "exec gg ${y}g ${x}l"
}
}
# Regions definition are the same between c++ and objective-c # Regions definition are the same between c++ and objective-c
%sh{ %sh{
for ft in c cpp objc; do for ft in c cpp objc; do
@ -122,13 +133,20 @@ hook global WinSetOption filetype=(c|cpp|objc) %[
alias window alt c-family-alternative-file alias window alt c-family-alternative-file
alias window comment-selection c-family-comment-selection alias window comment-selection c-family-comment-selection
alias window comment-line c-family-comment-line
alias window format-code c-format-astyle
] ]
hook global WinSetOption filetype=(?!(c|cpp|objc)$).* %[ hook global WinSetOption filetype=(?!(c|cpp|objc)$).* %[
rmhooks window c-family-indent
rmhooks window c-family-hooks rmhooks window c-family-hooks
rmhooks window c-family-indent
unalias window alt c-family-alternative-file unalias window alt c-family-alternative-file
unalias window comment-selection c-family-comment-selection unalias window comment-selection c-family-comment-selection
unalias window comment-line c-family-comment-line
unalias window format-code c-format-astyle
] ]
hook global WinSetOption filetype=c %[ addhl ref c ] hook global WinSetOption filetype=c %[ addhl ref c ]