feat(nvim): add conform.nvim plugin
GitOrigin-RevId: f697a10f5fa69b938c33b8729506b03ea1b45ca1
diff --git a/private_dot_config/nvim/lua/plugins/code_formatting.lua b/private_dot_config/nvim/lua/plugins/code_formatting.lua
index 9eca093..b8210a3 100644
--- a/private_dot_config/nvim/lua/plugins/code_formatting.lua
+++ b/private_dot_config/nvim/lua/plugins/code_formatting.lua
@@ -1,6 +1,47 @@
return {
"editorconfig/editorconfig-vim",
{
+ 'stevearc/conform.nvim',
+ keys = {
+ {
+ '<space>f',
+ function ()
+ require'conform'.format({ async = true })
+ end,
+ mode = '',
+ desc = 'Format buffer',
+ },
+ },
+ opts = {
+ formatters_by_ft = {
+ typescript = {
+ 'prettierd',
+ 'prettier',
+ stop_after_first = true
+ },
+ typescriptreact = {
+ 'prettierd',
+ 'prettier',
+ stop_after_first = true
+ },
+ jjdescription = {
+ 'commitmsgfmt',
+ },
+ },
+ default_format_opts = {
+ lsp_format = 'never',
+ },
+ format_on_save = {
+ timeout_ms = 500,
+ },
+ formatters = {
+ shfmt = {
+ prepend_args = { '-i', '2', '-ci' }
+ },
+ },
+ },
+ },
+ {
"google/vim-codefmt",
dependencies = {
"google/vim-maktaba",
diff --git a/private_dot_config/nvim/lua/plugins/lsp_config.lua b/private_dot_config/nvim/lua/plugins/lsp_config.lua
index 89b1ae3..1d9e7d1 100644
--- a/private_dot_config/nvim/lua/plugins/lsp_config.lua
+++ b/private_dot_config/nvim/lua/plugins/lsp_config.lua
@@ -31,9 +31,6 @@
end, opts)
vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, opts)
vim.keymap.set({ 'n', 'v' }, '<space>ca', vim.lsp.buf.code_action, opts)
- vim.keymap.set('n', '<space>f', function()
- vim.lsp.buf.format { async = true }
- end, opts)
end,
})