-
Notifications
You must be signed in to change notification settings - Fork 100
Open
Description
When loading bookmarks with BookmarkLoad, the plugin sometimes return an error stating:
Failed to load/parse fileThis happens because of the sign place command, which could be called with a file argument associated to a buffer which hasn't been opened yet:
vim-bookmarks/autoload/bm_sign.vim
Lines 47 to 55 in 9cc5fa7
| " add sign with certain index | |
| function! bm_sign#add_at(file, sign_idx, line_nr, is_annotation) | |
| call bm_sign#lazy_init() | |
| let name = a:is_annotation ==# 1 ? "BookmarkAnnotation" : "Bookmark" | |
| execute "sign place ". a:sign_idx ." line=" . a:line_nr ." name=". name ." file=". a:file | |
| if (a:sign_idx >=# g:bm_sign_index) | |
| let g:bm_sign_index = a:sign_idx + 1 | |
| endif | |
| endfunction |
If a:file is associated to a buffer which is not already open, the sign place command will obviously fail, thus the plugin will report the Failed to load/parse file error.
This could be easily fixed by adding the following at the beginning of the bm_sign#add_at function:
if bufnr(a:file) ==# -1
return
endifSo if a bookmarked file is not already opened in Vim, the sign place command won't be called, thus avoiding the exception.
rod-stuchi
Metadata
Metadata
Assignees
Labels
No labels