Mercurial > vim
comparison runtime/plugin/manpager.vim @ 29193:1e9e9d89f0ee
Update runtime files
Commit: https://github.com/vim/vim/commit/d592deb336523a5448779ee3d4bba80334cff1f7
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Jun 17 15:42:40 2022 +0100
Update runtime files
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 17 Jun 2022 16:45:04 +0200 |
parents | f3ec3c57e070 |
children | f68f43043842 |
comparison
equal
deleted
inserted
replaced
29192:e4488cf0eff9 | 29193:1e9e9d89f0ee |
---|---|
1 " Vim plugin for using Vim as manpager. | 1 " Vim plugin for using Vim as manpager. |
2 " Maintainer: Enno Nagel <ennonagel+vim@gmail.com> | 2 " Maintainer: Enno Nagel <ennonagel+vim@gmail.com> |
3 " Last Change: 2022 Jun 05 | 3 " Last Change: 2022 Jun 17 |
4 | 4 |
5 command! -nargs=0 MANPAGER call s:ManPager() | delcommand MANPAGER | 5 " Set up the current buffer (likely read from stdin) as a manpage |
6 command MANPAGER call s:ManPager() | |
6 | 7 |
7 function s:ManPager() | 8 function s:ManPager() |
8 " global options, keep these to a minimum to avoid side effects | 9 " global options, keep these to a minimum to avoid side effects |
9 if &compatible | 10 if &compatible |
10 set nocompatible | 11 set nocompatible |
11 endif | 12 endif |
12 if exists('+viminfofile') | 13 if exists('+viminfofile') |
13 set viminfofile=NONE | 14 set viminfofile=NONE |
14 endif | 15 endif |
15 set noswapfile | 16 syntax on |
16 | 17 |
17 setlocal ft=man | 18 " Make this an unlisted, readonly scratch buffer |
18 runtime ftplugin/man.vim | 19 setlocal buftype=nofile noswapfile bufhidden=hide nobuflisted readonly |
19 setlocal buftype=nofile bufhidden=hide iskeyword+=: modifiable | 20 |
21 " Is this useful? Should allow for using K on word with a colon. | |
22 setlocal iskeyword+=: | |
23 | |
24 " Ensure text width matches window width | |
25 setlocal foldcolumn& nofoldenable nonumber norelativenumber | |
26 | |
27 " In case Vim was invoked with -M | |
28 setlocal modifiable | |
20 | 29 |
21 " Emulate 'col -b' | 30 " Emulate 'col -b' |
22 silent! keepj keepp %s/\v(.)\b\ze\1?//ge | 31 silent! keepj keepp %s/\v(.)\b\ze\1?//ge |
23 | 32 |
24 " Remove ansi sequences | 33 " Remove ansi sequences |
28 call cursor(1, 1) | 37 call cursor(1, 1) |
29 let n = search(".*(.*)", "c") | 38 let n = search(".*(.*)", "c") |
30 if n > 1 | 39 if n > 1 |
31 exe "1," . n-1 . "d" | 40 exe "1," . n-1 . "d" |
32 endif | 41 endif |
33 setlocal nomodifiable nomodified readonly nowrite | |
34 | 42 |
35 syntax on | 43 " Finished preprocessing the buffer, prevent any further modifications |
44 setlocal nomodified nomodifiable | |
45 | |
46 " Set filetype to man even if ftplugin is disabled | |
47 setlocal iskeyword+=: filetype=man | |
48 runtime ftplugin/man.vim | |
36 endfunction | 49 endfunction |