Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: cpdean/cpd.dotfiles
base: a7580839fc
...
head fork: cpdean/cpd.dotfiles
compare: 338ec505ff
Checking mergeability… Don't worry, you can still create the pull request.
  • 4 commits
  • 76 files changed
  • 0 commit comments
  • 1 contributor
Showing with 25 additions and 24,333 deletions.
  1. +1 −0  .gitignore
  2. +3 −0  .gitmodules
  3. +15 −0 .vim/.vundle_settings
  4. +0 −35 .vim/after/plugin/snipMate.vim
  5. +0 −1,046 .vim/autoload/fuf.vim
  6. +0 −163 .vim/autoload/fuf/bookmarkdir.vim
  7. +0 −199 .vim/autoload/fuf/bookmarkfile.vim
  8. +0 −189 .vim/autoload/fuf/buffer.vim
  9. +0 −300 .vim/autoload/fuf/buffertag.vim
  10. +0 −137 .vim/autoload/fuf/callbackfile.vim
  11. +0 −139 .vim/autoload/fuf/callbackitem.vim
  12. +0 −172 .vim/autoload/fuf/changelist.vim
  13. +0 −199 .vim/autoload/fuf/coveragefile.vim
  14. +0 −132 .vim/autoload/fuf/dir.vim
  15. +0 −139 .vim/autoload/fuf/file.vim
  16. +0 −123 .vim/autoload/fuf/givencmd.vim
  17. +0 −123 .vim/autoload/fuf/givendir.vim
  18. +0 −121 .vim/autoload/fuf/givenfile.vim
  19. +0 −198 .vim/autoload/fuf/help.vim
  20. +0 −182 .vim/autoload/fuf/jumplist.vim
  21. +0 −135 .vim/autoload/fuf/line.vim
  22. +0 −134 .vim/autoload/fuf/mrucmd.vim
  23. +0 −234 .vim/autoload/fuf/mrufile.vim
  24. +0 −154 .vim/autoload/fuf/quickfix.vim
  25. +0 −178 .vim/autoload/fuf/tag.vim
  26. +0 −159 .vim/autoload/fuf/taggedfile.vim
  27. +0 −570 .vim/autoload/l9.vim
  28. +0 −92 .vim/autoload/l9/async.py
  29. +0 −67 .vim/autoload/l9/async.vim
  30. +0 −107 .vim/autoload/l9/quickfix.vim
  31. +0 −112 .vim/autoload/l9/tempbuffer.vim
  32. +0 −60 .vim/autoload/l9/tempvariables.vim
  33. +0 −433 .vim/autoload/snipMate.vim
  34. +1 −0  .vim/bundle/vundle
  35. +0 −1,222 .vim/doc/NERD_tree.txt
  36. +0 −1,405 .vim/doc/fuf.jax
  37. +0 −1,883 .vim/doc/fuf.txt
  38. +0 −55 .vim/doc/l9.jax
  39. +0 −73 .vim/doc/l9.txt
  40. +0 −286 .vim/doc/snipMate.txt
  41. +0 −1,501 .vim/doc/taglist.txt
  42. +0 −118 .vim/doc/tags
  43. +0 −10 .vim/ftplugin/html_snip_helper.vim
  44. +0 −41 .vim/nerdtree_plugin/exec_menuitem.vim
  45. +0 −194 .vim/nerdtree_plugin/fs_menu.vim
  46. +0 −4,059 .vim/plugin/NERD_tree.vim
  47. +0 −158 .vim/plugin/fuf.vim
  48. +0 −108 .vim/plugin/l9.vim
  49. +0 −32 .vim/plugin/slime.vim
  50. +0 −247 .vim/plugin/snipMate.vim
  51. +0 −4,546 .vim/plugin/taglist.vim
  52. +0 −7 .vim/snippets/_.snippets
  53. +0 −66 .vim/snippets/autoit.snippets
  54. +0 −110 .vim/snippets/c.snippets
  55. +0 −30 .vim/snippets/cpp.snippets
  56. +0 −11 .vim/snippets/html-foo.snippets
  57. +0 −190 .vim/snippets/html.snippets
  58. +0 −22 .vim/snippets/htmldjango.snippets
  59. +0 −78 .vim/snippets/java.snippets
  60. +0 −74 .vim/snippets/javascript.snippets
  61. +0 −54 .vim/snippets/mako.snippets
  62. +0 −184 .vim/snippets/objc.snippets
  63. +0 −91 .vim/snippets/perl.snippets
  64. +0 −216 .vim/snippets/php.snippets
  65. +0 −86 .vim/snippets/python.snippets
  66. +0 −420 .vim/snippets/ruby.snippets
  67. +0 −28 .vim/snippets/sh.snippets
  68. +0 −7 .vim/snippets/snippet.snippets
  69. +0 −92 .vim/snippets/tcl.snippets
  70. +0 −115 .vim/snippets/tex.snippets
  71. +0 −32 .vim/snippets/vim.snippets
  72. +0 −58 .vim/snippets/zsh.snippets
  73. +0 −197 .vim/syntax/objj.vim
  74. +0 −19 .vim/syntax/snippet.vim
  75. +0 −174 .vim/syntax/vala.vim
  76. +5 −2 .vimrc
