Commit Graph

137 Commits

Author SHA1 Message Date
David Briscoe dd247a0f85 branch: ignore upcoming FocusGained when updating
closes #2029

airline#util#focusgain(1) was called too soon -- it's called before vim
loses focus and not after it gains focus. Instead, we ignore the next
FocusGained event.
2020-01-28 12:01:09 -08:00
Christian Brabandt f4795532c6
branch: disable FocusGained handler when updating fugitive information
closes #2029
2020-01-28 15:54:53 +01:00
kazukazuinaina cf6dcf5e19 update license's year in vim-airline 2020-01-06 11:22:49 +09:00
kazukazuinaina be85daa23f fix untrack branch check about gina 2019-12-19 15:43:50 +09:00
kazukazuinaina d4e2bfe892 add try catch in gina.vim's extension in branch.vim 2019-12-15 23:08:31 +09:00
kazukazuinaina f8e1f85fde add gina support for vim-airline's branch
add check gina in util.vim

fix typo

add gina check

fix typo

add gina.vim's url in doc

fix typo

delete v:version > 800

fix error
2019-12-14 04:10:46 +09:00
Christian Brabandt 664426be21
doc: mention all supported plugins
Also, in the extensions mention the required vim plugin
2019-11-08 20:18:04 +01:00
Christian Brabandt d848de4918
branch: remove double '.' for string concatenation
fixes #1961
2019-08-22 07:56:51 +02:00
Kai Moschcau 3f82d3a975
Improve multibyte character handling in branch ext
This fixes a bug that causes a mangled statusline. The bug occurs, when
the `displayed_head_limit` variable is set and causes the substring
expression to take a substring, which ends in the middle of a multi-byte
character.

This patch replaces the byte-based methods for measuring the
length of the branch name and creating a substring with methods that are
character-based and multi-byte aware.

It also has the nice side effect of making the length measuring more
accurate, by taking the actual display width of multi-byte characters
and the ambiwidth setting into account.

Since we need to take into account older Vim 7.4 (which might not have
the strcharpart() function), do introduce a compatibility wrapper in
airline#util that checks for the existence of the function before using
it. Older Vims will keep on using the byte-based index. I suppose Vim
7.4 before the strcharpart() function was available (patch 7.4.1730)
shouldn't be in use anymore.

closes #1948
2019-08-20 14:21:10 +02:00
Christian Brabandt 79f91649b6
branch: Check untracked and dirty only wehn the fugitive/lawrencium plugins are installed 2019-05-08 13:57:25 +02:00
Christian Brabandt a26a460698
branch: configure what additional checks to run
Allow to customize, whether to check the untracked status of a file or
whether the current repository is clean.

fixes #1910
2019-05-02 08:14:57 +02:00
Christian Brabandt d1e82c71a3
branch: check existence of dirty key before accessing it
closes #1907
2019-04-30 16:33:05 +02:00
Christian Brabandt 9c1486522a
branch: ignore submodules for git when determing clean state 2019-04-25 08:47:05 +02:00
Christian Brabandt 1297773a26
branch: skip untracked files for clean state 2019-04-25 07:35:41 +02:00
Christian Brabandt a8b0c5f760
branch: skip for non-empty &buftype buffers 2019-04-25 07:32:13 +02:00
Christian Brabandt 9f193de600
branch: Remove spurious dirty var 2019-04-24 15:51:43 +02:00
Christian Brabandt 3ac318bfd3
fugitive: replace old buffer().commit() function by new global function
as requested by the exception thrown:
fugitive: A third-party plugin or vimrc is calling
fugitive#buffer().commit() which has been removed. Replace it with
matchstr(FugitiveParse()[0], '^\x\+')
2019-04-24 15:29:51 +02:00
Christian Brabandt 9112675ad8
branch: display dirty state
If the repository is considered dirty, do display the
g:airline_symbols.dirty symbol right after the branch name.
2019-04-24 15:16:57 +02:00
Christian Brabandt 941341d085
branch: simplify async logic a bit 2019-04-24 13:25:31 +02:00
Christian Brabandt c8a36e14e9
Updated Copyright Statements 2019-03-25 12:29:47 +01:00
Max Nordlund gmail 61ca196d73
Move formatting of branch name into get_head
This allows for advanced customization where the shortening of the
branch name is up to the caller, unlike before.

