lambdalisue / vim-manpager

Use Vim as a MANPAGER program
MIT License
62 stars 5 forks source link

replace space with '-' in page name #15

Open zzs213 opened 3 years ago

zzs213 commented 3 years ago

This patch works when selected text contains space in visual mode. like "git ls-files"

diff --git a/autoload/manpager.vim b/autoload/manpager.vim
index 4490996..d09503a 100644
--- a/autoload/manpager.vim
+++ b/autoload/manpager.vim
@@ -74,8 +74,9 @@ function! manpager#load(section, page) abort
 endfunction

 function! manpager#open(section, page) abort
-  let name = empty(a:section) ? a:page : printf('%s(%s)', a:page, a:section)
-  let result = manpager#load(a:section, a:page)
+  let page = substitute(a:page, '\s\+', '-', 'g')
+  let name = empty(a:section) ? page : printf('%s(%s)', page, a:section)
+  let result = manpager#load(a:section, page)
   if result.status
     if g:manpager#debug
       echo join(result.args, ' ')

000.txt

lambdalisue commented 3 years ago

Send me a PR 👍