在Neovim(nvchad)中的Markdown文件中的缩进。

huangapple go评论66阅读模式
英文:

Indentation in markdown files in neovim (nvchad)

问题

为什么在Neovim中处理Markdown文件时,我没有得到8个缩进空格。是否有一些标准,或者其他原因。在Visual Studio Code中,它正常工作。

就Python和Rust而言,我了解社区对此进行了强制执行。但是Markdown文件有什么问题?

我刚刚使用官方网站上提供的命令添加了nvchad配置,并在nvim/lua/core目录下的init.lua中将tabstopshiftwidth的缩进都改为了8。

英文:

why am i not getting 8 indent spaces in neovim when it comes to markdown files. is there some standard, or something else. in visualstudio code, it is working fine.

in case of python, rust , i read that the community enforces it. but what is wrong with markdown files

i just added nvchad config using the command given on the official website. and in the init.lua inside nvim/lua/core, i changed the indent to 8 both tabstop and shiftwidth

答案1

得分: 1

默认情况下,使用 NvChad,你的配置将shiftwidthtabstop设置为2 => 请参考https://github.com/NvChad/NvChad/blob/v2.0/lua/core/init.lua

你可以在lua/custom/init.lua中添加一个特定的配置文件(请参考https://nvchad.com/docs/config/walkthrough)。

在其中,你可以定义一个特定的自动命令以设置Markdown文件的选项:

vim.api.nvim_create_autocmd("FileType", {
  pattern = "markdown",
  callback = function()
    vim.opt.shiftwidth = 8
    vim.opt.tabstop = 8
    vim.opt.softtabstop = 8
  end,
})
英文:

By default, with NvChad, your configuration sets shiftwidth and tabstop to 2 => see https://github.com/NvChad/NvChad/blob/v2.0/lua/core/init.lua

You can add a specific configuration file in lua/custom/init.lua (see https://nvchad.com/docs/config/walkthrough).

In it, you could define a specific autocommand to set options for Markdown files :

vim.api.nvim_create_autocmd("FileType", {
  pattern = "markdown",
  callback = function()
    vim.opt.shiftwidth = 8
    vim.opt.tabstop = 8
    vim.opt.softtabstop = 8
  end,
})

huangapple
  • 本文由 发表于 2023年4月11日 03:47:11
  • 转载请务必保留本文链接:https://go.coder-hub.com/75980220.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定