mirror of
https://github.com/ViViDboarder/vim-settings.git
synced 2024-12-22 18:47:35 +00:00
More getting things working well with lazy
This commit is contained in:
parent
144903e2c4
commit
65f434fcb8
@ -125,7 +125,6 @@ return {
|
||||
},
|
||||
|
||||
-- Custom status line
|
||||
|
||||
{
|
||||
"https://github.com/nvim-lualine/lualine.nvim",
|
||||
config = function()
|
||||
@ -245,6 +244,7 @@ return {
|
||||
-- Rust analyzer
|
||||
{
|
||||
"https://github.com/simrat39/rust-tools.nvim",
|
||||
ft = { "rust" },
|
||||
},
|
||||
|
||||
-- Better display of lsp diagnostics
|
||||
@ -262,13 +262,14 @@ return {
|
||||
opts = {
|
||||
input_buffer_type = "dressing",
|
||||
},
|
||||
-- Only supports >=0.8.0
|
||||
enabled = vim.fn.has("nvim-0.8.0") == 1,
|
||||
lazy = true,
|
||||
},
|
||||
|
||||
-- Generic linter/formatters in diagnostics API
|
||||
{
|
||||
"https://github.com/jose-elias-alvarez/null-ls.nvim",
|
||||
-- This is lazy and configured after lspis loaded in plugins/lsp.lua
|
||||
lazy = true,
|
||||
branch = utils.map_version_rule({
|
||||
[">=0.8.0"] = utils.nil_val,
|
||||
[">=0.7.0"] = "0.7-compat",
|
||||
@ -291,10 +292,6 @@ return {
|
||||
"https://github.com/preservim/vim-pencil",
|
||||
cmd = { "Pencil" },
|
||||
},
|
||||
{
|
||||
"https://github.com/preservim/vim-textobj-sentence",
|
||||
dependencies = { { "https://github.com/kana/vim-textobj-user" } },
|
||||
},
|
||||
{
|
||||
"https://github.com/junegunn/goyo.vim",
|
||||
cmd = { "Goyo", "Zen" },
|
||||
@ -329,61 +326,62 @@ return {
|
||||
}),
|
||||
},
|
||||
|
||||
-- Completion
|
||||
{
|
||||
"https://github.com/L3MON4D3/LuaSnip",
|
||||
version = "1.x.x",
|
||||
},
|
||||
{
|
||||
"https://github.com/hrsh7th/cmp-nvim-lsp",
|
||||
commit = utils.map_version_rule({
|
||||
[">=0.7.0"] = utils.nil_val,
|
||||
["<0.7.0"] = "3cf38d9c957e95c397b66f91967758b31be4abe6",
|
||||
}),
|
||||
dependencies = { { "https://github.com/hrsh7th/nvim-cmp" } },
|
||||
},
|
||||
{
|
||||
"https://github.com/hrsh7th/cmp-buffer",
|
||||
dependencies = { { "https://github.com/hrsh7th/nvim-cmp" } },
|
||||
},
|
||||
{
|
||||
"https://github.com/f3fora/cmp-spell",
|
||||
dependencies = { { "https://github.com/hrsh7th/nvim-cmp" } },
|
||||
},
|
||||
{
|
||||
"https://github.com/saadparwaiz1/cmp_luasnip",
|
||||
commit = utils.map_version_rule({
|
||||
[">0.7.0"] = utils.nil_val,
|
||||
[">=0.5.0"] = "b10829736542e7cc9291e60bab134df1273165c9",
|
||||
}),
|
||||
dependencies = { { "https://github.com/hrsh7th/nvim-cmp" } },
|
||||
},
|
||||
{
|
||||
"https://github.com/L3MON4D3/LuaSnip",
|
||||
dependencies = { { "https://github.com/hrsh7th/nvim-cmp" } },
|
||||
},
|
||||
-- Completion
|
||||
{
|
||||
"https://github.com/L3MON4D3/LuaSnip",
|
||||
version = "1.x.x",
|
||||
},
|
||||
{
|
||||
"https://github.com/hrsh7th/cmp-nvim-lsp",
|
||||
commit = utils.map_version_rule({
|
||||
[">=0.7.0"] = utils.nil_val,
|
||||
["<0.7.0"] = "3cf38d9c957e95c397b66f91967758b31be4abe6",
|
||||
}),
|
||||
dependencies = { { "https://github.com/hrsh7th/nvim-cmp" } },
|
||||
},
|
||||
{
|
||||
"https://github.com/hrsh7th/cmp-buffer",
|
||||
dependencies = { { "https://github.com/hrsh7th/nvim-cmp" } },
|
||||
},
|
||||
{
|
||||
"https://github.com/f3fora/cmp-spell",
|
||||
dependencies = { { "https://github.com/hrsh7th/nvim-cmp" } },
|
||||
},
|
||||
{
|
||||
"https://github.com/saadparwaiz1/cmp_luasnip",
|
||||
commit = utils.map_version_rule({
|
||||
[">0.7.0"] = utils.nil_val,
|
||||
[">=0.5.0"] = "b10829736542e7cc9291e60bab134df1273165c9",
|
||||
}),
|
||||
dependencies = {
|
||||
{ "https://github.com/hrsh7th/nvim-cmp" },
|
||||
{ "https://github.com/L3MON4D3/LuaSnip" },
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
"https://github.com/hrsh7th/nvim-cmp",
|
||||
config = function()
|
||||
require("plugins.completion").config_cmp()
|
||||
end,
|
||||
commit = utils.map_version_rule({
|
||||
[">=0.7.0"] = utils.nil_val,
|
||||
[">=0.5.0"] = "bba6fb67fdafc0af7c5454058dfbabc2182741f4",
|
||||
}),
|
||||
{
|
||||
"https://github.com/hrsh7th/nvim-cmp",
|
||||
config = function()
|
||||
require("plugins.completion").config_cmp()
|
||||
end,
|
||||
commit = utils.map_version_rule({
|
||||
[">=0.7.0"] = utils.nil_val,
|
||||
[">=0.5.0"] = "bba6fb67fdafc0af7c5454058dfbabc2182741f4",
|
||||
}),
|
||||
},
|
||||
|
||||
-- Add snippets
|
||||
{
|
||||
"https://github.com/rafamadriz/friendly-snippets",
|
||||
dependencies = { { "https://github.com/L3MON4D3/LuaSnip" } },
|
||||
config = function()
|
||||
require("luasnip.loaders.from_vscode").lazy_load()
|
||||
end,
|
||||
},
|
||||
event = "InsertEnter *",
|
||||
},
|
||||
|
||||
-- Add snippets
|
||||
{
|
||||
"https://github.com/rafamadriz/friendly-snippets",
|
||||
dependencies = { { "https://github.com/L3MON4D3/LuaSnip" } },
|
||||
config = function()
|
||||
require("luasnip.loaders.from_vscode").lazy_load()
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
"https://github.com/ray-x/lsp_signature.nvim",
|
||||
opts = {
|
||||
|
@ -287,10 +287,10 @@ function M.config_lsp()
|
||||
-- Configure neovim dev for when sumneko_lua is installed
|
||||
utils.try_require("neodev", function(neodev)
|
||||
local config = {}
|
||||
if utils.can_require("dapui") then
|
||||
utils.try_require("dapui", function()
|
||||
config.plugins = { "nvim-dap-ui" }
|
||||
config.types = true
|
||||
end
|
||||
end)
|
||||
neodev.setup(config)
|
||||
end)
|
||||
|
||||
|
@ -41,9 +41,9 @@ local function config_telescope()
|
||||
finder_keymap("t", telescope_builtin.current_buffer_tags, { desc = "Find buffer tags" })
|
||||
finder_keymap("T", telescope_builtin.tags, { desc = "Find tags" })
|
||||
|
||||
if utils.can_require("sg.telescope") then
|
||||
finder_keymap("G", require("sg.telescope").fuzzy_search_results, { desc = "Search Sourcegraph" })
|
||||
end
|
||||
utils.try_require("sg.telescope", function(telescope_sg)
|
||||
finder_keymap("G", telescope_sg.fuzzy_search_results, { desc = "Search Sourcegraph" })
|
||||
end)
|
||||
|
||||
load_extensions()
|
||||
end
|
||||
|
@ -16,32 +16,6 @@ function M.env_default(name, def)
|
||||
return val == nil and def or val
|
||||
end
|
||||
|
||||
-- Checks to see if a package can be required
|
||||
function M.can_require(name)
|
||||
if package.loaded[name] then
|
||||
return false
|
||||
else
|
||||
for _, searcher in ipairs(package.searchers or package.loaders) do
|
||||
local loader = searcher(name)
|
||||
if type(loader) == "function" then
|
||||
package.preload[name] = loader
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
-- Require a package if possible
|
||||
function M.maybe_require(name)
|
||||
if M.can_require(name) then
|
||||
return require(name)
|
||||
end
|
||||
|
||||
return nil
|
||||
end
|
||||
|
||||
-- Require a package and a "_local" suffixed one
|
||||
function M.require_with_local(name)
|
||||
-- Local should completely override the versioned module
|
||||
@ -50,7 +24,7 @@ function M.require_with_local(name)
|
||||
-- of boiler plate
|
||||
local rmod = require(name)
|
||||
|
||||
local lmod = M.maybe_require(name .. "_local")
|
||||
local lmod = M.try_require(name .. "_local")
|
||||
if lmod ~= nil then
|
||||
return lmod
|
||||
end
|
||||
@ -58,9 +32,14 @@ function M.require_with_local(name)
|
||||
return rmod
|
||||
end
|
||||
|
||||
-- Returns whether or not packer plugin is loaded
|
||||
-- Returns whether or not lazy plugin is loaded
|
||||
function M.is_plugin_loaded(name)
|
||||
return _G["packer_plugins"] and _G["packer_plugins"][name] and _G["packer_plugins"][name].loaded
|
||||
local result = false
|
||||
M.try_require("lazy.core.config", function(config)
|
||||
result = config.plugins[name] ~= nil
|
||||
end)
|
||||
|
||||
return result
|
||||
end
|
||||
|
||||
-- Try to require something and perform some action if it was found
|
||||
|
Loading…
Reference in New Issue
Block a user