gpt4 book ai didi

linux - 如何在 Vim 中打开自动格式设置?

转载 作者:太空宇宙 更新时间:2023-11-04 05:19:24 25 4
gpt4 key购买 nike

我正在按照教程并尝试在 Vim 中编辑 .yml 文件。我的 Vim 编辑器和老师的不一样。他的文本会自动缩进并添加颜色格式。

This first image is the instructor's Vim and what I want mine to look like

This second image is my Vim editor. You can see mine is without formatting and colours.

如何打开此自动格式设置?如果没有正确格式化 .yml 文件,Docker 会出现构建问题。谢谢!

最佳答案

这些设置可以在您的.vimrc中进行修改。文件。

具体而言,您要寻找的是set autoindent选项。在设置之前,请确保使用 set Expandtab 调整缩进类型(想要制表符还是空格?),并使用 set shiftwidth=4 调整缩进大小(多少个空格?),其中 4 是空格数。

对于颜色格式,您需要查看 syntax highlighting 。您可以将其与 color scheme 一起使用为了定制你的 Vim :)

关于linux - 如何在 Vim 中打开自动格式设置?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43859770/

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