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)