Takeshi NISHIDA avatar Takeshi NISHIDA committed 917ac14

added Buffer-Tag mode.

Comments (0)

Files changed (25)

 "=============================================================================
 " LOAD GUARD {{{1
 
-if !l9#guardScriptLoading(expand('<sfile>:p'), 702, 100)
+if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
   finish
 endif
 
 
 "
 function fuf#countModifiedFiles(files, time)
-  return len(filter(copy(a:files), 'getftime(v:val) > a:time'))
+  return len(filter(copy(a:files), 'getftime(expand(v:val)) > a:time'))
+endfunction
+
+"
+function fuf#countModifiedBuffers(buffers, time)
+  return len(filter(copy(a:buffers), 'getftime(expand(bufname(v:val))) > a:time'))
 endfunction
 
 "
 endfunction
 
 "
-function fuf#defineLaunchCommand(CmdName, modeName, prefixInitialPattern)
-  execute printf('command! -bang -narg=? %s call fuf#launch(%s, %s . <q-args>, len(<q-bang>))',
-        \        a:CmdName, string(a:modeName), a:prefixInitialPattern)
+function fuf#defineLaunchCommand(CmdName, modeName, prefixInitialPattern, tempVars)
+  if empty(a:tempVars)
+    let preCmd = ''
+  else
+    let preCmd = printf('call l9#tempvariables#setList(%s, %s) | ',
+          \             string(s:TEMP_VARIABLES_GROUP), string(a:tempVars))
+  endif
+  execute printf('command! -bang -narg=? %s %s call fuf#launch(%s, %s . <q-args>, len(<q-bang>))',
+        \        a:CmdName, preCmd, string(a:modeName), a:prefixInitialPattern)
 endfunction
 
 "
 "
 function s:handlerBase.onInsertLeave()
   unlet s:runningHandler
-  call l9#tempvariables#swap(s:TEMP_VARIABLES_GROUP)
+  let tempVars = l9#tempvariables#getList(s:TEMP_VARIABLES_GROUP)
+  call l9#tempvariables#end(s:TEMP_VARIABLES_GROUP)
   call s:deactivateFufBuffer()
   call fuf#saveDataFile(self.getModeName(), 'stats', self.stats)
   execute self.windowRestoringCommand
   endif
   call self.onModeLeavePost(fOpen)
   if exists('self.reservedMode')
-    call l9#tempvariables#swap(s:TEMP_VARIABLES_GROUP)
+    call l9#tempvariables#setList(s:TEMP_VARIABLES_GROUP, tempVars)
     call fuf#launch(self.reservedMode, self.lastPattern, self.partialMatching)
-  else
-    call l9#tempvariables#end(s:TEMP_VARIABLES_GROUP)
   endif
 endfunction
 

autoload/fuf/bookmarkdir.vim

 "=============================================================================
 " LOAD GUARD {{{1
 
-if !l9#guardScriptLoading(expand('<sfile>:p'), 702, 100)
+if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
   finish
 endif
 
 
 "
 function fuf#bookmarkdir#onInit()
-  call fuf#defineLaunchCommand('FufBookmarkDir', s:MODE_NAME, '""')
+  call fuf#defineLaunchCommand('FufBookmarkDir', s:MODE_NAME, '""', [])
   command! -bang -narg=?        FufBookmarkDirAdd call s:bookmark(<q-args>)
 endfunction
 

autoload/fuf/bookmarkfile.vim

 "=============================================================================
 " LOAD GUARD {{{1
 
-if !l9#guardScriptLoading(expand('<sfile>:p'), 702, 100)
+if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
   finish
 endif
 
 
 "
 function fuf#bookmarkfile#onInit()
