Commits

ZyX_I committed b535136

@%aurum/maputils: Added fuzzyfinder support
docs: Documented the list of supported plugins

  • Participants
  • Parent commits 39845f9
  • Branches command-t

Comments (0)

Files changed (3)

File autoload/aurum/maputils.vim

 let s:ctrlp_files=[]
 let s:F.listplugs.ctrlp={}
 function s:F.listplugs.ctrlp.init()
-    runtime plugin/ctrlp.vim
     try
+        runtime plugin/ctrlp.vim
         call add(g:ctrlp_ext_vars, s:ctrlp_ext_var)
         let s:ctrlp_id=g:ctrlp_builtins+len(g:ctrlp_ext_vars)
         lockvar! s:ctlp_id
     call ctrlp#init(s:ctrlp_id)
     let [b:aurum_callback_fun; b:aurum_addargs]=a:cbargs
 endfunction
+"▶2 fuf
+let s:F.listplugs.fuf={}
+function s:F.listplugs.fuf.init()
+    try
+        runtime plugin/fuf.vim
+        call fuf#addMode('aurum')
+        return 1
+    catch
+        return 0
+    endtry
+endfunction
+function s:F.listplugs.fuf.call(files, cbargs)
+    " FIXME It is relying on structure of cbargs which should not happen
+    let repo=a:cbargs[1]
+    let rev=a:cbargs[2]
+    call fuf#aurum#setAuVars({'repo': repo, 'rev': rev, 'files': a:files,
+                \             'cbargs': a:cbargs})
+    call fuf#launch('aurum', '', 0)
+endfunction
 "▶1 promptuser
 function s:r.promptuser(files, cbargs)
     if s:plug is 0

File autoload/fuf/aurum.vim

+"▶1 
+execute frawor#Setup('0.0', {})
+let s:_messages={
+            \'invcall': 'Invalid call. You must call '.
+            \           'fuf#aurum#setAuVars() first',
+        \}
+"▶1 Global functions
+function fuf#aurum#createHandler(base)
+    if !exists('s:vars')
+        call s:_f.throw('invcall')
+    endif
+    let handler=copy(s:handler)
+    let handler._aurum=s:vars
+    unlet s:vars
+    return a:base.concretize(handler)
+endfunction
+let s:_functions+=['fuf#aurum#createHandler']
+function fuf#aurum#getSwitchOrder()
+    return -1
+endfunction
+let s:_functions+=['fuf#aurum#getSwitchOrder']
+function fuf#aurum#getEditableDataNames()
+    return []
+endfunction
+let s:_functions+=['fuf#aurum#getEditableDataNames']
+function fuf#aurum#renewCache()
+endfunction
+let s:_functions+=['fuf#aurum#renewCache']
+function fuf#aurum#requiresOnCommandPre()
+    return 0
+endfunction
+let s:_functions+=['fuf#aurum#requiresOnCommandPre']
+function fuf#aurum#onInit()
+endfunction
+let s:_functions+=['fuf#aurum#onInit']
+function fuf#aurum#setAuVars(vars)
+    let s:vars=a:vars
+endfunction
+let s:_functions+=['fuf#aurum#setAuVars']
+"▶1 s:handler
+let s:handler={}
+function s:handler.getModeName()
+    return 'changeset files'
+endfunction
+function s:handler.getPrompt()
+    return fuf#formatPrompt('>Changeset file[]>', 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 lines=self._aurum.repo.functions.readfile(self._aurum.repo,
+                \                                 self._aurum.rev, a:word)
+    return fuf#makePreviewLinesAround(lines, [], a:count,
+                \                     self.getPreviewHeight())
+endfunction
+function s:handler.getCompleteItems(patternPrimary)
+    return self.items
+endfunction
+function s:handler.onOpen(word, mode)
+    return call(self._aurum.cbargs[0], [a:word]+self._aurum.cbargs[1:], {})
+endfunction
+function s:handler.onModeEnterPre()
+endfunction
+function s:handler.onModeEnterPost()
+    let self.items=map(copy(self._aurum.files),
+                \      'extend(fuf#makePathItem(v:val, "", 0), '.
+                \              '{"index": v:key+1})')
+    let self.items=fuf#mapToSetAbbrWithSnippedWordAsPath(self.items)
+endfunction
+function s:handler.onModeLeavePost(opened)
+endfunction
+"▶1 
+call frawor#Lockvar(s:, '')
+" vim: ft=vim ts=4 sts=4 et fmr=▶,▲

File doc/aurum.txt

   customized using |g:frawormap_mgid| and |g:frawormap_mgid_mapname|.
 - All buffers that define mappings also define Exit mapping (with default 
   LHS=X)
+- OpenAny/AnnotateAny mappings require one of Command-T, Ctrlp or FuzzyFinder 
+  plugins installed. Otherwise they will show inputdialog() unusable with 
+  large number of files.
 
 aurum://annotate:{repo}:{rev}:{file}                        *aurum://annotate*
     Annotate file {file} from repository {repo} at revision {rev}.