Collapse jumps in grep.kak and make.kak

This commit is contained in:
Maxime Coste 2016-03-20 16:37:58 +00:00
parent 38f146d849
commit 3499d440de
2 changed files with 24 additions and 20 deletions

View File

@ -35,16 +35,18 @@ hook global WinSetOption filetype=(?!grep).* %{ rmhl grep; rmhooks buffer grep-h
decl str jumpclient
def grep-jump %{
eval -collapse-jumps %{
try %{
exec 'xs^((?:\w:)?[^:]+):(\d+):(\d+)?<ret>'
set buffer _grep_current_line %val{cursor_line}
eval -try-client %opt{jumpclient} edit -existing %reg{1} %reg{2} %reg{3}
try %{ focus %opt{jumpclient} }
}
}
}
def grep-next -docstring 'Jump to next grep match' %{
eval -try-client %opt{jumpclient} %{
eval -collapse-jumps -try-client %opt{jumpclient} %{
buffer '*grep*'
exec "%opt{_grep_current_line}g<a-l>/^[^:]+:\d+:<ret>"
grep-jump
@ -53,7 +55,7 @@ def grep-next -docstring 'Jump to next grep match' %{
}
def grep-prev -docstring 'Jump to previous grep match' %{
eval -try-client %opt{jumpclient} %{
eval -collapse-jumps -try-client %opt{jumpclient} %{
buffer '*grep*'
exec "%opt{_grep_current_line}g<a-/>^[^:]+:\d+:<ret>"
grep-jump

View File

@ -32,6 +32,7 @@ hook global WinSetOption filetype=(?!make).* %{ rmhl make; rmhooks buffer make-h
decl str jumpclient
def make-jump -docstring 'Jump to error location' %{
eval -collapse-jumps %{
try %{
exec gl<a-?> "Entering directory" <ret>
exec s "Entering directory '([^']+)'.*\n([^:]+):(\d+):(?:(\d+):)?([^\n]+)\'" <ret>l
@ -44,10 +45,11 @@ def make-jump -docstring 'Jump to error location' %{
eval -try-client %opt{jumpclient} "edit -existing %reg{1} %reg{2} %reg{3}; echo -color Information %{%reg{4}}"
try %{ focus %opt{jumpclient} }
}
}
}
def make-next -docstring 'Jump to next error' %{
eval -try-client %opt{jumpclient} %{
eval -collapse-jumps -try-client %opt{jumpclient} %{
buffer '*make*'
exec "%opt{_make_current_error_line}g<a-l>/[0-9]+: (?:fatal )?error:<ret>"
make-jump
@ -56,7 +58,7 @@ def make-next -docstring 'Jump to next error' %{
}
def make-prev -docstring 'Jump to previous error' %{
eval -try-client %opt{jumpclient} %{
eval -collapse-jumps -try-client %opt{jumpclient} %{
buffer '*make*'
exec "%opt{_make_current_error_line}g<a-h><a-/>[0-9]+: (?:fatal )?error:<ret>"
make-jump