在Vim中,防止在括号中缩进包装文本可以通过以下方法实现:
autoindent
选项来自动缩进。在Vim配置文件(如~/.vimrc
)中添加以下行:set autoindent
这将使Vim在新行中保留与上一行相同的缩进。
formatoptions
选项。在Vim配置文件中添加以下行:set formatoptions+=croql
这将设置formatoptions
选项,以便在格式化时避免在括号中缩进包装文本。
autoindent
和smartindent
选项。在Vim配置文件中添加以下行:set autoindent
set smartindent
这将使Vim在键入时自动缩进,并根据上下文调整缩进。
autoindent
、smartindent
和formatoptions
选项。在Vim配置文件中添加以下行:set autoindent
set smartindent
set formatoptions+=croql
这将使Vim在键入时自动缩进,并根据上下文调整缩进,同时避免在括号中缩进包装文本。
总之,通过设置Vim的autoindent
、smartindent
和formatoptions
选项,可以在键入时自动缩进,并根据上下文调整缩进,同时避免在括号中缩进包装文本。
领取专属 10元无门槛券
手把手带您无忧上云