vim phpdoc 多行注释自动缩进

标签 vim phpdoc auto-indent

假设我有一个这样的评论块:

/**
 * 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/

相关文章:

vim - 烦人的,vim 中随机单词的红色突出显示

regex - 我如何让 vim 突出显示多余的空白和所有选项卡?

c++ - VIM:有没有一种简单的方法可以从 Vim 管理 Visual Studio 解决方案/makefile 项目?

php - 如何在PhpStorm中为整个项目更新生成DocBlock?

通过 PEAR 在 OSX 上安装的 PhpDocumentor 无法正常工作 - 缺少文件?

javascript - 如何在 Aptana Studio 中自动缩进 JavaScript 代码?

Vim Surround 在单词周围插入额外的空格

testing - phpundercontrol 没有找到任何测试

tabs - Sublime Text 3,将空格转换为制表符