This was used as a workaround to fix a highlighting bug, which was fixed
in Vim 7.4.1511 and therefore, we need to correctly detect that the
patch was applied and in that case skip adding those extra groups.
As a bonus, when not using those empty %( %) groups, the
skip_empty_section test will correctly handle this and therefore this
closes#1351
This is no explicit problem in Vim, however Neovim diverged in this
behaviour from Vim and requires the dict attribute to be present before
accessing the self attribute.
See neovim/neovim#5763
Adding an option to prevent windows from being closed when a buffer in
the tabline is middle clicked and the clicked buffer is currently open
in a window.
When this option is enabled, instead of closing the window a new buffer
will be opened in all of the windows editing the clicked buffer instead.
This is my first pull request AND my first experience with vimscript, so
my apologies if this is a bit sloppy 😄
This seems to be an omission/regression from #afb75adc, where inactive
highlight updating was accidentally removed when fixing another bug.
Solution: Add back the deleted statement. closes#1339
Repro steps:
1. Install some theme that depends on the background color
(Soares/base16.nvim has a bunch)
2. `set background=dark` in your vimrc, and `colorscheme` one of the
aforementioned schemes.
3. Open a split window. Note the colors on the inactive window's airline.
4. `set background=light` manually. note the colors on the inactive
window's airline. Note how they have not updated. (In particular,
airline_c_inactive has updated, but all the other inactive groups
have not.)
5. Enter the inactive window. Exit the inactive window. Observe that the
colors are now correct (showing that it is in fact a problem with the
airline load_theme code, and not with the theme).
It seems strange that the code as written only expects
airline_c_inactive to have styling; perhaps there is some norm that
themes are supposed to handle inactive windows in a particular way? For
the record, my theme dis omething like this:
```
let s:IA1 = s:airlist('similar1', 'similar2')
let s:IA2 = s:airlist('similar1', 'similar2')
let s:IA3 = s:airlist('similar1', 'similar2')
let g:airline#themes#{s:palette}#palette.inactive = airline#themes#generate_color_map(s:IA1, s:IA2, s:IA3)
let g:airline#themes#{s:palette}#palette.inactive.airline_warning = s:airlist('base', 'contrast3')
let g:airline#themes#{s:palette}#palette.inactive.airline_error = s:airlist('base', 'antibase')
```
airline#extensions#tabline#excludes and
airline#extensions#tabline#exclude_preview previously had no impact if
changed after vim load. This fixes that.
Currently vim-airline assumes, that the git_dir is part of the path for
the file being edited. This has changed, since git supports worktrees.
So take care of b:git_dir (which is set by fugitive) being a path
differently from the absolute path of the file being edited (however, it
should include the substring worktree in that case).
A typical status line for a 'po' (Portable Object) translation file is:
1152 translated messages, 91 fuzzy translations, 42 untranslated messages.
Adding a substitute(), tidies this to:
1152 translated, 91 fuzzy, 42 untranslated
which is still informative, but less verbose.
airline#system#util for nvim used to fall back to 'system' implementation on
command error. This behavior caused conflict with other plugins if 'util' was
executed with a failing command as part of a ShellCmdPost event.
This commit makes 'util' interpret command error as persistent and not call
'system' in such a case.
This commit fixes#1317.
Since Vim8 we have win_getid() and getwininfo() functions to get
information about the current window. So we can use those functions to
find out, whether the current window is a quickfix or location list
window.
This avoids using a redir() over the :ls command and trying to
manually match the string quickfix and should be faster and also be more
robust, as the redir may fail if done recursively.
fixes#1319
This commit makes branch.vim use neovim's async jobs instead of a system()
function. This way we avoid the v:shell_error overwrite bug and allow live
updates of the untracked status.
* The head string is now calculated iff it has changed.
* The not exists symbol for current file appears as soon as its status is known.
* Fixes various problems with asynchronous status checking, such as:
* The not exists symbol keeps appearing and disapearing. This happened when
file was marked as not existing, the untracked cache was invalidated, and
the cache update is started, but in the meantime, the head string
calculation used the current (empty) value of the cache.
* The not exists symbol never appears, because cache keeps getting invalidated
before b:airline_head is emptied and updated.
closes#1306
* Introduce a config variable that holds the vcs-dependent parts of code.
* Removes `get_*_untracked` duplication by merging their logic together.
* Removes custom checks for 'git' or 'hg'. Functions now rely on provided config
argument.
* Use loops instead of manually specifying each handled VCS.
closes#1303
This commit fixes a bug, where untracked files in Git repos did not get the not
exists symbol displayed. The fix works by replacing the previous check for
whether currently edited file is a directory or not with a check based on
`findfile`. More detailed explanation follows.
VCS extension to vim-airline checks whether currently edited file is untracked.
The previous `s:get_git_untracked` implementation, which was used for the
aforementioned purpose for Git repos, was buggy, because it did not return the
untracked symbol in most situations, i.e. the edited file is untracked, but it
was treated as if it wasn't.
The root cause was the second clause in boolean expression checking the output
of `git status`:
if output[0:1] is# '??' && output[3:-2] is? a:file
It was added to make sure we are not checking a directory, but at this point in
the program `a:file` is an absolute path, while output of `git status` is a
relative path from the root of git repo. So the `is?` expression failed in most
situations.
These are forks/alternate versions of Solarized, without many of the
dynamic elements or the extensive terminal support.
[flattened](https://github.com/romainl/flattened) is a basic, totally
static version of Solarized with only ansi and GUI support.
[NeoSolarized](https://github.com/iCyMind/NeoSolarized) is a version
focusing on true/24-bit color support and NeoVim support, with limited
dynamic options.
[solarized8](https://github.com/lifepillar/vim-solarized8) is a version
focusing on vim/neovim true color support and limited dynamics. It is
already supported (`match()` matches it), but it is at least worth
noting.
Many users, including myself, use these themes over the original
Solarized for performance or technical reasons. Many users believe they
are incompatible with airline because automatic theming no longer
functions. While they can manually override the theme, most people seem
to miss this option in the documentation and give up.
It would be a nice quality of live improvement if airline detected these
themes and enabled its own Solarized theme automatically to match.
This makes it so if the whitespace symbol (g:airline#extensions#whitespace#symbol) is an empty string, we don't end up wth two characters at the beginning of the message.
commit #3d667c32d3ac04 fixed a bug, that a section was not considered
empty for the statusline, also g:airline_skip_empty was set.
However unfortunately, this lead to a regression, makeing the tabline
ugly, because sections, that contained a single highlighting group would
be considered empty and would therefore be skipped. Since this is not
what is expected, make s:section_is_empty() return zero, when it notices
we are looking at a tabline.
fixes#1273
airline_c (which contains the filename) usually is used together with
the buffer number, so that several windows showing the a different
buffer do not share the same highlighting group.
This was fixed in 73aea86a, but unfortunately it was forgotten to not
only add this to the current group, but also modify the previous group
accordingly. This is what this patch does.
fixes#1268
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
Using let g:airline_section_y = airline#section#create_right(['ffenc','%{strftime("%H:%M")}'])
will result in an output string of `utf-8[unix] < < 00:00`
This happens, because the function util#prepend() will eventually add an
extra separator, if the width is zero. Therefore, when building the
string, remember, if the last section added an extra separator and only
add one, if there hasn't been added one before.
fixes#1220
If active buffer is modified, `:AirlineRefresh` apply `normal` highlight
instead of `normal_modified` highlight.
No particular config is requiered to reproduce this bug.
I see this bug with option `g:airline_skip_empty_sections` set.
Add any modification at the active buffer return to normal mode,
**do not save** and wait a few seconds, you can see highlight change to
normal but file is modified.
Without option `g:airline_skip_empty_sections`, add any modification at
the active buffer return to normal mode and type `:AirlineRefresh` you
can see change to bad highlight .
Cache the hunk values. In case of short windows, shorten the hunk string
a little bit and make the branch extension take the hunk value into
account when deciding how much to shorten it.
Sometimes, if a buffer triggers many whitespace check warnings,
and the Vim window size is too small, other parts of the statusline
might become unreadable.
Therefore, if the window size is smaller than say 120 characters
and the whitespace warning > 9 chars, limit it to 10 characters
and inidicate, that there is more to come
fixes#1187 by making sure, we only call functions, that actually exist.
Should make vim-airline work with lady loaded YCM, e.g. using vim-plug:
```viml
" Code to execute when the plugin is loaded on demand
Plug 'Valloric/YouCompleteMe', { 'for': 'cpp' }
autocmd! User YouCompleteMe if !has('vim_starting') | call youcompleteme#Enable() | endif
```
Make sure, b:airline_head variable is set, also it is initially set in
this function earlier. But see #1171 for an error.
Therefore, before checking if the variable is empty, make sure it
exists.
fixes#1171
This is a little bit a hack, because by the time the separators are
added, it is not clear, if the following section is empty, therefore
we need to parse the content of the following section and eval the
expressions to find out, if this is empty
Remarks:
- catch all exceptions when eval'ing statusline
- make sure, that the seperators are highlighted
even when skipping empty regions (highlight group
names need to be adjusted)
- if a section is defined as empty, it will be removed completly from
the statusline. This means, it won't be called on the next update
and may not refresh properly (e.g. when the whitespace check
triggers, therefore, the whitesapce extension has to call an
explicit redraw whenever it is supposed to be refreshed)
"system()" called by "get_git_untracked" and "get_hg_untracked" fails
sometimes. It reports error "Can't open file /tmp/***".
The root cause is that the file path for system() contains some unordinary
character and lacks quotes.
airline#extensions#load() tries to load all extensions,
the user has specified in g:airline_extensions.
However, if e.g. bufferline is requested to be loaded, but
is not installed, it will throw an error
E117: Unknown function: airline#extensions#bufferline#init
Therefore, catch E117 and show a warning.
closes#1127
Similar to #1065 and #1081, adds link scripts to be excluded.
Adds a list containing C-like languages to ignore, which implement
multiline comments as:
/*
*
...
*/
Comment below filetype check reflects all exclusions (c-like)
This patch prevents check_mix_indent_file() form notifying a "mix-ident-file"
when working where C/CPP using space and comment like:
/**
* Some comment on the 1st column that shall not trigger check_indent_file()
*/
This kind of file can be found in linux kernel for example.
tabline
Solution: Add a new option which inverses the position of buffer and
tabs
If switch_buffer_and_tabs is 0 (default) buffer are on the left and tabs
on the right else if is 1 the order is reversed.
theme usually use '_' instead of '-', so replace that first before
trying to match.
Second, make the patterns easier to match.
Third, make sure, match for Tomorrow happens with matching case
fixes#1056
This is required when used with 'Normal' with a transparent background.
Falling back to 1 here results in "red" for "ctermbg"!
I think it's important to keep the 'NONE' color property here, instead
of hardcoding the fallbacks (even if white would be used instead of
red).
This is a new tabline extension, that displays both the buffers open and
the available tabs. This has been requested by #639 and fixes#639.
This is based on blings work on branch spike.
This uses the new highlight groups tab*_right, so that the separators
have the correct color. Also this makes some configuration variable
obsolete and therefore, they have been removed.
remove unused combined config variable, remove space after tab
This should make the buflist algorithm faster.
Also there is an alternative implementation in branch 535 available,
which avoids looping over the complete range, I'll stay with the current
approach, as it does not depend on BufAdd/BufDelete autocommands.
details:
instead of testing for buflisted() and bufexists() we only test for
buflisted() because, this also tests for the existence of the buffer.
Also instead of a second loop of the exclude patterns, we'll join all
of them together with '\|' and check if they match the current buffer.
The rest of the conditions have been joined into a single condition.
This together made up an improvement of
Orig:
FUNCTION airline#extensions#tabline#buflist#list()
Called 94 times
Total time: 0.267305
Self time: 0.267305
New:
FUNCTION airline#extensions#tabline#buflist#list()
Called 85 times
Total time: 0.124572
Self time: 0.124572
Try a different approach, that does not echo
the commandline. For that, create a <silent> mapping,
that is called via feedkeys() and as such should update the tabline.
fixes#1011
Solution: Use the current one from ctrlspace 5.0 + minor style fixes
Problem: CtrlSpace 5.0 does no longer work with airline
Solution: Modify the ctrlspace extension to call the new APIs
The statusline work fine but the custom ctrlspace function
somehow/somewhere gets overridden and I could not figure out where.
Therefore the user must add
let g:CtrlSpaceStatuslineFunction = "airline#extensions#ctrlspace#statusline()"
to its .vimrc.
Problem: Ctrlspace 5.0 does not integrate well into tabline
Solution: Write a tabline extensions for ctrlspace 5.0.
The extensions is capable of showing both tabs and buffers, but only the
buffers of a current tab are shown.
The current mode is only cached per window. This will break, if one
switches tabpage. We remember the last mode that was used to create the
highlighting group and compare, if this has changed.
This fixes#670
This is an extension to the whitespace extension.
It can now detect, if there is mixed indentation used within a file,
e.g. (using space for indentation on some lines and using tabs on other
lines.
This fixes#560
Most of them seem to be caused by using :hi statements, although the
highlighting group to be created is exactly the same. Therefore, get the
info from actual definition and only execute :hi when the new group is
actually different.
Also try to avoid to generate :hi statements when the popupmen is
visible. This causes flickers.
This is probably a bug in Vim because redrawing might cause
Vim to actually try to access a line of the buffer, that hasn't
been loaded yet.
Therefore try to update the tabline, by performing a two :set mod!
calls.
first argument of git status is <pathspec> in git speech,
and so if you feed it a directory, that contained an untracked file,
the directory would be marked as untracked. So fix this.
This will show a little not-existing sign in a buffer,
if that file lives in a git/hg repository but does not exists
there yet. Use `:let g:airline_symbols.notexists='!'` to configure
the '!' as symbol. By default, will use U+2204 symbol
To not impact performance by shelling out a lot, the result is cached
until the buffer is written or a shell command is issued.
Should work with mercurial and git.
fixes#925
1) Make sure airline_error and airline_warning highlighting are
different, so that the correct separator will be drawn. This
fixes#982.
2) allow to deactivate %(%) to workaround a vim bug, that may cause
leaking of colors from one section to the next and adding additional
spaces. This needs to be fixed upstream:
https://groups.google.com/d/msg/vim_dev/sb1jmVirXPU/mPhvDnZ-CwAJ
Possibly, also related to neovim/neovim#4147
Use `:let airline#extensions#default#section_use_groupitems = 0`
to disable grouping of statusline items
meaning that branches retrieved from those are now displayed side by
side. The order can be customised with g:airline#extensions#branch#vcs_priority.
The VCS name is now prepended to the branch name to be able to tell
which is which. The VSCCommand behaviour is unchanged.
Also restructured the code a little bit, and made found_fugitive_head
variable behave as its name suggests.
Currently, vim-airline uses hard-coded '\s$' to check for trailing
whitespace. However you might want to check for different values.
Therefore, set the variable
g:airline#extensions#whitespace#trailing_regexp to the required regexp
value.
closes#663
1) allow for custom formatting of the output of the wordcount formatter
This allows for formatting numbers correctly e.g. 1,042 in English
locale and 1.042 in German locale.
2) cache values, so that no on every cursor move the wordcount needs to
be recalculated.
this issue fixes#758
The problem was, that a given color list ['','',0,'',''] was given to
the airline#highlighter#exec() function. This resulted in the following
comparison:
if (get(colors,2,'') != '') ? 'ctermfg='.colors[2] : ''
which, since echo 0 != '' returns falls will return a single:
:hi group
and no color codes given and therefore, Vim would output the
current highlighting group.
Use isnot# as comparison to fix this issue.
This fixes#511
It allows the virtualenv plugin to call back and tell the airline plugin
to update the statusline. Therefore, the new function
airline#extensions#virtualenv#update() is provided. However, to properly
fix this issue, the virtualenv plugin needs to call this function.
Second, depending on $VIRTUAL_ENV is not safe, since the virtualenv
plugin might define it itsself when calling :VirtualEnvActivate
Therefore skip this test and just test for existance of he
:VirtualEnvList command.
Prior to this change airline set the function for getting hunks only once,
which works as long as you don't use simlar plugins for different VCS at the
same time.
If that was the case, only one plugin would have won, depending on the first
buffer handled by these plugins. And although the code for the other plugin
was run every time, you would never see the actual line changes, since airline
didn't even bother checking.
Now these plugins can be used side-by-side in the same Vim instance, e.g.
gitgutter for, well, git and signify for the rest.