Commit Graph

1289 Commits

Author SHA1 Message Date
Christian Brabandt
6e2a9e38cd
tabline: force redraw on BufAdd autocommands
closes #1580
2017-10-19 11:37:24 +02:00
Shohei Fujii
7bf1d9b1fb skip toggling ctrlspace tabline plugin 2017-10-16 17:33:40 +09:00
Christian Brabandt
27acd851a7
cleanup term extension 2017-09-27 20:28:18 +02:00
Christian Brabandt
0ad4f97c1a
Add a terminal statusline function for vim 2017-09-27 20:28:16 +02:00
yehuohan
4d645711e5 Fix: Use the CS-symbol of ctrlspace which may be change by user in ctrlspace-externsion 2017-09-27 16:17:50 +08:00
Christian Brabandt
031cb31056
branch: do not show errors for mq extensions
skip anything that matches abort

e.g. running hg qtop with Vims path outside of the repository returns
something like "abort: no repository found in ..."
in that case, do not show anything.
2017-09-22 21:39:17 +02:00
Christian Brabandt
9f186d899a
branch: mq patch not correctly displayed
also make the branch extension make use of the specific code to handle
the mq output
2017-09-22 21:37:28 +02:00
Gideon VanRiette
a763c6b53f Catch trailing whitespace when matching output 2017-09-18 09:02:39 -05:00
Christian Brabandt
8a3e3e2794
mq: remove trailing \n from system()
fixes #1563
2017-09-14 11:43:53 +02:00
Christian Brabandt
81f089322a
keymap: allow to disable extension by checking config var
closes #1556
2017-09-03 21:18:01 +02:00
Christian Brabandt
cdaa5117b0
highlighter: also return bold flag 2017-09-01 11:25:37 +02:00
Christian Brabandt
e7a5c97df1
readonly: remove modifiable check 2017-09-01 09:19:39 +02:00
Christian Brabandt
9e3fcc4cdb
tagbar: only try loading the tagbar extension once
commit 232b641 did unfortunately disable tagbar completely, since
exists("*func") does not autoload the function.

So this time, try explicitly calling the function once, and if it does
not exists, it should be disabled and not cause any further errors.

closes #1555
2017-09-01 09:08:22 +02:00
Christian Brabandt
f0a508b121
async: nvim: use generic output handler 2017-08-30 13:15:55 +02:00
Christian Brabandt
942458f19b
async: include stderr output in job output (Nvim)
references #1551
2017-08-29 12:56:15 +02:00
Christian Brabandt
d3f8873469
async: fix error, when mq is not enabled
fixes #1551
2017-08-29 12:47:29 +02:00
Christian Brabandt
09ab45a2fb
async: add missing comma
fixes #1550
2017-08-29 11:53:20 +02:00
Christian Brabandt
195f2e1dae
keymap: fix missing keymap symbol, fix wrong condition 2017-08-27 21:29:40 +02:00
Christian Brabandt
3b225a1322
keymap: add some more missing parts, fix missing printf 2017-08-26 21:14:35 +02:00
Christian Brabandt
f430246aff
keymap: add missing part from #1546 2017-08-26 18:18:45 +02:00
Christian Brabandt
57cda93aad
keymap: fix the style 2017-08-26 18:14:08 +02:00
Doron Behar
89e484ac59
Add keymap extension which shows keymap setting. 2017-08-26 18:09:20 +02:00
kaidiren
2b45581f1c fix: refresh airline when airline_skip_empty_sections enabled in plugin ale 2017-08-26 19:00:40 +08:00
Christian Brabandt
db907f5598
async: new function for validating directory
references #1544
2017-08-26 08:04:44 +02:00
Christian Brabandt
3e25ca5a5a
async: Check directory before starting the job (Neovim)
fixes #1544
2017-08-26 07:58:39 +02:00
Christian Brabandt
e357f88de6
async: define config variable for older vims
references #1542
2017-08-25 18:50:15 +02:00
Christian Brabandt
f4caf598fa
async: only use nvim functions, when actually using neovim
closes #1542
2017-08-25 16:48:45 +02:00
Christian Brabandt
42e5c82d64 Merge pull request #1535 from chrisbra/nvim_async
Improvement to async functionality
2017-08-25 14:37:47 +02:00
Christian Brabandt
5345c8fafa
denite: Check filetype in mode function
references #1540
2017-08-25 08:38:31 +02:00
Christian Brabandt
9bd2c40e7d
denite: remove FileType autocommand
closes #1540
2017-08-25 07:44:39 +02:00
icymind
b6a98bcd10 add option 'keymap_ignored_filetypes' for tabline extensions 2017-08-24 23:22:16 +08:00
Christian Brabandt
b77f326b33
async: rename variable
rename g:airline#init#async variable to g:airline#init#vim_async
because that is what it is for: showing whether vim supports async. Is
not set vor nvim, because nvim always supports jobs.
2017-08-23 18:38:19 +02:00
Christian Brabandt
06272275b5
fix po output not visible for nvim
Apparently, the output of msgfmt goes to stderr. So catch that one as
well.
2017-08-23 18:37:28 +02:00
Christian Brabandt
2c05a48a26
async: Add comments, better conditions to detect vim/nvim 2017-08-23 18:37:26 +02:00
Christian Brabandt
4c74a95045
Refactor async functions
- create a new async module
- refactor async functions from branch.vim and po.vim to async.vim
- support nvim async correctly
2017-08-23 18:37:24 +02:00
Christian Brabandt
50bfe8dd68
First commit to handle nvim specific async code 2017-08-23 18:31:43 +02:00
Christian Brabandt
a01d03a78a
branch: only do mq check once
but reset the check variable on Shell commands and when :AirlineRefresh
was called.

