Commits

ZyX_I committed 182c0ba

Ported plugin to frawor

Comments (0)

Files changed (2)

aurum-addon-info.txt

         "url": "https://bitbucket.org/ZyX_I/aurum",
     },
     "dependencies": {
-        "vimpluginloader": {
+        "frawor": {
             "type": "hg",
-            "url": "http://vimpluginloader.hg.sourceforge.net:8000/hgroot/vimpluginloader/vimpluginloader",
+            "url": "https://bitbucket.org/ZyX_I/frawor",
         },
     },
     "files": [
-"▶1 Начало
+"▶1 Первая загрузка
 scriptencoding utf-8
-if (exists("s:g._pluginloaded") && s:g._pluginloaded) ||
-            \exists("g:aurumOptions.DoNotLoad")
-    finish
-"▶1 Первая загрузка
-elseif !exists("s:g._pluginloaded")
+if !exists('s:_pluginloaded')
     "▶2 Объявление переменных
-    execute load#Setup('0.0', "au", "Au", "Au")
+    execute frawor#Setup('0.0', {'@/commands': '0.0',
+                \               '@/functions': '0.0',
+                \                      '@/os': '0.0',
+                \                  '@/python': '0.0',}, 0)
     call map(['hg', 'comm', 'graph', 'glog'], 'extend(s:F, {v:val : {}})')
     lockvar 1 s:F
-    "▶2 Функции
-    let s:g._load.functions=[
-                \['getrepo', 'hg.repo', {}],
-            \]
-    " "▶2 Словарные функции
-    " let s:g._load.dictfunctions=[
-    "             \[%-VISIBLE_NAME-%, %-INNER_FUNCTION-%, %-CHECK_MODEL-%],
-    "         \]
     "▶2 Команды
-    let s:g._load.commands={
-                \'Glog': {
-                \        "func": 'comm.glog',
-                \       "nargs": '?',
-                \},
-            \}
-    " "▶2 Привязки
-    " let s:g._load.mappings={
-    "             \%-MAP_NAME-%: {
-    "             \   'function': %-INNER_FUNCTION-%,
-    "             \    'default': %-DEFAULT_KEYS-%,
-    "             \       'type': %-MAP_MODE-%,
-    "             \},
-    "         \}
-    "▶2 Регистрация дополнения
-    let s:g._load.requires=[["load", '0.0'],
-                \           ["stuf", '0.5']]
-    let s:g._load.preload=[["os", "autoload"]]
-    let s:g._load.reginfo=s:F.plug.load.registerplugin(s:g._load)
-    call extend(s:F.main, s:g._load.reginfo.functions)
+    call FraworLoad('@/commands')
+    call FraworLoad('@/functions')
+    let s:glogfunc={}
+    call s:_f.command.add('AuGlog', s:glogfunc, {'nargs': '?'})
+    "▲2
+    finish
+elseif s:_pluginloaded
     finish
 endif
 "▶1 Вторая загрузка
-let s:g._pluginloaded=1
-unlet s:g._load
-let s:g.repos={}
-"▶2 Настройки
-let s:g.defaultOptions={
-            \"PythonVersion":    2,
-        \}
-let s:g.c={}
-let s:g.c.options={
-            \"PythonVersion":    ["in", [2, 3]],
-        \}
-"▶2 Выводимые сообщения
-let s:g.p={
-            \"emsg": {
-            \   'nopython': 'Unable to load python interface',
-            \    'nopycmd': 'Python command does not exist for some reason',
-            \},
-            \"etype": {
-            \     'notimp': 'NotImplemented',
-            \        'int': 'InternalError',
-            \}
-        \}
+let s:repos={}
 "▶1 Вторая загрузка — функции
-" "▶2 Внешние дополнения
-" let s:F.plug.%-PLUGNAME-%=s:F.plug.load.getfunctions("%-PLUGNAME-%")
-"▶2 main: eerror, destruct, option
-function s:F.main.destruct()
-    unlet s:g s:F
-    return 1
-endfunction
 "▶2 hg
