|
Indented with tabs or spaces tab, this is not a problem, just like Python with four spaces to indent, this is a matter of personal preference. In Vim can easily depending on the file type is set to use tabs or spaces tab, you can set the length, very flexible.
First look at how to set up and how to determine the width of the tab with the tab tabs or spaces to represent a indent:
set tabstop = 4
set softtabstop = 4
set shiftwidth = 4
set noexpandtab / expandtab
Explanation:
Tabstop which represents a tab displayed is the number of spaces in length, default 8.
softtabstop expressed in Edit mode when pressing the backspace key to return when the length of indentation is especially useful when using expandtab.
shiftwidth represent each level of indentation length, with the same general set softtabstop.
When set to expandtab, indented with spaces to represent, noexpandtab is represented by a tab indent.
According to the file type settings tab:
Sometimes you want to set a different tab performance for certain types of files, such as python with four spaces to represent an indentation in our javascript conventions are also using four spaces to indent, and prefer to use HTML and CSS tab tab to indent, you can make the following settings:
if it has ( "autocmd")
autocmd FileType javascript setlocal ts = 4 sts = 4 sw = 4 expandtab
autocmd FileType python setlocal ts = 4 sts = 4 sw = 4 expandtab
endif
So that when the file is open play .js .py, we will use four spaces to indent.
With a special notation tab tabs:
In Vim you can use special symbols to represent a tab tabs, tab so that tabs and spaces can easily distinguish the opinion
Added vimrc on it:
set list
set listchars = tab: ▸ \, eol: ¬ |
|
|
|