假设我有一个这样的评论块:
/**
* comment
* comment
* comment
*/
当我在这个块中打开一个新行时,我希望 vim 以
/**
* comment
* _
* comment
* comment
*/
但是标准(ubuntu)vim 脚本中的 autoindent 以空行开头,如下所示:
/**
* comment
_
* comment
* comment
*/
是否有修改过的脚本或命令可以让 vim 这样做(我记得几年前我有这个功能,但现在不能用谷歌搜索)?
TIA。
最佳答案
你应该把它添加到你的 .vimrc 中:
set formatoptions+=or
o Automatically insert the current comment leader after hitting 'o' or 'O' in Normal mode.
r Automatically insert the current comment leader after hitting <Enter> in Insert mode.
关于vim phpdoc 多行注释自动缩进,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3298820/