Quantcast

Manpage inside Vim

classic Classic list List threaded Threaded
16 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Manpage inside Vim

Ajay Jain
Hi,

I want to be able to open a manpage using VIM without exiting it. For
example .. I want to able to do something like:

vim dumm.c
:tabe **** man ls .****

Is this possible?

Regards,
Ajay.

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Manpage inside Vim

Daniel Corrêa
On 02/02/11 10:19, Ajay Jain wrote:

> Hi,
>
> I want to be able to open a manpage using VIM without exiting it. For
> example .. I want to able to do something like:
>
> vim dumm.c
> :tabe **** man ls .****
>
> Is this possible?
>
> Regards,
> Ajay.
>
Try:

     :tabnew | silent !man <thing>

Cheers,
     Daniel

------------------------------------------------------------
Daniel Corrêa
+55 (45) 9938.3993
http://about.me/dnlcorrea

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Manpage inside Vim

Steve Laurie-2
In reply to this post by Ajay Jain
On 02/02/11 23:19, Ajay Jain wrote:

> Hi,
>
> I want to be able to open a manpage using VIM without exiting it. For
> example .. I want to able to do something like:
>
> vim dumm.c
> :tabe **** man ls .****
>
> Is this possible?
>
> Regards,
> Ajay.
>
If you put the cursor on the word/statement/command for example "use the
ls command to list ..."

In command mode, you can put the cursor on the word ls and press the
Ctrl K key combination and the ls manpage will open up.
This is handy for C/C++ commands.




--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Manpage inside Vim

Marco
In reply to this post by Daniel Corrêa
On 2011-02-02 Daniel Corrêa <[hidden email]> wrote:

> Try:
>
>      :tabnew | silent !man <thing>

If i execute !man ls I get the message:

WARNING: terminal is not fully functional

and the displayed man page looks distorted in gvim. Why? I opened up
(gnome-terminal, urxvt, xterm) opened gvim and executed !man ls

If I open vim and execute !man ls everything is fine.

Regards
Marco


--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Manpage inside Vim

sergio-2
In reply to this post by Ajay Jain
On 02/02/2011 03:19 PM, Ajay Jain wrote:

> I want to be able to open a manpage using VIM without exiting it.

Have you tied to find answer by yourself?

I've newer thought to read man from vim, but have found answer in five
seconds:
:help :Man

It it not very difficult, right?

--
sergio.

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Manpage inside Vim

Joan Miquel Torres Rigo
In reply to this post by Marco
2011/2/2 Marco <[hidden email]>:

> On 2011-02-02 Daniel Corrêa <[hidden email]> wrote:
>
>> Try:
>>
>>      :tabnew | silent !man <thing>
>
> If i execute !man ls I get the message:
>
> WARNING: terminal is not fully functional
>
> and the displayed man page looks distorted in gvim. Why?

This is not (exactly) a vim issue but man pager's (typically 'less') one.

Gvim isn't terminal application and you probably did'nt call it from
terminal but from some Gui menu, icon or "command-line popup" which
aren't terminals and doesn't export any value for TERM environment
variable.

less reads this value to ensure that terminal is fully functional and
fails to comatibility mode when not recognize the TERM value.

Did you try to run gvim from terminal and try again?

