Skip to content

Commit b20545f

Browse files
committed
patch 7.4.1804
Problem: Can't use Vim as MANPAGER. Solution: Add manpager.vim. (Enno Nagel, closes #491)
1 parent 0b6cf69 commit b20545f

2 files changed

Lines changed: 31 additions & 0 deletions

File tree

runtime/plugin/manpager.vim

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
" Vim plugin for using Vim as manpager.
2+
" Maintainer: Enno Nagel <[email protected]>
3+
" Last Change: 2016 Apr 30
4+
5+
" $MAN_PN is supposed to be set by MANPAGER, see ":help manpager.vim".
6+
if empty($MAN_PN)
7+
finish
8+
endif
9+
10+
command! -nargs=0 MANPAGER call s:MANPAGER() | delcommand MANPAGER
11+
12+
function! s:MANPAGER()
13+
let page_pattern = '\v\w+%([-_.]\w+)*'
14+
let sec_pattern = '\v\w+%(\+\w+)*'
15+
let pagesec_pattern = '\v(' . page_pattern . ')\((' . sec_pattern . ')\)'
16+
17+
if $MAN_PN is '1'
18+
let manpage = matchstr( getline(1), '^' . pagesec_pattern )
19+
else
20+
let manpage = expand('$MAN_PN')
21+
endif
22+
23+
let page_sec = matchlist( manpage, '^' . pagesec_pattern . '$')
24+
25+
bwipe!
26+
27+
setlocal filetype=man
28+
exe 'Man' page_sec[3] page_sec[1]
29+
endfunction

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -753,6 +753,8 @@ static char *(features[]) =
753753

754754
static int included_patches[] =
755755
{ /* Add new patch number below this line */
756+
/**/
757+
1804,
756758
/**/
757759
1803,
758760
/**/

0 commit comments

Comments
 (0)