I am using vim to write a document in Latex. I have to replace a regex with the italic code, which is \textit{regex}. I use the Vim code:


But the \t expression is interpreted as a tab.

Would anyone know how to input \textit{} in the vim replace tool, without having \t interpreted as a tab?

1 Answer 1


You have to escape the \.


You'll have more information about what to put in the second part of the substitute command by using:

:help substitute

  • I though this command was not working, for Vim display the words directly in italic. But it is indeed working well. Thanks! Apr 12, 2022 at 11:18
  • You are welcome :-) Thanks for Nice words Apr 12, 2022 at 17:00
  • 1
    @Drosera_capensis Welcome to the site! Quick suggestion: if this answer solves your problem, you should upvote and accept it, by clicking on the upwards-pointing triangle and the checkmark to the left of the answer.
    – Rich
    Sep 9, 2022 at 9:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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