Merge pull request #2276 from kazukazuinaina/fix_indent_bookmark_extension

[fix] bookmark extension's indentation and add abort
This commit is contained in:
Christian Brabandt 2020-11-06 09:11:35 +01:00 committed by GitHub
commit 5f2421fa39
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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