Sublime Forum

Auto indent when changing tab width of a file

#1

Hi,

I have this Python file that I download from an assignment on the internet. The default indentation of the file is set to 2, although my indentation settings for Python file is 4. I mean, when I write new code, the indent is 4 as I expected, but the indentation of the starter code remain 2. How can I fix that?

Here is my general settings:

{
	"bold_folder_labels": true,
	"caret_extra_width": 1,
	"color_scheme": "Packages/Material Theme/schemes/Material-Theme-Darker.tmTheme",
	"folder_exclude_patterns":
	[
		".svn/",
		".git/",
		".hg/",
		"CVS/",
		"node_modules/",
		"bower_components/"
	],
	"detect_indentation": false,
	"font_size": 10.5,
	"highlight_line": true,
	"highlight_modif1ied_tabs": true,
	"ignored_packages":
	[
		"Vintage"
	],
	"indent_guide_options":
	[
		"draw_normal",
		"draw_active"
	],
	"line_padding_bottom": 3,
	"line_padding_top": 3,
	"material_theme_accent_scrollbars": true,
	"material_theme_arrow_folders": true,
	"material_theme_bold_tab": true,
	"material_theme_bright_scrollbars": true,
	"material_theme_bullet_tree_indicator": true,
	"material_theme_contrast_mode": true,
	"material_theme_disable_folder_animation": true,
	"material_theme_panel_separator": true,
	"material_theme_small_tab": true,
	"material_theme_tabs_autowidth": true,
	"material_theme_tree_headings": true,
	"overlay_scroll_bars": "enabled",
	"rulers":
	[
		100
	],
	"tab_size": 4,
	"theme": "Material-Theme-Darker.sublime-theme",
	"theme_accent_numix": true,
	"theme_bar": true,
	"theme_bar_logo_atomized": true,
	"theme_find_panel_font_sm": true,
	"theme_font_sm": true,
	"theme_panel_switcher_atomized": true,
	"theme_scrollbar_colored": true,
	"theme_sidebar_indent_xl": true,
	"theme_statusbar_font_md": true,
	"theme_tab_close_always_visible": true,
	"theme_tab_selected_underlined": true,
	"translate_tabs_to_spaces": true,
	"word_wrap": true,
	"wrap_width": 100
}
0 Likes

#2

You can convert the indentation to tabs first (based on a width of two), then change the width to 4 and convert to spaces again. There is probably a package to do this also.

2 Likes

#3
1 Like