View
1  .gitignore
@@ -1,2 +1,3 @@
.vim/view/*
+.vim/bundle/*
.vim/.netrwhist*
View
3  .gitmodules
@@ -0,0 +1,3 @@
+[submodule ".vim/bundle/vundle"]
+ path = .vim/bundle/vundle
+ url = https://github.com/gmarik/vundle.git
View
15 .vim/.vundle_settings
@@ -0,0 +1,15 @@
+set nocompatible
+filetype off " required!
+
+set rtp+=~/.vim/bundle/vundle/
+call vundle#rc()
+
+" let Vundle Manage Vundle
+" required!
+Bundle 'gmarik/vundle'
+
+" original repos on github
+Bundle 'msanders/snipmate.vim'
+Bundle 'kien/ctrlp.vim'
+
+filetype plugin indent on
View
35 .vim/after/plugin/snipMate.vim
@@ -1,35 +0,0 @@
-" These are the mappings for snipMate.vim. Putting it here ensures that it
-" will be mapped after other plugins such as supertab.vim.
-if !exists('loaded_snips') || exists('s:did_snips_mappings')
- finish
-endif
-let s:did_snips_mappings = 1
-
-ino <silent> <tab> <c-r>=TriggerSnippet()<cr>
-snor <silent> <tab> <esc>i<right><c-r>=TriggerSnippet()<cr>
-ino <silent> <s-tab> <c-r>=BackwardsSnippet()<cr>
-snor <silent> <s-tab> <esc>i<right><c-r>=BackwardsSnippet()<cr>
-ino <silent> <c-r><tab> <c-r>=ShowAvailableSnips()<cr>
-
-" The default mappings for these are annoying & sometimes break snipMate.
-" You can change them back if you want, I've put them here for convenience.
-snor <bs> b<bs>
-snor <right> <esc>a
-snor <left> <esc>bi
-snor ' b<bs>'
-snor ` b<bs>`
-snor % b<bs>%
-snor U b<bs>U
-snor ^ b<bs>^
-snor \ b<bs>\
-snor <c-x> b<bs><c-x>
-
-" By default load snippets in snippets_dir
-if empty(snippets_dir)
- finish
-endif
-
-call GetSnippets(snippets_dir, '_') " Get global snippets
-
-au FileType * if &ft != 'help' | call GetSnippets(snippets_dir, &ft) | endif
-" vim:noet:sw=4:ts=4:ft=vim
View
1,046 .vim/autoload/fuf.vim
@@ -1,1046 +0,0 @@
-"=============================================================================
-" Copyright (c) 2007-2010 Takeshi NISHIDA
-"
-"=============================================================================
-" LOAD GUARD {{{1
-
-if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
- finish
-endif
-
-" }}}1
-"=============================================================================
-" GLOBAL FUNCTIONS {{{1
-
-
-" returns list of paths.
-" An argument for glob() is normalized in order to avoid a bug on Windows.
-function fuf#glob(expr)
- " Substitutes "\", because on Windows, "**\" doesn't include ".\",
- " but "**/" include "./". I don't know why.
- return split(glob(substitute(a:expr, '\', '/', 'g')), "\n")
-endfunction
-
-"
-function fuf#countModifiedFiles(files, time)
- return len(filter(copy(a:files), 'getftime(expand(v:val)) > a:time'))
-endfunction
-
-"
-function fuf#getCurrentTagFiles()
- return sort(filter(map(tagfiles(), 'fnamemodify(v:val, '':p'')'), 'filereadable(v:val)'))
-endfunction
-
-"
-function fuf#mapToSetSerialIndex(in, offset)
- for i in range(len(a:in))
- let a:in[i].index = i + a:offset
- endfor
- return a:in
-endfunction
-
-"
-function fuf#updateMruList(mrulist, newItem, maxItem, exclude)
- let result = copy(a:mrulist)
- let result = filter(result,'v:val.word !=# a:newItem.word')
- let result = insert(result, a:newItem)
- if len(a:exclude)
- let result = filter(result, 'v:val.word !~ a:exclude')
- endif
- return result[0 : a:maxItem - 1]
-endfunction
-
-" takes suffix number. if no digits, returns -1
-function fuf#suffixNumber(str)
- let s = matchstr(a:str, '\d\+$')
- return (len(s) ? str2nr(s) : -1)
-endfunction
-
-" "foo/bar/buz/hoge" -> { head: "foo/bar/buz/", tail: "hoge" }
-function fuf#splitPath(path)
- let head = matchstr(a:path, '^.*[/\\]')
- return {
- \ 'head' : head,
- \ 'tail' : a:path[strlen(head):]
- \ }
-endfunction
-
-" "foo/.../bar/...hoge" -> "foo/.../bar/../../hoge"
-function fuf#expandTailDotSequenceToParentDir(pattern)
- return substitute(a:pattern, '^\(.*[/\\]\)\?\zs\.\(\.\+\)\ze[^/\\]*$',
- \ '\=repeat(".." . l9#getPathSeparator(), len(submatch(2)))', '')
-endfunction
-
-"
-function fuf#formatPrompt(prompt, partialMatching, otherString)
- let indicator = escape((a:partialMatching ? '!' : '') . a:otherString, '\')
- return substitute(a:prompt, '[]', indicator, 'g')
-endfunction
-
-"
-function fuf#getFileLines(file)
- let bufnr = (type(a:file) ==# type(0) ? a:file : bufnr('^' . a:file . '$'))
- let lines = getbufline(bufnr, 1, '$')
- if !empty(lines)
- return lines
- endif
- return l9#readFile(a:file)
-endfunction
-
-"
-function fuf#makePreviewLinesAround(lines, indices, page, maxHeight)
- let index = ((empty(a:indices) ? 0 : a:indices[0])
- \ + a:page * a:maxHeight) % len(a:lines)
- if empty(a:lines) || a:maxHeight <= 0
- return []
- endif
- let beg = max([0, index - a:maxHeight / 2])
- let end = min([beg + a:maxHeight, len(a:lines)])
- let beg = max([0, end - a:maxHeight])
- let lines = []
- for i in range(beg, end - 1)
- let mark = (count(a:indices, i) ? '>' : ' ')
- call add(lines, printf('%s%4d ', mark, i + 1) . a:lines[i])
- endfor
- return lines
-endfunction
-
-" a:file: a path string or a buffer number
-function fuf#makePreviewLinesForFile(file, count, maxHeight)
- let lines = fuf#getFileLines(a:file)
- if empty(lines)
- return []
- endif
- let bufnr = (type(a:file) ==# type(0) ? a:file : bufnr('^' . a:file . '$'))
- if exists('s:bufferCursorPosMap[bufnr]')
- let indices = [s:bufferCursorPosMap[bufnr][1] - 1]
- else
- let indices = []
- endif
- return fuf#makePreviewLinesAround(
- \ lines, indices, a:count, a:maxHeight)
-endfunction
-
-"
-function fuf#echoWarning(msg)
- call l9#echoHl('WarningMsg', a:msg, '[fuf] ', 1)
-endfunction
-
-"
-function fuf#echoError(msg)
- call l9#echoHl('ErrorMsg', a:msg, '[fuf] ', 1)
-endfunction
-
-"
-function fuf#openBuffer(bufNr, mode, reuse)
- if a:reuse && ((a:mode ==# s:OPEN_TYPE_SPLIT &&
- \ l9#moveToBufferWindowInCurrentTabpage(a:bufNr)) ||
- \ (a:mode ==# s:OPEN_TYPE_VSPLIT &&
- \ l9#moveToBufferWindowInCurrentTabpage(a:bufNr)) ||
- \ (a:mode ==# s:OPEN_TYPE_TAB &&
- \ l9#moveToBufferWindowInOtherTabpage(a:bufNr)))
- return
- endif
- execute printf({
- \ s:OPEN_TYPE_CURRENT : '%sbuffer' ,
- \ s:OPEN_TYPE_SPLIT : '%ssbuffer' ,
- \ s:OPEN_TYPE_VSPLIT : 'vertical %ssbuffer',
- \ s:OPEN_TYPE_TAB : 'tab %ssbuffer' ,
- \ }[a:mode], a:bufNr)
-endfunction
-
-"
-function fuf#openFile(path, mode, reuse)
- let bufNr = bufnr('^' . a:path . '$')
- if bufNr > -1
- call fuf#openBuffer(bufNr, a:mode, a:reuse)
- else
- execute {
- \ s:OPEN_TYPE_CURRENT : 'edit ' ,
- \ s:OPEN_TYPE_SPLIT : 'split ' ,
- \ s:OPEN_TYPE_VSPLIT : 'vsplit ' ,
- \ s:OPEN_TYPE_TAB : 'tabedit ',
- \ }[a:mode] . fnameescape(fnamemodify(a:path, ':~:.'))
- endif
-endfunction
-
-"
-function fuf#openTag(tag, mode)
- execute {
- \ s:OPEN_TYPE_CURRENT : 'tjump ' ,
- \ s:OPEN_TYPE_SPLIT : 'stjump ' ,
- \ s:OPEN_TYPE_VSPLIT : 'vertical stjump ',
- \ s:OPEN_TYPE_TAB : 'tab stjump ' ,
- \ }[a:mode] . a:tag
-endfunction
-
-"
-function fuf#openHelp(tag, mode)
- execute {
- \ s:OPEN_TYPE_CURRENT : 'help ' ,
- \ s:OPEN_TYPE_SPLIT : 'help ' ,
- \ s:OPEN_TYPE_VSPLIT : 'vertical help ',
- \ s:OPEN_TYPE_TAB : 'tab help ' ,
- \ }[a:mode] . a:tag
-endfunction
-
-"
-function fuf#prejump(mode)
- execute {
- \ s:OPEN_TYPE_CURRENT : '' ,
- \ s:OPEN_TYPE_SPLIT : 'split' ,
- \ s:OPEN_TYPE_VSPLIT : 'vsplit' ,
- \ s:OPEN_TYPE_TAB : 'tab split',
- \ }[a:mode]
-endfunction
-
-"
-function fuf#compareRanks(i1, i2)
- if exists('a:i1.ranks') && exists('a:i2.ranks')
- for i in range(min([len(a:i1.ranks), len(a:i2.ranks)]))
- if a:i1.ranks[i] > a:i2.ranks[i]
- return +1
- elseif a:i1.ranks[i] < a:i2.ranks[i]
- return -1
- endif
- endfor
- endif
- return 0
-endfunction
-
-"
-function fuf#makePathItem(fname, menu, appendsDirSuffix)
- let pathPair = fuf#splitPath(a:fname)
- let dirSuffix = (a:appendsDirSuffix && isdirectory(expand(a:fname))
- \ ? l9#getPathSeparator()
- \ : '')
- return {
- \ 'word' : a:fname . dirSuffix,
- \ 'wordForPrimaryHead': s:toLowerForIgnoringCase(pathPair.head),
- \ 'wordForPrimaryTail': s:toLowerForIgnoringCase(pathPair.tail),
- \ 'wordForBoundary' : s:toLowerForIgnoringCase(s:getWordBoundaries(pathPair.tail)),
- \ 'wordForRefining' : s:toLowerForIgnoringCase(a:fname . dirSuffix),
- \ 'wordForRank' : s:toLowerForIgnoringCase(pathPair.tail),
- \ 'menu' : a:menu,
- \ }
-endfunction
-
-"
-function fuf#makeNonPathItem(word, menu)
- let wordL = s:toLowerForIgnoringCase(a:word)
- return {
- \ 'word' : a:word,
- \ 'wordForPrimary' : wordL,
- \ 'wordForBoundary': s:toLowerForIgnoringCase(s:getWordBoundaries(a:word)),
- \ 'wordForRefining': wordL,
- \ 'wordForRank' : wordL,
- \ 'menu' : a:menu,
- \ }
-endfunction
-
-"
-function fuf#makePatternSet(patternBase, interpreter, partialMatching)
- let MakeMatchingExpr = function(a:partialMatching
- \ ? 's:makePartialMatchingExpr'
- \ : 's:makeFuzzyMatchingExpr')
- let [primary; refinings] = split(a:patternBase, g:fuf_patternSeparator, 1)
- let elements = call(a:interpreter, [primary])
- let primaryExprs = map(elements.matchingPairs, 'MakeMatchingExpr(v:val[0], v:val[1])')
- let refiningExprs = map(refinings, 's:makeRefiningExpr(v:val)')
- return {
- \ 'primary' : elements.primary,
- \ 'primaryForRank': elements.primaryForRank,
- \ 'filteringExpr' : join(primaryExprs + refiningExprs, ' && '),
- \ }
-endfunction
-
-"
-function fuf#enumExpandedDirsEntries(dir, exclude)
- let entries = fuf#glob(a:dir . '*') + fuf#glob(a:dir . '.*')
- " removes "*/." and "*/.."
- call filter(entries, 'v:val !~ ''\v(^|[/\\])\.\.?$''')
- call map(entries, 'fuf#makePathItem(v:val, "", 1)')
- if len(a:exclude)
- call filter(entries, 'v:val.word !~ a:exclude')
- endif
- return entries
-endfunction
-
-"
-function fuf#mapToSetAbbrWithSnippedWordAsPath(items)
- let maxLenStats = {}
- call map(a:items, 's:makeFileAbbrInfo(v:val, maxLenStats)')
- let snippedHeads =
- \ map(maxLenStats, 's:getSnippedHead(v:key[: -2], v:val)')
- return map(a:items, 's:setAbbrWithFileAbbrData(v:val, snippedHeads)')
-endfunction
-
-"
-function fuf#setAbbrWithFormattedWord(item, abbrIndex)
- let lenMenu = (exists('a:item.menu') ? len(a:item.menu) + 2 : 0)
- let abbrPrefix = (exists('a:item.abbrPrefix') ? a:item.abbrPrefix : '')
- let a:item.abbr = abbrPrefix . a:item.word
- if a:abbrIndex
- let a:item.abbr = printf('%4d: ', a:item.index) . a:item.abbr
- endif
- let a:item.abbr = l9#snipTail(a:item.abbr, g:fuf_maxMenuWidth - lenMenu, s:ABBR_SNIP_MASK)
- return a:item
-endfunction
-
-"
-function s:onCommandPre()
- for m in filter(copy(fuf#getModeNames()), 'fuf#{v:val}#requiresOnCommandPre()')
- call fuf#{m}#onCommandPre(getcmdtype() . getcmdline())
- endfor
- " lets last entry become the newest in the history
- call histadd(getcmdtype(), getcmdline())
- " this is not mapped again (:help recursive_mapping)
- return "\<CR>"
-endfunction
-
-"
-let s:modeNames = []
-
-"
-function fuf#addMode(modeName)
- if count(g:fuf_modesDisable, a:modeName) > 0
- return
- endif
- call add(s:modeNames, a:modeName)
- call fuf#{a:modeName}#renewCache()
- call fuf#{a:modeName}#onInit()
- if fuf#{a:modeName}#requiresOnCommandPre()
- " cnoremap has a problem, which doesn't expand cabbrev.
- cmap <silent> <expr> <CR> <SID>onCommandPre()
- endif
-endfunction
-
-"
-function fuf#getModeNames()
- return s:modeNames
-endfunction
-
-"
-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! -range -bang -narg=? %s %s call fuf#launch(%s, %s . <q-args>, len(<q-bang>))',
- \ a:CmdName, preCmd, string(a:modeName), a:prefixInitialPattern)
-endfunction
-
-"
-function fuf#defineKeyMappingInHandler(key, func)
- " hacks to be able to use feedkeys().
- execute printf(
- \ 'inoremap <buffer> <silent> %s <C-r>=fuf#getRunningHandler().%s ? "" : ""<CR>',
- \ a:key, a:func)
-endfunction
-
-"
-let s:oneTimeVariables = []
-
-"
-function fuf#setOneTimeVariables(...)
- let s:oneTimeVariables += a:000
-endfunction
-
-"
-function fuf#launch(modeName, initialPattern, partialMatching)
- if exists('s:runningHandler')
- call fuf#echoWarning('FuzzyFinder is running.')
- endif
- if count(fuf#getModeNames(), a:modeName) == 0
- echoerr 'This mode is not available: ' . a:modeName
- return
- endif
- let s:runningHandler = fuf#{a:modeName}#createHandler(copy(s:handlerBase))
- let s:runningHandler.stats = fuf#loadDataFile(s:runningHandler.getModeName(), 'stats')
- let s:runningHandler.partialMatching = a:partialMatching
- let s:runningHandler.bufNrPrev = bufnr('%')
- let s:runningHandler.lastCol = -1
- let s:runningHandler.windowRestoringCommand = winrestcmd()
- call s:runningHandler.onModeEnterPre()
- " NOTE: updatetime is set, because in Buffer-Tag mode on Vim 7.3 on Windows,
- " Vim keeps from triggering CursorMovedI for updatetime after system() is
- " called. I don't know why.
- call fuf#setOneTimeVariables(
- \ ['&completeopt', 'menuone'],
- \ ['&ignorecase', 0],
- \ ['&updatetime', 10],
- \ )
- if s:runningHandler.getPreviewHeight() > 0
- call fuf#setOneTimeVariables(
- \ ['&cmdheight', s:runningHandler.getPreviewHeight() + 1])
- endif
- call l9#tempvariables#setList(s:TEMP_VARIABLES_GROUP, s:oneTimeVariables)
- let s:oneTimeVariables = []
- call s:activateFufBuffer()
- augroup FufLocal
- autocmd!
- autocmd CursorMovedI <buffer> call s:runningHandler.onCursorMovedI()
- autocmd InsertLeave <buffer> nested call s:runningHandler.onInsertLeave()
- augroup END
- for [key, func] in [
- \ [ g:fuf_keyOpen , 'onCr(' . s:OPEN_TYPE_CURRENT . ')' ],
- \ [ g:fuf_keyOpenSplit , 'onCr(' . s:OPEN_TYPE_SPLIT . ')' ],
- \ [ g:fuf_keyOpenVsplit , 'onCr(' . s:OPEN_TYPE_VSPLIT . ')' ],
- \ [ g:fuf_keyOpenTabpage , 'onCr(' . s:OPEN_TYPE_TAB . ')' ],
- \ [ '<BS>' , 'onBs()' ],
- \ [ '<C-h>' , 'onBs()' ],
- \ [ '<C-w>' , 'onDeleteWord()' ],
- \ [ g:fuf_keyPreview , 'onPreviewBase(1)' ],
- \ [ g:fuf_keyNextMode , 'onSwitchMode(+1)' ],
- \ [ g:fuf_keyPrevMode , 'onSwitchMode(-1)' ],
- \ [ g:fuf_keySwitchMatching, 'onSwitchMatching()' ],
- \ [ g:fuf_keyPrevPattern , 'onRecallPattern(+1)' ],
- \ [ g:fuf_keyNextPattern , 'onRecallPattern(-1)' ],
- \ ]
- call fuf#defineKeyMappingInHandler(key, func)
- endfor
- " Starts Insert mode and makes CursorMovedI event now. Command prompt is
- " needed to forces a completion menu to update every typing.
- call setline(1, s:runningHandler.getPrompt() . a:initialPattern)
- call s:runningHandler.onModeEnterPost()
- call feedkeys("A", 'n') " startinsert! does not work in InsertLeave event handler
- redraw
-endfunction
-
-"
-function fuf#loadDataFile(modeName, dataName)
- if !s:dataFileAvailable
- return []
- endif
- let lines = l9#readFile(l9#concatPaths([g:fuf_dataDir, a:modeName, a:dataName]))
- return map(lines, 'eval(v:val)')
-endfunction
-
-"
-function fuf#saveDataFile(modeName, dataName, items)
- if !s:dataFileAvailable
- return -1
- endif
- let lines = map(copy(a:items), 'string(v:val)')
- return l9#writeFile(lines, l9#concatPaths([g:fuf_dataDir, a:modeName, a:dataName]))
-endfunction
-
-"
-function fuf#getDataFileTime(modeName, dataName)
- if !s:dataFileAvailable
- return -1
- endif
- return getftime(expand(l9#concatPaths([g:fuf_dataDir, a:modeName, a:dataName])))
-endfunction
-
-"
-function s:createDataBufferListener(dataFile)
- let listener = { 'dataFile': a:dataFile }
-
- function listener.onWrite(lines)
- let [modeName, dataName] = split(self.dataFile, l9#getPathSeparator())
- let items = map(filter(a:lines, '!empty(v:val)'), 'eval(v:val)')
- call fuf#saveDataFile(modeName, dataName, items)
- echo "Data files updated"
- return 1
- endfunction
-
- return listener
-endfunction
-
-"
-function s:createEditDataListener()
- let listener = {}
-
- function listener.onComplete(dataFile, method)
- let bufName = '[fuf-info]'
- let lines = l9#readFile(l9#concatPaths([g:fuf_dataDir, a:dataFile]))
- call l9#tempbuffer#openWritable(bufName, 'vim', lines, 0, 0, 0,
- \ s:createDataBufferListener(a:dataFile))
- endfunction
-
- return listener
-endfunction
-
-"
-function s:getEditableDataFiles(modeName)
- let dataFiles = fuf#{a:modeName}#getEditableDataNames()
- call filter(dataFiles, 'fuf#getDataFileTime(a:modeName, v:val) != -1')
- return map(dataFiles, 'l9#concatPaths([a:modeName, v:val])')
-endfunction
-
-"
-function fuf#editDataFile()
- let dataFiles = map(copy(fuf#getModeNames()), 's:getEditableDataFiles(v:val)')
- let dataFiles = l9#concat(dataFiles)
- call fuf#callbackitem#launch('', 0, '>Mode>', s:createEditDataListener(), dataFiles, 0)
-endfunction
-
-"
-function fuf#getRunningHandler()
- return s:runningHandler
-endfunction
-
-"
-function fuf#onComplete(findstart, base)
- return s:runningHandler.onComplete(a:findstart, a:base)
-endfunction
-
-" }}}1
-"=============================================================================
-" LOCAL FUNCTIONS/VARIABLES {{{1
-
-let s:TEMP_VARIABLES_GROUP = expand('<sfile>:p')
-let s:ABBR_SNIP_MASK = '...'
-let s:OPEN_TYPE_CURRENT = 1
-let s:OPEN_TYPE_SPLIT = 2
-let s:OPEN_TYPE_VSPLIT = 3
-let s:OPEN_TYPE_TAB = 4
-
-" a:pattern: 'str' -> '\V\.\*s\.\*t\.\*r\.\*'
-function s:makeFuzzyMatchingExpr(target, pattern)
- let wi = ''
- for c in split(a:pattern, '\zs')
- if wi =~# '[^*?]$' && c !~ '[*?]'
- let wi .= '*'
- endif
- let wi .= c
- endfor
- return s:makePartialMatchingExpr(a:target, wi)
-endfunction
-
-" a:pattern: 'str' -> '\Vstr'
-" 'st*r' -> '\Vst\.\*r'
-function s:makePartialMatchingExpr(target, pattern)
- let patternMigemo = s:makeAdditionalMigemoPattern(a:pattern)
- if a:pattern !~ '[*?]' && empty(patternMigemo)
- " NOTE: stridx is faster than regexp matching
- return 'stridx(' . a:target . ', ' . string(a:pattern) . ') >= 0'
- endif
- return a:target . ' =~# ' .
- \ string(l9#convertWildcardToRegexp(a:pattern)) . patternMigemo
-endfunction
-
-"
-function s:makeRefiningExpr(pattern)
- if g:fuf_fuzzyRefining
- let expr = s:makeFuzzyMatchingExpr('v:val.wordForRefining', a:pattern)
- else
- let expr = s:makePartialMatchingExpr('v:val.wordForRefining', a:pattern)
- endif
- if a:pattern =~# '\D'
- return expr
- else
- return '(' . expr . ' || v:val.index == ' . string(a:pattern) . ')'
- endif
-endfunction
-
-"
-function s:makeAdditionalMigemoPattern(pattern)
- if !g:fuf_useMigemo || a:pattern =~# '[^\x01-\x7e]'
- return ''
- endif
- return '\|\m' . substitute(migemo(a:pattern), '\\_s\*', '.*', 'g')
-endfunction
-
-"
-function s:interpretPrimaryPatternForPathTail(pattern)
- let pattern = fuf#expandTailDotSequenceToParentDir(a:pattern)
- let pairL = fuf#splitPath(s:toLowerForIgnoringCase(pattern))
- return {
- \ 'primary' : pattern,
- \ 'primaryForRank': pairL.tail,
- \ 'matchingPairs' : [['v:val.wordForPrimaryTail', pairL.tail],],
- \ }
-endfunction
-
-"
-function s:interpretPrimaryPatternForPath(pattern)
- let pattern = fuf#expandTailDotSequenceToParentDir(a:pattern)
- let patternL = s:toLowerForIgnoringCase(pattern)
- let pairL = fuf#splitPath(patternL)
- if g:fuf_splitPathMatching
- let matches = [
- \ ['v:val.wordForPrimaryHead', pairL.head],
- \ ['v:val.wordForPrimaryTail', pairL.tail],
- \ ]
- else
- let matches = [
- \ ['v:val.wordForPrimaryHead . v:val.wordForPrimaryTail', patternL],
- \ ]
- endif
- return {
- \ 'primary' : pattern,
- \ 'primaryForRank': pairL.tail,
- \ 'matchingPairs' : matches,
- \ }
-endfunction
-
-"
-function s:interpretPrimaryPatternForNonPath(pattern)
- let patternL = s:toLowerForIgnoringCase(a:pattern)
- return {
- \ 'primary' : a:pattern,
- \ 'primaryForRank': patternL,
- \ 'matchingPairs' : [['v:val.wordForPrimary', patternL],],
- \ }
-endfunction
-
-"
-function s:getWordBoundaries(word)
- return substitute(a:word, '\a\zs\l\+\|\zs\A', '', 'g')
-endfunction
-
-"
-function s:toLowerForIgnoringCase(str)
- return (g:fuf_ignoreCase ? tolower(a:str) : a:str)
-endfunction
-
-"
-function s:setRanks(item, pattern, exprBoundary, stats)
- "let word2 = substitute(a:eval_word, '\a\zs\l\+\|\zs\A', '', 'g')
- let a:item.ranks = [
- \ s:evaluateLearningRank(a:item.word, a:stats),
- \ -s:scoreSequentialMatching(a:item.wordForRank, a:pattern),
- \ -s:scoreBoundaryMatching(a:item.wordForBoundary,
- \ a:pattern, a:exprBoundary),
- \ a:item.index,
- \ ]
- return a:item
-endfunction
-
-"
-function s:evaluateLearningRank(word, stats)
- for i in range(len(a:stats))
- if a:stats[i].word ==# a:word
- return i
- endif
- endfor
- return len(a:stats)
-endfunction
-
-" range of return value is [0.0, 1.0]
-function s:scoreSequentialMatching(word, pattern)
- if empty(a:pattern)
- return str2float('0.0')
- endif
- let pos = stridx(a:word, a:pattern)
- if pos < 0
- return str2float('0.0')
- endif
- let lenRest = len(a:word) - len(a:pattern) - pos
- return str2float(pos == 0 ? '0.5' : '0.0') + str2float('0.5') / (lenRest + 1)
-endfunction
-
-" range of return value is [0.0, 1.0]
-function s:scoreBoundaryMatching(wordForBoundary, pattern, exprBoundary)
- if empty(a:pattern)
- return str2float('0.0')
- endif
- if !eval(a:exprBoundary)
- return 0
- endif
- return (s:scoreSequentialMatching(a:wordForBoundary, a:pattern) + 1) / 2
-endfunction
-
-"
-function s:highlightPrompt(prompt)
- syntax clear
- execute printf('syntax match %s /^\V%s/', g:fuf_promptHighlight, escape(a:prompt, '\/'))
-endfunction
-
-"
-function s:highlightError()
- syntax clear
- syntax match Error /^.*$/
-endfunction
-
-"
-function s:expandAbbrevMap(pattern, abbrevMap)
- let result = [a:pattern]
- for [pattern, subs] in items(a:abbrevMap)
- let exprs = result
- let result = []
- for expr in exprs
- let result += map(copy(subs), 'substitute(expr, pattern, escape(v:val, ''\''), "g")')
- endfor
- endfor
- return l9#unique(result)
-endfunction
-
-"
-function s:makeFileAbbrInfo(item, maxLenStats)
- let head = matchstr(a:item.word, '^.*[/\\]\ze.')
- let a:item.abbr = { 'head' : head,
- \ 'tail' : a:item.word[strlen(head):],
- \ 'key' : head . '.',
- \ 'prefix' : printf('%4d: ', a:item.index), }
- if exists('a:item.abbrPrefix')
- let a:item.abbr.prefix .= a:item.abbrPrefix
- endif
- let len = len(a:item.abbr.prefix) + len(a:item.word) +
- \ (exists('a:item.menu') ? len(a:item.menu) + 2 : 0)
- if !exists('a:maxLenStats[a:item.abbr.key]') || len > a:maxLenStats[a:item.abbr.key]
- let a:maxLenStats[a:item.abbr.key] = len
- endif
- return a:item
-endfunction
-
-"
-function s:getSnippedHead(head, baseLen)
- return l9#snipMid(a:head, len(a:head) + g:fuf_maxMenuWidth - a:baseLen, s:ABBR_SNIP_MASK)
-endfunction
-
-"
-function s:setAbbrWithFileAbbrData(item, snippedHeads)
- let lenMenu = (exists('a:item.menu') ? len(a:item.menu) + 2 : 0)
- let abbr = a:item.abbr.prefix . a:snippedHeads[a:item.abbr.key] . a:item.abbr.tail
- let a:item.abbr = l9#snipTail(abbr, g:fuf_maxMenuWidth - lenMenu, s:ABBR_SNIP_MASK)
- return a:item
-endfunction
-
-"
-let s:FUF_BUF_NAME = '[fuf]'
-
-"
-function s:activateFufBuffer()
- " lcd . : To avoid the strange behavior that unnamed buffer changes its cwd
- " if 'autochdir' was set on.
- lcd .
- let cwd = getcwd()
- call l9#tempbuffer#openScratch(s:FUF_BUF_NAME, 'fuf', [], 1, 0, 1, {})
- resize 1 " for issue #21
- " lcd ... : countermeasure against auto-cd script
- lcd `=cwd`
- setlocal nocursorline " for highlighting
- setlocal nocursorcolumn " for highlighting
- setlocal omnifunc=fuf#onComplete
- redraw " for 'lazyredraw'
- if exists(':AcpLock')
- AcpLock
- elseif exists(':AutoComplPopLock')
- AutoComplPopLock
- endif
-endfunction
-
-"
-function s:deactivateFufBuffer()
- if exists(':AcpUnlock')
- AcpUnlock
- elseif exists(':AutoComplPopUnlock')
- AutoComplPopUnlock
- endif
- call l9#tempbuffer#close(s:FUF_BUF_NAME)
-endfunction
-
-" }}}1
-"=============================================================================
-" s:handlerBase {{{1
-
-let s:handlerBase = {}
-
-"-----------------------------------------------------------------------------
-" PURE VIRTUAL FUNCTIONS {{{2
-"
-" "
-" s:handler.getModeName()
-"
-" "
-" s:handler.getPrompt()
-"
-" "
-" s:handler.getCompleteItems(patternSet)
-"
-" "
-" s:handler.onOpen(word, mode)
-"
-" " Before entering FuzzyFinder buffer. This function should return in a short time.
-" s:handler.onModeEnterPre()
-"
-" " After entering FuzzyFinder buffer.
-" s:handler.onModeEnterPost()
-"
-" " After leaving FuzzyFinder buffer.
-" s:handler.onModeLeavePost(opened)
-"
-" }}}2
-"-----------------------------------------------------------------------------
-
-"
-function s:handlerBase.concretize(deriv)
- call extend(self, a:deriv, 'error')
- return self
-endfunction
-
-"
-function s:handlerBase.addStat(pattern, word)
- let stat = { 'pattern' : a:pattern, 'word' : a:word }
- call filter(self.stats, 'v:val !=# stat')
- call insert(self.stats, stat)
- let self.stats = self.stats[0 : g:fuf_learningLimit - 1]
-endfunction
-
-"
-function s:handlerBase.getMatchingCompleteItems(patternBase)
- let MakeMatchingExpr = function(self.partialMatching
- \ ? 's:makePartialMatchingExpr'
- \ : 's:makeFuzzyMatchingExpr')
- let patternSet = self.makePatternSet(a:patternBase)
- let exprBoundary = s:makeFuzzyMatchingExpr('a:wordForBoundary', patternSet.primaryForRank)
- let stats = filter(
- \ copy(self.stats), 'v:val.pattern ==# patternSet.primaryForRank')
- let items = self.getCompleteItems(patternSet.primary)
- " NOTE: In order to know an excess, plus 1 to limit number
- let items = l9#filterWithLimit(
- \ items, patternSet.filteringExpr, g:fuf_enumeratingLimit + 1)
- return map(items,
- \ 's:setRanks(v:val, patternSet.primaryForRank, exprBoundary, stats)')
-endfunction
-
-"
-function s:handlerBase.onComplete(findstart, base)
- if a:findstart
- return 0
- elseif !self.existsPrompt(a:base)
- return []
- endif
- call s:highlightPrompt(self.getPrompt())
- let items = []
- for patternBase in s:expandAbbrevMap(self.removePrompt(a:base), g:fuf_abbrevMap)
- let items += self.getMatchingCompleteItems(patternBase)
- if len(items) > g:fuf_enumeratingLimit
- let items = items[ : g:fuf_enumeratingLimit - 1]
- call s:highlightError()
- break
- endif
- endfor
- if empty(items)
- call s:highlightError()
- else
- call sort(items, 'fuf#compareRanks')
- if g:fuf_autoPreview
- call feedkeys("\<C-p>\<Down>\<C-r>=fuf#getRunningHandler().onPreviewBase(0) ? '' : ''\<CR>", 'n')
- else
- call feedkeys("\<C-p>\<Down>", 'n')
- endif
- let self.lastFirstWord = items[0].word
- endif
- return items
-endfunction
-
-"
-function s:handlerBase.existsPrompt(line)
- return strlen(a:line) >= strlen(self.getPrompt()) &&
- \ a:line[:strlen(self.getPrompt()) -1] ==# self.getPrompt()
-endfunction
-
-"
-function s:handlerBase.removePrompt(line)
- return a:line[(self.existsPrompt(a:line) ? strlen(self.getPrompt()) : 0):]
-endfunction
-
-"
-function s:handlerBase.restorePrompt(line)
- let i = 0
- while i < len(self.getPrompt()) && i < len(a:line) && self.getPrompt()[i] ==# a:line[i]
- let i += 1
- endwhile
- return self.getPrompt() . a:line[i : ]
-endfunction
-
-"
-function s:handlerBase.onCursorMovedI()
- if !self.existsPrompt(getline('.'))
- call setline('.', self.restorePrompt(getline('.')))
- call feedkeys("\<End>", 'n')
- elseif col('.') <= len(self.getPrompt())
- " if the cursor is moved before command prompt
- call feedkeys(repeat("\<Right>", len(self.getPrompt()) - col('.') + 1), 'n')
- elseif col('.') > strlen(getline('.')) && col('.') != self.lastCol
- " if the cursor is placed on the end of the line and has been actually moved.
- let self.lastCol = col('.')
- let self.lastPattern = self.removePrompt(getline('.'))
- call feedkeys("\<C-x>\<C-o>", 'n')
- endif
-endfunction
-
-"
-function s:handlerBase.onInsertLeave()
- unlet s:runningHandler
- 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
- let fOpen = exists('s:reservedCommand')
- if fOpen
- call self.onOpen(s:reservedCommand[0], s:reservedCommand[1])
- unlet s:reservedCommand
- endif
- call self.onModeLeavePost(fOpen)
- if exists('self.reservedMode')
- call l9#tempvariables#setList(s:TEMP_VARIABLES_GROUP, tempVars)
- call fuf#launch(self.reservedMode, self.lastPattern, self.partialMatching)
- endif
-endfunction
-
-"
-function s:handlerBase.onCr(openType)
- if pumvisible()
- call feedkeys(printf("\<C-y>\<C-r>=fuf#getRunningHandler().onCr(%d) ? '' : ''\<CR>",
- \ a:openType), 'n')
- return
- endif
- if !empty(self.lastPattern)
- call self.addStat(self.lastPattern, self.removePrompt(getline('.')))
- endif
- if !self.isOpenable(getline('.'))
- " To clear i_<C-r> expression (fuf#getRunningHandler().onCr...)
- echo ''
- return
- endif
- let s:reservedCommand = [self.removePrompt(getline('.')), a:openType]
- call feedkeys("\<Esc>", 'n') " stopinsert behavior is strange...
-endfunction
-
-"
-function s:handlerBase.onBs()
- call feedkeys((pumvisible() ? "\<C-e>\<BS>" : "\<BS>"), 'n')
-endfunction
-
-"
-function s:getLastBlockLength(pattern, patternIsPath)
- let separatorPos = strridx(a:pattern, g:fuf_patternSeparator)
- if separatorPos >= 0
- return len(a:pattern) - separatorPos
- endif
- if a:patternIsPath && a:pattern =~# '[/\\].'
- return len(matchstr(a:pattern, '[^/\\]*.$'))
- endif
- return len(a:pattern)
-endfunction
-
-"
-function s:handlerBase.onDeleteWord()
- let pattern = self.removePrompt(getline('.')[ : col('.') - 2])
- let numBs = s:getLastBlockLength(pattern, 1)
- call feedkeys((pumvisible() ? "\<C-e>" : "") . repeat("\<BS>", numBs), 'n')
-endfunction
-
-"
-function s:handlerBase.onPreviewBase(repeatable)
- if self.getPreviewHeight() <= 0
- return
- elseif !pumvisible()
- return
- elseif !self.existsPrompt(getline('.'))
- let word = self.removePrompt(getline('.'))
- elseif !exists('self.lastFirstWord')
- return
- else
- let word = self.lastFirstWord
- endif
- redraw
- if a:repeatable && exists('self.lastPreviewInfo') && self.lastPreviewInfo.word ==# word
- let self.lastPreviewInfo.count += 1
- else
- let self.lastPreviewInfo = {'word': word, 'count': 0}
- endif
- let lines = self.makePreviewLines(word, self.lastPreviewInfo.count)
- let lines = lines[: self.getPreviewHeight() - 1]
- call map(lines, 'substitute(v:val, "\t", repeat(" ", &tabstop), "g")')
- call map(lines, 'strtrans(v:val)')
- call map(lines, 'l9#snipTail(v:val, &columns - 1, s:ABBR_SNIP_MASK)')
- echo join(lines, "\n")
-endfunction
-
-"
-function s:handlerBase.onSwitchMode(shift)
- let modes = copy(fuf#getModeNames())
- call map(modes, '{ "ranks": [ fuf#{v:val}#getSwitchOrder(), v:val ] }')
- call filter(modes, 'v:val.ranks[0] >= 0')
- call sort(modes, 'fuf#compareRanks')
- let self.reservedMode = self.getModeName()
- for i in range(len(modes))
- if modes[i].ranks[1] ==# self.getModeName()
- let self.reservedMode = modes[(i + a:shift) % len(modes)].ranks[1]
- break
- endif
- endfor
- call feedkeys("\<Esc>", 'n') " stopinsert doesn't work.
-endfunction
-
-"
-function s:handlerBase.onSwitchMatching()
- let self.partialMatching = !self.partialMatching
- let self.lastCol = -1
- call setline('.', self.restorePrompt(self.lastPattern))
- call feedkeys("\<End>", 'n')
- "call self.onCursorMovedI()
-endfunction
-
-"
-function s:handlerBase.onRecallPattern(shift)
- let patterns = map(copy(self.stats), 'v:val.pattern')
- if !exists('self.indexRecall')
- let self.indexRecall = -1
- endif
- let self.indexRecall += a:shift
- if self.indexRecall < 0
- let self.indexRecall = -1
- elseif self.indexRecall >= len(patterns)
- let self.indexRecall = len(patterns) - 1
- else
- call setline('.', self.getPrompt() . patterns[self.indexRecall])
- call feedkeys("\<End>", 'n')
- endif
-endfunction
-
-" }}}1
-"=============================================================================
-" INITIALIZATION {{{1
-
-augroup FufGlobal
- autocmd!
- autocmd BufLeave * let s:bufferCursorPosMap[bufnr('')] = getpos('.')
-augroup END
-
-let s:bufferCursorPosMap = {}
-
-"
-let s:DATA_FILE_VERSION = 400
-
-"
-function s:checkDataFileCompatibility()
- if empty(g:fuf_dataDir)
- let s:dataFileAvailable = 0
- return
- endif
- let versionPath = l9#concatPaths([g:fuf_dataDir, 'VERSION'])
- let lines = l9#readFile(versionPath)
- if empty(lines)
- call l9#writeFile([s:DATA_FILE_VERSION], versionPath)
- let s:dataFileAvailable = 1
- elseif str2nr(lines[0]) == s:DATA_FILE_VERSION
- let s:dataFileAvailable = 1
- else
- call fuf#echoWarning(printf(
- \ "=======================================================\n" .
- \ " Existing data files for FuzzyFinder is no longer \n" .
- \ " compatible with this version of FuzzyFinder. Remove \n" .
- \ " %-53s\n" .
- \ "=======================================================\n" ,
- \ string(g:fuf_dataDir)))
- call l9#inputHl('Question', 'Press Enter')
- let s:dataFileAvailable = 0
- endif
-endfunction
-
-call s:checkDataFileCompatibility()
-
-" }}}1
-"=============================================================================
-" vim: set fdm=marker:
-
View
163 .vim/autoload/fuf/bookmarkdir.vim
@@ -1,163 +0,0 @@
-"=============================================================================
-" Copyright (c) 2010 Takeshi NISHIDA
-"
-"=============================================================================
-" LOAD GUARD {{{1
-
-if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
- finish
-endif
-
-" }}}1
-"=============================================================================
-" GLOBAL FUNCTIONS {{{1
-
-"
-function fuf#bookmarkdir#createHandler(base)
- return a:base.concretize(copy(s:handler))
-endfunction
-
-"
-function fuf#bookmarkdir#getSwitchOrder()
- return g:fuf_bookmarkdir_switchOrder
-endfunction
-
-"
-function fuf#bookmarkdir#getEditableDataNames()
- return ['items']
-endfunction
-
-"
-function fuf#bookmarkdir#renewCache()
-endfunction
-
-"
-function fuf#bookmarkdir#requiresOnCommandPre()
- return 0
-endfunction
-
-"
-function fuf#bookmarkdir#onInit()
- call fuf#defineLaunchCommand('FufBookmarkDir', s:MODE_NAME, '""', [])
- command! -bang -narg=? FufBookmarkDirAdd call s:bookmark(<q-args>)
-endfunction
-
-" }}}1
-"=============================================================================
-" LOCAL FUNCTIONS/VARIABLES {{{1
-
-let s:MODE_NAME = expand('<sfile>:t:r')
-let s:OPEN_TYPE_DELETE = -1
-
-"
-function s:bookmark(word)
- let item = {
- \ 'time' : localtime(),
- \ }
-
- let item.path = l9#inputHl('Question', '[fuf] Directory to bookmark:',
- \ fnamemodify(getcwd(), ':p:~'), 'dir')
- if item.path !~ '\S'
- call fuf#echoWarning('Canceled')
- return
- endif
- let item.word = l9#inputHl('Question', '[fuf] Bookmark as:',
- \ fnamemodify(getcwd(), ':p:~'))
- if item.word !~ '\S'
- call fuf#echoWarning('Canceled')
- return
- endif
- let items = fuf#loadDataFile(s:MODE_NAME, 'items')
- call insert(items, item)
- call fuf#saveDataFile(s:MODE_NAME, 'items', items)
-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_bookmarkdir_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 a:mode ==# s:OPEN_TYPE_DELETE
- let items = fuf#loadDataFile(s:MODE_NAME, 'items')
- call filter(items, 'v:val.word !=# a:word')
- call fuf#saveDataFile(s:MODE_NAME, 'items', items)
- let self.reservedMode = self.getModeName()
- return
- else
- let item = s:findItem(fuf#loadDataFile(s:MODE_NAME, 'items'), a:word)
- if !empty(item)
- execute ':cd ' . fnameescape(item.path)
- endif
- endif
-endfunction
-
-"
-function s:handler.onModeEnterPre()
-endfunction
-
-"
-function s:handler.onModeEnterPost()
- call fuf#defineKeyMappingInHandler(g:fuf_bookmarkdir_keyDelete,
- \ 'onCr(' . s:OPEN_TYPE_DELETE . ')')
- 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)')
-endfunction
-
-"
-function s:handler.onModeLeavePost(opened)
-endfunction
-
-" }}}1
-"=============================================================================
-" vim: set fdm=marker:
View
199 .vim/autoload/fuf/bookmarkfile.vim
@@ -1,199 +0,0 @@
-"=============================================================================
-" Copyright (c) 2010 Takeshi NISHIDA
-"
-"=============================================================================
-" LOAD GUARD {{{1
-
-if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
- finish
-endif
-
-" }}}1
-"=============================================================================
-" GLOBAL FUNCTIONS {{{1
-
-"
-function fuf#bookmarkfile#createHandler(base)
- return a:base.concretize(copy(s:handler))
-endfunction
-
-"
-function fuf#bookmarkfile#getSwitchOrder()
- return g:fuf_bookmarkfile_switchOrder
-endfunction
-
-"
-function fuf#bookmarkfile#getEditableDataNames()
- return ['items']
-endfunction
-
-"
-function fuf#bookmarkfile#renewCache()
-endfunction
-
-"
-function fuf#bookmarkfile#requiresOnCommandPre()
- return 0
-endfunction
-
-"
-function fuf#bookmarkfile#onInit()
- 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
-
-" }}}1
-"=============================================================================
-" LOCAL FUNCTIONS/VARIABLES {{{1
-
-let s:MODE_NAME = expand('<sfile>:t:r')
-let s:OPEN_TYPE_DELETE = -1
-
-" 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_bookmarkfile_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#echoWarning('Can''t bookmark this buffer.')
- 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 = l9#inputHl('Question', '[fuf] Bookmark as:', item.word)
- if item.word !~ '\S'
- call fuf#echoWarning('Canceled')
- return
- endif
- let items = fuf#loadDataFile(s:MODE_NAME, 'items')
- call insert(items, item)
- call fuf#saveDataFile(s:MODE_NAME, 'items', items)
-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_bookmarkfile_prompt, self.partialMatching, '')
-endfunction
-
-"
-function s:handler.getPreviewHeight()
- return g:fuf_previewHeight
-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)
- let item = s:findItem(fuf#loadDataFile(s:MODE_NAME, 'items'), 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
- let items = fuf#loadDataFile(s:MODE_NAME, 'items')
- call filter(items, 'v:val.word !=# a:word')
- call fuf#saveDataFile(s:MODE_NAME, 'items', items)
- let self.reservedMode = self.getModeName()
- return
- else
- let item = s:findItem(fuf#loadDataFile(s:MODE_NAME, 'items'), 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_bookmarkfile_keyDelete,
- \ 'onCr(' . s:OPEN_TYPE_DELETE . ')')
- 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)')
-endfunction
-
-"
-function s:handler.onModeLeavePost(opened)
-endfunction
-
-" }}}1
-"=============================================================================
-" vim: set fdm=marker:
View
189 .vim/autoload/fuf/buffer.vim
@@ -1,189 +0,0 @@
-"=============================================================================
-" Copyright (c) 2007-2010 Takeshi NISHIDA
-"
-"=============================================================================
-" LOAD GUARD {{{1
-
-if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
- finish
-endif
-
-" }}}1
-"=============================================================================
-" GLOBAL FUNCTIONS {{{1
-
-"
-function fuf#buffer#createHandler(base)
- return a:base.concretize(copy(s:handler))
-endfunction
-
-"
-function fuf#buffer#getSwitchOrder()
- return g:fuf_buffer_switchOrder
-endfunction
-
-"
-function fuf#buffer#getEditableDataNames()
- return []
-endfunction
-
-"
-function fuf#buffer#renewCache()
-endfunction
-
-"
-function fuf#buffer#requiresOnCommandPre()
- return 0
-endfunction
-
-"
-function fuf#buffer#onInit()
- call fuf#defineLaunchCommand('FufBuffer', s:MODE_NAME, '""', [])
- augroup fuf#buffer
- autocmd!
- autocmd BufEnter * call s:updateBufTimes()
- autocmd BufWritePost * call s:updateBufTimes()
- augroup END
-endfunction
-
-" }}}1
-"=============================================================================
-" LOCAL FUNCTIONS/VARIABLES {{{1
-
-let s:MODE_NAME = expand('<sfile>:t:r')
-let s:OPEN_TYPE_DELETE = -1
-
-let s:bufTimes = {}
-
-"
-function s:updateBufTimes()
- let s:bufTimes[bufnr('%')] = localtime()
-endfunction
-
-"
-function s:makeItem(nr)
- let fname = (empty(bufname(a:nr))
- \ ? '[No Name]'
- \ : 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
- let item.bufNr = a:nr
- let item.time = time
- let item.abbrPrefix = s:getBufIndicator(a:nr) . ' '
- return item
-endfunction
-
-"
-function s:getBufIndicator(bufNr)
- if !getbufvar(a:bufNr, '&modifiable')
- return '[-]'
- elseif getbufvar(a:bufNr, '&modified')
- return '[+]'
- elseif getbufvar(a:bufNr, '&readonly')
- return '[R]'
- else
- return ' '
- endif
-endfunction
-
-"
-function s:compareTimeDescending(i1, i2)
- return a:i1.time == a:i2.time ? 0 : a:i1.time > a:i2.time ? -1 : +1
-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_buffer_prompt, self.partialMatching, '')
-endfunction
-
-"
-function s:handler.getPreviewHeight()
- return g:fuf_previewHeight
-endfunction
-
-"
-function s:handler.isOpenable(enteredPattern)
- return 1
-endfunction
-
-"
-function s:handler.makePatternSet(patternBase)
- return fuf#makePatternSet(a:patternBase, 's:interpretPrimaryPatternForPath',
- \ self.partialMatching)
-endfunction
-
-"
-function s:handler.makePreviewLines(word, count)
- let item = s:findItem(self.items, a:word)
- if empty(item)
- return []
- endif
- return fuf#makePreviewLinesForFile(item.bufNr, a:count, self.getPreviewHeight())
-endfunction
-
-"
-function s:handler.getCompleteItems(patternPrimary)
- return self.items
-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)
- " 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
-
-"
-function s:handler.onModeEnterPre()
-endfunction
-
-"
-function s:handler.onModeEnterPost()
- 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 sort(self.items, 's:compareTimeDescending')
- call fuf#mapToSetSerialIndex(self.items, 1)
- endif
- let self.items = fuf#mapToSetAbbrWithSnippedWordAsPath(self.items)
-endfunction
-
-"
-function s:handler.onModeLeavePost(opened)
-endfunction
-
-" }}}1
-"=============================================================================
-" vim: set fdm=marker:
View
300 .vim/autoload/fuf/buffertag.vim
@@ -1,300 +0,0 @@
-"=============================================================================
-" 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
- " the following settings originate from taglist.vim
- 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)
- " tag W:\Win32\SRC7\NCSIM\NCVW32\CUBEFACE.H /^#define CUBEFACE_H$/;" macro line:4
- let fields = matchlist(a:line, '\v^([^\t]+)\t(.+)\t\/\^(.+)\$\/\;\"\t(.+)\tline\:(\d+)')
- if empty(fields)
- return {}
- endif
- return {
- \ 'tag' : fields[1],
- \ 'fname' : fields[2],
- \ 'pattern': fields[3],
- \ 'kind' : fields[4],
- \ 'lnum' : str2nr(fields[5]),
- \ }
-endfunction
-
-"
-let s:TEMP_VARIABLES_GROUP = expand('<sfile>:p')
-
-"
-function s:getFileType(bufNr)
- let ft = getbufvar(a:bufNr, '&filetype')
- if !empty(ft) || bufloaded(a:bufNr)
- return ft
- endif
- let ft = getbufvar(a:bufNr, 'fuf_buffertag_filetype')
- if !empty(ft)
- return ft
- endif
- call l9#tempvariables#set(s:TEMP_VARIABLES_GROUP, '&eventignore', 'FileType')
- call l9#tempvariables#set(s:TEMP_VARIABLES_GROUP, '&filetype', &filetype)
- " from taglist.vim
- execute 'doautocmd filetypedetect BufRead ' . bufname(a:bufNr)
- let ft = &filetype
- call l9#tempvariables#end(s:TEMP_VARIABLES_GROUP)
- call setbufvar(a:bufNr, 'fuf_buffertag_filetype', ft)
- return ft
-endfunction
-
-"
-function s:makeCtagsCmd(bufNr)
- let ft = s:getFileType(a:bufNr)
- 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
- call fuf#echoError([cmd] + items)
- throw "Command error"
- 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")
- let bufNames = map(copy(a:bufNrs), 'bufname(v:val)')
- if !exists('s:tagDataCache[key]') ||
- \ fuf#countModifiedFiles(bufNames, 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]')
- call fuf#echoError('Definition not found:' . a:word)
- return
- 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 a definition of "' . a:word . '":'] + 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:
View
137 .vim/autoload/fuf/callbackfile.vim
@@ -1,137 +0,0 @@
-"=============================================================================
-" Copyright (c) 2007-2010 Takeshi NISHIDA
-"
-"=============================================================================
-" LOAD GUARD {{{1
-
-if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
- finish
-endif
-
-" }}}1
-"=============================================================================
-" GLOBAL FUNCTIONS {{{1
-
-"
-function fuf#callbackfile#createHandler(base)
- return a:base.concretize(copy(s:handler))
-endfunction
-
-"
-function fuf#callbackfile#getSwitchOrder()
- return -1
-endfunction
-
-"
-function fuf#callbackfile#getEditableDataNames()
- return []
-endfunction
-
-"
-function fuf#callbackfile#renewCache()
- let s:cache = {}
-endfunction
-
-"
-function fuf#callbackfile#requiresOnCommandPre()
- return 0
-endfunction
-
-"
-function fuf#callbackfile#onInit()
-endfunction
-
-"
-function fuf#callbackfile#launch(initialPattern, partialMatching, prompt, exclude, listener)
- let s:prompt = (empty(a:prompt) ? '>' : a:prompt)
- let s:exclude = a:exclude
- let s:listener = a:listener
- call fuf#launch(s:MODE_NAME, a:initialPattern, a:partialMatching)
-endfunction
-
-" }}}1
-"=============================================================================
-" LOCAL FUNCTIONS/VARIABLES {{{1
-
-let s:MODE_NAME = expand('<sfile>:t:r')
-
-"
-function s:enumItems(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)
- call insert(s:cache[key], fuf#makePathItem(a:dir . '.', '', 0))
- endif
- call fuf#mapToSetSerialIndex(s:cache[key], 1)
- call fuf#mapToSetAbbrWithSnippedWordAsPath(s:cache[key])
- endif
- return s:cache[key]
-endfunction
-
-" }}}1
-"=============================================================================
-" s:handler {{{1
-
-let s:handler = {}
-
-"
-function s:handler.getModeName()
- return s:MODE_NAME
-endfunction
-
-"
-function s:handler.getPrompt()
- return fuf#formatPrompt(s:prompt, self.partialMatching, '')
-endfunction
-
-"
-function s:handler.getPreviewHeight()
- return g:fuf_previewHeight
-endfunction
-
-"
-function s:handler.isOpenable(enteredPattern)
- return a:enteredPattern =~# '[^/\\]$'
-endfunction
-
-"
-function s:handler.makePatternSet(patternBase)
- return fuf#makePatternSet(a:patternBase, 's:interpretPrimaryPatternForPathTail',
- \ self.partialMatching)
-endfunction
-
-"
-function s:handler.makePreviewLines(word, count)
- return fuf#makePreviewLinesForFile(a:word, a:count, self.getPreviewHeight())
-endfunction
-
-"
-function s:handler.getCompleteItems(patternPrimary)
- let items = copy(s:enumItems(fuf#splitPath(a:patternPrimary).head))
- return filter(items, 'bufnr("^" . v:val.word . "$") != self.bufNrPrev')
-endfunction
-
-"
-function s:handler.onOpen(word, mode)
- call s:listener.onComplete(a:word, a:mode)
-endfunction
-
-"
-function s:handler.onModeEnterPre()
-endfunction
-
-"
-function s:handler.onModeEnterPost()
-endfunction
-
-"
-function s:handler.onModeLeavePost(opened)
- if !a:opened && exists('s:listener.onAbort()')
- call s:listener.onAbort()
- endif
-endfunction
-
-" }}}1
-"=============================================================================
-" vim: set fdm=marker:
View
139 .vim/autoload/fuf/callbackitem.vim
@@ -1,139 +0,0 @@
-"=============================================================================
-" Copyright (c) 2007-2010 Takeshi NISHIDA
-"
-"=============================================================================
-" LOAD GUARD {{{1
-
-if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
- finish
-endif
-
-" }}}1
-"=============================================================================
-" GLOBAL FUNCTIONS {{{1
-
-"
-function fuf#callbackitem#createHandler(base)
- return a:base.concretize(copy(s:handler))
-endfunction
-
-"
-function fuf#callbackitem#getSwitchOrder()
- return -1
-endfunction
-
-"
-function fuf#callbackitem#getEditableDataNames()
- return []
-endfunction
-
-"
-function fuf#callbackitem#renewCache()
-endfunction
-
-"
-function fuf#callbackitem#requiresOnCommandPre()
- return 0
-endfunction
-
-"
-function fuf#callbackitem#onInit()
-endfunction
-
-"
-function fuf#callbackitem#launch(initialPattern, partialMatching, prompt, listener, items, forPath)
- let s:prompt = (empty(a:prompt) ? '>' : a:prompt)
- let s:listener = a:listener
- let s:forPath = a:forPath
- let s:items = copy(a:items)
- if s:forPath
- call map(s:items, 'fuf#makePathItem(v:val, "", 1)')
- call fuf#mapToSetSerialIndex(s:items, 1)
- call fuf#mapToSetAbbrWithSnippedWordAsPath(s:items)
- else
- call map(s:items, 'fuf#makeNonPathItem(v:val, "")')
- call fuf#mapToSetSerialIndex(s:items, 1)
- call map(s:items, 'fuf#setAbbrWithFormattedWord(v:val, 1)')
- endif
- call fuf#launch(s:MODE_NAME, a:initialPattern, a:partialMatching)
-endfunction
-
-" }}}1
-"=============================================================================
-" LOCAL FUNCTIONS/VARIABLES {{{1
-
-let s:MODE_NAME = expand('<sfile>:t:r')
-
-" }}}1
-"=============================================================================
-" s:handler {{{1
-
-let s:handler = {}
-
-"
-function s:handler.getModeName()
- return s:MODE_NAME
-endfunction
-
-"
-function s:handler.getPrompt()
- return fuf#formatPrompt(s:prompt, self.partialMatching, '')
-endfunction
-
-"
-function s:handler.getPreviewHeight()
- if s:forPath
- return g:fuf_previewHeight
- endif
- return 0
-endfunction
-
-"
-function s:handler.isOpenable(enteredPattern)
- return 1
-endfunction
-
-"
-function s:handler.makePatternSet(patternBase)
- let parser = (s:forPath
- \ ? 's:interpretPrimaryPatternForPath'
- \ : 's:interpretPrimaryPatternForNonPath')
- return fuf#makePatternSet(a:patternBase, parser, self.partialMatching)
-endfunction
-
-"
-function s:handler.makePreviewLines(word, count)
- if s:forPath
- return fuf#makePreviewLinesForFile(a:word, a:count, self.getPreviewHeight())
- endif
- return []
-endfunction
-
-"
-function s:handler.getCompleteItems(patternPrimary)
- return s:items
-endfunction
-
-"
-function s:handler.onOpen(word, mode)
- call s:listener.onComplete(a:word, a:mode)
-endfunction
-
-"
-function s:handler.onModeEnterPre()
-endfunction
-
-"
-function s:handler.onModeEnterPost()
-endfunction
-
-"
-function s:handler.onModeLeavePost(opened)
- if !a:opened && exists('s:listener.onAbort()')
- call s:listener.onAbort()
- endif
-endfunction
-
-" }}}1
-"=============================================================================
-" vim: set fdm=marker:
View
172 .vim/autoload/fuf/changelist.vim
@@ -1,172 +0,0 @@
-"=============================================================================