Permalink
Browse files

canonicalized statusline

  • Loading branch information...
Soares committed Nov 16, 2012
1 parent c421791 commit 0e1856be2ba1847c5da66bd87ccbd2e402be3f45
Showing with 20 additions and 20 deletions.
  1. +0 −13 autoload/write.vim
  2. +8 −0 autoload/write/status.vim
  3. +12 −7 doc/write.txt
View
@@ -1,9 +1,3 @@
-if exists("g:write#autoloaded") || &cp || v:version < 700
- finish
-endif
-let g:write#autoloaded = 1
-
-
" Sets the buffer as writer-friendly.
" @param {string} bang Whether or not to force full writing mode.
function! write#start(bang)
@@ -58,10 +52,3 @@ function! write#restart(bang)
call write#start(a:bang)
let b:write_ft = &ft
endfunction
-
-
-" Makes a statusline flag if writin mode is on.
-" @return {string}
-function! write#statusline()
- return b:writing ? '[W]' : ''
-endfunction
@@ -0,0 +1,8 @@
+function! write#status#flag()
+ return write#status#info()
+endfunction
+
+
+function! write#status#info()
+ return b:writing ? '[W]' : ''
+endfunction
View
@@ -74,14 +74,19 @@ This plugin does not disable your statusline, because the statusline can not
be disabled for only one window. If you want to turn the statusline off see
the |laststatus| variable and set it to 0 or 1 yourself.
- *write#statusline()*
-Returns '[W]' if write mode is on, '' otherwise. Perfect for use in
-a statusline. Use >
+write#status#flag() *write#status#flag()*
+ An alias for |write#status#info()|. If other statusline flags are
+ added, write#status#flag() will return the first non-empty flag in
+ decreasing order of severity.
+
+write#status#info() *write#status#info()*
+ [W] if write mode is on.
+ Use as follows:
+>
set statusline+=%#ModeMsg#
- set statusline+=%{write#statusline()}
+ set statusline+=%{write#status$info()}
set statusline+=%*
<
-to add this flag to your statusline.
==============================================================================
MAPPINGS *write-mappings*
@@ -97,8 +102,8 @@ filetypes. It's more effective than such a key mapping.
EXTRAS *write-extras*
You may check the 'b:writing' variable to see if writing mode is currently
-enabled. You can use this to write your own statusline functions if you do not
-like the style of |write#statusline()|.
+enabled. You can use this to write your own statusline flags if you do not
+like the style of |write#status#flag()|.
==============================================================================
ABOUT *write-about*

0 comments on commit 0e1856b

Please sign in to comment.