加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

vim phpdoc multiline comment autoindent

发布时间:2020-12-15 21:56:14 所属栏目:安全 来源:网络整理
导读:假设我有一个这样的评论块: /** * comment * comment * comment */ 当我在这个块中打开一个新行时,我希望vim启动它 /** * comment * _ * comment * comment */ 但是标准(ubuntu)vim脚本中的autoindent开始一个空行,如下所示: /** * comment _ * comment *
假设我有一个这样的评论块:

/**
 * comment
 * comment
 * comment
 */

当我在这个块中打开一个新行时,我希望vim启动它

/**
 * comment
 * _
 * comment
 * comment
 */

但是标准(ubuntu)vim脚本中的autoindent开始一个空行,如下所示:

/**
 * comment
 _
 * comment
 * comment
 */

是否有一个修改过的脚本或命令会使vim这样做(我记得几年前我有这个功能,但现在不能google)?

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.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读