z_mirror/dotfiles

git clone https://git.raiguard.me/z_mirror/dotfiles

Caleb Heuerkak: Include live-grep buffer in jumplists32def53

trunk
2.0 KiB55 linesraw
1declare-option str my_jump_buffers \*(grep|live-grep|find|callers|callees|goto|symbols|diagnostics|frun|make|cargo)\b.*\*
2map global normal <c-a-n> %{:jump-next -matching %opt{my_jump_buffers}<ret>} -docstring 'next location'
3map global normal <c-a-p> %{:jump-previous -matching %opt{my_jump_buffers}<ret>} -docstring 'previous location'
4
5# map global normal <c-a-e> %{:my-push-buffer<ret>} -docstring 'push buffer'
6# map global normal <c-a-r> %{:my-jump-buffer-pop %opt{my_jump_buffers}<ret>} -docstring 'pop jump buffer'
7# map global user j %{:buffer -matching %opt{my_jump_buffers}<ret>} -docstring "latest jump buffer"
8
9# define-command -override my-push-buffer %{
10# 	declare-option str my_push_buffer_safeguard nop
11# 	evaluate-commands %sh{
12# 		if printf %s "${kak_bufname}" | grep -q '^\*'; then {
13# 			basename=$(printf %s "${kak_bufname}" | sed 's,\(-[0-9]*\)\?\*$,,')
14# 			echo "rename-buffer -unique $basename-|*"
15# 		} else {
16# 			echo  "
17# 			%opt{my_push_buffer_safeguard}
18# 			set-option local my_push_buffer_safeguard %{fail recursion}
19# 			evaluate-commands -draft %{
20# 				buffer -matching %opt{my_jump_buffers}
21# 				my-push-buffer
22# 			}
23# 			"
24# 		} fi
25# 	}
26# }
27# define-command my-jump-buffer-pop -params 1 -docstring %{
28# 	delete the given buffer.
29# 	Activate the new last buffer in the client specified in the 'toolsclient'
30# 	option. If the active client is different from 'toolsclient', jump to
31# 	the current location.
32# } %{
33# 	buffer -matching %arg{1}
34# 	delete-buffer
35# 	try %{
36# 		evaluate-commands -save-regs b %{
37# 			evaluate-commands -try-client %opt{toolsclient} %{
38# 				buffer -matching %arg{1}
39# 				set-register b %val{bufname}
40# 			}
41# 			evaluate-commands -try-client %opt{jumpclient} %{
42# 				evaluate-commands %sh{
43# 					if [ -n "${kak_opt_toolsclient}" ] &&
44# 					[ "${kak_client}" != "${kak_opt_toolsclient}" ]; then
45# 					echo buffer %reg{b}
46# 					echo jump
47# 					fi
48# 				}
49# 			}
50# 			echo -markup {Information}{\}returned to buffer %reg{b}
51# 		}
52# 	} catch %{
53# 		echo -markup {Information}no jump buffer remaining
54# 	}
55# }