Initial LSP setup with formatting and autocompletion
This commit is contained in:
21
lua/formatting.lua
Normal file
21
lua/formatting.lua
Normal file
@@ -0,0 +1,21 @@
|
||||
local conform = require("conform")
|
||||
|
||||
---@type conform.setupOpts
|
||||
local options = {
|
||||
formatters_by_ft = {
|
||||
lua = { "stylua" },
|
||||
},
|
||||
format_on_save = {
|
||||
timeout_ms = 500,
|
||||
lsp_format = "fallback",
|
||||
},
|
||||
}
|
||||
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
pattern = "*",
|
||||
callback = function(args)
|
||||
conform.format({ bufnr = args.buf })
|
||||
end,
|
||||
})
|
||||
|
||||
conform.setup(options)
|
||||
Reference in New Issue
Block a user