有时候从 web 上复制一段代码要粘贴到 vim 中,因为启用了 set smartindent
选项,粘贴后的缩进完全乱套。查 vim.cn 的 FAQ(14.14节) 知,可用 paste
选项禁用或启用 smartindent
选项。虽然前后麻烦些,至少问题解决了,smartindent
还是不能缺的。
在粘贴文本到 vim 前,先:
:
set paste
完了再恢复:
: set paste!
其实先禁用 smartindent
也一样的,不过至少 paste
比 smartindent
短 6 个字符,呵呵。
转自:http://chunzi.me/post/601