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 { return {
'stevearc/dressing.nvim', "stevearc/dressing.nvim",
event = 'VeryLazy', event = "VeryLazy",
} }

View File

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