diff -Nru vim-tlib-1.13/autoload/tlib/agent.vim vim-tlib-1.20/autoload/tlib/agent.vim --- vim-tlib-1.13/autoload/tlib/agent.vim 2014-11-02 09:28:42.000000000 +0000 +++ vim-tlib-1.20/autoload/tlib/agent.vim 2016-01-26 17:04:08.000000000 +0000 @@ -1,10 +1,7 @@ -" agent.vim " @Author: Tom Link (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: 2007-06-24. -" @Last Change: 2014-02-06. -" @Revision: 0.1.251 +" @Revision: 328 " :filedoc: @@ -414,14 +411,17 @@ if !empty(a:selected) let back = a:world.SwitchWindow('win') " TLogVAR back - if !&hidden && &l:modified - let cmd0 = 'split' - let cmd1 = 'sbuffer' - else - let cmd0 = 'edit' - let cmd1 = 'buffer' - endif - call tlib#file#With(cmd0, cmd1, a:selected, a:world) + for filename in a:selected + call tlib#file#Edit(filename) + endfor + " if !&hidden && &l:modified + " let cmd0 = 'split' + " let cmd1 = 'sbuffer' + " else + " let cmd0 = 'edit' + " let cmd1 = 'buffer' + " endif + " call tlib#file#With(cmd0, cmd1, a:selected, a:world) " TLogVAR &filetype exec back let a:world.state = 'display' @@ -612,3 +612,53 @@ return filter(copy(s:agent_names), 'stridx(v:val, a:ArgLead) != -1') endf + +function! tlib#agent#Complete(world, selected) abort "{{{3 + let rxprefix = a:world.matcher.FilterRxPrefix() + let flt = a:world.filter[0][0] + " TLogVAR flt + let fltrx = rxprefix . flt . '\m[^[:space:][:cntrl:][:punct:]<>*+?&~{}()\[\]\\/]\+' + let fltrx0 = '\m^' . fltrx + " TLogVAR fltrx, fltrx0 + let words = {} + for item in a:world.list + let parts = split(item, '\ze'. fltrx) + " TLogVAR item, parts + for part in parts + let word = matchstr(part, fltrx0) + " TLogVAR part, word + if !empty(word) + let words[word] = 1 + endif + endfor + endfor + " TLogVAR keys(words) + let completions = keys(words) + " let completions = filter(keys(words), 'matchstr(v:val, fltrx0)') + let completions = sort(completions, 's:SortCompletions') + let completions = tlib#list#Uniq(completions) + " TLogVAR 0, completions + while len(completions) > 1 + let nchar = strwidth(completions[0]) - 1 + let completions = map(completions, 'strpart(v:val, 0, nchar)') + " TLogVAR 'reduce', completions + let completions = tlib#list#Uniq(completions) + " TLogVAR 'unique', len(completions), completions + endwh + " TLogVAR 9, completions + if empty(completions) + let a:world.state = 'redisplay update' + else + let a:world.filter[0][0] = completions[0] + let a:world.state = 'display update' + endif + return a:world +endf + + +function! s:SortCompletions(a, b) abort "{{{3 + let i1 = strwidth(a:a) + let i2 = strwidth(a:b) + return i2 - i1 +endf + diff -Nru vim-tlib-1.13/autoload/tlib/arg.vim vim-tlib-1.20/autoload/tlib/arg.vim --- vim-tlib-1.13/autoload/tlib/arg.vim 2014-11-02 09:28:42.000000000 +0000 +++ vim-tlib-1.20/autoload/tlib/arg.vim 2016-01-26 17:04:08.000000000 +0000 @@ -1,8 +1,8 @@ " @Author: Tom Link (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) -" @Last Change: 2014-07-01. -" @Revision: 63 +" @Last Change: 2015-11-24. +" @Revision: 258 " :def: function! tlib#arg#Get(n, var, ?default="", ?test='') @@ -31,30 +31,25 @@ endf -" :def: function! tlib#arg#Key(dict, list, ?default='') -" See |:TKeyArg|. -function! tlib#arg#Key(list, ...) "{{{3 - let default = a:0 >= 1 ? a:1 : '' - let dict = a:list[0] - let list = map(copy(a:list[1:-1]), 'type(v:val) == 3 ? v:val : [v:val, default]') - let args = map(list, '"let ". v:val[0] ." = ". string(get(dict, v:val[0], v:val[1]))') - " TLogVAR dict, list, args - return join(args, ' | ') -endf - - -" :def: function! tlib#arg#StringAsKeyArgs(string, ?keys=[], ?evaluate=0, ?sep=':') +" :def: function! tlib#arg#StringAsKeyArgs(string, ?keys=[], ?evaluate=0, ?sep=':', ?booleans=0) function! tlib#arg#StringAsKeyArgs(string, ...) "{{{1 - TVarArg ['keys', {}], ['evaluate', 0], ['sep', ':'] + TVarArg ['keys', {}], ['evaluate', 0], ['sep', ':'], ['booleans', 0] let keyargs = {} let args = split(a:string, '\\\@= 0 + let keyargs['__posargs__'] = range(0, pos) + endif return keyargs endf function! tlib#arg#StringAsKeyArgsEqual(string) "{{{1 - return tlib#arg#StringAsKeyArgs(a:string, [], 0, '=') + return tlib#arg#StringAsKeyArgs(a:string, [], 0, '=', 1) +endf + + +" :display: tlib#arg#GetOpts(args, ?def={}) +" Convert a list of strings of command-line arguments into a dictonary. +" +" The main use case is to pass [], i.e. the command-line +" arguments of a command as list, from a command definition to this +" function. +" +" Example: +" ['-h'] +" => If def contains a 'help' key, invoke |:help| on its value. +" +" ['-ab', '--foo', '--bar=BAR', 'bla', bla'] +" => {'a': 1, 'b': 1, 'foo': 1, 'bar': 'BAR', '__rest__': ['bla', 'bla']} +" +" ['-ab', '--', '--foo', '--bar=BAR'] +" => {'a': 1, 'b': 1, '__rest__': ['--foo', '--bar=BAR']} +function! tlib#arg#GetOpts(args, ...) abort "{{{3 + let throw = a:0 == 0 + TVarArg ['def', {}] + " TLogVAR def + let opts = {'__exit__': 0} + for [key, vdef] in items(get(def, 'values', {})) + if has_key(vdef, 'default') + let opts[key] = vdef.default + endif + endfor + let idx = 0 + for o in a:args + let [break, idx] = s:SetOpt(def, opts, idx, o) + if break == 1 + break + elseif break == 2 + if throw + throw 'tlib#arg#GetOpts: Show help' + else + let opts.__exit__ = 5 + endif + endif + endfor + let opts.__rest__ = a:args[idx : -1] + return opts +endf + + +function! s:GetValueType(def) abort "{{{3 + return get(a:def, 'type', type(get(a:def, 'default', ''))) +endf + + +function! s:SetOpt(def, opts, idx, opt) abort "{{{3 + " TLogVAR a:def + let idx = a:idx + 1 + let break = 0 + let long = get(a:def, 'long', 1) + let short = get(a:def, 'short', 1) + if (short && a:opt =~# '^-[?h]$') || (long && a:opt ==# '--help') + if has_key(a:def, 'help') + exec 'help' a:def.help + else + " TLogVAR a:def + let values = get(a:def, 'values', {}) + let flags = get(a:def, 'flags', {}) + if empty(values) && empty(flags) + echom 'No help' + else + if !empty(values) + echom 'Options:' + for [key, vdef] in sort(items(values)) + let opt = key + let default = get(vdef, 'default', '') + let type = s:GetValueType(vdef) + if default =~ '^-\?\d\+\%(\.\d\+\)$' + if type == -1 + let opt .= ' (flag)' + elseif type == 1 + let opt .= '=INT' + else + let opt .= '=INT or maybe BOOL' + endif + elseif type(default) == 1 + let opt .= '=STRING' + elseif type(default) == 3 + let opt .= '=COMMA-LIST' + endif + echom printf(' --%20s (default: %s)', opt, string(default)) + endfor + endif + if !empty(flags) + echom 'Short flags:' + for [sflag, lflag] in sort(items(flags)) + echom printf(' -%s -> %s', sflag, lflag) + endfor + endif + endif + endif + let break = 2 + elseif long && a:opt =~# '^--no-.\+' + let key = matchstr(a:opt, '^--no-\zs.\+$') + let a:opts[key] = s:Validate(a:def, key, 0) + elseif long && a:opt =~# '^--\w\+$' + let key = matchstr(a:opt, '^--\zs.\+$') + let a:opts[key] = s:Validate(a:def, key, 1) + elseif long && a:opt =~# '^--\w\+=' + let ml = matchlist(a:opt, '^--\(\w\+\)=\(.*\)$') + if empty(ml) + throw 'tlib#arg#GetOpts: Cannot parse: '. a:opt + else + let values = get(a:def, 'values', {}) + if has_key(values, ml[1]) + let vdef = values[ml[1]] + let type = s:GetValueType(vdef) + if type == -1 + let opt_value = !!str2nr(ml[2]) + elseif type == 0 + let opt_value = str2nr(ml[2]) + elseif type == 1 + let opt_value = ml[2] + elseif type == 2 + let opt_value = function(ml[2]) + elseif type == 3 + let opt_value = tlib#string#SplitCommaList(ml[2]) + elseif type == 4 + throw 'tlib#arg#GetOpts: Unsupported type conversion for '. ml[1] + elseif type == 5 + let opt_value = str2float(ml[2]) + endif + else + let opt_value = ml[2] + endif + let a:opts[ml[1]] = s:Validate(a:def, ml[1], opt_value) + unlet opt_value + endif + elseif short && a:opt =~# '^-\w=' + let flagdefs = get(a:def, 'flags', {}) + let flag = matchstr(a:opt, '^-\zs\w') + let rest = matchstr(a:opt, '^-\w\zs.*$') + call s:SetFlag(a:def, a:opts, idx, flag, rest, flagdefs) + elseif short && a:opt =~# '^-\w\+$' + let flagdefs = get(a:def, 'flags', {}) + for flag in split(substitute(a:opt, '^-', '', ''), '\zs') + call s:SetFlag(a:def, a:opts, idx, flag, '', flagdefs) + endfor + else + let break = 1 + if a:opt !=# '--' + let idx -= 1 + endif + endif + return [break, idx] +endf + + +function! s:SetFlag(def, opts, idx, flag, rest, flagdefs) abort "{{{3 + " TLogVAR a:def + if has_key(a:flagdefs, a:flag) + call s:SetOpt(a:def, a:opts, a:idx, a:flagdefs[a:flag] . a:rest) + else + let a:opts[a:flag] = s:Validate(a:def, a:flag, 1) + endif +endf + + +function! s:Validate(def, name, value) abort "{{{3 + let values = get(a:def, 'values', {}) + if has_key(values, a:name) + let vdef = values[a:name] + if has_key(vdef, 'validate') + if !call(vdef.validate, [a:value]) + throw printf('tlib#arg: %s has invalid value: %s', string(a:name), string(a:value)) + endif + endif + endif + return a:value +endf + + +":nodoc: +function! tlib#arg#CComplete(def, ArgLead) abort "{{{3 + let values = get(a:def, 'values', {}) + let opt = matchstr(a:ArgLead, '^--\zs\w\+\ze=') + if has_key(values, opt) + let words = [] + let vals = values[opt] + let complete_customlist = get(vals, 'complete_customlist', '') + if !empty(complete_customlist) + let words = eval(complete_customlist) + " else + " let complete = get(vals, 'complete', '') + " if !empty(complete) + " endif + endif + if !empty(words) + let prefix = matchstr(a:ArgLead, '^--\w\+=\%([^,]\+,\s*\)*') + let lead = substitute(a:ArgLead, '^--\w\+=\%([^,]\+,\s*\)*', '', '') + " TLogVAR a:ArgLead, lead + if !empty(lead) + let nchar = len(lead) + call filter(words, 'strpart(v:val, 0, nchar) ==# lead') + endif + let words = map(words, 'prefix . v:val') + return sort(words) + endif + endif + let cs = {'-h': 1, '--help': 1} + for [name, vdef] in items(values) + let type = s:GetValueType(vdef) + if type >= 0 + let name .= '=' + else + let cs['--no-'. name] = 1 + endif + let cs['--'. name] = 1 + endfor + for [name, subst] in items(get(a:def, 'flags', {})) + let ldef = get(values, substitute(subst, '^--', '', ''), {}) + let type = s:GetValueType(ldef) + if type >= 0 + let name .= '=' + endif + let cs['-'. name] = 1 + endfor + let nchar = len(a:ArgLead) + if nchar > 0 + call filter(cs, 'strpart(v:key, 0, nchar) ==# a:ArgLead') + endif + return sort(keys(cs)) endf diff -Nru vim-tlib-1.13/autoload/tlib/assert.vim vim-tlib-1.20/autoload/tlib/assert.vim --- vim-tlib-1.13/autoload/tlib/assert.vim 1970-01-01 00:00:00.000000000 +0000 +++ vim-tlib-1.20/autoload/tlib/assert.vim 2016-01-26 17:04:08.000000000 +0000 @@ -0,0 +1,44 @@ +" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim]) +" @Website: https://github.com/tomtom +" @License: GPL (see http://www.gnu.org/licenses/gpl.txt) +" @Last Change: 2015-12-04 +" @Revision: 41 + + +" Enable tracing via |:Tlibassert|. +function! tlib#assert#Enable() abort "{{{3 + " :nodoc: + command! -nargs=+ -bang Tlibassert call tlib#assert#Assert(expand(''), , []) +endf + + +" Disable tracing via |:Tlibassert|. +function! tlib#assert#Disable() abort "{{{3 + " :nodoc: + command! -nargs=+ -bang Tlibassert : +endf + + +function! tlib#assert#Assert(caller, check, vals) abort "{{{3 + for val in a:vals + " TLogVAR val + if type(val) == 3 + call tlib#assert#Assert(a:caller, a:check, val) + elseif !val + throw 'Tlibassert: '. tlib#trace#Backtrace(a:caller) .': '. a:check + endif + endfor +endf + + +function! tlib#assert#Map(vals, expr) abort "{{{3 + return tlib#assert#All(map(a:vals, a:expr)) +endf + + +function! tlib#assert#All(vals) abort "{{{3 + " TLogVAR a:vals, empty(filter(a:vals, '!v:val')) + return empty(filter(a:vals, '!v:val')) +endf + + diff -Nru vim-tlib-1.13/autoload/tlib/balloon.vim vim-tlib-1.20/autoload/tlib/balloon.vim --- vim-tlib-1.13/autoload/tlib/balloon.vim 2014-11-02 09:28:42.000000000 +0000 +++ vim-tlib-1.20/autoload/tlib/balloon.vim 2016-01-26 17:04:08.000000000 +0000 @@ -3,8 +3,8 @@ " @GIT: http://github.com/tomtom/tlib_vim/ " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) " @Created: 2010-08-30. -" @Last Change: 2010-09-05. -" @Revision: 27 +" @Last Change: 2015-11-23. +" @Revision: 48 function! tlib#balloon#Register(expr) "{{{3 @@ -30,8 +30,13 @@ function! tlib#balloon#Remove(expr) "{{{3 - if !exists('b:tlib_balloons') + if exists('b:tlib_balloons') call filter(b:tlib_balloons, 'v:val != a:expr') + if empty(b:tlib_balloons) + setlocal ballooneval& + setlocal balloonexpr& + unlet b:tlib_balloons + endif endif endf @@ -52,3 +57,17 @@ endf +function! tlib#balloon#Expand(expr) abort "{{{3 + if v:beval_bufnr != bufnr('%') + " TLogVAR v:beval_bufnr, bufnr('%') + return '' + endif + let win = winsaveview() + try + call setpos('.', [v:beval_bufnr, v:beval_lnum, v:beval_col, 0]) + return expand(a:expr) + finally + call winrestview(win) + endtry +endf + diff -Nru vim-tlib-1.13/autoload/tlib/buffer.vim vim-tlib-1.20/autoload/tlib/buffer.vim --- vim-tlib-1.13/autoload/tlib/buffer.vim 2014-11-02 09:28:42.000000000 +0000 +++ vim-tlib-1.20/autoload/tlib/buffer.vim 2016-01-26 17:04:08.000000000 +0000 @@ -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: 2013-09-25. -" @Revision: 0.0.352 +" @Last Change: 2015-11-06. +" @Revision: 7.1.352 " Where to display the line when using |tlib#buffer#ViewLine|. @@ -160,7 +160,7 @@ elseif order == 'basename' call sort(buffer_list, function('s:CompareBuffernameByBasename')) endif - let buffer_nr = map(copy(buffer_list), 'matchstr(v:val, ''\s*\zs\d\+\ze'')') + let buffer_nr = map(copy(buffer_list), 'str2nr(matchstr(v:val, ''\s*\zs\d\+\ze''))') " TLogVAR buffer_list, buffer_nr if show_number call map(buffer_list, 'matchstr(v:val, ''^\s*\d\+.\{-}\ze\s\+\S\+ \d\+\s*$'')') @@ -201,7 +201,7 @@ function! s:UndoHighlightLine() "{{{3 - 3match none + 2match none autocmd! TLib CursorMoved,CursorMovedI autocmd! TLib CursorHold,CursorHoldI autocmd! TLib InsertEnter,InsertChange,InsertLeave @@ -211,8 +211,8 @@ function! tlib#buffer#HighlightLine(...) "{{{3 TVarArg ['line', line('.')] - " exec '3match MatchParen /^\%'. a:line .'l.*/' - exec '3match Search /^\%'. line .'l.*/' + " exec '2match MatchParen /^\%'. a:line .'l.*/' + exec '2match Search /^\%'. line .'l.*/' call tlib#autocmdgroup#Init() exec 'autocmd TLib CursorMoved,CursorMovedI if line(".") != '. line .' | call s:UndoHighlightLine() | endif' autocmd TLib CursorHold,CursorHoldI call s:UndoHighlightLine() @@ -276,27 +276,28 @@ function! tlib#buffer#InsertText(text, ...) "{{{3 TVarArg ['keyargs', {}] " TLogVAR a:text, keyargs - TKeyArg keyargs, ['shift', 0], ['col', col('.')], ['lineno', line('.')], ['pos', 'e'], - \ ['indent', 0] - " TLogVAR shift, col, lineno, pos, indent + let keyargs = extend({ + \ 'shift': 0, 'col': col('.'), 'lineno': line('.'), 'pos': 'e', 'indent': 0 + \ }, keyargs) + " TLogVAR keyargs let grow = 0 let post_del_last_line = line('$') == 1 - let line = getline(lineno) - if col + shift > 0 - let pre = line[0 : (col - 1 + shift)] - let post = line[(col + shift): -1] + let line = getline(keyargs.lineno) + if keyargs.col + keyargs.shift > 0 + let pre = line[0 : (keyargs.col - 1 + keyargs.shift)] + let post = line[(keyargs.col + keyargs.shift): -1] else let pre = '' let post = line endif - " TLogVAR lineno, line, pre, post + " TLogVAR keyargs.lineno, line, pre, post let text0 = pre . a:text . post let text = split(text0, '\n', 1) " TLogVAR text let icol = len(pre) - " exec 'norm! '. lineno .'G' - call cursor(lineno, col) - if indent && col > 1 + " exec 'norm! '. keyargs.lineno .'G' + call cursor(keyargs.lineno, keyargs.col) + if keyargs.indent && keyargs.col > 1 if &fo =~# '[or]' " FIXME: Is the simple version sufficient? " VERSION 1 @@ -306,13 +307,13 @@ " norm! a " "norm! o " " TAssertExec redraw | sleep 3 - " let idt = strpart(getline('.'), 0, col('.') + shift) + " let idt = strpart(getline('.'), 0, keyargs.col('.') + keyargs.shift) " " TLogVAR idt " let idtl = len(idt) " -1,.delete " " TAssertExec redraw | sleep 3 - " call append(lineno - 1, cline) - " call cursor(lineno, col) + " call append(keyargs.lineno - 1, cline) + " call cursor(keyargs.lineno, keyargs.col) " " TAssertExec redraw | sleep 3 " if idtl == 0 && icol != 0 " let idt = matchstr(pre, '^\s\+') @@ -336,27 +337,27 @@ endfor endif " TLogVAR text - " exec 'norm! '. lineno .'Gdd' + " exec 'norm! '. keyargs.lineno .'Gdd' call tlib#normal#WithRegister('"tdd', 't') - call append(lineno - 1, text) + call append(keyargs.lineno - 1, text) if post_del_last_line call tlib#buffer#KeepCursorPosition('$delete') endif let tlen = len(text) - let posshift = matchstr(pos, '\d\+') - " TLogVAR pos - if pos =~ '^e' - exec lineno + tlen - 1 + let posshift = matchstr(keyargs.pos, '\d\+') + " TLogVAR keyargs.pos + if keyargs.pos =~ '^e' + exec keyargs.lineno + tlen - 1 exec 'norm! 0'. (len(text[-1]) - len(post) + posshift - 1) .'l' - elseif pos =~ '^s' - " TLogVAR lineno, pre, posshift - exec lineno + elseif keyargs.pos =~ '^s' + " TLogVAR keyargs.lineno, pre, posshift + exec keyargs.lineno exec 'norm! '. len(pre) .'|' if !empty(posshift) exec 'norm! '. posshift .'h' endif endif - " TLogDBG getline(lineno) + " TLogDBG getline(keyargs.lineno) " TLogDBG string(getline(1, '$')) return grow endf diff -Nru vim-tlib-1.13/autoload/tlib/cache.vim vim-tlib-1.20/autoload/tlib/cache.vim --- vim-tlib-1.13/autoload/tlib/cache.vim 2014-11-02 09:28:42.000000000 +0000 +++ vim-tlib-1.20/autoload/tlib/cache.vim 2016-01-26 17:04:08.000000000 +0000 @@ -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: 2013-09-25. -" @Revision: 0.1.243 +" @Last Change: 2015-11-26. +" @Revision: 35.1.243 " The cache directory. If empty, use |tlib#dir#MyRuntime|.'/cache'. @@ -45,6 +45,8 @@ " |pathshorten()|. TLet g:tlib#cache#max_filename = 200 +let s:cache = {} + " :display: tlib#cache#Dir(?mode = 'bg') " The default cache directory. @@ -124,9 +126,13 @@ endf -function! tlib#cache#Save(cfile, dictionary) "{{{3 - " TLogVAR a:cfile, a:dictionary - if !empty(a:cfile) +function! tlib#cache#Save(cfile, dictionary, ...) "{{{3 + TVarArg ['options', {}] + let in_memory = get(options, 'in_memory', 0) + if in_memory + " TLogVAR in_memory, a:cfile, localtime() + let s:cache[a:cfile] = {'mtime': localtime(), 'data': a:dictionary} + elseif !empty(a:cfile) " TLogVAR a:dictionary call writefile([string(a:dictionary)], a:cfile, 'b') call s:SetTimestamp(a:cfile, 'write') @@ -142,33 +148,52 @@ function! tlib#cache#Get(cfile, ...) "{{{3 - call tlib#cache#MaybePurge() - if !empty(a:cfile) && filereadable(a:cfile) - let val = readfile(a:cfile, 'b') - call s:SetTimestamp(a:cfile, 'read') - return eval(join(val, "\n")) + TVarArg ['default', {}], ['options', {}] + let in_memory = get(options, 'in_memory', 0) + if in_memory + " TLogVAR in_memory, a:cfile + return get(get(s:cache, a:cfile, {}), 'data', default) else - let default = a:0 >= 1 ? a:1 : {} - return default + call tlib#cache#MaybePurge() + if !empty(a:cfile) && filereadable(a:cfile) + let val = readfile(a:cfile, 'b') + call s:SetTimestamp(a:cfile, 'read') + return eval(join(val, "\n")) + else + return default + endif endif endf +" :display: tlib#cache#Value(cfile, generator, ftime, ?generator_args=[], ?options={}) " Get a cached value from cfile. If it is outdated (compared to ftime) " or does not exist, create it calling a generator function. function! tlib#cache#Value(cfile, generator, ftime, ...) "{{{3 - if !filereadable(a:cfile) || (a:ftime != 0 && getftime(a:cfile) < a:ftime) - let args = a:0 >= 1 ? a:1 : [] + TVarArg ['args', []], ['options', {}] + let in_memory = get(options, 'in_memory', 0) + if in_memory + let not_found = !has_key(s:cache, a:cfile) + let cftime = not_found ? -1 : s:cache[a:cfile].mtime + else + let cftime = getftime(a:cfile) + endif + " TLogVAR in_memory, cftime + if cftime == -1 || (a:ftime != 0 && cftime < a:ftime) " TLogVAR a:generator, args let val = call(a:generator, args) " TLogVAR val let cval = {'val': val} " TLogVAR cval - call tlib#cache#Save(a:cfile, cval) + call tlib#cache#Save(a:cfile, cval, options) return val else - let val = tlib#cache#Get(a:cfile) - return val.val + let val = tlib#cache#Get(a:cfile, {}, options) + if !has_key(val, 'val') + throw 'tlib#cache#Value: Internal error: '. a:cfile + else + return val.val + endif endif endf @@ -286,9 +311,9 @@ try let yn = g:tlib#cache#run_script == 2 ? 'y' : tlib#input#Dialog("TLib: About to delete directories by means of a shell script.\nDirectory removal script: ". scriptfile ."\nRun script to delete directories now?", ['yes', 'no', 'edit'], 'no') if yn =~ '^y\%[es]$' - exec 'cd '. fnameescape(dir) + exec 'silent cd '. fnameescape(dir) exec '! ' &shell shellescape(scriptfile, 1) - exec 'cd -' + exec 'silent cd -' call delete(scriptfile) elseif yn =~ '^e\%[dit]$' exec 'edit '. fnameescape(scriptfile) diff -Nru vim-tlib-1.13/autoload/tlib/char.vim vim-tlib-1.20/autoload/tlib/char.vim --- vim-tlib-1.13/autoload/tlib/char.vim 2014-11-02 09:28:42.000000000 +0000 +++ vim-tlib-1.20/autoload/tlib/char.vim 2016-01-26 17:04:08.000000000 +0000 @@ -1,15 +1,7 @@ -" char.vim " @Author: Tom Link (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: 2007-06-30. -" @Last Change: 2014-01-20. -" @Revision: 0.0.37 - -if &cp || exists("loaded_tlib_char_autoload") - finish -endif -let loaded_tlib_char_autoload = 1 +" @Revision: 38 " :def: function! tlib#char#Get(?timeout=0) diff -Nru vim-tlib-1.13/autoload/tlib/cmd.vim vim-tlib-1.20/autoload/tlib/cmd.vim --- vim-tlib-1.13/autoload/tlib/cmd.vim 2014-11-02 09:28:42.000000000 +0000 +++ vim-tlib-1.20/autoload/tlib/cmd.vim 2016-01-26 17:04:08.000000000 +0000 @@ -1,15 +1,7 @@ -" cmd.vim " @Author: Tom Link (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: 2007-08-23. -" @Last Change: 2014-10-21. -" @Revision: 0.0.54 - -if &cp || exists("loaded_tlib_cmd_autoload") - finish -endif -let loaded_tlib_cmd_autoload = 1 +" @Revision: 58 let g:tlib#cmd#last_output = [] @@ -77,6 +69,12 @@ exe 'drop '. fnameescape(parsedValue) endf + +function! tlib#cmd#TBrowseScriptnames() abort "{{{3 + call tlib#cmd#BrowseOutputWithCallback("tlib#cmd#ParseScriptname", "scriptnames") +endf + + " :def: function! tlib#cmd#UseVertical(?rx='') " Look at the history whether the command was called with vertical. If " an rx is provided check first if the last entry in the history matches diff -Nru vim-tlib-1.13/autoload/tlib/comments.vim vim-tlib-1.20/autoload/tlib/comments.vim --- vim-tlib-1.13/autoload/tlib/comments.vim 2014-11-02 09:28:42.000000000 +0000 +++ vim-tlib-1.20/autoload/tlib/comments.vim 2016-01-26 17:04:08.000000000 +0000 @@ -1,17 +1,7 @@ -" comments.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: 2007-11-15. -" @Last Change: 2009-02-15. -" @Revision: 0.0.24 - -if &cp || exists("loaded_tlib_comments_autoload") - finish -endif -let loaded_tlib_comments_autoload = 1 -let s:save_cpo = &cpo -set cpo&vim +" @Revision: 25 " function! tlib#comments#Comments(?rx='') @@ -34,24 +24,3 @@ endf -" function! tlib#comments#PartitionLine(line) "{{{3 -" if !empty(&commentstring) -" let cs = '^\(\s*\)\('. printf(tlib#rx#Escape(&commentstring), '\)\(.\{-}\)\(') .'\)\(.*\)$' -" let ml = matchlist(a:line, cs) -" else -" let ml = [] -" endif -" if !empty(ml) -" let [m_0, pre, open, line, close, post; rest] = ml -" else -" let [m_0, pre, line; rest] = matchstr(a:line, '^\(\s*\)\(.*\)$') -" for [key, val] in tlib#comments#Comments() -" if +++ -" endfor -" endif -" return {'pre': pre, 'open': open, 'line': line, 'close': close, 'post': post} -" endf - - -let &cpo = s:save_cpo -unlet s:save_cpo diff -Nru vim-tlib-1.13/autoload/tlib/date.vim vim-tlib-1.20/autoload/tlib/date.vim --- vim-tlib-1.13/autoload/tlib/date.vim 2014-11-02 09:28:42.000000000 +0000 +++ vim-tlib-1.20/autoload/tlib/date.vim 2016-01-26 17:04:08.000000000 +0000 @@ -3,14 +3,28 @@ " @Website: http://www.vim.org/account/profile.php?user_id=4037 " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) " @Created: 2010-03-25. -" @Last Change: 2010-09-17. -" @Revision: 0.0.34 +" @Last Change: 2016-01-21. +" @Revision: 25.0.34 if !exists('g:tlib#date#ShortDatePrefix') | let g:tlib#date#ShortDatePrefix = '20' | endif "{{{2 if !exists('g:tlib#date#TimeZoneShift') | let g:tlib#date#TimeZoneShift = 0 | endif "{{{2 let g:tlib#date#dayshift = 60 * 60 * 24 +" let g:tlib#date#date_rx = '\<\(\d\{4}\)-\(\d\d\)-\(\d\d\)\%(\s\+\(\(\d\d\):\(\d\d\)\)\)\?\>' +let g:tlib#date#date_rx = '\<\(\d\{4}\)-\(\d\d\)-\(\d\d\)\>' +let g:tlib#date#date_format = '%Y-%m-%d' + + +function! tlib#date#IsDate(text) abort "{{{3 + return a:text =~# '^'. g:tlib#date#date_rx .'$' && + \ !empty(tlib#date#Parse(a:text, 0, 1)) +endf + + +function! tlib#date#Format(secs1970) abort "{{{3 + return strftime(g:tlib#date#date_format, a:secs1970) +endf " :display: tlib#date#DiffInDays(date1, ?date2=localtime(), ?allow_zero=0) @@ -24,9 +38,10 @@ endf -" :display: tlib#date#Parse(date, ?allow_zero=0) "{{{3 +" :display: tlib#date#Parse(date, ?allow_zero=0, ?silent=0) "{{{3 function! tlib#date#Parse(date, ...) "{{{3 let min = a:0 >= 1 && a:1 ? 0 : 1 + let silent = a:0 >= 2 ? a:2 : 0 " TLogVAR a:date, min let m = matchlist(a:date, '^\(\d\{2}\|\d\{4}\)-\(\d\{1,2}\)-\(\d\{1,2}\)$') if !empty(m) @@ -50,7 +65,9 @@ endif if empty(m) || year == '' || month == '' || days == '' || \ month < min || month > 12 || days < min || days > 31 - echoerr 'TLib: Invalid date: '. a:date + if !silent + echoerr 'TLib: Invalid date: '. a:date + endif return [] endif if strlen(year) == 2 @@ -118,3 +135,33 @@ return seconds endf + +function! tlib#date#Shift(date, shift) abort "{{{3 + let n = str2nr(matchstr(a:shift, '\d\+')) + let ml = matchlist(a:date, g:tlib#date#date_rx) + " TLogVAR a:date, a:shift, n, ml + if a:shift =~ 'd$' + let secs = tlib#date#SecondsSince1970(a:date) + g:tlib#date#dayshift * n + " TLogVAR secs + let date = tlib#date#Format(secs) + elseif a:shift =~ 'w$' + let secs = tlib#date#SecondsSince1970(a:date) + g:tlib#date#dayshift * n * 7 + let date = tlib#date#Format(secs) + elseif a:shift =~ 'm$' + let d = str2nr(ml[3]) + let ms = str2nr(ml[2]) + n + let m = (ms - 1) % 12 + 1 + let yr = str2nr(ml[1]) + (ms - 1) / 12 + let date = printf('%04d-%02d-%02d', yr, m, d) + " TLogVAR d, ms, m, yr, date + elseif a:shift =~ 'y$' + let yr = str2nr(ml[1]) + n + let date = substitute(a:date, '^\d\{4}', yr, '') + endif + " if !empty(ml[4]) && date !~ '\s'. ml[4] .'$' + " let date .= ' '. ml[4] + " endif + " TLogVAR date + return date +endf + diff -Nru vim-tlib-1.13/autoload/tlib/dictionary.vim vim-tlib-1.20/autoload/tlib/dictionary.vim --- vim-tlib-1.13/autoload/tlib/dictionary.vim 1970-01-01 00:00:00.000000000 +0000 +++ vim-tlib-1.20/autoload/tlib/dictionary.vim 2016-01-26 17:04:08.000000000 +0000 @@ -0,0 +1,15 @@ +" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim]) +" @Website: https://github.com/tomtom +" @License: GPL (see http://www.gnu.org/licenses/gpl.txt) +" @Last Change: 2015-10-14 +" @Revision: 2 + + +function! tlib#dictionary#Rev(dict) abort "{{{3 + let rev = {} + for [m, f] in items(a:dict) + let rev[f] = m + endfor + return rev +endf + diff -Nru vim-tlib-1.13/autoload/tlib/dir.vim vim-tlib-1.20/autoload/tlib/dir.vim --- vim-tlib-1.13/autoload/tlib/dir.vim 2014-11-02 09:28:42.000000000 +0000 +++ vim-tlib-1.20/autoload/tlib/dir.vim 2016-01-26 17:04:08.000000000 +0000 @@ -1,15 +1,7 @@ -" dir.vim " @Author: Tom Link (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: 2007-06-30. -" @Last Change: 2014-07-07. -" @Revision: 0.0.38 - -if &cp || exists("loaded_tlib_dir_autoload") - finish -endif -let loaded_tlib_dir_autoload = 1 +" @Revision: 43 " TLet g:tlib#dir#sep = '/' TLet g:tlib#dir#sep = exists('+shellslash') && !&shellslash ? '\' : '/' @@ -73,12 +65,12 @@ " :def: function! tlib#dir#CD(dir, ?locally=0) => CWD function! tlib#dir#CD(dir, ...) "{{{3 - TVarArg ['locally', 0] - let cmd = locally ? 'lcd ' : 'cd ' + TVarArg ['locally', haslocaldir()] + let cmd = locally ? 'lcd! ' : 'cd! ' " let cwd = getcwd() let cmd .= tlib#arg#Ex(a:dir) " TLogVAR a:dir, locally, cmd - exec cmd + exec 'silent' cmd " return cwd return getcwd() endf @@ -86,7 +78,7 @@ " :def: function! tlib#dir#Push(dir, ?locally=0) => CWD function! tlib#dir#Push(dir, ...) "{{{3 - TVarArg ['locally', 0] + TVarArg ['locally', haslocaldir()] call add(s:dir_stack, [getcwd(), locally]) return tlib#dir#CD(a:dir, locally) endf diff -Nru vim-tlib-1.13/autoload/tlib/eval.vim vim-tlib-1.20/autoload/tlib/eval.vim --- vim-tlib-1.13/autoload/tlib/eval.vim 2014-11-02 09:28:42.000000000 +0000 +++ vim-tlib-1.20/autoload/tlib/eval.vim 2016-01-26 17:04:08.000000000 +0000 @@ -1,15 +1,7 @@ -" eval.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: 2007-09-16. -" @Last Change: 2009-02-15. -" @Revision: 0.0.34 - -if &cp || exists("loaded_tlib_eval_autoload") - finish -endif -let loaded_tlib_eval_autoload = 1 +" @Revision: 56 function! tlib#eval#FormatValue(value, ...) "{{{3 @@ -53,3 +45,28 @@ endf +function! tlib#eval#Extend(a, b, ...) abort "{{{3 + let mode = a:0 >= 1 ? a:1 : 'force' + if type(a:a) != type(a:b) + throw 'tlib#eval#Extend: Incompatible types: a='. string(a:a) .' b='. string(a:b) + elseif type(a:a) == 3 " list + return extend(a:a, a:b, mode) + elseif type(a:a) == 4 " dict + for k in keys(a:b) + if has_key(a:a, k) + if mode == 'force' + let a:a[k] = tlib#eval#Extend(copy(a:a[k]), a:b[k], mode) + elseif mode == 'error' + throw 'tlib#eval#Extend: Key already exists: '. k + endif + else + let a:a[k] = a:b[k] + endif + unlet! k + endfor + return a:a + else + return a:b + endif +endf + diff -Nru vim-tlib-1.13/autoload/tlib/file.vim vim-tlib-1.20/autoload/tlib/file.vim --- vim-tlib-1.13/autoload/tlib/file.vim 2014-11-02 09:28:42.000000000 +0000 +++ vim-tlib-1.20/autoload/tlib/file.vim 2016-01-26 17:04:08.000000000 +0000 @@ -1,17 +1,29 @@ -" file.vim " @Author: Tom Link (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: 2007-06-30. -" @Last Change: 2014-07-07. -" @Revision: 0.0.150 +" @Revision: 168 -if &cp || exists("loaded_tlib_file_autoload") - finish + +if !exists('g:tlib#file#drop') + " If true, use |:drop| to edit loaded buffers (only available with GUI). + let g:tlib#file#drop = has('gui') "{{{2 +endif + + +if !exists('g:tlib#file#use_tabs') + let g:tlib#file#use_tabs = 0 "{{{2 endif -let loaded_tlib_file_autoload = 1 +if !exists('g:tlib#file#edit_cmds') + let g:tlib#file#edit_cmds = g:tlib#file#use_tabs ? {'buffer': 'tab split | buffer', 'edit': 'tabedit'} : {} "{{{2 +endif + + +if !exists('g:tlib#file#absolute_filename_rx') + let g:tlib#file#absolute_filename_rx = '^\~\?[\/]' "{{{2 +endif + """ File related {{{1 " For the following functions please see ../../test/tlib.vim for examples. @@ -36,21 +48,32 @@ endf -" :display: tlib#file#Join(filename_parts, ?strip_slashes=1) +" :display: tlib#file#Join(filename_parts, ?strip_slashes=1, ?maybe_absolute=0) " EXAMPLES: > " tlib#file#Join(['foo', 'bar', 'filename.txt']) " => 'foo/bar/filename.txt' function! tlib#file#Join(filename_parts, ...) "{{{3 - TVarArg ['strip_slashes', 1] + TVarArg ['strip_slashes', 1], 'maybe_absolute' " TLogVAR a:filename_parts, strip_slashes + if maybe_absolute + let filename_parts = [] + for part in a:filename_parts + if part =~ g:tlib#file#absolute_filename_rx + let filename_parts = [] + endif + call add(filename_parts, part) + endfor + else + let filename_parts = a:filename_parts + endif if strip_slashes " let rx = tlib#rx#Escape(g:tlib#dir#sep) .'$' let rx = '[/\\]\+$' - let parts = map(copy(a:filename_parts), 'substitute(v:val, rx, "", "")') + let parts = map(copy(filename_parts), 'substitute(v:val, rx, "", "")') " TLogVAR parts return join(parts, g:tlib#dir#sep) else - return join(a:filename_parts, g:tlib#dir#sep) + return join(filename_parts, g:tlib#dir#sep) endif endf @@ -181,3 +204,75 @@ endf +" Return 0 if the file isn't readable/doesn't exist. +" Otherwise return 1. +function! tlib#file#Edit(fileid) "{{{3 + if type(a:fileid) == 0 + let bn = a:fileid + let filename = fnamemodify(bufname(bn), ':p') + else + let filename = fnamemodify(a:fileid, ':p') + let bn = bufnr(filename) + endif + if filename == expand('%:p') + return 1 + else + " TLogVAR a:fileid, bn, filename, g:tlib#file#drop, filereadable(filename) + if bn != -1 && buflisted(bn) + if g:tlib#file#drop + " echom "DBG" get(g:tlib#file#edit_cmds, 'drop', 'drop') fnameescape(filename) + exec get(g:tlib#file#edit_cmds, 'drop', 'drop') fnameescape(filename) + else + " echom "DBG" get(g:tlib#file#edit_cmds, 'buffer', 'buffer') bn + exec get(g:tlib#file#edit_cmds, 'buffer', 'buffer') bn + endif + return 1 + elseif filereadable(filename) + try + " let file = tlib#arg#Ex(filename) + " " TLogVAR file + " echom "DBG" get(g:tlib#file#edit_cmds, 'edit', 'edit') fnameescape(filename) + exec get(g:tlib#file#edit_cmds, 'edit', 'edit') fnameescape(filename) + catch /E325/ + " swap file exists, let the user handle it + catch + echohl error + echom v:exception + echohl NONE + endtry + return 1 + else + echom "TLIB: File not readable: " . filename + if filename != a:fileid + echom "TLIB: original filename: " . a:fileid + endif + endif + endif + return 0 +endf + + +if v:version > 704 || (v:version == 704 && has('patch279')) + + function! tlib#file#Glob(pattern) abort "{{{3 + return glob(a:pattern, 0, 1) + endf + + function! tlib#file#Globpath(path, pattern) abort "{{{3 + return globpath(a:path, a:pattern, 0, 1) + endf + +else + + " :nodoc: + function! tlib#file#Glob(pattern) abort "{{{3 + return split(glob(a:pattern), '\n') + endf + + " :nodoc: + function! tlib#file#Globpath(path, pattern) abort "{{{3 + return split(globpath(a:path, a:pattern), '\n') + endf + +endif + diff -Nru vim-tlib-1.13/autoload/tlib/Filter_cnf.vim vim-tlib-1.20/autoload/tlib/Filter_cnf.vim --- vim-tlib-1.13/autoload/tlib/Filter_cnf.vim 2014-11-02 09:28:42.000000000 +0000 +++ vim-tlib-1.20/autoload/tlib/Filter_cnf.vim 2016-01-26 17:04:08.000000000 +0000 @@ -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: 2014-06-02. -" @Revision: 0.0.109 +" @Last Change: 2014-11-18. +" @Revision: 0.0.114 let s:prototype = tlib#Object#New({'_class': ['Filter_cnf'], 'name': 'cnf'}) "{{{2 let s:prototype.highlight = g:tlib#input#higroup diff -Nru vim-tlib-1.13/autoload/tlib/Filter_glob.vim vim-tlib-1.20/autoload/tlib/Filter_glob.vim --- vim-tlib-1.13/autoload/tlib/Filter_glob.vim 2014-11-02 09:28:42.000000000 +0000 +++ vim-tlib-1.20/autoload/tlib/Filter_glob.vim 2016-01-26 17:04:08.000000000 +0000 @@ -2,8 +2,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: 2014-01-23. -" @Revision: 0.0.80 +" @Last Change: 2014-11-18. +" @Revision: 0.0.82 let s:prototype = tlib#Filter_cnf#New({'_class': ['Filter_glob'], 'name': 'glob'}) "{{{2 let s:prototype.highlight = g:tlib#input#higroup @@ -61,8 +61,8 @@ " :nodoc: function! s:prototype.CleanFilter(filter) dict "{{{3 - let filter = substitute(a:filter, '\\.\\{-}', g:tlib#Filter_glob#seq, 'g') - let filter = substitute(filter, '\\.', g:tlib#Filter_glob#char, 'g') + let filter = substitute(a:filter, '\\\.\\{-}', g:tlib#Filter_glob#seq, 'g') + let filter = substitute(filter, '\\\.', g:tlib#Filter_glob#char, 'g') return filter endf diff -Nru vim-tlib-1.13/autoload/tlib/hook.vim vim-tlib-1.20/autoload/tlib/hook.vim --- vim-tlib-1.13/autoload/tlib/hook.vim 2014-11-02 09:28:42.000000000 +0000 +++ vim-tlib-1.20/autoload/tlib/hook.vim 2016-01-26 17:04:08.000000000 +0000 @@ -1,15 +1,7 @@ -" hook.vim " @Author: Tom Link (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: 2007-08-21. -" @Last Change: 2009-02-15. -" @Revision: 0.0.10 - -if &cp || exists("loaded_tlib_hook_autoload") - finish -endif -let loaded_tlib_hook_autoload = 1 +" @Revision: 11 " :def: function! tlib#hook#Run(hook, ?dict={}) diff -Nru vim-tlib-1.13/autoload/tlib/input.vim vim-tlib-1.20/autoload/tlib/input.vim --- vim-tlib-1.13/autoload/tlib/input.vim 2014-11-02 09:28:42.000000000 +0000 +++ vim-tlib-1.20/autoload/tlib/input.vim 2016-01-26 17:04:08.000000000 +0000 @@ -1,7 +1,7 @@ " @Author: Tom Link (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) -" @Revision: 1338 +" @Revision: 1366 " :filedoc: @@ -131,6 +131,7 @@ \ "\": 'tlib#agent#End', \ "\": 'tlib#agent#Up', \ "\": 'tlib#agent#Down', + \ 9: 'tlib#agent#Complete', \ "\": 'tlib#agent#UpN', \ "\": 'tlib#agent#DownN', \ "\": 'tlib#agent#ShiftLeft', @@ -252,6 +253,9 @@ " Several pattern matching styles are supported. See " |g:tlib#input#filter_mode|. " +" Users can type to complete the current filter with the longest +" match. +" " EXAMPLES: > " echo tlib#input#List('s', 'Select one item', [100,200,300]) " echo tlib#input#List('si', 'Select one item', [100,200,300]) @@ -362,7 +366,7 @@ " let time01 = str2float(reltimestr(reltime())) " DBG " TLogVAR time01, time01 - time0 try - call s:RunStateHandlers(world) + let world = s:RunStateHandlers(world) " if exists('b:tlib_world_event') " let event = b:tlib_world_event @@ -518,7 +522,8 @@ " let world.offset = world.prefidx " endif " TLogDBG 8 - if world.initial_display || !tlib#char#IsAvailable() + " TLogVAR world.initial_display, !tlib#char#IsAvailable() + if world.state =~ '\' || world.initial_display || !tlib#char#IsAvailable() " TLogDBG len(dlist) call world.DisplayList(world.Query(), dlist) call world.FollowCursor() @@ -585,8 +590,9 @@ if !empty(world.next_agent) let nagent = world.next_agent let world.next_agent = '' - let world = call(nagent, [world, world.GetSelectedItems(world.CurrentItem())]) - call s:CheckAgentReturnValue(nagent, world) + " let world = call(nagent, [world, world.GetSelectedItems(world.CurrentItem())]) + " call s:CheckAgentReturnValue(nagent, world) + let world = s:CallAgent({'agent': nagent}, world, world.GetSelectedItems(world.CurrentItem())) elseif !empty(world.next_eval) let selected = world.GetSelectedItems(world.CurrentItem()) let neval = world.next_eval @@ -601,9 +607,10 @@ " 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) + " " TLogVAR handler + " let world = call(handler.agent, [world, world.GetSelectedItems(world.CurrentItem())]) + " call s:CheckAgentReturnValue(c, world) + let world = s:CallAgent(handler, world, world.GetSelectedItems(world.CurrentItem())) silent! let @/ = sr " continue elseif c == 13 @@ -662,8 +669,9 @@ " TLogVAR world.prefidx, world.state elseif has_key(world.key_map[world.key_mode], 'unknown_key') let agent = world.key_map[world.key_mode].unknown_key.agent - let world = call(agent, [world, c]) - call s:CheckAgentReturnValue(agent, world) + " let world = call(agent, [world, c]) + " call s:CheckAgentReturnValue(agent, world) + let world = s:CallAgent({'agent': agent}, world, c) elseif c >= 32 let world.state = 'display' let numbase = get(world.numeric_chars, c, -99999) @@ -856,6 +864,18 @@ endf +function! s:CallAgent(handler, world, list) abort "{{{3 + let agent = a:handler.agent + let args = [a:world, a:list] + if has_key(a:handler, 'args') + let args += a:handler.args + endif + let world = call(agent, args) + " TLogVAR world.state, world.rv + call s:CheckAgentReturnValue(agent, world) + return world +endf + function! s:GetModdedChar(world) "{{{3 let [char, mode] = tlib#char#Get(a:world.timeout, a:world.timeout_resolution, 1) if char !~ '\D' && char > 0 && mode != 0 @@ -916,6 +936,7 @@ 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 + " TLogVAR a:world.key_mode 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 @@ -925,6 +946,7 @@ else throw "tlib#input#ListW: key_handlers must be either a list or a dictionary" endif + " TLogVAR a:world.type, a:world.key_map if !empty(a:cmd) let a:world.state .= ' '. a:cmd endif @@ -943,7 +965,7 @@ endf -function s:PopupmenuExists() +function! s:PopupmenuExists() if !g:tlib#input#use_popup \ || exists(':popup') != 2 \ || !(has('gui_win32') || has('gui_gtk') || has('gui_gtk2')) @@ -1082,11 +1104,13 @@ 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) + " let world = call(agent, [a:world, a:world.GetSelectedItems(a:world.CurrentItem())]) + " call s:CheckAgentReturnValue(agent, a:world) + let world = s:CallAgent({'agent': agent}, world, world.GetSelectedItems(world.CurrentItem())) endif endif endfor + return world endf diff -Nru vim-tlib-1.13/autoload/tlib/list.vim vim-tlib-1.20/autoload/tlib/list.vim --- vim-tlib-1.13/autoload/tlib/list.vim 2014-11-02 09:28:42.000000000 +0000 +++ vim-tlib-1.20/autoload/tlib/list.vim 2016-01-26 17:04:08.000000000 +0000 @@ -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-18. -" @Revision: 57 +" @Last Change: 2015-10-21. +" @Revision: 61 """ List related functions {{{1 @@ -140,6 +140,7 @@ function! tlib#list#Uniq(list, ...) "{{{3 + " TLogVAR a:list TVarArg ['get_value', ''], ['remove_empty', 0] if remove_empty call filter(a:list, 'type(v:val) == 0 || !empty(v:val)') @@ -153,6 +154,7 @@ let seen[e] = 1 call add(uniques, e) endif + unlet e endfor else for e in a:list @@ -161,6 +163,7 @@ let seen[v] = 1 call add(uniques, e) endif + unlet e endfor endif return uniques diff -Nru vim-tlib-1.13/autoload/tlib/loclist.vim vim-tlib-1.20/autoload/tlib/loclist.vim --- vim-tlib-1.13/autoload/tlib/loclist.vim 1970-01-01 00:00:00.000000000 +0000 +++ vim-tlib-1.20/autoload/tlib/loclist.vim 2016-01-26 17:04:08.000000000 +0000 @@ -0,0 +1,13 @@ +" @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) +" @Last Change: 2015-10-24 +" @Revision: 2 + + +function! tlib#loclist#Browse(...) abort "{{{3 + let list = getloclist(0) + return call(function('tlib#qfl#QflList'), [list] + a:000) +endf + + diff -Nru vim-tlib-1.13/autoload/tlib/notify.vim vim-tlib-1.20/autoload/tlib/notify.vim --- vim-tlib-1.13/autoload/tlib/notify.vim 2014-11-02 09:28:42.000000000 +0000 +++ vim-tlib-1.20/autoload/tlib/notify.vim 2016-01-26 17:04:08.000000000 +0000 @@ -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-09-19. -" @Last Change: 2012-01-02. -" @Revision: 0.0.19 +" @Last Change: 2015-04-07. +" @Revision: 0.3.19 let s:save_cpo = &cpo set cpo&vim @@ -17,13 +17,14 @@ TVarArg 'style' let ruler = &ruler let showcmd = &showcmd + let text = substitute(a:text, '\n', '|', 'g') try set noruler set noshowcmd if !empty(style) - exec 'echohl '. style + exec 'echohl' style endif - echo strpart(a:text, 0, &columns - 1) + echo strpart(text, 0, &columns - 1) finally if !empty(style) echohl None diff -Nru vim-tlib-1.13/autoload/tlib/Object.vim vim-tlib-1.20/autoload/tlib/Object.vim --- vim-tlib-1.13/autoload/tlib/Object.vim 2014-11-02 09:28:42.000000000 +0000 +++ vim-tlib-1.20/autoload/tlib/Object.vim 2016-01-26 17:04:08.000000000 +0000 @@ -1,20 +1,11 @@ -" Object.vim -- Prototype objects? " @Author: Tom Link (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: 2007-05-01. -" @Last Change: 2011-03-10. -" @Revision: 0.1.126 +" @Revision: 127 " :filedoc: " Provides a prototype plus some OO-like methods. - -if &cp || exists("loaded_tlib_object_autoload") - finish -endif -let loaded_tlib_object_autoload = 1 - let s:id_counter = 0 let s:prototype = {'_class': ['object'], '_super': [], '_id': 0} "{{{2 diff -Nru vim-tlib-1.13/autoload/tlib/progressbar.vim vim-tlib-1.20/autoload/tlib/progressbar.vim --- vim-tlib-1.13/autoload/tlib/progressbar.vim 2014-11-02 09:28:42.000000000 +0000 +++ vim-tlib-1.20/autoload/tlib/progressbar.vim 2016-01-26 17:04:08.000000000 +0000 @@ -1,15 +1,7 @@ -" progressbar.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: 2007-09-30. -" @Last Change: 2010-01-07. -" @Revision: 0.0.69 - -if &cp || exists("loaded_tlib_progressbar_autoload") - finish -endif -let loaded_tlib_progressbar_autoload = 1 +" @Revision: 72 let s:statusline = [] let s:laststatus = [] @@ -43,15 +35,15 @@ function! tlib#progressbar#Display(value, ...) "{{{3 - TVarArg 'extra' + TVarArg 'extra', ['always', 0] let ts = localtime() - if ts == s:timestamp + if !always && ts == s:timestamp return else let s:timestamp = ts endif let val = a:value * s:width[0] / s:max[0] - if val != s:value[0] + if always || val != s:value[0] let s:value[0] = val let pbl = repeat('#', val) let pbr = repeat('.', s:width[0] - val) diff -Nru vim-tlib-1.13/autoload/tlib/qfl.vim vim-tlib-1.20/autoload/tlib/qfl.vim --- vim-tlib-1.13/autoload/tlib/qfl.vim 1970-01-01 00:00:00.000000000 +0000 +++ vim-tlib-1.20/autoload/tlib/qfl.vim 2016-01-26 17:04:08.000000000 +0000 @@ -0,0 +1,312 @@ +" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim]) +" @Website: https://github.com/tomtom +" @License: GPL (see http://www.gnu.org/licenses/gpl.txt) +" @Last Change: 2015-12-06 +" @Revision: 60 + +" :nodoc: +TLet g:tlib#qfl#world = { + \ 'type': 'mi', + \ 'query': 'Select entry', + \ 'pick_last_item': 0, + \ 'resize_vertical': 0, + \ 'resize': 20, + \ 'scratch': '__TLibQFL__', + \ 'tlib_UseInputListScratch': 'call tlib#qfl#InitListBuffer(world)', + \ 'key_handlers': [ + \ {'key': 5, 'agent': 'tlib#qfl#AgentWithSelected', 'key_name': '', 'help': 'Run a command on selected lines'}, + \ {'key': 16, 'agent': 'tlib#qfl#AgentPreviewQFE', 'key_name': '', 'help': 'Preview'}, + \ {'key': 60, 'agent': 'tlib#qfl#AgentGotoQFE', 'key_name': '<', 'help': 'Jump (don''t close the list)'}, + \ {'key': 19, 'agent': 'tlib#qfl#AgentSplitBuffer', 'key_name': '', 'help': 'Show in split buffer'}, + \ {'key': 20, 'agent': 'tlib#qfl#AgentTabBuffer', 'key_name': '', 'help': 'Show in tab'}, + \ {'key': 22, 'agent': 'tlib#qfl#AgentVSplitBuffer', 'key_name': '', 'help': 'Show in vsplit buffer'}, + \ {'key': 12, 'agent': 'tlib#qfl#AgentEditLine', 'key_name': '', 'help': 'Edit selected line(s)'}, + \ {'key': "\", 'agent': 'tlib#qfl#SetFollowCursor', 'key_name': '', 'help': 'Toggle trace cursor'}, + \ ], + \ 'return_agent': 'tlib#qfl#AgentEditQFE', + \ } + + +function! tlib#qfl#FormatQFLE(qfe) dict abort "{{{3 + let filename = tlib#qfl#QfeFilename(a:qfe) + if get(self, 'qfl_short_filename', '') + let filename = pathshorten(filename) + endif + return printf("%s|%d| %s", filename, a:qfe.lnum, get(a:qfe, "text")) +endf + + +function! tlib#qfl#QfeFilename(qfe) abort "{{{3 + let filename = get(a:qfe, 'filename') + if empty(filename) + let filename = bufname(get(a:qfe, 'bufnr')) + endif + return filename +endf + + +function! tlib#qfl#InitListBuffer(world) "{{{3 + let set_syntax = get(a:world, 'set_syntax', 'tlib#qfl#SetSyntax') + call call(set_syntax, [], a:world) + if has('balloon_eval') + setlocal ballooneval balloonexpr=tlib#qfl#Balloon() + endif +endf + + +function! tlib#qfl#SetSyntax() dict abort "{{{3 + let syntax = get(self, 'qfl_list_syntax', '') + let nextgroup = get(self, 'qfl_list_syntax_nextgroup', '') + " TLogVAR syntax, nextgroup + if !empty(syntax) + exec printf('runtime syntax/%s.vim', syntax) + endif + syn match TTagedFilesFilename /\%(\f\+\| \)\+\ze|\d\+| / nextgroup=TTagedFilesLNum + if !empty(nextgroup) + exec 'syn match TTagedFilesLNum /|\d\+|\s\+/ nextgroup='. nextgroup + else + syn match TTagedFilesLNum /|\d\+|/ + endif + hi def link TTagedFilesFilename Directory + hi def link TTagedFilesLNum LineNr +endf + + +function! tlib#qfl#Balloon() "{{{3 + let world = getbufvar(v:beval_bufnr, 'tlibDisplayListWorld') + let current = max([1, world.offset]) + v:beval_lnum - 1 + if current > len(world.table) + let current = len(world.table) + endif + let baseidx = world.GetBaseIdx0(current) + " TLogVAR world.offset, v:beval_lnum, current, baseidx + let item = world.data[baseidx] + let bufnr = get(item, 'bufnr', 0) + let bufname = get(item, 'filename', '') + if bufnr == 0 && !empty(bufname) + let bufnr = bufnr(bufname) + endif + if empty(bufname) && bufnr > 0 + let bufname = bufname(bufnr) + endif + " TLogVAR item + if bufnr == 0 + return '' + else + let lines = [printf("%d#%d: %s", bufnr, item.lnum, bufname)] + if has('balloon_multiline') + let desc = {'nr': 'Error number', 'type': 'Error type', 'text': ''} + for key in ['nr', 'type', 'text'] + if has_key(item, key) && !empty(item[key]) + let keydesc = get(desc, key, key) + if empty(keydesc) + let text = item[key] + else + let text = printf("%s: %s", key, item[key]) + endif + call add(lines, text) + endif + endfor + endif + return join(lines, "\n") + endif + " v:beval_bufnr number of the buffer in which balloon is going to show + " v:beval_winnr number of the window + " v:beval_lnum line number + " v:beval_col column number (byte index) + " v:beval_text word under or after the mouse pointer +endf + + +function! tlib#qfl#AgentEditQFE(world, selected, ...) "{{{3 + TVarArg ['cmd_edit', ''], ['cmd_buffer', ''] + " TVarArg ['cmd_edit', 'edit'], ['cmd_buffer', 'buffer'] + " TLogVAR a:selected + if empty(a:selected) + call a:world.RestoreOrigin() + " call a:world.ResetSelected() + else + call a:world.RestoreOrigin() + for idx in a:selected + let idx -= 1 + " TLogVAR idx + if idx >= 0 + " TLogVAR a:world.data + " call tlog#Debug(string(map(copy(a:world.data), 'v:val.bufnr'))) + " TLogVAR idx, a:world.data[idx] + let qfe = a:world.data[idx] + " let back = a:world.SwitchWindow('win') + " TLogVAR cmd_edit, cmd_buffer, qfe + let fn = tlib#qfl#QfeFilename(qfe) + " TLogVAR cmd_edit, cmd_buffer, fn + if empty(cmd_edit) && empty(cmd_buffer) + if tlib#file#Edit(fn) + call tlib#buffer#ViewLine(qfe.lnum) + endif + else + call tlib#file#With(cmd_edit, cmd_buffer, [fn], a:world) + " TLogDBG bufname('%') + " TLogVAR &filetype + call tlib#buffer#ViewLine(qfe.lnum) + " call a:world.SetOrigin() + " exec back + endif + endif + endfor + endif + return a:world +endf + + +function! tlib#qfl#AgentPreviewQFE(world, selected) "{{{3 + " TLogVAR a:selected + let back = a:world.SwitchWindow('win') + call tlib#qfl#AgentEditQFE(a:world, a:selected[0:0]) + exec back + redraw + let a:world.state = 'redisplay' + return a:world +endf + + +function! tlib#qfl#AgentGotoQFE(world, selected) "{{{3 + let world = a:world + if !empty(a:selected) + let world = tlib#agent#Suspend(world, a:selected) + call tlib#qfl#AgentEditQFE(world, a:selected[0:0]) + endif + return world +endf + + +function! tlib#qfl#AgentWithSelected(world, selected, ...) "{{{3 + let cmd = a:0 >= 1 ? a:1 : input('Ex command: ', '', 'command') + let world = a:world + if !empty(cmd) + let world = tlib#qfl#RunCmdOnSelected(world, a:selected, cmd) + else + let world.state = 'redisplay' + endif + return world +endf + + +function! tlib#qfl#RunCmdOnSelected(world, selected, cmd, ...) "{{{3 + let close_scratch = a:0 >= 1 ? a:1 : 1 + if close_scratch + call a:world.CloseScratch() + endif + " TLogVAR a:cmd + for entry in a:selected + " TLogVAR entry, a:world.GetBaseItem(entry) + call tlib#qfl#AgentEditQFE(a:world, [entry]) + " TLogDBG bufname('%') + exec a:cmd + " let item = a:world.data[a:world.GetBaseIdx(entry - 1)] + " <+TODO+> + let item = a:world.data[entry - 1] + " TLogVAR entry, item, getline('.') + if has_key(a:world, 'GetBufferLines') + let lines = a:world.GetBufferLines('.', '.') + else + let lines = getline('.', '.') + endif + let item['text'] = tlib#string#Strip(lines[0]) + endfor + if has_key(a:world, 'AfterRunCmd') + if bufnr('%') == a:world.bufnr + call a:world.AfterRunCmd() + else + " <+TODO+> Run in other buffer + endif + endif + " call s:FormatBase(a:world) + call a:world.RestoreOrigin() + let a:world.state = 'reset' + return a:world +endf + + +function! tlib#qfl#AgentSplitBuffer(world, selected) "{{{3 + call a:world.CloseScratch() + return tlib#qfl#AgentEditQFE(a:world, a:selected, 'split', 'sbuffer') +endf + + +function! tlib#qfl#AgentTabBuffer(world, selected) "{{{3 + call a:world.CloseScratch() + return tlib#qfl#AgentEditQFE(a:world, a:selected, 'tabedit', 'tab sbuffer') +endf + + +function! tlib#qfl#AgentVSplitBuffer(world, selected) "{{{3 + call a:world.CloseScratch() + return tlib#qfl#AgentEditQFE(a:world, a:selected, 'vertical split', 'vertical sbuffer') +endf + + +" function! tlib#qfl#AgentOpenBuffer(world, selected) "{{{3 +" endf + + +function! tlib#qfl#AgentEditLine(world, selected) "{{{3 + call a:world.CloseScratch() + let cmd = 'call tlib#qfl#EditLine(".")' + return tlib#qfl#RunCmdOnSelected(a:world, a:selected, cmd) + let a:world.state = 'reset' + return a:world +endf + + +function! tlib#qfl#EditLine(lnum) "{{{3 + call inputsave() + let line = input('', getline(a:lnum)) + call inputrestore() + if !empty(line) + call setline(line(a:lnum), line) + endif +endf + + +function! tlib#qfl#SetFollowCursor(world, selected) "{{{3 + if empty(a:world.follow_cursor) + let a:world.follow_cursor = 'tlib#qfl#AgentPreviewQFE' + else + let a:world.follow_cursor = '' + endif + let a:world.state = 'redisplay' + return a:world +endf + + +function! tlib#qfl#QflList(list, ...) abort "{{{3 + TVarArg ['world_dict', {}], ['anyway', 0], ['suspended', 0] + Tlibtrace 'tlib', world_dict, anyway, suspended + " TLogVAR a:list, world_dict, anyway, suspended + if !anyway && empty(a:list) + return + endif + let world = copy(g:tlib#qfl#world) + if !empty(world_dict) + let world = tlib#eval#Extend(world, world_dict) + endif + " TLogVAR world + let world = tlib#World#New(world) + " echom "DBG world" string(sort(keys(world))) + let world.data = copy(a:list) + if !has_key(world, 'format_data') + let world.format_data = 'tlib#qfl#FormatQFLE' + endif + " TLogVAR world + " TLogVAR world.data + " call s:FormatBase(world) + " TLogVAR world.base + return tlib#input#ListW(world, suspended ? 'hibernate' : '') +endf + + +function! tlib#qfl#Browse(...) abort "{{{3 + let list = getqflist() + return call(function('tlib#qfl#QflList'), [list] + a:000) +endf + diff -Nru vim-tlib-1.13/autoload/tlib/rx.vim vim-tlib-1.20/autoload/tlib/rx.vim --- vim-tlib-1.13/autoload/tlib/rx.vim 2014-11-02 09:28:42.000000000 +0000 +++ vim-tlib-1.20/autoload/tlib/rx.vim 2016-01-26 17:04:08.000000000 +0000 @@ -1,15 +1,7 @@ -" rx.vim " @Author: Tom Link (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: 2007-07-20. -" @Last Change: 2010-02-26. -" @Revision: 0.0.28 - -if &cp || exists("loaded_tlib_rx_autoload") - finish -endif -let loaded_tlib_rx_autoload = 1 +" @Revision: 113 " :def: function! tlib#rx#Escape(text, ?magic='m') @@ -61,3 +53,8 @@ endif endf + +function! tlib#rx#LooksLikeRegexp(text) abort "{{{3 + return a:text =~ '[.?*+{}\[\]]' +endf + diff -Nru vim-tlib-1.13/autoload/tlib/scratch.vim vim-tlib-1.20/autoload/tlib/scratch.vim --- vim-tlib-1.13/autoload/tlib/scratch.vim 2014-11-02 09:28:42.000000000 +0000 +++ vim-tlib-1.20/autoload/tlib/scratch.vim 2016-01-26 17:04:08.000000000 +0000 @@ -1,15 +1,7 @@ -" scratch.vim " @Author: Tom Link (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: 2007-07-18. -" @Last Change: 2014-02-06. -" @Revision: 0.0.252 - -if &cp || exists("loaded_tlib_scratch_autoload") - finish -endif -let loaded_tlib_scratch_autoload = 1 +" @Revision: 255 " Scratch window position. By default the list window is opened on the @@ -92,8 +84,9 @@ setlocal nobuflisted setlocal foldmethod=manual setlocal foldcolumn=0 - setlocal modifiable setlocal nospell + setlocal modifiable + setlocal noreadonly " TLogVAR &ft, ft if !empty(ft) let &l:ft = ft diff -Nru vim-tlib-1.13/autoload/tlib/selection.vim vim-tlib-1.20/autoload/tlib/selection.vim --- vim-tlib-1.13/autoload/tlib/selection.vim 1970-01-01 00:00:00.000000000 +0000 +++ vim-tlib-1.20/autoload/tlib/selection.vim 2016-01-26 17:04:08.000000000 +0000 @@ -0,0 +1,40 @@ +" @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) +" @Last Change: 2016-01-03 +" @Revision: 3 + + +" :display: tlib#selection#GetSelection(mode, ?mbeg="'<", ?mend="'>", ?opmode='selection') +" mode can be one of: selection, lines, block +function! tlib#selection#GetSelection(mode, ...) range "{{{3 + if a:0 >= 2 + let mbeg = a:1 + let mend = a:2 + else + let mbeg = "'<" + let mend = "'>" + endif + let opmode = a:0 >= 3 ? a:3 : 'selection' + let l0 = line(mbeg) + let l1 = line(mend) + let text = getline(l0, l1) + let c0 = col(mbeg) + let c1 = col(mend) + " TLogVAR mbeg, mend, opmode, l0, l1, c0, c1 + " TLogVAR text[-1] + " TLogVAR len(text[-1]) + if opmode == 'block' + let clen = c1 - c0 + call map(text, 'strpart(v:val, c0, clen)') + elseif opmode == 'selection' + if c1 > 1 + let text[-1] = strpart(text[-1], 0, c1 - (a:mode == 'o' || c1 > len(text[-1]) ? 0 : 1)) + endif + if c0 > 1 + let text[0] = strpart(text[0], c0 - 1) + endif + endif + return text +endf + diff -Nru vim-tlib-1.13/autoload/tlib/string.vim vim-tlib-1.20/autoload/tlib/string.vim --- vim-tlib-1.13/autoload/tlib/string.vim 2014-11-02 09:28:42.000000000 +0000 +++ vim-tlib-1.20/autoload/tlib/string.vim 2016-01-26 17:04:08.000000000 +0000 @@ -1,15 +1,7 @@ -" string.vim " @Author: Tom Link (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: 2007-06-30. -" @Last Change: 2009-02-15. -" @Revision: 0.0.115 - -if &cp || exists("loaded_tlib_string_autoload") - finish -endif -let loaded_tlib_string_autoload = 1 +" @Revision: 122 " :def: function! tlib#string#RemoveBackslashes(text, ?chars=' ') @@ -156,3 +148,19 @@ let s:count += 1 endf + +function! tlib#string#SplitCommaList(text, ...) abort "{{{3 + let sep = a:0 >= 1 ? a:1 : ',\s*' + let parts = split(a:text, '\\\@ [[tabpage, winnr] ...] diff -Nru vim-tlib-1.13/autoload/tlib/tag.vim vim-tlib-1.20/autoload/tlib/tag.vim --- vim-tlib-1.13/autoload/tlib/tag.vim 2014-11-02 09:28:42.000000000 +0000 +++ vim-tlib-1.20/autoload/tlib/tag.vim 2016-01-26 17:04:08.000000000 +0000 @@ -1,15 +1,7 @@ -" tag.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: 2007-11-01. -" @Last Change: 2013-09-25. -" @Revision: 0.0.58 - -if &cp || exists("loaded_tlib_tag_autoload") - finish -endif -let loaded_tlib_tag_autoload = 1 +" @Revision: 59 " Extra tags for |tlib#tag#Retrieve()| (see there). Can also be buffer-local. diff -Nru vim-tlib-1.13/autoload/tlib/TestChild.vim vim-tlib-1.20/autoload/tlib/TestChild.vim --- vim-tlib-1.13/autoload/tlib/TestChild.vim 2014-11-02 09:28:42.000000000 +0000 +++ vim-tlib-1.20/autoload/tlib/TestChild.vim 2016-01-26 17:04:08.000000000 +0000 @@ -1,18 +1,10 @@ -" TestChild.vim " @Author: Tom Link (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: 2007-05-18. -" @Last Change: 2010-09-05. -" @Revision: 0.1.14 +" @Revision: 15 " :enddoc: -if &cp || exists("loaded_tlib_TestChild_autoload") - finish -endif -let loaded_tlib_TestChild_autoload = 1 - let s:prototype = tlib#Test#New({'_class': ['TestChild']}) "{{{2 function! tlib#TestChild#New(...) "{{{3 diff -Nru vim-tlib-1.13/autoload/tlib/Test.vim vim-tlib-1.20/autoload/tlib/Test.vim --- vim-tlib-1.13/autoload/tlib/Test.vim 2014-11-02 09:28:42.000000000 +0000 +++ vim-tlib-1.20/autoload/tlib/Test.vim 2016-01-26 17:04:08.000000000 +0000 @@ -1,18 +1,10 @@ -" Test.vim -- A test class " @Author: Tom Link (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: 2007-05-01. -" @Last Change: 2010-09-05. -" @Revision: 0.1.10 +" @Revision: 11 " :enddoc: -if &cp || exists("loaded_tlib_Test_autoload") - finish -endif -let loaded_tlib_Test_autoload = 1 - let s:prototype = tlib#Object#New({'_class': ['Test']}) "{{{2 function! tlib#Test#New(...) "{{{3 diff -Nru vim-tlib-1.13/autoload/tlib/time.vim vim-tlib-1.20/autoload/tlib/time.vim --- vim-tlib-1.13/autoload/tlib/time.vim 2014-11-02 09:28:42.000000000 +0000 +++ vim-tlib-1.20/autoload/tlib/time.vim 2016-01-26 17:04:08.000000000 +0000 @@ -1,15 +1,7 @@ -" time.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: 2007-10-17. -" @Last Change: 2009-02-22. -" @Revision: 0.0.29 - -if &cp || exists("loaded_tlib_time_autoload") - finish -endif -let loaded_tlib_time_autoload = 1 +" @Revision: 36 function! tlib#time#MSecs() "{{{3 @@ -19,12 +11,27 @@ function! tlib#time#Now() "{{{3 - let rts = reltimestr(reltime()) - let rtl = split(rts, '\.') + if has('reltime') + let rts = reltimestr(reltime()) + let rtl = map(split(rts, '\.'), 'str2nr(v:val)') + else + let rtl = [localtime()] + endif return rtl endf +function! tlib#time#FormatNow() "{{{3 + let rtl = tlib#time#Now() + if len(rtl) == 2 + let rts = strftime(g:tlib#date#date_format .' %H:%M:%S', rtl[0]) .'.'. rtl[1] + else + let rts = strftime(g:tlib#date#date_format .' %H:%M:%S', rtl[0]) + endif + return rts +endf + + function! tlib#time#Diff(a, b, ...) "{{{3 TVarArg ['resolution', 2] let [as, am] = a:a diff -Nru vim-tlib-1.13/autoload/tlib/trace.vim vim-tlib-1.20/autoload/tlib/trace.vim --- vim-tlib-1.13/autoload/tlib/trace.vim 1970-01-01 00:00:00.000000000 +0000 +++ vim-tlib-1.20/autoload/tlib/trace.vim 2016-01-26 17:04:08.000000000 +0000 @@ -0,0 +1,130 @@ +" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim]) +" @Website: https://github.com/tomtom +" @License: GPL (see http://www.gnu.org/licenses/gpl.txt) +" @Last Change: 2016-01-25 +" @Revision: 146 + + +if !exists('g:tlib#trace#backtrace') + " The length of the backtrace that should be included in + " |tlib#trace#Print()|. + let g:tlib#trace#backtrace = 2 "{{{2 +endif + + +if !exists('g:tlib#trace#printf') + " The command used for printing traces from |tlib#trace#Print()|. + let g:tlib#trace#printf = 'echom %s' "{{{2 +endif + + +let s:trace_hl = {'error': 'ErrorMsg', 'fatal': 'ErrorMsg', 'warning': 'WarningMsg'} + + +" Set |g:tlib#trace#printf| to make |tlib#trace#Print()| print to +" `filename`. +function! tlib#trace#PrintToFile(filename) abort "{{{3 + let g:tlib#trace#printf = 'call writefile([%s], '. string(a:filename) .', "a")' +endf + + +" Set the tracing |regexp|. See |:Tlibtrace|. +" This will also call |tlib#trace#Enable()|. +" +" Examples: +" call tlib#trace#Set(["+foo", "-bar"]) +" call tlib#trace#Set("+foo,-bar") +function! tlib#trace#Set(vars) abort "{{{3 + call tlib#trace#Enable() + if type(a:vars) == 1 + let vars = tlib#string#SplitCommaList(a:vars, '[,[:space:]]\+') + else + let vars = a:vars + endif + " TLogVAR vars + for rx in vars + let rx1 = substitute(rx, '^[+-]', '', 'g') + if rx1 !~# '^\%(error\|fatal\)$' + let erx1 = tlib#rx#Escape(rx1) + " TLogVAR rx, rx1 + " echom "DBG" s:trace_rx + if rx =~ '^+' + if s:trace_rx !~# '[(|]'. erx1 .'\\' + let s:trace_rx = substitute(s:trace_rx, '\ze\\)\$', '\\|'. erx1, '') + endif + elseif rx =~ '^-' + if s:trace_rx =~# '[(|]'. erx1 .'\\' + let s:trace_rx = substitute(s:trace_rx, '\\|'. erx1, '', '') + endif + else + echohl WarningMsg + echom 'tlib#trace#Print: Unsupported syntax:' rx + echohl NONE + endif + " echom "DBG" s:trace_rx + endif + endfor + echom "SetTrace:" s:trace_rx +endf + + +function! tlib#trace#Backtrace(caller) abort "{{{3 + let caller = split(a:caller, '\.\.') + let start = max([0, len(caller) - g:tlib#trace#backtrace - 1]) + let caller = caller[start : -1] + return join(caller, '..') +endf + + +" Print the values of vars. The first value is a "guard" (see +" |:Tlibtrace|). +function! tlib#trace#Print(caller, vars, values) abort "{{{3 + let msg = ['TRACE'] + let guard = a:values[0] + if type(guard) == 0 + let cond = guard + else + let cond = guard =~# s:trace_rx + endif + " TLogVAR guard, cond, a:vars, a:values + if cond + call add(msg, guard) + call add(msg, tlib#time#FormatNow() .':') + if g:tlib#trace#backtrace > 0 + let bt = tlib#trace#Backtrace(a:caller) + if !empty(bt) + call add(msg, bt .':') + endif + endif + for i in range(1, len(a:vars) - 1) + let v = substitute(a:vars[i], ',$', '', '') + let r = a:values[i] + if v =~# '^\([''"]\).\{-}\1$' + call add(msg, r .';') + else + call add(msg, v .'='. string(r) .';') + endif + unlet r + endfor + exec printf(g:tlib#trace#printf, string(join(msg))) + endif +endf + + +" Enable tracing via |:Tlibtrace|. +function! tlib#trace#Enable() abort "{{{3 + if !exists('s:trace_rx') + let s:trace_rx = '^\%(error\)$' + " :nodoc: + command! -nargs=+ -bang Tlibtrace call tlib#trace#Print(expand(''), [], []) + endif +endf + + +" Disable tracing via |:Tlibtrace|. +function! tlib#trace#Disable() abort "{{{3 + " :nodoc: + command! -nargs=+ -bang Tlibtrace : + unlet! s:trace_rx +endf + diff -Nru vim-tlib-1.13/autoload/tlib/type.vim vim-tlib-1.20/autoload/tlib/type.vim --- vim-tlib-1.13/autoload/tlib/type.vim 2014-11-02 09:28:42.000000000 +0000 +++ vim-tlib-1.20/autoload/tlib/type.vim 2016-01-26 17:04:08.000000000 +0000 @@ -1,29 +1,126 @@ -" type.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: 2007-09-30. -" @Last Change: 2010-09-27. -" @Revision: 0.0.4 +" @Last Change: 2015-12-04. +" @Revision: 44 + + +" Enable type assertiona via |:Tlibtype|. +function! tlib#type#Enable() abort "{{{3 + " :nodoc: + command! -nargs=+ Tlibtype call tlib#type#Check(expand(''), [], []) +endf + + +" Disable type assertiona via |:Tlibtype|. +function! tlib#type#Disable() abort "{{{3 + " :nodoc: + command! -nargs=+ Tlibtype : +endf + function! tlib#type#IsNumber(expr) - return type(a:expr) == 0 + return tlib#type#Is(a:expr, 0) endf + function! tlib#type#IsString(expr) - return type(a:expr) == 1 + return tlib#type#Is(a:expr, 1) endf + function! tlib#type#IsFuncref(expr) - return type(a:expr) == 2 + return tlib#type#Is(a:expr, 2) endf + function! tlib#type#IsList(expr) - return type(a:expr) == 3 + return tlib#type#Is(a:expr, 3) endf + function! tlib#type#IsDictionary(expr) - return type(a:expr) == 4 + return tlib#type#Is(a:expr, 4) +endf + + +function! tlib#type#Is(val, type) abort "{{{3 + if has_key(s:schemas, a:type) + return tlib#type#Has(a:val, a:type) + else + if type(a:type) == 0 + let type = a:type + elseif a:type =~? '^n\%[umber]' + let type = 0 + elseif a:type =~? '^s\%[tring]' + let type = 1 + elseif a:type =~? '^fu\%[ncref]' + let type = 2 + elseif a:type =~? '^l\%[ist]' + let type = 3 + elseif a:type =~? '^d\%[ictionary]' + let type = 4 + elseif a:type =~? '^fl\%[oat]' + let type = 5 + else + throw 'tlib#type#Is: Unknown type: ' a:type + endif + " TLogVAR a:val, a:type, type, type(a:val), type(a:val) == a:type + return type(a:val) == type + endif +endf + + +function! tlib#type#Are(vals, type) abort "{{{3 + return tlib#assert#Map(a:vals, 'tlib#type#Is(v:val,'. string(a:type) .')') +endf + + +let s:schemas = {} + + +function! tlib#type#Define(name, schema) abort "{{{3 + let s:schemas[a:name] = deepcopy(a:schema) endf +function! tlib#type#Has(val, schema) abort "{{{3 + " TLogVAR type(a:val), type(a:schema) + if !tlib#type#IsDictionary(a:val) + " TLogVAR 'not a dictionary', a:val + return 0 + endif + if tlib#type#IsString(a:schema) + " TLogVAR a:schema + let schema = copy(s:schemas[a:schema]) + else + let schema = copy(a:schema) + endif + if tlib#type#IsDictionary(schema) + return tlib#assert#All(map(schema, 'has_key(a:val, v:key) && tlib#type#Is(a:val[v:key], v:val)')) + else + " TLogVAR keys(a:val), schema + return tlib#assert#All(map(schema, 'has_key(a:val, v:val)')) + endif +endf + + +function! tlib#type#Have(vals, schema) abort "{{{3 + return tlib#assert#Map(a:vals, 'tlib#type#Has(v:val,'. string(a:schema) .')') +endf + + +function! tlib#type#Check(caller, names, vals) abort "{{{3 + " TLogVAR a:names, a:vals, len(a:names) + for i in range(0, len(a:names) - 1, 2) + let val = a:vals[i] + let type = a:vals[i + 1] + " TLogVAR i, val, type + if !tlib#type#Is(val, type) + let name = matchstr(a:names[i], '^''\zs.\{-}\ze'',\?$') + throw 'tlib#type#Check: Type mismatch: '. name .':'. a:vals[i + 1] + endif + endfor +endf + diff -Nru vim-tlib-1.13/autoload/tlib/var.vim vim-tlib-1.20/autoload/tlib/var.vim --- vim-tlib-1.13/autoload/tlib/var.vim 2014-11-02 09:28:42.000000000 +0000 +++ vim-tlib-1.20/autoload/tlib/var.vim 2016-01-26 17:04:08.000000000 +0000 @@ -1,15 +1,7 @@ -" var.vim " @Author: Tom Link (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: 2007-06-30. -" @Last Change: 2014-07-08. -" @Revision: 0.0.29 - -if &cp || exists("loaded_tlib_var_autoload") - finish -endif -let loaded_tlib_var_autoload = 1 +" @Revision: 30 " Define a variable called NAME if yet undefined. diff -Nru vim-tlib-1.13/autoload/tlib/vcs.vim vim-tlib-1.20/autoload/tlib/vcs.vim --- vim-tlib-1.13/autoload/tlib/vcs.vim 2014-11-02 09:28:42.000000000 +0000 +++ vim-tlib-1.20/autoload/tlib/vcs.vim 2016-01-26 17:04:08.000000000 +0000 @@ -1,9 +1,10 @@ -" 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: 2014-09-30. -" @Revision: 133 +" @Last Change: 2015-11-07. +" @Revision: 190 + +scriptencoding utf-8 " A dictionarie of supported VCS (currently: git, hg, svn, bzr). @@ -11,7 +12,8 @@ TLet g:tlib#vcs#def = { \ 'git': { \ 'dir': '.git', - \ 'ls': 'git ls-files --full-name %s', + \ 'ls': 'git ls-files --full-name', + \ 'ls.postprocess': '*tlib#vcs#GitLsPostprocess', \ 'diff': 'git diff --no-ext-diff -U0 %s' \ }, \ 'hg': { @@ -64,11 +66,13 @@ let dirname = fnamemodify(a:filename, isdirectory(a:filename) ? ':p' : ':p:h') let path = escape(dirname, ';') .';' " TLogVAR a:filename, dirname, path + Tlibtrace 'tlib', 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 + Tlibtrace 'tlib', vcs, subdir, vcsdir if !empty(vcsdir) let vcsdir_depth = len(split(fnamemodify(vcsdir, ':p'), '\/')) if vcsdir_depth > depth @@ -79,6 +83,7 @@ endif endif endfor + Tlibtrace 'tlib', type, dir " TLogVAR type, dir if empty(type) return ['', ''] @@ -92,13 +97,17 @@ 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, '') + if cmd =~ '^\*' + let cmd = substitute(cmd, '^\*', '', '') + else + 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 endif return cmd else @@ -115,6 +124,7 @@ else let vcs = tlib#vcs#FindVCS(a:0 >= 1 ? a:1 : bufname('%')) endif + Tlibtrace 'tlib', vcs, a:000 " TLogVAR vcs if !empty(vcs) let [vcstype, vcsdir] = vcs @@ -129,11 +139,17 @@ else let cmd = ls endif - " TLogVAR cmd - let filess = system(cmd) + " TLogVAR cmd, getcwd() + Tlibtrace 'tlib', getcwd(), vcstype, vcsdir, rootdir, cmd + let filess = tlib#sys#SystemInDir(rootdir, cmd) " TLogVAR filess let files = split(filess, '\n') + let postprocess = s:GetCmd(vcstype, 'ls.postprocess') + if !empty(postprocess) + call map(files, 'call(postprocess, [v:val])') + endif call map(files, 'join([rootdir, v:val], "/")') + " TLogVAR files return files endif endif @@ -158,3 +174,16 @@ return [] endf + +function! tlib#vcs#GitLsPostprocess(filename) abort "{{{3 + if a:filename =~ '^".\{-}"$' + let filename = matchstr(a:filename, '^"\zs.\{-}\ze"$') + let filename = substitute(filename, '\%(\\\@ 1 - call remove(self.filter, 0) - elseif empty(self.filter[0][0]) && len(self.filter[0]) > 1 - call remove(self.filter[0], 0) - else - call self.matcher.ReduceFrontFilter(self) - endif + let reduced = 0 + while !reduced + if self.filter[0] == [''] && len(self.filter) > 1 + call remove(self.filter, 0) + elseif empty(self.filter[0][0]) && len(self.filter[0]) > 1 + call remove(self.filter[0], 0) + else + call self.matcher.ReduceFrontFilter(self) + endif + if self.IsValidFilter() + let reduced = 1 + endif + endwh endf @@ -687,6 +704,7 @@ " filter is either a string or a list of list of strings. function! s:prototype.SetInitialFilter(filter) dict "{{{3 " let self.initial_filter = [[''], [a:filter]] + Tlibtrace 'tlib', a:filter if type(a:filter) == 3 let self.initial_filter = deepcopy(a:filter) else @@ -816,10 +834,18 @@ if !exists('w:tlib_list_init') " TLogVAR scratch if has_key(self, 'index_next_syntax') - exec 'syntax match InputlListIndex /^\d\+:\s/ nextgroup='. self.index_next_syntax + if type(self.index_next_syntax) == 1 + exec 'syntax match InputlListIndex /^\d\+:\s/ nextgroup='. self.index_next_syntax + elseif type(self.index_next_syntax) == 4 + for [n, nsyn] in items(self.index_next_syntax) + let fn = printf('%0'. world.index_width .'d', n) + exec 'syntax match InputlListIndex /^'. fn .':\s/ nextgroup='. nsyn + endfor + endif else syntax match InputlListIndex /^\d\+:\s/ endif + call tlib#hook#Run('tlib_UseInputListScratch', self) syntax match InputlListCursor /^\d\+\* .*$/ contains=InputlListIndex syntax match InputlListSelected /^\d\+# .*$/ contains=InputlListIndex hi def link InputlListIndex Constant @@ -830,7 +856,6 @@ " 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 @@ -842,6 +867,7 @@ function! s:prototype.Reset(...) dict "{{{3 TVarArg ['initial', 0] " TLogVAR initial + Tlibtrace 'tlib', initial, self.initial_filter let self.state = 'display' let self.offset = 1 let self.filter = deepcopy(self.initial_filter) @@ -853,6 +879,7 @@ call self.UseInputListScratch() call self.ResetSelected() call self.Retrieve(!initial) + call self.FormatBaseFromData() return self endf @@ -977,6 +1004,7 @@ call self.PushHelp('Mouse', 'L: Pick item, R: Show menu') call self.PushHelp('', 'Select an item') call self.PushHelp(', ', 'Reduce filter') + call self.PushHelp('', 'Complete word') call self.PushHelp(', ', 'Enter command') if self.key_mode == 'default' @@ -1214,10 +1242,11 @@ " :nodoc: function! s:prototype.Query() dict "{{{3 + let flt = self.DisplayFilter() if g:tlib_inputlist_shortmessage - let query = 'Filter: '. self.DisplayFilter() + let query = 'Filter: '. flt else - let query = self.query .' (filter: '. self.DisplayFilter() .'; press for help)' + let query = self.query .' (filter: '. flt .'; press for help)' endif return query endf diff -Nru vim-tlib-1.13/autoload/tlib.vim vim-tlib-1.20/autoload/tlib.vim --- vim-tlib-1.13/autoload/tlib.vim 2014-11-02 09:28:42.000000000 +0000 +++ vim-tlib-1.20/autoload/tlib.vim 2016-01-26 17:04:08.000000000 +0000 @@ -1,10 +1,7 @@ -" tlib.vim " @Author: Tom Link (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: 2007-07-17. -" @Last Change: 2013-09-25. -" @Revision: 0.0.12 +" @Revision: 13 " :nodefault: TLet g:tlib#debug = 0 diff -Nru vim-tlib-1.13/CHANGES.TXT vim-tlib-1.20/CHANGES.TXT --- vim-tlib-1.13/CHANGES.TXT 2014-11-02 09:28:42.000000000 +0000 +++ vim-tlib-1.20/CHANGES.TXT 2016-01-26 17:04:08.000000000 +0000 @@ -542,3 +542,195 @@ MD5 checksum: 7dd8b17a1a5b555df979381dcbd4c9aa version: "1.13" + - SetInitialFilter(): Use deepcopy() + - tlib#var#List(): use keys(namespace) for newer versions of vim + - g:tlib#input#user_shortcuts (not functional yet) + - tlib#input#List: state "picked" + - UseInputListScratch(): Allow customization via self.index_next_syntax + - tlib#cmd#Capture() + - Facilitate customization of key agents via g:tlib_extend_keyagents_InputList_s, g:tlib_extend_keyagents_InputList_m + MD5 checksum: 7dd8b17a1a5b555df979381dcbd4c9aa +version: "1.13" + +version: "1.14" + - FIX #18: Make sure the scratch isn't readonly + - FIX: display filter (properly handle backslashes) + - Remove loaded_* guard from autoload files + - tlib#notify#Echo(): minor changes + - tlib#file#Edit() (used by tlib#agent#ViewFile) + - tlib#buffer#GetList(): Buffer numbers are converted to numbers + - tlib#sys: Change order of functions (move tlib#sys#IsCygwinBin to the (possibly FIX #19) + - g:tlib#sys#check_cygpath: Call tlib#sys#IsExecutable('cygpath', 1) (possibly FIX #19) + MD5 checksum: 2cf6386218736a2d09db43c8e751e5a4 + +version: "1.15" + - tlib#file#Join(): New optional argument: maybe_absolute Drop preceding parts if a part looks like an absolute filename + - tlib#sys#Open(), tlib#sys#IsSpecial() (moved from viki) + - tlib#list#Uniq(): Handle hetergenous lists + - FIX #21: duplicate help tag + - NEW tlib#dictionary#Rev() + - tlib#input#List(): Use to complete current word + - NEW tlib#arg#GetOpts(); ENH tlib#arg#StringAsKeyArgsEqual() + - cache: Allow for in memory cache + - NEW tlib#eval#Extend() + - Move qfl/loclist browser from trag to tlib + - FIX tlib#eval#Extend() + - Simplify tlib#eval#Extend() + - World.index_next_syntax may be a dict + - tlib#qfl#QflList: Use copy() + - tlib#arg#GetOpts: Handle exit code + MD5 checksum: 13fd8b0e4ba9cd932c57fc40ac3f641f + +version: "1.15" + - tlib#file#Join(): New optional argument: maybe_absolute Drop preceding parts if a part looks like an absolute filename + - tlib#sys#Open(), tlib#sys#IsSpecial() (moved from viki) + - tlib#list#Uniq(): Handle hetergenous lists + - FIX #21: duplicate help tag + - NEW tlib#dictionary#Rev() + - tlib#input#List(): Use to complete current word + - NEW tlib#arg#GetOpts(); ENH tlib#arg#StringAsKeyArgsEqual() + - cache: Allow for in memory cache + - NEW tlib#eval#Extend() + - Move qfl/loclist browser from trag to tlib + - FIX tlib#eval#Extend() + - Simplify tlib#eval#Extend() + - World.index_next_syntax may be a dict + - tlib#qfl#QflList: Use copy() + - tlib#arg#GetOpts: Handle exit code + MD5 checksum: 13fd8b0e4ba9cd932c57fc40ac3f641f + + - tlib#arg#GetOpts: Handle short options + - tlib#arg: support short flags & facilitate completion + - NEW :TLibTrace + - tlib#sys#system_browser: FIX XDG string + - NEW tlib#sys#SystemInDir() (used by tlib#vcs#Ls) + - tlib#agent#Complete: improve fltrx + - Remove tlib#arg#Key(), :TKeyArg + - Move :TRequire, :TTimeCommand to macros/tlib.vim + - NEW tlib#cmd#TBrowseScriptnames() + - TScratch: use empty('') + - NEW :TLibTrace + - tlib#qfl: FIX TTagedFilesFilename regexp + - Remove tlib#arg#Key() + - tlib#buffer#InsertText(): Don't use TKeyArg + - tlib#eval#Extend: don't assign value + - NEW :TLibTrace, tlib#trace (was tlib#debug) + - NEW tlib#string#SplitCommaList() + - NEW tlib#time#FormatNow() + - tlib#arg#GetOpts: selectively disable "long", "short" flags + - tlib#arg#CComplete(): Support values completion (complete_customlist field) + - NEW tlib#date#Shift() + - tlib#qfl#Balloon(): Handle items with no bufnr + - NEW tlib#file#Glob, tlib#file#Globpath + - tlib#progressbar#Display(): optional "always" argument + - tlib#vcs#GitLsPostprocess(): Try to handle encoded filenames from git ls-files + - tlib#vcs#GitLsPostprocess: Eval only \ddd substrings + - FIX #22: duplicate tag + - tlib#buffer: Use 2match instead of 3match (incompatibility with matchparen) + - FIX #23: duplicate help tag + - tlib#string#SplitCommaList: optional "sep" argument + - Rename TLibTrace -> Tlibtrace; NEW Tlibtraceset command + - Rename s:SetSyntax -> tlib#qfl#SetSyntax + - mv tlib#rx#Convert to incubator + MD5 checksum: f3656fb35b7b3033084d6c5e504aca61 +version: "1.16" + + - tlib#input#List: #ReduceFilter: make sure the regexp is valid + - TTimeCommand -> Ttimecommand + - tlib#eval#Extend: mode argument for expand() compatibility + - tlib#input#List: Key handlers can have additional arguments + - tlib#qfl#AgentWithSelected: Set world + - prototype.UseInputListScratch: Run tlib_UseInputListScratch hook earlier + - tlib#qfl#AgentWithSelected: typo + - tlib#arg#GetOpts: type conversion (comma-separated lists etc.) + - tlib#arg: validators + - NEW tlib#date#IsDate() + - tlib#balloon#Remove: Unset &ballooneval, &balloonexpr + - NEW tlib#balloon#Expand() + - NEW tlib#date#Format() + - FIX tlib#date#Shift(..., "+Xm") for months + - NEW tlib#trace#Backtrace() + - NEW tlib#type#Is(), tlib#type#Are(), tlib#type#Has(), tlib#type#Have() + - NEW :Tlibassert + MD5 checksum: 3c4125a28ff1860accd254846651c251 +version: "1.17" + + - tlib#input#List: #ReduceFilter: make sure the regexp is valid + - TTimeCommand -> Ttimecommand + - tlib#eval#Extend: mode argument for expand() compatibility + - tlib#input#List: Key handlers can have additional arguments + - tlib#qfl#AgentWithSelected: Set world + - prototype.UseInputListScratch: Run tlib_UseInputListScratch hook earlier + - tlib#qfl#AgentWithSelected: typo + - tlib#arg#GetOpts: type conversion (comma-separated lists etc.) + - tlib#arg: validators + - NEW tlib#date#IsDate() + - tlib#balloon#Remove: Unset &ballooneval, &balloonexpr + - NEW tlib#balloon#Expand() + - NEW tlib#date#Format() + - FIX tlib#date#Shift(..., "+Xm") for months + - NEW tlib#trace#Backtrace() + - NEW tlib#type#Is(), tlib#type#Are(), tlib#type#Has(), tlib#type#Have() + - NEW :Tlibassert + MD5 checksum: 3c4125a28ff1860accd254846651c251 +version: "1.17" + + - tlib#input#List: #ReduceFilter: make sure the regexp is valid + - TTimeCommand -> Ttimecommand + - tlib#eval#Extend: mode argument for expand() compatibility + - tlib#input#List: Key handlers can have additional arguments + - tlib#qfl#AgentWithSelected: Set world + - prototype.UseInputListScratch: Run tlib_UseInputListScratch hook earlier + - tlib#qfl#AgentWithSelected: typo + - tlib#arg#GetOpts: type conversion (comma-separated lists etc.) + - tlib#arg: validators + - NEW tlib#date#IsDate() + - tlib#balloon#Remove: Unset &ballooneval, &balloonexpr + - NEW tlib#balloon#Expand() + - NEW tlib#date#Format() + - FIX tlib#date#Shift(..., "+Xm") for months + - NEW tlib#trace#Backtrace() + - NEW tlib#type#Is(), tlib#type#Are(), tlib#type#Has(), tlib#type#Have() + - NEW :Tlibassert + MD5 checksum: 3c4125a28ff1860accd254846651c251 +version: "1.17" + + - tlib#input#List: #ReduceFilter: make sure the regexp is valid + - TTimeCommand -> Ttimecommand + - tlib#eval#Extend: mode argument for expand() compatibility + - tlib#input#List: Key handlers can have additional arguments + - tlib#qfl#AgentWithSelected: Set world + - prototype.UseInputListScratch: Run tlib_UseInputListScratch hook earlier + - tlib#qfl#AgentWithSelected: typo + - tlib#arg#GetOpts: type conversion (comma-separated lists etc.) + - tlib#arg: validators + - NEW tlib#date#IsDate() + - tlib#balloon#Remove: Unset &ballooneval, &balloonexpr + - NEW tlib#balloon#Expand() + - NEW tlib#date#Format() + - FIX tlib#date#Shift(..., "+Xm") for months + - NEW tlib#trace#Backtrace() + - NEW tlib#type#Is(), tlib#type#Are(), tlib#type#Has(), tlib#type#Have() + - NEW :Tlibassert + MD5 checksum: 3c4125a28ff1860accd254846651c251 +version: "1.17" + + - tlib#arg: Completion for comma-separated lists + - Use "silent cd" + - NEW tlib#type#DefSchema(); FIX tlib#type#Has() + - tlib#cache#Value(): minor change + - tlib#date#IsDate() also checks whether the date is valid + - ! tlib#sys#Open(): escape special chars only once + - tlib#trace#Print: Allow for strings + - :Tlibtrace, :Tlibtraceset, :Tlibassert remove `-bar` + - NEW :Tlibtype (type/schema assertions); tlib#type#Is() also accepts schemas as "types" + - tlib#dir#CD(): Use haslocaldir() + - tlib#qfl#AgentGotoQFE: Don't use wincmd w + - NEW tlib#string#Input() + - FIX g:tlib#sys#system_rx; add OpenOffice exensions to g:tlib#sys#special_suffixes + - NEW tlib#selection#GetSelection() + - tlib#date#Shift(): Fix "Xm", ++specs + - tlib#trace#Set: FIX Properly handly "-label" + MD5 checksum: c3a1fe7d3cd86becbd3f7b0ba7ae9cd8 +version: "1.19" + diff -Nru vim-tlib-1.13/debian/changelog vim-tlib-1.20/debian/changelog --- vim-tlib-1.13/debian/changelog 2015-02-07 13:01:38.000000000 +0000 +++ vim-tlib-1.20/debian/changelog 2016-02-13 13:34:23.000000000 +0000 @@ -1,3 +1,13 @@ +vim-tlib (1.20-1) unstable; urgency=medium + + * New upstream release + * Fixed copyright file + * Standard version bumped to 3.9.7 + * Removed useless preinst script + - Thanks to Sam Morris for the suggestion + + -- Andrea Capriotti Sat, 13 Feb 2016 14:15:26 +0100 + vim-tlib (1.13-1) unstable; urgency=medium * New upstream release diff -Nru vim-tlib-1.13/debian/control vim-tlib-1.20/debian/control --- vim-tlib-1.13/debian/control 2015-02-07 12:56:50.000000000 +0000 +++ vim-tlib-1.20/debian/control 2016-02-13 13:33:26.000000000 +0000 @@ -3,7 +3,7 @@ Priority: extra Maintainer: Andrea Capriotti Build-Depends: debhelper (>= 9.0.0) -Standards-Version: 3.9.6 +Standards-Version: 3.9.7 Homepage: http://www.vim.org/scripts/script.php?script_id=1863 Vcs-Git: git://anonscm.debian.org/collab-maint/vim-tlib.git Vcs-Browser: http://anonscm.debian.org/gitweb?p=collab-maint/vim-tlib.git;a=summary diff -Nru vim-tlib-1.13/debian/copyright vim-tlib-1.20/debian/copyright --- vim-tlib-1.13/debian/copyright 2014-06-25 14:54:38.000000000 +0000 +++ vim-tlib-1.20/debian/copyright 2016-02-13 13:31:54.000000000 +0000 @@ -5,25 +5,12 @@ Files: * Copyright: 2007-2014 Tom Link License: GPL-2+ - This package is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - . - This package is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - . - You should have received a copy of the GNU General Public License - along with this program. If not, see - . - On Debian systems, the complete text of the GNU General - Public License version 2 can be found in "/usr/share/common-licenses/GPL-2". Files: debian/* Copyright: 2014 Andrea Capriotti License: GPL-2+ + +License: GPL-2+ This package is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or diff -Nru vim-tlib-1.13/debian/vim-tlib.dirs vim-tlib-1.20/debian/vim-tlib.dirs --- vim-tlib-1.13/debian/vim-tlib.dirs 2014-12-17 01:26:59.000000000 +0000 +++ vim-tlib-1.20/debian/vim-tlib.dirs 2016-02-13 13:30:22.000000000 +0000 @@ -1 +1,2 @@ var/lib/vim/addons/samples/ +var/lib/vim/addons/macro/ diff -Nru vim-tlib-1.13/debian/vim-tlib.install vim-tlib-1.20/debian/vim-tlib.install --- vim-tlib-1.13/debian/vim-tlib.install 2014-07-08 10:23:41.000000000 +0000 +++ vim-tlib-1.20/debian/vim-tlib.install 2016-02-13 13:22:35.000000000 +0000 @@ -1,5 +1,6 @@ doc/ usr/share/vim/addons etc/ usr/share/vim/addons +macros/ usr/share/vim/addons plugin/ usr/share/vim/addons test/ usr/share/vim/addons spec/ usr/share/vim/addons diff -Nru vim-tlib-1.13/debian/vim-tlib.preinst vim-tlib-1.20/debian/vim-tlib.preinst --- vim-tlib-1.13/debian/vim-tlib.preinst 2014-06-25 08:30:19.000000000 +0000 +++ vim-tlib-1.20/debian/vim-tlib.preinst 1970-01-01 00:00:00.000000000 +0000 @@ -1,38 +0,0 @@ -#!/bin/sh -# preinst script for vim-tlib -# -# see: dh_installdeb(1) - -set -e - -# summary of how this script can be called: -# * `install' -# * `install' -# * `upgrade' -# * `abort-upgrade' -# for details, see http://www.debian.org/doc/debian-policy/ or -# the debian-policy package - - -case "$1" in - install|upgrade) - if [ "$(vim-addons status | grep tlib | awk '{print $3}')" = "installed" ] ; then - vim-addon-manager -w remove tlib - fi - ;; - - abort-upgrade) - ;; - - *) - echo "preinst called with unknown argument \`$1'" >&2 - exit 1 - ;; -esac - -# dh_installdeb will replace this with shell code automatically -# generated by other debhelper scripts. - -#DEBHELPER# - -exit 0 diff -Nru vim-tlib-1.13/debian/vim-tlib.yaml vim-tlib-1.20/debian/vim-tlib.yaml --- vim-tlib-1.13/debian/vim-tlib.yaml 2014-07-08 10:23:21.000000000 +0000 +++ vim-tlib-1.20/debian/vim-tlib.yaml 2016-02-13 13:23:58.000000000 +0000 @@ -2,9 +2,11 @@ description: "Some vim utility functions" files: + - macros/tlib.vim - test/tlib.vim - spec/tlib/arg.vim - spec/tlib/date.vim + - spec/tlib/eval.vim - spec/tlib/file.vim - spec/tlib/hash.vim - spec/tlib/input.vim @@ -21,6 +23,7 @@ - autoload/tinykeymap/map/para_move.vim - autoload/tlib/agent.vim - autoload/tlib/arg.vim + - autoload/tlib/assert.vim - autoload/tlib/autocmdgroup.vim - autoload/tlib/balloon.vim - autoload/tlib/bitwise.vim @@ -30,6 +33,7 @@ - autoload/tlib/cmd.vim - autoload/tlib/comments.vim - autoload/tlib/date.vim + - autoload/tlib/dictionary.vim - autoload/tlib/dir.vim - autoload/tlib/eval.vim - autoload/tlib/file.vim @@ -43,6 +47,7 @@ - autoload/tlib/hook.vim - autoload/tlib/input.vim - autoload/tlib/list.vim + - autoload/tlib/loclist.vim - autoload/tlib/map.vim - autoload/tlib/normal.vim - autoload/tlib/notify.vim @@ -51,8 +56,10 @@ - autoload/tlib/paragraph.vim - autoload/tlib/persistent.vim - autoload/tlib/progressbar.vim + - autoload/tlib/qfl.vim - autoload/tlib/rx.vim - autoload/tlib/scratch.vim + - autoload/tlib/selection.vim - autoload/tlib/signs.vim - autoload/tlib/string.vim - autoload/tlib/syntax.vim @@ -63,6 +70,7 @@ - autoload/tlib/Test.vim - autoload/tlib/textobjects.vim - autoload/tlib/time.vim + - autoload/tlib/trace.vim - autoload/tlib/type.vim - autoload/tlib/url.vim - autoload/tlib/var.vim diff -Nru vim-tlib-1.13/doc/tlib.txt vim-tlib-1.20/doc/tlib.txt --- vim-tlib-1.13/doc/tlib.txt 2014-11-02 09:28:42.000000000 +0000 +++ vim-tlib-1.20/doc/tlib.txt 2016-01-26 17:04:08.000000000 +0000 @@ -30,14 +30,15 @@ ======================================================================== Contents~ - :TRequire .............................. |:TRequire| :TLet .................................. |:TLet| :TScratch .............................. |:TScratch| :TVarArg ............................... |:TVarArg| - :TKeyArg ............................... |:TKeyArg| :TBrowseOutput ......................... |:TBrowseOutput| :TBrowseScriptnames .................... |:TBrowseScriptnames| - :TTimeCommand .......................... |:TTimeCommand| + :Tlibtrace ............................. |:Tlibtrace| + :Tlibtraceset .......................... |:Tlibtraceset| + :Tlibassert ............................ |:Tlibassert| + :Tlibtype .............................. |:Tlibtype| Add .................................... |Add()| TestGetArg ............................. |TestGetArg()| TestGetArg1 ............................ |TestGetArg1()| @@ -48,6 +49,15 @@ g:tlib#debug ........................... |g:tlib#debug| tlib#notify#Echo ....................... |tlib#notify#Echo()| tlib#notify#TrimMessage ................ |tlib#notify#TrimMessage()| + g:tlib#trace#backtrace ................. |g:tlib#trace#backtrace| + g:tlib#trace#printf .................... |g:tlib#trace#printf| + tlib#trace#PrintToFile ................. |tlib#trace#PrintToFile()| + tlib#trace#Set ......................... |tlib#trace#Set()| + tlib#trace#Backtrace ................... |tlib#trace#Backtrace()| + tlib#trace#Print ....................... |tlib#trace#Print()| + tlib#trace#Enable ...................... |tlib#trace#Enable()| + tlib#trace#Disable ..................... |tlib#trace#Disable()| + tlib#dictionary#Rev .................... |tlib#dictionary#Rev()| g:tlib_persistent ...................... |g:tlib_persistent| tlib#persistent#Dir .................... |tlib#persistent#Dir()| tlib#persistent#Filename ............... |tlib#persistent#Filename()| @@ -65,7 +75,9 @@ tlib#progressbar#Init .................. |tlib#progressbar#Init()| tlib#progressbar#Display ............... |tlib#progressbar#Display()| tlib#progressbar#Restore ............... |tlib#progressbar#Restore()| + tlib#selection#GetSelection ............ |tlib#selection#GetSelection()| tlib#eval#FormatValue .................. |tlib#eval#FormatValue()| + tlib#eval#Extend ....................... |tlib#eval#Extend()| tlib#list#Inject ....................... |tlib#list#Inject()| tlib#list#Compact ...................... |tlib#list#Compact()| tlib#list#Flatten ...................... |tlib#list#Flatten()| @@ -83,6 +95,7 @@ tlib#cmd#BrowseOutputWithCallback ...... |tlib#cmd#BrowseOutputWithCallback()| tlib#cmd#DefaultBrowseOutput ........... |tlib#cmd#DefaultBrowseOutput()| tlib#cmd#ParseScriptname ............... |tlib#cmd#ParseScriptname()| + tlib#cmd#TBrowseScriptnames ............ |tlib#cmd#TBrowseScriptnames()| tlib#cmd#UseVertical ................... |tlib#cmd#UseVertical()| tlib#cmd#Time .......................... |tlib#cmd#Time()| tlib#cmd#Capture ....................... |tlib#cmd#Capture()| @@ -91,6 +104,7 @@ tlib#balloon#Register .................. |tlib#balloon#Register()| tlib#balloon#Remove .................... |tlib#balloon#Remove()| tlib#balloon#Expr ...................... |tlib#balloon#Expr()| + tlib#balloon#Expand .................... |tlib#balloon#Expand()| g:tlib#vcs#def ......................... |g:tlib#vcs#def| g:tlib#vcs#executables ................. |g:tlib#vcs#executables| g:tlib#vcs#check ....................... |g:tlib#vcs#check| @@ -98,6 +112,7 @@ tlib#vcs#FindVCS ....................... |tlib#vcs#FindVCS()| tlib#vcs#Ls ............................ |tlib#vcs#Ls()| tlib#vcs#Diff .......................... |tlib#vcs#Diff()| + tlib#vcs#GitLsPostprocess .............. |tlib#vcs#GitLsPostprocess()| tlib#char#Get .......................... |tlib#char#Get()| tlib#char#IsAvailable .................. |tlib#char#IsAvailable()| tlib#char#GetWithTimeout ............... |tlib#char#GetWithTimeout()| @@ -129,6 +144,7 @@ tlib#normal#WithRegister ............... |tlib#normal#WithRegister()| tlib#time#MSecs ........................ |tlib#time#MSecs()| tlib#time#Now .......................... |tlib#time#Now()| + tlib#time#FormatNow .................... |tlib#time#FormatNow()| tlib#time#Diff ......................... |tlib#time#Diff()| tlib#time#DiffMSecs .................... |tlib#time#DiffMSecs()| tlib#var#Let ........................... |tlib#var#Let()| @@ -187,6 +203,7 @@ tlib#agent#Null ........................ |tlib#agent#Null()| tlib#agent#ExecAgentByName ............. |tlib#agent#ExecAgentByName()| tlib#agent#CompleteAgentNames .......... |tlib#agent#CompleteAgentNames()| + tlib#agent#Complete .................... |tlib#agent#Complete()| tlib#bitwise#Num2Bits .................. |tlib#bitwise#Num2Bits()| tlib#bitwise#Bits2Num .................. |tlib#bitwise#Bits2Num()| tlib#bitwise#AND ....................... |tlib#bitwise#AND()| @@ -206,6 +223,7 @@ tlib#rx#Escape ......................... |tlib#rx#Escape()| tlib#rx#EscapeReplace .................. |tlib#rx#EscapeReplace()| tlib#rx#Suffixes ....................... |tlib#rx#Suffixes()| + tlib#rx#LooksLikeRegexp ................ |tlib#rx#LooksLikeRegexp()| g:tlib_tags_extra ...................... |g:tlib_tags_extra| g:tlib_tag_substitute .................. |g:tlib_tag_substitute| tlib#tag#Retrieve ...................... |tlib#tag#Retrieve()| @@ -239,23 +257,37 @@ tlib#input#Edit ........................ |tlib#input#Edit()| tlib#input#Dialog ...................... |tlib#input#Dialog()| tlib#number#ConvertBase ................ |tlib#number#ConvertBase()| + g:tlib#file#drop ....................... |g:tlib#file#drop| + g:tlib#file#use_tabs ................... |g:tlib#file#use_tabs| + g:tlib#file#edit_cmds .................. |g:tlib#file#edit_cmds| + g:tlib#file#absolute_filename_rx ....... |g:tlib#file#absolute_filename_rx| tlib#file#Split ........................ |tlib#file#Split()| tlib#file#Join ......................... |tlib#file#Join()| tlib#file#Relative ..................... |tlib#file#Relative()| tlib#file#Absolute ..................... |tlib#file#Absolute()| tlib#file#Canonic ...................... |tlib#file#Canonic()| tlib#file#With ......................... |tlib#file#With()| + tlib#file#Edit ......................... |tlib#file#Edit()| + tlib#file#Glob ......................... |tlib#file#Glob()| + tlib#file#Globpath ..................... |tlib#file#Globpath()| + g:tlib#sys#special_protocols ........... |g:tlib#sys#special_protocols| + g:tlib#sys#special_suffixes ............ |g:tlib#sys#special_suffixes| + g:tlib#sys#system_rx ................... |g:tlib#sys#system_rx| + g:tlib#sys#system_browser .............. |g:tlib#sys#system_browser| g:tlib#sys#windows ..................... |g:tlib#sys#windows| g:tlib#sys#null ........................ |g:tlib#sys#null| + tlib#sys#IsCygwinBin ................... |tlib#sys#IsCygwinBin()| tlib#sys#IsExecutable .................. |tlib#sys#IsExecutable()| g:tlib#sys#check_cygpath ............... |g:tlib#sys#check_cygpath| g:tlib#sys#cygwin_path_rx .............. |g:tlib#sys#cygwin_path_rx| g:tlib#sys#cygwin_expr ................. |g:tlib#sys#cygwin_expr| - tlib#sys#IsCygwinBin ................... |tlib#sys#IsCygwinBin()| tlib#sys#GetCmd ........................ |tlib#sys#GetCmd()| tlib#sys#MaybeUseCygpath ............... |tlib#sys#MaybeUseCygpath()| tlib#sys#ConvertPath ................... |tlib#sys#ConvertPath()| tlib#sys#FileArgs ...................... |tlib#sys#FileArgs()| + tlib#sys#IsSpecial ..................... |tlib#sys#IsSpecial()| + tlib#sys#Open .......................... |tlib#sys#Open()| + tlib#sys#SystemInDir ................... |tlib#sys#SystemInDir()| tlib#paragraph#GetMetric ............... |tlib#paragraph#GetMetric()| tlib#paragraph#Move .................... |tlib#paragraph#Move()| g:tlib_inputlist_pct ................... |g:tlib_inputlist_pct| @@ -265,27 +297,44 @@ tlib#World#New ......................... |tlib#World#New()| prototype.PrintLines prototype.Suspend + tlib#loclist#Browse .................... |tlib#loclist#Browse()| tlib#tab#BufMap ........................ |tlib#tab#BufMap()| tlib#tab#TabWinNr ...................... |tlib#tab#TabWinNr()| tlib#tab#Set ........................... |tlib#tab#Set()| + tlib#date#IsDate ....................... |tlib#date#IsDate()| + tlib#date#Format ....................... |tlib#date#Format()| tlib#date#DiffInDays ................... |tlib#date#DiffInDays()| tlib#date#Parse ........................ |tlib#date#Parse()| tlib#date#SecondsSince1970 ............. |tlib#date#SecondsSince1970()| + tlib#date#Shift ........................ |tlib#date#Shift()| + tlib#type#Enable ....................... |tlib#type#Enable()| + tlib#type#Disable ...................... |tlib#type#Disable()| tlib#type#IsNumber ..................... |tlib#type#IsNumber()| tlib#type#IsString ..................... |tlib#type#IsString()| tlib#type#IsFuncref .................... |tlib#type#IsFuncref()| tlib#type#IsList ....................... |tlib#type#IsList()| tlib#type#IsDictionary ................. |tlib#type#IsDictionary()| + tlib#type#Is ........................... |tlib#type#Is()| + tlib#type#Are .......................... |tlib#type#Are()| + tlib#type#Define ....................... |tlib#type#Define()| + tlib#type#Has .......................... |tlib#type#Has()| + tlib#type#Have ......................... |tlib#type#Have()| + tlib#type#Check ........................ |tlib#type#Check()| tlib#Filter_fuzzy#New .................. |tlib#Filter_fuzzy#New()| + tlib#assert#Enable ..................... |tlib#assert#Enable()| + tlib#assert#Disable .................... |tlib#assert#Disable()| + tlib#assert#Assert ..................... |tlib#assert#Assert()| + tlib#assert#Map ........................ |tlib#assert#Map()| + tlib#assert#All ........................ |tlib#assert#All()| tlib#textobjects#StandardParagraph ..... |standard-paragraph| tlib#textobjects#Init .................. |tlib#textobjects#Init()| v_sp ................................... |v_sp| o_sp ................................... |o_sp| tlib#arg#Get ........................... |tlib#arg#Get()| tlib#arg#Let ........................... |tlib#arg#Let()| - tlib#arg#Key ........................... |tlib#arg#Key()| tlib#arg#StringAsKeyArgs ............... |tlib#arg#StringAsKeyArgs()| tlib#arg#StringAsKeyArgsEqual .......... |tlib#arg#StringAsKeyArgsEqual()| + tlib#arg#GetOpts ....................... |tlib#arg#GetOpts()| tlib#arg#Ex ............................ |tlib#arg#Ex()| tlib#fixes#Winpos ...................... |tlib#fixes#Winpos()| g:tlib#dir#sep ......................... |g:tlib#dir#sep| @@ -316,6 +365,24 @@ tlib#grep#LocList ...................... |tlib#grep#LocList()| tlib#grep#QuickFixList ................. |tlib#grep#QuickFixList()| tlib#grep#List ......................... |tlib#grep#List()| + tlib#qfl#FormatQFLE .................... |tlib#qfl#FormatQFLE()| + tlib#qfl#QfeFilename ................... |tlib#qfl#QfeFilename()| + tlib#qfl#InitListBuffer ................ |tlib#qfl#InitListBuffer()| + tlib#qfl#SetSyntax ..................... |tlib#qfl#SetSyntax()| + tlib#qfl#Balloon ....................... |tlib#qfl#Balloon()| + tlib#qfl#AgentEditQFE .................. |tlib#qfl#AgentEditQFE()| + tlib#qfl#AgentPreviewQFE ............... |tlib#qfl#AgentPreviewQFE()| + tlib#qfl#AgentGotoQFE .................. |tlib#qfl#AgentGotoQFE()| + tlib#qfl#AgentWithSelected ............. |tlib#qfl#AgentWithSelected()| + tlib#qfl#RunCmdOnSelected .............. |tlib#qfl#RunCmdOnSelected()| + tlib#qfl#AgentSplitBuffer .............. |tlib#qfl#AgentSplitBuffer()| + tlib#qfl#AgentTabBuffer ................ |tlib#qfl#AgentTabBuffer()| + tlib#qfl#AgentVSplitBuffer ............. |tlib#qfl#AgentVSplitBuffer()| + tlib#qfl#AgentEditLine ................. |tlib#qfl#AgentEditLine()| + tlib#qfl#EditLine ...................... |tlib#qfl#EditLine()| + tlib#qfl#SetFollowCursor ............... |tlib#qfl#SetFollowCursor()| + tlib#qfl#QflList ....................... |tlib#qfl#QflList()| + tlib#qfl#Browse ........................ |tlib#qfl#Browse()| tlib#Filter_cnf#New .................... |tlib#Filter_cnf#New()| prototype.Pretty tlib#Object#New ........................ |tlib#Object#New()| @@ -353,19 +420,13 @@ tlib#string#TrimRight .................. |tlib#string#TrimRight()| tlib#string#Strip ...................... |tlib#string#Strip()| tlib#string#Count ...................... |tlib#string#Count()| + tlib#string#SplitCommaList ............. |tlib#string#SplitCommaList()| + tlib#string#Input ...................... |tlib#string#Input()| ======================================================================== plugin/02tlib.vim~ - *:TRequire* -:TRequire NAME [VERSION [FILE]] - Make a certain vim file is loaded. - - Conventions: If FILE isn't defined, plugin/NAME.vim is loaded. The - file must provide a variable loaded_{NAME} that represents the version - number. - *:TLet* :TLet VAR = VALUE Set a variable only if it doesn't already exist. @@ -398,17 +459,6 @@ endf < - *:TKeyArg* -:TKeyArg DICT, VAR1, [VAR2, DEFAULT2] ... - A convenience wrapper for |tlib#arg#Let|. - EXAMPLES: > - function! Foo(keyargs) - TKeyArg a:keyargs, ['a', 1], 'b' - echo 'a='. a - echo 'b='. b - endf -< - *:TBrowseOutput* :TBrowseOutput COMMAND Ever wondered how to efficiently browse the output of a command @@ -435,9 +485,27 @@ TBrowseScriptnames < - *:TTimeCommand* -:TTimeCommand CMD - Time the execution time of CMD. + *:Tlibtrace* +:Tlibtrace GUARD, VAR1, VAR2... + Do nothing unless |tlib#trace#Enable()| was called. + + When |:Tlibtraceset| or |tlib#trace#Enable()| were called: + + If GUARD is a number that evaluates to true or if it is a string that + matches a |regexp|, which was added using Tlibtrace! (with '!'), + display the values of VAR1, VAR2 ... + + *:Tlibtraceset* +:Tlibtraceset + :Tlibtraceset +RX1, -RX2... + If |tlib#trace#Enable()| was called: With the optional , users + can add and remove GUARDs (actually a |regexp|) that should be traced. + + *:Tlibassert* +:Tlibtrace ASSERTION + + *:Tlibtype* +:Tlibtype val, 'type', ... ======================================================================== @@ -494,6 +562,56 @@ ======================================================================== +autoload/tlib/trace.vim~ + + *g:tlib#trace#backtrace* +g:tlib#trace#backtrace (default: 2) + The length of the backtrace that should be included in + |tlib#trace#Print()|. + + *g:tlib#trace#printf* +g:tlib#trace#printf (default: 'echom %s') + The command used for printing traces from |tlib#trace#Print()|. + + *tlib#trace#PrintToFile()* +tlib#trace#PrintToFile(filename) + Set |g:tlib#trace#printf| to make |tlib#trace#Print()| print to + `filename`. + + *tlib#trace#Set()* +tlib#trace#Set(vars) + Set the tracing |regexp|. See |:Tlibtrace|. + This will also call |tlib#trace#Enable()|. + + Examples: + call tlib#trace#Set(["+foo", "-bar"]) + call tlib#trace#Set("+foo,-bar") + + *tlib#trace#Backtrace()* +tlib#trace#Backtrace(caller) + + *tlib#trace#Print()* +tlib#trace#Print(caller, vars, values) + Print the values of vars. The first value is a "guard" (see + |:Tlibtrace|). + + *tlib#trace#Enable()* +tlib#trace#Enable() + Enable tracing via |:Tlibtrace|. + + *tlib#trace#Disable()* +tlib#trace#Disable() + Disable tracing via |:Tlibtrace|. + + +======================================================================== +autoload/tlib/dictionary.vim~ + + *tlib#dictionary#Rev()* +tlib#dictionary#Rev(dict) + + +======================================================================== autoload/tlib/persistent.vim~ *g:tlib_persistent* @@ -590,11 +708,22 @@ ======================================================================== +autoload/tlib/selection.vim~ + + *tlib#selection#GetSelection()* +tlib#selection#GetSelection(mode, ?mbeg="'<", ?mend="'>", ?opmode='selection') + mode can be one of: selection, lines, block + + +======================================================================== autoload/tlib/eval.vim~ *tlib#eval#FormatValue()* tlib#eval#FormatValue(value, ...) + *tlib#eval#Extend()* +tlib#eval#Extend(a, b, ...) + ======================================================================== autoload/tlib/list.vim~ @@ -714,6 +843,9 @@ *tlib#cmd#ParseScriptname()* tlib#cmd#ParseScriptname(line) + *tlib#cmd#TBrowseScriptnames()* +tlib#cmd#TBrowseScriptnames() + *tlib#cmd#UseVertical()* tlib#cmd#UseVertical(?rx='') Look at the history whether the command was called with vertical. If @@ -751,6 +883,9 @@ *tlib#balloon#Expr()* tlib#balloon#Expr() + *tlib#balloon#Expand()* +tlib#balloon#Expand(expr) + ======================================================================== autoload/tlib/vcs.vim~ @@ -784,6 +919,9 @@ tlib#vcs#Diff(filename, ?vcs=[type, dir]) Return the diff for "filename" + *tlib#vcs#GitLsPostprocess()* +tlib#vcs#GitLsPostprocess(filename) + ======================================================================== autoload/tlib/char.vim~ @@ -918,7 +1056,7 @@ tlib#cache#Filename(type, ?file=%, ?mkdir=0, ?dir='') *tlib#cache#Save()* -tlib#cache#Save(cfile, dictionary) +tlib#cache#Save(cfile, dictionary, ...) *tlib#cache#MTime()* tlib#cache#MTime(cfile) @@ -927,7 +1065,7 @@ tlib#cache#Get(cfile, ...) *tlib#cache#Value()* -tlib#cache#Value(cfile, generator, ftime, ...) +tlib#cache#Value(cfile, generator, ftime, ?generator_args=[], ?options={}) Get a cached value from cfile. If it is outdated (compared to ftime) or does not exist, create it calling a generator function. @@ -961,6 +1099,9 @@ *tlib#time#Now()* tlib#time#Now() + *tlib#time#FormatNow()* +tlib#time#FormatNow() + *tlib#time#Diff()* tlib#time#Diff(a, b, ...) @@ -1185,6 +1326,9 @@ *tlib#agent#CompleteAgentNames()* tlib#agent#CompleteAgentNames(ArgLead, CmdLine, CursorPos) + *tlib#agent#Complete()* +tlib#agent#Complete(world, selected) + ======================================================================== autoload/tlib/bitwise.vim~ @@ -1273,6 +1417,9 @@ *tlib#rx#Suffixes()* tlib#rx#Suffixes(...) + *tlib#rx#LooksLikeRegexp()* +tlib#rx#LooksLikeRegexp(text) + ======================================================================== autoload/tlib/tag.vim~ @@ -1510,6 +1657,9 @@ Several pattern matching styles are supported. See |g:tlib#input#filter_mode|. + Users can type to complete the current filter with the longest + match. + EXAMPLES: > echo tlib#input#List('s', 'Select one item', [100,200,300]) echo tlib#input#List('si', 'Select one item', [100,200,300]) @@ -1582,6 +1732,19 @@ ======================================================================== autoload/tlib/file.vim~ + *g:tlib#file#drop* +g:tlib#file#drop (default: has('gui')) + If true, use |:drop| to edit loaded buffers (only available with GUI). + + *g:tlib#file#use_tabs* +g:tlib#file#use_tabs (default: 0) + + *g:tlib#file#edit_cmds* +g:tlib#file#edit_cmds (default: g:tlib#file#use_tabs ? {'buffer': 'tab split | buffer', 'edit': 'tabedit'} : {}) + + *g:tlib#file#absolute_filename_rx* +g:tlib#file#absolute_filename_rx (default: '^\~\?[\/]') + *tlib#file#Split()* tlib#file#Split(filename) EXAMPLES: > @@ -1590,7 +1753,7 @@ < *tlib#file#Join()* -tlib#file#Join(filename_parts, ?strip_slashes=1) +tlib#file#Join(filename_parts, ?strip_slashes=1, ?maybe_absolute=0) EXAMPLES: > tlib#file#Join(['foo', 'bar', 'filename.txt']) => 'foo/bar/filename.txt' @@ -1612,21 +1775,56 @@ *tlib#file#With()* tlib#file#With(fcmd, bcmd, files, ?world={}) + *tlib#file#Edit()* +tlib#file#Edit(fileid) + Return 0 if the file isn't readable/doesn't exist. + Otherwise return 1. + + *tlib#file#Glob()* +tlib#file#Glob(pattern) + + *tlib#file#Globpath()* +tlib#file#Globpath(path, pattern) + ======================================================================== autoload/tlib/sys.vim~ + *g:tlib#sys#special_protocols* +g:tlib#sys#special_protocols (default: ['https\?', 'nntp', 'mailto']) + A list of |regexp|s matching protocol names that should be handled + by |g:tlib#sys#system_browser|. + CAVEAT: Must be a |\V| |regexp|. + + *g:tlib#sys#special_suffixes* +g:tlib#sys#special_suffixes (default: ['xlsx\?', 'docx\?', 'pptx\?', 'accdb', 'mdb', 'sqlite', 'pdf', 'jpg', 'png', 'gif', 'od\[tspg]']) + A list of |regexp|s matching suffixes that should be handled by + |g:tlib#sys#system_browser|. + CAVEAT: Must be a |\V| |regexp|. + + *g:tlib#sys#system_rx* +g:tlib#sys#system_rx (default: printf('\V\%(\^\%(%s\):\|.\%(%s\)\$\)', join(g:tlib#sys#special_protocols, '\|'), join(g:tlib#sys#special_suffixes, '\|'))) + Open links matching this |regexp| with |g:tlib#sys#system_browser|. + CAVEAT: Must be a |\V| |regexp|. + + *g:tlib#sys#system_browser* +g:tlib#sys#system_browser (default: ...) + Open files in the system browser. + *g:tlib#sys#windows* g:tlib#sys#windows (default: &shell !~ 'sh' && (has('win16') || has('win32') || has('win64'))) *g:tlib#sys#null* g:tlib#sys#null (default: g:tlib#sys#windows ? 'NUL' : (filereadable('/dev/null') ? '/dev/null' : '')) + *tlib#sys#IsCygwinBin()* +tlib#sys#IsCygwinBin(cmd) + *tlib#sys#IsExecutable()* tlib#sys#IsExecutable(cmd, ...) *g:tlib#sys#check_cygpath* -g:tlib#sys#check_cygpath (default: g:tlib#sys#windows && tlib#sys#IsExecutable('cygpath')) +g:tlib#sys#check_cygpath (default: g:tlib#sys#windows && tlib#sys#IsExecutable('cygpath', 1)) If true, check whether we have to convert a path via cyppath -- see |tlib#sys#MaybeUseCygpath| @@ -1640,9 +1838,6 @@ For cygwin binaries, convert command calls using this vim expression. - *tlib#sys#IsCygwinBin()* -tlib#sys#IsCygwinBin(cmd) - *tlib#sys#GetCmd()* tlib#sys#GetCmd(cmd) @@ -1658,6 +1853,20 @@ *tlib#sys#FileArgs()* tlib#sys#FileArgs(cmd, files) + *tlib#sys#IsSpecial()* +tlib#sys#IsSpecial(filename) + Check whether filename matches |g:tlib#sys#system_rx|, i.e. whether it + is a special file that should not be opened in vim. + + *tlib#sys#Open()* +tlib#sys#Open(filename) + Open filename with the default OS application (see + |g:tlib#sys#system_browser|), if |tlib#sys#IsSpecial()| return 1. + Returns 1 if successful or 0 otherwise. + + *tlib#sys#SystemInDir()* +tlib#sys#SystemInDir(dir, expr, ?input='') + ======================================================================== autoload/tlib/paragraph.vim~ @@ -1716,6 +1925,13 @@ ======================================================================== +autoload/tlib/loclist.vim~ + + *tlib#loclist#Browse()* +tlib#loclist#Browse(...) + + +======================================================================== autoload/tlib/tab.vim~ *tlib#tab#BufMap()* @@ -1733,20 +1949,37 @@ ======================================================================== autoload/tlib/date.vim~ + *tlib#date#IsDate()* +tlib#date#IsDate(text) + + *tlib#date#Format()* +tlib#date#Format(secs1970) + *tlib#date#DiffInDays()* tlib#date#DiffInDays(date1, ?date2=localtime(), ?allow_zero=0) *tlib#date#Parse()* -tlib#date#Parse(date, ?allow_zero=0) "{{{3 +tlib#date#Parse(date, ?allow_zero=0, ?silent=0) "{{{3 *tlib#date#SecondsSince1970()* tlib#date#SecondsSince1970(date, ...) tlib#date#SecondsSince1970(date, ?daysshift=0, ?allow_zero=0) + *tlib#date#Shift()* +tlib#date#Shift(date, shift) + ======================================================================== autoload/tlib/type.vim~ + *tlib#type#Enable()* +tlib#type#Enable() + Enable type assertiona via |:Tlibtype|. + + *tlib#type#Disable()* +tlib#type#Disable() + Disable type assertiona via |:Tlibtype|. + *tlib#type#IsNumber()* tlib#type#IsNumber(expr) @@ -1762,6 +1995,24 @@ *tlib#type#IsDictionary()* tlib#type#IsDictionary(expr) + *tlib#type#Is()* +tlib#type#Is(val, type) + + *tlib#type#Are()* +tlib#type#Are(vals, type) + + *tlib#type#Define()* +tlib#type#Define(name, schema) + + *tlib#type#Has()* +tlib#type#Has(val, schema) + + *tlib#type#Have()* +tlib#type#Have(vals, schema) + + *tlib#type#Check()* +tlib#type#Check(caller, names, vals) + ======================================================================== autoload/tlib/Filter_fuzzy.vim~ @@ -1775,6 +2026,27 @@ ======================================================================== +autoload/tlib/assert.vim~ + + *tlib#assert#Enable()* +tlib#assert#Enable() + Enable tracing via |:Tlibassert|. + + *tlib#assert#Disable()* +tlib#assert#Disable() + Disable tracing via |:Tlibassert|. + + *tlib#assert#Assert()* +tlib#assert#Assert(caller, check, vals) + + *tlib#assert#Map()* +tlib#assert#Map(vals, expr) + + *tlib#assert#All()* +tlib#assert#All(vals) + + +======================================================================== autoload/tlib/textobjects.vim~ *standard-paragraph* @@ -1813,16 +2085,30 @@ Set a positional arguments from a variable argument list. See tlib#input#List() for an example. - *tlib#arg#Key()* -tlib#arg#Key(dict, list, ?default='') - See |:TKeyArg|. - *tlib#arg#StringAsKeyArgs()* -tlib#arg#StringAsKeyArgs(string, ?keys=[], ?evaluate=0, ?sep=':') +tlib#arg#StringAsKeyArgs(string, ?keys=[], ?evaluate=0, ?sep=':', ?booleans=0) *tlib#arg#StringAsKeyArgsEqual()* tlib#arg#StringAsKeyArgsEqual(string) + *tlib#arg#GetOpts()* +tlib#arg#GetOpts(args, ?def={}) + Convert a list of strings of command-line arguments into a dictonary. + + The main use case is to pass [], i.e. the command-line + arguments of a command as list, from a command definition to this + function. + + Example: + ['-h'] + => If def contains a 'help' key, invoke |:help| on its value. + + ['-ab', '--foo', '--bar=BAR', 'bla', bla'] + => {'a': 1, 'b': 1, 'foo': 1, 'bar': 'BAR', '__rest__': ['bla', 'bla']} + + ['-ab', '--', '--foo', '--bar=BAR'] + => {'a': 1, 'b': 1, '__rest__': ['--foo', '--bar=BAR']} + *tlib#arg#Ex()* tlib#arg#Ex(arg, ?chars='%#! ') Escape some characters in a string. @@ -1966,6 +2252,64 @@ ======================================================================== +autoload/tlib/qfl.vim~ + + *tlib#qfl#FormatQFLE()* +tlib#qfl#FormatQFLE(qfe) + + *tlib#qfl#QfeFilename()* +tlib#qfl#QfeFilename(qfe) + + *tlib#qfl#InitListBuffer()* +tlib#qfl#InitListBuffer(world) + + *tlib#qfl#SetSyntax()* +tlib#qfl#SetSyntax() + + *tlib#qfl#Balloon()* +tlib#qfl#Balloon() + + *tlib#qfl#AgentEditQFE()* +tlib#qfl#AgentEditQFE(world, selected, ...) + + *tlib#qfl#AgentPreviewQFE()* +tlib#qfl#AgentPreviewQFE(world, selected) + + *tlib#qfl#AgentGotoQFE()* +tlib#qfl#AgentGotoQFE(world, selected) + + *tlib#qfl#AgentWithSelected()* +tlib#qfl#AgentWithSelected(world, selected, ...) + + *tlib#qfl#RunCmdOnSelected()* +tlib#qfl#RunCmdOnSelected(world, selected, cmd, ...) + + *tlib#qfl#AgentSplitBuffer()* +tlib#qfl#AgentSplitBuffer(world, selected) + + *tlib#qfl#AgentTabBuffer()* +tlib#qfl#AgentTabBuffer(world, selected) + + *tlib#qfl#AgentVSplitBuffer()* +tlib#qfl#AgentVSplitBuffer(world, selected) + + *tlib#qfl#AgentEditLine()* +tlib#qfl#AgentEditLine(world, selected) + + *tlib#qfl#EditLine()* +tlib#qfl#EditLine(lnum) + + *tlib#qfl#SetFollowCursor()* +tlib#qfl#SetFollowCursor(world, selected) + + *tlib#qfl#QflList()* +tlib#qfl#QflList(list, ...) + + *tlib#qfl#Browse()* +tlib#qfl#Browse(...) + + +======================================================================== autoload/tlib/Filter_cnf.vim~ *tlib#Filter_cnf#New()* @@ -2177,6 +2521,12 @@ *tlib#string#Count()* tlib#string#Count(string, rx) + *tlib#string#SplitCommaList()* +tlib#string#SplitCommaList(text, ...) + + *tlib#string#Input()* +tlib#string#Input(...) + vim:tw=78:fo=w2croql:isk=!-~,^*,^|,^":ts=8:ft=help:norl: diff -Nru vim-tlib-1.13/macros/tlib.vim vim-tlib-1.20/macros/tlib.vim --- vim-tlib-1.13/macros/tlib.vim 1970-01-01 00:00:00.000000000 +0000 +++ vim-tlib-1.20/macros/tlib.vim 2016-01-26 17:04:08.000000000 +0000 @@ -0,0 +1,38 @@ +" @Author: Tom Link (micathom AT gmail com?subject=[vim]) +" @GIT: http://github.com/tomtom/tlib_vim/ +" @License: GPL (see http://www.gnu.org/licenses/gpl.txt) +" @Last Change: 2015-11-09. +" @Revision: 10 + +if &cp || exists("loaded_tlib_macros") + finish +endif +let loaded_tlib_macros = 1 + +let s:save_cpo = &cpo +set cpo&vim + + +" :display: :TRequire NAME [VERSION [FILE]] +" Make a certain vim file is loaded. +" +" Conventions: If FILE isn't defined, plugin/NAME.vim is loaded. The +" file must provide a variable loaded_{NAME} that represents the version +" number. +command! -nargs=+ TRequire let s:require = [] + \ | if !exists('loaded_'. get(s:require, 0)) + \ | exec 'runtime '. get(s:require, 2, 'plugin/'. get(s:require, 0) .'.vim') + \ | if !exists('loaded_'. get(s:require, 0)) || loaded_{get(s:require, 0)} < get(s:require, 1, loaded_{get(s:require, 0)}) + \ | echoerr 'Require '. get(s:require, 0) .' >= '. get(s:require, 1, 'any version will do') + \ | finish + \ | endif + \ | endif | unlet s:require + + +" :display: :Ttimecommand CMD +" Time the execution time of CMD. +command! -nargs=1 -complete=command Ttimecommand call tlib#cmd#Time() + + +let &cpo = s:save_cpo +unlet s:save_cpo diff -Nru vim-tlib-1.13/plugin/02tlib.vim vim-tlib-1.20/plugin/02tlib.vim --- vim-tlib-1.13/plugin/02tlib.vim 2014-11-02 09:28:42.000000000 +0000 +++ vim-tlib-1.20/plugin/02tlib.vim 2016-01-26 17:04:08.000000000 +0000 @@ -1,47 +1,25 @@ " @Author: Tom Link (micathom AT gmail com?subject=[vim]) " @Created: 2007-04-10. -" @Last Change: 2014-07-03. +" @Last Change: 2016-01-26. " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) -" @Revision: 754 +" @Revision: 814 " @Website: http://www.vim.org/account/profile.php?user_id=4037 " GetLatestVimScripts: 1863 1 tlib.vim " tlib.vim -- Some utility functions -if &cp || exists("loaded_tlib") +if &cp || exists("g:loaded_tlib") finish endif if v:version < 700 "{{{2 echoerr "tlib requires Vim >= 7" finish endif -let loaded_tlib = 113 +let g:loaded_tlib = 120 let s:save_cpo = &cpo set cpo&vim -" Init~ {{{1 -" call tlib#autocmdgroup#Init() - - -" Commands~ {{{1 - -" :display: :TRequire NAME [VERSION [FILE]] -" Make a certain vim file is loaded. -" -" Conventions: If FILE isn't defined, plugin/NAME.vim is loaded. The -" file must provide a variable loaded_{NAME} that represents the version -" number. -command! -nargs=+ TRequire let s:require = [] - \ | if !exists('loaded_'. get(s:require, 0)) - \ | exec 'runtime '. get(s:require, 2, 'plugin/'. get(s:require, 0) .'.vim') - \ | if !exists('loaded_'. get(s:require, 0)) || loaded_{get(s:require, 0)} < get(s:require, 1, loaded_{get(s:require, 0)}) - \ | echoerr 'Require '. get(s:require, 0) .' >= '. get(s:require, 1, 'any version will do') - \ | finish - \ | endif - \ | endif | unlet s:require - - " :display: :TLet VAR = VALUE " Set a variable only if it doesn't already exist. " EXAMPLES: > @@ -59,7 +37,7 @@ " EXAMPLES: > " TScratch 'scratch': '__FOO__' " => Open a scratch buffer named __FOO__ -command! -bar -nargs=* -bang TScratch call tlib#scratch#UseScratch({'scratch_split': '' != '!', }) +command! -bar -nargs=* -bang TScratch call tlib#scratch#UseScratch({'scratch_split': empty(''), }) " :display: :TVarArg VAR1, [VAR2, DEFAULT2] ... @@ -73,17 +51,6 @@ command! -nargs=+ TVarArg exec tlib#arg#Let([]) -" :display: :TKeyArg DICT, VAR1, [VAR2, DEFAULT2] ... -" A convenience wrapper for |tlib#arg#Let|. -" EXAMPLES: > -" function! Foo(keyargs) -" TKeyArg a:keyargs, ['a', 1], 'b' -" echo 'a='. a -" echo 'b='. b -" endf -command! -nargs=+ TKeyArg exec tlib#arg#Key([]) - - " :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 @@ -98,6 +65,7 @@ " TBrowseOutput 20verb TeaseTheCulprit command! -nargs=1 -complete=command TBrowseOutput call tlib#cmd#BrowseOutput() + " :display: :TBrowseScriptnames " List all sourced script names (the output of ':scriptnames'). " @@ -106,12 +74,32 @@ " " EXAMPLES: > " TBrowseScriptnames -command! -nargs=0 -complete=command TBrowseScriptnames call - \ tlib#cmd#BrowseOutputWithCallback("tlib#cmd#ParseScriptname", "scriptnames") +command! -nargs=0 -complete=command TBrowseScriptnames call tlib#cmd#TBrowseScriptnames() + + +" :display: :Tlibtrace GUARD, VAR1, VAR2... +" Do nothing unless |tlib#trace#Enable()| was called. +" +" When |:Tlibtraceset| or |tlib#trace#Enable()| were called: +" +" If GUARD is a number that evaluates to true or if it is a string that +" matches a |regexp|, which was added using Tlibtrace! (with '!'), +" display the values of VAR1, VAR2 ... +command! -nargs=+ -bang Tlibtrace : + + +" :Tlibtraceset +RX1, -RX2... +" If |tlib#trace#Enable()| was called: With the optional , users +" can add and remove GUARDs (actually a |regexp|) that should be traced. +command! -nargs=+ -bang Tlibtraceset call tlib#trace#Set() + + +" :display: :Tlibtrace ASSERTION +command! -nargs=+ -bang Tlibassert : + +" :display: :Tlibtype val, 'type', ... +command! -nargs=+ Tlibtype : -" :display: :TTimeCommand CMD -" Time the execution time of CMD. -command! -nargs=1 -complete=command TTimeCommand call tlib#cmd#Time() let &cpo = s:save_cpo diff -Nru vim-tlib-1.13/spec/tlib/date.vim vim-tlib-1.20/spec/tlib/date.vim --- vim-tlib-1.13/spec/tlib/date.vim 2014-11-02 09:28:42.000000000 +0000 +++ vim-tlib-1.20/spec/tlib/date.vim 2016-01-26 17:04:08.000000000 +0000 @@ -3,8 +3,8 @@ " @GIT: http://github.com/tomtom/vimtlib/ " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) " @Created: 2010-09-17. -" @Last Change: 2010-09-17. -" @Revision: 16 +" @Last Change: 2016-01-21. +" @Revision: 18 SpecBegin 'title': 'tlib#date' @@ -38,3 +38,15 @@ Should throw exception "tlib#date#Parse('2000-10-40')", 'TLib: Invalid date' Should throw exception "tlib#date#Parse('2000-10-0')", 'TLib: Invalid date' +Should be equal tlib#date#Shift('2015-10-29', '1m'), '2015-11-29' +Should be equal tlib#date#Shift('2015-11-29', '1m'), '2015-12-29' +Should be equal tlib#date#Shift('2015-12-29', '1m'), '2016-01-29' +Should be equal tlib#date#Shift('2016-01-29', '1m'), '2016-02-29' +Should be equal tlib#date#Shift('2015-10-29', '2m'), '2015-12-29' +Should be equal tlib#date#Shift('2015-10-29', '3m'), '2016-01-29' +Should be equal tlib#date#Shift('2015-10-29', '4m'), '2016-02-29' +Should be equal tlib#date#Shift('2015-12-30', '1d'), '2015-12-31' +Should be equal tlib#date#Shift('2015-12-31', '1d'), '2016-01-01' +Should be equal tlib#date#Shift('2015-12-30', '2d'), '2016-01-01' +Should be equal tlib#date#Shift('2015-12-30', '3d'), '2016-01-02' + diff -Nru vim-tlib-1.13/spec/tlib/eval.vim vim-tlib-1.20/spec/tlib/eval.vim --- vim-tlib-1.13/spec/tlib/eval.vim 1970-01-01 00:00:00.000000000 +0000 +++ vim-tlib-1.20/spec/tlib/eval.vim 2016-01-26 17:04:08.000000000 +0000 @@ -0,0 +1,27 @@ +" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim]) +" @Website: https://github.com/tomtom +" @License: GPL (see http://www.gnu.org/licenses/gpl.txt) +" @Created: 2015-10-26. +" @Last Change: 2015-10-26. + +let s:save_cpo = &cpo +set cpo&vim + + +SpecBegin 'title': 'tlib#eval' + + +let g:eval_a = {'foo': range(0, 5), 'd': {'a': range(0, 5)}} +let g:eval_b = {'foo': range(6, 10), 'd': {'a': range(6, 10), 'b': 2}, 'bar': range(5)} +let g:eval_a0 = deepcopy(g:eval_a) +let g:eval_b0 = deepcopy(g:eval_b) +let g:eval_c = {'foo': range(0, 10), 'd': {'a': range(0, 10), 'b': 2}, 'bar': range(5)} + + +Should be equal tlib#eval#Extend(copy(g:eval_a), g:eval_b), g:eval_c +Should be equal g:eval_a, g:eval_a0 +Should be equal g:eval_b, g:eval_b0 + + +let &cpo = s:save_cpo +unlet s:save_cpo