update nvim plugins

This commit is contained in:
Alexander Navarro 2024-08-30 09:14:44 -04:00
parent 58a23e4a86
commit 282f40fc2a
Signed by untrusted user who does not match committer: anavarro
GPG key ID: 6426043E9FA3E3B5
4 changed files with 28 additions and 9 deletions

View file

@ -12,6 +12,7 @@ return {
["_"] = { "trim_whitespace" },
blade = { "blade-formatter" },
css = { { "prettierd", "prettier" } },
go = { { "gofumpt", "goimports_reviser", "golines" } },
html = { "prettierd" },
javascript = { { "prettierd", "prettier" } },
javascriptreact = { { "prettierd", "prettier" } },
@ -26,9 +27,8 @@ return {
sh = { "shfmt" },
typescript = { { "prettierd", "prettier" } },
typescriptreact = { { "prettierd", "prettier" } },
zsh = { "shfmt" },
go = { { "gofumpt", "goimports_reviser", "golines" } },
xml = { "lemminx" }
xml = { "lemminx" },
zsh = { "shfmt" }
},
format_on_save = function(bufnr)
-- Disable with a global or buffer-local variable
@ -52,5 +52,17 @@ return {
end
MAP("n", "<leader>uf", toggleAutoFormat, "Toggle auto format")
vim.api.nvim_create_user_command("Format", function(args)
local range = nil
if args.count ~= -1 then
local end_line = vim.api.nvim_buf_get_lines(0, args.line2 - 1, args.line2, true)[1]
range = {
start = { args.line1, 0 },
["end"] = { args.line2, end_line:len() },
}
end
require("conform").format({ async = true, lsp_format = "fallback", range = range })
end, { range = true })
end,
}