gpt4 book ai didi

vim - autoindent 是 vim 中 smartindent 的子集吗?

转载 作者:行者123 更新时间:2023-12-03 11:35:01 27 4
gpt4 key购买 nike

: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 在开始新行时也应对当前行的缩进。这意味着 自动缩进 特征是 的子集smartindent 功能和不需要 自动缩进 如果 smartindent 在,对吧?为什么 自动缩进 应该开启?

最佳答案

smartindent是一个旧脚本,在编写时旨在成为 autoindent 的“智能”补充。 .从那时起,大多数语言要么具有特定的缩进功能,要么使用 cindent带有特定选项。

一般情况下,smartindent根本不应该使用。

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

set autoindent
filetype plugin indent on
autoindent不是绝对必要的,但在处理纯文本时使用它是很好的。

关于vim - autoindent 是 vim 中 smartindent 的子集吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18415492/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com