Commits

ZyX_I  committed 2911e60

@%aurum/maputils: Added support for ku
Ref #67

  • Participants
  • Parent commits b9e6704

Comments (0)

Files changed (2)

File autoload/aurum/maputils.vim

 execute frawor#Setup('0.0', {'@/resources': '0.0',
             \                       '@/os': '0.0',})
 let s:_messages={
-            \'plinst': 'If you install Command-T, Ctrlp, FuzzyFinder or tlib '.
-            \          'you will be prompted with much less sucking interface',
+            \'plinst': 'If you install Command-T, Ctrlp, FuzzyFinder, ku '.
+            \          'or tlib you will be prompted with much less sucking '.
+            \          'interface',
         \}
 let s:r={}
 "▶1 update
     autocmd BufUnload <buffer> ruby $command_t = $aurum_old_command_t
 endfunction
 "▶2 ctrlp
-function s:Accept(mode, str)
+function s:CtrlpAccept(mode, str)
     let d={}
     let d.cbfun=b:aurum_callback_fun
     let addargs=b:aurum_addargs
     call ctrlp#exit()
     return call(d.cbfun, [a:str]+addargs, {})
 endfunction
-let s:_functions+=['s:Accept']
+let s:_functions+=['s:CtrlpAccept']
 let s:ctrlp_ext_var={
             \'init': '<SNR>'.s:_sid.'_Eval("s:ctrlp_files")',
-            \'accept': '<SNR>'.s:_sid.'_Accept',
+            \'accept': '<SNR>'.s:_sid.'_CtrlpAccept',
             \'lname': 'changeset files',
             \'sname': 'changeset file',
             \'type': 'path',
     endif
     return call(a:cbargs[0], [file]+a:cbargs[1:], {})
 endfunction
+"▶2 ku
+let s:F.listplugs.ku={}
+function s:KuOpen(candidate)
+    return call(b:aurum_callback_fun, [a:candidate.word]+b:aurum_addargs, {})
+endfunction
+let s:_functions+=['s:KuOpen']
+let s:ku_files=[]
+function s:F.kulist(_)
+    if !exists('b:aurum_files')
+        let b:aurum_files=s:ku_files
+    endif
+    return map(copy(b:aurum_files), '{"word": v:val}')
+endfunction
+function s:F.listplugs.ku.init()
+    try
+        if !exists('*ku#define_source')
+            runtime autoload/ku.vim
+        endif
+        if exists('*ku#define_source')
+            call ku#define_kind({
+                        \                'name': 'csfiles',
+                        \'default_action_table': {'open':
+                        \                   function('<SNR>'.s:_sid.'_KuOpen')},
+                        \   'default_key_table': {},
+                        \})
+            call ku#define_source({
+                        \             'name': 'aurum',
+                        \            'kinds': ['csfiles'],
+                        \'gather_candidates': s:F.kulist,
+                        \})
+            return 1
+        else
+            return 0
+        endif
+    catch
+        return 0
+    endtry
+endfunction
+function s:F.listplugs.ku.call(files, cbargs, pvargs)
+    let [b:aurum_callback_fun; b:aurum_addargs]=a:cbargs
+    let s:ku_files=a:files
+    call ku#start(['aurum'])
+endfunction
 "▶1 promptuser
 function s:r.promptuser(files, cbargs, pvargs)
     if s:plug is 0
 "▶1 Post maputils resource
 call s:_f.postresource('maputils', s:r)
 "▶1
-call frawor#Lockvar(s:, 'plug,ctrlp_id,ctrlp_files')
+call frawor#Lockvar(s:, 'plug,ctrlp_id,ctrlp_files,ku_files')
 " 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, FuzzyFinder or 
-  tlib plugins installed. Otherwise they will show |inputlist()| that is 
+- OpenAny/AnnotateAny mappings require one of Command-T, Ctrlp, FuzzyFinder, 
+  ku or tlib plugins installed. Otherwise they will show |inputlist()| that is 
   unusable with large number of files.
   Note: currently if you install two or all of them the behavior is undefined 
         (depends on how keys “commandt”, “ctrlp” and “fuf” are arranged inside