should make vim more performant

references #1536
2017-08-23 18:28:48 +02:00
Christian Brabandt
3ec22a524c
branch: comment why the argument is not used for update_hg_branch 2017-08-23 18:23:28 +02:00
Christian Brabandt
8cd7e35027
branch: correctly reset cache variables 2017-08-23 18:03:23 +02:00
Christian Brabandt
e553433430
branch: when mq is disabled, do not run hg qtop anymore 2017-08-23 18:01:41 +02:00
Christian Brabandt
5147d385a5
branch: cache filename path
fixes #1536
2017-08-23 17:56:57 +02:00
Christian Brabandt
232b6415d9
tagbar: do not error out, if autoloaded function does not exist
tagbar is not loaded if filetype plugin is off, so do not try to call a
non-existent function than.
2017-08-23 15:54:06 +02:00
Christian Brabandt
e8b6312dd9
Backout the wrong commit for checking async feature in nvim
fixes #1532
2017-08-21 22:22:19 +02:00
Christian Brabandt
04bc544db2
po: rename variable correctly and add g: prefix 2017-08-21 21:29:16 +02:00
Christian Brabandt
5fc5a43802
init: rename variable 2017-08-21 21:26:35 +02:00
Christian Brabandt
c2b2351d99
async: Better check for nvim
closes neovim/neovim#7186
2017-08-21 21:23:34 +02:00
Christian Brabandt
470e9870f1
highlighter: do not consider 0 to be empty
fixes #1531
2017-08-20 22:47:02 +02:00
Christian Brabandt
e5f9ccad8e
terminal: use mode() to detect terminal mode
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.
2017-08-20 22:47:00 +02:00
Christian Brabandt
d8eb12845f
hunks: do not cache for changes plugin 2017-08-14 08:13:19 +02:00
Christian Brabandt
a8c4424244
highligthing: Enable cacheing only when config is set.
This enables the highlighting caching only when the variable
g:airline_highlighting_cache is set to 1

Should make airline faster and more performant, because we can save a
lot of expensive C core calls. However, when redefining highlighting
groups, it might not correctly reset the cache.
2017-08-14 08:06:53 +02:00
Christian Brabandt
a96681d459
highlighter: Cache syntax highlighting attributes
Should in theory improve performance by quiet a lot.
2017-08-11 11:26:35 +02:00
Christian Brabandt
e9a7a12d9e
highlighter: improve performance of get_array() function 2017-08-11 11:05:56 +02:00
Christian Brabandt
c65d7fe36b
highlighter: slight performance increase
do not access get() function twice. We can assign the result to a
variable and use it a second time. Should speed up the highligther part
of the code by a bit.

