Indentation tab or space, this is not a problem, just like python with four spaces to indent, this is to see a person's preferences. In Vim, it is convenient to set the Tab tab or space according to different file types, and also to set the length, which is very flexible.
First, let's see how to set the tab width and how to determine whether to use Tab tab or empty Glyd to represent an indentation:
set tabstop=4set softtabstop=4set shiftwidth=4set noexpandtab/expandtab
Description:
softtabstopIndicates the length of the indent when pressing the backspace bar while in edit mode, when using theexpandtabis particularly useful.
shiftwidthIndicates the length of each level indent, typically set tosofttabstopThe same.
When set toexpandtab, the indentation is denoted by an empty Glyd,noexpandtabis a tab representation of an indentation.
To set tab according to file type:
Sometimes you want to set different tab performance for certain types of files, such as Python with four empty glyd for an indentation, and four null glyd for indentation in our JavaScript conventions, and HTML and CSS like tab tabs to indent, so you can do the following:
ifHas ("Autocmd") autocmd FileType JavaScript setlocal ts=4sts=4sw=4Expandtab autocmd FileType python setlocal ts=4sts=4sw=4Expandtabendif
So when the file is .js. PY will be indented with four spaces.
To represent tab tabs with special symbols:
In Vim, you can use special symbols to represent a tab tab so that tab tabs and spaces can easily be distinguished, such as:
To join in VIMRC:
set list set listchars=tab:?\, EOL:?
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Set Tab to 4 spaces in Vim