bookmark.vim 828 B

123456789101112131415161718192021222324252627282930
  1. " MIT License. Copyright (c) 2021 Bjoern Petri <bjoern.petri@sundevil.de>
  2. " Plugin: https://github.com/MattesGroeger/vim-bookmarks
  3. " vim: et ts=2 sts=2 sw=2
  4. scriptencoding utf-8
  5. if !exists(':BookmarkToggle')
  6. finish
  7. endif
  8. function! airline#extensions#bookmark#currentbookmark() abort
  9. if get(w:, 'airline_active', 0)
  10. let file = expand('%:p')
  11. if file ==# ''
  12. return
  13. endif
  14. let current_line = line('.')
  15. let has_bm = bm#has_bookmark_at_line(file, current_line)
  16. let bm = has_bm ? bm#get_bookmark_by_line(file, current_line) : 0
  17. let annotation = has_bm ? bm['annotation'] : ''
  18. return annotation
  19. endif
  20. return ''
  21. endfunction
  22. function! airline#extensions#bookmark#init(ext) abort
  23. call airline#parts#define_function('bookmark', 'airline#extensions#bookmark#currentbookmark')
  24. endfunction