From d16e82d468eb0d5bb1e662ac4812c0ca6fc0fc64 Mon Sep 17 00:00:00 2001 From: Yaroslav Date: Tue, 25 Feb 2020 14:47:03 +0300 Subject: reorganized repo to be easier to use with GNU stow; added script to stow --- .../airline/extensions/tabline/autoshow.vim | 55 --- .../airline/extensions/tabline/buffers.vim | 246 ------------- .../airline/extensions/tabline/buflist.vim | 77 ---- .../airline/extensions/tabline/builder.vim | 232 ------------ .../airline/extensions/tabline/ctrlspace.vim | 157 -------- .../extensions/tabline/formatters/default.vim | 43 --- .../extensions/tabline/formatters/jsformatter.vim | 15 - .../extensions/tabline/formatters/tabnr.vim | 14 - .../extensions/tabline/formatters/unique_tail.vim | 41 --- .../tabline/formatters/unique_tail_improved.vim | 91 ----- .vim/autoload/airline/extensions/tabline/tabs.vim | 124 ------- .../airline/extensions/tabline/xtabline.vim | 397 --------------------- 12 files changed, 1492 deletions(-) delete mode 100644 .vim/autoload/airline/extensions/tabline/autoshow.vim delete mode 100644 .vim/autoload/airline/extensions/tabline/buffers.vim delete mode 100644 .vim/autoload/airline/extensions/tabline/buflist.vim delete mode 100644 .vim/autoload/airline/extensions/tabline/builder.vim delete mode 100644 .vim/autoload/airline/extensions/tabline/ctrlspace.vim delete mode 100644 .vim/autoload/airline/extensions/tabline/formatters/default.vim delete mode 100644 .vim/autoload/airline/extensions/tabline/formatters/jsformatter.vim delete mode 100644 .vim/autoload/airline/extensions/tabline/formatters/tabnr.vim delete mode 100644 .vim/autoload/airline/extensions/tabline/formatters/unique_tail.vim delete mode 100644 .vim/autoload/airline/extensions/tabline/formatters/unique_tail_improved.vim delete mode 100644 .vim/autoload/airline/extensions/tabline/tabs.vim delete mode 100644 .vim/autoload/airline/extensions/tabline/xtabline.vim (limited to '.vim/autoload/airline/extensions/tabline') diff --git a/.vim/autoload/airline/extensions/tabline/autoshow.vim b/.vim/autoload/airline/extensions/tabline/autoshow.vim deleted file mode 100644 index ac1413f..0000000 --- a/.vim/autoload/airline/extensions/tabline/autoshow.vim +++ /dev/null @@ -1,55 +0,0 @@ -" 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 show_tabline(s:buf_min_count, len(airline#extensions#tabline#buflist#list())) - autocmd BufUnload * call show_tabline(s:buf_min_count, len(airline#extensions#tabline#buflist#list()) - 1) - else - autocmd TabEnter * call 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 deleted file mode 100644 index 88ebe5c..0000000 --- a/.vim/autoload/airline/extensions/tabline/buffers.vim +++ /dev/null @@ -1,246 +0,0 @@ -" 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 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 AirlineSelectTab1 :call select_tab(0) - noremap AirlineSelectTab2 :call select_tab(1) - noremap AirlineSelectTab3 :call select_tab(2) - noremap AirlineSelectTab4 :call select_tab(3) - noremap AirlineSelectTab5 :call select_tab(4) - noremap AirlineSelectTab6 :call select_tab(5) - noremap AirlineSelectTab7 :call select_tab(6) - noremap AirlineSelectTab8 :call select_tab(7) - noremap AirlineSelectTab9 :call select_tab(8) - noremap AirlineSelectPrevTab :call jump_to_tab(-v:count1) - noremap AirlineSelectNextTab :call jump_to_tab(v:count1) - 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 deleted file mode 100644 index a944cb9..0000000 --- a/.vim/autoload/airline/extensions/tabline/buflist.vim +++ /dev/null @@ -1,77 +0,0 @@ -" 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 deleted file mode 100644 index 20964b1..0000000 --- a/.vim/autoload/airline/extensions/tabline/builder.vim +++ /dev/null @@ -1,232 +0,0 @@ -" 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 deleted file mode 100644 index bb2d518..0000000 --- a/.vim/autoload/airline/extensions/tabline/ctrlspace.vim +++ /dev/null @@ -1,157 +0,0 @@ -" 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} {Buffers} {Tabs} 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 deleted file mode 100644 index b16d06f..0000000 --- a/.vim/autoload/airline/extensions/tabline/formatters/jsformatter.vim +++ /dev/null @@ -1,15 +0,0 @@ -" 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 deleted file mode 100644 index fa71014..0000000 --- a/.vim/autoload/airline/extensions/tabline/formatters/tabnr.vim +++ /dev/null @@ -1,14 +0,0 @@ -" 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 deleted file mode 100644 index 3e61b60..0000000 --- a/.vim/autoload/airline/extensions/tabline/formatters/unique_tail.vim +++ /dev/null @@ -1,41 +0,0 @@ -" 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 deleted file mode 100644 index c48174b..0000000 --- a/.vim/autoload/airline/extensions/tabline/formatters/unique_tail_improved.vim +++ /dev/null @@ -1,91 +0,0 @@ -" 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 deleted file mode 100644 index a74ab5b..0000000 --- a/.vim/autoload/airline/extensions/tabline/tabs.vim +++ /dev/null @@ -1,124 +0,0 @@ -" 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('AirlineSelectTab1', 'n') is# ':1tabn' - return - endif - noremap AirlineSelectTab1 :1tabn - noremap AirlineSelectTab2 :2tabn - noremap AirlineSelectTab3 :3tabn - noremap AirlineSelectTab4 :4tabn - noremap AirlineSelectTab5 :5tabn - noremap AirlineSelectTab6 :6tabn - noremap AirlineSelectTab7 :7tabn - noremap AirlineSelectTab8 :8tabn - noremap AirlineSelectTab9 :9tabn - noremap AirlineSelectPrevTab gT - " tabn {count} goes to count tab does not go {count} tab pages forward! - noremap AirlineSelectNextTab :exe repeat(':tabn\|', v:count1) -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 deleted file mode 100644 index 4d1cdec..0000000 --- a/.vim/autoload/airline/extensions/tabline/xtabline.vim +++ /dev/null @@ -1,397 +0,0 @@ -"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" xTabline - Reduced version for vim-airline -" Copyright (C) 2018 Gianmaria Bajo -" 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 '.a:keys.' '.a:plug - endif - endfun - - call s:mapkeys('','XTablineToggleTabs') - call s:mapkeys('','XTablineToggleFiltering') - call s:mapkeys('','XTablineSelectBuffer') - call s:mapkeys(']l','XTablineNextBuffer') - call s:mapkeys('[l','XTablinePrevBuffer') - call s:mapkeys('tr','XTablineReopen') - endif - - nnoremap