config(nvim): improve conform

main
sudo pacman -Syu 2024-12-25 16:44:04 +07:00
parent ca8a98ecf5
commit 35c547d93f
1 changed files with 21 additions and 7 deletions

View File

@ -384,7 +384,7 @@ require("lazy").setup({
lua = { "stylua" }, lua = { "stylua" },
markdown = { "deno_fmt" }, markdown = { "deno_fmt" },
proto = { "buf" }, proto = { "buf" },
python = { "ruff_format" }, python = { "ruff_fix", "ruff_format" },
sh = { "shfmt" }, sh = { "shfmt" },
sql = { "sqlfluff" }, sql = { "sqlfluff" },
toml = { "trim_whitespace", "taplo" }, toml = { "trim_whitespace", "taplo" },
@ -393,18 +393,34 @@ require("lazy").setup({
zsh = { "shfmt" }, zsh = { "shfmt" },
}, },
formatters = { formatters = {
-- https://github.com/stevearc/conform.nvim/blob/master/lua/conform/formatters/gofumpt.lua
gofumpt = { gofumpt = {
prepend_args = { "-extra" }, prepend_args = { "-extra" },
}, },
-- https://github.com/stevearc/conform.nvim/blob/master/lua/conform/formatters/shfmt.lua
shfmt = { shfmt = {
prepend_args = { "-s", "-i", "4" }, prepend_args = { "-s", "-i", "4" },
}, },
-- https://github.com/stevearc/conform.nvim/blob/master/lua/conform/formatters/taplo.lua
taplo = { taplo = {
args = { "fmt", "-o", "indent_string= ", "-o", "allowed_blank_lines=1", "-" }, args = { "fmt", "-o", "indent_string= ", "-o", "allowed_blank_lines=1", "-" },
}, },
-- https://github.com/stevearc/conform.nvim/blob/master/lua/conform/formatters/sqlfluff.lua
sqlfluff = { sqlfluff = {
args = { "fix", "--dialect=mysql", "-" }, args = { "fix", "--dialect=mysql", "-" },
}, },
-- https://github.com/stevearc/conform.nvim/blob/master/lua/conform/formatters/ruff_format.lua
ruff_format = {
args = {
"format",
"--force-exclude",
"--line-length",
"120",
"--stdin-filename",
"$FILENAME",
"-",
},
},
}, },
}) })
@ -423,23 +439,22 @@ require("lazy").setup({
opts = { opts = {
ensure_installed = { ensure_installed = {
"bash", "bash",
"c", "dockerfile",
"git_config", "git_config",
"gitcommit", "gitcommit",
"go", "go",
"json", "json",
"just",
"lua", "lua",
"make", "make",
"markdown", "markdown",
"markdown_inline", "markdown_inline",
"proto", "proto",
"python", "python",
"query",
"sql", "sql",
"toml", "toml",
"typst", "typst",
"vim", "yaml",
"vimdoc",
}, },
highlight = { highlight = {
enabled = true, enabled = true,
@ -583,8 +598,6 @@ require("lazy").setup({
vim.g.copilot_filetypes = { vim.g.copilot_filetypes = {
["*"] = false, ["*"] = false,
asciidoc = true, asciidoc = true,
c = true,
cpp = true,
dockerfile = true, dockerfile = true,
gitcommit = true, gitcommit = true,
go = true, go = true,
@ -596,6 +609,7 @@ require("lazy").setup({
plantuml = true, plantuml = true,
proto = true, proto = true,
python = true, python = true,
sql = true,
toml = true, toml = true,
typst = true, typst = true,
yaml = true, yaml = true,