v:t_list is an internal variable describing the type of a list.
Unfortunately, this is not available in older vims. So let's fall back
to using `type([])`
see #1795
This prevents a warning message, when the function is tried to add
several times. Also while at it, add a '!' so that no error is thrown if
the file is sourced a second times.
commit bcd37fc115 changed the detection of modes slightly in that it
allowed not only single letters but also several letters.
While in theory, it might be okay to have extra modes displayed like
Insert Completion or Normal Insert, or Operator Pending, let's for now
just revert it to the default. We can always enhance it later if
requested.
Checking for wordcount changes now uses a b:changedtick comparison in
the statusline funcref. The autocommand strategy that used to do this is
removed, simplifying the code.
- Formatter is now only called when the wordcount changes
- ...#apply() now only compares against the filetype list when necessary
- Old format() function is no longer called for (unsupported) counting
of visual words
- Misc code quality improvements
Various improvements:
- Seperate out visual mode detection.
- Use TextChanged rather than CursorMoved where supported.
- Let users specify the filetypes for which wordcounting is enabled
with a list rather than a pattern.
- Move the filetype check to when airline is refreshed, as opposed to
on every update; autocommands are not created if wordcounting is
disabled
Currently the formatter, and not the wordcount plugin, is responsible
for providing the wordcount as well as formatting it. The default
formatter allows visual mode word counting, although this is not
documented.
The new interface - a transform() function, allows the main wordcount
plugin to internalise this logic. Providing the wordcount simplifies
formatter implementations:
- All formatters can display the visual wordcount.
- Formatters do not have to worry about compatibility with different
vim versions.
The old format() function can now be deprecated, although the wordcount
plugin retains compatibility with formatters using it. The default
formatter will also be used as a fallback if no suitable function is
found.
The default formatter is rewritten to use the new interface.
Add 'arduino' filetype to list of C-like languages. This is needed in
order to avoid mix-indent-file warnings when using hard tabs for
indentation in Arduino source files (*.ino, *.pde) containing top level
block comments with leading space before a '*'.
Similar to: 460ed02864
Original fix: 8fde76dd63
for some reasons, calling async functions might cause an error, if a
SourcePre command has been defined. So explicitly call the functions
using `:noa` modifier to prevent triggering the SourcePre autocommand.
fixes#1742