Commit Graph

1004 Commits

Author SHA1 Message Date
Christian Brabandt a0ea8db1fc Make the wordcount ext more flexible for the def. filetypes
This allows the user to further adjust the
g:airline#extensions#wordcount#filetypes configuration variable even
after Vim has started up.
2016-12-13 21:27:53 +01:00
Christian Brabandt c375d050a8 Do not add extra %( %) in the statusline
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
2016-12-13 21:14:51 +01:00
Christian Brabandt 7cd7972bbe cleanup unlet calls
Instead of looping through the list and unletting each value separately,
join the list and their names together and unlet them all together.
2016-12-13 20:28:30 +01:00
Hirokazu Hata dfc0cb772a Add dict to function refferencing self
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
2016-12-12 19:26:52 +01:00
Sam Fuller 7cb5c24151 prevent windows from closing on middle_click
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 😄
2016-12-09 13:20:48 +01:00
Christian Brabandt 781b4ea6a2 Merge pull request #1321 from chrisbra/getwininfo
Use getwininfo() for checking quickfix window
2016-12-09 12:59:46 +01:00
Nate Soares 17b6bd9c8f Fixed bug where highlighting on inactive windows wouldn't refresh.
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')
```
2016-12-09 12:53:35 +01:00
Christian Brabandt 0357b4fcbe Merge pull request #1348 from shaunbrady/exclude_at_runtime
Make ...#excludes|exclude_preview runtime configurable
2016-12-06 21:18:38 +01:00
Christian Brabandt 4c39344cc1 Merge pull request #1334 from chrisbra/worktrees
Add Worktrees support
2016-12-06 21:17:51 +01:00
Shaun Brady 718107c107 Make ...#excludes|exclude_preview runtime configurable
airline#extensions#tabline#excludes and
airline#extensions#tabline#exclude_preview previously had no impact if
changed after vim load.  This fixes that.
2016-12-03 23:40:15 -05:00
Christian Brabandt 04be981de9 make ...#fnamemod configurable during runtime
airline#extensions#tabline#fnamemod would be initialized and could not
be changed during runtime, so fix that.

closes #1347
2016-12-02 13:40:34 +01:00
Christian Brabandt ccdc3d6c60 Merge pull request #1337 from mhartington/master
feat(): allow for buffer index formatting
2016-11-26 14:26:47 +01:00
mhartington ee8173e41d
feat(): allow for buffer index formatting 2016-11-25 12:36:55 -05:00
Christian Brabandt 53c8aa4fd6 enable wordcount for mail and tex filetypes 2016-11-24 15:20:38 +01:00
Christian Brabandt b67509189b check for correct variable 2016-11-23 16:35:01 +01:00
Christian Brabandt d4a239f14a Make airline aware of git worktrees
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).
2016-11-23 16:33:12 +01:00
Richard Russon 4e93a90441 Abbreviate the text for 'po' translation files.
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.
2016-11-22 11:24:10 +00:00
Grzegorz Milka 241f324b39 Do not forward v:shell_error on command fail.
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.
2016-11-20 10:16:13 +01:00
Christian Brabandt cebfc9a64b Use getwininfo() for checking quickfix window
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
2016-11-16 20:14:27 +01:00
Grzegorz Milka 433d5d8f97 Use neovim's async job's instead of system
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.
2016-11-04 19:09:05 +01:00
WADA Takashi e7056db27a Fix when using vim-lawrencium 2016-11-04 10:54:39 +09:00
Grzegorz Milka 3899f848a7 Adapt data structures of branch.vim to async
* 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
2016-11-03 21:03:13 +01:00
Christian Brabandt 02ecb8631d fix missing part of commit 3bd6cb5ee4
There was a part missing of #3bd6cb5ee4981227
add it back
2016-11-03 17:54:50 +01:00
Christian Brabandt 6dae3452db Fix order of statements
Commit #3bd6cb5ee498 causes an error, because a variable was used
before it was declared. Fix this.
2016-11-03 17:26:32 +01:00
Grzegorz Milka 3bd6cb5ee4 Refactor branch.vim to avoid code duplication
* 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
2016-11-03 17:19:17 +01:00
Christian Brabandt 516870bf9f Check for correct async condition
fixes #1308
2016-11-02 16:43:47 +01:00
Christian Brabandt 0ea4daa103 Merge pull request #1297 from chrisbra/mq
Add mq status for hg repositories
2016-10-26 20:47:45 +02:00
Christian Brabandt 98fe4eabd4 Merge pull request #1299 from gregorias/fix_git_untracked
Display not exists symbol correctly in Git repos
2016-10-26 20:47:28 +02:00
Grzegorz Milka 2af2bdb424 Display not exists symbol correctly in Git repos
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.
2016-10-25 19:26:44 +02:00
Christian Brabandt 5fe511c20b Merge pull request #1298 from chrisbra/shorten_mode
Shorten mode message for small windows
2016-10-25 08:01:07 +02:00
Christian Brabandt 6a155fabda guard against loading extensions twice
fixes #1300
2016-10-24 12:14:30 +02:00
Christian Brabandt 69020706b2 Shorten mode message for small windows 2016-10-20 22:57:26 +02:00
Christian Brabandt 14ab47cae6 Add mq status for hg repositories
Now that we have async feature for Vim 8, we can add the output of 'hg
qtop' back to the statusline if it is supported
2016-10-20 22:46:24 +02:00
Aditya be6e3db68b
on_exit function fix if self.file is missing 2016-10-18 22:23:07 -04:00
Christian Brabandt 8964603844 fix missing declaration 2016-10-14 11:14:33 +02:00
Bjorn Neergaard 06351e86df Add support for ALE, the Async Linting Engine
Ale is a plugin that lints text in the background, as you type!

It is new, but under [rapid development](https://github.com/w0rp/ale).
2016-10-14 10:36:21 +02:00
Bjorn Neergaard 45e5c907be Add support for flattened and NeoSolarized themes
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.
2016-10-14 10:36:21 +02:00
Christian Brabandt 4f8a16c31e fixup for async feature 2016-10-14 10:36:21 +02:00
Christian Brabandt 81ccd3bdf6 po-extension: Make asyncable 2016-10-14 10:36:21 +02:00
Christian Brabandt c39e5f82cc check for existence of git/hg before calling them 2016-10-14 10:36:21 +02:00
Christian Brabandt f706edee9f init async global variables 2016-10-14 10:36:21 +02:00
Christian Brabandt 57ca6c9e78 include workaround from c1704a2de0
add workaround from commit c1704a2de0 to prevent overwriting
v:shell_error
2016-10-14 10:36:21 +02:00
Christian Brabandt ffa3d59af2 branch ext: use async functions for system() commands
Make use of vim 8 async functionality and use it to get the vcs status
for the branch extension.

Won't work with neovim.

fixes #1266
2016-10-14 10:36:21 +02:00
Benjamin Thomas 78439b2b35 Fix whitespace symbol empty string has extra space
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.
2016-10-02 01:22:50 -07:00
Christian Brabandt f5359f9177 do not skip empty sections for the tabline
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
2016-09-27 21:44:00 +02:00
Saad Malik 3c33251ee7 Support for neomake
Added support for neomake plugin; similar to syntastic.
Shows warning and error counts in the airline statusbar.
2016-09-27 21:21:35 +02:00
Christian Brabandt 1c052e39b1 Merge pull request #1271 from chrisbra/highlighter_bug
Use the correct highlighting for the inactive window
2016-09-26 21:13:02 +02:00
Christian Brabandt 29c556dba4 use correct groupname for inactive windows
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
2016-09-26 21:12:15 +02:00
Christian Brabandt 3d667c32d3 for empty sections, make test return true
fixes #1231
2016-09-24 22:06:41 +02:00
Christian Brabandt 513afd25bc Merge pull request #1263 from thawk/master
Set script encoding to avoid script parsing problem in non UTF-8 VIM
2016-09-24 21:55:50 +02:00