350 augroup END |
350 augroup END |
351 augroup! PlugLOD |
351 augroup! PlugLOD |
352 endif |
352 endif |
353 let lod = { 'ft': {}, 'map': {}, 'cmd': {} } |
353 let lod = { 'ft': {}, 'map': {}, 'cmd': {} } |
354 |
354 |
355 if exists('g:did_load_filetypes') |
355 if get(g:, 'did_load_filetypes', 0) |
356 filetype off |
356 filetype off |
357 endif |
357 endif |
358 for name in g:plugs_order |
358 for name in g:plugs_order |
359 if !has_key(g:plugs, name) |
359 if !has_key(g:plugs, name) |
360 continue |
360 continue |
2619 let b:plug_preview = !s:is_preview_window_open() |
2619 let b:plug_preview = !s:is_preview_window_open() |
2620 endif |
2620 endif |
2621 |
2621 |
2622 let sha = matchstr(getline('.'), '^ \X*\zs[0-9a-f]\{7,9}') |
2622 let sha = matchstr(getline('.'), '^ \X*\zs[0-9a-f]\{7,9}') |
2623 if empty(sha) |
2623 if empty(sha) |
2624 return |
2624 let name = matchstr(getline('.'), '^- \zs[^:]*\ze:$') |
2625 endif |
2625 if empty(name) |
2626 |
2626 return |
2627 let name = s:find_name(line('.')) |
2627 endif |
|
2628 let title = 'HEAD@{1}..' |
|
2629 let command = 'git diff --no-color HEAD@{1}' |
|
2630 else |
|
2631 let title = sha |
|
2632 let command = 'git show --no-color --pretty=medium '.sha |
|
2633 let name = s:find_name(line('.')) |
|
2634 endif |
|
2635 |
2628 if empty(name) || !has_key(g:plugs, name) || !isdirectory(g:plugs[name].dir) |
2636 if empty(name) || !has_key(g:plugs, name) || !isdirectory(g:plugs[name].dir) |
2629 return |
2637 return |
2630 endif |
2638 endif |
2631 |
2639 |
2632 if exists('g:plug_pwindow') && !s:is_preview_window_open() |
2640 if exists('g:plug_pwindow') && !s:is_preview_window_open() |
2633 execute g:plug_pwindow |
2641 execute g:plug_pwindow |
2634 execute 'e' sha |
2642 execute 'e' title |
2635 else |
2643 else |
2636 execute 'pedit' sha |
2644 execute 'pedit' title |
2637 wincmd P |
2645 wincmd P |
2638 endif |
2646 endif |
2639 setlocal previewwindow filetype=git buftype=nofile nobuflisted modifiable |
2647 setlocal previewwindow filetype=git buftype=nofile bufhidden=wipe nobuflisted modifiable |
2640 let batchfile = '' |
2648 let batchfile = '' |
2641 try |
2649 try |
2642 let [sh, shellcmdflag, shrd] = s:chsh(1) |
2650 let [sh, shellcmdflag, shrd] = s:chsh(1) |
2643 let cmd = 'cd '.plug#shellescape(g:plugs[name].dir).' && git show --no-color --pretty=medium '.sha |
2651 let cmd = 'cd '.plug#shellescape(g:plugs[name].dir).' && '.command |
2644 if s:is_win |
2652 if s:is_win |
2645 let [batchfile, cmd] = s:batchfile(cmd) |
2653 let [batchfile, cmd] = s:batchfile(cmd) |
2646 endif |
2654 endif |
2647 execute 'silent %!' cmd |
2655 execute 'silent %!' cmd |
2648 finally |
2656 finally |
2764 \ '" or execute: vim -S snapshot.vim', |
2772 \ '" or execute: vim -S snapshot.vim', |
2765 \ '', '', 'PlugUpdate!']) |
2773 \ '', '', 'PlugUpdate!']) |
2766 1 |
2774 1 |
2767 let anchor = line('$') - 3 |
2775 let anchor = line('$') - 3 |
2768 let names = sort(keys(filter(copy(g:plugs), |
2776 let names = sort(keys(filter(copy(g:plugs), |
2769 \'has_key(v:val, "uri") && !has_key(v:val, "commit") && isdirectory(v:val.dir)'))) |
2777 \'has_key(v:val, "uri") && isdirectory(v:val.dir)'))) |
2770 for name in reverse(names) |
2778 for name in reverse(names) |
2771 let sha = s:git_revision(g:plugs[name].dir) |
2779 let sha = has_key(g:plugs[name], 'commit') ? g:plugs[name].commit : s:git_revision(g:plugs[name].dir) |
2772 if !empty(sha) |
2780 if !empty(sha) |
2773 call append(anchor, printf("silent! let g:plugs['%s'].commit = '%s'", name, sha)) |
2781 call append(anchor, printf("silent! let g:plugs['%s'].commit = '%s'", name, sha)) |
2774 redraw |
2782 redraw |
2775 endif |
2783 endif |
2776 endfor |
2784 endfor |