Merge branch 'master' into ranked-word-completion

This commit is contained in:
Maxime Coste 2015-10-21 19:21:26 +01:00
commit be76ba0461
4 changed files with 27 additions and 8 deletions

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>" ]
]
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
%sh{
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 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)$).* %[
rmhooks window c-family-indent
rmhooks window c-family-hooks
rmhooks window c-family-indent
unalias window alt c-family-alternative-file
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 ]

View File

@ -22,8 +22,8 @@ addhl -group / regions -default code dlang \
comment '//' $ ''
addhl -group /dlang/string fill string
addhl -group /dlang/verbatim_string fill rgb:FF40D4
addhl -group /dlang/verbatim_string_prefixed fill rgb:FF40D4
addhl -group /dlang/verbatim_string fill magenta
addhl -group /dlang/verbatim_string_prefixed fill magenta
addhl -group /dlang/token fill meta
addhl -group /dlang/disabled fill rgb:777777
addhl -group /dlang/comment fill comment
@ -93,7 +93,7 @@ hook global WinSetOption filetype=dlang %{
hook window InsertChar \{ -group dlang-indent _dlang-indent-on-opening-curly-brace
hook window InsertChar \} -group dlang-indent _dlang-indent-on-closing-curly-brace
alias buffer format-code dlang-format-dfmt
alias window format-code dlang-format-dfmt
}
hook global WinSetOption filetype=(?!dlang).* %{
@ -102,5 +102,5 @@ hook global WinSetOption filetype=(?!dlang).* %{
rmhooks window dlang-hooks
rmhooks window dlang-indent
unalias buffer format-code
unalias window format-code dlang-format-dfmt
}

View File

@ -16,6 +16,7 @@ addhl -group / regions -default code golang \
back_string '`' '`' '' \
double_string '"' (?<!\\)(\\\\)*" '' \
single_string "'" (?<!\\)(\\\\)*' '' \
comment /\* \*/ '' \
comment '//' $ ''
addhl -group /golang/back_string fill string
@ -83,7 +84,7 @@ hook global WinSetOption filetype=golang %{
hook window InsertChar \{ -group golang-indent _golang-indent-on-opening-curly-brace
hook window InsertChar \} -group golang-indent _golang-indent-on-closing-curly-brace
alias buffer format-code golang-format-gofmt
alias window format-code golang-format-gofmt
}
hook global WinSetOption filetype=(?!golang).* %{
@ -92,5 +93,5 @@ hook global WinSetOption filetype=(?!golang).* %{
rmhooks window golang-hooks
rmhooks window golang-indent
unalias buffer format-code
unalias window format-code golang-format-gofmt
}

View File

@ -1,4 +1,4 @@
hook global BufCreate .*\.((z|ba|c|k)?sh) %{
hook global BufCreate .*\.(z|ba|c|k)?sh(rc|_profile)? %{
set buffer filetype sh
}