Commits

ZyX_I committed 5ee11ad

autoload/Powerline: Added aurum:status segment (requires changes to colorscheme to work)
autoload/aurum: Cached reltorepo call
Made aurum#status() use empty string in place of zero
@aurum/drivers/git: Make rf-status() work in statusline

  • Participants
  • Parent commits 2abb46f

Comments (0)

Files changed (8)

 
   - Partially committing changes ([:AuRecord](http://vimpluginloader.sourceforge.net/doc/aurum.txt.html#line388-0)).
 
-  - Viewing file state at particular revision ([aurum://file](http://vimpluginloader.sourceforge.net/doc/aurum.txt.html#line631-0), [:AuFile](http://vimpluginloader.sourceforge.net/doc/aurum.txt.html#line161-0)).
+  - Viewing file state at particular revision ([aurum://file](http://vimpluginloader.sourceforge.net/doc/aurum.txt.html#line639-0), [:AuFile](http://vimpluginloader.sourceforge.net/doc/aurum.txt.html#line161-0)).
 
   - Viewing uncommited changes in a vimdiff, as well as changes between 
     specific revisions ([:AuVimDiff](http://vimpluginloader.sourceforge.net/doc/aurum.txt.html#line431-0)). It is also possible to open multiple 
   - Viewing working directory status ([:AuStatus](http://vimpluginloader.sourceforge.net/doc/aurum.txt.html#line392-0)).
 
   - Commiting changes ([:AuCommit](http://vimpluginloader.sourceforge.net/doc/aurum.txt.html#line102-0)), commit messages are remembered in case of 
-    rollback ([g:aurum_remembermsg](http://vimpluginloader.sourceforge.net/doc/aurum.txt.html#line989-0)).
+    rollback ([g:aurum_remembermsg](http://vimpluginloader.sourceforge.net/doc/aurum.txt.html#line998-0)).
 
   - Obtaining various URL’s out of remote repository URL (like URL of the HTML 
     version of the current file with URL fragment pointing to the current line 
 
   - Frontends for various other VCS commands.
 
-Most commands can be reached with a set of mappings (see [aurum-mappings](http://vimpluginloader.sourceforge.net/doc/aurum.txt.html#line786-0)), 
+Most commands can be reached with a set of mappings (see [aurum-mappings](http://vimpluginloader.sourceforge.net/doc/aurum.txt.html#line794-0)), 
 all mappings are customizable.
 
 

autoload/Powerline/Functions/aurum.vim

     let r=aurum#branch()
     return empty(r) ? '' : a:symbol.' '.r
 endfunction
+function Powerline#Functions#aurum#GetStatus()
+    let r=aurum#status()
+    return (empty(r) || r is# 'clean') ? '' : toupper(r[0])
+endfunction

autoload/Powerline/Segments/aurum.vim

 let g:Powerline#Segments#aurum#segments = Pl#Segment#Init(['aurum',
             \ 1,
-            \ Pl#Segment#Create('branch', '%{Powerline#Functions#aurum#GetBranch("$BRANCH")}')
+            \ Pl#Segment#Create('branch', '%{Powerline#Functions#aurum#GetBranch("$BRANCH")}'),
+            \ Pl#Segment#Create('status', '%{Powerline#Functions#aurum#GetStatus()}'),
             \])

autoload/aurum.vim

 "▶1 
 execute frawor#Setup('0.1', {'@aurum/repo': '4.0',
             \               '@aurum/cache': '0.0',})
+"▶1 reltorepo
+function s:F.reltorepo(repo)
+    let buf=bufnr('%')
+    if has_key(s:_r.cachebvars, buf)
+        let cbvar=s:_r.cachebvars[buf]
+        if !has_key(cbvar, '__relfname')
+            let cbvar.__relfname=a:repo.functions.reltorepo(a:repo, @%)
+        endif
+    else
+        let cbvar={'__relfname': a:repo.functions.reltorepo(a:repo, @%)}
+        let s:_r.cachebvars[buf]=cbvar
+    endif
+    return cbvar.__relfname
+endfunction
 "▶1 aurum#repository
 function aurum#repository()
     let repo=s:_r.cache.get('repo', s:_r.repo.get, [':'], {})
     if empty(repo)
         return {}
     endif
+    let relname=s:F.reltorepo(repo)
     return get(keys(filter(copy(s:_r.cache.get('status', repo.functions.status,
-                \                              [repo, 0, 0,
-                \                               [repo.functions.reltorepo(repo,
-                \                                                         @%)]],
+                \                              [repo, 0, 0, [relname]],
                 \                              {})),
-                \          '!empty(v:val)')), 0, 0)
+                \          'index(v:val, relname)!=-1')), 0, '')
 endfunction
 let s:_functions+=['aurum#status']
 "▶1 aurum#branch
 
 aurum#status :: ([{repo}]) -> status                          *aurum#status()*
     Returns a current file status (one of the keys of a dictionary returned by 
-    |aurum-rf-status|) or zero. Cached (update time is controlled by 
+    |aurum-rf-status|) or empty string. Cached (update time is controlled by 
     |g:aurum_statuscachetime|).
+    Note: if returned status is an empty string it may indicate that there it 
+          failed to get status as well as that this file was not modified.
 
 aurum#branch :: ([{repo}]) -> branch                          *aurum#branch()*
     Returns a current branch name (uses |aurum-rf-getrepoprop|). Should be 

plugin/aurum/cache.vim

 endfunction
 "▶1 Post cache resource
 call s:_f.postresource('cache', {'get': s:F.getcachedval})
+call s:_f.postresource('cachebvars', s:cachebvars, 1)
 "▶1
 call frawor#Lockvar(s:, '_pluginloaded,cachebvars')
 " vim: ft=vim ts=4 sts=4 et fmr=▶,▲

plugin/aurum/drivers/common/utils.vim

         set eventignore=all
         set lazyredraw
         try
-            tabnew
+            try
+                tabnew
+            catch /^Vim(tabnew):E523:/
+                let r=s:utils.run(a:cmd, 2, a:cdpath)
+                if empty(r[-1])
+                    call remove(r, -1)
+                endif
+                return r
+            endtry
             setlocal buftype=nofile modifiable noreadonly
             if !empty(a:cdpath)
                 execute 'lcd' fnameescape(a:cdpath)
 endfunction
 "▶1 post resource
 call s:_f.postresource('utils', s:utils)
-unlet s:utils
 "▶1
 call frawor#Lockvar(s:, '_pluginloaded')
 " vim: ft=vim ts=4 sts=4 et fmr=▶,▲

plugin/aurum/drivers/git.vim

     else
         let args=((a:0>2 && !empty(a:3))?(['--']+a:3):([]))
         let kwargs={'porcelain': 1, 'z': 1}
-        let s=s:F.nullnl(s:F.git(a:repo,'status',args,kwargs,1,'statusf'))[:-2]
+        let s=s:F.nullnl(s:F.git(a:repo,'status',args,kwargs,2,'statusf'))[:-2]
         let files={}
         while !empty(s)
             let line=remove(s, 0)