0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

patch 7.4.1804

Problem:    Can't use Vim as MANPAGER.
Solution:   Add manpager.vim. (Enno Nagel, closes #491)
This commit is contained in:
Bram Moolenaar
2016-04-30 14:15:54 +02:00
parent 0b6cf69c03
commit b20545f2a7
2 changed files with 31 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
" Vim plugin for using Vim as manpager.
" Maintainer: Enno Nagel <ennonagel+vim@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

View File

@@ -753,6 +753,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1804,
/**/
1803,
/**/