Commit Graph

291 Commits

Author SHA1 Message Date
Pierre-Nicolas Clauss 46e517e8c2
only set laststatus when airline is not on top
When airline is configured to show on top (`let g:airline_statusline_ontop = 1`)
and vim's `laststatus` option is configured to be hidden (`set laststatus=0`)
then there is no need to override its setting.
2022-12-16 08:28:29 +01:00
Christian Brabandt ebb89a0846
plugin: mention how to disable certain events
E.g. how to disable the FocusGained event by setting the 'eventignore'
option.

Add some boilerplate to skip the focusgained function handler function, if it should be
ignored. (this should in theory stop setting up the autocommands at all
so might be tiny performance optimization).

closes #2421
2022-07-13 20:41:15 +02:00
Christian Brabandt b5f2eb418a
tabline: properly refresh with ModeChanged autocommand
closes #2539
2022-07-12 21:48:06 +02:00
Vincenzo Di Massa f7cbf8c429
glob return results without removing wildignore matches
Ignore 'wildignore' and 'suffixes' when globbing for themes and extensions.

This can be a problem when you have a wildignore containing *.vim.

closes #2375
2021-05-03 08:37:05 +02:00
Christian Brabandt 2e9df43962
autocommands: check for existence of airline highlight group
Several extensions trigger custom actions. Make sure, those actions are
only performed, if airline is actually active and not temporarily
disabled using e.g. :AirlineToggle
2021-04-30 13:26:33 +02:00
Bailey Ling 5601c0928e Happy new year! 2021-01-01 12:57:00 +00:00
Christian Brabandt 59b4826806
plugin: remember 'scroll' option value and reset it after enabling the statusline
fixes #2307
2020-12-23 13:43:30 +01:00
Jan Steinke df096e16ae remove unnecessary indirection 2020-11-10 08:40:42 +01:00
Jan Steinke 7091b8a6ff
remove work-around for vista.vim 2020-11-09 20:17:05 +01:00
Christian Brabandt c8c0e7d9ff
Get rid of g:airline_gui_mode
This is needed for Neovim, because an external UI could be attached to
the same neovim server, so it does not make sense to define highlighting
groups with either only the cterm or the guifg attribute set.

So refactor the code slightly got get rid of this variable (and since
this variable is not needed anymore, we can also get rid of the guienter
and OptionSet autocommand).

fixes: #2261
2020-10-30 08:32:35 +01:00
Christian Brabandt 915c7cfcd7
Fix brocken CI test
because vim 7.4 does not know v:vim_did_enter

I am beginning to wonder, whether we should have vim8 as a minimal
requirement...
2020-05-04 08:10:33 +02:00
Christian Brabandt 0ac474fdc4
plugin: load vim-airline as optional package
allow to load vim-airline as opt package

Fixes: 2122
2020-05-04 07:48:13 +02:00
David Briscoe dd247a0f85 branch: ignore upcoming FocusGained when updating
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.
2020-01-28 12:01:09 -08:00
Christian Brabandt f4795532c6
branch: disable FocusGained handler when updating fugitive information
closes #2029
2020-01-28 15:54:53 +01:00
kazukazuinaina cf6dcf5e19 update license's year in vim-airline 2020-01-06 11:22:49 +09:00
midchildan bc0e2a3438
fix missing check for w:airline_disable_statusline 2019-12-22 20:06:35 +09:00
Christian Brabandt 9f00b402c5
plugin: save/restore cpo setting
This has been missing way too long. It should always be set to a sane
vim default, as documented (:h write-plugin). So add it as well.
2019-12-13 10:17:15 +01:00
Christian Brabandt 5f9ae83f44
config: allow to disable setting the statusline option
closes #2013
2019-12-13 09:59:45 +01:00
Christian Brabandt e395afed51
vista: init extension on VimEnter
closes #2009
2019-12-13 08:56:26 +01:00
Christian Brabandt 81fdc3b988
plugin: make use of rand() function from vim 8.1.2342 2019-11-25 17:13:33 +01:00
Christian Brabandt 19c655b420
plugin: do not trigger redraws for popup windows
coc.nvim might set the filetype of the poppup window, which might
trigger a redraw of the statusline, causing the current window to become
inactive.

So bail out early, if the current buffer is a popup buffer. It cannot
have a statusline anyhow.