-  call fuf#defineLaunchCommand('FufBookmarkFile', s:MODE_NAME, '""')
+  call fuf#defineLaunchCommand('FufBookmarkFile', s:MODE_NAME, '""', [])
   command! -bang -narg=?        FufBookmarkFileAdd               call s:bookmarkHere(<q-args>)
   command! -bang -narg=0 -range FufBookmarkFileAddAsSelectedText call s:bookmarkHere(l9#getSelectedText())
 endfunction

autoload/fuf/buffer.vim

 "=============================================================================
 " LOAD GUARD {{{1
 
-if !l9#guardScriptLoading(expand('<sfile>:p'), 702, 100)
+if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
   finish
 endif
 
 
 "
 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()

autoload/fuf/buffertag.vim

+"=============================================================================
+" Copyright (c) 2010 Takeshi NISHIDA
+"
+"=============================================================================
+" LOAD GUARD {{{1
+
+if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
+  finish
+endif
+
+" }}}1
+"=============================================================================
+" GLOBAL FUNCTIONS {{{1
+
+"
+function fuf#buffertag#createHandler(base)
+  return a:base.concretize(copy(s:handler))
+endfunction
+
+"
+function fuf#buffertag#getSwitchOrder()
+  return g:fuf_buffertag_switchOrder
+endfunction
+
+"
+function fuf#buffertag#getEditableDataNames()
+  return []
+endfunction
+
+"
+function fuf#buffertag#renewCache()
+  let s:tagItemsCache = {}
+  let s:tagDataCache = {}
+endfunction
+
+"
+function fuf#buffertag#requiresOnCommandPre()
+  return 0
+endfunction
+
+"
+function fuf#buffertag#onInit()
+  call fuf#defineLaunchCommand('FufBufferTag', s:MODE_NAME, '""',
+        \                      [['g:fuf_buffertag_forAll', 0]])
+  call fuf#defineLaunchCommand('FufBufferTagAll', s:MODE_NAME, '""',
+        \                      [['g:fuf_buffertag_forAll', 1]])
+  call fuf#defineLaunchCommand('FufBufferTagWithCursorWord', s:MODE_NAME,
+        \                      'expand(''<cword>'')', [['g:fuf_buffertag_forAll', 0]])
+  call fuf#defineLaunchCommand('FufBufferTagAllWithCursorWord', s:MODE_NAME,
+        \                      'expand(''<cword>'')', [['g:fuf_buffertag_forAll', 1]])
+  call fuf#defineLaunchCommand('FufBufferTagWithSelectedText', s:MODE_NAME,
+        \                      'l9#getSelectedText()', [['g:fuf_buffertag_forAll', 0]])
+  call fuf#defineLaunchCommand('FufBufferTagAllWithSelectedText', s:MODE_NAME,
+        \                      'l9#getSelectedText()', [['g:fuf_buffertag_forAll', 1]])
+  call l9#defineVariableDefault('g:fuf_buffertag_forAll', 0) " private option
+  " refered to taglist.vim for the following settings
+  call l9#defineVariableDefault('g:fuf_buffertag__asm'       , '--language-force=asm --asm-types=dlmt')
+  call l9#defineVariableDefault('g:fuf_buffertag__aspperl'   , '--language-force=asp --asp-types=fsv')
+  call l9#defineVariableDefault('g:fuf_buffertag__aspvbs'    , '--language-force=asp --asp-types=fsv')
+  call l9#defineVariableDefault('g:fuf_buffertag__awk'       , '--language-force=awk --awk-types=f')
+  call l9#defineVariableDefault('g:fuf_buffertag__beta'      , '--language-force=beta --beta-types=fsv')
+  call l9#defineVariableDefault('g:fuf_buffertag__c'         , '--language-force=c --c-types=dgsutvf')
+  call l9#defineVariableDefault('g:fuf_buffertag__cpp'       , '--language-force=c++ --c++-types=nvdtcgsuf')
+  call l9#defineVariableDefault('g:fuf_buffertag__cs'        , '--language-force=c# --c#-types=dtncEgsipm')
+  call l9#defineVariableDefault('g:fuf_buffertag__cobol'     , '--language-force=cobol --cobol-types=dfgpPs')
+  call l9#defineVariableDefault('g:fuf_buffertag__eiffel'    , '--language-force=eiffel --eiffel-types=cf')
+  call l9#defineVariableDefault('g:fuf_buffertag__erlang'    , '--language-force=erlang --erlang-types=drmf')
+  call l9#defineVariableDefault('g:fuf_buffertag__expect'    , '--language-force=tcl --tcl-types=cfp')
+  call l9#defineVariableDefault('g:fuf_buffertag__fortran'   , '--language-force=fortran --fortran-types=pbceiklmntvfs')
+  call l9#defineVariableDefault('g:fuf_buffertag__html'      , '--language-force=html --html-types=af')
+  call l9#defineVariableDefault('g:fuf_buffertag__java'      , '--language-force=java --java-types=pcifm')
+  call l9#defineVariableDefault('g:fuf_buffertag__javascript', '--language-force=javascript --javascript-types=f')
+  call l9#defineVariableDefault('g:fuf_buffertag__lisp'      , '--language-force=lisp --lisp-types=f')
+  call l9#defineVariableDefault('g:fuf_buffertag__lua'       , '--language-force=lua --lua-types=f')
+  call l9#defineVariableDefault('g:fuf_buffertag__make'      , '--language-force=make --make-types=m')
+  call l9#defineVariableDefault('g:fuf_buffertag__pascal'    , '--language-force=pascal --pascal-types=fp')
+  call l9#defineVariableDefault('g:fuf_buffertag__perl'      , '--language-force=perl --perl-types=clps')
+  call l9#defineVariableDefault('g:fuf_buffertag__php'       , '--language-force=php --php-types=cdvf')
+  call l9#defineVariableDefault('g:fuf_buffertag__python'    , '--language-force=python --python-types=cmf')
+  call l9#defineVariableDefault('g:fuf_buffertag__rexx'      , '--language-force=rexx --rexx-types=s')
+  call l9#defineVariableDefault('g:fuf_buffertag__ruby'      , '--language-force=ruby --ruby-types=cfFm')
+  call l9#defineVariableDefault('g:fuf_buffertag__scheme'    , '--language-force=scheme --scheme-types=sf')
+  call l9#defineVariableDefault('g:fuf_buffertag__sh'        , '--language-force=sh --sh-types=f')
+  call l9#defineVariableDefault('g:fuf_buffertag__csh'       , '--language-force=sh --sh-types=f')
+  call l9#defineVariableDefault('g:fuf_buffertag__zsh'       , '--language-force=sh --sh-types=f')
+  call l9#defineVariableDefault('g:fuf_buffertag__slang'     , '--language-force=slang --slang-types=nf')
+  call l9#defineVariableDefault('g:fuf_buffertag__sml'       , '--language-force=sml --sml-types=ecsrtvf')
+  call l9#defineVariableDefault('g:fuf_buffertag__sql'       , '--language-force=sql --sql-types=cFPrstTvfp')
+  call l9#defineVariableDefault('g:fuf_buffertag__tcl'       , '--language-force=tcl --tcl-types=cfmp')
+  call l9#defineVariableDefault('g:fuf_buffertag__vera'      , '--language-force=vera --vera-types=cdefgmpPtTvx')
+  call l9#defineVariableDefault('g:fuf_buffertag__verilog'   , '--language-force=verilog --verilog-types=mcPertwpvf')
+  call l9#defineVariableDefault('g:fuf_buffertag__vim'       , '--language-force=vim --vim-types=avf')
+  call l9#defineVariableDefault('g:fuf_buffertag__yacc'      , '--language-force=yacc --yacc-types=l')
+endfunction
+
+" }}}1
+"=============================================================================
+" LOCAL FUNCTIONS/VARIABLES {{{1
+
+let s:MODE_NAME = expand('<sfile>:t:r')
+
+"
+function s:parseTagLine(line)
+  let rows = split(a:line, "\t")
+  if len(rows) < 5
+    return {}
+  endif
+  " <pattern> is '/^pattern$/;'
+  " <lnum> is 'line:123'
+  return {
+        \   'tag'    : rows[0],
+        \   'fname'  : rows[1],
+        \   'pattern': rows[2][2:-5],
+        \   'kind'   : rows[3],
+        \   'lnum'   : matchstr(rows[4], '\d\+'),
+        \ }
+endfunction
+
+"
+function s:makeCtagsCmd(bufNr)
+  let ft = getbufvar(a:bufNr, "&filetype")
+  if !exists('g:fuf_buffertag__{ft}')
+    return ''
+  endif
+  "
+  let cmd = join([g:fuf_buffertag_ctagsPath,
+        \         '-f - --sort=no --excmd=pattern --fields=nKs',
+        \         g:fuf_buffertag__{ft},
+        \         shellescape(fnamemodify(bufname(a:bufNr), ':p'))])
+  return cmd
+endfunction
+
+"
+function s:getTagItems(bufNr)
+  let cmd = s:makeCtagsCmd(a:bufNr)
+  if empty(cmd)
+    return []
+  elseif !exists('s:tagItemsCache[cmd]') ||
+        \ s:tagItemsCache[cmd].time < getftime(expand(bufname(a:bufNr)))
+    let items = split(system(cmd), "\n")
+    if v:shell_error
+      throw cmd
+    endif
+    call map(items, 's:parseTagLine(v:val)')
+    call filter(items, '!empty(v:val)')
+    let s:tagItemsCache[cmd] = {
+          \   'time'  : localtime(),
+          \   'items' : items,
+          \ }
+  endif
+  return s:tagItemsCache[cmd].items
+endfunction
+
+"
+function s:makeItem(tag, itemMap)
+  let menu = fnamemodify(a:itemMap[a:tag][0].fname, ':t')
+        \ . ' [' . a:itemMap[a:tag][0].kind . ']'
+  if len(a:itemMap[a:tag]) > 1
+    let menu .= ' (' . len(a:itemMap[a:tag]) . ')'
+  endif
+  let item = fuf#makeNonPathItem(a:tag, menu)
+  return item
+endfunction
+
+"
+function s:getTagData(bufNrs)
+  let key = join([0] + sort(copy(a:bufNrs)), "\n")
+  if !exists('s:tagDataCache[key]') ||
+        \ fuf#countModifiedBuffers(a:bufNrs, s:tagDataCache[key].time) > 0
+    let itemMap = {}
+    for item in l9#concat(map(copy(a:bufNrs), 's:getTagItems(v:val)'))
+      if !exists('itemMap[item.tag]')
+        let itemMap[item.tag] = []
+      endif
+      call add(itemMap[item.tag], item)
+    endfor
+    let items = sort(keys(itemMap))
+    call map(items, 's:makeItem(v:val, itemMap)')
+    call fuf#mapToSetSerialIndex(items, 1)
+    call map(items, 'fuf#setAbbrWithFormattedWord(v:val, 1)')
+    let s:tagDataCache[key] = {
+          \   'time'   : localtime(),
+          \   'itemMap': itemMap,
+          \   'items'  : items,
+          \ }
+  endif
+  return [s:tagDataCache[key].items, s:tagDataCache[key].itemMap]
+endfunction
+
+"
+function s:jumpToTag(item, mode)
+  call fuf#openFile(a:item.fname, a:mode, g:fuf_reuseWindow)
+  call cursor(a:item.lnum, 1)
+  normal! zvzz
+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_buffertag_prompt, self.partialMatching, '')
+endfunction
+
+"
+function s:handler.getPreviewHeight()
+  return 0
+endfunction
+
+"
+function s:handler.isOpenable(enteredPattern)
+  return 1
+endfunction
+
+"
+function s:handler.makePatternSet(patternBase)
+  return fuf#makePatternSet(a:patternBase, 's:interpretPrimaryPatternForNonPath',
+        \                   self.partialMatching)
+endfunction
+
+"
+function s:handler.makePreviewLines(word, count)
+  return []
+endfunction
+
+"
+function s:handler.getCompleteItems(patternPrimary)
+  return self.items
+endfunction
+
+"
+function s:handler.onOpen(word, mode)
+  if !exists('self.itemMap[a:word][0]')
+    throw "buffertag"
+  elseif len(self.itemMap[a:word]) == 1
+    let i = 0
+  else
+    let list = map(fuf#mapToSetSerialIndex(copy(self.itemMap[a:word]), 1),
+          \        'printf(" %2d: %s|%d| [%s] %s",v:val.index, fnamemodify(v:val.fname, ":~:."), v:val.lnum, v:val.kind, v:val.pattern)')
+    let i = inputlist(['Select tag:'] + list) - 1
+  endif
+  if 0 <= i && i < len(self.itemMap[a:word])
+    call s:jumpToTag(self.itemMap[a:word][i], a:mode)
+  endif
+endfunction
+
+"
+function s:handler.onModeEnterPre()
+endfunction
+
+"
+function s:handler.onModeEnterPost()
+  if g:fuf_buffertag_forAll
+    let bufNrs = filter(range(1, bufnr('$')), 'buflisted(v:val)')
+  else
+    let bufNrs = [self.bufNrPrev]
+  endif
+  let [self.items, self.itemMap] = s:getTagData(bufNrs)
+endfunction
+
+"
+function s:handler.onModeLeavePost(opened)
+endfunction
+
+" }}}1
+"=============================================================================
+" vim: set fdm=marker:

