remove hooks when needed in rc files

This commit is contained in:
Maxime Coste 2013-04-11 14:30:02 +02:00
parent 107e95622d
commit 301921cd45
6 changed files with 15 additions and 10 deletions

View File

@ -29,8 +29,10 @@ def clang-complete %{
}
def clang-enable-autocomplete %{
hook window InsertIdle .* %{ eval -draft %{
hook window -id clang-autocomplete InsertIdle .* %{ eval -draft %{
exec <a-h>
%sh{ [[ $kak_selection =~ .*(\.|->|::).$ ]] && echo "exec <a-space>; echo 'completing...'; clang-complete" }
}}
}
def clang-disable-autocomplete %{ rmhooks window clang-autocomplete }

View File

@ -22,12 +22,13 @@ hook global WinSetOption filetype=cpp %~
addfilter -group cpp-filters regex ^(\h+)([^\n]*[^([{]\h*|$) \n \n$1
addfilter -group cpp-filters regex ^(\h*)[^\n]*[([{]\h* \n '\n$1 '
addfilter -group cpp-filters cleanup_whitespaces
hook window InsertEnd .* %{ exec -draft <a-x>s\h+$<ret>d }
hook window InsertEnd .* -id cpp-hooks %{ exec -draft <a-x>s\h+$<ret>d }
~
hook global WinSetOption filetype=(?!cpp).* %{
rmhl cpp-highlight
rmfilter cpp-filters
rmhooks window cpp-hooks
}
hook global BufNew .*\.(h|hh|hpp|hxx|H) %{

View File

@ -42,7 +42,9 @@ def funcinfo %{
}
def ctags-enable-autoinfo %{
hook window NormalIdle .* funcinfo
hook window NormalEnd .* info
hook window InsertIdle .* funcinfo
hook window -id ctags-autoinfo NormalIdle .* funcinfo
hook window -id ctags-autoinfo NormalEnd .* info
hook window -id ctags-autoinfo InsertIdle .* funcinfo
}
def ctags-disable-autoinfo %{ rmhooks window ctags-autoinfo }

View File

@ -22,9 +22,9 @@ def -shell-params -file-completion \
hook global WinSetOption filetype=grep %{
addhl group grep-highlight
addhl -group grep-highlight regex "^([^:]+):(\d+):(\d+)?" 1:cyan 2:green 3:green
hook buffer NormalKey <c-m> jump
hook buffer -id grep-hooks NormalKey <c-m> jump
}
hook global WinSetOption filetype=(?!grep).* %{ rmhl grep-highlight; }
hook global WinSetOption filetype=(?!grep).* %{ rmhl grep-highlight; rmhooks buffer grep-hooks }
def jump %{ exec 'xs^([^:]+):(\d+):(\d+)?<ret>'; edit %reg{1} %reg{2} %reg{3} }

View File

@ -4,7 +4,7 @@ hook global BufCreate (.*/)?(kakrc|.*.kak) %{
hook global WinSetOption filetype=kak %{
addhl group kak-highlight
addhl -group kak-highlight regex \<(hook|addhl|rmhl|addfilter|rmfilter|exec|eval|source|runtime|def|echo|edit|set[gbw])\> 0:keyword
addhl -group kak-highlight regex \<(hook|rmhooks|addhl|rmhl|addfilter|rmfilter|exec|eval|source|runtime|def|decl|echo|edit|set[gbw])\> 0:keyword
addhl -group kak-highlight regex \<(default|black|red|green|yellow|blue|magenta|cyan|white)\> 0:value
addhl -group kak-highlight regex (?<=\<hook)\h+((global|buffer|window)|(\S+))\h+(\S+)\h+(\H+) 2:attribute 3:error 4:identifier 5:string
addhl -group kak-highlight regex (?<=\<regex)\h+(\S+) 1:string

View File

@ -17,9 +17,9 @@ def -shell-params make %{ %sh{
hook global WinSetOption filetype=make %{
addhl group make-highlight
addhl -group make-highlight regex "^([^:\n]+):(\d+):(\d+):\h+(?:((?:fatal )?error)|(warning)|(note)|(required from(?: here)?))?.*?$" 1:cyan 2:green 3:green 4:red 5:yellow 6:blue 7:yellow
hook buffer NormalKey <c-m> errjump
hook buffer -id make-hooks NormalKey <c-m> errjump
}
hook global WinSetOption filetype=(?!make).* %{ rmhl make-highlight; }
hook global WinSetOption filetype=(?!make).* %{ rmhl make-highlight; rmhooks buffer make-hooks }
def errjump %{ exec 'xs^([^:\n]+):(\d+)(?::(\d+))?:(.*?)$<ret><a-h><space>'; edit %reg{1} %reg{2} %reg{3}; echo %reg{4} }