-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathostroga.vim
40 lines (36 loc) · 1.17 KB
/
ostroga.vim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
function! s:in_current_file(marks)
return a:marks->filter({_, mark_info -> fnamemodify(mark_info.file, ':p') == expand('%:p')})
endfunction
function! s:global_alpha_marks()
return getmarklist()
\ ->filter({_, mark_info -> mark_info.mark[1:] =~? '[[:alpha:]]'})
endfunction
function! s:choose_mark(winid, key)
if a:key =~? '[[:alpha:]]'
exe 'silent! normal! `' . toupper(a:key)
call popup_close(a:winid)
return 1
elseif a:key ==? "\<esc>"
call popup_close(a:winid)
return 1
endif
return 0
endfunction
function! ostroga#update_global_marks()
for info in s:global_alpha_marks()
\ ->s:in_current_file()
exe 'normal! m' . info.mark[1:]
endfor
endfunction
function! ostroga#popup_create()
return popup_create(ostroga#ui#marks_to_hints(s:global_alpha_marks()), {
\ 'filter': function('s:choose_mark'),
\
\ 'title': ' Jump to mark',
\ 'border': [1, 1, 1, 1],
\ 'borderchars': ['┈', '⸽', '┈', '⸽', '✨', '✨', '✨', '✨'],
\ 'mapping': v:false,
\ 'highlight': 'Normal',
\ 'borderhighlight': ['Statement'],
\})
endfunction