0

I want to use vim to check the -h param of pm2(a nodejs app),

and i want to use vim to check manual page,

man ascii | vim
pm2 -h | vim

dont not work, how to do this?

RavinderSingh13
  • 130,504
  • 14
  • 57
  • 93
user956609
  • 906
  • 7
  • 22
  • What do you mean by _checking the `-h` param of `pm2`_? – Enlico Feb 06 '20 at 19:19
  • 2
    Sure you don't want `less`, `more`, or another pager? – Shawn Feb 06 '20 at 19:28
  • 1
    Does this answer your question? [What is a way to read man pages in vim without using temporary files](https://stackoverflow.com/questions/16740246/what-is-a-way-to-read-man-pages-in-vim-without-using-temporary-files). After thinking better about it, I've marked the question as duplicate of the one I linked in my answer. I cannot see how the two subquestions here differ. – Enlico Feb 06 '20 at 19:37
  • `:h Man` describes the built-in way for doing that. – Benjamin W. Feb 06 '20 at 20:15

1 Answers1

2

If you really want to read the man page from vim, this is a way to accomplish the

man ascii | vim -

this is another:

vim <(man ascii)

The reason why man ascii | vim does not work, is because vim does not take input from standard input, unless you use vim -.

As suggested in a comment, are you sure man ascii | less is not enough for you? It allows you to search and move in the man page as vim would do (/,j,k,...).

As regards checking the -h param of pm2, I have no clue what you mean. If by any chance you refer to vim being "aware" that pm2 was called with that option, it does just make no sense.

Enlico
  • 23,259
  • 6
  • 48
  • 102
  • 1
    This is wrong. `man` is not a pager, but it uses one. It will use `less` by default or whatever the `PAGER` environment variable contains. – jordanm Feb 06 '20 at 19:24
  • @jordanm, `man man` reads `man is the system's manual pager`. Maybe I miss some bit? – Enlico Feb 06 '20 at 19:25
  • 1
    Also, if you want to just stream the output to stdout, you can set `PAGER=cat` – jordanm Feb 06 '20 at 19:25
  • I've removed that bit, which I've mistakenly confirmed before being sure it was right (there was a missing full stop, which I rarely miss). – Enlico Feb 06 '20 at 19:27
  • Interesting `man man`, refers to itself as a pager and less as an "output pager". I guess these are just semantics – jordanm Feb 06 '20 at 19:27
  • 1
    However I've removed that bit because it is wrong that you cannot pipe _from_ man. It's `vim` which does not take input from stdin, so you cannot pipe _into_ it (unless you use `vim -`). – Enlico Feb 06 '20 at 19:28
  • @jordanm, was that _less_ part of a joke? – Enlico Feb 06 '20 at 19:55
  • 1
    @EnricoMariaDeAngelis This is why you don't use lame puns to name your program :) – chepner Feb 06 '20 at 20:14