Skip to content

Commit

Permalink
add rbenv integration, closes millermedeiros#15. add safe checks to a…
Browse files Browse the repository at this point in the history
…ll plugins.
  • Loading branch information
millermedeiros committed Nov 10, 2011
1 parent f8938fd commit 89eb1c7
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 12 deletions.
13 changes: 13 additions & 0 deletions doc/statline.txt
Expand Up @@ -45,6 +45,13 @@ See |'syntastic_stl_format'| for customization info.
let g:statline_rvm = 1 let g:statline_rvm = 1
< <


------------------------------------------------------------------------------
*'statline_rbenv'*

|rbenv| integration is disabled by default, to enable it: >
let g:statline_rbenv = 1
<

------------------------------------------------------------------------------ ------------------------------------------------------------------------------
*'statline_show_n_buffers'* *'statline_show_n_buffers'*


Expand Down Expand Up @@ -176,7 +183,13 @@ Next
- Add |'statline_show_charcode'| (@knl) - Add |'statline_show_charcode'| (@knl)
- Add |'statline_no_encoding_string'| (@knl) - Add |'statline_no_encoding_string'| (@knl)
- Add |'statline_show_n_buffers'| [#2] - Add |'statline_show_n_buffers'| [#2]
- Add |'statline_rbenv'| [#15]
- Fix problem with non-utf8 encoding. [#13] - Fix problem with non-utf8 encoding. [#13]
- Create |augroup| to wrap all |autocmd| and make sure commands are cleared
before adding new ones, avoids setting same command multiple times.
- Add safe checks to all plugins to make sure they aren't called if they
don't exist, make it more portable since users may copy vimrc files that
enable plugin integration.




------------------------------------------------------------------------------ ------------------------------------------------------------------------------
Expand Down
25 changes: 13 additions & 12 deletions plugin/statline.vim
Expand Up @@ -140,7 +140,17 @@ if !exists('g:statline_rvm')
let g:statline_rvm = 0 let g:statline_rvm = 0
endif endif
if g:statline_rvm if g:statline_rvm
set statusline+=%{rvm#statusline()} set statusline+=%{exists('g:loaded_rvm')?rvm#statusline():''}
endif


" ---- rbenv ----

if !exists('g:statline_rbenv')
let g:statline_rbenv = 0
endif
if g:statline_rbenv
set statusline+=%{exists('g:loaded_rbenv')?rbenv#statusline():''}
endif endif




Expand All @@ -150,7 +160,7 @@ if !exists('g:statline_fugitive')
let g:statline_fugitive = 0 let g:statline_fugitive = 0
endif endif
if g:statline_fugitive if g:statline_fugitive
set statusline+=%4*%{fugitive#statusline()}%* set statusline+=%4*%{exists('g:loaded_fugitive')?fugitive#statusline():''}%*
endif endif




Expand All @@ -160,18 +170,9 @@ if !exists('g:statline_syntastic')
let g:statline_syntastic = 1 let g:statline_syntastic = 1
endif endif
if g:statline_syntastic if g:statline_syntastic
set statusline+=\ %3*%{StatlineSyntastic()}%* set statusline+=\ %3*%{exists('g:loaded_syntastic_plugin')?SyntasticStatuslineFlag():''}%*
endif endif


function! StatlineSyntastic()
" safe guard against syntastic being only loaded after statline
if exists('g:loaded_syntastic_plugin')
return SyntasticStatuslineFlag()
else
return ''
endif
endfunction





" ====== custom errors ====== " ====== custom errors ======
Expand Down

0 comments on commit 89eb1c7

Please sign in to comment.