Re: [PATCH] fix man page viewing with man-db

2011-07-25 Fir de Conversatie Bram Moolenaar

Mike Mcewan wrote:

 It's been a while since I reported a problem with the patch here and no 
 further comment has been made. I guess the majority of users out there are 
 probably using one of the pre-packaged versions of vim 7.3 and so this 
 problem hasn't come down the pipeline to hit them yet. I have seen one other 
 reference to the problem whilst browsing the web: 
 http://crumbtrail.chesmart.in/
 
 I still don't think the original patch was the right solution here, but 
 until someone comes up with a better solution, I wonder if the the following 
 patch could be applied?
 
 --- a/ftplugin/man.vim 2011-07-22 19:55:14.0 +0100
 +++ b/ftplugin/man.vim 2011-07-24 17:55:49.0 +0100
 @@ -17,7 +17,9 @@
  
 Ensure Vim is not recursively invoked (man-db does this)
 when doing ctrl-[ on a man page reference.
 -  let $MANPAGER = 
 +  if exists($MANPAGER)
 +let $MANPAGER = 
 +  endif
  
 allow dot and dash in manual page name.
setlocal iskeyword+=\.,-
 
 This patch maintains the fix for the original problem, but limits the 
 potential side effects to those that have a MANPAGER environment variable 
 actually defined.  

Thanks.  Since SungHyun Nam agreed I'll include this.

-- 
MORTICIAN:What?
CUSTOMER: Nothing -- here's your nine pence.
DEAD PERSON:  I'm not dead!
MORTICIAN:Here -- he says he's not dead!
CUSTOMER: Yes, he is.
DEAD PERSON:  I'm not!
  The Quest for the Holy Grail (Monty Python)

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org///
 \\\help me help AIDS victims -- http://ICCF-Holland.org///

-- 
You received this message from the vim_dev 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


Re: [PATCH] fix man page viewing with man-db

2011-07-25 Fir de Conversatie Elias Toivanen

Hello,

I've also experienced man.vim crashing when $MANPAGER had been already
defined to `col -b | vim -R -' in .bashrc. I took a look at the man.vim
file and came up with the following idea.

Instead of asking if $MANPAGER was defined, why not define it
temporarily for the call. It's possible to do this via

let tmp = tempname()
let $MANWIDTH = tw ? tw : 80
let manpager  = shellescape('less -s')  Fixes problems when user has 
defined $MANPAGER
silent execute !MANPAGER=.manpager. /usr/bin/man .args.| col -b  
.tmp
silent execute pedit .tmp

See the attachment for the complete reimplementation of GetPage(). I
also wanted to fix a couple of subtle shortcomings of the original script.

In my opinion, viewing man pages should mimic reading help pages which
is already reflected nicely in the mappings C-] and C-t. However, it
would also be nice to be able to double click the topics as one can do
in help files.

Man pages should also be closed when the last writable buffer is closed
in the current tab page, as is the case with help files. Now the user is
potentially left with two windows to the same shell script. The first
was used to spawn a man page via LeaderK for example and the second
appeared unintentionally when the user rewinded man pages one time too
many.

Finally, all man pages shouldn't be only 'readonly' but also
'nomodifiable'.

All of these aspects are taken care of in the script you'll find in the
attachment. I post it to your consideration.


On Mon, 25 Jul 2011, Bram Moolenaar wrote:



Mike Mcewan wrote:


It's been a while since I reported a problem with the patch here and no
further comment has been made. I guess the majority of users out there are
probably using one of the pre-packaged versions of vim 7.3 and so this
problem hasn't come down the pipeline to hit them yet. I have seen one other
reference to the problem whilst browsing the web:
http://crumbtrail.chesmart.in/

I still don't think the original patch was the right solution here, but
until someone comes up with a better solution, I wonder if the the following
patch could be applied?

--- a/ftplugin/man.vim 2011-07-22 19:55:14.0 +0100
+++ b/ftplugin/man.vim 2011-07-24 17:55:49.0 +0100
@@ -17,7 +17,9 @@

Ensure Vim is not recursively invoked (man-db does this)
when doing ctrl-[ on a man page reference.
-  let $MANPAGER = 
+  if exists($MANPAGER)
+let $MANPAGER = 
+  endif

allow dot and dash in manual page name.
   setlocal iskeyword+=\.,-


--
Elias Toivanen elias.toiva...@helsinki.fi

--
You received this message from the vim_dev 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
 Vim filetype plugin file
 Language: man
 Maintainer:   SungHyun Nam gow...@gmail.com
 Last Change:  Sun 24 Jul 2011 01:13:42 AM EEST
 Contributors: Elias Toivanen

 --
NOTES  
   
* Prevents all modifications of man pages and represents them  
  as `preview windows'. Man pages are not listed in the buffer 
  list and become hidden when closed.  
   
* Filetype specific mappings mimic those in Vim's help files.  
  c-] jumps to the topic under under cursor, whereas c-t   
  takes you back. You can also double click topics and 
  press C-RigthMouse to achieve the same results.
   
