2

For example suppose I do a certain man or maybe a grep.

I want to see the results using gvim without the normal procedure of saving them first and opening the saved file [because I don't need the results once I view them]

I tried two ways, both the methods fail:

a)

man gcc | gvim
//opens a blank gvim window

b)

man gcc > gvim
//saves the result in a new file named "gvim"

Is there a way to do it?


Below is a copy paste of the first few lines of what I get using man gcc | gvim - or :r! man gcc :

(N^HNA^HAM^HME^HE is what the NAME looks like in gvim. I guess ^H is some non-displayable character, because it is not being displayed here on SO)

GCC(1)
GNU
GCC(1)

NNAAMMEE gcc - GNU project C and C++ compiler

SSYYNNOOPPSSIISS gcc [--cc|--SS|--EE] [--ssttdd==_s_t_a_n_d_a_r_d]

Lazer
  • 90,700
  • 113
  • 281
  • 364

5 Answers5

2

those are control characters. Here's one way to "get rid" of it

man gcc|col -b| gvim -
ghostdog74
  • 327,991
  • 56
  • 259
  • 343
2

See this answer that I have given to a similar question on prior occasion on SO, in that case do

man gcc | col -b | gvim -R -

Which takes the manual page for 'gcc', pipes it to 'col' with a switch '-p', then pipe it into 'gvim' opening the file as read-only using the dash '-' as taking in input from the previous pipe.

Community
  • 1
  • 1
t0mm13b
  • 34,087
  • 8
  • 78
  • 110
1

Try:

man gcc | gvim -

Here

  • man gcc writes its output to the stdout and
  • gvim - reads its input from its stdin and
  • the pile connects the stdout of man gcc to stdin of gvim
codaddict
  • 445,704
  • 82
  • 492
  • 529
1

You can try from within gvim:

:r! man gcc

Some more info here

ccheneson
  • 49,072
  • 8
  • 63
  • 68
  • same as what happens with `man gcc | gvim -`, the text is filled with a lot of `^H` characters. – Lazer Mar 09 '10 at 15:04
0

If you have your PAGER & EDITOR variables set up correctly:

export PAGER=less
export EDITOR=gvim

Then you can simply hit 'v' while viewing the man page in less.

pra
  • 8,479
  • 2
  • 18
  • 15