vim lint+format+lsp fixes
This commit is contained in:
+50
-14
@@ -519,11 +519,25 @@ require("lazy").setup({
|
|||||||
require("mason").setup()
|
require("mason").setup()
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"mfussenegger/nvim-lint",
|
||||||
|
config = function()
|
||||||
|
require("lint").linters_by_ft = {
|
||||||
|
javascript = { "eslint_d" },
|
||||||
|
typescript = { "eslint_d" },
|
||||||
|
html = { "tidy", "eslint_d" },
|
||||||
|
}
|
||||||
|
vim.api.nvim_create_autocmd({ "BufWritePost" }, {
|
||||||
|
callback = function()
|
||||||
|
require("lint").try_lint()
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"mhartington/formatter.nvim",
|
"mhartington/formatter.nvim",
|
||||||
-- Utilities for creating configurations
|
-- Utilities for creating configurations
|
||||||
config = function()
|
config = function()
|
||||||
|
|
||||||
local util = require("formatter.util")
|
local util = require("formatter.util")
|
||||||
local map = vim.keymap.set
|
local map = vim.keymap.set
|
||||||
local opts = { silent = true, noremap = true }
|
local opts = { silent = true, noremap = true }
|
||||||
@@ -555,11 +569,12 @@ require("lazy").setup({
|
|||||||
function()
|
function()
|
||||||
return {
|
return {
|
||||||
exe = "blackdoc",
|
exe = "blackdoc",
|
||||||
args = { "-q", "-t py311", },
|
args = { "-q", "-t py311" },
|
||||||
stdin = false,
|
stdin = false,
|
||||||
}
|
}
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
go = { require("formatter.filetypes.go").gofumpt, require("formatter.filetypes.go").golines },
|
||||||
lua = {
|
lua = {
|
||||||
function()
|
function()
|
||||||
return {
|
return {
|
||||||
@@ -580,25 +595,32 @@ require("lazy").setup({
|
|||||||
function()
|
function()
|
||||||
return {
|
return {
|
||||||
exe = "yamlfmt",
|
exe = "yamlfmt",
|
||||||
args = { "-formatter indentless_arrays=true,retain_line_breaks=true,line_ending=lf,max_line_length=100,pad_line_comments=2", "-in" },
|
args = {
|
||||||
|
"-formatter indentless_arrays=true,retain_line_breaks=true,line_ending=lf,max_line_length=100,pad_line_comments=2",
|
||||||
|
"-in",
|
||||||
|
},
|
||||||
stdin = true,
|
stdin = true,
|
||||||
}
|
}
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
sh = { require("formatter.filetypes.sh").shfmt, },
|
sh = { require("formatter.filetypes.sh").shfmt },
|
||||||
typescript = { require("formatter.filetypes.typescript").eslint_d, },
|
typescript = { require("formatter.filetypes.typescript").eslint_d },
|
||||||
javascript = { require("formatter.filetypes.javascript").eslint_d, },
|
javascript = { require("formatter.filetypes.javascript").eslint_d },
|
||||||
html = { require("formatter.filetypes.html").prettierd, },
|
html = {
|
||||||
|
-- require("formatter.filetypes.html").prettierd,
|
||||||
|
require("formatter.filetypes.html").tidy,
|
||||||
|
require("formatter.filetypes.javascript").eslint_d,
|
||||||
|
},
|
||||||
css = {
|
css = {
|
||||||
require("formatter.filetypes.css").prettierd,
|
require("formatter.filetypes.css").prettierd,
|
||||||
require("formatter.filetypes.css").eslint_d,
|
require("formatter.filetypes.css").eslint_d,
|
||||||
},
|
},
|
||||||
markdown = { require("formatter.filetypes.markdown").prettierd, },
|
markdown = { require("formatter.filetypes.markdown").prettierd },
|
||||||
json = {require("formatter.filetypes.json").jq, },
|
json = { require("formatter.filetypes.json").jq },
|
||||||
["*"] = { require("formatter.filetypes.any").remove_trailing_whitespace },
|
["*"] = { require("formatter.filetypes.any").remove_trailing_whitespace },
|
||||||
}
|
},
|
||||||
})
|
})
|
||||||
end
|
end,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"neovim/nvim-lspconfig",
|
"neovim/nvim-lspconfig",
|
||||||
@@ -625,10 +647,10 @@ require("lazy").setup({
|
|||||||
vim.diagnostic.open_float({ source = true })
|
vim.diagnostic.open_float({ source = true })
|
||||||
end)
|
end)
|
||||||
bmap("n", "<M-n>", function()
|
bmap("n", "<M-n>", function()
|
||||||
vim.diagnostic.goto_next({ severity = { min = vim.diagnostic.severity.INFO } })
|
vim.diagnostic.goto_next({ severity = { min = vim.diagnostic.severity.HINT } })
|
||||||
end)
|
end)
|
||||||
bmap("n", "<M-p>", function()
|
bmap("n", "<M-p>", function()
|
||||||
vim.diagnostic.goto_prev({ severity = { min = vim.diagnostic.severity.INFO } })
|
vim.diagnostic.goto_prev({ severity = { min = vim.diagnostic.severity.HINT } })
|
||||||
end)
|
end)
|
||||||
bmap("n", "gd", vim.lsp.buf.definition)
|
bmap("n", "gd", vim.lsp.buf.definition)
|
||||||
bmap("n", "gD", vim.lsp.buf.type_definition)
|
bmap("n", "gD", vim.lsp.buf.type_definition)
|
||||||
@@ -672,6 +694,19 @@ require("lazy").setup({
|
|||||||
format = { enable = false },
|
format = { enable = false },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
html = {
|
||||||
|
html = {
|
||||||
|
format = {
|
||||||
|
templating = true,
|
||||||
|
wrapLineLength = 120,
|
||||||
|
wrapAttributes = "auto",
|
||||||
|
},
|
||||||
|
hover = {
|
||||||
|
documentation = true,
|
||||||
|
references = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
require("neodev").setup()
|
require("neodev").setup()
|
||||||
|
|
||||||
@@ -683,7 +718,6 @@ require("lazy").setup({
|
|||||||
ensure_installed = {
|
ensure_installed = {
|
||||||
"bashls", -- bash
|
"bashls", -- bash
|
||||||
"cssls", -- css
|
"cssls", -- css
|
||||||
"eslint", -- javascript
|
|
||||||
"html", -- html
|
"html", -- html
|
||||||
"jsonls", -- json
|
"jsonls", -- json
|
||||||
"lua_ls", -- lua
|
"lua_ls", -- lua
|
||||||
@@ -768,6 +802,8 @@ vim.o.expandtab = true -- Use spaces instead of tabs
|
|||||||
vim.o.shiftround = true -- Round indent
|
vim.o.shiftround = true -- Round indent
|
||||||
vim.o.tabstop = 4 -- Number of spaces tabs count for
|
vim.o.tabstop = 4 -- Number of spaces tabs count for
|
||||||
vim.o.shiftwidth = 4 -- Size of an indent
|
vim.o.shiftwidth = 4 -- Size of an indent
|
||||||
|
vim.o.listchars = "tab:→ ,trail:·,extends:↷,precedes:↶,nbsp:+,eol:↵"
|
||||||
|
vim.o.list = true -- Show listchars
|
||||||
|
|
||||||
-- search
|
-- search
|
||||||
vim.opt.wildmode = { "full" } -- Command-line completion mode
|
vim.opt.wildmode = { "full" } -- Command-line completion mode
|
||||||
|
|||||||
Reference in New Issue
Block a user