1. ZyX_I
  2. aurum

Commits

ZyX_I  committed f5f55a2

Added `cmd' option to :AuFile
Moved :AuFile repo argument to {prefixes} section
Made :AuFile accept file argument only if it contains something other then lowercase letters or is an existing file

  • Participants
  • Parent commits a8b8870
  • Branches default

Comments (0)

Files changed (3)

File plugin/aurum.vim

View file
     call FraworLoad('@/functions')
     " TODO revision completion
     " TODO U (update), K and J mappings for aurum://file and aurum://diff
-    " TODO Add :AuEdit, :AuVsplit, :AuSplit, ... (or just cmd option?) (?)
     let s:glogfunc={}
     let s:glogcomp=[]
     call s:_f.command.add('AuGlog', s:glogfunc, {'nargs': '*',
         \}
 " XXX There is a code relying on the fact that here exists string `"."' that
 "     is a default argument to getrepo
-let s:patharg='either (path d, match @\v^\w+%(\+\w+)*\V://@)'
+let s:patharg='either (path d, match @\v^\w+%(\+\w+)*\V://\v|^\:$@)'
 let s:repoarg=':*F.comm.getrepo(".") ('.s:patharg.
             \                        '|*F.comm.getrepo '.
             \                        '#norepo '.
             \'\V+ type ""', '+ (path)', ''),
             \'\Vcmd\s\+type ""',    'cmd first (in cmds, idof command)', ''))
 "▶2 filefunc
-function s:filefunc.function(rev, file, repopath)
-    let opts={'rev': a:rev, 'repo': a:repopath}
+function s:filefunc.function(rev, file, opts)
+    let opts=extend(copy(a:opts), {'rev': a:rev})
     if a:file isnot 0
         let opts.file=a:file
     endif
     endif
     let rev=repo.functions.getrevhex(repo, a:rev)
     let epath=escape(repo.path, ':\')
-    execute 'silent edit' fnameescape('aurum://file:'.epath.':'.rev.':'.file)
+    execute get(a:opts, 'cmd', 'silent edit')
+                \ fnameescape('aurum://file:'.epath.':'.rev.':'.file)
 endfunction
 let s:filefunc['@FWC']=['-onlystrings '.
             \           '[:=(".") type "" '.
-            \           '[:=(0)   type "" '.
-            \           '['.s:nogetrepocarg.']]]', 'filter']
+            \           '[:=(0)   either (match /\L/, path fr)]]'.
+            \           '{ repo '.s:nogetrepocarg.
+            \           ' ?cmd    type ""}', 'filter']
 call add(s:filecomp,
-            \substitute(s:filefunc['@FWC'][0],
-            \'\V:=(0)\v\s+type\s*\V""', 'path', ''))
+            \substitute(substitute(s:filefunc['@FWC'][0],
+            \'\V:=(0)\v\s+type\s*\V""', 'path', ''),
+            \'\Vcmd\s\+type ""',    'cmd first (in cmds, idof command)', ''))
 "▶2 aubwfunc
 function s:aubwfunc.function()
     let buf=+expand('<abuf>')

File test/file.in

View file
 :call WriteFile(bufname('%'))
 :AuFile 5 testrepo/dlines.lst
 :call WriteFile(bufname('%'))
-:AuFile 5 testrepo/dlines.lst testrepo
-:call WriteFile(bufname('%'))
+:AuFile 5 testrepo/dlines.lst repo testrepo
+:call WriteFile(bufname('%'), 'w$: '.winnr('$'))
+:AuFile 6 cmd silent\ vsplit
+:call WriteFile(bufname('%'), 'w$: '.winnr('$'))
 :source addmessages.vim

File test/file.ok

View file
 aurum://file:%TMPDIR%/test/filerepo:edd6110273b433a7e0cbdc512ea8f0eb8978a592:chgrepo.zsh
 aurum://file:%TMPDIR%/test/testrepo:c5d978071bc74635267df368a498d81f4ca03e27:dlines.lst
 aurum://file:%TMPDIR%/test/testrepo:c5d978071bc74635267df368a498d81f4ca03e27:dlines.lst
+w$: 1
+aurum://file:%TMPDIR%/test/testrepo:ad9ef3ae5da7f0af0f413dc9b0bbbccc73195c73:dlines.lst
+w$: 2