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

autoindent是vim中smartindent的子集?

发布时间:2020-12-15 19:41:24 所属栏目:安全 来源:网络整理
导读::help autoindent : Copy indent from current line when starting a new line (typing in Insert mode or when using the “o” or “O” command). … :help smartindent : Do smart autoindenting when starting a new line. Works for C-like programs,b

:help autoindent : Copy indent from current line when starting a new line (typing
in Insert mode or when using the “o” or “O” command). …

:help smartindent : Do smart autoindenting when starting a new line. Works for C-like
programs,but can also be used for other languages. …

Normally ‘autoindent’ should also be on when using ‘smartindent’.
An indent is automatically inserted:

  • After a line ending in ‘{‘.
  • After a line starting with a keyword from ‘cinwords’.
  • Before a line starting with ‘}’ (only with the “O” command).

    When typing ‘}’ as the first character in a new line,that line is
    given the same indent as the matching ‘{‘. …

smartindent在开始新行时也可以从当前行处理缩进。这意味着autoindent功能是smartindent功能的子集,如果smartindent打开,则不需要autoindent,对吗?为什么要打开autoindent?

smartindent是一个古老的剧本,当它被写成时,是一个“聪明”的补充自动缩进。从那时起,大多数语言都有特定的缩进功能,或者使用具有特定选项的cindent。

一般来说,smartindent不应该被使用。

以下行通常足以处理缩进:

set autoindent
filetype plugin indent on

autoindent并不是绝对必要的,但在使用明文时很有用。

(编辑:李大同)

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

    推荐文章
      热点阅读