mirror of
https://github.com/amix/vimrc
synced 2025-06-23 06:35:01 +08:00
Updated all the plugins. Removed powerline. Added vim-airline (replacement for powerline). Added vim-fugitive.
This commit is contained in:
@ -3,10 +3,9 @@
|
||||
" @Website: http://www.vim.org/account/profile.php?user_id=4037
|
||||
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
||||
" @Created: 2007-07-17.
|
||||
" @Last Change: 2010-01-03.
|
||||
" @Revision: 0.0.7
|
||||
" @Last Change: 2013-09-25.
|
||||
" @Revision: 0.0.12
|
||||
|
||||
" call tlog#Log('Load: '. expand('<sfile>')) " vimtlib-sfile
|
||||
|
||||
" Dummy file for backwards compatibility.
|
||||
" :nodefault:
|
||||
TLet g:tlib#debug = 0
|
||||
|
||||
|
@ -3,11 +3,11 @@
|
||||
" @Website: http://www.vim.org/account/profile.php?user_id=4037
|
||||
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
||||
" @Created: 2008-11-25.
|
||||
" @Last Change: 2012-09-26.
|
||||
" @Revision: 0.0.90
|
||||
" @Last Change: 2013-09-25.
|
||||
" @Revision: 0.0.92
|
||||
|
||||
let s:prototype = tlib#Object#New({'_class': ['Filter_cnf'], 'name': 'cnf'}) "{{{2
|
||||
let s:prototype.highlight = g:tlib_inputlist_higroup
|
||||
let s:prototype.highlight = g:tlib#input#higroup
|
||||
|
||||
" The search pattern for |tlib#input#List()| is in conjunctive normal
|
||||
" form: (P1 OR P2 ...) AND (P3 OR P4 ...) ...
|
||||
@ -33,7 +33,7 @@ endf
|
||||
" :nodoc:
|
||||
function! s:prototype.Help(world) dict "{{{3
|
||||
call a:world.PushHelp(
|
||||
\ printf('"%s", "%s", "%sWORD"', g:tlib_inputlist_and, g:tlib_inputlist_or, g:tlib_inputlist_not),
|
||||
\ printf('"%s", "%s", "%sWORD"', g:tlib#input#and, g:tlib#input#or, g:tlib#input#not),
|
||||
\ 'AND, OR, NOT')
|
||||
endf
|
||||
|
||||
|
@ -3,11 +3,11 @@
|
||||
" @Website: http://www.vim.org/account/profile.php?user_id=4037
|
||||
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
||||
" @Created: 2008-11-25.
|
||||
" @Last Change: 2012-09-20.
|
||||
" @Revision: 0.0.50
|
||||
" @Last Change: 2013-09-25.
|
||||
" @Revision: 0.0.51
|
||||
|
||||
let s:prototype = tlib#Filter_cnf#New({'_class': ['Filter_cnfd'], 'name': 'cnfd'}) "{{{2
|
||||
let s:prototype.highlight = g:tlib_inputlist_higroup
|
||||
let s:prototype.highlight = g:tlib#input#higroup
|
||||
|
||||
|
||||
" The same as |tlib#Filter_cnf#New()| but a dot is expanded to '\.\{-}'.
|
||||
|
@ -2,11 +2,11 @@
|
||||
" @Website: http://www.vim.org/account/profile.php?user_id=4037
|
||||
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
||||
" @Created: 2008-11-25.
|
||||
" @Last Change: 2012-09-20.
|
||||
" @Revision: 0.0.61
|
||||
" @Last Change: 2013-09-25.
|
||||
" @Revision: 0.0.62
|
||||
|
||||
let s:prototype = tlib#Filter_cnfd#New({'_class': ['Filter_cnfx'], 'name': 'cnfx'}) "{{{2
|
||||
let s:prototype.highlight = g:tlib_inputlist_higroup
|
||||
let s:prototype.highlight = g:tlib#input#higroup
|
||||
|
||||
|
||||
" A character that should be expanded to '\.\{-}'.
|
||||
|
@ -3,11 +3,11 @@
|
||||
" @Website: http://www.vim.org/account/profile.php?user_id=4037
|
||||
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
||||
" @Created: 2008-11-25.
|
||||
" @Last Change: 2012-09-20.
|
||||
" @Revision: 0.0.46
|
||||
" @Last Change: 2013-09-25.
|
||||
" @Revision: 0.0.47
|
||||
|
||||
let s:prototype = tlib#Filter_cnf#New({'_class': ['Filter_fuzzy'], 'name': 'fuzzy'}) "{{{2
|
||||
let s:prototype.highlight = g:tlib_inputlist_higroup
|
||||
let s:prototype.highlight = g:tlib#input#higroup
|
||||
|
||||
|
||||
" Support for "fuzzy" pattern matching in |tlib#input#List()|.
|
||||
|
@ -3,14 +3,34 @@
|
||||
" @Website: http://www.vim.org/account/profile.php?user_id=4037
|
||||
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
||||
" @Created: 2007-05-01.
|
||||
" @Last Change: 2012-10-03.
|
||||
" @Revision: 0.1.1203
|
||||
" @Last Change: 2013-09-26.
|
||||
" @Revision: 0.1.1297
|
||||
|
||||
" :filedoc:
|
||||
" A prototype used by |tlib#input#List|.
|
||||
" Inherits from |tlib#Object#New|.
|
||||
|
||||
|
||||
" Size of the input list window (in percent) from the main size (of &lines).
|
||||
" See |tlib#input#List()|.
|
||||
TLet g:tlib_inputlist_pct = 50
|
||||
|
||||
" Size of filename columns when listing filenames.
|
||||
" See |tlib#input#List()|.
|
||||
TLet g:tlib_inputlist_width_filename = '&co / 3'
|
||||
" TLet g:tlib_inputlist_width_filename = 25
|
||||
|
||||
" If true, |tlib#input#List()| will show some indicators about the
|
||||
" status of a filename (e.g. buflisted(), bufloaded() etc.).
|
||||
" This is disabled by default because vim checks also for the file on
|
||||
" disk when doing this.
|
||||
TLet g:tlib_inputlist_filename_indicators = 0
|
||||
|
||||
" If not null, display only a short info about the filter.
|
||||
TLet g:tlib_inputlist_shortmessage = 0
|
||||
|
||||
|
||||
|
||||
" Known keys & values:
|
||||
" scratch_split ... See |tlib#scratch#UseScratch()|
|
||||
let s:prototype = tlib#Object#New({
|
||||
@ -19,6 +39,7 @@ let s:prototype = tlib#Object#New({
|
||||
\ 'allow_suspend': 1,
|
||||
\ 'base': [],
|
||||
\ 'bufnr': -1,
|
||||
\ 'buffer_local': 1,
|
||||
\ 'cache_var': '',
|
||||
\ 'display_format': '',
|
||||
\ 'fileencoding': &fileencoding,
|
||||
@ -40,22 +61,26 @@ let s:prototype = tlib#Object#New({
|
||||
\ 'key_handlers': [],
|
||||
\ 'list': [],
|
||||
\ 'matcher': {},
|
||||
\ 'next_agent': '',
|
||||
\ 'next_eval': '',
|
||||
\ 'next_state': '',
|
||||
\ 'numeric_chars': tlib#var#Get('tlib_numeric_chars', 'bg'),
|
||||
\ 'numeric_chars': g:tlib#input#numeric_chars,
|
||||
\ 'offset': 1,
|
||||
\ 'offset_horizontal': 0,
|
||||
\ 'on_leave': [],
|
||||
\ 'pick_last_item': tlib#var#Get('tlib_pick_last_item', 'bg'),
|
||||
\ 'pick_last_item': tlib#var#Get('tlib#input#pick_last_item', 'bg'),
|
||||
\ 'post_handlers': [],
|
||||
\ 'query': '',
|
||||
\ 'resize': 0,
|
||||
\ 'resize_vertical': 0,
|
||||
\ 'restore_from_cache': [],
|
||||
\ 'filtered_items': [],
|
||||
\ 'retrieve_eval': '',
|
||||
\ 'return_agent': '',
|
||||
\ 'rv': '',
|
||||
\ 'scratch': '__InputList__',
|
||||
\ 'scratch_filetype': 'tlibInputList',
|
||||
\ 'scratch_hidden': g:tlib#scratch#hidden,
|
||||
\ 'scratch_vertical': 0,
|
||||
\ 'scratch_split': 1,
|
||||
\ 'sel_idx': [],
|
||||
@ -63,6 +88,7 @@ let s:prototype = tlib#Object#New({
|
||||
\ 'state': 'display',
|
||||
\ 'state_handlers': [],
|
||||
\ 'sticky': 0,
|
||||
\ 'temp_lines': [],
|
||||
\ 'temp_prompt': [],
|
||||
\ 'timeout': 0,
|
||||
\ 'timeout_resolution': 2,
|
||||
@ -77,7 +103,7 @@ let s:prototype = tlib#Object#New({
|
||||
|
||||
function! tlib#World#New(...)
|
||||
let object = s:prototype.New(a:0 >= 1 ? a:1 : {})
|
||||
call object.SetMatchMode(tlib#var#Get('tlib_inputlist_match', 'g', 'cnf'))
|
||||
call object.SetMatchMode(tlib#var#Get('tlib#input#filter_mode', 'g', 'cnf'))
|
||||
return object
|
||||
endf
|
||||
|
||||
@ -113,7 +139,7 @@ if g:tlib#input#format_filename == 'r'
|
||||
function! s:prototype.FormatFilename(file) dict "{{{3
|
||||
if !has_key(self.fmt_options, 'maxlen')
|
||||
let maxco = &co - len(len(self.base)) - eval(g:tlib#input#filename_padding_r)
|
||||
let maxfi = max(map(copy(self.base), 'len(v:val)'))
|
||||
let maxfi = max(map(copy(self.base), 'strwidth(v:val)'))
|
||||
let self.fmt_options.maxlen = min([maxco, maxfi])
|
||||
" TLogVAR maxco, maxfi, self.fmt_options.maxlen
|
||||
endif
|
||||
@ -135,11 +161,11 @@ else
|
||||
let self.width_filename = min([
|
||||
\ get(self, 'width_filename', &co),
|
||||
\ empty(g:tlib#input#filename_max_width) ? &co : eval(g:tlib#input#filename_max_width),
|
||||
\ max(map(copy(self.base), 'len(fnamemodify(v:val, ":t"))'))
|
||||
\ max(map(copy(self.base), 'strwidth(fnamemodify(v:val, ":t"))'))
|
||||
\ ])
|
||||
" TLogVAR self.width_filename
|
||||
exec 'syntax match TLibFilename /[^\/]\+$/ contained containedin=TLibDir'
|
||||
exec 'syntax match TLibDir /\%>'. (1 + self.width_filename) .'c \(|\|\[[^]]*\]\) \zs\(\(\a:\|\.\.\..\{-}\)\?[\/][^&<>*|]\{-}\)\?[^\/]\+$/ contained containedin=TLibMarker contains=TLibFilename'
|
||||
exec 'syntax match TLibDir /\%>'. (1 + self.width_filename) .'c \(|\|\[[^]]*\]\) \zs\(\(\a:\|\.\.\|\.\.\..\{-}\)\?[\/][^&<>*|]\{-}\)\?[^\/]\+$/ contained containedin=TLibMarker contains=TLibFilename'
|
||||
exec 'syntax match TLibMarker /\%>'. (1 + self.width_filename) .'c \(|\|\[[^]]*\]\) \S.*$/ contains=TLibDir'
|
||||
hi def link TLibMarker Special
|
||||
hi def link TLibDir Directory
|
||||
@ -154,10 +180,11 @@ else
|
||||
|
||||
" :nodoc:
|
||||
function! s:prototype.FormatFilename(file) dict "{{{3
|
||||
" TLogVAR a:file
|
||||
let width = self.width_filename
|
||||
let split = match(a:file, '[/\\]\zs[^/\\]\+$')
|
||||
if split == -1
|
||||
let fname = ''
|
||||
let fname = a:file
|
||||
let dname = a:file
|
||||
else
|
||||
let fname = strpart(a:file, split)
|
||||
@ -167,15 +194,17 @@ else
|
||||
if strwidth(fname) > width
|
||||
let fname = strpart(fname, 0, width - 3) .'...'
|
||||
endif
|
||||
let dnmax = &co - max([width, len(fname)]) - 10 - self.index_width - &fdc
|
||||
let dnmax = &co - max([width, strwidth(fname)]) - 10 - self.index_width - &fdc
|
||||
if g:tlib_inputlist_filename_indicators
|
||||
let dnmax -= 2
|
||||
endif
|
||||
if len(dname) > dnmax
|
||||
if strwidth(dname) > dnmax
|
||||
let dname = '...'. strpart(dname, len(dname) - dnmax)
|
||||
endif
|
||||
let marker = []
|
||||
if g:tlib_inputlist_filename_indicators
|
||||
let use_indicators = g:tlib_inputlist_filename_indicators || has_key(self, 'filename_indicators')
|
||||
" TLogVAR use_indicators
|
||||
if use_indicators
|
||||
call insert(marker, '[')
|
||||
let bnr = bufnr(a:file)
|
||||
" TLogVAR a:file, bnr, self.bufnr
|
||||
@ -194,14 +223,24 @@ else
|
||||
" if !buflisted(bnr)
|
||||
" call add(marker, 'u')
|
||||
" endif
|
||||
else
|
||||
" echom "DBG" a:file string(get(self,'filename_indicators'))
|
||||
endif
|
||||
if has_key(self, 'filename_indicators') && has_key(self.filename_indicators, a:file)
|
||||
if len(marker) > 1
|
||||
call add(marker, '|')
|
||||
endif
|
||||
call add(marker, self.filename_indicators[a:file])
|
||||
endif
|
||||
if len(marker) <= 1
|
||||
call add(marker, ' ')
|
||||
endif
|
||||
call add(marker, ']')
|
||||
else
|
||||
call add(marker, '|')
|
||||
endif
|
||||
return printf("%-". self.width_filename ."s %s %s", fname, join(marker, ''), dname)
|
||||
return printf("%-*s %s %s",
|
||||
\ self.width_filename + len(fname) - strwidth(fname),
|
||||
\ fname, join(marker, ''), dname)
|
||||
endf
|
||||
|
||||
endif
|
||||
@ -250,6 +289,26 @@ function! s:InsertSelectedItems(rv, current) "{{{3
|
||||
endf
|
||||
|
||||
|
||||
" :nodoc:
|
||||
function! s:prototype.SelectItemsByNames(mode, items) dict "{{{3
|
||||
for item in a:items
|
||||
let bi = index(self.base, item) + 1
|
||||
" TLogVAR item, bi
|
||||
if bi > 0
|
||||
let si = index(self.sel_idx, bi)
|
||||
" TLogVAR self.sel_idx
|
||||
" TLogVAR si
|
||||
if si == -1
|
||||
call add(self.sel_idx, bi)
|
||||
elseif a:mode == 'toggle'
|
||||
call remove(self.sel_idx, si)
|
||||
endif
|
||||
endif
|
||||
endfor
|
||||
return 1
|
||||
endf
|
||||
|
||||
|
||||
" :nodoc:
|
||||
function! s:prototype.SelectItem(mode, index) dict "{{{3
|
||||
let bi = self.GetBaseIdx(a:index)
|
||||
@ -292,7 +351,7 @@ function! s:prototype.GetRx0(...) dict "{{{3
|
||||
" TLogVAR filter
|
||||
let rx = join(reverse(filter(copy(filter), '!empty(v:val)')), '\|')
|
||||
" TLogVAR rx
|
||||
if !empty(rx) && (negative ? rx[0] == g:tlib_inputlist_not : rx[0] != g:tlib_inputlist_not)
|
||||
if !empty(rx) && (negative ? rx[0] == g:tlib#input#not : rx[0] != g:tlib#input#not)
|
||||
call add(rx0, rx)
|
||||
endif
|
||||
endfor
|
||||
@ -478,7 +537,7 @@ function! s:prototype.SetFilter() dict "{{{3
|
||||
let mrx1 = mrx
|
||||
endif
|
||||
" TLogVAR rx
|
||||
if rx[0] == g:tlib_inputlist_not
|
||||
if rx[0] == g:tlib#input#not
|
||||
if len(rx) > 1
|
||||
call add(self.filter_neg, mrx1 .'\('. rx[1:-1] .'\)')
|
||||
endif
|
||||
@ -513,7 +572,7 @@ function! s:prototype.SetMatchMode(match_mode) dict "{{{3
|
||||
let self.matcher = tlib#Filter_{a:match_mode}#New()
|
||||
call self.matcher.Init(self)
|
||||
catch /^Vim\%((\a\+)\)\=:E117/
|
||||
throw 'tlib: Unknown mode for tlib_inputlist_match: '. a:match_mode
|
||||
throw 'tlib: Unknown mode for tlib#input#filter_mode: '. a:match_mode
|
||||
endtry
|
||||
endif
|
||||
endf
|
||||
@ -542,18 +601,21 @@ function! s:prototype.BuildTableList() dict "{{{3
|
||||
" TLogVAR time0
|
||||
call self.SetFilter()
|
||||
" TLogVAR self.filter_neg, self.filter_pos
|
||||
if empty(self.filter_pos) && empty(self.filter_neg)
|
||||
let self.table = range(1, len(self.base))
|
||||
let self.table = range(1, len(self.base))
|
||||
" TLogVAR self.filtered_items
|
||||
let copy_base = 1
|
||||
if !empty(self.filtered_items)
|
||||
let self.table = filter(self.table, 'index(self.filtered_items, v:val) != -1')
|
||||
let copy_base = 0
|
||||
endif
|
||||
if !empty(self.filter_pos) || !empty(self.filter_neg)
|
||||
let self.table = filter(self.table, 'self.MatchBaseIdx(v:val)')
|
||||
let copy_base = 0
|
||||
endif
|
||||
if copy_base
|
||||
let self.list = copy(self.base)
|
||||
else
|
||||
" let time1 = str2float(reltimestr(reltime())) " DBG
|
||||
" TLogVAR time1, time1 - time0
|
||||
let self.table = filter(range(1, len(self.base)), 'self.MatchBaseIdx(v:val)')
|
||||
" let time2 = str2float(reltimestr(reltime())) " DBG
|
||||
" TLogVAR time2, time2 - time0
|
||||
let self.list = map(copy(self.table), 'self.GetBaseItem(v:val)')
|
||||
" let time3 = str2float(reltimestr(reltime())) " DBG
|
||||
" TLogVAR time3, time3 - time0
|
||||
endif
|
||||
endf
|
||||
|
||||
@ -634,7 +696,18 @@ endf
|
||||
|
||||
" :nodoc:
|
||||
function! s:prototype.UseScratch() dict "{{{3
|
||||
keepalt return tlib#scratch#UseScratch(self)
|
||||
" if type(self.scratch) != 0 && get(self, 'buffer_local', 1)
|
||||
" if self.scratch != fnamemodify(self.scratch, ':p')
|
||||
" let self.scratch = tlib#file#Join([expand('%:p:h'), self.scratch])
|
||||
" " TLogVAR self.scratch
|
||||
" endif
|
||||
" " let self.scratch_hidden = 'wipe'
|
||||
" endif
|
||||
keepjumps keepalt let rv = tlib#scratch#UseScratch(self)
|
||||
" if expand('%:t') == self.scratch
|
||||
let b:tlib_world = self
|
||||
" endif
|
||||
return rv
|
||||
endf
|
||||
|
||||
|
||||
@ -828,12 +901,12 @@ function! s:prototype.PushHelp(...) dict "{{{3
|
||||
" TLogVAR a:000
|
||||
if a:0 == 1
|
||||
if type(a:1) == 3
|
||||
let self._help += a:1
|
||||
let self.temp_lines += a:1
|
||||
else
|
||||
call add(self._help, a:1)
|
||||
call add(self.temp_lines, a:1)
|
||||
endif
|
||||
elseif a:0 == 2
|
||||
call add(self._help, a:000)
|
||||
call add(self.temp_lines, a:000)
|
||||
else
|
||||
throw "TLIB: PushHelp: Wrong number of arguments: ". string(a:000)
|
||||
endif
|
||||
@ -843,7 +916,7 @@ endf
|
||||
|
||||
" :nodoc:
|
||||
function! s:prototype.DisplayHelp() dict "{{{3
|
||||
let self._help = self.InitHelp()
|
||||
let self.temp_lines = self.InitHelp()
|
||||
call self.PushHelp('<Esc>', self.key_mode == 'default' ? 'Abort' : 'Reset keymap')
|
||||
call self.PushHelp('Enter, <cr>', 'Pick the current item')
|
||||
call self.PushHelp('<M-Number>', 'Pick an item')
|
||||
@ -861,14 +934,15 @@ function! s:prototype.DisplayHelp() dict "{{{3
|
||||
call self.PushHelp('<C-o>', 'Switch to origin')
|
||||
endif
|
||||
if stridx(self.type, 'm') != -1
|
||||
call self.PushHelp('<S-up/down>', '(Un)Select items')
|
||||
call self.PushHelp('<S-Up/Down>', '(Un)Select items')
|
||||
call self.PushHelp('#, <C-Space>', '(Un)Select the current item')
|
||||
call self.PushHelp('<C|M-a>', '(Un)Select all items')
|
||||
call self.PushHelp('<F9>', '(Un)Restrict view to selection')
|
||||
" \ '<c-\> ... Show only selected',
|
||||
endif
|
||||
endif
|
||||
|
||||
" TLogVAR len(self._help)
|
||||
" TLogVAR len(self.temp_lines)
|
||||
call self.matcher.Help(self)
|
||||
|
||||
" TLogVAR self.key_mode
|
||||
@ -893,20 +967,24 @@ function! s:prototype.DisplayHelp() dict "{{{3
|
||||
call self.PushHelp(self.help_extra)
|
||||
endif
|
||||
|
||||
" TLogVAR len(self._help)
|
||||
" TLogVAR len(self.temp_lines)
|
||||
call self.PushHelp([
|
||||
\ '',
|
||||
\ 'Matches at word boundaries are prioritized.',
|
||||
\ ])
|
||||
let self._help = s:FormatHelp(self._help)
|
||||
let self.temp_lines = s:FormatHelp(self.temp_lines)
|
||||
call self.PrintLines()
|
||||
endf
|
||||
|
||||
|
||||
function! s:prototype.PrintLines() dict "{{{3
|
||||
let self.temp_prompt = ['Press any key to continue.', 'Question']
|
||||
" call tlib#normal#WithRegister('gg"tdG', 't')
|
||||
call tlib#buffer#DeleteRange('1', '$')
|
||||
call append(0, self._help)
|
||||
" call tlib#normal#WithRegister('G"tddgg', 't')
|
||||
call append(0, self.temp_lines)
|
||||
call tlib#buffer#DeleteRange('$', '$')
|
||||
1
|
||||
call self.Resize(len(self._help), 0)
|
||||
call self.Resize(len(self.temp_lines), 0)
|
||||
let self.temp_lines = []
|
||||
endf
|
||||
|
||||
|
||||
@ -914,12 +992,14 @@ endf
|
||||
function! s:prototype.Resize(hsize, vsize) dict "{{{3
|
||||
" TLogVAR self.scratch_vertical, a:hsize, a:vsize
|
||||
let world_resize = ''
|
||||
let winpos = ''
|
||||
let scratch_split = get(self, 'scratch_split', 1)
|
||||
" TLogVAR scratch_split
|
||||
if scratch_split > 0
|
||||
if self.scratch_vertical
|
||||
if a:vsize
|
||||
let world_resize = 'vert resize '. a:vsize
|
||||
let winpos = tlib#fixes#Winpos()
|
||||
" let w:winresize = {'v': a:vsize}
|
||||
setlocal winfixwidth
|
||||
endif
|
||||
@ -932,8 +1012,11 @@ function! s:prototype.Resize(hsize, vsize) dict "{{{3
|
||||
endif
|
||||
endif
|
||||
if !empty(world_resize)
|
||||
" TLogVAR world_resize
|
||||
" TLogVAR world_resize, winpos
|
||||
exec world_resize
|
||||
if !empty(winpos)
|
||||
exec winpos
|
||||
endif
|
||||
" redraw!
|
||||
endif
|
||||
endf
|
||||
@ -971,6 +1054,9 @@ function! s:prototype.DisplayList(...) dict "{{{3
|
||||
elseif self.state == 'help'
|
||||
call self.DisplayHelp()
|
||||
call self.SetStatusline(query)
|
||||
elseif self.state == 'printlines'
|
||||
call self.PrintLines()
|
||||
call self.SetStatusline(query)
|
||||
else
|
||||
" TLogVAR query
|
||||
" let ll = len(list)
|
||||
@ -1042,6 +1128,13 @@ function! s:prototype.SetStatusline(query) dict "{{{3
|
||||
if self.key_mode != 'default'
|
||||
call add(options, 'map:'. self.key_mode)
|
||||
endif
|
||||
if !empty(self.filtered_items)
|
||||
if g:tlib_inputlist_shortmessage
|
||||
call add(options, 'R')
|
||||
else
|
||||
call add(options, 'restricted')
|
||||
endif
|
||||
endif
|
||||
if !empty(options)
|
||||
let sopts = printf('[%s]', join(options, ', '))
|
||||
" let echo = query . repeat(' ', &columns - len(sopts) - len(query) - 20) . sopts
|
||||
|
@ -3,13 +3,16 @@
|
||||
" @Website: http://www.vim.org/account/profile.php?user_id=4037
|
||||
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
||||
" @Created: 2007-06-24.
|
||||
" @Last Change: 2012-10-03.
|
||||
" @Revision: 0.1.208
|
||||
" @Last Change: 2013-09-26.
|
||||
" @Revision: 0.1.240
|
||||
|
||||
|
||||
" :filedoc:
|
||||
" Various agents for use as key handlers in tlib#input#List()
|
||||
|
||||
" Number of items to move when pressing <c-up/down> in the input list window.
|
||||
TLet g:tlib_scroll_lines = 10
|
||||
|
||||
|
||||
" General {{{1
|
||||
|
||||
@ -111,6 +114,36 @@ function! tlib#agent#Reset(world, selected) "{{{3
|
||||
endf
|
||||
|
||||
|
||||
function! tlib#agent#ToggleRestrictView(world, selected) "{{{3
|
||||
if empty(a:world.filtered_items)
|
||||
return tlib#agent#RestrictView(a:world, a:selected)
|
||||
else
|
||||
return tlib#agent#UnrestrictView(a:world, a:selected)
|
||||
endif
|
||||
endf
|
||||
|
||||
|
||||
function! tlib#agent#RestrictView(world, selected) "{{{3
|
||||
" TLogVAR a:selected
|
||||
let filtered_items = map(copy(a:selected), 'index(a:world.base, v:val) + 1')
|
||||
" TLogVAR 1, filtered_items
|
||||
let filtered_items = filter(filtered_items, 'v:val > 0')
|
||||
" TLogVAR 2, filtered_items
|
||||
if !empty(filtered_items)
|
||||
let a:world.filtered_items = filtered_items
|
||||
endif
|
||||
let a:world.state = 'display'
|
||||
return a:world
|
||||
endf
|
||||
|
||||
|
||||
function! tlib#agent#UnrestrictView(world, selected) "{{{3
|
||||
let a:world.filtered_items = []
|
||||
let a:world.state = 'display'
|
||||
return a:world
|
||||
endf
|
||||
|
||||
|
||||
function! tlib#agent#Input(world, selected) "{{{3
|
||||
let flt0 = a:world.CleanFilter(a:world.filter[0][0])
|
||||
let flt1 = input('Filter: ', flt0)
|
||||
@ -401,7 +434,11 @@ function! tlib#agent#EditFileInVSplit(world, selected) "{{{3
|
||||
call a:world.CloseScratch()
|
||||
" call tlib#file#With('edit', 'buffer', a:selected[0:0], a:world)
|
||||
" call tlib#file#With('vertical split', 'vertical sbuffer', a:selected[1:-1], a:world)
|
||||
let winpos = tlib#fixes#Winpos()
|
||||
call tlib#file#With('vertical split', 'vertical sbuffer', a:selected, a:world)
|
||||
if !empty(winpos)
|
||||
exec winpos
|
||||
endif
|
||||
return tlib#agent#Exit(a:world, a:selected)
|
||||
endf
|
||||
|
||||
@ -419,19 +456,18 @@ function! tlib#agent#ToggleScrollbind(world, selected) "{{{3
|
||||
return a:world
|
||||
endf
|
||||
|
||||
|
||||
function! tlib#agent#ShowInfo(world, selected)
|
||||
let lines = []
|
||||
for f in a:selected
|
||||
if filereadable(f)
|
||||
let desc = [getfperm(f), strftime('%c', getftime(f)), getfsize(f) .' bytes', getftype(f)]
|
||||
echo fnamemodify(f, ':t') .':'
|
||||
echo ' '. join(desc, '; ')
|
||||
call add(lines, fnamemodify(f, ':t') .':')
|
||||
call add(lines, ' '. join(desc, '; '))
|
||||
endif
|
||||
endfor
|
||||
echohl MoreMsg
|
||||
echo 'Press any key to continue'
|
||||
echohl NONE
|
||||
call getchar()
|
||||
let a:world.state = 'redisplay'
|
||||
let a:world.temp_lines = lines
|
||||
let a:world.state = 'printlines'
|
||||
return a:world
|
||||
endf
|
||||
|
||||
@ -530,8 +566,8 @@ function! tlib#agent#ExecAgentByName(world, selected) "{{{3
|
||||
let agent_names[def.help] = def.agent
|
||||
endif
|
||||
endfor
|
||||
let s:agent_names = join(sort(keys(agent_names)), "\n")
|
||||
let command = input('Command: ', '', 'custom,tlib#agent#CompleteAgentNames')
|
||||
let s:agent_names = sort(keys(agent_names))
|
||||
let command = input('Command: ', '', 'customlist,tlib#agent#CompleteAgentNames')
|
||||
" TLogVAR command
|
||||
if !has_key(agent_names, command)
|
||||
" TLogVAR command
|
||||
@ -558,6 +594,6 @@ endf
|
||||
|
||||
|
||||
function! tlib#agent#CompleteAgentNames(ArgLead, CmdLine, CursorPos)
|
||||
return s:agent_names
|
||||
return filter(copy(s:agent_names), 'stridx(v:val, a:ArgLead) != -1')
|
||||
endf
|
||||
|
||||
|
@ -2,13 +2,7 @@
|
||||
" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim])
|
||||
" @Website: http://www.vim.org/account/profile.php?user_id=4037
|
||||
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
||||
" @Created: 2008-08-19.
|
||||
" @Last Change: 2010-01-05.
|
||||
" @Revision: 0.0.6
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
" @Revision: 7
|
||||
|
||||
augroup TLib
|
||||
autocmd!
|
||||
@ -18,6 +12,3 @@ augroup END
|
||||
function! tlib#autocmdgroup#Init() "{{{3
|
||||
endf
|
||||
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
@ -4,7 +4,7 @@
|
||||
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
||||
" @Created: 2010-08-30.
|
||||
" @Last Change: 2010-09-05.
|
||||
" @Revision: 23
|
||||
" @Revision: 27
|
||||
|
||||
|
||||
function! tlib#balloon#Register(expr) "{{{3
|
||||
@ -37,10 +37,12 @@ endf
|
||||
|
||||
|
||||
function! tlib#balloon#Expr() "{{{3
|
||||
" TLogVAR exists('b:tlib_balloons')
|
||||
if !exists('b:tlib_balloons')
|
||||
return ''
|
||||
endif
|
||||
let text = map(copy(b:tlib_balloons), 'eval(v:val)')
|
||||
" TLogVAR b:tlib_balloons, text
|
||||
call filter(text, '!empty(v:val)')
|
||||
if has('balloon_multiline')
|
||||
return join(text, "\n----------------------------------\n")
|
||||
|
141
sources_non_forked/tlib/autoload/tlib/bitwise.vim
Normal file
141
sources_non_forked/tlib/autoload/tlib/bitwise.vim
Normal file
@ -0,0 +1,141 @@
|
||||
" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim])
|
||||
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
||||
" @Revision: 124
|
||||
|
||||
|
||||
function! tlib#bitwise#Num2Bits(num) "{{{3
|
||||
if type(a:num) <= 1 || type(a:num) == 5
|
||||
let bits = reverse(tlib#number#ConvertBase(a:num, 2, 'list'))
|
||||
elseif type(a:num) == 3
|
||||
let bits = copy(a:num)
|
||||
else
|
||||
throw "tlib#bitwise#Num2Bits: Must be number of list: ". string(a:num)
|
||||
endif
|
||||
return bits
|
||||
endf
|
||||
|
||||
|
||||
function! tlib#bitwise#Bits2Num(bits, ...) "{{{3
|
||||
let base = a:0 >= 1 ? a:1 : 10
|
||||
" TLogVAR a:bits
|
||||
let num = 0.0
|
||||
for i in range(len(a:bits))
|
||||
if get(a:bits, i, 0)
|
||||
let num += pow(2, i)
|
||||
endif
|
||||
endfor
|
||||
" TLogVAR num
|
||||
if base == 10
|
||||
if type(base) == 5
|
||||
return num
|
||||
else
|
||||
return float2nr(num)
|
||||
endif
|
||||
else
|
||||
return tlib#number#ConvertBase(num, base)
|
||||
endif
|
||||
endf
|
||||
|
||||
|
||||
function! tlib#bitwise#AND(num1, num2, ...) "{{{3
|
||||
let rtype = a:0 >= 1 ? a:1 : 'num'
|
||||
return s:BitwiseComparison(a:num1, a:num2, rtype,
|
||||
\ 'get(bits1, v:val) && get(bits2, v:val)')
|
||||
endf
|
||||
|
||||
|
||||
function! tlib#bitwise#OR(num1, num2, ...) "{{{3
|
||||
let rtype = a:0 >= 1 ? a:1 : 'num'
|
||||
return s:BitwiseComparison(a:num1, a:num2, rtype,
|
||||
\ 'get(bits1, v:val) || get(bits2, v:val)')
|
||||
endf
|
||||
|
||||
|
||||
function! tlib#bitwise#XOR(num1, num2, ...) "{{{3
|
||||
let rtype = a:0 >= 1 ? a:1 : 'num'
|
||||
return s:BitwiseComparison(a:num1, a:num2, rtype,
|
||||
\ 'get(bits1, v:val) ? !get(bits2, v:val) : get(bits2, v:val)')
|
||||
endf
|
||||
|
||||
|
||||
function! s:BitwiseComparison(num1, num2, rtype, expr) "{{{3
|
||||
let bits1 = tlib#bitwise#Num2Bits(a:num1)
|
||||
let bits2 = tlib#bitwise#Num2Bits(a:num2)
|
||||
let range = range(max([len(bits1), len(bits2)]))
|
||||
let bits = map(range, a:expr)
|
||||
if a:rtype == 'num' || (a:rtype == 'auto' && type(a:num1) <= 1)
|
||||
return tlib#bitwise#Bits2Num(bits)
|
||||
else
|
||||
return bits
|
||||
endif
|
||||
endf
|
||||
|
||||
|
||||
function! tlib#bitwise#ShiftRight(bits, n) "{{{3
|
||||
let bits = a:bits[a:n : -1]
|
||||
if empty(bits)
|
||||
let bits = [0]
|
||||
endif
|
||||
return bits
|
||||
endf
|
||||
|
||||
|
||||
function! tlib#bitwise#ShiftLeft(bits, n) "{{{3
|
||||
let bits = repeat([0], a:n) + a:bits
|
||||
return bits
|
||||
endf
|
||||
|
||||
|
||||
function! tlib#bitwise#Add(num1, num2, ...) "{{{3
|
||||
let rtype = a:0 >= 1 ? a:1 : 'num'
|
||||
let bits1 = tlib#bitwise#Num2Bits(a:num1)
|
||||
let bits2 = tlib#bitwise#Num2Bits(a:num2)
|
||||
let range = range(max([len(bits1), len(bits2)]))
|
||||
" TLogVAR bits1, bits2, range
|
||||
let carry = 0
|
||||
let bits = []
|
||||
for i in range
|
||||
let sum = get(bits1, i) + get(bits2, i) + carry
|
||||
if sum == 3
|
||||
let bit = 1
|
||||
let carry = 1
|
||||
elseif sum == 2
|
||||
let bit = 0
|
||||
let carry = 1
|
||||
elseif sum == 1
|
||||
let bit = 1
|
||||
let carry = 0
|
||||
elseif sum == 0
|
||||
let bit = 0
|
||||
let carry = 0
|
||||
endif
|
||||
call add(bits, bit)
|
||||
" TLogVAR i, bits, bit
|
||||
endfor
|
||||
if carry == 1
|
||||
call add(bits, carry)
|
||||
endif
|
||||
if rtype == 'num' || (rtype == 'auto' && type(a:num1) <= 1)
|
||||
return tlib#bitwise#Bits2Num(bits)
|
||||
else
|
||||
return bits
|
||||
endif
|
||||
endf
|
||||
|
||||
|
||||
function! tlib#bitwise#Sub(num1, num2, ...) "{{{3
|
||||
let rtype = a:0 >= 1 ? a:1 : 'num'
|
||||
let bits1 = tlib#bitwise#Num2Bits(a:num1)
|
||||
let bits2 = tlib#bitwise#Num2Bits(a:num2)
|
||||
let range = range(max([len(bits1), len(bits2)]))
|
||||
let bits2 = map(range, '!get(bits2, v:val)')
|
||||
let bits2 = tlib#bitwise#Add(bits2, [1], 'bits')
|
||||
let bits3 = tlib#bitwise#Add(bits1, bits2, 'bits')
|
||||
let bits = bits3[0 : -2]
|
||||
if rtype == 'num' || (rtype == 'auto' && type(a:num1) <= 1)
|
||||
return tlib#bitwise#Bits2Num(bits)
|
||||
else
|
||||
return bits
|
||||
endif
|
||||
endf
|
||||
|
@ -3,8 +3,13 @@
|
||||
" @Website: http://www.vim.org/account/profile.php?user_id=4037
|
||||
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
||||
" @Created: 2007-06-30.
|
||||
" @Last Change: 2012-02-09.
|
||||
" @Revision: 0.0.351
|
||||
" @Last Change: 2013-09-25.
|
||||
" @Revision: 0.0.352
|
||||
|
||||
|
||||
" Where to display the line when using |tlib#buffer#ViewLine|.
|
||||
" For possible values for position see |scroll-cursor|.
|
||||
TLet g:tlib_viewline_position = 'zz'
|
||||
|
||||
|
||||
let s:bmru = []
|
||||
|
@ -3,10 +3,16 @@
|
||||
" @Website: http://www.vim.org/account/profile.php?user_id=4037
|
||||
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
||||
" @Created: 2007-06-30.
|
||||
" @Last Change: 2012-05-11.
|
||||
" @Revision: 0.1.192
|
||||
" @Last Change: 2013-09-25.
|
||||
" @Revision: 0.1.220
|
||||
|
||||
|
||||
" The cache directory. If empty, use |tlib#dir#MyRuntime|.'/cache'.
|
||||
" You might want to delete old files from this directory from time to
|
||||
" time with a command like: >
|
||||
" find ~/vimfiles/cache/ -atime +31 -type f -print -delete
|
||||
TLet g:tlib_cache = ''
|
||||
|
||||
" |tlib#cache#Purge()|: Remove cache files older than N days.
|
||||
TLet g:tlib#cache#purge_days = 31
|
||||
|
||||
@ -24,15 +30,21 @@ TLet g:tlib#cache#script_encoding = &enc
|
||||
" 2 ... Yes
|
||||
TLet g:tlib#cache#run_script = 1
|
||||
|
||||
" If non-nil, don't display a message that files were deleted from the
|
||||
" cache.
|
||||
TLet g:tlib#cache#silent = 0
|
||||
" Verbosity level:
|
||||
" 0 ... Be quiet
|
||||
" 1 ... Display informative message
|
||||
" 2 ... Display detailed messages
|
||||
TLet g:tlib#cache#verbosity = 1
|
||||
|
||||
" A list of regexps that are matched against partial filenames of the
|
||||
" cached files. If a regexp matches, the file won't be removed by
|
||||
" |tlib#cache#Purge()|.
|
||||
TLet g:tlib#cache#dont_purge = ['[\/]\.last_purge$']
|
||||
|
||||
" If the cache filename is longer than N characters, use
|
||||
" |pathshorten()|.
|
||||
TLet g:tlib#cache#max_filename = 200
|
||||
|
||||
|
||||
" :display: tlib#cache#Dir(?mode = 'bg')
|
||||
" The default cache directory.
|
||||
@ -49,7 +61,8 @@ endf
|
||||
" :def: function! tlib#cache#Filename(type, ?file=%, ?mkdir=0, ?dir='')
|
||||
function! tlib#cache#Filename(type, ...) "{{{3
|
||||
" TLogDBG 'bufname='. bufname('.')
|
||||
let dir = a:0 >= 3 && !empty(a:3) ? a:3 : tlib#cache#Dir()
|
||||
let dir0 = a:0 >= 3 && !empty(a:3) ? a:3 : tlib#cache#Dir()
|
||||
let dir = dir0
|
||||
if a:0 >= 1 && !empty(a:1)
|
||||
let file = a:1
|
||||
else
|
||||
@ -73,18 +86,23 @@ function! tlib#cache#Filename(type, ...) "{{{3
|
||||
" TLogVAR dir
|
||||
let file = fnamemodify(file, ':t')
|
||||
" TLogVAR file, dir, mkdir
|
||||
if mkdir && !isdirectory(dir)
|
||||
try
|
||||
call mkdir(dir, 'p')
|
||||
catch /^Vim\%((\a\+)\)\=:E739:/
|
||||
if filereadable(dir) && !isdirectory(dir)
|
||||
echoerr 'TLib: Cannot create directory for cache file because a file with the same name exists (please delete it):' dir
|
||||
" call delete(dir)
|
||||
" call mkdir(dir, 'p')
|
||||
endif
|
||||
endtry
|
||||
endif
|
||||
let cache_file = tlib#file#Join([dir, file])
|
||||
if len(cache_file) > g:tlib#cache#max_filename
|
||||
let shortfilename = pathshorten(file) .'_'. tlib#hash#Adler32(file)
|
||||
let cache_file = tlib#cache#Filename(a:type, shortfilename, mkdir, dir0)
|
||||
else
|
||||
if mkdir && !isdirectory(dir)
|
||||
try
|
||||
call mkdir(dir, 'p')
|
||||
catch /^Vim\%((\a\+)\)\=:E739:/
|
||||
if filereadable(dir) && !isdirectory(dir)
|
||||
echoerr 'TLib: Cannot create directory for cache file because a file with the same name exists (please delete it):' dir
|
||||
" call delete(dir)
|
||||
" call mkdir(dir, 'p')
|
||||
endif
|
||||
endtry
|
||||
endif
|
||||
endif
|
||||
" TLogVAR cache_file
|
||||
return cache_file
|
||||
endf
|
||||
@ -101,6 +119,22 @@ function! tlib#cache#Get(cfile) "{{{3
|
||||
endf
|
||||
|
||||
|
||||
" Get a cached value from cfile. If it is outdated (compared to ftime)
|
||||
" or does not exist, create it calling a generator function.
|
||||
function! tlib#cache#Value(cfile, generator, ftime, ...) "{{{3
|
||||
if !filereadable(a:cfile) || (a:ftime != 0 && getftime(a:cfile) < a:ftime)
|
||||
let args = a:0 >= 1 ? a:1 : []
|
||||
let val = call(a:generator, args)
|
||||
" TLogVAR a:generator, args, val
|
||||
call tlib#cache#Save(a:cfile, {'val': val})
|
||||
return val
|
||||
else
|
||||
let val = tlib#cache#Get(a:cfile)
|
||||
return val.val
|
||||
endif
|
||||
endf
|
||||
|
||||
|
||||
" Call |tlib#cache#Purge()| if the last purge was done before
|
||||
" |g:tlib#cache#purge_every_days|.
|
||||
function! tlib#cache#MaybePurge() "{{{3
|
||||
@ -144,7 +178,7 @@ endf
|
||||
function! tlib#cache#Purge() "{{{3
|
||||
let threshold = localtime() - g:tlib#cache#purge_days * g:tlib#date#dayshift
|
||||
let dir = tlib#cache#Dir('g')
|
||||
if !g:tlib#cache#silent
|
||||
if g:tlib#cache#verbosity >= 1
|
||||
echohl WarningMsg
|
||||
echom "TLib: Delete files older than ". g:tlib#cache#purge_days ." days from ". dir
|
||||
echohl NONE
|
||||
@ -165,7 +199,7 @@ function! tlib#cache#Purge() "{{{3
|
||||
if getftime(file) < threshold
|
||||
if delete(file)
|
||||
call add(msg, "TLib: Could not delete cache file: ". file)
|
||||
else
|
||||
elseif g:tlib#cache#verbosity >= 2
|
||||
call add(msg, "TLib: Delete cache file: ". file)
|
||||
endif
|
||||
else
|
||||
@ -176,7 +210,7 @@ function! tlib#cache#Purge() "{{{3
|
||||
finally
|
||||
let &more = more
|
||||
endtry
|
||||
if !empty(msg) && !g:tlib#cache#silent
|
||||
if !empty(msg) && g:tlib#cache#verbosity >= 1
|
||||
echo join(msg, "\n")
|
||||
endif
|
||||
if !empty(deldir)
|
||||
@ -202,12 +236,14 @@ function! tlib#cache#Purge() "{{{3
|
||||
call writefile(script, scriptfile)
|
||||
call inputsave()
|
||||
if g:tlib#cache#run_script == 0
|
||||
echohl WarningMsg
|
||||
if g:tlib#cache#silent
|
||||
echom "TLib: Purged cache. Need to run script to delete directories"
|
||||
if g:tlib#cache#verbosity >= 1
|
||||
echohl WarningMsg
|
||||
if g:tlib#cache#verbosity >= 2
|
||||
echom "TLib: Purged cache. Need to run script to delete directories"
|
||||
endif
|
||||
echom "TLib: Please review and execute: ". scriptfile
|
||||
echohl NONE
|
||||
endif
|
||||
echom "TLib: Please review and execute: ". scriptfile
|
||||
echohl NONE
|
||||
else
|
||||
try
|
||||
let yn = g:tlib#cache#run_script == 2 ? 'y' : tlib#input#Dialog("TLib: About to delete directories by means of a shell script.\nDirectory removal script: ". scriptfile ."\nRun script to delete directories now?", ['yes', 'no', 'edit'], 'no')
|
||||
|
@ -3,8 +3,8 @@
|
||||
" @Website: http://www.vim.org/account/profile.php?user_id=4037
|
||||
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
||||
" @Created: 2007-08-23.
|
||||
" @Last Change: 2012-02-10.
|
||||
" @Revision: 0.0.35
|
||||
" @Last Change: 2013-05-14.
|
||||
" @Revision: 0.0.46
|
||||
|
||||
if &cp || exists("loaded_tlib_cmd_autoload")
|
||||
finish
|
||||
@ -17,12 +17,20 @@ let g:tlib#cmd#last_output = []
|
||||
|
||||
function! tlib#cmd#OutputAsList(command) "{{{3
|
||||
" TLogVAR a:command
|
||||
" let lines = ''
|
||||
redir => lines
|
||||
if exists('s:redir_lines')
|
||||
redir END
|
||||
let cache = s:redir_lines
|
||||
endif
|
||||
let s:redir_lines = ''
|
||||
redir =>> s:redir_lines
|
||||
silent! exec a:command
|
||||
redir END
|
||||
" TLogVAR lines
|
||||
let g:tlib#cmd#last_output = split(lines, '\n')
|
||||
let g:tlib#cmd#last_output = split(s:redir_lines, '\n')
|
||||
unlet s:redir_lines
|
||||
if exists('cache')
|
||||
let s:redir_lines = cache
|
||||
redir =>> s:redir_lines
|
||||
endif
|
||||
return g:tlib#cmd#last_output
|
||||
endf
|
||||
|
||||
|
@ -3,14 +3,18 @@
|
||||
" @Website: http://www.vim.org/account/profile.php?user_id=4037
|
||||
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
||||
" @Created: 2007-06-30.
|
||||
" @Last Change: 2009-08-04.
|
||||
" @Revision: 0.0.32
|
||||
" @Last Change: 2013-09-25.
|
||||
" @Revision: 0.0.37
|
||||
|
||||
if &cp || exists("loaded_tlib_dir_autoload")
|
||||
finish
|
||||
endif
|
||||
let loaded_tlib_dir_autoload = 1
|
||||
|
||||
" TLet g:tlib#dir#sep = '/'
|
||||
TLet g:tlib#dir#sep = exists('+shellslash') && !&shellslash ? '\' : '/'
|
||||
|
||||
|
||||
let s:dir_stack = []
|
||||
|
||||
" EXAMPLES: >
|
||||
@ -18,12 +22,25 @@ let s:dir_stack = []
|
||||
" => 'foo/bar/'
|
||||
function! tlib#dir#CanonicName(dirname) "{{{3
|
||||
if a:dirname !~ '[/\\]$'
|
||||
return a:dirname . g:tlib_filename_sep
|
||||
return a:dirname . g:tlib#dir#sep
|
||||
endif
|
||||
return a:dirname
|
||||
endf
|
||||
|
||||
|
||||
" EXAMPLES: >
|
||||
" tlib#dir#NativeName('foo/bar/')
|
||||
" On Windows:
|
||||
" => 'foo\bar\'
|
||||
" On Linux:
|
||||
" => 'foo/bar/'
|
||||
function! tlib#dir#NativeName(dirname) "{{{3
|
||||
let sep = tlib#rx#EscapeReplace(g:tlib#dir#sep)
|
||||
let dirname = substitute(a:dirname, '[\/]', sep, 'g')
|
||||
return dirname
|
||||
endf
|
||||
|
||||
|
||||
" EXAMPLES: >
|
||||
" tlib#dir#PlainName('foo/bar/')
|
||||
" => 'foo/bar'
|
||||
@ -33,7 +50,7 @@ function! tlib#dir#PlainName(dirname) "{{{3
|
||||
let dirname = dirname[0 : -2]
|
||||
endwh
|
||||
return dirname
|
||||
" return substitute(a:dirname, tlib#rx#Escape(g:tlib_filename_sep).'\+$', '', '')
|
||||
" return substitute(a:dirname, tlib#rx#Escape(g:tlib#dir#sep).'\+$', '', '')
|
||||
endf
|
||||
|
||||
|
||||
|
@ -3,8 +3,8 @@
|
||||
" @Website: http://www.vim.org/account/profile.php?user_id=4037
|
||||
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
||||
" @Created: 2007-06-30.
|
||||
" @Last Change: 2012-03-23.
|
||||
" @Revision: 0.0.106
|
||||
" @Last Change: 2013-09-25.
|
||||
" @Revision: 0.0.141
|
||||
|
||||
if &cp || exists("loaded_tlib_file_autoload")
|
||||
finish
|
||||
@ -42,13 +42,15 @@ endf
|
||||
" => 'foo/bar/filename.txt'
|
||||
function! tlib#file#Join(filename_parts, ...) "{{{3
|
||||
TVarArg 'strip_slashes'
|
||||
" TLogVAR a:filename_parts, strip_slashes
|
||||
if strip_slashes
|
||||
" let rx = tlib#rx#Escape(g:tlib_filename_sep) .'$'
|
||||
let rx = '[/\\]$'
|
||||
" let rx = tlib#rx#Escape(g:tlib#dir#sep) .'$'
|
||||
let rx = '[/\\]\+$'
|
||||
let parts = map(copy(a:filename_parts), 'substitute(v:val, rx, "", "")')
|
||||
return join(parts, g:tlib_filename_sep)
|
||||
" TLogVAR parts
|
||||
return join(parts, g:tlib#dir#sep)
|
||||
else
|
||||
return join(a:filename_parts, g:tlib_filename_sep)
|
||||
return join(a:filename_parts, g:tlib#dir#sep)
|
||||
endif
|
||||
endf
|
||||
|
||||
@ -60,14 +62,14 @@ function! tlib#file#Relative(filename, basedir) "{{{3
|
||||
" TLogVAR a:filename, a:basedir
|
||||
" TLogDBG getcwd()
|
||||
" TLogDBG expand('%:p')
|
||||
let f0 = fnamemodify(a:filename, ':p')
|
||||
let b0 = tlib#file#Absolute(a:basedir)
|
||||
let b = tlib#file#Split(b0)
|
||||
" TLogVAR b
|
||||
let f0 = tlib#file#Absolute(a:filename)
|
||||
let fn = fnamemodify(f0, ':t')
|
||||
let fd = fnamemodify(f0, ':h')
|
||||
let f = tlib#file#Split(fd)
|
||||
" TLogVAR f
|
||||
let b0 = fnamemodify(a:basedir, ':p')
|
||||
let b = tlib#file#Split(b0)
|
||||
" TLogVAR b
|
||||
" TLogVAR f0, fn, fd, f
|
||||
if f[0] != b[0]
|
||||
let rv = f0
|
||||
else
|
||||
@ -78,6 +80,7 @@ function! tlib#file#Relative(filename, basedir) "{{{3
|
||||
call remove(f, 0)
|
||||
call remove(b, 0)
|
||||
endwh
|
||||
" TLogVAR f, b
|
||||
let rv = tlib#file#Join(repeat(['..'], len(b)) + f + [fn])
|
||||
endif
|
||||
" TLogVAR rv
|
||||
@ -85,6 +88,21 @@ function! tlib#file#Relative(filename, basedir) "{{{3
|
||||
endf
|
||||
|
||||
|
||||
function! tlib#file#Absolute(filename, ...) "{{{3
|
||||
if filereadable(a:filename)
|
||||
let filename = fnamemodify(a:filename, ':p')
|
||||
elseif a:filename =~ '^\(/\|[^\/]\+:\)'
|
||||
let filename = a:filename
|
||||
else
|
||||
let cwd = a:0 >= 1 ? a:1 : getcwd()
|
||||
let filename = tlib#file#Join([cwd, a:filename])
|
||||
endif
|
||||
let filename = substitute(filename, '\(^\|[\/]\)\zs\.[\/]', '', 'g')
|
||||
let filename = substitute(filename, '[\/]\zs[^\/]\+[\/]\.\.[\/]', '', 'g')
|
||||
return filename
|
||||
endf
|
||||
|
||||
|
||||
function! s:SetScrollBind(world) "{{{3
|
||||
let sb = get(a:world, 'scrollbind', &scrollbind)
|
||||
if sb != &scrollbind
|
||||
@ -118,7 +136,7 @@ function! tlib#file#With(fcmd, bcmd, files, ...) "{{{3
|
||||
if filereadable(f)
|
||||
if !empty(a:fcmd)
|
||||
" TLogDBG a:fcmd .' '. tlib#arg#Ex(f)
|
||||
exec 'autocmd TLibFileRead BufRead' escape(f, ' ') 'let s:bufread=expand("<afile>:p")'
|
||||
exec 'autocmd TLibFileRead BufRead' escape(f, '\ ') 'let s:bufread=expand("<afile>:p")'
|
||||
try
|
||||
exec a:fcmd .' '. tlib#arg#Ex(f)
|
||||
finally
|
||||
|
14
sources_non_forked/tlib/autoload/tlib/fixes.vim
Normal file
14
sources_non_forked/tlib/autoload/tlib/fixes.vim
Normal file
@ -0,0 +1,14 @@
|
||||
" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim])
|
||||
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
||||
" @Last Change: 2013-02-22.
|
||||
" @Revision: 3
|
||||
|
||||
|
||||
function! tlib#fixes#Winpos() "{{{3
|
||||
if has('gui_win32')
|
||||
return 'winpos '. getwinposx() .' '. getwinposy()
|
||||
else
|
||||
return ''
|
||||
endif
|
||||
endf
|
||||
|
38
sources_non_forked/tlib/autoload/tlib/grep.vim
Normal file
38
sources_non_forked/tlib/autoload/tlib/grep.vim
Normal file
@ -0,0 +1,38 @@
|
||||
" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim])
|
||||
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
||||
" @Last Change: 2013-10-16.
|
||||
" @Revision: 31
|
||||
|
||||
|
||||
function! tlib#grep#Do(cmd, rx, files) "{{{3
|
||||
" TLogVAR a:cmd, a:rx, a:files
|
||||
let files = join(map(copy(a:files), 'tlib#arg#Ex(v:val, "")'), ' ')
|
||||
let rx = '/'. escape(a:rx, '/') .'/j'
|
||||
" TLogVAR rx, files
|
||||
silent exec a:cmd rx files
|
||||
endf
|
||||
|
||||
|
||||
function! tlib#grep#LocList(rx, files) "{{{3
|
||||
return tlib#grep#Do('noautocmd lvimgrep', a:rx, a:files)
|
||||
endf
|
||||
|
||||
|
||||
function! tlib#grep#QuickFixList(rx, files) "{{{3
|
||||
return tlib#grep#Do('noautocmd vimgrep', a:rx, a:files)
|
||||
endf
|
||||
|
||||
|
||||
function! tlib#grep#List(rx, files) "{{{3
|
||||
call setqflist([])
|
||||
call tlib#grep#Do('noautocmd vimgrepadd', a:rx, a:files)
|
||||
let qfl = getqflist()
|
||||
" TLogVAR qfl
|
||||
" try
|
||||
silent! colder
|
||||
" catch
|
||||
" call setqflist([], 'r')
|
||||
" endtry
|
||||
return qfl
|
||||
endf
|
||||
|
145
sources_non_forked/tlib/autoload/tlib/hash.vim
Normal file
145
sources_non_forked/tlib/autoload/tlib/hash.vim
Normal file
@ -0,0 +1,145 @@
|
||||
" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim])
|
||||
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
||||
" @Revision: 276
|
||||
|
||||
|
||||
if !exists('g:tlib#hash#use_crc32')
|
||||
let g:tlib#hash#use_crc32 = '' "{{{2
|
||||
endif
|
||||
|
||||
|
||||
if !exists('g:tlib#hash#use_adler32')
|
||||
let g:tlib#hash#use_adler32 = '' "{{{2
|
||||
endif
|
||||
|
||||
|
||||
function! tlib#hash#CRC32B(chars) "{{{3
|
||||
if !empty(g:tlib#hash#use_crc32)
|
||||
let use = g:tlib#hash#use_crc32
|
||||
elseif has('ruby')
|
||||
let use = 'ruby'
|
||||
else
|
||||
let use = 'vim'
|
||||
endif
|
||||
if exists('*tlib#hash#CRC32B_'. use)
|
||||
return tlib#hash#CRC32B_{use}(a:chars)
|
||||
else
|
||||
throw "Unknown version of tlib#hash#CRC32B: ". use
|
||||
endif
|
||||
endf
|
||||
|
||||
|
||||
function! tlib#hash#CRC32B_ruby(chars) "{{{3
|
||||
if has('ruby')
|
||||
let rv = ''
|
||||
if !exists('s:loaded_ruby_zlib')
|
||||
ruby require 'zlib'
|
||||
let s:loaded_ruby_zlib = 1
|
||||
endif
|
||||
ruby VIM::command('let rv = "%08X"' % Zlib.crc32(VIM::evaluate("a:chars")))
|
||||
return rv
|
||||
else
|
||||
throw "tlib#hash#CRC32B_ruby not supported in this version of vim"
|
||||
endif
|
||||
endf
|
||||
|
||||
|
||||
function! tlib#hash#CRC32B_vim(chars) "{{{3
|
||||
if !exists('s:crc_table')
|
||||
let cfile = tlib#persistent#Filename('tlib', 'crc_table', 1)
|
||||
let s:crc_table = tlib#persistent#Value(cfile, 'tlib#hash#CreateCrcTable', 0)
|
||||
endif
|
||||
let xFFFF_FFFF = repeat([1], 32)
|
||||
let crc = tlib#bitwise#XOR([0], xFFFF_FFFF, 'bits')
|
||||
for char in split(a:chars, '\zs')
|
||||
let octet = char2nr(char)
|
||||
let r1 = tlib#bitwise#ShiftRight(crc, 8)
|
||||
let i0 = tlib#bitwise#AND(crc, xFFFF_FFFF, 'bits')
|
||||
let i1 = tlib#bitwise#XOR(i0, octet, 'bits')
|
||||
let i2 = tlib#bitwise#Bits2Num(tlib#bitwise#AND(i1, 0xff, 'bits'))
|
||||
let r2 = s:crc_table[i2]
|
||||
let crc = tlib#bitwise#XOR(r1, r2, 'bits')
|
||||
endfor
|
||||
let crc = tlib#bitwise#XOR(crc, xFFFF_FFFF, 'bits')
|
||||
let rv = tlib#bitwise#Bits2Num(crc, 16)
|
||||
if len(rv) < 8
|
||||
let rv = repeat('0', 8 - len(rv)) . rv
|
||||
endif
|
||||
return rv
|
||||
endf
|
||||
|
||||
|
||||
" :nodoc:
|
||||
function! tlib#hash#CreateCrcTable() "{{{3
|
||||
let sum = 0.0
|
||||
for exponent in [0, 1, 2, 4, 5, 7, 8, 10, 11, 12, 16, 22, 23, 26, 32]
|
||||
let exp = tlib#bitwise#Bits2Num(repeat([0], 32 - exponent) + [1], 10.0)
|
||||
let sum += exp
|
||||
endfor
|
||||
let divisor = tlib#bitwise#Num2Bits(sum)
|
||||
let crc_table = []
|
||||
for octet in range(256)
|
||||
let remainder = tlib#bitwise#Num2Bits(octet)
|
||||
for i in range(8)
|
||||
if get(remainder, i) != 0
|
||||
let remainder = tlib#bitwise#XOR(remainder, tlib#bitwise#ShiftLeft(divisor, i), "bits")
|
||||
endif
|
||||
endfor
|
||||
let remainder = tlib#bitwise#ShiftRight(remainder, 8)
|
||||
call add(crc_table, remainder)
|
||||
endfor
|
||||
return crc_table
|
||||
endf
|
||||
|
||||
|
||||
function! tlib#hash#Adler32(chars) "{{{3
|
||||
if !empty(g:tlib#hash#use_adler32)
|
||||
let use = g:tlib#hash#use_adler32
|
||||
elseif exists('*or')
|
||||
let use = 'vim'
|
||||
else
|
||||
let use = 'tlib'
|
||||
endif
|
||||
if exists('*tlib#hash#Adler32_'. use)
|
||||
return tlib#hash#Adler32_{use}(a:chars)
|
||||
else
|
||||
throw "Unknown version of tlib#hash#Adler32_: ". use
|
||||
endif
|
||||
endf
|
||||
|
||||
|
||||
function! tlib#hash#Adler32_vim(chars) "{{{3
|
||||
if exists('*or')
|
||||
let mod_adler = 65521
|
||||
let a = 1
|
||||
let b = 0
|
||||
for index in range(len(a:chars))
|
||||
let c = char2nr(a:chars[index])
|
||||
let a = (a + c) % mod_adler
|
||||
let b = (b + a) % mod_adler
|
||||
endfor
|
||||
let bb = b * float2nr(pow(2, 16))
|
||||
let checksum = or(bb, a)
|
||||
" TLogVAR checksum, a, b, bb
|
||||
return printf("%08X", checksum)
|
||||
else
|
||||
throw "TLIB: Vim version doesn't support bitwise or()"
|
||||
endif
|
||||
endf
|
||||
|
||||
|
||||
function! tlib#hash#Adler32_tlib(chars) "{{{3
|
||||
let mod_adler = 65521
|
||||
let a = 1
|
||||
let b = 0
|
||||
for index in range(len(a:chars))
|
||||
let c = char2nr(a:chars[index])
|
||||
let a = (a + c) % mod_adler
|
||||
let b = (b + a) % mod_adler
|
||||
endfor
|
||||
let bb = tlib#bitwise#ShiftLeft(tlib#bitwise#Num2Bits(b), 16)
|
||||
let checksum = tlib#bitwise#OR(bb, a, "bits")
|
||||
return printf('%08s', tlib#bitwise#Bits2Num(checksum, 16))
|
||||
endf
|
||||
|
||||
|
@ -3,13 +3,188 @@
|
||||
" @Website: http://www.vim.org/account/profile.php?user_id=4037
|
||||
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
||||
" @Created: 2007-06-30.
|
||||
" @Last Change: 2012-10-01.
|
||||
" @Revision: 0.0.966
|
||||
" @Last Change: 2013-09-30.
|
||||
" @Revision: 0.0.1262
|
||||
|
||||
|
||||
" :filedoc:
|
||||
" Input-related, select from a list etc.
|
||||
|
||||
" If a list is bigger than this value, don't try to be smart when
|
||||
" selecting an item. Be slightly faster instead.
|
||||
" See |tlib#input#List()|.
|
||||
TLet g:tlib#input#sortprefs_threshold = 200
|
||||
|
||||
|
||||
" If a list contains more items, |tlib#input#List()| does not perform an
|
||||
" incremental "live search" but uses |input()| to query the user for a
|
||||
" filter. This is useful on slower machines or with very long lists.
|
||||
TLet g:tlib#input#livesearch_threshold = 1000
|
||||
|
||||
|
||||
" Determine how |tlib#input#List()| and related functions work.
|
||||
" Can be "cnf", "cnfd", "cnfx", "seq", or "fuzzy". See:
|
||||
" cnfx ... Like cnfd but |g:tlib#Filter_cnfx#expander| is interpreted
|
||||
" as a wildcard (this is the default method)
|
||||
" - A plus character ("+") acts as a wildcard as if ".\{-}" (see
|
||||
" |/\{-|) were entered.
|
||||
" - Examples:
|
||||
" - "f+o" matches "fo", "fxo", and "fxxxoo", but doesn't match
|
||||
" "far".
|
||||
" - Otherwise it is a derivate of the cnf method (see below).
|
||||
" - See also |tlib#Filter_cnfx#New()|.
|
||||
" cnfd ... Like cnf but "." is interpreted as a wildcard, i.e. it is
|
||||
" expanded to "\.\{-}"
|
||||
" - A period character (".") acts as a wildcard as if ".\{-}" (see
|
||||
" |/\{-|) were entered.
|
||||
" - Examples:
|
||||
" - "f.o" matches "fo", "fxo", and "fxxxoo", but doesn't match
|
||||
" "far".
|
||||
" - Otherwise it is a derivate of the cnf method (see below).
|
||||
" - See also |tlib#Filter_cnfd#New()|.
|
||||
" cnf .... Match substrings
|
||||
" - A blank creates an AND conjunction, i.e. the next pattern has to
|
||||
" match too.
|
||||
" - A pipe character ("|") creates an OR conjunction, either this or
|
||||
" the next next pattern has to match.
|
||||
" - Patterns are very 'nomagic' |regexp| with a |\V| prefix.
|
||||
" - A pattern starting with "-" makes the filter exclude items
|
||||
" matching that pattern.
|
||||
" - Examples:
|
||||
" - "foo bar" matches items that contain the strings "foo" AND
|
||||
" "bar".
|
||||
" - "foo|bar boo|far" matches items that contain either ("foo" OR
|
||||
" "bar") AND ("boo" OR "far").
|
||||
" - See also |tlib#Filter_cnf#New()|.
|
||||
" seq .... Match sequences of characters
|
||||
" - |tlib#Filter_seq#New()|
|
||||
" fuzzy .. Match fuzzy character sequences
|
||||
" - |tlib#Filter_fuzzy#New()|
|
||||
TLet g:tlib#input#filter_mode = 'cnfx'
|
||||
|
||||
|
||||
" The highlight group to use for showing matches in the input list
|
||||
" window.
|
||||
" See |tlib#input#List()|.
|
||||
TLet g:tlib#input#higroup = 'IncSearch'
|
||||
|
||||
" When 1, automatically select the last remaining item only if the list
|
||||
" had only one item to begin with.
|
||||
" When 2, automatically select a last remaining item after applying
|
||||
" any filters.
|
||||
" See |tlib#input#List()|.
|
||||
TLet g:tlib_pick_last_item = 1
|
||||
|
||||
|
||||
" :doc:
|
||||
" Keys for |tlib#input#List|~
|
||||
|
||||
TLet g:tlib#input#and = ' '
|
||||
TLet g:tlib#input#or = '|'
|
||||
TLet g:tlib#input#not = '-'
|
||||
|
||||
" When editing a list with |tlib#input#List|, typing these numeric chars
|
||||
" (as returned by getchar()) will select an item based on its index, not
|
||||
" based on its name. I.e. in the default setting, typing a "4" will
|
||||
" select the fourth item, not the item called "4".
|
||||
" In order to make keys 0-9 filter the items in the list and make
|
||||
" <m-[0-9]> select an item by its index, remove the keys 48 to 57 from
|
||||
" this dictionary.
|
||||
" Format: [KEY] = BASE ... the number is calculated as KEY - BASE.
|
||||
" :nodefault:
|
||||
TLet g:tlib#input#numeric_chars = {
|
||||
\ 176: 176,
|
||||
\ 177: 176,
|
||||
\ 178: 176,
|
||||
\ 179: 176,
|
||||
\ 180: 176,
|
||||
\ 181: 176,
|
||||
\ 182: 176,
|
||||
\ 183: 176,
|
||||
\ 184: 176,
|
||||
\ 185: 176,
|
||||
\}
|
||||
" \ 48: 48,
|
||||
" \ 49: 48,
|
||||
" \ 50: 48,
|
||||
" \ 51: 48,
|
||||
" \ 52: 48,
|
||||
" \ 53: 48,
|
||||
" \ 54: 48,
|
||||
" \ 55: 48,
|
||||
" \ 56: 48,
|
||||
" \ 57: 48,
|
||||
|
||||
|
||||
" :nodefault:
|
||||
" The default key bindings for single-item-select list views. If you
|
||||
" want to use <c-j>, <c-k> to move the cursor up and down, add these two
|
||||
" lines to after/plugin/02tlib.vim: >
|
||||
"
|
||||
" let g:tlib#input#keyagents_InputList_s[10] = 'tlib#agent#Down' " <c-j>
|
||||
" let g:tlib#input#keyagents_InputList_s[11] = 'tlib#agent#Up' " <c-k>
|
||||
TLet g:tlib#input#keyagents_InputList_s = {
|
||||
\ "\<PageUp>": 'tlib#agent#PageUp',
|
||||
\ "\<PageDown>": 'tlib#agent#PageDown',
|
||||
\ "\<Up>": 'tlib#agent#Up',
|
||||
\ "\<Down>": 'tlib#agent#Down',
|
||||
\ "\<c-Up>": 'tlib#agent#UpN',
|
||||
\ "\<c-Down>": 'tlib#agent#DownN',
|
||||
\ "\<Left>": 'tlib#agent#ShiftLeft',
|
||||
\ "\<Right>": 'tlib#agent#ShiftRight',
|
||||
\ 18: 'tlib#agent#Reset',
|
||||
\ 242: 'tlib#agent#Reset',
|
||||
\ 17: 'tlib#agent#Input',
|
||||
\ 241: 'tlib#agent#Input',
|
||||
\ 27: 'tlib#agent#Exit',
|
||||
\ 26: 'tlib#agent#Suspend',
|
||||
\ 250: 'tlib#agent#Suspend',
|
||||
\ 15: 'tlib#agent#SuspendToParentWindow',
|
||||
\ 63: 'tlib#agent#Help',
|
||||
\ "\<F1>": 'tlib#agent#Help',
|
||||
\ "\<F10>": 'tlib#agent#ExecAgentByName',
|
||||
\ "\<S-Esc>": 'tlib#agent#ExecAgentByName',
|
||||
\ "\<bs>": 'tlib#agent#ReduceFilter',
|
||||
\ "\<del>": 'tlib#agent#ReduceFilter',
|
||||
\ "\<c-bs>": 'tlib#agent#PopFilter',
|
||||
\ "\<m-bs>": 'tlib#agent#PopFilter',
|
||||
\ "\<c-del>": 'tlib#agent#PopFilter',
|
||||
\ "\<m-del>": 'tlib#agent#PopFilter',
|
||||
\ "\<s-space>": 'tlib#agent#Wildcard',
|
||||
\ 191: 'tlib#agent#Debug',
|
||||
\ char2nr(g:tlib#input#or): 'tlib#agent#OR',
|
||||
\ char2nr(g:tlib#input#and): 'tlib#agent#AND',
|
||||
\ }
|
||||
|
||||
|
||||
" :nodefault:
|
||||
TLet g:tlib#input#keyagents_InputList_m = {
|
||||
\ 35: 'tlib#agent#Select',
|
||||
\ "\<s-up>": 'tlib#agent#SelectUp',
|
||||
\ "\<s-down>": 'tlib#agent#SelectDown',
|
||||
\ 1: 'tlib#agent#SelectAll',
|
||||
\ 225: 'tlib#agent#SelectAll',
|
||||
\ "\<F9>": 'tlib#agent#ToggleRestrictView',
|
||||
\ }
|
||||
" "\<c-space>": 'tlib#agent#Select'
|
||||
|
||||
|
||||
" :nodefault:
|
||||
TLet g:tlib#input#handlers_EditList = [
|
||||
\ {'key': 5, 'agent': 'tlib#agent#EditItem', 'key_name': '<c-e>', 'help': 'Edit item'},
|
||||
\ {'key': 4, 'agent': 'tlib#agent#DeleteItems', 'key_name': '<c-d>', 'help': 'Delete item(s)'},
|
||||
\ {'key': 14, 'agent': 'tlib#agent#NewItem', 'key_name': '<c-n>', 'help': 'New item'},
|
||||
\ {'key': 24, 'agent': 'tlib#agent#Cut', 'key_name': '<c-x>', 'help': 'Cut item(s)'},
|
||||
\ {'key': 3, 'agent': 'tlib#agent#Copy', 'key_name': '<c-c>', 'help': 'Copy item(s)'},
|
||||
\ {'key': 22, 'agent': 'tlib#agent#Paste', 'key_name': '<c-v>', 'help': 'Paste item(s)'},
|
||||
\ {'pick_last_item': 0},
|
||||
\ {'return_agent': 'tlib#agent#EditReturnValue'},
|
||||
\ {'help_extra': [
|
||||
\ 'Submit changes by pressing ENTER or <c-s> or <c-w><cr>',
|
||||
\ 'Cancel editing by pressing <c-w>c'
|
||||
\ ]},
|
||||
\ ]
|
||||
|
||||
|
||||
" If true, define a popup menu for |tlib#input#List()| and related
|
||||
" functions.
|
||||
@ -40,7 +215,7 @@ TLet g:tlib#input#filename_max_width = '&co / 2'
|
||||
" of selected elements or its indexes.
|
||||
"
|
||||
" By default, typing numbers will select an item by its index. See
|
||||
" |g:tlib_numeric_chars| to find out how to change this.
|
||||
" |g:tlib#input#numeric_chars| to find out how to change this.
|
||||
"
|
||||
" The item is automatically selected if the numbers typed equals the
|
||||
" number of digits of the list length. I.e. if a list contains 20 items,
|
||||
@ -58,7 +233,7 @@ TLet g:tlib#input#filename_max_width = '&co / 2'
|
||||
" mi ... Return a list of indexes
|
||||
"
|
||||
" Several pattern matching styles are supported. See
|
||||
" |g:tlib_inputlist_match|.
|
||||
" |g:tlib#input#filter_mode|.
|
||||
"
|
||||
" EXAMPLES: >
|
||||
" echo tlib#input#List('s', 'Select one item', [100,200,300])
|
||||
@ -110,7 +285,7 @@ function! tlib#input#List(type, ...) "{{{3
|
||||
let world.pick_last_item = tlib#list#Find(handlers, 'has_key(v:val, "pick_last_item")',
|
||||
\ tlib#var#Get('tlib_pick_last_item', 'bg'), 'v:val.pick_last_item')
|
||||
let world.numeric_chars = tlib#list#Find(handlers, 'has_key(v:val, "numeric_chars")',
|
||||
\ tlib#var#Get('tlib_numeric_chars', 'bg'), 'v:val.numeric_chars')
|
||||
\ g:tlib#input#numeric_chars, 'v:val.numeric_chars')
|
||||
let world.key_handlers = filter(copy(handlers), 'has_key(v:val, "key")')
|
||||
let filter = tlib#list#Find(handlers, 'has_key(v:val, "filter")', '', 'v:val.filter')
|
||||
if !empty(filter)
|
||||
@ -157,10 +332,12 @@ function! tlib#input#ListW(world, ...) "{{{3
|
||||
let &l:scrolloff = 0
|
||||
let @/ = ''
|
||||
let dlist = []
|
||||
let post_keys = ''
|
||||
" let &laststatus = 2
|
||||
|
||||
try
|
||||
while !empty(world.state) && world.state !~ '^exit' && (world.show_empty || !empty(world.base))
|
||||
let post_keys = ''
|
||||
" TLogDBG 'while'
|
||||
" TLogVAR world.state
|
||||
" let time01 = str2float(reltimestr(reltime())) " DBG
|
||||
@ -249,7 +426,7 @@ function! tlib#input#ListW(world, ...) "{{{3
|
||||
" TLogVAR world.idx, world.llen, world.state
|
||||
" TLogDBG world.FilterIsEmpty()
|
||||
if world.state == 'display'
|
||||
if world.idx == '' && world.llen < g:tlib_sortprefs_threshold && !world.FilterIsEmpty()
|
||||
if world.idx == '' && world.llen < g:tlib#input#sortprefs_threshold && !world.FilterIsEmpty()
|
||||
call world.SetPrefIdx()
|
||||
else
|
||||
let world.prefidx = world.idx == '' ? world.initial_index : world.idx
|
||||
@ -333,7 +510,7 @@ function! tlib#input#ListW(world, ...) "{{{3
|
||||
" let world.prefidx = world.offset
|
||||
" endif
|
||||
call world.DisplayList()
|
||||
if world.state == 'help'
|
||||
if world.state == 'help' || world.state == 'printlines'
|
||||
let world.state = 'display'
|
||||
else
|
||||
let world.state = ''
|
||||
@ -343,7 +520,7 @@ function! tlib#input#ListW(world, ...) "{{{3
|
||||
" TAssert IsNotEmpty(world.scratch)
|
||||
let world.list_wnr = winnr()
|
||||
|
||||
" TLogVAR world.next_state, world.state
|
||||
" TLogVAR world.state, world.next_state
|
||||
if !empty(world.next_state)
|
||||
let world.state = world.next_state
|
||||
let world.next_state = ''
|
||||
@ -354,11 +531,49 @@ function! tlib#input#ListW(world, ...) "{{{3
|
||||
continue
|
||||
endif
|
||||
|
||||
" TLogVAR world.timeout
|
||||
let c = tlib#char#Get(world.timeout, world.timeout_resolution)
|
||||
" TLogVAR c, has_key(world.key_map[world.key_mode],c)
|
||||
if world.state =~ '\<eval\>'
|
||||
let query = matchstr(world.state, '\<eval\[\zs.\{-}\ze\]')
|
||||
if empty(query)
|
||||
let query = 'Waiting for input ... Press ESC to continue'
|
||||
endif
|
||||
if has('gui_win32')
|
||||
let exec_cmd = input(query, '')
|
||||
" TLogVAR exec_cmd
|
||||
if exec_cmd == ''
|
||||
let world.state = 'redisplay'
|
||||
else
|
||||
exec exec_cmd
|
||||
endif
|
||||
elseif has('gui_gtk') || has('gui_gtk2')
|
||||
let c = getchar()
|
||||
let cmod = getcharmod()
|
||||
" TLogVAR c, cmod
|
||||
if c !~ '\D' && c > 0 && cmod != 0
|
||||
let c = printf("<%s-%s>", cmod, c)
|
||||
endif
|
||||
endif
|
||||
else
|
||||
" TLogVAR world.timeout
|
||||
let c = tlib#char#Get(world.timeout, world.timeout_resolution)
|
||||
" TLogVAR c, has_key(world.key_map[world.key_mode],c)
|
||||
let cmod = getcharmod()
|
||||
endif
|
||||
" TLogVAR c, cmod
|
||||
" TLogDBG string(sort(keys(world.key_map[world.key_mode])))
|
||||
if world.state != ''
|
||||
|
||||
" TLogVAR world.next_agent, world.next_eval
|
||||
if !empty(world.next_agent)
|
||||
let nagent = world.next_agent
|
||||
let world.next_agent = ''
|
||||
let world = call(nagent, [world, world.GetSelectedItems(world.CurrentItem())])
|
||||
call s:CheckAgentReturnValue(nagent, world)
|
||||
elseif !empty(world.next_eval)
|
||||
let selected = world.GetSelectedItems(world.CurrentItem())
|
||||
let neval = world.next_eval
|
||||
let world.next_eval = ''
|
||||
exec neval
|
||||
call s:CheckAgentReturnValue(neval, world)
|
||||
elseif world.state != ''
|
||||
" continue
|
||||
elseif has_key(world.key_map[world.key_mode], c)
|
||||
let sr = @/
|
||||
@ -382,35 +597,53 @@ function! tlib#input#ListW(world, ...) "{{{3
|
||||
let world.state = 'exit empty'
|
||||
endif
|
||||
elseif c == "\<LeftMouse>"
|
||||
let world.prefidx = world.GetLineIdx(v:mouse_lnum)
|
||||
" let world.offset = world.prefidx
|
||||
" TLogVAR v:mouse_lnum, world.prefidx
|
||||
if empty(world.prefidx)
|
||||
" call feedkeys(c, 't')
|
||||
let c = tlib#char#Get(world.timeout)
|
||||
let world.state = 'help'
|
||||
continue
|
||||
endif
|
||||
throw 'pick'
|
||||
elseif c == "\<RightMouse>"
|
||||
if g:tlib#input#use_popup && world.has_menu
|
||||
" if v:mouse_lnum != line('.')
|
||||
" endif
|
||||
if v:mouse_win == world.list_wnr
|
||||
let world.prefidx = world.GetLineIdx(v:mouse_lnum)
|
||||
let world.state = 'redisplay'
|
||||
call world.DisplayList()
|
||||
if line('w$') - v:mouse_lnum < 6
|
||||
popup ]TLibInputListPopupMenu
|
||||
" let world.offset = world.prefidx
|
||||
if empty(world.prefidx)
|
||||
" call feedkeys(c, 't')
|
||||
let c = tlib#char#Get(world.timeout)
|
||||
let world.state = 'help'
|
||||
continue
|
||||
endif
|
||||
throw 'pick'
|
||||
else
|
||||
let post_keys = v:mouse_lnum .'gg'. v:mouse_col .'|'. c
|
||||
if world.allow_suspend
|
||||
let world = tlib#agent#SuspendToParentWindow(world, world.rv)
|
||||
else
|
||||
popup! ]TLibInputListPopupMenu
|
||||
let world.state = 'exit empty'
|
||||
endif
|
||||
endif
|
||||
elseif c == "\<RightMouse>"
|
||||
if v:mouse_win == world.list_wnr
|
||||
call s:BuildMenu(world)
|
||||
let world.state = 'redisplay'
|
||||
if s:PopupmenuExists() == 1
|
||||
" if v:mouse_lnum != line('.')
|
||||
" endif
|
||||
let world.prefidx = world.GetLineIdx(v:mouse_lnum)
|
||||
let world.next_state = 'eval[Waiting for popup menu ... Press ESC to continue]'
|
||||
call world.DisplayList()
|
||||
if line('w$') - v:mouse_lnum < 6
|
||||
popup ]TLibInputListPopupMenu
|
||||
else
|
||||
popup! ]TLibInputListPopupMenu
|
||||
endif
|
||||
endif
|
||||
else
|
||||
let world.state = 'redisplay'
|
||||
let post_keys = v:mouse_lnum .'gg'. v:mouse_col .'|'. c
|
||||
if world.allow_suspend
|
||||
let world = tlib#agent#SuspendToParentWindow(world, world.rv)
|
||||
else
|
||||
let world.state = 'exit empty'
|
||||
endif
|
||||
endif
|
||||
" TLogVAR world.prefidx, world.state
|
||||
elseif has_key(world.key_map[world.key_mode], 'unknown_key')
|
||||
let agent = world.key_map[world.key_mode].unknown_key.agent
|
||||
let world = call(agent, [world, c])
|
||||
call s:CheckAgentReturnValue(agent, world)
|
||||
elseif c >= 32
|
||||
let world.state = 'display'
|
||||
let numbase = get(world.numeric_chars, c, -99999)
|
||||
@ -425,7 +658,7 @@ function! tlib#input#ListW(world, ...) "{{{3
|
||||
else
|
||||
let world.idx = ''
|
||||
" TLogVAR world.filter
|
||||
if world.llen > g:tlib_inputlist_livesearch_threshold
|
||||
if world.llen > g:tlib#input#livesearch_threshold
|
||||
let pattern = input('Filter: ', world.CleanFilter(world.filter[0][0]) . nr2char(c))
|
||||
if empty(pattern)
|
||||
let world.state = 'exit empty'
|
||||
@ -552,9 +785,8 @@ function! tlib#input#ListW(world, ...) "{{{3
|
||||
" let &laststatus = laststatus
|
||||
silent! let @/ = lastsearch
|
||||
let &l:scrolloff = scrolloff
|
||||
if g:tlib#input#use_popup && world.has_menu
|
||||
if s:PopupmenuExists() == 1
|
||||
silent! aunmenu ]TLibInputListPopupMenu
|
||||
let world.has_menu = 0
|
||||
endif
|
||||
|
||||
" TLogDBG 'finally 2'
|
||||
@ -589,6 +821,10 @@ function! tlib#input#ListW(world, ...) "{{{3
|
||||
" endfor
|
||||
echo
|
||||
redraw!
|
||||
if !empty(post_keys)
|
||||
" TLogVAR post_keys
|
||||
call feedkeys(post_keys)
|
||||
endif
|
||||
endtry
|
||||
endf
|
||||
|
||||
@ -612,7 +848,7 @@ function! s:Init(world, cmd) "{{{3
|
||||
" TLogVAR a:world.initialized, a:world.win_wnr, a:world.bufnr
|
||||
let a:world.filetype = &filetype
|
||||
let a:world.fileencoding = &fileencoding
|
||||
call a:world.SetMatchMode(tlib#var#Get('tlib_inputlist_match', 'wb'))
|
||||
call a:world.SetMatchMode(tlib#var#Get('tlib#input#filter_mode', 'wb'))
|
||||
call a:world.Initialize()
|
||||
if !has_key(a:world, 'key_mode')
|
||||
let a:world.key_mode = 'default'
|
||||
@ -623,18 +859,19 @@ function! s:Init(world, cmd) "{{{3
|
||||
if has_key(a:world.key_map, a:world.key_mode)
|
||||
let a:world.key_map[a:world.key_mode] = extend(
|
||||
\ a:world.key_map[a:world.key_mode],
|
||||
\ copy(g:tlib_keyagents_InputList_s),
|
||||
\ copy(g:tlib#input#keyagents_InputList_s),
|
||||
\ 'keep')
|
||||
else
|
||||
let a:world.key_map[a:world.key_mode] = copy(g:tlib_keyagents_InputList_s)
|
||||
let a:world.key_map[a:world.key_mode] = copy(g:tlib#input#keyagents_InputList_s)
|
||||
endif
|
||||
else
|
||||
let a:world.key_map = {
|
||||
\ a:world.key_mode : copy(g:tlib_keyagents_InputList_s)
|
||||
\ a:world.key_mode : copy(g:tlib#input#keyagents_InputList_s)
|
||||
\ }
|
||||
endif
|
||||
" TLogVAR a:world.type
|
||||
if stridx(a:world.type, 'm') != -1
|
||||
call extend(a:world.key_map[a:world.key_mode], g:tlib_keyagents_InputList_m, 'force')
|
||||
call extend(a:world.key_map[a:world.key_mode], g:tlib#input#keyagents_InputList_m, 'force')
|
||||
endif
|
||||
for key_mode in keys(a:world.key_map)
|
||||
let a:world.key_map[key_mode] = map(a:world.key_map[key_mode], 'type(v:val) == 4 ? v:val : {"agent": v:val}')
|
||||
@ -652,7 +889,6 @@ function! s:Init(world, cmd) "{{{3
|
||||
let a:world.state .= ' '. a:cmd
|
||||
endif
|
||||
endif
|
||||
call s:BuildMenu(a:world)
|
||||
" TLogVAR a:world.state, a:world.sticky
|
||||
endf
|
||||
|
||||
@ -667,40 +903,133 @@ function! s:ExtendKeyMap(world, key_mode, key_handlers) "{{{3
|
||||
endf
|
||||
|
||||
|
||||
function s:PopupmenuExists()
|
||||
if !g:tlib#input#use_popup
|
||||
\ || exists(':popup') != 2
|
||||
\ || !(has('gui_win32') || has('gui_gtk') || has('gui_gtk2'))
|
||||
" \ || !has('gui_win32')
|
||||
let rv = -1
|
||||
else
|
||||
try
|
||||
let rv = 1
|
||||
silent amenu ]TLibInputListPopupMenu
|
||||
catch
|
||||
let rv = 0
|
||||
endtry
|
||||
endif
|
||||
" TLogVAR rv
|
||||
return rv
|
||||
endf
|
||||
|
||||
|
||||
function! s:BuildMenu(world) "{{{3
|
||||
if g:tlib#input#use_popup
|
||||
if a:world.has_menu
|
||||
silent! aunmenu ]TLibInputListPopupMenu
|
||||
endif
|
||||
amenu ]TLibInputListPopupMenu.Pick\ selected\ item <cr>
|
||||
amenu ]TLibInputListPopupMenu.Select #
|
||||
amenu ]TLibInputListPopupMenu.Select\ all <c-a>
|
||||
amenu ]TLibInputListPopupMenu.Reset\ list <c-r>
|
||||
amenu ]TLibInputListPopupMenu.Cancel <esc>
|
||||
amenu ]TLibInputListPopupMenu.-StandardEntries- :
|
||||
let a:world.has_menu = 1
|
||||
if g:tlib#input#use_popup && s:PopupmenuExists() == 0
|
||||
call s:BuildItem('Pick\ selected\ item', {'key_name': '<cr>', 'eval': 'let world.state = "pick"'})
|
||||
call s:BuildItem('Cancel', {'key_name': '<esc>', 'agent': 'tlib#agent#Exit'})
|
||||
call s:BuildItem('Select', {'key_name': '#', 'agent': 'tlib#agent#Select'})
|
||||
call s:BuildItem('Select\ all', {'key_name': '<c-a>', 'agent': 'tlib#agent#SelectAll'})
|
||||
call s:BuildItem('Reset\ list', {'key_name': '<c-r>', 'agent': 'tlib#agent#Reset'})
|
||||
call s:BuildItem('-StandardEntries-', {'key': ":", 'eval': 'let world.state = "redisplay"'})
|
||||
for [key_mode, key_handlers] in items(a:world.key_map)
|
||||
let keys = sort(keys(key_handlers))
|
||||
let mitems = {}
|
||||
for key in keys
|
||||
let handler = key_handlers[key]
|
||||
let k = get(handler, 'key', '')
|
||||
if !empty(k) && has_key(handler, 'help') && !empty(handler.help)
|
||||
if empty(key_mode) || key_mode == 'default'
|
||||
exec 'amenu ]TLibInputListPopupMenu.'. escape(handler.help, ' .\')
|
||||
\ .' '. handler.key_name
|
||||
let mname = ''
|
||||
else
|
||||
exec 'amenu ]TLibInputListPopupMenu'.
|
||||
\ '.'. escape(key_mode, ' .\')
|
||||
\ '.'. escape(handler.help, ' .\')
|
||||
\ .' '. handler.key_name
|
||||
let mname = escape(key_mode, ' .\') .'.'
|
||||
endif
|
||||
if has_key(handler, 'submenu')
|
||||
let submenu = escape(handler.submenu, ' .\')
|
||||
else
|
||||
let submenu = '~'
|
||||
endif
|
||||
for mfield in ['menu', 'help', 'key_name', 'agent']
|
||||
if has_key(handler, mfield)
|
||||
let mname .= escape(handler[mfield], ' .\')
|
||||
break
|
||||
endif
|
||||
endfor
|
||||
if !has_key(mitems, submenu)
|
||||
let mitems[submenu] = {}
|
||||
endif
|
||||
let mitems[submenu][mname] = handler
|
||||
endif
|
||||
endfor
|
||||
for msubname in sort(keys(mitems))
|
||||
let msubitems = mitems[msubname]
|
||||
if msubname == '~'
|
||||
let msubmname = ''
|
||||
else
|
||||
let msubmname = msubname .'.'
|
||||
endif
|
||||
for mname in sort(keys(msubitems))
|
||||
let msname = msubmname . mname
|
||||
let handler = msubitems[mname]
|
||||
call s:BuildItem(msname, handler)
|
||||
" if has_key(handler, 'agent')
|
||||
" call s:BuildItem(msname, {'agent': handler.agent})
|
||||
" else
|
||||
" call s:BuildItem(msname, {'key': handler.key_name})
|
||||
" endif
|
||||
endfor
|
||||
endfor
|
||||
endfor
|
||||
endif
|
||||
endf
|
||||
|
||||
|
||||
function! s:BuildItem(menu, def) "{{{3
|
||||
if has('gui_win32')
|
||||
let key_mode = 'c'
|
||||
elseif has('gui_gtk') || has('gui_gtk2')
|
||||
let key_mode = 'raw'
|
||||
endif
|
||||
for k in ['agent', 'eval', 'key_name', 'key']
|
||||
if has('gui_win32')
|
||||
elseif has('gui_gtk') || has('gui_gtk')
|
||||
if k == 'agent' || k == 'eval'
|
||||
continue
|
||||
endif
|
||||
endif
|
||||
try
|
||||
if has_key(a:def, k)
|
||||
let v = a:def[k]
|
||||
if k == 'key'
|
||||
if key_mode == 'c'
|
||||
" echom 'DBG amenu' (']TLibInputListPopupMenu.'. a:menu) ':let c = "'. v .'"<cr>'
|
||||
exec 'amenu' (']TLibInputListPopupMenu.'. a:menu) ':let c = "'. v .'"<cr>'
|
||||
else
|
||||
" echom 'DBG amenu' (']TLibInputListPopupMenu.'. a:menu) v
|
||||
exec 'amenu' (']TLibInputListPopupMenu.'. a:menu) v
|
||||
endif
|
||||
elseif k == 'key_name'
|
||||
if key_mode == 'c'
|
||||
" echom 'DBG amenu' (']TLibInputListPopupMenu.'. a:menu) ':let c = "\'. v .'"<cr>'
|
||||
exec 'amenu' (']TLibInputListPopupMenu.'. a:menu) ':let c = "\'. v .'"<cr>'
|
||||
else
|
||||
let key = v
|
||||
" echom 'DBG amenu' (']TLibInputListPopupMenu.'. a:menu) key
|
||||
exec 'amenu' (']TLibInputListPopupMenu.'. a:menu) key
|
||||
endif
|
||||
elseif k == 'agent'
|
||||
" echom 'DBG amenu' (']TLibInputListPopupMenu.'. a:menu) ':let world.next_agent ='. string(v) .'<cr>'
|
||||
exec 'amenu' (']TLibInputListPopupMenu.'. a:menu) ':let world.next_agent ='. string(v) .'<cr>'
|
||||
elseif k == 'eval'
|
||||
" echom 'DBG amenu' (']TLibInputListPopupMenu.'. a:menu) ':let world.next_eval ='. string(v) .'<cr>'
|
||||
exec 'amenu' (']TLibInputListPopupMenu.'. a:menu) ':let world.next_eval ='. string(v) .'<cr>'
|
||||
endif
|
||||
return
|
||||
endif
|
||||
catch
|
||||
endtry
|
||||
endfor
|
||||
endf
|
||||
|
||||
|
||||
function! s:RunStateHandlers(world) "{{{3
|
||||
" Provide the variable "world" in the environment of an "exec"
|
||||
" handler (ea).
|
||||
@ -748,7 +1077,7 @@ endf
|
||||
" EXAMPLES: >
|
||||
" echo tlib#input#EditList('Edit:', [100,200,300])
|
||||
function! tlib#input#EditList(query, list, ...) "{{{3
|
||||
let handlers = a:0 >= 1 && !empty(a:1) ? a:1 : g:tlib_handlers_EditList
|
||||
let handlers = a:0 >= 1 && !empty(a:1) ? a:1 : g:tlib#input#handlers_EditList
|
||||
let default = a:0 >= 2 ? a:2 : []
|
||||
let timeout = a:0 >= 3 ? a:3 : 0
|
||||
" TLogVAR handlers
|
||||
@ -767,7 +1096,7 @@ function! tlib#input#Resume(name, pick, bufnr) "{{{3
|
||||
" TLogVAR a:name, a:pick
|
||||
echo
|
||||
if bufnr('%') != a:bufnr
|
||||
if g:tlib_debug
|
||||
if g:tlib#debug
|
||||
echohl WarningMsg
|
||||
echom "tlib#input#Resume: Internal error: Not in scratch buffer:" bufname('%')
|
||||
echohl NONE
|
||||
@ -775,7 +1104,7 @@ function! tlib#input#Resume(name, pick, bufnr) "{{{3
|
||||
let br = tlib#buffer#Set(a:bufnr)
|
||||
endif
|
||||
if !exists('b:tlib_'. a:name)
|
||||
if g:tlib_debug
|
||||
if g:tlib#debug
|
||||
echohl WarningMsg
|
||||
echom "tlib#input#Resume: Internal error: b:tlib_". a:name ." does not exist:" bufname('%')
|
||||
echohl NONE
|
||||
|
30
sources_non_forked/tlib/autoload/tlib/number.vim
Normal file
30
sources_non_forked/tlib/autoload/tlib/number.vim
Normal file
@ -0,0 +1,30 @@
|
||||
" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim])
|
||||
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
||||
" @Revision: 14
|
||||
|
||||
|
||||
function! tlib#number#ConvertBase(num, base, ...) "{{{3
|
||||
let rtype = a:0 >= 1 ? a:1 : 'string'
|
||||
" TLogVAR a:num, a:base, rtype
|
||||
let rv = []
|
||||
let num = 0.0 + a:num
|
||||
while floor(num) > 0.0
|
||||
let div = floor(num / a:base)
|
||||
let num1 = float2nr(num - a:base * div)
|
||||
if a:base <= 10
|
||||
call insert(rv, num1)
|
||||
elseif a:base == 16
|
||||
let char = "0123456789ABCDEF"[num1]
|
||||
call insert(rv, char)
|
||||
endif
|
||||
let num = num / a:base
|
||||
endwh
|
||||
" TLogVAR rv
|
||||
if rtype == 'list'
|
||||
return rv
|
||||
else
|
||||
return join(rv, '')
|
||||
endif
|
||||
endf
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
||||
" @Created: 2012-05-11.
|
||||
" @Last Change: 2012-05-11.
|
||||
" @Revision: 6
|
||||
" @Revision: 7
|
||||
|
||||
" The directory for persistent data files. If empty, use
|
||||
" |tlib#dir#MyRuntime|.'/share'.
|
||||
@ -38,6 +38,10 @@ function! tlib#persistent#Get(cfile) "{{{3
|
||||
endif
|
||||
endf
|
||||
|
||||
function! tlib#persistent#Value(...) "{{{3
|
||||
return call('tlib#cache#Value', a:000)
|
||||
endf
|
||||
|
||||
function! tlib#persistent#Save(cfile, dictionary) "{{{3
|
||||
if !empty(a:cfile)
|
||||
" TLogVAR a:dictionary
|
||||
|
@ -3,8 +3,8 @@
|
||||
" @Website: http://www.vim.org/account/profile.php?user_id=4037
|
||||
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
||||
" @Created: 2007-07-18.
|
||||
" @Last Change: 2012-02-08.
|
||||
" @Revision: 0.0.167
|
||||
" @Last Change: 2013-10-16.
|
||||
" @Revision: 0.0.242
|
||||
|
||||
if &cp || exists("loaded_tlib_scratch_autoload")
|
||||
finish
|
||||
@ -12,6 +12,17 @@ endif
|
||||
let loaded_tlib_scratch_autoload = 1
|
||||
|
||||
|
||||
" Scratch window position. By default the list window is opened on the
|
||||
" bottom. Set this variable to 'topleft' or '' to change this behaviour.
|
||||
" See |tlib#input#List()|.
|
||||
TLet g:tlib_scratch_pos = 'botright'
|
||||
|
||||
" If you want the scratch buffer to be fully removed, you might want to
|
||||
" set this variable to 'wipe'.
|
||||
" See also https://github.com/tomtom/tlib_vim/pull/16
|
||||
TLet g:tlib#scratch#hidden = 'hide'
|
||||
|
||||
|
||||
" :def: function! tlib#scratch#UseScratch(?keyargs={})
|
||||
" Display a scratch buffer (a buffer with no file). See :TScratch for an
|
||||
" example.
|
||||
@ -22,23 +33,21 @@ function! tlib#scratch#UseScratch(...) "{{{3
|
||||
exec tlib#arg#Let([['keyargs', {}]])
|
||||
" TLogDBG string(keys(keyargs))
|
||||
let id = get(keyargs, 'scratch', '__Scratch__')
|
||||
" TLogVAR id
|
||||
" TLogDBG winnr()
|
||||
" TLogDBG bufnr(id)
|
||||
" TLogDBG bufwinnr(id)
|
||||
" TLogDBG bufnr('%')
|
||||
if id =~ '^\d\+$' && bufwinnr(id) != -1
|
||||
if bufnr('%') != id
|
||||
exec 'noautocmd buffer! '. id
|
||||
endif
|
||||
" let ft = &ft
|
||||
let ft = '*'
|
||||
" TLogVAR id, bufwinnr(id)
|
||||
" TLogVAR bufnr(id), bufname(id)
|
||||
" TLogVAR 1, winnr(), bufnr('%'), bufname("%")
|
||||
if bufwinnr(id) != -1
|
||||
" echom 'DBG noautocmd keepalt keepj' bufwinnr(id) 'wincmd w'
|
||||
exec 'noautocmd keepalt keepj' bufwinnr(id) 'wincmd w'
|
||||
" TLogVAR "reuse", bufnr("%"), bufname("%")
|
||||
else
|
||||
let winpos = ''
|
||||
let bn = bufnr(id)
|
||||
let wpos = get(keyargs, 'scratch_pos', g:tlib_scratch_pos)
|
||||
" TLogVAR keyargs.scratch_vertical
|
||||
if get(keyargs, 'scratch_vertical')
|
||||
let wpos .= ' vertical'
|
||||
let winpos = tlib#fixes#Winpos()
|
||||
endif
|
||||
" TLogVAR wpos
|
||||
let scratch_split = get(keyargs, 'scratch_split', 1)
|
||||
@ -47,7 +56,7 @@ function! tlib#scratch#UseScratch(...) "{{{3
|
||||
let wn = bufwinnr(bn)
|
||||
if wn != -1
|
||||
" TLogVAR wn
|
||||
exec 'noautocmd' (wn .'wincmd w')
|
||||
exec 'noautocmd keepalt keepj' (wn .'wincmd w')
|
||||
else
|
||||
if scratch_split == 1
|
||||
let cmd = wpos.' sbuffer!'
|
||||
@ -57,7 +66,7 @@ function! tlib#scratch#UseScratch(...) "{{{3
|
||||
let cmd = 'buffer!'
|
||||
endif
|
||||
" TLogVAR cmd
|
||||
silent exec 'noautocmd' cmd bn
|
||||
silent exec 'noautocmd keepalt keepj' cmd bn
|
||||
endif
|
||||
else
|
||||
" TLogVAR id
|
||||
@ -69,24 +78,29 @@ function! tlib#scratch#UseScratch(...) "{{{3
|
||||
let cmd = 'edit'
|
||||
endif
|
||||
" TLogVAR cmd
|
||||
silent exec 'noautocmd' cmd escape(id, '%#\ ')
|
||||
silent exec 'noautocmd keepalt keepj' cmd escape(id, '%#\ ')
|
||||
" silent exec 'split '. id
|
||||
endif
|
||||
let ft = get(keyargs, 'scratch_filetype', '')
|
||||
" TLogVAR ft
|
||||
endif
|
||||
setlocal buftype=nofile
|
||||
setlocal bufhidden=hide
|
||||
setlocal noswapfile
|
||||
setlocal nobuflisted
|
||||
setlocal foldmethod=manual
|
||||
setlocal foldcolumn=0
|
||||
setlocal modifiable
|
||||
setlocal nospell
|
||||
if &ft != '*'
|
||||
let &ft = ft
|
||||
" TLogVAR ft, winpos
|
||||
if !empty(winpos)
|
||||
exec winpos
|
||||
endif
|
||||
setlocal buftype=nofile
|
||||
let &l:bufhidden = get(keyargs, 'scratch_hidden', g:tlib#scratch#hidden)
|
||||
setlocal noswapfile
|
||||
setlocal nobuflisted
|
||||
setlocal foldmethod=manual
|
||||
setlocal foldcolumn=0
|
||||
setlocal modifiable
|
||||
setlocal nospell
|
||||
" TLogVAR &ft, ft
|
||||
if !empty(ft)
|
||||
let &l:ft = ft
|
||||
endif
|
||||
endif
|
||||
let keyargs.scratch = bufnr('%')
|
||||
" TLogVAR 2, winnr(), bufnr('%'), bufname("%")
|
||||
return keyargs.scratch
|
||||
endf
|
||||
|
||||
@ -106,7 +120,11 @@ function! tlib#scratch#CloseScratch(keyargs, ...) "{{{3
|
||||
if wn != -1
|
||||
" TLogDBG winnr()
|
||||
let wb = tlib#win#Set(wn)
|
||||
let winpos = tlib#fixes#Winpos()
|
||||
wincmd c
|
||||
if get(a:keyargs, 'scratch_vertical') && !empty(winpos)
|
||||
exec winpos
|
||||
endif
|
||||
" exec wb
|
||||
" redraw
|
||||
" TLogVAR winnr()
|
||||
|
@ -3,8 +3,8 @@
|
||||
" @Website: http://www.vim.org/account/profile.php?user_id=4037
|
||||
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
||||
" @Created: 2007-11-01.
|
||||
" @Last Change: 2011-08-11.
|
||||
" @Revision: 0.0.56
|
||||
" @Last Change: 2013-09-25.
|
||||
" @Revision: 0.0.58
|
||||
|
||||
if &cp || exists("loaded_tlib_tag_autoload")
|
||||
finish
|
||||
@ -12,6 +12,23 @@ endif
|
||||
let loaded_tlib_tag_autoload = 1
|
||||
|
||||
|
||||
" Extra tags for |tlib#tag#Retrieve()| (see there). Can also be buffer-local.
|
||||
TLet g:tlib_tags_extra = ''
|
||||
|
||||
" Filter the tag description through |substitute()| for these filetypes.
|
||||
" This applies only if the tag cmd field (see |taglist()|) is used.
|
||||
" :nodefault:
|
||||
TLet g:tlib_tag_substitute = {
|
||||
\ 'java': [['\s*{\s*$', '', '']],
|
||||
\ 'ruby': [['\<\(def\|class\|module\)\>\s\+', '', '']],
|
||||
\ 'vim': [
|
||||
\ ['^\s*com\%[mand]!\?\(\s\+-\S\+\)*\s*\u\w*\zs.*$', '', ''],
|
||||
\ ['^\s*\(let\|aug\%[roup]\|fu\%[nction]!\?\|com\%[mand]!\?\(\s\+-\S\+\)*\)\s*', '', ''],
|
||||
\ ['"\?\s*{{{\d.*$', '', ''],
|
||||
\ ],
|
||||
\ }
|
||||
|
||||
|
||||
" :def: function! tlib#tag#Retrieve(rx, ?extra_tags=0)
|
||||
" Get all tags matching rx. Basically, this function simply calls
|
||||
" |taglist()|, but when extra_tags is true, the list of the tag files
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -3,8 +3,8 @@
|
||||
" @Website: http://www.vim.org/account/profile.php?user_id=4037
|
||||
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
||||
" @Created: 2007-04-10.
|
||||
" @Last Change: 2012-10-03.
|
||||
" @Revision: 725
|
||||
" @Last Change: 2013-09-25.
|
||||
" @Revision: 746
|
||||
" GetLatestVimScripts: 1863 1 tlib.vim
|
||||
|
||||
if &cp || exists("loaded_tlib")
|
||||
@ -14,7 +14,7 @@ if v:version < 700 "{{{2
|
||||
echoerr "tlib requires Vim >= 7"
|
||||
finish
|
||||
endif
|
||||
let loaded_tlib = 102
|
||||
let loaded_tlib = 106
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
@ -114,240 +114,5 @@ command! -nargs=0 -complete=command TBrowseScriptnames call
|
||||
command! -nargs=1 -complete=command TTimeCommand call tlib#cmd#Time(<q-args>)
|
||||
|
||||
|
||||
|
||||
" :doc:
|
||||
" Variables~ {{{1
|
||||
|
||||
" When 1, automatically select the last remaining item only if the list
|
||||
" had only one item to begin with.
|
||||
" When 2, automatically select a last remaining item after applying
|
||||
" any filters.
|
||||
" See |tlib#input#List()|.
|
||||
TLet g:tlib_pick_last_item = 1
|
||||
|
||||
" If a list is bigger than this value, don't try to be smart when
|
||||
" selecting an item. Be slightly faster instead.
|
||||
" See |tlib#input#List()|.
|
||||
TLet g:tlib_sortprefs_threshold = 200
|
||||
|
||||
" Scratch window position. By default the list window is opened on the
|
||||
" bottom. Set this variable to 'topleft' or '' to change this behaviour.
|
||||
" See |tlib#input#List()|.
|
||||
TLet g:tlib_scratch_pos = 'botright'
|
||||
|
||||
" Size of the input list window (in percent) from the main size (of &lines).
|
||||
" See |tlib#input#List()|.
|
||||
TLet g:tlib_inputlist_pct = 50
|
||||
|
||||
" Size of filename columns when listing filenames.
|
||||
" See |tlib#input#List()|.
|
||||
TLet g:tlib_inputlist_width_filename = '&co / 3'
|
||||
" TLet g:tlib_inputlist_width_filename = 25
|
||||
|
||||
" The highlight group to use for showing matches in the input list
|
||||
" window.
|
||||
" See |tlib#input#List()|.
|
||||
TLet g:tlib_inputlist_higroup = 'IncSearch'
|
||||
|
||||
" If a list contains more items, |tlib#input#List()| does not perform an
|
||||
" incremental "live search" but uses |input()| to query the user for a
|
||||
" filter. This is useful on slower machines or with very long lists.
|
||||
TLet g:tlib_inputlist_livesearch_threshold = 1000
|
||||
|
||||
" If true, |tlib#input#List()| will show some indicators about the
|
||||
" status of a filename (e.g. buflisted(), bufloaded() etc.).
|
||||
" This is disabled by default because vim checks also for the file on
|
||||
" disk when doing this.
|
||||
TLet g:tlib_inputlist_filename_indicators = 0
|
||||
|
||||
" Determine how |tlib#input#List()| and related functions work.
|
||||
" Can be "cnf", "cnfd", "cnfx", "seq", or "fuzzy". See:
|
||||
" cnfx ... Like cnfd but |g:tlib#Filter_cnfx#expander| is interpreted
|
||||
" as a wildcard (this is the default method)
|
||||
" - A plus character ("+") acts as a wildcard as if ".\{-}" (see
|
||||
" |/\{-|) were entered.
|
||||
" - Examples:
|
||||
" - "f+o" matches "fo", "fxo", and "fxxxoo", but doesn't match
|
||||
" "far".
|
||||
" - Otherwise it is a derivate of the cnf method (see below).
|
||||
" - See also |tlib#Filter_cnfx#New()|.
|
||||
" cnfd ... Like cnf but "." is interpreted as a wildcard, i.e. it is
|
||||
" expanded to "\.\{-}"
|
||||
" - A period character (".") acts as a wildcard as if ".\{-}" (see
|
||||
" |/\{-|) were entered.
|
||||
" - Examples:
|
||||
" - "f.o" matches "fo", "fxo", and "fxxxoo", but doesn't match
|
||||
" "far".
|
||||
" - Otherwise it is a derivate of the cnf method (see below).
|
||||
" - See also |tlib#Filter_cnfd#New()|.
|
||||
" cnf .... Match substrings
|
||||
" - A blank creates an AND conjunction, i.e. the next pattern has to
|
||||
" match too.
|
||||
" - A pipe character ("|") creates an OR conjunction, either this or
|
||||
" the next next pattern has to match.
|
||||
" - Patterns are very 'nomagic' |regexp| with a |\V| prefix.
|
||||
" - A pattern starting with "-" makes the filter exclude items
|
||||
" matching that pattern.
|
||||
" - Examples:
|
||||
" - "foo bar" matches items that contain the strings "foo" AND
|
||||
" "bar".
|
||||
" - "foo|bar boo|far" matches items that contain either ("foo" OR
|
||||
" "bar") AND ("boo" OR "far").
|
||||
" - See also |tlib#Filter_cnf#New()|.
|
||||
" seq .... Match sequences of characters
|
||||
" - |tlib#Filter_seq#New()|
|
||||
" fuzzy .. Match fuzzy character sequences
|
||||
" - |tlib#Filter_fuzzy#New()|
|
||||
TLet g:tlib_inputlist_match = 'cnfx'
|
||||
|
||||
" If not null, display only a short info about the filter.
|
||||
TLet g:tlib_inputlist_shortmessage = 0
|
||||
|
||||
" Extra tags for |tlib#tag#Retrieve()| (see there). Can also be buffer-local.
|
||||
TLet g:tlib_tags_extra = ''
|
||||
|
||||
" Filter the tag description through |substitute()| for these filetypes.
|
||||
" This applies only if the tag cmd field (see |taglist()|) is used.
|
||||
" :nodefault:
|
||||
TLet g:tlib_tag_substitute = {
|
||||
\ 'java': [['\s*{\s*$', '', '']],
|
||||
\ 'ruby': [['\<\(def\|class\|module\)\>\s\+', '', '']],
|
||||
\ 'vim': [
|
||||
\ ['^\s*com\%[mand]!\?\(\s\+-\S\+\)*\s*\u\w*\zs.*$', '', ''],
|
||||
\ ['^\s*\(let\|aug\%[roup]\|fu\%[nction]!\?\|com\%[mand]!\?\(\s\+-\S\+\)*\)\s*', '', ''],
|
||||
\ ['"\?\s*{{{\d.*$', '', ''],
|
||||
\ ],
|
||||
\ }
|
||||
|
||||
" " Alternative rx for keywords, in case 'iskeyword' is inadequate for
|
||||
" " the purposes of tlib but you don't want to change it's value.
|
||||
" TLet g:tlib_keyword_rx = {
|
||||
" \ 'vim': '\(\w\|#\)',
|
||||
" \ }
|
||||
|
||||
TLet g:tlib_filename_sep = '/'
|
||||
" TLet g:tlib_filename_sep = exists('+shellslash') && !&shellslash ? '\' : '/' " {{{2
|
||||
|
||||
" The cache directory. If empty, use |tlib#dir#MyRuntime|.'/cache'.
|
||||
" You might want to delete old files from this directory from time to
|
||||
" time with a command like: >
|
||||
" find ~/vimfiles/cache/ -atime +31 -type f -print -delete
|
||||
TLet g:tlib_cache = ''
|
||||
|
||||
" Where to display the line when using |tlib#buffer#ViewLine|.
|
||||
" For possible values for position see |scroll-cursor|.
|
||||
TLet g:tlib_viewline_position = 'zz'
|
||||
|
||||
" :doc:
|
||||
" Keys for |tlib#input#List|~
|
||||
|
||||
TLet g:tlib_inputlist_and = ' '
|
||||
TLet g:tlib_inputlist_or = '|'
|
||||
TLet g:tlib_inputlist_not = '-'
|
||||
|
||||
" When editing a list with |tlib#input#List|, typing these numeric chars
|
||||
" (as returned by getchar()) will select an item based on its index, not
|
||||
" based on its name. I.e. in the default setting, typing a "4" will
|
||||
" select the fourth item, not the item called "4".
|
||||
" In order to make keys 0-9 filter the items in the list and make
|
||||
" <m-[0-9]> select an item by its index, remove the keys 48 to 57 from
|
||||
" this dictionary.
|
||||
" Format: [KEY] = BASE ... the number is calculated as KEY - BASE.
|
||||
" :nodefault:
|
||||
TLet g:tlib_numeric_chars = {
|
||||
\ 176: 176,
|
||||
\ 177: 176,
|
||||
\ 178: 176,
|
||||
\ 179: 176,
|
||||
\ 180: 176,
|
||||
\ 181: 176,
|
||||
\ 182: 176,
|
||||
\ 183: 176,
|
||||
\ 184: 176,
|
||||
\ 185: 176,
|
||||
\}
|
||||
" \ 48: 48,
|
||||
" \ 49: 48,
|
||||
" \ 50: 48,
|
||||
" \ 51: 48,
|
||||
" \ 52: 48,
|
||||
" \ 53: 48,
|
||||
" \ 54: 48,
|
||||
" \ 55: 48,
|
||||
" \ 56: 48,
|
||||
" \ 57: 48,
|
||||
|
||||
" :nodefault:
|
||||
" The default key bindings for single-item-select list views. If you
|
||||
" want to use <c-j>, <c-k> to move the cursor up and down, add these two
|
||||
" lines to after/plugin/02tlib.vim: >
|
||||
"
|
||||
" let g:tlib_keyagents_InputList_s[10] = 'tlib#agent#Down' " <c-j>
|
||||
" let g:tlib_keyagents_InputList_s[11] = 'tlib#agent#Up' " <c-k>
|
||||
TLet g:tlib_keyagents_InputList_s = {
|
||||
\ "\<PageUp>": 'tlib#agent#PageUp',
|
||||
\ "\<PageDown>": 'tlib#agent#PageDown',
|
||||
\ "\<Up>": 'tlib#agent#Up',
|
||||
\ "\<Down>": 'tlib#agent#Down',
|
||||
\ "\<c-Up>": 'tlib#agent#UpN',
|
||||
\ "\<c-Down>": 'tlib#agent#DownN',
|
||||
\ "\<Left>": 'tlib#agent#ShiftLeft',
|
||||
\ "\<Right>": 'tlib#agent#ShiftRight',
|
||||
\ 18: 'tlib#agent#Reset',
|
||||
\ 242: 'tlib#agent#Reset',
|
||||
\ 17: 'tlib#agent#Input',
|
||||
\ 241: 'tlib#agent#Input',
|
||||
\ 27: 'tlib#agent#Exit',
|
||||
\ 26: 'tlib#agent#Suspend',
|
||||
\ 250: 'tlib#agent#Suspend',
|
||||
\ 15: 'tlib#agent#SuspendToParentWindow',
|
||||
\ 63: 'tlib#agent#Help',
|
||||
\ "\<F1>": 'tlib#agent#Help',
|
||||
\ "\<F10>": 'tlib#agent#ExecAgentByName',
|
||||
\ "\<S-Esc>": 'tlib#agent#ExecAgentByName',
|
||||
\ "\<bs>": 'tlib#agent#ReduceFilter',
|
||||
\ "\<del>": 'tlib#agent#ReduceFilter',
|
||||
\ "\<c-bs>": 'tlib#agent#PopFilter',
|
||||
\ "\<m-bs>": 'tlib#agent#PopFilter',
|
||||
\ "\<c-del>": 'tlib#agent#PopFilter',
|
||||
\ "\<m-del>": 'tlib#agent#PopFilter',
|
||||
\ "\<s-space>": 'tlib#agent#Wildcard',
|
||||
\ 191: 'tlib#agent#Debug',
|
||||
\ char2nr(g:tlib_inputlist_or): 'tlib#agent#OR',
|
||||
\ char2nr(g:tlib_inputlist_and): 'tlib#agent#AND',
|
||||
\ }
|
||||
|
||||
" Number of items to move when pressing <c-up/down> in the input list window.
|
||||
TLet g:tlib_scroll_lines = 10
|
||||
|
||||
" :nodefault:
|
||||
TLet g:tlib_keyagents_InputList_m = {
|
||||
\ 35: 'tlib#agent#Select',
|
||||
\ "\<s-up>": 'tlib#agent#SelectUp',
|
||||
\ "\<s-down>": 'tlib#agent#SelectDown',
|
||||
\ 1: 'tlib#agent#SelectAll',
|
||||
\ 225: 'tlib#agent#SelectAll',
|
||||
\ }
|
||||
" "\<c-space>": 'tlib#agent#Select'
|
||||
|
||||
" :nodefault:
|
||||
TLet g:tlib_handlers_EditList = [
|
||||
\ {'key': 5, 'agent': 'tlib#agent#EditItem', 'key_name': '<c-e>', 'help': 'Edit item'},
|
||||
\ {'key': 4, 'agent': 'tlib#agent#DeleteItems', 'key_name': '<c-d>', 'help': 'Delete item(s)'},
|
||||
\ {'key': 14, 'agent': 'tlib#agent#NewItem', 'key_name': '<c-n>', 'help': 'New item'},
|
||||
\ {'key': 24, 'agent': 'tlib#agent#Cut', 'key_name': '<c-x>', 'help': 'Cut item(s)'},
|
||||
\ {'key': 3, 'agent': 'tlib#agent#Copy', 'key_name': '<c-c>', 'help': 'Copy item(s)'},
|
||||
\ {'key': 22, 'agent': 'tlib#agent#Paste', 'key_name': '<c-v>', 'help': 'Paste item(s)'},
|
||||
\ {'pick_last_item': 0},
|
||||
\ {'return_agent': 'tlib#agent#EditReturnValue'},
|
||||
\ {'help_extra': [
|
||||
\ 'Submit changes by pressing ENTER or <c-s> or <c-w><cr>',
|
||||
\ 'Cancel editing by pressing <c-w>c'
|
||||
\ ]},
|
||||
\ ]
|
||||
|
||||
" :nodefault:
|
||||
TLet g:tlib_debug = 0
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
3
sources_non_forked/vim-airline/.gitignore
vendored
Normal file
3
sources_non_forked/vim-airline/.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
doc/tags
|
||||
*.lock
|
||||
.vim-flavor
|
4
sources_non_forked/vim-airline/.travis.yml
Normal file
4
sources_non_forked/vim-airline/.travis.yml
Normal file
@ -0,0 +1,4 @@
|
||||
language: ruby
|
||||
rvm:
|
||||
- 1.9.3
|
||||
script: rake ci
|
2
sources_non_forked/vim-airline/Gemfile
Normal file
2
sources_non_forked/vim-airline/Gemfile
Normal file
@ -0,0 +1,2 @@
|
||||
source 'https://rubygems.org'
|
||||
gem 'vim-flavor', '~> 1.1'
|
21
sources_non_forked/vim-airline/LICENSE
Normal file
21
sources_non_forked/vim-airline/LICENSE
Normal file
@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (C) 2013 Bailey Ling
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
||||
OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
199
sources_non_forked/vim-airline/README.md
Normal file
199
sources_non_forked/vim-airline/README.md
Normal file
@ -0,0 +1,199 @@
|
||||
# vim-airline [](https://travis-ci.org/bling/vim-airline)
|
||||
|
||||
Lean & mean status/tabline for vim that's light as air.
|
||||
|
||||

|
||||
|
||||
# Features
|
||||
|
||||
* Tiny core written with extensibility in mind ([open/closed principle][8]).
|
||||
* Integrates with a variety of plugins, including: [vim-bufferline][6], [fugitive][4], [unite][9], [ctrlp][10], [minibufexpl][15], [gundo][16], [undotree][17], [nerdtree][18], [tagbar][19], [vim-gitgutter][29], [vim-signify][30], [syntastic][5], [eclim][34], [lawrencium][21] and [virtualenv][31].
|
||||
* Looks good with regular fonts and provides configuration points so you can use unicode or powerline symbols.
|
||||
* Optimized for speed; it loads in under a millisecond.
|
||||
* Extensive suite of themes for popular colorschemes including [solarized][23] (dark and light), [tomorrow][24] (all variants), [base16][32] (all variants), [molokai][25], [jellybeans][26] and others; have a look at the [screenshots][14] in the wiki.
|
||||
* Supports 7.2 as the minimum Vim version.
|
||||
* The master branch tries to be as stable as possible, and new features are merged in only after they have gone through a [full regression test][33].
|
||||
* Unit testing suite.
|
||||
|
||||
## Straightforward customization
|
||||
|
||||
If you don't like the defaults, you can replace all sections with standard `statusline` syntax. Give your statusline that you've built over the years a face lift.
|
||||
|
||||

|
||||
|
||||
## Automatic truncation
|
||||
|
||||
Sections and parts within sections can be configured to automatically hide when the window size shrinks.
|
||||
|
||||

|
||||
|
||||
## Smarter tab line
|
||||
|
||||
Automatically displays all buffers when there's only one tab open.
|
||||
|
||||

|
||||
|
||||
This is disabled by default; add the following to your vimrc to enable the extension:
|
||||
|
||||
let g:airline#extensions#tabline#enabled = 1
|
||||
|
||||
Separators can be configured independently for the tabline, so here is how you can define "straight" tabs:
|
||||
|
||||
let g:airline#extensions#tabline#left_sep = ' '
|
||||
let g:airline#extensions#tabline#left_alt_sep = '|'
|
||||
|
||||
## Seamless integration
|
||||
|
||||
vim-airline integrates with a variety of plugins out of the box. These extensions will be lazily loaded if and only if you have the other plugins installed (and of course you can turn them off).
|
||||
|
||||
#### [ctrlp.vim][10]
|
||||

|
||||
|
||||
#### [unite.vim][9]
|
||||

|
||||
|
||||
#### [tagbar][19]
|
||||

|
||||
|
||||
#### [csv.vim][28]
|
||||

|
||||
|
||||
#### [syntastic][5]
|
||||

|
||||
|
||||
#### hunks ([vim-gitgutter][29] & [vim-signify][30])
|
||||

|
||||
|
||||
#### [virtualenv][31]
|
||||

|
||||
|
||||
## Extras
|
||||
|
||||
vim-airline also supplies some supplementary stand-alone extensions. In addition to the tabline extension mentioned earlier, there is also:
|
||||
|
||||
#### whitespace
|
||||

|
||||
|
||||
## Configurable and extensible
|
||||
|
||||
#### Fine-tuned configuration
|
||||
|
||||
Every section is composed of parts, and you can reorder and reconfigure them at will.
|
||||
|
||||

|
||||
|
||||
Sections can contain accents, which allows for very granular control of visuals (see configuration [here](https://github.com/bling/vim-airline/issues/299#issuecomment-25772886)).
|
||||
|
||||

|
||||
|
||||
#### Extensible pipeline
|
||||
|
||||
Completely transform the statusline to your liking. Build out the statusline as you see fit by extracting colors from the current colorscheme's highlight groups.
|
||||
|
||||

|
||||
|
||||
# Rationale
|
||||
|
||||
There's already [powerline][2], why yet another statusline?
|
||||
|
||||
* 100% vimscript; no python needed.
|
||||
|
||||
What about [vim-powerline][1]?
|
||||
|
||||
* vim-powerline has been deprecated in favor of the newer, unifying powerline, which is under active development; the new version is written in python at the core and exposes various bindings such that it can style statuslines not only in vim, but also tmux, bash, zsh, and others.
|
||||
|
||||
# Where did the name come from?
|
||||
|
||||
I wrote the initial version on an airplane, and since it's light as air it turned out to be a good name. Thanks for flying vim!
|
||||
|
||||
# Installation
|
||||
|
||||
This plugin follows the standard runtime path structure, and as such it can be installed with a variety of plugin managers:
|
||||
|
||||
* [Pathogen][11]
|
||||
* `git clone https://github.com/bling/vim-airline ~/.vim/bundle/vim-airline`
|
||||
* [NeoBundle][12]
|
||||
* `NeoBundle 'bling/vim-airline'`
|
||||
* [Vundle][13]
|
||||
* `Bundle 'bling/vim-airline'`
|
||||
* [VAM][22]
|
||||
* `call vam#ActivateAddons([ 'vim-airline' ])`
|
||||
* manual
|
||||
* copy all of the files into your `~/.vim` directory
|
||||
|
||||
# Configuration
|
||||
|
||||
`:help airline`
|
||||
|
||||
# Integrating with powerline fonts
|
||||
|
||||
For the nice looking powerline symbols to appear, you will need to install a patched font. Instructions can be found in the official powerline [documentation][20]. Prepatched fonts can be found in the [powerline-fonts][3] repository.
|
||||
|
||||
Finally, you can add the convenience variable `let g:airline_powerline_fonts = 1` to your vimrc which will automatically populate the `g:airline_symbols` dictionary with the powerline symbols.
|
||||
|
||||
# FAQ
|
||||
|
||||
Solutions to common problems can be found in the [Wiki][27].
|
||||
|
||||
# Screenshots
|
||||
|
||||
A full list of screenshots for various themes can be found in the [Wiki][14].
|
||||
|
||||
# Bugs
|
||||
|
||||
Tracking down bugs can take a very long time due to different configurations, versions, and operating systems. To ensure a timely response, please help me out by doing the following:
|
||||
|
||||
* Reproduce it with this [minivimrc][7] repository to rule out any configuration conflicts.
|
||||
* A link to your vimrc or a gist which shows how you configured the plugin(s).
|
||||
* And so I can reproduce; your `:version` of vim, and the commit of vim-airline you're using.
|
||||
|
||||
# Contributions
|
||||
|
||||
Contributions and pull requests are welcome. Please take note of the following guidelines:
|
||||
|
||||
* Adhere to the existing style as much as possible; notably, 2 space indents and long-form keywords.
|
||||
* Keep the history clean! squash your branches before you submit a pull request. `pull --rebase` is your friend.
|
||||
* Any changes to the core should be tested against Vim 7.2.
|
||||
* If you submit a theme, please create a screenshot so it can be added to the [Wiki][14].
|
||||
|
||||
# License
|
||||
|
||||
MIT License. Copyright (c) 2013 Bailey Ling.
|
||||
|
||||
|
||||
[](https://bitdeli.com/free "Bitdeli Badge")
|
||||
|
||||
[1]: https://github.com/Lokaltog/vim-powerline
|
||||
[2]: https://github.com/Lokaltog/powerline
|
||||
[3]: https://github.com/Lokaltog/powerline-fonts
|
||||
[4]: https://github.com/tpope/vim-fugitive
|
||||
[5]: https://github.com/scrooloose/syntastic
|
||||
[6]: https://github.com/bling/vim-bufferline
|
||||
[7]: https://github.com/bling/minivimrc
|
||||
[8]: http://en.wikipedia.org/wiki/Open/closed_principle
|
||||
[9]: https://github.com/Shougo/unite.vim
|
||||
[10]: https://github.com/kien/ctrlp.vim
|
||||
[11]: https://github.com/tpope/vim-pathogen
|
||||
[12]: https://github.com/Shougo/neobundle.vim
|
||||
[13]: https://github.com/gmarik/vundle
|
||||
[14]: https://github.com/bling/vim-airline/wiki/Screenshots
|
||||
[15]: https://github.com/techlivezheng/vim-plugin-minibufexpl
|
||||
[16]: https://github.com/sjl/gundo.vim
|
||||
[17]: https://github.com/mbbill/undotree
|
||||
[18]: https://github.com/scrooloose/nerdtree
|
||||
[19]: https://github.com/majutsushi/tagbar
|
||||
[20]: https://powerline.readthedocs.org/en/latest/fontpatching.html
|
||||
[21]: https://bitbucket.org/ludovicchabant/vim-lawrencium
|
||||
[22]: https://github.com/MarcWeber/vim-addon-manager
|
||||
[23]: https://github.com/altercation/solarized
|
||||
[24]: https://github.com/chriskempson/tomorrow-theme
|
||||
[25]: https://github.com/tomasr/molokai
|
||||
[26]: https://github.com/nanotech/jellybeans.vim
|
||||
[27]: https://github.com/bling/vim-airline/wiki/FAQ
|
||||
[28]: https://github.com/chrisbra/csv.vim
|
||||
[29]: https://github.com/airblade/vim-gitgutter
|
||||
[30]: https://github.com/mhinz/vim-signify
|
||||
[31]: https://github.com/jmcantrell/vim-virtualenv
|
||||
[32]: https://github.com/chriskempson/base16-vim
|
||||
[33]: https://github.com/bling/vim-airline/wiki/Test-Plan
|
||||
[34]: http://eclim.org
|
14
sources_non_forked/vim-airline/Rakefile
Normal file
14
sources_non_forked/vim-airline/Rakefile
Normal file
@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env rake
|
||||
|
||||
task :default => [:test]
|
||||
|
||||
task :ci => [:dump, :test]
|
||||
|
||||
task :dump do
|
||||
sh 'vim --version'
|
||||
end
|
||||
|
||||
task :test do
|
||||
sh 'bundle exec vim-flavor test'
|
||||
end
|
||||
|
170
sources_non_forked/vim-airline/autoload/airline.vim
Normal file
170
sources_non_forked/vim-airline/autoload/airline.vim
Normal file
@ -0,0 +1,170 @@
|
||||
" MIT License. Copyright (c) 2013 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
let g:airline_statusline_funcrefs = get(g:, 'airline_statusline_funcrefs', [])
|
||||
|
||||
let s:sections = ['a','b','c','gutter','x','y','z','warning']
|
||||
let s:inactive_funcrefs = []
|
||||
|
||||
function! airline#add_statusline_func(name)
|
||||
call airline#add_statusline_funcref(function(a:name))
|
||||
endfunction
|
||||
|
||||
function! airline#add_statusline_funcref(function)
|
||||
if index(g:airline_statusline_funcrefs, a:function) >= 0
|
||||
echohl WarningMsg
|
||||
echo 'The airline statusline funcref '.string(a:function).' has already been added.'
|
||||
echohl NONE
|
||||
return
|
||||
endif
|
||||
call add(g:airline_statusline_funcrefs, a:function)
|
||||
endfunction
|
||||
|
||||
function! airline#remove_statusline_func(name)
|
||||
let i = index(g:airline_statusline_funcrefs, function(a:name))
|
||||
if i > -1
|
||||
call remove(g:airline_statusline_funcrefs, i)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#add_inactive_statusline_func(name)
|
||||
call add(s:inactive_funcrefs, function(a:name))
|
||||
endfunction
|
||||
|
||||
function! airline#load_theme()
|
||||
if exists('*airline#themes#{g:airline_theme}#refresh')
|
||||
call airline#themes#{g:airline_theme}#refresh()
|
||||
endif
|
||||
|
||||
let palette = g:airline#themes#{g:airline_theme}#palette
|
||||
call airline#themes#patch(palette)
|
||||
|
||||
if exists('g:airline_theme_patch_func')
|
||||
let Fn = function(g:airline_theme_patch_func)
|
||||
call Fn(palette)
|
||||
endif
|
||||
|
||||
call airline#highlighter#load_theme()
|
||||
call airline#extensions#load_theme()
|
||||
endfunction
|
||||
|
||||
function! airline#switch_theme(name)
|
||||
try
|
||||
let palette = g:airline#themes#{a:name}#palette "also lazy loads the theme
|
||||
let g:airline_theme = a:name
|
||||
catch
|
||||
echohl WarningMsg | echo 'The specified theme cannot be found.' | echohl NONE
|
||||
if exists('g:airline_theme')
|
||||
return
|
||||
else
|
||||
let g:airline_theme = 'dark'
|
||||
endif
|
||||
endtry
|
||||
|
||||
let w:airline_lastmode = ''
|
||||
call airline#update_statusline()
|
||||
call airline#load_theme()
|
||||
|
||||
" this is required to prevent clobbering the startup info message, i don't know why...
|
||||
call airline#check_mode(winnr())
|
||||
endfunction
|
||||
|
||||
function! airline#switch_matching_theme()
|
||||
if exists('g:colors_name')
|
||||
try
|
||||
let palette = g:airline#themes#{g:colors_name}#palette
|
||||
call airline#switch_theme(g:colors_name)
|
||||
return 1
|
||||
catch
|
||||
for map in items(g:airline_theme_map)
|
||||
if match(g:colors_name, map[0]) > -1
|
||||
call airline#switch_theme(map[1])
|
||||
return 1
|
||||
endif
|
||||
endfor
|
||||
endtry
|
||||
endif
|
||||
return 0
|
||||
endfunction
|
||||
|
||||
function! airline#update_statusline()
|
||||
for nr in filter(range(1, winnr('$')), 'v:val != winnr()')
|
||||
call setwinvar(nr, 'airline_active', 0)
|
||||
let context = { 'winnr': nr, 'active': 0, 'bufnr': winbufnr(nr) }
|
||||
call s:invoke_funcrefs(context, s:inactive_funcrefs)
|
||||
endfor
|
||||
|
||||
unlet! w:airline_render_left
|
||||
unlet! w:airline_render_right
|
||||
for section in s:sections
|
||||
unlet! w:airline_section_{section}
|
||||
endfor
|
||||
|
||||
let w:airline_active = 1
|
||||
let context = { 'winnr': winnr(), 'active': 1, 'bufnr': winbufnr(winnr()) }
|
||||
call s:invoke_funcrefs(context, g:airline_statusline_funcrefs)
|
||||
endfunction
|
||||
|
||||
let s:contexts = {}
|
||||
let s:core_funcrefs = [
|
||||
\ function('airline#extensions#apply'),
|
||||
\ function('airline#extensions#default#apply') ]
|
||||
function! s:invoke_funcrefs(context, funcrefs)
|
||||
let builder = airline#builder#new(a:context)
|
||||
let err = airline#util#exec_funcrefs(a:funcrefs + s:core_funcrefs, builder, a:context)
|
||||
if err == 1
|
||||
let a:context.line = builder.build()
|
||||
let s:contexts[a:context.winnr] = a:context
|
||||
call setwinvar(a:context.winnr, '&statusline', '%!airline#statusline('.a:context.winnr.')')
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#statusline(winnr)
|
||||
if has_key(s:contexts, a:winnr)
|
||||
return '%{airline#check_mode('.a:winnr.')}'.s:contexts[a:winnr].line
|
||||
endif
|
||||
|
||||
" in rare circumstances this happens...see #276
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
function! airline#check_mode(winnr)
|
||||
let context = s:contexts[a:winnr]
|
||||
|
||||
if get(w:, 'airline_active', 1)
|
||||
let l:m = mode()
|
||||
if l:m ==# "i"
|
||||
let l:mode = ['insert']
|
||||
elseif l:m ==# "R"
|
||||
let l:mode = ['replace']
|
||||
elseif l:m =~# '\v(v|V||s|S|)'
|
||||
let l:mode = ['visual']
|
||||
else
|
||||
let l:mode = ['normal']
|
||||
endif
|
||||
let w:airline_current_mode = get(g:airline_mode_map, l:m, l:m)
|
||||
else
|
||||
let l:mode = ['inactive']
|
||||
let w:airline_current_mode = get(g:airline_mode_map, '__')
|
||||
endif
|
||||
|
||||
if g:airline_detect_modified
|
||||
if &modified
|
||||
call add(l:mode, 'modified')
|
||||
endif
|
||||
endif
|
||||
|
||||
if g:airline_detect_paste && &paste
|
||||
call add(l:mode, 'paste')
|
||||
endif
|
||||
|
||||
let mode_string = join(l:mode)
|
||||
if get(w:, 'airline_lastmode', '') != mode_string
|
||||
call airline#highlighter#highlight_modified_inactive(context.bufnr)
|
||||
call airline#highlighter#highlight(l:mode)
|
||||
let w:airline_lastmode = mode_string
|
||||
endif
|
||||
|
||||
return ''
|
||||
endfunction
|
||||
|
74
sources_non_forked/vim-airline/autoload/airline/builder.vim
Normal file
74
sources_non_forked/vim-airline/autoload/airline/builder.vim
Normal file
@ -0,0 +1,74 @@
|
||||
" MIT License. Copyright (c) 2013 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
let s:prototype = {}
|
||||
|
||||
function! s:prototype.split(...)
|
||||
let self._side = 0
|
||||
let self._line .= '%#'.self._curgroup.'#'.(a:0 ? a:1 : '%=')
|
||||
endfunction
|
||||
|
||||
function! s:prototype.add_section_spaced(group, contents)
|
||||
call self.add_section(a:group, (g:airline_symbols.space).a:contents.(g:airline_symbols.space))
|
||||
endfunction
|
||||
|
||||
function! s:prototype.add_section(group, contents)
|
||||
if self._curgroup != ''
|
||||
if self._curgroup == a:group
|
||||
let self._line .= self._side ? self._context.left_alt_sep : self._context.right_alt_sep
|
||||
else
|
||||
call airline#highlighter#add_separator(self._curgroup, a:group, self._side)
|
||||
let self._line .= '%#'.self._curgroup.'_to_'.a:group.'#'
|
||||
let self._line .= self._side ? self._context.left_sep : self._context.right_sep
|
||||
endif
|
||||
endif
|
||||
|
||||
if self._curgroup != a:group
|
||||
let self._line .= '%#'.a:group.'#'
|
||||
endif
|
||||
|
||||
if self._context.active
|
||||
let contents = []
|
||||
let content_parts = split(a:contents, '__accent')
|
||||
for cpart in content_parts
|
||||
let accent = matchstr(cpart, '_\zs[^#]*\ze')
|
||||
call add(contents, cpart)
|
||||
endfor
|
||||
let line = join(contents, a:group)
|
||||
let line = substitute(line, '__restore__', a:group, 'g')
|
||||
else
|
||||
let line = substitute(a:contents, '%#__accent[^#]*#', '', 'g')
|
||||
let line = substitute(line, '%#__restore__#', '', 'g')
|
||||
endif
|
||||
|
||||
let self._line .= line
|
||||
let self._curgroup = a:group
|
||||
endfunction
|
||||
|
||||
function! s:prototype.add_raw(text)
|
||||
let self._line .= a:text
|
||||
endfunction
|
||||
|
||||
function! s:prototype.build()
|
||||
if !self._context.active
|
||||
let self._line = substitute(self._line, '%#.\{-}\ze#', '\0_inactive', 'g')
|
||||
endif
|
||||
return self._line
|
||||
endfunction
|
||||
|
||||
function! airline#builder#new(context)
|
||||
let builder = copy(s:prototype)
|
||||
let builder._context = a:context
|
||||
let builder._side = 1
|
||||
let builder._curgroup = ''
|
||||
let builder._line = ''
|
||||
|
||||
call extend(builder._context, {
|
||||
\ 'left_sep': g:airline_left_sep,
|
||||
\ 'left_alt_sep': g:airline_left_alt_sep,
|
||||
\ 'right_sep': g:airline_right_sep,
|
||||
\ 'right_alt_sep': g:airline_right_alt_sep,
|
||||
\ }, 'keep')
|
||||
return builder
|
||||
endfunction
|
||||
|
50
sources_non_forked/vim-airline/autoload/airline/debug.vim
Normal file
50
sources_non_forked/vim-airline/autoload/airline/debug.vim
Normal file
@ -0,0 +1,50 @@
|
||||
" MIT License. Copyright (c) 2013 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
function! airline#debug#profile1()
|
||||
profile start airline-profile-switch.log
|
||||
profile func *
|
||||
profile file *
|
||||
split
|
||||
for i in range(1, 1000)
|
||||
wincmd w
|
||||
redrawstatus
|
||||
endfor
|
||||
profile pause
|
||||
noautocmd qall!
|
||||
endfunction
|
||||
|
||||
function! airline#debug#profile2()
|
||||
profile start airline-profile-cursor.log
|
||||
profile func *
|
||||
profile file *
|
||||
edit blank
|
||||
call setline(1, 'all your base are belong to us')
|
||||
call setline(2, 'all your base are belong to us')
|
||||
let positions = [[1,2], [2,2], [1,2], [1,1]]
|
||||
for i in range(1, 1000)
|
||||
for pos in positions
|
||||
call cursor(pos[0], pos[1])
|
||||
redrawstatus
|
||||
endfor
|
||||
endfor
|
||||
profile pause
|
||||
noautocmd qall!
|
||||
endfunction
|
||||
|
||||
function! airline#debug#profile3()
|
||||
profile start airline-profile-mode.log
|
||||
profile func *
|
||||
profile file *
|
||||
|
||||
for i in range(1000)
|
||||
startinsert
|
||||
redrawstatus
|
||||
stopinsert
|
||||
redrawstatus
|
||||
endfor
|
||||
|
||||
profile pause
|
||||
noautocmd qall!
|
||||
endfunction
|
||||
|
@ -0,0 +1,32 @@
|
||||
" MIT License. Copyright (c) 2013 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
function! airline#deprecation#check()
|
||||
if exists('g:airline_enable_fugitive') || exists('g:airline_fugitive_prefix')
|
||||
echom 'The g:airline_enable_fugitive and g:airline_fugitive_prefix variables are obsolete. Please read the documentation about the branch extension.'
|
||||
endif
|
||||
|
||||
let tests = [
|
||||
\ [ 'g:airline_paste_symbol', 'g:airline_symbols.paste' ],
|
||||
\ [ 'g:airline_readonly_symbol', 'g:airline_symbols.readonly' ],
|
||||
\ [ 'g:airline_linecolumn_prefix', 'g:airline_symbols.linenr' ],
|
||||
\ [ 'g:airline_branch_prefix', 'g:airline_symbols.branch' ],
|
||||
\ [ 'g:airline_branch_empty_message', 'g:airline#extensions#branch#empty_message' ],
|
||||
\ [ 'g:airline_detect_whitespace', 'g:airline#extensions#whitespace#enabled|show_message' ],
|
||||
\ [ 'g:airline_enable_hunks', 'g:airline#extensions#hunks#enabled' ],
|
||||
\ [ 'g:airline_enable_tagbar', 'g:airline#extensions#tagbar#enabled' ],
|
||||
\ [ 'g:airline_enable_csv', 'g:airline#extensions#csv#enabled' ],
|
||||
\ [ 'g:airline_enable_branch', 'g:airline#extensions#branch#enabled' ],
|
||||
\ [ 'g:airline_enable_bufferline', 'g:airline#extensions#bufferline#enabled' ],
|
||||
\ [ 'g:airline_enable_syntastic', 'g:airline#extensions#syntastic#enabled' ],
|
||||
\ [ 'g:airline_enable_eclim', 'g:airline#extensions#eclim#enabled' ],
|
||||
\ ]
|
||||
for test in tests
|
||||
if exists(test[0])
|
||||
let max = winwidth(0) - 16
|
||||
let msg = printf('The variable %s is deprecated and may not work in the future. It has been replaced with %s. Please read the documentation.', test[0], test[1])
|
||||
echom msg[:max].'...'
|
||||
endif
|
||||
endfor
|
||||
endfunction
|
||||
|
215
sources_non_forked/vim-airline/autoload/airline/extensions.vim
Normal file
215
sources_non_forked/vim-airline/autoload/airline/extensions.vim
Normal file
@ -0,0 +1,215 @@
|
||||
" MIT License. Copyright (c) 2013 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 = {
|
||||
\ 'netrw': [ 'netrw', '%f' ],
|
||||
\ '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 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'))
|
||||
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
|
||||
|
||||
" load all other extensions not part of the default distribution
|
||||
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
|
||||
endfunction
|
||||
|
@ -0,0 +1,76 @@
|
||||
" MIT License. Copyright (c) 2013 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
let s:has_fugitive = exists('*fugitive#head')
|
||||
let s:has_fugitive_detect = exists('*fugitive#detect')
|
||||
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:empty_message = get(g:, 'airline#extensions#branch#empty_message',
|
||||
\ get(g:, 'airline_branch_empty_message', ''))
|
||||
let s:symbol = get(g:, 'airline#extensions#branch#symbol', g:airline_symbols.branch)
|
||||
|
||||
function! airline#extensions#branch#get_head()
|
||||
let head = ''
|
||||
|
||||
if s:has_fugitive && !exists('b:mercurial_dir')
|
||||
let head = fugitive#head()
|
||||
|
||||
if empty(head) && s:has_fugitive_detect && !exists('b:git_dir')
|
||||
call fugitive#detect(getcwd())
|
||||
let head = fugitive#head()
|
||||
endif
|
||||
endif
|
||||
|
||||
if empty(head)
|
||||
if s:has_lawrencium
|
||||
let head = lawrencium#statusline()
|
||||
endif
|
||||
endif
|
||||
|
||||
if empty(head)
|
||||
if s:has_vcscommand
|
||||
call VCSCommandEnableBufferSetup()
|
||||
if exists('b:VCSCommandBufferInfo')
|
||||
let head = get(b:VCSCommandBufferInfo, 0, '')
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
return empty(head) || !s:check_in_path()
|
||||
\ ? s:empty_message
|
||||
\ : printf('%s%s', empty(s:symbol) ? '' : s: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:h'))
|
||||
|
||||
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
|
||||
endfunction
|
||||
|
@ -0,0 +1,23 @@
|
||||
" MIT License. Copyright (c) 2013 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
|
||||
|
@ -0,0 +1,16 @@
|
||||
" MIT License. Copyright (c) 2013 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
|
@ -0,0 +1,31 @@
|
||||
" MIT License. Copyright (c) 2013 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
|
||||
|
@ -0,0 +1,77 @@
|
||||
" MIT License. Copyright (c) 2013 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
|
||||
|
@ -0,0 +1,77 @@
|
||||
" MIT License. Copyright (c) 2013 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
|
||||
|
@ -0,0 +1,35 @@
|
||||
" MIT License. Copyright (c) 2013 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)
|
||||
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
|
||||
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
|
||||
|
@ -0,0 +1,54 @@
|
||||
" MIT License. Copyright (c) 2013 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
|
||||
|
@ -0,0 +1,63 @@
|
||||
" MIT License. Copyright (c) 2013 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:get_hunks_gitgutter()
|
||||
if !get(g:, 'gitgutter_enabled', 0)
|
||||
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
|
||||
|
@ -0,0 +1,37 @@
|
||||
" MIT License. Copyright (c) 2013 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
|
||||
|
@ -0,0 +1,19 @@
|
||||
" MIT License. Copyright (c) 2013 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
|
||||
|
@ -0,0 +1,243 @@
|
||||
" MIT License. Copyright (c) 2013 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: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()
|
||||
|
||||
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#formatters#{s:formatter}(a:nr, get(s:, 'current_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
|
||||
|
||||
function! s:get_buffers()
|
||||
let b = airline#builder#new(s:builder_context)
|
||||
let cur = bufnr('%')
|
||||
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
|
||||
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 ')
|
||||
return b.build()
|
||||
endfunction
|
||||
|
||||
function! s:get_tabs()
|
||||
let b = airline#builder#new(s:builder_context)
|
||||
for i in range(1, tabpagenr('$'))
|
||||
if i == tabpagenr()
|
||||
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
|
||||
else
|
||||
let group = 'airline_tab'
|
||||
endif
|
||||
let val = '%('
|
||||
if s:tab_nr_type == 0
|
||||
let val .= ' %{len(tabpagebuflist('.i.'))}'
|
||||
else
|
||||
let val .= (g:airline_symbols.space).i
|
||||
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', ' %999XX ')
|
||||
call b.add_section('airline_tabtype', ' tabs ')
|
||||
return b.build()
|
||||
endfunction
|
||||
|
@ -0,0 +1,60 @@
|
||||
" MIT License. Copyright (c) 2013 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#formatters#default(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 s:wrap_name(a:bufnr, _)
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#tabline#formatters#unique_tail(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] = s:wrap_name(nr, tail)
|
||||
endif
|
||||
endfor
|
||||
|
||||
for nr in values(duplicates)
|
||||
let map[nr] = s:wrap_name(nr, fnamemodify(bufname(nr), ':p:.'))
|
||||
endfor
|
||||
|
||||
return map[a:bufnr]
|
||||
endfunction
|
||||
|
||||
function! s:wrap_name(bufnr, buffer_name)
|
||||
let _ = s:buf_nr_show ? printf(s:buf_nr_format, a:bufnr) : ''
|
||||
let _ .= a:buffer_name
|
||||
if getbufvar(a:bufnr, '&modified') == 1
|
||||
let _ .= s:buf_modified_symbol
|
||||
endif
|
||||
return _
|
||||
endfunction
|
||||
|
@ -0,0 +1,39 @@
|
||||
" MIT License. Copyright (c) 2013 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
|
||||
|
||||
function! airline#extensions#tagbar#currenttag()
|
||||
if get(w:, 'airline_active', 0)
|
||||
return tagbar#currenttag('%s', '', s:flags)
|
||||
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
|
||||
|
@ -0,0 +1,27 @@
|
||||
" MIT License. Copyright (c) 2013 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
|
||||
|
@ -0,0 +1,23 @@
|
||||
" MIT License. Copyright (c) 2013 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
|
||||
|
@ -0,0 +1,20 @@
|
||||
" MIT License. Copyright (c) 2013 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
|
||||
|
@ -0,0 +1,78 @@
|
||||
" MIT License. Copyright (c) 2013 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:enabled = 1
|
||||
|
||||
function! airline#extensions#whitespace#check()
|
||||
if &readonly || !&modifiable || !s:enabled
|
||||
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(' $', 'nw')
|
||||
endif
|
||||
|
||||
let mixed = 0
|
||||
if index(checks, 'indent') > -1
|
||||
let indents = [search('^ \{2,}', 'nb'), search('^ \{2,}', 'n'), search('^\t', 'nb'), search('^\t', 'n')]
|
||||
let mixed = indents[0] != 0 && indents[1] != 0 && indents[2] != 0 && indents[3] != 0
|
||||
endif
|
||||
|
||||
if trailing != 0 || mixed
|
||||
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
|
||||
let mixnr = indents[0] == indents[1] ? indents[0] : indents[2]
|
||||
let b:airline_whitespace_check .= (g:airline_symbols.space).printf(s:mixed_indent_format, mixnr)
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
return b:airline_whitespace_check
|
||||
endfunction!
|
||||
|
||||
function! airline#extensions#whitespace#toggle()
|
||||
if s:enabled
|
||||
autocmd! airline_whitespace CursorHold,BufWritePost
|
||||
augroup! airline_whitespace
|
||||
let s:enabled = 0
|
||||
else
|
||||
call airline#extensions#whitespace#init()
|
||||
let s:enabled = 1
|
||||
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
|
||||
|
156
sources_non_forked/vim-airline/autoload/airline/highlighter.vim
Normal file
156
sources_non_forked/vim-airline/autoload/airline/highlighter.vim
Normal file
@ -0,0 +1,156 @@
|
||||
" MIT License. Copyright (c) 2013 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
let s:is_win32term = (has('win32') || has('win64')) && !has('gui_running')
|
||||
let s:separators = {}
|
||||
let s:accents = {}
|
||||
|
||||
function! s:gui2cui(rgb, fallback)
|
||||
if a:rgb == ''
|
||||
return a:fallback
|
||||
endif
|
||||
let rgb = map(matchlist(a:rgb, '#\(..\)\(..\)\(..\)')[1:3], '0 + ("0x".v:val)')
|
||||
let rgb = [rgb[0] > 127 ? 4 : 0, rgb[1] > 127 ? 2 : 0, rgb[2] > 127 ? 1 : 0]
|
||||
return rgb[0]+rgb[1]+rgb[2]
|
||||
endfunction
|
||||
|
||||
function! s:get_syn(group, what)
|
||||
" need to pass in mode, known to break on 7.3.547
|
||||
let mode = has('gui_running') ? 'gui' : 'cterm'
|
||||
let color = synIDattr(synIDtrans(hlID(a:group)), a:what, mode)
|
||||
if empty(color) || color == -1
|
||||
let color = synIDattr(synIDtrans(hlID('Normal')), a:what, mode)
|
||||
endif
|
||||
if empty(color) || color == -1
|
||||
if has('gui_running')
|
||||
let color = a:what ==# 'fg' ? '#000000' : '#FFFFFF'
|
||||
else
|
||||
let color = a:what ==# 'fg' ? 0 : 1
|
||||
endif
|
||||
endif
|
||||
return color
|
||||
endfunction
|
||||
|
||||
function! s:get_array(fg, bg, opts)
|
||||
let fg = a:fg
|
||||
let bg = a:bg
|
||||
return has('gui_running')
|
||||
\ ? [ fg, bg, '', '', join(a:opts, ',') ]
|
||||
\ : [ '', '', fg, bg, join(a:opts, ',') ]
|
||||
endfunction
|
||||
|
||||
function! airline#highlighter#get_highlight(group, ...)
|
||||
let fg = s:get_syn(a:group, 'fg')
|
||||
let bg = s:get_syn(a:group, 'bg')
|
||||
let reverse = synIDattr(synIDtrans(hlID(a:group)), 'reverse', has('gui_running') ? 'gui' : 'term')
|
||||
return reverse ? s:get_array(bg, fg, a:000) : s:get_array(fg, bg, a:000)
|
||||
endfunction
|
||||
|
||||
function! airline#highlighter#get_highlight2(fg, bg, ...)
|
||||
let fg = s:get_syn(a:fg[0], a:fg[1])
|
||||
let bg = s:get_syn(a:bg[0], a:bg[1])
|
||||
return s:get_array(fg, bg, a:000)
|
||||
endfunction
|
||||
|
||||
function! airline#highlighter#exec(group, colors)
|
||||
let colors = a:colors
|
||||
if s:is_win32term
|
||||
let colors[2] = s:gui2cui(get(colors, 0, ''), get(colors, 2, ''))
|
||||
let colors[3] = s:gui2cui(get(colors, 1, ''), get(colors, 3, ''))
|
||||
endif
|
||||
exec printf('hi %s %s %s %s %s %s %s %s',
|
||||
\ a:group,
|
||||
\ get(colors, 0, '') != '' ? 'guifg='.colors[0] : '',
|
||||
\ get(colors, 1, '') != '' ? 'guibg='.colors[1] : '',
|
||||
\ get(colors, 2, '') != '' ? 'ctermfg='.colors[2] : '',
|
||||
\ get(colors, 3, '') != '' ? 'ctermbg='.colors[3] : '',
|
||||
\ get(colors, 4, '') != '' ? 'gui='.colors[4] : '',
|
||||
\ get(colors, 4, '') != '' ? 'cterm='.colors[4] : '',
|
||||
\ get(colors, 4, '') != '' ? 'term='.colors[4] : '')
|
||||
endfunction
|
||||
|
||||
function! s:exec_separator(dict, from, to, inverse, suffix)
|
||||
let l:from = airline#themes#get_highlight(a:from.a:suffix)
|
||||
let l:to = airline#themes#get_highlight(a:to.a:suffix)
|
||||
let group = a:from.'_to_'.a:to.a:suffix
|
||||
if a:inverse
|
||||
let colors = [ l:from[1], l:to[1], l:from[3], l:to[3] ]
|
||||
else
|
||||
let colors = [ l:to[1], l:from[1], l:to[3], l:from[3] ]
|
||||
endif
|
||||
let a:dict[group] = colors
|
||||
call airline#highlighter#exec(group, colors)
|
||||
endfunction
|
||||
|
||||
function! airline#highlighter#load_theme()
|
||||
for winnr in filter(range(1, winnr('$')), 'v:val != winnr()')
|
||||
call airline#highlighter#highlight_modified_inactive(winbufnr(winnr))
|
||||
endfor
|
||||
call airline#highlighter#highlight(['inactive'])
|
||||
call airline#highlighter#highlight(['normal'])
|
||||
endfunction
|
||||
|
||||
function! airline#highlighter#add_separator(from, to, inverse)
|
||||
let s:separators[a:from.a:to] = [a:from, a:to, a:inverse]
|
||||
call <sid>exec_separator({}, a:from, a:to, a:inverse, '')
|
||||
endfunction
|
||||
|
||||
function! airline#highlighter#add_accent(accent)
|
||||
let s:accents[a:accent] = 1
|
||||
endfunction
|
||||
|
||||
function! airline#highlighter#highlight_modified_inactive(bufnr)
|
||||
if getbufvar(a:bufnr, '&modified')
|
||||
let colors = exists('g:airline#themes#{g:airline_theme}#palette.inactive_modified.airline_c')
|
||||
\ ? g:airline#themes#{g:airline_theme}#palette.inactive_modified.airline_c : []
|
||||
else
|
||||
let colors = exists('g:airline#themes#{g:airline_theme}#palette.inactive.airline_c')
|
||||
\ ? g:airline#themes#{g:airline_theme}#palette.inactive.airline_c : []
|
||||
endif
|
||||
|
||||
if !empty(colors)
|
||||
call airline#highlighter#exec('airline_c'.(a:bufnr).'_inactive', colors)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#highlighter#highlight(modes)
|
||||
let p = g:airline#themes#{g:airline_theme}#palette
|
||||
|
||||
" draw the base mode, followed by any overrides
|
||||
let mapped = map(a:modes, 'v:val == a:modes[0] ? v:val : a:modes[0]."_".v:val')
|
||||
let suffix = a:modes[0] == 'inactive' ? '_inactive' : ''
|
||||
for mode in mapped
|
||||
if exists('g:airline#themes#{g:airline_theme}#palette[mode]')
|
||||
let dict = g:airline#themes#{g:airline_theme}#palette[mode]
|
||||
for kvp in items(dict)
|
||||
let mode_colors = kvp[1]
|
||||
call airline#highlighter#exec(kvp[0].suffix, mode_colors)
|
||||
|
||||
for accent in keys(s:accents)
|
||||
if !has_key(p.accents, accent)
|
||||
continue
|
||||
endif
|
||||
let colors = copy(mode_colors)
|
||||
if p.accents[accent][0] != ''
|
||||
let colors[0] = p.accents[accent][0]
|
||||
endif
|
||||
if p.accents[accent][2] != ''
|
||||
let colors[2] = p.accents[accent][2]
|
||||
endif
|
||||
if len(colors) >= 5
|
||||
let colors[4] = get(p.accents[accent], 4, '')
|
||||
else
|
||||
call add(colors, get(p.accents[accent], 4, ''))
|
||||
endif
|
||||
call airline#highlighter#exec(kvp[0].suffix.'_'.accent, colors)
|
||||
endfor
|
||||
endfor
|
||||
|
||||
" TODO: optimize this
|
||||
for sep in items(s:separators)
|
||||
call <sid>exec_separator(dict, sep[1][0], sep[1][1], sep[1][2], suffix)
|
||||
endfor
|
||||
endif
|
||||
endfor
|
||||
endfunction
|
||||
|
113
sources_non_forked/vim-airline/autoload/airline/init.vim
Normal file
113
sources_non_forked/vim-airline/autoload/airline/init.vim
Normal file
@ -0,0 +1,113 @@
|
||||
" MIT License. Copyright (c) 2013 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
function! s:check_defined(variable, default)
|
||||
if !exists(a:variable)
|
||||
let {a:variable} = a:default
|
||||
endif
|
||||
endfunction
|
||||
|
||||
let s:loaded = 0
|
||||
function! airline#init#bootstrap()
|
||||
if s:loaded
|
||||
return
|
||||
endif
|
||||
let s:loaded = 1
|
||||
|
||||
let g:airline#init#bootstrapping = 1
|
||||
|
||||
call s:check_defined('g:airline_left_sep', get(g:, 'airline_powerline_fonts', 0)?"\ue0b0":">")
|
||||
call s:check_defined('g:airline_left_alt_sep', get(g:, 'airline_powerline_fonts', 0)?"\ue0b1":">")
|
||||
call s:check_defined('g:airline_right_sep', get(g:, 'airline_powerline_fonts', 0)?"\ue0b2":"<")
|
||||
call s:check_defined('g:airline_right_alt_sep', get(g:, 'airline_powerline_fonts', 0)?"\ue0b3":"<")
|
||||
call s:check_defined('g:airline_detect_modified', 1)
|
||||
call s:check_defined('g:airline_detect_paste', 1)
|
||||
call s:check_defined('g:airline_detect_iminsert', 0)
|
||||
call s:check_defined('g:airline_inactive_collapse', 1)
|
||||
call s:check_defined('g:airline_exclude_filenames', ['DebuggerWatch','DebuggerStack','DebuggerStatus'])
|
||||
call s:check_defined('g:airline_exclude_filetypes', [])
|
||||
call s:check_defined('g:airline_exclude_preview', 0)
|
||||
|
||||
call s:check_defined('g:airline_mode_map', {})
|
||||
call extend(g:airline_mode_map, {
|
||||
\ '__' : '------',
|
||||
\ 'n' : 'NORMAL',
|
||||
\ 'i' : 'INSERT',
|
||||
\ 'R' : 'REPLACE',
|
||||
\ 'v' : 'VISUAL',
|
||||
\ 'V' : 'V-LINE',
|
||||
\ 'c' : 'COMMAND',
|
||||
\ '' : 'V-BLOCK',
|
||||
\ 's' : 'SELECT',
|
||||
\ 'S' : 'S-LINE',
|
||||
\ '' : 'S-BLOCK',
|
||||
\ }, 'keep')
|
||||
|
||||
call s:check_defined('g:airline_theme_map', {})
|
||||
call extend(g:airline_theme_map, {
|
||||
\ 'Tomorrow.*': 'tomorrow',
|
||||
\ 'base16.*': 'base16',
|
||||
\ 'mo[l|n]okai': 'molokai',
|
||||
\ 'wombat.*': 'wombat',
|
||||
\ '.*zenburn.*': 'zenburn',
|
||||
\ '.*solarized.*': 'solarized',
|
||||
\ }, 'keep')
|
||||
|
||||
call s:check_defined('g:airline_symbols', {})
|
||||
call extend(g:airline_symbols, {
|
||||
\ 'paste': get(g:, 'airline_paste_symbol', 'PASTE'),
|
||||
\ 'readonly': get(g:, 'airline_readonly_symbol', get(g:, 'airline_powerline_fonts', 0) ? "\ue0a2" : 'RO'),
|
||||
\ 'whitespace': get(g:, 'airline_powerline_fonts', 0) ? "\u2739" : '!',
|
||||
\ 'linenr': get(g:, 'airline_linecolumn_prefix', get(g:, 'airline_powerline_fonts', 0) ? "\ue0a1" : ':' ),
|
||||
\ 'branch': get(g:, 'airline_branch_prefix', get(g:, 'airline_powerline_fonts', 0) ? "\ue0a0" : ''),
|
||||
\ 'modified': '+',
|
||||
\ 'space': ' ',
|
||||
\ }, 'keep')
|
||||
|
||||
call airline#parts#define('mode', {
|
||||
\ 'function': 'airline#parts#mode',
|
||||
\ 'accent': 'bold',
|
||||
\ })
|
||||
call airline#parts#define_function('iminsert', 'airline#parts#iminsert')
|
||||
call airline#parts#define_function('paste', 'airline#parts#paste')
|
||||
call airline#parts#define_function('filetype', 'airline#parts#filetype')
|
||||
call airline#parts#define('readonly', {
|
||||
\ 'function': 'airline#parts#readonly',
|
||||
\ 'accent': 'red',
|
||||
\ })
|
||||
call airline#parts#define_raw('file', '%f%m')
|
||||
call airline#parts#define_raw('linenr', '%{g:airline_symbols.linenr}%#__accent_bold#%4l%#__restore__#')
|
||||
call airline#parts#define_function('ffenc', 'airline#parts#ffenc')
|
||||
call airline#parts#define_empty(['hunks', 'branch', 'tagbar', 'syntastic', 'eclim', 'whitespace'])
|
||||
|
||||
unlet g:airline#init#bootstrapping
|
||||
endfunction
|
||||
|
||||
function! airline#init#sections()
|
||||
let spc = g:airline_symbols.space
|
||||
if !exists('g:airline_section_a')
|
||||
let g:airline_section_a = airline#section#create_left(['mode', 'paste', 'iminsert'])
|
||||
endif
|
||||
if !exists('g:airline_section_b')
|
||||
let g:airline_section_b = airline#section#create(['hunks', 'branch'])
|
||||
endif
|
||||
if !exists('g:airline_section_c')
|
||||
let g:airline_section_c = airline#section#create(['%<', 'file', spc, 'readonly'])
|
||||
endif
|
||||
if !exists('g:airline_section_gutter')
|
||||
let g:airline_section_gutter = airline#section#create(['%='])
|
||||
endif
|
||||
if !exists('g:airline_section_x')
|
||||
let g:airline_section_x = airline#section#create_right(['tagbar', 'filetype'])
|
||||
endif
|
||||
if !exists('g:airline_section_y')
|
||||
let g:airline_section_y = airline#section#create_right(['ffenc'])
|
||||
endif
|
||||
if !exists('g:airline_section_z')
|
||||
let g:airline_section_z = airline#section#create(['%3p%%'.spc, 'linenr', ':%3c '])
|
||||
endif
|
||||
if !exists('g:airline_section_warning')
|
||||
let g:airline_section_warning = airline#section#create(['syntastic', 'eclim', 'whitespace'])
|
||||
endif
|
||||
endfunction
|
||||
|
79
sources_non_forked/vim-airline/autoload/airline/parts.vim
Normal file
79
sources_non_forked/vim-airline/autoload/airline/parts.vim
Normal file
@ -0,0 +1,79 @@
|
||||
" MIT License. Copyright (c) 2013 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
let s:parts = {}
|
||||
|
||||
" PUBLIC API {{{
|
||||
|
||||
function! airline#parts#define(key, config)
|
||||
let s:parts[a:key] = get(s:parts, a:key, {})
|
||||
if exists('g:airline#init#bootstrapping')
|
||||
call extend(s:parts[a:key], a:config, 'keep')
|
||||
else
|
||||
call extend(s:parts[a:key], a:config, 'force')
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#parts#define_function(key, name)
|
||||
call airline#parts#define(a:key, { 'function': a:name })
|
||||
endfunction
|
||||
|
||||
function! airline#parts#define_text(key, text)
|
||||
call airline#parts#define(a:key, { 'text': a:text })
|
||||
endfunction
|
||||
|
||||
function! airline#parts#define_raw(key, raw)
|
||||
call airline#parts#define(a:key, { 'raw': a:raw })
|
||||
endfunction
|
||||
|
||||
function! airline#parts#define_minwidth(key, width)
|
||||
call airline#parts#define(a:key, { 'minwidth': a:width })
|
||||
endfunction
|
||||
|
||||
function! airline#parts#define_condition(key, predicate)
|
||||
call airline#parts#define(a:key, { 'condition': a:predicate })
|
||||
endfunction
|
||||
|
||||
function! airline#parts#define_accent(key, accent)
|
||||
call airline#parts#define(a:key, { 'accent': a:accent })
|
||||
endfunction
|
||||
|
||||
function! airline#parts#define_empty(keys)
|
||||
for key in a:keys
|
||||
call airline#parts#define_raw(key, '')
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
function! airline#parts#get(key)
|
||||
return get(s:parts, a:key, {})
|
||||
endfunction
|
||||
|
||||
" }}}
|
||||
|
||||
function! airline#parts#mode()
|
||||
return get(w:, 'airline_current_mode', '')
|
||||
endfunction
|
||||
|
||||
function! airline#parts#paste()
|
||||
return g:airline_detect_paste && &paste ? g:airline_symbols.paste : ''
|
||||
endfunction
|
||||
|
||||
function! airline#parts#iminsert()
|
||||
if g:airline_detect_iminsert && &iminsert && exists('b:keymap_name')
|
||||
return toupper(b:keymap_name)
|
||||
endif
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
function! airline#parts#readonly()
|
||||
return &readonly ? g:airline_symbols.readonly : ''
|
||||
endfunction
|
||||
|
||||
function! airline#parts#filetype()
|
||||
return &filetype
|
||||
endfunction
|
||||
|
||||
function! airline#parts#ffenc()
|
||||
return printf('%s%s', &fenc, strlen(&ff) > 0 ? '['.&ff.']' : '')
|
||||
endfunction
|
||||
|
73
sources_non_forked/vim-airline/autoload/airline/section.vim
Normal file
73
sources_non_forked/vim-airline/autoload/airline/section.vim
Normal file
@ -0,0 +1,73 @@
|
||||
" MIT License. Copyright (c) 2013 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
call airline#init#bootstrap()
|
||||
let s:spc = g:airline_symbols.space
|
||||
|
||||
function! s:wrap_accent(part, value)
|
||||
if exists('a:part.accent')
|
||||
call airline#highlighter#add_accent(a:part.accent)
|
||||
return '%#__accent_'.(a:part.accent).'#'.a:value.'%#__restore__#'
|
||||
endif
|
||||
return a:value
|
||||
endfunction
|
||||
|
||||
function! s:create(parts, append)
|
||||
let _ = ''
|
||||
for idx in range(len(a:parts))
|
||||
let part = airline#parts#get(a:parts[idx])
|
||||
let val = ''
|
||||
|
||||
if exists('part.function')
|
||||
let func = (part.function).'()'
|
||||
elseif exists('part.text')
|
||||
let func = '"'.(part.text).'"'
|
||||
else
|
||||
if a:append > 0 && idx != 0
|
||||
let val .= s:spc.g:airline_left_alt_sep.s:spc
|
||||
endif
|
||||
if a:append < 0 && idx != 0
|
||||
let val = s:spc.g:airline_right_alt_sep.s:spc.val
|
||||
endif
|
||||
if exists('part.raw')
|
||||
let _ .= s:wrap_accent(part, val.(part.raw))
|
||||
continue
|
||||
else
|
||||
let _ .= s:wrap_accent(part, val.a:parts[idx])
|
||||
continue
|
||||
endif
|
||||
endif
|
||||
|
||||
let minwidth = get(part, 'minwidth', 0)
|
||||
|
||||
if a:append > 0 && idx != 0
|
||||
let partval = printf('%%{airline#util#append(%s,%s)}', func, minwidth)
|
||||
elseif a:append < 0 && idx != len(a:parts) - 1
|
||||
let partval = printf('%%{airline#util#prepend(%s,%s)}', func, minwidth)
|
||||
else
|
||||
let partval = printf('%%{airline#util#wrap(%s,%s)}', func, minwidth)
|
||||
endif
|
||||
|
||||
if exists('part.condition')
|
||||
let partval = substitute(partval, '{', '{'.(part.condition).' ? ', '')
|
||||
let partval = substitute(partval, '}', ' : ""}', '')
|
||||
endif
|
||||
|
||||
let val .= s:wrap_accent(part, partval)
|
||||
let _ .= val
|
||||
endfor
|
||||
return _
|
||||
endfunction
|
||||
|
||||
function! airline#section#create(parts)
|
||||
return s:create(a:parts, 0)
|
||||
endfunction
|
||||
|
||||
function! airline#section#create_left(parts)
|
||||
return s:create(a:parts, 1)
|
||||
endfunction
|
||||
|
||||
function! airline#section#create_right(parts)
|
||||
return s:create(a:parts, -1)
|
||||
endfunction
|
||||
|
67
sources_non_forked/vim-airline/autoload/airline/themes.vim
Normal file
67
sources_non_forked/vim-airline/autoload/airline/themes.vim
Normal file
@ -0,0 +1,67 @@
|
||||
" MIT License. Copyright (c) 2013 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
" generates a dictionary which defines the colors for each highlight group
|
||||
function! airline#themes#generate_color_map(sect1, sect2, sect3, ...)
|
||||
let palette = {
|
||||
\ 'airline_a': [ a:sect1[0] , a:sect1[1] , a:sect1[2] , a:sect1[3] , get(a:sect1 , 4 , '') ] ,
|
||||
\ 'airline_b': [ a:sect2[0] , a:sect2[1] , a:sect2[2] , a:sect2[3] , get(a:sect2 , 4 , '') ] ,
|
||||
\ 'airline_c': [ a:sect3[0] , a:sect3[1] , a:sect3[2] , a:sect3[3] , get(a:sect3 , 4 , '') ] ,
|
||||
\ }
|
||||
|
||||
if a:0 > 0
|
||||
call extend(palette, {
|
||||
\ 'airline_x': [ a:1[0] , a:1[1] , a:1[2] , a:1[3] , get(a:1 , 4 , '' ) ] ,
|
||||
\ 'airline_y': [ a:2[0] , a:2[1] , a:2[2] , a:2[3] , get(a:2 , 4 , '' ) ] ,
|
||||
\ 'airline_z': [ a:3[0] , a:3[1] , a:3[2] , a:3[3] , get(a:3 , 4 , '' ) ] ,
|
||||
\ })
|
||||
else
|
||||
call extend(palette, {
|
||||
\ 'airline_x': [ a:sect3[0] , a:sect3[1] , a:sect3[2] , a:sect3[3] , '' ] ,
|
||||
\ 'airline_y': [ a:sect2[0] , a:sect2[1] , a:sect2[2] , a:sect2[3] , '' ] ,
|
||||
\ 'airline_z': [ a:sect1[0] , a:sect1[1] , a:sect1[2] , a:sect1[3] , '' ] ,
|
||||
\ })
|
||||
endif
|
||||
|
||||
return palette
|
||||
endfunction
|
||||
|
||||
function! airline#themes#get_highlight(group, ...)
|
||||
return call('airline#highlighter#get_highlight', [a:group] + a:000)
|
||||
endfunction
|
||||
|
||||
function! airline#themes#get_highlight2(fg, bg, ...)
|
||||
return call('airline#highlighter#get_highlight2', [a:fg, a:bg] + a:000)
|
||||
endfunction
|
||||
|
||||
function! airline#themes#patch(palette)
|
||||
for mode in keys(a:palette)
|
||||
if !has_key(a:palette[mode], 'airline_warning')
|
||||
let a:palette[mode]['airline_warning'] = [ '#000000', '#df5f00', 232, 166 ]
|
||||
endif
|
||||
endfor
|
||||
|
||||
let a:palette.accents = get(a:palette, 'accents', {})
|
||||
let a:palette.accents.bold = [ '', '', '', '', 'bold' ]
|
||||
let a:palette.accents.italic = [ '', '', '', '', 'italic' ]
|
||||
|
||||
if !has_key(a:palette.accents, 'red')
|
||||
let a:palette.accents.red = [ '#ff0000' , '' , 160 , '' ]
|
||||
endif
|
||||
if !has_key(a:palette.accents, 'green')
|
||||
let a:palette.accents.green = [ '#008700' , '' , 22 , '' ]
|
||||
endif
|
||||
if !has_key(a:palette.accents, 'blue')
|
||||
let a:palette.accents.blue = [ '#005fff' , '' , 27 , '' ]
|
||||
endif
|
||||
if !has_key(a:palette.accents, 'yellow')
|
||||
let a:palette.accents.yellow = [ '#dfff00' , '' , 190 , '' ]
|
||||
endif
|
||||
if !has_key(a:palette.accents, 'orange')
|
||||
let a:palette.accents.orange = [ '#df5f00' , '' , 166 , '' ]
|
||||
endif
|
||||
if !has_key(a:palette.accents, 'purple')
|
||||
let a:palette.accents.purple = [ '#af00df' , '' , 128 , '' ]
|
||||
endif
|
||||
endfunction
|
||||
|
@ -0,0 +1,52 @@
|
||||
let s:N1 = [ '#141413' , '#aeee00' , 232 , 154 ] " blackestgravel & lime
|
||||
let s:N2 = [ '#f4cf86' , '#45413b' , 222 , 238 ] " dirtyblonde & deepgravel
|
||||
let s:N3 = [ '#8cffba' , '#242321' , 121 , 235 ] " saltwatertaffy & darkgravel
|
||||
let s:N4 = [ '#666462' , 241 ] " mediumgravel
|
||||
|
||||
let s:I1 = [ '#141413' , '#0a9dff' , 232 , 39 ] " blackestgravel & tardis
|
||||
let s:I2 = [ '#f4cf86' , '#005fff' , 222 , 27 ] " dirtyblonde & facebook
|
||||
let s:I3 = [ '#0a9dff' , '#242321' , 39 , 235 ] " tardis & darkgravel
|
||||
|
||||
let s:V1 = [ '#141413' , '#ffa724' , 232 , 214 ] " blackestgravel & orange
|
||||
let s:V2 = [ '#000000' , '#fade3e' , 16 , 221 ] " coal & dalespale
|
||||
let s:V3 = [ '#000000' , '#b88853' , 16 , 137 ] " coal & toffee
|
||||
let s:V4 = [ '#c7915b' , 173 ] " coffee
|
||||
|
||||
let s:PA = [ '#f4cf86' , 222 ] " dirtyblonde
|
||||
let s:RE = [ '#ff9eb8' , 211 ] " dress
|
||||
|
||||
let s:IA = [ s:N2[1] , s:N3[1] , s:N2[3] , s:N3[3] , '' ]
|
||||
|
||||
let g:airline#themes#badwolf#palette = {}
|
||||
|
||||
let g:airline#themes#badwolf#palette.accents = {
|
||||
\ 'red': [ '#ff2c4b' , '' , 196 , '' , '' ]
|
||||
\ }
|
||||
|
||||
let g:airline#themes#badwolf#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3)
|
||||
let g:airline#themes#badwolf#palette.normal_modified = {
|
||||
\ 'airline_b': [ s:N2[0] , s:N4[0] , s:N2[2] , s:N4[1] , '' ] ,
|
||||
\ 'airline_c': [ s:V1[1] , s:N2[1] , s:V1[3] , s:N2[3] , '' ] }
|
||||
|
||||
|
||||
let g:airline#themes#badwolf#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3)
|
||||
let g:airline#themes#badwolf#palette.insert_modified = {
|
||||
\ 'airline_c': [ s:V1[1] , s:N2[1] , s:V1[3] , s:N2[3] , '' ] }
|
||||
let g:airline#themes#badwolf#palette.insert_paste = {
|
||||
\ 'airline_a': [ s:I1[0] , s:PA[0] , s:I1[2] , s:PA[1] , '' ] }
|
||||
|
||||
|
||||
let g:airline#themes#badwolf#palette.replace = copy(airline#themes#badwolf#palette.insert)
|
||||
let g:airline#themes#badwolf#palette.replace.airline_a = [ s:I1[0] , s:RE[0] , s:I1[2] , s:RE[1] , '' ]
|
||||
let g:airline#themes#badwolf#palette.replace_modified = g:airline#themes#badwolf#palette.insert_modified
|
||||
|
||||
|
||||
let g:airline#themes#badwolf#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3)
|
||||
let g:airline#themes#badwolf#palette.visual_modified = {
|
||||
\ 'airline_c': [ s:V3[0] , s:V4[0] , s:V3[2] , s:V4[1] , '' ] }
|
||||
|
||||
|
||||
let g:airline#themes#badwolf#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA)
|
||||
let g:airline#themes#badwolf#palette.inactive_modified = {
|
||||
\ 'airline_c': [ s:V1[1] , '' , s:V1[3] , '' , '' ] }
|
||||
|
@ -0,0 +1,107 @@
|
||||
if get(g:, 'airline#themes#base16#constant', 0)
|
||||
let g:airline#themes#base16#palette = {}
|
||||
|
||||
" Color palette
|
||||
let s:gui_dark_gray = '#202020'
|
||||
let s:cterm_dark_gray = 234
|
||||
let s:gui_med_gray_hi = '#303030'
|
||||
let s:cterm_med_gray_hi = 236
|
||||
let s:gui_med_gray_lo = '#3a3a3a'
|
||||
let s:cterm_med_gray_lo = 237
|
||||
let s:gui_light_gray = '#505050'
|
||||
let s:cterm_light_gray = 239
|
||||
let s:gui_green = '#99cc99'
|
||||
let s:cterm_green = 151
|
||||
let s:gui_blue = '#6a9fb5'
|
||||
let s:cterm_blue = 67
|
||||
let s:gui_purple = '#aa759f'
|
||||
let s:cterm_purple = 139
|
||||
let s:gui_orange = '#d28445'
|
||||
let s:cterm_orange = 173
|
||||
let s:gui_red = '#ac4142'
|
||||
let s:cterm_red = 131
|
||||
let s:gui_pink = '#d7afd7'
|
||||
let s:cterm_pink = 182
|
||||
|
||||
" Normal mode
|
||||
let s:N1 = [s:gui_dark_gray, s:gui_green, s:cterm_dark_gray, s:cterm_green]
|
||||
let s:N2 = [s:gui_light_gray, s:gui_med_gray_lo, s:cterm_light_gray, s:cterm_med_gray_lo]
|
||||
let s:N3 = [s:gui_green, s:gui_med_gray_hi, s:cterm_green, s:cterm_med_gray_hi]
|
||||
let g:airline#themes#base16#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3)
|
||||
let g:airline#themes#base16#palette.normal_modified = {
|
||||
\ 'airline_c': [s:gui_orange, s:gui_med_gray_hi, s:cterm_orange, s:cterm_med_gray_hi, ''],
|
||||
\ }
|
||||
|
||||
" Insert mode
|
||||
let s:I1 = [s:gui_med_gray_hi, s:gui_blue, s:cterm_med_gray_hi, s:cterm_blue]
|
||||
let s:I3 = [s:gui_blue, s:gui_med_gray_hi, s:cterm_blue, s:cterm_med_gray_hi]
|
||||
let g:airline#themes#base16#palette.insert = airline#themes#generate_color_map(s:I1, s:N2, s:I3)
|
||||
let g:airline#themes#base16#palette.insert_modified = copy(g:airline#themes#base16#palette.normal_modified)
|
||||
let g:airline#themes#base16#palette.insert_paste = {
|
||||
\ 'airline_a': [s:gui_dark_gray, s:gui_orange, s:cterm_dark_gray, s:cterm_orange, ''],
|
||||
\ }
|
||||
|
||||
" Replace mode
|
||||
let g:airline#themes#base16#palette.replace = {
|
||||
\ 'airline_a': [s:gui_dark_gray, s:gui_red, s:cterm_dark_gray, s:cterm_red, ''],
|
||||
\ 'airline_c': [s:gui_red, s:gui_med_gray_hi, s:cterm_red, s:cterm_med_gray_hi, ''],
|
||||
\ }
|
||||
let g:airline#themes#base16#palette.replace_modified = copy(g:airline#themes#base16#palette.insert_modified)
|
||||
|
||||
" Visual mode
|
||||
let s:V1 = [s:gui_dark_gray, s:gui_pink, s:cterm_dark_gray, s:cterm_pink]
|
||||
let s:V3 = [s:gui_pink, s:gui_med_gray_hi, s:cterm_pink, s:cterm_med_gray_hi]
|
||||
let g:airline#themes#base16#palette.visual = airline#themes#generate_color_map(s:V1, s:N2, s:V3)
|
||||
let g:airline#themes#base16#palette.visual_modified = copy(g:airline#themes#base16#palette.insert_modified)
|
||||
|
||||
" Inactive window
|
||||
let s:IA = [s:gui_dark_gray, s:gui_med_gray_hi, s:cterm_dark_gray, s:cterm_med_gray_hi, '']
|
||||
let g:airline#themes#base16#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA)
|
||||
let g:airline#themes#base16#palette.inactive_modified = {
|
||||
\ 'airline_c': [s:gui_orange, '', s:cterm_orange, '', ''],
|
||||
\ }
|
||||
else
|
||||
function! airline#themes#base16#refresh()
|
||||
let g:airline#themes#base16#palette = {}
|
||||
|
||||
let g:airline#themes#base16#palette.accents = {
|
||||
\ 'red': airline#themes#get_highlight('Constant'),
|
||||
\ }
|
||||
|
||||
let s:N1 = airline#themes#get_highlight2(['DiffText', 'bg'], ['DiffText', 'fg'], 'bold')
|
||||
let s:N2 = airline#themes#get_highlight('Visual')
|
||||
let s:N3 = airline#themes#get_highlight('CursorLine')
|
||||
let g:airline#themes#base16#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3)
|
||||
|
||||
let group = airline#themes#get_highlight('vimCommand')
|
||||
let g:airline#themes#base16#palette.normal_modified = {
|
||||
\ 'statusline': [ group[0], '', group[2], '', '' ]
|
||||
\ }
|
||||
|
||||
let s:I1 = airline#themes#get_highlight2(['DiffAdded', 'bg'], ['DiffAdded', 'fg'], 'bold')
|
||||
let s:I2 = airline#themes#get_highlight2(['DiffAdded', 'fg'], ['Normal', 'bg'])
|
||||
let s:I3 = s:N3
|
||||
let g:airline#themes#base16#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3)
|
||||
let g:airline#themes#base16#palette.insert_modified = g:airline#themes#base16#palette.normal_modified
|
||||
|
||||
let s:R1 = airline#themes#get_highlight2(['WarningMsg', 'bg'], ['WarningMsg', 'fg'], 'bold')
|
||||
let s:R2 = s:N2
|
||||
let s:R3 = s:N3
|
||||
let g:airline#themes#base16#palette.replace = airline#themes#generate_color_map(s:R1, s:R2, s:R3)
|
||||
let g:airline#themes#base16#palette.replace_modified = g:airline#themes#base16#palette.normal_modified
|
||||
|
||||
let s:V1 = airline#themes#get_highlight2(['Normal', 'bg'], ['Constant', 'fg'], 'bold')
|
||||
let s:V2 = airline#themes#get_highlight2(['Constant', 'fg'], ['Normal', 'bg'])
|
||||
let s:V3 = s:N3
|
||||
let g:airline#themes#base16#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3)
|
||||
let g:airline#themes#base16#palette.visual_modified = g:airline#themes#base16#palette.normal_modified
|
||||
|
||||
let s:IA = airline#themes#get_highlight2(['NonText', 'fg'], ['CursorLine', 'bg'])
|
||||
let g:airline#themes#base16#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA)
|
||||
let g:airline#themes#base16#palette.inactive_modified = {
|
||||
\ 'airline_c': [ group[0], '', group[2], '', '' ]
|
||||
\ }
|
||||
endfunction
|
||||
call airline#themes#base16#refresh()
|
||||
endif
|
||||
|
@ -0,0 +1,62 @@
|
||||
" Color palette
|
||||
let s:gui_dark_gray = '#303030'
|
||||
let s:cterm_dark_gray = 236
|
||||
let s:gui_med_gray_hi = '#444444'
|
||||
let s:cterm_med_gray_hi = 238
|
||||
let s:gui_med_gray_lo = '#3a3a3a'
|
||||
let s:cterm_med_gray_lo = 237
|
||||
let s:gui_light_gray = '#b2b2b2'
|
||||
let s:cterm_light_gray = 249
|
||||
let s:gui_green = '#afd787'
|
||||
let s:cterm_green = 150
|
||||
let s:gui_blue = '#87afd7'
|
||||
let s:cterm_blue = 110
|
||||
let s:gui_purple = '#afafd7'
|
||||
let s:cterm_purple = 146
|
||||
let s:gui_orange = '#d7af5f'
|
||||
let s:cterm_orange = 179
|
||||
let s:gui_red = '#d78787'
|
||||
let s:cterm_red = 174
|
||||
let s:gui_pink = '#d7afd7'
|
||||
let s:cterm_pink = 182
|
||||
|
||||
let g:airline#themes#bubblegum#palette = {}
|
||||
|
||||
" Normal mode
|
||||
let s:N1 = [s:gui_dark_gray, s:gui_green, s:cterm_dark_gray, s:cterm_green]
|
||||
let s:N2 = [s:gui_light_gray, s:gui_med_gray_lo, s:cterm_light_gray, s:cterm_med_gray_lo]
|
||||
let s:N3 = [s:gui_green, s:gui_med_gray_hi, s:cterm_green, s:cterm_med_gray_hi]
|
||||
let g:airline#themes#bubblegum#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3)
|
||||
let g:airline#themes#bubblegum#palette.normal_modified = {
|
||||
\ 'airline_c': [s:gui_orange, s:gui_med_gray_hi, s:cterm_orange, s:cterm_med_gray_hi, ''],
|
||||
\ }
|
||||
|
||||
" Insert mode
|
||||
let s:I1 = [s:gui_med_gray_hi, s:gui_blue, s:cterm_med_gray_hi, s:cterm_blue]
|
||||
let s:I3 = [s:gui_blue, s:gui_med_gray_hi, s:cterm_blue, s:cterm_med_gray_hi]
|
||||
let g:airline#themes#bubblegum#palette.insert = airline#themes#generate_color_map(s:I1, s:N2, s:I3)
|
||||
let g:airline#themes#bubblegum#palette.insert_modified = copy(g:airline#themes#bubblegum#palette.normal_modified)
|
||||
let g:airline#themes#bubblegum#palette.insert_paste = {
|
||||
\ 'airline_a': [s:gui_dark_gray, s:gui_orange, s:cterm_dark_gray, s:cterm_orange, ''],
|
||||
\ }
|
||||
|
||||
" Replace mode
|
||||
let g:airline#themes#bubblegum#palette.replace = {
|
||||
\ 'airline_a': [s:gui_dark_gray, s:gui_red, s:cterm_dark_gray, s:cterm_red, ''],
|
||||
\ 'airline_c': [s:gui_red, s:gui_med_gray_hi, s:cterm_red, s:cterm_med_gray_hi, ''],
|
||||
\ }
|
||||
let g:airline#themes#bubblegum#palette.replace_modified = copy(g:airline#themes#bubblegum#palette.insert_modified)
|
||||
|
||||
" Visual mode
|
||||
let s:V1 = [s:gui_dark_gray, s:gui_pink, s:cterm_dark_gray, s:cterm_pink]
|
||||
let s:V3 = [s:gui_pink, s:gui_med_gray_hi, s:cterm_pink, s:cterm_med_gray_hi]
|
||||
let g:airline#themes#bubblegum#palette.visual = airline#themes#generate_color_map(s:V1, s:N2, s:V3)
|
||||
let g:airline#themes#bubblegum#palette.visual_modified = copy(g:airline#themes#bubblegum#palette.insert_modified)
|
||||
|
||||
" Inactive window
|
||||
let s:IA = [s:gui_dark_gray, s:gui_med_gray_hi, s:cterm_dark_gray, s:cterm_med_gray_hi, '']
|
||||
let g:airline#themes#bubblegum#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA)
|
||||
let g:airline#themes#bubblegum#palette.inactive_modified = {
|
||||
\ 'airline_c': [s:gui_orange, '', s:cterm_orange, '', ''],
|
||||
\ }
|
||||
|
102
sources_non_forked/vim-airline/autoload/airline/themes/dark.vim
Normal file
102
sources_non_forked/vim-airline/autoload/airline/themes/dark.vim
Normal file
@ -0,0 +1,102 @@
|
||||
" Each theme is contained in its own file and declares variables scoped to the
|
||||
" file. These variables represent the possible "modes" that airline can
|
||||
" detect. The mode is the return value of mode(), which gets converted to a
|
||||
" readable string. The following is a list currently supported modes: normal,
|
||||
" insert, replace, visual, and inactive.
|
||||
"
|
||||
" Each mode can also have overrides. These are small changes to the mode that
|
||||
" don't require a completely different look. "modified" and "paste" are two
|
||||
" such supported overrides. These are simply suffixed to the major mode,
|
||||
" separated by an underscore. For example, "normal_modified" would be normal
|
||||
" mode where the current buffer is modified.
|
||||
"
|
||||
" The theming algorithm is a 2-pass system where the mode will draw over all
|
||||
" parts of the statusline, and then the override is applied after. This means
|
||||
" it is possible to specify a subset of the theme in overrides, as it will
|
||||
" simply overwrite the previous colors. If you want simultaneous overrides,
|
||||
" then they will need to change different parts of the statusline so they do
|
||||
" not conflict with each other.
|
||||
"
|
||||
" First, let's define an empty dictionary and assign it to the "palette"
|
||||
" variable. The # is a separator that maps with the directory structure. If
|
||||
" you get this wrong, Vim will complain loudly.
|
||||
let g:airline#themes#dark#palette = {}
|
||||
|
||||
" First let's define some arrays. The s: is just a VimL thing for scoping the
|
||||
" variables to the current script. Without this, these variables would be
|
||||
" declared globally. Now let's declare some colors for normal mode and add it
|
||||
" to the dictionary. The array is in the format:
|
||||
" [ guifg, guibg, ctermfg, ctermbg, opts ]. See "help attr-list" for valid
|
||||
" values for the "opt" value.
|
||||
let s:N1 = [ '#00005f' , '#dfff00' , 17 , 190 ]
|
||||
let s:N2 = [ '#ffffff' , '#444444' , 255 , 238 ]
|
||||
let s:N3 = [ '#9cffd3' , '#202020' , 85 , 234 ]
|
||||
let g:airline#themes#dark#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3)
|
||||
|
||||
" Here we define overrides for when the buffer is modified. This will be
|
||||
" applied after g:airline#themes#dark#palette.normal, hence why only certain keys are
|
||||
" declared.
|
||||
let g:airline#themes#dark#palette.normal_modified = {
|
||||
\ 'airline_c': [ '#ffffff' , '#5f005f' , 255 , 53 , '' ] ,
|
||||
\ }
|
||||
|
||||
|
||||
let s:I1 = [ '#00005f' , '#00dfff' , 17 , 45 ]
|
||||
let s:I2 = [ '#ffffff' , '#005fff' , 255 , 27 ]
|
||||
let s:I3 = [ '#ffffff' , '#000080' , 15 , 17 ]
|
||||
let g:airline#themes#dark#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3)
|
||||
let g:airline#themes#dark#palette.insert_modified = {
|
||||
\ 'airline_c': [ '#ffffff' , '#5f005f' , 255 , 53 , '' ] ,
|
||||
\ }
|
||||
let g:airline#themes#dark#palette.insert_paste = {
|
||||
\ 'airline_a': [ s:I1[0] , '#d78700' , s:I1[2] , 172 , '' ] ,
|
||||
\ }
|
||||
|
||||
|
||||
let g:airline#themes#dark#palette.replace = copy(g:airline#themes#dark#palette.insert)
|
||||
let g:airline#themes#dark#palette.replace.airline_a = [ s:I2[0] , '#af0000' , s:I2[2] , 124 , '' ]
|
||||
let g:airline#themes#dark#palette.replace_modified = g:airline#themes#dark#palette.insert_modified
|
||||
|
||||
|
||||
let s:V1 = [ '#000000' , '#ffaf00' , 232 , 214 ]
|
||||
let s:V2 = [ '#000000' , '#ff5f00' , 232 , 202 ]
|
||||
let s:V3 = [ '#ffffff' , '#5f0000' , 15 , 52 ]
|
||||
let g:airline#themes#dark#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3)
|
||||
let g:airline#themes#dark#palette.visual_modified = {
|
||||
\ 'airline_c': [ '#ffffff' , '#5f005f' , 255 , 53 , '' ] ,
|
||||
\ }
|
||||
|
||||
|
||||
let s:IA1 = [ '#4e4e4e' , '#1c1c1c' , 239 , 234 , '' ]
|
||||
let s:IA2 = [ '#4e4e4e' , '#262626' , 239 , 235 , '' ]
|
||||
let s:IA3 = [ '#4e4e4e' , '#303030' , 239 , 236 , '' ]
|
||||
let g:airline#themes#dark#palette.inactive = airline#themes#generate_color_map(s:IA1, s:IA2, s:IA3)
|
||||
let g:airline#themes#dark#palette.inactive_modified = {
|
||||
\ 'airline_c': [ '#875faf' , '' , 97 , '' , '' ] ,
|
||||
\ }
|
||||
|
||||
|
||||
" Accents are used to give parts within a section a slightly different look or
|
||||
" color. Here we are defining a "red" accent, which is used by the 'readonly'
|
||||
" part by default. Only the foreground colors are specified, so the background
|
||||
" colors are automatically extracted from the underlying section colors. What
|
||||
" this means is that regardless of which section the part is defined in, it
|
||||
" will be red instead of the section's foreground color. You can also have
|
||||
" multiple parts with accents within a section.
|
||||
let g:airline#themes#dark#palette.accents = {
|
||||
\ 'red': [ '#ff0000' , '' , 160 , '' ]
|
||||
\ }
|
||||
|
||||
|
||||
" Here we define the color map for ctrlp. We check for the g:loaded_ctrlp
|
||||
" variable so that related functionality is loaded iff the user is using
|
||||
" ctrlp. Note that this is optional, and if you do not define ctrlp colors
|
||||
" they will be chosen automatically from the existing palette.
|
||||
if !get(g:, 'loaded_ctrlp', 0)
|
||||
finish
|
||||
endif
|
||||
let g:airline#themes#dark#palette.ctrlp = airline#extensions#ctrlp#generate_color_map(
|
||||
\ [ '#d7d7ff' , '#5f00af' , 189 , 55 , '' ],
|
||||
\ [ '#ffffff' , '#875fd7' , 231 , 98 , '' ],
|
||||
\ [ '#5f00af' , '#ffffff' , 55 , 231 , 'bold' ])
|
||||
|
@ -0,0 +1,52 @@
|
||||
let g:airline#themes#jellybeans#palette = {}
|
||||
|
||||
" The name of the function must be 'refresh'.
|
||||
function! airline#themes#jellybeans#refresh()
|
||||
" This theme is an example of how to use helper functions to extract highlight
|
||||
" values from the corresponding colorscheme. It was written in a hurry, so it
|
||||
" is very minimalistic. If you are a jellybeans user and want to make updates,
|
||||
" please send pull requests.
|
||||
|
||||
" Here are examples where the entire highlight group is copied and an airline
|
||||
" compatible color array is generated.
|
||||
let s:N1 = airline#themes#get_highlight('DbgCurrent', 'bold')
|
||||
let s:N2 = airline#themes#get_highlight('Folded')
|
||||
let s:N3 = airline#themes#get_highlight('NonText')
|
||||
|
||||
let g:airline#themes#jellybeans#palette.accents = {
|
||||
\ 'red': airline#themes#get_highlight('Constant'),
|
||||
\ }
|
||||
|
||||
let g:airline#themes#jellybeans#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3)
|
||||
let g:airline#themes#jellybeans#palette.normal_modified = {
|
||||
\ 'airline_c': [ '#ffb964', '', 215, '', '' ]
|
||||
\ }
|
||||
|
||||
let s:I1 = airline#themes#get_highlight('DiffAdd', 'bold')
|
||||
let s:I2 = s:N2
|
||||
let s:I3 = s:N3
|
||||
let g:airline#themes#jellybeans#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3)
|
||||
let g:airline#themes#jellybeans#palette.insert_modified = g:airline#themes#jellybeans#palette.normal_modified
|
||||
|
||||
let s:R1 = airline#themes#get_highlight('WildMenu', 'bold')
|
||||
let s:R2 = s:N2
|
||||
let s:R3 = s:N3
|
||||
let g:airline#themes#jellybeans#palette.replace = airline#themes#generate_color_map(s:R1, s:R2, s:R3)
|
||||
let g:airline#themes#jellybeans#palette.replace_modified = g:airline#themes#jellybeans#palette.normal_modified
|
||||
|
||||
" Sometimes you want to mix and match colors from different groups, you can do
|
||||
" that with this method.
|
||||
let s:V1 = airline#themes#get_highlight2(['TabLineSel', 'bg'], ['DiffDelete', 'bg'], 'bold')
|
||||
let s:V2 = s:N2
|
||||
let s:V3 = s:N3
|
||||
let g:airline#themes#jellybeans#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3)
|
||||
let g:airline#themes#jellybeans#palette.visual_modified = g:airline#themes#jellybeans#palette.normal_modified
|
||||
|
||||
" And of course, you can always do it manually as well.
|
||||
let s:IA = [ '#444444', '#1c1c1c', 237, 234 ]
|
||||
let g:airline#themes#jellybeans#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA)
|
||||
let g:airline#themes#jellybeans#palette.inactive_modified = g:airline#themes#jellybeans#palette.normal_modified
|
||||
endfunction
|
||||
|
||||
call airline#themes#jellybeans#refresh()
|
||||
|
@ -0,0 +1,62 @@
|
||||
" vim-airline companion theme of Laederon
|
||||
" (https://github.com/Donearm/Laederon)
|
||||
|
||||
" Normal mode
|
||||
let s:N1 = [ '#1a1a18' , '#ffffff' , 232 , 255 ] " blackestgravel & snow
|
||||
let s:N2 = [ '#ffffff' , '#44403a' , 255, 238 ] " snow & deepgravel
|
||||
let s:N3 = [ '#90a680' , '#2e2d2a' , 64, 235 ] " dilutedpaint & darkgravel
|
||||
let s:N4 = [ '#777470' , 240 ] " gravel
|
||||
|
||||
" Insert mode
|
||||
let s:I1 = [ '#1a1a18' , '#1693a5' , 232 , 62 ] " blackestgravel & crystallake
|
||||
let s:I2 = [ '#515744' , '#44403a' , 101 , 238 ] " lichen & deepgravel
|
||||
let s:I3 = [ '#1693a5' , '#2e2d2a' , 39 , 235 ] " crystallake & darkgravel
|
||||
|
||||
" Visual mode
|
||||
let s:V1 = [ '#1a1a18' , '#ab3e5d' , 232 , 161 ] " blackestgravel & raspberry
|
||||
let s:V2 = [ '#000000' , '#908571' , 16 , 252 ] " coal & winterterrain
|
||||
let s:V3 = [ '#ab3e5d' , '#8c7f77' , 161 , 245 ] " raspberry & wetcoldterrain
|
||||
let s:V4 = [ '#515744' , 101 ] " lichen
|
||||
|
||||
" Replace mode
|
||||
let s:RE = [ '#233e09' , 22 ] " oakleaf
|
||||
|
||||
" Paste mode
|
||||
let s:PA = [ '#ab3e5d' , 161 ] " raspberry
|
||||
|
||||
let s:IA = [ s:N2[1] , s:N3[1] , s:N2[3], s:N3[3] , '' ]
|
||||
|
||||
|
||||
let g:airline#themes#laederon#palette = {}
|
||||
|
||||
let g:airline#themes#laederon#palette.accents = {
|
||||
\ 'red': [ '#ef393d' , '' , 196 , '' , '' ]
|
||||
\ }
|
||||
|
||||
let g:airline#themes#laederon#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3)
|
||||
let g:airline#themes#laederon#palette.normal_modified = {
|
||||
\ 'airline_a' : [ s:N2[0] , s:N4[0] , s:N2[2] , s:N4[1] , '' ] ,
|
||||
\ 'airline_c' : [ s:V1[1] , s:N2[1] , s:V1[3] , s:N2[3] , '' ] }
|
||||
|
||||
|
||||
let g:airline#themes#laederon#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3)
|
||||
let g:airline#themes#laederon#palette.insert_modified = {
|
||||
\ 'airline_c' : [ s:V2[1] , s:N2[1] , s:V2[3] , s:N2[3] , '' ] }
|
||||
let g:airline#themes#laederon#palette.insert_paste = {
|
||||
\ 'airline_a' : [ s:I1[0] , s:PA[0] , s:I1[2] , s:PA[1] , '' ] }
|
||||
|
||||
|
||||
let g:airline#themes#laederon#palette.replace = copy(airline#themes#laederon#palette.insert)
|
||||
let g:airline#themes#laederon#palette.replace.airline_a = [ s:I1[0] , s:RE[0] , s:I1[2] , s:RE[1] , '' ]
|
||||
let g:airline#themes#laederon#palette.replace_modified = g:airline#themes#laederon#palette.insert_modified
|
||||
|
||||
|
||||
let g:airline#themes#laederon#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3)
|
||||
let g:airline#themes#laederon#palette.visual_modified = {
|
||||
\ 'airline_c' : [ s:V3[0] , s:V4[0] , s:V3[2] , s:V4[1] , '' ] }
|
||||
|
||||
|
||||
let g:airline#themes#laederon#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA)
|
||||
let g:airline#themes#laederon#palette.inactive_modified = {
|
||||
\ 'airline_c' : [ s:V1[1] , '' , s:V1[3] , '' , '' ] }
|
||||
|
@ -0,0 +1,45 @@
|
||||
let g:airline#themes#light#palette = {}
|
||||
|
||||
let s:N1 = [ '#ffffff' , '#005fff' , 255 , 27 ]
|
||||
let s:N2 = [ '#000087' , '#00dfff' , 18 , 45 ]
|
||||
let s:N3 = [ '#005fff' , '#afffff' , 27 , 159 ]
|
||||
let g:airline#themes#light#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3)
|
||||
let g:airline#themes#light#palette.normal_modified = {
|
||||
\ 'airline_c': [ '#df0000' , '#ffdfdf' , 160 , 224 , '' ] ,
|
||||
\ }
|
||||
|
||||
|
||||
let s:I1 = [ '#ffffff' , '#00875f' , 255 , 29 ]
|
||||
let s:I2 = [ '#005f00' , '#00df87' , 22 , 42 ]
|
||||
let s:I3 = [ '#005f5f' , '#afff87' , 23 , 156 ]
|
||||
let g:airline#themes#light#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3)
|
||||
let g:airline#themes#light#palette.insert_modified = {
|
||||
\ 'airline_c': [ '#df0000' , '#ffdfdf' , 160 , 224 , '' ] ,
|
||||
\ }
|
||||
let g:airline#themes#light#palette.insert_paste = {
|
||||
\ 'airline_a': [ s:I1[0] , '#d78700' , s:I1[2] , 172 , '' ] ,
|
||||
\ }
|
||||
|
||||
|
||||
let g:airline#themes#light#palette.replace = copy(g:airline#themes#light#palette.insert)
|
||||
let g:airline#themes#light#palette.replace.airline_a = [ s:I2[0] , '#ff0000' , s:I1[2] , 196 , '' ]
|
||||
let g:airline#themes#light#palette.replace_modified = g:airline#themes#light#palette.insert_modified
|
||||
|
||||
|
||||
let s:V1 = [ '#ffffff' , '#ff5f00' , 255 , 202 ]
|
||||
let s:V2 = [ '#5f0000' , '#ffaf00' , 52 , 214 ]
|
||||
let s:V3 = [ '#df5f00' , '#ffff87' , 166 , 228 ]
|
||||
let g:airline#themes#light#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3)
|
||||
let g:airline#themes#light#palette.visual_modified = {
|
||||
\ 'airline_c': [ '#df0000' , '#ffdfdf' , 160 , 224 , '' ] ,
|
||||
\ }
|
||||
|
||||
|
||||
let s:IA1 = [ '#666666' , '#b2b2b2' , 242 , 249 , '' ]
|
||||
let s:IA2 = [ '#8a8a8a' , '#d0d0d0' , 245 , 252 , '' ]
|
||||
let s:IA3 = [ '#a8a8a8' , '#ffffff' , 248 , 255 , '' ]
|
||||
let g:airline#themes#light#palette.inactive = airline#themes#generate_color_map(s:IA1, s:IA2, s:IA3)
|
||||
let g:airline#themes#light#palette.inactive_modified = {
|
||||
\ 'airline_c': [ '#df0000' , '' , 160 , '' , '' ] ,
|
||||
\ }
|
||||
|
@ -0,0 +1,56 @@
|
||||
let g:airline#themes#lucius#palette = {}
|
||||
|
||||
function! airline#themes#lucius#refresh()
|
||||
|
||||
let s:N1 = airline#themes#get_highlight('StatusLine')
|
||||
let s:N2 = airline#themes#get_highlight('Folded')
|
||||
let s:N3 = airline#themes#get_highlight('CursorLine')
|
||||
let g:airline#themes#lucius#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3)
|
||||
|
||||
let modified_group = airline#themes#get_highlight('Statement')
|
||||
let g:airline#themes#lucius#palette.normal_modified = {
|
||||
\ 'airline_c': [modified_group[0], '', modified_group[2], '', '']
|
||||
\ }
|
||||
|
||||
let warning_group = airline#themes#get_highlight('DiffDelete')
|
||||
let g:airline#themes#lucius#palette.normal.airline_warning = warning_group
|
||||
let g:airline#themes#lucius#palette.normal_modified.airline_warning = warning_group
|
||||
|
||||
let s:I1 = airline#themes#get_highlight('DiffAdd')
|
||||
let s:I2 = s:N2
|
||||
let s:I3 = s:N3
|
||||
let g:airline#themes#lucius#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3)
|
||||
let g:airline#themes#lucius#palette.insert_modified = g:airline#themes#lucius#palette.normal_modified
|
||||
let g:airline#themes#lucius#palette.insert.airline_warning = g:airline#themes#lucius#palette.normal.airline_warning
|
||||
let g:airline#themes#lucius#palette.insert_modified.airline_warning = g:airline#themes#lucius#palette.normal_modified.airline_warning
|
||||
|
||||
let s:R1 = airline#themes#get_highlight('DiffChange')
|
||||
let s:R2 = s:N2
|
||||
let s:R3 = s:N3
|
||||
let g:airline#themes#lucius#palette.replace = airline#themes#generate_color_map(s:R1, s:R2, s:R3)
|
||||
let g:airline#themes#lucius#palette.replace_modified = g:airline#themes#lucius#palette.normal_modified
|
||||
let g:airline#themes#lucius#palette.replace.airline_warning = g:airline#themes#lucius#palette.normal.airline_warning
|
||||
let g:airline#themes#lucius#palette.replace_modified.airline_warning = g:airline#themes#lucius#palette.normal_modified.airline_warning
|
||||
|
||||
let s:V1 = airline#themes#get_highlight('Cursor')
|
||||
let s:V2 = s:N2
|
||||
let s:V3 = s:N3
|
||||
let g:airline#themes#lucius#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3)
|
||||
let g:airline#themes#lucius#palette.visual_modified = g:airline#themes#lucius#palette.normal_modified
|
||||
let g:airline#themes#lucius#palette.visual.airline_warning = g:airline#themes#lucius#palette.normal.airline_warning
|
||||
let g:airline#themes#lucius#palette.visual_modified.airline_warning = g:airline#themes#lucius#palette.normal_modified.airline_warning
|
||||
|
||||
let s:IA = airline#themes#get_highlight('StatusLineNC')
|
||||
let g:airline#themes#lucius#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA)
|
||||
let g:airline#themes#lucius#palette.inactive_modified = {
|
||||
\ 'airline_c': [ modified_group[0], '', modified_group[2], '', '' ]
|
||||
\ }
|
||||
|
||||
let g:airline#themes#lucius#palette.accents = {
|
||||
\ 'red': airline#themes#get_highlight('Constant'),
|
||||
\ }
|
||||
|
||||
endfunction
|
||||
|
||||
call airline#themes#lucius#refresh()
|
||||
|
@ -0,0 +1,92 @@
|
||||
" vim-airline companion theme of Luna
|
||||
" (https://github.com/Pychimp/vim-luna)
|
||||
|
||||
let g:airline#themes#luna#palette = {}
|
||||
|
||||
let g:airline#themes#luna#palette.accents = {
|
||||
\ 'red': [ '#ffffff' , '' , 231 , '' , '' ],
|
||||
\ }
|
||||
|
||||
|
||||
let s:N1 = [ '#ffffff' , '#005252' , 231 , 36 ]
|
||||
let s:N2 = [ '#ffffff' , '#003f3f' , 231 , 29 ]
|
||||
let s:N3 = [ '#ffffff' , '#002b2b' , 231 , 23 ]
|
||||
let g:airline#themes#luna#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3)
|
||||
let g:airline#themes#luna#palette.normal_modified = {
|
||||
\ 'airline_c': [ '#ffffff' , '#450000' , 231 , 52 , '' ] ,
|
||||
\ }
|
||||
|
||||
|
||||
let s:I1 = [ '#ffffff' , '#789f00' , 231 , 106 ]
|
||||
let s:I2 = [ '#ffffff' , '#003f3f' , 231 , 29 ]
|
||||
let s:I3 = [ '#ffffff' , '#002b2b' , 231 , 23 ]
|
||||
let g:airline#themes#luna#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3)
|
||||
let g:airline#themes#luna#palette.insert_modified = {
|
||||
\ 'airline_c': [ '#ffffff' , '#005e5e' , 255 , 52 , '' ] ,
|
||||
\ }
|
||||
let g:airline#themes#luna#palette.insert_paste = {
|
||||
\ 'airline_a': [ s:I1[0] , '#789f00' , s:I1[2] , 106 , '' ] ,
|
||||
\ }
|
||||
|
||||
|
||||
let g:airline#themes#luna#palette.replace = copy(g:airline#themes#luna#palette.insert)
|
||||
let g:airline#themes#luna#palette.replace.airline_a = [ s:I2[0] , '#920000' , s:I2[2] , 88 , '' ]
|
||||
let g:airline#themes#luna#palette.replace_modified = g:airline#themes#luna#palette.insert_modified
|
||||
|
||||
let s:V1 = [ '#ffff9a' , '#ff8036' , 222 , 208 ]
|
||||
let s:V2 = [ '#ffffff' , '#003f3f' , 231 , 29 ]
|
||||
let s:V3 = [ '#ffffff' , '#002b2b' , 231 , 23 ]
|
||||
let g:airline#themes#luna#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3)
|
||||
let g:airline#themes#luna#palette.visual_modified = {
|
||||
\ 'airline_c': [ '#ffffff' , '#450000' , 231 , 52 , '' ] ,
|
||||
\ }
|
||||
|
||||
let s:IA = [ '#4e4e4e' , '#002b2b' , 59 , 23 , '' ]
|
||||
let g:airline#themes#luna#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA)
|
||||
let g:airline#themes#luna#palette.inactive_modified = {
|
||||
\ 'airline_c': [ '#450000' , '' , 52 , '' , '' ] ,
|
||||
\ }
|
||||
|
||||
let g:airline#themes#luna#palette.tabline = {
|
||||
\ 'airline_tab': ['#2aa198', '#003f3f', 231, 29, ''],
|
||||
\ 'airline_tabsel': ['#ffffff', '#2e8b57', 231, 36, ''],
|
||||
\ 'airline_tabtype': ['#ffffff', '#005252', 231, 36, ''],
|
||||
\ 'airline_tabfill': ['#ffffff', '#002b2b', 231, 23, ''],
|
||||
\ 'airline_tabmod': ['#ffffff', '#780000', 231, 88, ''],
|
||||
\ }
|
||||
|
||||
let s:WI = [ '#ffffff', '#5f0000', 231, 88 ]
|
||||
let g:airline#themes#luna#palette.normal.airline_warning = [
|
||||
\ s:WI[0], s:WI[1], s:WI[2], s:WI[3]
|
||||
\ ]
|
||||
|
||||
let g:airline#themes#luna#palette.normal_modified.airline_warning =
|
||||
\ g:airline#themes#luna#palette.normal.airline_warning
|
||||
|
||||
let g:airline#themes#luna#palette.insert.airline_warning =
|
||||
\ g:airline#themes#luna#palette.normal.airline_warning
|
||||
|
||||
let g:airline#themes#luna#palette.insert_modified.airline_warning =
|
||||
\ g:airline#themes#luna#palette.normal.airline_warning
|
||||
|
||||
let g:airline#themes#luna#palette.visual.airline_warning =
|
||||
\ g:airline#themes#luna#palette.normal.airline_warning
|
||||
|
||||
let g:airline#themes#luna#palette.visual_modified.airline_warning =
|
||||
\ g:airline#themes#luna#palette.normal.airline_warning
|
||||
|
||||
let g:airline#themes#luna#palette.replace.airline_warning =
|
||||
\ g:airline#themes#luna#palette.normal.airline_warning
|
||||
|
||||
let g:airline#themes#luna#palette.replace_modified.airline_warning =
|
||||
\ g:airline#themes#luna#palette.normal.airline_warning
|
||||
|
||||
|
||||
if !get(g:, 'loaded_ctrlp', 0)
|
||||
finish
|
||||
endif
|
||||
let g:airline#themes#luna#palette.ctrlp = airline#extensions#ctrlp#generate_color_map(
|
||||
\ [ '#ffffff' , '#002b2b' , 231 , 23 , '' ] ,
|
||||
\ [ '#ffffff' , '#005252' , 231 , 36 , '' ] ,
|
||||
\ [ '#ffffff' , '#973d45' , 231 , 95 , '' ] )
|
||||
|
@ -0,0 +1,65 @@
|
||||
let g:airline#themes#molokai#palette = {}
|
||||
|
||||
let g:airline#themes#molokai#palette.accents = {
|
||||
\ 'red': [ '#66d9ef' , '' , 81 , '' , '' ],
|
||||
\ }
|
||||
|
||||
|
||||
" Normal mode
|
||||
let s:N1 = [ '#080808' , '#e6db74' , 232 , 144 ] " mode
|
||||
let s:N2 = [ '#f8f8f0' , '#232526' , 253 , 16 ] " info
|
||||
let s:N3 = [ '#f8f8f0' , '#465457' , 253 , 67 ] " statusline
|
||||
|
||||
let g:airline#themes#molokai#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3)
|
||||
let g:airline#themes#molokai#palette.normal_modified = {
|
||||
\ 'airline_c': [ '#080808' , '#e6db74' , 232 , 144 , '' ] ,
|
||||
\ }
|
||||
|
||||
|
||||
" Insert mode
|
||||
let s:I1 = [ '#080808' , '#66d9ef' , 232 , 81 ]
|
||||
let s:I2 = [ '#f8f8f0' , '#232526' , 253 , 16 ]
|
||||
let s:I3 = [ '#f8f8f0' , '#465457' , 253 , 67 ]
|
||||
|
||||
let g:airline#themes#molokai#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3)
|
||||
let g:airline#themes#molokai#palette.insert_modified = {
|
||||
\ 'airline_c': [ '#080808' , '#66d9ef' , 232 , 81 , '' ] ,
|
||||
\ }
|
||||
|
||||
|
||||
" Replace mode
|
||||
let g:airline#themes#molokai#palette.replace = copy(g:airline#themes#molokai#palette.insert)
|
||||
let g:airline#themes#molokai#palette.replace.airline_a = [ s:I1[0] , '#ef5939' , s:I1[2] , 166 , '' ]
|
||||
let g:airline#themes#molokai#palette.replace_modified = {
|
||||
\ 'airline_c': [ '#080808' , '#ef5939' , 232 , 166 , '' ] ,
|
||||
\ }
|
||||
|
||||
|
||||
" Visual mode
|
||||
let s:V1 = [ '#080808' , '#fd971f' , 232 , 208 ]
|
||||
let s:V2 = [ '#f8f8f0' , '#232526' , 253 , 16 ]
|
||||
let s:V3 = [ '#f8f8f0' , '#465457' , 253 , 67 ]
|
||||
|
||||
let g:airline#themes#molokai#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3)
|
||||
let g:airline#themes#molokai#palette.visual_modified = {
|
||||
\ 'airline_c': [ '#080808' , '#fd971f' , 232 , 208 , '' ] ,
|
||||
\ }
|
||||
|
||||
|
||||
" Inactive
|
||||
let s:IA = [ '#1b1d1e' , '#465457' , 233 , 67 , '' ]
|
||||
let g:airline#themes#molokai#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA)
|
||||
let g:airline#themes#molokai#palette.inactive_modified = {
|
||||
\ 'airline_c': [ '#f8f8f0' , '' , 253 , '' , '' ] ,
|
||||
\ }
|
||||
|
||||
|
||||
" CtrlP
|
||||
if !get(g:, 'loaded_ctrlp', 0)
|
||||
finish
|
||||
endif
|
||||
let g:airline#themes#molokai#palette.ctrlp = airline#extensions#ctrlp#generate_color_map(
|
||||
\ [ '#f8f8f0' , '#465457' , 253 , 67 , '' ] ,
|
||||
\ [ '#f8f8f0' , '#232526' , 253 , 16 , '' ] ,
|
||||
\ [ '#080808' , '#e6db74' , 232 , 144 , 'bold' ] )
|
||||
|
@ -0,0 +1,15 @@
|
||||
let g:airline#themes#monochrome#palette = {}
|
||||
|
||||
function! airline#themes#monochrome#refresh()
|
||||
let s:SL = airline#themes#get_highlight('StatusLine')
|
||||
let g:airline#themes#monochrome#palette.normal = airline#themes#generate_color_map(s:SL, s:SL, s:SL)
|
||||
let g:airline#themes#monochrome#palette.insert = g:airline#themes#monochrome#palette.normal
|
||||
let g:airline#themes#monochrome#palette.replace = g:airline#themes#monochrome#palette.normal
|
||||
let g:airline#themes#monochrome#palette.visual = g:airline#themes#monochrome#palette.normal
|
||||
|
||||
let s:SLNC = airline#themes#get_highlight('StatusLineNC')
|
||||
let g:airline#themes#monochrome#palette.inactive = airline#themes#generate_color_map(s:SLNC, s:SLNC, s:SLNC)
|
||||
endfunction
|
||||
|
||||
call airline#themes#monochrome#refresh()
|
||||
|
@ -0,0 +1,46 @@
|
||||
let g:airline#themes#murmur#palette = {}
|
||||
|
||||
let s:termbg = 237 " Background for branch and file format blocks
|
||||
let s:termbg2= 234 " Background for middle block
|
||||
let s:normalbg= 27 " Background for normal mode and file position blocks
|
||||
let s:insertbg= 70 " Background for insert mode and file position blocks
|
||||
let s:visualbg= 166 " Background for visual mode and file position blocks
|
||||
let s:replacebg=88 " Background for replace mode and file position blocks
|
||||
let s:alert= 88 " Modefied file alert color
|
||||
|
||||
let s:BB = ['#AFAF87', '#5F5F5F', 144, s:termbg] " Branch and file format blocks
|
||||
|
||||
let s:N1 = ['#FFFFFF', '#5F87FF', 15, s:normalbg] " Outside blocks in normal mode
|
||||
let s:N2 = ['#AFAF87', '#5F5F5F', 39, s:termbg2] " Middle block
|
||||
let g:airline#themes#murmur#palette.normal = airline#themes#generate_color_map(s:N1, s:BB, s:N2)
|
||||
let g:airline#themes#murmur#palette.normal_modified = {'airline_c': ['#ffffff', '#5f005f', s:alert, s:termbg2, 'bold'] ,}
|
||||
|
||||
let s:I1 = ['#FFFFFF', '#87AF5F', 15, s:insertbg] " Outside blocks in insert mode
|
||||
let s:I2 = ['#AFAF87', '#5F5F5F', s:insertbg, s:termbg2] " Middle block
|
||||
let g:airline#themes#murmur#palette.insert = airline#themes#generate_color_map(s:I1, s:BB, s:I2)
|
||||
let g:airline#themes#murmur#palette.insert_modified = {'airline_c': ['#AFAF87', '#5F5F5F', s:alert, s:termbg2, 'bold'] ,}
|
||||
|
||||
let s:R1 = ['#FFFFFF', '#870000', 15, s:replacebg] " Outside blocks in replace mode
|
||||
let s:R2 = ['#AFAF87', '#5F5F5F', 255, s:termbg2] " Middle block
|
||||
let g:airline#themes#murmur#palette.replace = airline#themes#generate_color_map(s:R1, s:BB, s:R2)
|
||||
let g:airline#themes#murmur#palette.replace_modified = {'airline_c': ['#AFAF87', '#5f005f', s:alert, s:termbg2, 'bold'] ,}
|
||||
|
||||
let s:V1 = ['#FFFFFF', '#AF5F00', 15, s:visualbg] " Outside blocks in visual mode
|
||||
let s:V2 = ['#AFAF87', '#5F5F5F', s:visualbg, s:termbg2] " Middle block
|
||||
let g:airline#themes#murmur#palette.visual = airline#themes#generate_color_map(s:V1, s:BB, s:V2)
|
||||
let g:airline#themes#murmur#palette.visual_modified = {'airline_c': [ '#AFAF87', '#5f005f', s:alert, s:termbg2, 'bold'] ,}
|
||||
|
||||
" Inactive mode
|
||||
let s:IA1 = ['#4E4E4E', '#1C1C1C', 239, 234, '']
|
||||
let s:IA2 = ['#4E4E4E', '#1C1C1C', 239, 234, '']
|
||||
let s:IA3 = ['#4E4E4E', '#1C1C1C', 239, 234, '']
|
||||
let g:airline#themes#murmur#palette.inactive = airline#themes#generate_color_map(s:IA1, s:IA2, s:IA3)
|
||||
|
||||
" CtrlP plugin colors
|
||||
if !get(g:, 'loaded_ctrlp', 0)
|
||||
finish
|
||||
endif
|
||||
let g:airline#themes#murmur#palette.ctrlp = airline#extensions#ctrlp#generate_color_map(
|
||||
\ ['#FFFFFF', '#5F87FF', 15, s:normalbg, ''],
|
||||
\ ['#AFAF87', '#5F5F5F', 144, s:termbg, ''],
|
||||
\ ['#AFAF87', '#5F5F5F', 39, s:termbg2, 'bold'])
|
@ -0,0 +1,46 @@
|
||||
" Theme to mimic the default colorscheme of powerline
|
||||
" Not 100% the same so it's powerline... ish.
|
||||
"
|
||||
" Differences from default powerline:
|
||||
" * Paste indicator isn't colored different
|
||||
" * Far right hand section matches the color of the mode indicator
|
||||
"
|
||||
" Differences from other airline themes:
|
||||
" * No color differences when you're in a modified buffer
|
||||
" * Visual mode only changes the mode section. Otherwise
|
||||
" it appears the same as normal mode
|
||||
|
||||
" Normal mode " fg & bg
|
||||
let s:N1 = [ '#005f00' , '#afd700' , 22 , 148 ] " darkestgreen & brightgreen
|
||||
let s:N2 = [ '#9e9e9e' , '#303030' , 247 , 236 ] " gray8 & gray2
|
||||
let s:N3 = [ '#ffffff' , '#121212' , 231 , 233 ] " white & gray4
|
||||
|
||||
" Insert mode " fg & bg
|
||||
let s:I1 = [ '#005f5f' , '#ffffff' , 23 , 231 ] " darkestcyan & white
|
||||
let s:I2 = [ '#5fafd7' , '#0087af' , 74 , 31 ] " darkcyan & darkblue
|
||||
let s:I3 = [ '#87d7ff' , '#005f87' , 117 , 24 ] " mediumcyan & darkestblue
|
||||
|
||||
" Visual mode " fg & bg
|
||||
let s:V1 = [ '#080808' , '#ffaf00' , 232 , 214 ] " gray3 & brightestorange
|
||||
|
||||
" Replace mode " fg & bg
|
||||
let s:RE = [ '#ffffff' , '#d70000' , 231 , 160 ] " white & brightred
|
||||
|
||||
let g:airline#themes#powerlineish#palette = {}
|
||||
|
||||
let g:airline#themes#powerlineish#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3)
|
||||
|
||||
let g:airline#themes#powerlineish#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3)
|
||||
let g:airline#themes#powerlineish#palette.insert_replace = {
|
||||
\ 'airline_a': [ s:RE[0] , s:I1[1] , s:RE[1] , s:I1[3] , '' ] }
|
||||
|
||||
let g:airline#themes#powerlineish#palette.visual = {
|
||||
\ 'airline_a': [ s:V1[0] , s:V1[1] , s:V1[2] , s:V1[3] , '' ] }
|
||||
|
||||
let g:airline#themes#powerlineish#palette.replace = copy(airline#themes#powerlineish#palette.normal)
|
||||
let g:airline#themes#powerlineish#palette.replace.airline_a = [ s:RE[0] , s:RE[1] , s:RE[2] , s:RE[3] , '' ]
|
||||
|
||||
|
||||
let s:IA = [ s:N2[1] , s:N3[1] , s:N2[3] , s:N3[3] , '' ]
|
||||
let g:airline#themes#powerlineish#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA)
|
||||
|
@ -0,0 +1,41 @@
|
||||
let g:airline#themes#serene#palette = {}
|
||||
|
||||
let s:guibg = '#080808'
|
||||
let s:termbg = 232
|
||||
let s:termsep = 236
|
||||
let s:guisep = '#303030'
|
||||
|
||||
let s:N1 = [ '#00dfff' , s:guibg , 45 , s:termbg ]
|
||||
let s:N2 = [ '#ff5f00' , s:guibg , 202 , s:termbg ]
|
||||
let s:N3 = [ '#767676' , s:guibg , 7 , s:termbg ]
|
||||
|
||||
let g:airline#themes#serene#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3)
|
||||
let g:airline#themes#serene#palette.normal_modified = {
|
||||
\ 'airline_c': [ '#df0000' , s:guibg, 160 , s:termbg , '' ] ,
|
||||
\ }
|
||||
|
||||
let s:I1 = [ '#5fff00' , s:guibg , 82 , s:termbg ]
|
||||
let s:I2 = [ '#ff5f00' , s:guibg , 202 , s:termbg ]
|
||||
let s:I3 = [ '#767676' , s:guibg , 7 , s:termbg ]
|
||||
let g:airline#themes#serene#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3)
|
||||
let g:airline#themes#serene#palette.insert_modified = copy(g:airline#themes#serene#palette.normal_modified)
|
||||
let g:airline#themes#serene#palette.insert_paste = {
|
||||
\ 'airline_a': [ s:I1[0] , '#d78700' , s:I1[2] , 172 , '' ] ,
|
||||
\ }
|
||||
|
||||
let g:airline#themes#serene#palette.replace = {
|
||||
\ 'airline_a': [ s:I1[0] , '#af0000' , s:I1[2] , 124 , '' ] ,
|
||||
\ }
|
||||
let g:airline#themes#serene#palette.replace_modified = copy(g:airline#themes#serene#palette.normal_modified)
|
||||
|
||||
let s:V1 = [ '#dfdf00' , s:guibg , 184 , s:termbg ]
|
||||
let s:V2 = [ '#ff5f00' , s:guibg , 202 , s:termbg ]
|
||||
let s:V3 = [ '#767676' , s:guibg , 7 , s:termbg ]
|
||||
let g:airline#themes#serene#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3)
|
||||
let g:airline#themes#serene#palette.visual_modified = copy(g:airline#themes#serene#palette.normal_modified)
|
||||
|
||||
let s:IA = [ '#4e4e4e' , s:guibg , 239 , s:termbg , '' ]
|
||||
let s:IA2 = [ '#4e4e4e' , s:guisep , 239 , s:termsep , '' ]
|
||||
let g:airline#themes#serene#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA2, s:IA2)
|
||||
let g:airline#themes#serene#palette.inactive_modified = copy(g:airline#themes#serene#palette.normal_modified)
|
||||
|
@ -0,0 +1,46 @@
|
||||
let g:airline#themes#simple#palette = {}
|
||||
|
||||
let s:guibg = '#080808'
|
||||
let s:guibg2 = '#1c1c1c'
|
||||
let s:termbg = 232
|
||||
let s:termbg2= 234
|
||||
|
||||
let s:N1 = [ s:guibg , '#00dfff' , s:termbg , 45 ]
|
||||
let s:N2 = [ '#ff5f00' , s:guibg2, 202 , s:termbg2 ]
|
||||
let s:N3 = [ '#767676' , s:guibg, 243 , s:termbg]
|
||||
let g:airline#themes#simple#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3)
|
||||
let g:airline#themes#simple#palette.normal_modified = {
|
||||
\ 'airline_c': [ '#df0000' , s:guibg, 160 , s:termbg , '' ] ,
|
||||
\ }
|
||||
|
||||
|
||||
let s:I1 = [ s:guibg, '#5fff00' , s:termbg , 82 ]
|
||||
let s:I2 = [ '#ff5f00' , s:guibg2, 202 , s:termbg2 ]
|
||||
let s:I3 = [ '#767676' , s:guibg, 243 , s:termbg ]
|
||||
let g:airline#themes#simple#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3)
|
||||
let g:airline#themes#simple#palette.insert_modified = copy(g:airline#themes#simple#palette.normal_modified)
|
||||
let g:airline#themes#simple#palette.insert_paste = {
|
||||
\ 'airline_a': [ s:I1[0] , '#d78700' , s:I1[2] , 172 , '' ] ,
|
||||
\ }
|
||||
|
||||
|
||||
let g:airline#themes#simple#palette.replace = {
|
||||
\ 'airline_a': [ s:I1[0] , '#af0000' , s:I1[2] , 124 , '' ] ,
|
||||
\ }
|
||||
let g:airline#themes#simple#palette.replace_modified = copy(g:airline#themes#simple#palette.normal_modified)
|
||||
|
||||
|
||||
let s:V1 = [ s:guibg, '#dfdf00' , s:termbg , 184 ]
|
||||
let s:V2 = [ '#ff5f00' , s:guibg2, 202 , s:termbg2 ]
|
||||
let s:V3 = [ '#767676' , s:guibg, 243 , s:termbg ]
|
||||
let g:airline#themes#simple#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3)
|
||||
let g:airline#themes#simple#palette.visual_modified = copy(g:airline#themes#simple#palette.normal_modified)
|
||||
|
||||
|
||||
let s:IA = [ '#4e4e4e' , s:guibg , 239 , s:termbg , '' ]
|
||||
let s:IA2 = [ '#4e4e4e' , s:guibg2 , 239 , s:termbg2 , '' ]
|
||||
let g:airline#themes#simple#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA2, s:IA2)
|
||||
let g:airline#themes#simple#palette.inactive_modified = {
|
||||
\ 'airline_c': [ '#df0000', '', 160, '', '' ] ,
|
||||
\ }
|
||||
|
@ -0,0 +1,90 @@
|
||||
" vim-airline companion theme of Sol
|
||||
" (https://github.com/Pychimp/vim-sol)
|
||||
|
||||
let g:airline#themes#sol#palette = {}
|
||||
|
||||
let g:airline#themes#sol#palette.accents = {
|
||||
\ 'red': [ '#ffffff' , '' , 231 , '' , '' ],
|
||||
\ }
|
||||
|
||||
let s:N1 = [ '#343434' , '#a0a0a0' , 237 , 248 ]
|
||||
let s:N2 = [ '#343434' , '#b3b3b3' , 237 , 250 ]
|
||||
let s:N3 = [ '#343434' , '#c7c7c7' , 237 , 252 ]
|
||||
let g:airline#themes#sol#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3)
|
||||
let g:airline#themes#sol#palette.normal_modified = {
|
||||
\ 'airline_c': [ '#ffffff' , '#ff3535' , 231 , 203 , '' ] ,
|
||||
\ }
|
||||
|
||||
|
||||
let s:I1 = [ '#eeeeee' , '#09643f' , 255 , 30 ]
|
||||
let s:I2 = [ '#343434' , '#a3a3a3' , 237 , 249 ]
|
||||
let s:I3 = [ '#343434' , '#b0b0b0' , 237 , 250 ]
|
||||
let g:airline#themes#sol#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3)
|
||||
let g:airline#themes#sol#palette.insert_modified = {
|
||||
\ 'airline_c': [ '#ffffff' , '#ff6868' , 225 , 167 , '' ] ,
|
||||
\ }
|
||||
let g:airline#themes#sol#palette.insert_paste = {
|
||||
\ 'airline_a': [ s:I1[0] , '#09643f' , s:I1[2] , 30 , '' ] ,
|
||||
\ }
|
||||
|
||||
|
||||
let g:airline#themes#sol#palette.replace = copy(g:airline#themes#sol#palette.insert)
|
||||
let g:airline#themes#sol#palette.replace.airline_a = [ s:I1[0] , '#ff2121' , s:I1[2] , 196 , '' ]
|
||||
let g:airline#themes#sol#palette.replace.airline_z = [ s:I1[0] , '#ff2121' , s:I1[2] , 196 , '' ]
|
||||
let g:airline#themes#sol#palette.replace_modified = g:airline#themes#sol#palette.insert_modified
|
||||
|
||||
let s:V1 = [ '#ffff9a' , '#ff6003' , 222 , 202 ]
|
||||
let s:V2 = [ '#343434' , '#a3a3a3' , 237 , 249 ]
|
||||
let s:V3 = [ '#343434' , '#b0b0b0' , 237 , 250 ]
|
||||
let g:airline#themes#sol#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3)
|
||||
let g:airline#themes#sol#palette.visual_modified = {
|
||||
\ 'airline_c': [ '#ffffff' , '#ff3535' , 231 , 203 , '' ] ,
|
||||
\ }
|
||||
|
||||
let s:IA = [ '#777777' , '#c7c7c7' , 244 , 251 , '' ]
|
||||
let g:airline#themes#sol#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA)
|
||||
let g:airline#themes#sol#palette.inactive_modified = {
|
||||
\ 'airline_c': [ '#ff3535' , '' , 203 , '' , '' ] ,
|
||||
\ }
|
||||
|
||||
let g:airline#themes#sol#palette.tabline = {
|
||||
\ 'airline_tab': ['#343434', '#b3b3b3', 237, 250, ''],
|
||||
\ 'airline_tabsel': ['#ffffff', '#004b9a', 231, 31 , ''],
|
||||
\ 'airline_tabtype': ['#343434', '#a0a0a0', 237, 248, ''],
|
||||
\ 'airline_tabfill': ['#343434', '#c7c7c7', 237, 251, ''],
|
||||
\ 'airline_tabmod': ['#ffffff', '#ff6868', 231, 167, ''],
|
||||
\ }
|
||||
|
||||
let s:WI = [ '#eeeeee', '#ff0f38', 255, 201 ]
|
||||
let g:airline#themes#sol#palette.normal.airline_warning = [
|
||||
\ s:WI[0], s:WI[1], s:WI[2], s:WI[3]
|
||||
\ ]
|
||||
|
||||
let g:airline#themes#sol#palette.normal_modified.airline_warning =
|
||||
\ g:airline#themes#sol#palette.normal.airline_warning
|
||||
|
||||
let g:airline#themes#sol#palette.insert.airline_warning =
|
||||
\ g:airline#themes#sol#palette.normal.airline_warning
|
||||
|
||||
let g:airline#themes#sol#palette.insert_modified.airline_warning =
|
||||
\ g:airline#themes#sol#palette.normal.airline_warning
|
||||
|
||||
let g:airline#themes#sol#palette.visual.airline_warning =
|
||||
\ g:airline#themes#sol#palette.normal.airline_warning
|
||||
|
||||
let g:airline#themes#sol#palette.visual_modified.airline_warning =
|
||||
\ g:airline#themes#sol#palette.normal.airline_warning
|
||||
|
||||
let g:airline#themes#sol#palette.replace.airline_warning =
|
||||
\ g:airline#themes#sol#palette.normal.airline_warning
|
||||
|
||||
let g:airline#themes#sol#palette.replace_modified.airline_warning =
|
||||
\ g:airline#themes#sol#palette.normal.airline_warning
|
||||
|
||||
if !get(g:, 'loaded_ctrlp', 0)
|
||||
finish
|
||||
endif
|
||||
let g:airline#themes#sol#palette.ctrlp = airline#extensions#ctrlp#generate_color_map(
|
||||
\ [ '#343434' , '#c7c7c7' , 237 , 251 , '' ] ,
|
||||
\ [ '#343434' , '#b3b3b3' , 237 , 250 , '' ] ,
|
||||
\ [ '#eeeeee' , '#007fff' , 255 , 27 , '' ] )
|
@ -0,0 +1,173 @@
|
||||
let g:airline#themes#solarized#palette = {}
|
||||
|
||||
function! airline#themes#solarized#refresh()
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" Options
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
let s:background = get(g:, 'airline_solarized_bg', &background)
|
||||
let s:ansi_colors = get(g:, 'solarized_termcolors', 16) != 256 && &t_Co >= 16 ? 1 : 0
|
||||
let s:tty = &t_Co == 8
|
||||
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" Colors
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" Base colors
|
||||
let s:base03 = {'t': s:ansi_colors ? 8 : (s:tty ? '0' : 234), 'g': '#002b36'}
|
||||
let s:base02 = {'t': s:ansi_colors ? '0' : (s:tty ? '0' : 235), 'g': '#073642'}
|
||||
let s:base01 = {'t': s:ansi_colors ? 10 : (s:tty ? '0' : 240), 'g': '#586e75'}
|
||||
let s:base00 = {'t': s:ansi_colors ? 11 : (s:tty ? '7' : 241), 'g': '#657b83'}
|
||||
let s:base0 = {'t': s:ansi_colors ? 12 : (s:tty ? '7' : 244), 'g': '#839496'}
|
||||
let s:base1 = {'t': s:ansi_colors ? 14 : (s:tty ? '7' : 245), 'g': '#93a1a1'}
|
||||
let s:base2 = {'t': s:ansi_colors ? 7 : (s:tty ? '7' : 254), 'g': '#eee8d5'}
|
||||
let s:base3 = {'t': s:ansi_colors ? 15 : (s:tty ? '7' : 230), 'g': '#fdf6e3'}
|
||||
let s:yellow = {'t': s:ansi_colors ? 3 : (s:tty ? '3' : 136), 'g': '#b58900'}
|
||||
let s:orange = {'t': s:ansi_colors ? 9 : (s:tty ? '1' : 166), 'g': '#cb4b16'}
|
||||
let s:red = {'t': s:ansi_colors ? 1 : (s:tty ? '1' : 160), 'g': '#dc322f'}
|
||||
let s:magenta = {'t': s:ansi_colors ? 5 : (s:tty ? '5' : 125), 'g': '#d33682'}
|
||||
let s:violet = {'t': s:ansi_colors ? 13 : (s:tty ? '5' : 61 ), 'g': '#6c71c4'}
|
||||
let s:blue = {'t': s:ansi_colors ? 4 : (s:tty ? '4' : 33 ), 'g': '#268bd2'}
|
||||
let s:cyan = {'t': s:ansi_colors ? 6 : (s:tty ? '6' : 37 ), 'g': '#2aa198'}
|
||||
let s:green = {'t': s:ansi_colors ? 2 : (s:tty ? '2' : 64 ), 'g': '#859900'}
|
||||
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" Simple mappings
|
||||
" NOTE: These are easily tweakable mappings. The actual mappings get
|
||||
" the specific gui and terminal colors from the base color dicts.
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" Normal mode
|
||||
if s:background == 'dark'
|
||||
let s:N1 = [s:base3, s:base1, 'bold']
|
||||
let s:N2 = [s:base2, (s:tty ? s:base01 : s:base00), '']
|
||||
let s:N3 = [s:base01, s:base02, '']
|
||||
else
|
||||
let s:N1 = [s:base2, s:base00, 'bold']
|
||||
let s:N2 = [(s:tty ? s:base01 : s:base2), s:base1, '']
|
||||
let s:N3 = [s:base1, s:base2, '']
|
||||
endif
|
||||
let s:NF = [s:orange, s:N3[1], '']
|
||||
let s:NW = [s:base3, s:orange, '']
|
||||
if s:background == 'dark'
|
||||
let s:NM = [s:base1, s:N3[1], '']
|
||||
else
|
||||
let s:NM = [s:base01, s:N3[1], '']
|
||||
endif
|
||||
|
||||
" Insert mode
|
||||
let s:I1 = [s:N1[0], s:yellow, 'bold']
|
||||
let s:I2 = s:N2
|
||||
let s:I3 = s:N3
|
||||
let s:IF = s:NF
|
||||
let s:IM = s:NM
|
||||
|
||||
" Visual mode
|
||||
let s:V1 = [s:N1[0], s:magenta, 'bold']
|
||||
let s:V2 = s:N2
|
||||
let s:V3 = s:N3
|
||||
let s:VF = s:NF
|
||||
let s:VM = s:NM
|
||||
|
||||
" Replace mode
|
||||
let s:R1 = [s:N1[0], s:red, '']
|
||||
let s:R2 = s:N2
|
||||
let s:R3 = s:N3
|
||||
let s:RM = s:NM
|
||||
let s:RF = s:NF
|
||||
|
||||
" Inactive
|
||||
if s:background == 'dark'
|
||||
let s:IA = [s:base00, s:base02, '']
|
||||
else
|
||||
let s:IA = [s:base1, s:base2, '']
|
||||
endif
|
||||
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" Actual mappings
|
||||
" WARNING: Don't modify this section unless necessary.
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
let s:NFa = [s:NF[0].g, s:NF[1].g, s:NF[0].t, s:NF[1].t, s:NF[2]]
|
||||
let s:IFa = [s:IF[0].g, s:IF[1].g, s:IF[0].t, s:IF[1].t, s:IF[2]]
|
||||
let s:VFa = [s:VF[0].g, s:VF[1].g, s:VF[0].t, s:VF[1].t, s:VF[2]]
|
||||
let s:RFa = [s:RF[0].g, s:RF[1].g, s:RF[0].t, s:RF[1].t, s:RF[2]]
|
||||
|
||||
let g:airline#themes#solarized#palette.accents = {
|
||||
\ 'red': s:NFa,
|
||||
\ }
|
||||
|
||||
let g:airline#themes#solarized#palette.inactive = airline#themes#generate_color_map(
|
||||
\ [s:IA[0].g, s:IA[1].g, s:IA[0].t, s:IA[1].t, s:IA[2]],
|
||||
\ [s:IA[0].g, s:IA[1].g, s:IA[0].t, s:IA[1].t, s:IA[2]],
|
||||
\ [s:IA[0].g, s:IA[1].g, s:IA[0].t, s:IA[1].t, s:IA[2]])
|
||||
let g:airline#themes#solarized#palette.inactive_modified = {
|
||||
\ 'airline_c': [s:NM[0].g, '', s:NM[0].t, '', s:NM[2]]}
|
||||
|
||||
let g:airline#themes#solarized#palette.normal = airline#themes#generate_color_map(
|
||||
\ [s:N1[0].g, s:N1[1].g, s:N1[0].t, s:N1[1].t, s:N1[2]],
|
||||
\ [s:N2[0].g, s:N2[1].g, s:N2[0].t, s:N2[1].t, s:N2[2]],
|
||||
\ [s:N3[0].g, s:N3[1].g, s:N3[0].t, s:N3[1].t, s:N3[2]])
|
||||
|
||||
let g:airline#themes#solarized#palette.normal.airline_warning = [
|
||||
\ s:NW[0].g, s:NW[1].g, s:NW[0].t, s:NW[1].t, s:NW[2]]
|
||||
|
||||
let g:airline#themes#solarized#palette.normal_modified = {
|
||||
\ 'airline_c': [s:NM[0].g, s:NM[1].g,
|
||||
\ s:NM[0].t, s:NM[1].t, s:NM[2]]}
|
||||
|
||||
let g:airline#themes#solarized#palette.normal_modified.airline_warning =
|
||||
\ g:airline#themes#solarized#palette.normal.airline_warning
|
||||
|
||||
let g:airline#themes#solarized#palette.insert = airline#themes#generate_color_map(
|
||||
\ [s:I1[0].g, s:I1[1].g, s:I1[0].t, s:I1[1].t, s:I1[2]],
|
||||
\ [s:I2[0].g, s:I2[1].g, s:I2[0].t, s:I2[1].t, s:I2[2]],
|
||||
\ [s:I3[0].g, s:I3[1].g, s:I3[0].t, s:I3[1].t, s:I3[2]])
|
||||
|
||||
let g:airline#themes#solarized#palette.insert.airline_warning =
|
||||
\ g:airline#themes#solarized#palette.normal.airline_warning
|
||||
|
||||
let g:airline#themes#solarized#palette.insert_modified = {
|
||||
\ 'airline_c': [s:IM[0].g, s:IM[1].g,
|
||||
\ s:IM[0].t, s:IM[1].t, s:IM[2]]}
|
||||
|
||||
let g:airline#themes#solarized#palette.insert_modified.airline_warning =
|
||||
\ g:airline#themes#solarized#palette.normal.airline_warning
|
||||
|
||||
let g:airline#themes#solarized#palette.visual = airline#themes#generate_color_map(
|
||||
\ [s:V1[0].g, s:V1[1].g, s:V1[0].t, s:V1[1].t, s:V1[2]],
|
||||
\ [s:V2[0].g, s:V2[1].g, s:V2[0].t, s:V2[1].t, s:V2[2]],
|
||||
\ [s:V3[0].g, s:V3[1].g, s:V3[0].t, s:V3[1].t, s:V3[2]])
|
||||
|
||||
let g:airline#themes#solarized#palette.visual.airline_warning =
|
||||
\ g:airline#themes#solarized#palette.normal.airline_warning
|
||||
|
||||
let g:airline#themes#solarized#palette.visual_modified = {
|
||||
\ 'airline_c': [s:VM[0].g, s:VM[1].g,
|
||||
\ s:VM[0].t, s:VM[1].t, s:VM[2]]}
|
||||
|
||||
let g:airline#themes#solarized#palette.visual_modified.airline_warning =
|
||||
\ g:airline#themes#solarized#palette.normal.airline_warning
|
||||
|
||||
let g:airline#themes#solarized#palette.replace = airline#themes#generate_color_map(
|
||||
\ [s:R1[0].g, s:R1[1].g, s:R1[0].t, s:R1[1].t, s:R1[2]],
|
||||
\ [s:R2[0].g, s:R2[1].g, s:R2[0].t, s:R2[1].t, s:R2[2]],
|
||||
\ [s:R3[0].g, s:R3[1].g, s:R3[0].t, s:R3[1].t, s:R3[2]])
|
||||
|
||||
let g:airline#themes#solarized#palette.replace.airline_warning =
|
||||
\ g:airline#themes#solarized#palette.normal.airline_warning
|
||||
|
||||
let g:airline#themes#solarized#palette.replace_modified = {
|
||||
\ 'airline_c': [s:RM[0].g, s:RM[1].g,
|
||||
\ s:RM[0].t, s:RM[1].t, s:RM[2]]}
|
||||
|
||||
let g:airline#themes#solarized#palette.replace_modified.airline_warning =
|
||||
\ g:airline#themes#solarized#palette.normal.airline_warning
|
||||
|
||||
let g:airline#themes#solarized#palette.tabline = {}
|
||||
|
||||
let g:airline#themes#solarized#palette.tabline.airline_tab = [
|
||||
\ s:I2[0].g, s:I2[1].g, s:I2[0].t, s:I2[1].t, s:I2[2]]
|
||||
|
||||
let g:airline#themes#solarized#palette.tabline.airline_tabtype = [
|
||||
\ s:N2[0].g, s:N2[1].g, s:N2[0].t, s:N2[1].t, s:N2[2]]
|
||||
endfunction
|
||||
|
||||
call airline#themes#solarized#refresh()
|
||||
|
@ -0,0 +1,44 @@
|
||||
let g:airline#themes#tomorrow#palette = {}
|
||||
|
||||
function! airline#themes#tomorrow#refresh()
|
||||
let g:airline#themes#tomorrow#palette.accents = {
|
||||
\ 'red': airline#themes#get_highlight('Constant'),
|
||||
\ }
|
||||
|
||||
let s:N1 = airline#themes#get_highlight2(['Normal', 'bg'], ['Directory', 'fg'], 'bold')
|
||||
let s:N2 = airline#themes#get_highlight('Pmenu')
|
||||
let s:N3 = airline#themes#get_highlight('CursorLine')
|
||||
let g:airline#themes#tomorrow#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3)
|
||||
|
||||
let group = airline#themes#get_highlight('vimCommand')
|
||||
let g:airline#themes#tomorrow#palette.normal_modified = {
|
||||
\ 'airline_c': [ group[0], '', group[2], '', '' ]
|
||||
\ }
|
||||
|
||||
let s:I1 = airline#themes#get_highlight2(['Normal', 'bg'], ['MoreMsg', 'fg'], 'bold')
|
||||
let s:I2 = airline#themes#get_highlight2(['MoreMsg', 'fg'], ['Normal', 'bg'])
|
||||
let s:I3 = s:N3
|
||||
let g:airline#themes#tomorrow#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3)
|
||||
let g:airline#themes#tomorrow#palette.insert_modified = g:airline#themes#tomorrow#palette.normal_modified
|
||||
|
||||
let s:R1 = airline#themes#get_highlight('Error', 'bold')
|
||||
let s:R2 = s:N2
|
||||
let s:R3 = s:N3
|
||||
let g:airline#themes#tomorrow#palette.replace = airline#themes#generate_color_map(s:R1, s:R2, s:R3)
|
||||
let g:airline#themes#tomorrow#palette.replace_modified = g:airline#themes#tomorrow#palette.normal_modified
|
||||
|
||||
let s:V1 = airline#themes#get_highlight2(['Normal', 'bg'], ['Constant', 'fg'], 'bold')
|
||||
let s:V2 = airline#themes#get_highlight2(['Constant', 'fg'], ['Normal', 'bg'])
|
||||
let s:V3 = s:N3
|
||||
let g:airline#themes#tomorrow#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3)
|
||||
let g:airline#themes#tomorrow#palette.visual_modified = g:airline#themes#tomorrow#palette.normal_modified
|
||||
|
||||
let s:IA = airline#themes#get_highlight2(['NonText', 'fg'], ['CursorLine', 'bg'])
|
||||
let g:airline#themes#tomorrow#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA)
|
||||
let g:airline#themes#tomorrow#palette.inactive_modified = {
|
||||
\ 'airline_c': [ group[0], '', group[2], '', '' ]
|
||||
\ }
|
||||
endfunction
|
||||
|
||||
call airline#themes#tomorrow#refresh()
|
||||
|
@ -0,0 +1,64 @@
|
||||
" vim-airline companion theme of Ubaryd
|
||||
" (https://github.com/Donearm/Ubaryd)
|
||||
|
||||
" Normal mode
|
||||
let s:N1 = [ '#141413' , '#c7b386' , 232 , 252 ] " blackestgravel & bleaksand
|
||||
let s:N2 = [ '#c7b386' , '#45413b' , 252, 238 ] " bleaksand & deepgravel
|
||||
let s:N3 = [ '#b88853' , '#242321' , 137, 235 ] " toffee & darkgravel
|
||||
let s:N4 = [ '#857f78' , 243 ] " gravel
|
||||
|
||||
" Insert mode
|
||||
let s:I1 = [ '#1a1a18' , '#fade3e' , 232 , 221 ] " blackestgravel & warmcorn
|
||||
let s:I2 = [ '#c7b386' , '#45413b' , 252 , 238 ] " bleaksand & deepgravel
|
||||
let s:I3 = [ '#f4cf86' , '#242321' , 222 , 235 ] " lighttannedskin & darkgravel
|
||||
|
||||
" Visual mode
|
||||
let s:V1 = [ '#1c1b1a' , '#9a4820' , 233 , 88 ] " blackgravel & warmadobe
|
||||
let s:V2 = [ '#000000' , '#88633f' , 16 , 95 ] " coal & cappuccino
|
||||
let s:V3 = [ '#88633f' , '#c7b386' , 95 , 252 ] " cappuccino & bleaksand
|
||||
let s:V4 = [ '#c14c3d' , 160 ] " tannedumbrella
|
||||
|
||||
" Replace mode
|
||||
let s:RE = [ '#c7915b' , 173 ] " nut
|
||||
|
||||
" Paste mode
|
||||
let s:PA = [ '#f9ef6d' , 154 ] " bleaklemon
|
||||
|
||||
let s:IA = [ s:N2[1], s:N3[1], s:N2[3], s:N3[3], '' ]
|
||||
|
||||
let g:airline#themes#ubaryd#palette = {}
|
||||
|
||||
let g:airline#themes#ubaryd#palette.accents = {
|
||||
\ 'red': [ '#ff7400' , '' , 196 , '' , '' ],
|
||||
\ }
|
||||
|
||||
let g:airline#themes#ubaryd#palette.inactive = {
|
||||
\ 'airline_a' : [ s:N2[1] , s:N3[1] , s:N2[3] , s:N3[3] , '' ] }
|
||||
|
||||
|
||||
let g:airline#themes#ubaryd#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3)
|
||||
let g:airline#themes#ubaryd#palette.normal_modified = {
|
||||
\ 'airline_a' : [ s:N2[0] , s:N4[0] , s:N2[2] , s:N4[1] , '' ] ,
|
||||
\ 'airline_c' : [ s:V1[1] , s:N2[1] , s:V1[3] , s:N2[3] , '' ] }
|
||||
|
||||
|
||||
let g:airline#themes#ubaryd#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3)
|
||||
let g:airline#themes#ubaryd#palette.insert_modified = {
|
||||
\ 'airline_c' : [ s:V2[1] , s:N2[1] , s:V2[3] , s:N2[3] , '' ] }
|
||||
let g:airline#themes#ubaryd#palette.insert_paste = {
|
||||
\ 'airline_a' : [ s:I1[0] , s:PA[0] , s:I1[2] , s:PA[1] , '' ] }
|
||||
|
||||
|
||||
let g:airline#themes#ubaryd#palette.replace = copy(airline#themes#ubaryd#palette.insert)
|
||||
let g:airline#themes#ubaryd#palette.replace.airline_a = [ s:I1[0] , s:RE[0] , s:I1[2] , s:RE[1] , '' ]
|
||||
let g:airline#themes#ubaryd#palette.replace_modified = g:airline#themes#ubaryd#palette.insert_modified
|
||||
|
||||
|
||||
let g:airline#themes#ubaryd#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3)
|
||||
let g:airline#themes#ubaryd#palette.visual_modified = {
|
||||
\ 'airline_c' : [ s:V3[0] , s:V4[0] , s:V3[2] , s:V4[1] , '' ] }
|
||||
|
||||
let g:airline#themes#ubaryd#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA)
|
||||
let g:airline#themes#ubaryd#palette.inactive_modified = {
|
||||
\ 'airline_c' : [ s:V1[1] , '' , s:V1[3] , '' , '' ] }
|
||||
|
@ -0,0 +1,43 @@
|
||||
let g:airline#themes#understated#palette = {}
|
||||
|
||||
let s:N1 = ['#FFFFFF', '#5F87FF', 15, 69] " Outside blocks in normal mode (mode and file position)
|
||||
let s:N2 = ['#AFAF87', '#5F5F5F', 144, 59] " Next blocks inside (branch and file format)
|
||||
let s:N3 = ['#AFAF87', '#5F5F5F', 144, 59] " The middle block
|
||||
|
||||
let g:airline#themes#understated#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3)
|
||||
let g:airline#themes#understated#palette.normal_modified = {'airline_c': ['#ffffff', '#5f005f', 144, 59, 'bold'] ,}
|
||||
|
||||
let s:I1 = ['#FFFFFF', '#87AF5F', 15, 107] " Outside blocks in normal mode (mode and file position)
|
||||
let s:I2 = ['#AFAF87', '#5F5F5F', 144, 59] " Next blocks inside (branch and file format)
|
||||
let s:I3 = ['#AFAF87', '#5F5F5F', 144, 59] " The middle block
|
||||
let g:airline#themes#understated#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3)
|
||||
let g:airline#themes#understated#palette.insert_modified = {'airline_c': ['#AFAF87', '#5F5F5F', 144, 59, 'bold'] ,}
|
||||
let g:airline#themes#understated#palette.insert_paste = {'airline_c': ['#AFAF87', '#5F5F5F', 144, 59, ''] ,}
|
||||
|
||||
let g:airline#themes#understated#palette.replace = airline#themes#generate_color_map(s:I1, s:I2, s:I3)
|
||||
let g:airline#themes#understated#palette.replace.airline_a = ['#FFFFFF', '#870000', 15, 88, '']
|
||||
let g:airline#themes#understated#palette.replace_modified = {'airline_c': ['#AFAF87', '#5F5F5F', 144, 59, 'bold'] ,}
|
||||
|
||||
let s:V1 = ['#FFFFFF', '#AF5F00', 15, 130]
|
||||
let s:V2 = ['#AFAF87', '#5F5F5F', 144, 59]
|
||||
let s:V3 = ['#AFAF87', '#5F5F5F', 144, 59]
|
||||
let g:airline#themes#understated#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3)
|
||||
let g:airline#themes#understated#palette.visual_modified = {'airline_c': [ '#AFAF87', '#5f005f', 144, 59, 'bold'] ,}
|
||||
|
||||
let s:V1 = ['#080808', '#FFAF00', 232, 214]
|
||||
let s:IA1 = ['#4E4E4E', '#1C1C1C', 239, 234, '']
|
||||
let s:IA2 = ['#4E4E4E', '#1C1C1C', 239, 234, '']
|
||||
let s:IA3 = ['#4E4E4E', '#1C1C1C', 239, 234, '']
|
||||
let g:airline#themes#understated#palette.inactive = airline#themes#generate_color_map(s:IA1, s:IA2, s:IA3)
|
||||
let g:airline#themes#understated#palette.inactive_modified = {'airline_c': ['#4E4E4E', '', 239, '', 'bold'] ,}
|
||||
|
||||
let g:airline#themes#understated#palette.accents = {'red': ['#FF0000', '', 88, '']}
|
||||
|
||||
if !get(g:, 'loaded_ctrlp', 0)
|
||||
finish
|
||||
endif
|
||||
let g:airline#themes#understated#palette.ctrlp = airline#extensions#ctrlp#generate_color_map(
|
||||
\ ['#FFFFFF', '#1C1C1C', 15, 234, '' ],
|
||||
\ ['#FFFFFF', '#262626', 15, 235, '' ],
|
||||
\ ['#FFFFFF', '#303030', 15, 236, 'bold'])
|
||||
|
@ -0,0 +1,90 @@
|
||||
" vim-airline companion theme of Wombat
|
||||
" looks great with wombat256 vim colorscheme
|
||||
|
||||
" Normal mode
|
||||
" [ guifg, guibg, ctermfg, ctermbg, opts ]
|
||||
let s:N1 = [ '#141413' , '#CAE682' , 232 , 192 ] " mode
|
||||
let s:N2 = [ '#CAE682' , '#32322F' , 192 , 236 ] " info
|
||||
let s:N3 = [ '#CAE682' , '#242424' , 192 , 234 ] " statusline
|
||||
let s:N4 = [ '#86CD74' , 113 ] " mode modified
|
||||
|
||||
" Insert mode
|
||||
let s:I1 = [ '#141413' , '#FDE76E' , 232 , 227 ]
|
||||
let s:I2 = [ '#FDE76E' , '#32322F' , 227 , 236 ]
|
||||
let s:I3 = [ '#FDE76E' , '#242424' , 227 , 234 ]
|
||||
let s:I4 = [ '#FADE3E' , 221 ]
|
||||
|
||||
" Visual mode
|
||||
let s:V1 = [ '#141413' , '#B5D3F3' , 232 , 153 ]
|
||||
let s:V2 = [ '#B5D3F3' , '#32322F' , 153 , 236 ]
|
||||
let s:V3 = [ '#B5D3F3' , '#242424' , 153 , 234 ]
|
||||
let s:V4 = [ '#7CB0E6' , 111 ]
|
||||
|
||||
" Replace mode
|
||||
let s:R1 = [ '#141413' , '#E5786D' , 232 , 173 ]
|
||||
let s:R2 = [ '#E5786D' , '#32322F' , 173 , 236 ]
|
||||
let s:R3 = [ '#E5786D' , '#242424' , 173 , 234 ]
|
||||
let s:R4 = [ '#E55345' , 203 ]
|
||||
|
||||
" Paste mode
|
||||
let s:PA = [ '#94E42C' , 47 ]
|
||||
|
||||
" Info modified
|
||||
let s:IM = [ '#40403C' , 238 ]
|
||||
|
||||
" Inactive mode
|
||||
let s:IA = [ '#767676' , s:N3[1] , 243 , s:N3[3] , '' ]
|
||||
|
||||
let g:airline#themes#wombat#palette = {}
|
||||
|
||||
let g:airline#themes#wombat#palette.accents = {
|
||||
\ 'red': [ '#E5786D' , '' , 203 , '' , '' ],
|
||||
\ }
|
||||
|
||||
let g:airline#themes#wombat#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3)
|
||||
let g:airline#themes#wombat#palette.normal_modified = {
|
||||
\ 'airline_a': [ s:N1[0] , s:N4[0] , s:N1[2] , s:N4[1] , '' ] ,
|
||||
\ 'airline_b': [ s:N4[0] , s:IM[0] , s:N4[1] , s:IM[1] , '' ] ,
|
||||
\ 'airline_c': [ s:N4[0] , s:N3[1] , s:N4[1] , s:N3[3] , '' ] }
|
||||
|
||||
|
||||
let g:airline#themes#wombat#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3)
|
||||
let g:airline#themes#wombat#palette.insert_modified = {
|
||||
\ 'airline_a': [ s:I1[0] , s:I4[0] , s:I1[2] , s:I4[1] , '' ] ,
|
||||
\ 'airline_b': [ s:I4[0] , s:IM[0] , s:I4[1] , s:IM[1] , '' ] ,
|
||||
\ 'airline_c': [ s:I4[0] , s:N3[1] , s:I4[1] , s:N3[3] , '' ] }
|
||||
|
||||
|
||||
let g:airline#themes#wombat#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3)
|
||||
let g:airline#themes#wombat#palette.visual_modified = {
|
||||
\ 'airline_a': [ s:V1[0] , s:V4[0] , s:V1[2] , s:V4[1] , '' ] ,
|
||||
\ 'airline_b': [ s:V4[0] , s:IM[0] , s:V4[1] , s:IM[1] , '' ] ,
|
||||
\ 'airline_c': [ s:V4[0] , s:N3[1] , s:V4[1] , s:N3[3] , '' ] }
|
||||
|
||||
|
||||
let g:airline#themes#wombat#palette.replace = airline#themes#generate_color_map(s:R1, s:R2, s:R3)
|
||||
let g:airline#themes#wombat#palette.replace_modified = {
|
||||
\ 'airline_a': [ s:R1[0] , s:R4[0] , s:R1[2] , s:R4[1] , '' ] ,
|
||||
\ 'airline_b': [ s:R4[0] , s:IM[0] , s:R4[1] , s:IM[1] , '' ] ,
|
||||
\ 'airline_c': [ s:R4[0] , s:N3[1] , s:R4[1] , s:N3[3] , '' ] }
|
||||
|
||||
|
||||
let g:airline#themes#wombat#palette.insert_paste = {
|
||||
\ 'airline_a': [ s:I1[0] , s:PA[0] , s:I1[2] , s:PA[1] , '' ] ,
|
||||
\ 'airline_b': [ s:PA[0] , s:IM[0] , s:PA[1] , s:IM[1] , '' ] ,
|
||||
\ 'airline_c': [ s:PA[0] , s:N3[1] , s:PA[1] , s:N3[3] , '' ] }
|
||||
|
||||
|
||||
let g:airline#themes#wombat#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA)
|
||||
let g:airline#themes#wombat#palette.inactive_modified = {
|
||||
\ 'airline_c': [ s:N4[0] , '' , s:N4[1] , '' , '' ] }
|
||||
|
||||
|
||||
if !get(g:, 'loaded_ctrlp', 0)
|
||||
finish
|
||||
endif
|
||||
let g:airline#themes#wombat#palette.ctrlp = airline#extensions#ctrlp#generate_color_map(
|
||||
\ [ '#DADADA' , '#242424' , 253 , 234 , '' ] ,
|
||||
\ [ '#DADADA' , '#40403C' , 253 , 238 , '' ] ,
|
||||
\ [ '#141413' , '#DADADA' , 232 , 253 , 'bold' ] )
|
||||
|
@ -0,0 +1,44 @@
|
||||
let g:airline#themes#zenburn#palette = {}
|
||||
|
||||
function! airline#themes#zenburn#refresh()
|
||||
let g:airline#themes#zenburn#palette.accents = {
|
||||
\ 'red': airline#themes#get_highlight('Constant'),
|
||||
\ }
|
||||
|
||||
let s:N1 = airline#themes#get_highlight2(['DbgCurrent', 'bg'], ['Folded', 'fg'], 'bold')
|
||||
let s:N2 = airline#themes#get_highlight('Folded')
|
||||
let s:N3 = airline#themes#get_highlight('NonText')
|
||||
|
||||
let g:airline#themes#zenburn#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3)
|
||||
let s:Nmod = airline#themes#get_highlight('Comment')
|
||||
let g:airline#themes#zenburn#palette.normal_modified = {
|
||||
\ 'airline_c': s:Nmod
|
||||
\ }
|
||||
|
||||
let s:I1 = airline#themes#get_highlight2(['DbgCurrent', 'bg'], ['String', 'fg'], 'bold')
|
||||
let s:I2 = airline#themes#get_highlight2(['String', 'fg'], ['Folded', 'bg'])
|
||||
let s:I3 = s:N3
|
||||
let g:airline#themes#zenburn#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3)
|
||||
let g:airline#themes#zenburn#palette.insert_modified = g:airline#themes#zenburn#palette.normal_modified
|
||||
|
||||
let s:R1 = airline#themes#get_highlight2(['DbgCurrent', 'bg'], ['Comment', 'fg'], 'bold')
|
||||
let s:R2 = airline#themes#get_highlight2(['Comment', 'fg'], ['Folded', 'bg'])
|
||||
let s:R3 = s:N3
|
||||
let g:airline#themes#zenburn#palette.replace = airline#themes#generate_color_map(s:R1, s:R2, s:R3)
|
||||
let g:airline#themes#zenburn#palette.replace_modified = g:airline#themes#zenburn#palette.normal_modified
|
||||
|
||||
let s:V1 = airline#themes#get_highlight2(['DbgCurrent', 'bg'], ['Identifier', 'fg'], 'bold')
|
||||
let s:V2 = airline#themes#get_highlight2(['Identifier', 'fg'], ['Folded', 'bg'])
|
||||
let s:V3 = s:N3
|
||||
let g:airline#themes#zenburn#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3)
|
||||
let g:airline#themes#zenburn#palette.visual_modified = g:airline#themes#zenburn#palette.normal_modified
|
||||
|
||||
let s:IA = airline#themes#get_highlight('NonText')
|
||||
let g:airline#themes#zenburn#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA)
|
||||
let g:airline#themes#zenburn#palette.inactive_modified = {
|
||||
\ 'airline_c': s:Nmod
|
||||
\ }
|
||||
endfunction
|
||||
|
||||
call airline#themes#zenburn#refresh()
|
||||
|
64
sources_non_forked/vim-airline/autoload/airline/util.vim
Normal file
64
sources_non_forked/vim-airline/autoload/airline/util.vim
Normal file
@ -0,0 +1,64 @@
|
||||
" MIT License. Copyright (c) 2013 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
call airline#init#bootstrap()
|
||||
let s:spc = g:airline_symbols.space
|
||||
|
||||
function! airline#util#wrap(text, minwidth)
|
||||
if a:minwidth > 0 && winwidth(0) < a:minwidth
|
||||
return ''
|
||||
endif
|
||||
return a:text
|
||||
endfunction
|
||||
|
||||
function! airline#util#append(text, minwidth)
|
||||
if a:minwidth > 0 && winwidth(0) < a:minwidth
|
||||
return ''
|
||||
endif
|
||||
let prefix = s:spc == "\ua0" ? s:spc : s:spc.s:spc
|
||||
return empty(a:text) ? '' : prefix.g:airline_left_alt_sep.s:spc.a:text
|
||||
endfunction
|
||||
|
||||
function! airline#util#prepend(text, minwidth)
|
||||
if a:minwidth > 0 && winwidth(0) < a:minwidth
|
||||
return ''
|
||||
endif
|
||||
return empty(a:text) ? '' : a:text.s:spc.g:airline_right_alt_sep.s:spc
|
||||
endfunction
|
||||
|
||||
if v:version >= 704
|
||||
function! airline#util#getwinvar(winnr, key, def)
|
||||
return getwinvar(a:winnr, a:key, a:def)
|
||||
endfunction
|
||||
else
|
||||
function! airline#util#getwinvar(winnr, key, def)
|
||||
let winvals = getwinvar(a:winnr, '')
|
||||
return get(winvals, a:key, a:def)
|
||||
endfunction
|
||||
endif
|
||||
|
||||
if v:version >= 704
|
||||
function! airline#util#exec_funcrefs(list, ...)
|
||||
for Fn in a:list
|
||||
let code = call(Fn, a:000)
|
||||
if code != 0
|
||||
return code
|
||||
endif
|
||||
endfor
|
||||
return 0
|
||||
endfunction
|
||||
else
|
||||
function! airline#util#exec_funcrefs(list, ...)
|
||||
" for 7.2; we cannot iterate the list, hence why we use range()
|
||||
" for 7.3-[97, 328]; we cannot reuse the variable, hence the {}
|
||||
for i in range(0, len(a:list) - 1)
|
||||
let Fn{i} = a:list[i]
|
||||
let code = call(Fn{i}, a:000)
|
||||
if code != 0
|
||||
return code
|
||||
endif
|
||||
endfor
|
||||
return 0
|
||||
endfunction
|
||||
endif
|
||||
|
677
sources_non_forked/vim-airline/doc/airline.txt
Normal file
677
sources_non_forked/vim-airline/doc/airline.txt
Normal file
@ -0,0 +1,677 @@
|
||||
*airline.txt* Lean and mean status/tabline that's light as air
|
||||
*airline*
|
||||
_ _ _ _ ~
|
||||
__ _(_)_ __ ___ __ _(_)_ __| (_)_ __ ___ ~
|
||||
\ \ / / | '_ ` _ \ _____ / _` | | '__| | | '_ \ / _ \ ~
|
||||
\ V /| | | | | | |_____| (_| | | | | | | | | | __/ ~
|
||||
\_/ |_|_| |_| |_| \__,_|_|_| |_|_|_| |_|\___| ~
|
||||
~
|
||||
==============================================================================
|
||||
CONTENTS *airline-contents*
|
||||
|
||||
01. Intro ............................................... |airline-intro|
|
||||
02. Features ......................................... |airline-features|
|
||||
03. Name ................................................. |airline-name|
|
||||
04. Configuration ............................... |airline-configuration|
|
||||
05. Commands ......................................... |airline-commands|
|
||||
06. Customization ............................... |airline-customization|
|
||||
07. Extensions ..................................... |airline-extensions|
|
||||
08. Advanced Customization ............. |airline-advanced-customization|
|
||||
09. Funcrefs ......................................... |airline-funcrefs|
|
||||
10. Pipeline ......................................... |airline-pipeline|
|
||||
11. Writing Extensions ..................... |airline-writing-extensions|
|
||||
12. Writing Themes ..................................... |airline-themes|
|
||||
13. Troubleshooting ........................... |airline-troubleshooting|
|
||||
14. Contributions ............................... |airline-contributions|
|
||||
15. License ........................................... |airline-license|
|
||||
|
||||
==============================================================================
|
||||
INTRODUCTION *airline-intro*
|
||||
|
||||
vim-airline is a fast and lightweight alternative to powerline, written
|
||||
in 100% vimscript with no outside dependencies.
|
||||
|
||||
==============================================================================
|
||||
FEATURES *airline-features*
|
||||
|
||||
* tiny core written with extensibility in mind.
|
||||
* integrates with many popular plugins.
|
||||
* looks good with regular fonts, and provides configuration points so you
|
||||
can use unicode or powerline symbols.
|
||||
* optimized for speed; it loads in under a millisecond.
|
||||
* fully customizable; if you know a little 'statusline' syntax you can
|
||||
tweak it to your needs.
|
||||
* extremely easy to write themes.
|
||||
|
||||
==============================================================================
|
||||
NAME *airline-name*
|
||||
|
||||
Where did the name come from?
|
||||
|
||||
I wrote this on an airplane, and since it's light as air it turned out to be a
|
||||
good name :-)
|
||||
|
||||
==============================================================================
|
||||
CONFIGURATION *airline-configuration*
|
||||
|
||||
There are a couple configuration values available (shown with their default
|
||||
values):
|
||||
|
||||
* the separator used on the left side >
|
||||
let g:airline_left_sep='>'
|
||||
<
|
||||
* the separator used on the right side >
|
||||
let g:airline_right_sep='<'
|
||||
<
|
||||
* enable modified detection >
|
||||
let g:airline_detect_modified=1
|
||||
|
||||
* enable paste detection >
|
||||
let g:airline_detect_paste=1
|
||||
<
|
||||
* enable iminsert detection >
|
||||
let g:airline_detect_iminsert=0
|
||||
<
|
||||
* determine whether inactive windows should have the left section collapsed to
|
||||
only the filename of that buffer. >
|
||||
let g:airline_inactive_collapse=1
|
||||
<
|
||||
* themes are automatically selected based on the matching colorscheme. this
|
||||
can be overridden by defining a value. >
|
||||
let g:airline_theme=
|
||||
<
|
||||
* if you want to patch the airline theme before it gets applied, you can
|
||||
supply the name of a function where you can modify the palette. >
|
||||
let g:airline_theme_patch_func = 'AirlineThemePatch'
|
||||
function! AirlineThemePatch(palette)
|
||||
if g:airline_theme == 'badwolf'
|
||||
for colors in values(a:palette.inactive)
|
||||
let colors[3] = 245
|
||||
endfor
|
||||
endif
|
||||
endfunction
|
||||
<
|
||||
* enable/disable automatic population of the `g:airline_symbols` dictionary
|
||||
with powerline symbols. >
|
||||
let g:airline_powerline_fonts=0
|
||||
<
|
||||
* define the set of text to display for each mode. >
|
||||
let g:airline_mode_map = {} " see source for the defaults
|
||||
|
||||
" or copy paste the following into your vimrc for shortform text
|
||||
let g:airline_mode_map = {
|
||||
\ '__' : '-',
|
||||
\ 'n' : 'N',
|
||||
\ 'i' : 'I',
|
||||
\ 'R' : 'R',
|
||||
\ 'c' : 'C',
|
||||
\ 'v' : 'V',
|
||||
\ 'V' : 'V',
|
||||
\ '' : 'V',
|
||||
\ 's' : 'S',
|
||||
\ 'S' : 'S',
|
||||
\ '' : 'S',
|
||||
\ }
|
||||
<
|
||||
* define the set of filename match queries which excludes a window from having
|
||||
its statusline modified >
|
||||
let g:airline_exclude_filenames = [] " see source for current list
|
||||
<
|
||||
* define the set of filetypes which are excluded from having its window
|
||||
statusline modified >
|
||||
let g:airline_exclude_filetypes = [] " see source for current list
|
||||
<
|
||||
* defines whether the preview window should be excluded from have its window
|
||||
statusline modified (may help with plugins which use the preview window
|
||||
heavily) >
|
||||
let g:airline_exclude_preview = 0
|
||||
<
|
||||
==============================================================================
|
||||
COMMANDS *airline-commands*
|
||||
|
||||
:AirlineTheme {theme-name} *:AirlineTheme*
|
||||
Displays or changes the current theme.
|
||||
|
||||
:AirlineToggleWhitespace *:AirlineToggleWhitespace*
|
||||
Toggles whitespace detection.
|
||||
|
||||
:AirlineToggle *:AirlineToggle*
|
||||
Toggles between the standard 'statusline' and airline.
|
||||
|
||||
:AirlineRefresh *:AirlineRefresh*
|
||||
Refreshes all highlight groups.
|
||||
|
||||
==============================================================================
|
||||
CUSTOMIZATION *airline-customization*
|
||||
|
||||
The following are some unicode symbols for customizing the left/right
|
||||
separators, as well as the powerline font glyths.
|
||||
|
||||
Note: You must define the dictionary first before setting values. Also, it's a
|
||||
good idea to check whether if it exists as to avoid accidentally overwritting
|
||||
its contents. >
|
||||
if !exists('g:airline_symbols')
|
||||
let g:airline_symbols = {}
|
||||
endif
|
||||
|
||||
" unicode symbols
|
||||
let g:airline_left_sep = '»'
|
||||
let g:airline_left_sep = '▶'
|
||||
let g:airline_right_sep = '«'
|
||||
let g:airline_right_sep = '◀'
|
||||
let g:airline_symbols.linenr = '␊'
|
||||
let g:airline_symbols.linenr = ''
|
||||
let g:airline_symbols.linenr = '¶'
|
||||
let g:airline_symbols.branch = '⎇'
|
||||
let g:airline_symbols.paste = 'ρ'
|
||||
let g:airline_symbols.paste = 'Þ'
|
||||
let g:airline_symbols.paste = '∥'
|
||||
let g:airline_symbols.whitespace = 'Ξ'
|
||||
|
||||
" powerline symbols
|
||||
let g:airline_left_sep = ''
|
||||
let g:airline_left_alt_sep = ''
|
||||
let g:airline_right_sep = ''
|
||||
let g:airline_right_alt_sep = ''
|
||||
let g:airline_symbols.branch = ''
|
||||
let g:airline_symbols.readonly = ''
|
||||
let g:airline_symbols.linenr = ''
|
||||
|
||||
" old vim-powerline symbols
|
||||
let g:airline_left_sep = '⮀'
|
||||
let g:airline_left_alt_sep = '⮁'
|
||||
let g:airline_right_sep = '⮂'
|
||||
let g:airline_right_alt_sep = '⮃'
|
||||
let g:airline_symbols.branch = '⭠'
|
||||
let g:airline_symbols.readonly = '⭤'
|
||||
let g:airline_symbols.linenr = '⭡'
|
||||
<
|
||||
|
||||
For more intricate customizations, you can replace the predefined sections
|
||||
with the usual statusline syntax.
|
||||
|
||||
Note: If you define any section variables it will replace the default values
|
||||
entirely. If you want to disable only certain parts of a section you can try
|
||||
using variables defined in the |airline-configuration| or |airline-extensions|
|
||||
section.
|
||||
>
|
||||
variable names default contents
|
||||
----------------------------------------------------------------------------
|
||||
let g:airline_section_a (mode, paste, iminsert)
|
||||
let g:airline_section_b (hunks, branch)
|
||||
let g:airline_section_c (bufferline or filename)
|
||||
let g:airline_section_gutter (readonly, csv)
|
||||
let g:airline_section_x (tagbar, filetype, virtualenv)
|
||||
let g:airline_section_y (fileencoding, fileformat)
|
||||
let g:airline_section_z (percentage, line number, column number)
|
||||
let g:airline_section_warning (syntastic, whitespace)
|
||||
|
||||
" here is an example of how you could replace the branch indicator with
|
||||
" the current working directory, followed by the filename.
|
||||
let g:airline_section_b = '%{getcwd()}'
|
||||
let g:airline_section_c = '%t'
|
||||
<
|
||||
==============================================================================
|
||||
EXTENSIONS *airline-extensions*
|
||||
|
||||
Most extensions are enabled by default and lazily loaded when the
|
||||
corresponding plugin (if any) is detected.
|
||||
|
||||
------------------------------------- *airline-default*
|
||||
The default extension understands all of the `g:` variables in the
|
||||
|airline-configuration| section, however it also has some more fine-tuned
|
||||
configuration values that you can use.
|
||||
|
||||
* control which sections get truncated and at what width. >
|
||||
let g:airline#extensions#default#section_truncate_width = {
|
||||
\ 'b': 79,
|
||||
\ 'x': 60,
|
||||
\ 'y': 88,
|
||||
\ 'z': 45,
|
||||
\ })
|
||||
|
||||
" Note: set to an empty dictionary to disable truncation.
|
||||
let g:airline#extensions#default#section_truncate_width = {}
|
||||
<
|
||||
* configure the layout of the sections by specificing an array of two arrays
|
||||
(first array is the left side, second array is the right side). >
|
||||
let g:airline#extensions#default#layout = [
|
||||
\ [ 'a', 'b', 'c' ],
|
||||
\ [ 'x', 'y', 'z', 'warning' ]
|
||||
\ ])
|
||||
<
|
||||
|
||||
------------------------------------- *airline-quickfix*
|
||||
The quickfix extension is a simple built-in extension which determines
|
||||
whether the buffer is a quickfix or location list buffer, and adjusts the
|
||||
title accordingly.
|
||||
|
||||
* configure the title text for quickfix buffers >
|
||||
let g:airline#extensions#quickfix#quickfix_text = 'Quickfix'
|
||||
<
|
||||
* configure the title text for location list buffers >
|
||||
let g:airline#extensions#quickfix#location_text = 'Location'
|
||||
<
|
||||
|
||||
------------------------------------- *airline-bufferline*
|
||||
vim-bufferline <https://github.com/bling/vim-bufferline>
|
||||
|
||||
* enable/disable bufferline integration >
|
||||
let g:airline#extensions#bufferline#enabled = 1
|
||||
<
|
||||
* determine whether bufferline will overwrite customization variables >
|
||||
let g:airline#extensions#bufferline#overwrite_variables = 1
|
||||
<
|
||||
------------------------------------- *airline-branch*
|
||||
fugitive.vim <https://github.com/tpope/vim-fugitive>
|
||||
lawrencium <https://bitbucket.org/ludovicchabant/vim-lawrencium>
|
||||
vcscommand <http://www.vim.org/scripts/script.php?script_id=90>
|
||||
|
||||
* enable/disable fugitive/lawrencium integration >
|
||||
let g:airline#extensions#branch#enabled = 1
|
||||
<
|
||||
* change the text for when no branch is detected >
|
||||
let g:airline#extensions#branch#empty_message = ''
|
||||
|
||||
* use vcscommand.vim if available >
|
||||
let g:airline#extensions#branch#use_vcscommand = 0
|
||||
<
|
||||
------------------------------------- *airline-syntastic*
|
||||
syntastic <https://github.com/scrooloose/syntastic>
|
||||
|
||||
* enable/disable syntastic integration >
|
||||
let g:airline#extensions#syntastic#enabled = 1
|
||||
<
|
||||
------------------------------------- *airline-tagbar*
|
||||
tagbar <https://github.com/majutsushi/>
|
||||
|
||||
* enable/disable tagbar integration >
|
||||
let g:airline#extensions#tagbar#enabled = 1
|
||||
<
|
||||
* change how tags are displayed (:help tagbar-statusline) >
|
||||
let g:airline#extensions#tagbar#flags = '' "default
|
||||
let g:airline#extensions#tagbar#flags = 'f'
|
||||
let g:airline#extensions#tagbar#flags = 's'
|
||||
let g:airline#extensions#tagbar#flags = 'p'
|
||||
<
|
||||
------------------------------------- *airline-csv*
|
||||
csv.vim <https://github.com/chrisbra/csv.vim>
|
||||
|
||||
* enable/disable csv integration for displaying the current column. >
|
||||
let g:airline#extensions#csv#enabled = 1
|
||||
<
|
||||
* change how columns are displayed. >
|
||||
let g:airline#extensions#csv#column_display = 'Number' (default)
|
||||
let g:airline#extensions#csv#column_display = 'Name'
|
||||
<
|
||||
------------------------------------- *airline-hunks*
|
||||
vim-gitgutter <https://github.com/airblade/vim-gitgutter>
|
||||
vim-signify <https://github.com/mhinz/vim-signify>
|
||||
|
||||
* enable/disable showing a summary of changed hunks under source control. >
|
||||
let g:airline#extensions#hunks#enabled = 1
|
||||
<
|
||||
* enable/disable showing only non-zero hunks. >
|
||||
let g:airline#extensions#hunks#non_zero_only = 0
|
||||
<
|
||||
* set hunk count symbols. >
|
||||
let g:airline#extensions#hunks#hunk_symbols = ['+', '~', '-']
|
||||
<
|
||||
------------------------------------- *airline-ctrlp*
|
||||
ctrlp <https://github.com/kien/ctrlp.vim>
|
||||
|
||||
* configure which mode colors should ctrlp window use (takes effect
|
||||
only if the active airline theme doesn't define ctrlp colors) >
|
||||
let g:airline#extensions#ctrlp#color_template = 'insert' (default)
|
||||
let g:airline#extensions#ctrlp#color_template = 'normal'
|
||||
let g:airline#extensions#ctrlp#color_template = 'visual'
|
||||
let g:airline#extensions#ctrlp#color_template = 'replace'
|
||||
<
|
||||
|
||||
* configure whether to show the previous and next modes (mru, buffer, etc...)
|
||||
>
|
||||
let g:airline#extensions#ctrlp#show_adjacent_modes = 1
|
||||
<
|
||||
------------------------------------- *airline-virtualenv*
|
||||
virtualenv <https://github.com/jmcantrell/vim-virtualenv>
|
||||
|
||||
* enable/disable virtualenv integration >
|
||||
let g:airline#extensions#virtualenv#enabled = 1
|
||||
<
|
||||
------------------------------------- *airline-eclim*
|
||||
eclim <https://eclim.org>
|
||||
|
||||
* enable/disable eclim integration, which works well with the
|
||||
|airline-syntastic| extension. >
|
||||
let g:airline#extensions#eclim#enabled = 1
|
||||
|
||||
------------------------------------- *airline-whitespace*
|
||||
* enable/disable detection of whitespace errors. >
|
||||
let g:airline#extensions#whitespace#enabled = 1
|
||||
<
|
||||
* customize the whitespace symbol. >
|
||||
let g:airline#extensions#whitespace#symbol = '!'
|
||||
<
|
||||
* configure which whitespace checks to enable. >
|
||||
let g:airline#extensions#whitespace#checks = [ 'indent', 'trailing' ]
|
||||
<
|
||||
* configure whether a message should be displayed. >
|
||||
let g:airline#extensions#whitespace#show_message = 1
|
||||
<
|
||||
* configure the formatting of the warning messages. >
|
||||
let g:airline#extensions#whitespace#trailing_format = 'trailing[%s]'
|
||||
let g:airline#extensions#whitespace#mixed_indent_format = 'mixed-indent[%s]'
|
||||
<
|
||||
------------------------------------- *airline-tabline*
|
||||
* enable/disable enhanced tabline. >
|
||||
let g:airline#extensions#tabline#enabled = 0
|
||||
<
|
||||
* enable/disable displaying buffers with a single tab. >
|
||||
let g:airline#extensions#tabline#show_buffers = 1
|
||||
<
|
||||
* configure filename match rules to exclude from the tabline. >
|
||||
let g:airline#extensions#tabline#excludes = []
|
||||
<
|
||||
* configure how numbers are calculated in tab mode. >
|
||||
let g:airline#extensions#tabline#tab_nr_type = 0 " # of splits (default)
|
||||
let g:airline#extensions#tabline#tab_nr_type = 1 " tab number
|
||||
<
|
||||
* defines the name of a formatter for how buffer names are displayed. >
|
||||
let g:airline#extensions#tabline#formatter = 'default'
|
||||
|
||||
" here is how you can define a 'foo' formatter:
|
||||
function! airline#extensions#tabline#formatters#foo(bufnr, buffers)
|
||||
return fnamemodify(bufname(a:bufnr), ':t')
|
||||
endfunction
|
||||
let g:airline#extensions#tabline#formatter = 'foo'
|
||||
<
|
||||
Note: the following variables are only used by the 'default' formatter.
|
||||
|
||||
* configure whether buffer numbers should be shown. >
|
||||
let g:airline#extensions#tabline#buffer_nr_show = 0
|
||||
<
|
||||
* configure how buffer numbers should be formatted with |printf|. >
|
||||
let g:airline#extensions#tabline#buffer_nr_format = '%s: '
|
||||
<
|
||||
* configure the formatting of filenames (see |filename-modifiers|). >
|
||||
let g:airline#extensions#tabline#fnamemod = ':p:.'
|
||||
<
|
||||
* configure collapsing parent directories in buffer name. >
|
||||
let g:airline#extensions#tabline#fnamecollapse = 1
|
||||
|
||||
" The `unique_tail` algorithm will display the tail of the filename, unless
|
||||
" there is another file of the same name, in which it will display it along
|
||||
" with the containing parent directory.
|
||||
let g:airline#extensions#tabline#formatter = 'unique_tail'
|
||||
<
|
||||
* configure the minimum number of buffers needed to show the tabline. >
|
||||
let g:airline#extensions#tabline#buffer_min_count = 0
|
||||
<
|
||||
Note: this setting only applies to a single tab and when `show_buffers` is
|
||||
true.
|
||||
|
||||
* configure the minimum number of tabs needed to show the tabline. >
|
||||
let g:airline#extensions#tabline#tab_min_count = 0
|
||||
<
|
||||
Note: this setting only applies when `show_buffers` is false.
|
||||
|
||||
* configure separators for the tabline only. >
|
||||
let g:airline#extensions#tabline#left_sep = ''
|
||||
let g:airline#extensions#tabline#left_alt_sep = ''
|
||||
let g:airline#extensions#tabline#right_sep = ''
|
||||
let g:airline#extensions#tabline#right_alt_sep = ''
|
||||
<
|
||||
Note: Enabling this extension will modify 'showtabline' and 'guioptions'.
|
||||
|
||||
==============================================================================
|
||||
ADVANCED CUSTOMIZATION *airline-advanced-customization*
|
||||
|
||||
The defaults will accomodate the mass majority of users with minimal
|
||||
configuration. However, if you want to reposition sections or contents you can
|
||||
do so with built-in helper functions, which makes it possible to create
|
||||
sections in a more declarative style.
|
||||
|
||||
------------------------------------- *airline-parts*
|
||||
A part is something that contains metadata that eventually gets rendered into
|
||||
the statusline. You can define parts that contain constant strings or
|
||||
functions. Defining parts is needed if you want to use features like automatic
|
||||
insertion of separators or hiding based on window width.
|
||||
|
||||
For example, this is how you would define a part function: >
|
||||
call airline#parts#define_function('foo', 'GetFooText')
|
||||
<
|
||||
Here is how you would define a part that is visible only if the window width
|
||||
greater than a minimum width. >
|
||||
call airline#parts#define_minwidth('foo', 50)
|
||||
<
|
||||
Parts can be configured to be visible conditionally. >
|
||||
call airline#parts#define_condition('foo', 'getcwd() =~ "work_dir"')
|
||||
<
|
||||
Note: Part definitions are combinative; e.g. the two examples above modify the
|
||||
same `foo` part.
|
||||
|
||||
Note: Look at the source code and tests for the full API.
|
||||
|
||||
------------------------------------- *airline-predefined-parts*
|
||||
Before is a list of parts that are predefined by vim-airline.
|
||||
|
||||
* `mode` displays the current mode
|
||||
* `iminsert` displays the current insert method
|
||||
* `paste` displays the paste indicator
|
||||
* `filetype` displays the file type
|
||||
* `readonly` displays the read only indicator
|
||||
* `file` displays the filename and modified indicator
|
||||
* `ffenc` displays the file format and encoding
|
||||
|
||||
And the following are defined for their respective extensions:
|
||||
|
||||
`hunks`, `branch`, `tagbar`, `syntastic`, `whitespace`
|
||||
|
||||
------------------------------------- *airline-accents*
|
||||
Accents can be defined on any part, like so: >
|
||||
call airline#parts#define_accent('foo', 'red')
|
||||
<
|
||||
This will override the colors of that part by using what is defined in that
|
||||
particular accent. In the above example, the `red` accent is used, which means
|
||||
regardless of which section the part is used in, it will have red foreground
|
||||
colors instead of the section's default foreground color.
|
||||
|
||||
The following accents are defined by default. Themes can define their variants
|
||||
of the colors, but defaults will be provided if missing. >
|
||||
bold, italic, red, green, blue, yellow, orange, purple
|
||||
<
|
||||
The defaults configure the mode and line number parts to be bold, and the
|
||||
readonly part to be red.
|
||||
|
||||
------------------------------------- *airline-sections*
|
||||
Once a part is defined, you can use helper functions to generate the
|
||||
statuslines for each section. For example, to use the part above, we could
|
||||
define a section like this: >
|
||||
function! AirlineInit()
|
||||
let g:airline_section_a = airline#section#create(['mode', ' ', 'foo'])
|
||||
let g:airline_section_b = airline#section#create_left(['ffenc','file'])
|
||||
let g:airline_section_c = airline#section#create(['%{getcwd()}'])
|
||||
endfunction
|
||||
autocmd VimEnter * call AirlineInit()
|
||||
<
|
||||
This will create a section with the `mode`, followed by a space, and our `foo`
|
||||
part in section `a`. Section `b` will have two parts with a left-side
|
||||
separator. And section `c` will contain the current path. You may notice that
|
||||
the space and cwd are not defined parts. For convenience, if a part of that
|
||||
key does not exist, it will be inserted as is. The unit tests will be a good
|
||||
resource for possibilities.
|
||||
|
||||
Note: The use of |VimEnter| is important, because most extensions are lazily
|
||||
loaded, so we must give them a chance to define their parts before we can use
|
||||
them.
|
||||
|
||||
Note: The `airline#section#create` function and friends will do its best to
|
||||
create a section with the appropriate separators, but it only works for
|
||||
function and text parts. Special 'statusline' items like %f or raw/undefined
|
||||
parts will not work as it is not possible to inspect their widths/contents
|
||||
before rendering to the statusline.
|
||||
|
||||
==============================================================================
|
||||
FUNCREFS *airline-funcrefs*
|
||||
|
||||
vim-airline internally uses funcrefs to integrate with third party plugins,
|
||||
and you can tap into this functionality to extend it for you needs. This is
|
||||
the most powerful way to customize the statusline, and sometimes it may be
|
||||
easier to go this route than the above methods.
|
||||
|
||||
Every section can have two values. The default value is the global `g:`
|
||||
variable which is used in the absense of a `w:` value. This makes it very easy
|
||||
to override only certain parts of the statusline by only defining window-local
|
||||
variables for a subset of all sections.
|
||||
|
||||
------------------------------------- *add_statusline_func*
|
||||
The following is an example of how you can extend vim-airline to support a
|
||||
new plugin. >
|
||||
function! MyPlugin(...)
|
||||
if &filetype == 'MyPluginFileType'
|
||||
let w:airline_section_a = 'MyPlugin'
|
||||
let w:airline_section_b = '%f'
|
||||
let w:airline_section_c = '%{MyPlugin#function()}'
|
||||
let g:airline_variable_referenced_in_statusline = 'foo'
|
||||
endif
|
||||
endfunction
|
||||
call airline#add_statusline_func('MyPlugin')
|
||||
<
|
||||
Notice that only the left side of the statusline is overwritten. This means
|
||||
the right side (the line/column numbers, etc) will be intact.
|
||||
|
||||
------------------------------------- *remove_statusline_func*
|
||||
You can also remove a function as well, which is useful for when you want a
|
||||
temporary override. >
|
||||
call airline#remove_statusline_func('MyPlugin')
|
||||
<
|
||||
|
||||
==============================================================================
|
||||
PIPELINE *airline-pipeline*
|
||||
|
||||
Sometimes you want to do more than just use overrides. The statusline funcref
|
||||
is invoked and passed two arguments. The first of these arguments is the
|
||||
statusline builder. You can use this to build completely custom statuslines
|
||||
to your liking. Here is an example: >
|
||||
>
|
||||
function! MyPlugin(...)
|
||||
" first variable is the statusline builder
|
||||
let builder = a:1
|
||||
|
||||
" WARNING: the API for the builder is not finalized and may change
|
||||
call builder.add_section('Normal', '%f')
|
||||
call builder.add_section('WarningMsg', '%{getcwd()}')
|
||||
call builder.split()
|
||||
call builder.add_section('airline_z', '%p%%')
|
||||
|
||||
" tell the core to use the contents of the builder
|
||||
return 1
|
||||
endfunction
|
||||
<
|
||||
The above example uses various some example highlight groups to demonstrate
|
||||
that you can use any combination from the loaded colorscheme. However, if
|
||||
you want colors to change between modes, you should use one of the section
|
||||
highlight groups, e.g. `airline_a` and `airline_b`.
|
||||
|
||||
The second variable is the context, which is a dictionary containing various
|
||||
values such as whether the statusline is active or not, and the window number.
|
||||
>
|
||||
context = {
|
||||
'winnr': 'the window number for the statusline',
|
||||
'active': 'whether the window is active or not',
|
||||
'bufnr': 'the current buffer for this window',
|
||||
}
|
||||
<
|
||||
------------------------------------- *airline-pipeline-return-codes*
|
||||
The pipeline accepts various return codes and can be used to determine the
|
||||
next action. The following are the supported codes: >
|
||||
0 the default, continue on with the next funcref
|
||||
-1 do not modify the statusline
|
||||
1 modify the statusline with the current contents of the builder
|
||||
<
|
||||
Note: Any value other than 0 will halt the pipeline and prevent the next
|
||||
funcref from executing.
|
||||
|
||||
==============================================================================
|
||||
WRITING EXTENSIONS *airline-writing-extensions*
|
||||
|
||||
For contributions into the plugin, here are the following guidelines:
|
||||
|
||||
1. For simple 'filetype' checks, they can be added directly into the
|
||||
`extensions.vim` file.
|
||||
|
||||
2. Pretty much everything else should live as a separate file under the
|
||||
`extensions/` directory.
|
||||
|
||||
a. Inside `extensions.vim`, add a check for some variable or command that
|
||||
is always available (these must be defined in `plugin/`, and _not_
|
||||
`autoload/` of the other plugin). If it exists, then initialize the
|
||||
extension. This ensures that the extension is loaded if and only if the
|
||||
user has the other plugin installed. Also, a check to
|
||||
`airline#extensions#foo_plugin#enabled` should be performed to allow the
|
||||
user to disable it.
|
||||
|
||||
b. Configuration variables for the extension should reside in the
|
||||
extension, e.g. `g:airline#extensions#foo_plugin#bar_variable`.
|
||||
|
||||
See the source of |example.vim| for documented code of how to write one.
|
||||
Looking at the other extensions is also a good resource.
|
||||
|
||||
==============================================================================
|
||||
WRITING THEMES *airline-themes*
|
||||
|
||||
Themes are written "close to the metal" -- you will need to know some basic
|
||||
VimL syntax to write a theme, but if you've written in any programming
|
||||
language before it will be easy to pick up.
|
||||
|
||||
The |dark.vim| theme fully documents this procedure and will guide you through
|
||||
the process. The |jellybeans.vim| theme is another example of how to write a
|
||||
theme, but instead of manually declaring colors, it extracts the values from
|
||||
highlight groups.
|
||||
|
||||
==============================================================================
|
||||
TROUBLESHOOTING *airline-troubleshooting*
|
||||
|
||||
Q. There are no colors.
|
||||
A. You need to set up your terminal correctly. For more details, see
|
||||
<http://vim.wikia.com/wiki/256_colors_in_vim>. Alternatively, if you want
|
||||
to bypass the automatic detection of terminal colors, you can force Vim
|
||||
into 256 color mode with this: >
|
||||
set t_Co=256
|
||||
<
|
||||
Q. The statusline does not appear until I create a split.
|
||||
A. This is the default setting of 'laststatus'. If you want it to appear all
|
||||
the time, add the following to your vimrc: >
|
||||
set laststatus=2
|
||||
<
|
||||
Q. Powerline symbols are not showing up.
|
||||
A. First, you must install patched powerline fonts. Second, you must enable
|
||||
unicode in vim. >
|
||||
set encoding=utf-8
|
||||
<
|
||||
Q. There is a pause when leaving insert mode.
|
||||
A. Add the following to your vimrc. >
|
||||
set ttimeoutlen=50
|
||||
<
|
||||
Q. The colors look a little off for some themes.
|
||||
A. Certain themes are derived from the active colorscheme by extracting colors
|
||||
from predefined highlight groups. These airline themes will look good for
|
||||
their intended matching colorschemes, but will be hit or miss when loaded
|
||||
with other colorschemes.
|
||||
|
||||
|
||||
Solutions to other common problems can be found in the Wiki:
|
||||
<https://github.com/bling/vim-airline/wiki/FAQ>
|
||||
|
||||
==============================================================================
|
||||
CONTRIBUTIONS *airline-contributions*
|
||||
|
||||
Contributions and pull requests are welcome.
|
||||
|
||||
==============================================================================
|
||||
LICENSE *airline-license*
|
||||
|
||||
MIT License. Copyright © 2013 Bailey Ling.
|
||||
|
||||
|
||||
vim:tw=78:ts=8:ft=help:norl:
|
109
sources_non_forked/vim-airline/plugin/airline.vim
Normal file
109
sources_non_forked/vim-airline/plugin/airline.vim
Normal file
@ -0,0 +1,109 @@
|
||||
" MIT License. Copyright (c) 2013 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
if &cp || v:version < 702 || (exists('g:loaded_airline') && g:loaded_airline)
|
||||
finish
|
||||
endif
|
||||
let g:loaded_airline = 1
|
||||
|
||||
" autocmd VimEnter * call airline#deprecation#check()
|
||||
|
||||
let s:airline_initialized = 0
|
||||
let s:airline_theme_defined = 0
|
||||
function! s:init()
|
||||
if !s:airline_initialized
|
||||
let s:airline_initialized = 1
|
||||
|
||||
call airline#init#bootstrap()
|
||||
call airline#extensions#load()
|
||||
call airline#init#sections()
|
||||
|
||||
let s:airline_theme_defined = exists('g:airline_theme')
|
||||
if s:airline_theme_defined || !airline#switch_matching_theme()
|
||||
let g:airline_theme = get(g:, 'airline_theme', 'dark')
|
||||
call airline#switch_theme(g:airline_theme)
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:on_window_changed()
|
||||
if pumvisible()
|
||||
return
|
||||
endif
|
||||
call <sid>init()
|
||||
call airline#update_statusline()
|
||||
endfunction
|
||||
|
||||
function! s:on_colorscheme_changed()
|
||||
call <sid>init()
|
||||
if !s:airline_theme_defined
|
||||
if airline#switch_matching_theme()
|
||||
return
|
||||
endif
|
||||
endif
|
||||
|
||||
" couldn't find a match, or theme was defined, just refresh
|
||||
call airline#load_theme()
|
||||
endfunction
|
||||
|
||||
function airline#cmdwinenter(...)
|
||||
call airline#extensions#apply_left_override('Command Line', '')
|
||||
endfunction
|
||||
|
||||
function! s:airline_toggle()
|
||||
if exists("#airline")
|
||||
augroup airline
|
||||
au!
|
||||
augroup END
|
||||
augroup! airline
|
||||
|
||||
if exists("s:stl")
|
||||
let &stl = s:stl
|
||||
endif
|
||||
|
||||
silent doautocmd User AirlineToggledOff
|
||||
else
|
||||
let s:stl = &statusline
|
||||
augroup airline
|
||||
autocmd!
|
||||
|
||||
autocmd CmdwinEnter *
|
||||
\ call airline#add_statusline_func('airline#cmdwinenter')
|
||||
\ | call <sid>on_window_changed()
|
||||
autocmd CmdwinLeave * call airline#remove_statusline_func('airline#cmdwinenter')
|
||||
|
||||
autocmd ColorScheme * call <sid>on_colorscheme_changed()
|
||||
autocmd VimEnter,WinEnter,BufWinEnter,FileType,BufUnload,VimResized *
|
||||
\ call <sid>on_window_changed()
|
||||
|
||||
autocmd BufWritePost */autoload/airline/themes/*.vim
|
||||
\ exec 'source '.split(globpath(&rtp, 'autoload/airline/themes/'.g:airline_theme.'.vim', 1), "\n")[0]
|
||||
\ | call airline#load_theme()
|
||||
augroup END
|
||||
|
||||
silent doautocmd User AirlineToggledOn
|
||||
|
||||
if s:airline_initialized
|
||||
call <sid>on_window_changed()
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:get_airline_themes(a, l, p)
|
||||
let files = split(globpath(&rtp, 'autoload/airline/themes/'.a:a.'*'), "\n")
|
||||
return map(files, 'fnamemodify(v:val, ":t:r")')
|
||||
endfunction
|
||||
function! s:airline_theme(...)
|
||||
if a:0
|
||||
call airline#switch_theme(a:1)
|
||||
else
|
||||
echo g:airline_theme
|
||||
endif
|
||||
endfunction
|
||||
command! -nargs=? -complete=customlist,<sid>get_airline_themes AirlineTheme call <sid>airline_theme(<f-args>)
|
||||
command! AirlineToggleWhitespace call airline#extensions#whitespace#toggle()
|
||||
command! AirlineToggle call <sid>airline_toggle()
|
||||
command! AirlineRefresh call airline#load_theme()
|
||||
|
||||
call <sid>airline_toggle()
|
||||
|
87
sources_non_forked/vim-airline/t/airline.vim
Normal file
87
sources_non_forked/vim-airline/t/airline.vim
Normal file
@ -0,0 +1,87 @@
|
||||
let g:airline_theme = 'dark'
|
||||
call airline#init#bootstrap()
|
||||
call airline#init#sections()
|
||||
source plugin/airline.vim
|
||||
|
||||
function! MyFuncref(...)
|
||||
call a:1.add_raw('hello world')
|
||||
return 1
|
||||
endfunction
|
||||
|
||||
function! MyIgnoreFuncref(...)
|
||||
return -1
|
||||
endfunction
|
||||
|
||||
function! MyAppend1(...)
|
||||
call a:1.add_raw('hello')
|
||||
endfunction
|
||||
|
||||
function! MyAppend2(...)
|
||||
call a:1.add_raw('world')
|
||||
endfunction
|
||||
|
||||
describe 'airline'
|
||||
before
|
||||
let g:airline_statusline_funcrefs = []
|
||||
end
|
||||
|
||||
it 'should run user funcrefs first'
|
||||
call airline#add_statusline_func('MyFuncref')
|
||||
let &statusline = ''
|
||||
call airline#update_statusline()
|
||||
Expect airline#statusline(1) =~ 'hello world'
|
||||
end
|
||||
|
||||
it 'should not change the statusline with -1'
|
||||
call airline#add_statusline_funcref(function('MyIgnoreFuncref'))
|
||||
let &statusline = 'foo'
|
||||
call airline#update_statusline()
|
||||
Expect &statusline == 'foo'
|
||||
end
|
||||
|
||||
it 'should support multiple chained funcrefs'
|
||||
call airline#add_statusline_func('MyAppend1')
|
||||
call airline#add_statusline_func('MyAppend2')
|
||||
call airline#update_statusline()
|
||||
Expect airline#statusline(1) =~ 'helloworld'
|
||||
end
|
||||
|
||||
it 'should allow users to redefine sections'
|
||||
let g:airline_section_a = airline#section#create(['mode', 'mode'])
|
||||
call airline#update_statusline()
|
||||
Expect airline#statusline(1) =~ '%{airline#util#wrap(airline#parts#mode(),0)}%#airline_a#%#airline_a_bold#%{airline#util#wrap(airline#parts#mode(),0)}%#airline_a#'
|
||||
end
|
||||
|
||||
it 'should remove funcrefs properly'
|
||||
let c = len(g:airline_statusline_funcrefs)
|
||||
call airline#add_statusline_func('MyIgnoreFuncref')
|
||||
call airline#remove_statusline_func('MyIgnoreFuncref')
|
||||
Expect len(g:airline_statusline_funcrefs) == c
|
||||
end
|
||||
|
||||
it 'should overwrite the statusline with active and inactive splits'
|
||||
wincmd s
|
||||
Expect airline#statusline(1) !~ 'inactive'
|
||||
Expect airline#statusline(2) =~ 'inactive'
|
||||
wincmd c
|
||||
end
|
||||
|
||||
it 'should collapse the inactive split if the variable is set true'
|
||||
let g:airline_inactive_collapse = 1
|
||||
wincmd s
|
||||
Expect getwinvar(2, '&statusline') !~ 'airline#parts#mode'
|
||||
wincmd c
|
||||
end
|
||||
|
||||
it 'should not collapse the inactive split if the variable is set false'
|
||||
let g:airline_inactive_collapse = 0
|
||||
wincmd s
|
||||
Expect getwinvar(2, '&statusline') != 'airline#parts#mode'
|
||||
wincmd c
|
||||
end
|
||||
|
||||
it 'should include check_mode'
|
||||
Expect airline#statusline(1) =~ 'airline#check_mode'
|
||||
end
|
||||
end
|
||||
|
80
sources_non_forked/vim-airline/t/builder.vim
Normal file
80
sources_non_forked/vim-airline/t/builder.vim
Normal file
@ -0,0 +1,80 @@
|
||||
let g:airline_theme = 'dark'
|
||||
call airline#init#bootstrap()
|
||||
|
||||
describe 'active builder'
|
||||
before
|
||||
let s:builder = airline#builder#new({'active': 1})
|
||||
end
|
||||
|
||||
it 'should start with an empty statusline'
|
||||
let stl = s:builder.build()
|
||||
Expect stl == ''
|
||||
end
|
||||
|
||||
it 'should transition colors from one to the next'
|
||||
call s:builder.add_section('Normal', 'hello')
|
||||
call s:builder.add_section('NonText', 'world')
|
||||
let stl = s:builder.build()
|
||||
Expect stl =~ '%#Normal#hello%#Normal_to_NonText#>%#NonText#world'
|
||||
end
|
||||
|
||||
it 'should split left/right sections'
|
||||
call s:builder.split()
|
||||
let stl = s:builder.build()
|
||||
Expect stl =~ '%='
|
||||
end
|
||||
|
||||
it 'after split, sections use the right separator'
|
||||
call s:builder.split()
|
||||
call s:builder.add_section('Normal', 'hello')
|
||||
call s:builder.add_section('NonText', 'world')
|
||||
let stl = s:builder.build()
|
||||
Expect stl =~ '%#Normal#hello%#Normal_to_NonText#<%#NonText#world'
|
||||
end
|
||||
|
||||
it 'should not repeat the same highlight group'
|
||||
call s:builder.add_section('Normal', 'hello')
|
||||
call s:builder.add_section('Normal', 'hello')
|
||||
let stl = s:builder.build()
|
||||
Expect stl == '%#Normal#hello>hello'
|
||||
end
|
||||
|
||||
it 'should replace accent groups with the specified group'
|
||||
call s:builder.add_section('Normal', '%#__accent_foo#hello')
|
||||
let stl = s:builder.build()
|
||||
Expect stl == '%#Normal#%#Normal_foo#hello'
|
||||
end
|
||||
|
||||
it 'should replace two accent groups with correct groups'
|
||||
call s:builder.add_section('Normal', '%#__accent_foo#hello%#__accent_bar#world')
|
||||
let stl = s:builder.build()
|
||||
Expect stl =~ '%#Normal_foo#hello%#Normal_bar#world'
|
||||
end
|
||||
|
||||
it 'should special restore group should go back to previous group'
|
||||
call s:builder.add_section('Normal', '%#__restore__#')
|
||||
let stl = s:builder.build()
|
||||
Expect stl !~ '%#__restore__#'
|
||||
Expect stl =~ '%#Normal#'
|
||||
end
|
||||
end
|
||||
|
||||
describe 'inactive builder'
|
||||
before
|
||||
let s:builder = airline#builder#new({'active': 0})
|
||||
end
|
||||
|
||||
it 'should transition colors from one to the next'
|
||||
call s:builder.add_section('Normal', 'hello')
|
||||
call s:builder.add_section('NonText', 'world')
|
||||
let stl = s:builder.build()
|
||||
Expect stl =~ '%#Normal_inactive#hello%#Normal_to_NonText_inactive#>%#NonText_inactive#world'
|
||||
end
|
||||
|
||||
it 'should not render accents'
|
||||
call s:builder.add_section('Normal', '%#__accent_foo#hello%#foo#foo%#__accent_bar#world')
|
||||
let stl = s:builder.build()
|
||||
Expect stl == '%#Normal_inactive#hello%#foo_inactive#fooworld'
|
||||
end
|
||||
end
|
||||
|
33
sources_non_forked/vim-airline/t/commands.vim
Normal file
33
sources_non_forked/vim-airline/t/commands.vim
Normal file
@ -0,0 +1,33 @@
|
||||
call airline#init#bootstrap()
|
||||
call airline#init#sections()
|
||||
|
||||
source plugin/airline.vim
|
||||
|
||||
describe 'commands'
|
||||
it 'should toggle off and on'
|
||||
execute 'AirlineToggle'
|
||||
Expect exists('#airline') to_be_false
|
||||
execute 'AirlineToggle'
|
||||
Expect exists('#airline') to_be_true
|
||||
end
|
||||
|
||||
it 'should toggle whitespace off and on'
|
||||
call airline#extensions#load()
|
||||
execute 'AirlineToggleWhitespace'
|
||||
Expect exists('#airline_whitespace') to_be_false
|
||||
execute 'AirlineToggleWhitespace'
|
||||
Expect exists('#airline_whitespace') to_be_true
|
||||
end
|
||||
|
||||
it 'should display theme name with no args'
|
||||
execute 'AirlineTheme simple'
|
||||
Expect g:airline_theme == 'simple'
|
||||
execute 'AirlineTheme dark'
|
||||
Expect g:airline_theme == 'dark'
|
||||
end
|
||||
|
||||
it 'should have a refresh command'
|
||||
Expect exists(':AirlineRefresh') to_be_true
|
||||
end
|
||||
end
|
||||
|
32
sources_non_forked/vim-airline/t/extensions_default.vim
Normal file
32
sources_non_forked/vim-airline/t/extensions_default.vim
Normal file
@ -0,0 +1,32 @@
|
||||
let g:airline_theme = 'dark'
|
||||
call airline#init#bootstrap()
|
||||
call airline#init#sections()
|
||||
source plugin/airline.vim
|
||||
|
||||
describe 'default'
|
||||
before
|
||||
let s:builder = airline#builder#new({'active': 1})
|
||||
end
|
||||
|
||||
it 'should use the layout'
|
||||
let g:airline#extensions#default#layout = [
|
||||
\ [ 'c', 'a', 'b', 'warning' ],
|
||||
\ [ 'x', 'z', 'y' ]
|
||||
\ ]
|
||||
call airline#extensions#default#apply(s:builder, { 'winnr': 1, 'active': 1 })
|
||||
let stl = s:builder.build()
|
||||
Expect stl =~ 'airline_c_to_airline_a'
|
||||
Expect stl =~ 'airline_a_to_airline_b'
|
||||
Expect stl =~ 'airline_b_to_airline_warning'
|
||||
Expect stl =~ 'airline_x_to_airline_z'
|
||||
Expect stl =~ 'airline_z_to_airline_y'
|
||||
end
|
||||
|
||||
it 'should only render warning section in active splits'
|
||||
wincmd s
|
||||
Expect airline#statusline(1) =~ 'warning'
|
||||
Expect airline#statusline(2) !~ 'warning'
|
||||
wincmd c
|
||||
end
|
||||
end
|
||||
|
21
sources_non_forked/vim-airline/t/highlighter.vim
Normal file
21
sources_non_forked/vim-airline/t/highlighter.vim
Normal file
@ -0,0 +1,21 @@
|
||||
let g:airline_theme = 'dark'
|
||||
|
||||
describe 'highlighter'
|
||||
it 'should create separator highlight groups'
|
||||
hi Foo1 ctermfg=1 ctermbg=2
|
||||
hi Foo2 ctermfg=3 ctermbg=4
|
||||
call airline#highlighter#add_separator('Foo1', 'Foo2', 0)
|
||||
let hl = airline#highlighter#get_highlight('Foo1_to_Foo2')
|
||||
Expect hl == [ '', '', '4', '2', '' ]
|
||||
end
|
||||
|
||||
it 'should populate accent colors'
|
||||
Expect exists('g:airline#themes#dark#palette.normal.airline_c_red') to_be_false
|
||||
Expect hlID('airline_c_red') == 0
|
||||
call airline#themes#patch(g:airline#themes#dark#palette)
|
||||
call airline#highlighter#add_accent('red')
|
||||
call airline#highlighter#highlight(['normal'])
|
||||
Expect hlID('airline_c_red') != 0
|
||||
end
|
||||
end
|
||||
|
77
sources_non_forked/vim-airline/t/init.vim
Normal file
77
sources_non_forked/vim-airline/t/init.vim
Normal file
@ -0,0 +1,77 @@
|
||||
let s:sections = ['a', 'b', 'c', 'gutter', 'x', 'y', 'z', 'warning']
|
||||
|
||||
function! s:clear()
|
||||
for key in s:sections
|
||||
unlet! g:airline_section_{key}
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
call airline#init#bootstrap()
|
||||
|
||||
describe 'init sections'
|
||||
before
|
||||
call s:clear()
|
||||
call airline#init#sections()
|
||||
end
|
||||
|
||||
after
|
||||
call s:clear()
|
||||
end
|
||||
|
||||
it 'section a should have mode, paste, iminsert'
|
||||
Expect g:airline_section_a =~ 'mode'
|
||||
Expect g:airline_section_a =~ 'paste'
|
||||
Expect g:airline_section_a =~ 'iminsert'
|
||||
end
|
||||
|
||||
it 'section b should be blank because no extensions are installed'
|
||||
Expect g:airline_section_b == ''
|
||||
end
|
||||
|
||||
it 'section c should be file'
|
||||
Expect g:airline_section_c == '%<%f%m %#__accent_red#%{airline#util#wrap(airline#parts#readonly(),0)}%#__restore__#'
|
||||
end
|
||||
|
||||
it 'section x should be filetype'
|
||||
Expect g:airline_section_x == '%{airline#util#wrap(airline#parts#filetype(),0)}'
|
||||
end
|
||||
|
||||
it 'section y should be fenc and ff'
|
||||
Expect g:airline_section_y =~ 'ff'
|
||||
Expect g:airline_section_y =~ 'fenc'
|
||||
end
|
||||
|
||||
it 'section z should be line numbers'
|
||||
Expect g:airline_section_z =~ '%3p%%'
|
||||
Expect g:airline_section_z =~ '%4l'
|
||||
Expect g:airline_section_z =~ '%3c'
|
||||
end
|
||||
|
||||
it 'should not redefine sections already defined'
|
||||
for s in s:sections
|
||||
let g:airline_section_{s} = s
|
||||
endfor
|
||||
call airline#init#bootstrap()
|
||||
for s in s:sections
|
||||
Expect g:airline_section_{s} == s
|
||||
endfor
|
||||
end
|
||||
|
||||
it 'all default statusline extensions should be blank'
|
||||
Expect airline#parts#get('hunks').raw == ''
|
||||
Expect airline#parts#get('branch').raw == ''
|
||||
Expect airline#parts#get('tagbar').raw == ''
|
||||
Expect airline#parts#get('syntastic').raw == ''
|
||||
Expect airline#parts#get('eclim').raw == ''
|
||||
Expect airline#parts#get('whitespace').raw == ''
|
||||
end
|
||||
end
|
||||
|
||||
describe 'init parts'
|
||||
it 'should not redefine parts already defined'
|
||||
call airline#parts#define_raw('linenr', 'bar')
|
||||
call airline#init#sections()
|
||||
Expect g:airline_section_z =~ 'bar'
|
||||
end
|
||||
end
|
||||
|
39
sources_non_forked/vim-airline/t/parts.vim
Normal file
39
sources_non_forked/vim-airline/t/parts.vim
Normal file
@ -0,0 +1,39 @@
|
||||
describe 'parts'
|
||||
it 'overwrites existing values'
|
||||
call airline#parts#define('foo', { 'test': '123' })
|
||||
Expect airline#parts#get('foo').test == '123'
|
||||
call airline#parts#define('foo', { 'test': '321' })
|
||||
Expect airline#parts#get('foo').test == '321'
|
||||
end
|
||||
|
||||
it 'can define a function part'
|
||||
call airline#parts#define_function('func', 'bar')
|
||||
Expect airline#parts#get('func').function == 'bar'
|
||||
end
|
||||
|
||||
it 'can define a text part'
|
||||
call airline#parts#define_text('text', 'bar')
|
||||
Expect airline#parts#get('text').text == 'bar'
|
||||
end
|
||||
|
||||
it 'can define a raw part'
|
||||
call airline#parts#define_raw('raw', 'bar')
|
||||
Expect airline#parts#get('raw').raw == 'bar'
|
||||
end
|
||||
|
||||
it 'can define a minwidth'
|
||||
call airline#parts#define_minwidth('mw', 123)
|
||||
Expect airline#parts#get('mw').minwidth == 123
|
||||
end
|
||||
|
||||
it 'can define a condition'
|
||||
call airline#parts#define_condition('part', '1')
|
||||
Expect airline#parts#get('part').condition == '1'
|
||||
end
|
||||
|
||||
it 'can define a accent'
|
||||
call airline#parts#define_accent('part', 'red')
|
||||
Expect airline#parts#get('part').accent == 'red'
|
||||
end
|
||||
end
|
||||
|
76
sources_non_forked/vim-airline/t/section.vim
Normal file
76
sources_non_forked/vim-airline/t/section.vim
Normal file
@ -0,0 +1,76 @@
|
||||
function! SectionSpec()
|
||||
endfunction
|
||||
|
||||
describe 'section'
|
||||
before
|
||||
call airline#parts#define_text('text', 'text')
|
||||
call airline#parts#define_raw('raw', 'raw')
|
||||
call airline#parts#define_function('func', 'SectionSpec')
|
||||
end
|
||||
|
||||
it 'should be able to reference default parts'
|
||||
let s = airline#section#create(['paste'])
|
||||
Expect s == '%{airline#util#wrap(airline#parts#paste(),0)}'
|
||||
end
|
||||
|
||||
it 'should create sections with no separators'
|
||||
let s = airline#section#create(['text', 'raw', 'func'])
|
||||
Expect s == '%{airline#util#wrap("text",0)}raw%{airline#util#wrap(SectionSpec(),0)}'
|
||||
end
|
||||
|
||||
it 'should create left sections with separators'
|
||||
let s = airline#section#create_left(['text', 'text'])
|
||||
Expect s == '%{airline#util#wrap("text",0)}%{airline#util#append("text",0)}'
|
||||
end
|
||||
|
||||
it 'should create right sections with separators'
|
||||
let s = airline#section#create_right(['text', 'text'])
|
||||
Expect s == '%{airline#util#prepend("text",0)}%{airline#util#wrap("text",0)}'
|
||||
end
|
||||
|
||||
it 'should prefix with accent group if provided and restore afterwards'
|
||||
call airline#parts#define('hi', {
|
||||
\ 'raw': 'hello',
|
||||
\ 'accent': 'red',
|
||||
\ })
|
||||
let s = airline#section#create(['hi'])
|
||||
Expect s == '%#__accent_red#hello%#__restore__#'
|
||||
end
|
||||
|
||||
it 'should accent functions'
|
||||
call airline#parts#define_function('hi', 'Hello')
|
||||
call airline#parts#define_accent('hi', 'bold')
|
||||
let s = airline#section#create(['hi'])
|
||||
Expect s == '%#__accent_bold#%{airline#util#wrap(Hello(),0)}%#__restore__#'
|
||||
end
|
||||
|
||||
it 'should parse out a section from the distro'
|
||||
call airline#extensions#load()
|
||||
let s = airline#section#create(['whitespace'])
|
||||
Expect s =~ 'airline#extensions#whitespace#check'
|
||||
end
|
||||
|
||||
it 'should use parts as is if they are not found'
|
||||
let s = airline#section#create(['asdf', 'func'])
|
||||
Expect s == 'asdf%{airline#util#wrap(SectionSpec(),0)}'
|
||||
end
|
||||
|
||||
it 'should force add separators for raw and missing keys'
|
||||
let s = airline#section#create_left(['asdf', 'raw'])
|
||||
Expect s == 'asdf > raw'
|
||||
let s = airline#section#create_left(['asdf', 'aaaa', 'raw'])
|
||||
Expect s == 'asdf > aaaa > raw'
|
||||
let s = airline#section#create_right(['raw', '%f'])
|
||||
Expect s == 'raw < %f'
|
||||
let s = airline#section#create_right(['%t', 'asdf', '%{getcwd()}'])
|
||||
Expect s == '%t < asdf < %{getcwd()}'
|
||||
end
|
||||
|
||||
it 'should empty out parts that do not pass their condition'
|
||||
call airline#parts#define_text('conditional', 'conditional')
|
||||
call airline#parts#define_condition('conditional', '0')
|
||||
let s = airline#section#create(['conditional'])
|
||||
Expect s == '%{0 ? airline#util#wrap("conditional",0) : ""}'
|
||||
end
|
||||
end
|
||||
|
68
sources_non_forked/vim-airline/t/themes.vim
Normal file
68
sources_non_forked/vim-airline/t/themes.vim
Normal file
@ -0,0 +1,68 @@
|
||||
describe 'themes'
|
||||
after
|
||||
highlight clear Foo
|
||||
highlight clear Normal
|
||||
end
|
||||
|
||||
it 'should extract correct colors'
|
||||
highlight Foo ctermfg=1 ctermbg=2
|
||||
let colors = airline#themes#get_highlight('Foo')
|
||||
Expect colors[2] == '1'
|
||||
Expect colors[3] == '2'
|
||||
end
|
||||
|
||||
it 'should extract from normal if colors unavailable'
|
||||
highlight Normal ctermfg=100 ctermbg=200
|
||||
highlight Foo ctermbg=2
|
||||
let colors = airline#themes#get_highlight('Foo')
|
||||
Expect colors[2] == '100'
|
||||
Expect colors[3] == '2'
|
||||
end
|
||||
|
||||
it 'should flip target group if it is reversed'
|
||||
highlight Foo ctermbg=222 ctermfg=103 term=reverse
|
||||
let colors = airline#themes#get_highlight('Foo')
|
||||
Expect colors[2] == '222'
|
||||
Expect colors[3] == '103'
|
||||
end
|
||||
|
||||
it 'should pass args through correctly'
|
||||
let hl = airline#themes#get_highlight('Foo', 'bold', 'italic')
|
||||
Expect hl == ['', '', 0, 1, 'bold,italic']
|
||||
|
||||
let hl = airline#themes#get_highlight2(['Foo','bg'], ['Foo','fg'], 'italic', 'bold')
|
||||
Expect hl == ['', '', 1, 0, 'italic,bold']
|
||||
end
|
||||
|
||||
it 'should generate color map with mirroring'
|
||||
let map = airline#themes#generate_color_map(
|
||||
\ [ 1, 1, 1, 1, '1' ],
|
||||
\ [ 2, 2, 2, 2, '2' ],
|
||||
\ [ 3, 3, 3, 3, '3' ],
|
||||
\ )
|
||||
Expect map.airline_a[0] == 1
|
||||
Expect map.airline_b[0] == 2
|
||||
Expect map.airline_c[0] == 3
|
||||
Expect map.airline_x[0] == 3
|
||||
Expect map.airline_y[0] == 2
|
||||
Expect map.airline_z[0] == 1
|
||||
end
|
||||
|
||||
it 'should generate color map with full set of colors'
|
||||
let map = airline#themes#generate_color_map(
|
||||
\ [ 1, 1, 1, 1, '1' ],
|
||||
\ [ 2, 2, 2, 2, '2' ],
|
||||
\ [ 3, 3, 3, 3, '3' ],
|
||||
\ [ 4, 4, 4, 4, '4' ],
|
||||
\ [ 5, 5, 5, 5, '5' ],
|
||||
\ [ 6, 6, 6, 6, '6' ],
|
||||
\ )
|
||||
Expect map.airline_a[0] == 1
|
||||
Expect map.airline_b[0] == 2
|
||||
Expect map.airline_c[0] == 3
|
||||
Expect map.airline_x[0] == 4
|
||||
Expect map.airline_y[0] == 5
|
||||
Expect map.airline_z[0] == 6
|
||||
end
|
||||
end
|
||||
|
54
sources_non_forked/vim-airline/t/util.vim
Normal file
54
sources_non_forked/vim-airline/t/util.vim
Normal file
@ -0,0 +1,54 @@
|
||||
call airline#init#bootstrap()
|
||||
|
||||
function! Util1()
|
||||
let g:count += 1
|
||||
endfunction
|
||||
function! Util2()
|
||||
let g:count += 2
|
||||
endfunction
|
||||
function! Util3(...)
|
||||
let g:count = a:0
|
||||
endfunction
|
||||
|
||||
describe 'util'
|
||||
before
|
||||
let g:count = 0
|
||||
end
|
||||
|
||||
it 'has append wrapper function'
|
||||
Expect airline#util#append('', 0) == ''
|
||||
Expect airline#util#append('1', 0) == ' > 1'
|
||||
end
|
||||
|
||||
it 'has prepend wrapper function'
|
||||
Expect airline#util#prepend('', 0) == ''
|
||||
Expect airline#util#prepend('1', 0) == '1 < '
|
||||
end
|
||||
|
||||
it 'has getwinvar function'
|
||||
Expect airline#util#getwinvar(1, 'asdf', '123') == '123'
|
||||
call setwinvar(1, 'vspec', 'is cool')
|
||||
Expect airline#util#getwinvar(1, 'vspec', '') == 'is cool'
|
||||
end
|
||||
|
||||
it 'has exec funcrefs helper functions'
|
||||
call airline#util#exec_funcrefs([function('Util1'), function('Util2')])
|
||||
Expect g:count == 3
|
||||
|
||||
call airline#util#exec_funcrefs([function('Util3')], 1, 2, 3, 4)
|
||||
Expect g:count == 4
|
||||
end
|
||||
|
||||
it 'should ignore minwidth if less than 0'
|
||||
Expect airline#util#append('foo', -1) == ' > foo'
|
||||
Expect airline#util#prepend('foo', -1) == 'foo < '
|
||||
Expect airline#util#wrap('foo', -1) == 'foo'
|
||||
end
|
||||
|
||||
it 'should return empty if winwidth() > minwidth'
|
||||
Expect airline#util#append('foo', 99999) == ''
|
||||
Expect airline#util#prepend('foo', 99999) == ''
|
||||
Expect airline#util#wrap('foo', 99999) == ''
|
||||
end
|
||||
end
|
||||
|
@ -2,7 +2,7 @@ REF = HEAD
|
||||
VERSION = $(shell git describe --always $(REF))
|
||||
|
||||
ARCHIVE = vim-coffee-script-$(VERSION).zip
|
||||
ARCHIVE_DIRS = after compiler doc ftdetect ftplugin indent syntax
|
||||
ARCHIVE_DIRS = after autoload compiler doc ftdetect ftplugin indent syntax
|
||||
|
||||
# Don't do anything by default.
|
||||
all:
|
||||
|
@ -1,226 +1,555 @@
|
||||
This project adds [CoffeeScript] support to the vim editor. It handles syntax,
|
||||
indenting, compiling, and more. Also included is support for CoffeeScript in
|
||||
Haml and HTML.
|
||||
This project adds [CoffeeScript] support to vim. It covers syntax, indenting,
|
||||
compiling, and more.
|
||||
|
||||

|
||||

|
||||
|
||||
[CoffeeScript]: http://jashkenas.github.com/coffee-script/
|
||||
[CoffeeScript]: http://coffeescript.org/
|
||||
|
||||
### Install from a Zipball
|
||||
## Table of Contents
|
||||
|
||||
This is the quickest way to get things running.
|
||||
- Installation
|
||||
- [Requirements](#requirements)
|
||||
- [Install using Pathogen](#install-using-pathogen)
|
||||
- [Install using Vundle](#install-using-vundle)
|
||||
- [Install from a Zip File](#install-from-a-zip-file)
|
||||
- Coffee Commands
|
||||
- [Compile to JavaScript](#compile-to-javascript)
|
||||
- [Compile CoffeeScript Snippets](#coffeecompile-compile-coffeescript-snippets)
|
||||
- [Live Preview Compiling](#coffeewatch-live-preview-compiling)
|
||||
- [Run CoffeeScript Snippets](#coffeerun-run-coffeescript-snippets)
|
||||
- [Lint your CoffeeScript](#coffeelint-lint-your-coffeescript)
|
||||
- Extras
|
||||
- [Literate CoffeeScript](#literate-coffeescript)
|
||||
- [CoffeeScript in HTML](#coffeescript-in-html)
|
||||
- [CoffeeScript in Haml](#coffeescript-in-haml)
|
||||
- Configuration
|
||||
- [Custom Autocmds](#custom-autocmds)
|
||||
- [Configuration Variables](#configuration-variables)
|
||||
- [Configure Syntax Highlighting](#configure-syntax-highlighting)
|
||||
- [Tune Vim for CoffeeScript](#tune-vim-for-coffeescript)
|
||||
|
||||
1. Download the latest zipball from [vim.org][zipball-vim] or
|
||||
[github][zipball-github]. The latest version on github is under Download
|
||||
Packages (don't use the Download buttons.)
|
||||
## Requirements
|
||||
|
||||
2. Extract the archive into `~/.vim/`:
|
||||
- vim 7.4 or later
|
||||
- coffee 1.2.0 or later
|
||||
|
||||
unzip -od ~/.vim vim-coffee-script-HASH.zip
|
||||
## Install using Pathogen
|
||||
|
||||
These steps are also used to update the plugin.
|
||||
This project uses rolling releases based on git commits, so pathogen is a
|
||||
natural fit for it. If you're already using pathogen, you can skip to step 4.
|
||||
|
||||
[zipball-vim]: http://www.vim.org/scripts/script.php?script_id=3590
|
||||
[zipball-github]: https://github.com/kchmck/vim-coffee-script/downloads
|
||||
1. Install [pathogen.vim] into `~/.vim/autoload/` (see [pathogen's
|
||||
readme][install-pathogen] for more information.)
|
||||
|
||||
### Install with Pathogen
|
||||
[pathogen.vim]: http://www.vim.org/scripts/script.php?script_id=2332
|
||||
[install-pathogen]: https://github.com/tpope/vim-pathogen#installation
|
||||
|
||||
Since this plugin has rolling versions based on git commits, using pathogen and
|
||||
git is the preferred way to install. The plugin ends up contained in its own
|
||||
directory and updates are just a `git pull` away.
|
||||
2. Enable pathogen in your vimrc. Here's a bare-minimum vimrc that enables
|
||||
all the features of `vim-coffee-script`:
|
||||
|
||||
1. Install tpope's [pathogen] into `~/.vim/autoload/` and add this line to your
|
||||
`vimrc`:
|
||||
```vim
|
||||
call pathogen#infect()
|
||||
syntax enable
|
||||
filetype plugin indent on
|
||||
```
|
||||
|
||||
call pathogen#infect()
|
||||
If you already have a vimrc built up, just make sure it contains these calls,
|
||||
in this order.
|
||||
|
||||
To get the all the features of this plugin, make sure you also have a
|
||||
`filetype plugin indent on` line in there.
|
||||
3. Create the directory `~/.vim/bundle/`:
|
||||
|
||||
[pathogen]: http://www.vim.org/scripts/script.php?script_id=2332
|
||||
mkdir ~/.vim/bundle
|
||||
|
||||
2. Create and change into `~/.vim/bundle/`:
|
||||
4. Clone the `vim-coffee-script` repo into `~/.vim/bundle/`:
|
||||
|
||||
$ mkdir ~/.vim/bundle
|
||||
$ cd ~/.vim/bundle
|
||||
git clone https://github.com/kchmck/vim-coffee-script.git ~/.vim/bundle/vim-coffee-script/
|
||||
|
||||
3. Make a clone of the `vim-coffee-script` repository:
|
||||
|
||||
$ git clone https://github.com/kchmck/vim-coffee-script.git
|
||||
|
||||
#### Updating
|
||||
Updating takes two steps:
|
||||
|
||||
1. Change into `~/.vim/bundle/vim-coffee-script/`:
|
||||
|
||||
$ cd ~/.vim/bundle/vim-coffee-script
|
||||
cd ~/.vim/bundle/vim-coffee-script
|
||||
|
||||
2. Pull in the latest changes:
|
||||
|
||||
$ git pull
|
||||
git pull
|
||||
|
||||
### CoffeeMake: Compile the Current File
|
||||
## Install using Vundle
|
||||
|
||||
The `CoffeeMake` command compiles the current file and parses any errors:
|
||||
1. [Install Vundle] into `~/.vim/bundle/`.
|
||||
|
||||

|
||||
[Install Vundle]: https://github.com/gmarik/vundle#quick-start
|
||||
|
||||
The full signature of the command is:
|
||||
2. Configure your vimrc for Vundle. Here's a bare-minimum vimrc that enables all
|
||||
the features of `vim-coffee-script`:
|
||||
|
||||
:[silent] CoffeeMake[!] [COFFEE-OPTIONS]...
|
||||
|
||||
By default, `CoffeeMake` shows all compiler output and jumps to the first line
|
||||
reported as an error by `coffee`:
|
||||
```vim
|
||||
set nocompatible
|
||||
filetype off
|
||||
|
||||
:CoffeeMake
|
||||
set rtp+=~/.vim/bundle/vundle/
|
||||
call vundle#rc()
|
||||
|
||||
Compiler output can be hidden with `silent`:
|
||||
Bundle 'kchmck/vim-coffee-script'
|
||||
|
||||
:silent CoffeeMake
|
||||
syntax enable
|
||||
filetype plugin indent on
|
||||
```
|
||||
|
||||
Line-jumping can be turned off by adding a bang:
|
||||
If you're adding Vundle to a built-up vimrc, just make sure all these calls
|
||||
are in there and that they occur in this order.
|
||||
|
||||
:CoffeeMake!
|
||||
3. Open vim and run `:BundleInstall`.
|
||||
|
||||
Options given to `CoffeeMake` are passed along to `coffee`:
|
||||
To update, open vim and run `:BundleInstall!` (notice the bang!)
|
||||
|
||||
:CoffeeMake --bare
|
||||
## Install from a Zip File
|
||||
|
||||
`CoffeeMake` can be manually loaded for a file with:
|
||||
1. Download the latest zip file from [vim.org][zip].
|
||||
|
||||
2. Extract the archive into `~/.vim/`:
|
||||
|
||||
unzip -od ~/.vim/ ARCHIVE.zip
|
||||
|
||||
This should create the files `~/.vim/autoload/coffee.vim`,
|
||||
`~/.vim/compiler/coffee.vim`, etc.
|
||||
|
||||
You can update the plugin using the same steps.
|
||||
|
||||
[zip]: http://www.vim.org/scripts/script.php?script_id=3590
|
||||
|
||||
## Compile to JavaScript
|
||||
|
||||
A `coffee` wrapper for use with `:make` is enabled automatically for coffee
|
||||
files if no other compiler is loaded. To enable it manually, run
|
||||
|
||||
:compiler coffee
|
||||
|
||||
#### Recompile on write
|
||||
The `:make` command is then configured to use the `coffee` compiler and
|
||||
recognize its errors. I've included a quick reference here but be sure to check
|
||||
out [`:help :make`][make] for a full reference of the command.
|
||||
|
||||
To recompile a file when it's written, add an `autocmd` like this to your
|
||||
`vimrc`:
|
||||

|
||||
|
||||
au BufWritePost *.coffee silent CoffeeMake!
|
||||

|
||||
|
||||
All of the customizations above can be used, too. This one compiles silently
|
||||
and with the `-b` option, but shows any errors:
|
||||
[make]: http://vimdoc.sourceforge.net/htmldoc/quickfix.html#:make_makeprg
|
||||
|
||||
au BufWritePost *.coffee silent CoffeeMake! -b | cwindow | redraw!
|
||||
Consider the full signature of a `:make` call as
|
||||
|
||||
:[silent] make[!] [COFFEE-OPTIONS]...
|
||||
|
||||
By default `:make` shows all compiler output and jumps to the first line
|
||||
reported as an error. Compiler output can be hidden with a leading `:silent`:
|
||||
|
||||
:silent make
|
||||
|
||||
Line-jumping can be turned off by adding a bang:
|
||||
|
||||
:make!
|
||||
|
||||
`COFFEE-OPTIONS` given to `:make` are passed along to `coffee` (see also
|
||||
[`coffee_make_options`](#coffee_make_options)):
|
||||
|
||||
:make --bare --output /some/dir
|
||||
|
||||
See the [full table of options](http://coffeescript.org/#usage) for a
|
||||
list of all the options that `coffee` recognizes.
|
||||
|
||||
*Configuration*: [`coffee_compiler`](#coffee_compiler),
|
||||
[`coffee_make_options`](#coffee_make_options)
|
||||
|
||||
#### The quickfix window
|
||||
|
||||
Compiler errors are added to the [quickfix] list by `:make`, but the quickfix
|
||||
window isn't automatically shown. The [`:cwindow`][cwindow] command will pop up
|
||||
the quickfix window if there are any errors:
|
||||
|
||||
:make
|
||||
:cwindow
|
||||
|
||||
This is usually the desired behavior, so you may want to add an autocmd to your
|
||||
vimrc to do this automatically:
|
||||
|
||||
autocmd QuickFixCmdPost * nested cwindow | redraw!
|
||||
|
||||
The `redraw!` command is needed to fix a redrawing quirk in terminal vim, but
|
||||
can removed for gVim.
|
||||
|
||||
#### Default compiler options
|
||||
[quickfix]: http://vimdoc.sourceforge.net/htmldoc/quickfix.html#quickfix
|
||||
[cwindow]: http://vimdoc.sourceforge.net/htmldoc/quickfix.html#:cwindow
|
||||
|
||||
The `CoffeeMake` command passes any options in the `coffee_make_options`
|
||||
variable along to the compiler. You can use this to set default options:
|
||||
#### Recompile on write
|
||||
|
||||
let coffee_make_options = '--bare'
|
||||
To recompile a file when it's written, add a `BufWritePost` autocmd to your
|
||||
vimrc:
|
||||
|
||||
#### Path to compiler
|
||||
autocmd BufWritePost *.coffee silent make!
|
||||
|
||||
To change the compiler used by `CoffeeMake` and `CoffeeCompile`, set
|
||||
`coffee_compiler` to the full path of an executable or the filename of one
|
||||
in your `$PATH`:
|
||||
#### Cake and Cakefiles
|
||||
|
||||
let coffee_compiler = '/usr/bin/coffee'
|
||||
A `cake` compiler is also available with the call
|
||||
|
||||
This option is set to `coffee` by default.
|
||||
:compiler cake
|
||||
|
||||
### CoffeeCompile: Compile Snippets of CoffeeScript
|
||||
You can then use `:make` as above to run your Cakefile and capture any `coffee`
|
||||
errors:
|
||||
|
||||
The `CoffeeCompile` command shows how the current file or a snippet of
|
||||
CoffeeScript is compiled to JavaScript. The full signature of the command is:
|
||||
:silent make build
|
||||
|
||||
:[RANGE] CoffeeCompile [watch|unwatch] [vert[ical]] [WINDOW-SIZE]
|
||||
It runs within the current directory, so make sure you're in the directory of
|
||||
your Cakefile before calling it.
|
||||
|
||||
Calling `CoffeeCompile` without a range compiles the whole file:
|
||||
*Configuration*: [`coffee_cake`](#coffee_cake),
|
||||
[`coffee_cake_options`](#coffee_cake_options)
|
||||
|
||||

|
||||
## CoffeeCompile: Compile CoffeeScript Snippets
|
||||
|
||||
Calling `CoffeeCompile` with a range, like in visual mode, compiles the selected
|
||||
snippet of CoffeeScript:
|
||||
CoffeeCompile shows how the current file or a snippet of CoffeeScript is
|
||||
compiled to JavaScript.
|
||||
|
||||

|
||||
:[RANGE] CoffeeCompile [vert[ical]] [WINDOW-SIZE]
|
||||
|
||||

|
||||
Calling `:CoffeeCompile` without a range compiles the whole file:
|
||||
|
||||
This scratch buffer can be quickly closed by hitting the `q` key.
|
||||

|
||||
|
||||
Using `vert` splits the CoffeeCompile buffer vertically instead of horizontally:
|
||||

|
||||
|
||||
Calling it with a range, like in visual mode, compiles only the selected snippet
|
||||
of CoffeeScript:
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
Each file gets its own CoffeeCompile buffer, and the same buffer is used for all
|
||||
future calls of `:CoffeeCompile` on that file. It can be quickly closed by
|
||||
hitting `q` in normal mode.
|
||||
|
||||
Using `vert` opens the CoffeeCompile buffer vertically instead of horizontally
|
||||
(see also [`coffee_compile_vert`](#coffee_compile_vert)):
|
||||
|
||||
:CoffeeCompile vert
|
||||
|
||||
Set the `coffee_compile_vert` variable to split the buffer vertically by
|
||||
default:
|
||||
|
||||
let coffee_compile_vert = 1
|
||||
|
||||
The initial size of the CoffeeCompile buffer can be given as a number:
|
||||
By default the CoffeeCompile buffer splits the source buffer in half, but this
|
||||
can be overridden by passing in a `WINDOW-SIZE`:
|
||||
|
||||
:CoffeeCompile 4
|
||||
|
||||
#### Watch (live preview) mode
|
||||
*Configuration*: [`coffee_compiler`](#coffee_compiler`),
|
||||
[`coffee_compile_vert`](#coffee_compile_vert)
|
||||
|
||||
Watch mode is like the Try CoffeeScript preview box on the CoffeeScript
|
||||
homepage:
|
||||
#### Quick syntax checking
|
||||
|
||||

|
||||
If compiling a snippet results in a compiler error, CoffeeCompile adds that
|
||||
error to the [quickfix] list.
|
||||
|
||||

|
||||
[quickfix]: http://vimdoc.sourceforge.net/htmldoc/quickfix.html#quickfix
|
||||
|
||||
Writing some code and then exiting insert mode automatically updates the
|
||||
compiled JavaScript buffer.
|
||||

|
||||
|
||||
Use `watch` to start watching a buffer (`vert` is also recommended):
|
||||

|
||||
|
||||
:CoffeeCompile watch vert
|
||||
You can use this to quickly check the syntax of a snippet.
|
||||
|
||||
After making some changes in insert mode, hit escape and the CoffeeScript will
|
||||
be recompiled. Changes made outside of insert mode don't trigger this recompile,
|
||||
but calling `CoffeeCompile` will compile these changes without any bad effects.
|
||||
## CoffeeWatch: Live Preview Compiling
|
||||
|
||||
To get synchronized scrolling of a CoffeeScript and CoffeeCompile buffer, set
|
||||
`scrollbind` on each:
|
||||
CoffeeWatch emulates using the Try CoffeeScript preview box on the [CoffeeScript
|
||||
homepage][CoffeeScript].
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
CoffeeWatch takes the same options as CoffeeCompile:
|
||||
|
||||
:CoffeeWatch [vert[ical]] [WINDOW-SIZE]
|
||||
|
||||
After a source buffer is watched, leaving insert mode or saving the file fires
|
||||
off a recompile of the CoffeeScript:
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
You can force recompilation by calling `:CoffeeWatch`.
|
||||
|
||||
To get synchronized scrolling of the source buffer and CoffeeWatch buffer, set
|
||||
[`'scrollbind'`](http://vimdoc.sourceforge.net/htmldoc/options.html#'scrollbind')
|
||||
on each:
|
||||
|
||||
:setl scrollbind
|
||||
|
||||
Use `unwatch` to stop watching a buffer:
|
||||
*Configuration*: [`coffee_compiler`](#coffee_compiler),
|
||||
[`coffee_watch_vert`](#coffee_watch_vert)
|
||||
|
||||
:CoffeeCompile unwatch
|
||||
## CoffeeRun: Run CoffeeScript Snippets
|
||||
|
||||
### CoffeeLint: Lint your CoffeeScript
|
||||
CoffeeRun compiles the current file or selected snippet and runs the resulting
|
||||
JavaScript.
|
||||
|
||||
The `CoffeeLint` command runs [coffeelint](http://www.coffeelint.org/) (version
|
||||
0.4.0 or later required) on the current file and parses any errors:
|
||||

|
||||
|
||||
:[RANGE] CoffeeLint[!] [COFFEELINT-OPTIONS]
|
||||

|
||||
|
||||
Use it like `CoffeeMake`.
|
||||
The command has two forms:
|
||||
|
||||

|
||||
:CoffeeRun [PROGRAM-OPTIONS]...
|
||||
|
||||
#### Default coffeelint options
|
||||
This form applies when no `RANGE` is given or when the given range is `1,$`
|
||||
(first line to last line). It allows passing `PROGRAM-OPTIONS` to your compiled
|
||||
program. The filename is passed directly to `coffee` so you must save the file
|
||||
for your changes to take effect.
|
||||
|
||||
Options in `coffee_lint_options` are passed along to `coffeelint`:
|
||||
:RANGE CoffeeRun [COFFEE-OPTIONS]...
|
||||
|
||||
This form applies with all other ranges. It compiles and runs the lines within
|
||||
the given `RANGE` and any extra `COFFEE-OPTIONS` are passed to `coffee`.
|
||||
|
||||
*Configuration*: [`coffee_compiler`](#coffee_compiler),
|
||||
[`coffee_run_vert`](#coffee_run_vert)
|
||||
|
||||
## CoffeeLint: Lint your CoffeeScript
|
||||
|
||||
CoffeeLint runs [coffeelint](http://www.coffeelint.org/) (version 0.5.7 or later
|
||||
required) on the current file and adds any issues to the [quickfix] list.
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
:[RANGE] CoffeeLint[!] [COFFEELINT-OPTIONS]... [ | cwindow]
|
||||
|
||||
If a `RANGE` is given, only those lines are piped to `coffeelint`. Options given
|
||||
in `COFFEELINT-OPTIONS` are passed to `coffeelint` (see also
|
||||
[`coffee_lint_options`](#coffee_lint_options)):
|
||||
|
||||
:CoffeeLint -f lint.json
|
||||
|
||||
It behaves very similar to `:make`, described [above](#compile-to-javascript).
|
||||
|
||||
:CoffeeLint! | cwindow
|
||||
|
||||
*Configuration*: [`coffee_linter`](#coffee_linter),
|
||||
[`coffee_lint_options`](#coffee_lint_options)
|
||||
|
||||
## Literate CoffeeScript
|
||||
|
||||
Literate CoffeeScript syntax and indent support is provided by
|
||||
[vim-literate-coffeescript]. The `Coffee` commands detect when they're running
|
||||
on a litcoffee file and pass the `--literate` flag to their respective tools,
|
||||
but at this time the commands are not automatically loaded when a litcoffee file
|
||||
is opened.
|
||||
|
||||
[vim-literate-coffeescript]: https://github.com/mintplant/vim-literate-coffeescript
|
||||
|
||||
To load them, run
|
||||
|
||||
runtime ftplugin/coffee.vim
|
||||
|
||||
while inside a litcoffee buffer. To do this automatically, add
|
||||
|
||||
autocmd FileType litcoffee runtime ftplugin/coffee.vim
|
||||
|
||||
to your vimrc.
|
||||
|
||||
## CoffeeScript in HTML
|
||||
|
||||
CoffeeScript is highlighted and indented within
|
||||
|
||||
```html
|
||||
<script type="text/coffeescript">
|
||||
</script>
|
||||
```
|
||||
|
||||
blocks in html files.
|
||||
|
||||
## CoffeeScript in Haml
|
||||
|
||||
CoffeeScript is highlighted within the `:coffeescript` filter in haml files:
|
||||
|
||||
```haml
|
||||
:coffeescript
|
||||
console.log "hullo"
|
||||
```
|
||||
|
||||
At this time, coffee indenting doesn't work in these blocks.
|
||||
|
||||
## Custom Autocmds
|
||||
|
||||
You can [define commands][autocmd-explain] to be ran automatically on these
|
||||
custom events.
|
||||
|
||||
In all cases, the name of the command running the event (`CoffeeCompile`,
|
||||
`CoffeeWatch`, or `CoffeeRun`) is matched by the [`{pat}`][autocmd] argument.
|
||||
You can match all commands with a `*` or only specific commands by separating
|
||||
them with a comma: `CoffeeCompile,CoffeeWatch`.
|
||||
|
||||
[autocmd-explain]: http://vimdoc.sourceforge.net/htmldoc/usr_40.html#40.3
|
||||
[autocmd]: http://vimdoc.sourceforge.net/htmldoc/autocmd.html#:autocmd
|
||||
|
||||
#### CoffeeBufNew
|
||||
|
||||
CoffeeBufNew is ran when a new scratch buffer is created. It's called from the
|
||||
new buffer, so it can be used to do additional set up.
|
||||
|
||||
```vim
|
||||
augroup CoffeeBufNew
|
||||
autocmd User * set wrap
|
||||
augroup END
|
||||
```
|
||||
|
||||
*Used By*: CoffeeCompile, CoffeeWatch, CoffeeRun
|
||||
|
||||
#### CoffeeBufUpdate
|
||||
|
||||
CoffeeBufUpdate is ran when a scratch buffer is updated with output from
|
||||
`coffee`. It's called from the scratch buffer, so it can be used to alter the
|
||||
compiled output.
|
||||
|
||||
```vim
|
||||
" Switch back to the source buffer after updating.
|
||||
augroup CoffeeBufUpdate
|
||||
autocmd User CoffeeCompile,CoffeeRun exec bufwinnr(b:coffee_src_buf) 'wincmd w'
|
||||
augroup END
|
||||
```
|
||||
|
||||
For example, to strip off the "Generated by" comment on the first line, put this
|
||||
in your vimrc:
|
||||
|
||||
```vim
|
||||
function! s:RemoveGeneratedBy()
|
||||
" If there was an error compiling, there's no comment to remove.
|
||||
if v:shell_error
|
||||
return
|
||||
endif
|
||||
|
||||
" Save cursor position.
|
||||
let pos = getpos('.')
|
||||
|
||||
" Remove first line.
|
||||
set modifiable
|
||||
1 delete _
|
||||
set nomodifiable
|
||||
|
||||
" Restore cursor position.
|
||||
call setpos('.', pos)
|
||||
endfunction
|
||||
|
||||
augroup CoffeeBufUpdate
|
||||
autocmd User CoffeeCompile,CoffeeWatch call s:RemoveGeneratedBy()
|
||||
augroup END
|
||||
```
|
||||
|
||||
*Used By*: CoffeeCompile, CoffeeWatch, CoffeeRun
|
||||
|
||||
## Configuration Variables
|
||||
|
||||
This is the full list of configuration variables available, with example
|
||||
settings and default values. Use these in your vimrc to control the default
|
||||
behavior.
|
||||
|
||||
#### coffee\_indent\_keep\_current
|
||||
|
||||
By default, the indent function matches the indent of the previous line if it
|
||||
doesn't find a reason to indent or outdent. To change this behavior so it
|
||||
instead keeps the [current indent of the cursor][98], use
|
||||
|
||||
let coffee_indent_keep_current = 1
|
||||
|
||||
[98]: https://github.com/kchmck/vim-coffee-script/pull/98
|
||||
|
||||
*Default*: `unlet coffee_indent_keep_current`
|
||||
|
||||
Note that if you change this after a coffee file has been loaded, you'll have to
|
||||
reload the indent script for the change to take effect:
|
||||
|
||||
unlet b:did_indent | runtime indent/coffee.vim
|
||||
|
||||
#### coffee\_compiler
|
||||
|
||||
Path to the `coffee` executable used by the `Coffee` commands:
|
||||
|
||||
let coffee_compiler = '/usr/bin/coffee'
|
||||
|
||||
*Default*: `'coffee'` (search `$PATH` for executable)
|
||||
|
||||
#### coffee\_make\_options
|
||||
|
||||
Options to pass to `coffee` with `:make`:
|
||||
|
||||
let coffee_make_options = '--bare'
|
||||
|
||||
*Default*: `''` (nothing)
|
||||
|
||||
Note that `coffee_make_options` is embedded into `'makeprg'`, so `:compiler
|
||||
coffee` must be ran after changing `coffee_make_options` for the changes to take
|
||||
effect.
|
||||
|
||||
#### coffee\_cake
|
||||
|
||||
Path to the `cake` executable:
|
||||
|
||||
let coffee_cake = '/opt/bin/cake'
|
||||
|
||||
*Default*: `'cake'` (search `$PATH` for executable)
|
||||
|
||||
#### coffee\_cake\_options
|
||||
|
||||
Options to pass to `cake` with `:make`:
|
||||
|
||||
let coffee_cake_options = 'build'
|
||||
|
||||
*Default*: `''` (nothing)
|
||||
|
||||
#### coffee\_linter
|
||||
|
||||
Path to the `coffeelint` executable:
|
||||
|
||||
let coffee_linter = '/opt/bin/coffeelint'
|
||||
|
||||
*Default*: `'coffeelint'` (search `$PATH` for executable)
|
||||
|
||||
#### coffee\_lint\_options
|
||||
|
||||
Options to pass to `coffeelint`:
|
||||
|
||||
let coffee_lint_options = '-f lint.json'
|
||||
|
||||
#### Path to `coffeelint`
|
||||
*Default*: `''` (nothing)
|
||||
|
||||
Use the `coffee_linter` option to set a different path to the `coffeelint`
|
||||
executable:
|
||||
#### coffee\_compile\_vert
|
||||
|
||||
let coffee_linter = '/usr/bin/coffeelint'
|
||||
Open the CoffeeCompile buffer with a vertical split instead of a horizontal
|
||||
one:
|
||||
|
||||
This option is set to `coffeelint` by default.
|
||||
let coffee_compile_vert = 1
|
||||
|
||||
### CoffeeRun: Run some CoffeeScript
|
||||
*Default*: `unlet coffee_compile_vert`
|
||||
|
||||
The `CoffeeRun` command compiles the current file or selected snippet and runs
|
||||
the resulting JavaScript. Output is shown at the bottom of the screen:
|
||||
#### coffee\_watch\_vert
|
||||
|
||||

|
||||
Open the CoffeeWatch buffer with a vertical split instead of a horizontal
|
||||
one:
|
||||
|
||||

|
||||
let coffee_watch_vert = 1
|
||||
|
||||
### Configure Syntax Highlighting
|
||||
*Default*: `unlet coffee_watch_vert`
|
||||
|
||||
Add these lines to your `vimrc` to disable the relevant syntax group.
|
||||
#### coffee\_run\_vert
|
||||
|
||||
Open the CoffeeRun buffer with a vertical split instead of a horizontal
|
||||
one:
|
||||
|
||||
let coffee_run_vert = 1
|
||||
|
||||
*Default*: `unlet coffee_run_vert`
|
||||
|
||||
## Configure Syntax Highlighting
|
||||
|
||||
Add these lines to your vimrc to disable the relevant syntax group.
|
||||
|
||||
#### Disable trailing whitespace error
|
||||
|
||||
@ -231,7 +560,7 @@ with:
|
||||
|
||||
#### Disable trailing semicolon error
|
||||
|
||||
Trailing semicolons are also considered an error (for help transitioning from
|
||||
Trailing semicolons are considered an error (for help transitioning from
|
||||
JavaScript.) This can be disabled with:
|
||||
|
||||
hi link coffeeSemicolonError NONE
|
||||
@ -243,7 +572,7 @@ they're not allowed in CoffeeScript. This can be disabled with:
|
||||
|
||||
hi link coffeeReservedError NONE
|
||||
|
||||
### Tune Vim for CoffeeScript
|
||||
## Tune Vim for CoffeeScript
|
||||
|
||||
Changing these core settings can make vim more CoffeeScript friendly.
|
||||
|
||||
@ -251,20 +580,20 @@ Changing these core settings can make vim more CoffeeScript friendly.
|
||||
|
||||
Folding by indentation works well for CoffeeScript functions and classes:
|
||||
|
||||

|
||||

|
||||
|
||||
To fold by indentation in CoffeeScript files, add this line to your `vimrc`:
|
||||
To fold by indentation in CoffeeScript files, add this line to your vimrc:
|
||||
|
||||
au BufNewFile,BufReadPost *.coffee setl foldmethod=indent nofoldenable
|
||||
autocmd BufNewFile,BufReadPost *.coffee setl foldmethod=indent nofoldenable
|
||||
|
||||
With this, folding is disabled by default but can be quickly toggled per-file
|
||||
by hitting `zi`. To enable folding by default, remove `nofoldenable`:
|
||||
|
||||
au BufNewFile,BufReadPost *.coffee setl foldmethod=indent
|
||||
autocmd BufNewFile,BufReadPost *.coffee setl foldmethod=indent
|
||||
|
||||
#### Two-space indentation
|
||||
|
||||
To get standard two-space indentation in CoffeeScript files, add this line to
|
||||
your `vimrc`:
|
||||
your vimrc:
|
||||
|
||||
au BufNewFile,BufReadPost *.coffee setl shiftwidth=2 expandtab
|
||||
autocmd BufNewFile,BufReadPost *.coffee setl shiftwidth=2 expandtab
|
||||
|
33
sources_non_forked/vim-coffee-script/after/indent/html.vim
Normal file
33
sources_non_forked/vim-coffee-script/after/indent/html.vim
Normal file
@ -0,0 +1,33 @@
|
||||
" Language: CoffeeScript
|
||||
" Maintainer: Mick Koch <kchmck@gmail.com>
|
||||
" URL: http://github.com/kchmck/vim-coffee-script
|
||||
" License: WTFPL
|
||||
|
||||
" Load the coffee and html indent functions.
|
||||
silent! unlet b:did_indent
|
||||
runtime indent/coffee.vim
|
||||
let s:coffeeIndentExpr = &l:indentexpr
|
||||
|
||||
" Load html last so it can overwrite coffee settings.
|
||||
silent! unlet b:did_indent
|
||||
runtime indent/html.vim
|
||||
let s:htmlIndentExpr = &l:indentexpr
|
||||
|
||||
" Inject our wrapper indent function.
|
||||
setlocal indentexpr=GetCoffeeHtmlIndent(v:lnum)
|
||||
|
||||
function! GetCoffeeHtmlIndent(curlinenum)
|
||||
" See if we're inside a coffeescript block.
|
||||
let scriptlnum = searchpair('<script [^>]*type="text/coffeescript"[^>]*>', '',
|
||||
\ '</script>', 'bWn')
|
||||
let prevlnum = prevnonblank(a:curlinenum)
|
||||
|
||||
" If we're in the script block and the previous line isn't the script tag
|
||||
" itself, use coffee indenting.
|
||||
if scriptlnum && scriptlnum != prevlnum
|
||||
exec 'return ' s:coffeeIndentExpr
|
||||
endif
|
||||
|
||||
" Otherwise use html indenting.
|
||||
exec 'return ' s:htmlIndentExpr
|
||||
endfunction
|
@ -6,4 +6,8 @@
|
||||
" Inherit coffee from html so coffeeComment isn't redefined and given higher
|
||||
" priority than hamlInterpolation.
|
||||
syn cluster hamlCoffeescript contains=@htmlCoffeeScript
|
||||
syn region hamlCoffeescriptFilter matchgroup=hamlFilter start="^\z(\s*\):coffee\z(script\)*\s*$" end="^\%(\z1 \| *$\)\@!" contains=@hamlCoffeeScript,hamlInterpolation keepend
|
||||
syn region hamlCoffeescriptFilter matchgroup=hamlFilter
|
||||
\ start="^\z(\s*\):coffee\z(script\)\?\s*$"
|
||||
\ end="^\%(\z1 \| *$\)\@!"
|
||||
\ contains=@hamlCoffeeScript,hamlInterpolation
|
||||
\ keepend
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
" Syntax highlighting for text/coffeescript script tags
|
||||
syn include @htmlCoffeeScript syntax/coffee.vim
|
||||
syn region coffeeScript start=+<script [^>]*type *=[^>]*text/coffeescript[^>]*>+
|
||||
\ end=+</script>+me=s-1 keepend
|
||||
syn region coffeeScript start=#<script [^>]*type="text/coffeescript"[^>]*>#
|
||||
\ end=#</script>#me=s-1 keepend
|
||||
\ contains=@htmlCoffeeScript,htmlScriptTag,@htmlPreproc
|
||||
\ containedin=htmlHead
|
||||
|
54
sources_non_forked/vim-coffee-script/autoload/coffee.vim
Normal file
54
sources_non_forked/vim-coffee-script/autoload/coffee.vim
Normal file
@ -0,0 +1,54 @@
|
||||
" Language: CoffeeScript
|
||||
" Maintainer: Mick Koch <kchmck@gmail.com>
|
||||
" URL: http://github.com/kchmck/vim-coffee-script
|
||||
" License: WTFPL
|
||||
|
||||
" Set up some common global/buffer variables.
|
||||
function! coffee#CoffeeSetUpVariables()
|
||||
" Path to coffee executable
|
||||
if !exists('g:coffee_compiler')
|
||||
let g:coffee_compiler = 'coffee'
|
||||
endif
|
||||
|
||||
" Options passed to coffee with make
|
||||
if !exists('g:coffee_make_options')
|
||||
let g:coffee_make_options = ''
|
||||
endif
|
||||
|
||||
" Path to cake executable
|
||||
if !exists('g:coffee_cake')
|
||||
let g:coffee_cake = 'cake'
|
||||
endif
|
||||
|
||||
" Extra options passed to cake
|
||||
if !exists('g:coffee_cake_options')
|
||||
let g:coffee_cake_options = ''
|
||||
endif
|
||||
|
||||
" Path to coffeelint executable
|
||||
if !exists('g:coffee_linter')
|
||||
let g:coffee_linter = 'coffeelint'
|
||||
endif
|
||||
|
||||
" Options passed to CoffeeLint
|
||||
if !exists('g:coffee_lint_options')
|
||||
let g:coffee_lint_options = ''
|
||||
endif
|
||||
|
||||
" Pass the litcoffee flag to tools in this buffer if a litcoffee file is open.
|
||||
" Let the variable be overwritten so it can be updated if a different filetype
|
||||
" is set.
|
||||
if &filetype == 'litcoffee'
|
||||
let b:coffee_litcoffee = '--literate'
|
||||
else
|
||||
let b:coffee_litcoffee = ''
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! coffee#CoffeeSetUpErrorFormat()
|
||||
CompilerSet errorformat=Error:\ In\ %f\\,\ %m\ on\ line\ %l,
|
||||
\Error:\ In\ %f\\,\ Parse\ error\ on\ line\ %l:\ %m,
|
||||
\SyntaxError:\ In\ %f\\,\ %m,
|
||||
\%f:%l:%c:\ error:\ %m,
|
||||
\%-G%.%#
|
||||
endfunction
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user