Commits

ZyX_I committed 72d1278

Add CurRevHex and CurRev global mappings

Comments (0)

Files changed (3)

autoload/aurum.vim

     return s:_r.cache.get('cs', repo.functions.getwork, [repo], {})
 endfunction
 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
+endfunction
+let s:_functions+=['aurum#currev']
 "▶1 filestatus
 function s:F.filestatus(status)
     return get(keys(filter(copy(a:status), '!empty(v:val)')), 0, '')
           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*
 
             \'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',
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.