man -> vim

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

man -> vim

Dr. COD
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

Reply | Threaded
Open this post in threaded view
|

Re: man -> vim

Martijn van Duren-5
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@

Reply | Threaded
Open this post in threaded view
|

Re: man -> vim

Otto Moerbeek
In reply to this post by Dr. COD
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

Reply | Threaded
Open this post in threaded view
|

Re: man -> vim

Dr. COD
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

Reply | Threaded
Open this post in threaded view
|

Re: man -> vim

Andreas Kusalananda Kähäri-4
In reply to this post by Dr. COD
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.