Since I was already touching s:Get(), also get rid of the default
parameter, as it always has been the empty string.
2017-08-11 10:46:03 +02:00
Christian Brabandt
2ec563bd57
syntastic: slightly tweak output format
also document how to use different syntastic statusline format

closes #1525
2017-08-08 14:57:04 +02:00
Christian Brabandt
83ceae726e
syntastic: display line number for errors/warnings
line number was omitted from 2e3055541e, so add it back
in parenthesis.

fixes #1525
2017-08-08 12:59:15 +02:00
tenfy
c0695feb13 Fixes #1515. The tabline will no update when use ctrlspace together.
Do not update tabline when the new buffer is no add to BufferList yes.
It will update by other event later.
2017-08-08 15:07:54 +08:00
Ryan Lue
039fd6b50f Fix airline#switch_matching_theme() to accommodate camelcased colorscheme names 2017-08-07 12:42:22 +08:00
Christian Brabandt
a2e20bc3ca
spell: Display spelling language
fixes: #1521
2017-08-01 19:25:20 +02:00
Christian Brabandt
0c307d5f73
Better way to check for terminal buffer 2017-07-30 18:57:05 +02:00
Christian Brabandt
d54613d2dd
Check for existence of term_list()
fixes #1518
2017-07-30 18:55:52 +02:00
Christian Brabandt
846d85aaa1
main: support for Vims terminal mode
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
2017-07-30 09:51:23 +02:00
Reuben D'Netto
e79188c3bd Neomake integration: if loclist is empty, fallback to quickfix 2017-07-21 18:30:34 +10:00
Christian Brabandt
61c624ef6c
unicode: Update Unicode extension
do not draw the complete statusline in a bright yellow. This might hurt
your eyes
2017-07-19 12:57:18 +02:00
Christian Brabandt
afcda0510e
Ale: Removing caching
fixes #1506
2017-07-06 12:14:49 +02:00
Christian Brabandt
4f43e5c93d Merge pull request #1503 from d10n/git-hunk-empty
Fix git hunk status disappearance on CursorHold
2017-07-01 21:44:30 +02:00
d10n
b6eaa60a88 Fix typo 2017-07-01 12:11:27 -04:00
d10n
39c61288e8 Fix git hunk status disappearance on CursorHold
When using vim-gitgutter and fugitive:

The hunks extension and the branch extension work as expected when the
file is first loaded; both parts are added to the statusline.

Once the cursor is moved and stopped for &updatetime ms:

1. The branch extension clears b:airline_head on CursorHold
2. Somehow (?) airline#statusline gets called on CursorHold
3. The hunks extension returns '' when b:airline_head is empty, causing
the hunks to be removed from the statusline.

It doesn't make sense to clear airline_head just because the cursor
moved, and the commit message adding the line doesn't say why:
13297cee03

Commit 174b7e1962 relies on airline_head
being set.

Debug detail:

Executing CursorHold Auto commands for "*"
autocommand unlet! b:airline_head
[...]
continuing in CursorHold Auto commands for "*"
calling function airline#statusline(1)
[...]
line 1:   return exists('*airline#extensions#branch#head') && empty(get(b:, 'airline_head', ''))
function airline#extensions#hunks#get_hunks[13]..<SNR>32_get_hunks[14]..<SNR>32_get_hunks_gitgutter[1]..<SNR>32_is_branch_empty returning #1
function airline#extensions#hunks#get_hunks[13]..<SNR>32_get_hunks[14]..<SNR>32_get_hunks_gitgutter returning ''
function airline#extensions#hunks#get_hunks[13]..<SNR>32_get_hunks returning ''
function airline#extensions#hunks#get_hunks returning ''

:au CursorHold
--- Auto-Commands ---
gitgutter  CursorHold
    *         call gitgutter#process_buffer(bufnr(''), 1)
CursorHold
    *         unlet! b:airline_head
airline_whitespace  CursorHold
    *         call <sid>ws_refresh()

------------------------

Sample vimrc:

set nocompatible

if empty(glob('~/.vim/autoload/plug.vim'))
  silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
    \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
  autocmd VimEnter * PlugInstall --sync | q | doautocmd WinEnter
endif

autocmd VimEnter *
  \  if len(filter(values(g:plugs), '!isdirectory(v:val.dir)'))
  \|   PlugInstall --sync | q
  \| endif

