diff options
Diffstat (limited to '.vim/autoload/airline')
71 files changed, 6588 insertions, 0 deletions
diff --git a/.vim/autoload/airline/async.vim b/.vim/autoload/airline/async.vim new file mode 100644 index 0000000..93bbfe7 --- /dev/null +++ b/.vim/autoload/airline/async.vim @@ -0,0 +1,259 @@ +" MIT License. Copyright (c) 2013-2018 C.Brabandt et al. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +let s:untracked_jobs = {} +let s:mq_jobs = {} +let s:po_jobs = {} + +" Generic functions handling on exit event of the various async functions +function! s:untracked_output(dict, buf) + if a:buf =~? ('^'. a:dict.cfg['untracked_mark']) + let a:dict.cfg.untracked[a:dict.file] = get(g:, 'airline#extensions#branch#notexists', g:airline_symbols.notexists) + else + let a:dict.cfg.untracked[a:dict.file] = '' + endif +endfunction + +" also called from branch extension (for non-async vims) +function! airline#async#mq_output(buf, file) + let buf=a:buf + if !empty(a:buf) + if a:buf =~# 'no patches applied' || + \ a:buf =~# "unknown command 'qtop'" || + \ a:buf =~# "abort" + let buf = '' + elseif exists("b:mq") && b:mq isnot# buf + " make sure, statusline is updated + unlet! b:airline_head + endif + let b:mq = buf + endif + if has_key(s:mq_jobs, a:file) + call remove(s:mq_jobs, a:file) + endif +endfunction + +function! s:po_output(buf, file) + if !empty(a:buf) + let b:airline_po_stats = printf("%s", a:buf) + else + let b:airline_po_stats = '' + endif + if has_key(s:po_jobs, a:file) + call remove(s:po_jobs, a:file) + endif +endfunction + +function! s:valid_dir(dir) + if empty(a:dir) || !isdirectory(a:dir) + return getcwd() + endif + return a:dir +endfunction + +if v:version >= 800 && has("job") + " Vim 8.0 with Job feature + " TODO: Check if we need the cwd option for the job_start() functions + " (only works starting with Vim 8.0.0902) + + function! s:on_stdout(channel, msg) dict abort + let self.buf .= a:msg + endfunction + + function! s:on_exit_mq(channel) dict abort + call airline#async#mq_output(self.buf, self.file) + endfunction + + function! s:on_exit_untracked(channel) dict abort + call s:untracked_output(self, self.buf) + if has_key(s:untracked_jobs, self.file) + call remove(s:untracked_jobs, self.file) + endif + endfunction + + function! s:on_exit_po(channel) dict abort + call s:po_output(self.buf, self.file) + call airline#extensions#po#shorten() + endfunction + + function! airline#async#get_mq_async(cmd, file) + if g:airline#init#is_windows && &shell =~ 'cmd' + let cmd = a:cmd + else + let cmd = ['sh', '-c', a:cmd] + endif + + let options = {'cmd': a:cmd, 'buf': '', 'file': a:file} + if has_key(s:mq_jobs, a:file) + if job_status(get(s:mq_jobs, a:file)) == 'run' + return + elseif has_key(s:mq_jobs, a:file) + call remove(s:mq_jobs, a:file) + endif + endif + let id = job_start(cmd, { + \ 'err_io': 'out', + \ 'out_cb': function('s:on_stdout', options), + \ 'close_cb': function('s:on_exit_mq', options)}) + let s:mq_jobs[a:file] = id + endfunction + + function! airline#async#get_msgfmt_stat(cmd, file) + if g:airline#init#is_windows || !executable('msgfmt') + " no msgfmt on windows? + return + else + let cmd = ['sh', '-c', a:cmd. shellescape(a:file)] + endif + + let options = {'buf': '', 'file': a:file} + if has_key(s:po_jobs, a:file) + if job_status(get(s:po_jobs, a:file)) == 'run' + return + elseif has_key(s:po_jobs, a:file) + call remove(s:po_jobs, a:file) + endif + endif + let id = job_start(cmd, { + \ 'err_io': 'out', + \ 'out_cb': function('s:on_stdout', options), + \ 'close_cb': function('s:on_exit_po', options)}) + let s:po_jobs[a:file] = id + endfunction + + function! airline#async#vim_vcs_untracked(config, file) + if g:airline#init#is_windows && &shell =~ 'cmd' + let cmd = a:config['cmd'] . shellescape(a:file) + else + let cmd = ['sh', '-c', a:config['cmd'] . shellescape(a:file)] + endif + + let options = {'cfg': a:config, 'buf': '', 'file': a:file} + if has_key(s:untracked_jobs, a:file) + if job_status(get(s:untracked_jobs, a:file)) == 'run' + return + elseif has_key(s:untracked_jobs, a:file) + call remove(s:untracked_jobs, a:file) + endif + endif + let id = job_start(cmd, { + \ 'err_io': 'out', + \ 'out_cb': function('s:on_stdout', options), + \ 'close_cb': function('s:on_exit_untracked', options)}) + let s:untracked_jobs[a:file] = id + endfunction + +elseif has("nvim") + " NVim specific functions + + function! s:nvim_output_handler(job_id, data, event) dict + if a:event == 'stdout' || a:event == 'stderr' + let self.buf .= join(a:data) + endif + endfunction + + function! s:nvim_untracked_job_handler(job_id, data, event) dict + if a:event == 'exit' + call s:untracked_output(self, self.buf) + if has_key(s:untracked_jobs, self.file) + call remove(s:untracked_jobs, self.file) + endif + endif + endfunction + + function! s:nvim_mq_job_handler(job_id, data, event) dict + if a:event == 'exit' + call airline#async#mq_output(self.buf, self.file) + endif + endfunction + + function! s:nvim_po_job_handler(job_id, data, event) dict + if a:event == 'exit' + call s:po_output(self.buf, self.file) + call airline#extensions#po#shorten() + endif + endfunction + + function! airline#async#nvim_get_mq_async(cmd, file) + let config = { + \ 'buf': '', + \ 'file': a:file, + \ 'cwd': s:valid_dir(fnamemodify(a:file, ':p:h')), + \ 'on_stdout': function('s:nvim_output_handler'), + \ 'on_stderr': function('s:nvim_output_handler'), + \ 'on_exit': function('s:nvim_mq_job_handler') + \ } + if g:airline#init#is_windows && &shell =~ 'cmd' + let cmd = a:cmd + else + let cmd = ['sh', '-c', a:cmd] + endif + + if has_key(s:mq_jobs, a:file) + call remove(s:mq_jobs, a:file) + endif + let id = jobstart(cmd, config) + let s:mq_jobs[a:file] = id + endfunction + + function! airline#async#nvim_get_msgfmt_stat(cmd, file) + let config = { + \ 'buf': '', + \ 'file': a:file, + \ 'cwd': s:valid_dir(fnamemodify(a:file, ':p:h')), + \ 'on_stdout': function('s:nvim_output_handler'), + \ 'on_stderr': function('s:nvim_output_handler'), + \ 'on_exit': function('s:nvim_po_job_handler') + \ } + if g:airline#init#is_windows && &shell =~ 'cmd' + " no msgfmt on windows? + return + else + let cmd = ['sh', '-c', a:cmd. shellescape(a:file)] + endif + + if has_key(s:po_jobs, a:file) + call remove(s:po_jobs, a:file) + endif + let id = jobstart(cmd, config) + let s:po_jobs[a:file] = id + endfunction + +endif + +" Should work in either Vim pre 8 or Nvim +function! airline#async#nvim_vcs_untracked(cfg, file, vcs) + let cmd = a:cfg.cmd . shellescape(a:file) + let id = -1 + let config = { + \ 'buf': '', + \ 'vcs': a:vcs, + \ 'cfg': a:cfg, + \ 'file': a:file, + \ 'cwd': s:valid_dir(fnamemodify(a:file, ':p:h')) + \ } + if has("nvim") + call extend(config, { + \ 'on_stdout': function('s:nvim_output_handler'), + \ 'on_exit': function('s:nvim_untracked_job_handler')}) + if has_key(s:untracked_jobs, config.file) + " still running + return + endif + try + let id = jobstart(cmd, config) + catch + " catch-all, jobstart() failed, fall back to system() + let id=-1 + endtry + 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/autoload/airline/builder.vim b/.vim/autoload/airline/builder.vim new file mode 100644 index 0000000..b0352e3 --- /dev/null +++ b/.vim/autoload/airline/builder.vim @@ -0,0 +1,244 @@ +" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +let s:prototype = {} + +function! s:prototype.split(...) dict + call add(self._sections, ['|', a:0 ? a:1 : '%=']) +endfunction + +function! s:prototype.add_section_spaced(group, contents) dict + let spc = empty(a:contents) ? '' : g:airline_symbols.space + call self.add_section(a:group, spc.a:contents.spc) +endfunction + +function! s:prototype.add_section(group, contents) dict + call add(self._sections, [a:group, a:contents]) +endfunction + +function! s:prototype.add_raw(text) dict + call add(self._sections, ['', a:text]) +endfunction + +function! s:prototype.insert_section(group, contents, position) dict + call insert(self._sections, [a:group, a:contents], a:position) +endfunction + +function! s:prototype.insert_raw(text, position) dict + call insert(self._sections, ['', a:text], a:position) +endfunction + +function! s:prototype.get_position() dict + return len(self._sections) +endfunction + +function! airline#builder#get_prev_group(sections, i) + let x = a:i - 1 + while x >= 0 + let group = a:sections[x][0] + if group != '' && group != '|' + return group + endif + let x = x - 1 + endwhile + return '' +endfunction + +function! airline#builder#get_next_group(sections, i) + let x = a:i + 1 + let l = len(a:sections) + while x < l + let group = a:sections[x][0] + if group != '' && group != '|' + return group + endif + let x = x + 1 + endwhile + return '' +endfunction + +function! s:prototype.build() dict + let side = 1 + let line = '' + let i = 0 + let length = len(self._sections) + let split = 0 + let is_empty = 0 + let prev_group = '' + + while i < length + let section = self._sections[i] + let group = section[0] + let contents = section[1] + let pgroup = prev_group + let prev_group = airline#builder#get_prev_group(self._sections, i) + if group ==# 'airline_c' && &buftype ==# 'terminal' && self._context.active + let group = 'airline_term' + elseif group ==# 'airline_c' && !self._context.active && has_key(self._context, 'bufnr') + let group = 'airline_c'. self._context.bufnr + elseif prev_group ==# 'airline_c' && !self._context.active && has_key(self._context, 'bufnr') + let prev_group = 'airline_c'. self._context.bufnr + endif + if is_empty + let prev_group = pgroup + endif + let is_empty = s:section_is_empty(self, contents) + + if is_empty + " need to fix highlighting groups, since we + " have skipped a section, we actually need + " the previous previous group and so the + " seperator goes from the previous previous group + " to the current group + let pgroup = group + endif + + if group == '' + let line .= contents + elseif group == '|' + let side = 0 + let line .= contents + let split = 1 + else + if prev_group == '' + let line .= '%#'.group.'#' + elseif split + if !is_empty + let line .= s:get_transitioned_seperator(self, prev_group, group, side) + endif + let split = 0 + else + if !is_empty + let line .= s:get_seperator(self, prev_group, group, side) + endif + endif + let line .= is_empty ? '' : s:get_accented_line(self, group, contents) + endif + + let i = i + 1 + endwhile + + if !self._context.active + "let line = substitute(line, '%#airline_c#', '%#airline_c'.self._context.bufnr.'#', '') + let line = substitute(line, '%#.\{-}\ze#', '\0_inactive', 'g') + endif + return line +endfunction + +function! airline#builder#should_change_group(group1, group2) + if a:group1 == a:group2 + return 0 + endif + let color1 = airline#highlighter#get_highlight(a:group1) + let color2 = airline#highlighter#get_highlight(a:group2) + if g:airline_gui_mode ==# 'gui' + return color1[1] != color2[1] || color1[0] != color2[0] + else + return color1[3] != color2[3] || color1[2] != color2[2] + endif +endfunction + +function! s:get_transitioned_seperator(self, prev_group, group, side) + let line = '' + if get(a:self._context, 'tabline', 0) && get(g:, 'airline#extensions#tabline#alt_sep', 0) && a:group ==# 'airline_tabsel' && a:side + call airline#highlighter#add_separator(a:prev_group, a:group, 0) + let line .= '%#'.a:prev_group.'_to_'.a:group.'#' + let line .= a:self._context.right_sep.'%#'.a:group.'#' + else + call airline#highlighter#add_separator(a:prev_group, a:group, a:side) + let line .= '%#'.a:prev_group.'_to_'.a:group.'#' + let line .= a:side ? a:self._context.left_sep : a:self._context.right_sep + let line .= '%#'.a:group.'#' + endif + return line +endfunction + +function! s:get_seperator(self, prev_group, group, side) + if airline#builder#should_change_group(a:prev_group, a:group) + return s:get_transitioned_seperator(a:self, a:prev_group, a:group, a:side) + else + return a:side ? a:self._context.left_alt_sep : a:self._context.right_alt_sep + endif +endfunction + +function! s:get_accented_line(self, group, contents) + if a:self._context.active + " active window + let contents = [] + let content_parts = split(a:contents, '__accent') + for cpart in content_parts + let accent = matchstr(cpart, '_\zs[^#]*\ze') + call add(contents, cpart) + endfor + let line = join(contents, a:group) + let line = substitute(line, '__restore__', a:group, 'g') + else + " inactive window + let line = substitute(a:contents, '%#__accent[^#]*#', '', 'g') + let line = substitute(line, '%#__restore__#', '', 'g') + endif + return line +endfunction + +function! s:section_is_empty(self, content) + let start=1 + + " do not check for inactive windows or the tabline + if a:self._context.active == 0 + return 0 + elseif get(a:self._context, 'tabline', 0) + return 0 + endif + + " only check, if airline#skip_empty_sections == 1 + if get(g:, 'airline_skip_empty_sections', 0) == 0 + return 0 + endif + + " only check, if airline#skip_empty_sections == 1 + if get(w:, 'airline_skip_empty_sections', -1) == 0 + return 0 + endif + " assume accents sections to be never empty + " (avoides, that on startup the mode message becomes empty) + if match(a:content, '%#__accent_[^#]*#.*__restore__#') > -1 + return 0 + endif + if empty(a:content) + return 1 + endif + let list=matchlist(a:content, '%{\zs.\{-}\ze}', 1, start) + if empty(list) + return 0 " no function in statusline text + endif + while len(list) > 0 + let expr = list[0] + try + " catch all exceptions, just in case + if !empty(eval(expr)) + return 0 + endif + catch + return 0 + endtry + let start += 1 + let list=matchlist(a:content, '%{\zs.\{-}\ze}', 1, start) + endw + return 1 +endfunction + +function! airline#builder#new(context) + let builder = copy(s:prototype) + let builder._context = a:context + let builder._sections = [] + + call extend(builder._context, { + \ 'left_sep': g:airline_left_sep, + \ 'left_alt_sep': g:airline_left_alt_sep, + \ 'right_sep': g:airline_right_sep, + \ 'right_alt_sep': g:airline_right_alt_sep, + \ }, 'keep') + return builder +endfunction diff --git a/.vim/autoload/airline/debug.vim b/.vim/autoload/airline/debug.vim new file mode 100644 index 0000000..afa42af --- /dev/null +++ b/.vim/autoload/airline/debug.vim @@ -0,0 +1,51 @@ +" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +function! airline#debug#profile1() + profile start airline-profile-switch.log + profile func * + profile file * + split + for i in range(1, 1000) + wincmd w + redrawstatus + endfor + profile pause + noautocmd qall! +endfunction + +function! airline#debug#profile2() + profile start airline-profile-cursor.log + profile func * + profile file * + edit blank + call setline(1, 'all your base are belong to us') + call setline(2, 'all your base are belong to us') + let positions = [[1,2], [2,2], [1,2], [1,1]] + for i in range(1, 1000) + for pos in positions + call cursor(pos[0], pos[1]) + redrawstatus + endfor + endfor + profile pause + noautocmd qall! +endfunction + +function! airline#debug#profile3() + profile start airline-profile-mode.log + profile func * + profile file * + + for i in range(1000) + startinsert + redrawstatus + stopinsert + redrawstatus + endfor + + profile pause + noautocmd qall! +endfunction diff --git a/.vim/autoload/airline/extensions.vim b/.vim/autoload/airline/extensions.vim new file mode 100644 index 0000000..726e983 --- /dev/null +++ b/.vim/autoload/airline/extensions.vim @@ -0,0 +1,389 @@ +" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +let s:loaded_ext = [] +let s:ext = {} +let s:ext._theme_funcrefs = [] + +function! s:ext.add_statusline_func(name) dict + call airline#add_statusline_func(a:name) +endfunction +function! s:ext.add_statusline_funcref(function) dict + call airline#add_statusline_funcref(a:function) +endfunction +function! s:ext.add_inactive_statusline_func(name) dict + call airline#add_inactive_statusline_func(a:name) +endfunction +function! s:ext.add_theme_func(name) dict + call add(self._theme_funcrefs, function(a:name)) +endfunction + +let s:script_path = tolower(resolve(expand('<sfile>:p:h'))) + +let s:filetype_overrides = { + \ 'nerdtree': [ get(g:, 'NERDTreeStatusline', 'NERD'), '' ], + \ 'gundo': [ 'Gundo', '' ], + \ 'vimfiler': [ 'vimfiler', '%{vimfiler#get_status_string()}' ], + \ 'minibufexpl': [ 'MiniBufExplorer', '' ], + \ 'startify': [ 'startify', '' ], + \ 'vim-plug': [ 'Plugins', '' ], + \ } + +let s:filetype_regex_overrides = {} + +function! s:check_defined_section(name) + if !exists('w:airline_section_{a:name}') + let w:airline_section_{a:name} = g:airline_section_{a:name} + endif +endfunction + +function! airline#extensions#append_to_section(name, value) + call <sid>check_defined_section(a:name) + let w:airline_section_{a:name} .= a:value +endfunction + +function! airline#extensions#prepend_to_section(name, value) + call <sid>check_defined_section(a:name) + let w:airline_section_{a:name} = a:value . w:airline_section_{a:name} +endfunction + +function! airline#extensions#apply_left_override(section1, section2) + let w:airline_section_a = a:section1 + let w:airline_section_b = a:section2 + let w:airline_section_c = airline#section#create(['readonly']) + let w:airline_render_left = 1 + let w:airline_render_right = 0 +endfunction + +function! airline#extensions#apply(...) + + if s:is_excluded_window() + return -1 + endif + + if &buftype == 'help' + call airline#extensions#apply_left_override('Help', '%f') + let w:airline_section_x = '' + let w:airline_section_y = '' + let w:airline_render_right = 1 + endif + + if &buftype == 'terminal' + let w:airline_section_x = '' + let w:airline_section_y = '' + endif + + if &previewwindow + let w:airline_section_a = 'Preview' + let w:airline_section_b = '' + let w:airline_section_c = bufname(winbufnr(winnr())) + endif + + if has_key(s:filetype_overrides, &ft) + let args = s:filetype_overrides[&ft] + call airline#extensions#apply_left_override(args[0], args[1]) + endif + + for item in items(s:filetype_regex_overrides) + if match(&ft, item[0]) >= 0 + call airline#extensions#apply_left_override(item[1][0], item[1][1]) + endif + endfor +endfunction + +function! s:is_excluded_window() + for matchft in g:airline_exclude_filetypes + if matchft ==# &ft + return 1 + endif + endfor + + for matchw in g:airline_exclude_filenames + if matchstr(expand('%'), matchw) ==# matchw + return 1 + endif + endfor + + if g:airline_exclude_preview && &previewwindow + return 1 + endif + + return 0 +endfunction + +function! airline#extensions#load_theme() + call airline#util#exec_funcrefs(s:ext._theme_funcrefs, g:airline#themes#{g:airline_theme}#palette) +endfunction + +function! airline#extensions#load() + let s:loaded_ext = [] + + if exists('g:airline_extensions') + for ext in g:airline_extensions + try + call airline#extensions#{ext}#init(s:ext) + catch /^Vim\%((\a\+)\)\=:E117/ " E117, function does not exist + call airline#util#warning("Extension '".ext."' not installed, ignoring!") + endtry + endfor + return + endif + + call airline#extensions#quickfix#init(s:ext) + call add(s:loaded_ext, 'quickfix') + + if get(g:, 'loaded_unite', 0) + call airline#extensions#unite#init(s:ext) + call add(s:loaded_ext, 'unite') + endif + + if get(g:, 'loaded_denite', 0) + call airline#extensions#denite#init(s:ext) + call add(s:loaded_ext, 'denite') + endif + + if exists(':NetrwSettings') + call airline#extensions#netrw#init(s:ext) + call add(s:loaded_ext, 'netrw') + endif + + if has("terminal") || has('nvim') + call airline#extensions#term#init(s:ext) + call add(s:loaded_ext, 'term') + endif + + if get(g:, 'airline#extensions#ycm#enabled', 0) + call airline#extensions#ycm#init(s:ext) + call add(s:loaded_ext, 'ycm') + endif + + if get(g:, 'loaded_vimfiler', 0) + let g:vimfiler_force_overwrite_statusline = 0 + endif + + if get(g:, 'loaded_ctrlp', 0) + call airline#extensions#ctrlp#init(s:ext) + call add(s:loaded_ext, 'ctrlp') + endif + + if get(g:, 'loaded_localsearch', 0) + call airline#extensions#localsearch#init(s:ext) + call add(s:loaded_ext, 'localsearch') + endif + + if get(g:, 'CtrlSpaceLoaded', 0) + call airline#extensions#ctrlspace#init(s:ext) + call add(s:loaded_ext, 'ctrlspace') + endif + + if get(g:, 'command_t_loaded', 0) + call airline#extensions#commandt#init(s:ext) + call add(s:loaded_ext, 'commandt') + endif + + if exists(':UndotreeToggle') + call airline#extensions#undotree#init(s:ext) + call add(s:loaded_ext, 'undotree') + endif + + if get(g:, 'airline#extensions#hunks#enabled', 1) + \ && (exists('g:loaded_signify') || exists('g:loaded_gitgutter') || exists('g:loaded_changes') || exists('g:loaded_quickfixsigns')) + call airline#extensions#hunks#init(s:ext) + call add(s:loaded_ext, 'hunks') + endif + + if get(g:, 'airline#extensions#vimagit#enabled', 1) + \ && (exists('g:loaded_magit')) + call airline#extensions#vimagit#init(s:ext) + call add(s:loaded_ext, 'vimagit') + endif + + if get(g:, 'airline#extensions#tagbar#enabled', 1) + \ && exists(':TagbarToggle') + call airline#extensions#tagbar#init(s:ext) + call add(s:loaded_ext, 'tagbar') + endif + + if get(g:, 'airline#extensions#csv#enabled', 1) + \ && (get(g:, 'loaded_csv', 0) || exists(':Table')) + call airline#extensions#csv#init(s:ext) + call add(s:loaded_ext, 'csv') + endif + + if exists(':VimShell') + let s:filetype_overrides['vimshell'] = ['vimshell','%{vimshell#get_status_string()}'] + let s:filetype_regex_overrides['^int-'] = ['vimshell','%{substitute(&ft, "int-", "", "")}'] + endif + + if exists(':Defx') + let s:filetype_overrides['defx'] = ['defx', '%{b:defx.paths[0]}'] + endif + + if get(g:, 'airline#extensions#branch#enabled', 1) && ( + \ airline#util#has_fugitive() || + \ airline#util#has_lawrencium() || + \ airline#util#has_vcscommand() || + \ airline#util#has_custom_scm()) + call airline#extensions#branch#init(s:ext) + call add(s:loaded_ext, 'branch') + endif + + if get(g:, 'airline#extensions#bufferline#enabled', 1) + \ && exists('*bufferline#get_status_string') + call airline#extensions#bufferline#init(s:ext) + call add(s:loaded_ext, 'bufferline') + endif + + if get(g:, 'airline#extensions#fugitiveline#enabled', 1) + \ && airline#util#has_fugitive() + \ && index(s:loaded_ext, 'bufferline') == -1 + call airline#extensions#fugitiveline#init(s:ext) + call add(s:loaded_ext, 'fugitiveline') + endif + + if (get(g:, 'airline#extensions#virtualenv#enabled', 1) && (exists(':VirtualEnvList') || isdirectory($VIRTUAL_ENV))) + call airline#extensions#virtualenv#init(s:ext) + call add(s:loaded_ext, 'virtualenv') + endif + + if (get(g:, 'airline#extensions#eclim#enabled', 1) && exists(':ProjectCreate')) + call airline#extensions#eclim#init(s:ext) + call add(s:loaded_ext, 'eclim') + endif + + if get(g:, 'airline#extensions#syntastic#enabled', 1) + \ && exists(':SyntasticCheck') + call airline#extensions#syntastic#init(s:ext) + call add(s:loaded_ext, 'syntastic') + endif + + if (get(g:, 'airline#extensions#ale#enabled', 1) && exists(':ALELint')) + call airline#extensions#ale#init(s:ext) + call add(s:loaded_ext, 'ale') + endif + + if (get(g:, 'airline#extensions#languageclient#enabled', 1) && exists(':LanguageClientStart')) + call airline#extensions#languageclient#init(s:ext) + call add(s:loaded_ext, 'languageclient') + endif + + if get(g:, 'airline#extensions#whitespace#enabled', 1) + call airline#extensions#whitespace#init(s:ext) + call add(s:loaded_ext, 'whitespace') + endif + + if (get(g:, 'airline#extensions#neomake#enabled', 1) && exists(':Neomake')) + call airline#extensions#neomake#init(s:ext) + call add(s:loaded_ext, 'neomake') + endif + + if get(g:, 'airline#extensions#po#enabled', 1) && executable('msgfmt') + call airline#extensions#po#init(s:ext) + call add(s:loaded_ext, 'po') + endif + + if get(g:, 'airline#extensions#wordcount#enabled', 1) + call airline#extensions#wordcount#init(s:ext) + call add(s:loaded_ext, 'wordcount') + endif + + if get(g:, 'airline#extensions#tabline#enabled', 0) + call airline#extensions#tabline#init(s:ext) + call add(s:loaded_ext, 'tabline') + endif + + if get(g:, 'airline#extensions#tmuxline#enabled', 1) && exists(':Tmuxline') + call airline#extensions#tmuxline#init(s:ext) + call add(s:loaded_ext, 'tmuxline') + endif + + if get(g:, 'airline#extensions#promptline#enabled', 1) && exists(':PromptlineSnapshot') && len(get(g:, 'airline#extensions#promptline#snapshot_file', '')) + call airline#extensions#promptline#init(s:ext) + call add(s:loaded_ext, 'promptline') + endif + + if get(g:, 'airline#extensions#nrrwrgn#enabled', 1) && exists(':NR') == 2 + call airline#extensions#nrrwrgn#init(s:ext) + call add(s:loaded_ext, 'nrrwrgn') + endif + + if get(g:, 'airline#extensions#unicode#enabled', 1) && exists(':UnicodeTable') == 2 + call airline#extensions#unicode#init(s:ext) + call add(s:loaded_ext, 'unicode') + endif + + if (get(g:, 'airline#extensions#capslock#enabled', 1) && exists('*CapsLockStatusline')) + call airline#extensions#capslock#init(s:ext) + call add(s:loaded_ext, 'capslock') + endif + + if (get(g:, 'airline#extensions#gutentags#enabled', 1) && get(g:, 'loaded_gutentags', 0)) + call airline#extensions#gutentags#init(s:ext) + call add(s:loaded_ext, 'gutentags') + endif + + if (get(g:, 'airline#extensions#grepper#enabled', 1) && get(g:, 'loaded_grepper', 0)) + call airline#extensions#grepper#init(s:ext) + call add(s:loaded_ext, 'grepper') + endif + + if (get(g:, 'airline#extensions#xkblayout#enabled', 1) && exists('g:XkbSwitchLib')) + call airline#extensions#xkblayout#init(s:ext) + call add(s:loaded_ext, 'xkblayout') + endif + + if (get(g:, 'airline#extensions#keymap#enabled', 1) && has('keymap')) + call airline#extensions#keymap#init(s:ext) + call add(s: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(s:loaded_ext, 'windowswap') + endif + + if (get(g:, 'airline#extensions#obsession#enabled', 1) && exists('*ObsessionStatus')) + call airline#extensions#obsession#init(s:ext) + call add(s:loaded_ext, 'obsession') + endif + + if get(g:, 'airline#extensions#vimtex#enabled', 1) + runtime autoload/vimtex.vim + if exists('*vimtex#init') + call airline#extensions#vimtex#init(s:ext) + call add(s:loaded_ext, 'vimtex') + endif + endif + + if (get(g:, 'airline#extensions#cursormode#enabled', 0)) + call airline#extensions#cursormode#init(s:ext) + call add(s:loaded_ext, 'cursormode') + endif + + if !get(g:, 'airline#extensions#disable_rtp_load', 0) + " load all other extensions, which are not part of the default distribution. + " (autoload/airline/extensions/*.vim outside of our s:script_path). + for file in split(globpath(&rtp, "autoload/airline/extensions/*.vim"), "\n") + " we have to check both resolved and unresolved paths, since it's possible + " that they might not get resolved properly (see #187) + if stridx(tolower(resolve(fnamemodify(file, ':p'))), s:script_path) < 0 + \ && stridx(tolower(fnamemodify(file, ':p')), s:script_path) < 0 + let name = fnamemodify(file, ':t:r') + if !get(g:, 'airline#extensions#'.name.'#enabled', 1) || + \ index(s:loaded_ext, name) > -1 + continue + endif + try + call airline#extensions#{name}#init(s:ext) + catch + endtry + endif + endfor + endif +endfunction + +function! airline#extensions#get_loaded_extensions() + return s:loaded_ext +endfunction diff --git a/.vim/autoload/airline/extensions/ale.vim b/.vim/autoload/airline/extensions/ale.vim new file mode 100644 index 0000000..71f6317 --- /dev/null +++ b/.vim/autoload/airline/extensions/ale.vim @@ -0,0 +1,88 @@ +" MIT License. Copyright (c) 2013-2018 Bjorn Neergaard, w0rp et al. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +function! s:airline_ale_count(cnt, symbol) + return a:cnt ? a:symbol. a:cnt : '' +endfunction + +function! s:airline_ale_get_line_number(cnt, type) abort + if a:cnt == 0 + return '' + endif + + let buffer = bufnr('') + let problem_type = (a:type ==# 'error') ? 'E' : 'W' + let problems = copy(ale#engine#GetLoclist(buffer)) + + call filter(problems, 'v:val.bufnr is buffer && v:val.type is# problem_type') + + if empty(problems) + return '' + endif + + let open_lnum_symbol = get(g:, 'airline#extensions#ale#open_lnum_symbol', '(L') + let close_lnum_symbol = get(g:, 'airline#extensions#ale#close_lnum_symbol', ')') + + return open_lnum_symbol . problems[0].lnum . close_lnum_symbol +endfunction + +function! airline#extensions#ale#get(type) + if !exists(':ALELint') + return '' + endif + + let error_symbol = get(g:, 'airline#extensions#ale#error_symbol', 'E:') + let warning_symbol = get(g:, 'airline#extensions#ale#warning_symbol', 'W:') + let checking_symbol = get(g:, 'airline#extensions#ale#checking_symbol', '...') + let show_line_numbers = get(g:, 'airline#extensions#ale#show_line_numbers', 1) + + let is_err = a:type ==# 'error' + + if ale#engine#IsCheckingBuffer(bufnr('')) == 1 + return is_err ? '' : checking_symbol + endif + + let symbol = is_err ? error_symbol : warning_symbol + + let counts = ale#statusline#Count(bufnr('')) + if type(counts) == type({}) && has_key(counts, 'error') + " Use the current Dictionary format. + let errors = counts.error + counts.style_error + let num = is_err ? errors : counts.total - errors + else + " Use the old List format. + let num = is_err ? counts[0] : counts[1] + endif + + if show_line_numbers == 1 + return s:airline_ale_count(num, symbol) . <sid>airline_ale_get_line_number(num, a:type) + else + return s:airline_ale_count(num, symbol) + endif +endfunction + +function! airline#extensions#ale#get_warning() + return airline#extensions#ale#get('warning') +endfunction + +function! airline#extensions#ale#get_error() + return airline#extensions#ale#get('error') +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() + autocmd User ALEJobStarted,ALELintPost call <sid>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/autoload/airline/extensions/branch.vim b/.vim/autoload/airline/extensions/branch.vim new file mode 100644 index 0000000..fcf4d3a --- /dev/null +++ b/.vim/autoload/airline/extensions/branch.vim @@ -0,0 +1,312 @@ +" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +" 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 +" has not been initialized yet or the current file is not in +" an active branch. +" 'untracked' - Cache of untracked files represented as a dictionary with files +" as keys. A file has a not exists symbol set as its value if it +" is untracked. A file is present in this dictionary iff its +" status is considered up to date. +" 'untracked_mark' - used as regexp to test against the output of 'cmd' +let s:vcs_config = { +\ 'git': { +\ 'exe': 'git', +\ 'cmd': 'git status --porcelain -- ', +\ 'untracked_mark': '??', +\ 'exclude': '\.git', +\ 'update_branch': 's:update_git_branch', +\ 'display_branch': 's:display_git_branch', +\ 'branch': '', +\ 'untracked': {}, +\ }, +\ 'mercurial': { +\ 'exe': 'hg', +\ 'cmd': 'hg status -u -- ', +\ 'untracked_mark': '?', +\ 'exclude': '\.hg', +\ 'update_branch': 's:update_hg_branch', +\ 'display_branch': 's:display_hg_branch', +\ 'branch': '', +\ 'untracked': {}, +\ }, +\} + +" Initializes b:buffer_vcs_config. b:buffer_vcs_config caches the branch and +" untracked status of the file in the buffer. Caching those fields is necessary, +" because s:vcs_config may be updated asynchronously and s:vcs_config fields may +" be invalid during those updates. b:buffer_vcs_config fields are updated +" whenever corresponding fields in s:vcs_config are updated or an inconsistency +" is detected during update_* operation. +" +" b:airline_head caches the head string it is empty iff it needs to be +" recalculated. b:airline_head is recalculated based on b:buffer_vcs_config. +function! s:init_buffer() + let b:buffer_vcs_config = {} + for vcs in keys(s:vcs_config) + let b:buffer_vcs_config[vcs] = { + \ 'branch': '', + \ 'untracked': '', + \ } + endfor + unlet! b:airline_head +endfunction + +let s:head_format = get(g:, 'airline#extensions#branch#format', 0) +if s:head_format == 1 + function! s:format_name(name) + return fnamemodify(a:name, ':t') + endfunction +elseif s:head_format == 2 + function! s:format_name(name) + return pathshorten(a:name) + endfunction +elseif type(s:head_format) == type('') + function! s:format_name(name) + return call(s:head_format, [a:name]) + endfunction +else + function! s:format_name(name) + return a:name + endfunction +endif + + +" Fugitive special revisions. call '0' "staging" ? +let s:names = {'0': 'index', '1': 'orig', '2':'fetch', '3':'merge'} +let s:sha1size = get(g:, 'airline#extensions#branch#sha1_len', 7) + +function! s:update_git_branch() + if !airline#util#has_fugitive() + let s:vcs_config['git'].branch = '' + return + endif + + let s:vcs_config['git'].branch = exists("*FugitiveHead") ? + \ FugitiveHead(s:sha1size) : fugitive#head(s:sha1size) + if s:vcs_config['git'].branch is# 'master' && winwidth(0) < 81 + " Shorten default a bit + let s:vcs_config['git'].branch='mas' + endif +endfunction + +function! s:display_git_branch() + let name = b:buffer_vcs_config['git'].branch + try + let commit = fugitive#buffer().commit() + + if has_key(s:names, commit) + let name = get(s:names, commit)."(".name.")" + elseif !empty(commit) + let ref = fugitive#repo().git_chomp('describe', '--all', '--exact-match', commit) + if ref !~ "^fatal: no tag exactly matches" + let name = s:format_name(substitute(ref, '\v\C^%(heads/|remotes/|tags/)=','',''))."(".name.")" + else + let name = matchstr(commit, '.\{'.s:sha1size.'}')."(".name.")" + endif + endif + catch + endtry + + return name +endfunction + +function! s:update_hg_branch() + if airline#util#has_lawrencium() + let cmd='LC_ALL=C hg qtop' + let stl=lawrencium#statusline() + let file=expand('%:p') + if !empty(stl) && get(b:, 'airline_do_mq_check', 1) + if g:airline#init#vim_async + noa call airline#async#get_mq_async(cmd, file) + elseif has("nvim") + noa call airline#async#nvim_get_mq_async(cmd, file) + else + " remove \n at the end of the command + let output=system(cmd)[0:-2] + noa call airline#async#mq_output(output, file) + endif + endif + " do not do mq check anymore + let b:airline_do_mq_check = 0 + if exists("b:mq") && !empty(b:mq) + if stl is# 'default' + " Shorten default a bit + let stl='def' + endif + let stl.=' ['.b:mq.']' + endif + let s:vcs_config['mercurial'].branch = stl + else + let s:vcs_config['mercurial'].branch = '' + endif +endfunction + +function! s:display_hg_branch() + return b:buffer_vcs_config['mercurial'].branch +endfunction + +function! s:update_branch() + for vcs in keys(s:vcs_config) + call {s:vcs_config[vcs].update_branch}() + if b:buffer_vcs_config[vcs].branch != s:vcs_config[vcs].branch + let b:buffer_vcs_config[vcs].branch = s:vcs_config[vcs].branch + unlet! b:airline_head + endif + endfor +endfunction + +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 + let b:buffer_vcs_config[a:vcs].untracked = s:vcs_config[a:vcs].untracked[a:file] + unlet! b:airline_head + endif +endfunction + +function! s:update_untracked() + let file = expand("%:p") + if empty(file) || isdirectory(file) + return + endif + + let needs_update = 1 + for vcs in keys(s:vcs_config) + if file =~ s:vcs_config[vcs].exclude + " Skip check for files that live in the exclude directory + let needs_update = 0 + endif + 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 !needs_update + return + endif + + for vcs in keys(s:vcs_config) + 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. + noa call airline#async#vim_vcs_untracked(config, file) + else + " nvim async or vim without job-feature + noa call airline#async#nvim_vcs_untracked(config, file, vcs) + endif + endfor +endfunction + +function! airline#extensions#branch#head() + if !exists('b:buffer_vcs_config') + call s:init_buffer() + endif + + call s:update_branch() + call s:update_untracked() + + if exists('b:airline_head') && !empty(b:airline_head) + return b:airline_head + endif + + let b:airline_head = '' + let vcs_priority = get(g:, "airline#extensions#branch#vcs_priority", ["git", "mercurial"]) + + let heads = [] + for vcs in vcs_priority + if !empty(b:buffer_vcs_config[vcs].branch) + let heads += [vcs] + endif + endfor + + for vcs in heads + if !empty(b:airline_head) + let b:airline_head .= ' | ' + endif + if len(heads) > 1 + let b:airline_head .= s:vcs_config[vcs].exe .':' + endif + let b:airline_head .= s:format_name({s:vcs_config[vcs].display_branch}()) + let b:airline_head .= b:buffer_vcs_config[vcs].untracked + endfor + + if empty(heads) + if airline#util#has_vcscommand() + noa call VCSCommandEnableBufferSetup() + if exists('b:VCSCommandBufferInfo') + let b:airline_head = s:format_name(get(b:VCSCommandBufferInfo, 0, '')) + endif + endif + endif + + if empty(heads) + if airline#util#has_custom_scm() + try + let Fn = function(g:airline#extensions#branch#custom_head) + let b:airline_head = Fn() + endtry + endif + endif + + if exists("g:airline#extensions#branch#displayed_head_limit") + let w:displayed_head_limit = g:airline#extensions#branch#displayed_head_limit + if len(b:airline_head) > w:displayed_head_limit - 1 + let b:airline_head = b:airline_head[0:(w:displayed_head_limit - 1)].(&encoding ==? 'utf-8' ? '…' : '.') + endif + endif + + let minwidth = empty(get(b:, 'airline_hunks', '')) ? 14 : 7 + let b:airline_head = airline#util#shorten(b:airline_head, 120, minwidth) + return b:airline_head +endfunction + +function! airline#extensions#branch#get_head() + let head = airline#extensions#branch#head() + let empty_message = get(g:, 'airline#extensions#branch#empty_message', '') + let symbol = get(g:, 'airline#extensions#branch#symbol', g:airline_symbols.branch) + return empty(head) + \ ? empty_message + \ : printf('%s%s', empty(symbol) ? '' : symbol.(g:airline_symbols.space), head) +endfunction + +function! s:reset_untracked_cache(shellcmdpost) + " shellcmdpost - whether function was called as a result of ShellCmdPost hook + 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 + " v:shell_error with a system() call inside get_*_untracked. + if v:shell_error + return + endif + endif + endif + + 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 airline#extensions#branch#update_untracked_config(file, vcs) + let s:vcs_config[vcs].untracked = {} + endfor +endfunction + +function! airline#extensions#branch#init(ext) + call airline#parts#define_function('branch', 'airline#extensions#branch#get_head') + + autocmd ShellCmdPost,CmdwinLeave * unlet! b:airline_head b:airline_do_mq_check + autocmd User AirlineBeforeRefresh unlet! b:airline_head b:airline_do_mq_check + autocmd BufWritePost * call s:reset_untracked_cache(0) + autocmd ShellCmdPost * call s:reset_untracked_cache(1) +endfunction diff --git a/.vim/autoload/airline/extensions/bufferline.vim b/.vim/autoload/airline/extensions/bufferline.vim new file mode 100644 index 0000000..b7ccc09 --- /dev/null +++ b/.vim/autoload/airline/extensions/bufferline.vim @@ -0,0 +1,29 @@ +" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +if !exists('*bufferline#get_status_string') + finish +endif + +let s:overwrite = get(g:, 'airline#extensions#bufferline#overwrite_variables', 1) + +function! airline#extensions#bufferline#init(ext) + if s:overwrite + highlight bufferline_selected gui=bold cterm=bold term=bold + highlight link bufferline_selected_inactive airline_c_inactive + let g:bufferline_inactive_highlight = 'airline_c' + let g:bufferline_active_highlight = 'bufferline_selected' + let g:bufferline_active_buffer_left = '' + let g:bufferline_active_buffer_right = '' + let g:bufferline_separator = g:airline_symbols.space + endif + + if exists("+autochdir") && &autochdir == 1 + " if 'acd' is set, vim-airline uses the path section, so we need ot redefine this here as well + call airline#parts#define_raw('path', '%{bufferline#refresh_status()}'.bufferline#get_status_string()) + else + call airline#parts#define_raw('file', '%{bufferline#refresh_status()}'.bufferline#get_status_string()) + endif +endfunction diff --git a/.vim/autoload/airline/extensions/capslock.vim b/.vim/autoload/airline/extensions/capslock.vim new file mode 100644 index 0000000..55b28da --- /dev/null +++ b/.vim/autoload/airline/extensions/capslock.vim @@ -0,0 +1,16 @@ +" MIT License. Copyright (c) 2014-2018 Mathias Andersson et al. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +if !exists('*CapsLockStatusline') + finish +endif + +function! airline#extensions#capslock#status() + return tolower(CapsLockStatusline()) == '[caps]' ? 'CAPS' : '' +endfunction + +function! airline#extensions#capslock#init(ext) + call airline#parts#define_function('capslock', 'airline#extensions#capslock#status') +endfunction diff --git a/.vim/autoload/airline/extensions/commandt.vim b/.vim/autoload/airline/extensions/commandt.vim new file mode 100644 index 0000000..1e05a58 --- /dev/null +++ b/.vim/autoload/airline/extensions/commandt.vim @@ -0,0 +1,18 @@ +" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +if !get(g:, 'command_t_loaded', 0) + finish +endif + +function! airline#extensions#commandt#apply(...) + if bufname('%') ==# 'GoToFile' + call airline#extensions#apply_left_override('CommandT', '') + endif +endfunction + +function! airline#extensions#commandt#init(ext) + call a:ext.add_statusline_func('airline#extensions#commandt#apply') +endfunction diff --git a/.vim/autoload/airline/extensions/csv.vim b/.vim/autoload/airline/extensions/csv.vim new file mode 100644 index 0000000..d0eb64b --- /dev/null +++ b/.vim/autoload/airline/extensions/csv.vim @@ -0,0 +1,32 @@ +" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +if !get(g:, 'loaded_csv', 0) && !exists(':Table') + finish +endif + +let s:column_display = get(g:, 'airline#extensions#csv#column_display', 'Number') + +function! airline#extensions#csv#get_column() + if exists('*CSV_WCol') + if s:column_display ==# 'Name' + return '['.CSV_WCol('Name').CSV_WCol().']' + else + return '['.CSV_WCol().']' + endif + endif + return '' +endfunction + +function! airline#extensions#csv#apply(...) + if &ft ==# "csv" + call airline#extensions#prepend_to_section('gutter', + \ g:airline_left_alt_sep.' %{airline#extensions#csv#get_column()}') + endif +endfunction + +function! airline#extensions#csv#init(ext) + call a:ext.add_statusline_func('airline#extensions#csv#apply') +endfunction diff --git a/.vim/autoload/airline/extensions/ctrlp.vim b/.vim/autoload/airline/extensions/ctrlp.vim new file mode 100644 index 0000000..c477a6a --- /dev/null +++ b/.vim/autoload/airline/extensions/ctrlp.vim @@ -0,0 +1,81 @@ +" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +if !get(g:, 'loaded_ctrlp', 0) + finish +endif + +let s:color_template = get(g:, 'airline#extensions#ctrlp#color_template', 'insert') + +function! airline#extensions#ctrlp#generate_color_map(dark, light, white) + return { + \ 'CtrlPdark' : a:dark, + \ 'CtrlPlight' : a:light, + \ 'CtrlPwhite' : a:white, + \ 'CtrlParrow1' : [ a:light[1] , a:white[1] , a:light[3] , a:white[3] , '' ] , + \ 'CtrlParrow2' : [ a:white[1] , a:light[1] , a:white[3] , a:light[3] , '' ] , + \ 'CtrlParrow3' : [ a:light[1] , a:dark[1] , a:light[3] , a:dark[3] , '' ] , + \ } +endfunction + +function! airline#extensions#ctrlp#load_theme(palette) + if exists('a:palette.ctrlp') + let theme = a:palette.ctrlp + else + let s:color_template = has_key(a:palette, s:color_template) ? s:color_template : 'insert' + let theme = airline#extensions#ctrlp#generate_color_map( + \ a:palette[s:color_template]['airline_c'], + \ a:palette[s:color_template]['airline_b'], + \ a:palette[s:color_template]['airline_a']) + endif + for key in keys(theme) + call airline#highlighter#exec(key, theme[key]) + endfor +endfunction + +" Arguments: focus, byfname, regexp, prv, item, nxt, marked +function! airline#extensions#ctrlp#ctrlp_airline(...) + let b = airline#builder#new({'active': 1}) + if a:2 == 'file' + call b.add_section_spaced('CtrlPlight', 'by fname') + endif + if a:3 + call b.add_section_spaced('CtrlPlight', 'regex') + endif + if get(g:, 'airline#extensions#ctrlp#show_adjacent_modes', 1) + call b.add_section_spaced('CtrlPlight', a:4) + call b.add_section_spaced('CtrlPwhite', a:5) + call b.add_section_spaced('CtrlPlight', a:6) + else + call b.add_section_spaced('CtrlPwhite', a:5) + endif + call b.add_section_spaced('CtrlPdark', a:7) + call b.split() + call b.add_section_spaced('CtrlPdark', a:1) + call b.add_section_spaced('CtrlPdark', a:2) + call b.add_section_spaced('CtrlPlight', '%{getcwd()}') + return b.build() +endfunction + +" Argument: len +function! airline#extensions#ctrlp#ctrlp_airline_status(...) + let len = '%#CtrlPdark# '.a:1 + let dir = '%=%<%#CtrlParrow3#'.g:airline_right_sep.'%#CtrlPlight# '.getcwd().' %*' + return len.dir +endfunction + +function! airline#extensions#ctrlp#apply(...) + " disable statusline overwrite if ctrlp already did it + return match(&statusline, 'CtrlPwhite') >= 0 ? -1 : 0 +endfunction + +function! airline#extensions#ctrlp#init(ext) + let g:ctrlp_status_func = { + \ 'main': 'airline#extensions#ctrlp#ctrlp_airline', + \ 'prog': 'airline#extensions#ctrlp#ctrlp_airline_status', + \ } + call a:ext.add_statusline_func('airline#extensions#ctrlp#apply') + call a:ext.add_theme_func('airline#extensions#ctrlp#load_theme') +endfunction diff --git a/.vim/autoload/airline/extensions/ctrlspace.vim b/.vim/autoload/airline/extensions/ctrlspace.vim new file mode 100644 index 0000000..66f29a5 --- /dev/null +++ b/.vim/autoload/airline/extensions/ctrlspace.vim @@ -0,0 +1,20 @@ +" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +let s:spc = g:airline_symbols.space +let s:padding = s:spc . s:spc . s:spc +let s:cs = ctrlspace#context#Configuration().Symbols.CS + +function! airline#extensions#ctrlspace#statusline(...) + let b = airline#builder#new({ 'active': 1 }) + call b.add_section('airline_b', s:cs . s:padding . ctrlspace#api#StatuslineModeSegment(s:padding)) + call b.split() + call b.add_section('airline_x', s:spc . ctrlspace#api#StatuslineTabSegment() . s:spc) + return b.build() +endfunction + +function! airline#extensions#ctrlspace#init(ext) + let g:CtrlSpaceStatuslineFunction = "airline#extensions#ctrlspace#statusline()" +endfunction diff --git a/.vim/autoload/airline/extensions/cursormode.vim b/.vim/autoload/airline/extensions/cursormode.vim new file mode 100644 index 0000000..097ddd8 --- /dev/null +++ b/.vim/autoload/airline/extensions/cursormode.vim @@ -0,0 +1,132 @@ +" Copyright (C) 2014 Andrea Cedraro <a.cedraro@gmail.com> +" Copyright (C) 2017 Eduardo Suarez-Santana <e.suarezsantana@gmail.com> +" +" Permission is hereby granted, free of charge, to any person obtaining +" a copy of this software and associated documentation files (the "Software"), +" to deal in the Software without restriction, including without limitation +" the rights to use, copy, modify, merge, publish, distribute, sublicense, +" and/or sell copies of the Software, and to permit persons to whom the +" Software is furnished to do so, subject to the following conditions: +" +" The above copyright notice and this permission notice shall be included +" in all copies or substantial portions of the Software. +" +" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +" EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +" OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +" IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +" DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +" TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE +" OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +scriptencoding utf-8 + +let s:is_win = has('win32') || has('win64') +let s:is_iTerm = exists('$TERM_PROGRAM') && $TERM_PROGRAM =~# 'iTerm.app' +let s:is_AppleTerminal = exists('$TERM_PROGRAM') && $TERM_PROGRAM =~# 'Apple_Terminal' + +let s:is_good = !has('gui_running') && !s:is_win && !s:is_AppleTerminal + +let s:last_mode = '' + +if !exists('g:cursormode_exit_mode') + let g:cursormode_exit_mode='n' +endif + +function! airline#extensions#cursormode#tmux_escape(escape) + return '\033Ptmux;'.substitute(a:escape, '\\033', '\\033\\033', 'g').'\033\\' +endfunction + +let s:iTerm_escape_template = '\033]Pl%s\033\\' +let s:xterm_escape_template = '\033]12;%s\007' + +function! s:get_mode() + return call(get(g:, 'cursormode_mode_func', 'mode'), []) +endfunction + +function! airline#extensions#cursormode#set(...) + let mode = s:get_mode() + if mode !=# s:last_mode + let s:last_mode = mode + call s:set_cursor_color_for(mode) + endif + return '' +endfunction + +function! s:set_cursor_color_for(mode) + let mode = a:mode + for mode in [a:mode, a:mode.&background] + if has_key(s:color_map, mode) + try + let save_eventignore = &eventignore + set eventignore=all + let save_shelltemp = &shelltemp + set noshelltemp + + silent call system(s:build_command(s:color_map[mode])) + return + finally + let &shelltemp = save_shelltemp + let &eventignore = save_eventignore + endtry + endif + endfor +endfunction + +function! s:build_command(color) + if s:is_iTerm + let color = substitute(a:color, '^#', '', '') + let escape_template = s:iTerm_escape_template + else + let color = a:color + let escape_template = s:xterm_escape_template + endif + + let escape = printf(escape_template, color) + if exists('$TMUX') + let escape = airline#extensions#cursormode#tmux_escape(escape) + endif + return "printf '".escape."' > /dev/tty" +endfunction + +function! s:get_color_map() + if exists('g:cursormode_color_map') + return g:cursormode_color_map + endif + + try + let map = g:cursormode#{g:colors_name}#color_map + return map + catch + return { + \ "nlight": "#000000", + \ "ndark": "#BBBBBB", + \ "i": "#0000BB", + \ "v": "#FF5555", + \ "V": "#BBBB00", + \ "\<C-V>": "#BB00BB", + \ } + endtry +endfunction + +augroup airline#extensions#cursormode + autocmd! + autocmd VimLeave * nested call s:set_cursor_color_for(g:cursormode_exit_mode) + " autocmd VimEnter * call airline#extensions#cursormode#activate() + autocmd Colorscheme * call airline#extensions#cursormode#activate() +augroup END + +function! airline#extensions#cursormode#activate() + let s:color_map = s:get_color_map() + call airline#extensions#cursormode#set() +endfunction + +function! airline#extensions#cursormode#apply(...) + let w:airline_section_a = get(w:, 'airline_section_a', g:airline_section_a) + let w:airline_section_a .= '%{airline#extensions#cursormode#set()}' +endfunction + +function! airline#extensions#cursormode#init(ext) + let s:color_map = s:get_color_map() + call a:ext.add_statusline_func('airline#extensions#cursormode#apply') +endfunction diff --git a/.vim/autoload/airline/extensions/default.vim b/.vim/autoload/airline/extensions/default.vim new file mode 100644 index 0000000..f9ca3d4 --- /dev/null +++ b/.vim/autoload/airline/extensions/default.vim @@ -0,0 +1,100 @@ +" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +let s:section_use_groups = get(g:, 'airline#extensions#default#section_use_groupitems', 1) +let s:section_truncate_width = get(g:, 'airline#extensions#default#section_truncate_width', { + \ 'b': 79, + \ 'x': 60, + \ 'y': 88, + \ 'z': 45, + \ 'warning': 80, + \ 'error': 80, + \ }) +let s:layout = get(g:, 'airline#extensions#default#layout', [ + \ [ 'a', 'b', 'c' ], + \ [ 'x', 'y', 'z', 'warning', 'error' ] + \ ]) + +function! s:get_section(winnr, key, ...) + if has_key(s:section_truncate_width, a:key) + if winwidth(a:winnr) < s:section_truncate_width[a:key] + return '' + endif + endif + let spc = g:airline_symbols.space + if !exists('g:airline_section_{a:key}') + return '' + endif + let text = airline#util#getwinvar(a:winnr, 'airline_section_'.a:key, g:airline_section_{a:key}) + let [prefix, suffix] = [get(a:000, 0, '%('.spc), get(a:000, 1, spc.'%)')] + return empty(text) ? '' : prefix.text.suffix +endfunction + +function! s:build_sections(builder, context, keys) + for key in a:keys + if (key == 'warning' || key == 'error') && !a:context.active + continue + endif + call s:add_section(a:builder, a:context, key) + endfor +endfunction + +" There still is a highlighting bug when using groups %(%) in the statusline, +" deactivate it, unless it is fixed (7.4.1511) +if s:section_use_groups && (v:version >= 704 || (v:version >= 703 && has('patch81'))) + function! s:add_section(builder, context, key) + let condition = (a:key is# "warning" || a:key is# "error") && + \ (v:version == 704 && !has("patch1511")) + " i have no idea why the warning section needs special treatment, but it's + " needed to prevent separators from showing up + if ((a:key == 'error' || a:key == 'warning') && empty(s:get_section(a:context.winnr, a:key))) + return + endif + if condition + call a:builder.add_raw('%(') + endif + call a:builder.add_section('airline_'.a:key, s:get_section(a:context.winnr, a:key)) + if condition + call a:builder.add_raw('%)') + endif + endfunction +else + " older version don't like the use of %(%) + function! s:add_section(builder, context, key) + if ((a:key == 'error' || a:key == 'warning') && empty(s:get_section(a:context.winnr, a:key))) + return + endif + if a:key == 'warning' + call a:builder.add_raw('%#airline_warning#'.s:get_section(a:context.winnr, a:key)) + elseif a:key == 'error' + call a:builder.add_raw('%#airline_error#'.s:get_section(a:context.winnr, a:key)) + else + call a:builder.add_section('airline_'.a:key, s:get_section(a:context.winnr, a:key)) + endif + endfunction +endif + +function! airline#extensions#default#apply(builder, context) + let winnr = a:context.winnr + let active = a:context.active + + if airline#util#getwinvar(winnr, 'airline_render_left', active || (!active && !g:airline_inactive_collapse)) + call s:build_sections(a:builder, a:context, s:layout[0]) + else + let text = s:get_section(winnr, 'c') + if empty(text) + let text = ' %f%m ' + endif + call a:builder.add_section('airline_c'.(a:context.bufnr), text) + endif + + call a:builder.split(s:get_section(winnr, 'gutter', '', '')) + + if airline#util#getwinvar(winnr, 'airline_render_right', 1) + call s:build_sections(a:builder, a:context, s:layout[1]) + endif + + return 1 +endfunction diff --git a/.vim/autoload/airline/extensions/denite.vim b/.vim/autoload/airline/extensions/denite.vim new file mode 100644 index 0000000..e3c1f3b --- /dev/null +++ b/.vim/autoload/airline/extensions/denite.vim @@ -0,0 +1,41 @@ +" MIT License. Copyright (c) 2017-2018 Thomas Dy et al. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +if !get(g:, 'loaded_denite', 0) + finish +endif + +" Denite does not use vim's built-in modal editing but has a custom prompt +" that implements its own insert/normal mode so we have to handle changing the +" highlight +function! airline#extensions#denite#check_denite_mode(bufnr) + 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 + +function! airline#extensions#denite#apply(...) + if &ft == 'denite' + let w:airline_skip_empty_sections = 0 + call a:1.add_section('airline_a', ' Denite %{airline#extensions#denite#check_denite_mode('.a:2['bufnr'].')}') + call a:1.add_section('airline_c', ' %{denite#get_status_sources()}') + call a:1.split() + call a:1.add_section('airline_y', ' %{denite#get_status_path()} ') + call a:1.add_section('airline_z', ' %{denite#get_status_linenr()} ') + return 1 + endif +endfunction + +function! airline#extensions#denite#init(ext) + call denite#custom#option('_', 'statusline', 0) + call a:ext.add_statusline_func('airline#extensions#denite#apply') +endfunction diff --git a/.vim/autoload/airline/extensions/eclim.vim b/.vim/autoload/airline/extensions/eclim.vim new file mode 100644 index 0000000..3c48d75 --- /dev/null +++ b/.vim/autoload/airline/extensions/eclim.vim @@ -0,0 +1,61 @@ +" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +if !exists(':ProjectCreate') + finish +endif + +function! airline#extensions#eclim#creat_line(...) + if &filetype == "tree" + let builder = a:1 + call builder.add_section('airline_a', ' Project ') + call builder.add_section('airline_b', ' %f ') + call builder.add_section('airline_c', '') + return 1 + endif +endfunction + +function! airline#extensions#eclim#get_warnings() + " Cache vavlues, so that it isn't called too often + if exists("s:eclim_errors") && + \ get(b:, 'airline_changenr', 0) == changenr() + return s:eclim_errors + endif + let eclimList = eclim#display#signs#GetExisting() + let s:eclim_errors = '' + + if !empty(eclimList) + " Remove any non-eclim signs (see eclim#display#signs#Update) + " First check for just errors since they are more important. + " If there are no errors, then check for warnings. + let errorList = filter(copy(eclimList), 'v:val.name =~ "^\\(qf_\\)\\?\\(error\\)$"') + + if (empty(errorList)) + " use the warnings + call filter(eclimList, 'v:val.name =~ "^\\(qf_\\)\\?\\(warning\\)$"') + let type = 'W' + else + " Use the errors + let eclimList = errorList + let type = 'E' + endif + + if !empty(eclimList) + let errorsLine = eclimList[0]['line'] + let errorsNumber = len(eclimList) + let errors = "[Eclim:" . type . " line:".string(errorsLine)." (".string(errorsNumber).")]" + if !exists(':SyntasticCheck') || SyntasticStatuslineFlag() == '' + let s:eclim_errors = errors.(g:airline_symbols.space) + endif + endif + endif + let b:airline_changenr = changenr() + return s:eclim_errors +endfunction + +function! airline#extensions#eclim#init(ext) + call airline#parts#define_function('eclim', 'airline#extensions#eclim#get_warnings') + call a:ext.add_statusline_func('airline#extensions#eclim#creat_line') +endfunction diff --git a/.vim/autoload/airline/extensions/example.vim b/.vim/autoload/airline/extensions/example.vim new file mode 100644 index 0000000..50a327d --- /dev/null +++ b/.vim/autoload/airline/extensions/example.vim @@ -0,0 +1,55 @@ +" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +" we don't actually want this loaded :P +finish + +" Due to some potential rendering issues, the use of the `space` variable is +" recommended. +let s:spc = g:airline_symbols.space + +" Extension specific variables can be defined the usual fashion. +if !exists('g:airline#extensions#example#number_of_cats') + let g:airline#extensions#example#number_of_cats = 42 +endif + +" First we define an init function that will be invoked from extensions.vim +function! airline#extensions#example#init(ext) + + " Here we define a new part for the plugin. This allows users to place this + " extension in arbitrary locations. + call airline#parts#define_raw('cats', '%{airline#extensions#example#get_cats()}') + + " Next up we add a funcref so that we can run some code prior to the + " statusline getting modifed. + call a:ext.add_statusline_func('airline#extensions#example#apply') + + " You can also add a funcref for inactive statuslines. + " call a:ext.add_inactive_statusline_func('airline#extensions#example#unapply') +endfunction + +" This function will be invoked just prior to the statusline getting modified. +function! airline#extensions#example#apply(...) + " First we check for the filetype. + if &filetype == "nyancat" + + " Let's say we want to append to section_c, first we check if there's + " already a window-local override, and if not, create it off of the global + " section_c. + let w:airline_section_c = get(w:, 'airline_section_c', g:airline_section_c) + + " Then we just append this extenion to it, optionally using separators. + let w:airline_section_c .= s:spc.g:airline_left_alt_sep.s:spc.'%{airline#extensions#example#get_cats()}' + endif +endfunction + +" Finally, this function will be invoked from the statusline. +function! airline#extensions#example#get_cats() + let cats = '' + for i in range(1, g:airline#extensions#example#number_of_cats) + let cats .= ' (,,,)=(^.^)=(,,,) ' + endfor + return cats +endfunction diff --git a/.vim/autoload/airline/extensions/fugitiveline.vim b/.vim/autoload/airline/extensions/fugitiveline.vim new file mode 100644 index 0000000..5dab995 --- /dev/null +++ b/.vim/autoload/airline/extensions/fugitiveline.vim @@ -0,0 +1,49 @@ +" MIT License. Copyright (c) 2017-2018 Cimbali et al +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +if !airline#util#has_fugitive() + finish +endif + + +if exists("+autochdir") && &autochdir == 1 + let s:fmod = ':p' +else + let s:fmod = ':.' +endif + +function! airline#extensions#fugitiveline#bufname() + if !exists('b:fugitive_name') + let b:fugitive_name = '' + try + if bufname('%') =~? '^fugitive:' && exists('*FugitiveReal') + let b:fugitive_name = FugitiveReal(bufname('%')) + elseif exists('b:git_dir') + let buffer = fugitive#buffer() + if buffer.type('blob') + let b:fugitive_name = buffer.repo().translate(buffer.path('/')) + endif + endif + catch + endtry + endif + + if empty(b:fugitive_name) + return fnamemodify(bufname('%'), s:fmod) + else + return fnamemodify(b:fugitive_name, s:fmod) + endif +endfunction + +function! airline#extensions#fugitiveline#init(ext) + if exists("+autochdir") && &autochdir == 1 + " if 'acd' is set, vim-airline uses the path section, so we need to redefine this here as well + call airline#parts#define_raw('path', '%<%{airline#extensions#fugitiveline#bufname()}%m') + else + call airline#parts#define_raw('file', '%<%{airline#extensions#fugitiveline#bufname()}%m') + endif + autocmd ShellCmdPost,CmdwinLeave * unlet! b:fugitive_name + autocmd User AirlineBeforeRefresh unlet! b:fugitive_name +endfunction diff --git a/.vim/autoload/airline/extensions/grepper.vim b/.vim/autoload/airline/extensions/grepper.vim new file mode 100644 index 0000000..3e5debf --- /dev/null +++ b/.vim/autoload/airline/extensions/grepper.vim @@ -0,0 +1,19 @@ +" MIT License. Copyright (c) 2014-2018 Mathias Andersson et al. +" vim: et ts=2 sts=2 sw=2 + +" Heavily derived from the Gutentags extension + +scriptencoding utf-8 + +if !get(g:, 'loaded_grepper', 0) + finish +endif + +function! airline#extensions#grepper#status() + let msg = grepper#statusline() + return empty(msg) ? '' : 'grepper' +endfunction + +function! airline#extensions#grepper#init(ext) + call airline#parts#define_function('grepper', 'airline#extensions#grepper#status') +endfunction diff --git a/.vim/autoload/airline/extensions/gutentags.vim b/.vim/autoload/airline/extensions/gutentags.vim new file mode 100644 index 0000000..4af2d78 --- /dev/null +++ b/.vim/autoload/airline/extensions/gutentags.vim @@ -0,0 +1,17 @@ +" MIT License. Copyright (c) 2014-2018 Mathias Andersson et al. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +if !get(g:, 'loaded_gutentags', 0) + finish +endif + +function! airline#extensions#gutentags#status() + let msg = gutentags#statusline() + return empty(msg) ? '' : 'Gen. ' . msg +endfunction + +function! airline#extensions#gutentags#init(ext) + call airline#parts#define_function('gutentags', 'airline#extensions#gutentags#status') +endfunction diff --git a/.vim/autoload/airline/extensions/hunks.vim b/.vim/autoload/airline/extensions/hunks.vim new file mode 100644 index 0000000..aba84cc --- /dev/null +++ b/.vim/autoload/airline/extensions/hunks.vim @@ -0,0 +1,93 @@ +" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +if !get(g:, 'loaded_signify', 0) && !get(g:, 'loaded_gitgutter', 0) && !get(g:, 'loaded_changes', 0) && !get(g:, 'loaded_quickfixsigns', 0) + finish +endif + +let s:non_zero_only = get(g:, 'airline#extensions#hunks#non_zero_only', 0) +let s:hunk_symbols = get(g:, 'airline#extensions#hunks#hunk_symbols', ['+', '~', '-']) + +function! s:get_hunks_signify() + let hunks = sy#repo#get_stats() + if hunks[0] >= 0 + return hunks + endif + return [] +endfunction + +function! s:is_branch_empty() + return exists('*airline#extensions#branch#head') && + \ empty(get(b:, 'airline_head', '')) +endfunction + +function! s:get_hunks_gitgutter() + if !get(g:, 'gitgutter_enabled', 0) || s:is_branch_empty() + return '' + endif + return GitGutterGetHunkSummary() +endfunction + +function! s:get_hunks_changes() + if !get(b:, 'changes_view_enabled', 0) || s:is_branch_empty() + return [] + endif + let hunks = changes#GetStats() + return hunks == [0, 0, 0] ? [] : hunks +endfunction + +function! s:get_hunks_empty() + return '' +endfunction + +function! s:get_hunks() + if !exists('b:source_func') || get(b:, 'source_func', '') is# 's:get_hunks_empty' + if get(g:, 'loaded_signify') && sy#buffer_is_active() + let b:source_func = 's:get_hunks_signify' + elseif exists('*GitGutterGetHunkSummary') + let b:source_func = 's:get_hunks_gitgutter' + elseif exists('*changes#GetStats') + let b:source_func = 's:get_hunks_changes' + elseif exists('*quickfixsigns#vcsdiff#GetHunkSummary') + let b:source_func = 'quickfixsigns#vcsdiff#GetHunkSummary' + else + let b:source_func = 's:get_hunks_empty' + endif + endif + return {b:source_func}() +endfunction + +function! airline#extensions#hunks#get_hunks() + if !get(w:, 'airline_active', 0) + return '' + endif + " Cache values, so that it isn't called too often + if exists("b:airline_hunks") && + \ get(b:, 'airline_changenr', 0) == b:changedtick && + \ winwidth(0) == get(s:, 'airline_winwidth', 0) && + \ get(b:, 'source_func', '') isnot# 's:get_hunks_signify' && + \ get(b:, 'source_func', '') isnot# 's:get_hunks_gitgutter' && + \ get(b:, 'source_func', '') isnot# 's:get_hunks_empty' && + \ get(b:, 'source_func', '') isnot# 's:get_hunks_changes' + return b:airline_hunks + endif + let hunks = s:get_hunks() + let string = '' + if !empty(hunks) + for i in [0, 1, 2] + if (s:non_zero_only == 0 && winwidth(0) > 100) || hunks[i] > 0 + let string .= printf('%s%s ', s:hunk_symbols[i], hunks[i]) + endif + endfor + endif + let b:airline_hunks = string + let b:airline_changenr = b:changedtick + let s:airline_winwidth = winwidth(0) + return string +endfunction + +function! airline#extensions#hunks#init(ext) + call airline#parts#define_function('hunks', 'airline#extensions#hunks#get_hunks') +endfunction diff --git a/.vim/autoload/airline/extensions/keymap.vim b/.vim/autoload/airline/extensions/keymap.vim new file mode 100644 index 0000000..c09c68b --- /dev/null +++ b/.vim/autoload/airline/extensions/keymap.vim @@ -0,0 +1,20 @@ +" MIT License. Copyright (c) 2013-2018 Doron Behar, C.Brabandt et al. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +if !has('keymap') + finish +endif + +function! airline#extensions#keymap#status() + if (get(g:, 'airline#extensions#keymap#enabled', 1) && has('keymap')) + return printf('%s', (!empty(&keymap) ? (g:airline_symbols.keymap . ' '. &keymap) : '')) + else + return '' + endif +endfunction + +function! airline#extensions#keymap#init(ext) + call airline#parts#define_function('keymap', 'airline#extensions#keymap#status') +endfunction diff --git a/.vim/autoload/airline/extensions/languageclient.vim b/.vim/autoload/airline/extensions/languageclient.vim new file mode 100644 index 0000000..82fed28 --- /dev/null +++ b/.vim/autoload/airline/extensions/languageclient.vim @@ -0,0 +1,101 @@ +" MIT License. Copyright (c) 2013-2018 Bjorn Neergaard, w0rp, hallettj et al. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +let s:error_symbol = get(g:, 'airline#extensions#languageclient#error_symbol', 'E:') +let s:warning_symbol = get(g:, 'airline#extensions#languageclient#warning_symbol', 'W:') +let s:show_line_numbers = get(g:, 'airline#extensions#languageclient#show_line_numbers', 1) + +" Severity codes from the LSP spec +let s:severity_error = 1 +let s:severity_warning = 2 +let s:severity_info = 3 +let s:severity_hint = 4 + +" After each LanguageClient state change `s:diagnostics` will be populated with +" a map from file names to lists of errors, warnings, informational messages, +" and hints. +let s:diagnostics = {} + +function! s:languageclient_refresh() + if get(g:, 'airline_skip_empty_sections', 0) + exe ':AirlineRefresh' + endif +endfunction + +function! s:record_diagnostics(state) + let result = json_decode(a:state.result) + let s:diagnostics = result.diagnostics + call s:languageclient_refresh() +endfunction + +function! s:get_diagnostics() + call LanguageClient#getState(function("s:record_diagnostics")) +endfunction + +function! s:diagnostics_for_buffer() + return get(s:diagnostics, expand('%:p'), []) +endfunction + +function! s:airline_languageclient_count(cnt, symbol) + return a:cnt ? a:symbol. a:cnt : '' +endfunction + +function! s:airline_languageclient_get_line_number(type) abort + let linenumber_of_first_problem = 0 + for d in s:diagnostics_for_buffer() + if has_key(d, 'severity') && d.severity == a:type + let linenumber_of_first_problem = d.range.start.line + break + endif + endfor + + if linenumber_of_first_problem == 0 + return '' + endif + + let open_lnum_symbol = get(g:, 'airline#extensions#languageclient#open_lnum_symbol', '(L') + let close_lnum_symbol = get(g:, 'airline#extensions#languageclient#close_lnum_symbol', ')') + + return open_lnum_symbol . linenumber_of_first_problem . close_lnum_symbol +endfunction + +function! airline#extensions#languageclient#get(type) + let is_err = a:type == s:severity_error + let symbol = is_err ? s:error_symbol : s:warning_symbol + + let cnt = 0 + for d in s:diagnostics_for_buffer() + if has_key(d, 'severity') && d.severity == a:type + let cnt += 1 + endif + endfor + + if cnt == 0 + return '' + endif + + if s:show_line_numbers == 1 + return s:airline_languageclient_count(cnt, symbol) . <sid>airline_languageclient_get_line_number(a:type) + else + return s:airline_languageclient_count(cnt, symbol) + endif +endfunction + +function! airline#extensions#languageclient#get_warning() + return airline#extensions#languageclient#get(s:severity_warning) +endfunction + +function! airline#extensions#languageclient#get_error() + return airline#extensions#languageclient#get(s:severity_error) +endfunction + +function! airline#extensions#languageclient#init(ext) + call airline#parts#define_function('languageclient_error_count', 'airline#extensions#languageclient#get_error') + call airline#parts#define_function('languageclient_warning_count', 'airline#extensions#languageclient#get_warning') + augroup airline_languageclient + autocmd! + autocmd User LanguageClientDiagnosticsChanged call <sid>get_diagnostics() + augroup END +endfunction diff --git a/.vim/autoload/airline/extensions/localsearch.vim b/.vim/autoload/airline/extensions/localsearch.vim new file mode 100644 index 0000000..685be47 --- /dev/null +++ b/.vim/autoload/airline/extensions/localsearch.vim @@ -0,0 +1,35 @@ +" MIT License. Copyright (c) 2018 mox et al. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +let s:enabled = get(g:, 'airline#extensions#localsearch#enabled', 1) +if !get(g:, 'loaded_localsearch', 0) || !s:enabled || get(g:, 'airline#extensions#localsearch#loaded', 0) + finish +endif +let g:airline#extensions#localsearch#loaded = 001 + +let s:spc = g:airline_symbols.space + +function! airline#extensions#localsearch#load_theme(palette) + call airline#highlighter#exec('localsearch_dark', [ '#ffffff' , '#000000' , 15 , 1 , '']) +endfunction + + +function! airline#extensions#localsearch#init(ext) + call a:ext.add_theme_func('airline#extensions#localsearch#load_theme') + call a:ext.add_statusline_func('airline#extensions#localsearch#apply') +endfunction + + +function! airline#extensions#localsearch#apply(...) + " first variable is the statusline builder + let builder = a:1 + + """"" WARNING: the API for the builder is not finalized and may change + if exists('#localsearch#WinEnter') " If localsearch mode is enabled + call builder.add_section('localsearch_dark', s:spc.airline#section#create('LS').s:spc) + endif + return 0 +endfunction + diff --git a/.vim/autoload/airline/extensions/neomake.vim b/.vim/autoload/airline/extensions/neomake.vim new file mode 100644 index 0000000..b82d6c3 --- /dev/null +++ b/.vim/autoload/airline/extensions/neomake.vim @@ -0,0 +1,36 @@ +" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. +" vim: et ts=2 sts=2 sw=2 + +if !exists(':Neomake') + finish +endif + +let s:error_symbol = get(g:, 'airline#extensions#neomake#error_symbol', 'E:') +let s:warning_symbol = get(g:, 'airline#extensions#neomake#warning_symbol', 'W:') + +function! s:get_counts() + let l:counts = neomake#statusline#LoclistCounts() + + if empty(l:counts) + return neomake#statusline#QflistCounts() + else + return l:counts + endif +endfunction + +function! airline#extensions#neomake#get_warnings() + let counts = s:get_counts() + let warnings = get(counts, 'W', 0) + return warnings ? s:warning_symbol.warnings : '' +endfunction + +function! airline#extensions#neomake#get_errors() + let counts = s:get_counts() + let errors = get(counts, 'E', 0) + return errors ? s:error_symbol.errors : '' +endfunction + +function! airline#extensions#neomake#init(ext) + call airline#parts#define_function('neomake_warning_count', 'airline#extensions#neomake#get_warnings') + call airline#parts#define_function('neomake_error_count', 'airline#extensions#neomake#get_errors') +endfunction diff --git a/.vim/autoload/airline/extensions/netrw.vim b/.vim/autoload/airline/extensions/netrw.vim new file mode 100644 index 0000000..10f024a --- /dev/null +++ b/.vim/autoload/airline/extensions/netrw.vim @@ -0,0 +1,34 @@ +" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +if !exists(':NetrwSettings') + finish +endif + +function! airline#extensions#netrw#apply(...) + if &ft == 'netrw' + let spc = g:airline_symbols.space + + call a:1.add_section('airline_a', spc.'netrw'.spc) + if exists('*airline#extensions#branch#get_head') + call a:1.add_section('airline_b', spc.'%{airline#extensions#branch#get_head()}'.spc) + endif + call a:1.add_section('airline_c', spc.'%f'.spc) + call a:1.split() + call a:1.add_section('airline_y', spc.'%{airline#extensions#netrw#sortstring()}'.spc) + return 1 + endif +endfunction + +function! airline#extensions#netrw#init(ext) + let g:netrw_force_overwrite_statusline = 0 + call a:ext.add_statusline_func('airline#extensions#netrw#apply') +endfunction + + +function! airline#extensions#netrw#sortstring() + let order = (get(g:, 'netrw_sort_direction', 'n') =~ 'n') ? '+' : '-' + return g:netrw_sort_by . (g:airline_symbols.space) . '[' . order . ']' +endfunction diff --git a/.vim/autoload/airline/extensions/nrrwrgn.vim b/.vim/autoload/airline/extensions/nrrwrgn.vim new file mode 100644 index 0000000..e97c8a5 --- /dev/null +++ b/.vim/autoload/airline/extensions/nrrwrgn.vim @@ -0,0 +1,57 @@ +" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +if !get(g:, 'loaded_nrrw_rgn', 0) + finish +endif + +function! airline#extensions#nrrwrgn#apply(...) + if exists(":WidenRegion") == 2 + let spc = g:airline_symbols.space + if !exists("*nrrwrgn#NrrwRgnStatus()") || empty(nrrwrgn#NrrwRgnStatus()) + call a:1.add_section('airline_a', printf('%s[Narrowed%s#%d]', spc, spc, b:nrrw_instn)) + let bufname=(get(b:, 'orig_buf', 0) ? bufname(b:orig_buf) : substitute(bufname('%'), '^Nrrwrgn_\zs.*\ze_\d\+$', submatch(0), '')) + call a:1.add_section('airline_c', spc.bufname.spc) + call a:1.split() + else + let dict=nrrwrgn#NrrwRgnStatus() + let vmode = { 'v': 'Char ', 'V': 'Line ', '': 'Block '} + let mode = dict.visual ? vmode[dict.visual] : vmode['V'] + let winwidth = winwidth(0) + if winwidth < 80 + let mode = mode[0] + endif + let title = (winwidth < 80 ? "Nrrw" : "Narrowed ") + let multi = (winwidth < 80 ? 'M' : 'Multi') + call a:1.add_section('airline_a', printf('[%s%s%s#%d]%s', (dict.multi ? multi : ""), + \ title, mode, b:nrrw_instn, spc)) + let name = dict.fullname + if name !=# '[No Name]' + if winwidth > 100 + " need some space + let name = fnamemodify(dict.fullname, ':~') + if strlen(name) > 8 + " shorten name + let name = substitute(name, '\(.\)[^/\\]*\([/\\]\)', '\1\2', 'g') + endif + else + let name = fnamemodify(dict.fullname, ':t') + endif + endif + let range=(dict.multi ? '' : printf("[%d-%d]", dict.start[1], dict.end[1])) + call a:1.add_section('airline_c', printf("%s %s %s", name, range, + \ dict.enabled ? (&encoding ==? 'utf-8' ? "\u2713" : '') : '!')) + call a:1.split() + call a:1.add_section('airline_x', get(g:, 'airline_section_x').spc) + call a:1.add_section('airline_y', spc.get(g:, 'airline_section_y').spc) + call a:1.add_section('airline_z', spc.get(g:, 'airline_section_z')) + endif + return 1 + endif +endfunction + +function! airline#extensions#nrrwrgn#init(ext) + call a:ext.add_statusline_func('airline#extensions#nrrwrgn#apply') +endfunction diff --git a/.vim/autoload/airline/extensions/obsession.vim b/.vim/autoload/airline/extensions/obsession.vim new file mode 100644 index 0000000..04105d0 --- /dev/null +++ b/.vim/autoload/airline/extensions/obsession.vim @@ -0,0 +1,22 @@ +" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +if !exists('*ObsessionStatus') + finish +endif + +let s:spc = g:airline_symbols.space + +if !exists('g:airline#extensions#obsession#indicator_text') + let g:airline#extensions#obsession#indicator_text = '$' +endif + +function! airline#extensions#obsession#init(ext) + call airline#parts#define_function('obsession', 'airline#extensions#obsession#get_status') +endfunction + +function! airline#extensions#obsession#get_status() + return ObsessionStatus((g:airline#extensions#obsession#indicator_text . s:spc), '') +endfunction diff --git a/.vim/autoload/airline/extensions/po.vim b/.vim/autoload/airline/extensions/po.vim new file mode 100644 index 0000000..3ec2942 --- /dev/null +++ b/.vim/autoload/airline/extensions/po.vim @@ -0,0 +1,81 @@ +" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +function! airline#extensions#po#shorten() + " Format and shorte the output of msgfmt + let b:airline_po_stats = substitute(get(b:, 'airline_po_stats', ''), ' \(message\|translation\)s*\.*', '', 'g') + let b:airline_po_stats = substitute(b:airline_po_stats, ', ', '/', 'g') + 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 + let b:airline_po_stats = b:airline_po_stats[0:(w:displayed_po_limit - 2)].(&encoding==?'utf-8' ? '…' : '.'). ']' + endif + endif + if strlen(get(b:, 'airline_po_stats', '')) >= 30 && winwidth(0) < 150 + let fuzzy = '' + let untranslated = '' + let messages = '' + " Shorten [120 translated, 50 fuzzy, 4 untranslated] to [120T/50F/4U] + if b:airline_po_stats =~ 'fuzzy' + let fuzzy = substitute(b:airline_po_stats, '.*\(\d\+\) fuzzy.*', '\1F', '') + endif + if b:airline_po_stats =~ 'untranslated' + let untranslated = substitute(b:airline_po_stats, '.*\(\d\+\) untranslated.*', '\1U', '') + endif + let messages = substitute(b:airline_po_stats, '\(\d\+\) translated.*', '\1T', '') + let b:airline_po_stats = printf('%s%s%s', fuzzy, (empty(fuzzy) || empty(untranslated) ? '' : '/'), untranslated) + if strlen(b:airline_po_stats) < 8 + let b:airline_po_stats = messages. (!empty(b:airline_po_stats) ? '/':''). b:airline_po_stats + endif + endif + let b:airline_po_stats = '['.b:airline_po_stats. ']' +endfunction + +function! airline#extensions#po#on_winenter() + " only reset cache, if the window size changed + if get(b:, 'airline_winwidth', 0) != winwidth(0) + let b:airline_winwidth = winwidth(0) + " needs re-formatting + unlet! b:airline_po_stats + endif +endfunction + +function! airline#extensions#po#apply(...) + if &ft ==# 'po' + call airline#extensions#prepend_to_section('z', '%{airline#extensions#po#stats()}') + " Also reset the cache variable, if a window has been split, e.g. the winwidth changed + autocmd airline BufWritePost * unlet! b:airline_po_stats + autocmd airline WinEnter * call airline#extensions#po#on_winenter() + endif +endfunction + +function! airline#extensions#po#stats() + if exists('b:airline_po_stats') && !empty(b:airline_po_stats) + return b:airline_po_stats + endif + + let cmd = 'msgfmt --statistics -o /dev/null -- ' + 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 + return '' + endif + try + let b:airline_po_stats = split(airline_po_stats, '\n')[0] + catch + let b:airline_po_stats = '' + endtry + call airline#extensions#po#shorten() + endif + return get(b:, 'airline_po_stats', '') +endfunction + +function! airline#extensions#po#init(ext) + call a:ext.add_statusline_func('airline#extensions#po#apply') +endfunction diff --git a/.vim/autoload/airline/extensions/promptline.vim b/.vim/autoload/airline/extensions/promptline.vim new file mode 100644 index 0000000..7c90b7c --- /dev/null +++ b/.vim/autoload/airline/extensions/promptline.vim @@ -0,0 +1,35 @@ +" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +if !exists(':PromptlineSnapshot') + finish +endif + +if !exists('airline#extensions#promptline#snapshot_file') || !len('airline#extensions#promptline#snapshot_file') + finish +endif + +let s:prompt_snapshot_file = get(g:, 'airline#extensions#promptline#snapshot_file', '') +let s:color_template = get(g:, 'airline#extensions#promptline#color_template', 'normal') + +function! airline#extensions#promptline#init(ext) + call a:ext.add_theme_func('airline#extensions#promptline#set_prompt_colors') +endfunction + +function! airline#extensions#promptline#set_prompt_colors(palette) + let color_template = has_key(a:palette, s:color_template) ? s:color_template : 'normal' + let mode_palette = a:palette[color_template] + + if !has_key(g:, 'promptline_symbols') + let g:promptline_symbols = { + \ 'left' : g:airline_left_sep, + \ 'right' : g:airline_right_sep, + \ 'left_alt' : g:airline_left_alt_sep, + \ 'right_alt' : g:airline_right_alt_sep} + endif + + let promptline_theme = promptline#api#create_theme_from_airline(mode_palette) + call promptline#api#create_snapshot_with_theme(s:prompt_snapshot_file, promptline_theme) +endfunction diff --git a/.vim/autoload/airline/extensions/quickfix.vim b/.vim/autoload/airline/extensions/quickfix.vim new file mode 100644 index 0000000..2680371 --- /dev/null +++ b/.vim/autoload/airline/extensions/quickfix.vim @@ -0,0 +1,58 @@ +" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +if !exists('g:airline#extensions#quickfix#quickfix_text') + let g:airline#extensions#quickfix#quickfix_text = 'Quickfix' +endif + +if !exists('g:airline#extensions#quickfix#location_text') + let g:airline#extensions#quickfix#location_text = 'Location' +endif + +function! airline#extensions#quickfix#apply(...) + if &buftype == 'quickfix' + let w:airline_section_a = airline#extensions#quickfix#get_type() + let w:airline_section_b = '%{get(w:, "quickfix_title", "")}' + let w:airline_section_c = '' + let w:airline_section_x = '' + endif +endfunction + +function! airline#extensions#quickfix#init(ext) + call a:ext.add_statusline_func('airline#extensions#quickfix#apply') + call a:ext.add_inactive_statusline_func('airline#extensions#quickfix#inactive_qf_window') +endfunction + +function! airline#extensions#quickfix#inactive_qf_window(...) + if getbufvar(a:2.bufnr, '&filetype') is# 'qf' && !empty(airline#util#getwinvar(a:2.winnr, 'quickfix_title', '')) + call setwinvar(a:2.winnr, 'airline_section_c', '[%{get(w:, "quickfix_title", "")}] %f %m') + endif +endfunction + +function! airline#extensions#quickfix#get_type() + if exists("*win_getid") && exists("*getwininfo") + let dict = getwininfo(win_getid()) + if len(dict) > 0 && get(dict[0], 'quickfix', 0) && !get(dict[0], 'loclist', 0) + return g:airline#extensions#quickfix#quickfix_text + elseif len(dict) > 0 && get(dict[0], 'quickfix', 0) && get(dict[0], 'loclist', 0) + return g:airline#extensions#quickfix#location_text + endif + endif + redir => buffers + silent ls + redir END + + let nr = bufnr('%') + for buf in split(buffers, '\n') + if match(buf, '\v^\s*'.nr) > -1 + if match(buf, '\cQuickfix') > -1 + return g:airline#extensions#quickfix#quickfix_text + else + return g:airline#extensions#quickfix#location_text + endif + endif + endfor + return '' +endfunction diff --git a/.vim/autoload/airline/extensions/syntastic.vim b/.vim/autoload/airline/extensions/syntastic.vim new file mode 100644 index 0000000..be21fb4 --- /dev/null +++ b/.vim/autoload/airline/extensions/syntastic.vim @@ -0,0 +1,43 @@ +" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +if !exists(':SyntasticCheck') + finish +endif + +let s:error_symbol = get(g:, 'airline#extensions#syntastic#error_symbol', 'E:') +let s:warning_symbol = get(g:, 'airline#extensions#syntastic#warning_symbol', 'W:') + +function! airline#extensions#syntastic#get_warning() + return airline#extensions#syntastic#get('warning') +endfunction + +function! airline#extensions#syntastic#get_error() + return airline#extensions#syntastic#get('error') +endfunction + +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 = get(g:, 'airline#extensions#syntastic#stl_format_err', '%E{[%e(#%fe)]}') + else + 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 empty(cnt) + return '' + else + return (is_err ? s:error_symbol : s:warning_symbol).cnt + endif +endfunction + +function! airline#extensions#syntastic#init(ext) + call airline#parts#define_function('syntastic-warn', 'airline#extensions#syntastic#get_warning') + call airline#parts#define_function('syntastic-err', 'airline#extensions#syntastic#get_error') +endfunction diff --git a/.vim/autoload/airline/extensions/tabline.vim b/.vim/autoload/airline/extensions/tabline.vim new file mode 100644 index 0000000..10e235e --- /dev/null +++ b/.vim/autoload/airline/extensions/tabline.vim @@ -0,0 +1,213 @@ +" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + + +let s:taboo = get(g:, 'airline#extensions#taboo#enabled', 1) && get(g:, 'loaded_taboo', 0) +if s:taboo + let g:taboo_tabline = 0 +endif + +let s:ctrlspace = get(g:, 'CtrlSpaceLoaded', 0) + +function! airline#extensions#tabline#init(ext) + if has('gui_running') + set guioptions-=e + endif + + autocmd User AirlineToggledOn call s:toggle_on() + autocmd User AirlineToggledOff call s:toggle_off() + + call s:toggle_on() + call a:ext.add_theme_func('airline#extensions#tabline#load_theme') +endfunction + +function! s:toggle_off() + call airline#extensions#tabline#autoshow#off() + call airline#extensions#tabline#tabs#off() + call airline#extensions#tabline#buffers#off() + if s:ctrlspace + call airline#extensions#tabline#ctrlspace#off() + endif +endfunction + +function! s:toggle_on() + call airline#extensions#tabline#autoshow#on() + call airline#extensions#tabline#tabs#on() + call airline#extensions#tabline#buffers#on() + if s:ctrlspace + call airline#extensions#tabline#ctrlspace#on() + endif + + set tabline=%!airline#extensions#tabline#get() +endfunction + +function! s:update_tabline() + if get(g:, 'airline#extensions#tabline#disable_refresh', 0) + return + endif + let match = expand('<afile>') + if pumvisible() + return + elseif !get(g:, 'airline#extensions#tabline#enabled', 0) + return + " return, if buffer matches ignore pattern or is directory (netrw) + elseif empty(match) || airline#util#ignore_buf(match) + \ || isdirectory(expand("<afile>")) + return + endif + call airline#util#doautocmd('BufMRUChange') + " sometimes, the tabline is not correctly updated see #1580 + " so force redraw here + if exists(":redrawtabline") == 2 + redrawtabline + else + let &tabline = &tabline + endif +endfunction + +function! airline#extensions#tabline#load_theme(palette) + if pumvisible() + return + endif + let colors = get(a:palette, 'tabline', {}) + let tablabel = get(colors, 'airline_tablabel', a:palette.normal.airline_b) + " Theme for tabs on the left + let tab = get(colors, 'airline_tab', a:palette.normal.airline_b) + let tabsel = get(colors, 'airline_tabsel', a:palette.normal.airline_a) + let tabtype = get(colors, 'airline_tabtype', a:palette.visual.airline_a) + let tabfill = get(colors, 'airline_tabfill', a:palette.normal.airline_c) + let tabmod = get(colors, 'airline_tabmod', a:palette.insert.airline_a) + let tabhid = get(colors, 'airline_tabhid', a:palette.normal.airline_c) + if has_key(a:palette, 'normal_modified') && has_key(a:palette.normal_modified, 'airline_c') + let tabmodu = get(colors, 'airline_tabmod_unsel', a:palette.normal_modified.airline_c) + else + "Fall back to normal airline_c if modified airline_c isn't present + let tabmodu = get(colors, 'airline_tabmod_unsel', a:palette.normal.airline_c) + endif + call airline#highlighter#exec('airline_tablabel', tablabel) + call airline#highlighter#exec('airline_tab', tab) + call airline#highlighter#exec('airline_tabsel', tabsel) + call airline#highlighter#exec('airline_tabtype', tabtype) + call airline#highlighter#exec('airline_tabfill', tabfill) + call airline#highlighter#exec('airline_tabmod', tabmod) + call airline#highlighter#exec('airline_tabmod_unsel', tabmodu) + call airline#highlighter#exec('airline_tabhid', tabhid) + + " Theme for tabs on the right + let tabsel_right = get(colors, 'airline_tabsel_right', a:palette.normal.airline_a) + let tab_right = get(colors, 'airline_tab_right', a:palette.inactive.airline_c) + let tabmod_right = get(colors, 'airline_tabmod_right', a:palette.insert.airline_a) + let tabhid_right = get(colors, 'airline_tabhid_right', a:palette.normal.airline_c) + if has_key(a:palette, 'normal_modified') && has_key(a:palette.normal_modified, 'airline_c') + let tabmodu_right = get(colors, 'airline_tabmod_unsel_right', a:palette.normal_modified.airline_c) + else + "Fall back to normal airline_c if modified airline_c isn't present + let tabmodu_right = get(colors, 'airline_tabmod_unsel_right', a:palette.normal.airline_c) + endif + call airline#highlighter#exec('airline_tab_right', tab_right) + call airline#highlighter#exec('airline_tabsel_right', tabsel_right) + call airline#highlighter#exec('airline_tabmod_right', tabmod_right) + call airline#highlighter#exec('airline_tabhid_right', tabhid_right) + call airline#highlighter#exec('airline_tabmod_unsel_right', tabmodu_right) +endfunction + +let s:current_tabcnt = -1 + +function! airline#extensions#tabline#get() + let show_buffers = get(g:, 'airline#extensions#tabline#show_buffers', 1) + let show_tabs = get(g:, 'airline#extensions#tabline#show_tabs', 1) + + let curtabcnt = tabpagenr('$') + if curtabcnt != s:current_tabcnt + let s:current_tabcnt = curtabcnt + call airline#extensions#tabline#tabs#invalidate() + call airline#extensions#tabline#buffers#invalidate() + call airline#extensions#tabline#ctrlspace#invalidate() + endif + + if !exists('#airline#BufAdd#*') + autocmd airline BufAdd * call <sid>update_tabline() + endif + if s:ctrlspace + return airline#extensions#tabline#ctrlspace#get() + elseif show_buffers && curtabcnt == 1 || !show_tabs + return airline#extensions#tabline#buffers#get() + else + return airline#extensions#tabline#tabs#get() + endif +endfunction + +function! airline#extensions#tabline#title(n) + let title = '' + if s:taboo + let title = TabooTabTitle(a:n) + endif + + if empty(title) && exists('*gettabvar') + let title = gettabvar(a:n, 'title') + endif + + if empty(title) + let buflist = tabpagebuflist(a:n) + let winnr = tabpagewinnr(a:n) + let all_buffers = airline#extensions#tabline#buflist#list() + return airline#extensions#tabline#get_buffer_name( + \ buflist[winnr - 1], + \ filter(buflist, 'index(all_buffers, v:val) != -1')) + endif + + return title +endfunction + +function! airline#extensions#tabline#get_buffer_name(nr, ...) + let buffers = a:0 ? a:1 : airline#extensions#tabline#buflist#list() + let formatter = get(g:, 'airline#extensions#tabline#formatter', 'default') + return airline#extensions#tabline#formatters#{formatter}#format(a:nr, buffers) +endfunction + +function! airline#extensions#tabline#new_builder() + let builder_context = { + \ 'active' : 1, + \ 'tabline' : 1, + \ 'right_sep' : get(g:, 'airline#extensions#tabline#right_sep' , g:airline_right_sep), + \ 'right_alt_sep' : get(g:, 'airline#extensions#tabline#right_alt_sep', g:airline_right_alt_sep), + \ } + if get(g:, 'airline_powerline_fonts', 0) + let builder_context.left_sep = get(g:, 'airline#extensions#tabline#left_sep' , g:airline_left_sep) + let builder_context.left_alt_sep = get(g:, 'airline#extensions#tabline#left_alt_sep' , g:airline_left_alt_sep) + else + let builder_context.left_sep = get(g:, 'airline#extensions#tabline#left_sep' , ' ') + let builder_context.left_alt_sep = get(g:, 'airline#extensions#tabline#left_alt_sep' , '|') + endif + + return airline#extensions#tabline#builder#new(builder_context) +endfunction + +function! airline#extensions#tabline#group_of_bufnr(tab_bufs, bufnr) + let cur = bufnr('%') + if cur == a:bufnr + if g:airline_detect_modified && getbufvar(a:bufnr, '&modified') + let group = 'airline_tabmod' + else + let group = 'airline_tabsel' + endif + else + if g:airline_detect_modified && getbufvar(a:bufnr, '&modified') + let group = 'airline_tabmod_unsel' + elseif index(a:tab_bufs, a:bufnr) > -1 + let group = 'airline_tab' + else + let group = 'airline_tabhid' + endif + endif + return group +endfunction + +function! airline#extensions#tabline#add_label(dict, type) + if get(g:, 'airline#extensions#tabline#show_tab_type', 1) + call a:dict.add_section_spaced('airline_tablabel', + \ get(g:, 'airline#extensions#tabline#'.a:type.'_label', a:type)) + endif +endfunction diff --git a/.vim/autoload/airline/extensions/tabline/autoshow.vim b/.vim/autoload/airline/extensions/tabline/autoshow.vim new file mode 100644 index 0000000..ac1413f --- /dev/null +++ b/.vim/autoload/airline/extensions/tabline/autoshow.vim @@ -0,0 +1,55 @@ +" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +let s:show_buffers = get(g:, 'airline#extensions#tabline#show_buffers', 1) +let s:buf_min_count = get(g:, 'airline#extensions#tabline#buffer_min_count', 0) +let s:tab_min_count = get(g:, 'airline#extensions#tabline#tab_min_count', 0) + +function! airline#extensions#tabline#autoshow#off() + if exists('s:original_tabline') + let &tabline = s:original_tabline + let &showtabline = s:original_showtabline + endif + + augroup airline_tabline_autoshow + autocmd! + augroup END +endfunction + +function! airline#extensions#tabline#autoshow#on() + let [ s:original_tabline, s:original_showtabline ] = [ &tabline, &showtabline ] + + augroup airline_tabline_autoshow + autocmd! + if s:buf_min_count <= 0 && s:tab_min_count <= 1 + if &lines > 3 + set showtabline=2 + endif + else + if s:show_buffers == 1 + autocmd BufEnter * call <sid>show_tabline(s:buf_min_count, len(airline#extensions#tabline#buflist#list())) + autocmd BufUnload * call <sid>show_tabline(s:buf_min_count, len(airline#extensions#tabline#buflist#list()) - 1) + else + autocmd TabEnter * call <sid>show_tabline(s:tab_min_count, tabpagenr('$')) + endif + endif + + " Invalidate cache. This has to come after the BufUnload for + " s:show_buffers, to invalidate the cache for BufEnter. + autocmd BufLeave,BufAdd,BufUnload * call airline#extensions#tabline#buflist#invalidate() + augroup END +endfunction + +function! s:show_tabline(min_count, total_count) + if a:total_count >= a:min_count + if &showtabline != 2 && &lines > 3 + set showtabline=2 + endif + else + if &showtabline != 0 + set showtabline=0 + endif + endif +endfunction diff --git a/.vim/autoload/airline/extensions/tabline/buffers.vim b/.vim/autoload/airline/extensions/tabline/buffers.vim new file mode 100644 index 0000000..88ebe5c --- /dev/null +++ b/.vim/autoload/airline/extensions/tabline/buffers.vim @@ -0,0 +1,246 @@ +" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +let s:spc = g:airline_symbols.space + +let s:current_bufnr = -1 +let s:current_modified = 0 +let s:current_tabline = '' +let s:current_visible_buffers = [] + +let s:number_map = { + \ '0': '⁰', + \ '1': '¹', + \ '2': '²', + \ '3': '³', + \ '4': '⁴', + \ '5': '⁵', + \ '6': '⁶', + \ '7': '⁷', + \ '8': '⁸', + \ '9': '⁹' + \ } +let s:number_map = &encoding == 'utf-8' + \ ? get(g:, 'airline#extensions#tabline#buffer_idx_format', s:number_map) + \ : {} + +function! airline#extensions#tabline#buffers#off() + augroup airline_tabline_buffers + autocmd! + augroup END +endfunction + +function! airline#extensions#tabline#buffers#on() + augroup airline_tabline_buffers + autocmd! + autocmd BufDelete * call airline#extensions#tabline#buflist#clean() + autocmd User BufMRUChange call airline#extensions#tabline#buflist#clean() + augroup END +endfunction + +function! airline#extensions#tabline#buffers#invalidate() + let s:current_bufnr = -1 +endfunction + +function! airline#extensions#tabline#buffers#get() + try + call <sid>map_keys() + catch + " no-op + endtry + let cur = bufnr('%') + if cur == s:current_bufnr && &columns == s:column_width + if !g:airline_detect_modified || getbufvar(cur, '&modified') == s:current_modified + return s:current_tabline + endif + endif + + let b = airline#extensions#tabline#new_builder() + let tab_bufs = tabpagebuflist(tabpagenr()) + let show_buf_label_first = 0 + + if get(g:, 'airline#extensions#tabline#buf_label_first', 0) + let show_buf_label_first = 1 + endif + if show_buf_label_first + call airline#extensions#tabline#add_label(b, 'buffers') + endif + + let b.tab_bufs = tabpagebuflist(tabpagenr()) + + let b.overflow_group = 'airline_tabhid' + let b.buffers = airline#extensions#tabline#buflist#list() + if get(g:, 'airline#extensions#tabline#current_first', 0) + if index(b.buffers, cur) > -1 + call remove(b.buffers, index(b.buffers, cur)) + endif + let b.buffers = [cur] + b.buffers + endif + + function! b.get_group(i) dict + let bufnum = get(self.buffers, a:i, -1) + if bufnum == -1 + return '' + endif + let group = airline#extensions#tabline#group_of_bufnr(self.tab_bufs, bufnum) + if bufnum == bufnr('%') + let s:current_modified = (group == 'airline_tabmod') ? 1 : 0 + endif + return group + endfunction + + if has("tablineat") + function! b.get_pretitle(i) dict + let bufnum = get(self.buffers, a:i, -1) + return '%'.bufnum.'@airline#extensions#tabline#buffers#clickbuf@' + endfunction + + function! b.get_posttitle(i) dict + return '%X' + endfunction + endif + + function! b.get_title(i) dict + let bufnum = get(self.buffers, a:i, -1) + let group = self.get_group(a:i) + let pgroup = self.get_group(a:i - 1) + " always add a space when powerline_fonts are used + " or for the very first item + if get(g:, 'airline_powerline_fonts', 0) || a:i == 0 + let space = s:spc + else + let space= (pgroup == group ? s:spc : '') + endif + + if get(g:, 'airline#extensions#tabline#buffer_idx_mode', 0) + if len(s:number_map) > 0 + return space. get(s:number_map, a:i+1, '') . '%(%{airline#extensions#tabline#get_buffer_name('.bufnum.')}%)' . s:spc + else + return '['.(a:i+1).s:spc.'%(%{airline#extensions#tabline#get_buffer_name('.bufnum.')}%)'.']' + endif + else + return space.'%(%{airline#extensions#tabline#get_buffer_name('.bufnum.')}%)'.s:spc + endif + endfunction + + let current_buffer = max([index(b.buffers, cur), 0]) + let last_buffer = len(b.buffers) - 1 + call b.insert_titles(current_buffer, 0, last_buffer) + + call b.add_section('airline_tabfill', '') + call b.split() + call b.add_section('airline_tabfill', '') + if !show_buf_label_first + call airline#extensions#tabline#add_label(b, 'buffers') + endif + + if tabpagenr('$') > 1 + call b.add_section_spaced('airline_tabmod', printf('%s %d/%d', "tab", tabpagenr(), tabpagenr('$'))) + endif + + let s:current_bufnr = cur + let s:column_width = &columns + let s:current_tabline = b.build() + let s:current_visible_buffers = copy(b.buffers) + if b._right_title <= last_buffer + call remove(s:current_visible_buffers, b._right_title, last_buffer) + endif + if b._left_title > 0 + call remove(s:current_visible_buffers, 0, b._left_title) + endif + return s:current_tabline +endfunction + +function! s:select_tab(buf_index) + " no-op when called in 'keymap_ignored_filetypes' + if count(get(g:, 'airline#extensions#tabline#keymap_ignored_filetypes', + \ ['vimfiler', 'nerdtree']), &ft) + return + endif + + let idx = a:buf_index + if s:current_visible_buffers[0] == -1 + let idx = idx + 1 + endif + + let buf = get(s:current_visible_buffers, idx, 0) + if buf != 0 + exec 'b!' . buf + endif +endfunction + +function! s:jump_to_tab(offset) + let l = airline#extensions#tabline#buflist#list() + let i = index(l, bufnr('%')) + if i > -1 + exec 'b!' . l[(i + a:offset) % len(l)] + endif +endfunction + +function! s:map_keys() + if get(g:, 'airline#extensions#tabline#buffer_idx_mode', 1) + noremap <silent> <Plug>AirlineSelectTab1 :call <SID>select_tab(0)<CR> + noremap <silent> <Plug>AirlineSelectTab2 :call <SID>select_tab(1)<CR> + noremap <silent> <Plug>AirlineSelectTab3 :call <SID>select_tab(2)<CR> + noremap <silent> <Plug>AirlineSelectTab4 :call <SID>select_tab(3)<CR> + noremap <silent> <Plug>AirlineSelectTab5 :call <SID>select_tab(4)<CR> + noremap <silent> <Plug>AirlineSelectTab6 :call <SID>select_tab(5)<CR> + noremap <silent> <Plug>AirlineSelectTab7 :call <SID>select_tab(6)<CR> + noremap <silent> <Plug>AirlineSelectTab8 :call <SID>select_tab(7)<CR> + noremap <silent> <Plug>AirlineSelectTab9 :call <SID>select_tab(8)<CR> + noremap <silent> <Plug>AirlineSelectPrevTab :<C-u>call <SID>jump_to_tab(-v:count1)<CR> + noremap <silent> <Plug>AirlineSelectNextTab :<C-u>call <SID>jump_to_tab(v:count1)<CR> + endif +endfunction + +function! airline#extensions#tabline#buffers#clickbuf(minwid, clicks, button, modifiers) abort + " Clickable buffers + " works only in recent NeoVim with has('tablineat') + + " single mouse button click without modifiers pressed + if a:clicks == 1 && a:modifiers !~# '[^ ]' + if a:button is# 'l' + " left button - switch to buffer + silent execute 'buffer' a:minwid + elseif a:button is# 'm' + " middle button - delete buffer + + if get(g:, 'airline#extensions#tabline#middle_click_preserves_windows', 0) == 0 || winnr('$') == 1 + " just simply delete the clicked buffer. This will cause windows + " associated with the clicked buffer to be closed. + silent execute 'bdelete' a:minwid + else + " find windows displaying the clicked buffer and open an new + " buffer in them. + let current_window = bufwinnr("%") + let window_number = bufwinnr(a:minwid) + let last_window_visited = -1 + + " Set to 1 if the clicked buffer was open in any windows. + let buffer_in_window = 0 + + " Find the next window with the clicked buffer open. If bufwinnr() + " returns the same window number, this is because we clicked a new + " buffer, and then tried editing a new buffer. Vim won't create a + " new empty buffer for the same window, so we get the same window + " number from bufwinnr(). In this case we just give up and don't + " delete the buffer. + " This could be made cleaner if we could check if the clicked buffer + " is a new buffer, but I don't know if there is a way to do that. + while window_number != -1 && window_number != last_window_visited + let buffer_in_window = 1 + silent execute window_number . 'wincmd w' + silent execute 'enew' + let last_window_visited = window_number + let window_number = bufwinnr(a:minwid) + endwhile + silent execute current_window . 'wincmd w' + if window_number != last_window_visited || buffer_in_window == 0 + silent execute 'bdelete' a:minwid + endif + endif + endif + endif +endfunction diff --git a/.vim/autoload/airline/extensions/tabline/buflist.vim b/.vim/autoload/airline/extensions/tabline/buflist.vim new file mode 100644 index 0000000..a944cb9 --- /dev/null +++ b/.vim/autoload/airline/extensions/tabline/buflist.vim @@ -0,0 +1,77 @@ +" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +function! airline#extensions#tabline#buflist#invalidate() + unlet! s:current_buffer_list +endfunction + +function! airline#extensions#tabline#buflist#clean() + call airline#extensions#tabline#buflist#invalidate() + call airline#extensions#tabline#buffers#invalidate() +endfunction + +" paths in excludes list +function! s:ExcludePaths(nr, exclude_paths) + let bpath = fnamemodify(bufname(a:nr), ":p") + for f in a:exclude_paths + if bpath =~# f | return 1 | endif + endfor +endfunction + +" other types to exclude +function! s:ExcludeOther(nr, exclude_preview) + if (getbufvar(a:nr, 'current_syntax') == 'qf') || + \ (a:exclude_preview && getbufvar(a:nr, '&bufhidden') == 'wipe' + \ && getbufvar(a:nr, '&buftype') == 'nofile') + return 1 | endif +endfunction + +function! airline#extensions#tabline#buflist#list() + if exists('s:current_buffer_list') + return s:current_buffer_list + endif + + let exclude_buffers = get(g:, 'airline#extensions#tabline#exclude_buffers', []) + let exclude_paths = get(g:, 'airline#extensions#tabline#excludes', []) + let exclude_preview = get(g:, 'airline#extensions#tabline#exclude_preview', 1) + + let list = (exists('g:did_bufmru') && g:did_bufmru) ? BufMRUList() : range(1, bufnr("$")) + + let buffers = [] + " If this is too slow, we can switch to a different algorithm. + " Basically branch 535 already does it, but since it relies on + " BufAdd autocommand, I'd like to avoid this if possible. + for nr in list + if buflisted(nr) + " Do not add to the bufferlist, if either + " 1) bufnr is exclude_buffers list + " 2) buffername matches one of exclude_paths patterns + " 3) buffer is a quickfix buffer + " 4) when excluding preview windows: + " 'bufhidden' == wipe + " 'buftype' == nofile + " 5) ignore buffers matching airline#extensions#tabline#ignore_bufadd_pat + + " check buffer numbers first + if index(exclude_buffers, nr) >= 0 + continue + " check paths second + elseif !empty(exclude_paths) && s:ExcludePaths(nr, exclude_paths) + continue + " ignore buffers matching airline#extensions#tabline#ignore_bufadd_pat + elseif airline#util#ignore_buf(bufname(nr)) + continue + " check other types last + elseif s:ExcludeOther(nr, exclude_preview) + continue + endif + + call add(buffers, nr) + endif + endfor + + let s:current_buffer_list = buffers + return buffers +endfunction diff --git a/.vim/autoload/airline/extensions/tabline/builder.vim b/.vim/autoload/airline/extensions/tabline/builder.vim new file mode 100644 index 0000000..20964b1 --- /dev/null +++ b/.vim/autoload/airline/extensions/tabline/builder.vim @@ -0,0 +1,232 @@ +" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +let s:prototype = {} + +" Set the point in the tabline where the builder should insert the titles. +" +" Subsequent calls will overwrite the previous ones, so only the last call +" determines to location to insert titles. +" +" NOTE: The titles are not inserted until |build| is called, so that the +" remaining contents of the tabline can be taken into account. +" +" Callers should define at least |get_title| and |get_group| on the host +" object before calling |build|. +function! s:prototype.insert_titles(current, first, last) dict + let self._first_title = a:first " lowest index + let self._last_title = a:last " highest index + let self._left_title = a:current " next index to add on the left + let self._right_title = a:current + 1 " next index to add on the right + let self._left_position = self.get_position() " left end of titles + let self._right_position = self._left_position " right end of the titles +endfunction + +" Insert a title for entry number |index|, of group |group| at position |pos|, +" if there is space for it. Returns 1 if it is inserted, 0 otherwise +" +" |force| inserts the title even if there isn't enough space left for it. +" |sep_size| adjusts the size change that the title is considered to take up, +" to account for changes to the separators +" +" The title is defined by |get_title| on the hosting object, called with +" |index| as its only argument. +" |get_pretitle| and |get_posttitle| may be defined on the host object to +" insert some formatting before or after the title. These should be 0-width. +" +" This method updates |_right_position| and |_remaining_space| on the host +" object, if the title is inserted. +function! s:prototype.try_insert_title(index, group, pos, sep_size, force) dict + let title = self.get_title(a:index) + let title_size = s:tabline_evaluated_length(title) + a:sep_size + if a:force || self._remaining_space >= title_size + let pos = a:pos + if has_key(self, "get_pretitle") + call self.insert_raw(self.get_pretitle(a:index), pos) + let self._right_position += 1 + let pos += 1 + endif + + call self.insert_section(a:group, title, pos) + let self._right_position += 1 + let pos += 1 + + if has_key(self, "get_posttitle") + call self.insert_raw(self.get_posttitle(a:index), pos) + let self._right_position += 1 + let pos += 1 + endif + + let self._remaining_space -= title_size + return 1 + endif + return 0 +endfunction + +function! s:get_separator_change(new_group, old_group, end_group, sep_size, alt_sep_size) + return s:get_separator_change_with_end(a:new_group, a:old_group, a:end_group, a:end_group, a:sep_size, a:alt_sep_size) +endfunction + +" Compute the change in size of the tabline caused by separators +" +" This should be kept up-to-date with |s:get_transitioned_seperator| and +" |s:get_separator| in autoload/airline/builder.vim +function! s:get_separator_change_with_end(new_group, old_group, new_end_group, old_end_group, sep_size, alt_sep_size) + let sep_change = 0 + if !empty(a:new_end_group) " Separator between title and the end + let sep_change += airline#builder#should_change_group(a:new_group, a:new_end_group) ? a:sep_size : a:alt_sep_size + endif + if !empty(a:old_group) " Separator between the title and the one adjacent + let sep_change += airline#builder#should_change_group(a:new_group, a:old_group) ? a:sep_size : a:alt_sep_size + if !empty(a:old_end_group) " Remove mis-predicted separator + let sep_change -= airline#builder#should_change_group(a:old_group, a:old_end_group) ? a:sep_size : a:alt_sep_size + endif + endif + return sep_change +endfunction + +" This replaces the build function of the |airline#builder#new| object, to +" insert titles as specified by the last call to |insert_titles| before +" passing to the original build function. +" +" Callers should define at least |get_title| and |get_group| on the host +" object if |insert_titles| has been called on it. +function! s:prototype.build() dict + if has_key(self, '_left_position') && self._first_title <= self._last_title + let self._remaining_space = &columns - s:tabline_evaluated_length(self._build()) + + let center_active = get(g:, 'airline#extensions#tabline#center_active', 0) + + let sep_size = s:tabline_evaluated_length(self._context.left_sep) + let alt_sep_size = s:tabline_evaluated_length(self._context.left_alt_sep) + + let outer_left_group = airline#builder#get_prev_group(self._sections, self._left_position) + let outer_right_group = airline#builder#get_next_group(self._sections, self._right_position) + + let overflow_marker = get(g:, 'airline#extensions#tabline#overflow_marker', g:airline_symbols.ellipsis) + let overflow_marker_size = s:tabline_evaluated_length(overflow_marker) + " Allow space for the markers before we begin filling in titles. + if self._left_title > self._first_title + let self._remaining_space -= overflow_marker_size + + \ s:get_separator_change(self.overflow_group, "", outer_left_group, sep_size, alt_sep_size) + endif + if self._left_title < self._last_title + let self._remaining_space -= overflow_marker_size + + \ s:get_separator_change(self.overflow_group, "", outer_right_group, sep_size, alt_sep_size) + endif + + " Add the current title + let group = self.get_group(self._left_title) + if self._left_title == self._first_title + let sep_change = s:get_separator_change(group, "", outer_left_group, sep_size, alt_sep_size) + else + let sep_change = s:get_separator_change(group, "", self.overflow_group, sep_size, alt_sep_size) + endif + if self._left_title == self._last_title + let sep_change += s:get_separator_change(group, "", outer_right_group, sep_size, alt_sep_size) + else + let sep_change += s:get_separator_change(group, "", self.overflow_group, sep_size, alt_sep_size) + endif + let left_group = group + let right_group = group + let self._left_title -= + \ self.try_insert_title(self._left_title, group, self._left_position, sep_change, 1) + + if get(g:, 'airline#extensions#tabline#current_first', 0) + " always have current title first + let self._left_position += 1 + endif + + if !center_active && self._right_title <= self._last_title + " Add the title to the right + let group = self.get_group(self._right_title) + if self._right_title == self._last_title + let sep_change = s:get_separator_change_with_end(group, right_group, outer_right_group, self.overflow_group, sep_size, alt_sep_size) - overflow_marker_size + else + let sep_change = s:get_separator_change(group, right_group, self.overflow_group, sep_size, alt_sep_size) + endif + let right_group = group + let self._right_title += + \ self.try_insert_title(self._right_title, group, self._right_position, sep_change, 1) + endif + + while self._remaining_space > 0 + let done = 0 + if self._left_title >= self._first_title + " Insert next title to the left + let group = self.get_group(self._left_title) + if self._left_title == self._first_title + let sep_change = s:get_separator_change_with_end(group, left_group, outer_left_group, self.overflow_group, sep_size, alt_sep_size) - overflow_marker_size + else + let sep_change = s:get_separator_change(group, left_group, self.overflow_group, sep_size, alt_sep_size) + endif + let left_group = group + let done = self.try_insert_title(self._left_title, group, self._left_position, sep_change, 0) + let self._left_title -= done + endif + " If center_active is set, this |if| operates as an independent |if|, + " otherwise as an |elif|. + if self._right_title <= self._last_title && (center_active || !done) + " Insert next title to the right + let group = self.get_group(self._right_title) + if self._right_title == self._last_title + let sep_change = s:get_separator_change_with_end(group, right_group, outer_right_group, self.overflow_group, sep_size, alt_sep_size) - overflow_marker_size + else + let sep_change = s:get_separator_change(group, right_group, self.overflow_group, sep_size, alt_sep_size) + endif + let right_group = group + let done = self.try_insert_title(self._right_title, group, self._right_position, sep_change, 0) + let self._right_title += done + endif + if !done + break + endif + endwhile + + if self._left_title >= self._first_title + if get(g:, 'airline#extensions#tabline#current_first', 0) + let self._left_position -= 1 + endif + call self.insert_section(self.overflow_group, overflow_marker, self._left_position) + let self._right_position += 1 + endif + + if self._right_title <= self._last_title + call self.insert_section(self.overflow_group, overflow_marker, self._right_position) + endif + endif + + return self._build() +endfunction + +let s:prototype.overflow_group = 'airline_tab' + +" Extract the text content a tabline will render. (Incomplete). +" +" See :help 'statusline' for the list of fields. +function! s:evaluate_tabline(tabline) + let tabline = a:tabline + let tabline = substitute(tabline, '%{\([^}]\+\)}', '\=eval(submatch(1))', 'g') + let tabline = substitute(tabline, '%#[^#]\+#', '', 'g') + let tabline = substitute(tabline, '%(\([^)]\+\)%)', '\1', 'g') + let tabline = substitute(tabline, '%\d\+[TX]', '', 'g') + let tabline = substitute(tabline, '%=', '', 'g') + let tabline = substitute(tabline, '%\d*\*', '', 'g') + if has('tablineat') + let tabline = substitute(tabline, '%@[^@]\+@', '', 'g') + endif + return tabline +endfunction + +function! s:tabline_evaluated_length(tabline) + return airline#util#strchars(s:evaluate_tabline(a:tabline)) +endfunction + +function! airline#extensions#tabline#builder#new(context) + let builder = airline#builder#new(a:context) + let builder._build = builder.build + call extend(builder, s:prototype, 'force') + return builder +endfunction diff --git a/.vim/autoload/airline/extensions/tabline/ctrlspace.vim b/.vim/autoload/airline/extensions/tabline/ctrlspace.vim new file mode 100644 index 0000000..bb2d518 --- /dev/null +++ b/.vim/autoload/airline/extensions/tabline/ctrlspace.vim @@ -0,0 +1,157 @@ +" MIT License. Copyright (c) 2016-2018 Kevin Sapper et al. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +let s:current_bufnr = -1 +let s:current_modified = 0 +let s:current_tabnr = -1 +let s:current_tabline = '' +let s:highlight_groups = ['hid', 0, '', 'sel', 'mod_unsel', 0, 'mod_unsel', 'mod'] + +function! airline#extensions#tabline#ctrlspace#off() + augroup airline_tabline_ctrlspace + autocmd! + augroup END +endfunction + +function! airline#extensions#tabline#ctrlspace#on() + augroup airline_tabline_ctrlspace + autocmd! + autocmd BufDelete * call airline#extensions#tabline#ctrlspace#invalidate() + augroup END +endfunction + +function! airline#extensions#tabline#ctrlspace#invalidate() + let s:current_bufnr = -1 + let s:current_tabnr = -1 +endfunction + +function! airline#extensions#tabline#ctrlspace#add_buffer_section(builder, cur_tab, cur_buf, pull_right) + let pos_extension = (a:pull_right ? '_right' : '') + let 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(buffer_list), 'v:val["index"]') + if index(bufnr_list, a:cur_buf) == -1 && a:cur_tab == s:current_tabnr + return 0 + endif + + let s:current_modified = getbufvar(a:cur_buf, '&modified') + + for buffer in buffer_list + let group = 'airline_tab' + \ .s:highlight_groups[(4 * buffer.modified) + (2 * buffer.visible) + (a:cur_buf == buffer.index)] + \ .pos_extension + + let buf_name = '%(%{airline#extensions#tabline#get_buffer_name('.buffer.index.')}%)' + + if has("tablineat") + let buf_name = '%'.buffer.index.'@airline#extensions#tabline#buffers#clickbuf@'.buf_name.'%X' + endif + + 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, pull_right) + let pos_extension = (a:pull_right ? '_right' : '') + let tab_list = ctrlspace#api#TabList() + + for tab in tab_list + let group = 'airline_tab' + \ .s:highlight_groups[(4 * tab.modified) + (3 * tab.current)] + \ .pos_extension + + if get(g:, 'airline#extensions#tabline#ctrlspace_show_tab_nr', 0) == 0 + call a:builder.add_section_spaced(group, '%'.tab.index.'T'.tab.title.ctrlspace#api#TabBuffersNumber(tab.index).'%T') + else + call a:builder.add_section_spaced(group, '%'.(tab.index).'T'.(tab.index).(g:airline_symbols.space).(tab.title).ctrlspace#api#TabBuffersNumber(tab.index).'%T') + endif + endfor +endfunction + +function! airline#extensions#tabline#ctrlspace#get() + let cur_buf = bufnr('%') + let buffer_label = get(g:, 'airline#extensions#tabline#buffers_label', 'buffers') + let tab_label = get(g:, 'airline#extensions#tabline#tabs_label', 'tabs') + let switch_buffers_and_tabs = get(g:, 'airline#extensions#tabline#switch_buffers_and_tabs', 0) + + try + call airline#extensions#tabline#tabs#map_keys() + endtry + + let cur_tab = tabpagenr() + + if cur_buf == s:current_bufnr && cur_tab == s:current_tabnr + if !g:airline_detect_modified || getbufvar(cur_buf, '&modified') == s:current_modified + return s:current_tabline + endif + endif + + let builder = airline#extensions#tabline#new_builder() + + let show_buffers = get(g:, 'airline#extensions#tabline#show_buffers', 1) + let show_tabs = get(g:, 'airline#extensions#tabline#show_tabs', 1) + + let AppendBuffers = function('airline#extensions#tabline#ctrlspace#add_buffer_section', [builder, cur_tab, cur_buf]) + let AppendTabs = function('airline#extensions#tabline#ctrlspace#add_tab_section', [builder]) + let AppendLabel = function(builder.add_section_spaced, ['airline_tabtype'], builder) + + " <= 1: |{Tabs} <tab| + " == 2: |{Buffers} <buffers| + " == 3: |buffers> {Buffers} {Tabs} <tabs| + let showing_mode = (2 * show_buffers) + (show_tabs) + let ignore_update = 0 + + " Add left tabline content + if showing_mode <= 1 " Tabs only mode + call AppendTabs(0) + elseif showing_mode == 2 " Buffers only mode + let ignore_update = !AppendBuffers(0) + else + if !switch_buffers_and_tabs + call AppendLabel(buffer_label) + let ignore_update = !AppendBuffers(0) + else + call AppendLabel(tab_label) + call AppendTabs(0) + endif + endif + + if ignore_update | return s:current_tabline | endif + + call builder.add_section('airline_tabfill', '') + call builder.split() + call builder.add_section('airline_tabfill', '') + + " Add right tabline content + if showing_mode <= 1 " Tabs only mode + call AppendLabel(tab_label) + elseif showing_mode == 2 " Buffers only mode + call AppendLabel(buffer_label) + else + if !switch_buffers_and_tabs + call AppendTabs(1) + call AppendLabel(tab_label) + else + let ignore_update = AppendBuffers(1) + call AppendLabel(buffer_label) + endif + endif + + if ignore_update | return s:current_tabline | endif + + let s:current_bufnr = cur_buf + let s:current_tabnr = cur_tab + let s:current_tabline = builder.build() + return s:current_tabline +endfunction diff --git a/.vim/autoload/airline/extensions/tabline/formatters/default.vim b/.vim/autoload/airline/extensions/tabline/formatters/default.vim new file mode 100644 index 0000000..c98d7ef --- /dev/null +++ b/.vim/autoload/airline/extensions/tabline/formatters/default.vim @@ -0,0 +1,43 @@ +" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +let s:fnamecollapse = get(g:, 'airline#extensions#tabline#fnamecollapse', 1) +let s:fnametruncate = get(g:, 'airline#extensions#tabline#fnametruncate', 0) +let s:buf_nr_format = get(g:, 'airline#extensions#tabline#buffer_nr_format', '%s: ') +let s:buf_nr_show = get(g:, 'airline#extensions#tabline#buffer_nr_show', 0) +let s:buf_modified_symbol = g:airline_symbols.modified + +function! airline#extensions#tabline#formatters#default#format(bufnr, buffers) + let fmod = get(g:, 'airline#extensions#tabline#fnamemod', ':~:.') + let _ = '' + + let name = bufname(a:bufnr) + if empty(name) + let _ .= '[No Name]' + else + if s:fnamecollapse + " Does not handle non-ascii characters like Cyrillic: 'D/Учёба/t.c' + "let _ .= substitute(fnamemodify(name, fmod), '\v\w\zs.{-}\ze(\\|/)', '', 'g') + let _ .= pathshorten(fnamemodify(name, fmod)) + else + let _ .= fnamemodify(name, fmod) + endif + if a:bufnr != bufnr('%') && s:fnametruncate && strlen(_) > s:fnametruncate + let _ = strpart(_, 0, s:fnametruncate) + endif + endif + + return airline#extensions#tabline#formatters#default#wrap_name(a:bufnr, _) +endfunction + +function! airline#extensions#tabline#formatters#default#wrap_name(bufnr, buffer_name) + let _ = s:buf_nr_show ? printf(s:buf_nr_format, a:bufnr) : '' + let _ .= substitute(a:buffer_name, '\\', '/', 'g') + + if getbufvar(a:bufnr, '&modified') == 1 + let _ .= s:buf_modified_symbol + endif + return _ +endfunction diff --git a/.vim/autoload/airline/extensions/tabline/formatters/jsformatter.vim b/.vim/autoload/airline/extensions/tabline/formatters/jsformatter.vim new file mode 100644 index 0000000..b16d06f --- /dev/null +++ b/.vim/autoload/airline/extensions/tabline/formatters/jsformatter.vim @@ -0,0 +1,15 @@ +" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +function! airline#extensions#tabline#formatters#jsformatter#format(bufnr, buffers) + let buf = bufname(a:bufnr) + let filename = fnamemodify(buf, ':t') + + if filename == 'index.js' || filename == 'index.jsx' || filename == 'index.ts' || filename == 'index.tsx' + return fnamemodify(buf, ':p:h:t') . '/i' + else + return airline#extensions#tabline#formatters#unique_tail_improved#format(a:bufnr, a:buffers) + endif +endfunction diff --git a/.vim/autoload/airline/extensions/tabline/formatters/tabnr.vim b/.vim/autoload/airline/extensions/tabline/formatters/tabnr.vim new file mode 100644 index 0000000..fa71014 --- /dev/null +++ b/.vim/autoload/airline/extensions/tabline/formatters/tabnr.vim @@ -0,0 +1,14 @@ +" MIT License. Copyright (c) 2017-2018 C.Brabandt et al. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +function! airline#extensions#tabline#formatters#tabnr#format(tab_nr_type, nr) + if a:tab_nr_type == 0 " nr of splits + return (g:airline_symbols.space).'%{len(tabpagebuflist('.a:nr.'))}' + elseif a:tab_nr_type == 1 " tab number + return (g:airline_symbols.space).a:nr + else "== 2 splits and tab number + return (g:airline_symbols.space).a:nr.'.%{len(tabpagebuflist('.a:nr.'))}' + endif +endfunction diff --git a/.vim/autoload/airline/extensions/tabline/formatters/unique_tail.vim b/.vim/autoload/airline/extensions/tabline/formatters/unique_tail.vim new file mode 100644 index 0000000..3e61b60 --- /dev/null +++ b/.vim/autoload/airline/extensions/tabline/formatters/unique_tail.vim @@ -0,0 +1,41 @@ +" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +function! airline#extensions#tabline#formatters#unique_tail#format(bufnr, buffers) + let duplicates = {} + let tails = {} + let map = {} + for nr in a:buffers + let name = bufname(nr) + if empty(name) + let map[nr] = '[No Name]' + else + let tail = fnamemodify(name, ':s?/\+$??:t') + if has_key(tails, tail) + let duplicates[nr] = nr + endif + let tails[tail] = 1 + let map[nr] = airline#extensions#tabline#formatters#default#wrap_name(nr, tail) + endif + endfor + + let fmod = get(g:, 'airline#extensions#tabline#fnamemod', ':p:.') + for nr in values(duplicates) + let name = bufname(nr) + let fnamecollapse = get(g:, 'airline#extensions#tabline#fnamecollapse', 1) + if fnamecollapse + let map[nr] = airline#extensions#tabline#formatters#default#wrap_name(nr, substitute(fnamemodify(name, fmod), '\v\w\zs.{-}\ze(\\|/)', '', 'g')) + else + let map[nr] = airline#extensions#tabline#formatters#default#wrap_name(nr, fnamemodify(name, fmod)) + endif + endfor + + if has_key(map, a:bufnr) + return map[a:bufnr] + endif + + " if we get here, the buffer list isn't in sync with the selected buffer yet, fall back to the default + return airline#extensions#tabline#formatters#default#format(a:bufnr, a:buffers) +endfunction diff --git a/.vim/autoload/airline/extensions/tabline/formatters/unique_tail_improved.vim b/.vim/autoload/airline/extensions/tabline/formatters/unique_tail_improved.vim new file mode 100644 index 0000000..c48174b --- /dev/null +++ b/.vim/autoload/airline/extensions/tabline/formatters/unique_tail_improved.vim @@ -0,0 +1,91 @@ +" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +let s:skip_symbol = '…' + +function! airline#extensions#tabline#formatters#unique_tail_improved#format(bufnr, buffers) + if len(a:buffers) <= 1 " don't need to compare bufnames if has less than one buffer opened + return airline#extensions#tabline#formatters#default#format(a:bufnr, a:buffers) + endif + + let curbuf_tail = fnamemodify(bufname(a:bufnr), ':t') + let do_deduplicate = 0 + let path_tokens = {} + + for nr in a:buffers + let name = bufname(nr) + if !empty(name) && nr != a:bufnr && fnamemodify(name, ':t') == curbuf_tail " only perform actions if curbuf_tail isn't unique + let do_deduplicate = 1 + let tokens = reverse(split(substitute(fnamemodify(name, ':p:h'), '\\', '/', 'g'), '/')) + let token_index = 0 + for token in tokens + if token == '' | continue | endif + if token == '.' | break | endif + if !has_key(path_tokens, token_index) + let path_tokens[token_index] = {} + endif + let path_tokens[token_index][token] = 1 + let token_index += 1 + endfor + endif + endfor + + if do_deduplicate == 1 + let path = [] + let token_index = 0 + for token in reverse(split(substitute(fnamemodify(bufname(a:bufnr), ':p:h'), '\\', '/', 'g'), '/')) + if token == '.' | break | endif + let duplicated = 0 + let uniq = 1 + let single = 1 + if has_key(path_tokens, token_index) + let duplicated = 1 + if len(keys(path_tokens[token_index])) > 1 | let single = 0 | endif + if has_key(path_tokens[token_index], token) | let uniq = 0 | endif + endif + call insert(path, {'token': token, 'duplicated': duplicated, 'uniq': uniq, 'single': single}) + let token_index += 1 + endfor + + let buf_name = [curbuf_tail] + let has_uniq = 0 + let has_skipped = 0 + for token1 in reverse(path) + if !token1['duplicated'] && len(buf_name) > 1 + call insert(buf_name, s:skip_symbol) + let has_skipped = 0 + break + endif + + if has_uniq == 1 + call insert(buf_name, s:skip_symbol) + let has_skipped = 0 + break + endif + + if token1['uniq'] == 0 && token1['single'] == 1 + let has_skipped = 1 + else + if has_skipped == 1 + call insert(buf_name, s:skip_symbol) + let has_skipped = 0 + endif + call insert(buf_name, token1['token']) + endif + + if token1['uniq'] == 1 + let has_uniq = 1 + endif + endfor + + if has_skipped == 1 + call insert(buf_name, s:skip_symbol) + endif + + return airline#extensions#tabline#formatters#default#wrap_name(a:bufnr, join(buf_name, '/')) + else + return airline#extensions#tabline#formatters#default#format(a:bufnr, a:buffers) + endif +endfunction diff --git a/.vim/autoload/airline/extensions/tabline/tabs.vim b/.vim/autoload/airline/extensions/tabline/tabs.vim new file mode 100644 index 0000000..a74ab5b --- /dev/null +++ b/.vim/autoload/airline/extensions/tabline/tabs.vim @@ -0,0 +1,124 @@ +" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +let s:spc = g:airline_symbols.space +let s:current_bufnr = -1 +let s:current_tabnr = -1 +let s:current_modified = 0 + +function! airline#extensions#tabline#tabs#off() + augroup airline_tabline_tabs + autocmd! + augroup END +endfunction + +function! airline#extensions#tabline#tabs#on() + augroup airline_tabline_tabs + autocmd! + autocmd BufDelete * call airline#extensions#tabline#tabs#invalidate() + augroup END +endfunction + +function! airline#extensions#tabline#tabs#invalidate() + let s:current_bufnr = -1 +endfunction + +function! airline#extensions#tabline#tabs#get() + let curbuf = bufnr('%') + let curtab = tabpagenr() + try + call airline#extensions#tabline#tabs#map_keys() + catch + " no-op + endtry + if curbuf == s:current_bufnr && curtab == s:current_tabnr && &columns == s:column_width + if !g:airline_detect_modified || getbufvar(curbuf, '&modified') == s:current_modified + return s:current_tabline + endif + endif + + let b = airline#extensions#tabline#new_builder() + + call airline#extensions#tabline#add_label(b, 'tabs') + + function! b.get_group(i) dict + let curtab = tabpagenr() + let group = 'airline_tab' + if a:i == curtab + let group = 'airline_tabsel' + if g:airline_detect_modified + for bi in tabpagebuflist(curtab) + if getbufvar(bi, '&modified') + let group = 'airline_tabmod' + endif + endfor + endif + let s:current_modified = (group == 'airline_tabmod') ? 1 : 0 + endif + return group + endfunction + + function! b.get_title(i) dict + let val = '%(' + + if get(g:, 'airline#extensions#tabline#show_tab_nr', 1) + let tab_nr_type = get(g:, 'airline#extensions#tabline#tab_nr_type', 0) + let val .= airline#extensions#tabline#tabs#tabnr_formatter(tab_nr_type, a:i) + endif + + return val.'%'.a:i.'T %{airline#extensions#tabline#title('.a:i.')} %)' + endfunction + + call b.insert_titles(curtab, 1, tabpagenr('$')) + + call b.add_section('airline_tabfill', '') + call b.split() + call b.add_section('airline_tabfill', '') + + if get(g:, 'airline#extensions#tabline#show_close_button', 1) + call b.add_section('airline_tab_right', ' %999X'. + \ get(g:, 'airline#extensions#tabline#close_symbol', 'X').' ') + endif + + if get(g:, 'airline#extensions#tabline#show_splits', 1) == 1 + let buffers = tabpagebuflist(curtab) + for nr in buffers + let group = airline#extensions#tabline#group_of_bufnr(buffers, nr) . "_right" + call b.add_section_spaced(group, '%(%{airline#extensions#tabline#get_buffer_name('.nr.')}%)') + endfor + if get(g:, 'airline#extensions#tabline#show_buffers', 1) + call airline#extensions#tabline#add_label(b, 'buffers') + endif + endif + + let s:current_bufnr = curbuf + let s:current_tabnr = curtab + let s:column_width = &columns + let s:current_tabline = b.build() + return s:current_tabline +endfunction + +function! airline#extensions#tabline#tabs#map_keys() + if maparg('<Plug>AirlineSelectTab1', 'n') is# ':1tabn<CR>' + return + endif + noremap <silent> <Plug>AirlineSelectTab1 :1tabn<CR> + noremap <silent> <Plug>AirlineSelectTab2 :2tabn<CR> + noremap <silent> <Plug>AirlineSelectTab3 :3tabn<CR> + noremap <silent> <Plug>AirlineSelectTab4 :4tabn<CR> + noremap <silent> <Plug>AirlineSelectTab5 :5tabn<CR> + noremap <silent> <Plug>AirlineSelectTab6 :6tabn<CR> + noremap <silent> <Plug>AirlineSelectTab7 :7tabn<CR> + noremap <silent> <Plug>AirlineSelectTab8 :8tabn<CR> + noremap <silent> <Plug>AirlineSelectTab9 :9tabn<CR> + noremap <silent> <Plug>AirlineSelectPrevTab gT + " tabn {count} goes to count tab does not go {count} tab pages forward! + noremap <silent> <Plug>AirlineSelectNextTab :<C-U>exe repeat(':tabn\|', v:count1)<cr> +endfunction + +function! airline#extensions#tabline#tabs#tabnr_formatter(nr, i) + let formatter = get(g:, 'airline#extensions#tabline#tabnr_formatter', 'tabnr') + return airline#extensions#tabline#formatters#{formatter}#format(a:nr, a:i) +endfunction diff --git a/.vim/autoload/airline/extensions/tabline/xtabline.vim b/.vim/autoload/airline/extensions/tabline/xtabline.vim new file mode 100644 index 0000000..4d1cdec --- /dev/null +++ b/.vim/autoload/airline/extensions/tabline/xtabline.vim @@ -0,0 +1,397 @@ +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" xTabline - Reduced version for vim-airline +" Copyright (C) 2018 Gianmaria Bajo <mg1979.git@gmail.com> +" License: MIT License +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + + +function! airline#extensions#tabline#xtabline#init() + + let s:state = 0 + + " initialize mappings + call airline#extensions#tabline#xtabline#maps() + + """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + " Variables + """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + + let g:loaded_xtabline = 1 + let s:most_recent = -1 + let s:xtabline_filtering = 1 + + let t:xtl_excluded = get(g:, 'airline#extensions#tabline#exclude_buffers', []) + let t:xtl_accepted = [] + + let g:xtabline_include_previews = get(g:, 'xtabline_include_previews', 1) + + let g:xtabline_alt_action = get(g:, 'xtabline_alt_action', "buffer #") + + + """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + " Autocommands + """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + + augroup plugin-xtabline + autocmd! + + autocmd TabNew * call s:Do('new') + autocmd TabEnter * call s:Do('enter') + autocmd TabLeave * call s:Do('leave') + autocmd TabClosed * call s:Do('close') + + autocmd BufEnter * let g:xtabline_changing_buffer = 0 + autocmd BufAdd,BufDelete,BufWrite * call airline#extensions#tabline#xtabline#filter_buffers() + augroup END + + + """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + " Commands + """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + + com! XTabReopen call airline#extensions#tabline#xtabline#reopen_last_tab() + +endfunction + + +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" Mappings +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + +function! airline#extensions#tabline#xtabline#maps() + + if !exists('g:xtabline_disable_keybindings') + + fun! s:mapkeys(keys, plug) + if empty(mapcheck(a:keys)) && !hasmapto(a:plug) + silent! execute 'nmap <unique> '.a:keys.' '.a:plug + endif + endfun + + call s:mapkeys('<F5>','<Plug>XTablineToggleTabs') + call s:mapkeys('<leader><F5>','<Plug>XTablineToggleFiltering') + call s:mapkeys('<BS>','<Plug>XTablineSelectBuffer') + call s:mapkeys(']l','<Plug>XTablineNextBuffer') + call s:mapkeys('[l','<Plug>XTablinePrevBuffer') + call s:mapkeys('<leader>tr','<Plug>XTablineReopen') + endif + + nnoremap <unique> <script> <Plug>XTablineToggleTabs <SID>ToggleTabs + nnoremap <silent> <SID>ToggleTabs :call airline#extensions#tabline#xtabline#toggle_tabs()<cr> + + nnoremap <unique> <script> <Plug>XTablineToggleFiltering <SID>ToggleFiltering + nnoremap <silent> <SID>ToggleFiltering :call airline#extensions#tabline#xtabline#toggle_buffers()<cr> + + nnoremap <unique> <script> <Plug>XTablineSelectBuffer <SID>SelectBuffer + nnoremap <silent> <expr> <SID>SelectBuffer g:xtabline_changing_buffer ? "\<C-c>" : ":<C-u>call airline#extensions#tabline#xtabline#select_buffer(v:count)\<cr>" + + nnoremap <unique> <script> <Plug>XTablineNextBuffer <SID>NextBuffer + nnoremap <silent> <expr> <SID>NextBuffer airline#extensions#tabline#xtabline#next_buffer(v:count1) + + nnoremap <unique> <script> <Plug>XTablinePrevBuffer <SID>PrevBuffer + nnoremap <silent> <expr> <SID>PrevBuffer airline#extensions#tabline#xtabline#prev_buffer(v:count1) + + nnoremap <unique> <script> <Plug>XTablineReopen <SID>ReopenLastTab + nnoremap <silent> <SID>ReopenLastTab :XTabReopen<cr> + + if get(g:, 'xtabline_cd_commands', 0) + map <unique> <leader>cdc <Plug>XTablineCdCurrent + map <unique> <leader>cdd <Plug>XTablineCdDown1 + map <unique> <leader>cd2 <Plug>XTablineCdDown2 + map <unique> <leader>cd3 <Plug>XTablineCdDown3 + map <unique> <leader>cdh <Plug>XTablineCdHome + nnoremap <unique> <script> <Plug>XTablineCdCurrent :cd %:p:h<cr>:call airline#util#doautocmd('BufAdd')<cr>:pwd<cr> + nnoremap <unique> <script> <Plug>XTablineCdDown1 :cd %:p:h:h<cr>:call airline#util#doautocmd('BufAdd')<cr>:pwd<cr> + nnoremap <unique> <script> <Plug>XTablineCdDown2 :cd %:p:h:h:h<cr>:call airline#util#doautocmd('BufAdd')<cr>:pwd<cr> + nnoremap <unique> <script> <Plug>XTablineCdDown3 :cd %:p:h:h:h:h<cr>:call airline#util#doautocmd('BufAdd')<cr>:pwd<cr> + nnoremap <unique> <script> <Plug>XTablineCdHome :cd ~<cr>:call airline#util#doautocmd('BufAdd')<cr>:pwd<cr> + endif +endfunction + + +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" Commands functions +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + +function! airline#extensions#tabline#xtabline#toggle_tabs() + """Toggle between tabs/buffers tabline.""" + + if tabpagenr("$") == 1 | call airline#util#warning("There is only one tab.") | return | endif + + if g:airline#extensions#tabline#show_tabs + let g:airline#extensions#tabline#show_tabs = 0 + call airline#util#warning("Showing buffers") + else + let g:airline#extensions#tabline#show_tabs = 1 + call airline#util#warning("Showing tabs") + endif + + doautocmd BufAdd +endfunction + +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + +function! airline#extensions#tabline#xtabline#toggle_buffers() + """Toggle buffer filtering in the tabline.""" + + if s:xtabline_filtering + let s:xtabline_filtering = 0 + let g:airline#extensions#tabline#exclude_buffers = [] + call airline#util#warning("Buffer filtering turned off") + doautocmd BufAdd + else + let s:xtabline_filtering = 1 + call airline#extensions#tabline#xtabline#filter_buffers() + call airline#util#warning("Buffer filtering turned on") + doautocmd BufAdd + endif +endfunction + +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + +function! airline#extensions#tabline#xtabline#reopen_last_tab() + """Reopen the last closed tab.""" + + if !exists('s:most_recently_closed_tab') + call airline#util#warning("No recent tabs.") + return + endif + + let tab = s:most_recently_closed_tab + tabnew + let empty = bufnr("%") + let t:cwd = tab['cwd'] + cd `=t:cwd` + let t:name = tab['name'] + for buf in tab['buffers'] | execute "badd ".buf | endfor + execute "edit ".tab['buffers'][0] + execute "bdelete ".empty +endfunction + +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + +function! airline#extensions#tabline#xtabline#filter_buffers() + """Filter buffers so that only the ones within the tab's cwd will show up. + + " 'accepted' is a list of buffer numbers, for quick access. + " 'excluded' is a list of buffer numbers, it will be used by Airline to hide buffers. + + if !s:xtabline_filtering | return | endif + + let g:airline#extensions#tabline#exclude_buffers = [] + let t:xtl_excluded = g:airline#extensions#tabline#exclude_buffers + let t:xtl_accepted = [] | let accepted = t:xtl_accepted + let previews = g:xtabline_include_previews + + " bufnr(0) is the alternate buffer + for buf in range(1, bufnr("$")) + + if !buflisted(buf) | continue | endif + + " get the path + let path = expand("#".buf.":p") + + " confront with the cwd + if !previews && path =~ "^".getcwd() + call add(accepted, buf) + elseif previews && path =~ getcwd() + call add(accepted, buf) + else + call add(t:xtl_excluded, buf) + endif + endfor + + call s:RefreshTabline() +endfunction + +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + +function! airline#extensions#tabline#xtabline#next_buffer(nr) + """Switch to next visible buffer.""" + + if ( s:NotEnoughBuffers() || !s:xtabline_filtering ) | return | endif + let accepted = t:xtl_accepted + + let ix = index(accepted, bufnr("%")) + let target = ix + a:nr + let total = len(accepted) + + if ix == -1 + " not in index, go back to most recent or back to first + if s:most_recent == -1 || s:most_recent >= total + let s:most_recent = 0 + endif + + elseif target >= total + " over last buffer + while target >= total | let target -= total | endwhile + let s:most_recent = target + + else + let s:most_recent = target + endif + + return ":buffer " . accepted[s:most_recent] . "\<cr>" +endfunction + +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + +function! airline#extensions#tabline#xtabline#prev_buffer(nr) + """Switch to previous visible buffer.""" + + if ( s:NotEnoughBuffers() || !s:xtabline_filtering ) | return | endif + let accepted = t:xtl_accepted + + let ix = index(accepted, bufnr("%")) + let target = ix - a:nr + let total = len(accepted) + + if ix == -1 + " not in index, go back to most recent or back to first + if s:most_recent == -1 || s:most_recent >= total + let s:most_recent = 0 + endif + + elseif target < 0 + " before first buffer + while target < 0 | let target += total | endwhile + let s:most_recent = target + + else + let s:most_recent = target + endif + + return ":buffer " . accepted[s:most_recent] . "\<cr>" +endfunction + +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + +function! airline#extensions#tabline#xtabline#select_buffer(nr) + """Switch to visible buffer in the tabline with [count].""" + + if ( a:nr == 0 || !s:xtabline_filtering ) | execute g:xtabline_alt_action | return | endif + let accepted = t:xtl_accepted + + if (a:nr > len(accepted)) || s:NotEnoughBuffers() || accepted[a:nr - 1] == bufnr("%") + return + else + let g:xtabline_changing_buffer = 1 + execute "buffer ".accepted[a:nr - 1] + endif +endfunction + +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + +function! s:TabBuffers() + """Return a list of buffers names for this tab.""" + + return map(copy(t:xtl_accepted), 'bufname(v:val)') +endfunction + + +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" Helper functions +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + +function! s:NotEnoughBuffers() + """Just return if there aren't enough buffers.""" + + if len(t:xtl_accepted) < 2 + if index(t:xtl_accepted, bufnr("%")) == -1 + return + elseif !len(t:xtl_accepted) + call airline#util#warning("No available buffers for this tab.") + else + call airline#util#warning("No other available buffers for this tab.") + endif + return 1 + endif +endfunction + +function! s:RefreshTabline() + call airline#extensions#tabline#buflist#invalidate() +endfunction + + +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" TabPageCd +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + +" tabpagecd - Turn :cd into :tabpagecd, to use one tab page per project +" expanded version by mg979 +" Copyright (C) 2012-2013 Kana Natsuno <http://whileimautomaton.net/> +" Copyright (C) 2018 Gianmaria Bajo <mg1979.git@gmail.com> +" License: MIT License + +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + +function! s:InitCwds() + if !exists('g:xtab_cwds') | let g:xtab_cwds = [] | endif + + while len(g:xtab_cwds) < tabpagenr("$") + call add(g:xtab_cwds, getcwd()) + endwhile + let s:state = 1 + let t:cwd = getcwd() + let s:last_tab = 0 + call airline#extensions#tabline#xtabline#filter_buffers() +endfunction + +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + +function! airline#extensions#tabline#xtabline#update_obsession() + let string = 'let g:xtab_cwds = '.string(g:xtab_cwds).' | call airline#extensions#tabline#xtabline#update_obsession()' + if !exists('g:obsession_append') + let g:obsession_append = [string] + else + call filter(g:obsession_append, 'v:val !~# "^let g:xtab_cwds"') + call add(g:obsession_append, string) + endif +endfunction + +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + +function! s:Do(action) + let arg = a:action + if !s:state | call s:InitCwds() | return | endif + + """""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + + if arg == 'new' + + call insert(g:xtab_cwds, getcwd(), tabpagenr()-1) + + """""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + + elseif arg == 'enter' + + let t:cwd =g:xtab_cwds[tabpagenr()-1] + + cd `=t:cwd` + call airline#extensions#tabline#xtabline#filter_buffers() + + """""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + + elseif arg == 'leave' + + let t:cwd = getcwd() + let g:xtab_cwds[tabpagenr()-1] = t:cwd + let s:last_tab = tabpagenr() - 1 + + if !exists('t:name') | let t:name = t:cwd | endif + let s:most_recent_tab = {'cwd': t:cwd, 'name': t:name, 'buffers': s:TabBuffers()} + + """""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + + elseif arg == 'close' + + let s:most_recently_closed_tab = copy(s:most_recent_tab) + call remove(g:xtab_cwds, s:last_tab) + endif + + """""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + + call airline#extensions#tabline#xtabline#update_obsession() +endfunction + +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" diff --git a/.vim/autoload/airline/extensions/tagbar.vim b/.vim/autoload/airline/extensions/tagbar.vim new file mode 100644 index 0000000..5db53ee --- /dev/null +++ b/.vim/autoload/airline/extensions/tagbar.vim @@ -0,0 +1,58 @@ +" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +if !exists(':TagbarToggle') + finish +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(...) + let builder = airline#builder#new({ 'active': a:1 }) + call builder.add_section('airline_a', s:spc.'Tagbar'.s:spc) + call builder.add_section('airline_b', s:spc.a:2.s:spc) + call builder.add_section('airline_c', s:spc.a:3.s:spc) + return builder.build() +endfunction + +function! airline#extensions#tagbar#inactive_apply(...) + if getwinvar(a:2.winnr, '&filetype') == 'tagbar' + return -1 + endif +endfunction + +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: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 + return s:airline_tagbar_last_lookup_val + endif + return '' +endfunction + +function! airline#extensions#tagbar#init(ext) + call a:ext.add_inactive_statusline_func('airline#extensions#tagbar#inactive_apply') + let g:tagbar_status_func = 'airline#extensions#tagbar#get_status' + + call airline#parts#define_function('tagbar', 'airline#extensions#tagbar#currenttag') +endfunction diff --git a/.vim/autoload/airline/extensions/term.vim b/.vim/autoload/airline/extensions/term.vim new file mode 100644 index 0000000..c5b578e --- /dev/null +++ b/.vim/autoload/airline/extensions/term.vim @@ -0,0 +1,43 @@ +" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +function! airline#extensions#term#apply(...) + if &buftype == 'terminal' + let spc = g:airline_symbols.space + + let name=get(g:airline_mode_map, 't', 't') + call a:1.add_section('airline_a', spc.name.spc) + call a:1.add_section('airline_b', '') + call a:1.add_section('airline_term', spc.s:termname()) + call a:1.split() + call a:1.add_section('airline_y', '') + call a:1.add_section('airline_z', spc.airline#section#create_right(['linenr', 'maxlinenr'])) + return 1 + endif +endfunction + +function! airline#extensions#term#inactive_apply(...) + if getbufvar(a:2.bufnr, '&buftype') == 'terminal' + let spc = g:airline_symbols.space + call a:1.add_section('airline_a', spc.'TERMINAL'.spc) + call a:1.add_section('airline_b', spc.'%f') + return 1 + endif +endfunction + +function! s:termname() + let bufname = bufname('%') + if has('nvim') + return matchstr(bufname, 'term.*:\zs.*') + else + " get rid of leading '!' + return bufname[1:] + endif +endfunction + +function! airline#extensions#term#init(ext) + call a:ext.add_statusline_func('airline#extensions#term#apply') + call a:ext.add_inactive_statusline_func('airline#extensions#term#inactive_apply') +endfunction diff --git a/.vim/autoload/airline/extensions/tmuxline.vim b/.vim/autoload/airline/extensions/tmuxline.vim new file mode 100644 index 0000000..44c7ec2 --- /dev/null +++ b/.vim/autoload/airline/extensions/tmuxline.vim @@ -0,0 +1,27 @@ +" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +if !exists(':Tmuxline') + finish +endif + +let s:tmuxline_snapshot_file = get(g:, 'airline#extensions#tmuxline#snapshot_file', '') +let s:color_template = get(g:, 'airline#extensions#tmuxline#color_template', 'normal') + +function! airline#extensions#tmuxline#init(ext) + call a:ext.add_theme_func('airline#extensions#tmuxline#set_tmux_colors') +endfunction + +function! airline#extensions#tmuxline#set_tmux_colors(palette) + let color_template = has_key(a:palette, s:color_template) ? s:color_template : 'normal' + let mode_palette = a:palette[color_template] + + let tmuxline_theme = tmuxline#api#create_theme_from_airline(mode_palette) + call tmuxline#api#set_theme(tmuxline_theme) + + if strlen(s:tmuxline_snapshot_file) + call tmuxline#api#snapshot(s:tmuxline_snapshot_file) + endif +endfunction diff --git a/.vim/autoload/airline/extensions/undotree.vim b/.vim/autoload/airline/extensions/undotree.vim new file mode 100644 index 0000000..9e43dfb --- /dev/null +++ b/.vim/autoload/airline/extensions/undotree.vim @@ -0,0 +1,28 @@ +" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +if !exists(':UndotreeToggle') + finish +endif + +function! airline#extensions#undotree#apply(...) + if exists('t:undotree') + if &ft == 'undotree' + if exists('*t:undotree.GetStatusLine') + call airline#extensions#apply_left_override('undo', '%{t:undotree.GetStatusLine()}') + else + call airline#extensions#apply_left_override('undotree', '%f') + endif + endif + + if &ft == 'diff' && exists('*t:diffpanel.GetStatusLine') + call airline#extensions#apply_left_override('diff', '%{t:diffpanel.GetStatusLine()}') + endif + endif +endfunction + +function! airline#extensions#undotree#init(ext) + call a:ext.add_statusline_func('airline#extensions#undotree#apply') +endfunction diff --git a/.vim/autoload/airline/extensions/unicode.vim b/.vim/autoload/airline/extensions/unicode.vim new file mode 100644 index 0000000..4afe129 --- /dev/null +++ b/.vim/autoload/airline/extensions/unicode.vim @@ -0,0 +1,24 @@ +" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +if !get(g:, 'loaded_unicodePlugin', 0) + finish +endif + +function! airline#extensions#unicode#apply(...) + if exists(":UnicodeTable") == 2 && bufname('') ==# 'UnicodeTable' + call airline#parts#define('unicode', { + \ 'text': '[UnicodeTable]', + \ 'accent': 'bold' }) + let w:airline_section_a = airline#section#create(['unicode']) + let w:airline_section_b = '' + let w:airline_section_c = ' ' + let w:airline_section_y = '' + endif +endfunction + +function! airline#extensions#unicode#init(ext) + call a:ext.add_statusline_func('airline#extensions#unicode#apply') +endfunction diff --git a/.vim/autoload/airline/extensions/unite.vim b/.vim/autoload/airline/extensions/unite.vim new file mode 100644 index 0000000..c6a09f0 --- /dev/null +++ b/.vim/autoload/airline/extensions/unite.vim @@ -0,0 +1,24 @@ +" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +if !get(g:, 'loaded_unite', 0) + finish +endif + +function! airline#extensions#unite#apply(...) + if &ft == 'unite' + call a:1.add_section('airline_a', ' Unite ') + call a:1.add_section('airline_b', ' %{get(unite#get_context(), "buffer_name", "")} ') + call a:1.add_section('airline_c', ' %{unite#get_status_string()} ') + call a:1.split() + call a:1.add_section('airline_y', ' %{get(unite#get_context(), "real_buffer_name", "")} ') + return 1 + endif +endfunction + +function! airline#extensions#unite#init(ext) + let g:unite_force_overwrite_statusline = 0 + call a:ext.add_statusline_func('airline#extensions#unite#apply') +endfunction diff --git a/.vim/autoload/airline/extensions/vimagit.vim b/.vim/autoload/airline/extensions/vimagit.vim new file mode 100644 index 0000000..8c98ec9 --- /dev/null +++ b/.vim/autoload/airline/extensions/vimagit.vim @@ -0,0 +1,34 @@ +" MIT License. Copyright (c) 2016-2018 Jerome Reybert et al. +" vim: et ts=2 sts=2 sw=2 + +" This plugin replace the whole section_a when in vimagit buffer +scriptencoding utf-8 + +if !get(g:, 'loaded_magit', 0) + finish +endif + +function! airline#extensions#vimagit#init(ext) + call a:ext.add_statusline_func('airline#extensions#vimagit#apply') +endfunction + +function! airline#extensions#vimagit#get_mode() + if ( exists("*magit#get_current_mode") ) + return magit#get_current_mode() + else + if ( b:magit_current_commit_mode == '' ) + return "STAGING" + elseif ( b:magit_current_commit_mode == 'CC' ) + return "COMMIT" + elseif ( b:magit_current_commit_mode == 'CA' ) + return "AMEND" + else + return "???" + endif +endfunction + +function! airline#extensions#vimagit#apply(...) + if ( &filetype == 'magit' ) + let w:airline_section_a = '%{airline#extensions#vimagit#get_mode()}' + endif +endfunction diff --git a/.vim/autoload/airline/extensions/vimtex.vim b/.vim/autoload/airline/extensions/vimtex.vim new file mode 100644 index 0000000..9eda8d5 --- /dev/null +++ b/.vim/autoload/airline/extensions/vimtex.vim @@ -0,0 +1,84 @@ +" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. +" vim: et ts=2 sts=2 sw=2 + +" This plugin replace the whole section_a when in vimagit buffer +scriptencoding utf-8 + +let s:spc = g:airline_symbols.space + +function! s:SetDefault(var, val) + if !exists(a:var) + execute 'let ' . a:var . '=' . string(a:val) + endif +endfunction + +" Left and right delimiters (added only when status string is not empty) +call s:SetDefault( 'g:airline#extensions#vimtex#left', "{") +call s:SetDefault( 'g:airline#extensions#vimtex#right', "}") + +" The current tex file is the main project file +call s:SetDefault( 'g:airline#extensions#vimtex#main', "" ) +" +" The current tex file is a subfile of the project +" and the compilation is set for the main file +call s:SetDefault( '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 +call s:SetDefault( 'g:airline#extensions#vimtex#sub_local', "l") +" +" Compilation is running and continuous compilation is off +call s:SetDefault( 'g:airline#extensions#vimtex#compiled', "c₁") + +" Compilation is running and continuous compilation is on +call s:SetDefault( 'g:airline#extensions#vimtex#continuous', "c") + +" Viewer is opened +call s:SetDefault( 'g:airline#extensions#vimtex#viewer', "v") + +function! airline#extensions#vimtex#init(ext) + call airline#parts#define_raw('vimtex', '%{airline#extensions#vimtex#get_scope()}') + call a:ext.add_statusline_func('airline#extensions#vimtex#apply') +endfunction + +function! airline#extensions#vimtex#apply(...) + if exists("b:vimtex") + let w:airline_section_x = get(w:, 'airline_section_x', g:airline_section_x) + let w:airline_section_x.=s:spc.g:airline_left_alt_sep.s:spc.'%{airline#extensions#vimtex#get_scope()}' + endif +endfunction + +function! airline#extensions#vimtex#get_scope() + let l:status = '' + + let vt_local = get(b:, 'vimtex_local', {}) + if empty(vt_local) + let l:status .= g:airline#extensions#vimtex#main + else + if get(vt_local, 'active') + let l:status .= g:airline#extensions#vimtex#sub_local + else + let l:status .= g:airline#extensions#vimtex#sub_main + endif + endif + + if get(get(get(b:, 'vimtex', {}), 'viewer', {}), 'xwin_id') + let l:status .= g:airline#extensions#vimtex#viewer + endif + + let l:compiler = get(get(b:, 'vimtex', {}), 'compiler', {}) + if !empty(l:compiler) + if has_key(l:compiler, 'is_running') && b:vimtex.compiler.is_running() + if get(l:compiler, 'continuous') + let l:status .= g:airline#extensions#vimtex#continuous + else + let l:status .= g:airline#extensions#vimtex#compiled + endif + endif + endif + + if !empty(l:status) + let l:status = g:airline#extensions#vimtex#left . l:status . g:airline#extensions#vimtex#right + endif + return l:status +endfunction diff --git a/.vim/autoload/airline/extensions/virtualenv.vim b/.vim/autoload/airline/extensions/virtualenv.vim new file mode 100644 index 0000000..b494d85 --- /dev/null +++ b/.vim/autoload/airline/extensions/virtualenv.vim @@ -0,0 +1,31 @@ +" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +let s:spc = g:airline_symbols.space + +function! airline#extensions#virtualenv#init(ext) + call a:ext.add_statusline_func('airline#extensions#virtualenv#apply') +endfunction + +function! airline#extensions#virtualenv#apply(...) + if &filetype =~# "python" + if get(g:, 'virtualenv_loaded', 0) + let statusline = virtualenv#statusline() + else + let statusline = fnamemodify($VIRTUAL_ENV, ':t') + endif + if !empty(statusline) + call airline#extensions#append_to_section('x', + \ s:spc.g:airline_right_alt_sep.s:spc.statusline) + endif + endif +endfunction + +function! airline#extensions#virtualenv#update() + if &filetype =~# "python" + call airline#extensions#virtualenv#apply() + call airline#update_statusline() + endif +endfunction diff --git a/.vim/autoload/airline/extensions/whitespace.vim b/.vim/autoload/airline/extensions/whitespace.vim new file mode 100644 index 0000000..c9b5a2a --- /dev/null +++ b/.vim/autoload/airline/extensions/whitespace.vim @@ -0,0 +1,171 @@ +" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. +" vim: et ts=2 sts=2 sw=2 + +" http://got-ravings.blogspot.com/2008/10/vim-pr0n-statusline-whitespace-flags.html + +scriptencoding utf-8 + +let s:show_message = get(g:, 'airline#extensions#whitespace#show_message', 1) +let s:symbol = get(g:, 'airline#extensions#whitespace#symbol', g:airline_symbols.whitespace) +let s:default_checks = ['indent', 'trailing', 'mixed-indent-file'] + +let s:enabled = get(g:, 'airline#extensions#whitespace#enabled', 1) +let s:skip_check_ft = {'make': ['indent', 'mixed-indent-file']} + +function! s:check_mixed_indent() + let indent_algo = get(g:, 'airline#extensions#whitespace#mixed_indent_algo', 0) + if indent_algo == 1 + " [<tab>]<space><tab> + " spaces before or between tabs are not allowed + let t_s_t = '(^\t* +\t\s*\S)' + " <tab>(<space> x count) + " count of spaces at the end of tabs should be less than tabstop value + let t_l_s = '(^\t+ {' . &ts . ',}' . '\S)' + return search('\v' . t_s_t . '|' . t_l_s, 'nw') + elseif indent_algo == 2 + return search('\v(^\t* +\t\s*\S)', 'nw') + else + return search('\v(^\t+ +)|(^ +\t+)', 'nw') + endif +endfunction + +function! s:check_mixed_indent_file() + let c_like_langs = get(g:, 'airline#extensions#c_like_langs', + \ [ 'arduino', 'c', 'cpp', 'cuda', 'go', 'javascript', 'ld', 'php' ]) + if index(c_like_langs, &ft) > -1 + " for C-like languages: allow /** */ comment style with one space before the '*' + let head_spc = '\v(^ +\*@!)' + else + let head_spc = '\v(^ +)' + endif + let indent_tabs = search('\v(^\t+)', 'nw') + let indent_spc = search(head_spc, 'nw') + if indent_tabs > 0 && indent_spc > 0 + return printf("%d:%d", indent_tabs, indent_spc) + else + return '' + endif +endfunction + +function! airline#extensions#whitespace#check() + let max_lines = get(g:, 'airline#extensions#whitespace#max_lines', 20000) + if &readonly || !&modifiable || !s:enabled || line('$') > max_lines + \ || get(b:, 'airline_whitespace_disabled', 0) + return '' + endif + let skip_check_ft = extend(s:skip_check_ft, + \ get(g:, 'airline#extensions#whitespace#skip_indent_check_ft', {}), 'force') + + if !exists('b:airline_whitespace_check') + let b:airline_whitespace_check = '' + let checks = get(b:, 'airline_whitespace_checks', get(g:, 'airline#extensions#whitespace#checks', s:default_checks)) + + let trailing = 0 + let check = 'trailing' + if index(checks, check) > -1 && index(get(skip_check_ft, &ft, []), check) < 0 + try + let regexp = get(g:, 'airline#extensions#whitespace#trailing_regexp', '\s$') + let trailing = search(regexp, 'nw') + catch + call airline#util#warning(printf('Whitespace: error occurred evaluating "%s"', regexp)) + echomsg v:exception + return '' + endtry + endif + + let mixed = 0 + let check = 'indent' + if index(checks, check) > -1 && index(get(skip_check_ft, &ft, []), check) < 0 + let mixed = s:check_mixed_indent() + endif + + let mixed_file = '' + let check = 'mixed-indent-file' + if index(checks, check) > -1 && index(get(skip_check_ft, &ft, []), check) < 0 + let mixed_file = s:check_mixed_indent_file() + endif + + let long = 0 + if index(checks, 'long') > -1 && &tw > 0 + let long = search('\%>'.&tw.'v.\+', 'nw') + endif + + if trailing != 0 || mixed != 0 || long != 0 || !empty(mixed_file) + let b:airline_whitespace_check = s:symbol + if strlen(s:symbol) > 0 + let space = (g:airline_symbols.space) + else + let space = '' + endif + + if s:show_message + if trailing != 0 + let trailing_fmt = get(g:, 'airline#extensions#whitespace#trailing_format', '[%s]trailing') + let b:airline_whitespace_check .= space.printf(trailing_fmt, trailing) + endif + if mixed != 0 + let mixed_indent_fmt = get(g:, 'airline#extensions#whitespace#mixed_indent_format', '[%s]mixed-indent') + let b:airline_whitespace_check .= space.printf(mixed_indent_fmt, mixed) + endif + if long != 0 + let long_fmt = get(g:, 'airline#extensions#whitespace#long_format', '[%s]long') + let b:airline_whitespace_check .= space.printf(long_fmt, long) + endif + if !empty(mixed_file) + let mixed_indent_file_fmt = get(g:, 'airline#extensions#whitespace#mixed_indent_file_format', '[%s]mix-indent-file') + let b:airline_whitespace_check .= space.printf(mixed_indent_file_fmt, mixed_file) + endif + endif + endif + endif + return airline#util#shorten(b:airline_whitespace_check, 120, 9) +endfunction + +function! airline#extensions#whitespace#toggle() + if s:enabled + augroup airline_whitespace + autocmd! + augroup END + augroup! airline_whitespace + let s:enabled = 0 + else + call airline#extensions#whitespace#init() + let s:enabled = 1 + endif + + if exists("g:airline#extensions#whitespace#enabled") + let g:airline#extensions#whitespace#enabled = s:enabled + if s:enabled && match(g:airline_section_warning, '#whitespace#check') < 0 + let g:airline_section_warning .= airline#section#create(['whitespace']) + call airline#update_statusline() + endif + endif + call airline#util#warning(printf('Whitespace checking: %s',(s:enabled ? 'Enabled' : 'Disabled'))) +endfunction + +function! airline#extensions#whitespace#disable() + if s:enabled + call airline#extensions#whitespace#toggle() + endif +endfunction + +function! airline#extensions#whitespace#init(...) + call airline#parts#define_function('whitespace', 'airline#extensions#whitespace#check') + + unlet! b:airline_whitespace_check + augroup airline_whitespace + autocmd! + autocmd CursorHold,BufWritePost * call <sid>ws_refresh() + augroup END +endfunction + +function! s:ws_refresh() + if get(b:, 'airline_ws_changedtick', 0) == b:changedtick + return + endif + unlet! b:airline_whitespace_check + if get(g:, 'airline_skip_empty_sections', 0) + exe ':AirlineRefresh' + endif + let b:airline_ws_changedtick = b:changedtick +endfunction diff --git a/.vim/autoload/airline/extensions/windowswap.vim b/.vim/autoload/airline/extensions/windowswap.vim new file mode 100644 index 0000000..5ef531e --- /dev/null +++ b/.vim/autoload/airline/extensions/windowswap.vim @@ -0,0 +1,29 @@ +" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +if !exists('g:loaded_windowswap') + finish +endif + +let s:spc = g:airline_symbols.space + +if !exists('g:airline#extensions#windowswap#indicator_text') + let g:airline#extensions#windowswap#indicator_text = 'WS' +endif + +function! airline#extensions#windowswap#init(ext) + call airline#parts#define_function('windowswap', 'airline#extensions#windowswap#get_status') +endfunction + +function! airline#extensions#windowswap#get_status() + " use new tab-aware api if WS is up to date + let s:mark = exists('*WindowSwap#IsCurrentWindowMarked') ? + \WindowSwap#IsCurrentWindowMarked() : + \(WindowSwap#HasMarkedWindow() && WindowSwap#GetMarkedWindowNum() == winnr()) + if s:mark + return g:airline#extensions#windowswap#indicator_text.s:spc + endif + return '' +endfunction diff --git a/.vim/autoload/airline/extensions/wordcount.vim b/.vim/autoload/airline/extensions/wordcount.vim new file mode 100644 index 0000000..a9b9aac --- /dev/null +++ b/.vim/autoload/airline/extensions/wordcount.vim @@ -0,0 +1,117 @@ +" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. +" vim: et ts=2 sts=2 sw=2 fdm=marker + +scriptencoding utf-8 + +" get wordcount {{{1 +if exists('*wordcount') + function! s:get_wordcount(visual_mode_active) + let query = a:visual_mode_active ? 'visual_words' : 'words' + return get(wordcount(), query, 0) + endfunction +else " Pull wordcount from the g_ctrl-g stats + function! s:get_wordcount(visual_mode_active) + let pattern = a:visual_mode_active + \ ? '^.\D*\d\+\D\+\d\+\D\+\zs\d\+' + \ : '^.\D*\%(\d\+\D\+\)\{5}\zs\d\+' + + let save_status = v:statusmsg + if !a:visual_mode_active && col('.') == col('$') + let save_pos = getpos('.') + execute "silent normal! g\<c-g>" + call setpos('.', save_pos) + else + execute "silent normal! g\<c-g>" + endif + let stats = v:statusmsg + let v:statusmsg = save_status + + return str2nr(matchstr(stats, pattern)) + endfunction +endif + +" format {{{1 +let s:formatter = get(g:, 'airline#extensions#wordcount#formatter', 'default') + +" wrapper function for compatibility; redefined below for old-style formatters +function! s:format_wordcount(wordcount) + return airline#extensions#wordcount#formatters#{s:formatter}#to_string(a:wordcount) +endfunction + +" check user-defined formatter exists with appropriate functions, otherwise +" fall back to default +if s:formatter !=# 'default' + execute 'runtime! autoload/airline/extensions/wordcount/formatters/'.s:formatter + if !exists('*airline#extensions#wordcount#formatters#{s:formatter}#to_string') + if !exists('*airline#extensions#wordcount#formatters#{s:formatter}#format') + let s:formatter = 'default' + else + " redefine for backwords compatibility + function! s:format_wordcount(_) + if mode() ==? 'v' + return b:airline_wordcount + else + return airline#extensions#wordcount#formatters#{s:formatter}#format() + endif + endfunction + endif + endif +endif + +" update {{{1 +let s:wordcount_cache = 0 " cache wordcount for performance when force_update=0 +function! s:update_wordcount(force_update) + let wordcount = s:get_wordcount(0) + if wordcount != s:wordcount_cache || a:force_update + let s:wordcount_cache = wordcount + let b:airline_wordcount = s:format_wordcount(wordcount) + endif +endfunction + +let s:visual_active = 0 " Boolean: for when to get visual wordcount +function airline#extensions#wordcount#get() + if s:visual_active + return s:format_wordcount(s:get_wordcount(1)) + else + if get(b:, 'airline_changedtick', 0) != b:changedtick + call s:update_wordcount(0) + let b:airline_changedtick = b:changedtick + endif + return get(b:, 'airline_wordcount', '') + endif +endfunction + +" airline functions {{{1 +" default filetypes: +let s:filetypes = ['help', 'markdown', 'rst', 'org', 'text', 'asciidoc', 'tex', 'mail'] +function! airline#extensions#wordcount#apply(...) + let filetypes = get(g:, 'airline#extensions#wordcount#filetypes', s:filetypes) + + " Check if filetype needs testing + if did_filetype() || filetypes isnot s:filetypes + let s:filetypes = filetypes + + " Select test based on type of "filetypes": new=list, old=string + if type(filetypes) == get(v:, 't_list', type([])) + \ ? index(filetypes, &filetype) > -1 || index(filetypes, 'all') > -1 + \ : match(&filetype, filetypes) > -1 + let b:airline_changedtick = -1 + call s:update_wordcount(1) " force update: ensures initial worcount exists + elseif exists('b:airline_wordcount') " cleanup when filetype is removed + unlet b:airline_wordcount + endif + endif + + if exists('b:airline_wordcount') + call airline#extensions#prepend_to_section( + \ 'z', '%{airline#extensions#wordcount#get()}') + endif +endfunction + +function! airline#extensions#wordcount#init(ext) + augroup airline_wordcount + autocmd! User AirlineModeChanged nested + \ let s:visual_active = (mode() ==? 'v' || mode() ==? 's') + augroup END + call a:ext.add_statusline_func('airline#extensions#wordcount#apply') +endfunction diff --git a/.vim/autoload/airline/extensions/wordcount/formatters/default.vim b/.vim/autoload/airline/extensions/wordcount/formatters/default.vim new file mode 100644 index 0000000..5682921 --- /dev/null +++ b/.vim/autoload/airline/extensions/wordcount/formatters/default.vim @@ -0,0 +1,39 @@ +" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +function! airline#extensions#wordcount#formatters#default#update_fmt(...) + let s:fmt = get(g:, 'airline#extensions#wordcount#formatter#default#fmt', '%s words') + let s:fmt_short = get(g:, 'airline#extensions#wordcount#formatter#default#fmt_short', s:fmt == '%s words' ? '%sW' : s:fmt) +endfunction + +" Reload format when statusline is rebuilt +call airline#extensions#wordcount#formatters#default#update_fmt() +if index(g:airline_statusline_funcrefs, function('airline#extensions#wordcount#formatters#default#update_fmt')) == -1 + " only add it, if not already done + call airline#add_statusline_funcref(function('airline#extensions#wordcount#formatters#default#update_fmt')) +endif + +if match(get(v:, 'lang', ''), '\v\cC|en') > -1 + let s:decimal_group = ',' +elseif match(get(v:, 'lang', ''), '\v\cde|dk|fr|pt') > -1 + let s:decimal_group = '.' +else + let s:decimal_group = '' +endif + +function! airline#extensions#wordcount#formatters#default#to_string(wordcount) + if winwidth(0) >= 80 + if a:wordcount > 999 + " Format number according to locale, e.g. German: 1.245 or English: 1,245 + let wordcount = substitute(a:wordcount, '\d\@<=\(\(\d\{3\}\)\+\)$', s:decimal_group.'&', 'g') + else + let wordcount = a:wordcount + endif + let str = printf(s:fmt, wordcount) + else + let str = printf(s:fmt_short, a:wordcount) + endif + return str . g:airline_symbols.space . g:airline_right_alt_sep . g:airline_symbols.space +endfunction diff --git a/.vim/autoload/airline/extensions/xkblayout.vim b/.vim/autoload/airline/extensions/xkblayout.vim new file mode 100644 index 0000000..b9d56a1 --- /dev/null +++ b/.vim/autoload/airline/extensions/xkblayout.vim @@ -0,0 +1,24 @@ +" MIT License. Copyright (c) 2017-2018 YoungHoon Rhiu et al. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +if !exists('g:XkbSwitchLib') + finish +endif + +function! airline#extensions#xkblayout#status() + let keyboard_layout = libcall(g:XkbSwitchLib, 'Xkb_Switch_getXkbLayout', '') + let keyboard_layout = split(keyboard_layout, '\.')[-1] + let short_codes = get(g:, 'airline#extensions#xkblayout#short_codes', {'2SetKorean': 'KR', 'Chinese': 'CN', 'Japanese': 'JP'}) + + if has_key(short_codes, keyboard_layout) + let keyboard_layout = short_codes[keyboard_layout] + endif + + return keyboard_layout +endfunction + +function! airline#extensions#xkblayout#init(ext) + call airline#parts#define_function('xkblayout', 'airline#extensions#xkblayout#status') +endfunction diff --git a/.vim/autoload/airline/extensions/ycm.vim b/.vim/autoload/airline/extensions/ycm.vim new file mode 100644 index 0000000..677ba03 --- /dev/null +++ b/.vim/autoload/airline/extensions/ycm.vim @@ -0,0 +1,37 @@ +" MIT License. Copyright (c) 2015-2018 Evgeny Firsov et al. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +let s:spc = g:airline_symbols.space +let s:error_symbol = get(g:, 'airline#extensions#ycm#error_symbol', 'E:') +let s:warning_symbol = get(g:, 'airline#extensions#ycm#warning_symbol', 'W:') + +function! airline#extensions#ycm#init(ext) + call airline#parts#define_function('ycm_error_count', 'airline#extensions#ycm#get_error_count') + call airline#parts#define_function('ycm_warning_count', 'airline#extensions#ycm#get_warning_count') +endfunction + +function! airline#extensions#ycm#get_error_count() + if exists(':YcmDiag') && exists("*youcompleteme#GetErrorCount") + let cnt = youcompleteme#GetErrorCount() + + if cnt != 0 + return s:error_symbol.cnt + endif + endif + + return '' +endfunction + +function! airline#extensions#ycm#get_warning_count() + if exists(':YcmDiag') && exists("*youcompleteme#GetWarningCount") + let cnt = youcompleteme#GetWarningCount() + + if cnt != 0 + return s:warning_symbol.cnt.s:spc + endif + endif + + return '' +endfunction diff --git a/.vim/autoload/airline/highlighter.vim b/.vim/autoload/airline/highlighter.vim new file mode 100644 index 0000000..5d4a7d7 --- /dev/null +++ b/.vim/autoload/airline/highlighter.vim @@ -0,0 +1,319 @@ +" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +let s:is_win32term = (has('win32') || has('win64')) && + \ !has('gui_running') && + \ (empty($CONEMUBUILD) || &term !=? 'xterm') && + \ !(exists("+termguicolors") && &termguicolors) + +let s:separators = {} +let s:accents = {} +let s:hl_groups = {} + +function! s:gui2cui(rgb, fallback) + if a:rgb == '' + return a:fallback + elseif match(a:rgb, '^\%(NONE\|[fb]g\)$') > -1 + return a:rgb + endif + let rgb = map(split(a:rgb[1:], '..\zs'), '0 + ("0x".v:val)') + return airline#msdos#round_msdos_colors(rgb) +endfunction + +function! s:group_not_done(list, name) + if index(a:list, a:name) == -1 + call add(a:list, a:name) + return 1 + else + if &vbs + echomsg printf("airline: group: %s already done, skipping", a:name) + endif + return 0 + endif +endfu + +function! s:get_syn(group, what) + if !exists("g:airline_gui_mode") + let g:airline_gui_mode = airline#init#gui_mode() + endif + let color = '' + if hlexists(a:group) + let color = synIDattr(synIDtrans(hlID(a:group)), a:what, g:airline_gui_mode) + endif + if empty(color) || color == -1 + " should always exists + let color = synIDattr(synIDtrans(hlID('Normal')), a:what, g:airline_gui_mode) + " however, just in case + if empty(color) || color == -1 + let color = 'NONE' + endif + endif + return color +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, '', '', opts ] + \ : [ '', '', a:fg, a:bg, opts ] +endfunction + +function! airline#highlighter#reset_hlcache() + let s:hl_groups = {} +endfunction + +function! airline#highlighter#get_highlight(group, ...) + let reverse = get(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') + if get(g:, 'airline_highlighting_cache', 0) && has_key(s:hl_groups, a:group) + let res = s:hl_groups[a:group] + return reverse ? [ res[1], res[0], res[3], res[2], res[4] ] : res + else + let fg = s:get_syn(a:group, 'fg') + let bg = s:get_syn(a:group, 'bg') + let bold = synIDattr(synIDtrans(hlID(a:group)), 'bold') + if reverse + let res = s:get_array(bg, fg, bold ? ['bold'] : a:000) + else + let res = s:get_array(fg, bg, bold ? ['bold'] : a:000) + endif + endif + let s:hl_groups[a:group] = res + return res +endfunction + +function! airline#highlighter#get_highlight2(fg, bg, ...) + let fg = s:get_syn(a:fg[0], a:fg[1]) + let bg = s:get_syn(a:bg[0], a:bg[1]) + return s:get_array(fg, bg, a:000) +endfunction + +function! s:hl_group_exists(group) + if !hlexists(a:group) + return 0 + elseif empty(synIDattr(hlID(a:group), 'fg')) + return 0 + endif + return 1 +endfunction + +function! airline#highlighter#exec(group, colors) + if pumvisible() + return + endif + let colors = a:colors + if s:is_win32term + let colors[2] = s:gui2cui(get(colors, 0, ''), get(colors, 2, '')) + let colors[3] = s:gui2cui(get(colors, 1, ''), get(colors, 3, '')) + endif + let old_hi = airline#highlighter#get_highlight(a:group) + if len(colors) == 4 + call add(colors, '') + endif + if g:airline_gui_mode ==# 'gui' + let new_hi = [colors[0], colors[1], '', '', colors[4]] + else + let new_hi = ['', '', printf("%s", colors[2]), printf("%s", colors[3]), colors[4]] + endif + let colors = s:CheckDefined(colors) + if old_hi != new_hi || !s:hl_group_exists(a:group) + let cmd = printf('hi %s%s', a:group, s:GetHiCmd(colors)) + exe cmd + if has_key(s:hl_groups, a:group) + let s:hl_groups[a:group] = colors + endif + endif +endfunction + +function! s:CheckDefined(colors) + " Checks, whether the definition of the colors is valid and is not empty or NONE + " e.g. if the colors would expand to this: + " hi airline_c ctermfg=NONE ctermbg=NONE + " that means to clear that highlighting group, therefore, fallback to Normal + " highlighting group for the cterm values + + " This only works, if the Normal highlighting group is actually defined, so + " return early, if it has been cleared + if !exists("g:airline#highlighter#normal_fg_hi") + let g:airline#highlighter#normal_fg_hi = synIDattr(synIDtrans(hlID('Normal')), 'fg', 'cterm') + endif + if empty(g:airline#highlighter#normal_fg_hi) || g:airline#highlighter#normal_fg_hi < 0 + return a:colors + endif + + for val in a:colors + if !empty(val) && val !=# 'NONE' + return a:colors + endif + endfor + " this adds the bold attribute to the term argument of the :hi command, + " but at least this makes sure, the group will be defined + let fg = g:airline#highlighter#normal_fg_hi + let bg = synIDattr(synIDtrans(hlID('Normal')), 'bg', 'cterm') + if bg < 0 + " in case there is no background color defined for Normal + let bg = a:colors[3] + endif + return a:colors[0:1] + [fg, bg] + [a:colors[4]] +endfunction + +function! s:GetHiCmd(list) + " a:list needs to have 5 items! + let res = '' + let i = -1 + while i < 4 + let i += 1 + let item = get(a:list, i, '') + if item is '' + continue + endif + if i == 0 + let res .= ' guifg='.item + elseif i == 1 + let res .= ' guibg='.item + elseif i == 2 + let res .= ' ctermfg='.item + elseif i == 3 + let res .= ' ctermbg='.item + elseif i == 4 + let res .= printf(' gui=%s cterm=%s term=%s', item, item, item) + endif + endwhile + return res +endfunction + +function! s:exec_separator(dict, from, to, inverse, suffix) + if pumvisible() + return + endif + let group = a:from.'_to_'.a:to.a:suffix + let l:from = airline#themes#get_highlight(a:from.a:suffix) + let l:to = airline#themes#get_highlight(a:to.a:suffix) + if a:inverse + let colors = [ l:from[1], l:to[1], l:from[3], l:to[3] ] + else + let colors = [ l:to[1], l:from[1], l:to[3], l:from[3] ] + endif + let a:dict[group] = colors + call airline#highlighter#exec(group, colors) +endfunction + +function! airline#highlighter#load_theme() + if pumvisible() + return + endif + for winnr in filter(range(1, winnr('$')), 'v:val != winnr()') + call airline#highlighter#highlight_modified_inactive(winbufnr(winnr)) + endfor + call airline#highlighter#highlight(['inactive']) + if getbufvar( bufnr('%'), '&modified' ) + call airline#highlighter#highlight(['normal', 'modified']) + else + call airline#highlighter#highlight(['normal']) + endif +endfunction + +function! airline#highlighter#add_separator(from, to, inverse) + let s:separators[a:from.a:to] = [a:from, a:to, a:inverse] + call <sid>exec_separator({}, a:from, a:to, a:inverse, '') +endfunction + +function! airline#highlighter#add_accent(accent) + let s:accents[a:accent] = 1 +endfunction + +function! airline#highlighter#highlight_modified_inactive(bufnr) + if getbufvar(a:bufnr, '&modified') + let colors = exists('g:airline#themes#{g:airline_theme}#palette.inactive_modified.airline_c') + \ ? g:airline#themes#{g:airline_theme}#palette.inactive_modified.airline_c : [] + else + let colors = exists('g:airline#themes#{g:airline_theme}#palette.inactive.airline_c') + \ ? g:airline#themes#{g:airline_theme}#palette.inactive.airline_c : [] + endif + + if !empty(colors) + call airline#highlighter#exec('airline_c'.(a:bufnr).'_inactive', colors) + endif +endfunction + +function! airline#highlighter#highlight(modes, ...) + let bufnr = a:0 ? a:1 : '' + let p = g:airline#themes#{g:airline_theme}#palette + + " draw the base mode, followed by any overrides + let mapped = map(a:modes, 'v:val == a:modes[0] ? v:val : a:modes[0]."_".v:val') + let suffix = a:modes[0] == 'inactive' ? '_inactive' : '' + let airline_grouplist = [] + let buffers_in_tabpage = sort(tabpagebuflist()) + if exists("*uniq") + let buffers_in_tabpage = uniq(buffers_in_tabpage) + endif + " mapped might be something like ['normal', 'normal_modified'] + " if a group is in both modes available, only define the second + " that is how this was done previously overwrite the previous definition + for mode in reverse(mapped) + if exists('g:airline#themes#{g:airline_theme}#palette[mode]') + let dict = g:airline#themes#{g:airline_theme}#palette[mode] + for kvp in items(dict) + let mode_colors = kvp[1] + let name = kvp[0] + if name is# 'airline_c' && !empty(bufnr) && suffix is# '_inactive' + let name = 'airline_c'.bufnr + endif + " do not re-create highlighting for buffers that are no longer visible + " in the current tabpage + if name =~# 'airline_c\d\+' + let bnr = matchstr(name, 'airline_c\zs\d\+') + 0 + if bnr > 0 && index(buffers_in_tabpage, bnr) == -1 + continue + endif + elseif (name =~# '_to_') || (name[0:10] is# 'airline_tab' && !empty(suffix)) + " group will be redefined below at exec_separator + " or is not needed for tabline with '_inactive' suffix + " since active flag is 1 for builder) + continue + endif + if s:group_not_done(airline_grouplist, name.suffix) + call airline#highlighter#exec(name.suffix, mode_colors) + endif + + for accent in keys(s:accents) + if !has_key(p.accents, accent) + continue + endif + let colors = copy(mode_colors) + if p.accents[accent][0] != '' + let colors[0] = p.accents[accent][0] + endif + if p.accents[accent][2] != '' + let colors[2] = p.accents[accent][2] + endif + if len(colors) >= 5 + let colors[4] = get(p.accents[accent], 4, '') + else + call add(colors, get(p.accents[accent], 4, '')) + endif + if s:group_not_done(airline_grouplist, name.suffix.'_'.accent) + call airline#highlighter#exec(name.suffix.'_'.accent, colors) + endif + endfor + endfor + + if empty(s:separators) + " nothing to be done + continue + endif + " TODO: optimize this + for sep in items(s:separators) + " we cannot check, that the group already exists, else the separators + " might not be correctly defined. But perhaps we can skip above groups + " that match the '_to_' name, because they would be redefined here... + call <sid>exec_separator(dict, sep[1][0], sep[1][1], sep[1][2], suffix) + endfor + endif + endfor +endfunction diff --git a/.vim/autoload/airline/init.vim b/.vim/autoload/airline/init.vim new file mode 100644 index 0000000..18a59da --- /dev/null +++ b/.vim/autoload/airline/init.vim @@ -0,0 +1,209 @@ +" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +function! s:check_defined(variable, default) + if !exists(a:variable) + let {a:variable} = a:default + endif +endfunction + +let s:loaded = 0 +function! airline#init#bootstrap() + if s:loaded + return + endif + let s:loaded = 1 + + let g:airline#init#bootstrapping = 1 + + let g:airline#init#vim_async = (v:version >= 800 && has('job')) + let g:airline#init#is_windows = has('win32') || has('win64') + + call s:check_defined('g:airline_detect_modified', 1) + call s:check_defined('g:airline_detect_paste', 1) + call s:check_defined('g:airline_detect_crypt', 1) + call s:check_defined('g:airline_detect_spell', 1) + call s:check_defined('g:airline_detect_spelllang', 1) + call s:check_defined('g:airline_detect_iminsert', 0) + call s:check_defined('g:airline_inactive_collapse', 1) + call s:check_defined('g:airline_exclude_filenames', ['DebuggerWatch','DebuggerStack','DebuggerStatus']) + call s:check_defined('g:airline_exclude_filetypes', []) + call s:check_defined('g:airline_exclude_preview', 0) + call s:check_defined('g:airline_gui_mode', airline#init#gui_mode()) + + call s:check_defined('g:airline_mode_map', {}) + call extend(g:airline_mode_map, { + \ '__' : '------', + \ 'c' : 'COMMAND', + \ 'i' : 'INSERT', + \ 'ic' : 'INSERT COMPL', + \ 'ix' : 'INSERT COMPL', + \ 'n' : 'NORMAL', + \ 'ni' : '(INSERT)', + \ 'no' : 'OP PENDING', + \ 'R' : 'REPLACE', + \ 'Rv' : 'V REPLACE', + \ 's' : 'SELECT', + \ 'S' : 'S-LINE', + \ '' : 'S-BLOCK', + \ 't' : 'TERMINAL', + \ 'v' : 'VISUAL', + \ 'V' : 'V-LINE', + \ '' : 'V-BLOCK', + \ }, 'keep') + + call s:check_defined('g:airline_theme_map', {}) + call extend(g:airline_theme_map, { + \ 'default': 'dark', + \ '\CTomorrow': 'tomorrow', + \ 'base16': 'base16', + \ 'mo[l|n]okai': 'molokai', + \ 'wombat': 'wombat', + \ 'zenburn': 'zenburn', + \ 'solarized': 'solarized', + \ 'flattened': 'solarized', + \ '\CNeoSolarized': 'solarized', + \ }, 'keep') + + call s:check_defined('g:airline_symbols', {}) + " First define the symbols, + " that are common in Powerline/Unicode/ASCII mode, + " then add specific symbols for either mode + call extend(g:airline_symbols, { + \ 'paste': 'PASTE', + \ 'spell': 'SPELL', + \ 'modified': '+', + \ 'space': ' ', + \ 'keymap': 'Keymap:', + \ 'ellipsis': '...' + \ }, 'keep') + + if get(g:, 'airline_powerline_fonts', 0) + " Symbols for Powerline terminals + call s:check_defined('g:airline_left_sep', "\ue0b0") " + call s:check_defined('g:airline_left_alt_sep', "\ue0b1") " + call s:check_defined('g:airline_right_sep', "\ue0b2") " + call s:check_defined('g:airline_right_alt_sep', "\ue0b3") " + " ro=, ws=☲, lnr=☰, mlnr=, br=, nx=Ɇ, crypt=🔒 + call extend(g:airline_symbols, { + \ 'readonly': "\ue0a2", + \ 'whitespace': "\u2632", + \ 'linenr': "\u2630 ", + \ 'maxlinenr': " \ue0a1", + \ 'branch': "\ue0a0", + \ 'notexists': "\u0246", + \ 'crypt': nr2char(0x1F512), + \ }, 'keep') + elseif &encoding==?'utf-8' && !get(g:, "airline_symbols_ascii", 0) + " Symbols for Unicode terminals + call s:check_defined('g:airline_left_sep', "") + call s:check_defined('g:airline_left_alt_sep', "") + call s:check_defined('g:airline_right_sep', "") + call s:check_defined('g:airline_right_alt_sep', "") + " ro=⊝, ws=☲, lnr=☰, mlnr=㏑, br=ᚠ, nx=Ɇ, crypt=🔒 + call extend(g:airline_symbols, { + \ 'readonly': "\u229D", + \ 'whitespace': "\u2632", + \ 'linenr': "\u2630 ", + \ 'maxlinenr': " \u33D1", + \ 'branch': "\u16A0", + \ 'notexists': "\u0246", + \ 'crypt': nr2char(0x1F512), + \ }, 'keep') + else + " Symbols for ASCII terminals + call s:check_defined('g:airline_left_sep', "") + call s:check_defined('g:airline_left_alt_sep', "") + call s:check_defined('g:airline_right_sep', "") + call s:check_defined('g:airline_right_alt_sep', "") + call extend(g:airline_symbols, { + \ 'readonly': 'RO', + \ 'whitespace': '!', + \ 'linenr': 'ln ', + \ 'maxlinenr': ' :', + \ 'branch': '', + \ 'notexists': '?', + \ 'crypt': 'cr', + \ }, 'keep') + endif + + call airline#parts#define('mode', { + \ 'function': 'airline#parts#mode', + \ 'accent': 'bold', + \ }) + call airline#parts#define_function('iminsert', 'airline#parts#iminsert') + call airline#parts#define_function('paste', 'airline#parts#paste') + call airline#parts#define_function('crypt', 'airline#parts#crypt') + call airline#parts#define_function('spell', 'airline#parts#spell') + call airline#parts#define_function('filetype', 'airline#parts#filetype') + call airline#parts#define('readonly', { + \ 'function': 'airline#parts#readonly', + \ 'accent': 'red', + \ }) + call airline#parts#define_raw('file', '%f%m') + call airline#parts#define_raw('path', '%F%m') + call airline#parts#define('linenr', { + \ 'raw': '%{g:airline_symbols.linenr}%4l', + \ 'accent': 'bold'}) + call airline#parts#define('maxlinenr', { + \ 'raw': '/%L%{g:airline_symbols.maxlinenr}', + \ 'accent': 'bold'}) + call airline#parts#define_function('ffenc', 'airline#parts#ffenc') + call airline#parts#define_empty(['hunks', 'branch', 'obsession', 'tagbar', + \ 'syntastic-warn', 'syntastic-err', 'eclim', 'whitespace','windowswap', + \ 'ycm_error_count', 'ycm_warning_count', 'neomake_error_count', + \ 'neomake_warning_count', 'ale_error_count', 'ale_warning_count', + \ 'languageclient_error_count', 'languageclient_warning_count']) + call airline#parts#define_text('capslock', '') + call airline#parts#define_text('gutentags', '') + call airline#parts#define_text('grepper', '') + call airline#parts#define_text('xkblayout', '') + call airline#parts#define_text('keymap', '') + + unlet g:airline#init#bootstrapping +endfunction + +function! airline#init#gui_mode() + return has('gui_running') || (has("termguicolors") && &termguicolors == 1) ? 'gui' : 'cterm' +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', 'keymap', 'spell', 'capslock', 'xkblayout', 'iminsert']) + endif + if !exists('g:airline_section_b') + let g:airline_section_b = airline#section#create(['hunks', 'branch']) + endif + if !exists('g:airline_section_c') + if exists("+autochdir") && &autochdir == 1 + let g:airline_section_c = airline#section#create(['%<', 'path', spc, 'readonly']) + else + let g:airline_section_c = airline#section#create(['%<', 'file', spc, 'readonly']) + endif + endif + if !exists('g:airline_section_gutter') + let g:airline_section_gutter = airline#section#create(['%=']) + endif + if !exists('g:airline_section_x') + let g:airline_section_x = airline#section#create_right(['tagbar', 'gutentags', 'grepper', 'filetype']) + endif + if !exists('g:airline_section_y') + let g:airline_section_y = airline#section#create_right(['ffenc']) + endif + if !exists('g:airline_section_z') + if winwidth(0) > 80 + let g:airline_section_z = airline#section#create(['windowswap', 'obsession', '%3p%%'.spc, 'linenr', 'maxlinenr', spc.':%3v']) + else + let g:airline_section_z = airline#section#create(['%3p%%'.spc, 'linenr', ':%3v']) + endif + endif + if !exists('g:airline_section_error') + let g:airline_section_error = airline#section#create(['ycm_error_count', 'syntastic-err', 'eclim', 'neomake_error_count', 'ale_error_count', 'languageclient_error_count']) + endif + if !exists('g:airline_section_warning') + let g:airline_section_warning = airline#section#create(['ycm_warning_count', 'syntastic-warn', 'neomake_warning_count', 'ale_warning_count', 'languageclient_warning_count', 'whitespace']) + endif +endfunction diff --git a/.vim/autoload/airline/msdos.vim b/.vim/autoload/airline/msdos.vim new file mode 100644 index 0000000..2d2d4e8 --- /dev/null +++ b/.vim/autoload/airline/msdos.vim @@ -0,0 +1,59 @@ +" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +" basic 16 msdos from MSDOS +" see output of color, should be +" 0 Black +" 1 DarkBlue +" 2 DarkGreen +" 3 DarkCyan +" 4 DarkRed +" 5 DarkMagenta +" 6 Brown +" 7 LightGray +" 8 DarkGray +" 9 Blue +" 10 Green +" 11 Cyan +" 12 Red +" 13 Magenta +" 14 Yellow +" 15 White + +let s:basic16 = [ + \ [ 0x00, 0x00, 0x00 ], + \ [ 0x00, 0x00, 0x80 ], + \ [ 0x00, 0x80, 0x00 ], + \ [ 0x00, 0x80, 0x80 ], + \ [ 0x80, 0x00, 0x00 ], + \ [ 0x80, 0x00, 0x80 ], + \ [ 0x80, 0x80, 0x00 ], + \ [ 0xC0, 0xC0, 0xC0 ], + \ [ 0x80, 0x80, 0x80 ], + \ [ 0x00, 0x00, 0xFF ], + \ [ 0x00, 0xFF, 0x00 ], + \ [ 0x00, 0xFF, 0xFF ], + \ [ 0xFF, 0x00, 0x00 ], + \ [ 0xFF, 0x00, 0xFF ], + \ [ 0xFF, 0xFF, 0x00 ], + \ [ 0xFF, 0xFF, 0xFF ] + \ ] + +function! airline#msdos#round_msdos_colors(rgblist) + " Check for values from MSDOS 16 color terminal + let best = [] + let min = 100000 + let list = s:basic16 + for value in list + let t = abs(value[0] - a:rgblist[0]) + + \ abs(value[1] - a:rgblist[1]) + + \ abs(value[2] - a:rgblist[2]) + if min > t + let min = t + let best = value + endif + endfor + return index(s:basic16, best) +endfunction diff --git a/.vim/autoload/airline/parts.vim b/.vim/autoload/airline/parts.vim new file mode 100644 index 0000000..b6625c6 --- /dev/null +++ b/.vim/autoload/airline/parts.vim @@ -0,0 +1,114 @@ +" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +let s:parts = {} + +" PUBLIC API {{{ + +function! airline#parts#define(key, config) + let s:parts[a:key] = get(s:parts, a:key, {}) + if exists('g:airline#init#bootstrapping') + call extend(s:parts[a:key], a:config, 'keep') + else + call extend(s:parts[a:key], a:config, 'force') + endif +endfunction + +function! airline#parts#define_function(key, name) + call airline#parts#define(a:key, { 'function': a:name }) +endfunction + +function! airline#parts#define_text(key, text) + call airline#parts#define(a:key, { 'text': a:text }) +endfunction + +function! airline#parts#define_raw(key, raw) + call airline#parts#define(a:key, { 'raw': a:raw }) +endfunction + +function! airline#parts#define_minwidth(key, width) + call airline#parts#define(a:key, { 'minwidth': a:width }) +endfunction + +function! airline#parts#define_condition(key, predicate) + call airline#parts#define(a:key, { 'condition': a:predicate }) +endfunction + +function! airline#parts#define_accent(key, accent) + call airline#parts#define(a:key, { 'accent': a:accent }) +endfunction + +function! airline#parts#define_empty(keys) + for key in a:keys + call airline#parts#define_raw(key, '') + endfor +endfunction + +function! airline#parts#get(key) + return get(s:parts, a:key, {}) +endfunction + +" }}} + +function! airline#parts#mode() + return airline#util#shorten(get(w:, 'airline_current_mode', ''), 79, 1) +endfunction + +function! airline#parts#crypt() + return g:airline_detect_crypt && exists("+key") && !empty(&key) ? g:airline_symbols.crypt : '' +endfunction + +function! airline#parts#paste() + return g:airline_detect_paste && &paste ? g:airline_symbols.paste : '' +endfunction + +function! airline#parts#spell() + let spelllang = g:airline_detect_spelllang ? printf(" [%s]", toupper(substitute(&spelllang, ',', '/', 'g'))) : '' + if g:airline_detect_spell && &spell + if winwidth(0) >= 90 + return g:airline_symbols.spell . spelllang + elseif winwidth(0) >= 70 + return g:airline_symbols.spell + else + return split(g:airline_symbols.spell, '\zs')[0] + endif + endif + return '' +endfunction + +function! airline#parts#iminsert() + if g:airline_detect_iminsert && &iminsert && exists('b:keymap_name') + return toupper(b:keymap_name) + endif + return '' +endfunction + +function! airline#parts#readonly() + " only consider regular buffers (e.g. ones that represent actual files, + " but not special ones like e.g. NERDTree) + if !empty(&buftype) || airline#util#ignore_buf(bufname('%')) + return '' + endif + if &readonly && !filereadable(bufname('%')) + return '[noperm]' + else + return &readonly ? g:airline_symbols.readonly : '' + endif +endfunction + +function! airline#parts#filetype() + return winwidth(0) < 90 && strlen(&filetype) > 3 ? matchstr(&filetype, '...'). (&encoding is? 'utf-8' ? '…' : '>') : &filetype +endfunction + +function! airline#parts#ffenc() + let expected = get(g:, 'airline#parts#ffenc#skip_expected_string', '') + let bomb = &l:bomb ? '[BOM]' : '' + let ff = strlen(&ff) ? '['.&ff.']' : '' + if expected is# &fenc.bomb.ff + return '' + else + return &fenc.bomb.ff + endif +endfunction diff --git a/.vim/autoload/airline/section.vim b/.vim/autoload/airline/section.vim new file mode 100644 index 0000000..7d84faf --- /dev/null +++ b/.vim/autoload/airline/section.vim @@ -0,0 +1,84 @@ +" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +call airline#init#bootstrap() +let s:spc = g:airline_symbols.space + +function! s:wrap_accent(part, value) + if exists('a:part.accent') + call airline#highlighter#add_accent(a:part.accent) + return '%#__accent_'.(a:part.accent).'#'.a:value.'%#__restore__#' + endif + return a:value +endfunction + +function! s:create(parts, append) + let _ = '' + for idx in range(len(a:parts)) + let part = airline#parts#get(a:parts[idx]) + let val = '' + let add_sep = get(l:, 'add_sep', 0) + + if exists('part.function') + let func = (part.function).'()' + elseif exists('part.text') + let func = '"'.(part.text).'"' + else + if a:append > 0 && idx != 0 + let val .= s:spc.g:airline_left_alt_sep.s:spc + endif + if a:append < 0 && idx != 0 + let t = '' + if !add_sep + let t = s:spc.g:airline_right_alt_sep.s:spc + endif + let val = t.val + endif + if exists('part.raw') + let _ .= s:wrap_accent(part, val.(part.raw)) + continue + else + let _ .= s:wrap_accent(part, val.a:parts[idx]) + continue + endif + endif + + let minwidth = get(part, 'minwidth', 0) + + if a:append > 0 && idx != 0 + let partval = printf('%%{airline#util#append(%s,%s)}', func, minwidth) + " will add an extra separator, if minwidth is zero + let add_sep = (minwidth == 0) + elseif a:append < 0 && idx != len(a:parts) - 1 + let partval = printf('%%{airline#util#prepend(%s,%s)}', func, minwidth) + " will add an extra separator, if minwidth is zero + let add_sep = (minwidth == 0) + else + let partval = printf('%%{airline#util#wrap(%s,%s)}', func, minwidth) + let add_sep = 0 + endif + + if exists('part.condition') + let partval = substitute(partval, '{', '\="{".(part.condition)." ? "', '') + let partval = substitute(partval, '}', ' : ""}', '') + endif + + let val .= s:wrap_accent(part, partval) + let _ .= val + endfor + return _ +endfunction + +function! airline#section#create(parts) + return s:create(a:parts, 0) +endfunction + +function! airline#section#create_left(parts) + return s:create(a:parts, 1) +endfunction + +function! airline#section#create_right(parts) + return s:create(a:parts, -1) +endfunction diff --git a/.vim/autoload/airline/themes.vim b/.vim/autoload/airline/themes.vim new file mode 100644 index 0000000..b757fe5 --- /dev/null +++ b/.vim/autoload/airline/themes.vim @@ -0,0 +1,78 @@ +" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. +" vim: et ts=2 sts=2 sw=2 + +scriptencoding utf-8 + +" generates a dictionary which defines the colors for each highlight group +function! airline#themes#generate_color_map(sect1, sect2, sect3, ...) + let palette = { + \ 'airline_a': [ a:sect1[0] , a:sect1[1] , a:sect1[2] , a:sect1[3] , get(a:sect1 , 4 , '') ] , + \ 'airline_b': [ a:sect2[0] , a:sect2[1] , a:sect2[2] , a:sect2[3] , get(a:sect2 , 4 , '') ] , + \ 'airline_c': [ a:sect3[0] , a:sect3[1] , a:sect3[2] , a:sect3[3] , get(a:sect3 , 4 , '') ] , + \ } + + if a:0 > 0 + call extend(palette, { + \ 'airline_x': [ a:1[0] , a:1[1] , a:1[2] , a:1[3] , get(a:1 , 4 , '' ) ] , + \ 'airline_y': [ a:2[0] , a:2[1] , a:2[2] , a:2[3] , get(a:2 , 4 , '' ) ] , + \ 'airline_z': [ a:3[0] , a:3[1] , a:3[2] , a:3[3] , get(a:3 , 4 , '' ) ] , + \ }) + else + call extend(palette, { + \ 'airline_x': [ a:sect3[0] , a:sect3[1] , a:sect3[2] , a:sect3[3] , '' ] , + \ 'airline_y': [ a:sect2[0] , a:sect2[1] , a:sect2[2] , a:sect2[3] , '' ] , + \ 'airline_z': [ a:sect1[0] , a:sect1[1] , a:sect1[2] , a:sect1[3] , '' ] , + \ }) + endif + + return palette +endfunction + +function! airline#themes#get_highlight(group, ...) + return call('airline#highlighter#get_highlight', [a:group] + a:000) +endfunction + +function! airline#themes#get_highlight2(fg, bg, ...) + return call('airline#highlighter#get_highlight2', [a:fg, a:bg] + a:000) +endfunction + +function! airline#themes#patch(palette) + for mode in keys(a:palette) + if mode == 'accents' + continue + endif + if !has_key(a:palette[mode], 'airline_warning') + let a:palette[mode]['airline_warning'] = [ '#000000', '#df5f00', 232, 166 ] + endif + if !has_key(a:palette[mode], 'airline_error') + let a:palette[mode]['airline_error'] = [ '#000000', '#990000', 232, 160 ] + endif + if !has_key(a:palette[mode], 'airline_term') + let a:palette[mode]['airline_term'] = [ '#9cffd3', '#202020', 85, 232] + endif + endfor + + let a:palette.accents = get(a:palette, 'accents', {}) + let a:palette.accents.none = [ '', '', '', '', '' ] + let a:palette.accents.bold = [ '', '', '', '', 'bold' ] + let a:palette.accents.italic = [ '', '', '', '', 'italic' ] + + if !has_key(a:palette.accents, 'red') + let a:palette.accents.red = [ '#ff0000' , '' , 160 , '' ] + endif + if !has_key(a:palette.accents, 'green') + let a:palette.accents.green = [ '#008700' , '' , 22 , '' ] + endif + if !has_key(a:palette.accents, 'blue') + let a:palette.accents.blue = [ '#005fff' , '' , 27 , '' ] + endif + if !has_key(a:palette.accents, 'yellow') + let a:palette.accents.yellow = [ '#dfff00' , '' , 190 , '' ] + endif + if !has_key(a:palette.accents, 'orange') + let a:palette.accents.orange = [ '#df5f00' , '' , 166 , '' ] + endif + if !has_key(a:palette.accents, 'purple') + let a:palette.accents.purple = [ '#af00df' , '' , 128 , '' ] + endif +endfunction diff --git a/.vim/autoload/airline/themes/base16.vim b/.vim/autoload/airline/themes/base16.vim new file mode 100644 index 0000000..0a7b442 --- /dev/null +++ b/.vim/autoload/airline/themes/base16.vim @@ -0,0 +1,181 @@ +let s:improved_contrast = get(g:, 'airline_base16_improved_contrast', 0) + +" Color palette +let s:gui_dark_gray = '#202020' +let s:cterm_dark_gray = 234 +let s:gui_med_gray_hi = '#303030' +let s:cterm_med_gray_hi = 236 +let s:gui_med_gray_lo = '#3a3a3a' +let s:cterm_med_gray_lo = 237 +let s:gui_light_gray = '#505050' +let s:cterm_light_gray = 239 +let s:gui_lightlight_gray = '#8A8A8A' +let s:cterm_lightlight_gray = 245 +let s:gui_green = '#99cc99' +let s:cterm_green = 151 +let s:gui_blue = '#6a9fb5' +let s:cterm_blue = 67 +let s:gui_purple = '#aa759f' +let s:cterm_purple = 139 +let s:gui_orange = '#d28445' +let s:cterm_orange = 173 +let s:gui_red = '#ac4142' +let s:cterm_red = 131 +let s:gui_pink = '#d7afd7' +let s:cterm_pink = 182 + +if get(g:, 'airline#themes#base16#constant', 0) + let g:airline#themes#base16#palette = {} + + " Normal mode + let s:N1 = [s:gui_dark_gray, s:gui_green, s:cterm_dark_gray, s:cterm_green] + if s:improved_contrast + let s:N2 = [s:gui_lightlight_gray, s:gui_med_gray_lo, s:cterm_lightlight_gray, s:cterm_med_gray_lo] + else + + let s:N2 = [s:gui_light_gray, s:gui_med_gray_lo, s:cterm_light_gray, s:cterm_med_gray_lo] + endif + let s:N3 = [s:gui_green, s:gui_med_gray_hi, s:cterm_green, s:cterm_med_gray_hi] + let g:airline#themes#base16#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3) + let g:airline#themes#base16#palette.normal_modified = { + \ 'airline_c': [s:gui_orange, s:gui_med_gray_hi, s:cterm_orange, s:cterm_med_gray_hi, ''], + \ } + + " Insert mode + let s:I1 = [s:gui_med_gray_hi, s:gui_blue, s:cterm_med_gray_hi, s:cterm_blue] + let s:I3 = [s:gui_blue, s:gui_med_gray_hi, s:cterm_blue, s:cterm_med_gray_hi] + let g:airline#themes#base16#palette.insert = airline#themes#generate_color_map(s:I1, s:N2, s:I3) + let g:airline#themes#base16#palette.insert_modified = copy(g:airline#themes#base16#palette.normal_modified) + let g:airline#themes#base16#palette.insert_paste = { + \ 'airline_a': [s:gui_dark_gray, s:gui_orange, s:cterm_dark_gray, s:cterm_orange, ''], + \ } + + " Replace mode + let g:airline#themes#base16#palette.replace = { + \ 'airline_a': [s:gui_dark_gray, s:gui_red, s:cterm_dark_gray, s:cterm_red, ''], + \ 'airline_c': [s:gui_red, s:gui_med_gray_hi, s:cterm_red, s:cterm_med_gray_hi, ''], + \ } + let g:airline#themes#base16#palette.replace_modified = copy(g:airline#themes#base16#palette.insert_modified) + + " Visual mode + let s:V1 = [s:gui_dark_gray, s:gui_pink, s:cterm_dark_gray, s:cterm_pink] + let s:V3 = [s:gui_pink, s:gui_med_gray_hi, s:cterm_pink, s:cterm_med_gray_hi] + let g:airline#themes#base16#palette.visual = airline#themes#generate_color_map(s:V1, s:N2, s:V3) + let g:airline#themes#base16#palette.visual_modified = copy(g:airline#themes#base16#palette.insert_modified) + + " Inactive window + if s:improved_contrast + let s:IA = [s:gui_dark_gray, s:gui_med_gray_hi, s:cterm_lightlight_gray, s:cterm_med_gray_hi, ''] + else + let s:IA = [s:gui_dark_gray, s:gui_med_gray_hi, s:cterm_light_gray, s:cterm_med_gray_hi, ''] + endif + let g:airline#themes#base16#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA) + let g:airline#themes#base16#palette.inactive_modified = { + \ 'airline_c': [s:gui_orange, '', s:cterm_orange, '', ''], + \ } +else + function! airline#themes#base16#refresh() + let g:airline#themes#base16#palette = {} + + let g:airline#themes#base16#palette.accents = { + \ 'red': airline#themes#get_highlight('Constant'), + \ } + + let s:N1 = airline#themes#get_highlight2(['DiffText', 'bg'], ['DiffText', 'fg'], 'bold') + let s:N2 = airline#themes#get_highlight2(['Visual', 'fg'], ['Visual', 'bg']) + let s:N3 = airline#themes#get_highlight('CursorLine') + let g:airline#themes#base16#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3) + + let group = airline#themes#get_highlight('Statement') + let g:airline#themes#base16#palette.normal_modified = { + \ 'airline_c': [ group[0], '', group[2], '', '' ] + \ } + + let s:I1 = airline#themes#get_highlight2(['DiffText', 'bg'], ['DiffAdded', 'fg'], 'bold') + let s:I2 = airline#themes#get_highlight2(['DiffAdded', 'fg'], ['Normal', 'bg']) + let s:I3 = s:N3 + let g:airline#themes#base16#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3) + let g:airline#themes#base16#palette.insert_modified = g:airline#themes#base16#palette.normal_modified + + let s:R1 = airline#themes#get_highlight2(['DiffText', 'bg'], ['WarningMsg', 'fg'], 'bold') + let s:R2 = s:N2 + let s:R3 = s:N3 + let g:airline#themes#base16#palette.replace = airline#themes#generate_color_map(s:R1, s:R2, s:R3) + let g:airline#themes#base16#palette.replace_modified = g:airline#themes#base16#palette.normal_modified + + let s:V1 = airline#themes#get_highlight2(['DiffText', 'bg'], ['Constant', 'fg'], 'bold') + let s:V2 = airline#themes#get_highlight2(['Constant', 'fg'], ['Normal', 'bg']) + let s:V3 = s:N3 + let g:airline#themes#base16#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3) + let g:airline#themes#base16#palette.visual_modified = g:airline#themes#base16#palette.normal_modified + + " Use VertSplit's bg and default fg (reversed) for inactive statusline. + let s:VS = airline#themes#get_highlight('VertSplit') + if s:improved_contrast + let s:IA = [ s:VS[1], 'NONE', s:VS[2], s:cterm_lightlight_gray, 'reverse'] + else + let s:IA = [ s:VS[1], 'NONE', s:VS[2], 'NONE', 'reverse'] + endif + let g:airline#themes#base16#palette.inactive = + \ airline#themes#generate_color_map(s:IA, s:IA, s:IA, s:IA, s:IA, s:IA) + let s:IM = [ s:VS[1], 'NONE', s:VS[2], 'NONE', 'reverse'] + let g:airline#themes#base16#palette.inactive_modified = + \ airline#themes#generate_color_map(s:IM, s:IM, s:IM, s:IM, s:IM, s:IM) + + " Warnings + let s:WI = airline#themes#get_highlight2(['WarningMsg', 'bg'], ['WarningMsg', 'fg'], 'bold') + let g:airline#themes#base16#palette.normal.airline_warning = [ + \ s:WI[0], s:WI[1], s:WI[2], s:WI[3] + \ ] + + let g:airline#themes#base16#palette.normal_modified.airline_warning = + \ g:airline#themes#base16#palette.normal.airline_warning + + let g:airline#themes#base16#palette.insert.airline_warning = + \ g:airline#themes#base16#palette.normal.airline_warning + + let g:airline#themes#base16#palette.insert_modified.airline_warning = + \ g:airline#themes#base16#palette.normal.airline_warning + + let g:airline#themes#base16#palette.visual.airline_warning = + \ g:airline#themes#base16#palette.normal.airline_warning + + let g:airline#themes#base16#palette.visual_modified.airline_warning = + \ g:airline#themes#base16#palette.normal.airline_warning + + let g:airline#themes#base16#palette.replace.airline_warning = + \ g:airline#themes#base16#palette.normal.airline_warning + + let g:airline#themes#base16#palette.replace_modified.airline_warning = + \ g:airline#themes#base16#palette.normal.airline_warning + + " Errors + let s:ER = airline#themes#get_highlight2(['ErrorMsg', 'bg'], ['ErrorMsg', 'fg'], 'bold') + let g:airline#themes#base16#palette.normal.airline_error = [ + \ s:ER[0], s:ER[1], s:ER[2], s:ER[3] + \ ] + + let g:airline#themes#base16#palette.normal_modified.airline_error = + \ g:airline#themes#base16#palette.normal.airline_error + + let g:airline#themes#base16#palette.insert.airline_error = + \ g:airline#themes#base16#palette.normal.airline_error + + let g:airline#themes#base16#palette.insert_modified.airline_error = + \ g:airline#themes#base16#palette.normal.airline_error + + let g:airline#themes#base16#palette.visual.airline_error = + \ g:airline#themes#base16#palette.normal.airline_error + + let g:airline#themes#base16#palette.visual_modified.airline_error = + \ g:airline#themes#base16#palette.normal.airline_error + + let g:airline#themes#base16#palette.replace.airline_error = + \ g:airline#themes#base16#palette.normal.airline_error + + let g:airline#themes#base16#palette.replace_modified.airline_error = + \ g:airline#themes#base16#palette.normal.airline_error + + endfunction + call airline#themes#base16#refresh() +endif diff --git a/.vim/autoload/airline/themes/bubblegum.vim b/.vim/autoload/airline/themes/bubblegum.vim new file mode 100644 index 0000000..f2378ce --- /dev/null +++ b/.vim/autoload/airline/themes/bubblegum.vim @@ -0,0 +1,70 @@ +" Color palette +let s:gui_dark_gray = '#303030' +let s:cterm_dark_gray = 236 +let s:gui_med_gray_hi = '#444444' +let s:cterm_med_gray_hi = 238 +let s:gui_med_gray_lo = '#3a3a3a' +let s:cterm_med_gray_lo = 237 +let s:gui_light_gray = '#b2b2b2' +let s:cterm_light_gray = 249 +let s:gui_green = '#afd787' +let s:cterm_green = 150 +let s:gui_blue = '#87afd7' +let s:cterm_blue = 110 +let s:gui_purple = '#afafd7' +let s:cterm_purple = 146 +let s:gui_orange = '#d7af5f' +let s:cterm_orange = 179 +let s:gui_red = '#d78787' +let s:cterm_red = 174 +let s:gui_pink = '#d7afd7' +let s:cterm_pink = 182 + +let g:airline#themes#bubblegum#palette = {} + +" Normal mode +let s:N1 = [s:gui_dark_gray, s:gui_green, s:cterm_dark_gray, s:cterm_green] +let s:N2 = [s:gui_light_gray, s:gui_med_gray_lo, s:cterm_light_gray, s:cterm_med_gray_lo] +let s:N3 = [s:gui_green, s:gui_med_gray_hi, s:cterm_green, s:cterm_med_gray_hi] +let g:airline#themes#bubblegum#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3) +let g:airline#themes#bubblegum#palette.normal_modified = { + \ 'airline_c': [s:gui_orange, s:gui_med_gray_hi, s:cterm_orange, s:cterm_med_gray_hi, ''], + \ } + +" Insert mode +let s:I1 = [s:gui_med_gray_hi, s:gui_blue, s:cterm_med_gray_hi, s:cterm_blue] +let s:I3 = [s:gui_blue, s:gui_med_gray_hi, s:cterm_blue, s:cterm_med_gray_hi] +let g:airline#themes#bubblegum#palette.insert = airline#themes#generate_color_map(s:I1, s:N2, s:I3) +let g:airline#themes#bubblegum#palette.insert_modified = copy(g:airline#themes#bubblegum#palette.normal_modified) +let g:airline#themes#bubblegum#palette.insert_paste = { + \ 'airline_a': [s:gui_dark_gray, s:gui_orange, s:cterm_dark_gray, s:cterm_orange, ''], + \ } + +" Replace mode +let g:airline#themes#bubblegum#palette.replace = { + \ 'airline_a': [s:gui_dark_gray, s:gui_red, s:cterm_dark_gray, s:cterm_red, ''], + \ 'airline_c': [s:gui_red, s:gui_med_gray_hi, s:cterm_red, s:cterm_med_gray_hi, ''], + \ } +let g:airline#themes#bubblegum#palette.replace_modified = copy(g:airline#themes#bubblegum#palette.insert_modified) + +" Visual mode +let s:V1 = [s:gui_dark_gray, s:gui_pink, s:cterm_dark_gray, s:cterm_pink] +let s:V3 = [s:gui_pink, s:gui_med_gray_hi, s:cterm_pink, s:cterm_med_gray_hi] +let g:airline#themes#bubblegum#palette.visual = airline#themes#generate_color_map(s:V1, s:N2, s:V3) +let g:airline#themes#bubblegum#palette.visual_modified = copy(g:airline#themes#bubblegum#palette.insert_modified) + +" Inactive window +let s:IA = [s:gui_light_gray, s:gui_med_gray_hi, s:cterm_light_gray, s:cterm_med_gray_hi, ''] +let g:airline#themes#bubblegum#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA) +let g:airline#themes#bubblegum#palette.inactive_modified = { + \ 'airline_c': [s:gui_orange, '', s:cterm_orange, '', ''], + \ } + +" CtrlP +if !get(g:, 'loaded_ctrlp', 0) + finish +endif +let g:airline#themes#bubblegum#palette.ctrlp = airline#extensions#ctrlp#generate_color_map( + \ [ s:gui_orange, s:gui_med_gray_hi, s:cterm_orange, s:cterm_med_gray_hi, '' ] , + \ [ s:gui_orange, s:gui_med_gray_lo, s:cterm_orange, s:cterm_med_gray_lo, '' ] , + \ [ s:gui_dark_gray, s:gui_green, s:cterm_dark_gray, s:cterm_green, 'bold' ] ) diff --git a/.vim/autoload/airline/themes/dark.vim b/.vim/autoload/airline/themes/dark.vim new file mode 100644 index 0000000..94f3763 --- /dev/null +++ b/.vim/autoload/airline/themes/dark.vim @@ -0,0 +1,161 @@ +" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. +" vim: et ts=2 sts=2 sw=2 tw=80 + +scriptencoding utf-8 + +" Airline themes are generated based on the following concepts: +" * The section of the status line, valid Airline statusline sections are: +" * airline_a (left most section) +" * airline_b (section just to the right of airline_a) +" * airline_c (section just to the right of airline_b) +" * airline_x (first section of the right most sections) +" * airline_y (section just to the right of airline_x) +" * airline_z (right most section) +" * The mode of the buffer, as reported by the :mode() function. Airline +" converts the values reported by mode() to the following: +" * normal +" * insert +" * replace +" * visual +" * inactive +" The last one is actually no real mode as returned by mode(), but used by +" airline to style inactive statuslines (e.g. windows, where the cursor +" currently does not reside in). +" * In addition to each section and mode specified above, airline themes +" can also specify overrides. Overrides can be provided for the following +" scenarios: +" * 'modified' +" * 'paste' +" +" Airline themes are specified as a global viml dictionary using the above +" sections, modes and overrides as keys to the dictionary. The name of the +" dictionary is significant and should be specified as: +" * g:airline#themes#<theme_name>#palette +" where <theme_name> is substituted for the name of the theme.vim file where the +" theme definition resides. Airline themes should reside somewhere on the +" 'runtimepath' where it will be loaded at vim startup, for example: +" * autoload/airline/themes/theme_name.vim +" +" For this, the dark.vim, theme, this is defined as +let g:airline#themes#dark#palette = {} + +" Keys in the dictionary are composed of the mode, and if specified the +" override. For example: +" * g:airline#themes#dark#palette.normal +" * the colors for a statusline while in normal mode +" * g:airline#themes#dark#palette.normal_modified +" * the colors for a statusline while in normal mode when the buffer has +" been modified +" * g:airline#themes#dark#palette.visual +" * the colors for a statusline while in visual mode +" +" Values for each dictionary key is an array of color values that should be +" familiar for colorscheme designers: +" * [guifg, guibg, ctermfg, ctermbg, opts] +" See "help attr-list" for valid values for the "opt" value. +" +" Each theme must provide an array of such values for each airline section of +" the statusline (airline_a through airline_z). A convenience function, +" airline#themes#generate_color_map() exists to mirror airline_a/b/c to +" airline_x/y/z, respectively. + +" The dark.vim theme: +let s:airline_a_normal = [ '#00005f' , '#dfff00' , 17 , 190 ] +let s:airline_b_normal = [ '#ffffff' , '#444444' , 255 , 238 ] +let s:airline_c_normal = [ '#9cffd3' , '#202020' , 85 , 234 ] +let g:airline#themes#dark#palette.normal = airline#themes#generate_color_map(s:airline_a_normal, s:airline_b_normal, s:airline_c_normal) + +" It should be noted the above is equivalent to: +" let g:airline#themes#dark#palette.normal = airline#themes#generate_color_map( +" \ [ '#00005f' , '#dfff00' , 17 , 190 ], " section airline_a +" \ [ '#ffffff' , '#444444' , 255 , 238 ], " section airline_b +" \ [ '#9cffd3' , '#202020' , 85 , 234 ] " section airline_c +" \) +" +" In turn, that is equivalent to: +" let g:airline#themes#dark#palette.normal = { +" \ 'airline_a': [ '#00005f' , '#dfff00' , 17 , 190 ], "section airline_a +" \ 'airline_b': [ '#ffffff' , '#444444' , 255 , 238 ], "section airline_b +" \ 'airline_c': [ '#9cffd3' , '#202020' , 85 , 234 ], "section airline_c +" \ 'airline_x': [ '#9cffd3' , '#202020' , 85 , 234 ], "section airline_x +" \ 'airline_y': [ '#ffffff' , '#444444' , 255 , 238 ], "section airline_y +" \ 'airline_z': [ '#00005f' , '#dfff00' , 17 , 190 ] "section airline_z +" \} +" +" airline#themes#generate_color_map() also uses the values provided as +" parameters to create intermediary groups such as: +" airline_a_to_airline_b +" airline_b_to_airline_c +" etc... + +" Here we define overrides for when the buffer is modified. This will be +" applied after g:airline#themes#dark#palette.normal, hence why only certain keys are +" declared. +let g:airline#themes#dark#palette.normal_modified = { + \ 'airline_c': [ '#ffffff' , '#5f005f' , 255 , 53 , '' ] , + \ } + + +let s:airline_a_insert = [ '#00005f' , '#00dfff' , 17 , 45 ] +let s:airline_b_insert = [ '#ffffff' , '#005fff' , 255 , 27 ] +let s:airline_c_insert = [ '#ffffff' , '#000080' , 15 , 17 ] +let g:airline#themes#dark#palette.insert = airline#themes#generate_color_map(s:airline_a_insert, s:airline_b_insert, s:airline_c_insert) +let g:airline#themes#dark#palette.insert_modified = { + \ 'airline_c': [ '#ffffff' , '#5f005f' , 255 , 53 , '' ] , + \ } +let g:airline#themes#dark#palette.insert_paste = { + \ 'airline_a': [ s:airline_a_insert[0] , '#d78700' , s:airline_a_insert[2] , 172 , '' ] , + \ } + + +let g:airline#themes#dark#palette.replace = copy(g:airline#themes#dark#palette.insert) +let g:airline#themes#dark#palette.replace.airline_a = [ s:airline_b_insert[0] , '#af0000' , s:airline_b_insert[2] , 124 , '' ] +let g:airline#themes#dark#palette.replace_modified = g:airline#themes#dark#palette.insert_modified + + +let s:airline_a_visual = [ '#000000' , '#ffaf00' , 232 , 214 ] +let s:airline_b_visual = [ '#000000' , '#ff5f00' , 232 , 202 ] +let s:airline_c_visual = [ '#ffffff' , '#5f0000' , 15 , 52 ] +let g:airline#themes#dark#palette.visual = airline#themes#generate_color_map(s:airline_a_visual, s:airline_b_visual, s:airline_c_visual) +let g:airline#themes#dark#palette.visual_modified = { + \ 'airline_c': [ '#ffffff' , '#5f005f' , 255 , 53 , '' ] , + \ } + + +let s:airline_a_inactive = [ '#4e4e4e' , '#1c1c1c' , 239 , 234 , '' ] +let s:airline_b_inactive = [ '#4e4e4e' , '#262626' , 239 , 235 , '' ] +let s:airline_c_inactive = [ '#4e4e4e' , '#303030' , 239 , 236 , '' ] +let g:airline#themes#dark#palette.inactive = airline#themes#generate_color_map(s:airline_a_inactive, s:airline_b_inactive, s:airline_c_inactive) +let g:airline#themes#dark#palette.inactive_modified = { + \ 'airline_c': [ '#875faf' , '' , 97 , '' , '' ] , + \ } + +" For commandline mode, we use the colors from normal mode, except the mode +" indicator should be colored differently, e.g. blue on light green +let s:airline_a_commandline = [ '#0000ff' , '#0cff00' , 63 , 40 ] +let s:airline_b_commandline = [ '#ffffff' , '#444444' , 255 , 238 ] +let s:airline_c_commandline = [ '#9cffd3' , '#202020' , 85 , 234 ] +let g:airline#themes#dark#palette.commandline = airline#themes#generate_color_map(s:airline_a_commandline, s:airline_b_commandline, s:airline_c_commandline) + +" 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#palette.accents = { + \ 'red': [ '#ff0000' , '' , 160 , '' ] + \ } + + +" Here we define the color map for ctrlp. We check for the g:loaded_ctrlp +" variable so that related functionality is loaded iff the user is using +" ctrlp. Note that this is optional, and if you do not define ctrlp colors +" they will be chosen automatically from the existing palette. +if get(g:, 'loaded_ctrlp', 0) + let g:airline#themes#dark#palette.ctrlp = airline#extensions#ctrlp#generate_color_map( + \ [ '#d7d7ff' , '#5f00af' , 189 , 55 , '' ], + \ [ '#ffffff' , '#875fd7' , 231 , 98 , '' ], + \ [ '#5f00af' , '#ffffff' , 55 , 231 , 'bold' ]) +endif diff --git a/.vim/autoload/airline/themes/gruvbox.vim b/.vim/autoload/airline/themes/gruvbox.vim new file mode 100644 index 0000000..6862a81 --- /dev/null +++ b/.vim/autoload/airline/themes/gruvbox.vim @@ -0,0 +1,79 @@ +" ----------------------------------------------------------------------------- +" File: gruvbox.vim +" Description: Retro groove color scheme for Airline +" Author: morhetz <morhetz@gmail.com> +" Source: https://github.com/morhetz/gruvbox +" Last Modified: 12 Aug 2017 +" ----------------------------------------------------------------------------- + +let g:airline#themes#gruvbox#palette = {} + +function! airline#themes#gruvbox#refresh() + + let M0 = airline#themes#get_highlight('Identifier') + let accents_group = airline#themes#get_highlight('Special') + let modified_group = [M0[0], '', M0[2], '', ''] + let warning_group = airline#themes#get_highlight2(['Normal', 'bg'], ['Question', 'fg']) + let error_group = airline#themes#get_highlight2(['Normal', 'bg'], ['WarningMsg', 'fg']) + + let s:N1 = airline#themes#get_highlight2(['Normal', 'bg'], ['StatusLineNC', 'bg']) + let s:N2 = airline#themes#get_highlight2(['StatusLineNC', 'bg'], ['Pmenu', 'bg']) + let s:N3 = airline#themes#get_highlight2(['StatusLineNC', 'bg'], ['CursorLine', 'bg']) + let g:airline#themes#gruvbox#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3) + let g:airline#themes#gruvbox#palette.normal_modified = { 'airline_c': modified_group } + let g:airline#themes#gruvbox#palette.normal.airline_warning = warning_group + let g:airline#themes#gruvbox#palette.normal_modified.airline_warning = warning_group + let g:airline#themes#gruvbox#palette.normal.airline_error = error_group + let g:airline#themes#gruvbox#palette.normal_modified.airline_error = error_group + + let s:I1 = airline#themes#get_highlight2(['Normal', 'bg'], ['Identifier', 'fg']) + let s:I2 = s:N2 + let s:I3 = airline#themes#get_highlight2(['Normal', 'fg'], ['Pmenu', 'bg']) + let g:airline#themes#gruvbox#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3) + let g:airline#themes#gruvbox#palette.insert_modified = g:airline#themes#gruvbox#palette.normal_modified + let g:airline#themes#gruvbox#palette.insert.airline_warning = g:airline#themes#gruvbox#palette.normal.airline_warning + let g:airline#themes#gruvbox#palette.insert_modified.airline_warning = g:airline#themes#gruvbox#palette.normal_modified.airline_warning + let g:airline#themes#gruvbox#palette.insert.airline_error = g:airline#themes#gruvbox#palette.normal.airline_error + let g:airline#themes#gruvbox#palette.insert_modified.airline_error = g:airline#themes#gruvbox#palette.normal_modified.airline_error + + let s:R1 = airline#themes#get_highlight2(['Normal', 'bg'], ['Structure', 'fg']) + let s:R2 = s:I2 + let s:R3 = s:I3 + let g:airline#themes#gruvbox#palette.replace = airline#themes#generate_color_map(s:R1, s:R2, s:R3) + let g:airline#themes#gruvbox#palette.replace_modified = g:airline#themes#gruvbox#palette.normal_modified + let g:airline#themes#gruvbox#palette.replace.airline_warning = g:airline#themes#gruvbox#palette.normal.airline_warning + let g:airline#themes#gruvbox#palette.replace_modified.airline_warning = g:airline#themes#gruvbox#palette.normal_modified.airline_warning + let g:airline#themes#gruvbox#palette.replace.airline_error = g:airline#themes#gruvbox#palette.normal.airline_error + let g:airline#themes#gruvbox#palette.replace_modified.airline_error = g:airline#themes#gruvbox#palette.normal_modified.airline_error + + let s:V1 = airline#themes#get_highlight2(['Normal', 'bg'], ['Question', 'fg']) + let s:V2 = s:N2 + let s:V3 = airline#themes#get_highlight2(['Normal', 'bg'], ['TabLine', 'fg']) + let g:airline#themes#gruvbox#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3) + let g:airline#themes#gruvbox#palette.visual_modified = { 'airline_c': [ s:V3[0], '', s:V3[2], '', '' ] } + let g:airline#themes#gruvbox#palette.visual.airline_warning = g:airline#themes#gruvbox#palette.normal.airline_warning + let g:airline#themes#gruvbox#palette.visual_modified.airline_warning = g:airline#themes#gruvbox#palette.normal_modified.airline_warning + let g:airline#themes#gruvbox#palette.visual.airline_error = g:airline#themes#gruvbox#palette.normal.airline_error + let g:airline#themes#gruvbox#palette.visual_modified.airline_error = g:airline#themes#gruvbox#palette.normal_modified.airline_error + + let s:IA = airline#themes#get_highlight2(['TabLine', 'fg'], ['CursorLine', 'bg']) + let g:airline#themes#gruvbox#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA) + let g:airline#themes#gruvbox#palette.inactive_modified = { 'airline_c': modified_group } + + let g:airline#themes#gruvbox#palette.accents = { 'red': accents_group } + + let s:TF = airline#themes#get_highlight2(['Normal', 'bg'], ['Normal', 'bg']) + let g:airline#themes#gruvbox#palette.tabline = { + \ 'airline_tab': s:N2, + \ 'airline_tabsel': s:N1, + \ 'airline_tabtype': s:V1, + \ 'airline_tabfill': s:TF, + \ 'airline_tabhid': s:IA, + \ 'airline_tabmod': s:I1 + \ } + +endfunction + +call airline#themes#gruvbox#refresh() + +" vim: set sw=2 ts=2 sts=2 et tw=80 ft=vim fdm=marker: diff --git a/.vim/autoload/airline/util.vim b/.vim/autoload/airline/util.vim new file mode 100644 index 0000000..65e123c --- /dev/null +++ b/.vim/autoload/airline/util.vim @@ -0,0 +1,131 @@ +" MIT License. Copyright (c) 2013-2018 Bailey Ling et al. +" vim: et ts=2 sts=2 sw=2 + +" TODO: Try to cache winwidth(0) function +" e.g. store winwidth per window and access that, only update it, if the size +" actually changed. +scriptencoding utf-8 + +call airline#init#bootstrap() +let s:spc = g:airline_symbols.space +let s:nomodeline = (v:version > 703 || (v:version == 703 && has("patch438"))) ? '<nomodeline>' : '' + +function! airline#util#shorten(text, winwidth, minwidth, ...) + if winwidth(0) < a:winwidth && len(split(a:text, '\zs')) > a:minwidth + if get(a:000, 0, 0) + " shorten from tail + return '…'.matchstr(a:text, '.\{'.a:minwidth.'}$') + else + " shorten from beginning of string + return matchstr(a:text, '^.\{'.a:minwidth.'}').'…' + endif + else + return a:text + endif +endfunction + +function! airline#util#wrap(text, minwidth) + if a:minwidth > 0 && winwidth(0) < a:minwidth + return '' + endif + return a:text +endfunction + +function! airline#util#append(text, minwidth) + if a:minwidth > 0 && winwidth(0) < a:minwidth + return '' + endif + let prefix = s:spc == "\ua0" ? s:spc : s:spc.s:spc + return empty(a:text) ? '' : prefix.g:airline_left_alt_sep.s:spc.a:text +endfunction + +function! airline#util#warning(msg) + echohl WarningMsg + echomsg "airline: ".a:msg + echohl Normal +endfunction + +function! airline#util#prepend(text, minwidth) + if a:minwidth > 0 && winwidth(0) < a:minwidth + return '' + endif + return empty(a:text) ? '' : a:text.s:spc.g:airline_right_alt_sep.s:spc +endfunction + +if v:version >= 704 + function! airline#util#getwinvar(winnr, key, def) + return getwinvar(a:winnr, a:key, a:def) + endfunction +else + function! airline#util#getwinvar(winnr, key, def) + let winvals = getwinvar(a:winnr, '') + return get(winvals, a:key, a:def) + endfunction +endif + +if v:version >= 704 + function! airline#util#exec_funcrefs(list, ...) + for Fn in a:list + let code = call(Fn, a:000) + if code != 0 + return code + endif + endfor + return 0 + endfunction +else + function! airline#util#exec_funcrefs(list, ...) + " for 7.2; we cannot iterate the list, hence why we use range() + " for 7.3-[97, 328]; we cannot reuse the variable, hence the {} + for i in range(0, len(a:list) - 1) + let Fn{i} = a:list[i] + let code = call(Fn{i}, a:000) + if code != 0 + return code + endif + endfor + return 0 + endfunction +endif + +" Compatibility wrapper for strchars, in case this vim version does not +" have it natively +function! airline#util#strchars(str) + if exists('*strchars') + return strchars(a:str) + else + return strlen(substitute(a:str, '.', 'a', 'g')) + endif +endfunction + +function! airline#util#ignore_buf(name) + let pat = '\c\v'. get(g:, 'airline#ignore_bufadd_pat', ''). + \ get(g:, 'airline#extensions#tabline#ignore_bufadd_pat', + \ 'gundo|undotree|vimfiler|tagbar|nerd_tree|startify|!') + return match(a:name, pat) > -1 +endfunction + +function! airline#util#has_fugitive() + return exists('*fugitive#head') || exists('*FugitiveHead') +endfunction + +function! airline#util#has_lawrencium() + return exists('*lawrencium#statusline') +endfunction + +function! airline#util#has_vcscommand() + return get(g:, 'airline#extensions#branch#use_vcscommand', 0) && exists('*VCSCommandGetStatusLine') +endfunction + +function! airline#util#has_custom_scm() + return !empty(get(g:, 'airline#extensions#branch#custom_head', '')) +endfunction + +function! airline#util#doautocmd(event) + exe printf("silent doautocmd %s User %s", s:nomodeline, a:event) +endfunction + +function! airline#util#themes(match) + let files = split(globpath(&rtp, 'autoload/airline/themes/'.a:match.'*'), "\n") + return map(files, 'fnamemodify(v:val, ":t:r")') +endfunction |