Permalink
Browse files

add rbenv integration, closes #15. add safe checks to all plugins.

  • Loading branch information...
1 parent f8938fd commit 89eb1c71adbbafe0a0fbbf5d1c996e35d3eb33b0 @millermedeiros millermedeiros committed Nov 10, 2011
Showing with 26 additions and 12 deletions.
  1. +13 −0 doc/statline.txt
  2. +13 −12 plugin/statline.vim
View
@@ -45,6 +45,13 @@ See |'syntastic_stl_format'| for customization info.
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'*
@@ -176,7 +183,13 @@ Next
- Add |'statline_show_charcode'| (@knl)
- Add |'statline_no_encoding_string'| (@knl)
- Add |'statline_show_n_buffers'| [#2]
+ - Add |'statline_rbenv'| [#15]
- 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.
------------------------------------------------------------------------------
View
@@ -140,7 +140,17 @@ if !exists('g:statline_rvm')
let g:statline_rvm = 0
endif
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
@@ -150,7 +160,7 @@ if !exists('g:statline_fugitive')
let g:statline_fugitive = 0
endif
if g:statline_fugitive
- set statusline+=%4*%{fugitive#statusline()}%*
+ set statusline+=%4*%{exists('g:loaded_fugitive')?fugitive#statusline():''}%*
endif
@@ -160,18 +170,9 @@ if !exists('g:statline_syntastic')
let g:statline_syntastic = 1
endif
if g:statline_syntastic
- set statusline+=\ %3*%{StatlineSyntastic()}%*
+ set statusline+=\ %3*%{exists('g:loaded_syntastic_plugin')?SyntasticStatuslineFlag():''}%*
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 ======

0 comments on commit 89eb1c7

Please sign in to comment.