[fix] bookmark extension's indentation and add abort

This commit is contained in:
kazukazuinaina 2020-11-05 19:39:26 +09:00
parent d64e5f8dd7
commit 83804f3c6d

View File

@ -8,23 +8,23 @@ if !exists(':BookmarkToggle')
finish
endif
function! airline#extensions#bookmark#currentbookmark()
function! airline#extensions#bookmark#currentbookmark() abort
if get(w:, 'airline_active', 0)
let file = expand("%:p")
if file ==# ""
return
endif
let file = expand('%:p')
if file ==# ''
return
endif
let current_line = line('.')
let has_bm = bm#has_bookmark_at_line(file, current_line)
let bm = has_bm ? bm#get_bookmark_by_line(file, current_line) : 0
let annotation = has_bm ? bm['annotation'] : ""
let current_line = line('.')
let has_bm = bm#has_bookmark_at_line(file, current_line)
let bm = has_bm ? bm#get_bookmark_by_line(file, current_line) : 0
let annotation = has_bm ? bm['annotation'] : ''
return annotation
endif
return annotation
endif
return ''
endfunction
function! airline#extensions#bookmark#init(ext)
function! airline#extensions#bookmark#init(ext) abort
call airline#parts#define_function('bookmark', 'airline#extensions#bookmark#currentbookmark')
endfunction