autoload/fuf/callbackfile.vim

 "=============================================================================
 " LOAD GUARD {{{1
 
-if !l9#guardScriptLoading(expand('<sfile>:p'), 702, 100)
+if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
   finish
 endif
 

autoload/fuf/callbackitem.vim

 "=============================================================================
 " LOAD GUARD {{{1
 
-if !l9#guardScriptLoading(expand('<sfile>:p'), 702, 100)
+if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
   finish
 endif
 

autoload/fuf/changelist.vim

 "=============================================================================
 " LOAD GUARD {{{1
 
-if !l9#guardScriptLoading(expand('<sfile>:p'), 702, 100)
+if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
   finish
 endif
 
 
 "
 function fuf#changelist#onInit()
-  call fuf#defineLaunchCommand('FufChangeList', s:MODE_NAME, '""')
+  call fuf#defineLaunchCommand('FufChangeList', s:MODE_NAME, '""', [])
 endfunction
 
 " }}}1

autoload/fuf/coveragefile.vim

 "=============================================================================
 " LOAD GUARD {{{1
 
-if !l9#guardScriptLoading(expand('<sfile>:p'), 702, 100)
+if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
   finish
 endif
 
 
 "
 function fuf#coveragefile#onInit()
-  call fuf#defineLaunchCommand('FufCoverageFile', s:MODE_NAME, '""')
+  call fuf#defineLaunchCommand('FufCoverageFile', s:MODE_NAME, '""', [])
   command! -bang -narg=0        FufCoverageFileRegister call s:registerCoverage()
   command! -bang -narg=?        FufCoverageFileChange call s:changeCoverage(<q-args>)
 endfunction
   endif
   call fuf#setOneTimeVariables(['g:fuf_coveragefile_globPatterns',
         \                       coverages[0].patterns])