-"▶3 hg.pycmd
-let s:g.py={}
-let s:g.py.version=s:F.main.option("PythonVersion")
-let s:g.py.features=['python', 'python3']
-call insert(s:g.py.features, remove(s:g.py.features, s:g.py.version-2))
-for s:g.py.feature in s:g.py.features
-    if has(s:g.py.feature) || has(s:g.py.feature.'/dyn')
-        let s:g.py.cmd=s:g.py.feature[:1].s:g.py.feature[6:]
-        try
-            if !exists(':'.s:g.py.cmd)
-                call s:F.main.eerror('', 'int', 1, ['nopycmd'])
-            endif
-            execute s:g.py.cmd 'import vim'
-            lockvar! s:g.py.cmd
-            break
-        catch
-            unlet s:g.py.cmd
-        endtry
-    endif
-endfor
-unlet s:g.py.features
-if !has_key(s:g.py, 'cmd')
-    call s:F.main.eerror('', 'notimp', 1, ['nopython'])
-endif
-
-let s:g.py.importdir=os#JoinPath(expand('<sfile>:p:h:h'), 'python')
-execute s:g.py.cmd "import sys, vim"
-execute s:g.py.cmd "sys.path.append(vim.eval('s:g.py.importdir'))"
-execute s:g.py.cmd "import aurum"
+execute s:_r.py.cmd 'import aurum'
 "▶3 hg.repo
 function s:F.hg.repo(path)
-    if has_key(s:g.repos, a:path)
-        return s:g.repos[a:path]
+    if has_key(s:repos, a:path)
+        return s:repos[a:path]
     endif
     let repo={}
-    let s:g.repos[a:path]=repo
-    execute s:g.py.cmd "aurum.new_repo(vim.eval('a:path'))"
+    let s:repos[a:path]=repo
+    execute s:_r.py.cmd 'aurum.new_repo(vim.eval("a:path"))'
     for cs in values(repo.changesets)
         let cs.parents=map(copy(cs.parents_hex), 'repo.changesets[v:val]')
         let cs.children=map(copy(cs.children_hex), 'repo.changesets[v:val]')
     endif
     call insert(a:graph.grid, repeat([0], clen), line)
     if line==0
-        call insert(a:graph.connections, repeat(["0000"], clen))
+        call insert(a:graph.connections, repeat(['0000'], clen))
     elseif line==clen
-        call insert(a:graph.connections, repeat(["0000"], clen), clen-1)
+        call insert(a:graph.connections, repeat(['0000'], clen), clen-1)
     else
-        call insert(a:graph.connections, repeat(["0000"], clen), line)
+        call insert(a:graph.connections, repeat(['0000'], clen), line)
         let [prevcon, inscon]=a:graph.connections[(line-1):(line)]
         let insline=a:graph.lines[line]
         let llen=len(a:graph.grid[0])
         let i=0
         while i<llen
-            let element=repeat(prevcon[i][0], 2)."00"
+            let element=repeat(prevcon[i][0], 2).'00'
             let inscon[i]=element
             let insline[i]=element
             let i+=1
     if a:fix_tail && a:n_columns_diff==a:p_diff && a:n_columns_diff!=0
         if a:n_columns_diff==-1
             let start=max([a:node_index+1, a:p_node_index])
