Closed akmalsoliev closed 3 months ago
I don't think it works that way. You can customize default values of formatters but the option field is only present in these three. You can create a default stylua.toml and put options there then point stylua to it with --config-path argument.
Merhaba @msyavuz, thanks so much for your reply, I will def give it a try and get back to you.
@msyavuz I finally got around this issue, thanks so much it works like a charm! Teşekkürler!!!
Fix:
return { -- Autoformat
"stevearc/conform.nvim",
keys = {
{
"<leader>f",
'<CMD>lua require("conform").format({ timeout_ms = 3000 })<CR>',
mode = { "n", "v" },
desc = "[F]ormat file",
},
},
opts = {
notify_on_error = true,
format_on_save = {
timeout_ms = 500,
lsp_fallback = true,
},
formatters_by_ft = {
lua = { "stylua" },
python = { "ruff_fix", "ruff_format" },
rust = { "rustfmt" },
bash = { "beautysh" },
sql = { "sqlfluff" },
json = { "prettier" },
["*"] = { "trim_whitespace" },
},
},
formatters = {
stylua = {
args = { "--config-path", "~/.config/stylua/stylua.toml" },
},
rustfmt = {
autosave = 1,
},
},
}
My stylua.toml
:
➤ cat ~/.config/stylua/stylua.toml
indent_width = 2
indent_type = "Spaces"
Neovim version (nvim -v)
5.6.0
Operating system/version
MacOS 14.4.1
Add the debug logs
log_level = vim.log.levels.DEBUG
and pasted the log contents below.Log file
Describe the bug
Inability to enforce indentantation width and using spaces or tabs with stylua
What is the severity of this bug?
minor (annoyance)
Steps To Reproduce
Use the lazyvim init
Expected Behavior
2 spaces for an indent
Minimal example file
No response
Minimal init.lua