rc/{grep,make}.kak: use a scratch buffer to store results

This commit is contained in:
Maxime Coste 2012-08-07 23:29:12 +02:00
parent 78b0c2f7f5
commit e7153aacef
2 changed files with 12 additions and 2 deletions

View File

@ -1,7 +1,12 @@
def -env-params grep %{ echo grep in progress, please wait...; %sh{ def -env-params grep %{ echo grep in progress, please wait...; %sh{
output=$(mktemp -t kak-grep.XXXXXXXX) output=$(mktemp -t kak-grep.XXXXXXXX)
grep -Hn $kak_param0 $kak_param1 $kak_param2 $kak_param3 $kak_param4 >& ${output} grep -Hn $kak_param0 $kak_param1 $kak_param2 $kak_param3 $kak_param4 >& ${output}
echo "echo; edit ${output}; setb filetype grep; hook buffer BufClose ${output} %{ %sh{rm ${output} } }" echo "echo
try %{ db *grep* } catch %{ }
edit -scratch *grep*
setb filetype grep
exec %{|cat ${output}<ret>gg}
%sh{rm ${output} }"
}} }}
hook global WinSetOption filetype=grep %{ hook global WinSetOption filetype=grep %{

View File

@ -1,7 +1,12 @@
def -env-params make %{ echo make in progress, please wait...; %sh{ def -env-params make %{ echo make in progress, please wait...; %sh{
output=$(mktemp -t kak-make.XXXXXXXX) output=$(mktemp -t kak-make.XXXXXXXX)
make ${kak_param_0} ${kak_param_1} ${kak_param_2} ${kak_param_3} ${kak_param_4} >& ${output} make ${kak_param_0} ${kak_param_1} ${kak_param_2} ${kak_param_3} ${kak_param_4} >& ${output}
echo "echo; edit ${output}; setb filetype make; hook buffer BufClose ${output} %{ %sh{rm ${output} } }" echo "echo
try %{ db *make* } catch %{ }
edit -scratch %{*make*}
setb filetype make
exec %{|cat ${output}<ret>gg}
%sh{ rm ${output} }"
}} }}
hook global WinSetOption filetype=make %{ hook global WinSetOption filetype=make %{