Issue with PAGER and MANPAGER
dpo opened this issue · 6 comments
Hi. Thanks for a great plugin! I really enjoy all your tmux plugins!
I'm having an issue with Shift-K
that I believe may be more due to Vim itself than to your plugin, but you'll probably be able to tell. I have overridden PAGER
and MANPAGER
in my ~/.bashrc
(to use Vim actually) like so:
export PAGER=/Users/dpo/bin/Less.sh # this basically just calls macros/less.vim
export MANPAGER="col -bx | view -c 'set ft=man nomod nolist' -c 'runtime! macros/less.vim' -"
If I hit Shift-K
in my ~/.tmux.conf
, I get the error
Vim: Warning: Output is not to a terminal
Vim: Warning: Input is not from a terminal
^M
?1000h?1049h?1h27m23mm94m100mH2J?25l24;1H"-stdin-" [readonly] 1763L, 101104C1;24r?12;25h?12l?25h27m23mm94m100mH2J?1000lVim: Reading from stdin...
?1000h94m100m24;1H?1000lm94m100m39;49m?1l?12l?25h?1049lVim: Error reading input, exiting...
Vim: Reading from stdin...
Vim: Finished.
24;1H27m23mm94m100m39;49m
I believe this isn't related to your plugin because if I open any file in Vim, and execute
:runtime! ftplugin/man.vim
:Man tmux
I get the same error.
Now I see this bit in ftplugin/man.vim
:
if exists("$MANPAGER")
let $MANPAGER = ""
endif
The man page for man
says that it first checks for MANPAGER
, and if not set, it then checks for PAGER
. So I added
if exists("$PAGER")
let $PAGER = ""
endif
and all goes well. Is that an omission of man.vim
? Or did I miss something in the configuration steps?
I'm using vim 7.4.712 on OSX.
Thanks in advance!
Hey @dpo,
thanks for reporting. I must say I'm not very knowledgeable about this, but it seems you're right: man.vim
shouldn't depend on user config where not necessary.
I suggest reporting this to man.vim
maintainer. You can find his email in ftplugin/man.vim
file header (I won't paste it here for spam reasons). I contacted the guy once and he was pretty responsive.
Let me know if you find anything new about this!
Hey @dpo,
I was thinking about this problem and actually I'm not sure if setting the $PAGER
to blank value is a good thing to do here. If that's done that affects all the programs executed from vim. This seems to have some nasty side effects. Here's the example:
- unset
PAGER
env var in vim with::let $PAGER=''
- now running programs that require a pager results in an error. Examples:
:!man bash
and:!ri to_a
(ri is a ruby docs browser)
Do you also get errors when executing the above steps?
If yes, I'm afraid this is not a theoretical issue. ri
program is set as the default keywordprg
for ruby files and I think man
is vim's default (so many users in both cases). Could it happen all those users get an error if they hit <shift>k
after they have loaded man.vim
(and PAGER was set to empty string)?
@bruno- I'm afraid you're right. I also get an error message. Something is wrong because the manpage for man
states that if neither MANPAGER
nor PAGER
are set, then man
uses /usr/bin/less -is
, so it's not clear to me why less
isn't being invoked.
A possible solution would be for man.vim
to always invoke man
with -P
to specify a particular pager and override MANPAGER
and PAGER
without unsetting them.