diff options
Diffstat (limited to '')
25 files changed, 1546 insertions, 0 deletions
diff --git a/.vim/bundle/vim-airline/autoload/airline/extensions.vim b/.vim/bundle/vim-airline/autoload/airline/extensions.vim new file mode 100644 index 0000000..461d1c3 --- /dev/null +++ b/.vim/bundle/vim-airline/autoload/airline/extensions.vim @@ -0,0 +1,234 @@ +" MIT License. Copyright (c) 2013-2014 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +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': [ 'NERD', '' ], + \ 'gundo': [ 'Gundo', '' ], + \ 'diff': [ 'diff', '' ], + \ 'vimfiler': [ 'vimfiler', '%{vimfiler#get_status_string()}' ], + \ 'minibufexpl': [ 'MiniBufExplorer', '' ], + \ 'startify': [ 'startify', '' ], + \ } + +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 + +let s:active_winnr = -1 +function! airline#extensions#apply(...) + let s:active_winnr = winnr() + + 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 &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! s:sync_active_winnr() + if exists('#airline') && winnr() != s:active_winnr + call airline#update_statusline() + endif +endfunction + +function! airline#extensions#load() + " non-trivial number of external plugins use eventignore=all, so we need to account for that + autocmd CursorMoved * call <sid>sync_active_winnr() + + call airline#extensions#quickfix#init(s:ext) + + if get(g:, 'loaded_unite', 0) + call airline#extensions#unite#init(s:ext) + endif + + if exists(':NetrwSettings') + call airline#extensions#netrw#init(s:ext) + 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) + endif + + if get(g:, 'command_t_loaded', 0) + call airline#extensions#commandt#init(s:ext) + endif + + if exists(':UndotreeToggle') + call airline#extensions#undotree#init(s:ext) + endif + + if (get(g:, 'airline#extensions#hunks#enabled', 1) && get(g:, 'airline_enable_hunks', 1)) + \ && (exists('g:loaded_signify') || exists('g:loaded_gitgutter')) + call airline#extensions#hunks#init(s:ext) + endif + + if (get(g:, 'airline#extensions#tagbar#enabled', 1) && get(g:, 'airline_enable_tagbar', 1)) + \ && exists(':TagbarToggle') + call airline#extensions#tagbar#init(s:ext) + endif + + if (get(g:, 'airline#extensions#csv#enabled', 1) && get(g:, 'airline_enable_csv', 1)) + \ && (get(g:, 'loaded_csv', 0) || exists(':Table')) + call airline#extensions#csv#init(s:ext) + 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 (get(g:, 'airline#extensions#branch#enabled', 1) && get(g:, 'airline_enable_branch', 1)) + \ && (exists('*fugitive#head') || exists('*lawrencium#statusline') || + \ (get(g:, 'airline#extensions#branch#use_vcscommand', 0) && exists('*VCSCommandGetStatusLine'))) + call airline#extensions#branch#init(s:ext) + endif + + if (get(g:, 'airline#extensions#bufferline#enabled', 1) && get(g:, 'airline_enable_bufferline', 1)) + \ && exists('*bufferline#get_status_string') + call airline#extensions#bufferline#init(s:ext) + endif + + if get(g:, 'virtualenv_loaded', 0) && get(g:, 'airline#extensions#virtualenv#enabled', 1) + call airline#extensions#virtualenv#init(s:ext) + endif + + if (get(g:, 'airline#extensions#eclim#enabled', 1) && exists(':ProjectCreate')) + call airline#extensions#eclim#init(s:ext) + endif + + if (get(g:, 'airline#extensions#syntastic#enabled', 1) && get(g:, 'airline_enable_syntastic', 1)) + \ && exists(':SyntasticCheck') + call airline#extensions#syntastic#init(s:ext) + endif + + if (get(g:, 'airline#extensions#whitespace#enabled', 1) && get(g:, 'airline_detect_whitespace', 1)) + call airline#extensions#whitespace#init(s:ext) + endif + + if get(g:, 'airline#extensions#tabline#enabled', 0) + call airline#extensions#tabline#init(s:ext) + endif + + if get(g:, 'airline#extensions#tmuxline#enabled', 1) && exists(':Tmuxline') + call airline#extensions#tmuxline#init(s:ext) + 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) + endif + + if get(g:, 'airline#extensions#nrrwrgn#enabled', 1) && exists(':NR') == 2 + call airline#extensions#nrrwrgn#init(s:ext) + 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) + continue + endif + try + call airline#extensions#{name}#init(s:ext) + catch + endtry + endif + endfor + endif +endfunction + diff --git a/.vim/bundle/vim-airline/autoload/airline/extensions/branch.vim b/.vim/bundle/vim-airline/autoload/airline/extensions/branch.vim new file mode 100644 index 0000000..ceaa44b --- /dev/null +++ b/.vim/bundle/vim-airline/autoload/airline/extensions/branch.vim @@ -0,0 +1,108 @@ +" MIT License. Copyright (c) 2013-2014 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +let s:has_fugitive = exists('*fugitive#head') +let s:has_lawrencium = exists('*lawrencium#statusline') +let s:has_vcscommand = get(g:, 'airline#extensions#branch#use_vcscommand', 0) && exists('*VCSCommandGetStatusLine') + +if !s:has_fugitive && !s:has_lawrencium && !s:has_vcscommand + finish +endif + +let s:git_dirs = {} +function! s:get_git_branch(path) + if has_key(s:git_dirs, a:path) + return s:git_dirs[a:path] + endif + + let dir = fugitive#extract_git_dir(a:path) + if empty(dir) + let name = '' + else + try + let line = join(readfile(dir . '/HEAD')) + let name = strpart(line, 16) + catch + let name = '' + endtry + endif + + let s:git_dirs[a:path] = name + return name +endfunction + +function! airline#extensions#branch#head() + if exists('b:airline_head') && !empty(b:airline_head) + return b:airline_head + endif + + let b:airline_head = '' + + if s:has_fugitive && !exists('b:mercurial_dir') + let b:airline_head = fugitive#head() + + if empty(b:airline_head) && !exists('b:git_dir') + let b:airline_head = s:get_git_branch(expand("%:p:h")) + endif + endif + + if empty(b:airline_head) + if s:has_lawrencium + let b:airline_head = lawrencium#statusline() + endif + endif + + if empty(b:airline_head) + if s:has_vcscommand + call VCSCommandEnableBufferSetup() + if exists('b:VCSCommandBufferInfo') + let b:airline_head = get(b:VCSCommandBufferInfo, 0, '') + endif + endif + endif + + if empty(b:airline_head) || !s:check_in_path() + let b:airline_head = '' + endif + + 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', + \ get(g:, 'airline_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:check_in_path() + if !exists('b:airline_branch_path') + let root = get(b:, 'git_dir', get(b:, 'mercurial_dir', '')) + let bufferpath = resolve(fnamemodify(expand('%'), ':p')) + + if !filereadable(root) "not a file + " if .git is a directory, it's the old submodule format + if match(root, '\.git$') >= 0 + let root = expand(fnamemodify(root, ':h')) + else + " else it's the newer format, and we need to guesstimate + let pattern = '\.git\(\\\|\/\)modules\(\\\|\/\)' + if match(root, pattern) >= 0 + let root = substitute(root, pattern, '', '') + endif + endif + + let b:airline_file_in_root = stridx(bufferpath, root) > -1 + endif + return b:airline_file_in_root +endfunction + +function! airline#extensions#branch#init(ext) + call airline#parts#define_function('branch', 'airline#extensions#branch#get_head') + + autocmd BufReadPost * unlet! b:airline_file_in_root + autocmd CursorHold,ShellCmdPost,CmdwinLeave * unlet! b:airline_head +endfunction diff --git a/.vim/bundle/vim-airline/autoload/airline/extensions/bufferline.vim b/.vim/bundle/vim-airline/autoload/airline/extensions/bufferline.vim new file mode 100644 index 0000000..6dc97fe --- /dev/null +++ b/.vim/bundle/vim-airline/autoload/airline/extensions/bufferline.vim @@ -0,0 +1,23 @@ +" MIT License. Copyright (c) 2013-2014 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +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 + + call airline#parts#define_raw('file', '%{bufferline#refresh_status()}'.bufferline#get_status_string()) +endfunction + diff --git a/.vim/bundle/vim-airline/autoload/airline/extensions/commandt.vim b/.vim/bundle/vim-airline/autoload/airline/extensions/commandt.vim new file mode 100644 index 0000000..e549f27 --- /dev/null +++ b/.vim/bundle/vim-airline/autoload/airline/extensions/commandt.vim @@ -0,0 +1,16 @@ +" MIT License. Copyright (c) 2013-2014 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +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/bundle/vim-airline/autoload/airline/extensions/csv.vim b/.vim/bundle/vim-airline/autoload/airline/extensions/csv.vim new file mode 100644 index 0000000..2c296ab --- /dev/null +++ b/.vim/bundle/vim-airline/autoload/airline/extensions/csv.vim @@ -0,0 +1,31 @@ +" MIT License. Copyright (c) 2013-2014 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +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/bundle/vim-airline/autoload/airline/extensions/ctrlp.vim b/.vim/bundle/vim-airline/autoload/airline/extensions/ctrlp.vim new file mode 100644 index 0000000..11a8922 --- /dev/null +++ b/.vim/bundle/vim-airline/autoload/airline/extensions/ctrlp.vim @@ -0,0 +1,77 @@ +" MIT License. Copyright (c) 2013-2014 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +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: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_raw('%#CtrlPdark#'.a:1.(g:airline_symbols.space)) + 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/bundle/vim-airline/autoload/airline/extensions/default.vim b/.vim/bundle/vim-airline/autoload/airline/extensions/default.vim new file mode 100644 index 0000000..d01349d --- /dev/null +++ b/.vim/bundle/vim-airline/autoload/airline/extensions/default.vim @@ -0,0 +1,77 @@ +" MIT License. Copyright (c) 2013-2014 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +let s:section_truncate_width = get(g:, 'airline#extensions#default#section_truncate_width', { + \ 'b': 79, + \ 'x': 60, + \ 'y': 88, + \ 'z': 45, + \ }) +let s:layout = get(g:, 'airline#extensions#default#layout', [ + \ [ 'a', 'b', 'c' ], + \ [ 'x', 'y', 'z', 'warning' ] + \ ]) + +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 + 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' && !a:context.active + continue + endif + call s:add_section(a:builder, a:context, key) + endfor +endfunction + +if v:version >= 704 || (v:version >= 703 && has('patch81')) + function s:add_section(builder, context, key) + " i have no idea why the warning section needs special treatment, but it's + " needed to prevent separators from showing up + if a:key == 'warning' + call a:builder.add_raw('%(') + endif + call a:builder.add_section('airline_'.a:key, s:get_section(a:context.winnr, a:key)) + if a:key == 'warning' + 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 == 'warning' + call a:builder.add_raw('%#airline_warning#'.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 <sid>build_sections(a:builder, a:context, s:layout[0]) + else + call a:builder.add_section('airline_c'.(a:context.bufnr), ' %f%m ') + endif + + call a:builder.split(s:get_section(winnr, 'gutter', '', '')) + + if airline#util#getwinvar(winnr, 'airline_render_right', 1) + call <sid>build_sections(a:builder, a:context, s:layout[1]) + endif + + return 1 +endfunction + diff --git a/.vim/bundle/vim-airline/autoload/airline/extensions/eclim.vim b/.vim/bundle/vim-airline/autoload/airline/extensions/eclim.vim new file mode 100644 index 0000000..18cbae5 --- /dev/null +++ b/.vim/bundle/vim-airline/autoload/airline/extensions/eclim.vim @@ -0,0 +1,41 @@ +" MIT License. Copyright (c) 2013-2014 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +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() + let eclimList = eclim#display#signs#GetExisting() + + if !empty(eclimList) + " Remove any non-eclim signs (see eclim#display#signs#Update) + call filter(eclimList, 'v:val.name =~ "^\\(qf_\\)\\?\\(error\\|info\\|warning\\)$"') + + if !empty(eclimList) + let errorsLine = eclimList[0]['line'] + let errorsNumber = len(eclimList) + let errors = "[Eclim: line:".string(errorsLine)." (".string(errorsNumber).")]" + if !exists(':SyntasticCheck') || SyntasticStatuslineFlag() == '' + return errors.(g:airline_symbols.space) + endif + endif + endif + return '' +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/bundle/vim-airline/autoload/airline/extensions/example.vim b/.vim/bundle/vim-airline/autoload/airline/extensions/example.vim new file mode 100644 index 0000000..4a1932d --- /dev/null +++ b/.vim/bundle/vim-airline/autoload/airline/extensions/example.vim @@ -0,0 +1,54 @@ +" MIT License. Copyright (c) 2013-2014 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +" 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/bundle/vim-airline/autoload/airline/extensions/hunks.vim b/.vim/bundle/vim-airline/autoload/airline/extensions/hunks.vim new file mode 100644 index 0000000..6827f5d --- /dev/null +++ b/.vim/bundle/vim-airline/autoload/airline/extensions/hunks.vim @@ -0,0 +1,67 @@ +" MIT License. Copyright (c) 2013-2014 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +if !get(g:, 'loaded_signify', 0) && !get(g:, 'loaded_gitgutter', 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(airline#extensions#branch#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_empty() + return '' +endfunction + +let s:source_func = '' +function! s:get_hunks() + if empty(s:source_func) + if get(g:, 'loaded_signify', 0) + let s:source_func = 's:get_hunks_signify' + elseif exists('*GitGutterGetHunkSummary') + let s:source_func = 's:get_hunks_gitgutter' + else + let s:source_func = 's:get_hunks_empty' + endif + endif + return {s:source_func}() +endfunction + +function! airline#extensions#hunks#get_hunks() + if !get(w:, 'airline_active', 0) + return '' + endif + let hunks = s:get_hunks() + let string = '' + if !empty(hunks) + for i in [0, 1, 2] + if s:non_zero_only == 0 || hunks[i] > 0 + let string .= printf('%s%s ', s:hunk_symbols[i], hunks[i]) + endif + endfor + endif + 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/bundle/vim-airline/autoload/airline/extensions/netrw.vim b/.vim/bundle/vim-airline/autoload/airline/extensions/netrw.vim new file mode 100644 index 0000000..debb088 --- /dev/null +++ b/.vim/bundle/vim-airline/autoload/airline/extensions/netrw.vim @@ -0,0 +1,32 @@ +" MIT License. Copyright (c) 2013-2014 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +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 = (g:netrw_sort_direction =~ 'n') ? '+' : '-' + return g:netrw_sort_by . (g:airline_symbols.space) . '[' . order . ']' +endfunction diff --git a/.vim/bundle/vim-airline/autoload/airline/extensions/nrrwrgn.vim b/.vim/bundle/vim-airline/autoload/airline/extensions/nrrwrgn.vim new file mode 100644 index 0000000..2281598 --- /dev/null +++ b/.vim/bundle/vim-airline/autoload/airline/extensions/nrrwrgn.vim @@ -0,0 +1,24 @@ +" MIT License. Copyright (c) 2013-2014 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +if !get(g:, 'loaded_nrrw_rgn', 0) + finish +endif + +function! airline#extensions#nrrwrgn#apply(...) + if exists(":WidenRegion") == 2 + let spc = g:airline_symbols.space + call a:1.add_section('airline_a', printf('%s[Narrowed%s#%d]', spc, spc, b:nrrw_instn)) + if exists('*airline#extensions#branch#get_head') + call a:1.add_section('airline_b', spc.'%{airline#extensions#branch#get_head()}'.spc) + endif + 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() + 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/bundle/vim-airline/autoload/airline/extensions/promptline.vim b/.vim/bundle/vim-airline/autoload/airline/extensions/promptline.vim new file mode 100644 index 0000000..50b9708 --- /dev/null +++ b/.vim/bundle/vim-airline/autoload/airline/extensions/promptline.vim @@ -0,0 +1,33 @@ +" MIT License. Copyright (c) 2013-2014 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +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/bundle/vim-airline/autoload/airline/extensions/quickfix.vim b/.vim/bundle/vim-airline/autoload/airline/extensions/quickfix.vim new file mode 100644 index 0000000..8efc527 --- /dev/null +++ b/.vim/bundle/vim-airline/autoload/airline/extensions/quickfix.vim @@ -0,0 +1,37 @@ +" MIT License. Copyright (c) 2013-2014 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +let g:airline#extensions#quickfix#quickfix_text = 'Quickfix' +let g:airline#extensions#quickfix#location_text = 'Location' + +function! airline#extensions#quickfix#apply(...) + if &buftype == 'quickfix' + let w:airline_section_a = s:get_text() + 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') +endfunction + +function! s:get_text() + 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, '\[Quickfix List\]') > -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/bundle/vim-airline/autoload/airline/extensions/syntastic.vim b/.vim/bundle/vim-airline/autoload/airline/extensions/syntastic.vim new file mode 100644 index 0000000..f7179af --- /dev/null +++ b/.vim/bundle/vim-airline/autoload/airline/extensions/syntastic.vim @@ -0,0 +1,19 @@ +" MIT License. Copyright (c) 2013-2014 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +if !exists(':SyntasticCheck') + finish +endif + +function! airline#extensions#syntastic#get_warnings() + let errors = SyntasticStatuslineFlag() + if strlen(errors) > 0 + return errors.(g:airline_symbols.space) + endif + return '' +endfunction + +function! airline#extensions#syntastic#init(ext) + call airline#parts#define_function('syntastic', 'airline#extensions#syntastic#get_warnings') +endfunction + diff --git a/.vim/bundle/vim-airline/autoload/airline/extensions/tabline.vim b/.vim/bundle/vim-airline/autoload/airline/extensions/tabline.vim new file mode 100644 index 0000000..ec75db7 --- /dev/null +++ b/.vim/bundle/vim-airline/autoload/airline/extensions/tabline.vim @@ -0,0 +1,278 @@ +" MIT License. Copyright (c) 2013-2014 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +let s:formatter = get(g:, 'airline#extensions#tabline#formatter', 'default') +let s:excludes = get(g:, 'airline#extensions#tabline#excludes', []) +let s:tab_nr_type = get(g:, 'airline#extensions#tabline#tab_nr_type', 0) +let s:show_buffers = get(g:, 'airline#extensions#tabline#show_buffers', 1) +let s:show_tab_nr = get(g:, 'airline#extensions#tabline#show_tab_nr', 1) +let s:show_tab_type = get(g:, 'airline#extensions#tabline#show_tab_type', 1) +let s:close_symbol = get(g:, 'airline#extensions#tabline#close_symbol', 'X') + +let s:builder_context = { + \ 'active' : 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 s:builder_context.left_sep = get(g:, 'airline#extensions#tabline#left_sep' , "\ue0b0") + let s:builder_context.left_alt_sep = get(g:, 'airline#extensions#tabline#left_alt_sep' , "\ue0b1") +else + let s:builder_context.left_sep = get(g:, 'airline#extensions#tabline#left_sep' , ' ') + let s:builder_context.left_alt_sep = get(g:, 'airline#extensions#tabline#left_alt_sep' , '|') +endif + +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) +let s:spc = g:airline_symbols.space + +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() + autocmd BufDelete * let s:current_bufnr = -1 + + call s:toggle_on() + call a:ext.add_theme_func('airline#extensions#tabline#load_theme') +endfunction + +function! s:toggle_off() + if exists('s:original_tabline') + let &tabline = s:original_tabline + let &showtabline = s:original_showtabline + endif +endfunction + +function! s:toggle_on() + let [ s:original_tabline, s:original_showtabline ] = [ &tabline, &showtabline ] + + set tabline=%!airline#extensions#tabline#get() + if s:buf_min_count <= 0 && s:tab_min_count <= 1 + set showtabline=2 + else + augroup airline_tabline + autocmd! + if s:show_buffers == 1 + autocmd CursorMoved * call <sid>on_cursormove(s:buf_min_count, len(s:get_buffer_list())) + else + autocmd TabEnter * call <sid>on_cursormove(s:tab_min_count, tabpagenr('$')) + endif + augroup END + endif +endfunction + +function! airline#extensions#tabline#load_theme(palette) + let colors = get(a:palette, 'tabline', {}) + let l:tab = get(colors, 'airline_tab', a:palette.normal.airline_b) + let l:tabsel = get(colors, 'airline_tabsel', a:palette.normal.airline_a) + let l:tabtype = get(colors, 'airline_tabtype', a:palette.visual.airline_a) + let l:tabfill = get(colors, 'airline_tabfill', a:palette.normal.airline_c) + let l:tabmod = get(colors, 'airline_tabmod', a:palette.insert.airline_a) + let l:tabhid = get(colors, 'airline_tabhid', a:palette.normal.airline_c) + call airline#highlighter#exec('airline_tab', l:tab) + call airline#highlighter#exec('airline_tabsel', l:tabsel) + call airline#highlighter#exec('airline_tabtype', l:tabtype) + call airline#highlighter#exec('airline_tabfill', l:tabfill) + call airline#highlighter#exec('airline_tabmod', l:tabmod) + call airline#highlighter#exec('airline_tabhid', l:tabhid) +endfunction + +function! s:on_cursormove(min_count, total_count) + if a:total_count >= a:min_count + if &showtabline != 2 + set showtabline=2 + endif + else + if &showtabline != 0 + set showtabline=0 + endif + endif +endfunction + +function! airline#extensions#tabline#get() + if s:show_buffers && tabpagenr('$') == 1 + return s:get_buffers() + else + return s:get_tabs() + endif +endfunction + +function! airline#extensions#tabline#title(n) + let buflist = tabpagebuflist(a:n) + let winnr = tabpagewinnr(a:n) + return airline#extensions#tabline#get_buffer_name(buflist[winnr - 1]) +endfunction + +function! airline#extensions#tabline#get_buffer_name(nr) + return airline#extensions#tabline#{s:formatter}#format(a:nr, get(s:, 'current_buffer_list', s:get_buffer_list())) +endfunction + +function! s:get_buffer_list() + let buffers = [] + let cur = bufnr('%') + for nr in range(1, bufnr('$')) + if buflisted(nr) && bufexists(nr) + for ex in s:excludes + if match(bufname(nr), ex) + continue + endif + endfor + if getbufvar(nr, 'current_syntax') == 'qf' + continue + endif + call add(buffers, nr) + endif + endfor + + let s:current_buffer_list = buffers + return buffers +endfunction + +function! s:get_visible_buffers() + let buffers = s:get_buffer_list() + let cur = bufnr('%') + + let total_width = 0 + let max_width = 0 + + for nr in buffers + let width = len(airline#extensions#tabline#get_buffer_name(nr)) + 4 + let total_width += width + let max_width = max([max_width, width]) + endfor + + " only show current and surrounding buffers if there are too many buffers + let position = index(buffers, cur) + let vimwidth = &columns + if total_width > vimwidth && position > -1 + let buf_count = len(buffers) + + " determine how many buffers to show based on the longest buffer width, + " use one on the right side and put the rest on the left + let buf_max = vimwidth / max_width + let buf_right = 1 + let buf_left = max([0, buf_max - buf_right]) + + let start = max([0, position - buf_left]) + let end = min([buf_count, position + buf_right]) + + " fill up available space on the right + if position < buf_left + let end += (buf_left - position) + endif + + " fill up available space on the left + if end > buf_count - 1 - buf_right + let start -= max([0, buf_right - (buf_count - 1 - position)]) + endif + + let buffers = eval('buffers[' . start . ':' . end . ']') + + if start > 0 + call insert(buffers, -1, 0) + endif + + if end < buf_count - 1 + call add(buffers, -1) + endif + endif + + return buffers +endfunction + +let s:current_bufnr = -1 +let s:current_tabnr = -1 +let s:current_tabline = '' +let s:current_modified = 0 +function! s:get_buffers() + let cur = bufnr('%') + if cur == s:current_bufnr + if !g:airline_detect_modified || getbufvar(cur, '&modified') == s:current_modified + return s:current_tabline + endif + endif + + let b = airline#builder#new(s:builder_context) + let tab_bufs = tabpagebuflist(tabpagenr()) + for nr in s:get_visible_buffers() + if nr < 0 + call b.add_raw('%#airline_tabhid#...') + continue + endif + if cur == nr + if g:airline_detect_modified && getbufvar(nr, '&modified') + let group = 'airline_tabmod' + else + let group = 'airline_tabsel' + endif + let s:current_modified = (group == 'airline_tabmod') ? 1 : 0 + else + if index(tab_bufs, nr) > -1 + let group = 'airline_tab' + else + let group = 'airline_tabhid' + endif + endif + call b.add_section(group, s:spc.'%(%{airline#extensions#tabline#get_buffer_name('.nr.')}%)'.s:spc) + endfor + + call b.add_section('airline_tabfill', '') + call b.split() + call b.add_section('airline_tabtype', ' buffers ') + + let s:current_bufnr = cur + let s:current_tabline = b.build() + return s:current_tabline +endfunction + +function! s:get_tabs() + let curbuf = bufnr('%') + let curtab = tabpagenr() + if curbuf == s:current_bufnr && curtab == s:current_tabnr + if !g:airline_detect_modified || getbufvar(curbuf, '&modified') == s:current_modified + return s:current_tabline + endif + endif + + let b = airline#builder#new(s:builder_context) + for i in range(1, tabpagenr('$')) + if i == curtab + let group = 'airline_tabsel' + if g:airline_detect_modified + for bi in tabpagebuflist(i) + if getbufvar(bi, '&modified') + let group = 'airline_tabmod' + endif + endfor + endif + let s:current_modified = (group == 'airline_tabmod') ? 1 : 0 + else + let group = 'airline_tab' + endif + let val = '%(' + if s:show_tab_nr + if s:tab_nr_type == 0 + let val .= ' %{len(tabpagebuflist('.i.'))}' + else + let val .= (g:airline_symbols.space).i + endif + endif + call b.add_section(group, val.'%'.i.'T %{airline#extensions#tabline#title('.i.')} %)') + endfor + + call b.add_raw('%T') + call b.add_section('airline_tabfill', '') + call b.split() + call b.add_section('airline_tab', ' %999X'.s:close_symbol.' ') + if s:show_tab_type + call b.add_section('airline_tabtype', ' tabs ') + endif + + let s:current_bufnr = curbuf + let s:current_tabnr = curtab + let s:current_tabline = b.build() + return s:current_tabline +endfunction diff --git a/.vim/bundle/vim-airline/autoload/airline/extensions/tabline/default.vim b/.vim/bundle/vim-airline/autoload/airline/extensions/tabline/default.vim new file mode 100644 index 0000000..4f1ed40 --- /dev/null +++ b/.vim/bundle/vim-airline/autoload/airline/extensions/tabline/default.vim @@ -0,0 +1,35 @@ +" MIT License. Copyright (c) 2013-2014 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +let s:fmod = get(g:, 'airline#extensions#tabline#fnamemod', ':~:.') +let s:fnamecollapse = get(g:, 'airline#extensions#tabline#fnamecollapse', 1) +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#default#format(bufnr, buffers) + let _ = '' + + let name = bufname(a:bufnr) + if empty(name) + let _ .= '[No Name]' + else + if s:fnamecollapse + let _ .= substitute(fnamemodify(name, s:fmod), '\v\w\zs.{-}\ze(\\|/)', '', 'g') + else + let _ .= fnamemodify(name, s:fmod) + endif + endif + + return airline#extensions#tabline#default#wrap_name(a:bufnr, _) +endfunction + +function! airline#extensions#tabline#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/bundle/vim-airline/autoload/airline/extensions/tabline/unique_tail.vim b/.vim/bundle/vim-airline/autoload/airline/extensions/tabline/unique_tail.vim new file mode 100644 index 0000000..e4a790d --- /dev/null +++ b/.vim/bundle/vim-airline/autoload/airline/extensions/tabline/unique_tail.vim @@ -0,0 +1,27 @@ +" MIT License. Copyright (c) 2013-2014 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +function! airline#extensions#tabline#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, ':t') + if has_key(tails, tail) + let duplicates[nr] = nr + endif + let tails[tail] = 1 + let map[nr] = airline#extensions#tabline#default#wrap_name(nr, tail) + endif + endfor + + for nr in values(duplicates) + let map[nr] = airline#extensions#tabline#default#wrap_name(nr, fnamemodify(bufname(nr), ':p:.')) + endfor + + return map[a:bufnr] +endfunction diff --git a/.vim/bundle/vim-airline/autoload/airline/extensions/tabline/unique_tail_improved.vim b/.vim/bundle/vim-airline/autoload/airline/extensions/tabline/unique_tail_improved.vim new file mode 100644 index 0000000..6b13dcf --- /dev/null +++ b/.vim/bundle/vim-airline/autoload/airline/extensions/tabline/unique_tail_improved.vim @@ -0,0 +1,89 @@ +" MIT License. Copyright (c) 2013-2014 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +let s:skip_symbol = '…' + +function! airline#extensions#tabline#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#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 + 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#default#wrap_name(a:bufnr, join(buf_name, '/')) + else + return airline#extensions#tabline#default#format(a:bufnr, a:buffers) + endif +endfunction diff --git a/.vim/bundle/vim-airline/autoload/airline/extensions/tagbar.vim b/.vim/bundle/vim-airline/autoload/airline/extensions/tagbar.vim new file mode 100644 index 0000000..56919a8 --- /dev/null +++ b/.vim/bundle/vim-airline/autoload/airline/extensions/tagbar.vim @@ -0,0 +1,45 @@ +" MIT License. Copyright (c) 2013-2014 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +if !exists(':TagbarToggle') + finish +endif + +let s:flags = get(g:, 'airline#extensions#tagbar#flags', '') +let s:spc = g:airline_symbols.space + +" 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:airline_tagbar_last_lookup_time != localtime() + 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/bundle/vim-airline/autoload/airline/extensions/tmuxline.vim b/.vim/bundle/vim-airline/autoload/airline/extensions/tmuxline.vim new file mode 100644 index 0000000..363709b --- /dev/null +++ b/.vim/bundle/vim-airline/autoload/airline/extensions/tmuxline.vim @@ -0,0 +1,26 @@ +" MIT License. Copyright (c) 2013-2014 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +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/bundle/vim-airline/autoload/airline/extensions/undotree.vim b/.vim/bundle/vim-airline/autoload/airline/extensions/undotree.vim new file mode 100644 index 0000000..f577ffd --- /dev/null +++ b/.vim/bundle/vim-airline/autoload/airline/extensions/undotree.vim @@ -0,0 +1,27 @@ +" MIT License. Copyright (c) 2013-2014 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +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/bundle/vim-airline/autoload/airline/extensions/unite.vim b/.vim/bundle/vim-airline/autoload/airline/extensions/unite.vim new file mode 100644 index 0000000..d230b6f --- /dev/null +++ b/.vim/bundle/vim-airline/autoload/airline/extensions/unite.vim @@ -0,0 +1,23 @@ +" MIT License. Copyright (c) 2013-2014 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +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/bundle/vim-airline/autoload/airline/extensions/virtualenv.vim b/.vim/bundle/vim-airline/autoload/airline/extensions/virtualenv.vim new file mode 100644 index 0000000..f070c47 --- /dev/null +++ b/.vim/bundle/vim-airline/autoload/airline/extensions/virtualenv.vim @@ -0,0 +1,20 @@ +" MIT License. Copyright (c) 2013-2014 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +if !get(g:, 'virtualenv_loaded', 0) + finish +endif + +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" + call airline#extensions#append_to_section('x', + \ s:spc.g:airline_right_alt_sep.s:spc.'%{virtualenv#statusline()}') + endif +endfunction + diff --git a/.vim/bundle/vim-airline/autoload/airline/extensions/whitespace.vim.disable b/.vim/bundle/vim-airline/autoload/airline/extensions/whitespace.vim.disable new file mode 100644 index 0000000..8657412 --- /dev/null +++ b/.vim/bundle/vim-airline/autoload/airline/extensions/whitespace.vim.disable @@ -0,0 +1,103 @@ +" MIT License. Copyright (c) 2013-2014 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +" http://got-ravings.blogspot.com/2008/10/vim-pr0n-statusline-whitespace-flags.html + +" for backwards compatibility +if exists('g:airline_detect_whitespace') + let s:show_message = g:airline_detect_whitespace == 1 +else + let s:show_message = get(g:, 'airline#extensions#whitespace#show_message', 1) +endif + +let s:symbol = get(g:, 'airline#extensions#whitespace#symbol', g:airline_symbols.whitespace) +let s:default_checks = ['indent', 'trailing'] + +let s:trailing_format = get(g:, 'airline#extensions#whitespace#trailing_format', 'trailing[%s]') +let s:mixed_indent_format = get(g:, 'airline#extensions#whitespace#mixed_indent_format', 'mixed-indent[%s]') +let s:indent_algo = get(g:, 'airline#extensions#whitespace#mixed_indent_algo', 0) + +let s:max_lines = get(g:, 'airline#extensions#whitespace#max_lines', 20000) + +let s:enabled = get(g:, 'airline#extensions#whitespace#enabled', 1) + +function! s:check_mixed_indent() + if s: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 then tabstop value + let t_l_s = '(^\t+ {' . &ts . ',}' . '\S)' + return search('\v' . t_s_t . '|' . t_l_s, 'nw') + else + return search('\v(^\t+ +)|(^ +\t+)', 'nw') + endif +endfunction + +function! airline#extensions#whitespace#check() + if &readonly || !&modifiable || !s:enabled || line('$') > s:max_lines + return '' + endif + + if !exists('b:airline_whitespace_check') + let b:airline_whitespace_check = '' + let checks = get(g:, 'airline#extensions#whitespace#checks', s:default_checks) + + let trailing = 0 + if index(checks, 'trailing') > -1 + let trailing = search('\s$', 'nw') + endif + + let mixed = 0 + if index(checks, 'indent') > -1 + let mixed = s:check_mixed_indent() + endif + + if trailing != 0 || mixed != 0 + let b:airline_whitespace_check = s:symbol + if s:show_message + if trailing != 0 + let b:airline_whitespace_check .= (g:airline_symbols.space).printf(s:trailing_format, trailing) + endif + if mixed != 0 + let b:airline_whitespace_check .= (g:airline_symbols.space).printf(s:mixed_indent_format, mixed) + endif + endif + endif + endif + return b:airline_whitespace_check +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 + echo 'Whitespace checking: '.(s:enabled ? 'Enabled' : 'Disabled') +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 * unlet! b:airline_whitespace_check + augroup END +endfunction + |