add toggle auto format

add auto closing html tags
This commit is contained in:
hwu 2025-09-01 22:04:19 -04:00
parent 2597126549
commit 17b3d146d4
2 changed files with 30 additions and 5 deletions

View File

@ -1,6 +1,16 @@
return {
'stevearc/conform.nvim',
event = { 'BufReadPre', 'BufNewFile' },
keys = {
{
'<leader>tf',
function()
vim.g.disable_autoformat = not vim.g.disable_autoformat
end,
mode = '',
desc = 'Toggle Format On Save',
},
},
config = function()
local conform = require 'conform'
@ -20,11 +30,12 @@ return {
liquid = { 'prettier' },
lua = { 'stylua' },
},
format_on_save = {
lsp_fallback = true,
async = false,
timeout_ms = 1000,
},
format_on_save = function(bufnr)
if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then
return
end
return { timeout_ms = 1000, lsp_format = 'fallback' }
end,
}
end,
}

View File

@ -0,0 +1,14 @@
return {
'pmizio/typescript-tools.nvim',
dependencies = { 'nvim-lua/plenary.nvim', 'neovim/nvim-lspconfig' },
config = function()
require('typescript-tools').setup {
settings = {
jsx_close_tag = {
enable = true,
filetypes = { 'javascriptreact', 'typescriptreact', 'javascript' },
},
},
}
end,
}