[Pandoc flavoured Markdown](https://en.wikipedia.org/wiki/Markdown#CommonMark) has its [own file type in `vim`](https://github.com/vim-pandoc/vim-pandoc-syntax#standalone), namely `markdown.pandoc`.
Word count by default in `vim-airline` obviously would make a lot of sense for this popular file type.
Fix this, by making sure that the wordcount extensions will apply
correctly if any of the combined filetypes (e.g. either pandoc or
markdwon) matches the list of allowed filetypes.
Fix#2062: restore g:airline_focuslost_inactive behaviour.
Only ignore focusgained events on Windows. If there are more problematic
platforms, we'll add them later.
Instead of ignoring the next x FocusGained events whenever we do call
system(), ignore them for the current second. That allows us to put a
hard limit on the duration of the ignore.
This seems like a much better solution than the previous one because it
also prevents ignore events from building up (s:focusgained_ignored was
often greater than 5).
Test (gvim 8.2.140 on Win10)
gvim.exe ~/.vim/bundle/airline/autoload/airline/extensions/branch.vim
:Gedit HEAD
check several parents and no regression of looping behaviour from #2053.
:let g:airline_focuslost_inactive = 1
:split
alt-tab several times and statusline is correctly dimmed and restored
each time.
closes#2029
airline#util#focusgain(1) was called too soon -- it's called before vim
loses focus and not after it gains focus. Instead, we ignore the next
FocusGained event.
This is actually a work around for a broken installation. the dict p
should always contain the accents key (see `airline#themes#patch()`
function, that adds missing accents). So even if the theme does not
define the accents key, it should always exist.
However, an error while evaluating the statusline is extremely annoying,
so add some safeguards here and skip the following for loop.
related #2043
vim-airline by default already tries to load theme names, that have the
same name as the colorscheme. Therefore, it does not make sense, to add
mappings that result in the same theme name.
So drop the base16, wombat, zenburn and solarized keys
gina.vim needs the `<mods>` feature to work correctly. Therefore check
that Vim has at least patch 7.4.1898 included before using and accessing
the gina plugin.
fixes#1984
Previously it used a width of >= 80 to display the long word count
format. However I personally found that a bit too wide, while other
sections will be shortened too much which does not really look nice.
Therefore, adjust the limit a bit, using the short word count format for
windows up to 85 characters.
This fixes a bug that causes a mangled statusline. The bug occurs, when
the `displayed_head_limit` variable is set and causes the substring
expression to take a substring, which ends in the middle of a multi-byte
character.
This patch replaces the byte-based methods for measuring the
length of the branch name and creating a substring with methods that are
character-based and multi-byte aware.
It also has the nice side effect of making the length measuring more
accurate, by taking the actual display width of multi-byte characters
and the ambiwidth setting into account.
Since we need to take into account older Vim 7.4 (which might not have
the strcharpart() function), do introduce a compatibility wrapper in
airline#util that checks for the existence of the function before using
it. Older Vims will keep on using the byte-based index. I suppose Vim
7.4 before the strcharpart() function was available (patch 7.4.1730)
shouldn't be in use anymore.
closes#1948
Define the variable :let g:airline_filetype_overrides to allow for
specific customization how a specific filetype will be displayed.
For e.g. a German display, you can use: >
:let g:airline_filetype_overrides = {'help': ['Hilfe', ':%f']}
<
This defines how section a and b will look like for a window with that
specific filetype.
Closes#1888
When `g:skip_empty_sections` is set, `:AirlineRefresh` can be called
very often and cause slow down, because it forcefully re-creates the
highlighting groups. This is mostly not needed for the redraw to happen,
therefore, add the `<bang>` attribute to the command, making it skip to
re-create the highlighting groups and have all extensions that rely on a
forced update use the `!` form.
Should be much fast then.
fixes#1908
A buffer name wich special characters such as Command-T [Files] will
cause E94 when trying to call setbufvar() on it. That is because the
'[]' is special in buffer names. Therefore, fnameescape the buffer name.
This should prevent 'E94: No matching buffer for
/home/louis/git/minivimrc/Command-T [Files]' errors.
closes#1906
as requested by the exception thrown:
fugitive: A third-party plugin or vimrc is calling
fugitive#buffer().commit() which has been removed. Replace it with
matchstr(FugitiveParse()[0], '^\x\+')
if the same highlighting group is used on the left and right for the
label, the `airline_tablabel_to_airline_tabmod` will be overwritten on
the right side, causing the fg/bg colors to be wrong, because on the
right side they have to be the opposite of the left side.
So use a separate highlighting group for the tablabel on the right.
closes#1902
You can now specify the special theme name `random` and vim-airline will
load a random theme from the ones installed. This works from either your
.vimrc as well as when calling `:AirlineTheme` command directly.
closesvim-airline/vim-airline-themes#170
The 'autochdir' option could be toggled on later in a session.
So do not set the has_autochdir flag once the file is read, but evaluate
it every time the corresponding function is called.
While at it, get rid of the s:fmod variable. Instead let a helper
function return the correct modifier flags depending on the value of the
'autochdir' option.
The magic flags were in the wrong order, %e is the number of errors, it
should go in the parentheses after the # symbol. %fe is the line number
of the first error. Same for the warnings.
This allows for advanced customization where the shortening of the
branch name is up to the caller, unlike before.
This change is observable from the outside, and as such can be
dangerous. But AFAIK it does not change the default behavior.
This removes the hardcoded minwidth limits for both the `hunks` and
`branch` parts. It replaces these with safe accesses to the `minwidth`
setting as done by `airline#parts#define_minwidth`.
Partly revert commit 105e9daaf7
and fix#1857 another way, by making sure, that buffers are not taking
away from the s:current_visible_buffers list.
Fixes#1857Fixes#1872
Do not scatter the autocommands around, but rather move the auto command
to the main plugin file. The function that handles the auto command will
be created in the autoload script.
Also add a call to force updating the tabline, if g:airline_statusline_ontop
is defined.
In addition, the wordcount() extension did not correctly notice
block-wise visual mode, so while creating the airline#mode_changed()
function, make the mode also detect blockwise visual mode correctly.
This is an experimental feature that allows to display the statusline in
the tabline. It might still be a bit rough, but seems to work so far.
Remaining problem:
- Mode changes are not immediately detected, only after moving the
cursor
fixes#1388closes#1867
currently, empty buffer names were still considered to match against the
exclude_path setting. That does not make sense, so skip the check for
empty bufnames.
I have never touched anything in this file, nor in the LanguageClient plugin, so the copyright attribution is incorrect. @neersighted may also wish to be removed from the list here.
the ```t:undotree.GetStatusLine()``` is appended to the status line when ```t:undotree``` exists, but it seems like the ```statusline``` will be executed when ```t:undtree``` is no longer available during window destruction.
Only show the "airline theme not found" warning message, when the user
actually used `:AirlineTheme foobar`, not when called by an autocommand
that tries to switch themes when the Vim colorscheme changed.
fixes#1824
While this adds a bit more code it makes it possible to distinguish
between themes not found and errors in themes.
Use :verbose AirlineTheme <foobar>
to also see the error message in case of errors.
Groupnames like 'airline_c1_to_airline_x_inactive' still have to be
processed, so do not skip them.
Also for the tabline, '_inactive' groups are not used, so skip them
Replace by a function that retuns the to be executed highlighting string
Should in theory be a bit faster, since the same function does not have
to be called 5 times per highlighting group.
It probably is not much better, but here are some random numbers:
Profiling:
Previously:
count total (s) self (s)
199 0.022973 0.009909 let cmd = printf('hi %s %s %s %s %s %s %s %s', a:group, s:Get(colors, 0, 'guifg=')…
New:
count total (s) self (s)
79 0.010166 0.000862 let cmd = printf('hi %s%s', a:group, s:GetHiCmd(colors))
Make sure, to also check, if the separator groups have already been
defined. Once they are defined initially, they are usually available in
the palette group. So do not redefine them once they have been created
initially.
references #1779
Previously, we only checked for if the name starts with 'airline_c'
But there could as well be highlighting groups starting being called
'airline_b_to_airline_c5', but if buffer 5 is no longer visible in the
current viewport, then we do not need to recreate those groups.
currently, if the matchstr() evaluates to '', it would skip the required
section, because bnr would be evaluated to zero and since there is no
buffer zero, skip that highlighting group.
Make sure, to only skip the highlighting group if the buffer number is
actually > 0
In a long editing session, there could happen to accumulate several
highlighting groups for buffers that might no longer be visible.
Therefore, only re-create the highlighting group for buffers that are
actually displayed in the current tabpage. If not, skip them.
references #1779
previously, it could happen that the same highlighting group was defined
several times, because it was available in several modes within
g:airline#theme[mode]. So the second one would always win.
Therefore, loop through all modes in reverse order and define the group
and remember what group has already been defined. If we happen to have
to re-define the same group, skip it. Since we are traversing the list
in reverse order, this should make sure the last definition wins.
This has the benefit of being more performant and hopefully helps with
e.g. #1779 and similar issues.
At the moment you can never be sure whether you look at the results
that ale just produced after your last changes or you are looking at
outdated information.
Instead of showing the last results while ale executes checks on the
current buffer it can now show a specific indicator.
This commit introduces the new config variable
`g:airline#extensions#ale#checking_symbol` which defaults to "...". In
case you don't want to see this, you may set it to an empty string.
This will make sure that the current window will be highlighted as
expected, even if there are no other windows and all highlighting groups
will be correctly re-created as 'inactive'
references #1807
Previously the ale refresh was triggered after user interactions only.
When linting takes some time and the user is not actively working the
ale information was not updated while the things ale directly controls
were updated. This change makes showing linting results a loot smoother.
When switching away from Vim and your terminal supports the FocusLost
autocommand, set the statusline to inactive, so it won't distract you
too much when working with another application.
In the gui, the FocusLost autocommand should always trigger.
This is now the default, if people start complaining, that behaviour
should probably be made configurable.
closes#1807
for older Vims, the wordcount extension falls back to `g<c-g>` and
parses the messaage that is generated.
When doing so, it expects the English locale, which might not be true.
Therefore, try to regex parse the result without using the english words
(assuming the output is still in the same order as in English).
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
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