1. ZyX_I
  2. aurum

Commits

ZyX_I  committed 3bd7e53

Replaced `d' and `D' status mappings with `c' and `C', added `d', `D', `gc' and `gd' status mappings with the same meaning as annotate mappings with same lhs, added `gc' annotate mapping (full diff against current state)

  • Participants
  • Parent commits 9aeebe8
  • Branches default

Comments (0)

Files changed (5)

File ftplugin/aurumannotate.vim

View file
 " TODO U (update), K and J mappings
 call s:_f.mapgroup.add('AuAnnotate', {
             \    'Enter': {'lhs': '<CR>', 'rhs': s:F.getrhs(   'vimdiff'   )},
-            \    'Fdiff': {'lhs': 'gd',   'rhs': s:F.getrhs('rev'.'diff', 1)},
+            \   'RFdiff': {'lhs': 'gd',   'rhs': s:F.getrhs('rev'.'diff', 1)},
+            \    'Fdiff': {'lhs': 'gc',   'rhs': s:F.getrhs(      'diff', 1)},
             \     'Diff': {'lhs':  'd',   'rhs': s:F.getrhs(      'diff'   )},
             \    'Rdiff': {'lhs':  'c',   'rhs': s:F.getrhs('rev'.'diff'   )},
             \    'Vdiff': {'lhs':  'D',   'rhs': s:F.getrhs(   'vimdiff'   )},

File ftplugin/aurumgraphlog.vim

View file
         " so no need to use getcsprop()
         let file=cs.files[+spname[4:]]
         let cmd='edit '.fnameescape('aurum://file:'.epath.':'.hex.':'.file)
-    "▶3 diff: view diff between changeset and current state
+    "▶3 curdiff: view diff between changeset and current state
     elseif spname is# 'curdiff'
         let cmd='edit '.fnameescape('aurum://diff:'.epath.'::'.hex)
         if has_key(bvar.opts, 'files') && !has_key(bvar.opts.ignorefiles,'diff')

File ftplugin/aurumstatus.vim

View file
 endif
 "▶1 runmap
 let s:noacttypes={
-            \   'open': ['deleted'],
-            \'revopen': ['added', 'ignored'],
-            \   'diff': ['deleted', 'removed', 'added', 'ignored', 'unknown'],
+            \    'open': ['deleted'],
+            \ 'revopen': ['added', 'ignored'],
+            \    'diff': ['added', 'removed', 'deleted', 'unknown', 'ignored'],
+            \'annotate': ['added', 'unknown', 'ignored'],
         \}
-let s:noacttypes.vimdiff=s:noacttypes.diff
+let s:noacttypes.vimdiff    = s:noacttypes.diff
+let s:noacttypes.revdiff    = s:noacttypes.diff
+let s:noacttypes.revvimdiff = s:noacttypes.vimdiff
 function s:F.runmap(action)
     let bvar=s:_r.aurum.bufvars[bufnr('%')]
     if empty(bvar.types)
     endif
     let file=bvar.files[line('.')-1]
     let epath=escape(bvar.repo.path, ':\')
-    if index(s:noacttypes[a:action], bvar.types[line('.')-1])!=-1
+    if has_key(s:noacttypes, a:action) &&
+                \index(s:noacttypes[a:action], bvar.types[line('.')-1])!=-1
         return ''
     endif
     if a:action is# 'open'
         let r='edit '.fnameescape(s:_r.os.path.join(bvar.repo.path,file))
     elseif a:action is# 'revopen'
         let r='edit '.fnameescape('aurum://file:'.epath.':'.rev1.':'.file)
+    elseif a:action is# 'revfulldiff'
+        let r='edit '.fnameescape('aurum://diff:'.epath.':'.rev1.':'.rev2)
+    elseif a:action is# 'fulldiff'
+        let r='edit '.fnameescape('aurum://diff:'.epath.':'.rev1)
     elseif a:action is# 'diff'
+        let r='edit '.fnameescape('aurum://diff:'.epath.':'.rev1.'::'.
+                    \             escape(file, '\;:'))
+    elseif a:action is# 'revdiff'
         let r='edit '.fnameescape('aurum://diff:'.epath.':'.rev1.':'.rev2.':'.
                     \             escape(file, '\;:'))
-    elseif a:action is# 'vimdiff'
-        if empty(rev2)
+    elseif a:action is# 'revvimdiff' || a:action is# 'vimdiff'
+        let file1=fnameescape('aurum://file:'.epath.':'.rev1.':'.file)
+        if empty(rev2) || a:action is# 'vimdiff'
             let file2=fnameescape(s:_r.os.path.join(bvar.repo.path, file))
         else
             let file2=fnameescape('aurum://file:'.epath.':'.rev2.':'.file)
         endif
+        let r='edit '.file2."\n:silent diffsplit ".file1
+    elseif a:action is# 'annotate'
         let r='edit '.fnameescape('aurum://file:'.epath.':'.rev1.':'.file).
-                    \"\n:silent diffsplit ".file2
+                    \"\n:AuAnnotate"
     endif
     return ":wincmd c\n:silent ".r."\n"
 endfunction
 "▶1 AuStatus mapping group
+" TODO Add K/J mappings
 call s:_f.mapgroup.add('AuStatus', {
-            \  'Open': {'lhs': '<CR>', 'rhs': [   'open']},
-            \ 'ROpen': {'lhs': 'o',    'rhs': ['revopen']},
-            \  'Diff': {'lhs': 'd',    'rhs': [   'diff']},
-            \ 'Vdiff': {'lhs': 'D',    'rhs': ['vimdiff']},
+            \    'Open': {'lhs': '<CR>', 'rhs': [       'open']},
+            \   'ROpen': {'lhs':  'o',   'rhs': [    'revopen']},
+            \  'RFdiff': {'lhs': 'gd',   'rhs': ['revfulldiff']},
+            \   'Fdiff': {'lhs': 'gc',   'rhs': [   'fulldiff']},
+            \    'Diff': {'lhs':  'd',   'rhs': [       'diff']},
+            \   'Rdiff': {'lhs':  'c',   'rhs': [    'revdiff']},
+            \   'Vdiff': {'lhs':  'D',   'rhs': [    'vimdiff']},
+            \  'RVdiff': {'lhs':  'C',   'rhs': [ 'revvimdiff']},
+            \'Annotate': {'lhs':  'a',   'rhs': [   'annotate']},
             \}, {'func': s:F.runmap, 'silent': 1, 'mode': 'n'})
 "▶1
 call frawor#Lockvar(s:, '_r')

File test/statmaps.in

View file
 :call mkdir(g:curtest.'repo')
 :execute '!tar c -C testrepo . | (cd '.g:curtest.'repo && tar x)'
-:W <CR>
+:W{{{1 <CR>
 :silent cd `=g:curtest.'repo'`
 :AuStatus
 /^M
 
 :call WriteFile(bufname('%'))
 :bwipeout!
-:W o
+:W{{{1 o
 :AuStatus
 /^M
 o:call WriteFile(bufname('%'))
 :bwipeout!
-:W d
+:W{{{1 gc
+:AuStatus
+/^M
+gc:call WriteFile(bufname('%'))
+:bwipeout!
+:W{{{1 c
+:AuStatus
+/^M
+c:call WriteFile(bufname('%'))
+:bwipeout!
+:W{{{1 C
+:AuStatus
+/^M
+C:call WriteFile(bufname('%'), bufname(winbufnr(winnr('#'))), 'w$: '.winnr('$').', d:'.&diff)
+:bwipeout!
+:bwipeout!
+:W{{{1 gd
+:AuStatus
+/^M
+gd:call WriteFile(bufname('%'))
+:bwipeout!
+:W{{{1 d
 :AuStatus
 /^M
 d:call WriteFile(bufname('%'))
 :bwipeout!
-:W D
+:W{{{1 D
 :AuStatus
 /^M
-D:call WriteFile(bufname('%'), 'w$: '.winnr('$').', d:'.&diff)
+D:call WriteFile(bufname('%'), bufname(winbufnr(winnr('#'))), 'w$: '.winnr('$').', d:'.&diff)
+:bwipeout!
+:bwipeout!
 :silent cd ..
 :source addmessages.vim

File test/statmaps.ok

View file
-<CR>
+{{{1 <CR>
 %TMPDIR%/test/statmapsrepo/nohglinesrev.lst
-o
+{{{1 o
 aurum://file:%TMPDIR%/test/statmapsrepo:.:nohglinesrev.lst
-d
+{{{1 gc
+aurum://diff:%TMPDIR%/test/statmapsrepo:.
+{{{1 c
 aurum://diff:%TMPDIR%/test/statmapsrepo:.::nohglinesrev.lst
-D
+{{{1 C
+aurum://file:%TMPDIR%/test/statmapsrepo:.:nohglinesrev.lst
 %TMPDIR%/test/statmapsrepo/nohglinesrev.lst
 w$: 2, d:1
+{{{1 gd
+aurum://diff:%TMPDIR%/test/statmapsrepo:.:
+{{{1 d
+aurum://diff:%TMPDIR%/test/statmapsrepo:.::nohglinesrev.lst
+{{{1 D
+aurum://file:%TMPDIR%/test/statmapsrepo:.:nohglinesrev.lst
+%TMPDIR%/test/statmapsrepo/nohglinesrev.lst
+w$: 2, d:1