-  call feedkeys(":FufCoverageFile\<CR>", 'n')
+  FufCoverageFile
 endfunction
 
 " }}}1

autoload/fuf/dir.vim

 "=============================================================================
 " LOAD GUARD {{{1
 
-if !l9#guardScriptLoading(expand('<sfile>:p'), 702, 100)
+if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
   finish
 endif
 
 
 "
 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

autoload/fuf/file.vim

 "=============================================================================
 " LOAD GUARD {{{1
 
-if !l9#guardScriptLoading(expand('<sfile>:p'), 702, 100)
+if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
   finish
 endif
 
 
 "
 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

autoload/fuf/givencmd.vim

 "=============================================================================
 " LOAD GUARD {{{1
 
-if !l9#guardScriptLoading(expand('<sfile>:p'), 702, 100)
+if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
   finish
 endif
 

autoload/fuf/givendir.vim

 "=============================================================================
 " LOAD GUARD {{{1
 
-if !l9#guardScriptLoading(expand('<sfile>:p'), 702, 100)
+if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
   finish
 endif
 

autoload/fuf/givenfile.vim

 "=============================================================================
 " LOAD GUARD {{{1
 
-if !l9#guardScriptLoading(expand('<sfile>:p'), 702, 100)
+if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
   finish
 endif
 

autoload/fuf/help.vim

 "=============================================================================
 " LOAD GUARD {{{1
 
-if !l9#guardScriptLoading(expand('<sfile>:p'), 702, 100)
+if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
   finish
 endif
 
 
 "
 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

autoload/fuf/jumplist.vim

 "=============================================================================
 " LOAD GUARD {{{1
 
-if !l9#guardScriptLoading(expand('<sfile>:p'), 702, 100)
+if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
   finish
 endif
 
 
 "
 function fuf#jumplist#onInit()
-  call fuf#defineLaunchCommand('FufJumpList', s:MODE_NAME, '""')
+  call fuf#defineLaunchCommand('FufJumpList', s:MODE_NAME, '""', [])
 endfunction
 
 " }}}1

autoload/fuf/line.vim

 "=============================================================================
 " LOAD GUARD {{{1
 
-if !l9#guardScriptLoading(expand('<sfile>:p'), 702, 100)
+if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
   finish
 endif
 
 
 "
 function fuf#line#onInit()
-  call fuf#defineLaunchCommand('FufLine', s:MODE_NAME, '""')
+  call fuf#defineLaunchCommand('FufLine', s:MODE_NAME, '""', [])
 endfunction
 
 " }}}1

autoload/fuf/mrucmd.vim

 "=============================================================================
 " LOAD GUARD {{{1
 
-if !l9#guardScriptLoading(expand('<sfile>:p'), 702, 100)
+if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
   finish
 endif
 
 
 "
 function fuf#mrucmd#onInit()
-  call fuf#defineLaunchCommand('FufMruCmd', s:MODE_NAME, '""')
+  call fuf#defineLaunchCommand('FufMruCmd', s:MODE_NAME, '""', [])
 endfunction
 
 "

autoload/fuf/mrufile.vim

 "=============================================================================
 " LOAD GUARD {{{1
 
-if !l9#guardScriptLoading(expand('<sfile>:p'), 702, 100)
+if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
   finish
 endif
 
 
 "
 function fuf#mrufile#onInit()
