clean config & rm un-needed pcalls
This commit is contained in:
parent
ff93c22e63
commit
2b94bb92e0
|
@ -1,8 +1,4 @@
|
||||||
local present, cmp = pcall(require, "cmp")
|
local cmp = require "cmp"
|
||||||
|
|
||||||
if not present then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
loadfile(vim.g.base46_cache .. "cmp")()
|
loadfile(vim.g.base46_cache .. "cmp")()
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,3 @@
|
||||||
local present, lspconfig = pcall(require, "lspconfig")
|
|
||||||
|
|
||||||
if not present then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
loadfile(vim.g.base46_cache .. "lsp")()
|
loadfile(vim.g.base46_cache .. "lsp")()
|
||||||
require "nvchad_ui.lsp"
|
require "nvchad_ui.lsp"
|
||||||
|
|
||||||
|
@ -43,7 +37,7 @@ M.capabilities.textDocument.completion.completionItem = {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
lspconfig.sumneko_lua.setup {
|
require("lspconfig").sumneko_lua.setup {
|
||||||
on_attach = M.on_attach,
|
on_attach = M.on_attach,
|
||||||
capabilities = M.capabilities,
|
capabilities = M.capabilities,
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,3 @@
|
||||||
local present, mason = pcall(require, "mason")
|
|
||||||
|
|
||||||
if not present then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
loadfile(vim.g.base46_cache .. "mason")()
|
loadfile(vim.g.base46_cache .. "mason")()
|
||||||
|
|
||||||
local options = {
|
local options = {
|
||||||
|
@ -39,4 +33,4 @@ vim.api.nvim_create_user_command("MasonInstallAll", function()
|
||||||
vim.cmd("MasonInstall " .. table.concat(options.ensure_installed, " "))
|
vim.cmd("MasonInstall " .. table.concat(options.ensure_installed, " "))
|
||||||
end, {})
|
end, {})
|
||||||
|
|
||||||
mason.setup(options)
|
require("mason").setup(options)
|
||||||
|
|
|
@ -1,9 +1,3 @@
|
||||||
local present, nvimtree = pcall(require, "nvim-tree")
|
|
||||||
|
|
||||||
if not present then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
loadfile(vim.g.base46_cache .. "nvimtree")()
|
loadfile(vim.g.base46_cache .. "nvimtree")()
|
||||||
|
|
||||||
local options = {
|
local options = {
|
||||||
|
@ -86,4 +80,4 @@ local options = {
|
||||||
options = require("core.utils").load_override(options, "nvim-tree/nvim-tree.lua")
|
options = require("core.utils").load_override(options, "nvim-tree/nvim-tree.lua")
|
||||||
vim.g.nvimtree_side = options.view.side
|
vim.g.nvimtree_side = options.view.side
|
||||||
|
|
||||||
nvimtree.setup(options)
|
require("nvim-tree").setup(options)
|
||||||
|
|
|
@ -1,9 +1,3 @@
|
||||||
local present, nvterm = pcall(require, "nvterm")
|
|
||||||
|
|
||||||
if not present then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
require "base46.term"
|
require "base46.term"
|
||||||
|
|
||||||
local options = {
|
local options = {
|
||||||
|
@ -30,5 +24,4 @@ local options = {
|
||||||
}
|
}
|
||||||
|
|
||||||
options = require("core.utils").load_override(options, "NvChad/nvterm")
|
options = require("core.utils").load_override(options, "NvChad/nvterm")
|
||||||
|
require("nvterm").setup(options)
|
||||||
nvterm.setup(options)
|
|
||||||
|
|
|
@ -4,32 +4,20 @@ local load_override = require("core.utils").load_override
|
||||||
local utils = require "core.utils"
|
local utils = require "core.utils"
|
||||||
|
|
||||||
M.autopairs = function()
|
M.autopairs = function()
|
||||||
local present1, autopairs = pcall(require, "nvim-autopairs")
|
|
||||||
local present2, cmp = pcall(require, "cmp")
|
|
||||||
|
|
||||||
if not (present1 and present2) then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local options = {
|
local options = {
|
||||||
fast_wrap = {},
|
fast_wrap = {},
|
||||||
disable_filetype = { "TelescopePrompt", "vim" },
|
disable_filetype = { "TelescopePrompt", "vim" },
|
||||||
}
|
}
|
||||||
|
|
||||||
options = load_override(options, "windwp/nvim-autopairs")
|
options = load_override(options, "windwp/nvim-autopairs")
|
||||||
autopairs.setup(options)
|
require("nvim-autopairs").setup(options)
|
||||||
|
|
||||||
|
-- setup cmp for autopairs
|
||||||
local cmp_autopairs = require "nvim-autopairs.completion.cmp"
|
local cmp_autopairs = require "nvim-autopairs.completion.cmp"
|
||||||
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done())
|
require("cmp").event:on("confirm_done", cmp_autopairs.on_confirm_done())
|
||||||
end
|
end
|
||||||
|
|
||||||
M.blankline = function()
|
M.blankline = function()
|
||||||
local present, blankline = pcall(require, "indent_blankline")
|
|
||||||
|
|
||||||
if not present then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
loadfile(vim.g.base46_cache .. "blankline")()
|
loadfile(vim.g.base46_cache .. "blankline")()
|
||||||
|
|
||||||
local options = {
|
local options = {
|
||||||
|
@ -52,36 +40,14 @@ M.blankline = function()
|
||||||
}
|
}
|
||||||
|
|
||||||
options = load_override(options, "lukas-reineke/indent-blankline.nvim")
|
options = load_override(options, "lukas-reineke/indent-blankline.nvim")
|
||||||
blankline.setup(options)
|
require("indent_blankline").setup(options)
|
||||||
end
|
end
|
||||||
|
|
||||||
M.colorizer = function()
|
M.colorizer = function()
|
||||||
local present, colorizer = pcall(require, "colorizer")
|
local options = {}
|
||||||
|
|
||||||
if not present then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local options = {
|
|
||||||
filetypes = {
|
|
||||||
"*",
|
|
||||||
},
|
|
||||||
user_default_options = {
|
|
||||||
RGB = true, -- #RGB hex codes
|
|
||||||
RRGGBB = true, -- #RRGGBB hex codes
|
|
||||||
names = false, -- "Name" codes like Blue
|
|
||||||
RRGGBBAA = false, -- #RRGGBBAA hex codes
|
|
||||||
rgb_fn = false, -- CSS rgb() and rgba() functions
|
|
||||||
hsl_fn = false, -- CSS hsl() and hsla() functions
|
|
||||||
css = false, -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB
|
|
||||||
css_fn = false, -- Enable all CSS *functions*: rgb_fn, hsl_fn
|
|
||||||
mode = "background", -- Set the display mode.
|
|
||||||
tailwind = true, -- Enable tailwind colors
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
options = load_override(options, "NvChad/nvim-colorizer.lua")
|
options = load_override(options, "NvChad/nvim-colorizer.lua")
|
||||||
colorizer.setup(options)
|
require("colorizer").setup(options)
|
||||||
|
|
||||||
-- execute colorizer as soon as possible
|
-- execute colorizer as soon as possible
|
||||||
vim.defer_fn(function()
|
vim.defer_fn(function()
|
||||||
require("colorizer").attach_to_buffer(0)
|
require("colorizer").attach_to_buffer(0)
|
||||||
|
@ -89,31 +55,18 @@ M.colorizer = function()
|
||||||
end
|
end
|
||||||
|
|
||||||
M.comment = function()
|
M.comment = function()
|
||||||
local present, nvim_comment = pcall(require, "Comment")
|
require("Comment").setup(load_override({}, "numToStr/Comment.nvim"))
|
||||||
|
|
||||||
if not present then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local options = {}
|
|
||||||
options = load_override(options, "numToStr/Comment.nvim")
|
|
||||||
nvim_comment.setup(options)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
M.luasnip = function()
|
M.luasnip = function()
|
||||||
local present, luasnip = pcall(require, "luasnip")
|
|
||||||
|
|
||||||
if not present then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local options = {
|
local options = {
|
||||||
history = true,
|
history = true,
|
||||||
updateevents = "TextChanged,TextChangedI",
|
updateevents = "TextChanged,TextChangedI",
|
||||||
}
|
}
|
||||||
|
|
||||||
options = load_override(options, "L3MON4D3/LuaSnip")
|
options = load_override(options, "L3MON4D3/LuaSnip")
|
||||||
luasnip.config.set_config(options)
|
require("luasnip").config.set_config(options)
|
||||||
|
|
||||||
require("luasnip.loaders.from_vscode").lazy_load { paths = vim.g.luasnippets_path or "" }
|
require("luasnip.loaders.from_vscode").lazy_load { paths = vim.g.luasnippets_path or "" }
|
||||||
require("luasnip.loaders.from_vscode").lazy_load()
|
require("luasnip.loaders.from_vscode").lazy_load()
|
||||||
|
|
||||||
|
@ -130,12 +83,6 @@ M.luasnip = function()
|
||||||
end
|
end
|
||||||
|
|
||||||
M.gitsigns = function()
|
M.gitsigns = function()
|
||||||
local present, gitsigns = pcall(require, "gitsigns")
|
|
||||||
|
|
||||||
if not present then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
loadfile(vim.g.base46_cache .. "git")()
|
loadfile(vim.g.base46_cache .. "git")()
|
||||||
|
|
||||||
local options = {
|
local options = {
|
||||||
|
@ -153,20 +100,16 @@ M.gitsigns = function()
|
||||||
}
|
}
|
||||||
|
|
||||||
options = load_override(options, "lewis6991/gitsigns.nvim")
|
options = load_override(options, "lewis6991/gitsigns.nvim")
|
||||||
gitsigns.setup(options)
|
require("gitsigns").setup(options)
|
||||||
end
|
end
|
||||||
|
|
||||||
M.devicons = function()
|
M.devicons = function()
|
||||||
local present, devicons = pcall(require, "nvim-web-devicons")
|
|
||||||
|
|
||||||
if present then
|
|
||||||
loadfile(vim.g.base46_cache .. "devicons")()
|
loadfile(vim.g.base46_cache .. "devicons")()
|
||||||
|
|
||||||
local options = { override = require("nvchad_ui.icons").devicons }
|
local options = { override = require("nvchad_ui.icons").devicons }
|
||||||
options = require("core.utils").load_override(options, "nvim-tree/nvim-web-devicons")
|
options = require("core.utils").load_override(options, "nvim-tree/nvim-web-devicons")
|
||||||
|
|
||||||
devicons.setup(options)
|
require("nvim-web-devicons").setup(options)
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
|
@ -1,9 +1,3 @@
|
||||||
local present, telescope = pcall(require, "telescope")
|
|
||||||
|
|
||||||
if not present then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
loadfile(vim.g.base46_cache .. "telescope")()
|
loadfile(vim.g.base46_cache .. "telescope")()
|
||||||
|
|
||||||
local options = {
|
local options = {
|
||||||
|
@ -60,13 +54,13 @@ local options = {
|
||||||
extensions_list = { "themes", "terms" },
|
extensions_list = { "themes", "terms" },
|
||||||
}
|
}
|
||||||
|
|
||||||
|
local telescope = require "telescope"
|
||||||
|
|
||||||
-- check for any override
|
-- check for any override
|
||||||
options = require("core.utils").load_override(options, "nvim-telescope/telescope.nvim")
|
options = require("core.utils").load_override(options, "nvim-telescope/telescope.nvim")
|
||||||
telescope.setup(options)
|
telescope.setup(options)
|
||||||
|
|
||||||
-- load extensions
|
-- load extensions
|
||||||
pcall(function()
|
|
||||||
for _, ext in ipairs(options.extensions_list) do
|
for _, ext in ipairs(options.extensions_list) do
|
||||||
telescope.load_extension(ext)
|
telescope.load_extension(ext)
|
||||||
end
|
end
|
||||||
end)
|
|
||||||
|
|
|
@ -1,9 +1,3 @@
|
||||||
local present, treesitter = pcall(require, "nvim-treesitter.configs")
|
|
||||||
|
|
||||||
if not present then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
loadfile(vim.g.base46_cache .. "syntax")()
|
loadfile(vim.g.base46_cache .. "syntax")()
|
||||||
loadfile(vim.g.base46_cache .. "treesitter")()
|
loadfile(vim.g.base46_cache .. "treesitter")()
|
||||||
|
|
||||||
|
@ -25,4 +19,4 @@ local options = {
|
||||||
-- check for any override
|
-- check for any override
|
||||||
options = require("core.utils").load_override(options, "nvim-treesitter/nvim-treesitter")
|
options = require("core.utils").load_override(options, "nvim-treesitter/nvim-treesitter")
|
||||||
|
|
||||||
treesitter.setup(options)
|
require("nvim-treesitter.configs").setup(options)
|
||||||
|
|
|
@ -1,9 +1,3 @@
|
||||||
local present, wk = pcall(require, "which-key")
|
|
||||||
|
|
||||||
if not present then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
loadfile(vim.g.base46_cache .. "whichkey")()
|
loadfile(vim.g.base46_cache .. "whichkey")()
|
||||||
|
|
||||||
local options = {
|
local options = {
|
||||||
|
@ -38,4 +32,4 @@ local options = {
|
||||||
|
|
||||||
options = require("core.utils").load_override(options, "folke/which-key.nvim")
|
options = require("core.utils").load_override(options, "folke/which-key.nvim")
|
||||||
|
|
||||||
wk.setup(options)
|
require("which-key").setup(options)
|
||||||
|
|
Loading…
Reference in New Issue