mirror of
https://github.com/amix/vimrc
synced 2025-06-23 06:35:01 +08:00
Updated all plugins that are non-forked. Added some new plugins.
Added update_plugins.py which can fetch new plugins from GitHub. New plugins added: zencoding, vim-indent-object, taglist, nginx.vim
This commit is contained in:
@ -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: 2008-11-25.
|
||||
" @Last Change: 2010-11-20.
|
||||
" @Revision: 0.0.79
|
||||
" @Last Change: 2012-09-26.
|
||||
" @Revision: 0.0.90
|
||||
|
||||
let s:prototype = tlib#Object#New({'_class': ['Filter_cnf'], 'name': 'cnf'}) "{{{2
|
||||
let s:prototype.highlight = g:tlib_inputlist_higroup
|
||||
@ -30,6 +30,14 @@ function! s:prototype.Init(world) dict "{{{3
|
||||
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),
|
||||
\ 'AND, OR, NOT')
|
||||
endf
|
||||
|
||||
|
||||
" :nodoc:
|
||||
function! s:prototype.AssessName(world, name) dict "{{{3
|
||||
let xa = 0
|
||||
@ -86,18 +94,22 @@ function! s:prototype.Match(world, text) dict "{{{3
|
||||
" set smartcase
|
||||
" endif
|
||||
" try
|
||||
if !empty(a:world.filter_neg)
|
||||
for rx in a:world.filter_neg
|
||||
" TLogVAR rx
|
||||
if a:text =~ rx
|
||||
return 0
|
||||
endif
|
||||
endfor
|
||||
endif
|
||||
if !empty(a:world.filter_pos)
|
||||
for rx in a:world.filter_pos
|
||||
" TLogVAR rx
|
||||
if a:text !~ rx
|
||||
return 0
|
||||
endif
|
||||
endfor
|
||||
endif
|
||||
" finally
|
||||
" let &smartcase = sc
|
||||
" let &ignorecase = ic
|
||||
@ -109,13 +121,14 @@ endf
|
||||
" :nodoc:
|
||||
function! s:prototype.DisplayFilter(filter) dict "{{{3
|
||||
let filter1 = deepcopy(a:filter)
|
||||
call map(filter1, '"(". join(reverse(s:Pretty(v:val)), " OR ") .")"')
|
||||
call map(filter1, '"(". join(reverse(self.Pretty(v:val)), " OR ") .")"')
|
||||
return join(reverse(filter1), ' AND ')
|
||||
endf
|
||||
|
||||
|
||||
function! s:Pretty(filter) "{{{3
|
||||
call map(a:filter, 'substitute(v:val, ''\\\.\\{-}'', ''__'', ''g'')')
|
||||
function! s:prototype.Pretty(filter) dict "{{{3
|
||||
" call map(a:filter, 'substitute(v:val, ''\\\.\\{-}'', ''=>'', ''g'')')
|
||||
call map(a:filter, 'self.CleanFilter(v:val)')
|
||||
return a:filter
|
||||
endf
|
||||
|
||||
|
@ -3,14 +3,14 @@
|
||||
" @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: 2010-09-15.
|
||||
" @Revision: 0.0.35
|
||||
" @Last Change: 2012-09-20.
|
||||
" @Revision: 0.0.50
|
||||
|
||||
let s:prototype = tlib#Filter_cnf#New({'_class': ['Filter_cnfd'], 'name': 'cnfd'}) "{{{2
|
||||
let s:prototype.highlight = g:tlib_inputlist_higroup
|
||||
|
||||
|
||||
" The same as |tlib#FilterCNF#New()| but a dot is expanded to '\.\{-}'.
|
||||
" The same as |tlib#Filter_cnf#New()| but a dot is expanded to '\.\{-}'.
|
||||
" As a consequence, patterns cannot match dots.
|
||||
" The pattern is a '/\V' very no-'/magic' regexp pattern.
|
||||
function! tlib#Filter_cnfd#New(...) "{{{3
|
||||
@ -24,6 +24,19 @@ function! s:prototype.Init(world) dict "{{{3
|
||||
endf
|
||||
|
||||
|
||||
let s:Help = s:prototype.Help
|
||||
|
||||
" :nodoc:
|
||||
function! s:prototype.Help(world) dict "{{{3
|
||||
call call(s:Help, [a:world], self)
|
||||
if self.name == 'cnfx'
|
||||
call a:world.PushHelp(g:tlib#Filter_cnfx#expander, 'Any characters')
|
||||
else
|
||||
call a:world.PushHelp('.', 'Any characters')
|
||||
endif
|
||||
endf
|
||||
|
||||
|
||||
" :nodoc:
|
||||
function! s:prototype.SetFrontFilter(world, pattern) dict "{{{3
|
||||
let pattern = substitute(a:pattern, '\.', '\\.\\{-}', 'g')
|
||||
|
42
sources_non_forked/tlib/autoload/tlib/Filter_cnfx.vim
Normal file
42
sources_non_forked/tlib/autoload/tlib/Filter_cnfx.vim
Normal file
@ -0,0 +1,42 @@
|
||||
" @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-11-25.
|
||||
" @Last Change: 2012-09-20.
|
||||
" @Revision: 0.0.61
|
||||
|
||||
let s:prototype = tlib#Filter_cnfd#New({'_class': ['Filter_cnfx'], 'name': 'cnfx'}) "{{{2
|
||||
let s:prototype.highlight = g:tlib_inputlist_higroup
|
||||
|
||||
|
||||
" A character that should be expanded to '\.\{-}'.
|
||||
TLet g:tlib#Filter_cnfx#expander = '+'
|
||||
|
||||
|
||||
" The same as |tlib#Filter_cnfd#New()| but a a customizable character
|
||||
" |see tlib#Filter_cnfx#expander| is expanded to '\.\{-}'.
|
||||
" The pattern is a '/\V' very no-'/magic' regexp pattern.
|
||||
function! tlib#Filter_cnfx#New(...) "{{{3
|
||||
let object = s:prototype.New(a:0 >= 1 ? a:1 : {})
|
||||
return object
|
||||
endf
|
||||
|
||||
|
||||
" :nodoc:
|
||||
function! s:prototype.SetFrontFilter(world, pattern) dict "{{{3
|
||||
let pattern = substitute(a:pattern, tlib#rx#Escape(g:tlib#Filter_cnfx#expander, 'V'), '\\.\\{-}', 'g')
|
||||
let a:world.filter[0] = reverse(split(pattern, '\s*|\s*')) + a:world.filter[0][1 : -1]
|
||||
endf
|
||||
|
||||
|
||||
" :nodoc:
|
||||
function! s:prototype.PushFrontFilter(world, char) dict "{{{3
|
||||
let a:world.filter[0][0] .= a:char == char2nr(g:tlib#Filter_cnfx#expander) ? '\.\{-}' : nr2char(a:char)
|
||||
endf
|
||||
|
||||
|
||||
" :nodoc:
|
||||
function! s:prototype.CleanFilter(filter) dict "{{{3
|
||||
return substitute(a:filter, '\\.\\{-}', g:tlib#Filter_cnfx#expander, 'g')
|
||||
endf
|
||||
|
@ -3,15 +3,15 @@
|
||||
" @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: 2010-09-15.
|
||||
" @Revision: 0.0.38
|
||||
" @Last Change: 2012-09-20.
|
||||
" @Revision: 0.0.46
|
||||
|
||||
let s:prototype = tlib#Filter_cnf#New({'_class': ['Filter_fuzzy'], 'name': 'fuzzy'}) "{{{2
|
||||
let s:prototype.highlight = ''
|
||||
let s:prototype.highlight = g:tlib_inputlist_higroup
|
||||
|
||||
|
||||
" Support for "fuzzy" pattern matching in |tlib#input#List()|.
|
||||
" Characters are interpreted as if connected with '.\{-}'.
|
||||
" Patterns are interpreted as if characters were connected with '.\{-}'.
|
||||
"
|
||||
" In "fuzzy" mode, the pretty printing of filenames is disabled.
|
||||
function! tlib#Filter_fuzzy#New(...) "{{{3
|
||||
@ -23,7 +23,8 @@ endf
|
||||
" :nodoc:
|
||||
function! s:prototype.Init(world) dict "{{{3
|
||||
" TLogVAR a:world.display_format
|
||||
function! a:world.Set_display_format(value) dict "{{{3
|
||||
" :nodoc:
|
||||
function! a:world.Set_display_format(value) dict
|
||||
if a:value == 'filename'
|
||||
let self.display_format = ''
|
||||
else
|
||||
@ -33,6 +34,15 @@ function! s:prototype.Init(world) dict "{{{3
|
||||
endf
|
||||
|
||||
|
||||
let s:Help = s:prototype.Help
|
||||
|
||||
" :nodoc:
|
||||
function! s:prototype.Help(world) dict "{{{3
|
||||
call call(s:Help, [a:world], self)
|
||||
call a:world.PushHelp('Patterns are interpreted as if characters were connected with .\{-}')
|
||||
endf
|
||||
|
||||
|
||||
" :nodoc:
|
||||
function! s:prototype.DisplayFilter(filter) dict "{{{3
|
||||
" TLogVAR a:filter
|
||||
|
@ -1,98 +0,0 @@
|
||||
" Filter_seq.vim
|
||||
" @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-11-25.
|
||||
" @Last Change: 2010-11-20.
|
||||
" @Revision: 0.0.30
|
||||
|
||||
let s:prototype = tlib#Filter_cnf#New({'_class': ['Filter_seq'], 'name': 'seq'}) "{{{2
|
||||
let s:prototype.highlight = g:tlib_inputlist_higroup
|
||||
|
||||
" The search pattern for |tlib#input#List()| is interpreted as a
|
||||
" disjunction of 'magic' regular expressions with the exception of a dot
|
||||
" ".", which is interpreted as ".\{-}".
|
||||
" The pattern is a '/magic' regexp pattern.
|
||||
function! tlib#Filter_seq#New(...) "{{{3
|
||||
let object = s:prototype.New(a:0 >= 1 ? a:1 : {})
|
||||
return object
|
||||
endf
|
||||
|
||||
|
||||
" :nodoc:
|
||||
function! s:prototype.Init(world) dict "{{{3
|
||||
endf
|
||||
|
||||
|
||||
" :nodoc:
|
||||
function! s:prototype.Match(world, text) dict "{{{3
|
||||
" TLogVAR a:text
|
||||
for rx in a:world.filter_neg
|
||||
if a:text !~ rx
|
||||
" TLogDBG "filter_neg ". rx
|
||||
return 1
|
||||
endif
|
||||
endfor
|
||||
for rx in a:world.filter_pos
|
||||
if a:text =~ rx
|
||||
" TLogDBG "filter_pos ". rx
|
||||
return 1
|
||||
endif
|
||||
endfor
|
||||
return 0
|
||||
endf
|
||||
|
||||
|
||||
" :nodoc:
|
||||
function! s:prototype.DisplayFilter(filter) dict "{{{3
|
||||
let filter1 = deepcopy(a:filter)
|
||||
call map(filter1, '"(". join(reverse(s:Pretty(v:val)), "_") .")"')
|
||||
return join(reverse(filter1), ' OR ')
|
||||
endf
|
||||
|
||||
|
||||
function! s:Pretty(filter) "{{{3
|
||||
call map(a:filter, 's:prototype.CleanFilter(v:val)')
|
||||
return a:filter
|
||||
endf
|
||||
|
||||
|
||||
" :nodoc:
|
||||
function! s:prototype.SetFrontFilter(world, pattern) dict "{{{3
|
||||
let a:world.filter[0] = map(reverse(split(a:pattern, '\s*|\s*')), 'join(split(v:val, ''\.''), ''.\{-}'')') + a:world.filter[0][1 : -1]
|
||||
endf
|
||||
|
||||
|
||||
" :nodoc:
|
||||
function! s:prototype.PushFrontFilter(world, char) dict "{{{3
|
||||
let cc = nr2char(a:char)
|
||||
if cc == '.'
|
||||
let a:world.filter[0][0] .= '.\{-}'
|
||||
else
|
||||
let a:world.filter[0][0] .= nr2char(a:char)
|
||||
endif
|
||||
endf
|
||||
|
||||
|
||||
" :nodoc:
|
||||
function! s:prototype.ReduceFrontFilter(world) dict "{{{3
|
||||
let flt = a:world.filter[0][0]
|
||||
if flt =~ '\.\\{-}$'
|
||||
let a:world.filter[0][0] = flt[0:-6]
|
||||
else
|
||||
let a:world.filter[0][0] = flt[0:-2]
|
||||
endif
|
||||
endf
|
||||
|
||||
|
||||
" :nodoc:
|
||||
function! s:prototype.FilterRxPrefix() dict "{{{3
|
||||
return ''
|
||||
endf
|
||||
|
||||
|
||||
" :nodoc:
|
||||
function! s:prototype.CleanFilter(filter) dict "{{{3
|
||||
return substitute(a:filter, '.\\{-}', '.', 'g')
|
||||
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-05-01.
|
||||
" @Last Change: 2011-04-01.
|
||||
" @Revision: 0.1.915
|
||||
" @Last Change: 2012-10-03.
|
||||
" @Revision: 0.1.1203
|
||||
|
||||
" :filedoc:
|
||||
" A prototype used by |tlib#input#List|.
|
||||
@ -24,6 +24,7 @@ let s:prototype = tlib#Object#New({
|
||||
\ 'fileencoding': &fileencoding,
|
||||
\ 'fmt_display': {},
|
||||
\ 'fmt_filter': {},
|
||||
\ 'fmt_options': {},
|
||||
\ 'filetype': '',
|
||||
\ 'filter': [['']],
|
||||
\ 'filter_format': '',
|
||||
@ -62,6 +63,7 @@ let s:prototype = tlib#Object#New({
|
||||
\ 'state': 'display',
|
||||
\ 'state_handlers': [],
|
||||
\ 'sticky': 0,
|
||||
\ 'temp_prompt': [],
|
||||
\ 'timeout': 0,
|
||||
\ 'timeout_resolution': 2,
|
||||
\ 'type': '',
|
||||
@ -94,71 +96,115 @@ endf
|
||||
" :nodoc:
|
||||
function! s:prototype.Set_highlight_filename() dict "{{{3
|
||||
let self.tlib_UseInputListScratch = 'call world.Highlight_filename()'
|
||||
" \ 'syntax match TLibMarker /\%>'. (1 + eval(g:tlib_inputlist_width_filename)) .'c |.\{-}| / | hi def link TLibMarker Special'
|
||||
" let self.tlib_UseInputListScratch .= '| syntax match TLibDir /\%>'. (4 + eval(g:tlib_inputlist_width_filename)) .'c\S\{-}[\/].*$/ | hi def link TLibDir Directory'
|
||||
endf
|
||||
|
||||
|
||||
" :nodoc:
|
||||
function! s:prototype.Highlight_filename() dict "{{{3
|
||||
" exec 'syntax match TLibDir /\%>'. (3 + eval(g:tlib_inputlist_width_filename)) .'c \(\S:\)\?[\/].*$/ contained containedin=TLibMarker'
|
||||
exec 'syntax match TLibDir /\(\a:\|\.\.\..\{-}\)\?[\/][^&<>*|]*$/ contained containedin=TLibMarker'
|
||||
exec 'syntax match TLibMarker /\%>'. (1 + eval(g:tlib_inputlist_width_filename)) .'c |\( \|[[:alnum:]%*+-]*\)| \S.*$/ contains=TLibDir'
|
||||
hi def link TLibMarker Special
|
||||
hi def link TLibDir Directory
|
||||
endf
|
||||
if g:tlib#input#format_filename == 'r'
|
||||
|
||||
" :nodoc:
|
||||
function! s:prototype.Highlight_filename() dict "{{{3
|
||||
syntax match TLibDir /\s\+\zs.\{-}[\/]\ze[^\/]\+$/
|
||||
hi def link TLibDir Directory
|
||||
syntax match TLibFilename /[^\/]\+$/
|
||||
hi def link TLibFilename Normal
|
||||
endf
|
||||
|
||||
" :nodoc:
|
||||
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 self.fmt_options.maxlen = min([maxco, maxfi])
|
||||
" TLogVAR maxco, maxfi, self.fmt_options.maxlen
|
||||
endif
|
||||
let max = self.fmt_options.maxlen
|
||||
if len(a:file) > max
|
||||
let filename = '...' . strpart(a:file, len(a:file) - max + 3)
|
||||
else
|
||||
let filename = printf('% '. max .'s', a:file)
|
||||
endif
|
||||
return filename
|
||||
endf
|
||||
|
||||
else
|
||||
|
||||
" :nodoc:
|
||||
function! s:prototype.Highlight_filename() dict "{{{3
|
||||
" let self.width_filename = 1 + eval(g:tlib_inputlist_width_filename)
|
||||
" TLogVAR self.base
|
||||
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"))'))
|
||||
\ ])
|
||||
" 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 TLibMarker /\%>'. (1 + self.width_filename) .'c \(|\|\[[^]]*\]\) \S.*$/ contains=TLibDir'
|
||||
hi def link TLibMarker Special
|
||||
hi def link TLibDir Directory
|
||||
hi def link TLibFilename NonText
|
||||
" :nodoc:
|
||||
function! self.Highlighter(rx) dict
|
||||
let rx = '/\c\%>'. (1 + self.width_filename) .'c \(|\|\[[^]]*\]\) .\{-}\zs'. escape(a:rx, '/') .'/'
|
||||
exec 'match' self.matcher.highlight rx
|
||||
endf
|
||||
endf
|
||||
|
||||
|
||||
" :nodoc:
|
||||
function! s:prototype.FormatFilename(file) dict "{{{3
|
||||
let width = eval(g:tlib_inputlist_width_filename)
|
||||
let split = match(a:file, '[/\\]\zs[^/\\]\+$')
|
||||
if split == -1
|
||||
let fname = ''
|
||||
let dname = a:file
|
||||
else
|
||||
let fname = strpart(a:file, split)
|
||||
let dname = strpart(a:file, 0, split - 1)
|
||||
endif
|
||||
" let fname = fnamemodify(a:file, ":p:t")
|
||||
" " let fname = fnamemodify(a:file, ":t")
|
||||
" " if isdirectory(a:file)
|
||||
" " let fname .='/'
|
||||
" " endif
|
||||
" let dname = fnamemodify(a:file, ":h")
|
||||
" let dname = pathshorten(fnamemodify(a:file, ":h"))
|
||||
let dnmax = &co - max([width, len(fname)]) - 11 - self.index_width - &fdc
|
||||
if len(dname) > dnmax
|
||||
let dname = '...'. strpart(dname, len(dname) - dnmax)
|
||||
endif
|
||||
let marker = []
|
||||
if g:tlib_inputlist_filename_indicators
|
||||
let bnr = bufnr(a:file)
|
||||
" TLogVAR a:file, bnr, self.bufnr
|
||||
if bnr != -1
|
||||
if bnr == self.bufnr
|
||||
call add(marker, '%')
|
||||
" :nodoc:
|
||||
function! s:prototype.FormatFilename(file) dict "{{{3
|
||||
let width = self.width_filename
|
||||
let split = match(a:file, '[/\\]\zs[^/\\]\+$')
|
||||
if split == -1
|
||||
let fname = ''
|
||||
let dname = a:file
|
||||
else
|
||||
let fname = strpart(a:file, split)
|
||||
" let dname = strpart(a:file, 0, split - 1)
|
||||
let dname = a:file
|
||||
endif
|
||||
if strwidth(fname) > width
|
||||
let fname = strpart(fname, 0, width - 3) .'...'
|
||||
endif
|
||||
let dnmax = &co - max([width, len(fname)]) - 10 - self.index_width - &fdc
|
||||
if g:tlib_inputlist_filename_indicators
|
||||
let dnmax -= 2
|
||||
endif
|
||||
if len(dname) > dnmax
|
||||
let dname = '...'. strpart(dname, len(dname) - dnmax)
|
||||
endif
|
||||
let marker = []
|
||||
if g:tlib_inputlist_filename_indicators
|
||||
call insert(marker, '[')
|
||||
let bnr = bufnr(a:file)
|
||||
" TLogVAR a:file, bnr, self.bufnr
|
||||
if bnr != -1
|
||||
if bnr == self.bufnr
|
||||
call add(marker, '%')
|
||||
else
|
||||
call add(marker, bnr)
|
||||
endif
|
||||
if getbufvar(bnr, '&modified')
|
||||
call add(marker, '+')
|
||||
endif
|
||||
if getbufvar(bnr, '&bufhidden') == 'hide'
|
||||
call add(marker, 'h')
|
||||
endif
|
||||
" if !buflisted(bnr)
|
||||
" call add(marker, 'u')
|
||||
" endif
|
||||
else
|
||||
call add(marker, ' ')
|
||||
" elseif buflisted(a:file)
|
||||
" if getbufvar(a:file, "&mod")
|
||||
" call add(marker, '+')
|
||||
" else
|
||||
" call add(marker, 'B')
|
||||
" endif
|
||||
" elseif bufloaded(a:file)
|
||||
" call add(marker, 'h')
|
||||
" else
|
||||
" call add(marker, 'u')
|
||||
endif
|
||||
call add(marker, ']')
|
||||
else
|
||||
call add(marker, ' ')
|
||||
call add(marker, '|')
|
||||
endif
|
||||
endif
|
||||
call insert(marker, '|')
|
||||
call add(marker, '|')
|
||||
return printf("%-". eval(g:tlib_inputlist_width_filename) ."s %s %s", fname, join(marker, ''), dname)
|
||||
endf
|
||||
return printf("%-". self.width_filename ."s %s %s", fname, join(marker, ''), dname)
|
||||
endf
|
||||
|
||||
endif
|
||||
|
||||
|
||||
" :nodoc:
|
||||
@ -312,7 +358,11 @@ endf
|
||||
|
||||
" :nodoc:
|
||||
function! s:prototype.GetBaseIdx0(idx) dict "{{{3
|
||||
return self.GetBaseIdx(a:idx) - 1
|
||||
let idx0 = self.GetBaseIdx(a:idx) - 1
|
||||
if idx0 < 0
|
||||
call tlib#notify#Echo('TLIB: Internal Error: GetBaseIdx0: idx0 < 0', 'WarningMsg')
|
||||
endif
|
||||
return idx0
|
||||
endf
|
||||
|
||||
|
||||
@ -416,22 +466,25 @@ function! s:prototype.SetFilter() dict "{{{3
|
||||
let mrx = self.FilterRxPrefix() . self.filter_options
|
||||
let self.filter_pos = []
|
||||
let self.filter_neg = []
|
||||
" TLogVAR self.filter
|
||||
" TLogVAR mrx, self.filter
|
||||
for filter in self.filter
|
||||
" TLogVAR filter
|
||||
let rx = join(reverse(filter(copy(filter), '!empty(v:val)')), '\|')
|
||||
if rx =~ '\u'
|
||||
let mrx1 = mrx .'\C'
|
||||
else
|
||||
let mrx1 = mrx
|
||||
endif
|
||||
" TLogVAR rx
|
||||
if rx[0] == g:tlib_inputlist_not
|
||||
if len(rx) > 1
|
||||
call add(self.filter_neg, mrx1 .'\('. rx[1:-1] .'\)')
|
||||
if !empty(rx)
|
||||
if rx =~ '\u'
|
||||
let mrx1 = mrx .'\C'
|
||||
else
|
||||
let mrx1 = mrx
|
||||
endif
|
||||
" TLogVAR rx
|
||||
if rx[0] == g:tlib_inputlist_not
|
||||
if len(rx) > 1
|
||||
call add(self.filter_neg, mrx1 .'\('. rx[1:-1] .'\)')
|
||||
endif
|
||||
else
|
||||
call add(self.filter_pos, mrx1 .'\('. rx .'\)')
|
||||
endif
|
||||
else
|
||||
call add(self.filter_pos, mrx1 .'\('. rx .'\)')
|
||||
endif
|
||||
endfor
|
||||
" TLogVAR self.filter_pos, self.filter_neg
|
||||
@ -485,14 +538,22 @@ endf
|
||||
|
||||
" :nodoc:
|
||||
function! s:prototype.BuildTableList() dict "{{{3
|
||||
" let time0 = str2float(reltimestr(reltime())) " DBG
|
||||
" 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.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
|
||||
|
||||
@ -623,25 +684,32 @@ endf
|
||||
" :nodoc:
|
||||
function! s:prototype.UseInputListScratch() dict "{{{3
|
||||
let scratch = self.UseScratch()
|
||||
" TLogVAR scratch
|
||||
syntax match InputlListIndex /^\d\+:/
|
||||
syntax match InputlListCursor /^\d\+\* .*$/ contains=InputlListIndex
|
||||
syntax match InputlListSelected /^\d\+# .*$/ contains=InputlListIndex
|
||||
hi def link InputlListIndex Constant
|
||||
hi def link InputlListCursor Search
|
||||
hi def link InputlListSelected IncSearch
|
||||
" exec "au BufEnter <buffer> call tlib#input#Resume(". string(self.name) .")"
|
||||
setlocal nowrap
|
||||
" hi def link InputlListIndex Special
|
||||
" let b:tlibDisplayListMarks = {}
|
||||
let b:tlibDisplayListMarks = []
|
||||
let b:tlibDisplayListWorld = self
|
||||
call tlib#hook#Run('tlib_UseInputListScratch', self)
|
||||
if !exists('b:tlib_list_init')
|
||||
call tlib#autocmdgroup#Init()
|
||||
autocmd TLib VimResized <buffer> call feedkeys("\<c-j>", 't')
|
||||
let b:tlib_list_init = 1
|
||||
endif
|
||||
if !exists('w:tlib_list_init')
|
||||
" TLogVAR scratch
|
||||
syntax match InputlListIndex /^\d\+:/
|
||||
syntax match InputlListCursor /^\d\+\* .*$/ contains=InputlListIndex
|
||||
syntax match InputlListSelected /^\d\+# .*$/ contains=InputlListIndex
|
||||
hi def link InputlListIndex Constant
|
||||
hi def link InputlListCursor Search
|
||||
hi def link InputlListSelected IncSearch
|
||||
setlocal nowrap
|
||||
" hi def link InputlListIndex Special
|
||||
" let b:tlibDisplayListMarks = {}
|
||||
let b:tlibDisplayListMarks = []
|
||||
let b:tlibDisplayListWorld = self
|
||||
call tlib#hook#Run('tlib_UseInputListScratch', self)
|
||||
let w:tlib_list_init = 1
|
||||
endif
|
||||
return scratch
|
||||
endf
|
||||
|
||||
|
||||
" :def: function! s:prototype.Reset(?initial=0)
|
||||
" s:prototype.Reset(?initial=0)
|
||||
" :nodoc:
|
||||
function! s:prototype.Reset(...) dict "{{{3
|
||||
TVarArg ['initial', 0]
|
||||
@ -687,56 +755,158 @@ function! s:prototype.Retrieve(anyway) dict "{{{3
|
||||
endf
|
||||
|
||||
|
||||
function! s:FormatHelp(help) "{{{3
|
||||
" TLogVAR a:help
|
||||
let max = [0, 0]
|
||||
for item in a:help
|
||||
" TLogVAR item
|
||||
if type(item) == 3
|
||||
let itemlen = map(copy(item), 'strwidth(v:val)')
|
||||
" TLogVAR itemlen
|
||||
let max = map(range(2), 'max[v:val] >= itemlen[v:val] ? max[v:val] : itemlen[v:val]')
|
||||
endif
|
||||
unlet item
|
||||
endfor
|
||||
" TLogVAR max
|
||||
let cols = float2nr((winwidth(0) - &foldcolumn - 1) / (max[0] + max[1] + 2))
|
||||
if cols < 1
|
||||
let cols = 1
|
||||
endif
|
||||
let fmt = printf('%%%ds: %%-%ds', max[0], max[1])
|
||||
" TLogVAR cols, fmt
|
||||
let help = []
|
||||
let idx = -1
|
||||
let maxidx = len(a:help)
|
||||
while idx < maxidx
|
||||
let push_item = 0
|
||||
let accum = []
|
||||
for i in range(cols)
|
||||
let idx += 1
|
||||
if idx >= maxidx
|
||||
break
|
||||
endif
|
||||
let item = a:help[idx]
|
||||
if type(item) == 3
|
||||
call add(accum, item)
|
||||
else
|
||||
let push_item = 1
|
||||
break
|
||||
endif
|
||||
unlet item
|
||||
endfor
|
||||
if !empty(accum)
|
||||
call add(help, s:FormatHelpItem(accum, fmt))
|
||||
endif
|
||||
if push_item
|
||||
call add(help, a:help[idx])
|
||||
endif
|
||||
endwh
|
||||
" TLogVAR help
|
||||
return help
|
||||
endf
|
||||
|
||||
|
||||
function! s:FormatHelpItem(item, fmt) "{{{3
|
||||
let args = [join(repeat([a:fmt], len(a:item)), ' ')]
|
||||
for item in a:item
|
||||
" TLogVAR item
|
||||
let args += item
|
||||
endfor
|
||||
" TLogVAR args
|
||||
return call('printf', args)
|
||||
endf
|
||||
|
||||
|
||||
" :nodoc:
|
||||
function! s:prototype.InitHelp() dict "{{{3
|
||||
return []
|
||||
endf
|
||||
|
||||
|
||||
" :nodoc:
|
||||
function! s:prototype.PushHelp(...) dict "{{{3
|
||||
" TLogVAR a:000
|
||||
if a:0 == 1
|
||||
if type(a:1) == 3
|
||||
let self._help += a:1
|
||||
else
|
||||
call add(self._help, a:1)
|
||||
endif
|
||||
elseif a:0 == 2
|
||||
call add(self._help, a:000)
|
||||
else
|
||||
throw "TLIB: PushHelp: Wrong number of arguments: ". string(a:000)
|
||||
endif
|
||||
" TLogVAR helpstring
|
||||
endf
|
||||
|
||||
|
||||
" :nodoc:
|
||||
function! s:prototype.DisplayHelp() dict "{{{3
|
||||
" \ 'Help:',
|
||||
let help = [
|
||||
\ 'Mouse ... Pick an item Letter ... Filter the list',
|
||||
\ printf('<m-Number> ... Pick an item "%s", "%s", %sWORD ... AND, OR, NOT',
|
||||
\ g:tlib_inputlist_and, g:tlib_inputlist_or, g:tlib_inputlist_not),
|
||||
\ 'Enter ... Pick the current item <bs>, <c-bs> ... Reduce filter',
|
||||
\ '<c|m-r> ... Reset the display Up/Down ... Next/previous item',
|
||||
\ '<c|m-q> ... Edit top filter string Page Up/Down ... Scroll',
|
||||
\ '<Esc> ... Abort',
|
||||
\ ]
|
||||
let self._help = 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')
|
||||
call self.PushHelp('Mouse', 'L: Pick item, R: Show menu')
|
||||
call self.PushHelp('<BS>, <C-BS>', 'Reduce filter')
|
||||
call self.PushHelp('<S-Esc>, <F10>', 'Enter command')
|
||||
|
||||
if self.allow_suspend
|
||||
call add(help,
|
||||
\ '<c|m-z> ... Suspend/Resume <c-o> ... Switch to origin')
|
||||
if self.key_mode == 'default'
|
||||
call self.PushHelp('<C|M-r>', 'Reset the display')
|
||||
call self.PushHelp('Up/Down', 'Next/previous item')
|
||||
call self.PushHelp('<C|M-q>', 'Edit top filter string')
|
||||
call self.PushHelp('Page Up/Down', 'Scroll')
|
||||
if self.allow_suspend
|
||||
call self.PushHelp('<C|M-z>', 'Suspend/Resume')
|
||||
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('#, <C-Space>', '(Un)Select the current item')
|
||||
call self.PushHelp('<C|M-a>', '(Un)Select all items')
|
||||
" \ '<c-\> ... Show only selected',
|
||||
endif
|
||||
endif
|
||||
|
||||
if stridx(self.type, 'm') != -1
|
||||
let help += [
|
||||
\ '#, <c-space> ... (Un)Select the current item',
|
||||
\ '<c|m-a> ... (Un)Select all currently visible items',
|
||||
\ '<s-up/down> ... (Un)Select items',
|
||||
\ ]
|
||||
" \ '<c-\> ... Show only selected',
|
||||
endif
|
||||
for handler in self.key_handlers
|
||||
" TLogVAR len(self._help)
|
||||
call self.matcher.Help(self)
|
||||
|
||||
" TLogVAR self.key_mode
|
||||
for handler in values(self.key_map[self.key_mode])
|
||||
" TLogVAR handler
|
||||
let key = get(handler, 'key_name', '')
|
||||
" TLogVAR key
|
||||
if !empty(key)
|
||||
let desc = get(handler, 'help', '')
|
||||
call add(help, printf('%-12s ... %s', key, desc))
|
||||
if empty(desc)
|
||||
let desc = get(handler, 'agent', '')
|
||||
endif
|
||||
call self.PushHelp(key, desc)
|
||||
endif
|
||||
endfor
|
||||
if !empty(self.help_extra)
|
||||
let help += self.help_extra
|
||||
|
||||
if !has_key(self.key_map[self.key_mode], 'unknown_key')
|
||||
call self.PushHelp('Letter', 'Filter the list')
|
||||
endif
|
||||
let help += [
|
||||
|
||||
if self.key_mode == 'default' && !empty(self.help_extra)
|
||||
call self.PushHelp(self.help_extra)
|
||||
endif
|
||||
|
||||
" TLogVAR len(self._help)
|
||||
call self.PushHelp([
|
||||
\ '',
|
||||
\ 'Exact matches and matches at word boundaries is given more weight.',
|
||||
\ 'Warning: Please don''t resize the window with the mouse.',
|
||||
\ '',
|
||||
\ 'Press any key to continue.',
|
||||
\ ]
|
||||
\ 'Matches at word boundaries are prioritized.',
|
||||
\ ])
|
||||
let self._help = s:FormatHelp(self._help)
|
||||
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, help)
|
||||
call append(0, self._help)
|
||||
" call tlib#normal#WithRegister('G"tddgg', 't')
|
||||
call tlib#buffer#DeleteRange('$', '$')
|
||||
1
|
||||
call self.Resize(len(help), 0)
|
||||
call self.Resize(len(self._help), 0)
|
||||
endf
|
||||
|
||||
|
||||
@ -785,12 +955,13 @@ function! s:prototype.GetResize(size) dict "{{{3
|
||||
endf
|
||||
|
||||
|
||||
" function! s:prototype.DisplayList(query, ?list)
|
||||
" function! s:prototype.DisplayList(?query=self.Query(), ?list=[])
|
||||
" :nodoc:
|
||||
function! s:prototype.DisplayList(query, ...) dict "{{{3
|
||||
" TLogVAR a:query
|
||||
function! s:prototype.DisplayList(...) dict "{{{3
|
||||
" TLogVAR self.state
|
||||
let list = a:0 >= 1 ? a:1 : []
|
||||
let query = a:0 >= 1 ? a:1 : self.Query()
|
||||
let list = a:0 >= 2 ? a:2 : []
|
||||
" TLogVAR query, len(list)
|
||||
" TLogDBG 'len(list) = '. len(list)
|
||||
call self.UseScratch()
|
||||
" TLogVAR self.scratch
|
||||
@ -799,6 +970,7 @@ function! s:prototype.DisplayList(query, ...) dict "{{{3
|
||||
call self.ScrollToOffset()
|
||||
elseif self.state == 'help'
|
||||
call self.DisplayHelp()
|
||||
call self.SetStatusline(query)
|
||||
else
|
||||
" TLogVAR query
|
||||
" let ll = len(list)
|
||||
@ -832,7 +1004,7 @@ function! s:prototype.DisplayList(query, ...) dict "{{{3
|
||||
call add(b:tlibDisplayListMarks, base_pref)
|
||||
call self.DisplayListMark(x, base_pref, '*')
|
||||
call self.SetOffset()
|
||||
call self.SetStatusline(a:query)
|
||||
call self.SetStatusline(query)
|
||||
" TLogVAR self.offset
|
||||
call self.ScrollToOffset()
|
||||
let rx0 = self.GetRx0()
|
||||
@ -841,7 +1013,11 @@ function! s:prototype.DisplayList(query, ...) dict "{{{3
|
||||
if empty(rx0)
|
||||
match none
|
||||
elseif self.IsValidFilter()
|
||||
exec 'match '. self.matcher.highlight .' /\c'. escape(rx0, '/') .'/'
|
||||
if has_key(self, 'Highlighter')
|
||||
call self.Highlighter(rx0)
|
||||
else
|
||||
exec 'match '. self.matcher.highlight .' /\c'. escape(rx0, '/') .'/'
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
@ -849,22 +1025,51 @@ function! s:prototype.DisplayList(query, ...) dict "{{{3
|
||||
endf
|
||||
|
||||
|
||||
" :nodoc:
|
||||
function! s:prototype.SetStatusline(query) dict "{{{3
|
||||
let query = a:query
|
||||
let options = [self.matcher.name]
|
||||
if self.sticky
|
||||
call add(options, '#')
|
||||
" TLogVAR a:query
|
||||
if !empty(self.temp_prompt)
|
||||
let echo = get(self.temp_prompt, 0, '')
|
||||
let hl = get(self.temp_prompt, 1, 'Normal')
|
||||
let self.temp_prompt = []
|
||||
else
|
||||
let hl = 'Normal'
|
||||
let query = a:query
|
||||
let options = [self.matcher.name]
|
||||
if self.sticky
|
||||
call add(options, '#')
|
||||
endif
|
||||
if self.key_mode != 'default'
|
||||
call add(options, 'map:'. self.key_mode)
|
||||
endif
|
||||
if !empty(options)
|
||||
let sopts = printf('[%s]', join(options, ', '))
|
||||
" let echo = query . repeat(' ', &columns - len(sopts) - len(query) - 20) . sopts
|
||||
let echo = query . ' ' . sopts
|
||||
" let query .= '%%='. sopts .' '
|
||||
endif
|
||||
" TLogVAR &l:statusline, query
|
||||
" let &l:statusline = query
|
||||
endif
|
||||
if !empty(options)
|
||||
let sopts = printf('[%s]', join(options, ', '))
|
||||
" let echo = query . repeat(' ', &columns - len(sopts) - len(query) - 20) . sopts
|
||||
let echo = query . ' ' . sopts
|
||||
" let query .= '%%='. sopts .' '
|
||||
endif
|
||||
" TLogVAR &l:statusline, query
|
||||
" let &l:statusline = query
|
||||
echo
|
||||
echo echo
|
||||
if hl != 'Normal'
|
||||
exec 'echohl' hl
|
||||
echo echo
|
||||
echohl None
|
||||
else
|
||||
echo echo
|
||||
endif
|
||||
endf
|
||||
|
||||
|
||||
" :nodoc:
|
||||
function! s:prototype.Query() dict "{{{3
|
||||
if g:tlib_inputlist_shortmessage
|
||||
let query = 'Filter: '. self.DisplayFilter()
|
||||
else
|
||||
let query = self.query .' (filter: '. self.DisplayFilter() .'; press "?" for help)'
|
||||
endif
|
||||
return query
|
||||
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-24.
|
||||
" @Last Change: 2010-11-20.
|
||||
" @Revision: 0.1.185
|
||||
" @Last Change: 2012-10-03.
|
||||
" @Revision: 0.1.208
|
||||
|
||||
|
||||
" :filedoc:
|
||||
@ -14,11 +14,16 @@
|
||||
" General {{{1
|
||||
|
||||
function! tlib#agent#Exit(world, selected) "{{{3
|
||||
call a:world.CloseScratch()
|
||||
let a:world.state = 'exit empty escape'
|
||||
let a:world.list = []
|
||||
" let a:world.base = []
|
||||
call a:world.ResetSelected()
|
||||
if a:world.key_mode == 'default'
|
||||
call a:world.CloseScratch()
|
||||
let a:world.state = 'exit empty escape'
|
||||
let a:world.list = []
|
||||
" let a:world.base = []
|
||||
call a:world.ResetSelected()
|
||||
else
|
||||
let a:world.key_mode = 'default'
|
||||
let a:world.state = 'redisplay'
|
||||
endif
|
||||
return a:world
|
||||
endf
|
||||
|
||||
@ -156,17 +161,14 @@ function! tlib#agent#Suspend(world, selected) "{{{3
|
||||
" TLogDBG bufnr('%')
|
||||
let br = tlib#buffer#Set(a:world.scratch)
|
||||
" TLogVAR br, a:world.bufnr, a:world.scratch
|
||||
" TLogDBG bufnr('%')
|
||||
if bufnr('%') != a:world.scratch
|
||||
echohl WarningMsg
|
||||
echom "tlib#agent#Suspend: Internal error: Not a scratch buffer:" bufname('%')
|
||||
echohl NONE
|
||||
endif
|
||||
" TLogVAR bufnr('%'), bufname('%'), a:world.scratch
|
||||
call tlib#autocmdgroup#Init()
|
||||
autocmd TLib InsertEnter,InsertChange <buffer> call tlib#input#Resume("world", 0)
|
||||
let b:tlib_suspend = {
|
||||
\ '<m-z>': 0, '<c-z>': 0, '<space>': 0,
|
||||
\ '<cr>': 1,
|
||||
\ '<LeftMouse>': 1, '<MiddleMouse>': 0, '<RightMouse>': 0, '<c-LeftMouse>': 0,
|
||||
\ '<': 2}
|
||||
for [m, pick] in items(b:tlib_suspend)
|
||||
exec 'noremap <buffer> '. m .' :call tlib#input#Resume("world", '. pick .')<cr>'
|
||||
endfor
|
||||
exec 'autocmd TLib BufEnter <buffer='. a:world.scratch .'> call tlib#input#Resume("world", 0, '. a:world.scratch .')'
|
||||
let b:tlib_world = a:world
|
||||
exec br
|
||||
let a:world.state = 'exit suspend'
|
||||
@ -373,6 +375,7 @@ function! tlib#agent#ViewFile(world, selected) "{{{3
|
||||
let cmd1 = 'buffer'
|
||||
endif
|
||||
call tlib#file#With(cmd0, cmd1, a:selected, a:world)
|
||||
" TLogVAR &filetype
|
||||
exec back
|
||||
let a:world.state = 'display'
|
||||
endif
|
||||
@ -512,3 +515,49 @@ function! tlib#agent#Wildcard(world, selected) "{{{3
|
||||
return a:world
|
||||
endf
|
||||
|
||||
|
||||
function! tlib#agent#Null(world, selected) "{{{3
|
||||
let a:world.state = 'redisplay'
|
||||
return a:world
|
||||
endf
|
||||
|
||||
|
||||
function! tlib#agent#ExecAgentByName(world, selected) "{{{3
|
||||
let s:agent_names_world = a:world
|
||||
let agent_names = {}
|
||||
for def in values(a:world.key_map[a:world.key_mode])
|
||||
if has_key(def, 'help') && !empty(def.help) && has_key(def, 'agent') && !empty(def.agent)
|
||||
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')
|
||||
" TLogVAR command
|
||||
if !has_key(agent_names, command)
|
||||
" TLogVAR command
|
||||
silent! let matches = filter(keys(agent_names), 'v:val =~ command')
|
||||
" TLogVAR matches
|
||||
if len(matches) == 1
|
||||
let command = matches[0]
|
||||
endif
|
||||
endif
|
||||
if has_key(agent_names, command)
|
||||
let agent = agent_names[command]
|
||||
return call(agent, [a:world, a:selected])
|
||||
else
|
||||
if !empty(command)
|
||||
echohl WarningMsg
|
||||
echom "Unknown command:" command
|
||||
echohl NONE
|
||||
sleep 1
|
||||
endif
|
||||
let a:world.state = 'display'
|
||||
return a:world
|
||||
endif
|
||||
endf
|
||||
|
||||
|
||||
function! tlib#agent#CompleteAgentNames(ArgLead, CmdLine, CursorPos)
|
||||
return s:agent_names
|
||||
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: 2010-09-23.
|
||||
" @Revision: 0.0.334
|
||||
" @Last Change: 2012-02-09.
|
||||
" @Revision: 0.0.351
|
||||
|
||||
|
||||
let s:bmru = []
|
||||
@ -351,6 +351,7 @@ function! tlib#buffer#InsertText(text, ...) "{{{3
|
||||
exec 'norm! '. posshift .'h'
|
||||
endif
|
||||
endif
|
||||
" TLogDBG getline(lineno)
|
||||
" TLogDBG string(getline(1, '$'))
|
||||
return grow
|
||||
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: 2011-03-10.
|
||||
" @Revision: 0.1.182
|
||||
" @Last Change: 2012-05-11.
|
||||
" @Revision: 0.1.192
|
||||
|
||||
|
||||
" |tlib#cache#Purge()|: Remove cache files older than N days.
|
||||
@ -24,6 +24,10 @@ 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
|
||||
|
||||
" 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()|.
|
||||
@ -42,10 +46,10 @@ function! tlib#cache#Dir(...) "{{{3
|
||||
endf
|
||||
|
||||
|
||||
" :def: function! tlib#cache#Filename(type, ?file=%, ?mkdir=0)
|
||||
" :def: function! tlib#cache#Filename(type, ?file=%, ?mkdir=0, ?dir='')
|
||||
function! tlib#cache#Filename(type, ...) "{{{3
|
||||
" TLogDBG 'bufname='. bufname('.')
|
||||
let dir = tlib#cache#Dir()
|
||||
let dir = a:0 >= 3 && !empty(a:3) ? a:3 : tlib#cache#Dir()
|
||||
if a:0 >= 1 && !empty(a:1)
|
||||
let file = a:1
|
||||
else
|
||||
@ -87,70 +91,64 @@ endf
|
||||
|
||||
|
||||
function! tlib#cache#Save(cfile, dictionary) "{{{3
|
||||
if !empty(a:cfile)
|
||||
" TLogVAR a:dictionary
|
||||
call writefile([string(a:dictionary)], a:cfile, 'b')
|
||||
endif
|
||||
call tlib#persistent#Save(a:cfile, a:dictionary)
|
||||
endf
|
||||
|
||||
|
||||
function! tlib#cache#Get(cfile) "{{{3
|
||||
call tlib#cache#MaybePurge()
|
||||
if !empty(a:cfile) && filereadable(a:cfile)
|
||||
let val = readfile(a:cfile, 'b')
|
||||
return eval(join(val, "\n"))
|
||||
else
|
||||
return {}
|
||||
endif
|
||||
return tlib#persistent#Get(a:cfile)
|
||||
endf
|
||||
|
||||
|
||||
" Call |tlib#cache#Purge()| if the last purge was done before
|
||||
" |g:tlib#cache#purge_every_days|.
|
||||
function! tlib#cache#MaybePurge() "{{{3
|
||||
if g:tlib#cache#purge_every_days < 0
|
||||
return
|
||||
endif
|
||||
let dir = tlib#cache#Dir('g')
|
||||
let last_purge = tlib#file#Join([dir, '.last_purge'])
|
||||
let last_purge_exists = filereadable(last_purge)
|
||||
" |g:tlib#cache#purge_every_days|.
|
||||
function! tlib#cache#MaybePurge() "{{{3
|
||||
if g:tlib#cache#purge_every_days < 0
|
||||
return
|
||||
endif
|
||||
let dir = tlib#cache#Dir('g')
|
||||
let last_purge = tlib#file#Join([dir, '.last_purge'])
|
||||
let last_purge_exists = filereadable(last_purge)
|
||||
if last_purge_exists
|
||||
let threshold = localtime() - g:tlib#cache#purge_every_days * g:tlib#date#dayshift
|
||||
let should_purge = getftime(last_purge) < threshold
|
||||
else
|
||||
let should_purge = 0 " should ignore empty dirs, like the tmru one: !empty(glob(tlib#file#Join([dir, '**'])))
|
||||
endif
|
||||
if should_purge
|
||||
if last_purge_exists
|
||||
let threshold = localtime() - g:tlib#cache#purge_every_days * g:tlib#date#dayshift
|
||||
let should_purge = getftime(last_purge) < threshold
|
||||
let yn = 'y'
|
||||
else
|
||||
let should_purge = 0 " should ignore empty dirs, like the tmru one: !empty(glob(tlib#file#Join([dir, '**'])))
|
||||
let txt = "TLib: The cache directory '". dir ."' should be purged of old files.\nDelete files older than ". g:tlib#cache#purge_days ." days now?"
|
||||
let yn = tlib#input#Dialog(txt, ['yes', 'no'], 'no')
|
||||
endif
|
||||
if should_purge
|
||||
if last_purge_exists
|
||||
let yn = 'y'
|
||||
else
|
||||
let txt = "TLib: The cache directory '". dir ."' should be purged of old files.\nDelete files older than ". g:tlib#cache#purge_days ." days now?"
|
||||
let yn = tlib#input#Dialog(txt, ['yes', 'no'], 'no')
|
||||
if yn =~ '^y\%[es]$'
|
||||
call tlib#cache#Purge()
|
||||
else
|
||||
let g:tlib#cache#purge_every_days = -1
|
||||
if !last_purge_exists
|
||||
call s:PurgeTimestamp(dir)
|
||||
endif
|
||||
if yn =~ '^y\%[es]$'
|
||||
call tlib#cache#Purge()
|
||||
else
|
||||
let g:tlib#cache#purge_every_days = -1
|
||||
if !last_purge_exists
|
||||
call s:PurgeTimestamp(dir)
|
||||
endif
|
||||
echohl WarningMsg
|
||||
echom "TLib: Please run :call tlib#cache#Purge() to clean up ". dir
|
||||
echohl NONE
|
||||
endif
|
||||
elseif !last_purge_exists
|
||||
call s:PurgeTimestamp(dir)
|
||||
echohl WarningMsg
|
||||
echom "TLib: Please run :call tlib#cache#Purge() to clean up ". dir
|
||||
echohl NONE
|
||||
endif
|
||||
endf
|
||||
elseif !last_purge_exists
|
||||
call s:PurgeTimestamp(dir)
|
||||
endif
|
||||
endf
|
||||
|
||||
|
||||
" Delete old files.
|
||||
function! tlib#cache#Purge() "{{{3
|
||||
let threshold = localtime() - g:tlib#cache#purge_days * g:tlib#date#dayshift
|
||||
let dir = tlib#cache#Dir('g')
|
||||
echohl WarningMsg
|
||||
echom "TLib: Delete files older than ". g:tlib#cache#purge_days ." days from ". dir
|
||||
echohl NONE
|
||||
if !g:tlib#cache#silent
|
||||
echohl WarningMsg
|
||||
echom "TLib: Delete files older than ". g:tlib#cache#purge_days ." days from ". dir
|
||||
echohl NONE
|
||||
endif
|
||||
let files = tlib#cache#ListFilesInCache()
|
||||
let deldir = []
|
||||
let newer = []
|
||||
@ -169,7 +167,6 @@ function! tlib#cache#Purge() "{{{3
|
||||
call add(msg, "TLib: Could not delete cache file: ". file)
|
||||
else
|
||||
call add(msg, "TLib: Delete cache file: ". file)
|
||||
" echo "TLib: Delete cache file: ". file
|
||||
endif
|
||||
else
|
||||
call add(newer, file)
|
||||
@ -179,7 +176,7 @@ function! tlib#cache#Purge() "{{{3
|
||||
finally
|
||||
let &more = more
|
||||
endtry
|
||||
if !empty(msg)
|
||||
if !empty(msg) && !g:tlib#cache#silent
|
||||
echo join(msg, "\n")
|
||||
endif
|
||||
if !empty(deldir)
|
||||
@ -206,11 +203,14 @@ function! tlib#cache#Purge() "{{{3
|
||||
call inputsave()
|
||||
if g:tlib#cache#run_script == 0
|
||||
echohl WarningMsg
|
||||
echom "TLib: Please review and execute ". scriptfile
|
||||
if g:tlib#cache#silent
|
||||
echom "TLib: Purged cache. Need to run script to delete directories"
|
||||
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: Could not delete some directories.\nDirectory removal script: ". scriptfile ."\nRun script to delete directories now?", ['yes', 'no', 'edit'], 'no')
|
||||
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')
|
||||
if yn =~ '^y\%[es]$'
|
||||
exec 'cd '. fnameescape(dir)
|
||||
exec '! ' &shell shellescape(scriptfile, 1)
|
||||
|
@ -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: 2011-04-28.
|
||||
" @Revision: 0.0.31
|
||||
" @Last Change: 2012-02-10.
|
||||
" @Revision: 0.0.35
|
||||
|
||||
if &cp || exists("loaded_tlib_cmd_autoload")
|
||||
finish
|
||||
@ -12,12 +12,18 @@ endif
|
||||
let loaded_tlib_cmd_autoload = 1
|
||||
|
||||
|
||||
let g:tlib#cmd#last_output = []
|
||||
|
||||
|
||||
function! tlib#cmd#OutputAsList(command) "{{{3
|
||||
" TLogVAR a:command
|
||||
" let lines = ''
|
||||
redir => lines
|
||||
silent! exec a:command
|
||||
redir END
|
||||
return split(lines, '\n')
|
||||
" TLogVAR lines
|
||||
let g:tlib#cmd#last_output = split(lines, '\n')
|
||||
return g:tlib#cmd#last_output
|
||||
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: 2010-04-03.
|
||||
" @Revision: 0.0.74
|
||||
" @Last Change: 2012-03-23.
|
||||
" @Revision: 0.0.106
|
||||
|
||||
if &cp || exists("loaded_tlib_file_autoload")
|
||||
finish
|
||||
@ -97,22 +97,34 @@ endf
|
||||
function! tlib#file#With(fcmd, bcmd, files, ...) "{{{3
|
||||
" TLogVAR a:fcmd, a:bcmd, a:files
|
||||
exec tlib#arg#Let([['world', {}]])
|
||||
call tlib#autocmdgroup#Init()
|
||||
augroup TLibFileRead
|
||||
autocmd!
|
||||
augroup END
|
||||
for f in a:files
|
||||
let bn = bufnr('^'.f.'$')
|
||||
" TLogVAR f, bn
|
||||
let bufloaded = bufloaded(bn)
|
||||
let ok = 0
|
||||
let s:bufread = ""
|
||||
if bn != -1 && buflisted(bn)
|
||||
if !empty(a:bcmd)
|
||||
" TLogDBG a:bcmd .' '. bn
|
||||
exec a:bcmd .' '. bn
|
||||
let ok = 1
|
||||
call s:SetScrollBind(world)
|
||||
endif
|
||||
else
|
||||
if filereadable(f)
|
||||
if !empty(a:fcmd)
|
||||
" TLogDBG a:fcmd .' '. escape(f, '%#\ ')
|
||||
" exec a:fcmd .' '. escape(f, '%#\ ')
|
||||
" exec a:fcmd .' '. escape(f, '%# ')
|
||||
exec a:fcmd .' '. tlib#arg#Ex(f)
|
||||
" TLogDBG a:fcmd .' '. tlib#arg#Ex(f)
|
||||
exec 'autocmd TLibFileRead BufRead' escape(f, ' ') 'let s:bufread=expand("<afile>:p")'
|
||||
try
|
||||
exec a:fcmd .' '. tlib#arg#Ex(f)
|
||||
finally
|
||||
exec 'autocmd! TLibFileRead BufRead'
|
||||
endtry
|
||||
let ok = 1
|
||||
call s:SetScrollBind(world)
|
||||
endif
|
||||
else
|
||||
@ -121,7 +133,14 @@ function! tlib#file#With(fcmd, bcmd, files, ...) "{{{3
|
||||
echohl NONE
|
||||
endif
|
||||
endif
|
||||
" TLogVAR ok, bufloaded, &filetype
|
||||
if empty(s:bufread) && ok && !bufloaded && empty(&filetype)
|
||||
doautocmd BufRead
|
||||
endif
|
||||
endfor
|
||||
augroup! TLibFileRead
|
||||
unlet! s:bufread
|
||||
" TLogDBG "done"
|
||||
endf
|
||||
|
||||
|
||||
|
@ -3,14 +3,36 @@
|
||||
" @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: 2011-03-31.
|
||||
" @Revision: 0.0.840
|
||||
" @Last Change: 2012-10-01.
|
||||
" @Revision: 0.0.966
|
||||
|
||||
|
||||
" :filedoc:
|
||||
" Input-related, select from a list etc.
|
||||
|
||||
|
||||
" If true, define a popup menu for |tlib#input#List()| and related
|
||||
" functions.
|
||||
TLet g:tlib#input#use_popup = has('menu') && (has('gui_gtk') || has('gui_gtk2') || has('gui_win32'))
|
||||
|
||||
|
||||
" How to format filenames:
|
||||
" l ... Show basenames on the left side, separated from the
|
||||
" directory names
|
||||
" r ... Show basenames on the right side
|
||||
TLet g:tlib#input#format_filename = 'l'
|
||||
|
||||
|
||||
" If g:tlib#input#format_filename == 'r', how much space should be kept
|
||||
" free on the right side.
|
||||
TLet g:tlib#input#filename_padding_r = '&co / 10'
|
||||
|
||||
|
||||
" If g:tlib#input#format_filename == 'l', an expression that
|
||||
" |eval()|uates to the maximum display width of filenames.
|
||||
TLet g:tlib#input#filename_max_width = '&co / 2'
|
||||
|
||||
|
||||
" Functions related to tlib#input#List(type, ...) "{{{2
|
||||
|
||||
" :def: function! tlib#input#List(type. ?query='', ?list=[], ?handlers=[], ?default="", ?timeout=0)
|
||||
@ -115,65 +137,39 @@ endf
|
||||
" (an instance of tlib#World as returned by |tlib#World#New|).
|
||||
function! tlib#input#ListW(world, ...) "{{{3
|
||||
TVarArg 'cmd'
|
||||
if a:world.pick_last_item >= 1 && stridx(a:world.type, 'e') == -1 && len(a:world.base) <= 1
|
||||
return get(a:world.base, 0, a:world.rv)
|
||||
endif
|
||||
" let time0 = str2float(reltimestr(reltime())) " DBG
|
||||
" TLogVAR time0
|
||||
let world = a:world
|
||||
let world.filetype = &filetype
|
||||
let world.fileencoding = &fileencoding
|
||||
call world.SetMatchMode(tlib#var#Get('tlib_inputlist_match', 'wb'))
|
||||
if world.pick_last_item >= 1 && stridx(world.type, 'e') == -1 && len(world.base) <= 1
|
||||
let rv = get(world.base, 0, world.rv)
|
||||
if stridx(world.type, 'm') != -1
|
||||
return [rv]
|
||||
else
|
||||
return rv
|
||||
endif
|
||||
endif
|
||||
call s:Init(world, cmd)
|
||||
" TLogVAR world.state, world.sticky, world.initial_index
|
||||
let key_agents = copy(g:tlib_keyagents_InputList_s)
|
||||
if stridx(world.type, 'm') != -1
|
||||
call extend(key_agents, g:tlib_keyagents_InputList_m, 'force')
|
||||
endif
|
||||
if has('menu')
|
||||
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- :
|
||||
endif
|
||||
for handler in world.key_handlers
|
||||
let k = get(handler, 'key', '')
|
||||
if !empty(k)
|
||||
let key_agents[k] = handler.agent
|
||||
if has('menu') && has_key(handler, 'help') && !empty(handler.help)
|
||||
exec 'amenu ]TLibInputListPopupMenu.'. escape(handler.help, ' .\')
|
||||
\ .' '. handler.key_name
|
||||
let world.has_menu = 1
|
||||
endif
|
||||
endif
|
||||
endfor
|
||||
" let statusline = &l:statusline
|
||||
" let laststatus = &laststatus
|
||||
let lastsearch = @/
|
||||
let scrolloff = &l:scrolloff
|
||||
let &l:scrolloff = 0
|
||||
let @/ = ''
|
||||
let dlist = []
|
||||
" let &laststatus = 2
|
||||
let world.initial_display = 1
|
||||
|
||||
try
|
||||
while !empty(world.state) && world.state !~ '^exit' && (world.show_empty || !empty(world.base))
|
||||
" TLogDBG 'while'
|
||||
" TLogVAR world.state
|
||||
" let time01 = str2float(reltimestr(reltime())) " DBG
|
||||
" TLogVAR time01, time01 - time0
|
||||
try
|
||||
for handler in world.state_handlers
|
||||
let eh = get(handler, 'state', '')
|
||||
if !empty(eh) && world.state =~ eh
|
||||
let ea = get(handler, 'exec', '')
|
||||
if !empty(ea)
|
||||
exec ea
|
||||
else
|
||||
let agent = get(handler, 'agent', '')
|
||||
let world = call(agent, [world, world.GetSelectedItems(world.CurrentItem())])
|
||||
call s:CheckAgentReturnValue(agent, world)
|
||||
endif
|
||||
endif
|
||||
endfor
|
||||
call s:RunStateHandlers(world)
|
||||
|
||||
" let time02 = str2float(reltimestr(reltime())) " DBG
|
||||
" TLogVAR time02, time02 - time0
|
||||
if world.state =~ '\<reset\>'
|
||||
" TLogDBG 'reset'
|
||||
" call world.Reset(world.state =~ '\<initial\>')
|
||||
@ -181,23 +177,21 @@ function! tlib#input#ListW(world, ...) "{{{3
|
||||
continue
|
||||
endif
|
||||
|
||||
let llenw = len(world.base) - winheight(0) + 1
|
||||
if world.offset > llenw
|
||||
let world.offset = llenw
|
||||
endif
|
||||
if world.offset < 1
|
||||
let world.offset = 1
|
||||
endif
|
||||
call s:SetOffset(world)
|
||||
|
||||
" let time02 = str2float(reltimestr(reltime())) " DBG
|
||||
" TLogVAR time02, time02 - time0
|
||||
" TLogDBG 1
|
||||
" TLogVAR world.state
|
||||
if world.state == 'scroll'
|
||||
let world.prefidx = world.offset
|
||||
let world.state = 'redisplay'
|
||||
endif
|
||||
|
||||
if world.state =~ '\<sticky\>'
|
||||
let world.sticky = 1
|
||||
endif
|
||||
|
||||
" TLogVAR world.filter
|
||||
" TLogVAR world.sticky
|
||||
if world.state =~ '\<pick\>'
|
||||
@ -206,9 +200,15 @@ function! tlib#input#ListW(world, ...) "{{{3
|
||||
throw 'pick'
|
||||
elseif world.state =~ 'display'
|
||||
if world.state =~ '^display'
|
||||
" let time03 = str2float(reltimestr(reltime())) " DBG
|
||||
" TLogVAR time03, time03 - time0
|
||||
if world.IsValidFilter()
|
||||
|
||||
" let time1 = str2float(reltimestr(reltime())) " DBG
|
||||
" TLogVAR time1, time1 - time0
|
||||
call world.BuildTableList()
|
||||
" let time2 = str2float(reltimestr(reltime())) " DBG
|
||||
" TLogVAR time2, time2 - time0
|
||||
" TLogDBG 2
|
||||
" TLogDBG len(world.table)
|
||||
" TLogVAR world.table
|
||||
@ -223,6 +223,8 @@ function! tlib#input#ListW(world, ...) "{{{3
|
||||
let dindex = world.index_table
|
||||
let world.index_width = len(max(dindex))
|
||||
endif
|
||||
" let time3 = str2float(reltimestr(reltime())) " DBG
|
||||
" TLogVAR time3, time3 - time0
|
||||
if world.llen == 0 && !world.show_empty
|
||||
call world.ReduceFilter()
|
||||
let world.offset = 1
|
||||
@ -241,6 +243,8 @@ function! tlib#input#ListW(world, ...) "{{{3
|
||||
let world.last_item = ''
|
||||
endif
|
||||
endif
|
||||
" let time4 = str2float(reltimestr(reltime())) " DBG
|
||||
" TLogVAR time4, time4 - time0
|
||||
" TLogDBG 4
|
||||
" TLogVAR world.idx, world.llen, world.state
|
||||
" TLogDBG world.FilterIsEmpty()
|
||||
@ -256,6 +260,8 @@ function! tlib#input#ListW(world, ...) "{{{3
|
||||
let world.prefidx = 1
|
||||
endif
|
||||
endif
|
||||
" let time5 = str2float(reltimestr(reltime())) " DBG
|
||||
" TLogVAR time5, time5 - time0
|
||||
" TLogVAR world.initial_index, world.prefidx
|
||||
" TLogDBG 5
|
||||
" TLogDBG len(world.list)
|
||||
@ -270,19 +276,30 @@ function! tlib#input#ListW(world, ...) "{{{3
|
||||
endif
|
||||
" TLogVAR world.prefidx
|
||||
" TLogDBG 6
|
||||
" let time6 = str2float(reltimestr(reltime())) " DBG
|
||||
" TLogVAR time6, time6 - time0
|
||||
if world.offset_horizontal > 0
|
||||
call map(dlist, 'v:val[world.offset_horizontal:-1]')
|
||||
endif
|
||||
" let time7 = str2float(reltimestr(reltime())) " DBG
|
||||
" TLogVAR time7, time7 - time0
|
||||
" TLogVAR dindex
|
||||
let dlist = map(range(0, world.llen - 1), 'printf("%0'. world.index_width .'d", dindex[v:val]) .": ". dlist[v:val]')
|
||||
" TLogVAR dlist
|
||||
" let time8 = str2float(reltimestr(reltime())) " DBG
|
||||
" TLogVAR time8, time8 - time0
|
||||
|
||||
else
|
||||
|
||||
let dlist = ['Malformed filter']
|
||||
|
||||
endif
|
||||
else
|
||||
if world.prefidx == 0
|
||||
let world.prefidx = 1
|
||||
endif
|
||||
endif
|
||||
" TLogVAR world.idx, world.prefidx
|
||||
|
||||
" TLogDBG 7
|
||||
" TLogVAR world.prefidx, world.offset
|
||||
@ -301,12 +318,7 @@ function! tlib#input#ListW(world, ...) "{{{3
|
||||
" TLogDBG 8
|
||||
if world.initial_display || !tlib#char#IsAvailable()
|
||||
" TLogDBG len(dlist)
|
||||
if g:tlib_inputlist_shortmessage
|
||||
let query = 'Filter: '. world.DisplayFilter()
|
||||
else
|
||||
let query = world.query .' (filter: '. world.DisplayFilter() .'; press "?" for help)'
|
||||
endif
|
||||
call world.DisplayList(query, dlist)
|
||||
call world.DisplayList(world.Query(), dlist)
|
||||
call world.FollowCursor()
|
||||
let world.initial_display = 0
|
||||
" TLogDBG 9
|
||||
@ -320,7 +332,7 @@ function! tlib#input#ListW(world, ...) "{{{3
|
||||
" if world.state == 'scroll'
|
||||
" let world.prefidx = world.offset
|
||||
" endif
|
||||
call world.DisplayList('')
|
||||
call world.DisplayList()
|
||||
if world.state == 'help'
|
||||
let world.state = 'display'
|
||||
else
|
||||
@ -344,21 +356,31 @@ function! tlib#input#ListW(world, ...) "{{{3
|
||||
|
||||
" TLogVAR world.timeout
|
||||
let c = tlib#char#Get(world.timeout, world.timeout_resolution)
|
||||
" TLogVAR c, has_key(world.key_map[world.key_mode],c)
|
||||
" TLogDBG string(sort(keys(world.key_map[world.key_mode])))
|
||||
if world.state != ''
|
||||
" continue
|
||||
elseif has_key(key_agents, c)
|
||||
elseif has_key(world.key_map[world.key_mode], c)
|
||||
let sr = @/
|
||||
silent! let @/ = lastsearch
|
||||
" TLogVAR c, key_agents[c]
|
||||
" TLog "Agent: ". string(key_agents[c])
|
||||
let world = call(key_agents[c], [world, world.GetSelectedItems(world.CurrentItem())])
|
||||
" TLogVAR c, world.key_map[world.key_mode][c]
|
||||
" TLog "Agent: ". string(world.key_map[world.key_mode][c])
|
||||
let handler = world.key_map[world.key_mode][c]
|
||||
" TLogVAR handler
|
||||
let world = call(handler.agent, [world, world.GetSelectedItems(world.CurrentItem())])
|
||||
call s:CheckAgentReturnValue(c, world)
|
||||
silent! let @/ = sr
|
||||
" continue
|
||||
elseif c == 13
|
||||
throw 'pick'
|
||||
elseif c == 27
|
||||
let world.state = 'exit empty'
|
||||
" TLogVAR c, world.key_mode
|
||||
if world.key_mode != 'default'
|
||||
let world.key_mode = 'default'
|
||||
let world.state = 'redisplay'
|
||||
else
|
||||
let world.state = 'exit empty'
|
||||
endif
|
||||
elseif c == "\<LeftMouse>"
|
||||
let world.prefidx = world.GetLineIdx(v:mouse_lnum)
|
||||
" let world.offset = world.prefidx
|
||||
@ -371,12 +393,12 @@ function! tlib#input#ListW(world, ...) "{{{3
|
||||
endif
|
||||
throw 'pick'
|
||||
elseif c == "\<RightMouse>"
|
||||
if has('menu')
|
||||
if g:tlib#input#use_popup && world.has_menu
|
||||
" if v:mouse_lnum != line('.')
|
||||
" endif
|
||||
let world.prefidx = world.GetLineIdx(v:mouse_lnum)
|
||||
let world.state = 'redisplay'
|
||||
call world.DisplayList('')
|
||||
call world.DisplayList()
|
||||
if line('w$') - v:mouse_lnum < 6
|
||||
popup ]TLibInputListPopupMenu
|
||||
else
|
||||
@ -386,6 +408,9 @@ function! tlib#input#ListW(world, ...) "{{{3
|
||||
let world.state = 'redisplay'
|
||||
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])
|
||||
elseif c >= 32
|
||||
let world.state = 'display'
|
||||
let numbase = get(world.numeric_chars, c, -99999)
|
||||
@ -526,8 +551,10 @@ function! tlib#input#ListW(world, ...) "{{{3
|
||||
" let &l:statusline = statusline
|
||||
" let &laststatus = laststatus
|
||||
silent! let @/ = lastsearch
|
||||
if has('menu') && world.has_menu
|
||||
let &l:scrolloff = scrolloff
|
||||
if g:tlib#input#use_popup && world.has_menu
|
||||
silent! aunmenu ]TLibInputListPopupMenu
|
||||
let world.has_menu = 0
|
||||
endif
|
||||
|
||||
" TLogDBG 'finally 2'
|
||||
@ -568,6 +595,7 @@ endf
|
||||
|
||||
function! s:Init(world, cmd) "{{{3
|
||||
" TLogVAR a:cmd
|
||||
let a:world.initial_display = 1
|
||||
if a:cmd =~ '\<sticky\>'
|
||||
let a:world.sticky = 1
|
||||
endif
|
||||
@ -582,15 +610,117 @@ function! s:Init(world, cmd) "{{{3
|
||||
endif
|
||||
elseif !a:world.initialized
|
||||
" 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.Initialize()
|
||||
if !has_key(a:world, 'key_mode')
|
||||
let a:world.key_mode = 'default'
|
||||
endif
|
||||
" TLogVAR has_key(a:world,'key_map')
|
||||
if has_key(a:world, 'key_map')
|
||||
" TLogVAR has_key(a:world.key_map,a:world.key_mode)
|
||||
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),
|
||||
\ 'keep')
|
||||
else
|
||||
let a:world.key_map[a:world.key_mode] = copy(g:tlib_keyagents_InputList_s)
|
||||
endif
|
||||
else
|
||||
let a:world.key_map = {
|
||||
\ a:world.key_mode : copy(g:tlib_keyagents_InputList_s)
|
||||
\ }
|
||||
endif
|
||||
if stridx(a:world.type, 'm') != -1
|
||||
call extend(a:world.key_map[a:world.key_mode], g:tlib_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}')
|
||||
endfor
|
||||
if type(a:world.key_handlers) == 3
|
||||
call s:ExtendKeyMap(a:world, a:world.key_mode, a:world.key_handlers)
|
||||
elseif type(a:world.key_handlers) == 4
|
||||
for [world_key_mode, world_key_handlers] in items(a:world.key_handlers)
|
||||
call s:ExtendKeyMap(a:world, world_key_mode, world_key_handlers)
|
||||
endfor
|
||||
else
|
||||
throw "tlib#input#ListW: key_handlers must be either a list or a dictionary"
|
||||
endif
|
||||
if !empty(a:cmd)
|
||||
let a:world.state .= ' '. a:cmd
|
||||
endif
|
||||
endif
|
||||
call s:BuildMenu(a:world)
|
||||
" TLogVAR a:world.state, a:world.sticky
|
||||
endf
|
||||
|
||||
|
||||
function! s:ExtendKeyMap(world, key_mode, key_handlers) "{{{3
|
||||
for handler in a:key_handlers
|
||||
let k = get(handler, 'key', '')
|
||||
if !empty(k)
|
||||
let a:world.key_map[a:key_mode][k] = handler
|
||||
endif
|
||||
endfor
|
||||
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
|
||||
for [key_mode, key_handlers] in items(a:world.key_map)
|
||||
let keys = sort(keys(key_handlers))
|
||||
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
|
||||
else
|
||||
exec 'amenu ]TLibInputListPopupMenu'.
|
||||
\ '.'. escape(key_mode, ' .\')
|
||||
\ '.'. escape(handler.help, ' .\')
|
||||
\ .' '. handler.key_name
|
||||
endif
|
||||
endif
|
||||
endfor
|
||||
endfor
|
||||
endif
|
||||
endf
|
||||
|
||||
|
||||
function! s:RunStateHandlers(world) "{{{3
|
||||
" Provide the variable "world" in the environment of an "exec"
|
||||
" handler (ea).
|
||||
let world = a:world
|
||||
for handler in a:world.state_handlers
|
||||
let eh = get(handler, 'state', '')
|
||||
if !empty(eh) && a:world.state =~ eh
|
||||
let ea = get(handler, 'exec', '')
|
||||
if !empty(ea)
|
||||
exec ea
|
||||
else
|
||||
let agent = get(handler, 'agent', '')
|
||||
let a:world = call(agent, [a:world, a:world.GetSelectedItems(a:world.CurrentItem())])
|
||||
call s:CheckAgentReturnValue(agent, a:world)
|
||||
endif
|
||||
endif
|
||||
endfor
|
||||
endf
|
||||
|
||||
|
||||
function! s:CheckAgentReturnValue(name, value) "{{{3
|
||||
if type(a:value) != 4 && !has_key(a:value, 'state')
|
||||
echoerr 'Malformed agent: '. a:name
|
||||
@ -599,6 +729,17 @@ function! s:CheckAgentReturnValue(name, value) "{{{3
|
||||
endf
|
||||
|
||||
|
||||
function! s:SetOffset(world) "{{{3
|
||||
let llenw = len(a:world.base) - winheight(0) + 1
|
||||
if a:world.offset > llenw
|
||||
let a:world.offset = llenw
|
||||
endif
|
||||
if a:world.offset < 1
|
||||
let a:world.offset = 1
|
||||
endif
|
||||
endf
|
||||
|
||||
|
||||
" Functions related to tlib#input#EditList(type, ...) "{{{2
|
||||
|
||||
" :def: function! tlib#input#EditList(query, list, ?timeout=0)
|
||||
@ -622,26 +763,47 @@ function! tlib#input#EditList(query, list, ...) "{{{3
|
||||
endf
|
||||
|
||||
|
||||
function! tlib#input#Resume(name, pick) "{{{3
|
||||
function! tlib#input#Resume(name, pick, bufnr) "{{{3
|
||||
" TLogVAR a:name, a:pick
|
||||
echo
|
||||
if exists('b:tlib_suspend')
|
||||
for [m, pick] in items(b:tlib_suspend)
|
||||
exec 'unmap <buffer> '. m
|
||||
endfor
|
||||
unlet b:tlib_suspend
|
||||
if bufnr('%') != a:bufnr
|
||||
if g:tlib_debug
|
||||
echohl WarningMsg
|
||||
echom "tlib#input#Resume: Internal error: Not in scratch buffer:" bufname('%')
|
||||
echohl NONE
|
||||
endif
|
||||
let br = tlib#buffer#Set(a:bufnr)
|
||||
endif
|
||||
call tlib#autocmdgroup#Init()
|
||||
autocmd! TLib InsertEnter,InsertChange <buffer>
|
||||
let b:tlib_{a:name}.state = 'display'
|
||||
" call tlib#input#List('resume '. a:name)
|
||||
let cmd = 'resume '. a:name
|
||||
if a:pick >= 1
|
||||
let cmd .= ' pick'
|
||||
if a:pick >= 2
|
||||
let cmd .= ' sticky'
|
||||
end
|
||||
if !exists('b:tlib_'. a:name)
|
||||
if g:tlib_debug
|
||||
echohl WarningMsg
|
||||
echom "tlib#input#Resume: Internal error: b:tlib_". a:name ." does not exist:" bufname('%')
|
||||
echohl NONE
|
||||
redir => varss
|
||||
silent let b:
|
||||
redir END
|
||||
let vars = split(varss, '\n')
|
||||
call filter(vars, 'v:val =~ "^b:tlib_"')
|
||||
echom "DEBUG tlib#input#Resume" string(vars)
|
||||
endif
|
||||
else
|
||||
call tlib#autocmdgroup#Init()
|
||||
autocmd! TLib BufEnter <buffer>
|
||||
if b:tlib_{a:name}.state =~ '\<suspend\>'
|
||||
let b:tlib_{a:name}.state = 'redisplay'
|
||||
else
|
||||
let b:tlib_{a:name}.state .= ' redisplay'
|
||||
endif
|
||||
" call tlib#input#List('resume '. a:name)
|
||||
let cmd = 'resume '. a:name
|
||||
if a:pick >= 1
|
||||
let cmd .= ' pick'
|
||||
if a:pick >= 2
|
||||
let cmd .= ' sticky'
|
||||
end
|
||||
endif
|
||||
call tlib#input#ListW(b:tlib_{a:name}, cmd)
|
||||
endif
|
||||
call tlib#input#ListW(b:tlib_{a:name}, cmd)
|
||||
endf
|
||||
|
||||
|
||||
|
@ -3,16 +3,17 @@
|
||||
" @Website: http://www.vim.org/account/profile.php?user_id=4037
|
||||
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
||||
" @Created: 2008-09-19.
|
||||
" @Last Change: 2011-03-10.
|
||||
" @Revision: 0.0.15
|
||||
" @Last Change: 2012-01-02.
|
||||
" @Revision: 0.0.19
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
|
||||
" :display: tlib#notify#Echo(text, ?style='')
|
||||
" Print text in the echo area. Temporarily disable 'ruler' and 'showcmd'
|
||||
" in order to prevent |press-enter| messages.
|
||||
function! tlib#notify#Echo(text, ...) "{{{3
|
||||
function! tlib#notify#Echo(text, ...)
|
||||
TVarArg 'style'
|
||||
let ruler = &ruler
|
||||
let showcmd = &showcmd
|
||||
|
47
sources_non_forked/tlib/autoload/tlib/persistent.vim
Normal file
47
sources_non_forked/tlib/autoload/tlib/persistent.vim
Normal file
@ -0,0 +1,47 @@
|
||||
" persistent.vim -- Persistent data
|
||||
" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim])
|
||||
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
||||
" @Created: 2012-05-11.
|
||||
" @Last Change: 2012-05-11.
|
||||
" @Revision: 6
|
||||
|
||||
" The directory for persistent data files. If empty, use
|
||||
" |tlib#dir#MyRuntime|.'/share'.
|
||||
TLet g:tlib_persistent = ''
|
||||
|
||||
|
||||
" :display: tlib#persistent#Dir(?mode = 'bg')
|
||||
" Return the full directory name for persistent data files.
|
||||
function! tlib#persistent#Dir() "{{{3
|
||||
TVarArg ['mode', 'bg']
|
||||
let dir = tlib#var#Get('tlib_persistent', mode)
|
||||
if empty(dir)
|
||||
let dir = tlib#file#Join([tlib#dir#MyRuntime(), 'share'])
|
||||
endif
|
||||
return dir
|
||||
endf
|
||||
|
||||
" :def: function! tlib#persistent#Filename(type, ?file=%, ?mkdir=0)
|
||||
function! tlib#persistent#Filename(type, ...) "{{{3
|
||||
" TLogDBG 'bufname='. bufname('.')
|
||||
let file = a:0 >= 1 ? a:1 : ''
|
||||
let mkdir = a:0 >= 2 ? a:2 : 0
|
||||
return tlib#cache#Filename(a:type, file, mkdir, tlib#persistent#Dir())
|
||||
endf
|
||||
|
||||
function! tlib#persistent#Get(cfile) "{{{3
|
||||
if !empty(a:cfile) && filereadable(a:cfile)
|
||||
let val = readfile(a:cfile, 'b')
|
||||
return eval(join(val, "\n"))
|
||||
else
|
||||
return {}
|
||||
endif
|
||||
endf
|
||||
|
||||
function! tlib#persistent#Save(cfile, dictionary) "{{{3
|
||||
if !empty(a:cfile)
|
||||
" TLogVAR a:dictionary
|
||||
call writefile([string(a:dictionary)], a:cfile, 'b')
|
||||
endif
|
||||
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-07-18.
|
||||
" @Last Change: 2011-03-10.
|
||||
" @Revision: 0.0.166
|
||||
" @Last Change: 2012-02-08.
|
||||
" @Revision: 0.0.167
|
||||
|
||||
if &cp || exists("loaded_tlib_scratch_autoload")
|
||||
finish
|
||||
@ -29,7 +29,7 @@ function! tlib#scratch#UseScratch(...) "{{{3
|
||||
" TLogDBG bufnr('%')
|
||||
if id =~ '^\d\+$' && bufwinnr(id) != -1
|
||||
if bufnr('%') != id
|
||||
exec 'buffer! '. id
|
||||
exec 'noautocmd buffer! '. id
|
||||
endif
|
||||
" let ft = &ft
|
||||
let ft = '*'
|
||||
@ -47,29 +47,29 @@ function! tlib#scratch#UseScratch(...) "{{{3
|
||||
let wn = bufwinnr(bn)
|
||||
if wn != -1
|
||||
" TLogVAR wn
|
||||
exec wn .'wincmd w'
|
||||
exec 'noautocmd' (wn .'wincmd w')
|
||||
else
|
||||
if scratch_split == 1
|
||||
let cmd = wpos.' sbuffer! '
|
||||
let cmd = wpos.' sbuffer!'
|
||||
elseif scratch_split == -1
|
||||
let cmd = wpos.' tab sbuffer! '
|
||||
let cmd = wpos.' tab sbuffer!'
|
||||
else
|
||||
let cmd = 'buffer! '
|
||||
let cmd = 'buffer!'
|
||||
endif
|
||||
" TLogVAR cmd
|
||||
silent exec cmd . bn
|
||||
silent exec 'noautocmd' cmd bn
|
||||
endif
|
||||
else
|
||||
" TLogVAR id
|
||||
if scratch_split == 1
|
||||
let cmd = wpos.' split '
|
||||
let cmd = wpos.' split'
|
||||
elseif scratch_split == -1
|
||||
let cmd = wpos.' tab split '
|
||||
let cmd = wpos.' tab split'
|
||||
else
|
||||
let cmd = 'edit '
|
||||
let cmd = 'edit'
|
||||
endif
|
||||
" TLogVAR cmd
|
||||
silent exec cmd . escape(id, '%#\ ')
|
||||
silent exec 'noautocmd' cmd escape(id, '%#\ ')
|
||||
" silent exec 'split '. id
|
||||
endif
|
||||
let ft = get(keyargs, 'scratch_filetype', '')
|
||||
|
@ -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-03-10.
|
||||
" @Revision: 0.0.53
|
||||
" @Last Change: 2011-08-11.
|
||||
" @Revision: 0.0.56
|
||||
|
||||
if &cp || exists("loaded_tlib_tag_autoload")
|
||||
finish
|
||||
@ -38,6 +38,7 @@ let loaded_tlib_tag_autoload = 1
|
||||
" < tags from the JDK will be included.
|
||||
function! tlib#tag#Retrieve(rx, ...) "{{{3
|
||||
TVarArg ['extra_tags', 0]
|
||||
" TLogVAR a:rx, extra_tags
|
||||
if extra_tags
|
||||
let tags_orig = &l:tags
|
||||
if empty(tags_orig)
|
||||
|
155
sources_non_forked/tlib/autoload/tlib/vcs.vim
Normal file
155
sources_non_forked/tlib/autoload/tlib/vcs.vim
Normal file
@ -0,0 +1,155 @@
|
||||
" vcs.vim
|
||||
" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim])
|
||||
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
||||
" @Created: 2012-03-08.
|
||||
" @Last Change: 2012-09-10.
|
||||
" @Revision: 122
|
||||
|
||||
|
||||
" A dictionarie of supported VCS (currently: git, hg, svn, bzr).
|
||||
" :display: g:tlib#vcs#def {...}
|
||||
TLet g:tlib#vcs#def = {
|
||||
\ 'git': {
|
||||
\ 'dir': '.git',
|
||||
\ 'ls': 'git ls-files --full-name %s',
|
||||
\ 'diff': 'git diff --no-ext-diff -U0 %s'
|
||||
\ },
|
||||
\ 'hg': {
|
||||
\ 'dir': '.hg',
|
||||
\ 'diff': 'hg diff -U0 %s',
|
||||
\ 'ls': 'hg manifest'
|
||||
\ },
|
||||
\ 'svn': {
|
||||
\ 'dir': '.svn',
|
||||
\ 'diff': 'svn diff --diff-cmd diff --extensions -U0 %s',
|
||||
\ },
|
||||
\ 'bzr': {
|
||||
\ 'dir': '.bzr',
|
||||
\ 'diff': 'bzr diff --diff-options=-U0 %s',
|
||||
\ }
|
||||
\ }
|
||||
|
||||
|
||||
" A dictionary of custom executables for VCS commands. If the value is
|
||||
" empty, support for that VCS will be removed. If no key is present, it
|
||||
" is assumed that the VCS "type" is the name of the executable.
|
||||
" :display: g:tlib#vcs#executables {...}
|
||||
TLet g:tlib#vcs#executables = {}
|
||||
|
||||
|
||||
" If non-empty, use it as a format string to check whether a VCS is
|
||||
" installed on your computer.
|
||||
TLet g:tlib#vcs#check = has('win16') || has('win32') || has('win64') ? '%s.exe' : '%s'
|
||||
|
||||
|
||||
if !empty(g:tlib#vcs#check)
|
||||
for [s:cmd, s:def] in items(g:tlib#vcs#def)
|
||||
if !has_key(g:tlib#vcs#executables, s:cmd)
|
||||
let s:cmd1 = printf(g:tlib#vcs#check, s:cmd)
|
||||
let g:tlib#vcs#executables[s:cmd] = executable(s:cmd1) ? s:cmd1 : ''
|
||||
endif
|
||||
endfor
|
||||
endif
|
||||
|
||||
|
||||
function! tlib#vcs#FindVCS(filename) "{{{3
|
||||
let type = ''
|
||||
let dir = ''
|
||||
" let path = escape(fnamemodify(a:filename, ':p'), ',:') .';'
|
||||
let filename = fnamemodify(a:filename, isdirectory(a:filename) ? ':p:h' : ':p')
|
||||
let path = escape(filename, ';') .';'
|
||||
" TLogVAR a:filename, path
|
||||
let depth = -1
|
||||
for vcs in keys(g:tlib#vcs#def)
|
||||
let subdir = g:tlib#vcs#def[vcs].dir
|
||||
let vcsdir = finddir(subdir, path)
|
||||
" TLogVAR vcs, subdir, vcsdir
|
||||
if !empty(vcsdir)
|
||||
let vcsdir_depth = len(split(fnamemodify(vcsdir, ':p'), '\/'))
|
||||
if vcsdir_depth > depth
|
||||
let depth = vcsdir_depth
|
||||
let type = vcs
|
||||
let dir = vcsdir
|
||||
" TLogVAR type, depth
|
||||
endif
|
||||
endif
|
||||
endfor
|
||||
" TLogVAR type, dir
|
||||
if empty(type)
|
||||
return ['', '']
|
||||
else
|
||||
return [type, dir]
|
||||
endif
|
||||
endf
|
||||
|
||||
|
||||
function! s:GetCmd(vcstype, cmd)
|
||||
let vcsdef = get(g:tlib#vcs#def, a:vcstype, {})
|
||||
if has_key(vcsdef, a:cmd)
|
||||
let cmd = vcsdef[a:cmd]
|
||||
let bin = get(g:tlib#vcs#executables, a:vcstype, '')
|
||||
if empty(bin)
|
||||
let cmd = ''
|
||||
elseif bin != a:vcstype
|
||||
" let bin = escape(shellescape(bin), '\')
|
||||
let bin = escape(bin, '\')
|
||||
let cmd = substitute(cmd, '^.\{-}\zs'. escape(a:vcstype, '\'), bin, '')
|
||||
endif
|
||||
return cmd
|
||||
else
|
||||
return ''
|
||||
endif
|
||||
endf
|
||||
|
||||
|
||||
" :display: tlib#vcs#Ls(?filename=bufname('%'), ?vcs=[type, dir])
|
||||
" Return the files under VCS.
|
||||
function! tlib#vcs#Ls(...) "{{{3
|
||||
if a:0 >= 2
|
||||
let vcs = a:2
|
||||
else
|
||||
let vcs = tlib#vcs#FindVCS(a:0 >= 1 ? a:1 : bufname('%'))
|
||||
endif
|
||||
" TLogVAR vcs
|
||||
if !empty(vcs)
|
||||
let [vcstype, vcsdir] = vcs
|
||||
if has_key(g:tlib#vcs#def, vcstype)
|
||||
let ls = s:GetCmd(vcstype, 'ls')
|
||||
" TLogVAR ls
|
||||
if !empty(ls)
|
||||
let rootdir = fnamemodify(vcsdir, ':p:h:h')
|
||||
" TLogVAR vcsdir, rootdir
|
||||
if ls =~ '%s'
|
||||
let cmd = printf(ls, shellescape(rootdir))
|
||||
else
|
||||
let cmd = ls
|
||||
endif
|
||||
" TLogVAR cmd
|
||||
let filess = system(cmd)
|
||||
" TLogVAR filess
|
||||
let files = split(filess, '\n')
|
||||
call map(files, 'join([rootdir, v:val], "/")')
|
||||
return files
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
return []
|
||||
endf
|
||||
|
||||
|
||||
" :display: tlib#vcs#Diff(filename, ?vcs=[type, dir])
|
||||
" Return the diff for "filename"
|
||||
function! tlib#vcs#Diff(filename, ...) "{{{3
|
||||
let vcs = a:0 >= 1 ? a:1 : tlib#vcs#FindVCS(a:filename)
|
||||
if !empty(vcs)
|
||||
let [vcstype, vcsdir] = vcs
|
||||
let diff = s:GetCmd(vcstype, 'diff')
|
||||
if !empty(diff)
|
||||
let cmd = printf(diff, shellescape(fnamemodify(a:filename, ':p')))
|
||||
let patch = system(cmd)
|
||||
return patch
|
||||
endif
|
||||
endif
|
||||
return []
|
||||
endf
|
||||
|
@ -3,8 +3,8 @@
|
||||
" @GIT: http://github.com/tomtom/tlib_vim/
|
||||
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
||||
" @Created: 2010-07-19.
|
||||
" @Last Change: 2010-10-24.
|
||||
" @Revision: 24
|
||||
" @Last Change: 2012-06-08.
|
||||
" @Revision: 35
|
||||
|
||||
|
||||
let s:restoreframecmd = ''
|
||||
@ -13,14 +13,22 @@ let s:fullscreen = 0
|
||||
if has('win16') || has('win32') || has('win64')
|
||||
|
||||
if !exists('g:tlib#vim#simalt_maximize')
|
||||
" The alt-key for maximizing the window.
|
||||
" CAUTION: The value of this paramter depends on your locale and
|
||||
" maybe the windows version you are running.
|
||||
let g:tlib#vim#simalt_maximize = 'x' "{{{2
|
||||
endif
|
||||
|
||||
if !exists('g:tlib#vim#simalt_restore')
|
||||
" The alt-key for restoring the window.
|
||||
" CAUTION: The value of this paramter depends on your locale and
|
||||
" maybe the windows version you are running.
|
||||
let g:tlib#vim#simalt_restore = 'r' "{{{2
|
||||
endif
|
||||
|
||||
if !exists('g:tlib#vim#use_vimtweak')
|
||||
" If true, use the vimtweak.dll for windows. This will enable
|
||||
" tlib to remove the caption for fullscreen windows.
|
||||
let g:tlib#vim#use_vimtweak = 0 "{{{2
|
||||
endif
|
||||
|
||||
@ -54,6 +62,13 @@ if has('win16') || has('win32') || has('win64')
|
||||
else
|
||||
|
||||
if !exists('g:tlib#vim#use_wmctrl')
|
||||
" If true, use wmctrl for X windows to make a window
|
||||
" maximized/fullscreen.
|
||||
"
|
||||
" This is the preferred method for maximizing windows under X
|
||||
" windows. Some window managers have problem coping with the
|
||||
" default method of setting 'lines' and 'columns' to a large
|
||||
" value.
|
||||
let g:tlib#vim#use_wmctrl = executable('wmctrl') "{{{2
|
||||
endif
|
||||
|
||||
|
252
sources_non_forked/tlib/doc/tags
Normal file
252
sources_non_forked/tlib/doc/tags
Normal file
@ -0,0 +1,252 @@
|
||||
:TBrowseOutput tlib.txt /*:TBrowseOutput*
|
||||
:TBrowseScriptnames tlib.txt /*:TBrowseScriptnames*
|
||||
:TKeyArg tlib.txt /*:TKeyArg*
|
||||
:TLet tlib.txt /*:TLet*
|
||||
:TRequire tlib.txt /*:TRequire*
|
||||
:TScratch tlib.txt /*:TScratch*
|
||||
:TTimeCommand tlib.txt /*:TTimeCommand*
|
||||
:TVarArg tlib.txt /*:TVarArg*
|
||||
g:tlib#Filter_cnfx#expander tlib.txt /*g:tlib#Filter_cnfx#expander*
|
||||
g:tlib#cache#dont_purge tlib.txt /*g:tlib#cache#dont_purge*
|
||||
g:tlib#cache#purge_days tlib.txt /*g:tlib#cache#purge_days*
|
||||
g:tlib#cache#purge_every_days tlib.txt /*g:tlib#cache#purge_every_days*
|
||||
g:tlib#cache#run_script tlib.txt /*g:tlib#cache#run_script*
|
||||
g:tlib#cache#script_encoding tlib.txt /*g:tlib#cache#script_encoding*
|
||||
g:tlib#cache#silent tlib.txt /*g:tlib#cache#silent*
|
||||
g:tlib#input#filename_max_width tlib.txt /*g:tlib#input#filename_max_width*
|
||||
g:tlib#input#filename_padding_r tlib.txt /*g:tlib#input#filename_padding_r*
|
||||
g:tlib#input#format_filename tlib.txt /*g:tlib#input#format_filename*
|
||||
g:tlib#input#use_popup tlib.txt /*g:tlib#input#use_popup*
|
||||
g:tlib#vcs#check tlib.txt /*g:tlib#vcs#check*
|
||||
g:tlib#vcs#def tlib.txt /*g:tlib#vcs#def*
|
||||
g:tlib#vcs#executables tlib.txt /*g:tlib#vcs#executables*
|
||||
g:tlib#vim#simalt_maximize tlib.txt /*g:tlib#vim#simalt_maximize*
|
||||
g:tlib#vim#simalt_restore tlib.txt /*g:tlib#vim#simalt_restore*
|
||||
g:tlib#vim#use_vimtweak tlib.txt /*g:tlib#vim#use_vimtweak*
|
||||
g:tlib#vim#use_wmctrl tlib.txt /*g:tlib#vim#use_wmctrl*
|
||||
g:tlib_cache tlib.txt /*g:tlib_cache*
|
||||
g:tlib_debug tlib.txt /*g:tlib_debug*
|
||||
g:tlib_filename_sep tlib.txt /*g:tlib_filename_sep*
|
||||
g:tlib_handlers_EditList tlib.txt /*g:tlib_handlers_EditList*
|
||||
g:tlib_inputlist_and tlib.txt /*g:tlib_inputlist_and*
|
||||
g:tlib_inputlist_filename_indicators tlib.txt /*g:tlib_inputlist_filename_indicators*
|
||||
g:tlib_inputlist_higroup tlib.txt /*g:tlib_inputlist_higroup*
|
||||
g:tlib_inputlist_livesearch_threshold tlib.txt /*g:tlib_inputlist_livesearch_threshold*
|
||||
g:tlib_inputlist_match tlib.txt /*g:tlib_inputlist_match*
|
||||
g:tlib_inputlist_not tlib.txt /*g:tlib_inputlist_not*
|
||||
g:tlib_inputlist_or tlib.txt /*g:tlib_inputlist_or*
|
||||
g:tlib_inputlist_pct tlib.txt /*g:tlib_inputlist_pct*
|
||||
g:tlib_inputlist_shortmessage tlib.txt /*g:tlib_inputlist_shortmessage*
|
||||
g:tlib_inputlist_width_filename tlib.txt /*g:tlib_inputlist_width_filename*
|
||||
g:tlib_keyagents_InputList_m tlib.txt /*g:tlib_keyagents_InputList_m*
|
||||
g:tlib_keyagents_InputList_s tlib.txt /*g:tlib_keyagents_InputList_s*
|
||||
g:tlib_numeric_chars tlib.txt /*g:tlib_numeric_chars*
|
||||
g:tlib_persistent tlib.txt /*g:tlib_persistent*
|
||||
g:tlib_pick_last_item tlib.txt /*g:tlib_pick_last_item*
|
||||
g:tlib_scratch_pos tlib.txt /*g:tlib_scratch_pos*
|
||||
g:tlib_scroll_lines tlib.txt /*g:tlib_scroll_lines*
|
||||
g:tlib_sortprefs_threshold tlib.txt /*g:tlib_sortprefs_threshold*
|
||||
g:tlib_tag_substitute tlib.txt /*g:tlib_tag_substitute*
|
||||
g:tlib_tags_extra tlib.txt /*g:tlib_tags_extra*
|
||||
g:tlib_viewline_position tlib.txt /*g:tlib_viewline_position*
|
||||
o_sp tlib.txt /*o_sp*
|
||||
standard-paragraph tlib.txt /*standard-paragraph*
|
||||
tlib#Filter_cnf#New() tlib.txt /*tlib#Filter_cnf#New()*
|
||||
tlib#Filter_cnfd#New() tlib.txt /*tlib#Filter_cnfd#New()*
|
||||
tlib#Filter_cnfx#New() tlib.txt /*tlib#Filter_cnfx#New()*
|
||||
tlib#Filter_fuzzy#New() tlib.txt /*tlib#Filter_fuzzy#New()*
|
||||
tlib#Object#Methods() tlib.txt /*tlib#Object#Methods()*
|
||||
tlib#Object#New() tlib.txt /*tlib#Object#New()*
|
||||
tlib#World#New() tlib.txt /*tlib#World#New()*
|
||||
tlib#agent#AND() tlib.txt /*tlib#agent#AND()*
|
||||
tlib#agent#CompleteAgentNames() tlib.txt /*tlib#agent#CompleteAgentNames()*
|
||||
tlib#agent#Copy() tlib.txt /*tlib#agent#Copy()*
|
||||
tlib#agent#CopyItems() tlib.txt /*tlib#agent#CopyItems()*
|
||||
tlib#agent#Cut() tlib.txt /*tlib#agent#Cut()*
|
||||
tlib#agent#Debug() tlib.txt /*tlib#agent#Debug()*
|
||||
tlib#agent#DeleteItems() tlib.txt /*tlib#agent#DeleteItems()*
|
||||
tlib#agent#DoAtLine() tlib.txt /*tlib#agent#DoAtLine()*
|
||||
tlib#agent#Down() tlib.txt /*tlib#agent#Down()*
|
||||
tlib#agent#DownN() tlib.txt /*tlib#agent#DownN()*
|
||||
tlib#agent#EditFile() tlib.txt /*tlib#agent#EditFile()*
|
||||
tlib#agent#EditFileInSplit() tlib.txt /*tlib#agent#EditFileInSplit()*
|
||||
tlib#agent#EditFileInTab() tlib.txt /*tlib#agent#EditFileInTab()*
|
||||
tlib#agent#EditFileInVSplit() tlib.txt /*tlib#agent#EditFileInVSplit()*
|
||||
tlib#agent#EditItem() tlib.txt /*tlib#agent#EditItem()*
|
||||
tlib#agent#EditReturnValue() tlib.txt /*tlib#agent#EditReturnValue()*
|
||||
tlib#agent#ExecAgentByName() tlib.txt /*tlib#agent#ExecAgentByName()*
|
||||
tlib#agent#Exit() tlib.txt /*tlib#agent#Exit()*
|
||||
tlib#agent#GotoLine() tlib.txt /*tlib#agent#GotoLine()*
|
||||
tlib#agent#Help() tlib.txt /*tlib#agent#Help()*
|
||||
tlib#agent#Input() tlib.txt /*tlib#agent#Input()*
|
||||
tlib#agent#NewItem() tlib.txt /*tlib#agent#NewItem()*
|
||||
tlib#agent#Null() tlib.txt /*tlib#agent#Null()*
|
||||
tlib#agent#OR() tlib.txt /*tlib#agent#OR()*
|
||||
tlib#agent#PageDown() tlib.txt /*tlib#agent#PageDown()*
|
||||
tlib#agent#PageUp() tlib.txt /*tlib#agent#PageUp()*
|
||||
tlib#agent#Paste() tlib.txt /*tlib#agent#Paste()*
|
||||
tlib#agent#PopFilter() tlib.txt /*tlib#agent#PopFilter()*
|
||||
tlib#agent#PreviewLine() tlib.txt /*tlib#agent#PreviewLine()*
|
||||
tlib#agent#ReduceFilter() tlib.txt /*tlib#agent#ReduceFilter()*
|
||||
tlib#agent#Reset() tlib.txt /*tlib#agent#Reset()*
|
||||
tlib#agent#Select() tlib.txt /*tlib#agent#Select()*
|
||||
tlib#agent#SelectAll() tlib.txt /*tlib#agent#SelectAll()*
|
||||
tlib#agent#SelectDown() tlib.txt /*tlib#agent#SelectDown()*
|
||||
tlib#agent#SelectUp() tlib.txt /*tlib#agent#SelectUp()*
|
||||
tlib#agent#ShiftLeft() tlib.txt /*tlib#agent#ShiftLeft()*
|
||||
tlib#agent#ShiftRight() tlib.txt /*tlib#agent#ShiftRight()*
|
||||
tlib#agent#ShowInfo() tlib.txt /*tlib#agent#ShowInfo()*
|
||||
tlib#agent#Suspend() tlib.txt /*tlib#agent#Suspend()*
|
||||
tlib#agent#SuspendToParentWindow() tlib.txt /*tlib#agent#SuspendToParentWindow()*
|
||||
tlib#agent#ToggleScrollbind() tlib.txt /*tlib#agent#ToggleScrollbind()*
|
||||
tlib#agent#ToggleStickyList() tlib.txt /*tlib#agent#ToggleStickyList()*
|
||||
tlib#agent#Up() tlib.txt /*tlib#agent#Up()*
|
||||
tlib#agent#UpN() tlib.txt /*tlib#agent#UpN()*
|
||||
tlib#agent#ViewFile() tlib.txt /*tlib#agent#ViewFile()*
|
||||
tlib#agent#Wildcard() tlib.txt /*tlib#agent#Wildcard()*
|
||||
tlib#arg#Ex() tlib.txt /*tlib#arg#Ex()*
|
||||
tlib#arg#Get() tlib.txt /*tlib#arg#Get()*
|
||||
tlib#arg#Key() tlib.txt /*tlib#arg#Key()*
|
||||
tlib#arg#Let() tlib.txt /*tlib#arg#Let()*
|
||||
tlib#arg#StringAsKeyArgs() tlib.txt /*tlib#arg#StringAsKeyArgs()*
|
||||
tlib#autocmdgroup#Init() tlib.txt /*tlib#autocmdgroup#Init()*
|
||||
tlib#balloon#Expr() tlib.txt /*tlib#balloon#Expr()*
|
||||
tlib#balloon#Register() tlib.txt /*tlib#balloon#Register()*
|
||||
tlib#balloon#Remove() tlib.txt /*tlib#balloon#Remove()*
|
||||
tlib#buffer#BufDo() tlib.txt /*tlib#buffer#BufDo()*
|
||||
tlib#buffer#CurrentByte() tlib.txt /*tlib#buffer#CurrentByte()*
|
||||
tlib#buffer#DeleteRange() tlib.txt /*tlib#buffer#DeleteRange()*
|
||||
tlib#buffer#DisableMRU() tlib.txt /*tlib#buffer#DisableMRU()*
|
||||
tlib#buffer#EnableMRU() tlib.txt /*tlib#buffer#EnableMRU()*
|
||||
tlib#buffer#Eval() tlib.txt /*tlib#buffer#Eval()*
|
||||
tlib#buffer#GetList() tlib.txt /*tlib#buffer#GetList()*
|
||||
tlib#buffer#HighlightLine() tlib.txt /*tlib#buffer#HighlightLine()*
|
||||
tlib#buffer#InsertText() tlib.txt /*tlib#buffer#InsertText()*
|
||||
tlib#buffer#InsertText0() tlib.txt /*tlib#buffer#InsertText0()*
|
||||
tlib#buffer#KeepCursorPosition() tlib.txt /*tlib#buffer#KeepCursorPosition()*
|
||||
tlib#buffer#ReplaceRange() tlib.txt /*tlib#buffer#ReplaceRange()*
|
||||
tlib#buffer#ScratchEnd() tlib.txt /*tlib#buffer#ScratchEnd()*
|
||||
tlib#buffer#ScratchStart() tlib.txt /*tlib#buffer#ScratchStart()*
|
||||
tlib#buffer#Set() tlib.txt /*tlib#buffer#Set()*
|
||||
tlib#buffer#ViewLine() tlib.txt /*tlib#buffer#ViewLine()*
|
||||
tlib#cache#Dir() tlib.txt /*tlib#cache#Dir()*
|
||||
tlib#cache#Filename() tlib.txt /*tlib#cache#Filename()*
|
||||
tlib#cache#Get() tlib.txt /*tlib#cache#Get()*
|
||||
tlib#cache#ListFilesInCache() tlib.txt /*tlib#cache#ListFilesInCache()*
|
||||
tlib#cache#MaybePurge() tlib.txt /*tlib#cache#MaybePurge()*
|
||||
tlib#cache#Purge() tlib.txt /*tlib#cache#Purge()*
|
||||
tlib#cache#Save() tlib.txt /*tlib#cache#Save()*
|
||||
tlib#char#Get() tlib.txt /*tlib#char#Get()*
|
||||
tlib#char#GetWithTimeout() tlib.txt /*tlib#char#GetWithTimeout()*
|
||||
tlib#char#IsAvailable() tlib.txt /*tlib#char#IsAvailable()*
|
||||
tlib#cmd#BrowseOutput() tlib.txt /*tlib#cmd#BrowseOutput()*
|
||||
tlib#cmd#BrowseOutputWithCallback() tlib.txt /*tlib#cmd#BrowseOutputWithCallback()*
|
||||
tlib#cmd#DefaultBrowseOutput() tlib.txt /*tlib#cmd#DefaultBrowseOutput()*
|
||||
tlib#cmd#OutputAsList() tlib.txt /*tlib#cmd#OutputAsList()*
|
||||
tlib#cmd#ParseScriptname() tlib.txt /*tlib#cmd#ParseScriptname()*
|
||||
tlib#cmd#Time() tlib.txt /*tlib#cmd#Time()*
|
||||
tlib#cmd#UseVertical() tlib.txt /*tlib#cmd#UseVertical()*
|
||||
tlib#comments#Comments() tlib.txt /*tlib#comments#Comments()*
|
||||
tlib#date#DiffInDays() tlib.txt /*tlib#date#DiffInDays()*
|
||||
tlib#date#Parse() tlib.txt /*tlib#date#Parse()*
|
||||
tlib#date#SecondsSince1970() tlib.txt /*tlib#date#SecondsSince1970()*
|
||||
tlib#dir#CD() tlib.txt /*tlib#dir#CD()*
|
||||
tlib#dir#CanonicName() tlib.txt /*tlib#dir#CanonicName()*
|
||||
tlib#dir#Ensure() tlib.txt /*tlib#dir#Ensure()*
|
||||
tlib#dir#MyRuntime() tlib.txt /*tlib#dir#MyRuntime()*
|
||||
tlib#dir#PlainName() tlib.txt /*tlib#dir#PlainName()*
|
||||
tlib#dir#Pop() tlib.txt /*tlib#dir#Pop()*
|
||||
tlib#dir#Push() tlib.txt /*tlib#dir#Push()*
|
||||
tlib#eval#FormatValue() tlib.txt /*tlib#eval#FormatValue()*
|
||||
tlib#file#Join() tlib.txt /*tlib#file#Join()*
|
||||
tlib#file#Relative() tlib.txt /*tlib#file#Relative()*
|
||||
tlib#file#Split() tlib.txt /*tlib#file#Split()*
|
||||
tlib#file#With() tlib.txt /*tlib#file#With()*
|
||||
tlib#hook#Run() tlib.txt /*tlib#hook#Run()*
|
||||
tlib#input#CommandSelect() tlib.txt /*tlib#input#CommandSelect()*
|
||||
tlib#input#Dialog() tlib.txt /*tlib#input#Dialog()*
|
||||
tlib#input#Edit() tlib.txt /*tlib#input#Edit()*
|
||||
tlib#input#EditList() tlib.txt /*tlib#input#EditList()*
|
||||
tlib#input#List() tlib.txt /*tlib#input#List()*
|
||||
tlib#input#ListD() tlib.txt /*tlib#input#ListD()*
|
||||
tlib#input#ListW() tlib.txt /*tlib#input#ListW()*
|
||||
tlib#input#Resume() tlib.txt /*tlib#input#Resume()*
|
||||
tlib#list#All() tlib.txt /*tlib#list#All()*
|
||||
tlib#list#Any() tlib.txt /*tlib#list#Any()*
|
||||
tlib#list#Compact() tlib.txt /*tlib#list#Compact()*
|
||||
tlib#list#Find() tlib.txt /*tlib#list#Find()*
|
||||
tlib#list#FindAll() tlib.txt /*tlib#list#FindAll()*
|
||||
tlib#list#Flatten() tlib.txt /*tlib#list#Flatten()*
|
||||
tlib#list#Inject() tlib.txt /*tlib#list#Inject()*
|
||||
tlib#list#Remove() tlib.txt /*tlib#list#Remove()*
|
||||
tlib#list#RemoveAll() tlib.txt /*tlib#list#RemoveAll()*
|
||||
tlib#list#Uniq() tlib.txt /*tlib#list#Uniq()*
|
||||
tlib#list#Zip() tlib.txt /*tlib#list#Zip()*
|
||||
tlib#map#PumAccept() tlib.txt /*tlib#map#PumAccept()*
|
||||
tlib#normal#WithRegister() tlib.txt /*tlib#normal#WithRegister()*
|
||||
tlib#notify#Echo() tlib.txt /*tlib#notify#Echo()*
|
||||
tlib#notify#TrimMessage() tlib.txt /*tlib#notify#TrimMessage()*
|
||||
tlib#paragraph#GetMetric() tlib.txt /*tlib#paragraph#GetMetric()*
|
||||
tlib#paragraph#Move() tlib.txt /*tlib#paragraph#Move()*
|
||||
tlib#persistent#Dir() tlib.txt /*tlib#persistent#Dir()*
|
||||
tlib#persistent#Filename() tlib.txt /*tlib#persistent#Filename()*
|
||||
tlib#persistent#Get() tlib.txt /*tlib#persistent#Get()*
|
||||
tlib#persistent#Save() tlib.txt /*tlib#persistent#Save()*
|
||||
tlib#progressbar#Display() tlib.txt /*tlib#progressbar#Display()*
|
||||
tlib#progressbar#Init() tlib.txt /*tlib#progressbar#Init()*
|
||||
tlib#progressbar#Restore() tlib.txt /*tlib#progressbar#Restore()*
|
||||
tlib#rx#Escape() tlib.txt /*tlib#rx#Escape()*
|
||||
tlib#rx#EscapeReplace() tlib.txt /*tlib#rx#EscapeReplace()*
|
||||
tlib#rx#Suffixes() tlib.txt /*tlib#rx#Suffixes()*
|
||||
tlib#scratch#CloseScratch() tlib.txt /*tlib#scratch#CloseScratch()*
|
||||
tlib#scratch#UseScratch() tlib.txt /*tlib#scratch#UseScratch()*
|
||||
tlib#signs#ClearAll() tlib.txt /*tlib#signs#ClearAll()*
|
||||
tlib#signs#ClearBuffer() tlib.txt /*tlib#signs#ClearBuffer()*
|
||||
tlib#signs#Mark() tlib.txt /*tlib#signs#Mark()*
|
||||
tlib#string#Chomp() tlib.txt /*tlib#string#Chomp()*
|
||||
tlib#string#Count() tlib.txt /*tlib#string#Count()*
|
||||
tlib#string#Format() tlib.txt /*tlib#string#Format()*
|
||||
tlib#string#Printf1() tlib.txt /*tlib#string#Printf1()*
|
||||
tlib#string#RemoveBackslashes() tlib.txt /*tlib#string#RemoveBackslashes()*
|
||||
tlib#string#Strip() tlib.txt /*tlib#string#Strip()*
|
||||
tlib#string#TrimLeft() tlib.txt /*tlib#string#TrimLeft()*
|
||||
tlib#string#TrimRight() tlib.txt /*tlib#string#TrimRight()*
|
||||
tlib#syntax#Collect() tlib.txt /*tlib#syntax#Collect()*
|
||||
tlib#syntax#Names() tlib.txt /*tlib#syntax#Names()*
|
||||
tlib#tab#BufMap() tlib.txt /*tlib#tab#BufMap()*
|
||||
tlib#tab#Set() tlib.txt /*tlib#tab#Set()*
|
||||
tlib#tab#TabWinNr() tlib.txt /*tlib#tab#TabWinNr()*
|
||||
tlib#tag#Collect() tlib.txt /*tlib#tag#Collect()*
|
||||
tlib#tag#Format() tlib.txt /*tlib#tag#Format()*
|
||||
tlib#tag#Retrieve() tlib.txt /*tlib#tag#Retrieve()*
|
||||
tlib#textobjects#Init() tlib.txt /*tlib#textobjects#Init()*
|
||||
tlib#time#Diff() tlib.txt /*tlib#time#Diff()*
|
||||
tlib#time#DiffMSecs() tlib.txt /*tlib#time#DiffMSecs()*
|
||||
tlib#time#MSecs() tlib.txt /*tlib#time#MSecs()*
|
||||
tlib#time#Now() tlib.txt /*tlib#time#Now()*
|
||||
tlib#type#IsDictionary() tlib.txt /*tlib#type#IsDictionary()*
|
||||
tlib#type#IsFuncref() tlib.txt /*tlib#type#IsFuncref()*
|
||||
tlib#type#IsList() tlib.txt /*tlib#type#IsList()*
|
||||
tlib#type#IsNumber() tlib.txt /*tlib#type#IsNumber()*
|
||||
tlib#type#IsString() tlib.txt /*tlib#type#IsString()*
|
||||
tlib#url#Decode() tlib.txt /*tlib#url#Decode()*
|
||||
tlib#url#DecodeChar() tlib.txt /*tlib#url#DecodeChar()*
|
||||
tlib#url#Encode() tlib.txt /*tlib#url#Encode()*
|
||||
tlib#url#EncodeChar() tlib.txt /*tlib#url#EncodeChar()*
|
||||
tlib#var#EGet() tlib.txt /*tlib#var#EGet()*
|
||||
tlib#var#Get() tlib.txt /*tlib#var#Get()*
|
||||
tlib#var#Let() tlib.txt /*tlib#var#Let()*
|
||||
tlib#var#List() tlib.txt /*tlib#var#List()*
|
||||
tlib#vcs#Diff() tlib.txt /*tlib#vcs#Diff()*
|
||||
tlib#vcs#FindVCS() tlib.txt /*tlib#vcs#FindVCS()*
|
||||
tlib#vcs#Ls() tlib.txt /*tlib#vcs#Ls()*
|
||||
tlib#vim#Maximize() tlib.txt /*tlib#vim#Maximize()*
|
||||
tlib#vim#RestoreWindow() tlib.txt /*tlib#vim#RestoreWindow()*
|
||||
tlib#win#GetLayout() tlib.txt /*tlib#win#GetLayout()*
|
||||
tlib#win#List() tlib.txt /*tlib#win#List()*
|
||||
tlib#win#Set() tlib.txt /*tlib#win#Set()*
|
||||
tlib#win#SetLayout() tlib.txt /*tlib#win#SetLayout()*
|
||||
tlib#win#Width() tlib.txt /*tlib#win#Width()*
|
||||
tlib#win#WinDo() tlib.txt /*tlib#win#WinDo()*
|
||||
tlib.txt tlib.txt /*tlib.txt*
|
||||
v_sp tlib.txt /*v_sp*
|
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: 2011-04-28.
|
||||
" @Revision: 672
|
||||
" @Last Change: 2012-10-03.
|
||||
" @Revision: 725
|
||||
" 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 = 41
|
||||
let loaded_tlib = 102
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
@ -26,7 +26,7 @@ set cpo&vim
|
||||
|
||||
" Commands~ {{{1
|
||||
|
||||
" :display: TRequire NAME [VERSION [FILE]]
|
||||
" :display: :TRequire NAME [VERSION [FILE]]
|
||||
" Make a certain vim file is loaded.
|
||||
"
|
||||
" Conventions: If FILE isn't defined, plugin/NAME.vim is loaded. The
|
||||
@ -84,7 +84,7 @@ command! -nargs=+ TVarArg exec tlib#arg#Let([<args>])
|
||||
command! -nargs=+ TKeyArg exec tlib#arg#Key([<args>])
|
||||
|
||||
|
||||
" :display: TBrowseOutput COMMAND
|
||||
" :display: :TBrowseOutput COMMAND
|
||||
" Ever wondered how to efficiently browse the output of a command
|
||||
" without redirecting it to a file? This command takes a command as
|
||||
" argument and presents the output via |tlib#input#List()| so that you
|
||||
@ -98,7 +98,7 @@ command! -nargs=+ TKeyArg exec tlib#arg#Key([<args>])
|
||||
" TBrowseOutput 20verb TeaseTheCulprit
|
||||
command! -nargs=1 -complete=command TBrowseOutput call tlib#cmd#BrowseOutput(<q-args>)
|
||||
|
||||
" :display: TBrowseScriptnames
|
||||
" :display: :TBrowseScriptnames
|
||||
" List all sourced script names (the output of ':scriptnames').
|
||||
"
|
||||
" When you press enter, the selected script will be opened in the current
|
||||
@ -109,58 +109,96 @@ command! -nargs=1 -complete=command TBrowseOutput call tlib#cmd#BrowseOutput(<q-
|
||||
command! -nargs=0 -complete=command TBrowseScriptnames call
|
||||
\ tlib#cmd#BrowseOutputWithCallback("tlib#cmd#ParseScriptname", "scriptnames")
|
||||
|
||||
" :display: TTimeCommand CMD
|
||||
" :display: :TTimeCommand CMD
|
||||
" Time the execution time of CMD.
|
||||
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.
|
||||
" 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, don't do an incremental "live search",
|
||||
" but use |input()| to query the user for a filter. This is useful on
|
||||
" slower machines or with very long lists.
|
||||
" 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, show some indicators about the status of a filename (e.g.
|
||||
" buflisted(), bufloaded() etc.).
|
||||
" 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
|
||||
|
||||
" Can be "cnf", "cnfd", "seq", or "fuzzy". See:
|
||||
" cnf :: Match substrings
|
||||
" - |tlib#Filter_cnf#New()| (this is the default method)
|
||||
" - |tlib#Filter_cnfd#New()|
|
||||
" seq :: Match sequences of characters
|
||||
" 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
|
||||
" fuzzy .. Match fuzzy character sequences
|
||||
" - |tlib#Filter_fuzzy#New()|
|
||||
TLet g:tlib_inputlist_match = 'cnf'
|
||||
TLet g:tlib_inputlist_match = 'cnfx'
|
||||
|
||||
" If not null, display only a short info about the filter.
|
||||
TLet g:tlib_inputlist_shortmessage = 0
|
||||
@ -265,6 +303,8 @@ TLet g:tlib_keyagents_InputList_s = {
|
||||
\ 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',
|
||||
@ -306,13 +346,8 @@ TLet g:tlib_handlers_EditList = [
|
||||
\ ]},
|
||||
\ ]
|
||||
|
||||
|
||||
|
||||
" " TEST:
|
||||
" TRequire tselectbuffer 6
|
||||
" echo loaded_tselectbuffer
|
||||
|
||||
|
||||
" :nodefault:
|
||||
TLet g:tlib_debug = 0
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
Reference in New Issue
Block a user