frawor / tools / depstodot.vim

execute frawor#Setup('0.0', {})
let s:deps={}
let s:rtppls={}
let s:plrtps={}
let s:dtd={'ignoredeps': 1}
function s:dtd.register(plugdict, fdict)
    let s:deps[]=a:plugdict.dependencies
    let rtp=a:plugdict.runtimepath
    if empty(rtp)
        let rtp='NA'
    if has_key(s:rtppls, rtp)
        let s:rtppls[rtp]+=[]
        let s:rtppls[rtp]=[]
    if is# 'plugin/frawor'
        let s:deplen=a:plugdict.g.deplen
        let s:dependents=a:plugdict.g.dependents
call s:_f.newfeature('depstodot', s:dtd)
let g:dtd={}
let s:colors=[
function g:dtd.write(file)
    let ranks=map(repeat([[]], max(values(s:deplen))+1), 'copy(v:val)')
    call map(copy(s:deplen), 'add(ranks[v:val], v:key)')
    let lines=['digraph G {']
    let lines+=['    concentrate = true;']
    let lines+=['    {']
    let lines+=['        node [shape=plaintext]']
    let lines+=['        '.join(range(1, len(ranks)-1), ' -> ').';']
    let lines+=['    }']
    let lines+=['    node [shape=box];']
    let i=0
    for nodes in ranks[1:]
        let i+=1
        let lines+=['    { node [fontcolor='.s:colors[i].']; rank = same; '.i.'; "'.join(nodes, '"; "').'"; }']
    for [rtp, nodes] in sort(items(s:rtppls))
        let lines+=['    subgraph "'.rtp.'" {']
        let lines+=['        label = "'.fnamemodify(rtp, ':t').'";']
        let lines+=['        "'.join(nodes, '"; "').'";']
        let lines+=['    }']
    for [plid, dependencies] in sort(items(s:deps))
        for dplid in sort(keys(dependencies))
            let lines+=['    edge [color='.s:colors[s:deplen[plid]].'];']
            let lines+=['    "'.plid.'" -> "'.dplid.'";']
    let lines+=['}', '']
    call writefile(lines, a:file, 'b')
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
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.