annotate runtime/plugin/manpager.vim @ 11890:318ae82d8ba4 v8.0.0825

patch 8.0.0825: not easy to see that a window is a terminal window commit https://github.com/vim/vim/commit/3633cf5201e914cc802fd2f813fa87bc959ffaec Author: Bram Moolenaar <Bram@vim.org> Date: Mon Jul 31 22:29:35 2017 +0200 patch 8.0.0825: not easy to see that a window is a terminal window Problem: Not easy to see that a window is a terminal window. Solution: Add StatusLineTerm highlighting.
author Christian Brabandt <cb@256bit.org>
date Mon, 31 Jul 2017 22:30:04 +0200
parents 071f9da012fb
children f690da1b3c04
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9037
d07035f84f0d commit https://github.com/vim/vim/commit/b20545f2a718d4f19c3f609fd11c0ca4eff450ce
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 " Vim plugin for using Vim as manpager.
d07035f84f0d commit https://github.com/vim/vim/commit/b20545f2a718d4f19c3f609fd11c0ca4eff450ce
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2 " Maintainer: Enno Nagel <ennonagel+vim@gmail.com>
9097
071f9da012fb commit https://github.com/vim/vim/commit/06d2d38ab7564e1f784b1058a4ef4580cd6d1810
Christian Brabandt <cb@256bit.org>
parents: 9076
diff changeset
3 " Last Change: 2016 May 20
9037
d07035f84f0d commit https://github.com/vim/vim/commit/b20545f2a718d4f19c3f609fd11c0ca4eff450ce
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
4
d07035f84f0d commit https://github.com/vim/vim/commit/b20545f2a718d4f19c3f609fd11c0ca4eff450ce
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5 " $MAN_PN is supposed to be set by MANPAGER, see ":help manpager.vim".
d07035f84f0d commit https://github.com/vim/vim/commit/b20545f2a718d4f19c3f609fd11c0ca4eff450ce
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6 if empty($MAN_PN)
d07035f84f0d commit https://github.com/vim/vim/commit/b20545f2a718d4f19c3f609fd11c0ca4eff450ce
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 finish
d07035f84f0d commit https://github.com/vim/vim/commit/b20545f2a718d4f19c3f609fd11c0ca4eff450ce
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8 endif
d07035f84f0d commit https://github.com/vim/vim/commit/b20545f2a718d4f19c3f609fd11c0ca4eff450ce
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9
d07035f84f0d commit https://github.com/vim/vim/commit/b20545f2a718d4f19c3f609fd11c0ca4eff450ce
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10 command! -nargs=0 MANPAGER call s:MANPAGER() | delcommand MANPAGER
d07035f84f0d commit https://github.com/vim/vim/commit/b20545f2a718d4f19c3f609fd11c0ca4eff450ce
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
11
d07035f84f0d commit https://github.com/vim/vim/commit/b20545f2a718d4f19c3f609fd11c0ca4eff450ce
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12 function! s:MANPAGER()
d07035f84f0d commit https://github.com/vim/vim/commit/b20545f2a718d4f19c3f609fd11c0ca4eff450ce
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13 let page_pattern = '\v\w+%([-_.]\w+)*'
d07035f84f0d commit https://github.com/vim/vim/commit/b20545f2a718d4f19c3f609fd11c0ca4eff450ce
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 let sec_pattern = '\v\w+%(\+\w+)*'
d07035f84f0d commit https://github.com/vim/vim/commit/b20545f2a718d4f19c3f609fd11c0ca4eff450ce
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15 let pagesec_pattern = '\v(' . page_pattern . ')\((' . sec_pattern . ')\)'
d07035f84f0d commit https://github.com/vim/vim/commit/b20545f2a718d4f19c3f609fd11c0ca4eff450ce
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16
d07035f84f0d commit https://github.com/vim/vim/commit/b20545f2a718d4f19c3f609fd11c0ca4eff450ce
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17 if $MAN_PN is '1'
d07035f84f0d commit https://github.com/vim/vim/commit/b20545f2a718d4f19c3f609fd11c0ca4eff450ce
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 let manpage = matchstr( getline(1), '^' . pagesec_pattern )
d07035f84f0d commit https://github.com/vim/vim/commit/b20545f2a718d4f19c3f609fd11c0ca4eff450ce
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19 else
d07035f84f0d commit https://github.com/vim/vim/commit/b20545f2a718d4f19c3f609fd11c0ca4eff450ce
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20 let manpage = expand('$MAN_PN')
d07035f84f0d commit https://github.com/vim/vim/commit/b20545f2a718d4f19c3f609fd11c0ca4eff450ce
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
21 endif
d07035f84f0d commit https://github.com/vim/vim/commit/b20545f2a718d4f19c3f609fd11c0ca4eff450ce
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22
9076
9305a1251e51 commit https://github.com/vim/vim/commit/91c4937be15b0b743b6bc495df602c1abbff6b87
Christian Brabandt <cb@256bit.org>
parents: 9037
diff changeset
23 let page_sec = matchlist(tolower(manpage), '^' . pagesec_pattern . '$')
9037
d07035f84f0d commit https://github.com/vim/vim/commit/b20545f2a718d4f19c3f609fd11c0ca4eff450ce
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
24
d07035f84f0d commit https://github.com/vim/vim/commit/b20545f2a718d4f19c3f609fd11c0ca4eff450ce
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
25 bwipe!
d07035f84f0d commit https://github.com/vim/vim/commit/b20545f2a718d4f19c3f609fd11c0ca4eff450ce
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
26
d07035f84f0d commit https://github.com/vim/vim/commit/b20545f2a718d4f19c3f609fd11c0ca4eff450ce
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
27 setlocal filetype=man
9097
071f9da012fb commit https://github.com/vim/vim/commit/06d2d38ab7564e1f784b1058a4ef4580cd6d1810
Christian Brabandt <cb@256bit.org>
parents: 9076
diff changeset
28 exe 'Man' page_sec[2] page_sec[1]
9037
d07035f84f0d commit https://github.com/vim/vim/commit/b20545f2a718d4f19c3f609fd11c0ca4eff450ce
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
29 endfunction