-            let tail=repeat(["|", " "], (start-a:node_index-1))+
-                        \repeat(["/", " "], (a:n_columns-start))
+            let tail=repeat(['|', ' '], (start-a:node_index-1))+
+                        \repeat(['/', ' '], (a:n_columns-start))
             return tail
         else
             return repeat(['\', ' '], (a:n_columns-a:node_index-1))
         endif
     else
-        return repeat(["|", " "], (a:n_columns-a:node_index-1))
+        return repeat(['|', ' '], (a:n_columns-a:node_index-1))
     endif
 endfunction
 "▶3 glog.draw_edges
                 let [start, end]=[end, start]
             endif
             for i in range(2*start + 1, 2*end)
-                if a:nodeline[i]!=#'+'
+                if a:nodeline[i] isnot# '+'
                     let a:nodeline[i]='-'
                 endif
             endfor
 endfunction
 "▶3 glog.get_padding_line
 function s:F.glog.get_padding_line(ni, n_columns, edges)
-    let c=" "
+    let c=' '
     if index(a:edges, [a:ni, a:ni-1])!=-1 || index(a:edges, [a:ni, a:ni])!=-1
-        let c="|"
+        let c='|'
     endif
-    let line=repeat(["|", " "], a:ni)+
-                \[c, " "]+
-                \repeat(["|", " "], (a:n_columns-a:ni-1))
+    let line=repeat(['|', ' '], a:ni)+
+                \[c, ' ']+
+                \repeat(['|', " "], (a:n_columns-a:ni-1))
     return line
 endfunction
 "▶3 glog.utf
         endif
     endif
     let fix_nodeline_tail = (lnum<=2 && empty(add_padding_line))
-    let shift_interline=repeat(["|", " "], idx)
+    let shift_interline=repeat(['|', ' '], idx)
     let nodeline=copy(shift_interline)+
-                \[a:char, " "]+
+                \[a:char, ' ']+
                 \s:F.glog.get_nodeline_edges_tail(idx,     a:state[1], ncols,
                 \                                 coldiff, a:state[0],
                 \                                 fix_nodeline_tail)
         let n_spaces=3
         let edge_ch='\'
     endif
-    let shift_interline+=repeat([" "], n_spaces)+
-                \        repeat([edge_ch, " "], (ncols-idx-1))
+    let shift_interline+=repeat([' '], n_spaces)+
+                \        repeat([edge_ch, ' '], (ncols-idx-1))
     call s:F.glog.draw_edges(edges, nodeline, shift_interline)
     let lines=[nodeline]
     if !empty(add_padding_line)
     call add(lines, shift_interline)
     let ltdiff=lnum-len(lines)
     if ltdiff>0
-        let extra_interline=repeat(["|", " "], ncols+coldiff)
+        let extra_interline=repeat(['|', ' '], ncols+coldiff)
         call extend(lines, repeat([extra_interline], ltdiff))
     else
-        call extend(a:text.text, repeat([""], -ltdiff))
+        call extend(a:text.text, repeat([''], -ltdiff))
     endif
     let indentation_level=2*max([ncols, ncols+coldiff])
     let a:state[0]=coldiff
 "▶3 comm.addlines
 function s:F.comm.addlines(text, lnum)
     let mapexpr='[v:val[0]+'.a:lnum.']+v:val[1:]'
-    call map(a:text.specials, 'v:key[-1:]==#"s"?'.
+    call map(a:text.specials, 'v:key[-1:] is# "s"?'.
                 \                   'map(v:val, '.string(mapexpr).'):'.
                 \                   mapexpr)
     return a:text
 "▶3 comm.addcols
 function s:F.comm.addcols(text, cnum)
     let mapexpr='[v:val[0], v:val[1]+'.a:cnum.']+v:val[2:]'
-    call map(a:text.specials, 'v:key[-1:]==#"s"?'.
+    call map(a:text.specials, 'v:key[-1:] is# "s"?'.
                 \                   'map(v:val, '.string(mapexpr).'):'.
                 \                   mapexpr)
     return a:text
 endfunction
 "▶3 comm.hasrepo
 function s:F.comm.hasrepo(path)
-    return isdirectory(os#JoinPath(a:path, '.hg'))
+    return s:_r.os.path.isdir(s:_r.os.path.join(a:path, '.hg'))
 endfunction
 "▶3 comm.repopath
 function s:F.comm.repopath(...)
     endif
     let r=fnamemodify(r, ':p')
     let olddir=''
-    while r!=#olddir && !s:F.comm.hasrepo(r)
+    while r isnot# olddir && !s:F.comm.hasrepo(r)
         let olddir=r
         let r=fnamemodify(r, ':h')
     endwhile
 function s:F.comm.getrepo(path)
     return s:F.hg.repo(a:path)
 endfunction
-"▶3 comm.glog
-function s:F.comm.glog(...)
+"▶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)
     call setline(1, text.text)
 endfunction
 "▶2
-lockvar! s:F s:g
-unlockvar s:g.repos
+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.