Commit Graph

527 Commits

Author SHA1 Message Date
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
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
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
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
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
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
Julien Pivard
53dcd8a49c Hunks won't appear if g:airline_skip_empty_sections = 1 2016-07-24 21:15:10 +02:00
Christian Brabandt
657cf773ad Merge pull request #1206 from chrisbra/width
Cache hunk values, shorten for small windows
2016-07-24 10:08:40 +02:00
Christian Brabandt
797ad1ea79 Merge pull request #1207 from chrisbra/ctrlspace
Map keys in ctrlspace mode
2016-07-24 10:07:36 +02:00
Christian Brabandt
4d0c4f6b1e Merge pull request #1197 from chrisbra/eclim
Cache eclim errorlist
2016-07-04 20:29:08 +02:00
Christian Brabandt
a6c04644ef Map keys in ctrlspace mode
fixes #1181
2016-07-03 21:09:42 +02:00
Christian Brabandt
8fda614d0d Cache hunk values, shorten for small windows
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.
2016-07-03 20:44:05 +02:00
Daniel Hahler
63dc4ba2a4 tabline: do not change the signature of get_buffer_name
Thanks to @wsdjeg about notifying me in
https://github.com/vim-airline/vim-airline/commit/e1f7bf#commitcomment-18104843.

Fixes: https://github.com/vim-airline/vim-airline/issues/1204.
2016-07-02 16:24:47 +02:00
Christian Brabandt
e1f7bffe71 Merge pull request #1189 from blueyed/tabline-only-handle-visible-buffer-names
Tabline performance: only pass in visible buffers to formatters
2016-07-02 10:57:50 +02:00
Christian Brabandt
c6f5d8b823 Merge pull request #1202 from chrisbra/resolve_symlink
Try to resolve symlinks for git
2016-07-02 10:55:49 +02:00
Christian Brabandt
409e8b0cbd refactor shortening code 2016-07-02 10:20:07 +02:00
Christian Brabandt
5b00d54cd6 If window is too small, shorten branch name 2016-07-02 10:19:43 +02:00
Christian Brabandt
fadd737a29 Merge pull request #1201 from chrisbra/ycm
call YCM function only if they are defined
2016-07-01 11:54:09 +02:00
Christian Brabandt
ece61f346e Try to resolve symlinks for git 2016-07-01 11:52:07 +02:00
Christian Brabandt
fbfea6daee Merge pull request #1200 from chrisbra/width
limit whitespace check output for smaller screens
2016-07-01 11:17:16 +02:00
Christian Brabandt
bc095bcde1 limit whitespace check output for smaller screens
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
2016-07-01 11:10:51 +02:00
Christian Brabandt
5c24c3c504 call YCM function only if they are defined
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
```
2016-06-24 11:49:53 +02:00
Christian Brabandt
72b316c871 Cache eclim errorlist
fixes #1193
2016-06-24 11:43:20 +02:00
Daniel Hahler
8d681c7119 Tabline performance: only pass in visible buffers to formatters
This only passes in the list of visible buffers on that tab, which
reduces the processing a lot if you have a lot of buffers opened.
2016-06-17 15:07:55 +02:00
Harm te Hennepe
74aacca55d update ctrlspace bufferline to use clickbuf() 2016-06-02 16:00:00 +02:00
ivan tkachenko
5a170c5ef0 add obsession extension 2016-05-30 03:44:39 +08:00
Christian Brabandt
4d39cb6f20 Merge pull request #1175 from chrisbra/1174
vim 7.3 does not allow getwinvar with 3 args
2016-05-22 21:37:10 +02:00
Christian Brabandt
985f3d3eca b:airline_head sometimes undefined
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
2016-05-22 21:29:00 +02:00
Christian Brabandt
83b6dd11a8 vim 7.3 does not allow getwinvar with 3 args
use airline#util#getwinvar instead, fixes #1174
2016-05-22 21:26:34 +02:00
Michael Henry
e67b2847ea Add the b:airline_whitespace_disabled feature.
If the per-buffer variable b:airline_whitespace_disabled is defined
and non-zero, whitespace checking will be disabled for that buffer.
2016-05-14 15:56:48 -04:00
Christian Brabandt
bd4cb97e85 Add quickfix title to inactive statusline
fixes #1162
2016-05-13 10:08:54 +02:00
Christian Brabandt
727208d766 Do not draw separators for empty sections
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)
2016-05-12 21:40:56 +02:00
Christian Brabandt
cf5632bb94 Merge pull request #1152 from chrisbra/1146
Check that default value exists, before accessing it
2016-04-29 09:17:35 +02:00
hanhuanle
a8dfdd40b7 shellescape file path when call "system()"
"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.
2016-04-28 23:14:32 +08:00
Christian Brabandt
057b429b02 Check that default value exists, before accessing it
closes #1146
2016-04-27 20:11:40 +02:00
Daniel Hahler
5652b576b0 Add bang to function definitions
This makes it easier to reload the files, e.g. via vim-scriptease's
`:Runtime`.
2016-04-20 21:10:28 +02:00
John Byrne
a5fab144aa Made c_like_langs customisable via g:airline#extenstions#c_like_langs 2016-04-20 20:44:50 +02:00
Christian Brabandt
3f2247593a Merge pull request #1117 from 987poiuytrewq/middle_click_buffers
Make middle clickable buffers (only Neovim)
2016-04-19 23:33:11 +02:00
Duncan Williams
0c251e20a7 Add middle click to close buffer functionality
Extended the left click to switch buffer functionality to also
support middle click to delete buffer

documentation of clickable buffers
2016-04-19 20:49:01 +01:00
Shane Smith
a79e35b5e3 Fix tabs theming 2016-04-11 18:22:42 -04:00
Adrian Cowan
066d936076 Add Java as an exception in mixed-indent-file
Java allows "/** */"-style comments; add it as an exception in mixed-indent-file.
2016-04-07 14:55:39 +10:00
Christian Brabandt
377010ea6e Merge pull request #1105 from octurion/cuda-patch
Add CUDA as an exception in mixed-indent-file
2016-04-05 21:44:09 +02:00
Dominic Monroe
8f83231078 Add asciidoc to default wordcount filetype 2016-04-05 13:14:48 +01:00
Alexandros Tasos
dba50e9eea Add CUDA as an exception in mixed-indent-file 2016-03-24 23:53:13 +02:00
Christian Brabandt
842e562359 Merge pull request #1092 from tamul/mixed-indent-ld
extensions#whitespace: fix .ld mixed indent false positive
2016-03-23 15:09:05 +01:00
Christian Brabandt
5ee24f5d87 Merge pull request #1093 from wesQ3/windowswap-update
windowswap: use new tab-aware API if WS is up to date
2016-03-23 15:08:32 +01:00
Christian Brabandt
9afebc9233 Merge pull request #1097 from HarmtH/tablineat-for-ctrlspace
tablineat() support for ctrlspace tabline
2016-03-23 15:08:07 +01:00
Joshua Rubin
73146e3e73 Add support for getting tab title from t:title
Uses `gettabvar` to get tab name.
2016-03-22 12:14:47 -06:00
Harm te Hennepe
bc7aa0c812 tablineat() support with ctrlspace tabline 2016-03-19 17:38:53 +01:00
Wes Malone
582958d6c5 windowswap: use new tab-aware API if WS is current 2016-03-16 19:27:54 -05:00
Tayler Mulligan
c8048973cd extensions#whitespace: fix .ld mixed indent false positive
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)
2016-03-16 16:19:55 -07:00
Tri Nguyen
48423832d4 extensions#whitespace: fix false positive for check_mix_indent_file() for JS file 2016-03-07 22:22:07 -05:00
Christian Brabandt
e8cc5f8b84 Merge pull request #1076 from chrisbra/update_tabline
another approach for updating the bufferline on BufAdd
2016-03-07 19:55:10 +01:00
Christian Brabandt
1104639708 Merge pull request #1075 from chrisbra/po.vim
Enable po.vim integration
2016-03-02 18:48:58 +01:00
Christian Brabandt
d8d08ada7b Make clickable buffers (only Neovim)
fixes #369
2016-03-02 18:47:09 +01:00
Christian Brabandt
f60a8cc7a3 another approach for updating the bufferline on BufAdd 2016-03-01 22:07:52 +01:00
Christian Brabandt
a45a96c881 Merge pull request #1063 from sappo/master
Various ctrlspace tabline improvements
2016-03-01 20:40:20 +01:00
Christian Brabandt
f28a706020 Enable po.vim integration
fixes #1070
2016-02-29 22:38:39 +01:00
Frederic Chanal
8fde76dd63 extensions#whitespace: fix false positive for check_mix_indent_file()
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.
2016-02-26 14:29:51 +01:00
Christian Brabandt
23fb126322 Merge pull request #1057 from illicium/1055-buffer-highlight
Fix buffer modified highlighting being set from wrong buffer
2016-02-25 16:27:13 +01:00
Kevin Sapper
ab948735be Problem: Cannot disable tabs for ctrlspace tabline
Solution: Implement the show_tabs option which is used by the default
tabline.
2016-02-25 11:35:52 +01:00
Christian Brabandt
0bfae15d97 do not unconditionally use utf-8 encoding in branch exten
Check, that encoding is utf8 before using '…'
fixes #1061
2016-02-25 11:30:02 +01:00
Kevin Sapper
2f2797becb Problem: Cannot disable displaying buffers for ctrlspace tabline
Solution: Implement the show_buffers option which is used by the default
airline tab as well.
2016-02-25 11:19:52 +01:00
Kevin Sapper
ad5194244b Problem: Cannot switch position of tabs and buffers for ctrlspace
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.
2016-02-25 11:03:50 +01:00
Yegor Pomortsev
7453b5e15c Fix buffer modified highlighting being set from wrong buffer
Fixes #1055, cased by refactoring in e4ef624 (#952)
2016-02-24 16:45:17 -08:00
Christian Brabandt
0e70dac030 Disable tabline refresh per configuration
fixes #1049 and should prevent that users see AirlineTabRefresh printed
on their screen.
2016-02-23 20:23:29 +01:00
rosston
63f9abd3f2 Fix highlighting of current/modified buffer.
Fixes broken variable reference caused by e4ef624 (#952).
2016-02-22 23:07:27 -05:00
Kevin Sapper
e7edb4c75a Problem: Cannot rename the labels for buffers and tabs
Solution: Add an option for the user to configure those labels and make
the current values the default ones.
2016-02-22 08:30:20 +01:00
Bailey Ling
e6ab7bdf6d show tabs on the left when in tabs mode, splits on the right (#1043) 2016-02-21 15:03:55 -05:00
Bailey Ling
8c080fdf80 Merge pull request #952 from chrisbra/buffer_line
Always display buffer list in tabline
2016-02-20 20:10:12 -05:00
Christian Brabandt
8af213d3f9 Merge pull request #816 from mildred/master
Make tabline compatible with bufmru
2016-02-17 07:42:42 +01:00
Shanti Bouchez-Mongardé
faa7a18242 Make tabline compatible with bufmru 2016-02-16 21:16:55 +01:00
Christian Brabandt
13ea57b98a Revert "Add mq patch to branch output"
This reverts commit 8023f6f5dc.

fixes #1035
2016-02-16 17:52:26 +01:00
Christian Brabandt
5e0b10c005 Revert "Only show hg qtop output, if branch is also shown"
This reverts commit da78d4a7bb,
since it causes a massive performance impact.

fixes #1035
2016-02-16 17:48:57 +01:00
Christian Brabandt
a2f54ef6e6 add feedback from PR 2016-02-15 20:01:34 +01:00
Christian Brabandt
da78d4a7bb Only show hg qtop output, if branch is also shown 2016-02-15 17:05:53 +01:00
Christian Brabandt
8023f6f5dc Add mq patch to branch output 2016-02-11 22:44:12 +01:00
Christian Brabandt
2c5aa75d5f update according to PR comments 2016-02-11 21:31:42 +01:00
Bailey Ling
e4ef624ea8 tabline for combined buffers/tabs
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
2016-02-10 20:22:35 +01:00
Christian Brabandt
1d072bf019 Do not check for mixed whitespace in Makefiles
Skip indent and mixed-indent-file check for Makefiles.

fixes #1017
2016-02-09 20:16:12 +01:00