Optimize startup time and make some minor refactorings

This commit is contained in:
Martin Larsson 2024-07-12 23:00:01 +02:00
parent f8faa2f5c1
commit 456fc0da59
23 changed files with 69 additions and 11 deletions

View file

@ -1,5 +1,7 @@
return { return {
"otavioschwanck/arrow.nvim", "otavioschwanck/arrow.nvim",
event = "VeryLazy",
lazy = true,
opts = { opts = {
show_icons = true, show_icons = true,
leader_key = ",", leader_key = ",",

View file

@ -6,6 +6,7 @@ return {
"hrsh7th/cmp-path", "hrsh7th/cmp-path",
"hrsh7th/cmp-cmdline", "hrsh7th/cmp-cmdline",
}, },
event = "InsertEnter",
config = function() config = function()
local cmp = require("cmp") local cmp = require("cmp")

View file

@ -1,6 +1,8 @@
return { return {
"mistricky/codesnap.nvim", "mistricky/codesnap.nvim",
build = "make", build = "make",
event = "VeryLazy",
lazy = true,
config = function() config = function()
require("codesnap").setup({ require("codesnap").setup({
mac_window_bar = true, mac_window_bar = true,

View file

@ -1,5 +1,7 @@
return { return {
"norcalli/nvim-colorizer.lua", "norcalli/nvim-colorizer.lua",
event = "VeryLazy",
lazy = true,
opts = { opts = {
DEFAULT_OPTIONS = { DEFAULT_OPTIONS = {
RGB = true, RGB = true,

View file

@ -1,3 +1,4 @@
return { return {
"github/copilot.vim", "github/copilot.vim",
event = "InsertEnter",
} }

View file

@ -1,3 +1,5 @@
return { return {
"nvim-tree/nvim-web-devicons", "nvim-tree/nvim-web-devicons",
event = "VeryLazy",
lazy = true,
} }

View file

@ -1,5 +1,7 @@
return { return {
"ggandor/flit.nvim", "ggandor/flit.nvim",
event = "VeryLazy",
lazy = true,
opts = { opts = {
keys = { f = "f", F = "F", t = "t", T = "T" }, keys = { f = "f", F = "F", t = "t", T = "T" },
labeled_modes = "v", labeled_modes = "v",

View file

@ -3,6 +3,8 @@ return {
dependencies = { dependencies = {
"lewis6991/gitsigns.nvim" "lewis6991/gitsigns.nvim"
}, },
event = "VeryLazy",
lazy = true,
config = function() config = function()
require("gitsigns").setup({}) require("gitsigns").setup({})
local devicons = require("nvim-web-devicons") local devicons = require("nvim-web-devicons")
@ -89,5 +91,4 @@ return {
}) })
}) })
end, end,
event = "VeryLazy",
} }

View file

@ -1,6 +1,7 @@
return { return {
"lukas-reineke/indent-blankline.nvim", "lukas-reineke/indent-blankline.nvim",
main = "ibl", main = "ibl",
event = "BufRead",
opts = { opts = {
debounce = 100, debounce = 100,
scope = { scope = {

View file

@ -22,6 +22,8 @@ return {
dependencies = { dependencies = {
"tpope/vim-repeat", "tpope/vim-repeat",
}, },
event = "VeryLazy",
lazy = true,
config = function() config = function()
local leap = require("leap") local leap = require("leap")
leap.opts.safe_labels = {} leap.opts.safe_labels = {}

View file

@ -1,9 +1,11 @@
return { return {
"nvimdev/lspsaga.nvim", "nvimdev/lspsaga.nvim",
event = "LspAttach", event = "LspAttach",
lazy = true,
dependencies = { dependencies = {
"nvim-tree/nvim-web-devicons", "nvim-tree/nvim-web-devicons",
}, },
after = "nvim-lspconfig",
config = function() config = function()
require("lspsaga").setup({ require("lspsaga").setup({
symbol_in_winbar = { symbol_in_winbar = {

View file

@ -13,6 +13,8 @@ return {
dependencies = { dependencies = {
"nvim-tree/nvim-web-devicons" "nvim-tree/nvim-web-devicons"
}, },
event = "VeryLazy",
lazy = true,
config = function() config = function()
local catppuccin_theme = require("lualine.themes.catppuccin") local catppuccin_theme = require("lualine.themes.catppuccin")
local slightly_darker_surface0 = "#2c3045" local slightly_darker_surface0 = "#2c3045"

View file

@ -87,10 +87,19 @@ local function setup_dap()
require("nvim-dap-repl-highlights").setup() require("nvim-dap-repl-highlights").setup()
require("nvim-dap-virtual-text").setup() require("nvim-dap-virtual-text").setup()
local dap = require("dap")
utils.add_keymaps({ utils.add_keymaps({
n = { n = {
["<leader>dr"] = { cmd = ":lua require(\"dap\").continue()<CR>" }, ["<leader>dr"] = {
["<leader>db"] = { cmd = ":lua require(\"dap\").toggle_breakpoint()<CR>" }, cmd = function()
dap.continue()
end
},
["<leader>db"] = {
cmd = function()
dap.toggle_breakpoint()
end
},
["<leader>ds"] = { ["<leader>ds"] = {
cmd = function() cmd = function()
dap.disconnect({ terminateDebuggee = true }) dap.disconnect({ terminateDebuggee = true })
@ -98,9 +107,21 @@ local function setup_dap()
dapui.close() dapui.close()
end end
}, },
["<F10>"] = { cmd = ":lua require(\"dap\").step_over()<CR>" }, ["<F10>"] = {
["<F11>"] = { cmd = ":lua require(\"dap\").step_into()<CR>" }, cmd = function()
["<F12>"] = { cmd = ":lua require(\"dap\").step_out()<CR>" }, dap.step_over()
end
},
["<F11>"] = {
cmd = function()
dap.step_into()
end
},
["<F12>"] = {
cmd = function()
dap.step_out()
end
},
} }
}) })
end end

View file

@ -1,9 +1,9 @@
return { return {
"NeogitOrg/neogit", "NeogitOrg/neogit",
dependencies = { dependencies = {
"nvim-lua/plenary.nvim",
"sindrets/diffview.nvim", "sindrets/diffview.nvim",
"nvim-telescope/telescope.nvim",
}, },
event = "VeryLazy",
lazy = true,
config = true config = true
} }

View file

@ -1,4 +1,6 @@
return { return {
"nvim-neorg/neorg", "nvim-neorg/neorg",
opts = {} opts = {},
event = "VeryLazy",
lazy = true,
} }

View file

@ -1,8 +1,9 @@
return { return {
"folke/noice.nvim", "folke/noice.nvim",
event = "VeryLazy", event = "VeryLazy",
lazy = true,
dependencies = { dependencies = {
"MunifTanjim/nui.nvim", { "MunifTanjim/nui.nvim", lazy = true },
{ {
"rcarriga/nvim-notify", "rcarriga/nvim-notify",
opts = { opts = {

View file

@ -30,6 +30,8 @@ end
return { return {
"stevearc/oil.nvim", "stevearc/oil.nvim",
event = "VeryLazy",
lazy = true,
config = function() config = function()
oil = require("oil") oil = require("oil")
oil.setup({ oil.setup({

View file

@ -0,0 +1,4 @@
return {
"nvim-lua/plenary.nvim",
lazy = true,
}

View file

@ -1,5 +1,7 @@
return { return {
"rasulomaroff/reactive.nvim", "rasulomaroff/reactive.nvim",
event = "VeryLazy",
lazy = true,
opts = { opts = {
load = { load = {
"catppuccin-macchiato-cursor", "catppuccin-macchiato-cursor",

View file

@ -2,6 +2,7 @@ return {
"kylechui/nvim-surround", "kylechui/nvim-surround",
version = "*", version = "*",
event = "VeryLazy", event = "VeryLazy",
lazy = true,
opts = { opts = {
-- Make sure that we never get whitespaces when adding surroundings -- Make sure that we never get whitespaces when adding surroundings
surrounds = { surrounds = {

View file

@ -1,13 +1,14 @@
return { return {
"nvim-telescope/telescope.nvim", "nvim-telescope/telescope.nvim",
dependencies = { dependencies = {
"nvim-lua/plenary.nvim",
{ {
"nvim-telescope/telescope-fzf-native.nvim", "nvim-telescope/telescope-fzf-native.nvim",
build = build =
"cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build", "cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build",
} }
}, },
event = "VeryLazy",
lazy = true,
config = function() config = function()
require("telescope").setup({ require("telescope").setup({
extensions = { extensions = {

View file

@ -80,6 +80,8 @@ end
return { return {
"folke/trouble.nvim", "folke/trouble.nvim",
event = "VeryLazy",
lazy = true,
config = function() config = function()
local trouble = require("trouble") local trouble = require("trouble")
trouble.setup({}) trouble.setup({})

View file

@ -1,5 +1,7 @@
return { return {
"mbbill/undotree", "mbbill/undotree",
event = "VeryLazy",
lazy = true,
config = function() config = function()
require("utils").add_keymaps({ require("utils").add_keymaps({
n = { n = {