call plug#begin('~/.vim/bundle/')
Plug 'vim-airline/vim-airline'
Plug 'tpope/vim-fugitive'
Plug 'airblade/vim-gitgutter'
call plug#end()
set laststatus=2
set updatetime=250
let g:airline_theme = 'dark'
2017-07-01 11:57:08 -04:00
David Antaramian
42522f994a Fixes typo introduced in a10d321
Commmit a10d321809 introduced a small typo
spelling a previously set variable `trailing_fmt` as `trailing_fm`. This
causes Vim to report `trailing_fm` as an undefined variable. In this
change, the variable is properly referenced as `trailing_fmt`.
2017-06-30 18:45:21 -04:00
Christian Brabandt
a10d321809
whitespace: move s:variables around
Will make sure, that even after setting the whitespace extension
variables, they are taken correctly into account.
2017-06-30 21:37:37 +02:00
Christian Brabandt
a914cfb754
backout b2f301f73c
Backout commit b2f301f73c

First of all, it caused flicker (which is caused by a Vim bug:
https://groups.google.com/d/msg/vim_dev/fdgPqmYZwOk/KJzR4l9wAwAJA)

and then the cache was not reset when editing a new file.

So let's just revert that commit, although it does affect performance.

fixes #1499
2017-06-28 21:10:57 +02:00
Christian Brabandt
313a6fcad2
tabline: prevent flicker on Windows
calling settabvar() while evaluating the 'tabline' setting apparently
causes flicker on Windows. Fall back to using `:let t:var` to store the
content in the current tabpage.

This is not as good as using `settabvar()` since we cannot store the
title for other tabs, but at least it should prevent the flicker and at
the same time at least cache the title for the current tabpage.
2017-06-27 18:28:28 +02:00
Christian Brabandt
825aec9e4d
Revert "highlight: skip processing the same hi group twice"
This reverts commit feee9bcf3c.

It brakes CI and shouldn't be needed
2017-06-27 14:44:49 +02:00
Christian Brabandt
62952b3887
tabline: only map keys if not done yet
Should improve performance by not steadily remapping keys
2017-06-27 14:44:03 +02:00
Christian Brabandt
b2f301f73c
tabline: Cache title as tablocal variable 2017-06-27 14:40:31 +02:00
Christian Brabandt
174b7e1962
hunks: Make hunk extension slightly faster
do not call airline#extensions#branch#head() but instead use the cached
variable b:airline_head.

Note: it looks like GitGutterGetHunkSummary() could need some cacheing
2017-06-27 14:16:28 +02:00
Christian Brabandt
6ab0098ced
Ale: Cache Warning and Errors
should provide some better performance
2017-06-27 13:52:48 +02:00
Christian Brabandt
feee9bcf3c
highlight: skip processing the same hi group twice
Shouldn't happen, but just in case skip creating highlighting group,
if the same group with the same attributes has already been defined.
2017-06-26 23:17:43 +02:00
Christian Brabandt
583ae3d5f9
highlighter: skip create hi groups for inactive mode if not needed
This will skip creation of highlighting groups, if there are no inactive
windows.
2017-06-26 22:30:48 +02:00
Christian Brabandt
560092a9ec
highligher: fix the comparison before redefining hi group
The comparison in airline#highlighter#exec() was there to prevent to
call out to too many :hi calls by making sure that the newly to be
defined highlighting group will be actually different from the current
existing one.

However, that did not work, as the returned old highlight
group did never match the newly to be created one, since it
intentionally left the cterm attributes out for the gui and the gui
attributes for the terminal.

Therefore, fix the comparasion and make it compare the actual values
that we have.

This should make vim-airline a bit faster (hopefully!)
2017-06-26 22:27:01 +02:00
Christian Brabandt
f86f1e8103
whitespace: Only refresh on changes to buffer
Should prevent too many redraws of Vim
2017-06-26 10:04:43 +02:00
w0rp
c8a5efc11e Update the ALE extension so it loads better and uses the new count format 2017-06-25 19:49:18 +01:00
Christian Brabandt
0a352c9f5b
branch: don't check untracked status for files in vcs dir
Currently, vim-airline will check untracked status for files e.g. living
in .git. So when editing .git/config it will show as being untracked.

While technically, this is correct I prefer not to see this for those
files. So skip the check for those files.
2017-06-24 14:03:40 +02:00
Christian Brabandt
fde2511201
Syntastic: remove unused variable 2017-06-22 09:47:01 +02:00
Christian Brabandt
57e564b227
Add termguicolor check for is_win32term
closes #1259
2017-06-21 15:44:58 +02:00
Christian Brabandt
7d082c03b2
Do not clear intro screen
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).
2017-06-21 13:21:13 +02:00
Christian Brabandt
87cdf8f6c4
highlighter: Make sure hi group exists and is valid
previously we only checked, that the group exists, however
if loading a new color scheme, this might lead to the group becoming
cleared. That means it still exists, but the highlighting group would
not show anything. Therefore, also check that the group is not cleared.

