Re: man -> vim

2019-02-15 Thread Andreas Kusalananda Kähäri
On Fri, Feb 15, 2019 at 11:19:57AM +0100, Oleg Pahl wrote:
> Hi @all,
> 
> Today I try to work with man pages using *vim*.
> 
> *# man man | vim -*
> 
> why i see raw (a lot of special char.) data by default? is it ok?
> 
> *# ma man | less *
> 
> I see no special characters. looks very good.
> 
> Is it possible to convert *raw* data of man page to normal format (for
> *vim*) with one command?
> 
> BR,
> 
> -op

man man | col -b | vim -

See the col(1) manual.  This is also mentioned in the mandoc(1) manual,
in the "ASCII Output" section.


-- 
Andreas Kusalananda Kähäri,
National Bioinformatics Infrastructure Sweden (NBIS),
Uppsala University, Sweden.



Re: man -> vim

2019-02-15 Thread Oleg Pahl

Perfect !

Thanks all !

On 2/15/19 11:35 AM, Otto Moerbeek wrote:

On Fri, Feb 15, 2019 at 11:19:57AM +0100, Oleg Pahl wrote:


Hi @all,

Today I try to work with man pages using *vim*.

*# man man | vim -*

why i see raw (a lot of special char.) data by default? is it ok?

*# ma man | less *

I see no special characters. looks very good.

Is it possible to convert *raw* data of man page to normal format (for
*vim*) with one command?

BR,

-op


Pipe through col -b

-Otto




Re: man -> vim

2019-02-15 Thread Otto Moerbeek
On Fri, Feb 15, 2019 at 11:19:57AM +0100, Oleg Pahl wrote:

> Hi @all,
> 
> Today I try to work with man pages using *vim*.
> 
> *# man man | vim -*
> 
> why i see raw (a lot of special char.) data by default? is it ok?
> 
> *# ma man | less *
> 
> I see no special characters. looks very good.
> 
> Is it possible to convert *raw* data of man page to normal format (for
> *vim*) with one command?
> 
> BR,
> 
> -op
> 

Pipe through col -b

-Otto



Re: man -> vim

2019-02-15 Thread Martijn van Duren
On 2/15/19 11:19 AM, Oleg Pahl wrote:
> Hi @all,
> 
> Today I try to work with man pages using *vim*.

What do you mean with work with? Do you mean you want to edit them, or
you want to read them?
If you want to edit them, just edit the source
/usr/src/usr.bin/mandoc/man.1 (you need to have a local copy of the
repo).
> 
> *# man man | vim -*
> 
> why i see raw (a lot of special char.) data by default? is it ok?

Yes, those chars are used to create the pretty formatting (e.g. bold
printing or underlining).
> 
> *# ma man | less *
> 
> I see no special characters. looks very good.

less doesn't interpret those characters and blindly forwards them to
the terminal, allow you to see nicely formatted text.
> 
> Is it possible to convert *raw* data of man page to normal format (for *vim*) 
> with one command?
> 
I'm not 100% sure what you want to do, but if you want it to be a
little more readable in vim, the following command helps:
:%s/.^H//g
Note that ^H can be achieved via control+v+h
> BR,
> 
> -op
> 
martijn@