mirror of
https://github.com/gryf/.vim.git
synced 2025-12-18 03:50:30 +01: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_help') || v:version < 702
|
||||
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
|
||||
finish
|
||||
endif
|
||||
let g:loaded_autoload_fuf_help = 1
|
||||
|
||||
" }}}1
|
||||
"=============================================================================
|
||||
@@ -23,6 +22,11 @@ function fuf#help#getSwitchOrder()
|
||||
return g:fuf_help_switchOrder
|
||||
endfunction
|
||||
|
||||
"
|
||||
function fuf#help#getEditableDataNames()
|
||||
return []
|
||||
endfunction
|
||||
|
||||
"
|
||||
function fuf#help#renewCache()
|
||||
let s:cache = {}
|
||||
@@ -35,8 +39,8 @@ endfunction
|
||||
|
||||
"
|
||||
function fuf#help#onInit()
|
||||
call fuf#defineLaunchCommand('FufHelp' , s:MODE_NAME, '""')
|
||||
call fuf#defineLaunchCommand('FufHelpWithCursorWord', s:MODE_NAME, 'expand(''<cword>'')')
|
||||
call fuf#defineLaunchCommand('FufHelp' , s:MODE_NAME, '""', [])
|
||||
call fuf#defineLaunchCommand('FufHelpWithCursorWord', s:MODE_NAME, 'expand(''<cword>'')', [])
|
||||
endfunction
|
||||
|
||||
" }}}1
|
||||
@@ -47,7 +51,7 @@ let s:MODE_NAME = expand('<sfile>:t:r')
|
||||
|
||||
"
|
||||
function s:getCurrentHelpTagFiles()
|
||||
let prefix = 'doc' . fuf#getPathSeparator()
|
||||
let prefix = 'doc' . l9#getPathSeparator()
|
||||
let tagFiles = split(globpath(&runtimepath, prefix . 'tags' ), "\n")
|
||||
\ + split(globpath(&runtimepath, prefix . 'tags-??'), "\n")
|
||||
return sort(map(tagFiles, 'fnamemodify(v:val, ":p")'))
|
||||
@@ -65,7 +69,7 @@ function s:parseHelpTagEntry(line, tagFile)
|
||||
else
|
||||
let suffix = '@' . suffix
|
||||
endif
|
||||
let dir = fnamemodify(a:tagFile, ':h') . fuf#getPathSeparator()
|
||||
let dir = fnamemodify(a:tagFile, ':h') . l9#getPathSeparator()
|
||||
return {
|
||||
\ 'word' : elements[0] . suffix,
|
||||
\ 'path' : dir . elements[1],
|
||||
@@ -75,30 +79,22 @@ endfunction
|
||||
|
||||
"
|
||||
function s:getHelpTagEntries(tagFile)
|
||||
let names = map(readfile(a:tagFile), 's:parseHelpTagEntry(v:val, a:tagFile)')
|
||||
let names = map(l9#readFile(a:tagFile), 's:parseHelpTagEntry(v:val, a:tagFile)')
|
||||
return filter(names, '!empty(v:val)')
|
||||
endfunction
|
||||
|
||||
"
|
||||
function s:parseHelpTagFiles(tagFiles)
|
||||
if !empty(g:fuf_help_cache_dir)
|
||||
if !isdirectory(expand(g:fuf_help_cache_dir))
|
||||
call mkdir(expand(g:fuf_help_cache_dir), 'p')
|
||||
endif
|
||||
" NOTE: fnamemodify('a/b', ':p') returns 'a/b/' if the directory exists.
|
||||
let cacheFile = fnamemodify(g:fuf_help_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:parseHelpTagFiles(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:getHelpTagEntries(v:val)')))
|
||||
let items = l9#unique(l9#concat(map(copy(a:tagFiles), 's:getHelpTagEntries(v:val)')))
|
||||
let items = map(items, 'extend(v:val, fuf#makeNonPathItem(v:val.word, ""))')
|
||||
call fuf#mapToSetSerialIndex(items, 1)
|
||||
let items = map(items, 'fuf#setAbbrWithFormattedWord(v:val, 1)')
|
||||
if !empty(g:fuf_help_cache_dir)
|
||||
call writefile(map(copy(items), 'string(v:val)'), cacheFile)
|
||||
endif
|
||||
call fuf#saveDataFile(s:MODE_NAME, cacheName, items)
|
||||
return items
|
||||
endfunction
|
||||
|
||||
@@ -107,11 +103,11 @@ function s:enumHelpTags(tagFiles)
|
||||
if !len(a:tagFiles)
|
||||
return []
|
||||
endif
|
||||
let key = join(a:tagFiles, "\n")
|
||||
let key = join([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:parseHelpTagFiles(a:tagFiles)
|
||||
\ 'items' : s:parseHelpTagFiles(a:tagFiles, key)
|
||||
\ }
|
||||
endif
|
||||
return s:cache[key].items
|
||||
@@ -143,7 +139,7 @@ endfunction
|
||||
|
||||
"
|
||||
function s:handler.getPrompt()
|
||||
return fuf#formatPrompt(g:fuf_help_prompt, self.partialMatching)
|
||||
return fuf#formatPrompt(g:fuf_help_prompt, self.partialMatching, '')
|
||||
endfunction
|
||||
|
||||
"
|
||||
@@ -152,8 +148,8 @@ function s:handler.getPreviewHeight()
|
||||
endfunction
|
||||
|
||||
"
|
||||
function s:handler.targetsPath()
|
||||
return 0
|
||||
function s:handler.isOpenable(enteredPattern)
|
||||
return 1
|
||||
endfunction
|
||||
|
||||
"
|
||||
|
||||
Reference in New Issue
Block a user