* Provides two commands :Man and :Whatis and two corresponding 
  global mappings LeaderK and LeaderW that are enabled 
  by appending 
   
ru ftplugin/man.vim
   
  to .vimrc. The variable `mapleader' has to be defined to 
  make the mappings effective. The first command takes two 
  arguments `section' and `page', first of which is optional.  
  A preview window with the man page of `page' is opened if found. 
  The second command accepts one argument `page' and displays  
  a short description of the command in the commandline. Mappings  
  achieve the same results except the `section' and `page' arguments   
  are found by inspecting the word under the cursor. 
   
* Use Vim as your 

Re: [PATCH] fix man page viewing with man-db

2011-07-25 Fir de Conversatie James Vega
On Mon, Jul 25, 2011 at 11:50:39PM +0300, Elias Toivanen wrote:
 Hello,
 
 I've also experienced man.vim crashing when $MANPAGER had been already
 defined to `col -b | vim -R -' in .bashrc. I took a look at the man.vim
 file and came up with the following idea.
 
 Instead of asking if $MANPAGER was defined, why not define it
 temporarily for the call. It's possible to do this via
 
 let tmp = tempname()
 let $MANWIDTH = tw ? tw : 80
 let manpager  = shellescape('less -s')  Fixes problems when user has 
 defined $MANPAGER
 silent execute !MANPAGER=.manpager. /usr/bin/man .args.| col -b 
  .tmp

Using !env MANPAGER= is better as not all shells support declaring
environment variables to use for a command invocation like that.

-- 
James
GPG Key: 1024D/61326D40 2003-09-02 James Vega james...@jamessan.com


signature.asc
Description: Digital signature


Re: [PATCH] fix man page viewing with man-db

2011-07-24 Fir de Conversatie MikeM
It's been a while since I reported a problem with the patch here and no 
further comment has been made. I guess the majority of users out there are 
probably using one of the pre-packaged versions of vim 7.3 and so this 
problem hasn't come down the pipeline to hit them yet. I have seen one other 
reference to the problem whilst browsing the web: 
http://crumbtrail.chesmart.in/

I still don't think the original patch was the right solution here, but 
until someone comes up with a better solution, I wonder if the the following 
patch could be applied?

--- a/ftplugin/man.vim 2011-07-22 19:55:14.0 +0100
+++ b/ftplugin/man.vim 2011-07-24 17:55:49.0 +0100
@@ -17,7 +17,9 @@
 
Ensure Vim is not recursively invoked (man-db does this)
when doing ctrl-[ on a man page reference.
-  let $MANPAGER = 
+  if exists($MANPAGER)
+let $MANPAGER = 
+  endif
 
allow dot and dash in manual page name.
   setlocal iskeyword+=\.,-

This patch maintains the fix for the original problem, but limits the 
potential side effects to those that have a MANPAGER environment variable 
actually defined.  

-- 
You received this message from the vim_dev 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


Re: [PATCH] fix man page viewing with man-db

2011-07-24 Fir de Conversatie SungHyun Nam

MikeM wrote:

It's been a while since I reported a problem with the patch here and no
further comment has been made. I guess the majority of users out there
are probably using one of the pre-packaged versions of vim 7.3 and so
this problem hasn't come down the pipeline to hit them yet. I have seen
one other reference to the problem whilst browsing the web:
http://crumbtrail.chesmart.in/

I still don't think the original patch was the right solution here, but
until someone comes up with a better solution, I wonder if the the
following patch could be applied?

--- a/ftplugin/man.vim2011-07-22 19:55:14.0 +0100
+++ b/ftplugin/man.vim2011-07-24 17:55:49.0 +0100
@@ -17,7 +17,9 @@
 Ensure Vim is not recursively invoked (man-db does this)
 when doing ctrl-[ on a man page reference.
- let $MANPAGER = 
+ if exists($MANPAGER)
+ let $MANPAGER = 
+ endif
 allow dot and dash in manual page name.
setlocal iskeyword+=\.,-

This patch maintains the fix for the original problem, but limits the
potential side effects to those that have a MANPAGER environment
variable actually defined.


I have no objection to this patch. so, Ack.

BTW, I'm not sure man.vim should include such lines at all.  Original 
reporter already found a workaround for his problem.  And his patch 
caused side-effect for others.


Regards,
namsh

--
You received this message from the vim_dev 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


Re: [PATCH] fix man page viewing with man-db

2011-02-02 Fir de Conversatie MikeM
This patch causes /usr/bin/man to fail on Mac OS X:

sh: -c: line 0: syntax error near unexpected token `||'
sh: -c: line 0: `(cd '/usr/share/man'  (echo .ll 13.0i; echo .nr LL 
13.0i; /usr/bin/gunzip -c '/usr/share/man/man1/man.1.gz') | /usr/bin/tbl | 
/usr/bin/groff -Wall -mtty-char -Tascii -mandoc -c | ( || true))'
Error executing formatting or display command.
System command (cd '/usr/share/man'  (echo .ll 13.0i; echo .nr LL 
13.0i; /usr/bin/gunzip -c '/usr/share/man/man1/man.1.gz') | /usr/bin/tbl | 
/usr/bin/groff -Wall -mtty-char -Tascii -mandoc -c | ( || true)) exited with 
status 512.
No manual entry for man

It would appear that because MANPAGER has been set to null, null 
is substituted in the actual command that /usr/bin/man runs (just before the 
'||'). Please can a more comprehensive solution be found. Unfortunately vim 
does not appear to allow the removal of a variable from the environment 
altogether, only adding or setting one.


-- 
You received this message from the vim_dev 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


Re: [PATCH] fix man page viewing with man-db

2010-12-02 Fir de Conversatie Matt Wozniski
2010/11/29 Bram Moolenaar b...@moolenaar.net:

 Pádraig wrote:
     Ensure vim is not recursively invoked (man-db does this)
     when doing ctrl-[ on a man page reference

Shouldn't that be ctrl-] ?

-- 
You received this message from the vim_dev 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


[PATCH] fix man page viewing with man-db

2010-11-29 Fir de Conversatie Pádraig Brady
Fedora 14 switched to man-db for handling man pages.
Ubuntu has been using it for ages.
On older versions of Fedora I was able to just
add this to my .bashrc to have full man page
functionality, (with drill down) using vim

export MANPAGER='bash -c vim -MRn -c \set ft=man nomod nolist nospell nonu\ \
-c \nm q :qa!CR\ -c \nm end G\ -c \nm home gg\/dev/tty (col -b)'

(if pasting that in a terminal make sure to \ the ! in the second line)

The above works fine for man-db too, except when using Ctrl-[
to drill down into sub man pages. In that case man-db will
run the output through $MANPAGER again, even though the
output is not a tty. That would cause various vim errors
and hangups.  I was able to work around this in my ~/.vimrc with:

augroup man
au!
Ensure vim is not recursively invoked (man-db does this)
when doing ctrl-[ on a man page reference
au FileType man let $MANPAGER=
augroup END

So rather than doing that, the patch below
just does the same in man.vim

cheers,
Pádraig.

--- /usr/share/vim/vim73/ftplugin/man.vim   2010-11-29 10:00:14.392636934 
+
+++ man.vim 2010-11-29 10:00:07.233636869 +
@@ -15,6 +15,10 @@
   endif
   let b:did_ftplugin = 1

+  Ensure vim is not recursively invoked (man-db does this)
+  when doing ctrl-[ on a man page reference
+  let $MANPAGER=
+
allow dot and dash in manual page name.
   setlocal iskeyword+=\.,-

-- 
You received this message from the vim_dev 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


Re: [PATCH] fix man page viewing with man-db

2010-11-29 Fir de Conversatie Bram Moolenaar

Pádraig wrote:

 Fedora 14 switched to man-db for handling man pages.
 Ubuntu has been using it for ages.
 On older versions of Fedora I was able to just
 add this to my .bashrc to have full man page
 functionality, (with drill down) using vim
 
 export MANPAGER='bash -c vim -MRn -c \set ft=man nomod nolist nospell 
 nonu\ \
 -c \nm q :qa!CR\ -c \nm end G\ -c \nm home gg\/dev/tty (col 
 -b)'
 
 (if pasting that in a terminal make sure to \ the ! in the second line)
 
 The above works fine for man-db too, except when using Ctrl-[
 to drill down into sub man pages. In that case man-db will
 run the output through $MANPAGER again, even though the
 output is not a tty. That would cause various vim errors
 and hangups.  I was able to work around this in my ~/.vimrc with:
 
 augroup man
 au!
 Ensure vim is not recursively invoked (man-db does this)
 when doing ctrl-[ on a man page reference
 au FileType man let $MANPAGER=
 augroup END
 
 So rather than doing that, the patch below
 just does the same in man.vim

Thanks, I'll include it.

-- 
It is too bad that the speed of light hasn't kept pace with the
changes in CPU speed and network bandwidth. -- wie...@porcupine.org

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org///
 \\\help me help AIDS victims -- http://ICCF-Holland.org///

-- 
You received this message from the vim_dev 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