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
, it only changes this file. I want to convert indentations to tabs in a whole project.
Sublime Text 2 allows you to convert tabs to spaces in existing files manually (View -> Indentation -> Convert indentation to spaces). However, this can be done automatically when saving the file.
The expand command is part of the GNU Core Utilities, which means it is available on just about any Linux system. It's main function is to convert tabs to spaces in a file.
Instead of changing tabs to spaces one by one, the Word's Find and Replace function is commonly used to convert tabs to spaces. Step 3: Enter a space character (press space button on your keyboard) in the Replace With field; Step 4: Click Replace All.
by pressing ctrl+f12, it will reindent your file to a tab size of 4. if you want a different tab size, you just change the "value" number.
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})+
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With