What is a way to read man pages in vim without using temporary files

前端 未结 11 1313
萌比男神i
萌比男神i 2020-12-12 19:36

I want to be able to read man pages in vim. For some reason, it seems that vim isn\'t able to read the output of programs through piping (i.e \'(man ls) | vi\' doesn\'t seem

11条回答
  •  不思量自难忘°
    2020-12-12 20:22

    On my system (Mac OS X), I found that the above left control characters in the output. Instead I used:

    export MANPAGER="col -b | vim -MR - "
    

    then just e.g.

    man vim
    

    The vim options turn off modifying the buffer and make it read-only. This stops vim complaining if you try to exit with ":q" (you can use :q! of course, but you might as well set the options).

    This is also handy for general use - I have the following. The -c command names the buffer, just for completeness.

    alias vimpager="vim -MR -c 'file [stdin]' -"
    

提交回复
热议问题