refactor: reduce number of requires

This commit is contained in:
Nydragon 2024-05-28 14:47:42 +09:00
parent 6cfb40cc79
commit 5a0dd8ea39
No known key found for this signature in database
GPG key ID: 14AA30A865EA1209

View file

@ -38,20 +38,23 @@ local lsp_flags = {
-- This is the default in Nvim 0.7+ -- This is the default in Nvim 0.7+
debounce_text_changes = 150, debounce_text_changes = 150,
} }
require("lspconfig")["pyright"].setup({
local lspconfig = require("lspconfig")
lspconfig.pyright.setup({
on_attach = on_attach, on_attach = on_attach,
flags = lsp_flags, flags = lsp_flags,
}) })
require("lspconfig").clangd.setup({}) lspconfig.clangd.setup({})
require("lspconfig").rust_analyzer.setup({}) lspconfig.rust_analyzer.setup({})
require("lspconfig").nixd.setup({}) lspconfig.nixd.setup({})
require("lspconfig").r_language_server.setup({}) lspconfig.r_language_server.setup({})
require("lspconfig").lua_ls.setup({ lspconfig.lua_ls.setup({
on_init = function(client) on_init = function(client)
local path = client.workspace_folders[1].name local path = client.workspace_folders[1].name
if vim.loop.fs_stat(path .. "/.luarc.json") or vim.loop.fs_stat(path .. "/.luarc.jsonc") then if vim.loop.fs_stat(path .. "/.luarc.json") or vim.loop.fs_stat(path .. "/.luarc.jsonc") then
@ -81,6 +84,6 @@ require("lspconfig").lua_ls.setup({
}, },
}) })
require("lspconfig").bashls.setup({}) lspconfig.bashls.setup({})
require("lspconfig").zls.setup({}) lspconfig.zls.setup({})