Mercurial > vim
annotate runtime/plugin/manpager.vim @ 32029:23e8d0371e35 v9.0.1346
patch 9.0.1346: Starlark files are not recognized
Commit: https://github.com/vim/vim/commit/ca06b30073de22dc120b532e90fbee2a10ef9772
Author: Amaan Qureshi <amaanq12@gmail.com>
Date: Thu Feb 23 15:38:49 2023 +0000
patch 9.0.1346: Starlark files are not recognized
Problem: Starlark files are not recognized.
Solution: Add patterns for Starlark files. (Amaan Qureshi, closes https://github.com/vim/vim/issues/12049)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 23 Feb 2023 16:45:03 +0100 |
parents | eb2638f278bf |
children | a57db996dbe3 |
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> |
30967 | 3 " Last Change: 2022 Oct 17 |
4 | |
5 if exists('g:loaded_manpager_plugin') | |
6 finish | |
7 endif | |
8 let g:loaded_manpager_plugin = 1 | |
9037
d07035f84f0d
commit https://github.com/vim/vim/commit/b20545f2a718d4f19c3f609fd11c0ca4eff450ce
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
9 |
29193 | 10 " Set up the current buffer (likely read from stdin) as a manpage |
11 command MANPAGER call s:ManPager() | |
9037
d07035f84f0d
commit https://github.com/vim/vim/commit/b20545f2a718d4f19c3f609fd11c0ca4eff450ce
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
12 |
29087 | 13 function s:ManPager() |
14 " global options, keep these to a minimum to avoid side effects | |
15 if &compatible | |
16 set nocompatible | |
17 endif | |
13231 | 18 if exists('+viminfofile') |
19 set viminfofile=NONE | |
20 endif | |
29193 | 21 syntax on |
22 | |
23 " Make this an unlisted, readonly scratch buffer | |
24 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
|
25 |
29193 | 26 " Ensure text width matches window width |
27 setlocal foldcolumn& nofoldenable nonumber norelativenumber | |
28 | |
29 " In case Vim was invoked with -M | |
30 setlocal modifiable | |
13231 | 31 |
32 " Emulate 'col -b' | |
25619 | 33 silent! keepj keepp %s/\v(.)\b\ze\1?//ge |
34 | |
35 " Remove ansi sequences | |
36 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
|
37 |
13231 | 38 " Remove empty lines above the header |
39 call cursor(1, 1) | |
40 let n = search(".*(.*)", "c") | |
41 if n > 1 | |
42 exe "1," . n-1 . "d" | |
43 endif | |
29193 | 44 |
45 " Finished preprocessing the buffer, prevent any further modifications | |
46 setlocal nomodified nomodifiable | |
9037
d07035f84f0d
commit https://github.com/vim/vim/commit/b20545f2a718d4f19c3f609fd11c0ca4eff450ce
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
47 |
29193 | 48 " Set filetype to man even if ftplugin is disabled |
30634 | 49 setlocal filetype=man |
29193 | 50 runtime ftplugin/man.vim |
9037
d07035f84f0d
commit https://github.com/vim/vim/commit/b20545f2a718d4f19c3f609fd11c0ca4eff450ce
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
51 endfunction |