Moved to Vundle from Pathogen. Refactored vimrc.
This commit is contained in:
parent
f9b282c858
commit
a80d721dd9
34 changed files with 640 additions and 578 deletions
|
@ -1,266 +0,0 @@
|
|||
" pathogen.vim - path option manipulation
|
||||
" Maintainer: Tim Pope <http://tpo.pe/>
|
||||
" Version: 2.4
|
||||
|
||||
" Install in ~/.vim/autoload (or ~\vimfiles\autoload).
|
||||
"
|
||||
" For management of individually installed plugins in ~/.vim/bundle (or
|
||||
" ~\vimfiles\bundle), adding `execute pathogen#infect()` to the top of your
|
||||
" .vimrc is the only other setup necessary.
|
||||
"
|
||||
" The API is documented inline below.
|
||||
|
||||
if exists("g:loaded_pathogen") || &cp
|
||||
finish
|
||||
endif
|
||||
let g:loaded_pathogen = 1
|
||||
|
||||
" Point of entry for basic default usage. Give a relative path to invoke
|
||||
" pathogen#interpose() or an absolute path to invoke pathogen#surround().
|
||||
" Curly braces are expanded with pathogen#expand(): "bundle/{}" finds all
|
||||
" subdirectories inside "bundle" inside all directories in the runtime path.
|
||||
" If no arguments are given, defaults "bundle/{}", and also "pack/{}/start/{}"
|
||||
" on versions of Vim without native package support.
|
||||
function! pathogen#infect(...) abort
|
||||
if a:0
|
||||
let paths = filter(reverse(copy(a:000)), 'type(v:val) == type("")')
|
||||
else
|
||||
let paths = ['bundle/{}', 'pack/{}/start/{}']
|
||||
endif
|
||||
if has('packages')
|
||||
call filter(paths, 'v:val !~# "^pack/[^/]*/start/[^/]*$"')
|
||||
endif
|
||||
let static = '^\%([$~\\/]\|\w:[\\/]\)[^{}*]*$'
|
||||
for path in filter(copy(paths), 'v:val =~# static')
|
||||
call pathogen#surround(path)
|
||||
endfor
|
||||
for path in filter(copy(paths), 'v:val !~# static')
|
||||
if path =~# '^\%([$~\\/]\|\w:[\\/]\)'
|
||||
call pathogen#surround(path)
|
||||
else
|
||||
call pathogen#interpose(path)
|
||||
endif
|
||||
endfor
|
||||
call pathogen#cycle_filetype()
|
||||
if pathogen#is_disabled($MYVIMRC)
|
||||
return 'finish'
|
||||
endif
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
" Split a path into a list.
|
||||
function! pathogen#split(path) abort
|
||||
if type(a:path) == type([]) | return a:path | endif
|
||||
if empty(a:path) | return [] | endif
|
||||
let split = split(a:path,'\\\@<!\%(\\\\\)*\zs,')
|
||||
return map(split,'substitute(v:val,''\\\([\\,]\)'',''\1'',"g")')
|
||||
endfunction
|
||||
|
||||
" Convert a list to a path.
|
||||
function! pathogen#join(...) abort
|
||||
if type(a:1) == type(1) && a:1
|
||||
let i = 1
|
||||
let space = ' '
|
||||
else
|
||||
let i = 0
|
||||
let space = ''
|
||||
endif
|
||||
let path = ""
|
||||
while i < a:0
|
||||
if type(a:000[i]) == type([])
|
||||
let list = a:000[i]
|
||||
let j = 0
|
||||
while j < len(list)
|
||||
let escaped = substitute(list[j],'[,'.space.']\|\\[\,'.space.']\@=','\\&','g')
|
||||
let path .= ',' . escaped
|
||||
let j += 1
|
||||
endwhile
|
||||
else
|
||||
let path .= "," . a:000[i]
|
||||
endif
|
||||
let i += 1
|
||||
endwhile
|
||||
return substitute(path,'^,','','')
|
||||
endfunction
|
||||
|
||||
" Convert a list to a path with escaped spaces for 'path', 'tag', etc.
|
||||
function! pathogen#legacyjoin(...) abort
|
||||
return call('pathogen#join',[1] + a:000)
|
||||
endfunction
|
||||
|
||||
" Turn filetype detection off and back on again if it was already enabled.
|
||||
function! pathogen#cycle_filetype() abort
|
||||
if exists('g:did_load_filetypes')
|
||||
filetype off
|
||||
filetype on
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Check if a bundle is disabled. A bundle is considered disabled if its
|
||||
" basename or full name is included in the list g:pathogen_blacklist or the
|
||||
" comma delimited environment variable $VIMBLACKLIST.
|
||||
function! pathogen#is_disabled(path) abort
|
||||
if a:path =~# '\~$'
|
||||
return 1
|
||||
endif
|
||||
let sep = pathogen#slash()
|
||||
let blacklist =
|
||||
\ get(g:, 'pathogen_blacklist', get(g:, 'pathogen_disabled', [])) +
|
||||
\ pathogen#split($VIMBLACKLIST)
|
||||
if !empty(blacklist)
|
||||
call map(blacklist, 'substitute(v:val, "[\\/]$", "", "")')
|
||||
endif
|
||||
return index(blacklist, fnamemodify(a:path, ':t')) != -1 || index(blacklist, a:path) != -1
|
||||
endfunction
|
||||
|
||||
" Prepend the given directory to the runtime path and append its corresponding
|
||||
" after directory. Curly braces are expanded with pathogen#expand().
|
||||
function! pathogen#surround(path) abort
|
||||
let sep = pathogen#slash()
|
||||
let rtp = pathogen#split(&rtp)
|
||||
let path = fnamemodify(a:path, ':s?[\\/]\=$??')
|
||||
let before = filter(pathogen#expand(path), '!pathogen#is_disabled(v:val)')
|
||||
let after = filter(reverse(pathogen#expand(path, sep.'after')), '!pathogen#is_disabled(v:val[0:-7])')
|
||||
call filter(rtp, 'index(before + after, v:val) == -1')
|
||||
let &rtp = pathogen#join(before, rtp, after)
|
||||
return &rtp
|
||||
endfunction
|
||||
|
||||
" For each directory in the runtime path, add a second entry with the given
|
||||
" argument appended. Curly braces are expanded with pathogen#expand().
|
||||
function! pathogen#interpose(name) abort
|
||||
let sep = pathogen#slash()
|
||||
let name = a:name
|
||||
if has_key(s:done_bundles, name)
|
||||
return ""
|
||||
endif
|
||||
let s:done_bundles[name] = 1
|
||||
let list = []
|
||||
for dir in pathogen#split(&rtp)
|
||||
if dir =~# '\<after$'
|
||||
let list += reverse(filter(pathogen#expand(dir[0:-6].name, sep.'after'), '!pathogen#is_disabled(v:val[0:-7])')) + [dir]
|
||||
else
|
||||
let list += [dir] + filter(pathogen#expand(dir.sep.name), '!pathogen#is_disabled(v:val)')
|
||||
endif
|
||||
endfor
|
||||
let &rtp = pathogen#join(pathogen#uniq(list))
|
||||
return 1
|
||||
endfunction
|
||||
|
||||
let s:done_bundles = {}
|
||||
|
||||
" Invoke :helptags on all non-$VIM doc directories in runtimepath.
|
||||
function! pathogen#helptags() abort
|
||||
let sep = pathogen#slash()
|
||||
for glob in pathogen#split(&rtp)
|
||||
for dir in map(split(glob(glob), "\n"), 'v:val.sep."/doc/".sep')
|
||||
if (dir)[0 : strlen($VIMRUNTIME)] !=# $VIMRUNTIME.sep && filewritable(dir) == 2 && !empty(split(glob(dir.'*.txt'))) && (!filereadable(dir.'tags') || filewritable(dir.'tags'))
|
||||
silent! execute 'helptags' pathogen#fnameescape(dir)
|
||||
endif
|
||||
endfor
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
command! -bar Helptags :call pathogen#helptags()
|
||||
|
||||
" Execute the given command. This is basically a backdoor for --remote-expr.
|
||||
function! pathogen#execute(...) abort
|
||||
for command in a:000
|
||||
execute command
|
||||
endfor
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
" Section: Unofficial
|
||||
|
||||
function! pathogen#is_absolute(path) abort
|
||||
return a:path =~# (has('win32') ? '^\%([\\/]\|\w:\)[\\/]\|^[~$]' : '^[/~$]')
|
||||
endfunction
|
||||
|
||||
" Given a string, returns all possible permutations of comma delimited braced
|
||||
" alternatives of that string. pathogen#expand('/{a,b}/{c,d}') yields
|
||||
" ['/a/c', '/a/d', '/b/c', '/b/d']. Empty braces are treated as a wildcard
|
||||
" and globbed. Actual globs are preserved.
|
||||
function! pathogen#expand(pattern, ...) abort
|
||||
let after = a:0 ? a:1 : ''
|
||||
let pattern = substitute(a:pattern, '^[~$][^\/]*', '\=expand(submatch(0))', '')
|
||||
if pattern =~# '{[^{}]\+}'
|
||||
let [pre, pat, post] = split(substitute(pattern, '\(.\{-\}\){\([^{}]\+\)}\(.*\)', "\\1\001\\2\001\\3", ''), "\001", 1)
|
||||
let found = map(split(pat, ',', 1), 'pre.v:val.post')
|
||||
let results = []
|
||||
for pattern in found
|
||||
call extend(results, pathogen#expand(pattern))
|
||||
endfor
|
||||
elseif pattern =~# '{}'
|
||||
let pat = matchstr(pattern, '^.*{}[^*]*\%($\|[\\/]\)')
|
||||
let post = pattern[strlen(pat) : -1]
|
||||
let results = map(split(glob(substitute(pat, '{}', '*', 'g')), "\n"), 'v:val.post')
|
||||
else
|
||||
let results = [pattern]
|
||||
endif
|
||||
let vf = pathogen#slash() . 'vimfiles'
|
||||
call map(results, 'v:val =~# "\\*" ? v:val.after : isdirectory(v:val.vf.after) ? v:val.vf.after : isdirectory(v:val.after) ? v:val.after : ""')
|
||||
return filter(results, '!empty(v:val)')
|
||||
endfunction
|
||||
|
||||
" \ on Windows unless shellslash is set, / everywhere else.
|
||||
function! pathogen#slash() abort
|
||||
return !exists("+shellslash") || &shellslash ? '/' : '\'
|
||||
endfunction
|
||||
|
||||
function! pathogen#separator() abort
|
||||
return pathogen#slash()
|
||||
endfunction
|
||||
|
||||
" Convenience wrapper around glob() which returns a list.
|
||||
function! pathogen#glob(pattern) abort
|
||||
let files = split(glob(a:pattern),"\n")
|
||||
return map(files,'substitute(v:val,"[".pathogen#slash()."/]$","","")')
|
||||
endfunction
|
||||
|
||||
" Like pathogen#glob(), only limit the results to directories.
|
||||
function! pathogen#glob_directories(pattern) abort
|
||||
return filter(pathogen#glob(a:pattern),'isdirectory(v:val)')
|
||||
endfunction
|
||||
|
||||
" Remove duplicates from a list.
|
||||
function! pathogen#uniq(list) abort
|
||||
let i = 0
|
||||
let seen = {}
|
||||
while i < len(a:list)
|
||||
if (a:list[i] ==# '' && exists('empty')) || has_key(seen,a:list[i])
|
||||
call remove(a:list,i)
|
||||
elseif a:list[i] ==# ''
|
||||
let i += 1
|
||||
let empty = 1
|
||||
else
|
||||
let seen[a:list[i]] = 1
|
||||
let i += 1
|
||||
endif
|
||||
endwhile
|
||||
return a:list
|
||||
endfunction
|
||||
|
||||
" Backport of fnameescape().
|
||||
function! pathogen#fnameescape(string) abort
|
||||
if exists('*fnameescape')
|
||||
return fnameescape(a:string)
|
||||
elseif a:string ==# '-'
|
||||
return '\-'
|
||||
else
|
||||
return substitute(escape(a:string," \t\n*?[{`$\\%#'\"|!<"),'^[+>]','\\&','')
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Like findfile(), but hardcoded to use the runtimepath.
|
||||
function! pathogen#runtime_findfile(file,count) abort
|
||||
let rtp = pathogen#join(1,pathogen#split(&rtp))
|
||||
let file = findfile(a:file,rtp,a:count)
|
||||
if file ==# ''
|
||||
return ''
|
||||
else
|
||||
return fnamemodify(file,':p')
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" vim:set et sw=2 foldmethod=expr foldexpr=getline(v\:lnum)=~'^\"\ Section\:'?'>1'\:getline(v\:lnum)=~#'^fu'?'a1'\:getline(v\:lnum)=~#'^endf'?'s1'\:'=':
|
1
.vim/bundle/Vundle.vim
Submodule
1
.vim/bundle/Vundle.vim
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit 6437ad6df4a3e6a87c5fb8bd2b8aadb277ec9c87
|
1
.vim/bundle/ctrlp.vim
Submodule
1
.vim/bundle/ctrlp.vim
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit bde7a2950adaa82e894d7bdf69e3e7383e40d229
|
1
.vim/bundle/indentLine
Submodule
1
.vim/bundle/indentLine
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit a97b6d12ae06c2db524e2ceba976f1d4f4637cb7
|
1
.vim/bundle/vim-airline-themes/.gitignore
vendored
Normal file
1
.vim/bundle/vim-airline-themes/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
doc/tags
|
|
@ -0,0 +1,63 @@
|
|||
scriptencoding utf-8
|
||||
|
||||
" This is a copy of the dark.vim theme, however it does not change colors in
|
||||
" the different modes, so should bring some performance improvements because
|
||||
" airline does not have to redefine highlighting groups after they have been
|
||||
" setup once.
|
||||
|
||||
" 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.
|
||||
"
|
||||
" 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.
|
||||
"
|
||||
" 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.
|
||||
let g:airline#themes#dark_minimal#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_minimal#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3)
|
||||
|
||||
" Accents are used to give parts within a section a slightly different look or
|
||||
" color. Here we are defining a "red" accent, which is used by the 'readonly'
|
||||
" part by default. Only the foreground colors are specified, so the background
|
||||
" colors are automatically extracted from the underlying section colors. What
|
||||
" this means is that regardless of which section the part is defined in, it
|
||||
" will be red instead of the section's foreground color. You can also have
|
||||
" multiple parts with accents within a section.
|
||||
let g:airline#themes#dark_minimal#palette.accents = {
|
||||
\ 'red': [ '#ff0000' , '' , 160 , '' ]
|
||||
\ }
|
||||
|
||||
let pal = g:airline#themes#dark_minimal#palette
|
||||
for item in ['insert', 'replace', 'visual', 'inactive', 'ctrlp']
|
||||
" why doesn't this work?
|
||||
" get E713: cannot use empty key for dictionary
|
||||
"let pal.{item} = pal.normal
|
||||
exe "let pal.".item." = pal.normal"
|
||||
for suffix in ['_modified', '_paste']
|
||||
exe "let pal.".item.suffix. " = pal.normal"
|
||||
endfor
|
||||
endfor
|
|
@ -78,6 +78,7 @@ Currently this repository contains the following themes:
|
|||
* cobalt2
|
||||
* cool
|
||||
* dark
|
||||
* dark_minimal
|
||||
* deus
|
||||
* distinguished
|
||||
* durant
|
||||
|
@ -127,6 +128,13 @@ g:airline_theme in your |.vimrc| like this: >
|
|||
|
||||
:let g:airline_theme='dark'
|
||||
<
|
||||
*airline-theme-dark_minimal*
|
||||
|
||||
This is a copy of the dark.vim theme, however it does not change colors in
|
||||
the different modes, so should bring some performance improvements because
|
||||
airline does not have to redefine highlighting groups after they have been
|
||||
setup once. However, it won't change colors if e.g. the mode changes.
|
||||
|
||||
*airline-theme-solarized*
|
||||
*g:solarized_base16*
|
||||
|
||||
|
|
4
.vim/bundle/vim-airline/.gitignore
vendored
Normal file
4
.vim/bundle/vim-airline/.gitignore
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
doc/tags
|
||||
*.lock
|
||||
.vim-flavor
|
||||
*.swp
|
|
@ -162,13 +162,10 @@ This plugin follows the standard runtime path structure, and as such it can be i
|
|||
| [minpac][54] | `call minpac#add('vim-airline/vim-airline')` |
|
||||
| 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 +186,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 +260,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
|
||||
|
|
|
@ -152,9 +152,6 @@ function! airline#check_mode(winnr)
|
|||
|
||||
if get(w:, 'airline_active', 1)
|
||||
let l:m = mode()
|
||||
if exists("*term_list") && index(term_list(), bufnr('')) > -1
|
||||
let l:m = "t"
|
||||
endif
|
||||
if l:m ==# "i"
|
||||
let l:mode = ['insert']
|
||||
elseif l:m ==# "R"
|
||||
|
|
248
.vim/bundle/vim-airline/autoload/airline/async.vim
Normal file
248
.vim/bundle/vim-airline/autoload/airline/async.vim
Normal file
|
@ -0,0 +1,248 @@
|
|||
" MIT License. Copyright (c) 2013-2017 C.Brabandt
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
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
|
||||
|
||||
function! s:mq_output(buf, file)
|
||||
let buf=a:buf
|
||||
if !empty(a:buf)
|
||||
if a:buf is# 'no patches applied' ||
|
||||
\ a:buf =~# "unknown command 'qtop'"
|
||||
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
|
||||
|
||||
function! s:on_stdout(channel, msg) dict abort
|
||||
let self.buf .= a:msg
|
||||
endfunction
|
||||
|
||||
function! s:on_exit_mq(channel) dict abort
|
||||
call s: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 s: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
|
|
@ -300,6 +300,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')
|
||||
|
|
|
@ -43,4 +43,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
|
||||
|
|
|
@ -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
|
||||
|
@ -120,18 +118,37 @@ function! s:update_git_branch(path)
|
|||
let s:vcs_config['git'].branch = name
|
||||
endfunction
|
||||
|
||||
function! s:update_hg_branch(path)
|
||||
function! s:update_hg_branch(...)
|
||||
" path argument is not actually used, so we don't actually care about a:1
|
||||
" it is just needed, because update_git_branch needs it.
|
||||
if s:has_lawrencium
|
||||
let cmd='LC_ALL=C hg qtop'
|
||||
let stl=lawrencium#statusline()
|
||||
if !empty(stl) && s:has_async
|
||||
call s:get_mq_async('LC_ALL=C hg qtop', 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, expand('%:p'))
|
||||
elseif has("nvim")
|
||||
call airline#async#nvim_get_mq_async(cmd, expand('%:p'))
|
||||
else
|
||||
" remove \n at the end of the command
|
||||
let output=system(cmd)[0:-2]
|
||||
if output is# 'no patches applied' ||
|
||||
\ output =~# "unknown command 'qtop'"
|
||||
let b:mq=''
|
||||
else
|
||||
unlet! b:airline_head
|
||||
let b:mq = output
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
if exists("s:mq") && !empty(s:mq)
|
||||
" 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
|
||||
|
@ -140,9 +157,10 @@ function! s:update_hg_branch(path)
|
|||
endfunction
|
||||
|
||||
function! s:update_branch()
|
||||
let l:path = exists("*fnamemodify") ? fnamemodify(resolve(@%), ":p:h") : expand("%:p:h")
|
||||
let b:airline_fname_path = get(b:, 'airline_fname_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}(b:airline_fname_path)
|
||||
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 +168,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 +178,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 +228,24 @@ 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] = b:buffer_vcs_config[vcs].branch
|
||||
endif
|
||||
endfor
|
||||
|
||||
for vcs in keys(l:heads)
|
||||
for vcs in keys(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])
|
||||
let b:airline_head .= (len(heads) > 1 ? s:vcs_config[vcs].exe .':' : '') . s:format_name(heads[vcs])
|
||||
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,7 +261,7 @@ function! airline#extensions#branch#head()
|
|||
endif
|
||||
endif
|
||||
|
||||
if has_key(l:heads, 'git') && !s:check_in_path()
|
||||
if has_key(heads, 'git') && !s:check_in_path()
|
||||
let b:airline_head = ''
|
||||
endif
|
||||
let minwidth = empty(get(b:, 'airline_hunks', '')) ? 14 : 7
|
||||
|
@ -377,7 +309,7 @@ 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 +320,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
|
||||
|
@ -402,8 +334,8 @@ 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 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 b:airline_fname_path
|
||||
autocmd User AirlineBeforeRefresh unlet! b:airline_head b:airline_do_mq_check b:airline_fname_path
|
||||
autocmd BufWritePost * call s:reset_untracked_cache(0)
|
||||
autocmd ShellCmdPost * call s:reset_untracked_cache(1)
|
||||
endfunction
|
||||
|
|
|
@ -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,5 @@ 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
|
||||
|
||||
|
|
|
@ -69,7 +69,8 @@ function! airline#extensions#hunks#get_hunks()
|
|||
\ 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()
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
" MIT License. Copyright (c) 2013-2017 Doron Behar, C.Brabandt
|
||||
" 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
|
|
@ -3,9 +3,7 @@
|
|||
|
||||
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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -6,6 +6,7 @@ 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:keymap_ignored_filetypes = get(g:, 'airline#extensions#tabline#keymap_ignored_filetypes', ['vimfiler', 'nerdtree'])
|
||||
let s:spc = g:airline_symbols.space
|
||||
|
||||
let s:current_bufnr = -1
|
||||
|
@ -160,8 +161,8 @@ 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(s:keymap_ignored_filetypes, &ft)
|
||||
return
|
||||
endif
|
||||
|
||||
|
|
|
@ -39,6 +39,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 +73,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)
|
||||
|
@ -113,11 +126,19 @@ function! airline#extensions#tabline#ctrlspace#get()
|
|||
if s:show_buffers == 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)
|
||||
" 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)
|
||||
" 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 airline#extensions#tabline#ctrlspace#add_tab_section(builder, 0)
|
||||
|
@ -138,7 +159,11 @@ function! airline#extensions#tabline#ctrlspace#get()
|
|||
call airline#extensions#tabline#ctrlspace#add_tab_section(builder, 1)
|
||||
call builder.add_section_spaced('airline_tabtype', s:tabs_label)
|
||||
else
|
||||
call airline#extensions#tabline#ctrlspace#add_buffer_section(builder, cur_tab, cur_buf, 1)
|
||||
" 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
|
||||
call builder.add_section_spaced('airline_tabtype', s:buffers_label)
|
||||
endif
|
||||
endif
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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, ...)
|
||||
|
@ -92,11 +109,14 @@ function! airline#highlighter#exec(group, colors)
|
|||
let colors = s:CheckDefined(colors)
|
||||
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
|
||||
|
||||
|
@ -132,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
|
||||
|
||||
|
|
|
@ -18,8 +18,8 @@ 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)
|
||||
|
@ -69,7 +69,8 @@ function! airline#init#bootstrap()
|
|||
\ 'paste': 'PASTE',
|
||||
\ 'spell': 'SPELL',
|
||||
\ 'modified': '+',
|
||||
\ 'space': ' '
|
||||
\ 'space': ' ',
|
||||
\ 'keymap': 'Keymap:'
|
||||
\ }, 'keep')
|
||||
|
||||
if get(g:, 'airline_powerline_fonts', 0)
|
||||
|
@ -149,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
|
||||
|
@ -162,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'])
|
||||
|
|
|
@ -86,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 : ''
|
||||
|
|
|
@ -86,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
|
||||
|
|
|
@ -211,6 +211,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*
|
||||
|
||||
|
@ -456,9 +460,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>
|
||||
|
||||
|
@ -624,7 +634,7 @@ 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). >
|
||||
|
@ -634,7 +644,7 @@ are supported!
|
|||
(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
|
||||
<
|
||||
|
||||
|
@ -642,7 +652,7 @@ 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)
|
||||
* 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. >
|
||||
|
@ -665,10 +675,10 @@ with the middle mouse button to delete that buffer.
|
|||
Note: The tab-type will only be displayed in tab-mode,
|
||||
if there are no splits shown. (See: g:airline#extensions#tabline#show_splits)
|
||||
|
||||
* 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'
|
||||
|
||||
* enable/disable displaying index of the buffer.
|
||||
|
@ -690,13 +700,16 @@ with the middle mouse button to delete that buffer.
|
|||
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 ',
|
||||
|
@ -712,7 +725,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:
|
||||
|
@ -848,11 +861,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>
|
||||
|
||||
|
@ -920,30 +940,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
|
||||
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*
|
||||
|
@ -1234,6 +1254,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>
|
||||
|
|
|
@ -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
|
||||
|
@ -140,6 +142,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
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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']
|
||||
|
||||
|
|
1
.vim/bundle/vim-sensible
Submodule
1
.vim/bundle/vim-sensible
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit 49ee364222dc2a5a00dddf89fd61880e3e39d46a
|
|
@ -1 +0,0 @@
|
|||
Subproject commit 891887b881bc818a1f8bd33904ac48e1dd471d6a
|
95
.vimrc
95
.vimrc
|
@ -1,41 +1,43 @@
|
|||
" => General
|
||||
execute pathogen#infect()
|
||||
set history=500
|
||||
set number
|
||||
syntax enable
|
||||
" => Vundle
|
||||
set nocompatible " be iMproved, required
|
||||
filetype off " required
|
||||
|
||||
" set the runtime path to include Vundle and initialize
|
||||
set rtp+=~/.vim/bundle/Vundle.vim
|
||||
call vundle#begin()
|
||||
" let Vundle manage Vundle, required
|
||||
Plugin 'VundleVim/Vundle.vim'
|
||||
|
||||
Plugin 'tpope/vim-sensible'
|
||||
Plugin 'altercation/vim-colors-solarized'
|
||||
Plugin 'vim-airline/vim-airline'
|
||||
Plugin 'vim-airline/vim-airline-themes'
|
||||
Plugin 'Yggdroot/indentLine'
|
||||
Plugin 'ajh17/VimCompletesMe'
|
||||
Plugin 'ctrlpvim/ctrlp.vim'
|
||||
|
||||
" All of your Plugins must be added before the following line
|
||||
call vundle#end() " required
|
||||
filetype plugin indent on " required
|
||||
" To ignore plugin indent changes, instead use:
|
||||
"filetype plugin on
|
||||
|
||||
" => Appearance
|
||||
set t_Co=256
|
||||
set background=dark
|
||||
colorscheme solarized
|
||||
set number
|
||||
" below is from https://bluz71.github.io/2017/05/15/vim-tips-tricks.html
|
||||
" see examples at https://github.com/bluz71/dotfiles/blob/master/vimrc
|
||||
set breakindent
|
||||
set showbreak=\\\\\
|
||||
"set breakindent
|
||||
"set showbreak=\\\\\
|
||||
set relativenumber
|
||||
set infercase
|
||||
set synmaxcol=200
|
||||
set nocompatible
|
||||
set autoindent
|
||||
set autoread
|
||||
set autowrite
|
||||
|
||||
set mouse=a
|
||||
" Enable filetype plugins
|
||||
filetype plugin on
|
||||
filetype indent on
|
||||
" :W sudo saves the file
|
||||
" (useful for handling the permission-denied error)
|
||||
command W w !sudo tee % > /dev/null
|
||||
" With a map leader it's possible to do extra key combinations
|
||||
" like <leader>w saves the current file
|
||||
let mapleader = ","
|
||||
let g:mapleader = ","
|
||||
" => VIM user interface
|
||||
" Turn on the WiLd menu
|
||||
set wildmenu
|
||||
" Wildmode is in sensible
|
||||
set wildmode=full
|
||||
"Always show current position
|
||||
set ruler
|
||||
|
||||
" Height of the command bar
|
||||
set cmdheight=2
|
||||
" Highlight search results
|
||||
|
@ -46,19 +48,13 @@ set lazyredraw
|
|||
set showmatch
|
||||
" How many tenths of a second to blink when matching brackets
|
||||
set mat=2
|
||||
" => Visual mode related
|
||||
""""""""""""""""""""""""""""""
|
||||
" Visual mode pressing * or # searches for the current selection
|
||||
" Super useful! From an idea by Michael Naumann
|
||||
vnoremap <silent> * :<C-u>call VisualSelection('', '')<CR>/<C-R>=@/<CR><CR>
|
||||
vnoremap <silent> # :<C-u>call VisualSelection('', '')<CR>?<C-R>=@/<CR><CR>
|
||||
|
||||
let g:airline_theme='solarized'
|
||||
let g:airline#extensions#tabline#enabled = 1
|
||||
|
||||
" markdown also starts with .md
|
||||
autocmd BufNewFile,BufRead *.md set filetype=markdown
|
||||
|
||||
"=> Functions
|
||||
set autowrite
|
||||
set mouse=a
|
||||
" :W sudo saves the file
|
||||
" (useful for handling the permission-denied error)
|
||||
command W w !sudo tee % > /dev/null
|
||||
"paste from outside buffer
|
||||
nnoremap <leader>p :set paste<CR>"+p:set nopaste<CR>
|
||||
vnoremap <leader>p <Esc>:set paste<CR>gv"+p:set nopaste<CR>
|
||||
|
@ -70,3 +66,24 @@ nnoremap <leader>a ggVG
|
|||
"Useful because `d` overwrites the <quote> register
|
||||
nnoremap <leader>P "0p
|
||||
vnoremap <leader>P "0p
|
||||
|
||||
"=> Leader
|
||||
" With a map leader it's possible to do extra key combinations
|
||||
" like <leader>w saves the current file
|
||||
let mapleader = ","
|
||||
let g:mapleader = ","
|
||||
|
||||
" => Visual mode related
|
||||
""""""""""""""""""""""""""""""
|
||||
" Visual mode pressing * or # searches for the current selection
|
||||
" Super useful! From an idea by Michael Naumann
|
||||
vnoremap <silent> * :<C-u>call VisualSelection('', '')<CR>/<C-R>=@/<CR><CR>
|
||||
vnoremap <silent> # :<C-u>call VisualSelection('', '')<CR>?<C-R>=@/<CR><CR>
|
||||
|
||||
" => airline Config
|
||||
let g:airline_theme='solarized'
|
||||
let g:airline#extensions#tabline#enabled = 1
|
||||
|
||||
" markdown also starts with .md
|
||||
autocmd BufNewFile,BufRead *.md set filetype=markdown
|
||||
|
||||
|
|
|
@ -16,9 +16,8 @@ a modern terminal multiplexor which is actively maintained compared to screen. B
|
|||
I chose the Z shell for its extensive expansion and bonus features compared to the default bash shell.
|
||||
|
||||
## Plugin Managers
|
||||
|
||||
### Pathogen
|
||||
This plugin manager automatically loads all of my vim plugins in the .vim/bundle directory. All I need to do is add one line to my .vimrc for this functionality.
|
||||
### Vundle
|
||||
An expansion of the original pathogen plugin manager, this will automatically update git repos for plugins based on what's in the vimrc file
|
||||
|
||||
### Antibody
|
||||
This plugin manager downloads zsh plugins directly from git based on a list of gituser/gitproject names in my .zshrc file. I chose it over antigen as it is more simple and quick.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue