feat(nvim): add stylua config

This commit is contained in:
Rob Watson 2023-09-19 07:15:18 +02:00
parent e6fb8cc478
commit eb86f4860c
2 changed files with 11 additions and 1 deletions

3
vim/lua/.luarc.json Normal file
View File

@ -0,0 +1,3 @@
{
"workspace.checkThirdParty": false
}

View File

@ -7,10 +7,17 @@ local prettier = function()
end end
require('formatter').setup({ require('formatter').setup({
log_level = vim.log.levels.INFO,
filetype = { filetype = {
javascript = { prettier }, javascript = { prettier },
typescript = { prettier }, typescript = { prettier },
typescriptreact = { prettier }, typescriptreact = { prettier },
-- https://github.com/JohnnyMorganz/StyLua
-- cargo install stylua --features lua54
lua = {
require("formatter.filetypes.lua").stylua
},
} }
}) })
@ -18,7 +25,7 @@ require('formatter').setup({
vim.api.nvim_exec2([[ vim.api.nvim_exec2([[
augroup FormatAutogroup augroup FormatAutogroup
autocmd! autocmd!
autocmd BufWritePost *.js,*.ts,*.tsx silent FormatWrite autocmd BufWritePost *.js,*.ts,*.tsx,*.lua silent FormatWrite
augroup END augroup END
]], { output = true }) ]], { output = true })