1" Vim plugin for using Vim as manpager. 2" Maintainer: Enno Nagel <[email protected]> 3" Last Change: 2018 Feb 04 4 5command! -nargs=0 MANPAGER call s:ManPager() | delcommand MANPAGER 6 7function! s:ManPager() 8 set nocompatible 9 if exists('+viminfofile') 10 set viminfofile=NONE 11 endif 12 set noswapfile 13 14 setlocal ft=man 15 runtime ftplugin/man.vim 16 setlocal buftype=nofile bufhidden=hide iskeyword+=: modifiable 17 18 " Emulate 'col -b' 19 silent keepj keepp %s/\v(.)\b\ze\1?//ge 20 21 " Remove empty lines above the header 22 call cursor(1, 1) 23 let n = search(".*(.*)", "c") 24 if n > 1 25 exe "1," . n-1 . "d" 26 endif 27 setlocal nomodified readonly 28 29 syntax on 30endfunction 31