mirror of
https://github.com/amix/vimrc
synced 2025-06-16 01:25:00 +08:00
Updated plugins
This commit is contained in:
@ -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: 1389
|
||||
" @Revision: 1391
|
||||
|
||||
" :filedoc:
|
||||
" A prototype used by |tlib#input#List|.
|
||||
@ -985,7 +985,7 @@ function! s:prototype.DisplayHelp() dict "{{{3
|
||||
endif
|
||||
if stridx(self.type, 'm') != -1
|
||||
call self.PushHelp('<S-Up/Down>', '(Un)Select items')
|
||||
call self.PushHelp('#, <C-Space>', '(Un)Select the current item')
|
||||
call self.PushHelp('#', '(Un)Select the current item')
|
||||
call self.PushHelp('<C|M-a>', '(Un)Select all items')
|
||||
call self.PushHelp('<F9>', '(Un)Restrict view to selection')
|
||||
" \ '<c-\> ... Show only selected',
|
||||
|
@ -4,7 +4,7 @@
|
||||
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
||||
" @Created: 2007-06-30.
|
||||
" @Last Change: 2013-09-25.
|
||||
" @Revision: 0.1.230
|
||||
" @Revision: 0.1.243
|
||||
|
||||
|
||||
" The cache directory. If empty, use |tlib#dir#MyRuntime|.'/cache'.
|
||||
@ -88,7 +88,11 @@ function! tlib#cache#Filename(type, ...) "{{{3
|
||||
" TLogVAR file, dir, mkdir
|
||||
let cache_file = tlib#file#Join([dir, file])
|
||||
if len(cache_file) > g:tlib#cache#max_filename
|
||||
let shortfilename = pathshorten(file) .'_'. tlib#hash#Adler32(file)
|
||||
if v:version >= 704
|
||||
let shortfilename = pathshorten(file) .'_'. sha256(file)
|
||||
else
|
||||
let shortfilename = pathshorten(file) .'_'. tlib#hash#Adler32(file)
|
||||
endif
|
||||
let cache_file = tlib#cache#Filename(a:type, shortfilename, mkdir, dir0)
|
||||
else
|
||||
if mkdir && !isdirectory(dir)
|
||||
@ -108,9 +112,32 @@ function! tlib#cache#Filename(type, ...) "{{{3
|
||||
endf
|
||||
|
||||
|
||||
let s:timestamps = {}
|
||||
|
||||
|
||||
function! s:SetTimestamp(cfile, type) "{{{3
|
||||
if !has_key(s:timestamps, a:cfile)
|
||||
let s:timestamps[a:cfile] = {}
|
||||
endif
|
||||
let s:timestamps[a:cfile].atime = getftime(a:cfile)
|
||||
let s:timestamps[a:cfile][a:type] = s:timestamps[a:cfile].atime
|
||||
endf
|
||||
|
||||
|
||||
function! tlib#cache#Save(cfile, dictionary) "{{{3
|
||||
" TLogVAR a:cfile, a:dictionary
|
||||
call tlib#persistent#Save(a:cfile, a:dictionary)
|
||||
if !empty(a:cfile)
|
||||
" TLogVAR a:dictionary
|
||||
call writefile([string(a:dictionary)], a:cfile, 'b')
|
||||
call s:SetTimestamp(a:cfile, 'write')
|
||||
endif
|
||||
endf
|
||||
|
||||
|
||||
function! tlib#cache#MTime(cfile) "{{{3
|
||||
let mtime = {'mtime': getftime(a:cfile)}
|
||||
let mtime = extend(mtime, get(s:timestamps, a:cfile, {}))
|
||||
return mtime
|
||||
endf
|
||||
|
||||
|
||||
@ -118,6 +145,7 @@ 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"))
|
||||
else
|
||||
let default = a:0 >= 1 ? a:1 : {}
|
||||
@ -130,14 +158,9 @@ endf
|
||||
" 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)
|
||||
if empty(a:generator) && a:0 >= 1
|
||||
" TLogVAR a:1
|
||||
let val = a:1
|
||||
else
|
||||
let args = a:0 >= 1 ? a:1 : []
|
||||
" TLogVAR a:generator, args
|
||||
let val = call(a:generator, args)
|
||||
endif
|
||||
let args = a:0 >= 1 ? a:1 : []
|
||||
" TLogVAR a:generator, args
|
||||
let val = call(a:generator, args)
|
||||
" TLogVAR val
|
||||
let cval = {'val': val}
|
||||
" TLogVAR cval
|
||||
|
@ -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: 1315
|
||||
" @Revision: 1317
|
||||
|
||||
|
||||
" :filedoc:
|
||||
@ -325,6 +325,8 @@ function! tlib#input#ListW(world, ...) "{{{3
|
||||
" TLogVAR world.state, world.sticky, world.initial_index
|
||||
" let statusline = &l:statusline
|
||||
" let laststatus = &laststatus
|
||||
let showmode = &showmode
|
||||
set noshowmode
|
||||
let lastsearch = @/
|
||||
let scrolloff = &l:scrolloff
|
||||
let &l:scrolloff = 0
|
||||
@ -779,6 +781,9 @@ function! tlib#input#ListW(world, ...) "{{{3
|
||||
" TLogVAR statusline
|
||||
" let &l:statusline = statusline
|
||||
" let &laststatus = laststatus
|
||||
if &showmode != showmode
|
||||
let &showmode = showmode
|
||||
endif
|
||||
silent! let @/ = lastsearch
|
||||
let &l:scrolloff = scrolloff
|
||||
if s:PopupmenuExists() == 1
|
||||
|
@ -4,7 +4,7 @@
|
||||
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
||||
" @Created: 2007-06-30.
|
||||
" @Last Change: 2011-03-18.
|
||||
" @Revision: 36
|
||||
" @Revision: 53
|
||||
|
||||
|
||||
""" List related functions {{{1
|
||||
@ -140,25 +140,29 @@ endf
|
||||
|
||||
|
||||
function! tlib#list#Uniq(list, ...) "{{{3
|
||||
TVarArg ['get_value', '']
|
||||
let s:uniq_values = {}
|
||||
TVarArg ['get_value', ''], ['remove_empty', 0]
|
||||
if remove_empty
|
||||
call filter(a:list, 'type(v:val) == 0 || !empty(v:val)')
|
||||
endif
|
||||
" CREDITS: Based on syntastic#util#unique(list) by scrooloose
|
||||
let seen = {}
|
||||
let uniques = []
|
||||
if empty(get_value)
|
||||
call filter(a:list, 's:UniqValue(v:val)')
|
||||
for e in a:list
|
||||
if !has_key(seen, e)
|
||||
let seen[e] = 1
|
||||
call add(uniques, e)
|
||||
endif
|
||||
endfor
|
||||
else
|
||||
call filter(a:list, 's:UniqValue(eval(printf(get_value, string(v:val))))')
|
||||
for e in a:list
|
||||
let v = eval(printf(get_value, string(e)))
|
||||
if !has_key(seen, v)
|
||||
let seen[v] = 1
|
||||
call add(uniques, e)
|
||||
endif
|
||||
endfor
|
||||
endif
|
||||
unlet s:uniq_values
|
||||
return a:list
|
||||
return uniques
|
||||
endf
|
||||
|
||||
|
||||
function! s:UniqValue(value) "{{{3
|
||||
if get(s:uniq_values, a:value, 0)
|
||||
return 0
|
||||
else
|
||||
let s:uniq_values[a:value] = 1
|
||||
return 1
|
||||
endif
|
||||
endf
|
||||
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
||||
" @Created: 2012-05-11.
|
||||
" @Last Change: 2012-05-11.
|
||||
" @Revision: 9
|
||||
" @Revision: 12
|
||||
|
||||
" The directory for persistent data files. If empty, use
|
||||
" |tlib#dir#MyRuntime|.'/share'.
|
||||
@ -33,14 +33,15 @@ function! tlib#persistent#Get(...) "{{{3
|
||||
return call('tlib#cache#Get', a:000)
|
||||
endf
|
||||
|
||||
function! tlib#persistent#MTime(cfile) "{{{3
|
||||
return tlib#cache#MTime(a:cfile)
|
||||
endf
|
||||
|
||||
function! tlib#persistent#Value(...) "{{{3
|
||||
return call('tlib#cache#Value', a:000)
|
||||
endf
|
||||
|
||||
function! tlib#persistent#Save(cfile, dictionary) "{{{3
|
||||
if !empty(a:cfile)
|
||||
" TLogVAR a:dictionary
|
||||
call writefile([string(a:dictionary)], a:cfile, 'b')
|
||||
endif
|
||||
call tlib#cache#Save(a:cfile, a:dictionary)
|
||||
endf
|
||||
|
||||
|
Reference in New Issue
Block a user