For example, take this code. Note that there are three spaces in front of the <li> tag, and my vim settings are as follows
set tapstop=4 set softtabstop=4 set shiftwidth=4
The reason why there are three spaces in front of the <li> tag is because I am changing someone else’s code and I don’t want to mess up the original indentation
<ul> <li>**光标所在处,在此处回车** </li> </ul>
Enter at the marked position above, <li>the three spaces in front of this label will be replaced with tabs, as shown in the figure
How to solve this problem of changing the indentation of the previous line by changing the line?
" 空格代替tab,这个是重点
set expandtab
" 缩进3个字符
set shiftwidth=3 softtabstop=3
" 下面是关于自动缩进的控制,不喜欢自动缩进可以关掉。
"Auto indent
set ai
" Smart indet
set si
" C-style indeting
set cindent
也可以不修改你的vim配置,采用modeline形式,参考:http://vim.wikia.com/wiki/Modeline_ma...