ZyX_I  committed 72d1278

Add CurRevHex and CurRev global mappings

  • Participants
  • Parent commits c7883ca

Comments (0)

Files changed (3)

File autoload/aurum.vim

     return s:_r.cache.get('cs', repo.functions.getwork, [repo], {})
 let s:_functions+=['aurum#changeset']
+"▶1 aurum#currev
+function aurum#currev(ret)
+    let [repo, rev] = s:_r.cmdutils.getrrf({}, 'norev', 'getrr')[1:2]
+    if rev is 0
+        let rev=repo.functions.getworkhex(repo)
+    endif
+    if a:ret is# 'hex'
+        return repo.functions.getrevhex(repo, rev)
+    elseif a:ret is# 'rev'
+        return repo.functions.getcs(repo, rev).rev
+    elseif a:ret is# 'cs'
+        return repo.functions.getcs(repo, rev)
+    endif
+let s:_functions+=['aurum#currev']
 "▶1 filestatus
 function s:F.filestatus(status)
     return get(keys(filter(copy(a:status), '!empty(v:val)')), 0, '')

File doc/aurum.txt

           was called which hold files in one repository are no longer visible. 
           Only one process is launched for one repository.
+aurum#currev :: {ret} -> hex | rev | cs                       *aurum#currev()*
+    Depending on {ret} argument returns something that belongs to current 
+    revision (|aurum-current-revision|):
+    {ret}  Returns ~
+    hex    Current revision unique identifier. |aurum-cs.hex|
+    rev    Current revision shortened identifier. |aurum-cs.rev|
+    cs     Current revision changeset dictionary. |aurum-changeset|
 2.3. aurum:// pseudo-protocol                                       *aurum://*
                             Pull new commits from remote repository and 
                             perform an update.
+The following mappings use aurum#* functions and are prefixless by default. 
+They are defined for command and insert modes.
+                         *g:frawormap_AurumNP_CurRev* *aurum-m-AurumNP_CurRev*
+Mapname    LHS         Description ~
+CurRevHex  <C-r><C-h>  Insert current revision hex string.
+CurRev     <C-r><C-v>  Insert current revision number.
 2.5. Local mappings index                               *aurum-mappings-index*

File plugin/aurum.vim

             \'Push':      {'lhs':  'P', 'rhs': ':<C-u>AuOther push<CR>'      },
             \'Pull':      {'lhs':  'p', 'rhs': ':<C-u>AuOther pull<CR>'      },
         \}, {'mode': 'n', 'silent': 1, 'leader': '<Leader>a'})
+call s:_f.mapgroup.add('AurumNP', {
+            \'CurRevHex': {'lhs': '<C-r><C-h>', 'rhs': '<C-r>=aurum#currev("hex")<CR>'},
+            \'CurRev'   : {'lhs': '<C-r><C-v>', 'rhs': '<C-r>=aurum#currev("rev")<CR>'},
+        \}, {'mode': 'ic', 'silent': 1})
 "▶1 Autocommands
 let s:aurun={'function': ['@%aurum/edit', [1], 'event']}
 call s:_f.augroup.add('Aurum',