开发者

Vim Autoindent Whitespace

I'm trying to work with Vim as an editor, but when I use the autoindent feature, it deletes my indents that have no text on them. This is really 开发者_运维百科annoying. It's documented to do this too.

Is there a way to stop it from doing this?

Also, this is not a duplicate of this question as that simply works around the problem.


Add the following to you .vimrc:

inoremap <CR> x<BS><CR>

Vim will not eliminate the indent if you type anything at all in a line, even if you delete what you typed right away. This is what the mapping does.

This page suggests another, more elaborate approach for tackling your request. But frankly I think you should adopt Vim's default behaviour of not indenting empty lines. It's The Right Way to generally avoid lines with nothing but whitespace.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