End of config for now

This commit is contained in:
2023-12-30 18:35:52 +01:00
parent c6fc077654
commit 9d87a5985d
21 changed files with 490 additions and 131 deletions

57
lua/config/lsp/bash.lua Normal file
View File

@@ -0,0 +1,57 @@
local ok, mason_lspconfig, mason_tool_installer, lspconfig, conform, lint = pcall(function()
return require("mason-lspconfig"),
require("mason-tool-installer"),
require("lspconfig"),
require("conform"),
require("lint")
end)
if not ok then
return
end
mason_lspconfig.setup({
ensure_installed = { "bashls" },
})
lspconfig.bashls.setup({
capabilities = require("config/lsp/capabilities"),
on_attach = require("config/lsp/attach"),
})
mason_tool_installer.setup({
ensure_installed = { "shellcheck" },
})
conform.setup({
formatters_by_ft = {
sh = { "shellcheck" },
},
format_on_save = {
async = false,
timeout_ms = 500,
lsp_fallback = true,
},
})
vim.keymap.set({ "n", "v" }, "<leader>lf", function()
conform.format({
async = false,
timeout_ms = 500,
lsp_fallback = true,
})
end, { desc = "Format" })
lint.linters_by_ft = {
lua = { "shellcheck" },
}
vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost", "InsertLeave" }, {
callback = function()
lint.try_lint()
end,
})
vim.keymap.set("n", "<leader>ll", function()
lint.try_lint()
end, { desc = "Lint" })