I've got the following vim script to show a perldoc or per man page into a new tab and then rewrap it the text so it's more readable (I have a very wide monitor).

nnoremap K :execute "tabnew <bar> read !man " . expand("<cword>") . " <bar><bar>" . " perldoc " . expand("<cword>") . " <bar><bar>" . " perldoc -f " . expand("<cword>") . " <bar><bar> " . " perldoc -q " . expand("<cword>")<cr>1G:set tw=80<cr>gggqGgg`

The problem is that UTF-8 characters from the man pages appear to be getting mangled. How do I modify the read command or change the tab's settings to properly display these characters?

  • 3
    try to :set fenc=utf-8 after the tabnew
    – Naumann
    Dec 7 '17 at 1:38
  • Ah, got it. I had to follow it with a <bar> character.
    – StevieD
    Dec 7 '17 at 2:11
  • 2
    @StevieD if you found a solution to your problem you can post an answer to your own question and accept it: that will help further readers encountering the same issue :)
    – statox
    Dec 7 '17 at 10:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.