@@ -5,6 +5,7 @@ declare-option -docstring "name of the client in which utilities display informa
55
66provide-module jump %{
77
8+ declare-option -hidden str jump_current_buffer ' '
89declare-option -hidden int jump_current_line 0
910
1011define-command -hidden jump %{
@@ -14,24 +15,25 @@ define-command -hidden jump %{
1415 execute-keys ' ,xs^([^:\n]+):(\d+):(\d+)?<ret>'
1516 set-register a %reg {1 } %reg {2 } %reg {3 }
1617 }
18+ set-option global jump_current_buffer %val{bufname }
1719 set-option buffer jump_current_line %val{cursor_line }
1820 evaluate-commands -try -client %opt{jumpclient} -verbatim -- edit -existing -- %reg {a}
1921 try %{ focus %opt{jumpclient} }
2022 }
2123 }
2224}
2325
24- define-command jump-next -params 1 .. -docstring %{
26+ define-command jump-next -params .. -docstring %{
2527 jump-next <bufname >: jump to next location listed in the given *grep*-like location list buffer .
2628} %{
27- evaluate-commands -try -client %opt{jumpclient} -save-regs / %{
28- buffer %arg{@}
29- jump- select -next
30- jump
29+ evaluate-commands -try -client %opt{jumpclient} -save-regs / %sh {
30+ args= ' %arg{@}'
31+ [ " $# " -eq 0 ] && args= ' %opt{jump_current_buffer} '
32+ printf %s \\ n " buffer $args " jump-select-next jump
3133 }
3234 try %{
3335 evaluate-commands -client %opt{toolsclient} %{
34- buffer %arg{@ }
36+ buffer %opt{jump_current_buffer }
3537 execute-keys gg %opt{jump_current_line}g
3638 }
3739 }
@@ -44,17 +46,17 @@ define-command -hidden jump-select-next %{
4446 execute-keys ge %opt{jump_current_line}g<a-l> /^[^:\n]+:\d+:<ret>
4547}
4648
47- define-command jump-previous -params 1 .. -docstring %{
49+ define-command jump-previous -params .. -docstring %{
4850 jump-previous <bufname >: jump to previous location listed in the given *grep*-like location list buffer .
4951} %{
50- evaluate-commands -try -client %opt{jumpclient} -save-regs / %{
51- buffer %arg{@}
52- jump- select -previous
53- jump
52+ evaluate-commands -try -client %opt{jumpclient} -save-regs / %sh {
53+ args= ' %arg{@}'
54+ [ " $# " -eq 0 ] && args= ' %opt{jump_current_buffer} '
55+ printf %s \\ n " buffer $args " jump-select-previous jump
5456 }
5557 try %{
5658 evaluate-commands -client %opt{toolsclient} %{
57- buffer %arg{@ }
59+ buffer %opt{jump_current_buffer }
5860 execute-keys gg %opt{jump_current_line}g
5961 }
6062 }
0 commit comments