Some checks failed
Detach Plugins / check (FlyGrep.vim) (push) Has been cancelled
Detach Plugins / check (GitHub.vim) (push) Has been cancelled
Detach Plugins / check (JavaUnit.vim) (push) Has been cancelled
Detach Plugins / check (SourceCounter.vim) (push) Has been cancelled
Detach Plugins / check (cpicker.nvim) (push) Has been cancelled
Detach Plugins / check (dein-ui.vim) (push) Has been cancelled
Detach Plugins / check (git.vim) (push) Has been cancelled
Detach Plugins / check (iedit.vim) (push) Has been cancelled
Detach Plugins / check (scrollbar.vim) (push) Has been cancelled
Detach Plugins / check (vim-chat) (push) Has been cancelled
Detach Plugins / check (vim-cheat) (push) Has been cancelled
Detach Plugins / check (vim-todo) (push) Has been cancelled
Detach Plugins / check (xmake.vim) (push) Has been cancelled
test / Linux (nvim, nightly) (push) Has been cancelled
test / Linux (nvim, v0.3.8) (push) Has been cancelled
test / Linux (nvim, v0.4.0) (push) Has been cancelled
test / Linux (nvim, v0.4.2) (push) Has been cancelled
test / Linux (nvim, v0.4.3) (push) Has been cancelled
test / Linux (nvim, v0.4.4) (push) Has been cancelled
test / Linux (nvim, v0.5.0) (push) Has been cancelled
test / Linux (nvim, v0.5.1) (push) Has been cancelled
test / Linux (nvim, v0.6.0) (push) Has been cancelled
test / Linux (nvim, v0.6.1) (push) Has been cancelled
test / Linux (nvim, v0.7.0) (push) Has been cancelled
test / Linux (nvim, v0.7.2) (push) Has been cancelled
test / Linux (nvim, v0.8.0) (push) Has been cancelled
test / Linux (nvim, v0.8.1) (push) Has been cancelled
test / Linux (nvim, v0.8.2) (push) Has been cancelled
test / Linux (nvim, v0.8.3) (push) Has been cancelled
test / Linux (nvim, v0.9.0) (push) Has been cancelled
test / Linux (nvim, v0.9.1) (push) Has been cancelled
test / Linux (true, vim, v7.4.052) (push) Has been cancelled
test / Linux (true, vim, v7.4.1689) (push) Has been cancelled
test / Linux (true, vim, v7.4.629) (push) Has been cancelled
test / Linux (true, vim, v8.0.0027) (push) Has been cancelled
test / Linux (true, vim, v8.0.0183) (push) Has been cancelled
test / Linux (vim, nightly) (push) Has been cancelled
test / Linux (vim, v8.0.0184) (push) Has been cancelled
test / Linux (vim, v8.0.1453) (push) Has been cancelled
test / Linux (vim, v8.1.2269) (push) Has been cancelled
test / Linux (vim, v8.2.2434) (push) Has been cancelled
test / Linux (vim, v8.2.3995) (push) Has been cancelled
test / Windows (nvim, nightly) (push) Has been cancelled
test / Windows (nvim, v0.3.8) (push) Has been cancelled
test / Windows (nvim, v0.4.2) (push) Has been cancelled
test / Windows (nvim, v0.4.3) (push) Has been cancelled
test / Windows (nvim, v0.4.4) (push) Has been cancelled
test / Windows (nvim, v0.5.0) (push) Has been cancelled
test / Windows (nvim, v0.5.1) (push) Has been cancelled
test / Windows (nvim, v0.6.0) (push) Has been cancelled
test / Windows (nvim, v0.6.1) (push) Has been cancelled
test / Windows (nvim, v0.7.0) (push) Has been cancelled
test / Windows (nvim, v0.7.2) (push) Has been cancelled
test / Windows (nvim, v0.8.0) (push) Has been cancelled
test / Windows (nvim, v0.8.1) (push) Has been cancelled
test / Windows (nvim, v0.8.2) (push) Has been cancelled
test / Windows (nvim, v0.8.3) (push) Has been cancelled
test / Windows (nvim, v0.9.0) (push) Has been cancelled
test / Windows (nvim, v0.9.1) (push) Has been cancelled
test / Windows (vim, nightly) (push) Has been cancelled
test / Windows (vim, v7.4.1185) (push) Has been cancelled
test / Windows (vim, v7.4.1689) (push) Has been cancelled
test / Windows (vim, v8.0.0027) (push) Has been cancelled
test / Windows (vim, v8.0.1453) (push) Has been cancelled
test / Windows (vim, v8.1.2269) (push) Has been cancelled
test / Windows (vim, v8.2.2434) (push) Has been cancelled
test / Windows (vim, v8.2.3995) (push) Has been cancelled
docker / docker (push) Has been cancelled
mirror / check (coding) (push) Has been cancelled
mirror / check (gitee) (push) Has been cancelled
mirror / check (gitlab) (push) Has been cancelled
121 lines
4.6 KiB
VimL
121 lines
4.6 KiB
VimL
function! gina#action#show#define(binder) abort
|
|
let params = {
|
|
\ 'description': 'Show a commit or a content at a commit',
|
|
\ 'mapping_mode': 'nv',
|
|
\ 'requirements': [],
|
|
\}
|
|
call a:binder.define('show', function('s:on_show'), extend({
|
|
\ 'options': {},
|
|
\}, params))
|
|
call a:binder.define('show:split', function('s:on_show'), extend({
|
|
\ 'hidden': 1,
|
|
\ 'options': {'opener': 'new'},
|
|
\}, params))
|
|
call a:binder.define('show:vsplit', function('s:on_show'), extend({
|
|
\ 'hidden': 1,
|
|
\ 'options': {'opener': 'vnew'},
|
|
\}, params))
|
|
call a:binder.define('show:tab', function('s:on_show'), extend({
|
|
\ 'hidden': 1,
|
|
\ 'options': {'opener': 'tabedit'},
|
|
\}, params))
|
|
call a:binder.define('show:preview', function('s:on_show'), extend({
|
|
\ 'hidden': 1,
|
|
\ 'options': {'opener': 'pedit'},
|
|
\}, params))
|
|
|
|
let params = {
|
|
\ 'description': 'Show a commit',
|
|
\ 'mapping_mode': 'nv',
|
|
\ 'requirements': [],
|
|
\}
|
|
call a:binder.define('show:commit', function('s:on_commit'), extend({
|
|
\ 'options': {},
|
|
\}, params))
|
|
call a:binder.define('show:commit:split', function('s:on_commit'), extend({
|
|
\ 'hidden': 1,
|
|
\ 'options': {'opener': 'new'},
|
|
\}, params))
|
|
call a:binder.define('show:commit:vsplit', function('s:on_commit'), extend({
|
|
\ 'hidden': 1,
|
|
\ 'options': {'opener': 'vnew'},
|
|
\}, params))
|
|
call a:binder.define('show:commit:tab', function('s:on_commit'), extend({
|
|
\ 'hidden': 1,
|
|
\ 'options': {'opener': 'tabedit'},
|
|
\}, params))
|
|
call a:binder.define('show:commit:preview', function('s:on_commit'), extend({
|
|
\ 'hidden': 1,
|
|
\ 'options': {'opener': 'pedit'},
|
|
\}, params))
|
|
" Alias
|
|
call a:binder.alias('show:above', 'leftabove show:split')
|
|
call a:binder.alias('show:below', 'belowright show:split')
|
|
call a:binder.alias('show:left', 'leftabove show:vsplit')
|
|
call a:binder.alias('show:right', 'belowright show:vsplit')
|
|
call a:binder.alias('show:top', 'topleft show:split')
|
|
call a:binder.alias('show:bottom', 'botright show:split')
|
|
call a:binder.alias('show:leftest', 'topleft show:vsplit')
|
|
call a:binder.alias('show:rightest', 'botright show:vsplit')
|
|
call a:binder.alias('show:preview:top', 'topleft show:preview')
|
|
call a:binder.alias('show:preview:bottom', 'botright show:preview')
|
|
call a:binder.alias('show:commit:above', 'leftabove show:commit:split')
|
|
call a:binder.alias('show:commit:below', 'belowright show:commit:split')
|
|
call a:binder.alias('show:commit:left', 'leftabove show:commit:vsplit')
|
|
call a:binder.alias('show:commit:right', 'belowright show:commit:vsplit')
|
|
call a:binder.alias('show:commit:top', 'topleft show:commit:split')
|
|
call a:binder.alias('show:commit:bottom', 'botright show:commit:split')
|
|
call a:binder.alias('show:commit:leftest', 'topleft show:commit:vsplit')
|
|
call a:binder.alias('show:commit:rightest', 'botright show:commit:vsplit')
|
|
call a:binder.alias('show:commit:preview:top', 'topleft show:commit:preview')
|
|
call a:binder.alias('show:commit:preview:bottom', 'botright show:commit:preview')
|
|
endfunction
|
|
|
|
|
|
" Private --------------------------------------------------------------------
|
|
function! s:on_show(candidates, options) abort
|
|
if empty(a:candidates)
|
|
return
|
|
endif
|
|
let options = extend({
|
|
\ 'opener': '',
|
|
\}, a:options)
|
|
for candidate in a:candidates
|
|
let treeish = gina#core#treeish#build(
|
|
\ gina#util#get(candidate, 'rev'),
|
|
\ gina#util#get(candidate, 'path', v:null),
|
|
\)
|
|
execute printf(
|
|
\ '%s Gina show %s %s %s %s -- %s',
|
|
\ options.mods,
|
|
\ gina#util#shellescape(options.opener, '--opener='),
|
|
\ gina#util#shellescape(get(candidate, 'line'), '--line='),
|
|
\ gina#util#shellescape(get(candidate, 'col'), '--col='),
|
|
\ gina#util#shellescape(treeish),
|
|
\ gina#util#shellescape(gina#util#get(candidate, 'residual')),
|
|
\)
|
|
endfor
|
|
endfunction
|
|
|
|
function! s:on_commit(candidates, options) abort
|
|
if empty(a:candidates)
|
|
return
|
|
endif
|
|
let options = extend({
|
|
\ 'opener': '',
|
|
\}, a:options)
|
|
for candidate in a:candidates
|
|
let treeish = gina#core#treeish#build(
|
|
\ gina#util#get(candidate, 'rev'),
|
|
\ v:null
|
|
\)
|
|
execute printf(
|
|
\ '%s Gina show %s %s -- %s',
|
|
\ options.mods,
|
|
\ gina#util#shellescape(options.opener, '--opener='),
|
|
\ gina#util#shellescape(treeish),
|
|
\ gina#util#shellescape(gina#util#get(candidate, 'residual')),
|
|
\)
|
|
endfor
|
|
endfunction
|