From a80d721dd92099b47c95b4e47973c01b1994d4d6 Mon Sep 17 00:00:00 2001 From: steveokard Date: Thu, 14 Sep 2017 11:25:54 -0400 Subject: [PATCH] Moved to Vundle from Pathogen. Refactored vimrc. --- .vim/autoload/pathogen.vim | 266 ------------------ .vim/bundle/Vundle.vim | 1 + .vim/bundle/ctrlp.vim | 1 + .vim/bundle/indentLine | 1 + .vim/bundle/vim-airline-themes/.gitignore | 1 + .../autoload/airline/themes/dark_minimal.vim | 63 +++++ .../vim-airline-themes/doc/airline-themes.txt | 8 + .vim/bundle/vim-airline/.gitignore | 4 + .vim/bundle/vim-airline/README.md | 12 +- .vim/bundle/vim-airline/autoload/airline.vim | 3 - .../vim-airline/autoload/airline/async.vim | 248 ++++++++++++++++ .../autoload/airline/extensions.vim | 5 + .../autoload/airline/extensions/ale.vim | 10 + .../autoload/airline/extensions/branch.vim | 178 ++++-------- .../autoload/airline/extensions/denite.vim | 21 +- .../autoload/airline/extensions/hunks.vim | 3 +- .../autoload/airline/extensions/keymap.vim | 20 ++ .../autoload/airline/extensions/po.vim | 55 +--- .../autoload/airline/extensions/syntastic.vim | 6 +- .../airline/extensions/tabline/buffers.vim | 5 +- .../airline/extensions/tabline/ctrlspace.vim | 31 +- .../autoload/airline/extensions/tagbar.vim | 14 +- .../autoload/airline/highlighter.vim | 55 ++-- .../vim-airline/autoload/airline/init.vim | 10 +- .../vim-airline/autoload/airline/parts.vim | 2 +- .../vim-airline/autoload/airline/util.vim | 28 -- .vim/bundle/vim-airline/doc/airline.txt | 55 ++-- .vim/bundle/vim-airline/plugin/airline.vim | 3 + .vim/bundle/vim-airline/t/builder.vim | 2 + .vim/bundle/vim-airline/t/themes.vim | 5 + .vim/bundle/vim-sensible | 1 + .vim/bundle/vim-tbone | 1 - .vimrc | 95 ++++--- README.md | 5 +- 34 files changed, 640 insertions(+), 578 deletions(-) delete mode 100644 .vim/autoload/pathogen.vim create mode 160000 .vim/bundle/Vundle.vim create mode 160000 .vim/bundle/ctrlp.vim create mode 160000 .vim/bundle/indentLine create mode 100644 .vim/bundle/vim-airline-themes/.gitignore create mode 100644 .vim/bundle/vim-airline-themes/autoload/airline/themes/dark_minimal.vim create mode 100644 .vim/bundle/vim-airline/.gitignore create mode 100644 .vim/bundle/vim-airline/autoload/airline/async.vim create mode 100644 .vim/bundle/vim-airline/autoload/airline/extensions/keymap.vim create mode 160000 .vim/bundle/vim-sensible delete mode 160000 .vim/bundle/vim-tbone diff --git a/.vim/autoload/pathogen.vim b/.vim/autoload/pathogen.vim deleted file mode 100644 index 2ec30e1..0000000 --- a/.vim/autoload/pathogen.vim +++ /dev/null @@ -1,266 +0,0 @@ -" pathogen.vim - path option manipulation -" Maintainer: Tim Pope -" 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,'\\\@]','\\&','') - 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'\:'=': diff --git a/.vim/bundle/Vundle.vim b/.vim/bundle/Vundle.vim new file mode 160000 index 0000000..6437ad6 --- /dev/null +++ b/.vim/bundle/Vundle.vim @@ -0,0 +1 @@ +Subproject commit 6437ad6df4a3e6a87c5fb8bd2b8aadb277ec9c87 diff --git a/.vim/bundle/ctrlp.vim b/.vim/bundle/ctrlp.vim new file mode 160000 index 0000000..bde7a29 --- /dev/null +++ b/.vim/bundle/ctrlp.vim @@ -0,0 +1 @@ +Subproject commit bde7a2950adaa82e894d7bdf69e3e7383e40d229 diff --git a/.vim/bundle/indentLine b/.vim/bundle/indentLine new file mode 160000 index 0000000..a97b6d1 --- /dev/null +++ b/.vim/bundle/indentLine @@ -0,0 +1 @@ +Subproject commit a97b6d12ae06c2db524e2ceba976f1d4f4637cb7 diff --git a/.vim/bundle/vim-airline-themes/.gitignore b/.vim/bundle/vim-airline-themes/.gitignore new file mode 100644 index 0000000..926ccaa --- /dev/null +++ b/.vim/bundle/vim-airline-themes/.gitignore @@ -0,0 +1 @@ +doc/tags diff --git a/.vim/bundle/vim-airline-themes/autoload/airline/themes/dark_minimal.vim b/.vim/bundle/vim-airline-themes/autoload/airline/themes/dark_minimal.vim new file mode 100644 index 0000000..6c08628 --- /dev/null +++ b/.vim/bundle/vim-airline-themes/autoload/airline/themes/dark_minimal.vim @@ -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 diff --git a/.vim/bundle/vim-airline-themes/doc/airline-themes.txt b/.vim/bundle/vim-airline-themes/doc/airline-themes.txt index 63c4d00..eadfc14 100644 --- a/.vim/bundle/vim-airline-themes/doc/airline-themes.txt +++ b/.vim/bundle/vim-airline-themes/doc/airline-themes.txt @@ -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* diff --git a/.vim/bundle/vim-airline/.gitignore b/.vim/bundle/vim-airline/.gitignore new file mode 100644 index 0000000..38ec5a0 --- /dev/null +++ b/.vim/bundle/vim-airline/.gitignore @@ -0,0 +1,4 @@ +doc/tags +*.lock +.vim-flavor +*.swp diff --git a/.vim/bundle/vim-airline/README.md b/.vim/bundle/vim-airline/README.md index 175d403..0077edb 100644 --- a/.vim/bundle/vim-airline/README.md +++ b/.vim/bundle/vim-airline/README.md @@ -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 diff --git a/.vim/bundle/vim-airline/autoload/airline.vim b/.vim/bundle/vim-airline/autoload/airline.vim index 2c16bfa..1179c2b 100644 --- a/.vim/bundle/vim-airline/autoload/airline.vim +++ b/.vim/bundle/vim-airline/autoload/airline.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" diff --git a/.vim/bundle/vim-airline/autoload/airline/async.vim b/.vim/bundle/vim-airline/autoload/airline/async.vim new file mode 100644 index 0000000..ee5165e --- /dev/null +++ b/.vim/bundle/vim-airline/autoload/airline/async.vim @@ -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 diff --git a/.vim/bundle/vim-airline/autoload/airline/extensions.vim b/.vim/bundle/vim-airline/autoload/airline/extensions.vim index b76169e..67ec77f 100644 --- a/.vim/bundle/vim-airline/autoload/airline/extensions.vim +++ b/.vim/bundle/vim-airline/autoload/airline/extensions.vim @@ -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') diff --git a/.vim/bundle/vim-airline/autoload/airline/extensions/ale.vim b/.vim/bundle/vim-airline/autoload/airline/extensions/ale.vim index 97eadf4..07639a8 100644 --- a/.vim/bundle/vim-airline/autoload/airline/extensions/ale.vim +++ b/.vim/bundle/vim-airline/autoload/airline/extensions/ale.vim @@ -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 ale_refresh() + augroup END +endfunction + +function! s:ale_refresh() + if get(g:, 'airline_skip_empty_sections', 0) + exe ':AirlineRefresh' + endif endfunction diff --git a/.vim/bundle/vim-airline/autoload/airline/extensions/branch.vim b/.vim/bundle/vim-airline/autoload/airline/extensions/branch.vim index 661cab3..6152eff 100644 --- a/.vim/bundle/vim-airline/autoload/airline/extensions/branch.vim +++ b/.vim/bundle/vim-airline/autoload/airline/extensions/branch.vim @@ -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 diff --git a/.vim/bundle/vim-airline/autoload/airline/extensions/denite.vim b/.vim/bundle/vim-airline/autoload/airline/extensions/denite.vim index 1d0ec7a..25a2f1d 100644 --- a/.vim/bundle/vim-airline/autoload/airline/extensions/denite.vim +++ b/.vim/bundle/vim-airline/autoload/airline/extensions/denite.vim @@ -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 diff --git a/.vim/bundle/vim-airline/autoload/airline/extensions/hunks.vim b/.vim/bundle/vim-airline/autoload/airline/extensions/hunks.vim index 8ce3a51..4bb4b4f 100644 --- a/.vim/bundle/vim-airline/autoload/airline/extensions/hunks.vim +++ b/.vim/bundle/vim-airline/autoload/airline/extensions/hunks.vim @@ -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() diff --git a/.vim/bundle/vim-airline/autoload/airline/extensions/keymap.vim b/.vim/bundle/vim-airline/autoload/airline/extensions/keymap.vim new file mode 100644 index 0000000..2ecbd45 --- /dev/null +++ b/.vim/bundle/vim-airline/autoload/airline/extensions/keymap.vim @@ -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 diff --git a/.vim/bundle/vim-airline/autoload/airline/extensions/po.vim b/.vim/bundle/vim-airline/autoload/airline/extensions/po.vim index 6536436..65beda7 100644 --- a/.vim/bundle/vim-airline/autoload/airline/extensions/po.vim +++ b/.vim/bundle/vim-airline/autoload/airline/extensions/po.vim @@ -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 diff --git a/.vim/bundle/vim-airline/autoload/airline/extensions/syntastic.vim b/.vim/bundle/vim-airline/autoload/airline/extensions/syntastic.vim index 9608ce0..7d8b7e6 100644 --- a/.vim/bundle/vim-airline/autoload/airline/extensions/syntastic.vim +++ b/.vim/bundle/vim-airline/autoload/airline/extensions/syntastic.vim @@ -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 diff --git a/.vim/bundle/vim-airline/autoload/airline/extensions/tabline/buffers.vim b/.vim/bundle/vim-airline/autoload/airline/extensions/tabline/buffers.vim index 31ad4da..74bff1f 100644 --- a/.vim/bundle/vim-airline/autoload/airline/extensions/tabline/buffers.vim +++ b/.vim/bundle/vim-airline/autoload/airline/extensions/tabline/buffers.vim @@ -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 diff --git a/.vim/bundle/vim-airline/autoload/airline/extensions/tabline/ctrlspace.vim b/.vim/bundle/vim-airline/autoload/airline/extensions/tabline/ctrlspace.vim index e2a1032..b509f0d 100644 --- a/.vim/bundle/vim-airline/autoload/airline/extensions/tabline/ctrlspace.vim +++ b/.vim/bundle/vim-airline/autoload/airline/extensions/tabline/ctrlspace.vim @@ -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 diff --git a/.vim/bundle/vim-airline/autoload/airline/extensions/tagbar.vim b/.vim/bundle/vim-airline/autoload/airline/extensions/tagbar.vim index 7e7665a..53c9edc 100644 --- a/.vim/bundle/vim-airline/autoload/airline/extensions/tagbar.vim +++ b/.vim/bundle/vim-airline/autoload/airline/extensions/tagbar.vim @@ -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 diff --git a/.vim/bundle/vim-airline/autoload/airline/highlighter.vim b/.vim/bundle/vim-airline/autoload/airline/highlighter.vim index 631f311..579ecfe 100644 --- a/.vim/bundle/vim-airline/autoload/airline/highlighter.vim +++ b/.vim/bundle/vim-airline/autoload/airline/highlighter.vim @@ -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 diff --git a/.vim/bundle/vim-airline/autoload/airline/init.vim b/.vim/bundle/vim-airline/autoload/airline/init.vim index 1c68429..57a24cb 100644 --- a/.vim/bundle/vim-airline/autoload/airline/init.vim +++ b/.vim/bundle/vim-airline/autoload/airline/init.vim @@ -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']) diff --git a/.vim/bundle/vim-airline/autoload/airline/parts.vim b/.vim/bundle/vim-airline/autoload/airline/parts.vim index a982062..98de731 100644 --- a/.vim/bundle/vim-airline/autoload/airline/parts.vim +++ b/.vim/bundle/vim-airline/autoload/airline/parts.vim @@ -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 : '' diff --git a/.vim/bundle/vim-airline/autoload/airline/util.vim b/.vim/bundle/vim-airline/autoload/airline/util.vim index 3f94086..06cba7a 100644 --- a/.vim/bundle/vim-airline/autoload/airline/util.vim +++ b/.vim/bundle/vim-airline/autoload/airline/util.vim @@ -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 diff --git a/.vim/bundle/vim-airline/doc/airline.txt b/.vim/bundle/vim-airline/doc/airline.txt index 32fd4a9..b9debed 100644 --- a/.vim/bundle/vim-airline/doc/airline.txt +++ b/.vim/bundle/vim-airline/doc/airline.txt @@ -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,8 +460,14 @@ 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 @@ -624,7 +634,7 @@ eclim 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 - AirlineSelectPrevTab nmap + 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 @@ -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: diff --git a/.vim/bundle/vim-airline/plugin/airline.vim b/.vim/bundle/vim-airline/plugin/airline.vim index 84f2048..0817a6b 100644 --- a/.vim/bundle/vim-airline/plugin/airline.vim +++ b/.vim/bundle/vim-airline/plugin/airline.vim @@ -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 = '' endif exe printf("silent doautocmd %s User AirlineBeforeRefresh", nomodeline) + call airline#highlighter#reset_hlcache() call airline#load_theme() call airline#update_statusline() endfunction diff --git a/.vim/bundle/vim-airline/t/builder.vim b/.vim/bundle/vim-airline/t/builder.vim index d3b0092..0b07df7 100644 --- a/.vim/bundle/vim-airline/t/builder.vim +++ b/.vim/bundle/vim-airline/t/builder.vim @@ -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') diff --git a/.vim/bundle/vim-airline/t/themes.vim b/.vim/bundle/vim-airline/t/themes.vim index 5a13993..b8a8fb2 100644 --- a/.vim/bundle/vim-airline/t/themes.vim +++ b/.vim/bundle/vim-airline/t/themes.vim @@ -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'] diff --git a/.vim/bundle/vim-sensible b/.vim/bundle/vim-sensible new file mode 160000 index 0000000..49ee364 --- /dev/null +++ b/.vim/bundle/vim-sensible @@ -0,0 +1 @@ +Subproject commit 49ee364222dc2a5a00dddf89fd61880e3e39d46a diff --git a/.vim/bundle/vim-tbone b/.vim/bundle/vim-tbone deleted file mode 160000 index 891887b..0000000 --- a/.vim/bundle/vim-tbone +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 891887b881bc818a1f8bd33904ac48e1dd471d6a diff --git a/.vimrc b/.vimrc index e91f513..57726c3 100644 --- a/.vimrc +++ b/.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 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 * :call VisualSelection('', '')/=@/ -vnoremap # :call VisualSelection('', '')?=@/ - -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 p :set paste"+p:set nopaste vnoremap p :set pastegv"+p:set nopaste @@ -70,3 +66,24 @@ nnoremap a ggVG "Useful because `d` overwrites the register nnoremap P "0p vnoremap P "0p + +"=> Leader +" With a map leader it's possible to do extra key combinations +" like 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 * :call VisualSelection('', '')/=@/ +vnoremap # :call VisualSelection('', '')?=@/ + +" => 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 + diff --git a/README.md b/README.md index 88f5f43..fd5a085 100644 --- a/README.md +++ b/README.md @@ -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.