when using `Ctrl-O` from insert mode, the highlighting currently updates
from insert mode highlighting to normal mode highlighting.
Unfortunately, changing the highlighting can be a bit expansive, so
redefining the highlighting just for one simple command does not make
too much sense.
Instead, keep the insert mode highlighting, because that's kind of like
the major mode Vim is in currently. The mode message uses '(INSERT)' to
distinguish between a "normal" INSERT mode and this temporary INSERT
mode, so it should still be visually be distinguishable.
closes#2217
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
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.
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
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
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.
commit 7d082c03b2 added a workaround to skip
a few redraws on startup so that the intro message is not shown anymore.
However might cause problems, that some highlighting groups are not
correctly set. Also recent Vims (8.0.1290 and so on) do not seem to
suffer from the problem that an too early initializiation of airline
causes a redraw which skips the intro message.
Therefore, revert that commit.
Fixes#1585
workaround with index(term_list(), bufnr('')) > -1 not needed anymore,
since vim 8.0.936 will correctly return 't' for the mode() function in
the terminal.
Currently this is a hack, to get terminal mode from Vim.
However there is no better solution yet, since the API is not stable
here. Until then, just use the hack with
index(term_list(), bufnr('')) > -1
if airline is initialized too early and some :hi commands are run,
this will force a redraw in Vim which will result in the intro screen
being cleared.
Currently, this does not work for gvim, not sure why.
closes#1476 (well only partly, until i have discovered, why for gvim it
doesn't work).
consider a window with these splits:
,----
| file1
| ---
| file2
| ---
| file1
`----
If the top buffer is the active one and you start modifying this buffer,
this will also reset the highlighting for the inactive buffer2, since
the highlighting group 'airline_c_inactive' is used for both windows
(one having the unmodified buffer 'file2' and one having the modified
'file1').
This lead to the incorrect highlighting of the buffer name of file2.
Airline basically already created different airline_c<bufnr>_inactive
highlighting groups, but unfortunately did not use them.
Therefore, make the builder aware of this and always append the buffer
number to the group 'airline_c' if it is in an inactive window.
2) we need to make sure, the highlighting won't get overwritten, so
make the highlighter aware of this situation as well, by appending the
buffer number to the group name, if it creates the 'inactive' mode
groups and a buffer number has been given.
this fixes#1233