Support for custom indices for g:startify_bookmarks
g:startify_bookmarks now supports custom indices directly. E.g. let g:startify_bookmarks = [ {'v': '~/.vimrc'} ] References #176, #178.
This commit is contained in:
parent
0bb969178d
commit
df8b4e1fde
2 changed files with 14 additions and 7 deletions
|
@ -529,14 +529,19 @@ function! s:show_bookmarks() abort
|
|||
call s:print_section_header()
|
||||
endif
|
||||
|
||||
for fname in g:startify_bookmarks
|
||||
let index = s:get_index_as_string(s:entry_number)
|
||||
for bookmark in g:startify_bookmarks
|
||||
if type(bookmark) == 4 " dict?
|
||||
let [index, fname] = items(bookmark)[0]
|
||||
else " string
|
||||
let [index, fname] = [s:get_index_as_string(s:entry_number), bookmark]
|
||||
let s:entry_number += 1
|
||||
endif
|
||||
call append('$', ' ['. index .']'. repeat(' ', (3 - strlen(index))) . fname)
|
||||
if has('win32')
|
||||
let fname = substitute(fname, '\[', '\[[]', 'g')
|
||||
endif
|
||||
call s:register(line('$'), index, 'file', 'edit', fname)
|
||||
let s:entry_number += 1
|
||||
unlet bookmark " avoid type mismatch for heterogeneous lists
|
||||
endfor
|
||||
|
||||
call append('$', '')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue