mirror of
https://github.com/gryf/.vim.git
synced 2025-12-17 11:30:29 +01:00
- updated FuzzyFinder
- moved Pydoc to ftplugin/python - updated pyflakes - added Pygments feature into rst functions
This commit is contained in:
731
autoload/fuf.vim
731
autoload/fuf.vim
File diff suppressed because it is too large
Load Diff
@@ -1,211 +0,0 @@
|
||||
"=============================================================================
|
||||
" Copyright (c) 2007-2009 Takeshi NISHIDA
|
||||
"
|
||||
"=============================================================================
|
||||
" LOAD GUARD {{{1
|
||||
|
||||
if exists('g:loaded_autoload_fuf_bookmark') || v:version < 702
|
||||
finish
|
||||
endif
|
||||
let g:loaded_autoload_fuf_bookmark = 1
|
||||
|
||||
" }}}1
|
||||
"=============================================================================
|
||||
" GLOBAL FUNCTIONS {{{1
|
||||
|
||||
"
|
||||
function fuf#bookmark#createHandler(base)
|
||||
return a:base.concretize(copy(s:handler))
|
||||
endfunction
|
||||
|
||||
"
|
||||
function fuf#bookmark#getSwitchOrder()
|
||||
return g:fuf_bookmark_switchOrder
|
||||
endfunction
|
||||
|
||||
"
|
||||
function fuf#bookmark#renewCache()
|
||||
endfunction
|
||||
|
||||
"
|
||||
function fuf#bookmark#requiresOnCommandPre()
|
||||
return 0
|
||||
endfunction
|
||||
|
||||
"
|
||||
function fuf#bookmark#onInit()
|
||||
call fuf#defineLaunchCommand('FufBookmark', s:MODE_NAME, '""')
|
||||
command! -bang -narg=? FufAddBookmark call s:bookmarkHere(<q-args>)
|
||||
command! -bang -narg=0 -range FufAddBookmarkAsSelectedText call s:bookmarkHere(s:getSelectedText())
|
||||
endfunction
|
||||
|
||||
" }}}1
|
||||
"=============================================================================
|
||||
" LOCAL FUNCTIONS/VARIABLES {{{1
|
||||
|
||||
let s:MODE_NAME = expand('<sfile>:t:r')
|
||||
let s:OPEN_TYPE_DELETE = -1
|
||||
|
||||
"
|
||||
function s:getSelectedText()
|
||||
let reg_ = [@", getregtype('"')]
|
||||
let regA = [@a, getregtype('a')]
|
||||
if mode() =~# "[vV\<C-v>]"
|
||||
silent normal! "aygv
|
||||
else
|
||||
let pos = getpos('.')
|
||||
silent normal! gv"ay
|
||||
call setpos('.', pos)
|
||||
endif
|
||||
let text = @a
|
||||
call setreg('"', reg_[0], reg_[1])
|
||||
call setreg('a', regA[0], regA[1])
|
||||
return text
|
||||
endfunction
|
||||
|
||||
" opens a:path and jumps to the line matching to a:pattern from a:lnum within
|
||||
" a:range. if not found, jumps to a:lnum.
|
||||
function s:jumpToBookmark(path, mode, pattern, lnum)
|
||||
call fuf#openFile(a:path, a:mode, g:fuf_reuseWindow)
|
||||
call cursor(s:getMatchingLineNumber(getline(1, '$'), a:pattern, a:lnum), 0)
|
||||
normal! zvzz
|
||||
endfunction
|
||||
|
||||
"
|
||||
function s:getMatchingLineNumber(lines, pattern, lnumBegin)
|
||||
let l = min([a:lnumBegin, len(a:lines)])
|
||||
for [l0, l1] in map(range(0, g:fuf_bookmark_searchRange),
|
||||
\ '[l + v:val, l - v:val]')
|
||||
if l0 <= len(a:lines) && a:lines[l0 - 1] =~# a:pattern
|
||||
return l0
|
||||
elseif l1 >= 0 && a:lines[l1 - 1] =~# a:pattern
|
||||
return l1
|
||||
endif
|
||||
endfor
|
||||
return l
|
||||
endfunction
|
||||
|
||||
"
|
||||
function s:getLinePattern(lnum)
|
||||
return '\C\V\^' . escape(getline(a:lnum), '\') . '\$'
|
||||
endfunction
|
||||
|
||||
"
|
||||
function s:bookmarkHere(word)
|
||||
if !empty(&buftype) || expand('%') !~ '\S'
|
||||
call fuf#echoWithHl('Can''t bookmark this buffer.', 'WarningMsg')
|
||||
return
|
||||
endif
|
||||
let item = {
|
||||
\ 'word' : (a:word =~# '\S' ? substitute(a:word, '\n', ' ', 'g')
|
||||
\ : pathshorten(expand('%:p:~')) . '|' . line('.') . '| ' . getline('.')),
|
||||
\ 'path' : expand('%:p'),
|
||||
\ 'lnum' : line('.'),
|
||||
\ 'pattern' : s:getLinePattern(line('.')),
|
||||
\ 'time' : localtime(),
|
||||
\ }
|
||||
let item.word = fuf#inputHl('Bookmark as:', item.word, 'Question')
|
||||
if item.word !~ '\S'
|
||||
call fuf#echoWithHl('Canceled', 'WarningMsg')
|
||||
return
|
||||
endif
|
||||
let info = fuf#loadInfoFile(s:MODE_NAME)
|
||||
call insert(info.data, item)
|
||||
call fuf#saveInfoFile(s:MODE_NAME, info)
|
||||
endfunction
|
||||
|
||||
"
|
||||
function s:findItem(items, word)
|
||||
for item in a:items
|
||||
if item.word ==# a:word
|
||||
return item
|
||||
endif
|
||||
endfor
|
||||
return {}
|
||||
endfunction
|
||||
|
||||
" }}}1
|
||||
"=============================================================================
|
||||
" s:handler {{{1
|
||||
|
||||
let s:handler = {}
|
||||
|
||||
"
|
||||
function s:handler.getModeName()
|
||||
return s:MODE_NAME
|
||||
endfunction
|
||||
|
||||
"
|
||||
function s:handler.getPrompt()
|
||||
return fuf#formatPrompt(g:fuf_bookmark_prompt, self.partialMatching)
|
||||
endfunction
|
||||
|
||||
"
|
||||
function s:handler.getPreviewHeight()
|
||||
return g:fuf_previewHeight
|
||||
endfunction
|
||||
|
||||
"
|
||||
function s:handler.targetsPath()
|
||||
return 0
|
||||
endfunction
|
||||
|
||||
"
|
||||
function s:handler.makePatternSet(patternBase)
|
||||
return fuf#makePatternSet(a:patternBase, 's:interpretPrimaryPatternForNonPath',
|
||||
\ self.partialMatching)
|
||||
endfunction
|
||||
|
||||
"
|
||||
function s:handler.makePreviewLines(word, count)
|
||||
let item = s:findItem(self.info.data, a:word)
|
||||
let lines = fuf#getFileLines(item.path)
|
||||
if empty(lines)
|
||||
return []
|
||||
endif
|
||||
let index = s:getMatchingLineNumber(lines, item.pattern, item.lnum) - 1
|
||||
return fuf#makePreviewLinesAround(
|
||||
\ lines, [index], a:count, self.getPreviewHeight())
|
||||
endfunction
|
||||
|
||||
"
|
||||
function s:handler.getCompleteItems(patternPrimary)
|
||||
return self.items
|
||||
endfunction
|
||||
|
||||
"
|
||||
function s:handler.onOpen(word, mode)
|
||||
if a:mode == s:OPEN_TYPE_DELETE
|
||||
call filter(self.info.data, 'v:val.word !=# a:word')
|
||||
call fuf#saveInfoFile(s:MODE_NAME, self.info)
|
||||
call fuf#launch(s:MODE_NAME, self.lastPattern, self.partialMatching)
|
||||
return
|
||||
else
|
||||
let item = s:findItem(self.info.data, a:word)
|
||||
if !empty(item)
|
||||
call s:jumpToBookmark(item.path, a:mode, item.pattern, item.lnum)
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
|
||||
"
|
||||
function s:handler.onModeEnterPre()
|
||||
endfunction
|
||||
|
||||
"
|
||||
function s:handler.onModeEnterPost()
|
||||
call fuf#defineKeyMappingInHandler(g:fuf_bookmark_keyDelete,
|
||||
\ 'onCr(' . s:OPEN_TYPE_DELETE . ', 0)')
|
||||
let self.items = copy(self.info.data)
|
||||
call map(self.items, 'fuf#makeNonPathItem(v:val.word, strftime(g:fuf_timeFormat, v:val.time))')
|
||||
call fuf#mapToSetSerialIndex(self.items, 1)
|
||||
call map(self.items, 'fuf#setAbbrWithFormattedWord(v:val, 1)')
|
||||
endfunction
|
||||
|
||||
"
|
||||
function s:handler.onModeLeavePost(opened)
|
||||
endfunction
|
||||
|
||||
" }}}1
|
||||
"=============================================================================
|
||||
" vim: set fdm=marker:
|
||||
@@ -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_buffer') || v:version < 702
|
||||
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
|
||||
finish
|
||||
endif
|
||||
let g:loaded_autoload_fuf_buffer = 1
|
||||
|
||||
" }}}1
|
||||
"=============================================================================
|
||||
@@ -23,6 +22,11 @@ function fuf#buffer#getSwitchOrder()
|
||||
return g:fuf_buffer_switchOrder
|
||||
endfunction
|
||||
|
||||
"
|
||||
function fuf#buffer#getEditableDataNames()
|
||||
return []
|
||||
endfunction
|
||||
|
||||
"
|
||||
function fuf#buffer#renewCache()
|
||||
endfunction
|
||||
@@ -34,7 +38,7 @@ endfunction
|
||||
|
||||
"
|
||||
function fuf#buffer#onInit()
|
||||
call fuf#defineLaunchCommand('FufBuffer', s:MODE_NAME, '""')
|
||||
call fuf#defineLaunchCommand('FufBuffer', s:MODE_NAME, '""', [])
|
||||
augroup fuf#buffer
|
||||
autocmd!
|
||||
autocmd BufEnter * call s:updateBufTimes()
|
||||
@@ -47,6 +51,7 @@ endfunction
|
||||
" LOCAL FUNCTIONS/VARIABLES {{{1
|
||||
|
||||
let s:MODE_NAME = expand('<sfile>:t:r')
|
||||
let s:OPEN_TYPE_DELETE = -1
|
||||
|
||||
let s:bufTimes = {}
|
||||
|
||||
@@ -59,7 +64,7 @@ endfunction
|
||||
function s:makeItem(nr)
|
||||
let fname = (empty(bufname(a:nr))
|
||||
\ ? '[No Name]'
|
||||
\ : fnamemodify(bufname(a:nr), ':~:.'))
|
||||
\ : fnamemodify(bufname(a:nr), ':p:~:.'))
|
||||
let time = (exists('s:bufTimes[a:nr]') ? s:bufTimes[a:nr] : 0)
|
||||
let item = fuf#makePathItem(fname, strftime(g:fuf_timeFormat, time), 0)
|
||||
let item.index = a:nr
|
||||
@@ -110,7 +115,7 @@ endfunction
|
||||
|
||||
"
|
||||
function s:handler.getPrompt()
|
||||
return fuf#formatPrompt(g:fuf_buffer_prompt, self.partialMatching)
|
||||
return fuf#formatPrompt(g:fuf_buffer_prompt, self.partialMatching, '')
|
||||
endfunction
|
||||
|
||||
"
|
||||
@@ -119,7 +124,7 @@ function s:handler.getPreviewHeight()
|
||||
endfunction
|
||||
|
||||
"
|
||||
function s:handler.targetsPath()
|
||||
function s:handler.isOpenable(enteredPattern)
|
||||
return 1
|
||||
endfunction
|
||||
|
||||
@@ -147,7 +152,12 @@ endfunction
|
||||
function s:handler.onOpen(word, mode)
|
||||
" not use bufnr(a:word) in order to handle unnamed buffer
|
||||
let item = s:findItem(self.items, a:word)
|
||||
if !empty(item)
|
||||
if empty(item)
|
||||
" do nothing
|
||||
elseif a:mode ==# s:OPEN_TYPE_DELETE
|
||||
execute item.bufNr . 'bdelete'
|
||||
let self.reservedMode = self.getModeName()
|
||||
else
|
||||
call fuf#openBuffer(item.bufNr, a:mode, g:fuf_reuseWindow)
|
||||
endif
|
||||
endfunction
|
||||
@@ -158,11 +168,14 @@ endfunction
|
||||
|
||||
"
|
||||
function s:handler.onModeEnterPost()
|
||||
let self.items = map(filter(range(1, bufnr('$')),
|
||||
\ 'buflisted(v:val) && v:val != self.bufNrPrev'),
|
||||
\ 's:makeItem(v:val)')
|
||||
call fuf#defineKeyMappingInHandler(g:fuf_buffer_keyDelete,
|
||||
\ 'onCr(' . s:OPEN_TYPE_DELETE . ')')
|
||||
let self.items = range(1, bufnr('$'))
|
||||
call filter(self.items, 'buflisted(v:val) && v:val != self.bufNrPrev && v:val != bufnr("%")')
|
||||
call map(self.items, 's:makeItem(v:val)')
|
||||
if g:fuf_buffer_mruOrder
|
||||
call fuf#mapToSetSerialIndex(sort(self.items, 's:compareTimeDescending'), 1)
|
||||
call sort(self.items, 's:compareTimeDescending')
|
||||
call fuf#mapToSetSerialIndex(self.items, 1)
|
||||
endif
|
||||
let self.items = fuf#mapToSetAbbrWithSnippedWordAsPath(self.items)
|
||||
endfunction
|
||||
|
||||
@@ -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_callbackfile') || v:version < 702
|
||||
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
|
||||
finish
|
||||
endif
|
||||
let g:loaded_autoload_fuf_callbackfile = 1
|
||||
|
||||
" }}}1
|
||||
"=============================================================================
|
||||
@@ -23,6 +22,11 @@ function fuf#callbackfile#getSwitchOrder()
|
||||
return -1
|
||||
endfunction
|
||||
|
||||
"
|
||||
function fuf#callbackfile#getEditableDataNames()
|
||||
return []
|
||||
endfunction
|
||||
|
||||
"
|
||||
function fuf#callbackfile#renewCache()
|
||||
let s:cache = {}
|
||||
@@ -53,7 +57,7 @@ let s:MODE_NAME = expand('<sfile>:t:r')
|
||||
|
||||
"
|
||||
function s:enumItems(dir)
|
||||
let key = getcwd() . s:exclude . "\n" . a:dir
|
||||
let key = getcwd() . g:fuf_ignoreCase . s:exclude . "\n" . a:dir
|
||||
if !exists('s:cache[key]')
|
||||
let s:cache[key] = fuf#enumExpandedDirsEntries(a:dir, s:exclude)
|
||||
if isdirectory(a:dir)
|
||||
@@ -78,7 +82,7 @@ endfunction
|
||||
|
||||
"
|
||||
function s:handler.getPrompt()
|
||||
return fuf#formatPrompt(s:prompt, self.partialMatching)
|
||||
return fuf#formatPrompt(s:prompt, self.partialMatching, '')
|
||||
endfunction
|
||||
|
||||
"
|
||||
@@ -87,8 +91,8 @@ function s:handler.getPreviewHeight()
|
||||
endfunction
|
||||
|
||||
"
|
||||
function s:handler.targetsPath()
|
||||
return 1
|
||||
function s:handler.isOpenable(enteredPattern)
|
||||
return a:enteredPattern =~# '[^/\\]$'
|
||||
endfunction
|
||||
|
||||
"
|
||||
@@ -123,7 +127,7 @@ endfunction
|
||||
|
||||
"
|
||||
function s:handler.onModeLeavePost(opened)
|
||||
if !a:opened
|
||||
if !a:opened && exists('s:listener.onAbort()')
|
||||
call s:listener.onAbort()
|
||||
endif
|
||||
endfunction
|
||||
|
||||
@@ -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_callbackitem') || v:version < 702
|
||||
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
|
||||
finish
|
||||
endif
|
||||
let g:loaded_autoload_fuf_callbackitem = 1
|
||||
|
||||
" }}}1
|
||||
"=============================================================================
|
||||
@@ -23,6 +22,11 @@ function fuf#callbackitem#getSwitchOrder()
|
||||
return -1
|
||||
endfunction
|
||||
|
||||
"
|
||||
function fuf#callbackitem#getEditableDataNames()
|
||||
return []
|
||||
endfunction
|
||||
|
||||
"
|
||||
function fuf#callbackitem#renewCache()
|
||||
endfunction
|
||||
@@ -73,7 +77,7 @@ endfunction
|
||||
|
||||
"
|
||||
function s:handler.getPrompt()
|
||||
return fuf#formatPrompt(s:prompt, self.partialMatching)
|
||||
return fuf#formatPrompt(s:prompt, self.partialMatching, '')
|
||||
endfunction
|
||||
|
||||
"
|
||||
@@ -85,8 +89,8 @@ function s:handler.getPreviewHeight()
|
||||
endfunction
|
||||
|
||||
"
|
||||
function s:handler.targetsPath()
|
||||
return s:forPath
|
||||
function s:handler.isOpenable(enteredPattern)
|
||||
return 1
|
||||
endfunction
|
||||
|
||||
"
|
||||
@@ -125,7 +129,7 @@ endfunction
|
||||
|
||||
"
|
||||
function s:handler.onModeLeavePost(opened)
|
||||
if !a:opened
|
||||
if !a:opened && exists('s:listener.onAbort()')
|
||||
call s:listener.onAbort()
|
||||
endif
|
||||
endfunction
|
||||
|
||||
@@ -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_changelist') || v:version < 702
|
||||
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
|
||||
finish
|
||||
endif
|
||||
let g:loaded_autoload_fuf_changelist = 1
|
||||
|
||||
" }}}1
|
||||
"=============================================================================
|
||||
@@ -23,6 +22,11 @@ function fuf#changelist#getSwitchOrder()
|
||||
return g:fuf_changelist_switchOrder
|
||||
endfunction
|
||||
|
||||
"
|
||||
function fuf#changelist#getEditableDataNames()
|
||||
return []
|
||||
endfunction
|
||||
|
||||
"
|
||||
function fuf#changelist#renewCache()
|
||||
endfunction
|
||||
@@ -34,7 +38,7 @@ endfunction
|
||||
|
||||
"
|
||||
function fuf#changelist#onInit()
|
||||
call fuf#defineLaunchCommand('FufChangeList', s:MODE_NAME, '""')
|
||||
call fuf#defineLaunchCommand('FufChangeList', s:MODE_NAME, '""', [])
|
||||
endfunction
|
||||
|
||||
" }}}1
|
||||
@@ -91,7 +95,7 @@ endfunction
|
||||
|
||||
"
|
||||
function s:handler.getPrompt()
|
||||
return fuf#formatPrompt(g:fuf_changelist_prompt, self.partialMatching)
|
||||
return fuf#formatPrompt(g:fuf_changelist_prompt, self.partialMatching, '')
|
||||
endfunction
|
||||
|
||||
"
|
||||
@@ -100,8 +104,8 @@ function s:handler.getPreviewHeight()
|
||||
endfunction
|
||||
|
||||
"
|
||||
function s:handler.targetsPath()
|
||||
return 0
|
||||
function s:handler.isOpenable(enteredPattern)
|
||||
return 1
|
||||
endfunction
|
||||
|
||||
"
|
||||
|
||||
@@ -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_dir') || v:version < 702
|
||||
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
|
||||
finish
|
||||
endif
|
||||
let g:loaded_autoload_fuf_dir = 1
|
||||
|
||||
" }}}1
|
||||
"=============================================================================
|
||||
@@ -23,6 +22,11 @@ function fuf#dir#getSwitchOrder()
|
||||
return g:fuf_dir_switchOrder
|
||||
endfunction
|
||||
|
||||
"
|
||||
function fuf#dir#getEditableDataNames()
|
||||
return []
|
||||
endfunction
|
||||
|
||||
"
|
||||
function fuf#dir#renewCache()
|
||||
let s:cache = {}
|
||||
@@ -35,9 +39,9 @@ endfunction
|
||||
|
||||
"
|
||||
function fuf#dir#onInit()
|
||||
call fuf#defineLaunchCommand('FufDir' , s:MODE_NAME, '""')
|
||||
call fuf#defineLaunchCommand('FufDirWithFullCwd' , s:MODE_NAME, 'fnamemodify(getcwd(), '':p'')')
|
||||
call fuf#defineLaunchCommand('FufDirWithCurrentBufferDir', s:MODE_NAME, 'expand(''%:~:.'')[:-1-len(expand(''%:~:.:t''))]')
|
||||
call fuf#defineLaunchCommand('FufDir' , s:MODE_NAME, '""', [])
|
||||
call fuf#defineLaunchCommand('FufDirWithFullCwd' , s:MODE_NAME, 'fnamemodify(getcwd(), '':p'')', [])
|
||||
call fuf#defineLaunchCommand('FufDirWithCurrentBufferDir', s:MODE_NAME, 'expand(''%:~:.'')[:-1-len(expand(''%:~:.:t''))]', [])
|
||||
endfunction
|
||||
|
||||
" }}}1
|
||||
@@ -48,7 +52,7 @@ let s:MODE_NAME = expand('<sfile>:t:r')
|
||||
|
||||
"
|
||||
function s:enumItems(dir)
|
||||
let key = getcwd() . g:fuf_dir_exclude . "\n" . a:dir
|
||||
let key = getcwd() . g:fuf_ignoreCase . g:fuf_dir_exclude . "\n" . a:dir
|
||||
if !exists('s:cache[key]')
|
||||
let s:cache[key] = fuf#enumExpandedDirsEntries(a:dir, g:fuf_dir_exclude)
|
||||
call filter(s:cache[key], 'v:val.word =~# ''[/\\]$''')
|
||||
@@ -74,7 +78,7 @@ endfunction
|
||||
|
||||
"
|
||||
function s:handler.getPrompt()
|
||||
return fuf#formatPrompt(g:fuf_dir_prompt, self.partialMatching)
|
||||
return fuf#formatPrompt(g:fuf_dir_prompt, self.partialMatching, '')
|
||||
endfunction
|
||||
|
||||
"
|
||||
@@ -83,8 +87,8 @@ function s:handler.getPreviewHeight()
|
||||
endfunction
|
||||
|
||||
"
|
||||
function s:handler.targetsPath()
|
||||
return 1
|
||||
function s:handler.isOpenable(enteredPattern)
|
||||
return a:enteredPattern =~# '[^/\\]$'
|
||||
endfunction
|
||||
|
||||
"
|
||||
@@ -96,7 +100,7 @@ endfunction
|
||||
"
|
||||
function s:handler.makePreviewLines(word, count)
|
||||
return fuf#makePreviewLinesAround(
|
||||
\ split(glob(fnamemodify(a:word, ':p') . '*'), "\n"),
|
||||
\ fuf#glob(fnamemodify(a:word, ':p') . '*'),
|
||||
\ [], a:count, self.getPreviewHeight())
|
||||
return
|
||||
endfunction
|
||||
|
||||
@@ -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_file') || v:version < 702
|
||||
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
|
||||
finish
|
||||
endif
|
||||
let g:loaded_autoload_fuf_file = 1
|
||||
|
||||
" }}}1
|
||||
"=============================================================================
|
||||
@@ -23,6 +22,11 @@ function fuf#file#getSwitchOrder()
|
||||
return g:fuf_file_switchOrder
|
||||
endfunction
|
||||
|
||||
"
|
||||
function fuf#file#getEditableDataNames()
|
||||
return []
|
||||
endfunction
|
||||
|
||||
"
|
||||
function fuf#file#renewCache()
|
||||
let s:cache = {}
|
||||
@@ -35,9 +39,9 @@ endfunction
|
||||
|
||||
"
|
||||
function fuf#file#onInit()
|
||||
call fuf#defineLaunchCommand('FufFile' , s:MODE_NAME, '""')
|
||||
call fuf#defineLaunchCommand('FufFileWithFullCwd' , s:MODE_NAME, 'fnamemodify(getcwd(), '':p'')')
|
||||
call fuf#defineLaunchCommand('FufFileWithCurrentBufferDir', s:MODE_NAME, 'expand(''%:~:.'')[:-1-len(expand(''%:~:.:t''))]')
|
||||
call fuf#defineLaunchCommand('FufFile' , s:MODE_NAME, '""', [])
|
||||
call fuf#defineLaunchCommand('FufFileWithFullCwd' , s:MODE_NAME, 'fnamemodify(getcwd(), '':p'')', [])
|
||||
call fuf#defineLaunchCommand('FufFileWithCurrentBufferDir', s:MODE_NAME, 'expand(''%:~:.'')[:-1-len(expand(''%:~:.:t''))]', [])
|
||||
endfunction
|
||||
|
||||
" }}}1
|
||||
@@ -48,7 +52,7 @@ let s:MODE_NAME = expand('<sfile>:t:r')
|
||||
|
||||
"
|
||||
function s:enumItems(dir)
|
||||
let key = getcwd() . g:fuf_file_exclude . "\n" . a:dir
|
||||
let key = join([getcwd(), g:fuf_ignoreCase, g:fuf_file_exclude, a:dir], "\n")
|
||||
if !exists('s:cache[key]')
|
||||
let s:cache[key] = fuf#enumExpandedDirsEntries(a:dir, g:fuf_file_exclude)
|
||||
call fuf#mapToSetSerialIndex(s:cache[key], 1)
|
||||
@@ -58,15 +62,13 @@ function s:enumItems(dir)
|
||||
endfunction
|
||||
|
||||
"
|
||||
function s:enumNonCurrentItems(dir, bufNr, cache)
|
||||
function s:enumNonCurrentItems(dir, bufNrPrev, cache)
|
||||
let key = a:dir . 'AVOIDING EMPTY KEY'
|
||||
if !exists('a:cache[key]')
|
||||
" NOTE: filtering should be done with
|
||||
" 'bufnr("^" . v:val.word . "$") != a:bufNr'.
|
||||
" But it takes a lot of time!
|
||||
let bufName = bufname(a:bufNr)
|
||||
" NOTE: Comparing filenames is faster than bufnr('^' . fname . '$')
|
||||
let bufNamePrev = bufname(a:bufNrPrev)
|
||||
let a:cache[key] =
|
||||
\ filter(copy(s:enumItems(a:dir)), 'v:val.word != bufName')
|
||||
\ filter(copy(s:enumItems(a:dir)), 'v:val.word !=# bufNamePrev')
|
||||
endif
|
||||
return a:cache[key]
|
||||
endfunction
|
||||
@@ -84,7 +86,7 @@ endfunction
|
||||
|
||||
"
|
||||
function s:handler.getPrompt()
|
||||
return fuf#formatPrompt(g:fuf_file_prompt, self.partialMatching)
|
||||
return fuf#formatPrompt(g:fuf_file_prompt, self.partialMatching, '')
|
||||
endfunction
|
||||
|
||||
"
|
||||
@@ -93,8 +95,8 @@ function s:handler.getPreviewHeight()
|
||||
endfunction
|
||||
|
||||
"
|
||||
function s:handler.targetsPath()
|
||||
return 1
|
||||
function s:handler.isOpenable(enteredPattern)
|
||||
return a:enteredPattern =~# '[^/\\]$'
|
||||
endfunction
|
||||
|
||||
"
|
||||
|
||||
@@ -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_givencmd') || v:version < 702
|
||||
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
|
||||
finish
|
||||
endif
|
||||
let g:loaded_autoload_fuf_givencmd = 1
|
||||
|
||||
" }}}1
|
||||
"=============================================================================
|
||||
@@ -23,6 +22,11 @@ function fuf#givencmd#getSwitchOrder()
|
||||
return -1
|
||||
endfunction
|
||||
|
||||
"
|
||||
function fuf#givencmd#getEditableDataNames()
|
||||
return []
|
||||
endfunction
|
||||
|
||||
"
|
||||
function fuf#givencmd#renewCache()
|
||||
endfunction
|
||||
@@ -65,7 +69,7 @@ endfunction
|
||||
|
||||
"
|
||||
function s:handler.getPrompt()
|
||||
return fuf#formatPrompt(s:prompt, self.partialMatching)
|
||||
return fuf#formatPrompt(s:prompt, self.partialMatching, '')
|
||||
endfunction
|
||||
|
||||
"
|
||||
@@ -74,8 +78,8 @@ function s:handler.getPreviewHeight()
|
||||
endfunction
|
||||
|
||||
"
|
||||
function s:handler.targetsPath()
|
||||
return 0
|
||||
function s:handler.isOpenable(enteredPattern)
|
||||
return 1
|
||||
endfunction
|
||||
|
||||
"
|
||||
|
||||
@@ -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_givendir') || v:version < 702
|
||||
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
|
||||
finish
|
||||
endif
|
||||
let g:loaded_autoload_fuf_givendir = 1
|
||||
|
||||
" }}}1
|
||||
"=============================================================================
|
||||
@@ -23,6 +22,11 @@ function fuf#givendir#getSwitchOrder()
|
||||
return -1
|
||||
endfunction
|
||||
|
||||
"
|
||||
function fuf#givendir#getEditableDataNames()
|
||||
return []
|
||||
endfunction
|
||||
|
||||
"
|
||||
function fuf#givendir#renewCache()
|
||||
endfunction
|
||||
@@ -65,7 +69,7 @@ endfunction
|
||||
|
||||
"
|
||||
function s:handler.getPrompt()
|
||||
return fuf#formatPrompt(s:prompt, self.partialMatching)
|
||||
return fuf#formatPrompt(s:prompt, self.partialMatching, '')
|
||||
endfunction
|
||||
|
||||
"
|
||||
@@ -74,7 +78,7 @@ function s:handler.getPreviewHeight()
|
||||
endfunction
|
||||
|
||||
"
|
||||
function s:handler.targetsPath()
|
||||
function s:handler.isOpenable(enteredPattern)
|
||||
return 1
|
||||
endfunction
|
||||
|
||||
@@ -87,7 +91,7 @@ endfunction
|
||||
"
|
||||
function s:handler.makePreviewLines(word, count)
|
||||
return fuf#makePreviewLinesAround(
|
||||
\ split(glob(fnamemodify(a:word, ':p') . '*'), "\n"),
|
||||
\ fuf#glob(fnamemodify(a:word, ':p') . '*'),
|
||||
\ [], a:count, self.getPreviewHeight())
|
||||
return
|
||||
endfunction
|
||||
|
||||
@@ -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_givenfile') || v:version < 702
|
||||
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
|
||||
finish
|
||||
endif
|
||||
let g:loaded_autoload_fuf_givenfile = 1
|
||||
|
||||
" }}}1
|
||||
"=============================================================================
|
||||
@@ -23,6 +22,11 @@ function fuf#givenfile#getSwitchOrder()
|
||||
return -1
|
||||
endfunction
|
||||
|
||||
"
|
||||
function fuf#givenfile#getEditableDataNames()
|
||||
return []
|
||||
endfunction
|
||||
|
||||
"
|
||||
function fuf#givenfile#renewCache()
|
||||
endfunction
|
||||
@@ -65,7 +69,7 @@ endfunction
|
||||
|
||||
"
|
||||
function s:handler.getPrompt()
|
||||
return fuf#formatPrompt(s:prompt, self.partialMatching)
|
||||
return fuf#formatPrompt(s:prompt, self.partialMatching, '')
|
||||
endfunction
|
||||
|
||||
"
|
||||
@@ -74,7 +78,7 @@ function s:handler.getPreviewHeight()
|
||||
endfunction
|
||||
|
||||
"
|
||||
function s:handler.targetsPath()
|
||||
function s:handler.isOpenable(enteredPattern)
|
||||
return 1
|
||||
endfunction
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
"
|
||||
|
||||
@@ -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_jumplist') || v:version < 702
|
||||
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
|
||||
finish
|
||||
endif
|
||||
let g:loaded_autoload_fuf_jumplist = 1
|
||||
|
||||
" }}}1
|
||||
"=============================================================================
|
||||
@@ -23,6 +22,11 @@ function fuf#jumplist#getSwitchOrder()
|
||||
return g:fuf_jumplist_switchOrder
|
||||
endfunction
|
||||
|
||||
"
|
||||
function fuf#jumplist#getEditableDataNames()
|
||||
return []
|
||||
endfunction
|
||||
|
||||
"
|
||||
function fuf#jumplist#renewCache()
|
||||
endfunction
|
||||
@@ -34,7 +38,7 @@ endfunction
|
||||
|
||||
"
|
||||
function fuf#jumplist#onInit()
|
||||
call fuf#defineLaunchCommand('FufJumpList', s:MODE_NAME, '""')
|
||||
call fuf#defineLaunchCommand('FufJumpList', s:MODE_NAME, '""', [])
|
||||
endfunction
|
||||
|
||||
" }}}1
|
||||
@@ -101,7 +105,7 @@ endfunction
|
||||
|
||||
"
|
||||
function s:handler.getPrompt()
|
||||
return fuf#formatPrompt(g:fuf_jumplist_prompt, self.partialMatching)
|
||||
return fuf#formatPrompt(g:fuf_jumplist_prompt, self.partialMatching, '')
|
||||
endfunction
|
||||
|
||||
"
|
||||
@@ -110,8 +114,8 @@ function s:handler.getPreviewHeight()
|
||||
endfunction
|
||||
|
||||
"
|
||||
function s:handler.targetsPath()
|
||||
return 0
|
||||
function s:handler.isOpenable(enteredPattern)
|
||||
return 1
|
||||
endfunction
|
||||
|
||||
"
|
||||
|
||||
@@ -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_line') || v:version < 702
|
||||
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
|
||||
finish
|
||||
endif
|
||||
let g:loaded_autoload_fuf_line = 1
|
||||
|
||||
" }}}1
|
||||
"=============================================================================
|
||||
@@ -23,6 +22,11 @@ function fuf#line#getSwitchOrder()
|
||||
return g:fuf_line_switchOrder
|
||||
endfunction
|
||||
|
||||
"
|
||||
function fuf#line#getEditableDataNames()
|
||||
return []
|
||||
endfunction
|
||||
|
||||
"
|
||||
function fuf#line#renewCache()
|
||||
endfunction
|
||||
@@ -34,7 +38,7 @@ endfunction
|
||||
|
||||
"
|
||||
function fuf#line#onInit()
|
||||
call fuf#defineLaunchCommand('FufLine', s:MODE_NAME, '""')
|
||||
call fuf#defineLaunchCommand('FufLine', s:MODE_NAME, '""', [])
|
||||
endfunction
|
||||
|
||||
" }}}1
|
||||
@@ -57,7 +61,7 @@ endfunction
|
||||
|
||||
"
|
||||
function s:handler.getPrompt()
|
||||
return fuf#formatPrompt(g:fuf_line_prompt, self.partialMatching)
|
||||
return fuf#formatPrompt(g:fuf_line_prompt, self.partialMatching, '')
|
||||
endfunction
|
||||
|
||||
"
|
||||
@@ -66,8 +70,8 @@ function s:handler.getPreviewHeight()
|
||||
endfunction
|
||||
|
||||
"
|
||||
function s:handler.targetsPath()
|
||||
return 0
|
||||
function s:handler.isOpenable(enteredPattern)
|
||||
return 1
|
||||
endfunction
|
||||
|
||||
"
|
||||
|
||||
@@ -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_mrucmd') || v:version < 702
|
||||
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
|
||||
finish
|
||||
endif
|
||||
let g:loaded_autoload_fuf_mrucmd = 1
|
||||
|
||||
" }}}1
|
||||
"=============================================================================
|
||||
@@ -23,6 +22,11 @@ function fuf#mrucmd#getSwitchOrder()
|
||||
return g:fuf_mrucmd_switchOrder
|
||||
endfunction
|
||||
|
||||
"
|
||||
function fuf#mrucmd#getEditableDataNames()
|
||||
return ['items']
|
||||
endfunction
|
||||
|
||||
"
|
||||
function fuf#mrucmd#renewCache()
|
||||
endfunction
|
||||
@@ -34,7 +38,7 @@ endfunction
|
||||
|
||||
"
|
||||
function fuf#mrucmd#onInit()
|
||||
call fuf#defineLaunchCommand('FufMruCmd', s:MODE_NAME, '""')
|
||||
call fuf#defineLaunchCommand('FufMruCmd', s:MODE_NAME, '""', [])
|
||||
endfunction
|
||||
|
||||
"
|
||||
@@ -53,11 +57,11 @@ let s:MODE_NAME = expand('<sfile>:t:r')
|
||||
|
||||
"
|
||||
function s:updateInfo(cmd)
|
||||
let info = fuf#loadInfoFile(s:MODE_NAME)
|
||||
let info.data = fuf#updateMruList(
|
||||
\ info.data, { 'word' : a:cmd, 'time' : localtime() },
|
||||
let items = fuf#loadDataFile(s:MODE_NAME, 'items')
|
||||
let items = fuf#updateMruList(
|
||||
\ items, { 'word' : a:cmd, 'time' : localtime() },
|
||||
\ g:fuf_mrucmd_maxItem, g:fuf_mrucmd_exclude)
|
||||
call fuf#saveInfoFile(s:MODE_NAME, info)
|
||||
call fuf#saveDataFile(s:MODE_NAME, 'items', items)
|
||||
endfunction
|
||||
|
||||
" }}}1
|
||||
@@ -73,7 +77,7 @@ endfunction
|
||||
|
||||
"
|
||||
function s:handler.getPrompt()
|
||||
return fuf#formatPrompt(g:fuf_mrucmd_prompt, self.partialMatching)
|
||||
return fuf#formatPrompt(g:fuf_mrucmd_prompt, self.partialMatching, '')
|
||||
endfunction
|
||||
|
||||
"
|
||||
@@ -82,8 +86,8 @@ function s:handler.getPreviewHeight()
|
||||
endfunction
|
||||
|
||||
"
|
||||
function s:handler.targetsPath()
|
||||
return 0
|
||||
function s:handler.isOpenable(enteredPattern)
|
||||
return 1
|
||||
endfunction
|
||||
|
||||
"
|
||||
@@ -115,7 +119,7 @@ endfunction
|
||||
|
||||
"
|
||||
function s:handler.onModeEnterPost()
|
||||
let self.items = copy(self.info.data)
|
||||
let self.items = fuf#loadDataFile(s:MODE_NAME, 'items')
|
||||
call map(self.items, 'fuf#makeNonPathItem(v:val.word, strftime(g:fuf_timeFormat, v:val.time))')
|
||||
call fuf#mapToSetSerialIndex(self.items, 1)
|
||||
call map(self.items, 'fuf#setAbbrWithFormattedWord(v:val, 1)')
|
||||
|
||||
@@ -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_mrufile') || v:version < 702
|
||||
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
|
||||
finish
|
||||
endif
|
||||
let g:loaded_autoload_fuf_mrufile = 1
|
||||
|
||||
" }}}1
|
||||
"=============================================================================
|
||||
@@ -23,9 +22,15 @@ function fuf#mrufile#getSwitchOrder()
|
||||
return g:fuf_mrufile_switchOrder
|
||||
endfunction
|
||||
|
||||
"
|
||||
function fuf#mrufile#getEditableDataNames()
|
||||
return ['items', 'itemdirs']
|
||||
endfunction
|
||||
|
||||
"
|
||||
function fuf#mrufile#renewCache()
|
||||
let s:cache = {}
|
||||
let s:aroundCache = {}
|
||||
endfunction
|
||||
|
||||
"
|
||||
@@ -35,11 +40,15 @@ endfunction
|
||||
|
||||
"
|
||||
function fuf#mrufile#onInit()
|
||||
call fuf#defineLaunchCommand('FufMruFile', s:MODE_NAME, '""')
|
||||
call fuf#defineLaunchCommand('FufMruFile', s:MODE_NAME, '""', [])
|
||||
call fuf#defineLaunchCommand('FufMruFileInCwd', s:MODE_NAME,
|
||||
\ '""', [['g:fuf_mrufile_underCwd', 1]])
|
||||
call l9#defineVariableDefault('g:fuf_mrufile_underCwd', 0) " private option
|
||||
call l9#defineVariableDefault('g:fuf_mrufile_searchAroundLevel', -1) " private option
|
||||
augroup fuf#mrufile
|
||||
autocmd!
|
||||
autocmd BufEnter * call s:updateInfo()
|
||||
autocmd BufWritePost * call s:updateInfo()
|
||||
autocmd BufEnter * call s:updateData()
|
||||
autocmd BufWritePost * call s:updateData()
|
||||
augroup END
|
||||
endfunction
|
||||
|
||||
@@ -48,18 +57,24 @@ endfunction
|
||||
" LOCAL FUNCTIONS/VARIABLES {{{1
|
||||
|
||||
let s:MODE_NAME = expand('<sfile>:t:r')
|
||||
let s:OPEN_TYPE_EXPAND = -1
|
||||
|
||||
"
|
||||
function s:updateInfo()
|
||||
function s:updateData()
|
||||
if !empty(&buftype) || !filereadable(expand('%'))
|
||||
return
|
||||
endif
|
||||
let info = fuf#loadInfoFile(s:MODE_NAME)
|
||||
let info.data = fuf#updateMruList(
|
||||
\ info.data, { 'word' : expand('%:p'), 'time' : localtime() },
|
||||
let items = fuf#loadDataFile(s:MODE_NAME, 'items')
|
||||
let items = fuf#updateMruList(
|
||||
\ items, { 'word' : expand('%:p'), 'time' : localtime() },
|
||||
\ g:fuf_mrufile_maxItem, g:fuf_mrufile_exclude)
|
||||
call fuf#saveInfoFile(s:MODE_NAME, info)
|
||||
call fuf#saveDataFile(s:MODE_NAME, 'items', items)
|
||||
call s:removeItemFromCache(expand('%:p'))
|
||||
let itemDirs = fuf#loadDataFile(s:MODE_NAME, 'itemdirs')
|
||||
let itemDirs = fuf#updateMruList(
|
||||
\ itemDirs, { 'word' : expand('%:p:h') },
|
||||
\ g:fuf_mrufile_maxItemDir, g:fuf_mrufile_exclude)
|
||||
call fuf#saveDataFile(s:MODE_NAME, 'itemdirs', itemDirs)
|
||||
endfunction
|
||||
|
||||
"
|
||||
@@ -79,7 +94,7 @@ function s:formatItemUsingCache(item)
|
||||
if !exists('s:cache[a:item.word]')
|
||||
if filereadable(a:item.word)
|
||||
let s:cache[a:item.word] = fuf#makePathItem(
|
||||
\ fnamemodify(a:item.word, ':~'), strftime(g:fuf_timeFormat, a:item.time), 0)
|
||||
\ fnamemodify(a:item.word, ':p:~'), strftime(g:fuf_timeFormat, a:item.time), 0)
|
||||
else
|
||||
let s:cache[a:item.word] = {}
|
||||
endif
|
||||
@@ -87,6 +102,41 @@ function s:formatItemUsingCache(item)
|
||||
return s:cache[a:item.word]
|
||||
endfunction
|
||||
|
||||
"
|
||||
function s:expandSearchDir(dir, level)
|
||||
let dirs = [a:dir]
|
||||
let dirPrev = a:dir
|
||||
for i in range(a:level)
|
||||
let dirPrev = l9#concatPaths([dirPrev, '*'])
|
||||
call add(dirs, dirPrev)
|
||||
endfor
|
||||
let dirPrev = a:dir
|
||||
for i in range(a:level)
|
||||
let dirPrevPrev = dirPrev
|
||||
let dirPrev = fnamemodify(dirPrev, ':h')
|
||||
if dirPrevPrev ==# dirPrev
|
||||
break
|
||||
endif
|
||||
call add(dirs, dirPrev)
|
||||
endfor
|
||||
return dirs
|
||||
endfunction
|
||||
|
||||
"
|
||||
function s:listAroundFiles(dir)
|
||||
if !exists('s:aroundCache[a:dir]')
|
||||
let s:aroundCache[a:dir] = [a:dir] +
|
||||
\ fuf#glob(l9#concatPaths([a:dir, '*' ])) +
|
||||
\ fuf#glob(l9#concatPaths([a:dir, '.*']))
|
||||
call filter(s:aroundCache[a:dir], 'filereadable(v:val)')
|
||||
call map(s:aroundCache[a:dir], 'fuf#makePathItem(fnamemodify(v:val, ":~"), "", 0)')
|
||||
if len(g:fuf_mrufile_exclude)
|
||||
call filter(s:aroundCache[a:dir], 'v:val.word !~ g:fuf_mrufile_exclude')
|
||||
endif
|
||||
endif
|
||||
return s:aroundCache[a:dir]
|
||||
endfunction
|
||||
|
||||
" }}}1
|
||||
"=============================================================================
|
||||
" s:handler {{{1
|
||||
@@ -100,7 +150,10 @@ endfunction
|
||||
|
||||
"
|
||||
function s:handler.getPrompt()
|
||||
return fuf#formatPrompt(g:fuf_mrufile_prompt, self.partialMatching)
|
||||
let cwdString = (g:fuf_mrufile_underCwd ? '[CWD]' : '')
|
||||
let levelString = (g:fuf_mrufile_searchAroundLevel < 0 ? ''
|
||||
\ : '[Around:' . g:fuf_mrufile_searchAroundLevel . ']')
|
||||
return fuf#formatPrompt(g:fuf_mrufile_prompt, self.partialMatching, cwdString . levelString)
|
||||
endfunction
|
||||
|
||||
"
|
||||
@@ -109,7 +162,7 @@ function s:handler.getPreviewHeight()
|
||||
endfunction
|
||||
|
||||
"
|
||||
function s:handler.targetsPath()
|
||||
function s:handler.isOpenable(enteredPattern)
|
||||
return 1
|
||||
endfunction
|
||||
|
||||
@@ -131,7 +184,14 @@ endfunction
|
||||
|
||||
"
|
||||
function s:handler.onOpen(word, mode)
|
||||
call fuf#openFile(a:word, a:mode, g:fuf_reuseWindow)
|
||||
if a:mode ==# s:OPEN_TYPE_EXPAND
|
||||
let nextLevel = (self.searchAroundLevel < 0 ? 0 : self.searchAroundLevel + 1)
|
||||
call fuf#setOneTimeVariables(['g:fuf_mrufile_searchAroundLevel', nextLevel])
|
||||
let self.reservedMode = self.getModeName()
|
||||
return
|
||||
else
|
||||
call fuf#openFile(a:word, a:mode, g:fuf_reuseWindow)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
"
|
||||
@@ -140,11 +200,29 @@ endfunction
|
||||
|
||||
"
|
||||
function s:handler.onModeEnterPost()
|
||||
let self.items = copy(self.info.data)
|
||||
let self.items = map(self.items, 's:formatItemUsingCache(v:val)')
|
||||
let self.items = filter(self.items, '!empty(v:val) && bufnr("^" . v:val.word . "$") != self.bufNrPrev')
|
||||
let self.items = fuf#mapToSetSerialIndex(self.items, 1)
|
||||
let self.items = fuf#mapToSetAbbrWithSnippedWordAsPath(self.items)
|
||||
let self.searchAroundLevel = g:fuf_mrufile_searchAroundLevel
|
||||
call fuf#defineKeyMappingInHandler(g:fuf_mrufile_keyExpand,
|
||||
\ 'onCr(' . s:OPEN_TYPE_EXPAND . ')')
|
||||
if self.searchAroundLevel < 0
|
||||
let self.items = fuf#loadDataFile(s:MODE_NAME, 'items')
|
||||
call map(self.items, 's:formatItemUsingCache(v:val)')
|
||||
else
|
||||
let self.items = fuf#loadDataFile(s:MODE_NAME, 'itemdirs')
|
||||
call map(self.items, 's:expandSearchDir(v:val.word, g:fuf_mrufile_searchAroundLevel)')
|
||||
let self.items = l9#concat(self.items)
|
||||
let self.items = l9#unique(self.items)
|
||||
call map(self.items, 's:listAroundFiles(v:val)')
|
||||
let self.items = l9#concat(self.items)
|
||||
endif
|
||||
" NOTE: Comparing filenames is faster than bufnr('^' . fname . '$')
|
||||
let bufNamePrev = fnamemodify(bufname(self.bufNrPrev), ':p:~')
|
||||
call filter(self.items, '!empty(v:val) && v:val.word !=# bufNamePrev')
|
||||
if g:fuf_mrufile_underCwd
|
||||
let cwd = fnamemodify(getcwd(), ':p:~')
|
||||
call filter(self.items, 'stridx(v:val.word, cwd) == 0')
|
||||
endif
|
||||
call fuf#mapToSetSerialIndex(self.items, 1)
|
||||
call fuf#mapToSetAbbrWithSnippedWordAsPath(self.items)
|
||||
endfunction
|
||||
|
||||
"
|
||||
|
||||
@@ -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_quickfix') || v:version < 702
|
||||
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
|
||||
finish
|
||||
endif
|
||||
let g:loaded_autoload_fuf_quickfix = 1
|
||||
|
||||
" }}}1
|
||||
"=============================================================================
|
||||
@@ -23,6 +22,11 @@ function fuf#quickfix#getSwitchOrder()
|
||||
return g:fuf_quickfix_switchOrder
|
||||
endfunction
|
||||
|
||||
"
|
||||
function fuf#quickfix#getEditableDataNames()
|
||||
return []
|
||||
endfunction
|
||||
|
||||
"
|
||||
function fuf#quickfix#renewCache()
|
||||
endfunction
|
||||
@@ -34,7 +38,7 @@ endfunction
|
||||
|
||||
"
|
||||
function fuf#quickfix#onInit()
|
||||
call fuf#defineLaunchCommand('FufQuickfix', s:MODE_NAME, '""')
|
||||
call fuf#defineLaunchCommand('FufQuickfix', s:MODE_NAME, '""', [])
|
||||
endfunction
|
||||
|
||||
" }}}1
|
||||
@@ -83,7 +87,7 @@ endfunction
|
||||
|
||||
"
|
||||
function s:handler.getPrompt()
|
||||
return fuf#formatPrompt(g:fuf_quickfix_prompt, self.partialMatching)
|
||||
return fuf#formatPrompt(g:fuf_quickfix_prompt, self.partialMatching, '')
|
||||
endfunction
|
||||
|
||||
"
|
||||
@@ -92,8 +96,8 @@ function s:handler.getPreviewHeight()
|
||||
endfunction
|
||||
|
||||
"
|
||||
function s:handler.targetsPath()
|
||||
return 0
|
||||
function s:handler.isOpenable(enteredPattern)
|
||||
return 1
|
||||
endfunction
|
||||
|
||||
"
|
||||
|
||||
@@ -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_tag') || v:version < 702
|
||||
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
|
||||
finish
|
||||
endif
|
||||
let g:loaded_autoload_fuf_tag = 1
|
||||
|
||||
" }}}1
|
||||
"=============================================================================
|
||||
@@ -23,6 +22,11 @@ function fuf#tag#getSwitchOrder()
|
||||
return g:fuf_tag_switchOrder
|
||||
endfunction
|
||||
|
||||
"
|
||||
function fuf#tag#getEditableDataNames()
|
||||
return []
|
||||
endfunction
|
||||
|
||||
"
|
||||
function fuf#tag#renewCache()
|
||||
let s:cache = {}
|
||||
@@ -35,8 +39,8 @@ endfunction
|
||||
|
||||
"
|
||||
function fuf#tag#onInit()
|
||||
call fuf#defineLaunchCommand('FufTag' , s:MODE_NAME, '""')
|
||||
call fuf#defineLaunchCommand('FufTagWithCursorWord', s:MODE_NAME, 'expand(''<cword>'')')
|
||||
call fuf#defineLaunchCommand('FufTag' , s:MODE_NAME, '""', [])
|
||||
call fuf#defineLaunchCommand('FufTagWithCursorWord', s:MODE_NAME, 'expand(''<cword>'')', [])
|
||||
endfunction
|
||||
|
||||
" }}}1
|
||||
@@ -47,30 +51,22 @@ let s:MODE_NAME = expand('<sfile>:t:r')
|
||||
|
||||
"
|
||||
function s:getTagNames(tagFile)
|
||||
let names = map(readfile(a:tagFile), 'matchstr(v:val, ''^[^!\t][^\t]*'')')
|
||||
let names = map(l9#readFile(a:tagFile), 'matchstr(v:val, ''^[^!\t][^\t]*'')')
|
||||
return filter(names, 'v:val =~# ''\S''')
|
||||
endfunction
|
||||
|
||||
"
|
||||
function s:parseTagFiles(tagFiles)
|
||||
if !empty(g:fuf_tag_cache_dir)
|
||||
if !isdirectory(expand(g:fuf_tag_cache_dir))
|
||||
call mkdir(expand(g:fuf_tag_cache_dir), 'p')
|
||||
endif
|
||||
" NOTE: fnamemodify('a/b', ':p') returns 'a/b/' if the directory exists.
|
||||
let cacheFile = fnamemodify(g:fuf_tag_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:getTagNames(v:val)')))
|
||||
let items = l9#unique(l9#concat(map(copy(a:tagFiles), 's:getTagNames(v:val)')))
|
||||
let items = map(items, 'fuf#makeNonPathItem(v:val, "")')
|
||||
call fuf#mapToSetSerialIndex(items, 1)
|
||||
let items = map(items, 'fuf#setAbbrWithFormattedWord(v:val, 1)')
|
||||
if !empty(g:fuf_tag_cache_dir)
|
||||
call writefile(map(copy(items), 'string(v:val)'), cacheFile)
|
||||
endif
|
||||
call fuf#saveDataFile(s:MODE_NAME, cacheName, items)
|
||||
return items
|
||||
endfunction
|
||||
|
||||
@@ -79,11 +75,11 @@ function s:enumTags(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:parseTagFiles(a:tagFiles)
|
||||
\ 'items' : s:parseTagFiles(a:tagFiles, key)
|
||||
\ }
|
||||
endif
|
||||
return s:cache[key].items
|
||||
@@ -119,7 +115,7 @@ endfunction
|
||||
|
||||
"
|
||||
function s:handler.getPrompt()
|
||||
return fuf#formatPrompt(g:fuf_tag_prompt, self.partialMatching)
|
||||
return fuf#formatPrompt(g:fuf_tag_prompt, self.partialMatching, '')
|
||||
endfunction
|
||||
|
||||
"
|
||||
@@ -128,8 +124,8 @@ function s:handler.getPreviewHeight()
|
||||
endfunction
|
||||
|
||||
"
|
||||
function s:handler.targetsPath()
|
||||
return 0
|
||||
function s:handler.isOpenable(enteredPattern)
|
||||
return 1
|
||||
endfunction
|
||||
|
||||
"
|
||||
|
||||
@@ -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