2021-01-01 12:57:00 +00:00
|
|
|
" MIT License. Copyright (c) 2021 Bjoern Petri <bjoern.petri@sundevil.de>
|
2019-11-08 19:18:04 +00:00
|
|
|
" Plugin: https://github.com/MattesGroeger/vim-bookmarks
|
|
|
|
" vim: et ts=2 sts=2 sw=2
|
2019-05-03 10:37:17 +00:00
|
|
|
|
|
|
|
scriptencoding utf-8
|
|
|
|
|
|
|
|
if !exists(':BookmarkToggle')
|
|
|
|
finish
|
|
|
|
endif
|
|
|
|
|
2020-11-05 10:39:26 +00:00
|
|
|
function! airline#extensions#bookmark#currentbookmark() abort
|
2019-05-03 08:44:09 +00:00
|
|
|
if get(w:, 'airline_active', 0)
|
2020-11-05 10:39:26 +00:00
|
|
|
let file = expand('%:p')
|
|
|
|
if file ==# ''
|
|
|
|
return
|
|
|
|
endif
|
2019-05-03 08:44:09 +00:00
|
|
|
|
2020-11-05 10:39:26 +00:00
|
|
|
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'] : ''
|
2019-05-03 08:44:09 +00:00
|
|
|
|
2020-11-05 10:39:26 +00:00
|
|
|
return annotation
|
|
|
|
endif
|
2019-05-03 08:44:09 +00:00
|
|
|
return ''
|
|
|
|
endfunction
|
|
|
|
|
2020-11-05 10:39:26 +00:00
|
|
|
function! airline#extensions#bookmark#init(ext) abort
|
2019-05-03 08:44:09 +00:00
|
|
|
call airline#parts#define_function('bookmark', 'airline#extensions#bookmark#currentbookmark')
|
|
|
|
endfunction
|