annotate runtime/plugin/manpager.vim @ 29326:1f1d99bba06c v9.0.0006

patch 9.0.0006: not all Visual Basic files are recognized Commit: https://github.com/vim/vim/commit/8b5901e2f9466eb6f38f5b251e871f609f65e252 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Jun 29 14:39:12 2022 +0100 patch 9.0.0006: not all Visual Basic files are recognized Problem: Not all Visual Basic files are recognized. Solution: Change detection of *.cls files. (Doug Kearns)
author Bram Moolenaar <Bram@vim.org>
date Wed, 29 Jun 2022 15:45:03 +0200
parents 1e9e9d89f0ee
children f68f43043842
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>
29193
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29087
diff changeset
3 " Last Change: 2022 Jun 17
9037
d07035f84f0d commit https://github.com/vim/vim/commit/b20545f2a718d4f19c3f609fd11c0ca4eff450ce
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
4
29193
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29087
diff changeset
5 " Set up the current buffer (likely read from stdin) as a manpage
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29087
diff changeset
6 command MANPAGER call s:ManPager()
9037
d07035f84f0d commit https://github.com/vim/vim/commit/b20545f2a718d4f19c3f609fd11c0ca4eff450ce
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7
29087
f3ec3c57e070 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 25619
diff changeset
8 function s:ManPager()
f3ec3c57e070 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 25619
diff changeset
9 " global options, keep these to a minimum to avoid side effects
f3ec3c57e070 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 25619
diff changeset
10 if &compatible
f3ec3c57e070 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 25619
diff changeset
11 set nocompatible
f3ec3c57e070 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 25619
diff changeset
12 endif
13231
167a030448fa Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 12826
diff changeset
13 if exists('+viminfofile')
167a030448fa Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 12826
diff changeset
14 set viminfofile=NONE
167a030448fa Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 12826
diff changeset
15 endif
29193
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29087
diff changeset
16 syntax on
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29087
diff changeset
17
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29087
diff changeset
18 " Make this an unlisted, readonly scratch buffer
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29087
diff changeset
19 setlocal buftype=nofile noswapfile bufhidden=hide nobuflisted readonly
9037
d07035f84f0d commit https://github.com/vim/vim/commit/b20545f2a718d4f19c3f609fd11c0ca4eff450ce
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20
29193
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29087
diff changeset
21 " Is this useful? Should allow for using K on word with a colon.
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29087
diff changeset
22 setlocal iskeyword+=:
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29087
diff changeset
23
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29087
diff changeset
24 " Ensure text width matches window width
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29087
diff changeset
25 setlocal foldcolumn& nofoldenable nonumber norelativenumber
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29087
diff changeset
26
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29087
diff changeset
27 " In case Vim was invoked with -M
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29087
diff changeset
28 setlocal modifiable
13231
167a030448fa Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 12826
diff changeset
29
167a030448fa Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 12826
diff changeset
30 " Emulate 'col -b'
25619
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13231
diff changeset
31 silent! keepj keepp %s/\v(.)\b\ze\1?//ge
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13231
diff changeset
32
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13231
diff changeset
33 " Remove ansi sequences
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13231
diff changeset
34 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
35
13231
167a030448fa Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 12826
diff changeset
36 " Remove empty lines above the header
167a030448fa Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 12826
diff changeset
37 call cursor(1, 1)
167a030448fa Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 12826
diff changeset
38 let n = search(".*(.*)", "c")
167a030448fa Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 12826
diff changeset
39 if n > 1
167a030448fa Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 12826
diff changeset
40 exe "1," . n-1 . "d"
167a030448fa Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 12826
diff changeset
41 endif
29193
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29087
diff changeset
42
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29087
diff changeset
43 " Finished preprocessing the buffer, prevent any further modifications
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29087
diff changeset
44 setlocal nomodified nomodifiable
9037
d07035f84f0d commit https://github.com/vim/vim/commit/b20545f2a718d4f19c3f609fd11c0ca4eff450ce
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
45
29193
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29087
diff changeset
46 " Set filetype to man even if ftplugin is disabled
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29087
diff changeset
47 setlocal iskeyword+=: filetype=man
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29087
diff changeset
48 runtime ftplugin/man.vim
9037
d07035f84f0d commit https://github.com/vim/vim/commit/b20545f2a718d4f19c3f609fd11c0ca4eff450ce
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
49 endfunction