In any case, you could avoid this problem by specifying TERM value in
command line or setting this environment variable from within vim (I
don't know, but must be possible).

Fore example:
:!TERM=xterm man ls



--
Joan Miquel Torres__________________________________
Linux Registered User #164872
http://www.mallorcaweb.net/joanmiquel
BULMA: http://bulma.net http://breu.bulma.net/?l2301

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Manpage inside Vim

Christian Brabandt
On Wed, February 2, 2011 3:04 pm, Joan Miquel Torres Rigo wrote:
> Did you try to run gvim from terminal and try again?
>
> In any case, you could avoid this problem by specifying TERM value in
> command line or setting this environment variable from within vim (I
> don't know, but must be possible).
>
> Fore example:
> :!TERM=xterm man ls

I doubt this changes anything for X11 gvim. See :h gui-shell and
:h gui-pty

regards,
Christian


--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Manpage inside Vim

Charles Campbell
In reply to this post by Ajay Jain
Ajay Jain wrote:

> Hi,
>
> I want to be able to open a manpage using VIM without exiting it. For
> example .. I want to able to do something like:
>
> vim dumm.c
> :tabe **** man ls .****
>
> Is this possible?
>    
Perhaps Manpageview will do what you want;  :Man ls

Manpageview is available at:

     http://mysite.verizon.net/astronaut/vim/index.html#MANPAGEVIEW   
(cutting edge)
     http://vim.sourceforge.net/scripts/script.php?script_id=489     
(stable)

Installation is simple:
     vim manpageview.vba.gz
     :so %
     :q

Regards,
Chip Campbell

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Manpage inside Vim

Daniel Corrêa
In reply to this post by sergio-2
On 02/02/11 12:03, sergio wrote:

> On 02/02/2011 03:19 PM, Ajay Jain wrote:
>
>> I want to be able to open a manpage using VIM without exiting it.
>
> Have you tied to find answer by yourself?
>
> I've newer thought to read man from vim, but have found answer in five
> seconds:
> :help :Man
>
> It it not very difficult, right?
>
You don't need to patronize him to tell him that he should try a little
harder next time.

Regards,
     Daniel

--
------------------------------------------------------------
Daniel Corręa
+55 (45) 9938.3993
http://about.me/dnlcorrea

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Manpage inside Vim

Marco
In reply to this post by Joan Miquel Torres Rigo
On 2011-02-02 Joan Miquel Torres Rigo <[hidden email]> wrote:

> Gvim isn't terminal application and you probably did'nt call it from
> terminal
Yes, I did call it from gnome-terminal, urxvt and xterm.

> aren't terminals and doesn't export any value for TERM environment
> variable.
TERM is set to xterm.

> Did you try to run gvim from terminal and try again?
>
> In any case, you could avoid this problem by specifying TERM value in
> command line or setting this environment variable from within vim (I
> don't know, but must be possible).
>
> Fore example:
> :!TERM=xterm man ls
Doesn't work, either.

Regards
Marco


--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Manpage inside Vim

Joan Miquel Torres Rigo
2011/2/2 Marco <[hidden email]>:
> On 2011-02-02 Joan Miquel Torres Rigo <[hidden email]> wrote:
>
>> Gvim isn't terminal application and you probably did'nt call it from
>> terminal
> Yes, I did call it from gnome-terminal, urxvt and xterm.
>
>> aren't terminals and doesn't export any value for TERM environment
>> variable.
> TERM is set to xterm.

Of course,

as Christian said, gvim don't use external terminal emulator but its
own one and it is not fully functional.

I didn't know that because I never use gvim (I prefer console-vim in
real terminal emulator).

Anyway, in this case, if TERM is set to xterm, then less will think
that terminal is fully functional.

This will not resolve the problem, but if you set TERM to something
like 'dumb', less will function in more compatible way.


Although, would be better solution if gvim let to change the used
terminal emulator. But I figure out that it wouldn't be pssible.

>> Fore example:
>> :!TERM=xterm man ls
> Doesn't work, either.

Ok. But try now with 'dumb'.


Regards.

--
Joan Miquel Torres__________________________________
Linux Registered User #164872
http://www.mallorcaweb.net/joanmiquel
BULMA: http://bulma.net http://breu.bulma.net/?l2301

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Manpage inside Vim

Marco
On 2011-02-03 Joan Miquel Torres Rigo <[hidden email]> wrote:

> >> aren't terminals and doesn't export any value for TERM environment
> >> variable.
> > TERM is set to xterm.
>
> Of course,
>
> as Christian said, gvim don't use external terminal emulator but its
> own one and it is not fully functional.

Now I understand.

> I didn't know that because I never use gvim (I prefer console-vim in
> real terminal emulator).
>
> Anyway, in this case, if TERM is set to xterm, then less will think
> that terminal is fully functional.
>
> This will not resolve the problem, but if you set TERM to something
> like 'dumb', less will function in more compatible way.

It seems to act the same.

> >> Fore example:
> >> :!TERM=xterm man ls
> > Doesn't work, either.
>
> Ok. But try now with 'dumb'.

Same result.

Marco


--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Manpage inside Vim

Joan Miquel Torres Rigo
2011/2/3 Marco <[hidden email]>:
>> Anyway, in this case, if TERM is set to xterm, then less will think
>> that terminal is fully functional.

This is one of the reasons for which I dislike gvim.


>
>> >> Fore example:
>> >> :!TERM=xterm man ls
>> > Doesn't work, either.
>>
>> Ok. But try now with 'dumb'.
>
> Same result.

Maybe you can try a slightly different strategy like

:tabedit | :r ! man ls


Regards.

--
Joan Miquel Torres__________________________________
Linux Registered User #164872
http://www.mallorcaweb.net/joanmiquel
BULMA: http://bulma.net http://breu.bulma.net/?l2301

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Manpage inside Vim

Marco
On 2011-02-03 Joan Miquel Torres Rigo <[hidden email]> wrote:

> >> >> Fore example:
> >> >> :!TERM=xterm man ls
> >> > Doesn't work, either.
> >>
> >> Ok. But try now with 'dumb'.
> >
> > Same result.
>
> Maybe you can try a slightly different strategy like
>
> :tabedit | :r ! man ls

Works. Thanks

Marco


--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Manpage inside Vim

Bee-16
On Feb 3, 6:12 am, Marco <[hidden email]> wrote:

> On 2011-02-03 Joan Miquel Torres Rigo <[hidden email]> wrote:
>
> > >> >> Fore example:
> > >> >> :!TERM=xterm man ls
> > >> > Doesn't work, either.
>
> > >> Ok. But try now with 'dumb'.
>
> > > Same result.
>
> > Maybe you can try a slightly different strategy like
>
> > :tabedit | :r ! man ls
>
> Works. Thanks
>
> Marco

When I try that, formatting control characters are shown.

I have add the following function to  .profile  then from a terminal
command line it makes a clean text file in terminal vim. Maybe parts
of it can be incorporated in the command from Joan Miquel Torres Rigo.

vman() { man "$@" | col -bx | iconv -c | vim -c 'set ft=man nomod
nolist' -; }

col -- filter reverse line feeds from input
-b  Do not output any backspaces,
    printing only the last character written to each column position.
-x  Output multiple spaces instead of tabs.

iconv -- character set conversion
-c  When this option is given,
    characters that cannot be converted are silently discarded,
    instead of leading to a conversion error.

-Bill

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Manpage inside Vim

scott-268
On Thursday 03 February 2011 09:57:34 Bee wrote:

> I have add the following function to  .profile  then from a
> terminal command line it makes a clean text file in terminal
> vim. Maybe parts of it can be incorporated in the command
> from Joan Miquel Torres Rigo.

> vman() { man "$@" | col -bx | iconv -c | vim -c 'set ft=man
> nomod nolist' -; }

that's really cool -- is that a tip?  i know i've seen
something like this before but this one works (i put mine in
my ~/.bashrc) and (thanx to my CSASnapshot) has cool syntax
highlighting i'm not used to seeing on man pages

one question:  when man has a choice to make as to which group
to show the manpage from you lose the ability to see the
message and make a choice -- apparently man is one of those
utilities that changes behavior when it senses its output is
being sent to a pipe -- anyone have a way around that?

admittedly, most often the one i want to see is the first one,
not the posix one, but sometimes a language specific page is
the one i want to see, like maybe the c++ one for printf

ok never mind -- i just tried

    vman 3 printf

and it brought it right up

cool beans Bee, i'll use this -- thanx

sc

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Loading...