180 Commits

Author SHA1 Message Date
Bailey Ling
e02176aca1 update changelog for 0.9 2018-01-15 13:18:51 -05:00
Christian Brabandt
b7d3feb4d2 tabline: correctly refresh on :syn commands
fixes #1590 and #1638
2018-01-10 08:41:04 +01:00
Christian Brabandt
a3bdb10aea Merge pull request #1634 from Cimbali/master
Fix over-caching of paths
2018-01-15 08:02:09 +01:00
Christian Brabandt
927c910af1 doc: Document, that the fugitive extension is needed 2018-01-10 08:14:48 +01:00
Cimbali
a104e40b10 Cache only git calls, not bufname and fnamemodify 2018-01-09 20:07:54 +01:00
Christian Brabandt
9a2ed35ff9 tabline: do not confuse Vim
looks like this:
```
let a=(condition ? s:var:'')
```
confuses older Vims and it complains about a missing colon. So make
parsing a bit easier and add a space in front of the second colon.

fixes #1629
2018-01-08 13:46:08 +01:00
Christian Brabandt
02816a3cb6 tabline: missing spaces
commit ab49a1c7ae changed that no leading whitespace was added.
While this removed a double space in front of the current active
selected buffer, it removed one space too much for the non-current
buffers in the bufferline.

So partly reverse it and only add the space, if the highlighting groups
between each item did not change.
2018-01-08 09:48:36 +01:00
Christian Brabandt
182675dc10 tabline: revert default buffer_idx_mode
commit 2e3cdeb unintentionally changed the default for the
buffer_idx_mode in the tabline.

Revert it back to be disabled by default

fixes #1628
2018-01-07 09:51:08 +01:00
Christian Brabandt
ab49a1c7ae tabline: do not add extra space before buffer name
there was a space too much added in the tabline. Fix that
2018-01-05 22:13:47 +01:00
Christian Brabandt
5db4c408bd Update copyright notifications 2018-01-05 10:37:59 +01:00
Christian Brabandt
6c4f3277f1 Add missing scriptencoding 2018-01-05 10:26:38 +01:00
Christian Brabandt
6cdcaf13b1 cursormode: disable by default
fixes #1625
2018-01-05 08:12:35 +01:00
Christian Brabandt
3a2323feac branch: shorten default master for smaller windows 2018-01-05 08:12:10 +01:00
Christian Brabandt
c76019ac9e Safety: Make sure g:airline_theme is defined before using it
fixes #1624
2018-01-04 23:54:12 +01:00
Christian Brabandt
a90ac37cb3 Changelog: slightly reorded items 2018-01-04 23:37:10 +01:00
Christian Brabandt
2ef81d4140 Changelog: Add links to the issues 2018-01-04 23:33:30 +01:00
Christian Brabandt
3b5f2bd470 async: Todo: Check if cwd option for Vim 8 is needed 2018-01-04 23:29:15 +01:00
Christian Brabandt
88130fd377 Updated Changelog 2018-01-04 23:27:05 +01:00
Michael Brailsford
7215a1fdd5 clarifying documentation
closes #1225
2018-01-04 21:31:16 +01:00
Eduardo Suarez-Santana
ebda798080 Cursormode integrated as extension 2018-01-04 21:24:27 +01:00
Christian Brabandt
c17ad9a123 Merge pull request #1426 from lynnard/master
Fix problems with AirlineSelect{Prev,Next}Tab
2018-01-04 21:15:00 +01:00
Christian Brabandt
73d8abff2f Merge pull request #1617 from kyleholzinger/master
Add formatter for js files
2018-01-04 21:14:00 +01:00
Christian Brabandt
4d0233ebdb plugin: correctly re-init on :syn-enable
should fix #1590 correctly
2018-01-04 21:09:26 +01:00
Christian Brabandt
d283a25e3f tabline: only show buffer label, if they were drawn
closes #1558
2018-01-04 20:56:09 +01:00
Christian Brabandt
ce83c39bed tabline: allow custom formatter for tabnr_type
closes #1418
2018-01-04 20:41:55 +01:00
Christian Brabandt
133a76d2d4 plugin: reset syntax highlighting on :syn off
hopefully fixes #1590
2018-01-04 20:07:15 +01:00
Christian Brabandt
c518f79aab tabline: allow to show buffers label at start 2018-01-04 19:38:07 +01:00
Christian Brabandt
9d28f0dcc7 tabline: allow to show current buffer/tab at first position
This will make highlighting more consistent. Always first item is the
one where the cursor is.
2018-01-04 19:32:29 +01:00
Christian Brabandt
30652c05c4 tabline: correct order of tab/buffer labels 2018-01-04 19:09:02 +01:00
Christian Brabandt
90cf752c90 tabline: add separate highlight group for labels 2018-01-04 18:57:28 +01:00
Christian Brabandt
3b631ef0c4 tabline: refactor label function 2018-01-04 18:43:03 +01:00
Christian Brabandt
3985ece131 tabline: add [buffers]/[tabs] labels consistently
previously, when both tabs and buffers were displayed in the tabline, it
was not immediately obvious which side belongs to a buffer and which one
to a tab. Therefore, add [buffers]/[tabs] labels consistently.
2018-01-04 18:34:48 +01:00
Christian Brabandt
45878a7947 tabline: remove l: prefix of function variables 2018-01-04 18:29:51 +01:00
Christian Brabandt
503b9977fb tabline: refactor s:variables 2018-01-04 18:20:25 +01:00
Christian Brabandt
69aa1e93b3 tabline: add more try/catch for mappings
similar to 2e3cdeb808 add a couple of more try catch statements
around the map_keys() function
2018-01-04 18:15:40 +01:00
Christian Brabandt
645f65d8d9 ctrlspace: wrong separator
under certains circumstances it could happen that for the vim-ctrlspace
tabline extension a tabline group was redefined which would cause a
separator having foreground and background color swapped. This was
caused by using the 'pos' parameter for the right side wrongly.

fixes #1559
2018-01-04 18:07:03 +01:00
Christian Brabandt
45236ba7c7 ctrlspace: refactor s:variables 2018-01-04 17:27:34 +01:00
Christian Brabandt
a25757ac64 tabline: Allow an alternate style for bufferlist
fixes #1608
2018-01-04 15:45:36 +01:00
Christian Brabandt
d78f686ce5 tabline: remove some more s:vars 2018-01-04 14:35:10 +01:00
Christian Brabandt
6ba65b2c8c tabline: remove s:show_tab_type variable 2018-01-04 14:30:16 +01:00
Christian Brabandt
708c76e22c tabline: do not cache s:buffer_idx_mode 2018-01-04 14:23:50 +01:00
Christian Brabandt
d03c3fa7b9 tabline: remove l: variable prefix 2018-01-04 14:20:36 +01:00
Christian Brabandt
72e457d8c2 tabline: remove static caching of s:vars
rather let them be defined whenever they are needed. They were only used
inside a single function anyhow, so it does not make sense to cache
them. In addition, having the user later change the variable won't work
as expected.
2018-01-04 14:11:13 +01:00
Christian Brabandt
2e3cdeb808 tabline: try/catch mapping of the keys
fixes #1621
2018-01-04 14:11:11 +01:00
Kyle Holzinger
66991f53fa add to docs 2017-12-28 16:08:32 -05:00
Kyle Holzinger
a3d5e84417 Add formatter for js files 2017-12-28 15:43:13 -05:00
Christian Brabandt
c386332570 Merge pull request #1619 from tracyone/doc
doc: update ctrlp.vim url
2017-12-28 11:20:23 +01:00
Christian Brabandt
125d3443e4 Merge pull request #1620 from Cimbali/master
Cache file names in fugitiveline extension
2017-12-28 11:20:05 +01:00
Cimbali
18da5aa699 Separate updating and displaying branch information
This will cause any calls that are not just head() to be delayed and
cached whenever possible.
2017-12-26 22:30:23 +01:00
Cimbali
1ee057362d Caching path simplified using fugitive 2017-12-26 22:30:23 +01:00
tracyone
450fa168ea doc: update ctrlp.vim url 2017-12-25 21:27:55 +08:00
Cimbali
e0dd3d8125 Rename merge file names
Clearer names that reference the HEADs of git: FETCH_HEAD, ORIG_HEAD and
MERGE_HEAD, rather than the names that fugitive uses for them.
2017-12-23 15:05:59 +01:00
Christian Brabandt
bc985301db Merge pull request #1603 from Cimbali/master
Improve fugitive integration
2017-12-21 09:09:44 +01:00
Christian Brabandt
6c8d0f5e6a Merge pull request #1605 from EdwardBetts/patch-2
Correct spelling mistake.
2017-11-27 09:27:58 +01:00
Christian Brabandt
77ab703a55 Merge pull request #1604 from EdwardBetts/patch-1
Correct spelling mistake.
2017-11-27 09:27:40 +01:00
Edward Betts
3b304f36ae Correct spelling mistake. 2017-11-25 21:14:31 +00:00
Edward Betts
7afc60af25 Correct spelling mistake. 2017-11-25 21:12:44 +00:00
Cimbali
e415c5301f Trusting fugitive instead of tracking paths manually
The initial reason in #237 is not valid anymore, as vim-gitgutter
functions as expected for editing files that are not part of a repo,
whether they are:
- in a different repo
- in a parent repo (cwd being a submodule)
- outside of the repo

Furthermore, removing this check allows to show relevant info for
specific fugitive file names that are fugitive://..../sha1//...
which are hard to parse manually, especially in complicated situations
such as submodules.
2017-11-22 23:55:22 +01:00
Cimbali
8c4bf37588 Configurability: parametrizable sha1 length 2017-11-22 23:01:54 +01:00
Cimbali
33663d7df2 Show buffer name relative to git folder 2017-11-22 23:00:58 +01:00
Cimbali
009f7932fb Show #branch#head() as "ref-or-sha1(current-branch)"
Only changes anything in the case of using fugitive to show a file that
is not from the current working directory.
2017-11-22 23:00:57 +01:00
Cimbali
f0093ceaa6 Remove code redundant with fugitive#head()
It which requires a path, and just performed the same as
fugitive#head() does internally.
2017-11-22 19:25:26 +01:00
Christian Brabandt
3e13bab201 Merge pull request #1600 from PratikBhusal/patch-1
Add function to show line number
2017-11-20 13:58:21 +01:00
Christian Brabandt
d719d0664a Merge pull request #1602 from jreybert/dev/vimagit
vimagit: let vimagit itself returns the current mode
2017-11-20 13:57:42 +01:00
Jerome Reybert
640d6762f7 vimagit: let vimagit itself returns the current mode
If current vimagit version does not provide vimagit#get_current_mode(),
internal string version is kept.
2017-11-20 13:47:48 +01:00
Pratik Bhusal
58328b347c Added function to show line number
The function shows the line number of the first error/warning that appears in the current buffer. If there are 20 warnings and the first warning exists on line 33, then vim-airline would show "W:20(L33)".

One can change how the line number is represented using: `g:airline#extensions#ale#open_lnum_symbol` and `airline#extensions#ale#close_lnum_symbol`
2017-11-18 14:24:47 -06:00
Christian Brabandt
4a1f65841c README: mention how to use pack feature for install
fixes #1594
2017-11-15 08:06:17 +01:00
Christian Brabandt
1f84ad886c README: still some problems 2017-11-15 07:58:22 +01:00
Christian Brabandt
c88dca5c96 README: still some problems with the table
(I hate markdown)
2017-11-15 07:54:50 +01:00
Christian Brabandt
dd368b3e31 README: one more fix for the table 2017-11-15 07:51:48 +01:00
Christian Brabandt
20a6fe2b9f README: Fix table 2017-11-14 23:44:52 +01:00
Christian Brabandt
f3aae5f72b README: show a screenshot and document what this plugin does
fixes #1589
2017-11-14 23:43:04 +01:00
Christian Brabandt
52ce640534 startup: remove workaround for skipping redraw
commit 7d082c03b2 added a workaround to skip
a few redraws on startup so that the intro message is not shown anymore.

However might cause problems, that some highlighting groups are not
correctly set. Also recent Vims (8.0.1290 and so on) do not seem to
suffer from the problem that an too early initializiation of airline
causes a redraw which skips the intro message.

Therefore, revert that commit.

Fixes #1585
2017-11-14 23:38:32 +01:00
Christian Brabandt
396cc92261 Merge pull request #1578 from ompugao/tabline_collapse_fname
collapse fname in tabline when using unique_tail formatter
2017-11-06 08:19:04 +01:00
Shohei Fujii
b044b4b204 collapse fname in tabline when using unique_tail formatter 2017-10-30 20:00:05 +09:00
Christian Brabandt
a1b7479b54 Merge pull request #1584 from Taikuh/wordcount_format
Add option to change wordcount display for the default formatter
2017-10-25 21:27:23 +02:00
Taikuh
ccc4c9f430 Add option to change wordcount display for the default formatter 2017-10-26 01:02:10 +08:00
Christian Brabandt
e72ec51e59 Merge pull request #1582 from 0x6a62/doc-typo
Fix typo
2017-10-23 08:57:57 +02:00
jb
78ca75af6e Fix typo 2017-10-21 13:29:17 -04:00
Christian Brabandt
6e2a9e38cd tabline: force redraw on BufAdd autocommands
closes #1580
2017-10-19 11:37:24 +02:00
Christian Brabandt
a5d9a4bcb2 Merge pull request #1577 from ompugao/skip_toggling_ctrlspace_if_not_installed
skip toggling ctrlspace tabline plugin when not installed
2017-10-16 10:57:20 +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
Christian Brabandt
bd613e69b6 Merge pull request #1569 from yehuohan/master
Fix: Use the CS-symbol of ctrlspace which may be changed by user in ctrlspace-extension
2017-09-27 13:21:10 +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
Christian Brabandt
cfb107c75f Merge pull request #1564 from gidj/vcs-patch-fix
Use regex matching to prevent message from bubbling up
2017-09-18 19:54:38 +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
ea46192561 README: remove laststatus section
closes #1560
2017-09-05 07:25:26 +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
571f892fcd README: mention how to fix performance problems 2017-09-01 12:01:43 +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
97f3f84881 Merge pull request #1549 from doronbehar/fix-doc-syntax2
Small fixes to syntax in documentation.
2017-08-27 20:58:19 +02:00
Doron Behar
c07b28d199 Small fixes to syntax in documentation. 2017-08-27 16:40:01 +03: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
Christian Brabandt
20de588fd1 Merge pull request #1547 from kaidiren/master
fix: refresh airline when airline_skip_empty_sections enabled in plugin in ale
2017-08-26 15:43:21 +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
Christian Brabandt
ab6acdee41 Merge pull request #1539 from icymind/master
add option 'keymap_ignored_filetypes' for tabline extensions
2017-08-24 18:15:18 +02:00
icymind
5df7d961bc amend doc 2017-08-25 00:00:50 +08: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
3535243c50 Merge pull request #1528 from doronbehar/fix-doc-syntax
Small fixes to syntax in help file.
2017-08-17 13:41:06 +02:00
Doron Behar
69ad039d07 Small fixes to syntax in help file. 2017-08-16 19:56:44 +03: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
6ee75bdbde Fix failing tests 2017-08-11 12:55:44 +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
96352f9b53 doc: fix typo 2017-08-08 16:03:11 +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
Christian Brabandt
711f50a567 Merge pull request #1524 from tenfyzhong/master
Fixes #1515. The tabline will no update when use ctrlspace together.
2017-08-08 09:34:11 +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
Christian Brabandt
4e24036782 Merge pull request #1523 from rlue/hotfix
Hotfix: Autoswitch theme for colorschemes with funny casing (like PaperColor)
2017-08-07 07:46:19 +02: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
Christian Brabandt
72e5f04f7c Merge pull request #1513 from rdnetto/master
Neomake integration: if loclist is empty, fallback to quickfix
2017-07-21 12:28:55 +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
e03afa1733 doc: linenr and maxlinenr are swapped in documentation
fixes #1507
2017-07-07 22:33:47 +02:00
Christian Brabandt
afcda0510e Ale: Removing caching
fixes #1506
2017-07-06 12:14:49 +02:00
Christian Brabandt
b78c2ec475 Always enable airline by setting laststatus=2
Previously the user was expected to set 'laststatus' himself to 2 if he
wanted to have airline be shown by default.

However it doesn't make much sense to have airline installed but not
display the statusline. Therefore, set the 'laststatus' to 2, if it
isn't set to it already.
2017-07-02 20:42:32 +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
Christian Brabandt
0205baa963 Merge pull request #1504 from d10n/fix-typo
Fix typo
2017-07-01 21:43:03 +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
Christian Brabandt
72ca1c344f Merge pull request #1502 from DavidAntaramian/master
Fix misspelling of trailing_fmt
2017-07-01 07:18:02 +02: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
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
69 changed files with 1429 additions and 679 deletions

View File

