Skip to content

Instantly share code, notes, and snippets.

@LeafCage
Last active January 1, 2016 14:19
Show Gist options
  • Save LeafCage/8156947 to your computer and use it in GitHub Desktop.
Save LeafCage/8156947 to your computer and use it in GitHub Desktop.
let g:ezbar = {'separator_L': '', 'separator_R': ''}
let g:ezbar.active = [
\ 'winbufnum', 'dir',
\ 'filename',
\ {'chg_color': {'gui': ['SlateGray', 'white', 'bold']}},
\ 'filetype',
\ 'modified',
\ 'currentfuncrow',
\ {'__SEP__': 'StatusLine'},
\ 'cfi',
\ 'fileformat',
\ 'encoding',
\ 'percent',
\ 'line_col',
\ ]
let g:ezbar.inactive = [
\ 'winbufnum', 'dir',
\ 'filename',
\ {'chg_color': 'StlProperty'},
\ 'filetype',
\ 'modified',
\ {'__SEP__': 'StatusLine'},
\ 'SEP',
\ 'encoding',
\ 'percent',
\ 'line_col',
\ ]
let s:u = {}
function! s:u._init(n) "{{{
let self.mode = mode()
let self.crrbuf = bufname(winbufnr(a:n))
if self.__is_active && self.mode == 'i'
let self.__default_color = {'gui': ['DarkKhaki', 'black', 'bold']}
end
endfunction
"}}}
function! s:u._filter(layout, parts) "{{{
if self.mode == 'i'
let a:parts.__SEP__.ac = {'gui': ['DarkKhaki', 'black', 'bold']}
end
let a:parts.line_col.ac = {'gui': ['NavajoWhite1', 'black', 'bold']}
let a:parts.line_col.c = {'gui': ['NavajoWhite1', 'black']}
"let a:layout[-1].ac = {'gui': ['NavajoWhite1', 'black', 'bold']}
"let a:layout[-1].c = {'gui': ['NavajoWhite1', 'black']}
let a:layout[-2].ac = {'gui': ['MistyRose', 'black', 'bold']}
let a:layout[-2].c = {'gui': ['MistyRose', 'black']}
return a:layout
endfunction
"}}}
function! s:u.winbufnum(n) "{{{
return '%n%{repeat(",", winnr())}%<'
endfunction
"}}}
function! s:u.dir(n) "{{{
let bg = self.mode=='i' ? 'LightSkyBlue1' : 'azure'
let _ = fnamemodify(self.crrbuf, ':h')
return {'s': '%.35('._.'%)', 'ac': {'gui': [bg, 'black', 'bold']}, 'ic': {'gui': ['azure', 'black']}}
endfunction
"}}}
function! s:u.filename(n) "{{{
let bg = self.mode=='i' ? 'RosyBrown1' : 'MistyRose'
return {'s': fnamemodify(self.crrbuf, ':t'), 'ac': {'gui': [bg, 'black', 'bold']}, 'c': {'gui': ['MistyRose', 'black']}}
endfunction
"}}}
function! s:u.currentfuncrow(n) "{{{
if &ft != 'vim'
return ''
end
let funcbgn = search('^\s*\<fu\%[nction]\>', 'bcnW', search('^\s*\<endf\%[unction]\>', 'bcnW'))
if funcbgn > 0
let row = line('.') - funcbgn
return row ? {'s': row, 'c': {'gui': ['azure', 'black', 'bold']}} : ''
endif
return ''
endfunction
"}}}
function! s:u.cfi(n) "{{{
if exists('*cfi#format')
return {'s': cfi#format('%.43s()', ''), 'c': {'gui': ['azure', 'black', 'bold']}}
end
return ''
endfunction
"}}}
let g:ezbar.parts = extend(s:u, ezbar#parts#default#new(), 'keep')
unlet s:u
@t9md
Copy link

t9md commented Dec 29, 2013

function 情報とるの良さそうですね。
ちなみに、設定方法はかなり自由度があって、こういうこともできます。

https://github.com/t9md/vim-ezbar/blob/master/misc/config_sample/color_theme_and_layout.vim

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment