macosvisual-studio-code

VSCode, how to type tab in the search and replace box


In Mac VSCode, I have files with a lot of \t in it. I want to replace all of them with actual tab.

However, I don't know how to type the tab in the replace box.

Anyone know how? Thanks!

enter image description here

PS: I will also accept command line solution that I can just pipe it to a new file.


Solution

  • You can use the Regular expression option for this: vscode example

    So search for a \t, but we need to escape \ so it's not searching for an actual tab, but the string itself, so it becomes \\t.

    Replace with a tab \t, since we've enabled regular expression, this will be the actual tab.