nvim: add better md support
This commit is contained in:
parent
435b46a249
commit
192e7d3c23
2 changed files with 74 additions and 72 deletions
|
@ -31,6 +31,8 @@ opt.wrap = false
|
|||
opt.formatoptions = "cro"
|
||||
opt.backspace = "indent,eol,start"
|
||||
opt.conceallevel = 0
|
||||
opt.spelllang = "en_gb"
|
||||
vim.opt.spell = true
|
||||
|
||||
diagnostic.config({
|
||||
virtual_text = false,
|
||||
|
|
|
@ -1,76 +1,76 @@
|
|||
return {
|
||||
"neovim/nvim-lspconfig",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
dependencies = {
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
{ "folke/neodev.nvim", opts = {} },
|
||||
},
|
||||
config = function()
|
||||
local nvim_lsp = require("lspconfig")
|
||||
local mason_lspconfig = require("mason-lspconfig")
|
||||
local on_attach = function(client, bufnr)
|
||||
-- format on save
|
||||
if client.server_capabilities.documentFormattingProvider then
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
group = vim.api.nvim_create_augroup("Format", { clear = true }),
|
||||
buffer = bufnr,
|
||||
callback = function()
|
||||
vim.lsp.buf.format()
|
||||
end,
|
||||
})
|
||||
end
|
||||
end
|
||||
"neovim/nvim-lspconfig",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
dependencies = {
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
{ "folke/neodev.nvim", opts = {} },
|
||||
},
|
||||
config = function()
|
||||
local nvim_lsp = require("lspconfig")
|
||||
local mason_lspconfig = require("mason-lspconfig")
|
||||
local on_attach = function(client, bufnr)
|
||||
-- format on save
|
||||
if client.server_capabilities.documentFormattingProvider then
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
group = vim.api.nvim_create_augroup("Format", { clear = true }),
|
||||
buffer = bufnr,
|
||||
callback = function()
|
||||
vim.lsp.buf.format()
|
||||
end,
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||
mason_lspconfig.setup_handlers({
|
||||
function(server)
|
||||
nvim_lsp[server].setup({
|
||||
capabilities = capabilities,
|
||||
})
|
||||
end,
|
||||
["ts_ls"] = function()
|
||||
nvim_lsp["ts_ls"].setup({
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
})
|
||||
end,
|
||||
["cssls"] = function()
|
||||
nvim_lsp["cssls"].setup({
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
})
|
||||
end,
|
||||
["html"] = function()
|
||||
nvim_lsp["html"].setup({
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
})
|
||||
end,
|
||||
["jsonls"] = function()
|
||||
nvim_lsp["jsonls"].setup({
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
})
|
||||
end,
|
||||
["eslint"] = function()
|
||||
nvim_lsp["eslint"].setup({
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
})
|
||||
end,
|
||||
["pyright"] = function()
|
||||
nvim_lsp["pyright"].setup({
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
})
|
||||
end,
|
||||
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||
mason_lspconfig.setup_handlers({
|
||||
function(server)
|
||||
nvim_lsp[server].setup({
|
||||
capabilities = capabilities,
|
||||
})
|
||||
end,
|
||||
["ts_ls"] = function()
|
||||
nvim_lsp["ts_ls"].setup({
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
})
|
||||
end,
|
||||
["cssls"] = function()
|
||||
nvim_lsp["cssls"].setup({
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
})
|
||||
end,
|
||||
["html"] = function()
|
||||
nvim_lsp["html"].setup({
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
})
|
||||
end,
|
||||
["jsonls"] = function()
|
||||
nvim_lsp["jsonls"].setup({
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
})
|
||||
end,
|
||||
["eslint"] = function()
|
||||
nvim_lsp["eslint"].setup({
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
})
|
||||
end,
|
||||
["pyright"] = function()
|
||||
nvim_lsp["pyright"].setup({
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
})
|
||||
end,
|
||||
|
||||
["marksman"] = function()
|
||||
nvim_lsp["pyright"].setup({
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
})
|
||||
end,
|
||||
})
|
||||
end,
|
||||
["marksman"] = function()
|
||||
nvim_lsp["marksman"].setup({
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
})
|
||||
end,
|
||||
})
|
||||
end,
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue