mirror of
https://github.com/gryf/.vim.git
synced 2026-04-07 00:43:32 +02:00
- updated FuzzyFinder
- moved Pydoc to ftplugin/python - updated pyflakes - added Pygments feature into rst functions
This commit is contained in:
@@ -1,13 +1,12 @@
|
||||
"=============================================================================
|
||||
" Copyright (c) 2007-2009 Takeshi NISHIDA
|
||||
" Copyright (c) 2007-2010 Takeshi NISHIDA
|
||||
"
|
||||
"=============================================================================
|
||||
" LOAD GUARD {{{1
|
||||
|
||||
if exists('g:loaded_autoload_fuf_taggedfile') || v:version < 702
|
||||
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
|
||||
finish
|
||||
endif
|
||||
let g:loaded_autoload_fuf_taggedfile = 1
|
||||
|
||||
" }}}1
|
||||
"=============================================================================
|
||||
@@ -23,6 +22,11 @@ function fuf#taggedfile#getSwitchOrder()
|
||||
return g:fuf_taggedfile_switchOrder
|
||||
endfunction
|
||||
|
||||
"
|
||||
function fuf#taggedfile#getEditableDataNames()
|
||||
return []
|
||||
endfunction
|
||||
|
||||
"
|
||||
function fuf#taggedfile#renewCache()
|
||||
let s:cache = {}
|
||||
@@ -35,7 +39,7 @@ endfunction
|
||||
|
||||
"
|
||||
function fuf#taggedfile#onInit()
|
||||
call fuf#defineLaunchCommand('FufTaggedFile', s:MODE_NAME, '""')
|
||||
call fuf#defineLaunchCommand('FufTaggedFile', s:MODE_NAME, '""', [])
|
||||
endfunction
|
||||
|
||||
" }}}1
|
||||
@@ -47,33 +51,25 @@ let s:MODE_NAME = expand('<sfile>:t:r')
|
||||
"
|
||||
function s:getTaggedFileList(tagfile)
|
||||
execute 'cd ' . fnamemodify(a:tagfile, ':h')
|
||||
let result = map(readfile(a:tagfile), 'matchstr(v:val, ''^[^!\t][^\t]*\t\zs[^\t]\+'')')
|
||||
call map(readfile(a:tagfile), 'fnamemodify(v:val, ":p")')
|
||||
let result = map(l9#readFile(a:tagfile), 'matchstr(v:val, ''^[^!\t][^\t]*\t\zs[^\t]\+'')')
|
||||
call map(l9#readFile(a:tagfile), 'fnamemodify(v:val, ":p")')
|
||||
cd -
|
||||
call map(readfile(a:tagfile), 'fnamemodify(v:val, ":~:.")')
|
||||
call map(l9#readFile(a:tagfile), 'fnamemodify(v:val, ":~:.")')
|
||||
return filter(result, 'v:val =~# ''[^/\\ ]$''')
|
||||
endfunction
|
||||
|
||||
"
|
||||
function s:parseTagFiles(tagFiles)
|
||||
if !empty(g:fuf_taggedfile_cache_dir)
|
||||
if !isdirectory(expand(g:fuf_taggedfile_cache_dir))
|
||||
call mkdir(expand(g:fuf_taggedfile_cache_dir), 'p')
|
||||
endif
|
||||
" NOTE: fnamemodify('a/b', ':p') returns 'a/b/' if the directory exists.
|
||||
let cacheFile = fnamemodify(g:fuf_taggedfile_cache_dir, ':p')
|
||||
\ . fuf#hash224(join(a:tagFiles, "\n"))
|
||||
if filereadable(cacheFile) && fuf#countModifiedFiles(a:tagFiles, getftime(cacheFile)) == 0
|
||||
return map(readfile(cacheFile), 'eval(v:val)')
|
||||
endif
|
||||
function s:parseTagFiles(tagFiles, key)
|
||||
let cacheName = 'cache-' . l9#hash224(a:key)
|
||||
let cacheTime = fuf#getDataFileTime(s:MODE_NAME, cacheName)
|
||||
if cacheTime != -1 && fuf#countModifiedFiles(a:tagFiles, cacheTime) == 0
|
||||
return fuf#loadDataFile(s:MODE_NAME, cacheName)
|
||||
endif
|
||||
let items = fuf#unique(fuf#concat(map(copy(a:tagFiles), 's:getTaggedFileList(v:val)')))
|
||||
let items = l9#unique(l9#concat(map(copy(a:tagFiles), 's:getTaggedFileList(v:val)')))
|
||||
call map(items, 'fuf#makePathItem(v:val, "", 0)')
|
||||
call fuf#mapToSetSerialIndex(items, 1)
|
||||
call fuf#mapToSetAbbrWithSnippedWordAsPath(items)
|
||||
if !empty(g:fuf_taggedfile_cache_dir)
|
||||
call writefile(map(copy(items), 'string(v:val)'), cacheFile)
|
||||
endif
|
||||
call fuf#saveDataFile(s:MODE_NAME, cacheName, items)
|
||||
return items
|
||||
endfunction
|
||||
|
||||
@@ -82,11 +78,11 @@ function s:enumTaggedFiles(tagFiles)
|
||||
if !len(a:tagFiles)
|
||||
return []
|
||||
endif
|
||||
let key = join([getcwd()] + a:tagFiles, "\n")
|
||||
let key = join([getcwd(), g:fuf_ignoreCase] + a:tagFiles, "\n")
|
||||
if !exists('s:cache[key]') || fuf#countModifiedFiles(a:tagFiles, s:cache[key].time)
|
||||
let s:cache[key] = {
|
||||
\ 'time' : localtime(),
|
||||
\ 'items' : s:parseTagFiles(a:tagFiles)
|
||||
\ 'items' : s:parseTagFiles(a:tagFiles, key)
|
||||
\ }
|
||||
endif
|
||||
return s:cache[key].items
|
||||
@@ -105,7 +101,7 @@ endfunction
|
||||
|
||||
"
|
||||
function s:handler.getPrompt()
|
||||
return fuf#formatPrompt(g:fuf_taggedfile_prompt, self.partialMatching)
|
||||
return fuf#formatPrompt(g:fuf_taggedfile_prompt, self.partialMatching, '')
|
||||
endfunction
|
||||
|
||||
"
|
||||
@@ -114,7 +110,7 @@ function s:handler.getPreviewHeight()
|
||||
endfunction
|
||||
|
||||
"
|
||||
function s:handler.targetsPath()
|
||||
function s:handler.isOpenable(enteredPattern)
|
||||
return 1
|
||||
endfunction
|
||||
|
||||
@@ -146,11 +142,12 @@ endfunction
|
||||
|
||||
"
|
||||
function s:handler.onModeEnterPost()
|
||||
" NOTE: Comparing filenames is faster than bufnr('^' . fname . '$')
|
||||
let bufNamePrev = fnamemodify(bufname(self.bufNrPrev), ':p:~:.')
|
||||
" NOTE: Don't do this in onModeEnterPre()
|
||||
" because that should return in a short time.
|
||||
let self.items =
|
||||
\ filter(copy(s:enumTaggedFiles(self.tagFiles)),
|
||||
\ 'bufnr("^" . v:val.word . "$") != self.bufNrPrev')
|
||||
let self.items = copy(s:enumTaggedFiles(self.tagFiles))
|
||||
call filter(self.items, 'v:val.word !=# bufNamePrev')
|
||||
endfunction
|
||||
|
||||
"
|
||||
|
||||
Reference in New Issue
Block a user