Commits

ZyX_I committed 395dcbe

Using aurum:// pseudo-protocol for special buffers (now only for graphlog)

Comments (0)

Files changed (1)

     execute frawor#Setup('0.0', {'@/commands': '0.0',
                 \               '@/functions': '0.0',
                 \                      '@/os': '0.0',
-                \                  '@/python': '0.0',}, 0)
+                \                  '@/python': '0.0',
+                \            '@/autocommands': '0.0',}, 0)
     call map(['hg', 'comm', 'graph', 'glog'], 'extend(s:F, {v:val : {}})')
     lockvar 1 s:F
     "▶2 Команды
     call FraworLoad('@/commands')
     call FraworLoad('@/functions')
+    call FraworLoad('@/autocommands')
     let s:glogfunc={}
     call s:_f.command.add('AuGlog', s:glogfunc, {'nargs': '?'})
+    "▶2 Autocommands
+    let s:auefunc={}
+    let s:auhidefunc={}
+    call s:_f.augroup.add('Aurum', [['BufReadCmd', 'aurum://*',0, s:auefunc],
+                \                   ['BufHidden',  'aurum://*',0, s:auhidefunc],
+                \                  ])
     "▲2
     finish
 elseif s:_pluginloaded
 "▶3 comm.repopath
 function s:F.comm.repopath(...)
     let r='.'
-    if a:0
+    if a:0 && !empty(a:1)
         let r=a:1
         if stridx(r, '://')!=-1
             return r
 endfunction
 "▶3 glogfunc
 function s:glogfunc.function(...)
-    let repopath=call(s:F.comm.repopath, a:000, {})
-    let repo=s:F.comm.getrepo(repopath)
-    let text=s:F.glog.graphlog(repo)
-    new
-    setlocal filetype=aurum buftype=nofile
-    call setline(1, text.text)
+    execute 'new' .fnameescape('aurum://glog:'.get(a:000, 0, ''))
 endfunction
-"▶2
+"▶3 auefunc
+function s:auefunc.function()
+    let file=substitute(expand('<amatch>'), '\V\^aurum://', '', '')
+    let command=matchstr(file, '\v^\w+')
+    let file=file[len(command)+1:]
+    if command is# 'glog'
+        let repopath=s:F.comm.repopath(file)
+        let repo=s:F.comm.getrepo(repopath)
+        let text=s:F.glog.graphlog(repo)
+        setlocal filetype=aurumgraphlog buftype=nofile nolist
+        call setline(1, text.text)
+    endif
+endfunction
+"▶3 auhidefunc
+function s:auhidefunc.function()
+    let buffer=+expand('<abuf>')
+    let file=substitute(expand('<amatch>'), '\V\^aurum://', '', '')
+    let command=matchstr(file, '\v^\w+')
+    if command is# 'glog'
+        " execute 'bwipeout '.buffer
+    endif
+endfunction
+"▶1
 call frawor#Lockvar(s:, 'repos,_pluginloaded')
 " vim: ft=vim ts=4 sts=4 et fmr=▶,▲
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.