-  call fuf#defineLaunchCommand('FufMruFile', s:MODE_NAME, '""')
+  call fuf#defineLaunchCommand('FufMruFile', s:MODE_NAME, '""', [])
+  call l9#defineVariableDefault('g:fuf_mrufile_searchAroundLevel', -1) " private option
   augroup fuf#mrufile
     autocmd!
     autocmd BufEnter     * call s:updateData()
 endfunction
 
 "
-function s:listAroundFilesUsingCache(dir)
+function s:listAroundFiles(dir)
   if !exists('s:aroundCache[a:dir]')
     let s:aroundCache[a:dir] = [a:dir] +
           \              split(glob(a:dir . l9#getPathSeparator() . "*" ), "\n") +
     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:listAroundFilesUsingCache(v:val)')
+    call map(self.items, 's:listAroundFiles(v:val)')
     let self.items = l9#concat(self.items)
   endif
   call filter(self.items, '!empty(v:val) && v:val.word !=# bufNamePrev')

autoload/fuf/quickfix.vim

 "=============================================================================
 " LOAD GUARD {{{1
 
-if !l9#guardScriptLoading(expand('<sfile>:p'), 702, 100)
+if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
   finish
 endif
 
 
 "
 function fuf#quickfix#onInit()
-  call fuf#defineLaunchCommand('FufQuickfix', s:MODE_NAME, '""')
+  call fuf#defineLaunchCommand('FufQuickfix', s:MODE_NAME, '""', [])
 endfunction
 
 " }}}1

autoload/fuf/tag.vim

 "=============================================================================
 " LOAD GUARD {{{1
 
-if !l9#guardScriptLoading(expand('<sfile>:p'), 702, 100)
+if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
   finish
 endif
 
 
 "
 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

autoload/fuf/taggedfile.vim

 "=============================================================================
 " LOAD GUARD {{{1
 
-if !l9#guardScriptLoading(expand('<sfile>:p'), 702, 100)
+if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
   finish
 endif
 
 
 "
 function fuf#taggedfile#onInit()
-  call fuf#defineLaunchCommand('FufTaggedFile', s:MODE_NAME, '""')
+  call fuf#defineLaunchCommand('FufTaggedFile', s:MODE_NAME, '""', [])
 endfunction
 
 " }}}1
         |:FufBookmarkFile| - Bookmark-File モード (|fuf-bookmarkfile-mode|)
         |:FufBookmarkDir|  - Bookmark-Dir モード (|fuf-bookmarkdir-mode|)
         |:FufTag|          - Tag モード (|fuf-tag-mode|)
+        |:FufBufferTag|    - Buffer-Tag モード (|fuf-buffertag-mode|)
         |:FufTaggedFile|   - Tagged-File モード (|fuf-taggedfile-mode|)
         |:FufJumpList|     - Jump-List モード (|fuf-jumplist-mode|)
         |:FufChangeList|   - Change-List モード (|fuf-changelist-mode|)
         noremap <silent> <C-]> :FufTagWithCursorWord!<CR>
 <
 
+                                                          *fuf-buffertag-mode*
+Buffer-Tag モード ~
+
+このモードはカレントバッファまたは全バッファのタグを選択してその定義へジャンプ
+するインターフェースを提供します。
+
+タグのリストはFuzzyFinderの起動時にその場で作成されるので、前もってtagsファイ
+ルを作成する必要はありません。
+
+|FufBufferTag|はカレントバッファを対象にし、|FufBufferTagAll|は全バッファを対
+象にします。
+
+以下は <C-]> を置き換えるマッピングです:
+>
+        nnoremap <silent> <C-]> :FufBufferTagWithCursorWord!<CR>
+        vnoremap <silent> <C-]> <Esc>:FufBufferTagAllWithSelectedText!<CR>
+<
+または
+>
+        nnoremap <silent> <C-]> :FufBufferTagAllWithCursorWord!<CR>
+        vnoremap <silent> <C-]> <Esc>:FufBufferTagAllWithSelectedText!<CR>
+<
+このモードは taglist.vim (vimscript #273) にインスパイアされました。コードも参
+考にしています。
+
                                                          *fuf-taggedfile-mode*
 Tagged-File モード ~
 
 :FufTagWithCursorWord [{pattern}]
         カーソル下の単語を初期パターンとする以外は|:FufTag|と同じです。
 
+                                                               *:FufBufferTag*
+:FufBufferTag[!] [{pattern}]
+        Buffer-Tag モードを起動します。
+
+        ! 修飾子を付けて実行した場合、あいまい検索ではなく部分一致検索を行うよ
+        うになります。
+
+        FuzzyFinder 起動後に {pattern} が挿入されます。
+
+                                                            *:FufBufferTagAll*
+:FufBufferTagAll[!] [{pattern}]
+        カレントバッファだけでなく他の全てのバッファからもタグを集める以外は
+        |:FufBufferTag|と同じです。
+
+                                                 *:FufBufferTagWithCursorWord*
+:FufBufferTagWithCursorWord[!] [{pattern}]
+        カーソル下の単語を初期パターンとする以外は|:FufBufferTag|と同じです。
+
+                                              *:FufBufferTagAllWithCursorWord*
+:FufBufferTagAllWithCursorWord[!] [{pattern}]
+        カーソル下の単語を初期パターンとする以外は|:FufBufferTagAll|と同じです
+        。
+
+                                               *:FufBufferTagWithSelectedText*
+:FufBufferTagWithSelectedText[!] [{pattern}]
+        最後に選択したテキストを初期パターンとする以外は|:FufBufferTag|と同じ
+        です。
+
+                                            *:FufBufferTagAllWithSelectedText*
+:FufBufferTagAllWithSelectedText[!] [{pattern}]
+        最後に選択したテキストを初期パターンとする以外は|:FufBufferTagAll|と同
+        じです。
+
                                                               *:FufTaggedFile*
 :FufTaggedFile [{pattern}]
         Tagged-File モードを起動します。
         プロンプト文字列。"[]" はインジケータに置換されます。
 
                                                  *g:fuf_mrucmd_switchOrder*  >
-  let g:fuf_mrucmd_switchOrder = 70
+  let g:fuf_mrucmd_switchOrder = 60
 <
         次/前のモードに切り替えるときの、モードの順位です。負数ならこのモード
         には切り替えません。
         プロンプト文字列。"[]" はインジケータに置換されます。
 
                                                *g:fuf_bookmarkfile_switchOrder*  >
-  let g:fuf_bookmarkfile_switchOrder = 80
+  let g:fuf_bookmarkfile_switchOrder = 70
 <
         次/前のモードに切り替えるときの、モードの順位です。負数ならこのモード
         には切り替えません。
         プロンプト文字列。"[]" はインジケータに置換されます。
 
                                                *g:fuf_bookmarkdir_switchOrder*  >
-  let g:fuf_bookmarkdir_switchOrder = 90
+  let g:fuf_bookmarkdir_switchOrder = 80
 <
         次/前のモードに切り替えるときの、モードの順位です。負数ならこのモード
         には切り替えません。
         プロンプト文字列。"[]" はインジケータに置換されます。
 
                                                     *g:fuf_tag_switchOrder*  >
-  let g:fuf_tag_switchOrder = 100
+  let g:fuf_tag_switchOrder = 90
 <
         次/前のモードに切り替えるときの、モードの順位です。負数ならこのモード
         には切り替えません。
 
+                                              *fuf-options-for-buffertag-mode*
+For Buffer-Tag モード用 ~
+
+                                                   *g:fuf_buffertag_prompt*  >
+  let g:fuf_buffertag_prompt = '>Buffer-Tag[]>'
+<
+        プロンプト文字列。"[]" はインジケータに置換されます。
+
+                                              *g:fuf_buffertag_switchOrder*  >
+  let g:fuf_buffertag_switchOrder = 100
+<
+        次/前のモードに切り替えるときの、モードの順位です。負数ならこのモード
+        には切り替えません。
+
+                                                *g:fuf_buffertag_ctagsPath*  >
+  let g:fuf_buffertag_ctagsPath = 'ctags'
+<
+        Ctagsの実行ファイルのパス
+
                                              *fuf-options-for-taggedfile-mode*
 Tagged-File モード用 ~
 
 
 >
   let g:fuf_modesDisable = []
-  let g:fuf_abbrevMap = {
-        \   '^vr:' : map(filter(split(&runtimepath, ','), 'v:val !~ "after$"'), 'v:val . ''/**/'''),
-        \   '^m0:' : [ '/mnt/d/0/', '/mnt/j/0/' ],
-        \ }
-  let g:fuf_mrufile_maxItem = 500
-  let g:fuf_mrucmd_maxItem = 500
+  let g:fuf_mrufile_maxItem = 400
+  let g:fuf_mrucmd_maxItem = 400
   nnoremap <silent> sj     :FufBuffer<CR>
   nnoremap <silent> sk     :FufFileWithCurrentBufferDir<CR>
   nnoremap <silent> sK     :FufFileWithFullCwd<CR>
   nnoremap <silent> st     :FufTag<CR>
   nnoremap <silent> sT     :FufTag!<CR>
   noremap  <silent> s]     :FufTagWithCursorWord!<CR>
