This commit is contained in:
cupcakearmy 2022-05-28 13:35:55 +02:00
parent 3dd377942d
commit bf702dbfe5
No known key found for this signature in database
GPG Key ID: 3235314B4D31232F

View File

@ -352,7 +352,7 @@ function! plug#end()
endif endif
let lod = { 'ft': {}, 'map': {}, 'cmd': {} } let lod = { 'ft': {}, 'map': {}, 'cmd': {} }
if exists('g:did_load_filetypes') if get(g:, 'did_load_filetypes', 0)
filetype off filetype off
endif endif
for name in g:plugs_order for name in g:plugs_order
@ -2621,26 +2621,34 @@ function! s:preview_commit()
let sha = matchstr(getline('.'), '^ \X*\zs[0-9a-f]\{7,9}') let sha = matchstr(getline('.'), '^ \X*\zs[0-9a-f]\{7,9}')
if empty(sha) if empty(sha)
let name = matchstr(getline('.'), '^- \zs[^:]*\ze:$')
if empty(name)
return return
endif endif
let title = 'HEAD@{1}..'
let command = 'git diff --no-color HEAD@{1}'
else
let title = sha
let command = 'git show --no-color --pretty=medium '.sha
let name = s:find_name(line('.')) let name = s:find_name(line('.'))
endif
if empty(name) || !has_key(g:plugs, name) || !isdirectory(g:plugs[name].dir) if empty(name) || !has_key(g:plugs, name) || !isdirectory(g:plugs[name].dir)
return return
endif endif
if exists('g:plug_pwindow') && !s:is_preview_window_open() if exists('g:plug_pwindow') && !s:is_preview_window_open()
execute g:plug_pwindow execute g:plug_pwindow
execute 'e' sha execute 'e' title
else else
execute 'pedit' sha execute 'pedit' title
wincmd P wincmd P
endif endif
setlocal previewwindow filetype=git buftype=nofile nobuflisted modifiable setlocal previewwindow filetype=git buftype=nofile bufhidden=wipe nobuflisted modifiable
let batchfile = '' let batchfile = ''
try try
let [sh, shellcmdflag, shrd] = s:chsh(1) let [sh, shellcmdflag, shrd] = s:chsh(1)
let cmd = 'cd '.plug#shellescape(g:plugs[name].dir).' && git show --no-color --pretty=medium '.sha let cmd = 'cd '.plug#shellescape(g:plugs[name].dir).' && '.command
if s:is_win if s:is_win
let [batchfile, cmd] = s:batchfile(cmd) let [batchfile, cmd] = s:batchfile(cmd)
endif endif