closes #1483
2017-06-21 09:19:51 +02:00
Christian Brabandt
52c0afadb9 Merge pull request #1413 from chrisbra/wordformat
Improvements to wordcount formatting
2017-06-20 23:31:15 +02:00
Christian Brabandt
2e3055541e
syntastic: distinguis errors and warnings
Currently the syntastic results are simply dumped into the error
section, however syntastic does internally distinguish between error and
warning sections.

Therefore change the syntastic extension to dump errors into the error
section and warnings into the warning section.

closes #1480
2017-06-20 22:26:22 +02:00
Christian Brabandt
d2b697d27b
ale ext: fix syntax error 2017-06-20 22:23:46 +02:00
Christian Brabandt
7f3d6287b5
ale ext: simplify logic 2017-06-20 21:20:24 +02:00
Christian Brabandt
1891933e59
branch: better display of branch for both hg and git
If a file is edited inside a git repository, which lies within a git
repository, the branch extensions shows 'gitmaster | hgdefault'

To make it more obvious, that we are looking into both repositories
here, use 'git:master | hg:default'

closes #1482
2017-06-20 17:47:07 +02:00
Christian Brabandt
c436592559
bufferline: take 'acd' into account
vim-airline does use a different section (path/file) depending on
whether 'acd' is set. Later in the bufferline extesion however, it
unconditionally overwrites the 'file' section, regardless of whether
this section is actually used.

Therefore the bufferline section needs to check this option as well.

fixes #1487
2017-06-20 13:58:39 +02:00
Christian Brabandt
e16ff7cc88
Do not error out, if a netrw variable is not defined
This should not happen, however being a bit more error tolerant
shouldn't hurt, so let's just fall back to 'normal' for the
g:netrw_sort_direction in case it is not defined (which should be the
default anyhow).

fixes #1492
2017-06-19 15:56:17 +02:00
Oz Elentok
7865dc8149 Improve denite extension performance 2017-06-12 22:00:25 +03:00
Maxim Gonchar
8e64138ef4 Add vimtex support
Indicates:
- whether the file is considered to be main or local
- whether the viewer is opened
- whether the compilation is running
- whether the compilation is continuous

Added:

* `vimtex` existence check
* variables documentation

TODO: readme and a screenshot

Update readme.md

Update doc

Update screenshot url
2017-05-08 13:07:13 +03:00
Christian Brabandt
d593359500
shorten filetype only when winwidth is < 90 2017-05-02 22:06:36 +02:00
Christian Brabandt
a950a2938a
shorten tagbar extension on short windows 2017-05-02 21:22:47 +02:00
Christian Brabandt
4a47cd70cd
correctly check w:airline_skip_empty_sections var 2017-04-11 22:10:43 +02:00
Christian Brabandt
f76ede3b28
Make skip_empty variable overridable per window
The denite extension functions return the content of some buffer-local
variables. Those variables are not defined, the first time the they are
accessed and therefore, the statusline is not updated later when
g:airline_skip_empty_sections is set.

So disable this variable in this window, by setting the
w:airline_skip_empty_section=0 variable in the denite window.