fixes #1930 (but this time for Vim)
2019-11-25 16:24:58 +01:00
kazukazuinaina 0cba7d3ed6 add check to statusline's update 2019-10-24 16:19:58 +09:00
Christian Brabandt 73b4e4233c
Remove Neovim Workaround, as bug has been fixed 2019-06-12 11:26:09 +02:00
Christian Brabandt 48d9d5e901
neovim: Do not react on BufWinEnter for floating windows
closes #1930
2019-06-03 10:35:58 +02:00
Christian Brabandt 7d5302b51f
plugin: make the on_window_changed function take the autocommand as argument
This is just for making it easier to debug why the plugin update called
2019-06-03 08:30:27 +02:00
Christian Brabandt ea7f5d5313
extensions: show loaded extension once (at most once)
could happen, that extensions are shown several times, if airline is
available in your &rtp several times (for whatever reason)
2019-05-03 12:43:21 +02:00
Christian Brabandt a753422549
main: Make :AirlineRefresh! skip recrecrating highlighting groups
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
2019-04-26 10:16:40 +02:00
Christian Brabandt d1d9548b8e
themes: correctly catch not-found in init function
plugin/airline.vim was calling airline#switch_theme() without actually
catching the 'not-found' exception.

Therefore, in case of errors, explicitly switch to a dark theme.

closes #1903
2019-04-17 08:27:30 +02:00
Christian Brabandt 86e73cade7
Get a random number from win32 cmd.exe 2019-03-26 21:53:47 +01:00
Christian Brabandt 4265798d4b
style: rename inconsistent function names 2019-03-26 21:10:45 +01:00
Christian Brabandt 148eb6bb28
Allow to switch to a random theme
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.

closes vim-airline/vim-airline-themes#170
2019-03-26 21:03:13 +01:00
Christian Brabandt a6fb6d9da0
Extensions: indicate, if an extension is external
Show in :AirlineExtensions if the extension comes bundled with airline
or from an external source.

closes #1890
2019-03-26 08:41:36 +01:00
Christian Brabandt c8a36e14e9
Updated Copyright Statements 2019-03-25 12:29:47 +01:00
Christian Brabandt 25e384f236
wordcount: move User autocommand to plugin
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.
2019-02-04 08:25:45 +01:00
Christian Brabandt 8867301f78
plugin: Move tabline_update function to autoload 2019-02-04 08:23:58 +01:00
Christian Brabandt fd5bde1a3a
allow to show the statusline on top
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 #1388
closes #1867
2019-02-03 17:30:55 +01:00
Christian Brabandt 72888d87ea
Revert "Make plugin reloadable"
This reverts commit 56197d5104.

fixes #1844
2018-12-18 16:13:03 +01:00
Christian Brabandt 56197d5104
Make plugin reloadable
there was a call to s:init() missing in the toggle function.
Without it, it wouldn't reload correctly, since the s:initialized
variable would never be set to 1 again. So load it when setting up
everything correctly.

fixes #1842
2018-12-17 22:23:40 +01:00
Christian Brabandt bd468dacfe
Revert TermOpen autocommand for Neovim
closes #1828
2018-11-22 08:31:14 +01:00
Christian Brabandt f9ccb57e76
Make terminal extension work with Neovim 2018-11-20 15:55:11 +01:00
Christian Brabandt fa11b8855b
Test for TerminalOpen Autocommand before using it 2018-11-20 15:28:29 +01:00
Christian Brabandt 904ac4eb0b
plugin: Reload terminal extension on :term command 2018-11-20 14:51:22 +01:00
Christian Brabandt df0c1731db
Add :AirlineExtensions command
This shows whether or not an extensions has been loaded.
2018-11-14 08:06:39 +01:00
Christian Brabandt ffac12cbbe
theme: do not show not-found warning
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
2018-11-14 07:36:45 +01:00
Christian Brabandt b20e181bc8
Add a separate function for returning all available themes 2018-11-13 22:14:51 +01:00
Christian Brabandt 49671d0a11
terminal: do not reset airline theme on TerminalOpen
remove autocommand, that would overwrite the airline theme on :term

(e.g. After a :AirlineTheme monochrome and then using `:term` the
autocommand would reset the theme back to the one given in the .vimrc)
2018-11-13 22:01:36 +01:00
Christian Brabandt cd0b15b195
plugin: use airline#util#warning instead of echo consistently 2018-11-13 21:37:52 +01:00
Christian Brabandt a334a89e59
plugin: better check for timer and funcref 2018-11-08 07:54:01 +01:00
Christian Brabandt ce6cf6f07e
Check that funcrefs() actually exists
closes #1819
2018-11-07 17:55:11 +01:00
Christian Brabandt 33a633766d
main: do not trigger FocusGained on startup
commit f045452743 introduced the
FocusGained autocommand. Unfortunately, for some systems this might
trigger already at startup, resulting in an unwanted redraw that might
clear the intro screen.

Therefore, add a timer, that enables the FocusGained autocommand after 5
seconds. The 5 seconds is somewhat arbritrarely, but we could change it
later if it turns out to be not useable.

fixes #1817
2018-11-07 10:46:57 +01:00