How do I replace or find non-printable characters in vim regex?

Say you want to replace ^C with C:

:%s/CtrlVC/C/g

Where CtrlVC means type V then C while holding Ctrl pressed.

CtrlV lets you enter control characters.


Removing control symbols only:

:%s/[[:cntrl:]]//g

Removing non-printable characters (note that in versions prior to ~8.1.1 this removes non-ASCII characters also):

:%s/[^[:print:]]//g

The difference between them could be seen if you have some non-printable-non-control characters, e.g. zero-width space:

enter image description here