cleanup {make,grep}.kak

This commit is contained in:
Maxime Coste 2012-12-06 20:12:44 +01:00
parent b81ea0bc92
commit ff1f9f662d
2 changed files with 6 additions and 8 deletions

View File

@ -1,10 +1,9 @@
def -shell-params -file-completion \ def -shell-params -file-completion \
grep %{ echo grep in progress, please wait...; %sh{ grep %{ %sh{
output=$(mktemp -d -t kak-grep.XXXXXXXX)/fifo output=$(mktemp -d -t kak-grep.XXXXXXXX)/fifo
mkfifo ${output} mkfifo ${output}
( grep -PHn "$@" >& ${output} ) >& /dev/null < /dev/null & ( grep -PHn "$@" >& ${output} ) >& /dev/null < /dev/null &
echo "echo echo "try %{ db *grep* } catch %{ }
try %{ db *grep* } catch %{ }
edit -fifo ${output} *grep* edit -fifo ${output} *grep*
setb filetype grep setb filetype grep
hook buffer BufClose .* %{ %sh{ rm -r $(dirname ${output}) } }" hook buffer BufClose .* %{ %sh{ rm -r $(dirname ${output}) } }"

View File

@ -1,9 +1,8 @@
def -shell-params make %{ echo make in progress, please wait...; %sh{ def -shell-params make %{ %sh{
output=$(mktemp -d -t kak-make.XXXXXXXX)/fifo output=$(mktemp -d -t kak-make.XXXXXXXX)/fifo
mkfifo ${output} mkfifo ${output}
( make $@ >& ${output} ) >& /dev/null < /dev/null & ( make $@ >& ${output} ) >& /dev/null < /dev/null &
echo "echo echo "try %{ db *make* } catch %{ }
try %{ db *make* } catch %{ }
edit -fifo ${output} *make* edit -fifo ${output} *make*
setb filetype make setb filetype make
hook buffer BufClose .* %{ %sh{ rm -r $(dirname ${output}) } }" hook buffer BufClose .* %{ %sh{ rm -r $(dirname ${output}) } }"
@ -11,9 +10,9 @@ def -shell-params make %{ echo make in progress, please wait...; %sh{
hook global WinSetOption filetype=make %{ hook global WinSetOption filetype=make %{
addhl group make-highlight addhl group make-highlight
addhl -group make-highlight regex "^([^:\n]+):(\d+):(\d+):\h+(?:((?:fatal )?error)|(warning)|(note)|(required from(?: here)?))?[^\n]*" 1:cyan 2:green 3:green 4:red 5:yellow 6:blue 7:yellow 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 global WinSetOption filetype=(?!make).* %{ rmhl make-highlight; } hook global WinSetOption filetype=(?!make).* %{ rmhl make-highlight; }
def errjump %{ exec 'xs^([^:]+):(\d+)(?::(\d+))?:([^\n]+)\n<ret>'; edit %reg{1} %reg{2} %reg{3}; echo %reg{4} } def errjump %{ exec 'xs^([^:\n]+):(\d+)(?::(\d+))?:(.*?)$<ret>'; edit %reg{1} %reg{2} %reg{3}; echo %reg{4} }