mirror of
https://github.com/ViViDboarder/vim-settings.git
synced 2024-12-22 23:37:33 +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
|
-- Custom status line
|
||||||
|
|
||||||
{
|
{
|
||||||
"https://github.com/nvim-lualine/lualine.nvim",
|
"https://github.com/nvim-lualine/lualine.nvim",
|
||||||
config = function()
|
config = function()
|
||||||
@ -245,6 +244,7 @@ return {
|
|||||||
-- Rust analyzer
|
-- Rust analyzer
|
||||||
{
|
{
|
||||||
"https://github.com/simrat39/rust-tools.nvim",
|
"https://github.com/simrat39/rust-tools.nvim",
|
||||||
|
ft = { "rust" },
|
||||||
},
|
},
|
||||||
|
|
||||||
-- Better display of lsp diagnostics
|
-- Better display of lsp diagnostics
|
||||||
@ -262,13 +262,14 @@ return {
|
|||||||
opts = {
|
opts = {
|
||||||
input_buffer_type = "dressing",
|
input_buffer_type = "dressing",
|
||||||
},
|
},
|
||||||
-- Only supports >=0.8.0
|
lazy = true,
|
||||||
enabled = vim.fn.has("nvim-0.8.0") == 1,
|
|
||||||
},
|
},
|
||||||
|
|
||||||
-- Generic linter/formatters in diagnostics API
|
-- Generic linter/formatters in diagnostics API
|
||||||
{
|
{
|
||||||
"https://github.com/jose-elias-alvarez/null-ls.nvim",
|
"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({
|
branch = utils.map_version_rule({
|
||||||
[">=0.8.0"] = utils.nil_val,
|
[">=0.8.0"] = utils.nil_val,
|
||||||
[">=0.7.0"] = "0.7-compat",
|
[">=0.7.0"] = "0.7-compat",
|
||||||
@ -291,10 +292,6 @@ return {
|
|||||||
"https://github.com/preservim/vim-pencil",
|
"https://github.com/preservim/vim-pencil",
|
||||||
cmd = { "Pencil" },
|
cmd = { "Pencil" },
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"https://github.com/preservim/vim-textobj-sentence",
|
|
||||||
dependencies = { { "https://github.com/kana/vim-textobj-user" } },
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"https://github.com/junegunn/goyo.vim",
|
"https://github.com/junegunn/goyo.vim",
|
||||||
cmd = { "Goyo", "Zen" },
|
cmd = { "Goyo", "Zen" },
|
||||||
@ -329,6 +326,7 @@ return {
|
|||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
-- Completion
|
-- Completion
|
||||||
{
|
{
|
||||||
"https://github.com/L3MON4D3/LuaSnip",
|
"https://github.com/L3MON4D3/LuaSnip",
|
||||||
@ -356,11 +354,10 @@ return {
|
|||||||
[">0.7.0"] = utils.nil_val,
|
[">0.7.0"] = utils.nil_val,
|
||||||
[">=0.5.0"] = "b10829736542e7cc9291e60bab134df1273165c9",
|
[">=0.5.0"] = "b10829736542e7cc9291e60bab134df1273165c9",
|
||||||
}),
|
}),
|
||||||
dependencies = { { "https://github.com/hrsh7th/nvim-cmp" } },
|
dependencies = {
|
||||||
|
{ "https://github.com/hrsh7th/nvim-cmp" },
|
||||||
|
{ "https://github.com/L3MON4D3/LuaSnip" },
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"https://github.com/L3MON4D3/LuaSnip",
|
|
||||||
dependencies = { { "https://github.com/hrsh7th/nvim-cmp" } },
|
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -372,7 +369,6 @@ return {
|
|||||||
[">=0.7.0"] = utils.nil_val,
|
[">=0.7.0"] = utils.nil_val,
|
||||||
[">=0.5.0"] = "bba6fb67fdafc0af7c5454058dfbabc2182741f4",
|
[">=0.5.0"] = "bba6fb67fdafc0af7c5454058dfbabc2182741f4",
|
||||||
}),
|
}),
|
||||||
event = "InsertEnter *",
|
|
||||||
},
|
},
|
||||||
|
|
||||||
-- Add snippets
|
-- Add snippets
|
||||||
@ -383,6 +379,8 @@ return {
|
|||||||
require("luasnip.loaders.from_vscode").lazy_load()
|
require("luasnip.loaders.from_vscode").lazy_load()
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
event = "InsertEnter *",
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"https://github.com/ray-x/lsp_signature.nvim",
|
"https://github.com/ray-x/lsp_signature.nvim",
|
||||||
|
@ -287,10 +287,10 @@ function M.config_lsp()
|
|||||||
-- Configure neovim dev for when sumneko_lua is installed
|
-- Configure neovim dev for when sumneko_lua is installed
|
||||||
utils.try_require("neodev", function(neodev)
|
utils.try_require("neodev", function(neodev)
|
||||||
local config = {}
|
local config = {}
|
||||||
if utils.can_require("dapui") then
|
utils.try_require("dapui", function()
|
||||||
config.plugins = { "nvim-dap-ui" }
|
config.plugins = { "nvim-dap-ui" }
|
||||||
config.types = true
|
config.types = true
|
||||||
end
|
end)
|
||||||
neodev.setup(config)
|
neodev.setup(config)
|
||||||
end)
|
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.current_buffer_tags, { desc = "Find buffer tags" })
|
||||||
finder_keymap("T", telescope_builtin.tags, { desc = "Find tags" })
|
finder_keymap("T", telescope_builtin.tags, { desc = "Find tags" })
|
||||||
|
|
||||||
if utils.can_require("sg.telescope") then
|
utils.try_require("sg.telescope", function(telescope_sg)
|
||||||
finder_keymap("G", require("sg.telescope").fuzzy_search_results, { desc = "Search Sourcegraph" })
|
finder_keymap("G", telescope_sg.fuzzy_search_results, { desc = "Search Sourcegraph" })
|
||||||
end
|
end)
|
||||||
|
|
||||||
load_extensions()
|
load_extensions()
|
||||||
end
|
end
|
||||||
|
@ -16,32 +16,6 @@ function M.env_default(name, def)
|
|||||||
return val == nil and def or val
|
return val == nil and def or val
|
||||||
end
|
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
|
-- Require a package and a "_local" suffixed one
|
||||||
function M.require_with_local(name)
|
function M.require_with_local(name)
|
||||||
-- Local should completely override the versioned module
|
-- Local should completely override the versioned module
|
||||||
@ -50,7 +24,7 @@ function M.require_with_local(name)
|
|||||||
-- of boiler plate
|
-- of boiler plate
|
||||||
local rmod = require(name)
|
local rmod = require(name)
|
||||||
|
|
||||||
local lmod = M.maybe_require(name .. "_local")
|
local lmod = M.try_require(name .. "_local")
|
||||||
if lmod ~= nil then
|
if lmod ~= nil then
|
||||||
return lmod
|
return lmod
|
||||||
end
|
end
|
||||||
@ -58,9 +32,14 @@ function M.require_with_local(name)
|
|||||||
return rmod
|
return rmod
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Returns whether or not packer plugin is loaded
|
-- Returns whether or not lazy plugin is loaded
|
||||||
function M.is_plugin_loaded(name)
|
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
|
end
|
||||||
|
|
||||||
-- Try to require something and perform some action if it was found
|
-- Try to require something and perform some action if it was found
|
||||||
|
Loading…
Reference in New Issue
Block a user