1. ZyX_I
  2. aurum

Commits

ZyX_I  committed 332c01f

Made *Vdiff status mappings use aurum.diffsplit(), fixed aurum.diffsplit() (it was using 'cursorbind' option which does not exist in old vim, now nonexistent options are filtered out)

  • Participants
  • Parent commits 151cfce
  • Branches default

Comments (0)

Files changed (3)

File ftplugin/aurumannotate.vim

View file
         if a:action[:2] is# 'rev'
             let rev1=get(cs.parents, 0, '')
         endif
+        if hasannbuf
+            wincmd c
+            execute bufwinnr(bvar.annbuf).'wincmd w'
+            setlocal noscrollbind
+        endif
         if a:action[-7:-5] is# 'vim'
-            if hasannbuf
-                wincmd c
-                execute bufwinnr(bvar.annbuf).'wincmd w'
-                execute 'setlocal noscrollbind'
-            elseif empty(rev1)
-                execute 'edit '.fnameescape('aurum://file:'.epath.':'.
-                            \               bvar.rev.':'.bvar.file)
-            endif
-            if !empty(rev1)
-                execute 'edit '.fnameescape('aurum://file:'.epath.':'.
-                            \               rev1.':'.bvar.file)
-            endif
-            call s:_r.aurum.diffsplit(buf, 'aurum://file:'.epath.':'.rev2.':'.
-                        \                  bvar.file)
+            execute 'edit '.fnameescape('aurum://file:'.epath.':'.
+                        \               (empty(rev1)?(bvar.rev):(rev1)).':'.
+                        \               bvar.file)
+            call s:_r.aurum.diffsplit(bufnr('%'),
+                        \             'aurum://file:'.epath.':'.rev2.':'.
+                        \                             bvar.file)
         else
             if empty(rev1)
                 let rev1=bvar.rev

File ftplugin/aurumstatus.vim

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

File plugin/aurum.vim

View file
 "▶3 comm.diffrestore
 let s:diffsaveopts=['diff', 'foldcolumn', 'foldenable', 'foldmethod',
             \       'foldlevel', 'scrollbind', 'cursorbind', 'wrap']
+call filter(s:diffsaveopts, 'exists("+".v:val)')
 function s:F.comm.diffrestore(buf, onenter)
     if !bufexists(a:buf)
         return