+  nnoremap <silent> s,     :FufBufferTag<CR>
+  nnoremap <silent> s<     :FufBufferTag!<CR>
+  vnoremap <silent> s,     <Esc>:FufBufferTagWithSelectedText!<CR>
+  nnoremap <silent> s.     :FufBufferTagAll<CR>
+  nnoremap <silent> s>     :FufBufferTagAll!<CR>
+  vnoremap <silent> s.     <Esc>:FufBufferTagAllWithSelectedText!<CR>
+  nnoremap <silent> s}     :FufBufferTagAllWithCursorWord!<CR>
   nnoremap <silent> sg     :FufTaggedFile<CR>
   nnoremap <silent> sG     :FufTaggedFile!<CR>
   nnoremap <silent> so     :FufJumpList<CR>
         |:FufBookmarkFile| - Bookmark-File mode (|fuf-bookmarkfile-mode|)
         |:FufBookmarkDir|  - Bookmark-Dir mode (|fuf-bookmarkdir-mode|)
         |:FufTag|          - Tag mode (|fuf-tag-mode|)
+        |:FufBufferTag|    - Buffer-Tag mode (|fuf-buffertag-mode|)
         |:FufTaggedFile|   - Tagged-File mode (|fuf-taggedfile-mode|)
         |:FufJumpList|     - Jump-List mode (|fuf-jumplist-mode|)
         |:FufChangeList|   - Change-List mode (|fuf-changelist-mode|)
 This mode provides an interface to select a tag and jump to the definition of
 it.
 
-Following mapping is the replacement for <C-]>:
+Following mapping is a replacement for <C-]>:
 >
         noremap <silent> <C-]> :FufTagWithCursorWord!<CR>
 <
 
