I am trying to direct data from manpage to gvim file but it's not properly formatted.


  • In manpage it is shown as NAME (bold)
  • But in gvim its printed as N^HNA^HAM^HME^HE.
  • Similarly for SYNTAX it prints S^HSY^HYN^HNT^HTA^HAX^HX.
  • You can notice additional letter after(or before) ^H.

Please suggest how to correct this.
Also suggest if there is any other way of re-directing, so that it keeps the formatting intact.

  • 3
    Unix and gvim are not file formats: one is an OS standard and the other an editor. Can you clarify (1) the exact steps you take to see the differences; (2) where the file comes from; and (3) what you mean by direct data from unix to gvim? I’ve seen similar things in man pages before for bolding effects. – D. Ben Knoble Jun 10 '19 at 14:07
  • Hello D.BenKnoble, sorry for not providing enough clarification. Your assumption is correct. This issue I am facing is of printing data of 'Manpage' to gvim editor, where it is creating formatting issue. – vikas Jun 11 '19 at 6:33
  • 1
    Shouldn't need an extra command. If you're using GNU tools then why not just man --ascii? (Other implementations should have some another way of dumping plain text if they don't have that flag. ) And, btw, you can't "preserve formatting" in any native way. Vim is a (plain) text editor. – B Layer Jun 11 '19 at 8:37
  • 1
    @vikas try my answer using vim’s native man page environment. – D. Ben Knoble Jun 11 '19 at 12:09

I suppose you are trying to capture the output from a program and open it on gVim... If that's the case, I'm afraid you will need to open the file with the output and then remove those ^H and the repeated character that follows it.



%s/ substitute in all lines:

\v uses very magic mode (see :help /magic)

(.)^H\1 searchs for one character followed by ^H and then by itself again (a^Ha, for example); note that in order to enter ^H you need to press ^V (or ^Q if you were on a Windows machine) and then ^H

/\1/g replace all the occurrences with the first character

PS: A long time ago, in order to print bold characters you would need to print it, than send a backspace and print it again; well, ^H is that backspace character.

  • Indeed, the man and manpager plugin files that ship with vim do something similar – D. Ben Knoble Jun 10 '19 at 18:02
  • Hello João A. Toledo. Thanks a lot for your input. Your assumption is on point. But command you provided is not working. Error reported is "Pattern not found \v(.)^H\1 ". – vikas Jun 11 '19 at 6:40
  • Good to know that you solved your problem in another way. Regarding the fact that it didn't find the pattern: maybe you didn't entered ^H by pressing Ctrl+V and then Ctrl+H? – João A. Toledo Jun 11 '19 at 13:22

Since the OP is dealing directly with manpages, I suggest

:runtime plugin/man.vim

(Which can be put in startup files), followed by

:Man command

Also see help MANPAGER


I got the solution.

man <command> | col -b > <file>

This command dumps the file without ^H and one extra character.
Drawback: bold letters are not bold, but at-least gvim file is now readable.


if you use vim in mac could do following in command enter mode:

Contrl + Q, Control + H

it will generate ^H in line.

  • 1
    Welcome to the forum! I think the OP is trying to prevent these characters to appear. How does this answer his question? – Biggybi Feb 6 at 9:22
  • If OP cannot type ^H in command how to remove it, this is why I post. Type ^h in command and then use %s/^h//g to remove it all, few people know how to type special symbol in vim, got it? – user613826 Feb 6 at 10:48
  • 1
    Oh, I get it now. So this is about the same as this answer, isn't it? – Biggybi Feb 6 at 13:05
  • You might want to edit your answer to give the example of using it in a :s command to enter the ^H. See also :help c_CTRL-Q. Also note that it's equivalent to CTRL-V, which I'd say is more standard for this purpose (personally I'd recommend using CTRL-V instead of CTRL-Q). – filbranden Feb 6 at 15:30
  • @Biggybi why not try it in mac, %s/\v(.)^H\1/\1/g not work in mac. Instead, :%s/^H//g works fine. – user613826 Feb 6 at 15:58

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.