closes #1454
2017-04-10 09:29:27 +02:00
Shivansh Rai
223624d3e9
Update icon spacings
The line numbers start to merge with icons when they get large
Reference: https://image.ibb.co/e7KGaa/airline.jpg
2017-03-17 19:08:47 +05:30
Christian Brabandt
46b0b6bf5a Merge pull request #1427 from thatsmydoing/denite
Add support for denite
2017-03-15 10:06:19 +01:00
Thomas Dy
c9a0c62b1b Add support for denite 2017-03-15 16:41:50 +08:00
Christian Brabandt
17d2db93fd
Check, that fg color can't be negative 2017-03-13 18:50:19 +01:00
Christian Brabandt
ba7d8c59f7
Call hg qtop with locale set to C
closes #1438
2017-03-13 09:49:02 +01:00
Chris White
fb6231b479 Permit appending content to a theme
When ctrlp is not loaded, do not finish (terminate script execution).
Instead, just skip assigning the ctrlp colors.
2017-03-12 18:16:26 -04:00
Christian Brabandt
134c0204f3
Do not return a negative background color
fixes #1429 and similar
2017-03-05 22:18:04 +01:00
Lingnan Dai
7f19896dc6 Fix problems with AirlineSelect{Prev,Next}Tab
Use the entire list of buffers instead of the currently visible ones
2017-02-28 15:56:37 +00:00
Christian Brabandt
fbd791e7f0 Merge pull request #1424 from tweekmonster/powerline
Fix g:airline_powerline_fonts check
2017-02-28 08:51:08 +01:00
Christian Brabandt
52663545a9
Only reset to Normal highlighting if it is actually defined
closes #1415 and similar
2017-02-28 08:33:44 +01:00
Tommy Allen
9876a0a2de Fix g:airline_powerline_fonts check 2017-02-27 22:32:06 -05:00
Alexey Zhikhartsev
3c6135d75f
Add a function to disable whitespace-detection
Useful to call for particular file types (e.g., .tex files):
ftplugin/tex.vim:
    call airline#extensions#whitespace#disable()
2017-02-26 10:35:17 +01:00
Christian Brabandt
9d89375b8f
Do not update wordcount on unknown buffers 2017-02-26 10:25:21 +01:00
Christian Brabandt
727a2b48d9
Rename wordcount update function 2017-02-26 10:24:08 +01:00
Christian Brabandt
7e6986651c
Fix stupid typo 2017-02-25 22:13:16 +01:00
Christian Brabandt
f8c85e3e53
for airline ascii symbols set g:airline_symbols_ascii 2017-02-25 17:39:32 +01:00
Jorrit Visser
078537f1e2
Add interface fallback (Powerline>Unicode>ASCII)
Basically what the title says. First check if the user has Powerline,
fall back to Unicode symbols if he doesn't and fall back to ASCII
symbols if he doesn't have that either.
2017-02-24 22:23:41 +01:00
Jorrit Visser
72478dee02
Make vim-airline pretty without Powerline
Vim-airline is not a looker without a Powerline font. This fixes that!

* Ugly separator symbols are hidden
* New branch (ᚠ), line (㏑), maxline (☰) and whitespace (☲) symbols
* Replace old whitespace (✹) symbol in Powerline with the new (☲) more logical one
2017-02-24 22:23:41 +01:00
Christian Brabandt
db01efd508
Better reformat wordcount format in with separator 2017-02-24 18:28:48 +01:00
Christian Brabandt
b2bbe7dbc2
Small wordcount format output on windows < 80 2017-02-24 18:25:29 +01:00
Christian Brabandt
562d060b08
Reset wordcount cache on window size
so the format can make a better guess what to display on different
window sizes.
2017-02-24 18:24:30 +01:00
Christian Brabandt
d8b62aa426
Remove unused variable 2017-02-24 18:22:25 +01:00
Christian Brabandt
f1574c4e0a
define highlighting group, if it not exists
previously, it could have been skipped, if the old highlighting
attribute was the same as the current one. However, if the group does
not exist, it should still be defined

closes #1404
2017-02-20 21:30:10 +01:00
Christian Brabandt
69b132a6f4
Make sure, the highlighting group will be defined
If a color value of ['', '', 'NONE', 'NONE', ''] is given as value to
the highlighting group, the resulting group definition would look like
this:

hi Normal ctermfg=NONE ctermbg=NONE