+                                                          *fuf-buffertag-mode*
+Buffer-Tag mode ~
+
+This mode provides an interface to select a tag of current buffer or all
+buffers and jump to the definition of it.
+
+Tag list is instantly created when FuzzyFinder is launched, so there is no
+need to make tags file in advance.
+
+|FufBufferTag| covers current buffer and |FufBufferTagAll| covers all buffers.
+
+Following mapping is a replacement for <C-]>:
+>
+        nnoremap <silent> <C-]> :FufBufferTagWithCursorWord!<CR>
+        vnoremap <silent> <C-]> <Esc>:FufBufferTagAllWithSelectedText!<CR>
+<
+or
+>
+        nnoremap <silent> <C-]> :FufBufferTagAllWithCursorWord!<CR>
+        vnoremap <silent> <C-]> <Esc>:FufBufferTagAllWithSelectedText!<CR>
+<
+This mode is inspired by taglist.vim (vimscript #273) and refered its codes.
+
                                                          *fuf-taggedfile-mode*
 Tagged-File mode ~
 
 
                                                        *:FufTagWithCursorWord*
 :FufTagWithCursorWord[!] [{pattern}]
-        Is mostly the same as |:FufTag|, except that 
+        Is mostly the same as |:FufTag|, except that initial pattern is the
+        word under the cursor.
+
+                                                               *:FufBufferTag*
+:FufBufferTag[!] [{pattern}]
+        Launchs Buffer-Tag mode.
+
+        If a command was executed with a ! modifier, it does partial matching
+        instead of fuzzy matching.
+
+        {pattern} will be inserted after launching FuzzyFinder.
+
+                                                            *:FufBufferTagAll*
+:FufBufferTagAll[!] [{pattern}]
+        Is mostly the same as |:FufBufferTag|, except that tags are gathered
+        from all other buffers in addition to the current one.
+
+                                                 *:FufBufferTagWithCursorWord*
+:FufBufferTagWithCursorWord[!] [{pattern}]
+        Is mostly the same as |:FufBufferTag|, except that initial pattern is
+        the word under the cursor.
+
+                                              *:FufBufferTagAllWithCursorWord*
+:FufBufferTagAllWithCursorWord[!] [{pattern}]
+        Is mostly the same as |:FufBufferTagAll|, except that initial pattern
+        is the word under the cursor.
+
+                                               *:FufBufferTagWithSelectedText*
+:FufBufferTagWithSelectedText[!] [{pattern}]
+        Is mostly the same as |:FufBufferTag|, except that initial pattern is
+        the last selected text.
+
+                                            *:FufBufferTagAllWithSelectedText*
+:FufBufferTagAllWithSelectedText[!] [{pattern}]
+        Is mostly the same as |:FufBufferTagAll|, except that initial pattern
+        is the last selected text.
 
                                                               *:FufTaggedFile*
 :FufTaggedFile[!] [{pattern}]
                                            *:FufBookmarkFileAddAsSelectedText*
 :FufBookmarkFileAddAsSelectedText
         Is mostly the same as |:FufBookmarkFileAdd|, except that initial
-        pattern is last selected one.
+        pattern is the last selected one.
 
                                                           *:FufBookmarkDirAdd*
 :FufBookmarkDirAdd [{name}]
         Prompt string. "[]" will be substituted with indicators.
 
                                                  *g:fuf_mrucmd_switchOrder*  >
-  let g:fuf_mrucmd_switchOrder = 70
+  let g:fuf_mrucmd_switchOrder = 60
 <
         Number of order for switching to the next/previous mode. If negative
         number, Fuzzyfinder never switches to this mode.
         Prompt string. "[]" will be substituted with indicators.
 
                                                *g:fuf_bookmarkfile_switchOrder*  >
-  let g:fuf_bookmarkfile_switchOrder = 80
+  let g:fuf_bookmarkfile_switchOrder = 70
 <
         Number of order for switching to the next/previous mode. If negative
         number, Fuzzyfinder never switches to this mode.
         Prompt string. "[]" will be substituted with indicators.
 
                                                *g:fuf_bookmarkdir_switchOrder*  >
-  let g:fuf_bookmarkdir_switchOrder = 90
+  let g:fuf_bookmarkdir_switchOrder = 80
 <
         Number of order for switching to the next/previous mode. If negative
         number, Fuzzyfinder never switches to this mode.
         Prompt string. "[]" will be substituted with indicators.
 
                                                     *g:fuf_tag_switchOrder*  >
-  let g:fuf_tag_switchOrder = 100
+  let g:fuf_tag_switchOrder = 90
 <
         Number of order for switching to the next/previous mode. If negative
         number, Fuzzyfinder never switches to this mode.
 
+                                              *fuf-options-for-buffertag-mode*
+For Buffer-Tag Mode ~
+
+                                                   *g:fuf_buffertag_prompt*  >
+  let g:fuf_buffertag_prompt = '>Buffer-Tag[]>'
+<
+        Prompt string. "[]" will be substituted with indicators.
+
+                                              *g:fuf_buffertag_switchOrder*  >
+  let g:fuf_buffertag_switchOrder = 100
+<
+        Number of order for switching to the next/previous mode. If negative
+        number, Fuzzyfinder never switches to this mode.
+
+                                                *g:fuf_buffertag_ctagsPath*  >
+  let g:fuf_buffertag_ctagsPath = 'ctags'
+<
+        Executable file path of Ctags.
+
                                              *fuf-options-for-taggedfile-mode*
 For Tagged-File Mode ~
 
 
 >
   let g:fuf_modesDisable = []
-  let g:fuf_abbrevMap = {
-        \   '^vr:' : map(filter(split(&runtimepath, ','), 'v:val !~ "after$"'), 'v:val . ''/**/'''),
-        \   '^m0:' : [ '/mnt/d/0/', '/mnt/j/0/' ],
-        \ }
-  let g:fuf_mrufile_maxItem = 500
-  let g:fuf_mrucmd_maxItem = 500
+  let g:fuf_mrufile_maxItem = 400
+  let g:fuf_mrucmd_maxItem = 400
   nnoremap <silent> sj     :FufBuffer<CR>
   nnoremap <silent> sk     :FufFileWithCurrentBufferDir<CR>
   nnoremap <silent> sK     :FufFileWithFullCwd<CR>
   nnoremap <silent> st     :FufTag<CR>
   nnoremap <silent> sT     :FufTag!<CR>
   noremap  <silent> s]     :FufTagWithCursorWord!<CR>
