Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 14 additions & 12 deletions rc/tools/jump.kak
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ declare-option -docstring "name of the client in which utilities display informa

provide-module jump %{

declare-option -hidden str jump_current_buffer ''
declare-option -hidden int jump_current_line 0

define-command -hidden jump %{
Expand All @@ -14,24 +15,25 @@ define-command -hidden jump %{
execute-keys ',xs^([^:\n]+):(\d+):(\d+)?<ret>'
set-register a %reg{1} %reg{2} %reg{3}
}
set-option global jump_current_buffer %val{bufname}
set-option buffer jump_current_line %val{cursor_line}
evaluate-commands -try-client %opt{jumpclient} -verbatim -- edit -existing -- %reg{a}
try %{ focus %opt{jumpclient} }
}
}
}

define-command jump-next -params 1.. -docstring %{
define-command jump-next -params .. -docstring %{
jump-next <bufname>: jump to next location listed in the given *grep*-like location list buffer.
} %{
evaluate-commands -try-client %opt{jumpclient} -save-regs / %{
buffer %arg{@}
jump-select-next
jump
evaluate-commands -try-client %opt{jumpclient} -save-regs / %sh{
args='%arg{@}'
[ "$#" -eq 0 ] && args='%opt{jump_current_buffer}'
printf %s\\n "buffer $args" jump-select-next jump
}
try %{
evaluate-commands -client %opt{toolsclient} %{
buffer %arg{@}
buffer %opt{jump_current_buffer}
execute-keys gg %opt{jump_current_line}g
}
}
Expand All @@ -44,17 +46,17 @@ define-command -hidden jump-select-next %{
execute-keys ge %opt{jump_current_line}g<a-l> /^[^:\n]+:\d+:<ret>
}

define-command jump-previous -params 1.. -docstring %{
define-command jump-previous -params .. -docstring %{
jump-previous <bufname>: jump to previous location listed in the given *grep*-like location list buffer.
} %{
evaluate-commands -try-client %opt{jumpclient} -save-regs / %{
buffer %arg{@}
jump-select-previous
jump
evaluate-commands -try-client %opt{jumpclient} -save-regs / %sh{
args='%arg{@}'
[ "$#" -eq 0 ] && args='%opt{jump_current_buffer}'
printf %s\\n "buffer $args" jump-select-previous jump
}
try %{
evaluate-commands -client %opt{toolsclient} %{
buffer %arg{@}
buffer %opt{jump_current_buffer}
execute-keys gg %opt{jump_current_line}g
}
}
Expand Down
Loading