mirror of
https://github.com/vim-airline/vim-airline.git
synced 2024-11-29 04:10:06 +08:00
wordcount: Update documentation
- g:airline#extensions#wordcount#filetypes is now documented as a list - New to_string() function for formatters
This commit is contained in:
parent
82a6097b01
commit
dcf76b0992
|
@ -592,14 +592,16 @@ eclim <https://eclim.org>
|
||||||
let g:airline#extensions#eclim#enabled = 1
|
let g:airline#extensions#eclim#enabled = 1
|
||||||
|
|
||||||
------------------------------------- *airline-wordcount*
|
------------------------------------- *airline-wordcount*
|
||||||
|
display the word count of the document or visual selection
|
||||||
|
|
||||||
* enable/disable word counting. >
|
* enable/disable word counting. >
|
||||||
let g:airline#extensions#wordcount#enabled = 1
|
let g:airline#extensions#wordcount#enabled = 1
|
||||||
<
|
<
|
||||||
* regex of filetypes to enable word counting. >
|
* set list of filetypes for which word counting is enabled: >
|
||||||
" the default value matches filetypes typically used for documentation
|
" the default value matches filetypes typically used for documentation
|
||||||
" such as markdown and help files.
|
" such as markdown and help files.
|
||||||
let g:airline#extensions#wordcount#filetypes = ...
|
let g:airline#extensions#wordcount#filetypes =
|
||||||
(default: markdown,rst,org,help,text,tex,mail)
|
\ ['help', 'markdown', 'rst', 'org', 'text', 'asciidoc', 'tex', 'mail']
|
||||||
|
|
||||||
* defines the name of a formatter for word count will be displayed: >
|
* defines the name of a formatter for word count will be displayed: >
|
||||||
" The default will try to guess LC_NUMERIC and format number accordingly
|
" The default will try to guess LC_NUMERIC and format number accordingly
|
||||||
|
@ -607,14 +609,14 @@ eclim <https://eclim.org>
|
||||||
let g:airline#extensions#wordcount#formatter = 'default'
|
let g:airline#extensions#wordcount#formatter = 'default'
|
||||||
|
|
||||||
" here is how you can define a 'foo' formatter:
|
" here is how you can define a 'foo' formatter:
|
||||||
" create a file in the dir autoload/airline/extensions/wordcount/formatters/
|
" create a file in autoload/airline/extensions/wordcount/formatters/
|
||||||
" called foo.vim
|
" called foo.vim, which defines the following function signature:
|
||||||
" this example needs at least Vim > 7.4.1042
|
function! airline#extensions#wordcount#formatters#foo#to_string(wordcount)
|
||||||
function! airline#extensions#wordcount#formatters#foo#format(format,fmt)
|
return a:wordcount == 0 ? 'NONE' :
|
||||||
return (wordcount()['words'] == 0 ? 'NONE' :
|
\ a:wordcount > 100 ? 'okay' : 'not enough')
|
||||||
\ wordcount()['words'] > 100 ? 'okay' : 'not enough')
|
|
||||||
endfunction
|
endfunction
|
||||||
let g:airline#extensions#wordline#formatter = 'foo'
|
let g:airline#extensions#wordline#formatter = 'foo'
|
||||||
|
" The function is passed the word count of the document or visual selection
|
||||||
|
|
||||||
* defines how to display the wordcount statistics for the default formatter: >
|
* defines how to display the wordcount statistics for the default formatter: >
|
||||||
" Defaults are below. If fmt_short isn't defined, fmt is used.
|
" Defaults are below. If fmt_short isn't defined, fmt is used.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user