annotate runtime/plugin/manpager.vim @ 27762:3196066c5795 v8.2.4407

patch 8.2.4407: Vim9: some code not covered by tests Commit: https://github.com/vim/vim/commit/e08be09a08485e8c919f46c05223c1ccfdaf175d Author: Bram Moolenaar <Bram@vim.org> Date: Thu Feb 17 13:08:26 2022 +0000 patch 8.2.4407: Vim9: some code not covered by tests Problem: Vim9: some code not covered by tests. Solution: Add more tests. Avoid giving two errors. Remove dead code.
author Bram Moolenaar <Bram@vim.org>
date Thu, 17 Feb 2022 14:15:04 +0100
parents 29ec2c198c8d
children f3ec3c57e070
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>
25619
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13231
diff changeset
3 " Last Change: 2020 Aug 05
9037
d07035f84f0d commit https://github.com/vim/vim/commit/b20545f2a718d4f19c3f609fd11c0ca4eff450ce
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
4
13231
167a030448fa Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 12826
diff changeset
5 command! -nargs=0 MANPAGER call s:ManPager() | delcommand MANPAGER
9037
d07035f84f0d commit https://github.com/vim/vim/commit/b20545f2a718d4f19c3f609fd11c0ca4eff450ce
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6
13231
167a030448fa Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 12826
diff changeset
7 function! s:ManPager()
167a030448fa Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 12826
diff changeset
8 set nocompatible
167a030448fa Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 12826
diff changeset
9 if exists('+viminfofile')
167a030448fa Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 12826
diff changeset
10 set viminfofile=NONE
167a030448fa Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 12826
diff changeset
11 endif
167a030448fa Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 12826
diff changeset
12 set noswapfile
9037
d07035f84f0d commit https://github.com/vim/vim/commit/b20545f2a718d4f19c3f609fd11c0ca4eff450ce
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13
13231
167a030448fa Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 12826
diff changeset
14 setlocal ft=man
167a030448fa Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 12826
diff changeset
15 runtime ftplugin/man.vim
167a030448fa Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 12826
diff changeset
16 setlocal buftype=nofile bufhidden=hide iskeyword+=: modifiable
167a030448fa Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 12826
diff changeset
17
167a030448fa Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 12826
diff changeset
18 " Emulate 'col -b'
25619
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13231
diff changeset
19 silent! keepj keepp %s/\v(.)\b\ze\1?//ge
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13231
diff changeset
20
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13231
diff changeset
21 " Remove ansi sequences
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13231
diff changeset
22 silent! keepj keepp %s/\v\e\[%(%(\d;)?\d{1,2})?[mK]//ge
9037
d07035f84f0d commit https://github.com/vim/vim/commit/b20545f2a718d4f19c3f609fd11c0ca4eff450ce
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
23
13231
167a030448fa Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 12826
diff changeset
24 " Remove empty lines above the header
167a030448fa Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 12826
diff changeset
25 call cursor(1, 1)
167a030448fa Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 12826
diff changeset
26 let n = search(".*(.*)", "c")
167a030448fa Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 12826
diff changeset
27 if n > 1
167a030448fa Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 12826
diff changeset
28 exe "1," . n-1 . "d"
167a030448fa Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 12826
diff changeset
29 endif
167a030448fa Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 12826
diff changeset
30 setlocal nomodified readonly
9037
d07035f84f0d commit https://github.com/vim/vim/commit/b20545f2a718d4f19c3f609fd11c0ca4eff450ce
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
31
13231
167a030448fa Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 12826
diff changeset
32 syntax on
9037
d07035f84f0d commit https://github.com/vim/vim/commit/b20545f2a718d4f19c3f609fd11c0ca4eff450ce
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
33 endfunction