Modify the name and attribute of three grep commands
Add the "grep" prefix to the "jump", "next" and "prev" commands for homogeneity with other kak scripts, and prevent the "grep-jump" command from raising errors by enclosing it into a try{} scope.
This commit is contained in:
parent
142c34d6de
commit
38bb9fc3a8
16
rc/grep.kak
16
rc/grep.kak
|
@ -34,14 +34,16 @@ hook global WinSetOption filetype=(?!grep).* %{ rmhl grep; rmhooks buffer grep-h
|
|||
|
||||
decl str jumpclient
|
||||
|
||||
def jump %{
|
||||
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-jump %{
|
||||
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 next -docstring 'Jump to next grep match' %{
|
||||
def grep-next -docstring 'Jump to next grep match' %{
|
||||
eval -try-client %opt{jumpclient} %{
|
||||
buffer '*grep*'
|
||||
exec "%opt{_grep_current_line}g<a-l>/^[^:]+:\d+:<ret>"
|
||||
|
@ -49,7 +51,7 @@ def next -docstring 'Jump to next grep match' %{
|
|||
}
|
||||
}
|
||||
|
||||
def prev -docstring 'Jump to previous grep match' %{
|
||||
def grep-prev -docstring 'Jump to previous grep match' %{
|
||||
eval -try-client %opt{jumpclient} %{
|
||||
buffer '*grep*'
|
||||
exec "%opt{_grep_current_line}g<a-/>^[^:]+:\d+:<ret>"
|
||||
|
|
Loading…
Reference in New Issue
Block a user