Skip to content

Commit

Permalink
feat: Improve lazy loading of plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
Allaman committed Jan 20, 2024
1 parent 2d31628 commit bdef077
Show file tree
Hide file tree
Showing 20 changed files with 34 additions and 15 deletions.
1 change: 1 addition & 0 deletions lua/core/plugins/autopairs.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
local M = {
"windwp/nvim-autopairs",
event = { "BufReadPre", "BufNewFile" },
opts = {
enable_check_bracket_line = false, -- Don't add pairs if it already has a close pair in the same line
ignored_next_char = "[%w%.]", -- will ignore alphanumeric and `.` symbol
Expand Down
2 changes: 1 addition & 1 deletion lua/core/plugins/dap.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
local M = {
{
"mfussenegger/nvim-dap",
event = "VeryLazy",
lazy = true,
dependencies = {
"mfussenegger/nvim-dap-python",
"leoluz/nvim-dap-go",
Expand Down
1 change: 1 addition & 0 deletions lua/core/plugins/dropbear.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ local utils = require("utils.functions")

return {
"Bekaboo/dropbar.nvim",
event = { "BufReadPost", "BufNewFile" },
enabled = utils.isNeovimVersionsatisfied(10),
}
2 changes: 1 addition & 1 deletion lua/core/plugins/flash.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
return {
"folke/flash.nvim",
event = "VeryLazy",
event = { "BufReadPost", "BufNewFile" },
opts = {},
keys = {
{
Expand Down
2 changes: 2 additions & 0 deletions lua/core/plugins/flatten.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
return {
"willothy/flatten.nvim",
lazy = false,
priority = 1001,
opts = {
window = {
open = "current",
Expand Down
1 change: 1 addition & 0 deletions lua/core/plugins/fugitive.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
-- no Lua alternative
local M = {
"tpope/vim-fugitive",
cmd = "G",
}

return M
1 change: 1 addition & 0 deletions lua/core/plugins/harpoon.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ return {
"ThePrimeagen/harpoon",
enabled = vim.g.config.plugins.harpoon.enable,
dependencies = { "nvim-lua/plenary.nvim" },
event = "VimEnter",
branch = "harpoon2",
config = function()
local harpoon = require("harpoon")
Expand Down
2 changes: 1 addition & 1 deletion lua/core/plugins/hydra.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
local M = {
"anuvyklack/hydra.nvim",
event = "VeryLazy",
lazy = true,
dependencies = {
"anuvyklack/keymap-layer.nvim",
{
Expand Down
1 change: 1 addition & 0 deletions lua/core/plugins/inc-rename.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
return {
"smjonas/inc-rename.nvim",
lazy = true,
config = true,
}
6 changes: 3 additions & 3 deletions lua/core/plugins/lsp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ return {
event = { "BufReadPre", "BufNewFile" },
dependencies = {
{ "onsails/lspkind-nvim" },
{ "folke/neodev.nvim", config = true, lazy = true, ft = "lua" },
{ "folke/neoconf.nvim", config = true, lazy = true, ft = "lua" },
{ "folke/neoconf.nvim", config = true, ft = "lua" }, -- must be loaded before lsp
},
config = function()
require("core.plugins.lsp.lsp")
end,
},
{
"williamboman/mason.nvim",
event = "VeryLazy",
lazy = true,
cmd = "Mason",
dependencies = {
{ "williamboman/mason-lspconfig.nvim", module = "mason" },
},
Expand Down
2 changes: 1 addition & 1 deletion lua/core/plugins/mini.lua
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ return {

{
"echasnovski/mini.files",
event = { "VimEnter" },
kyes = "-",
opts = {
windows = {
-- Whether to show preview of directory under cursor
Expand Down
1 change: 1 addition & 0 deletions lua/core/plugins/neodev.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
return { "folke/neodev.nvim", config = true, ft = "lua" }
1 change: 1 addition & 0 deletions lua/core/plugins/none-ls.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
local M = {
"nvimtools/none-ls.nvim",
event = { "BufReadPre", "BufNewFile" },
dependencies = {
"nvim-lua/plenary.nvim",
},
Expand Down
1 change: 1 addition & 0 deletions lua/core/plugins/project.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
local M = {
"ahmedkhalf/project.nvim",
cmd = "Telescope projects",
-- can't use 'opts' because module has non standard name 'project_nvim'
config = function()
require("project_nvim").setup({
Expand Down
18 changes: 13 additions & 5 deletions lua/core/plugins/starlite.lua
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
local M = {
"ironhouzi/starlite-nvim",
event = { "BufReadPost", "BufNewFile" },
config = function()
local map = vim.keymap.set
local default_options = { silent = true }
map("n", "*", ":lua require'starlite'.star()<cr>", default_options)
map("n", "g*", ":lua require'starlite'.g_star()<cr>", default_options)
map("n", "#", ":lua require'starlite'.hash()<cr>", default_options)
map("n", "g#", ":lua require'starlite'.g_hash()<cr>", default_options)
map({ "n", "x" }, "*", function()
require("starlite").star()
end, { desc = "Search forward (word)" })
map({ "n", "x" }, "g*", function()
require("starlite").g_star()
end, { desc = "Search forward" })
map({ "n", "x" }, "#", function()
require("starlite").hash()
end, { desc = "Search backward (word)" })
map({ "n", "x" }, "g#", function()
require("starlite").g_hash()
end, { desc = "Search backward" })
end,
}

Expand Down
1 change: 1 addition & 0 deletions lua/core/plugins/toggleterm.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
local M = {
"akinsho/nvim-toggleterm.lua",
keys = "<C-n>",
config = function()
local map = vim.api.nvim_set_keymap
local buf_map = vim.api.nvim_buf_set_keymap
Expand Down
1 change: 1 addition & 0 deletions lua/core/plugins/trouble.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ local config = vim.g.config.plugins.trouble

return {
"folke/trouble.nvim",
lazy = true,
dependencies = { "nvim-tree/nvim-web-devicons" },
enabled = config.enable,
opts = config.opts,
Expand Down
1 change: 0 additions & 1 deletion lua/core/plugins/typst.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
return {
"kaarmu/typst.vim",
ft = "typst",
lazy = false,
}
2 changes: 1 addition & 1 deletion lua/core/plugins/vimtex.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
local M = {
"lervag/vimtex",
lazy = false,
ft = "tex",
config = function()
local conf = vim.g.config.plugins.tex
local g = vim.g
Expand Down
2 changes: 1 addition & 1 deletion lua/core/plugins/which-key.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
local icons = require("utils.icons")
local M = {
"folke/which-key.nvim",
event = "VeryLazy",
event = "VimEnter",
opts = {
icons = {
breadcrumb = icons.arrows.DoubleArrowRight, -- symbol used in the command line area that shows your active key combo
Expand Down

0 comments on commit bdef077

Please sign in to comment.