mirror of
https://github.com/vim-airline/vim-airline.git
synced 2025-12-06 12:14:24 +08:00
vim-bookmark extension
This commit is contained in:
@@ -213,6 +213,11 @@ function! airline#extensions#load()
|
||||
call add(s:loaded_ext, 'tagbar')
|
||||
endif
|
||||
|
||||
if get(g:, 'airline#extensions#bookmark#enabled', 1)
|
||||
call airline#extensions#bookmark#init(s:ext)
|
||||
call add(s:loaded_ext, 'bookmark')
|
||||
endif
|
||||
|
||||
if get(g:, 'airline#extensions#csv#enabled', 1)
|
||||
\ && (get(g:, 'loaded_csv', 0) || exists(':Table'))
|
||||
call airline#extensions#csv#init(s:ext)
|
||||
|
||||
23
autoload/airline/extensions/bookmark.vim
Normal file
23
autoload/airline/extensions/bookmark.vim
Normal file
@@ -0,0 +1,23 @@
|
||||
"
|
||||
" MIT License. Copyright (c) 2019 Bjoern Petri <bjoern.petri@sundevil.de>
|
||||
"
|
||||
function! airline#extensions#bookmark#currentbookmark()
|
||||
if get(w:, 'airline_active', 0)
|
||||
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'] : ""
|
||||
|
||||
return annotation
|
||||
endif
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#bookmark#init(ext)
|
||||
call airline#parts#define_function('bookmark', 'airline#extensions#bookmark#currentbookmark')
|
||||
endfunction
|
||||
@@ -165,6 +165,7 @@ function! airline#init#bootstrap()
|
||||
\ 'ycm_error_count', 'ycm_warning_count', 'neomake_error_count',
|
||||
\ 'neomake_warning_count', 'ale_error_count', 'ale_warning_count',
|
||||
\ 'languageclient_error_count', 'languageclient_warning_count'])
|
||||
call airline#parts#define_text('bookmark', '')
|
||||
call airline#parts#define_text('capslock', '')
|
||||
call airline#parts#define_text('gutentags', '')
|
||||
call airline#parts#define_text('grepper', '')
|
||||
@@ -197,7 +198,7 @@ function! airline#init#sections()
|
||||
let g:airline_section_gutter = airline#section#create(['%='])
|
||||
endif
|
||||
if !exists('g:airline_section_x')
|
||||
let g:airline_section_x = airline#section#create_right(['tagbar', 'gutentags', 'grepper', 'filetype'])
|
||||
let g:airline_section_x = airline#section#create_right(['bookmark', 'tagbar', 'gutentags', 'grepper', 'filetype'])
|
||||
endif
|
||||
if !exists('g:airline_section_y')
|
||||
let g:airline_section_y = airline#section#create_right(['ffenc'])
|
||||
|
||||
Reference in New Issue
Block a user