This change is observable from the outside, and as such can be
dangerous. But AFAIK it does not change the default behavior.
2019-02-21 11:59:04 +01:00
Max Nordlund gmail 45ff435378
Honor minwidth for `hunks` and `branch` parts
This removes the hardcoded minwidth limits for both the `hunks` and
`branch` parts. It replaces these with safe accesses to the `minwidth`
setting as done by `airline#parts#define_minwidth`.
2019-02-20 12:36:40 +01:00
Christian Brabandt fd5bde1a3a
allow to show the statusline on top
This is an experimental feature that allows to display the statusline in
the tabline. It might still be a bit rough, but seems to work so far.

Remaining problem:
- Mode changes are not immediately detected, only after moving the
  cursor

fixes #1388
closes #1867
2019-02-03 17:30:55 +01:00
Christian Brabandt 4f95970228
branch: use :noa before calling async func
for some reasons, calling async functions might cause an error, if a
SourcePre command has been defined. So explicitly call the functions
using `:noa` modifier to prevent triggering the SourcePre autocommand.

fixes #1742
2018-06-11 14:45:29 +02:00
Christian Brabandt 981b83003f
fugitive: Use FugitiveHead() instead of fugitive#head
function if possible and use it instead of the fugitive#head
(which will always autload the fugitive plugin).
2018-06-04 18:32:30 +02:00
Christian Brabandt 30a3c4f549
branch: fugitive renamed its functions
this caused that the branch extension was not correctly working anymore
because of a refactoring of fugitive tpope/vim-fugitive@5d11ff7

Solution: Move the existence check for the fugitive plugin into a
separate function and call it from there in all places that check the
fugitive plugin. Do the same for lawrencium and vcscommand check.

fixes #605 #1739
2018-06-04 17:38:49 +02:00
Christian Brabandt d66b507b02
Merge pull request #1683 from idbrii/add-custom-scm
Make branch detection customizable
2018-04-08 21:56:32 +02:00
David Briscoe 8209ca7da1 Make branch detection customizable
Instead of requiring each version control plugin to modify airline to
show the current branch, provide a customization function we can check
instead.

Following the example of airline_theme_patch_func, you define the
variable like so:

    let g:airline#extensions#branch#custom_head = 'david#svn#get_branch'

Custom functions should cache their value. They may need an autocmd to
invalidate their cache:

    " Use a buffer-unique group name to prevent clearing autocmds for other
    " buffers.
    exec 'augroup svndavid-'. bufnr("%")
        au!
        autocmd BufWinLeave <buffer> unlet! b:svndavid_branch
    augroup END

This change lets me integrate with vc.vim (I couldn't get VCSCommand
working for svn) or write my own thing for perforce.

Additionally, always load whole file and check for existence.

Instead of determining up front whether various scm plugins are
installed, check for them on use so they can be added after this script
is sourced.

This also mitigates the problem of checking for existence of autoload
functions (which are not loaded by exist()). Since we're checking
root-level functions, they're likely to be loaded once we're using any
part of the plugin.
2018-04-06 09:40:17 -07:00
Christian Brabandt 4237bfb052
branch: allow multibyte chars in shortening algorithm
previously, the branch extension used name[0:6], however that would
break with multibyte characters, since this is a byte index and not a
character index.

fixes #1686
2018-03-14 21:33:25 +01:00
Christian Brabandt 5db4c408bd
Update copyright notifications 2018-01-05 10:37:59 +01:00
Christian Brabandt 3a2323feac
branch: shorten default master for smaller windows 2018-01-05 08:12:10 +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 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
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 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 9f186d899a
branch: mq patch not correctly displayed
also make the branch extension make use of the specific code to handle
the mq output
2017-09-22 21:37:28 +02:00
Gideon VanRiette a763c6b53f Catch trailing whitespace when matching output 2017-09-18 09:02:39 -05:00
Christian Brabandt 8a3e3e2794
mq: remove trailing \n from system()
fixes #1563
2017-09-14 11:43:53 +02:00
Christian Brabandt 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 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 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