+  nnoremap <silent> s,     :FufBufferTag<CR>
+  nnoremap <silent> s<     :FufBufferTag!<CR>
+  vnoremap <silent> s,     <Esc>:FufBufferTagWithSelectedText!<CR>
+  nnoremap <silent> s.     :FufBufferTagAll<CR>
+  nnoremap <silent> s>     :FufBufferTagAll!<CR>
+  vnoremap <silent> s.     <Esc>:FufBufferTagAllWithSelectedText!<CR>
+  nnoremap <silent> s}     :FufBufferTagAllWithCursorWord!<CR>
   nnoremap <silent> sg     :FufTaggedFile<CR>
   nnoremap <silent> sG     :FufTaggedFile!<CR>
   nnoremap <silent> so     :FufJumpList<CR>
 ==============================================================================
 CHANGELOG                                                      *fuf-changelog*
 
+4.2:
+  - L9 library (vimscript #3252) version 1.1 is required.
+  - Added Buffer-Tag mode, inspired by taglist.vim (vimscript #273).
+
 4.1.1:
   - Fixed a bug causing a error in MRU-File mode.
 
 " LOAD GUARD {{{1
 
 try
-  if !l9#guardScriptLoading(expand('<sfile>:p'), 702, 100)
+  if !l9#guardScriptLoading(expand('<sfile>:p'), 702, 101, [])
     finish
   endif
 catch /E117/
   call l9#defineVariableDefault('g:fuf_mrufile_maxItem'    , 200)
   call l9#defineVariableDefault('g:fuf_mrufile_maxItemDir' , 50)
   call l9#defineVariableDefault('g:fuf_mrufile_keyExpand'  , '<C-]>')
-  call l9#defineVariableDefault('g:fuf_mrufile_searchAroundLevel', -1) " private option
   "---------------------------------------------------------------------------
   call l9#defineVariableDefault('g:fuf_mrucmd_prompt'     , '>MRU-Cmd[]>')
-  call l9#defineVariableDefault('g:fuf_mrucmd_switchOrder', 70)
+  call l9#defineVariableDefault('g:fuf_mrucmd_switchOrder', 60)
   call l9#defineVariableDefault('g:fuf_mrucmd_exclude'    , '^$')
   call l9#defineVariableDefault('g:fuf_mrucmd_maxItem'    , 200)
   "---------------------------------------------------------------------------
-  call l9#defineVariableDefault('g:fuf_bookmarkfile_prompt'     , '>BookmarkFile[]>')
-  call l9#defineVariableDefault('g:fuf_bookmarkfile_switchOrder', 80)
+  call l9#defineVariableDefault('g:fuf_bookmarkfile_prompt'     , '>Bookmark-File[]>')
+  call l9#defineVariableDefault('g:fuf_bookmarkfile_switchOrder', 70)
   call l9#defineVariableDefault('g:fuf_bookmarkfile_searchRange', 400)
   call l9#defineVariableDefault('g:fuf_bookmarkfile_keyDelete'  , '<C-]>')
   "---------------------------------------------------------------------------
-  call l9#defineVariableDefault('g:fuf_bookmarkdir_prompt'     , '>BookmarkDir[]>')
-  call l9#defineVariableDefault('g:fuf_bookmarkdir_switchOrder', 90)
+  call l9#defineVariableDefault('g:fuf_bookmarkdir_prompt'     , '>Bookmark-Dir[]>')
+  call l9#defineVariableDefault('g:fuf_bookmarkdir_switchOrder', 80)
   call l9#defineVariableDefault('g:fuf_bookmarkdir_keyDelete'  , '<C-]>')
   "---------------------------------------------------------------------------
   call l9#defineVariableDefault('g:fuf_tag_prompt'     , '>Tag[]>')
-  call l9#defineVariableDefault('g:fuf_tag_switchOrder', 100)
+  call l9#defineVariableDefault('g:fuf_tag_switchOrder', 90)
+  "---------------------------------------------------------------------------
+  call l9#defineVariableDefault('g:fuf_buffertag_prompt'     , '>Buffer-Tag[]>')
+  call l9#defineVariableDefault('g:fuf_buffertag_switchOrder', 100)
+  call l9#defineVariableDefault('g:fuf_buffertag_ctagsPath'  , 'ctags')
   "---------------------------------------------------------------------------
   call l9#defineVariableDefault('g:fuf_taggedfile_prompt'     , '>Tagged-File[]>')
   call l9#defineVariableDefault('g:fuf_taggedfile_switchOrder', 110)
   call fuf#addMode('bookmarkfile')
   call fuf#addMode('bookmarkdir')
   call fuf#addMode('tag')
+  call fuf#addMode('buffertag')
   call fuf#addMode('taggedfile')
   call fuf#addMode('jumplist')
   call fuf#addMode('changelist')
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.