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

View File

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