[vim] 121/139: patch 7.4.1804 Problem: Can't use Vim as MANPAGER. Solution: Add manpager.vim. (Enno Nagel, closes #491)

James McCoy jamessan at debian.org
Fri May 6 04:00:15 UTC 2016


This is an automated email from the git hooks/post-receive script.

jamessan pushed a commit to branch debian/sid
in repository vim.

commit b20545f2a718d4f19c3f609fd11c0ca4eff450ce
Author: Bram Moolenaar <Bram at vim.org>
Date:   Sat Apr 30 14:15:54 2016 +0200

    patch 7.4.1804
    Problem:    Can't use Vim as MANPAGER.
    Solution:   Add manpager.vim. (Enno Nagel, closes #491)
---
 runtime/plugin/manpager.vim | 29 +++++++++++++++++++++++++++++
 src/version.c               |  2 ++
 2 files changed, 31 insertions(+)

diff --git a/runtime/plugin/manpager.vim b/runtime/plugin/manpager.vim
new file mode 100644
index 0000000..43b438c
--- /dev/null
+++ b/runtime/plugin/manpager.vim
@@ -0,0 +1,29 @@
+" Vim plugin for using Vim as manpager.
+" Maintainer: Enno Nagel <ennonagel+vim at gmail.com>
+" Last Change: 2016 Apr 30
+
+" $MAN_PN is supposed to be set by MANPAGER, see ":help manpager.vim".
+if empty($MAN_PN)
+  finish
+endif
+
+command! -nargs=0 MANPAGER call s:MANPAGER() | delcommand MANPAGER
+
+function! s:MANPAGER()
+  let page_pattern = '\v\w+%([-_.]\w+)*'
+  let sec_pattern = '\v\w+%(\+\w+)*'
+  let pagesec_pattern = '\v(' . page_pattern . ')\((' . sec_pattern . ')\)'
+
+  if $MAN_PN is '1'
+    let manpage = matchstr( getline(1), '^' . pagesec_pattern )
+  else
+    let manpage = expand('$MAN_PN')
+  endif
+
+  let page_sec = matchlist( manpage, '^' . pagesec_pattern  . '$')
+
+  bwipe!
+
+  setlocal filetype=man
+  exe 'Man' page_sec[3] page_sec[1]
+endfunction
diff --git a/src/version.c b/src/version.c
index ff275cf..e891af9 100644
--- a/src/version.c
+++ b/src/version.c
@@ -754,6 +754,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    1804,
+/**/
     1803,
 /**/
     1802,

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-vim/vim.git



More information about the pkg-vim-maintainers mailing list