簡體   English   中英

autoindent是vim中smartindent的子集?

[英]autoindent is subset of smartindent in vim?

:help autoindent :在開始新行時鍵入當前行的縮進(在“插入”模式下鍵入或使用“o”或“O”命令時)。 ...

:help smartindent :開始換行時進行智能自動調整。 適用於類似C的程序,但也可用於其他語言。 ...

通常情況下,'autoindent'也應該在使用'smartindent'時打開。 縮進自動插入:

  • 在以'{'結尾的行之后。
  • 以“cinwords”中的關鍵字開頭的一行后面。
  • 在以'}'開頭的行之前(僅使用“O”命令)。

    當輸入'}'作為新行中的第一個字符時,該行將被賦予與匹配的'{'相同的縮進。 ...

smartindent在開始換行時還會從當前行處理縮進。 這意味着autoindent功能是smartindent功能的子集,如果smartindent打開則不需要autoindent ,對吧? 為什么自動縮進應該被打開?

smartindent是一個古老的劇本,當它被寫成時,它意味着成為對autoindent的“智能”補充。 從那時起,大多數語言都具有特定的縮進功能或使用帶有特定選項的cindent

一般來說,不應該使用smartindent

以下幾行通常足以處理縮進:

set autoindent
filetype plugin indent on

autoindent並不是絕對必要的,但在使用明文時最好使用它。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM