stopping vim from removing indentation on empty lines

青春壹個敷衍的年華 提交于 2019-11-27 21:21:08
Prince Goulash

The Vim wiki suggests this:

inoremap <CR> <CR>x<BS>

because the indenting is not removed if some text has been entered on the line, even if it has been deleted.

[EDIT - milimetric]

Just a couple of pieces missing from a full solution. You also need remaps for o and O and whatever else you use to add lines:

inoremap <CR> <CR>x<BS>
nnoremap o ox<BS>
nnoremap O Ox<BS>

Same idea but people newer to vim might not figure it out quickly.

For me this code works:

inoremap <silent> <Esc> <C-O>:stopinsert<CR>
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!