Converting spaces to tabs in multiple files Sublime Text 2

前端 未结 1 911
刺人心
刺人心 2021-02-07 08:04

Is there any way to convert all spaces to tabs, not file by file?

If I open a file and go through View => Indentation => Convert Indentation to Tabs,

相关标签:
1条回答
  • 2021-02-07 08:21

    Use search and replace in multiple files to convert n spaces to tabs in select files.

    First open find in files panel, cmd + shift + f, by default to find and replace in multiple files. Next define a regular expression to match spaces as tabs eg {4} (make sure you set Regular Expressions in the panel) for 4 spaces and replace with \t in desired files. Change {4} to however many spaces are being used for indentation.

    As mentioned in comments to match spaces at the start of a line you can use the regexp ^( {4})+

    0 讨论(0)
提交回复
热议问题