Currently I am outputting AWS help to vim, and then searching through it, but to my horror, I am realising displays underlines, for example, NAME will be displayed as:


Where ^H is the <C-V><C-H> (Ctrl V, Ctrl H), special character.

Removing ^H does not yield amazing results %s/^H//g:


Which still renders my document unreadable in many ways.

How do I deal with this problem in a sane way? I don't always want to have to clean output form the terminal before reading it in vim. I'm capturing allot of output from the cli for different purposes with Vim, and would love it if there was a setting in Vim to just forget about bold, italic, underlines etc.

  • 2
    See if the answer to stackoverflow.com/q/60106514/9447571 helps? Is AWS help that you're reading provided as man pages? – filbranden Feb 17 '20 at 7:41
  • 1
    Hi thanks, I also looked at AnsiEsc, but that only removed the control characters I think they are called, and leaves me with duplicates, I'll check that out. I was hoping there might be a mode in vim which could actually handle this 100%, piping to something to filter the output is a bit difficult because I will have to do that everywhere I access output from the shell which is all over the place. – Snickers3192 Feb 17 '20 at 9:21
  • 1
    AnsiEsc handles Ansi or xterm escape sequences and those are not really that... They're typically seen in man pages so that's why using a $MANPAGER variable to have man invoke Vim is usually the way to go here. If you get these to Vim through specific file paths, you could consider adding autocmd to match those and enable the behavior (possibly through the :MANPAGER command) when you enter Vim, that way you don't need to configure that outside of Vim anywhere. – filbranden Feb 17 '20 at 11:06
  • 2
    pipe it through col -b – Christian Brabandt Feb 17 '20 at 12:25
  • 1
    There’s code in the manpager scripts for vim to fix some of this. – D. Ben Knoble Feb 17 '20 at 14:10

Ripping from ftplugin/man.vim to deal with this kind of backspace-bold hack:


Using Christian's col solution:

:%!col -b

You can also just do

command that creates output | vim +MANPAGER -

Your Answer

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

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