@@ -4,6 +4,50 @@ This is the Changelog for the vim-airline project.
## [Unreleased]
## [0.9] - 2018-01-15
- Changes
- Look of default Airline Symbols has been improved [#1397](https://github.com/vim-airline/vim-airline/issues/1397)
- Airline does now set `laststatus=2` if needed
- Syntastic extension now displays warnings and errors separately
- Updates on Resize and SessionLoad events
- Add `maxlinenr` symbol to `airline_section_z`
- Add quickfix title to inactive windows
- Improvements
- Many performance improvements (using caching and async feature when possible)
- Cache changes to highlighting groups if `g:airline_highlighting_cache = 1` is set
- Allow to skip empty sections by setting `g:airline_skip_empty_sections` variable
- Make use of improved Vim Script API, if available (e.g. getwininfo())
- Support for Vims terminal feature (very experimental since it hasn't been stabilized yet)
- More configuration for the tabline extension (with clickable buffers for Neovim)
- Works better on smaller window sizes
- Make airline aware of git worktrees
- Improvements to the fugitive extension [#1603](https://github.com/vim-airline/vim-airline/issues/1603)
- Allows for configurable fileformat output if `g:airline#parts#ffenc#skip_expected_string` is set
- Improvements to the documentation
- New features
- Full async support for Vim 8 and Neovim
- Extensions:
- [vim-bufmru](https://github.com/mildred/vim-bufmru)
- [xkb-switch](https://github.com/ierton/xkb-switch)
- [input-source-switcher](https://github.com/vovkasm/input-source-switcher)
- [vimagit](https://github.com/jreybert/vimagit)
- [denite](https://github.com/Shougo/denite.nvim)
- [dein](https://github.com/Shougo/dein.vim)
- [vimtex](https://github.com/lervag/vimtex)
- [minpac](https://github.com/k-takata/minpac/)
- [vim-cursormode](https://github.com/vheon/vim-cursormode)
- [Neomake](https://github.com/neomake/neomake)
- [Ale](https://github.com/w0rp/ale)
- [vim-obsession](https://github.com/tpope/vim-obsession)
- spell (can also display Spell language)
- keymap
- Formatters:
- Formatters for JavaScript [#1617](https://github.com/vim-airline/vim-airline/issues/1617)
- Tabline: Allow for custom formatter for `tab_nr_type` [#1418](https://github.com/vim-airline/vim-airline/issues/1418)
- Customizable wordcount formatter [#1584](https://github.com/vim-airline/vim-airline/issues/1584)
- Add User autocommand for Theme changing [#1226](https://github.com/vim-airline/vim-airline/issues/1226)
- Shows mercurial mq status if hg mq extension is enabled
## [0.8] - 2016-03-09
- Changes
- Airline converted to an organization and moved to new [repository](https://github.com/vim-airline/vim-airline)
@@ -109,7 +153,8 @@ This is the Changelog for the vim-airline project.
- integration with other plugins: netrw, unite, nerdtree, undotree, gundo, tagbar, minibufexplr, ctrlp
- support for themes: 8 included
[Unreleased]: https://github.com/vim-airline/vim-airline/compare/v0.8...HEAD
[Unreleased]: https://github.com/vim-airline/vim-airline/compare/v0.9...HEAD
[0.9]: https://github.com/vim-airline/vim-airline/compare/v0.8...v0.9
[0.8]: https://github.com/vim-airline/vim-airline/compare/v0.7...v0.8
[0.7]: https://github.com/vim-airline/vim-airline/compare/v0.6...v0.7
[0.6]: https://github.com/vim-airline/vim-airline/compare/v0.5...v0.6

View File

@@ -4,6 +4,60 @@ Lean &amp; mean status/tabline for vim that's light as air.
![img](https://github.com/vim-airline/vim-airline/wiki/screenshots/demo.gif)
When the plugin is correctly loaded, Vim will draw a nice statusline at the
bottom of each window.
That line consists of several sections, each one displaying some piece of
information. By default (without configuration) this line will look like this:
```
+-----------------------------------------------------------------------------+
|~ |
|~ |
|~ VIM - Vi IMproved |
|~ |
|~ version 8.0 |
|~ by Bram Moolenaar et al. |
|~ Vim is open source and freely distributable |
|~ |
|~ type :h :q<Enter> to exit |
|~ type :help<Enter> or <F1> for on-line help |
|~ type :help version8<Enter> for version info |
|~ |
|~ |
+-----------------------------------------------------------------------------+
| A | B | C X | Y | Z | [...] |
+-----------------------------------------------------------------------------+
```
The statusline is the colored line at the bottom, which contains the sections
(possibly in different colors):
section|meaning (example)
-------|------------------
A | displays the mode + additional flags like crypt/spell/paste (INSERT)
B | VCS information (branch, hunk summary) (master)
C | filename + read-only flag (~/.vim/vimrc RO)
X | filetype (vim)
Y | file encoding[fileformat] (utf-8[unix])
Z | current position in the file
[...] | additional sections (warning/errors/statistics) from external plugins (e.g. YCM, syntastic, ...)
The information in Section Z looks like this:
`10% ☰ 10/100 ln : 20`
This means:
```
10% - 10 percent down the top of the file
☰ 10 - current line 10
/100 ln - of 100 lines
: 20 - current column 20
```
For a better look, those sections can be colored differently, depending on various conditions
(e.g. the mode or whether the current file is 'modified')
# Features
* Tiny core written with extensibility in mind ([open/closed principle][8]).
@@ -62,6 +116,26 @@ Separators can be configured independently for the tabline, so here is how you c
let g:airline#extensions#tabline#left_sep = ' '
let g:airline#extensions#tabline#left_alt_sep = '|'
In addition, you can also choose which path formatter airline uses. This affects how file paths are
displayed in each individual tab as well as the current buffer indicator in the upper right.
To do so, set the `formatter` field with:
let g:airline#extensions#tabline#formatter = 'default'
Here is a complete list of formatters with screenshots:
#### `default`
![image](https://user-images.githubusercontent.com/2652762/34422844-1d005efa-ebe6-11e7-8053-c784c0da7ba7.png)
#### `jsformatter`
![image](https://user-images.githubusercontent.com/2652762/34422843-1cf6a4d2-ebe6-11e7-810a-07e6eb08de24.png)
#### `unique_tail`
![image](https://user-images.githubusercontent.com/2652762/34422841-1ce5b4ec-ebe6-11e7-86e9-3d45c876068b.png)
#### `unique_tail_improved`
![image](https://user-images.githubusercontent.com/2652762/34422842-1cee23f2-ebe6-11e7-962d-97e068873077.png)
## Seamless integration
vim-airline integrates with a variety of plugins out of the box. These extensions will be lazily loaded if and only if you have the other plugins installed (and of course you can turn them off).
@@ -160,15 +234,13 @@ This plugin follows the standard runtime path structure, and as such it can be i
| [VAM][22] | `call vam#ActivateAddons([ 'vim-airline' ])` |
| [Dein][52] | `call dein#add('vim-airline/vim-airline')` |
| [minpac][54] | `call minpac#add('vim-airline/vim-airline')` |
| pack feature (native Vim 8 package feature)| `git clone https://github.com/vim-airline/vim-airline ~/.vim/pack/dist/start/vim-airline`<br/>Remember to run `:helptags` to generate help tags |
| manual | copy all of the files into your `~/.vim` directory |
# Configuration
# Documentation
`:help airline`
The default setting of 'laststatus' is for the statusline to not appear until a split is created. If you want it to appear all the time, add the following to your vimrc:
`set laststatus=2`
# Integrating with powerline fonts
For the nice looking powerline symbols to appear, you will need to install a patched font. Instructions can be found in the official powerline [documentation][20]. Prepatched fonts can be found in the [powerline-fonts][3] repository.
@@ -189,7 +261,11 @@ Many optimizations have been made such that the majority of users will not see a
The [minivimrc][7] project has some helper mappings to troubleshoot performance related issues.
If you don't want all the bells and whistles enabled by default, you can define a value for `g:airline_extensions`. When this variable is defined, only the extensions listed will be loaded; an empty array would effectively disable all extensions.
If you don't want all the bells and whistles enabled by default, you can define a value for `g:airline_extensions`. When this variable is defined, only the extensions listed will be loaded; an empty array would effectively disable all extensions (e.g. `:let g:airline_extensions = []`).
Also, you can enable caching of the various syntax highlighting groups. This will try to prevent some of the more expensive `:hi` calls in Vim, which seem to be expensive in the Vim core at the expense of possibly not being hunderet percent correct all the times (especially if you often change highlighting groups yourself using `:hi` commands). To set this up do `:let g:airline_highlighting_cache = 1`. A `:AirlineRefresh` will however clear the cache.
In addition you might want to check out the [dark_minimal theme][55], which does not change highlighting groups once they are defined. Also please check the [FAQ][27] for more information on how to diagnose and fix the problem.
# Screenshots
@@ -259,3 +335,4 @@ MIT License. Copyright (c) 2013-2017 Bailey Ling & Contributors.
[52]: https://github.com/Shougo/dein.vim
[53]: https://github.com/lervag/vimtex
[54]: https://github.com/k-takata/minpac/
[55]: https://github.com/vim-airline/vim-airline-themes/blob/master/autoload/airline/themes/dark_minimal.vim

View File

@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
@@ -34,6 +34,7 @@ function! airline#add_inactive_statusline_func(name)
endfunction
function! airline#load_theme()
let g:airline_theme = get(g:, 'airline_theme', 'dark')
if exists('*airline#themes#{g:airline_theme}#refresh')
call airline#themes#{g:airline_theme}#refresh()
endif
@@ -76,7 +77,7 @@ endfunction
function! airline#switch_matching_theme()
if exists('g:colors_name')
let existing = g:airline_theme
let theme = substitute(g:colors_name, '-', '_', 'g')
let theme = substitute(tolower(g:colors_name), '-', '_', 'g')
try
let palette = g:airline#themes#{theme}#palette
call airline#switch_theme(theme)
@@ -143,11 +144,6 @@ function! airline#statusline(winnr)
endfunction
function! airline#check_mode(winnr)
if !exists("s:airline_run")
let s:airline_run = 0
endif
let s:airline_run += 1
let context = s:contexts[a:winnr]
if get(w:, 'airline_active', 1)
@@ -190,13 +186,6 @@ function! airline#check_mode(winnr)
endif
let mode_string = join(l:mode)
if s:airline_run < 3
" skip this round.
" When this function is run too early after startup,
" it forces a redraw by vim which will remove the intro screen.
let w:airline_lastmode = mode_string
return ''
endif
if get(w:, 'airline_lastmode', '') != mode_string
call airline#highlighter#highlight_modified_inactive(context.bufnr)
call airline#highlighter#highlight(l:mode, context.bufnr)

254
autoload/airline/async.vim Normal file
View File

@@ -0,0 +1,254 @@
" MIT License. Copyright (c) 2013-2018 C.Brabandt et al.
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
let s:untracked_jobs = {}
let s:mq_jobs = {}
let s:po_jobs = {}
" Generic functions handling on exit event of the various async functions
function! s:untracked_output(dict, buf)
if a:buf =~? ('^'. a:dict.cfg['untracked_mark'])
let a:dict.cfg.untracked[a:dict.file] = get(g:, 'airline#extensions#branch#notexists', g:airline_symbols.notexists)
else
let a:dict.cfg.untracked[a:dict.file] = ''
endif
endfunction
" also called from branch extension (for non-async vims)
function! airline#async#mq_output(buf, file)
let buf=a:buf
if !empty(a:buf)
if a:buf =~# 'no patches applied' ||
\ a:buf =~# "unknown command 'qtop'" ||
\ a:buf =~# "abort"
let buf = ''
elseif exists("b:mq") && b:mq isnot# buf
" make sure, statusline is updated
unlet! b:airline_head
endif
let b:mq = buf
endif
if has_key(s:mq_jobs, a:file)
call remove(s:mq_jobs, a:file)
endif
endfunction
function! s:po_output(buf, file)
if !empty(a:buf)
let b:airline_po_stats = printf("[%s]", a:buf)
else
let b:airline_po_stats = ''
endif
if has_key(s:po_jobs, a:file)
call remove(s:po_jobs, a:file)
endif
endfunction
function! s:valid_dir(dir)
if empty(a:dir) || !isdirectory(a:dir)
return getcwd()
endif
return a:dir
endfunction
if v:version >= 800 && has("job")
" Vim 8.0 with Job feature
" TODO: Check if we need the cwd option for the job_start() functions
" (only works starting with Vim 8.0.0902)
function! s:on_stdout(channel, msg) dict abort
let self.buf .= a:msg
endfunction
function! s:on_exit_mq(channel) dict abort
call airline#async#mq_output(self.buf, self.file)
endfunction
function! s:on_exit_untracked(channel) dict abort
call s:untracked_output(self, self.buf)
if has_key(s:untracked_jobs, self.file)
call remove(s:untracked_jobs, self.file)
endif
endfunction
function! s:on_exit_po(channel) dict abort
call s:po_output(self.buf, self.file)
call airline#extensions#po#shorten()
endfunction
function! airline#async#get_mq_async(cmd, file)
if g:airline#init#is_windows && &shell =~ 'cmd'
let cmd = a:cmd
else
let cmd = ['sh', '-c', a:cmd]
endif
let options = {'cmd': a:cmd, 'buf': '', 'file': a:file}
if has_key(s:mq_jobs, a:file)
if job_status(get(s:mq_jobs, a:file)) == 'run'
return
elseif has_key(s:mq_jobs, a:file)
call remove(s:mq_jobs, a:file)
endif
endif
let id = job_start(cmd, {
\ 'err_io': 'out',
\ 'out_cb': function('s:on_stdout', options),
\ 'close_cb': function('s:on_exit_mq', options)})
let s:mq_jobs[a:file] = id
endfunction
function! airline#async#get_msgfmt_stat(cmd, file)
if g:airline#init#is_windows || !executable('msgfmt')
" no msgfmt on windows?
return
else
let cmd = ['sh', '-c', a:cmd. shellescape(a:file)]
endif
let options = {'buf': '', 'file': a:file}
if has_key(s:po_jobs, a:file)
if job_status(get(s:po_jobs, a:file)) == 'run'
return
elseif has_key(s:po_jobs, a:file)
call remove(s:po_jobs, a:file)
endif
endif
let id = job_start(cmd, {
\ 'err_io': 'out',
\ 'out_cb': function('s:on_stdout', options),
\ 'close_cb': function('s:on_exit_po', options)})
let s:po_jobs[a:file] = id
endfunction
function airline#async#vim_vcs_untracked(config, file)
if g:airline#init#is_windows && &shell =~ 'cmd'
let cmd = a:config['cmd'] . shellescape(a:file)
else
let cmd = ['sh', '-c', a:config['cmd'] . shellescape(a:file)]
endif
let options = {'cfg': a:config, 'buf': '', 'file': a:file}
if has_key(s:untracked_jobs, a:file)
if job_status(get(s:untracked_jobs, a:file)) == 'run'
return
elseif has_key(s:untracked_jobs, a:file)
call remove(s:untracked_jobs, a:file)
endif
endif
let id = job_start(cmd, {
\ 'err_io': 'out',
\ 'out_cb': function('s:on_stdout', options),
\ 'close_cb': function('s:on_exit_untracked', options)})
let s:untracked_jobs[a:file] = id
endfunction
elseif has("nvim")
" NVim specific functions
function! s:nvim_output_handler(job_id, data, event) dict
if a:event == 'stdout' || a:event == 'stderr'
let self.buf .= join(a:data)
endif
endfunction
function! s:nvim_untracked_job_handler(job_id, data, event) dict
if a:event == 'exit'
call s:untracked_output(self, self.buf)
if has_key(s:untracked_jobs, self.file)
call remove(s:untracked_jobs, self.file)
endif
endif
endfunction
function! s:nvim_mq_job_handler(job_id, data, event) dict
if a:event == 'exit'
call airline#async#mq_output(self.buf, self.file)
endif
endfunction
function! s:nvim_po_job_handler(job_id, data, event) dict
if a:event == 'exit'
call s:po_output(self.buf, self.file)
call airline#extensions#po#shorten()
endif
endfunction
function! airline#async#nvim_get_mq_async(cmd, file)
let config = {
\ 'buf': '',
\ 'file': a:file,
\ 'cwd': s:valid_dir(fnamemodify(a:file, ':p:h')),
\ 'on_stdout': function('s:nvim_output_handler'),
\ 'on_stderr': function('s:nvim_output_handler'),
\ 'on_exit': function('s:nvim_mq_job_handler')
\ }
if g:airline#init#is_windows && &shell =~ 'cmd'
let cmd = a:cmd
else
let cmd = ['sh', '-c', a:cmd]
endif
if has_key(s:mq_jobs, a:file)
call remove(s:mq_jobs, a:file)
endif
let id = jobstart(cmd, config)
let s:mq_jobs[a:file] = id
endfunction
function! airline#async#nvim_get_msgfmt_stat(cmd, file)
let config = {
\ 'buf': '',
\ 'file': a:file,
\ 'cwd': s:valid_dir(fnamemodify(a:file, ':p:h')),
\ 'on_stdout': function('s:nvim_output_handler'),
\ 'on_stderr': function('s:nvim_output_handler'),
\ 'on_exit': function('s:nvim_po_job_handler')
\ }
if g:airline#init#is_windows && &shell =~ 'cmd'
" no msgfmt on windows?
return
else
let cmd = ['sh', '-c', a:cmd. shellescape(a:file)]
endif
if has_key(s:po_jobs, a:file)
call remove(s:po_jobs, a:file)
endif
let id = jobstart(cmd, config)
let s:po_jobs[a:file] = id
endfunction
endif
" Should work in either Vim pre 8 or Nvim
function! airline#async#nvim_vcs_untracked(cfg, file, vcs)
let cmd = a:cfg.cmd . shellescape(a:file)
let id = -1
let config = {
\ 'buf': '',
\ 'vcs': a:vcs,
\ 'cfg': a:cfg,
\ 'file': a:file,
\ 'cwd': s:valid_dir(fnamemodify(a:file, ':p:h'))
\ }
if has("nvim")
call extend(config, {
\ 'on_stdout': function('s:nvim_output_handler'),
\ 'on_exit': function('s:nvim_untracked_job_handler')})
if has_key(s:untracked_jobs, config.file)
" still running
return
endif
let id = jobstart(cmd, config)
let s:untracked_jobs[a:file] = id
endif
" vim without job feature or nvim jobstart failed
if id < 1
let output=system(cmd)
call s:untracked_output(config, output)
call airline#extensions#branch#update_untracked_config(a:file, a:vcs)
endif
endfunction

View File

@@ -1,21 +1,8 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
" min percentage width per section
let g:section_width = get(g:, 'airline#extensions#default#section_width', {
\ 'a': {'pct': 7},
\ 'b': {'pct': 10},
\ 'c': {'pct': 25},
\ 'x': {'pct': 7},
\ 'y': {'pct': 11},
\ 'z': {'pct': 15},
\ 'warning': {'pct': 10},
\ 'error': {'pct': 10},
\ 'gutter': {'pct': 5},
\ })
let s:prototype = {}
function! s:prototype.split(...) dict
@@ -62,7 +49,9 @@ function! s:prototype.build() dict
let contents = section[1]
let pgroup = prev_group
let prev_group = s:get_prev_group(self._sections, i)
if group ==# 'airline_c' && !self._context.active && has_key(self._context, 'bufnr')
if group ==# 'airline_c' && &buftype ==# 'terminal' && self._context.active
let group = 'airline_term'
elseif group ==# 'airline_c' && !self._context.active && has_key(self._context, 'bufnr')
let group = 'airline_c'. self._context.bufnr
elseif prev_group ==# 'airline_c' && !self._context.active && has_key(self._context, 'bufnr')
let prev_group = 'airline_c'. self._context.bufnr
@@ -100,7 +89,6 @@ function! s:prototype.build() dict
let line .= s:get_seperator(self, prev_group, group, side)
endif
endif
let contents = s:calculate_max_width(self, contents, group)
let line .= is_empty ? '' : s:get_accented_line(self, group, contents)
endif
@@ -130,9 +118,16 @@ endfunction
function! s:get_transitioned_seperator(self, prev_group, group, side)
let line = ''
call airline#highlighter#add_separator(a:prev_group, a:group, a:side)
let line .= '%#'.a:prev_group.'_to_'.a:group.'#'
let line .= a:side ? a:self._context.left_sep : a:self._context.right_sep
let line .= '%#'.a:group.'#'
if get(a:self._context, 'tabline', 0) && get(g:, 'airline#extensions#tabline#alt_sep', 0) && a:group ==# 'airline_tabsel' && a:side
call airline#highlighter#add_separator(a:prev_group, a:group, 0)
let line .= '%#'.a:prev_group.'_to_'.a:group.'#'
let line .= a:self._context.right_sep.'%#'.a:group.'#'
else
call airline#highlighter#add_separator(a:prev_group, a:group, a:side)
let line .= '%#'.a:prev_group.'_to_'.a:group.'#'
let line .= a:side ? a:self._context.left_sep : a:self._context.right_sep
let line .= '%#'.a:group.'#'
endif
return line
endfunction
@@ -161,37 +156,6 @@ function! s:get_accented_line(self, group, contents)
return line
endfunction
function! s:calculate_section_width()
if get(b:, 'airline_winwidth', 0) != winwidth(0)
let winwidth = winwidth(0)
for key in keys(g:section_width)
let g:section_width[key]['width'] = float2nr(winwidth * (g:section_width[key]['pct']/100.0))
endfor
let b:airline_winwidth = winwidth
endif
endfunction
function! s:calculate_max_width(self, content, key)
if a:self._context.active == 0 ||
\ get(a:self._context, 'tabline', 0)
return a:content
endif
call s:calculate_section_width()
if winwidth(0) >= 100
" only truncate sections for window width < 100
return a:content
endif
let section_key = matchstr(a:key, 'airline_\zs.*')
let width = g:section_width[section_key]['width']
if section_key == 'c'
" for the buffername, use a min-width
return '%-'.(width > 50 ? 50 : width).'.('.a:content.'%)'
else
" the rest takes a maxwidth
return '%-.'.width.'('.a:content.'%)'
endif
endfunction
function! s:section_is_empty(self, content)
let start=1

View File

@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
@@ -49,4 +49,3 @@ function! airline#debug#profile3()
profile pause
noautocmd qall!
endfunction

View File

@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
@@ -153,6 +153,11 @@ function! airline#extensions#load()
call add(loaded_ext, 'netrw')
endif
if has("terminal")
call airline#extensions#term#init(s:ext)
call add(loaded_ext, 'term')
endif
if get(g:, 'airline#extensions#ycm#enabled', 0)
call airline#extensions#ycm#init(s:ext)
call add(loaded_ext, 'ycm')
@@ -224,6 +229,12 @@ function! airline#extensions#load()
call add(loaded_ext, 'bufferline')
endif
if get(g:, 'airline#extensions#fugitiveline#enabled', 1)
\ && exists('*fugitive#head')
call airline#extensions#fugitiveline#init(s:ext)
call add(loaded_ext, 'fugitiveline')
endif
if (get(g:, 'airline#extensions#virtualenv#enabled', 1) && (exists(':VirtualEnvList') || isdirectory($VIRTUAL_ENV)))
call airline#extensions#virtualenv#init(s:ext)
call add(loaded_ext, 'virtualenv')
@@ -300,6 +311,11 @@ function! airline#extensions#load()
call add(loaded_ext, 'xkblayout')
endif
if (get(g:, 'airline#extensions#keymap#enabled', 1) && has('keymap'))
call airline#extensions#keymap#init(s:ext)
call add(loaded_ext, 'keymap')
endif
if (get(g:, 'airline#extensions#windowswap#enabled', 1) && get(g:, 'loaded_windowswap', 0))
call airline#extensions#windowswap#init(s:ext)
call add(loaded_ext, 'windowswap')
@@ -316,6 +332,11 @@ function! airline#extensions#load()
call add(loaded_ext, 'vimtex')
endif
if (get(g:, 'airline#extensions#cursormode#enabled', 0))
call airline#extensions#cursormode#init(s:ext)
call add(loaded_ext, 'cursormode')
endif
if !get(g:, 'airline#extensions#disable_rtp_load', 0)
" load all other extensions, which are not part of the default distribution.
" (autoload/airline/extensions/*.vim outside of our s:script_path).
@@ -337,4 +358,3 @@ function! airline#extensions#load()
endfor
endif
endfunction

View File

@@ -1,32 +1,58 @@
" MIT License. Copyright (c) 2013-2017 Bjorn Neergaard, w0rp
" MIT License. Copyright (c) 2013-2018 Bjorn Neergaard, w0rp et al.
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
let s:error_symbol = get(g:, 'airline#extensions#ale#error_symbol', 'E:')
let s:warning_symbol = get(g:, 'airline#extensions#ale#warning_symbol', 'W:')
function! s:airline_ale_count(cnt, symbol)
return a:cnt ? a:symbol. a:cnt : ''
endfunction
function! s:airline_ale_get_line_number(cnt, type) abort
if a:cnt == 0
return ''
endif
let buffer = bufnr('')
let problem_type = (a:type ==# 'error') ? 'E' : 'W'
let problems = copy(ale#engine#GetLoclist(buffer))
call filter(problems, 'v:val.bufnr is buffer && v:val.type is# problem_type')
if empty(problems)
return ''
endif
let open_lnum_symbol = get(g:, 'airline#extensions#ale#open_lnum_symbol', '(L')
let close_lnum_symbol = get(g:, 'airline#extensions#ale#close_lnum_symbol', ')')
return open_lnum_symbol . problems[0].lnum . close_lnum_symbol
endfunction
function! airline#extensions#ale#get(type)
if !exists(':ALELint')
return ''
endif
let l:is_err = a:type ==# 'error'
let l:counts = ale#statusline#Count(bufnr(''))
let l:symbol = l:is_err ? s:error_symbol : s:warning_symbol
let is_err = a:type ==# 'error'
let symbol = is_err ? s:error_symbol : s:warning_symbol
if type(l:counts) == type({}) && has_key(l:counts, 'error')
let is_err = a:type ==# 'error'
let counts = ale#statusline#Count(bufnr(''))
let symbol = is_err ? s:error_symbol : s:warning_symbol
if type(counts) == type({}) && has_key(counts, 'error')
" Use the current Dictionary format.
let l:errors = l:counts.error + l:counts.style_error
let l:num = l:is_err ? l:errors : l:counts.total - l:errors
let errors = counts.error + counts.style_error
let num = is_err ? errors : counts.total - errors
else
" Use the old List format.
let l:num = l:is_err ? l:counts[0] : l:counts[1]
let num = is_err ? counts[0] : counts[1]
endif
if l:num == 0
return ''
else
return l:symbol . l:num
endif
return s:airline_ale_count(num, symbol) . <sid>airline_ale_get_line_number(num, a:type)
endfunction
function! airline#extensions#ale#get_warning()
@@ -40,4 +66,14 @@ endfunction
function! airline#extensions#ale#init(ext)
call airline#parts#define_function('ale_error_count', 'airline#extensions#ale#get_error')
call airline#parts#define_function('ale_warning_count', 'airline#extensions#ale#get_warning')
augroup airline_ale
autocmd!
autocmd CursorHold,BufWritePost * call <sid>ale_refresh()
augroup END
endfunction
function! s:ale_refresh()
if get(g:, 'airline_skip_empty_sections', 0)
exe ':AirlineRefresh'
endif
endfunction

View File

@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling et al.
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
@@ -11,8 +11,6 @@ if !s:has_fugitive && !s:has_lawrencium && !s:has_vcscommand
finish
endif
let s:has_async = airline#util#async
" s:vcs_config contains static configuration of VCSes and their status relative
" to the active file.
" 'branch' - The name of currently active branch. This field is empty iff it
@@ -28,8 +26,9 @@ let s:vcs_config = {
\ 'exe': 'git',
\ 'cmd': 'git status --porcelain -- ',
\ 'untracked_mark': '??',
\ 'update_branch': 's:update_git_branch',
\ 'exclude': '\.git',
\ 'update_branch': 's:update_git_branch',
\ 'display_branch': 's:display_git_branch',
\ 'branch': '',
\ 'untracked': {},
\ },
@@ -39,6 +38,7 @@ let s:vcs_config = {
\ 'untracked_mark': '?',
\ 'exclude': '\.hg',
\ 'update_branch': 's:update_hg_branch',
\ 'display_branch': 's:display_hg_branch',
\ 'branch': '',
\ 'untracked': {},
\ },
@@ -83,55 +83,69 @@ else
endfunction
endif
let s:git_dirs = {}
function! s:update_git_branch(path)
" Fugitive special revisions. call '0' "staging" ?
let s:names = {'0': 'index', '1': 'orig', '2':'fetch', '3':'merge'}
let s:sha1size = get(g:, 'airline#extensions#branch#sha1_len', 7)
function! s:update_git_branch()
if !s:has_fugitive
let s:vcs_config['git'].branch = ''
return
endif
let name = fugitive#head(7)
if empty(name)
if has_key(s:git_dirs, a:path)
let s:vcs_config['git'].branch = s:git_dirs[a:path]
return
endif
let dir = fugitive#extract_git_dir(a:path)
if empty(dir)
let name = ''
else
try
let line = join(readfile(dir . '/HEAD'))
if strpart(line, 0, 16) == 'ref: refs/heads/'
let name = strpart(line, 16)
else
" raw commit hash
let name = strpart(line, 0, 7)
endif
catch
let name = ''
endtry
endif
let s:vcs_config['git'].branch = fugitive#head(s:sha1size)
if s:vcs_config['git'].branch is# 'master' && winwidth(0) < 81
" Shorten default a bit
let s:vcs_config['git'].branch='mas'
endif
let s:git_dirs[a:path] = name
let s:vcs_config['git'].branch = name
endfunction
function! s:update_hg_branch(path)
if s:has_lawrencium
let stl=lawrencium#statusline()
if !empty(stl) && s:has_async
call s:get_mq_async('LC_ALL=C hg qtop', expand('%:p'))
function! s:display_git_branch()
let name = b:buffer_vcs_config['git'].branch
try
let commit = fugitive#buffer().commit()
if has_key(s:names, commit)
let name = get(s:names, commit)."(".name.")"
elseif !empty(commit)
let ref = fugitive#repo().git_chomp('describe', '--all', '--exact-match', commit)
if ref !~ "^fatal: no tag exactly matches"
let name = s:format_name(substitute(ref, '\v\C^%(heads/|remotes/|tags/)=','',''))."(".name.")"
else
let name = commit[0:s:sha1size-1]."(".name.")"
endif
endif
if exists("s:mq") && !empty(s:mq)
catch
endtry
return name
endfunction
function! s:update_hg_branch()
if s:has_lawrencium
let cmd='LC_ALL=C hg qtop'
let stl=lawrencium#statusline()
let file=expand('%:p')
if !empty(stl) && get(b:, 'airline_do_mq_check', 1)
if g:airline#init#vim_async
call airline#async#get_mq_async(cmd, file)
elseif has("nvim")
call airline#async#nvim_get_mq_async(cmd, file)
else
" remove \n at the end of the command
let output=system(cmd)[0:-2]
call airline#async#mq_output(output, file)
endif
endif
" do not do mq check anymore
let b:airline_do_mq_check = 0
if exists("b:mq") && !empty(b:mq)
if stl is# 'default'
" Shorten default a bit
let stl='def'
endif
let stl.=' ['.s:mq.']'
let stl.=' ['.b:mq.']'
endif
let s:vcs_config['mercurial'].branch = stl
else
@@ -139,10 +153,13 @@ function! s:update_hg_branch(path)
endif
endfunction
function! s:display_hg_branch()
return b:buffer_vcs_config['mercurial'].branch
endfunction
function! s:update_branch()
let l:path = exists("*fnamemodify") ? fnamemodify(resolve(@%), ":p:h") : expand("%:p:h")
for vcs in keys(s:vcs_config)
call {s:vcs_config[vcs].update_branch}(l:path)
call {s:vcs_config[vcs].update_branch}()
if b:buffer_vcs_config[vcs].branch != s:vcs_config[vcs].branch
let b:buffer_vcs_config[vcs].branch = s:vcs_config[vcs].branch
unlet! b:airline_head
@@ -150,7 +167,7 @@ function! s:update_branch()
endfor
endfunction
function! s:update_untracked_in_buffer_config(file, vcs)
function! airline#extensions#branch#update_untracked_config(file, vcs)
if !has_key(s:vcs_config[a:vcs].untracked, a:file)
return
elseif s:vcs_config[a:vcs].untracked[a:file] != b:buffer_vcs_config[a:vcs].untracked
@@ -160,129 +177,43 @@ function! s:update_untracked_in_buffer_config(file, vcs)
endfunction
function! s:update_untracked()
let l:file = expand("%:p")
if empty(l:file) || isdirectory(l:file)
let file = expand("%:p")
if empty(file) || isdirectory(file)
return
endif
let l:needs_update = 1
let needs_update = 1
for vcs in keys(s:vcs_config)
if l:file =~ s:vcs_config[vcs].exclude
if file =~ s:vcs_config[vcs].exclude
" Skip check for files that live in the exclude directory
let l:needs_update = 0
let needs_update = 0
endif
if has_key(s:vcs_config[vcs].untracked, l:file)
let l:needs_update = 0
call s:update_untracked_in_buffer_config(l:file, vcs)
if has_key(s:vcs_config[vcs].untracked, file)
let needs_update = 0
call airline#extensions#branch#update_untracked_config(file, vcs)
endif
endfor
if !l:needs_update
if !needs_update
return
endif
for vcs in keys(s:vcs_config)
let l:config = s:vcs_config[vcs]
if s:has_async
let config = s:vcs_config[vcs]
if g:airline#init#vim_async
" Note that asynchronous update updates s:vcs_config only, and only
" s:update_untracked updates b:buffer_vcs_config. If s:vcs_config is
" invalidated again before s:update_untracked is called, then we lose the
" result of the previous call, i.e. the head string is not updated. It
" doesn't happen often in practice, so we let it be.
call s:get_vcs_untracked_async(l:config, l:file)
call airline#async#vim_vcs_untracked(config, file)
else
let output = airline#util#system(l:config.cmd . shellescape(l:file))
if output =~? ('^' . l:config.untracked_mark)
let l:config.untracked[l:file] = get(g:, 'airline#extensions#branch#notexists', g:airline_symbols.notexists)
else
let l:config.untracked[l:file] = ''
endif
call s:update_untracked_in_buffer_config(l:file, vcs)
" nvim async or vim without job-feature
call airline#async#nvim_vcs_untracked(config, file, vcs)
endif
endfor
endfunction
if s:has_async
let s:jobs = {}
function! s:on_stdout(channel, msg) dict abort
let self.buf .= a:msg
endfunction
function! s:on_exit(channel) dict abort
if self.buf =~? ('^' . self.config['untracked_mark'])
let self.config.untracked[self.file] = get(g:, 'airline#extensions#branch#notexists', g:airline_symbols.notexists)
else
let self.config.untracked[self.file] = ''
endif
" b:buffer_vcs_config will be updated on next call of update_untracked if
" needed
if has_key(s:jobs, self.file)
call remove(s:jobs, self.file)
endif
endfunction
function! s:get_vcs_untracked_async(config, file)
if g:airline#util#is_windows && &shell =~ 'cmd'
let cmd = a:config['cmd'] . shellescape(a:file)
else
let cmd = ['sh', '-c', a:config['cmd'] . shellescape(a:file)]
endif
let options = {'config': a:config, 'buf': '', 'file': a:file}
if has_key(s:jobs, a:file)
if job_status(get(s:jobs, a:file)) == 'run'
return
elseif has_key(s:jobs, a:file)
call remove(s:jobs, a:file)
endif
endif
let id = job_start(cmd, {
\ 'err_io': 'out',
\ 'out_cb': function('s:on_stdout', options),
\ 'close_cb': function('s:on_exit', options)})
let s:jobs[a:file] = id
endfu
function! s:on_exit_mq(channel) dict abort
if !empty(self.buf)
if self.buf is# 'no patches applied' ||
\ self.buf =~# "unknown command 'qtop'"
let self.buf = ''
elseif exists("s:mq") && s:mq isnot# self.buf
" make sure, statusline is updated
unlet! b:airline_head
endif
let s:mq = self.buf
endif
if has_key(s:jobs, self.file)
call remove(s:jobs, self.file)
endif
endfunction
function! s:get_mq_async(cmd, file)
if g:airline#util#is_windows && &shell =~ 'cmd'
let cmd = a:cmd
else
let cmd = ['sh', '-c', a:cmd]
endif
let options = {'cmd': a:cmd, 'buf': '', 'file': a:file}
if has_key(s:jobs, a:file)
if job_status(get(s:jobs, a:file)) == 'run'
return
elseif has_key(s:jobs, a:file)
call remove(s:jobs, a:file)
endif
endif
let id = job_start(cmd, {
\ 'err_io': 'out',
\ 'out_cb': function('s:on_stdout', options),
\ 'close_cb': function('s:on_exit_mq', options)})
let s:jobs[a:file] = id
endfu
endif
function! airline#extensions#branch#head()
if !exists('b:buffer_vcs_config')
call s:init_buffer()
@@ -296,24 +227,27 @@ function! airline#extensions#branch#head()
endif
let b:airline_head = ''
let l:vcs_priority = get(g:, "airline#extensions#branch#vcs_priority", ["git", "mercurial"])
let vcs_priority = get(g:, "airline#extensions#branch#vcs_priority", ["git", "mercurial"])
let l:heads = {}
for vcs in l:vcs_priority
let heads = []
for vcs in vcs_priority
if !empty(b:buffer_vcs_config[vcs].branch)
let l:heads[vcs] = b:buffer_vcs_config[vcs].branch
let heads += [vcs]
endif
endfor
for vcs in keys(l:heads)
for vcs in heads
if !empty(b:airline_head)
let b:airline_head .= ' | '
endif
let b:airline_head .= (len(l:heads) > 1 ? s:vcs_config[l:vcs].exe .':' : '') . s:format_name(l:heads[l:vcs])
if len(heads) > 1
let b:airline_head .= s:vcs_config[vcs].exe .':'
endif
let b:airline_head .= s:format_name({s:vcs_config[vcs].display_branch}())
let b:airline_head .= b:buffer_vcs_config[vcs].untracked
endfor
if empty(l:heads)
if empty(heads)
if s:has_vcscommand
call VCSCommandEnableBufferSetup()
if exists('b:VCSCommandBufferInfo')
@@ -329,9 +263,6 @@ function! airline#extensions#branch#head()
endif
endif
if has_key(l:heads, 'git') && !s:check_in_path()
let b:airline_head = ''
endif
let minwidth = empty(get(b:, 'airline_hunks', '')) ? 14 : 7
let b:airline_head = airline#util#shorten(b:airline_head, 120, minwidth)
return b:airline_head
@@ -346,38 +277,9 @@ function! airline#extensions#branch#get_head()
\ : printf('%s%s', empty(symbol) ? '' : symbol.(g:airline_symbols.space), head)
endfunction
function! s:check_in_path()
if !exists('b:airline_file_in_root')
let root = get(b:, 'git_dir', get(b:, 'mercurial_dir', ''))
let bufferpath = resolve(fnamemodify(expand('%'), ':p'))
if !filereadable(root) "not a file
" if .git is a directory, it's the old submodule format
if match(root, '\.git$') >= 0
let root = expand(fnamemodify(root, ':h'))
else
" else it's the newer format, and we need to guesstimate
" 1) check for worktrees
if match(root, 'worktrees') > -1
" worktree can be anywhere, so simply assume true here
return 1
endif
" 2) check for submodules
let pattern = '\.git[\\/]\(modules\)[\\/]'
if match(root, pattern) >= 0
let root = substitute(root, pattern, '', '')
endif
endif
endif
let b:airline_file_in_root = stridx(bufferpath, root) > -1
endif
return b:airline_file_in_root
endfunction
function! s:reset_untracked_cache(shellcmdpost)
" shellcmdpost - whether function was called as a result of ShellCmdPost hook
if !s:has_async && !has('nvim')
if !g:airline#init#vim_async && !has('nvim')
if a:shellcmdpost
" Clear cache only if there was no error or the script uses an
" asynchronous interface. Otherwise, cache clearing would overwrite
@@ -388,12 +290,12 @@ function! s:reset_untracked_cache(shellcmdpost)
endif
endif
let l:file = expand("%:p")
let file = expand("%:p")
for vcs in keys(s:vcs_config)
" Dump the value of the cache for the current file. Partially mitigates the
" issue of cache invalidation happening before a call to
" s:update_untracked()
call s:update_untracked_in_buffer_config(l:file, l:vcs)
call airline#extensions#branch#update_untracked_config(file, vcs)
let s:vcs_config[vcs].untracked = {}
endfor
endfunction
@@ -401,9 +303,8 @@ endfunction
function! airline#extensions#branch#init(ext)
call airline#parts#define_function('branch', 'airline#extensions#branch#get_head')
autocmd BufReadPost * unlet! b:airline_file_in_root
autocmd CursorHold,ShellCmdPost,CmdwinLeave * unlet! b:airline_head
autocmd User AirlineBeforeRefresh unlet! b:airline_head
autocmd ShellCmdPost,CmdwinLeave * unlet! b:airline_head b:airline_do_mq_check
autocmd User AirlineBeforeRefresh unlet! b:airline_head b:airline_do_mq_check
autocmd BufWritePost * call s:reset_untracked_cache(0)
autocmd ShellCmdPost * call s:reset_untracked_cache(1)
endfunction

View File

@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8

View File

@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2014 Mathias Andersson.
" MIT License. Copyright (c) 2014-2018 Mathias Andersson et al.
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
@@ -14,4 +14,3 @@ endfunction
function! airline#extensions#capslock#init(ext)
call airline#parts#define_function('capslock', 'airline#extensions#capslock#status')
endfunction

View File

@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8

View File

@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
@@ -30,4 +30,3 @@ endfunction
function! airline#extensions#csv#init(ext)
call a:ext.add_statusline_func('airline#extensions#csv#apply')
endfunction

View File

@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
@@ -79,4 +79,3 @@ function! airline#extensions#ctrlp#init(ext)
call a:ext.add_statusline_func('airline#extensions#ctrlp#apply')
call a:ext.add_theme_func('airline#extensions#ctrlp#load_theme')
endfunction

View File

@@ -1,14 +1,15 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
let s:spc = g:airline_symbols.space
let s:padding = s:spc . s:spc . s:spc
let s:cs = ctrlspace#context#Configuration().Symbols.CS
function! airline#extensions#ctrlspace#statusline(...)
let b = airline#builder#new({ 'active': 1 })
call b.add_section('airline_b', '⌗' . s:padding . ctrlspace#api#StatuslineModeSegment(s:padding))
call b.add_section('airline_b', s:cs . s:padding . ctrlspace#api#StatuslineModeSegment(s:padding))
call b.split()
call b.add_section('airline_x', s:spc . ctrlspace#api#StatuslineTabSegment() . s:spc)
return b.build()

View File

@@ -0,0 +1,128 @@
" Copyright (C) 2014 Andrea Cedraro <a.cedraro@gmail.com>
" Copyright (C) 2017 Eduardo Suarez-Santana <e.suarezsantana@gmail.com>
"
" Permission is hereby granted, free of charge, to any person obtaining
" a copy of this software and associated documentation files (the "Software"),
" to deal in the Software without restriction, including without limitation
" the rights to use, copy, modify, merge, publish, distribute, sublicense,
" and/or sell copies of the Software, and to permit persons to whom the
" Software is furnished to do so, subject to the following conditions:
"
" The above copyright notice and this permission notice shall be included
" in all copies or substantial portions of the Software.
"
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
" EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
" OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
" IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
" DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
" TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
" OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
scriptencoding utf-8
let s:is_win = has('win32') || has('win64')
let s:is_iTerm = exists('$TERM_PROGRAM') && $TERM_PROGRAM =~# 'iTerm.app'
let s:is_AppleTerminal = exists('$TERM_PROGRAM') && $TERM_PROGRAM =~# 'Apple_Terminal'
let s:is_good = !has('gui_running') && !s:is_win && !s:is_AppleTerminal
let s:last_mode = ''
if !exists('g:cursormode_exit_mode')
let g:cursormode_exit_mode='n'
endif
function! airline#extensions#cursormode#tmux_escape(escape)
return '\033Ptmux;'.substitute(a:escape, '\\033', '\\033\\033', 'g').'\033\\'
endfunction
let s:iTerm_escape_template = '\033]Pl%s\033\\'
let s:xterm_escape_template = '\033]12;%s\007'
function! airline#extensions#cursormode#set(...)
let mode = mode()
if mode !=# s:last_mode
let s:last_mode = mode
call s:set_cursor_color_for(mode)
endif
return ''
endfunction
function! s:set_cursor_color_for(mode)
let mode = a:mode
for mode in [a:mode, a:mode.&background]
if has_key(s:color_map, mode)
try
let save_eventignore = &eventignore
set eventignore=all
let save_shelltemp = &shelltemp
set noshelltemp
silent call system(s:build_command(s:color_map[mode]))
return
finally
let &shelltemp = save_shelltemp
let &eventignore = save_eventignore
endtry
endif
endfor
endfunction
function! s:build_command(color)
if s:is_iTerm
let color = substitute(a:color, '^#', '', '')
let escape_template = s:iTerm_escape_template
else
let color = a:color
let escape_template = s:xterm_escape_template
endif
let escape = printf(escape_template, color)
if exists('$TMUX')
let escape = airline#extensions#cursormode#tmux_escape(escape)
endif
return "printf '".escape."' > /dev/tty"
endfunction
function! s:get_color_map()
if exists('g:cursormode_color_map')
return g:cursormode_color_map
endif
try
let map = g:cursormode#{g:colors_name}#color_map
return map
catch
return {
\ "nlight": "#000000",
\ "ndark": "#BBBBBB",
\ "i": "#0000BB",
\ "v": "#FF5555",
\ "V": "#BBBB00",
\ "\<C-V>": "#BB00BB",
\ }
endtry
endfunction
augroup airline#extensions#cursormode
autocmd!
autocmd VimLeave * call s:set_cursor_color_for(g:cursormode_exit_mode)
" autocmd VimEnter * call airline#extensions#cursormode#activate()
autocmd Colorscheme * call airline#extensions#cursormode#activate()
augroup END
function! airline#extensions#cursormode#activate()
let s:color_map = s:get_color_map()
call airline#extensions#cursormode#set()
endfunction
function! airline#extensions#cursormode#apply(...)
let w:airline_section_a = get(w:, 'airline_section_a', g:airline_section_a)
let w:airline_section_a .= '%{airline#extensions#cursormode#set()}'
endfunction
function! airline#extensions#cursormode#init(ext)
let s:color_map = s:get_color_map()
call a:ext.add_statusline_func('airline#extensions#cursormode#apply')
endfunction

View File

@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
@@ -98,4 +98,3 @@ function! airline#extensions#default#apply(builder, context)
return 1
endfunction

View File

@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2017 Thomas Dy
" MIT License. Copyright (c) 2017-2018 Thomas Dy et al.
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
@@ -11,11 +11,14 @@ endif
" that implements its own insert/normal mode so we have to handle changing the
" highlight
function! airline#extensions#denite#check_denite_mode(bufnr)
let l:mode = split(denite#get_status_mode(), ' ')
let l:mode = tolower(l:mode[1])
if !exists('b:denite_mode_cache') || l:mode != b:denite_mode_cache
call airline#highlighter#highlight([l:mode], a:bufnr)
let b:denite_mode_cache = l:mode
if &filetype != 'denite'
return ''
endif
let mode = split(denite#get_status_mode(), ' ')
let mode = tolower(mode[1])
if !exists('b:denite_mode_cache') || mode != b:denite_mode_cache
call airline#highlighter#highlight([mode], a:bufnr)
let b:denite_mode_cache = mode
endif
return ''
endfunction
@@ -35,13 +38,4 @@ endfunction
function! airline#extensions#denite#init(ext)
call denite#custom#option('_', 'statusline', 0)
call a:ext.add_statusline_func('airline#extensions#denite#apply')
" airline#extensions#denite#apply normally gets called only after the
" denite window gets closed, so we have to call airline#update_statusline
" ourselves to make sure it's applied when the window is opened.
augroup airline_denite
autocmd!
autocmd FileType denite call airline#update_statusline()
augroup END
endfunction

View File

@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
@@ -59,4 +59,3 @@ function! airline#extensions#eclim#init(ext)
call airline#parts#define_function('eclim', 'airline#extensions#eclim#get_warnings')
call a:ext.add_statusline_func('airline#extensions#eclim#creat_line')
endfunction

View File

@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
@@ -53,4 +53,3 @@ function! airline#extensions#example#get_cats()
endfor
return cats
endfunction

View File

@@ -0,0 +1,45 @@
" MIT License. Copyright (c) 2017-2018 Cimbali et al
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
if !exists('*fugitive#head')
finish
endif
if exists("+autochdir") && &autochdir == 1
let s:fmod = ':p'
else
let s:fmod = ':.'
endif
function! airline#extensions#fugitiveline#bufname()
if !exists('b:fugitive_name')
let b:fugitive_name = ''
try
let buffer = fugitive#buffer()
if buffer.type('blob')
let b:fugitive_name = buffer.repo().translate(buffer.path())
endif
catch
endtry
endif
if empty(b:fugitive_name)
return fnamemodify(bufname('%'), s:fmod)
else
return fnamemodify(b:fugitive_name, s:fmod)
endif
endfunction
function! airline#extensions#fugitiveline#init(ext)
if exists("+autochdir") && &autochdir == 1
" if 'acd' is set, vim-airline uses the path section, so we need to redefine this here as well
call airline#parts#define_raw('path', '%<%{airline#extensions#fugitiveline#bufname()}%m')
else
call airline#parts#define_raw('file', '%<%{airline#extensions#fugitiveline#bufname()}%m')
endif
autocmd ShellCmdPost,CmdwinLeave * unlet! b:fugitive_name
autocmd User AirlineBeforeRefresh unlet! b:fugitive_name
endfunction

View File

@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
@@ -19,7 +19,8 @@ function! s:get_hunks_signify()
endfunction
function! s:is_branch_empty()
return exists('*airline#extensions#branch#head') && empty(airline#extensions#branch#head())
return exists('*airline#extensions#branch#head') &&
\ empty(get(b:, 'airline_head', ''))
endfunction
function! s:get_hunks_gitgutter()
@@ -34,12 +35,7 @@ function! s:get_hunks_changes()
return []
endif
let hunks = changes#GetStats()
for i in hunks
if i > 0
return hunks
endif
endfor
return []
return hunks == [0, 0, 0] ? [] : hunks
endfunction
function! s:get_hunks_empty()
@@ -67,13 +63,14 @@ function! airline#extensions#hunks#get_hunks()
if !get(w:, 'airline_active', 0)
return ''
endif
" Cache vavlues, so that it isn't called too often
" Cache values, so that it isn't called too often
if exists("b:airline_hunks") &&
\ get(b:, 'airline_changenr', 0) == changenr() &&
\ get(b:, 'airline_changenr', 0) == b:changedtick &&
\ winwidth(0) == get(s:, 'airline_winwidth', 0) &&
\ get(b:, 'source_func', '') isnot# 's:get_hunks_signify' &&
\ get(b:, 'source_func', '') isnot# 's:get_hunks_gitgutter' &&
\ get(b:, 'source_func', '') isnot# 's:get_hunks_empty'
\ get(b:, 'source_func', '') isnot# 's:get_hunks_empty' &&
\ get(b:, 'source_func', '') isnot# 's:get_hunks_changes'
return b:airline_hunks
endif
let hunks = s:get_hunks()
@@ -86,7 +83,7 @@ function! airline#extensions#hunks#get_hunks()
endfor
endif
let b:airline_hunks = string
let b:airline_changenr = changenr()
let b:airline_changenr = b:changedtick
let s:airline_winwidth = winwidth(0)
return string
endfunction

View File

@@ -0,0 +1,20 @@
" MIT License. Copyright (c) 2013-2018 Doron Behar, C.Brabandt et al.
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
if !has('keymap')
finish
endif
function! airline#extensions#keymap#status()
if (get(g:, 'airline#extensions#keymap#enabled', 1) && has('keymap'))
return printf('%s', (!empty(&keymap) ? (g:airline_symbols.keymap . ' '. &keymap) : ''))
else
return ''
endif
endfunction
function! airline#extensions#keymap#init(ext)
call airline#parts#define_function('keymap', 'airline#extensions#keymap#status')
endfunction

View File

@@ -1,3 +1,4 @@
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
" vim: et ts=2 sts=2 sw=2
if !exists(':Neomake')
@@ -7,14 +8,24 @@ endif
let s:error_symbol = get(g:, 'airline#extensions#neomake#error_symbol', 'E:')
let s:warning_symbol = get(g:, 'airline#extensions#neomake#warning_symbol', 'W:')
function! s:get_counts()
let l:counts = neomake#statusline#LoclistCounts()
if empty(l:counts)
return neomake#statusline#QflistCounts()
else
return l:counts
endif
endfunction
function! airline#extensions#neomake#get_warnings()
let counts = neomake#statusline#LoclistCounts()
let counts = s:get_counts()
let warnings = get(counts, 'W', 0)
return warnings ? s:warning_symbol.warnings : ''
endfunction
function! airline#extensions#neomake#get_errors()
let counts = neomake#statusline#LoclistCounts()
let counts = s:get_counts()
let errors = get(counts, 'E', 0)
return errors ? s:error_symbol.errors : ''
endfunction

View File

@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8

View File

@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8

View File

@@ -1,3 +1,4 @@
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
@@ -19,4 +20,3 @@ endfunction
function! airline#extensions#obsession#get_status()
return ObsessionStatus((g:airline#extensions#obsession#indicator_text . s:spc), '')
endfunction

View File

@@ -1,11 +1,9 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
let s:has_async = airline#util#async
function! s:shorten()
function! airline#extensions#po#shorten()
if exists("g:airline#extensions#po#displayed_limit")
let w:displayed_po_limit = g:airline#extensions#po#displayed_limit
if len(b:airline_po_stats) > w:displayed_po_limit - 1
@@ -14,49 +12,6 @@ function! s:shorten()
endif
endfunction
if s:has_async
let s:jobs = {}
function! s:on_stdout(channel, msg) dict abort
let self.buf = a:msg
endfunction
function! s:on_exit(channel) dict abort
if !empty(self.buf)
let b:airline_po_stats = printf("[%s]", self.buf)
else
let b:airline_po_stats = ''
endif
if has_key(s:jobs, self.file)
call remove(s:jobs, self.file)
endif
call s:shorten()
endfunction
function! s:get_msgfmt_stat_async(cmd, file)
if g:airline#util#is_windows || !executable('msgfmt')
" no msgfmt on windows?
return
else
let cmd = ['sh', '-c', a:cmd. shellescape(a:file)]
endif
let options = {'buf': '', 'file': a:file}
if has_key(s:jobs, a:file)
if job_status(get(s:jobs, a:file)) == 'run'
return
elseif has_key(s:jobs, a:file)
call remove(s:jobs, a:file)
endif
endif
let id = job_start(cmd, {
\ 'err_io': 'out',
\ 'out_cb': function('s:on_stdout', options),
\ 'close_cb': function('s:on_exit', options)})
let s:jobs[a:file] = id
endfu
endif
function! airline#extensions#po#apply(...)
if &ft ==# 'po'
call airline#extensions#prepend_to_section('z', '%{airline#extensions#po#stats()}')
@@ -70,8 +25,10 @@ function! airline#extensions#po#stats()
endif
let cmd = 'msgfmt --statistics -o /dev/null -- '
if s:has_async
call s:get_msgfmt_stat_async(cmd, expand('%:p'))
if g:airline#init#vim_async
call airline#async#get_msgfmt_stat(cmd, expand('%:p'))
elseif has("nvim")
call airline#async#nvim_get_msgfmt_stat(cmd, expand('%:p'))
else
let airline_po_stats = system(cmd. shellescape(expand('%:p')))
if v:shell_error
@@ -83,7 +40,7 @@ function! airline#extensions#po#stats()
catch
let b:airline_po_stats = ''
endtry
call s:shorten()
call airline#extensions#po#shorten()
endif
return get(b:, 'airline_po_stats', '')
endfunction

View File

@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8

View File

@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8

View File

@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
@@ -22,15 +22,15 @@ function! airline#extensions#syntastic#get(type)
let _backup = get(g:, 'syntastic_stl_format', '')
let is_err = (a:type is# 'error')
if is_err
let g:syntastic_stl_format = '%E{%e}'
let g:syntastic_stl_format = get(g:, 'airline#extensions#syntastic#stl_format_err', '%E{[%e(#%fe)]}')
else
let g:syntastic_stl_format = '%W{%w}'
let g:syntastic_stl_format = get(g:, 'airline#extensions#syntastic#stl_format_warn', '%W{[%w(#%fw)]}')
endif
let cnt = SyntasticStatuslineFlag()
if !empty(_backup)
let g:syntastic_stl_format = _backup
endif
if cnt == 0
if empty(cnt)
return ''
else
return (is_err ? s:error_symbol : s:warning_symbol).cnt

View File

@@ -1,12 +1,8 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
let s:formatter = get(g:, 'airline#extensions#tabline#formatter', 'default')
let s:show_buffers = get(g:, 'airline#extensions#tabline#show_buffers', 1)
let s:show_tabs = get(g:, 'airline#extensions#tabline#show_tabs', 1)
let s:ignore_bufadd_pat = get(g:, 'airline#extensions#tabline#ignore_bufadd_pat', '\c\vgundo|undotree|vimfiler|tagbar|nerd_tree')
let s:taboo = get(g:, 'airline#extensions#taboo#enabled', 1) && get(g:, 'loaded_taboo', 0)
if s:taboo
@@ -31,14 +27,18 @@ function! s:toggle_off()
call airline#extensions#tabline#autoshow#off()
call airline#extensions#tabline#tabs#off()
call airline#extensions#tabline#buffers#off()
call airline#extensions#tabline#ctrlspace#off()
if s:ctrlspace
call airline#extensions#tabline#ctrlspace#off()
endif
endfunction
function! s:toggle_on()
call airline#extensions#tabline#autoshow#on()
call airline#extensions#tabline#tabs#on()
call airline#extensions#tabline#buffers#on()
call airline#extensions#tabline#ctrlspace#on()
if s:ctrlspace
call airline#extensions#tabline#ctrlspace#on()
endif
set tabline=%!airline#extensions#tabline#get()
endfunction
@@ -48,17 +48,22 @@ function! s:update_tabline()
return
endif
let match = expand('<afile>')
let ignore_bufadd_pat = get(g:, 'airline#extensions#tabline#ignore_bufadd_pat',
\ '\c\vgundo|undotree|vimfiler|tagbar|nerd_tree')
if pumvisible()
return
elseif !get(g:, 'airline#extensions#tabline#enabled', 0)
return
" return, if buffer matches ignore pattern or is directory (netrw)
elseif empty(match)
\ || match(match, s:ignore_bufadd_pat) > -1
\ || match(match, ignore_bufadd_pat) > -1
\ || isdirectory(expand("<afile>"))
return
endif
doautocmd User BufMRUChange
" sometimes, the tabline is not correctly updated see #1580
" so force redraw here
let &tabline = &tabline
endfunction
function! airline#extensions#tabline#load_theme(palette)
@@ -66,47 +71,53 @@ function! airline#extensions#tabline#load_theme(palette)
return
endif
let colors = get(a:palette, 'tabline', {})
let tablabel = get(colors, 'airline_tablabel', a:palette.normal.airline_b)
" Theme for tabs on the left
let l:tab = get(colors, 'airline_tab', a:palette.normal.airline_b)
let l:tabsel = get(colors, 'airline_tabsel', a:palette.normal.airline_a)
let l:tabtype = get(colors, 'airline_tabtype', a:palette.visual.airline_a)
let l:tabfill = get(colors, 'airline_tabfill', a:palette.normal.airline_c)
let l:tabmod = get(colors, 'airline_tabmod', a:palette.insert.airline_a)
let l:tabhid = get(colors, 'airline_tabhid', a:palette.normal.airline_c)
let tab = get(colors, 'airline_tab', a:palette.normal.airline_b)
let tabsel = get(colors, 'airline_tabsel', a:palette.normal.airline_a)
let tabtype = get(colors, 'airline_tabtype', a:palette.visual.airline_a)
let tabfill = get(colors, 'airline_tabfill', a:palette.normal.airline_c)
let tabmod = get(colors, 'airline_tabmod', a:palette.insert.airline_a)
let tabhid = get(colors, 'airline_tabhid', a:palette.normal.airline_c)
if has_key(a:palette, 'normal_modified') && has_key(a:palette.normal_modified, 'airline_c')
let l:tabmodu = get(colors, 'airline_tabmod_unsel', a:palette.normal_modified.airline_c)
let tabmodu = get(colors, 'airline_tabmod_unsel', a:palette.normal_modified.airline_c)
else
"Fall back to normal airline_c if modified airline_c isn't present
let l:tabmodu = get(colors, 'airline_tabmod_unsel', a:palette.normal.airline_c)
let tabmodu = get(colors, 'airline_tabmod_unsel', a:palette.normal.airline_c)
endif
call airline#highlighter#exec('airline_tab', l:tab)
call airline#highlighter#exec('airline_tabsel', l:tabsel)
call airline#highlighter#exec('airline_tabtype', l:tabtype)
call airline#highlighter#exec('airline_tabfill', l:tabfill)
call airline#highlighter#exec('airline_tabmod', l:tabmod)
call airline#highlighter#exec('airline_tabmod_unsel', l:tabmodu)
call airline#highlighter#exec('airline_tabhid', l:tabhid)
call airline#highlighter#exec('airline_tablabel', tablabel)
call airline#highlighter#exec('airline_tab', tab)
call airline#highlighter#exec('airline_tabsel', tabsel)
call airline#highlighter#exec('airline_tabtype', tabtype)
call airline#highlighter#exec('airline_tabfill', tabfill)
call airline#highlighter#exec('airline_tabmod', tabmod)
call airline#highlighter#exec('airline_tabmod_unsel', tabmodu)
call airline#highlighter#exec('airline_tabhid', tabhid)
" Theme for tabs on the right
let l:tabsel_right = get(colors, 'airline_tabsel_right', a:palette.normal.airline_a)
let l:tab_right = get(colors, 'airline_tab_right', a:palette.inactive.airline_c)
let l:tabmod_right = get(colors, 'airline_tabmod_right', a:palette.insert.airline_a)
let l:tabhid_right = get(colors, 'airline_tabhid_right', a:palette.normal.airline_c)
let tabsel_right = get(colors, 'airline_tabsel_right', a:palette.normal.airline_a)
let tab_right = get(colors, 'airline_tab_right', a:palette.inactive.airline_c)
let tabmod_right = get(colors, 'airline_tabmod_right', a:palette.insert.airline_a)
let tabhid_right = get(colors, 'airline_tabhid_right', a:palette.normal.airline_c)
if has_key(a:palette, 'normal_modified') && has_key(a:palette.normal_modified, 'airline_c')
let l:tabmodu_right = get(colors, 'airline_tabmod_unsel_right', a:palette.normal_modified.airline_c)
let tabmodu_right = get(colors, 'airline_tabmod_unsel_right', a:palette.normal_modified.airline_c)
else
"Fall back to normal airline_c if modified airline_c isn't present
let l:tabmodu_right = get(colors, 'airline_tabmod_unsel_right', a:palette.normal.airline_c)
let tabmodu_right = get(colors, 'airline_tabmod_unsel_right', a:palette.normal.airline_c)
endif
call airline#highlighter#exec('airline_tab_right', l:tab_right)
call airline#highlighter#exec('airline_tabsel_right', l:tabsel_right)
call airline#highlighter#exec('airline_tabmod_right', l:tabmod_right)
call airline#highlighter#exec('airline_tabhid_right', l:tabhid_right)
call airline#highlighter#exec('airline_tabmod_unsel_right', l:tabmodu_right)
call airline#highlighter#exec('airline_tab_right', tab_right)
call airline#highlighter#exec('airline_tabsel_right', tabsel_right)
call airline#highlighter#exec('airline_tabmod_right', tabmod_right)
call airline#highlighter#exec('airline_tabhid_right', tabhid_right)
call airline#highlighter#exec('airline_tabmod_unsel_right', tabmodu_right)
endfunction
let s:current_tabcnt = -1
function! airline#extensions#tabline#get()
let show_buffers = get(g:, 'airline#extensions#tabline#show_buffers', 1)
let show_tabs = get(g:, 'airline#extensions#tabline#show_tabs', 1)
let curtabcnt = tabpagenr('$')
if curtabcnt != s:current_tabcnt
let s:current_tabcnt = curtabcnt
@@ -120,7 +131,7 @@ function! airline#extensions#tabline#get()
endif
if s:ctrlspace
return airline#extensions#tabline#ctrlspace#get()
elseif s:show_buffers && curtabcnt == 1 || !s:show_tabs
elseif show_buffers && curtabcnt == 1 || !show_tabs
return airline#extensions#tabline#buffers#get()
else
return airline#extensions#tabline#tabs#get()
@@ -151,7 +162,8 @@ endfunction
function! airline#extensions#tabline#get_buffer_name(nr, ...)
let buffers = a:0 ? a:1 : airline#extensions#tabline#buflist#list()
return airline#extensions#tabline#formatters#{s:formatter}#format(a:nr, buffers)
let formatter = get(g:, 'airline#extensions#tabline#formatter', 'default')
return airline#extensions#tabline#formatters#{formatter}#format(a:nr, buffers)
endfunction
function! airline#extensions#tabline#new_builder()
@@ -191,3 +203,10 @@ function! airline#extensions#tabline#group_of_bufnr(tab_bufs, bufnr)
endif
return group
endfunction
function! airline#extensions#tabline#add_label(dict, type)
if get(g:, 'airline#extensions#tabline#show_tab_type', 1)
call a:dict.add_section_spaced('airline_tablabel',
\ get(g:, 'airline#extensions#tabline#'.a:type.'_label', '['.a:type.']'))
endif
endfunction

View File

@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8

View File

@@ -1,11 +1,8 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
let s:buffer_idx_mode = get(g:, 'airline#extensions#tabline#buffer_idx_mode', 0)
let s:show_tab_type = get(g:, 'airline#extensions#tabline#show_tab_type', 1)
let s:buffers_label = get(g:, 'airline#extensions#tabline#buffers_label', 'buffers')
let s:spc = g:airline_symbols.space
let s:current_bufnr = -1
@@ -49,7 +46,11 @@ function! airline#extensions#tabline#buffers#invalidate()
endfunction
function! airline#extensions#tabline#buffers#get()
call <sid>map_keys()
try
call <sid>map_keys()
catch
" no-op
endtry
let cur = bufnr('%')
if cur == s:current_bufnr
if !g:airline_detect_modified || getbufvar(cur, '&modified') == s:current_modified
@@ -57,9 +58,18 @@ function! airline#extensions#tabline#buffers#get()
endif
endif
let l:index = 1
let index = 1
let b = airline#extensions#tabline#new_builder()
let tab_bufs = tabpagebuflist(tabpagenr())
let show_buf_label_first = 0
if get(g:, 'airline#extensions#tabline#buf_label_first', 0)
let show_buf_label_first = 1
endif
if show_buf_label_first
call airline#extensions#tabline#add_label(b, 'buffers')
endif
let pgroup = ''
for nr in s:get_visible_buffers()
if nr < 0
call b.add_raw('%#airline_tabhid#...')
@@ -76,27 +86,33 @@ function! airline#extensions#tabline#buffers#get()
if has("tablineat")
call b.add_raw('%'.nr.'@airline#extensions#tabline#buffers#clickbuf@')
endif
if s:buffer_idx_mode
let space= (pgroup == group ? s:spc : '')
if get(g:, 'airline#extensions#tabline#buffer_idx_mode', 0)
if len(s:number_map) > 0
call b.add_section(group, s:spc . get(s:number_map, l:index, '') . '%(%{airline#extensions#tabline#get_buffer_name('.nr.')}%)' . s:spc)
call b.add_section(group, space. get(s:number_map, index, '') . '%(%{airline#extensions#tabline#get_buffer_name('.nr.')}%)' . s:spc)
else
call b.add_section(group, '['.l:index.s:spc.'%(%{airline#extensions#tabline#get_buffer_name('.nr.')}%)'.']')
call b.add_section(group, '['.index.s:spc.'%(%{airline#extensions#tabline#get_buffer_name('.nr.')}%)'.']')
endif
let l:index = l:index + 1
let index += 1
else
call b.add_section(group, s:spc.'%(%{airline#extensions#tabline#get_buffer_name('.nr.')}%)'.s:spc)
call b.add_section(group, space.'%(%{airline#extensions#tabline#get_buffer_name('.nr.')}%)'.s:spc)
endif
if has("tablineat")
call b.add_raw('%X')
endif
let pgroup=group
endfor
call b.add_section('airline_tabfill', '')
call b.split()
call b.add_section('airline_tabfill', '')
if s:show_tab_type
call b.add_section_spaced('airline_tabtype', s:buffers_label)
if !show_buf_label_first
call airline#extensions#tabline#add_label(b, 'buffers')
endif
if tabpagenr('$') > 1
call b.add_section_spaced('airline_tabmod', printf('%s %d/%d', "tab", tabpagenr(), tabpagenr('$')))
endif
@@ -109,6 +125,12 @@ endfunction
function! s:get_visible_buffers()
let buffers = airline#extensions#tabline#buflist#list()
let cur = bufnr('%')
if get(g:, 'airline#extensions#tabline#current_first', 0)
if index(buffers, cur) > -1
call remove(buffers, index(buffers, cur))
endif
let buffers = [cur] + buffers
endif
let total_width = 0
let max_width = 0
@@ -160,8 +182,9 @@ function! s:get_visible_buffers()
endfunction
function! s:select_tab(buf_index)
" no-op when called in the NERDTree buffer
if exists('t:NERDTreeBufName') && bufname('%') == t:NERDTreeBufName
" no-op when called in 'keymap_ignored_filetypes'
if count(get(g:, 'airline#extensions#tabline#keymap_ignored_filetypes',
\ ['vimfiler', 'nerdtree']), &ft)
return
endif
@@ -177,15 +200,15 @@ function! s:select_tab(buf_index)
endfunction
function! s:jump_to_tab(offset)
let l = s:current_visible_buffers
let l = airline#extensions#tabline#buflist#list()
let i = index(l, bufnr('%'))
if i > -1
exec 'b!' . l[float2nr(fmod(i + a:offset, len(l)))]
exec 'b!' . l[(i + a:offset) % len(l)]
endif
endfunction
function! s:map_keys()
if s:buffer_idx_mode
if get(g:, 'airline#extensions#tabline#buffer_idx_mode', 1)
noremap <silent> <Plug>AirlineSelectTab1 :call <SID>select_tab(0)<CR>
noremap <silent> <Plug>AirlineSelectTab2 :call <SID>select_tab(1)<CR>
noremap <silent> <Plug>AirlineSelectTab3 :call <SID>select_tab(2)<CR>

View File

@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
@@ -41,4 +41,3 @@ function! airline#extensions#tabline#buflist#list()
let s:current_buffer_list = buffers
return buffers
endfunction

View File

@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2016 Kevin Sapper
" MIT License. Copyright (c) 2016-2018 Kevin Sapper et al.
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
@@ -7,12 +7,6 @@ let s:current_bufnr = -1
let s:current_tabnr = -1
let s:current_tabline = ''
let s:buffers_label = get(g:, 'airline#extensions#tabline#buffers_label', 'buffers')
let s:tabs_label = get(g:, 'airline#extensions#tabline#tabs_label', 'tabs')
let s:switch_buffers_and_tabs = get(g:, 'airline#extensions#tabline#switch_buffers_and_tabs', 0)
let s:show_buffers = get(g:, 'airline#extensions#tabline#show_buffers', 1)
let s:show_tabs = get(g:, 'airline#extensions#tabline#show_tabs', 1)
function! airline#extensions#tabline#ctrlspace#off()
augroup airline_tabline_ctrlspace
autocmd!
@@ -39,6 +33,15 @@ function! airline#extensions#tabline#ctrlspace#add_buffer_section(builder, cur_t
endif
let s:buffer_list = ctrlspace#api#BufferList(a:cur_tab)
" add by tenfy(tenfyzhong@qq.com)
" if the current buffer no in the buffer list
" return false and no redraw tabline.
" Fixes #1515. if there a BufEnter autocmd execute redraw. The tabline may no update.
let bufnr_list = map(copy(s:buffer_list), 'v:val["index"]')
if index(bufnr_list, a:cur_buf) == -1
return 0
endif
for buffer in s:buffer_list
if a:cur_buf == buffer.index
if buffer.modified
@@ -64,6 +67,10 @@ function! airline#extensions#tabline#ctrlspace#add_buffer_section(builder, cur_t
call a:builder.add_section_spaced(group, buf_name)
endfor
" add by tenfy(tenfyzhong@qq.com)
" if the selected buffer was updated
" return true
return 1
endfunction
function! airline#extensions#tabline#ctrlspace#add_tab_section(builder, pos)
@@ -94,8 +101,15 @@ endfunction
function! airline#extensions#tabline#ctrlspace#get()
let cur_buf = bufnr('%')
let buffer_label = get(g:, 'airline#extensions#tabline#buffers_label', 'buffers')
let tab_label = get(g:, 'airline#extensions#tabline#tabs_label', 'tabs')
let switch_buffers_and_tabs = get(g:, 'airline#extensions#tabline#switch_buffers_and_tabs', 0)
call airline#extensions#tabline#tabs#map_keys()
try
call airline#extensions#tabline#tabs#map_keys()
catch
" no-op
endtry
let s:tab_list = ctrlspace#api#TabList()
for tab in s:tab_list
if tab.current
@@ -110,16 +124,24 @@ function! airline#extensions#tabline#ctrlspace#get()
let builder = airline#extensions#tabline#new_builder()
" Add left tabline content
if s:show_buffers == 0
if get(g:, 'airline#extensions#tabline#show_buffers', 1) == 0
call airline#extensions#tabline#ctrlspace#add_tab_section(builder, 0)
elseif s:show_tabs == 0
call airline#extensions#tabline#ctrlspace#add_buffer_section(builder, cur_tab, cur_buf, 0)
elseif get(g:, 'airline#extensions#tabline#show_tabs', 1) == 0
" add by tenfy(tenfyzhong@qq.com)
" if current buffer no in the buffer list, does't update tabline
if airline#extensions#tabline#ctrlspace#add_buffer_section(builder, cur_tab, cur_buf, 0) == 0
return s:current_tabline
endif
else
if s:switch_buffers_and_tabs == 0
call builder.add_section_spaced('airline_tabtype', s:buffers_label)
call airline#extensions#tabline#ctrlspace#add_buffer_section(builder, cur_tab, cur_buf, 0)
if switch_buffers_and_tabs == 0
call builder.add_section_spaced('airline_tabtype', buffer_label)
" add by tenfy(tenfyzhong@qq.com)
" if current buffer no in the buffer list, does't update tabline
if airline#extensions#tabline#ctrlspace#add_buffer_section(builder, cur_tab, cur_buf, 0) == 0
return s:current_tabline
endif
else
call builder.add_section_spaced('airline_tabtype', s:tabs_label)
call builder.add_section_spaced('airline_tabtype', tab_label)
call airline#extensions#tabline#ctrlspace#add_tab_section(builder, 0)
endif
endif
@@ -129,17 +151,21 @@ function! airline#extensions#tabline#ctrlspace#get()
call builder.add_section('airline_tabfill', '')
" Add right tabline content
if s:show_buffers == 0
call builder.add_section_spaced('airline_tabtype', s:tabs_label)
elseif s:show_tabs == 0
call builder.add_section_spaced('airline_tabtype', s:buffers_label)
if get(g:, 'airline#extensions#tabline#show_buffers', 1) == 0
call builder.add_section_spaced('airline_tabtype', tab_label)
elseif get(g:, 'airline#extensions#tabline#show_tabs', 1) == 0
call builder.add_section_spaced('airline_tabtype', buffer_label)
else
if s:switch_buffers_and_tabs == 0
if switch_buffers_and_tabs == 0
call airline#extensions#tabline#ctrlspace#add_tab_section(builder, 1)
call builder.add_section_spaced('airline_tabtype', s:tabs_label)
call builder.add_section_spaced('airline_tabtype', tab_label)
else
call airline#extensions#tabline#ctrlspace#add_buffer_section(builder, cur_tab, cur_buf, 1)
call builder.add_section_spaced('airline_tabtype', s:buffers_label)
" add by tenfy(tenfyzhong@qq.com)
" if current buffer no in the buffer list, does't update tabline
if airline#extensions#tabline#ctrlspace#add_buffer_section(builder, cur_tab, cur_buf, 1) == 0
return s:current_tabline
endif
call builder.add_section_spaced('airline_tabtype', buffer_label)
endif
endif

View File

@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8

View File

@@ -0,0 +1,15 @@
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
function! airline#extensions#tabline#formatters#jsformatter#format(bufnr, buffers)
let buf = bufname(a:bufnr)
let filename = fnamemodify(buf, ':t')
if filename == 'index.js' || filename == 'index.jsx'
return fnamemodify(buf, ':p:h:t') . '/i'
else
return airline#extensions#tabline#formatters#unique_tail_improved#format(a:bufnr, a:buffers)
endif
endfunction

View File

@@ -0,0 +1,14 @@
" MIT License. Copyright (c) 2017-2018 C.Brabandt et al.
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
function! airline#extensions#tabline#formatters#tabnr#format(tab_nr_type, nr)
if a:tab_nr_type == 0 " nr of splits
return (g:airline_symbols.space).'%{len(tabpagebuflist('.a:nr.'))}'
elseif a:tab_nr_type == 1 " tab number
return (g:airline_symbols.space).a:nr
else "== 2 splits and tab number
return (g:airline_symbols.space).a:nr.'.%{len(tabpagebuflist('.a:nr.'))}'
endif
endfunction

View File

@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
@@ -21,8 +21,14 @@ function! airline#extensions#tabline#formatters#unique_tail#format(bufnr, buffer
endif
endfor
let fmod = get(g:, 'airline#extensions#tabline#fnamemod', ':p:.')
for nr in values(duplicates)
let map[nr] = airline#extensions#tabline#formatters#default#wrap_name(nr, fnamemodify(bufname(nr), ':p:.'))
let fnamecollapse = get(g:, 'airline#extensions#tabline#fnamecollapse', 1)
if fnamecollapse
let map[nr] = airline#extensions#tabline#formatters#default#wrap_name(nr, substitute(fnamemodify(name, fmod), '\v\w\zs.{-}\ze(\\|/)', '', 'g'))
else
let map[nr] = airline#extensions#tabline#formatters#default#wrap_name(nr, fnamemodify(bufname(nr), fmod))
endif
endfor
if has_key(map, a:bufnr)

View File

@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8

View File

@@ -1,17 +1,9 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
let s:show_close_button = get(g:, 'airline#extensions#tabline#show_close_button', 1)
let s:show_tab_type = get(g:, 'airline#extensions#tabline#show_tab_type', 1)
let s:show_tab_nr = get(g:, 'airline#extensions#tabline#show_tab_nr', 1)
let s:tab_nr_type = get(g:, 'airline#extensions#tabline#tab_nr_type', 0)
let s:close_symbol = get(g:, 'airline#extensions#tabline#close_symbol', 'X')
let s:tabs_label = get(g:, 'airline#extensions#tabline#tabs_label', 'tabs')
let s:show_splits = get(g:, 'airline#extensions#tabline#show_splits', 1)
let s:spc = g:airline_symbols.space
let s:current_bufnr = -1
let s:current_tabnr = -1
let s:current_modified = 0
@@ -36,16 +28,30 @@ endfunction
function! airline#extensions#tabline#tabs#get()
let curbuf = bufnr('%')
let curtab = tabpagenr()
call airline#extensions#tabline#tabs#map_keys()
try
call airline#extensions#tabline#tabs#map_keys()
catch
" no-op
endtry
if curbuf == s:current_bufnr && curtab == s:current_tabnr
if !g:airline_detect_modified || getbufvar(curbuf, '&modified') == s:current_modified
return s:current_tabline
endif
endif
let tab_nr_type = get(g:, 'airline#extensions#tabline#tab_nr_type', 0)
let b = airline#extensions#tabline#new_builder()
for i in range(1, tabpagenr('$'))
call airline#extensions#tabline#add_label(b, 'tabs')
" always have current tabpage first
let tablist = range(1, tabpagenr('$'))
if get(g:, 'airline#extensions#tabline#current_first', 0)
if index(tablist, curtab) > -1
call remove(tablist, index(tablist, curtab))
endif
let tablist = [curtab] + tablist
endif
for i in tablist
if i == curtab
let group = 'airline_tabsel'
if g:airline_detect_modified
@@ -60,14 +66,9 @@ function! airline#extensions#tabline#tabs#get()
let group = 'airline_tab'
endif
let val = '%('
if s:show_tab_nr
if s:tab_nr_type == 0
let val .= (g:airline_symbols.space).'%{len(tabpagebuflist('.i.'))}'
elseif s:tab_nr_type == 1
let val .= (g:airline_symbols.space).i
else "== 2
let val .= (g:airline_symbols.space).i.'.%{len(tabpagebuflist('.i.'))}'
endif
if get(g:, 'airline#extensions#tabline#show_tab_nr', 1)
let val .= airline#extensions#tabline#tabs#tabnr_formatter(tab_nr_type, i)
endif
call b.add_section(group, val.'%'.i.'T %{airline#extensions#tabline#title('.i.')} %)')
endfor
@@ -76,18 +77,18 @@ function! airline#extensions#tabline#tabs#get()
call b.split()
call b.add_section('airline_tabfill', '')
if s:show_close_button
call b.add_section('airline_tab_right', ' %999X'.s:close_symbol.' ')
if get(g:, 'airline#extensions#tabline#show_close_button', 1)
call b.add_section('airline_tab_right', ' %999X'.
\ get(g:, 'airline#extensions#tabline#close_symbol', 'X').' ')
endif
if s:show_splits == 1
if get(g:, 'airline#extensions#tabline#show_splits', 1) == 1
let buffers = tabpagebuflist(curtab)
for nr in buffers
let group = airline#extensions#tabline#group_of_bufnr(buffers, nr) . "_right"
call b.add_section_spaced(group, '%(%{airline#extensions#tabline#get_buffer_name('.nr.')}%)')
endfor
elseif s:show_tab_type == 1
call b.add_section_spaced('airline_tabtype', s:tabs_label)
call airline#extensions#tabline#add_label(b, 'buffers')
endif
let s:current_bufnr = curbuf
@@ -97,6 +98,9 @@ function! airline#extensions#tabline#tabs#get()
endfunction
function! airline#extensions#tabline#tabs#map_keys()
if exists("s:airline_tabline_map_key")
return
endif
noremap <silent> <Plug>AirlineSelectTab1 :1tabn<CR>
noremap <silent> <Plug>AirlineSelectTab2 :2tabn<CR>
noremap <silent> <Plug>AirlineSelectTab3 :3tabn<CR>
@@ -109,4 +113,10 @@ function! airline#extensions#tabline#tabs#map_keys()
noremap <silent> <Plug>AirlineSelectPrevTab gT
" tabn {count} goes to count tab does not go {count} tab pages forward!
noremap <silent> <Plug>AirlineSelectNextTab :<C-U>exe repeat(':tabn\|', v:count1)<cr>
let s:airline_tabline_map_key = 1
endfunction
function! airline#extensions#tabline#tabs#tabnr_formatter(nr, i)
let formatter = get(g:, 'airline#extensions#tabline#tabnr_formatter', 'tabnr')
return airline#extensions#tabline#formatters#{formatter}#format(a:nr, a:i)
endfunction

View File

@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
@@ -9,6 +9,7 @@ endif
let s:flags = get(g:, 'airline#extensions#tagbar#flags', '')
let s:spc = g:airline_symbols.space
let s:init=0
" Arguments: current, sort, fname
function! airline#extensions#tagbar#get_status(...)
@@ -29,7 +30,18 @@ let s:airline_tagbar_last_lookup_time = 0
let s:airline_tagbar_last_lookup_val = ''
function! airline#extensions#tagbar#currenttag()
if get(w:, 'airline_active', 0)
if s:airline_tagbar_last_lookup_time != localtime()
if !s:init
try
" try to load the plugin, if filetypes are disabled,
" this will cause an error, so try only once
let a=tagbar#currenttag('%', '', '')
catch
endtry
unlet! a
let s:init=1
endif
" function tagbar#currenttag does not exist, if filetype is not enabled
if s:airline_tagbar_last_lookup_time != localtime() && exists("*tagbar#currenttag")
let s:airline_tagbar_last_lookup_val = tagbar#currenttag('%s', '', s:flags)
let s:airline_tagbar_last_lookup_time = localtime()
endif
@@ -44,4 +56,3 @@ function! airline#extensions#tagbar#init(ext)
call airline#parts#define_function('tagbar', 'airline#extensions#tagbar#currenttag')
endfunction

View File

@@ -0,0 +1,22 @@
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
function! airline#extensions#term#apply(...)
if &buftype == 'terminal'
let spc = g:airline_symbols.space
call a:1.add_section('airline_a', spc.'TERMINAL'.spc)
call a:1.add_section('airline_b', '')
call a:1.add_section('airline_c', spc.'%f')
call a:1.split()
call a:1.add_section('airline_y', '')
call a:1.add_section('airline_z', spc.airline#section#create_right(['linenr', 'maxlinenr']))
return 1
endif
endfunction
function! airline#extensions#term#init(ext)
call a:ext.add_statusline_func('airline#extensions#term#apply')
endfunction

View File

@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
@@ -25,4 +25,3 @@ function! airline#extensions#tmuxline#set_tmux_colors(palette)
call tmuxline#api#snapshot(s:tmuxline_snapshot_file)
endif
endfunction

View File

@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
@@ -26,4 +26,3 @@ endfunction
function! airline#extensions#undotree#init(ext)
call a:ext.add_statusline_func('airline#extensions#undotree#apply')
endfunction

View File

@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
@@ -14,7 +14,7 @@ function! airline#extensions#unicode#apply(...)
\ 'accent': 'bold' })
let w:airline_section_a = airline#section#create(['unicode'])
let w:airline_section_b = ''
let w:airline_section_c = ''
let w:airline_section_c = ' '
let w:airline_section_y = ''
endif
endfunction

View File

@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
@@ -22,4 +22,3 @@ function! airline#extensions#unite#init(ext)
let g:unite_force_overwrite_statusline = 0
call a:ext.add_statusline_func('airline#extensions#unite#apply')
endfunction

View File

@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2016 Jerome Reybert
" MIT License. Copyright (c) 2016-2018 Jerome Reybert et al.
" vim: et ts=2 sts=2 sw=2
" This plugin replace the whole section_a when in vimagit buffer
@@ -13,14 +13,18 @@ function! airline#extensions#vimagit#init(ext)
endfunction
function! airline#extensions#vimagit#get_mode()
if ( b:magit_current_commit_mode == '' )
return "STAGING"
elseif ( b:magit_current_commit_mode == 'CC' )
return "COMMIT"
elseif ( b:magit_current_commit_mode == 'CA' )
return "AMEND"
else
return "???"
if ( exists("*magit#get_current_mode") )
return magit#get_current_mode()
else
if ( b:magit_current_commit_mode == '' )
return "STAGING"
elseif ( b:magit_current_commit_mode == 'CC' )
return "COMMIT"
elseif ( b:magit_current_commit_mode == 'CA' )
return "AMEND"
else
return "???"
endif
endfunction
function! airline#extensions#vimagit#apply(...)

View File

@@ -1,3 +1,7 @@
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
" vim: et ts=2 sts=2 sw=2
" This plugin replace the whole section_a when in vimagit buffer
scriptencoding utf-8
let s:spc = g:airline_symbols.space
@@ -78,4 +82,3 @@ function! airline#extensions#vimtex#get_scope()
endif
return l:status
endfunction

View File

@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8

View File

@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
" vim: et ts=2 sts=2 sw=2
" http://got-ravings.blogspot.com/2008/10/vim-pr0n-statusline-whitespace-flags.html
@@ -9,18 +9,12 @@ let s:show_message = get(g:, 'airline#extensions#whitespace#show_message', 1)
let s:symbol = get(g:, 'airline#extensions#whitespace#symbol', g:airline_symbols.whitespace)
let s:default_checks = ['indent', 'trailing', 'mixed-indent-file']
let s:trailing_format = get(g:, 'airline#extensions#whitespace#trailing_format', '[%s]trailing')
let s:mixed_indent_format = get(g:, 'airline#extensions#whitespace#mixed_indent_format', '[%s]mixed-indent')
let s:long_format = get(g:, 'airline#extensions#whitespace#long_format', '[%s]long')
let s:mixed_indent_file_format = get(g:, 'airline#extensions#whitespace#mixed_indent_file_format', '[%s]mix-indent-file')
let s:indent_algo = get(g:, 'airline#extensions#whitespace#mixed_indent_algo', 0)
let s:skip_check_ft = {'make': ['indent', 'mixed-indent-file'] }
let s:max_lines = get(g:, 'airline#extensions#whitespace#max_lines', 20000)
let s:enabled = get(g:, 'airline#extensions#whitespace#enabled', 1)
let s:c_like_langs = get(g:, 'airline#extensions#c_like_langs', [ 'c', 'cpp', 'cuda', 'go', 'javascript', 'ld', 'php' ])
let s:skip_check_ft = {'make': ['indent', 'mixed-indent-file'] }
function! s:check_mixed_indent()
if s:indent_algo == 1
let indent_algo = get(g:, 'airline#extensions#whitespace#mixed_indent_algo', 0)
if indent_algo == 1
" [<tab>]<space><tab>
" spaces before or between tabs are not allowed
let t_s_t = '(^\t* +\t\s*\S)'
@@ -28,7 +22,7 @@ function! s:check_mixed_indent()
" count of spaces at the end of tabs should be less than tabstop value
let t_l_s = '(^\t+ {' . &ts . ',}' . '\S)'
return search('\v' . t_s_t . '|' . t_l_s, 'nw')
elseif s:indent_algo == 2
elseif indent_algo == 2
return search('\v(^\t* +\t\s*\S)', 'nw')
else
return search('\v(^\t+ +)|(^ +\t+)', 'nw')
@@ -36,7 +30,9 @@ function! s:check_mixed_indent()
endfunction
function! s:check_mixed_indent_file()
if index(s:c_like_langs, &ft) > -1
let c_like_langs = get(g:, 'airline#extensions#c_like_langs',
\ [ 'c', 'cpp', 'cuda', 'go', 'javascript', 'ld', 'php' ])
if index(c_like_langs, &ft) > -1
" for C-like languages: allow /** */ comment style with one space before the '*'
let head_spc = '\v(^ +\*@!)'
else
@@ -52,7 +48,8 @@ function! s:check_mixed_indent_file()
endfunction
function! airline#extensions#whitespace#check()
if &readonly || !&modifiable || !s:enabled || line('$') > s:max_lines
let max_lines = get(g:, 'airline#extensions#whitespace#max_lines', 20000)
if &readonly || !&modifiable || !s:enabled || line('$') > max_lines
\ || get(b:, 'airline_whitespace_disabled', 0)
return ''
endif
@@ -67,7 +64,7 @@ function! airline#extensions#whitespace#check()
let regexp = get(g:, 'airline#extensions#whitespace#trailing_regexp', '\s$')
let trailing = search(regexp, 'nw')
catch
echomsg 'airline#whitespace: error occured evaluating '. regexp
echomsg 'airline#whitespace: error occurred evaluating '. regexp
echomsg v:exception
return ''
endtry
@@ -100,16 +97,20 @@ function! airline#extensions#whitespace#check()
if s:show_message
if trailing != 0
let b:airline_whitespace_check .= space.printf(s:trailing_format, trailing)
let trailing_fmt = get(g:, 'airline#extensions#whitespace#trailing_format', '[%s]trailing')
let b:airline_whitespace_check .= space.printf(trailing_fmt, trailing)
endif
if mixed != 0
let b:airline_whitespace_check .= space.printf(s:mixed_indent_format, mixed)
let mixed_indent_fmt = get(g:, 'airline#extensions#whitespace#mixed_indent_format', '[%s]mixed-indent')
let b:airline_whitespace_check .= space.printf(mixed_indent_fmt, mixed)
endif
if long != 0
let b:airline_whitespace_check .= space.printf(s:long_format, long)
let long_fmt = get(g:, 'airline#extensions#whitespace#long_format', '[%s]long')
let b:airline_whitespace_check .= space.printf(long_fmt, long)
endif
if !empty(mixed_file)
let b:airline_whitespace_check .= space.printf(s:mixed_indent_file_format, mixed_file)
let mixed_indent_file_fmt = get(g:, 'airline#extensions#whitespace#mixed_indent_file_format', '[%s]mix-indent-file')
let b:airline_whitespace_check .= space.printf(mixed_indent_file_fmt, mixed_file)
endif
endif
endif

View File

@@ -1,3 +1,4 @@
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
@@ -26,4 +27,3 @@ function! airline#extensions#windowswap#get_status()
endif
return ''
endfunction

View File

@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8

View File

@@ -1,9 +1,11 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
function! airline#extensions#wordcount#formatters#default#format()
let fmt = get(g:, 'airline#extensions#wordcount#formatter#default#fmt', '%s words')
let fmt_short = get(g:, 'airline#extensions#wordcount#formatter#default#fmt_short', fmt == '%s words' ? '%sW' : fmt)
let words = string(s:wordcount())
if empty(words)
return
@@ -15,9 +17,9 @@ function! airline#extensions#wordcount#formatters#default#format()
" Format number according to locale, e.g. German: 1.245 or English: 1,245
let words = substitute(words, '\d\@<=\(\(\d\{3\}\)\+\)$', separator.'&', 'g')
endif
let result = printf("%s%s", words, " words"). result
let result = printf(fmt, words). result
else
let result = printf("%s%s", words, "W"). result
let result = printf(fmt_short, words). result
endif
return result
endfunction

View File

@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2017 YoungHoon Rhiu.
" MIT License. Copyright (c) 2017-2018 YoungHoon Rhiu et al.
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
@@ -22,4 +22,3 @@ endfunction
function! airline#extensions#xkblayout#init(ext)
call airline#parts#define_function('xkblayout', 'airline#extensions#xkblayout#status')
endfunction

View File

@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2015 Evgeny Firsov.
" MIT License. Copyright (c) 2015-2018 Evgeny Firsov et al.
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
@@ -35,4 +35,3 @@ function! airline#extensions#ycm#get_warning_count()
return ''
endfunction

View File

@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
@@ -10,6 +10,7 @@ let s:is_win32term = (has('win32') || has('win64')) &&
let s:separators = {}
let s:accents = {}
let s:hl_groups = {}
function! s:gui2cui(rgb, fallback)
if a:rgb == ''
@@ -41,19 +42,35 @@ function! s:get_syn(group, what)
endfunction
function! s:get_array(fg, bg, opts)
let opts=empty(a:opts) ? '' : join(a:opts, ',')
return g:airline_gui_mode ==# 'gui'
\ ? [ a:fg, a:bg, '', '', join(a:opts, ',') ]
\ : [ '', '', a:fg, a:bg, join(a:opts, ',') ]
\ ? [ a:fg, a:bg, '', '', opts ]
\ : [ '', '', a:fg, a:bg, opts ]
endfunction
function! airline#highlighter#reset_hlcache()
let s:hl_groups = {}
endfunction
function! airline#highlighter#get_highlight(group, ...)
let fg = s:get_syn(a:group, 'fg')
let bg = s:get_syn(a:group, 'bg')
let reverse = g:airline_gui_mode ==# 'gui'
\ ? synIDattr(synIDtrans(hlID(a:group)), 'reverse', 'gui')
\ : synIDattr(synIDtrans(hlID(a:group)), 'reverse', 'cterm')
\|| synIDattr(synIDtrans(hlID(a:group)), 'reverse', 'term')
return reverse ? s:get_array(bg, fg, a:000) : s:get_array(fg, bg, a:000)
if get(g:, 'airline_highlighting_cache', 0) && has_key(s:hl_groups, a:group)
return s:hl_groups[a:group]
else
let fg = s:get_syn(a:group, 'fg')
let bg = s:get_syn(a:group, 'bg')
let reverse = g:airline_gui_mode ==# 'gui'
\ ? synIDattr(synIDtrans(hlID(a:group)), 'reverse', 'gui')
\ : synIDattr(synIDtrans(hlID(a:group)), 'reverse', 'cterm')
\|| synIDattr(synIDtrans(hlID(a:group)), 'reverse', 'term')
let bold = synIDattr(synIDtrans(hlID(a:group)), 'bold')
let opts = a:000
if bold
let opts = ['bold']
endif
let res = reverse ? s:get_array(bg, fg, opts) : s:get_array(fg, bg, opts)
endif
let s:hl_groups[a:group] = res
return res
endfunction
function! airline#highlighter#get_highlight2(fg, bg, ...)
@@ -84,14 +101,22 @@ function! airline#highlighter#exec(group, colors)
if len(colors) == 4
call add(colors, '')
endif
if g:airline_gui_mode ==# 'gui'
let new_hi = [colors[0], colors[1], '', '', colors[4]]
else
let new_hi = ['', '', printf("%s", colors[2]), printf("%s", colors[3]), colors[4]]
endif
let colors = s:CheckDefined(colors)
if old_hi != colors || !s:hl_group_exists(a:group)
if old_hi != new_hi || !s:hl_group_exists(a:group)
let cmd = printf('hi %s %s %s %s %s %s %s %s',
\ a:group, s:Get(colors, 0, 'guifg=', ''), s:Get(colors, 1, 'guibg=', ''),
\ s:Get(colors, 2, 'ctermfg=', ''), s:Get(colors, 3, 'ctermbg=', ''),
\ s:Get(colors, 4, 'gui=', ''), s:Get(colors, 4, 'cterm=', ''),
\ s:Get(colors, 4, 'term=', ''))
\ a:group, s:Get(colors, 0, 'guifg='), s:Get(colors, 1, 'guibg='),
\ s:Get(colors, 2, 'ctermfg='), s:Get(colors, 3, 'ctermbg='),
\ s:Get(colors, 4, 'gui='), s:Get(colors, 4, 'cterm='),
\ s:Get(colors, 4, 'term='))
exe cmd
if has_key(s:hl_groups, a:group)
let s:hl_groups[a:group] = colors
endif
endif
endfunction
@@ -127,11 +152,12 @@ function! s:CheckDefined(colors)
return a:colors[0:1] + [fg, bg] + [a:colors[4]]
endfunction
function! s:Get(dict, key, prefix, default)
if get(a:dict, a:key, a:default) isnot# a:default
return a:prefix. get(a:dict, a:key)
else
function! s:Get(dict, key, prefix)
let res=get(a:dict, a:key, '')
if res is ''
return ''
else
return a:prefix. res
endif
endfunction
@@ -197,6 +223,11 @@ function! airline#highlighter#highlight(modes, ...)
let mapped = map(a:modes, 'v:val == a:modes[0] ? v:val : a:modes[0]."_".v:val')
let suffix = a:modes[0] == 'inactive' ? '_inactive' : ''
for mode in mapped
if mode == 'inactive' && winnr('$') == 1
" there exist no inactive windows, don't need to create all those
" highlighting groups
continue
endif
if exists('g:airline#themes#{g:airline_theme}#palette[mode]')
let dict = g:airline#themes#{g:airline_theme}#palette[mode]
for kvp in items(dict)
@@ -234,4 +265,3 @@ function! airline#highlighter#highlight(modes, ...)
endif
endfor
endfunction

View File

@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
@@ -18,13 +18,14 @@ function! airline#init#bootstrap()
let g:airline#init#bootstrapping = 1
let g:airline#util#async = v:version >= 800 && has('job')
let g:airline#util#is_windows = has('win32') || has('win64')
let g:airline#init#vim_async = (v:version >= 800 && has('job'))
let g:airline#init#is_windows = has('win32') || has('win64')
call s:check_defined('g:airline_detect_modified', 1)
call s:check_defined('g:airline_detect_paste', 1)
call s:check_defined('g:airline_detect_crypt', 1)
call s:check_defined('g:airline_detect_spell', 1)
call s:check_defined('g:airline_detect_spelllang', 1)
call s:check_defined('g:airline_detect_iminsert', 0)
call s:check_defined('g:airline_inactive_collapse', 1)
call s:check_defined('g:airline_exclude_filenames', ['DebuggerWatch','DebuggerStack','DebuggerStatus'])
@@ -68,7 +69,8 @@ function! airline#init#bootstrap()
\ 'paste': 'PASTE',
\ 'spell': 'SPELL',
\ 'modified': '+',
\ 'space': ' '
\ 'space': ' ',
\ 'keymap': 'Keymap:'
\ }, 'keep')
if get(g:, 'airline_powerline_fonts', 0)
@@ -148,6 +150,7 @@ function! airline#init#bootstrap()
\ 'neomake_warning_count', 'ale_error_count', 'ale_warning_count'])
call airline#parts#define_text('capslock', '')
call airline#parts#define_text('xkblayout', '')
call airline#parts#define_text('keymap', '')
unlet g:airline#init#bootstrapping
endfunction
@@ -161,7 +164,7 @@ endfunction
function! airline#init#sections()
let spc = g:airline_symbols.space
if !exists('g:airline_section_a')
let g:airline_section_a = airline#section#create_left(['mode', 'crypt', 'paste', 'spell', 'capslock', 'xkblayout', 'iminsert'])
let g:airline_section_a = airline#section#create_left(['mode', 'crypt', 'paste', 'keymap', 'spell', 'capslock', 'xkblayout', 'iminsert'])
endif
if !exists('g:airline_section_b')
let g:airline_section_b = airline#section#create(['hunks', 'branch'])

View File

@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8

View File

@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
@@ -65,7 +65,17 @@ function! airline#parts#paste()
endfunction
function! airline#parts#spell()
return g:airline_detect_spell && &spell ? g:airline_symbols.spell : ''
let spelllang = g:airline_detect_spelllang ? printf(" [%s]", toupper(substitute(&spelllang, ',', '/', 'g'))) : ''
if g:airline_detect_spell && &spell
if winwidth(0) >= 90
return g:airline_symbols.spell . spelllang
elseif winwidth(0) >= 70
return g:airline_symbols.spell
else
return split(g:airline_symbols.spell, '\zs')[0]
endif
endif
return ''
endfunction
function! airline#parts#iminsert()
@@ -76,7 +86,7 @@ function! airline#parts#iminsert()
endfunction
function! airline#parts#readonly()
if &readonly && &modifiable && !filereadable(bufname('%'))
if &readonly && !filereadable(bufname('%'))
return '[noperm]'
else
return &readonly ? g:airline_symbols.readonly : ''

View File

@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
@@ -82,4 +82,3 @@ endfunction
function! airline#section#create_right(parts)
return s:create(a:parts, -1)
endfunction

View File

@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
@@ -44,6 +44,10 @@ function! airline#themes#patch(palette)
if !has_key(a:palette[mode], 'airline_error')
let a:palette[mode]['airline_error'] = [ '#000000', '#990000', 232, 160 ]
endif
if !has_key(a:palette[mode], 'airline_term')
"let a:palette[mode]['airline_term'] = [ '#9cffd3', '#202020', 85, 232]
let a:palette[mode]['airline_term'] = airline#highlighter#get_highlight('airline_c')
endif
endfor
let a:palette.accents = get(a:palette, 'accents', {})
@@ -70,4 +74,3 @@ function! airline#themes#patch(palette)
let a:palette.accents.purple = [ '#af00df' , '' , 128 , '' ]
endif
endfunction

View File

@@ -1,39 +1,92 @@
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
" vim: et ts=2 sts=2 sw=2 tw=80
scriptencoding utf-8
" Each theme is contained in its own file and declares variables scoped to the
" file. These variables represent the possible "modes" that airline can
" detect. The mode is the return value of mode(), which gets converted to a
" readable string. The following is a list currently supported modes: normal,
" insert, replace, visual, and inactive.
" Airline themes are generated based on the following concepts:
" * The section of the status line, valid Airline statusline sections are:
" * airline_a (left most section)
" * airline_b (section just to the right of airline_a)
" * airline_c (section just to the right of airline_b)
" * airline_x (first section of the right most sections)
" * airline_y (section just to the right of airline_x)
" * airline_z (right most section)
" * The mode of the buffer, as reported by the :mode() function. Airline
" converts the values reported by mode() to the following:
" * normal
" * insert
" * replace
" * visual
" * inactive
" The last one is actually no real mode as returned by mode(), but used by
" airline to style inactive statuslines (e.g. windows, where the cursor
" currently does not reside in).
" * In addition to each section and mode specified above, airline themes
" can also specify overrides. Overrides can be provided for the following
" scenarios:
" * 'modified'
" * 'paste'
"
" Each mode can also have overrides. These are small changes to the mode that
" don't require a completely different look. "modified" and "paste" are two
" such supported overrides. These are simply suffixed to the major mode,
" separated by an underscore. For example, "normal_modified" would be normal
" mode where the current buffer is modified.
" Airline themes are specified as a global viml dictionary using the above
" sections, modes and overrides as keys to the dictionary. The name of the
" dictionary is significant and should be specified as:
" * g:airline#themes#<theme_name>#palette
" where <theme_name> is substituted for the name of the theme.vim file where the
" theme definition resides. Airline themes should reside somewhere on the
" 'runtimepath' where it will be loaded at vim startup, for example:
" * autoload/airline/themes/theme_name.vim
"
" The theming algorithm is a 2-pass system where the mode will draw over all
" parts of the statusline, and then the override is applied after. This means
" it is possible to specify a subset of the theme in overrides, as it will
" simply overwrite the previous colors. If you want simultaneous overrides,
" then they will need to change different parts of the statusline so they do
" not conflict with each other.
"
" First, let's define an empty dictionary and assign it to the "palette"
" variable. The # is a separator that maps with the directory structure. If
" you get this wrong, Vim will complain loudly.
" For this, the dark.vim, theme, this is defined as
let g:airline#themes#dark#palette = {}
" First let's define some arrays. The s: is just a VimL thing for scoping the
" variables to the current script. Without this, these variables would be
" declared globally. Now let's declare some colors for normal mode and add it
" to the dictionary. The array is in the format:
" [ guifg, guibg, ctermfg, ctermbg, opts ]. See "help attr-list" for valid
" values for the "opt" value.
let s:N1 = [ '#00005f' , '#dfff00' , 17 , 190 ]
let s:N2 = [ '#ffffff' , '#444444' , 255 , 238 ]
let s:N3 = [ '#9cffd3' , '#202020' , 85 , 234 ]
let g:airline#themes#dark#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3)
" Keys in the dictionary are composed of the mode, and if specified the
" override. For example:
" * g:airline#themes#dark#palette.normal
" * the colors for a statusline while in normal mode
" * g:airline#themes#dark#palette.normal_modified
" * the colors for a statusline while in normal mode when the buffer has
" been modified
" * g:airline#themes#dark#palette.visual
" * the colors for a statusline while in visual mode
"
" Values for each dictionary key is an array of color values that should be
" familiar for colorscheme designers:
" * [guifg, guibg, ctermfg, ctermbg, opts]
" See "help attr-list" for valid values for the "opt" value.
"
" Each theme must provide an array of such values for each airline section of
" the statusline (airline_a through airline_z). A convenience function,
" airline#themes#generate_color_map() exists to mirror airline_a/b/c to
" airline_x/y/z, respectively.
" The dark.vim theme:
let s:airline_a_normal = [ '#00005f' , '#dfff00' , 17 , 190 ]
let s:airline_b_normal = [ '#ffffff' , '#444444' , 255 , 238 ]
let s:airline_c_normal = [ '#9cffd3' , '#202020' , 85 , 234 ]
let g:airline#themes#dark#palette.normal = airline#themes#generate_color_map(s:airline_a_normal, s:airline_b_normal, s:airline_c_normal)
" It should be noted the above is equivalent to:
" let g:airline#themes#dark#palette.normal = airline#themes#generate_color_map(
" \ [ '#00005f' , '#dfff00' , 17 , 190 ], " section airline_a
" \ [ '#ffffff' , '#444444' , 255 , 238 ], " section airline_b
" \ [ '#9cffd3' , '#202020' , 85 , 234 ] " section airline_c
" \)
"
" In turn, that is equivalent to:
" let g:airline#themes#dark#palette.normal = {
" \ 'airline_a': [ '#00005f' , '#dfff00' , 17 , 190 ], "section airline_a
" \ 'airline_b': [ '#ffffff' , '#444444' , 255 , 238 ], "section airline_b
" \ 'airline_c': [ '#9cffd3' , '#202020' , 85 , 234 ], "section airline_c
" \ 'airline_x': [ '#9cffd3' , '#202020' , 85 , 234 ], "section airline_x
" \ 'airline_y': [ '#ffffff' , '#444444' , 255 , 238 ], "section airline_y
" \ 'airline_z': [ '#00005f' , '#dfff00' , 17 , 190 ] "section airline_z
" \}
"
" airline#themes#generate_color_map() also uses the values provided as
" parameters to create intermediary groups such as:
" airline_a_to_airline_b
" airline_b_to_airline_c
" etc...
" Here we define overrides for when the buffer is modified. This will be
" applied after g:airline#themes#dark#palette.normal, hence why only certain keys are
@@ -43,36 +96,36 @@ let g:airline#themes#dark#palette.normal_modified = {
\ }
let s:I1 = [ '#00005f' , '#00dfff' , 17 , 45 ]
let s:I2 = [ '#ffffff' , '#005fff' , 255 , 27 ]
let s:I3 = [ '#ffffff' , '#000080' , 15 , 17 ]
let g:airline#themes#dark#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3)
let s:airline_a_insert = [ '#00005f' , '#00dfff' , 17 , 45 ]
let s:airline_b_insert = [ '#ffffff' , '#005fff' , 255 , 27 ]
let s:airline_c_insert = [ '#ffffff' , '#000080' , 15 , 17 ]
let g:airline#themes#dark#palette.insert = airline#themes#generate_color_map(s:airline_a_insert, s:airline_b_insert, s:airline_c_insert)
let g:airline#themes#dark#palette.insert_modified = {
\ 'airline_c': [ '#ffffff' , '#5f005f' , 255 , 53 , '' ] ,
\ }
let g:airline#themes#dark#palette.insert_paste = {
\ 'airline_a': [ s:I1[0] , '#d78700' , s:I1[2] , 172 , '' ] ,
\ 'airline_a': [ s:airline_a_insert[0] , '#d78700' , s:airline_a_insert[2] , 172 , '' ] ,
\ }
let g:airline#themes#dark#palette.replace = copy(g:airline#themes#dark#palette.insert)
let g:airline#themes#dark#palette.replace.airline_a = [ s:I2[0] , '#af0000' , s:I2[2] , 124 , '' ]
let g:airline#themes#dark#palette.replace.airline_a = [ s:airline_b_insert[0] , '#af0000' , s:airline_b_insert[2] , 124 , '' ]
let g:airline#themes#dark#palette.replace_modified = g:airline#themes#dark#palette.insert_modified
let s:V1 = [ '#000000' , '#ffaf00' , 232 , 214 ]
let s:V2 = [ '#000000' , '#ff5f00' , 232 , 202 ]
let s:V3 = [ '#ffffff' , '#5f0000' , 15 , 52 ]
let g:airline#themes#dark#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3)
let s:airline_a_visual = [ '#000000' , '#ffaf00' , 232 , 214 ]
let s:airline_b_visual = [ '#000000' , '#ff5f00' , 232 , 202 ]
let s:airline_c_visual = [ '#ffffff' , '#5f0000' , 15 , 52 ]
let g:airline#themes#dark#palette.visual = airline#themes#generate_color_map(s:airline_a_visual, s:airline_b_visual, s:airline_c_visual)
let g:airline#themes#dark#palette.visual_modified = {
\ 'airline_c': [ '#ffffff' , '#5f005f' , 255 , 53 , '' ] ,
\ }
let s:IA1 = [ '#4e4e4e' , '#1c1c1c' , 239 , 234 , '' ]
let s:IA2 = [ '#4e4e4e' , '#262626' , 239 , 235 , '' ]
let s:IA3 = [ '#4e4e4e' , '#303030' , 239 , 236 , '' ]
let g:airline#themes#dark#palette.inactive = airline#themes#generate_color_map(s:IA1, s:IA2, s:IA3)
let s:airline_a_inactive = [ '#4e4e4e' , '#1c1c1c' , 239 , 234 , '' ]
let s:airline_b_inactive = [ '#4e4e4e' , '#262626' , 239 , 235 , '' ]
let s:airline_c_inactive = [ '#4e4e4e' , '#303030' , 239 , 236 , '' ]
let g:airline#themes#dark#palette.inactive = airline#themes#generate_color_map(s:airline_a_inactive, s:airline_b_inactive, s:airline_c_inactive)
let g:airline#themes#dark#palette.inactive_modified = {
\ 'airline_c': [ '#875faf' , '' , 97 , '' , '' ] ,
\ }

View File

@@ -1,6 +1,9 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
" vim: et ts=2 sts=2 sw=2
" TODO: Try to cache winwidth(0) function
" e.g. store winwidth per window and access that, only update it, if the size
" actually changed.
scriptencoding utf-8
call airline#init#bootstrap()
@@ -83,31 +86,3 @@ else
return 0
endfunction
endif
" Define a wrapper over system() that uses nvim's async job control if
" available. This way we avoid overwriting v:shell_error, which might
" potentially disrupt other plugins.
if has('nvim')
function! s:system_job_handler(job_id, data, event) dict
if a:event == 'stdout'
let self.buf .= join(a:data)
endif
endfunction
function! airline#util#system(cmd)
let l:config = {
\ 'buf': '',
\ 'on_stdout': function('s:system_job_handler'),
\ }
let l:id = jobstart(a:cmd, l:config)
if l:id < 1
return system(a:cmd)
endif
call jobwait([l:id])
return l:config.buf
endfunction
else
function! airline#util#system(cmd)
return system(a:cmd)
endfunction
endif

View File

@@ -32,9 +32,8 @@ INTRODUCTION *airline-intro*
vim-airline is a fast and lightweight alternative to powerline, written
in 100% vimscript with no outside dependencies.
When the plugin is correctly loaded, and Vim is configured for drawing a
'statusline' (set 'laststatus' to 2, to always display the airline
statusline) Vim will draw a nice statusline at the bottom of each window.
When the plugin is correctly loaded, Vim will draw a nice statusline at the
bottom of each window.
That line consists of several sections, each one displaying some piece of
information. By default (without configuration) this line will look like this: >
@@ -131,6 +130,10 @@ values):
* enable spell detection >
let g:airline_detect_spell=1
* display spelling language when spell detection is enabled
(if enough space is available) >
let g:airline_detect_spelllang=1
<
* enable iminsert detection >
let g:airline_detect_iminsert=0
@@ -207,6 +210,10 @@ values):
the same name (in the correct window): >
let w:airline_skip_empty_sections = 0
<
* Caches the changes to the highlighting groups, should therefore be faster.
Set this to one, if you experience a sluggish Vim: >
let g:airline_highlighting_cache = 0
<
==============================================================================
COMMANDS *airline-commands*
@@ -253,11 +260,12 @@ its contents. >
let g:airline_right_sep = '«'
let g:airline_right_sep = '◀'
let g:airline_symbols.crypt = '🔒'
let g:airline_symbols.linenr = '☰'
let g:airline_symbols.linenr = '␊'
let g:airline_symbols.linenr = '␤'
let g:airline_symbols.linenr = '¶'
let g:airline_symbols.maxlinenr = '☰'
let g:airline_symbols.maxlinenr = ''
let g:airline_symbols.maxlinenr = '㏑'
let g:airline_symbols.branch = '⎇'
let g:airline_symbols.paste = 'ρ'
let g:airline_symbols.paste = 'Þ'
@@ -273,7 +281,8 @@ its contents. >
let g:airline_right_alt_sep = ''
let g:airline_symbols.branch = ''
let g:airline_symbols.readonly = ''
let g:airline_symbols.linenr = ''
let g:airline_symbols.linenr = ''
let g:airline_symbols.maxlinenr = ''
" old vim-powerline symbols
let g:airline_left_sep = '⮀'
@@ -297,7 +306,7 @@ section.
variable names default contents
----------------------------------------------------------------------------
let g:airline_section_a (mode, crypt, paste, spell, iminsert)
let g:airline_section_b (hunks, branch)
let g:airline_section_b (hunks, branch)[*]
let g:airline_section_c (bufferline or filename)
let g:airline_section_gutter (readonly, csv)
let g:airline_section_x (tagbar, filetype, virtualenv)
@@ -306,6 +315,9 @@ section.
let g:airline_section_error (ycm_error_count, syntastic-err, eclim)
let g:airline_section_warning (ycm_warning_count, syntastic-warn, whitespace)
" [*] This section needs at least the fugitive extension or else
" it will remain empty
"
" here is an example of how you could replace the branch indicator with
" the current working directory (limited to 10 characters),
" followed by the filename.
@@ -391,6 +403,13 @@ vim-bufferline <https://github.com/bling/vim-bufferline>
* determine whether bufferline will overwrite customization variables >
let g:airline#extensions#bufferline#overwrite_variables = 1
<
------------------------------------- *airline-fugitiveline*
This extension hides the fugitive://**// part of the buffer names, to only
show the file name as if it were in the current working tree.
* enable/disable bufferline integration >
let g:airline#extensions#fugitiveline#enabled = 1
<
------------------------------------- *airline-branch*
vim-airline will display the branch-indicator together with the branch name in
@@ -437,6 +456,9 @@ notexists symbol will be displayed after the branch name.
return '[' . a:name . ']'
endfunction
<
* truncate sha1 commits at this number of characters >
let g:airline#extensions#branch#sha1_len = 10
<
------------------------------------- *airline-syntastic*
syntastic <https://github.com/vim-syntastic/syntastic>
@@ -450,9 +472,15 @@ syntastic <https://github.com/vim-syntastic/syntastic>
* syntastic error_symbol >
let airline#extensions#syntastic#error_symbol = 'E:'
<
* syntastic statusline error format (see |syntastic_stl_format|) >
let airline#extensions#syntastic#stl_format_err = '%E{[%e(#%fe)]}'
* syntastic warning >
let airline#extensions#syntastic#warning_symbol = 'W:'
<
* syntastic statusline warning format (see |syntastic_stl_format|) >
let airline#extensions#syntastic#stl_format_err = '%W{[%w(#%fw)]}'
<
------------------------------------- *airline-tagbar*
tagbar <https://github.com/majutsushi/tagbar>
@@ -497,7 +525,7 @@ vimagit <https://github.com/jreybert/vimagit>
let g:airline#extensions#vimagit#enabled = 1
<
------------------------------------- *airline-ctrlp*
ctrlp <https://github.com/kien/ctrlp.vim>
ctrlp <https://github.com/ctrlpvim/ctrlp.vim>
* configure which mode colors should ctrlp window use (takes effect
only if the active airline theme doesn't define ctrlp colors) >
@@ -543,14 +571,18 @@ eclim <https://eclim.org>
" create a file in the dir autoload/airline/extensions/wordcount/formatters/
" called foo.vim
" this example needs at least Vim > 7.4.1042
function! airline#extensions#wordcount#formatters#foo#format()
function! airline#extensions#wordcount#formatters#foo#format(format,fmt)
return (wordcount()['words'] == 0 ? 'NONE' :
\ wordcount()['words'] > 100 ? 'okay' : 'not enough')
endfunction
let g:airline#extensions#wordline#formatter = 'foo'
* defines how to display the wordcount statistics: >
let g:airline#extensions#wordcount#format = '%d words'
* defines how to display the wordcount statistics for the default formatter: >
" Defaults are below. If fmt_short isn't defined, fmt is used.
" '%s' will be substituted by the word count
" fmt_short is displayed when window width is less than 80
let g:airline#extensions#wordcount#formatter#default#fmt = '%s words'
let g:airline#extensions#wordcount#formatter#default#fmt_short = '%sW'
<
------------------------------------- *airline-whitespace*
* enable/disable detection of whitespace errors. >
@@ -618,25 +650,32 @@ eclim <https://eclim.org>
Note: If you're using the ctrlspace tabline only the option marked with (c)
are supported!
* enable/disable enhanced tabline. (c)
* enable/disable enhanced tabline. (c) >
let g:airline#extensions#tabline#enabled = 0
* enable/disable displaying open splits per tab (only when tabs are opened). >
let g:airline#extensions#tabline#show_splits = 1
*
* switch position of buffers and tabs on splited tabline (c)
(only supported for ctrlspace plugin). >
let g:airline#extensions#tabline#switch_buffers_and_tabs = 0
<
* enable/disable displaying buffers with a single tab. (c)
* enable/disable displaying buffers with a single tab. (c) >
let g:airline#extensions#tabline#show_buffers = 1
<
Note: If you are using neovim (has('tablineat') = 1), then you can click
on the tabline with the left mouse button to switch to that buffer, and
with the middle mouse button to delete that buffer.
* enable/disable displaying tabs, regardless of number. (c)
* if you want to show the current active buffer like this:
----------------------
buffer <buffer> buffer `
>
let g:airline#extensions#tabline#alt_sep = 1
< Only makes sense, if g:airline_right_sep is not empty.
default: 0
* enable/disable displaying tabs, regardless of number. (c) >
let g:airline#extensions#tabline#show_tabs = 1
<
* configure filename match rules to exclude from the tabline. >
@@ -649,22 +688,30 @@ with the middle mouse button to delete that buffer.
let g:airline#extensions#tabline#tab_nr_type = 0 " # of splits (default)
let g:airline#extensions#tabline#tab_nr_type = 1 " tab number
let g:airline#extensions#tabline#tab_nr_type = 2 " splits and tab number
let g:airline#extensions#tabline#tabnr_formatter = 'tabnr'
Note: last option can be used to specify a different formatter for
displaying the numbers. By default tabline/formatter/tabnr.vim is used
<
* enable/disable displaying tab number in tabs mode. >
let g:airline#extensions#tabline#show_tab_nr = 1
* enable/disable displaying tab type (far right) >
* enable/disable displaying tab type (e.g. [buffers]/[tabs]) >
let g:airline#extensions#tabline#show_tab_type = 1
Note: The tab-type will only be displayed in tab-mode,
if there are no splits shown. (See: g:airline#extensions#tabline#show_splits)
* show buffer label at first position: >
let g:airline#extensions#tabline#buf_label_first = 1
* rename label for buffers (default: 'buffers') (c)
* rename label for buffers (default: 'buffers') (c) >
let g:airline#extensions#tabline#buffers_label = 'b'
* rename label for tabs (default: 'tabs') (c)
* rename label for tabs (default: 'tabs') (c) >
let g:airline#extensions#tabline#tabs_label = 't'
* always show current tabpage/buffer first >
let airline#extensions#tabline#current_first = 1
< default: 0
* enable/disable displaying index of the buffer.
When enabled, numbers will be displayed in the tabline and mappings will be
@@ -683,14 +730,17 @@ with the middle mouse button to delete that buffer.
nmap <leader>9 <Plug>AirlineSelectTab9
nmap <leader>- <Plug>AirlineSelectPrevTab
nmap <leader>+ <Plug>AirlineSelectNextTab
Note: Mappings will be ignored within a NERDTree buffer.
<
Note: Mappings will be ignored within "g:airline#extensions#tabline#keymap_ignored_filetypes".
Note: In buffer_idx_mode these mappings won't change the
current tab, but switch to the buffer visible in that tab.
Use |gt| for switching tabs.
In tabmode, those mappings will switch to the specified tab.
* define the set of filetypes which are ignored selectTab keymappings >
let g:airline#extensions#tabline#keymap_ignored_filetypes = ['vimfiler', 'nerdtree']
* change the display format of the buffer index >
let g:airline#extensions#tabline#buffer_idx_format = {
\ '0': '0 ',
@@ -706,7 +756,7 @@ with the middle mouse button to delete that buffer.
\}
<
* defines the name of a formatter for how buffer names are displayed. (c)
* defines the name of a formatter for how buffer names are displayed. (c) >
let g:airline#extensions#tabline#formatter = 'default'
" here is how you can define a 'foo' formatter:
@@ -718,7 +768,7 @@ with the middle mouse button to delete that buffer.
let g:airline#extensions#tabline#formatter = 'foo'
<
Note: the following variables are only used by the 'default' formatter.
Note: the following variables are used by the 'default' formatter.
When no disambiguation is needed, both 'unique_tail_improved' and
'unique_tail' delegate formatting to 'default', so these variables also
control rendering of unique filenames when using these formatters.
@@ -743,6 +793,12 @@ with the middle mouse button to delete that buffer.
" with the containing parent directory.
let g:airline#extensions#tabline#formatter = 'unique_tail'
" The following variables are also used by `unique_tail` formatter.
" the meanings are the same as the ones in default formatter.
let g:airline#extensions#tabline#fnamemod = ':p:.'
let g:airline#extensions#tabline#fnamecollapse = 1
" The `unique_tail_improved` - another algorithm, that will smartly uniquify
" buffers names with similar filename, suppressing common parts of paths.
let g:airline#extensions#tabline#formatter = 'unique_tail_improved'
@@ -771,7 +827,7 @@ with the middle mouse button to delete that buffer.
let g:airline#extensions#tabline#close_symbol = 'X'
* configure pattern to be ignored on BufAdd autocommand >
" fixes unneccessary redraw, when e.g. opening Gundo window
" fixes unnecessary redraw, when e.g. opening Gundo window
let airline#extensions#tabline#ignore_bufadd_pat =
\ '\c\vgundo|undotree|vimfiler|tagbar|nerd_tree'
@@ -783,7 +839,6 @@ Note: Enabling this extension will modify 'showtabline' and 'guioptions'.
let airline#extensions#tabline#disable_refresh = 0
* preserve windows when closing a buffer from the bufferline (default: 0) >
let airline#extensions#tabline#middle_click_preserves_windows = 1
<
------------------------------------- *airline-tmuxline*
@@ -842,11 +897,18 @@ vim-xkblayout
let g:airline#extensions#xkblayout#enabled = 1
* define path to the backend switcher library
Linux (Install https://github.com/ierton/xkb-switch):
Linux (Install https://github.com/ierton/xkb-switch): >
let g:XkbSwitchLib = '/usr/local/lib/libxkbswitch.so'
macOS (Install https://github.com/vovkasm/input-source-switcher):
<
macOS (Install https://github.com/vovkasm/input-source-switcher): >
let g:XkbSwitchLib = '/usr/local/lib/libInputSourceSwitcher.dylib'
------------------------------------- *airline-keymap*
vim-keymap
* enable/disable vim-keymap extension >
let g:airline#extensions#keymap#enabled = 1
------------------------------------- *airline-windowswap*
vim-windowswap <https://github.com/wesQ3/vim-windowswap>
@@ -914,30 +976,30 @@ Shows the current file's vimtex related info.
* enable/disable vimtex integration >
let g:airline#extensions#vimtex#enabled = 1
<
* left and right delimiters (shown only when status string is not empty)
* left and right delimiters (shown only when status string is not empty) >
let g:airline#extensions#vimtex#left = "{"
let g:airline#extensions#vimtex#right = "}"
State indicators:
* the current tex file is the main project file (nothing is shown by default)
* the current tex file is the main project file (nothing is shown by default) >
let g:airline#extensions#vimtex#main = ""
* the current tex file is a subfile of the project
and the compilation is set for the main file
* the current tex file is a subfile of the project
and the compilation is set for the main file >
let g:airline#extensions#vimtex#sub_main = "m"
* the current tex file is a subfile of the project
and the compilation is set for this subfile
and the compilation is set for this subfile >
let g:airline#extensions#vimtex#sub_local = "l"
* single compilation is running
* single compilation is running >
let g:airline#extensions#vimtex#compiled = "c₁"
* continuousr compilation is running
* continuousr compilation is running >
let g:airline#extensions#vimtex#continuous = "c"
* viewer is opened
* viewer is opened >
let g:airline#extensions#vimtex#viewer = "v"
------------------------------------- *airline-ale*
@@ -952,6 +1014,12 @@ ale <https://github.com/w0rp/ale>
* ale warning >
let airline#extensions#ale#warning_symbol = 'W:'
<
* ale open_lnum_symbol >
let airline#extensions#ale#open_lnum_symbol = '(L'
<
* ale close_lnum_symbol >
let airline#extensions#ale#close_lnum_symbol = ')'
<
------------------------------------- *airline-neomake*
neomake <https://github.com/neomake/neomake>
@@ -964,6 +1032,15 @@ neomake <https://github.com/neomake/neomake>
* neomake warning >
let airline#extensions#neomake#warning_symbol = 'W:'
<
------------------------------------- *airline-cursormode*
cursormode <https://github.com/vheon/vim-cursormode>
Displays cursor in different colors depending on the current mode (only works
in terminals iTerm, AppleTerm and xterm)
* enable cursormode integration >
let g:airline#extensions#cursormode#enabled = 1
==============================================================================
ADVANCED CUSTOMIZATION *airline-advanced-customization*
@@ -1010,7 +1087,7 @@ Before is a list of parts that are predefined by vim-airline.
* `file` displays the filename and modified indicator
* `path` displays the filename (absolute path) and modifier indicator
* `linenr` displays the current line number
* `maxlinenr` dispalys the number of lines in the buffer
* `maxlinenr` displays the number of lines in the buffer
* `ffenc` displays the file format and encoding
And the following are defined for their respective extensions:
@@ -1228,6 +1305,9 @@ A. Themes have been extracted into the vim-airlines-themes repository. Simply
clone https://github.com/vim-airline/vim-airline-themes and everything
should work again.
Q. Performance is bad
A. Check the question at the wiki:
https://github.com/vim-airline/vim-airline/wiki/FAQ#i-have-a-performance-problem
Solutions to other common problems can be found in the Wiki:
<https://github.com/vim-airline/vim-airline/wiki/FAQ>

View File

@@ -1,4 +1,4 @@
" MIT License. Copyright (c) 2013-2016 Bailey Ling.
" MIT License. Copyright (c) 2013-2018 Bailey Ling et al.
" vim: et ts=2 sts=2 sw=2
scriptencoding utf-8
@@ -57,6 +57,7 @@ endfunction
function! s:on_colorscheme_changed()
call s:init()
unlet! g:airline#highlighter#normal_fg_hi
call airline#highlighter#reset_hlcache()
let g:airline_gui_mode = airline#init#gui_mode()
if !s:theme_in_vimrc
call airline#switch_matching_theme()
@@ -80,6 +81,7 @@ function! s:airline_toggle()
if exists("s:stl")
let &stl = s:stl
endif
call airline#highlighter#reset_hlcache()
silent doautocmd User AirlineToggledOff
else
@@ -93,6 +95,8 @@ function! s:airline_toggle()
autocmd CmdwinLeave * call airline#remove_statusline_func('airline#cmdwinenter')
autocmd GUIEnter,ColorScheme * call <sid>on_colorscheme_changed()
" Refresh airline for :syntax off
autocmd SourcePre */syntax/*syntax.vim call <sid>airline_refresh()
autocmd VimEnter,WinEnter,BufWinEnter,FileType,BufUnload *
\ call <sid>on_window_changed()
if exists('#CompleteDone')
@@ -106,6 +110,9 @@ function! s:airline_toggle()
\ | call airline#load_theme()
augroup END
if &laststatus < 2
set laststatus=2
endif
if s:airline_initialized
call s:on_window_changed()
endif
@@ -137,6 +144,7 @@ function! s:airline_refresh()
let nomodeline = '<nomodeline>'
endif
exe printf("silent doautocmd %s User AirlineBeforeRefresh", nomodeline)
call airline#highlighter#reset_hlcache()
call airline#load_theme()
call airline#update_statusline()
endfunction

View File

@@ -19,6 +19,7 @@ describe 'active builder'
end
it 'should reuse highlight group if background colors match'
call airline#highlighter#reset_hlcache()
highlight Foo1 ctermfg=1 ctermbg=2
highlight Foo2 ctermfg=1 ctermbg=2
call s:builder.add_section('Foo1', 'hello')
@@ -28,6 +29,7 @@ describe 'active builder'
end
it 'should switch highlight groups if foreground colors differ'
call airline#highlighter#reset_hlcache()
highlight Foo1 ctermfg=1 ctermbg=2
highlight Foo2 ctermfg=2 ctermbg=2
call s:builder.add_section('Foo1', 'hello')

View File

@@ -5,6 +5,7 @@ describe 'themes'
end
it 'should extract correct colors'
call airline#highlighter#reset_hlcache()
highlight Foo ctermfg=1 ctermbg=2
let colors = airline#themes#get_highlight('Foo')
Expect colors[2] == '1'
@@ -12,6 +13,7 @@ describe 'themes'
end
it 'should extract from normal if colors unavailable'
call airline#highlighter#reset_hlcache()
highlight Normal ctermfg=100 ctermbg=200
highlight Foo ctermbg=2
let colors = airline#themes#get_highlight('Foo')
@@ -20,6 +22,7 @@ describe 'themes'
end
it 'should flip target group if it is reversed'
call airline#highlighter#reset_hlcache()
highlight Foo ctermbg=222 ctermfg=103 term=reverse
let colors = airline#themes#get_highlight('Foo')
Expect colors[2] == '222'
@@ -27,6 +30,8 @@ describe 'themes'
end
it 'should pass args through correctly'
call airline#highlighter#reset_hlcache()
hi clear Normal
let hl = airline#themes#get_highlight('Foo', 'bold', 'italic')
Expect hl == ['', '', 'NONE', 'NONE', 'bold,italic']