问问题
353 次
2 回答
1
你需要set ai
来自帮助:
'autoindent' 'ai' boolean (default off)
local to buffer
Copy indent from current line when starting a new line (typing <CR>
in Insert mode or when using the "o" or "O" command). If you do not
type anything on the new line except <BS> or CTRL-D and then type
<Esc>, CTRL-O or <CR>, the indent is deleted again. Moving the cursor
to another line has the same effect, unless the 'I' flag is included
in 'cpoptions'.
When autoindent is on, formatting (with the "gq" command or when you
reach 'textwidth' in Insert mode) uses the indentation of the first
line.
When 'smartindent' or 'cindent' is on the indent is changed in
a different way.
The 'autoindent' option is reset when the 'paste' option is set.
{small difference from Vi: After the indent is deleted when typing
<Esc> or <CR>, the cursor position when moving up or down is after the
deleted indent; Vi puts the cursor somewhere in the deleted indent}.
注意
如果您没有在新行中键入除 <BS> 或 CTRL-D 之外的任何内容,然后键入 <Esc>、CTRL-O 或 <CR>,缩进将再次被删除。
于 2013-09-11T20:34:52.283 回答