在不使用临时文件的情况下在vim中读取手册页的方法是什么 [英] What is a way to read man pages in vim without using temporary files
问题描述
我希望能够在vim中阅读手册页.由于某种原因,似乎vim无法通过管道读取程序的输出(即'(man ls)| vi'似乎不起作用,向可以解释原因的人加分),并获得为此,我一直在使用以下小脚本:
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 to work, bonus points to somebody who can explain why), and to get around this, I've been using the following little script:
tempo = `mktemp`
man $1 > $tempo ; vi $tempo
该脚本使用临时文件,我认为它可以很好地工作,但是我想知道是否存在一种不使用临时文件来读取vim手册页的好方法
This script uses temporary files which I guess works fine, but I was wondering if there was a good way to read man pages in vim without resorting to making temporary files
推荐答案
由于某些原因,似乎vim无法通过管道[…]
For some reason, it seems that vim isn't able to read the output of programs through piping […]
根据手册页,您需要指定一个文件-
以便从标准输入中读取该文件;所以:
According to the man-page, you need to specify a file of -
to get it to read from standard input; so:
man ls | vi -
如果这不起作用,您可以尝试使用进程替换:
If that doesn't work, you might try using process substitution:
vi <(man $1)
创建一种伪文件并将其传递给vi
.
which creates a sort of pseudo-file and passes it to vi
.
这篇关于在不使用临时文件的情况下在vim中读取手册页的方法是什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!