neovim/runtime/plugin/man.vim
Justin M. Keyes f895b47d3f
man.vim: :Man! operates on buffer contents (#9139)
mandoc may not handle quoted MANPAGER arguments correctly. E.g. with
    export MANPAGER='nvim -u NORC -c "set ft=man"'
mandoc treats `"set` and `ft=man"'` as separate tokens.

To workaround that, provide :Man! so that MANPAGER can avoid quoting.

closes #9120
2018-10-21 17:38:25 +02:00

16 lines
429 B
VimL

" Maintainer: Anmol Sethi <anmol@aubble.com>
if exists('g:loaded_man')
finish
endif
let g:loaded_man = 1
command! -bang -bar -range=0 -complete=customlist,man#complete -nargs=* Man
\ if <bang>0 | set ft=man |
\ else | call man#open_page(v:count, v:count1, <q-mods>, <f-args>) | endif
augroup man
autocmd!
autocmd BufReadCmd man://* call man#read_page(matchstr(expand('<amatch>'), 'man://\zs.*'))
augroup END