-
Notifications
You must be signed in to change notification settings - Fork 0
/
m.vim
37 lines (31 loc) · 858 Bytes
/
m.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
function! AddBookmarksToLocationList()
redir => tmp
silent marks
redir END
let bookmarks=split(tmp, '\n')
let locations=[]
for bookmark in bookmarks
let l=matchlist(bookmark, '^\s*\([0-9a-zA-Z]\)\s\+\(\d\+\)\s\+\(\d\+\)\s\+\(.\+\)')
if empty(l)
continue
endif
let f=substitute(l[4], "^\\~/", $HOME . "/", "")
if filereadable(f)
let l[5]=l[1]
let l[4]=f
else
let l[5]=l[4]
let l[4]=expand("%:p")
if ! filereadable(l[4])
continue
endif
endif
call add(locations, join(l[1:5], " "))
endfor
let save_efm=&efm
set efm=%t\ %l\ %c\ %f\ %s
laddexpr locations
let &efm=save_efm
lopen
endfunction
:command! Bookmark :call AddBookmarksToLocationList()