From 92c8d2a002794e94068cdb3287f82bf9076dd323 Mon Sep 17 00:00:00 2001 From: Freedzone Date: Tue, 21 Nov 2017 01:22:21 -0500 Subject: [PATCH 1/2] Added PlugHelp command to open plugins readme --- plug.vim | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/plug.vim b/plug.vim index 143c377..8c7f2ec 100644 --- a/plug.vim +++ b/plug.vim @@ -146,6 +146,7 @@ function! s:define_commands() command! -nargs=0 -bar PlugStatus call s:status() command! -nargs=0 -bar PlugDiff call s:diff() command! -nargs=? -bar -bang -complete=file PlugSnapshot call s:snapshot(0, ) + command! -nargs=0 -bar PlugHelp call s:readme() endfunction function! s:to_a(v) @@ -600,6 +601,27 @@ function! s:update(force, names) call s:update_impl(1, a:force, a:names) endfunction +function! s:readme() + let str=matchstr(getline('.'), "'\\zs[^']\\+\\ze'") + let str=fnamemodify(str, ":t") + let plug_dir=g:plug_home.'/'.str + + if isdirectory(plug_dir) + let globbed=glob(plug_dir.'/[Rr][Ee][Aa][Dd][Mm][Ee]*') + + if strlen(globbed) > 0 + let readme=split(globbed, '\n')[0] + if filereadable(readme) + execute 'vsplit '.readme + " echom readme + return 0 + endif + endif + endif + + return -1 +endfunction + function! plug#helptags() if !exists('g:plugs') return s:err('plug#begin was not called') From e291a799000e3387e6ec28e690b06655691df0ea Mon Sep 17 00:00:00 2001 From: Freedzone Date: Tue, 21 Nov 2017 01:25:25 -0500 Subject: [PATCH 2/2] Update plug.vim --- plug.vim | 1 - 1 file changed, 1 deletion(-) diff --git a/plug.vim b/plug.vim index 8c7f2ec..6ce2a25 100644 --- a/plug.vim +++ b/plug.vim @@ -613,7 +613,6 @@ function! s:readme() let readme=split(globbed, '\n')[0] if filereadable(readme) execute 'vsplit '.readme - " echom readme return 0 endif endif