Some formatting changes

This commit is contained in:
Rakshit Sinha 2025-01-10 18:55:11 -08:00
parent dbf42e4708
commit f00b911cf0
2 changed files with 29 additions and 29 deletions

View File

@ -1,4 +1,4 @@
return {
'stevearc/dressing.nvim',
event = 'VeryLazy',
"stevearc/dressing.nvim",
event = "VeryLazy",
}

View File

@ -1,15 +1,15 @@
return { -- Autoformat
'stevearc/conform.nvim',
event = { 'BufWritePre', 'BufReadPre', 'BufNewFile' },
cmd = { 'ConformInfo' },
"stevearc/conform.nvim",
event = { "BufWritePre", "BufReadPre", "BufNewFile" },
cmd = { "ConformInfo" },
keys = {
{
'<leader>f',
"<leader>f",
function()
require('conform').format({ async = true, lsp_format = 'fallback' })
require("conform").format({ async = true, lsp_format = "fallback" })
end,
mode = '',
desc = '[F]ormat buffer',
mode = "",
desc = "[F]ormat buffer",
},
},
opts = {
@ -21,35 +21,35 @@ return { -- Autoformat
timeout_ms = 5000,
},
formatters_by_ft = {
go = { 'goimports', 'gofmt' },
terraform = { 'terraform_fmt' },
lua = { 'stylua' },
javascript = { 'prettier' },
typescript = { 'prettier' },
javascriptreact = { 'prettier' },
typescriptreact = { 'prettier' },
svelte = { 'prettier' },
css = { 'prettier' },
html = { 'prettier' },
json = { 'prettier' },
yaml = { 'prettier' },
markdown = { 'prettier' },
graphql = { 'prettier' },
liquid = { 'prettier' },
go = { "goimports", "gofmt" },
terraform = { "terraform_fmt" },
lua = { "stylua" },
javascript = { "prettier" },
typescript = { "prettier" },
javascriptreact = { "prettier" },
typescriptreact = { "prettier" },
svelte = { "prettier" },
css = { "prettier" },
html = { "prettier" },
json = { "prettier" },
yaml = { "prettier" },
markdown = { "prettier" },
graphql = { "prettier" },
liquid = { "prettier" },
-- python = { 'isort', 'black' },
-- You can use a function here to determine the formatters dynamically
python = function(bufnr)
if require('conform').get_formatter_info('ruff_format', bufnr).available then
return { 'ruff_format' }
if require("conform").get_formatter_info("ruff_format", bufnr).available then
return { "ruff_format" }
else
return { 'isort', 'black' }
return { "isort", "black" }
end
end,
-- Use the "*" filetype to run formatters on all filetypes.
['*'] = { 'codespell' },
["*"] = { "codespell" },
-- Use the "_" filetype to run formatters on filetypes that don't
-- have other formatters configured.
['_'] = { 'trim_whitespace' },
["_"] = { "trim_whitespace" },
-- Conform can also run multiple formatters sequentially
-- python = { "isort", "black" },
--