wordcount: Compatibility fixes and General upkeep

Compatibility:
- Don't use a script-local function to update the format strings
- Protect against `:normal!' moving the cursor on on the wordcount check

Bugfix:
- Let to_string() try to return something for all values
  - Now returns correctly when passed both 0 and '0'

Upkeep:
- Simplify check again no valid key from winwidth()
- Old wordcount check: use matchstr() - more expressive and fewer steps
- Improve documentation style/clarity/detail
This commit is contained in:
Liam Fleming
2018-09-22 03:34:27 +01:00
parent ae024293e4
commit 264c1fefd2
3 changed files with 21 additions and 28 deletions

View File

@@ -592,16 +592,15 @@ eclim <https://eclim.org>
let g:airline#extensions#eclim#enabled = 1
------------------------------------- *airline-wordcount*
display the word count of the document or visual selection
* enable/disable word counting. >
* enable/disable word counting of the document/visual selection >
let g:airline#extensions#wordcount#enabled = 1
<
* 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.
let g:airline#extensions#wordcount#filetypes =
\ ['help', 'markdown', 'rst', 'org', 'text', 'asciidoc', 'tex', 'mail']
" Use ['all'] to enable for all filetypes.
* defines the name of a formatter for word count will be displayed: >
" The default will try to guess LC_NUMERIC and format number accordingly