Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

To use Vim as a pager for man I have

export MANPAGER="/usr/share/vim/vim73/macros/manpager.sh"

in my profile. Now man pages look very good with colors and stuff. However, when trying man ascii as a way of looking at the ASCII table, I notice that the table is mis-aligned as in the screenshot below:

Messed up ASCII table

This problem doesn't happen to the default pager. When I set export MANPAGER="view -" the table is also correct, so something must be wrong with the manpager.sh script:

#!/bin/sh
sed -e 's/\x1B\[[[:digit:]]\+m//g' | col -b | \
vim \
    -c 'let no_plugin_maps = 1' \
    -c 'set nolist nomod ft=man' \
    -c 'let g:showmarks_enable=0' \
    -c 'runtime! macros/less.vim' -

How can I fix this?

share|improve this question
    
It works for me (Vim 7.1pl314 on Debian lenny or 7.2pl330 on Ubuntu 10.04, C or en_US or en_US.UTF-8 locale, in xterm). What are your locale settings? In what terminal are you running this, and do other terminals make a difference? What is your version of Vim, what options was it compiled with? Does disabling your .vimrc with vim -u /dev/null make a difference? –  Gilles Feb 19 '11 at 15:15

1 Answer 1

up vote 4 down vote accepted

When I try with the following script things are normal:

#!/bin/sh
sed -e 's/\x1B\[[[:digit:]]\+m//g' | \
vim \
    -c 'let no_plugin_maps = 1' \
    -c 'set nolist nomod ft=man' \
    -c 'let g:showmarks_enable=0' \
    -c 'runtime! macros/less.vim' -

I'm not sure what role col plays in the sequence, but it is certainly messing up the spaces. Until somebody gives a better solution, this will be my fix.

Edit: so col was the problem because it "replaces white-space characters with tabs where possible". To fix this tell col to use spaces instead of tabs with the -x option. The final config is as follow (with credit to Gilles).

#!/bin/sh
sed -e 's/\x1B\[[[:digit:]]\+m//g' | col -bx | \
vim \
    -c 'let no_plugin_maps = 1' \
    -c 'set nolist nomod ft=man' \
    -c 'let g:showmarks_enable=0' \
    -c 'runtime! macros/less.vim' -
share|improve this answer
    
I wrote my comment on your question before I saw your answer. So maybe the version or configuration of col is the culprit. col replaces spaces with tabs, so it's easy to see why it would influence column alignment. I don't know what could have gone wrong though. –  Gilles Feb 19 '11 at 15:16
    
@Gilles Where is the configuration file for col? I looked in /etc/ but no file name starts with "col". –  phunehehe Feb 19 '11 at 15:25
    
Now that I think of it, there shouldn't be any configuration for col (neither compile-time nor run-time). col was standardized in earlier versions of Single Unix. Does col -bx solve the problem? What about col -bp? –  Gilles Feb 19 '11 at 15:30
    
@Gilles col -bx works (col -bp does not)! Do you want to make that another answer? –  phunehehe Feb 19 '11 at 15:37
    
You thought the problem might be col, so just edit your answer. –  Gilles Feb 19 '11 at 16:04

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.