Add formatters for lua and yaml

This commit is contained in:
Valeriy Filippov
2026-03-11 10:06:28 +03:00
parent c4a77e9d1b
commit 27663861dc
3 changed files with 20 additions and 2 deletions

2
nvim/.sylua.toml Normal file
View File

@@ -0,0 +1,2 @@
indent_type = "Spaces"
indent_width = 2

View File

@@ -15,7 +15,7 @@ local keymap = vim.keymap
-- Reserved firs characters:
-- +/- - numbers
-- c - [C]lear
-- c - [C]lear / [C]all
-- d - [D]iagnostic
-- e - File [E]xplorer
-- f - [F]ind
@@ -28,8 +28,9 @@ local keymap = vim.keymap
-- t - [T]abs
-- u - [U]i
-- [C]lear highlits
-- [C]lear / [C]all
keymap.set("n", "<leader>ch", ":nohl<CR>", { desc = "[C]lear: serch [h]ighlights" })
keymap.set({"n", "v"}, "<leader>cf", function() require("conform").format() end, { desc = "[C]all: [f]ormat" })
-- [D]iagnostic
keymap.set("n", "<leader>dl", vim.diagnostic.open_float, { desc = "[D]iagnostic: [l]ine" })

View File

@@ -0,0 +1,15 @@
-- https://github.com/stevearc/conform.nvim
return {
"stevearc/conform.nvim",
opts = {
formatters_by_ft = {
lua = { "stylua" },
yaml = { "prettierd", "prettier", stop_after_first = true },
},
format_on_save = {
-- These options will be passed to conform.format()
timeout_ms = 500,
lsp_format = "fallback",
},
},
}