which would result in the highlighting group being cleared (or even no
set at all), therefore check that at least one other value exists and if
not fall back to the highlighting definition of the Normal group.
2017-02-20 21:30:10 +01:00
Christian Brabandt
583121bbc9
before trying to return hi attributes, check the group exists
This prevents trying to access twice the highlighting groups
and should slightly speed up airline.
2017-02-20 21:29:37 +01:00
Jorrit Visser
8776a3e058 Truncation fix
Line numbers are now displayed before the error, instead of after, preventing truncation (and thus making the whitespace/indent section essentially useless in smaller terminals)
2017-02-07 14:20:56 +01:00
Christian Brabandt
7df411d59b Add missing comma
fixes #1386
2017-01-27 12:10:07 +01:00
Christian Brabandt
1a79d148dc do not add two bold accents to linenr and maxlinenr 2017-01-27 11:25:37 +01:00
Christian Brabandt
b56a064377 Use get() to access members of getwininfo() function
And add default value, in case the 'loclist' and 'quickfix' entry is not
available (can happen on versions without +quickfix feature).

Fixes #1379
2017-01-21 22:02:40 +01:00
Jerome Reybert
a1db013d3f Add vimagit extension 2017-01-19 14:02:53 +01:00
Christian Brabandt
9b1770f246 hg extension did not work on Windows
remove extra file argument

closes #1367
2016-12-31 23:50:39 +01:00
YoungHoon Rhiu
d60323d623 Add vim-xkblayout extension to display keyboard layout 2017-01-18 12:34:14 +09:00
Christian Brabandt
a2431f2adb Check s:jobs dictionary before trying to remove jobid
fixes #1363
2016-12-29 11:22:55 +01:00
Christian Brabandt
706cee277a Add tab indicator for tabline when buffers are shown
closes #1329
2016-12-16 23:42:58 +01:00
Christian Brabandt
73a1238205 wrong quoting of condition 2016-12-14 16:10:33 +01:00
Christian Brabandt
a69834f7dc Make fileformat output truncatable
closes #1309
2016-12-13 21:47:09 +01:00
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
thawk
45d77ca909 Add 'scriptencoding utf-8' to all scripts 2016-09-24 08:16:30 +08:00
Christian Brabandt
c1704a2de0 Do not overwrite v:shell_overwrite after ShellCmdPost
Prevents resetting v:shell_error from the followin system() call in
get_git_untracked.

Fixes #1266
2016-09-23 16:11:53 +02:00
R.Chavignat
da457ae5ea Add support for b:airline_whitespace_checks variable and documentation 2016-09-22 14:27:07 +02:00
Christian Brabandt
65b9aa4856 Check for existence of key in context dict before using it
fixes #1251
2016-09-09 08:07:07 +02:00
Christian Brabandt
c058922358 do not use utf-8 chars, if encoding is different
fixes #1234 #1248
2016-09-08 21:33:39 +02:00
Christian Brabandt
afee79bbe0 Merge pull request #1250 from chrisbra/1233
Do not unconditionally modify airline_c_inactive
2016-09-08 21:30:20 +02:00
Simon Ratner
0b1df0c524 Add null accent, to allow accents to be removed 2016-09-08 21:24:04 +02:00
Christian Brabandt
73aea86a7a Do not unconditionally modify airline_c_inactive
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
2016-09-08 18:46:11 +02:00
Christian Brabandt
c0cb03f48b don't add a second separator if not needed
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
2016-09-05 20:20:44 +02:00
Christian Brabandt
54e4772ef8 Merge pull request #1239 from chrisbra/1230
Do not cache gitgutter values
2016-09-05 19:32:24 +02:00
Christian Brabandt
5eaf658b9c Merge pull request #1240 from chrisbra/1226
Add User autocommand for Theme changing
2016-09-05 19:32:13 +02:00
Ythildyr
afb75adc11 :AirlineRefresh not work correctly
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 .
2016-08-28 14:41:45 +02:00
Christian Brabandt
7612aaf701 Add User autocommand for Theme changing
fixes #1226
2016-08-24 21:27:49 +02:00
Christian Brabandt
43e3ef5428 Do not cache gitgutter values
fixes #1230
2016-08-24 21:22:28 +02:00
Bill Neubauer
460ed02864 Add Go to the list of C-like languages. 2016-07-26 10:06:40 +09:00