When loading bookmarks with BookmarkLoad, the plugin sometimes return an error stating:
Failed to load/parse file
This 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:
|
" 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
endif
So if a bookmarked file is not already opened in Vim, the sign place command won't be called, thus avoiding the exception.
When loading bookmarks with
BookmarkLoad, the plugin sometimes return an error stating:This happens because of the
sign placecommand, 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
If
a:fileis associated to a buffer which is not already open, the sign place command will obviously fail, thus the plugin will report theFailed to load/parse file error.This could be easily fixed by adding the following at the beginning of the
bm_sign#add_atfunction:So if a bookmarked file is not already opened in Vim, the
sign placecommand won't be called, thus avoiding the exception.