0
0
mirror of https://github.com/vim/vim.git synced 2025-07-04 23:07:33 -04:00
vim/runtime/plugin/manpager.vim

31 lines
676 B
VimL
Raw Normal View History

" Vim plugin for using Vim as manpager.
" Maintainer: Enno Nagel <ennonagel+vim@gmail.com>
2018-02-09 22:00:53 +01:00
" Last Change: 2018 Feb 04
2018-02-09 22:00:53 +01:00
command! -nargs=0 MANPAGER call s:ManPager() | delcommand MANPAGER
2018-02-09 22:00:53 +01:00
function! s:ManPager()
set nocompatible
if exists('+viminfofile')
set viminfofile=NONE
endif
2018-02-09 22:00:53 +01:00
set noswapfile
2018-02-09 22:00:53 +01:00
setlocal ft=man
runtime ftplugin/man.vim
setlocal buftype=nofile bufhidden=hide iskeyword+=: modifiable
2018-02-09 22:00:53 +01:00
" Emulate 'col -b'
silent keepj keepp %s/\v(.)\b\ze\1?//ge
" Remove empty lines above the header
call cursor(1, 1)
let n = search(".*(.*)", "c")
if n > 1
exe "1," . n-1 . "d"
endif
setlocal nomodified readonly
2018-02-09 22:00:53 +01:00
syntax on
endfunction