From dec8271195821d6310217de99da8d3c21994eff7 Mon Sep 17 00:00:00 2001 From: Raoul Branten Date: Tue, 13 May 2025 16:00:41 +0200 Subject: [PATCH] changed to lazyloader --- init.lua | 7 +- lazy-lock.json | 20 +++ lua/config/lazy.lua | 35 +++++ lua/core/plugin_config/catppuccin.lua | 4 + lua/core/plugin_config/init.lua | 8 +- lua/core/plugin_config/lualine.lua | 2 +- lua/core/plugins.lua | 53 ------- lua/plugins/init.lua | 42 ++++++ plugin/packer_compiled.lua | 194 -------------------------- 9 files changed, 111 insertions(+), 254 deletions(-) create mode 100644 lazy-lock.json create mode 100644 lua/config/lazy.lua create mode 100644 lua/core/plugin_config/catppuccin.lua delete mode 100644 lua/core/plugins.lua create mode 100644 lua/plugins/init.lua delete mode 100644 plugin/packer_compiled.lua diff --git a/init.lua b/init.lua index d661f7a..4e0d436 100644 --- a/init.lua +++ b/init.lua @@ -1,6 +1,9 @@ +vim.opt.termguicolors = true + +require("config.lazy") require("core.options") require("core.functions") -require("core.keymaps") -require("core.plugins") +--require("core.plugins") require("core.aliases") require("core.plugin_config") +require("core.keymaps") diff --git a/lazy-lock.json b/lazy-lock.json new file mode 100644 index 0000000..6f82fba --- /dev/null +++ b/lazy-lock.json @@ -0,0 +1,20 @@ +{ + "SyntaxAttr.vim": { "branch": "master", "commit": "8debed49d8df762fd89f540996d9e9a5016ec0a3" }, + "catppuccin": { "branch": "main", "commit": "1bf070129c0b6f77cc23f6a2212dcdc868308c52" }, + "deadcolumn.nvim": { "branch": "master", "commit": "8f5f8610fda22ff7a3937bc72d0e7d41faaceeaa" }, + "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, + "lualine.nvim": { "branch": "master", "commit": "15884cee63a8c205334ab13ab1c891cd4d27101a" }, + "marks.nvim": { "branch": "master", "commit": "bb25ae3f65f504379e3d08c8a02560b76eaf91e8" }, + "neo-tree.nvim": { "branch": "main", "commit": "56f383aa157f1ff20a59154907cc5f9fe26e4db9" }, + "nvim-colorizer.lua": { "branch": "master", "commit": "a065833f35a3a7cc3ef137ac88b5381da2ba302e" }, + "nvim-tree.lua": { "branch": "master", "commit": "e7d1b7dadc62fe2eccc17d814354b0a5688621ce" }, + "nvim-treesitter": { "branch": "master", "commit": "066fd6505377e3fd4aa219e61ce94c2b8bdb0b79" }, + "nvim-web-devicons": { "branch": "master", "commit": "f1420728f59843eb2ef084406b3d0201a0a0932d" }, + "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, + "rainbow-delimiters.nvim": { "branch": "master", "commit": "55ad4fb76ab68460f700599b7449385f0c4e858e" }, + "tagbar": { "branch": "master", "commit": "8de7694c0aeda253073098bbc9fb890b2902ddb8" }, + "telescope.nvim": { "branch": "master", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" }, + "vim-fugitive": { "branch": "master", "commit": "4a745ea72fa93bb15dd077109afbb3d1809383f2" }, + "vim-gitgutter": { "branch": "main", "commit": "a5ae0a5a18e266f8a62b3e256208afcbb20fe5b5" }, + "vim-indentwise": { "branch": "master", "commit": "608bd6876d3b56d469e0e615eb774a6e06095dbf" } +} diff --git a/lua/config/lazy.lua b/lua/config/lazy.lua new file mode 100644 index 0000000..197c5e1 --- /dev/null +++ b/lua/config/lazy.lua @@ -0,0 +1,35 @@ +-- Bootstrap lazy.nvim +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not (vim.uv or vim.loop).fs_stat(lazypath) then + local lazyrepo = "https://github.com/folke/lazy.nvim.git" + local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }) + if vim.v.shell_error ~= 0 then + vim.api.nvim_echo({ + { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, + { out, "WarningMsg" }, + { "\nPress any key to exit..." }, + }, true, {}) + vim.fn.getchar() + os.exit(1) + end +end +vim.opt.rtp:prepend(lazypath) + +-- Make sure to setup `mapleader` and `maplocalleader` before +-- loading lazy.nvim so that mappings are correct. +-- This is also a good place to setup other settings (vim.opt) +vim.g.mapleader = " " +vim.g.maplocalleader = "\\" + +-- Setup lazy.nvim +require("lazy").setup({ + spec = { + -- import your plugins + { import = "plugins" }, + }, + -- Configure any other settings here. See the documentation for more details. + -- colorscheme that will be used when installing plugins. + install = { colorscheme = { "habamax" } }, + -- automatically check for plugin updates + checker = { enabled = true }, +}) diff --git a/lua/core/plugin_config/catppuccin.lua b/lua/core/plugin_config/catppuccin.lua new file mode 100644 index 0000000..077d3c0 --- /dev/null +++ b/lua/core/plugin_config/catppuccin.lua @@ -0,0 +1,4 @@ +-- setup must be called before loading + +require 'catppuccin'.setup() +vim.cmd.colorscheme "catppuccin-macchiato" diff --git a/lua/core/plugin_config/init.lua b/lua/core/plugin_config/init.lua index e1f7dc1..6905e9a 100644 --- a/lua/core/plugin_config/init.lua +++ b/lua/core/plugin_config/init.lua @@ -1,4 +1,5 @@ -require("core.plugin_config.gruvbox") +--require("core.plugin_config.gruvbox") +require("core.plugin_config.catppuccin") require("core.plugin_config.lualine") require("core.plugin_config.nvim-tree") require("core.plugin_config.treesitter") @@ -11,7 +12,6 @@ require("core.plugin_config.colorizer") require("core.plugin_config.synattr") require("core.plugin_config.rainbow-delimiters") require("core.plugin_config.marks") -require("core.plugin_config.lsp_config") -require("core.plugin_config.indent-blankline") -require("core.plugin_config.indent-blankline") +--require("core.plugin_config.lsp_config") +--require("core.plugin_config.indent-blankline") require("core.plugin_config.vim-indentwise") diff --git a/lua/core/plugin_config/lualine.lua b/lua/core/plugin_config/lualine.lua index 18a82a2..3d22319 100644 --- a/lua/core/plugin_config/lualine.lua +++ b/lua/core/plugin_config/lualine.lua @@ -1,7 +1,7 @@ require('lualine').setup { options = { icons_enabled = true, - theme = 'gruvbox', + theme = 'catppuccin', }, sections = { lualine_a = { diff --git a/lua/core/plugins.lua b/lua/core/plugins.lua deleted file mode 100644 index 8f240eb..0000000 --- a/lua/core/plugins.lua +++ /dev/null @@ -1,53 +0,0 @@ -local ensure_packer = function() - local fn = vim.fn - local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim' - if fn.empty(fn.glob(install_path)) > 0 then - fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path}) - vim.cmd [[packadd packer.nvim]] - return true - end - return false -end - -local packer_bootstrap = ensure_packer() - -return require('packer').startup(function(use) - use 'wbthomason/packer.nvim' - - -- My plugins here - use 'morhetz/gruvbox' - use 'nvim-tree/nvim-tree.lua' - use 'nvim-tree/nvim-web-devicons' - use 'nvim-lualine/lualine.nvim' - use { - 'nvim-treesitter/nvim-treesitter', - run = ':TSUpdate' - } - use { - 'nvim-telescope/telescope.nvim', - tag = '0.1.6', - requires = { {'nvim-lua/plenary.nvim'} } - } - use 'tpope/vim-fugitive' - use 'majutsushi/tagbar' - use 'airblade/vim-gitgutter' - use 'Bekaboo/deadcolumn.nvim' - use { - "williamboman/mason.nvim", - "williamboman/mason-lspconfig.nvim", - "neovim/nvim-lspconfig", - } - use 'norcalli/nvim-colorizer.lua' - use 'vim-scripts/SyntaxAttr.vim' - --use 'romgrk/barbar.nvim' - use 'HiPhish/rainbow-delimiters.nvim' - use 'chentoast/marks.nvim' - use "lukas-reineke/indent-blankline.nvim" - use "jeetsukumaran/vim-indentwise" - - -- Automatically set up your configuration after cloning packer.nvim - -- Put this at the end after all plugins - if packer_bootstrap then - require('packer').sync() - end -end) diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua new file mode 100644 index 0000000..012722b --- /dev/null +++ b/lua/plugins/init.lua @@ -0,0 +1,42 @@ +return { + "nvim-lua/plenary.nvim", + { + 'nvim-telescope/telescope.nvim', + tag = '0.1.8', + dependencies = { 'nvim-lua/plenary.nvim' } + }, + 'nvim-treesitter/nvim-treesitter', + 'nvim-lualine/lualine.nvim', + { + "nvim-tree/nvim-web-devicons", + opts = {} + }, + "nvim-tree/nvim-web-devicons", + { + "nvim-neo-tree/neo-tree.nvim", + keys = { + { "ft", "Neotree toggle", desc = "NeoTree" }, + }, + opts = {}, + }, + 'nvim-tree/nvim-tree.lua', + --'morhetz/gruvbox', + { + "catppuccin/nvim", + name = "catppuccin", + priority = 1000 + }, + 'tpope/vim-fugitive', + 'majutsushi/tagbar', + 'airblade/vim-gitgutter', + 'Bekaboo/deadcolumn.nvim', + --"williamboman/mason.nvim", + --"williamboman/mason-lspconfig.nvim", + --"neovim/nvim-lspconfig", + 'norcalli/nvim-colorizer.lua', + 'vim-scripts/SyntaxAttr.vim', + 'HiPhish/rainbow-delimiters.nvim', + 'chentoast/marks.nvim', + --"lukas-reineke/indent-blankline.nvim", + "jeetsukumaran/vim-indentwise", +} diff --git a/plugin/packer_compiled.lua b/plugin/packer_compiled.lua deleted file mode 100644 index 1e0d197..0000000 --- a/plugin/packer_compiled.lua +++ /dev/null @@ -1,194 +0,0 @@ --- Automatically generated packer.nvim plugin loader code - -if vim.api.nvim_call_function('has', {'nvim-0.5'}) ~= 1 then - vim.api.nvim_command('echohl WarningMsg | echom "Invalid Neovim version for packer.nvim! | echohl None"') - return -end - -vim.api.nvim_command('packadd packer.nvim') - -local no_errors, error_msg = pcall(function() - -_G._packer = _G._packer or {} -_G._packer.inside_compile = true - -local time -local profile_info -local should_profile = false -if should_profile then - local hrtime = vim.loop.hrtime - profile_info = {} - time = function(chunk, start) - if start then - profile_info[chunk] = hrtime() - else - profile_info[chunk] = (hrtime() - profile_info[chunk]) / 1e6 - end - end -else - time = function(chunk, start) end -end - -local function save_profiles(threshold) - local sorted_times = {} - for chunk_name, time_taken in pairs(profile_info) do - sorted_times[#sorted_times + 1] = {chunk_name, time_taken} - end - table.sort(sorted_times, function(a, b) return a[2] > b[2] end) - local results = {} - for i, elem in ipairs(sorted_times) do - if not threshold or threshold and elem[2] > threshold then - results[i] = elem[1] .. ' took ' .. elem[2] .. 'ms' - end - end - if threshold then - table.insert(results, '(Only showing plugins that took longer than ' .. threshold .. ' ms ' .. 'to load)') - end - - _G._packer.profile_output = results -end - -time([[Luarocks path setup]], true) -local package_path_str = "/home/produktr/.cache/nvim/packer_hererocks/2.1.1692716794/share/lua/5.1/?.lua;/home/produktr/.cache/nvim/packer_hererocks/2.1.1692716794/share/lua/5.1/?/init.lua;/home/produktr/.cache/nvim/packer_hererocks/2.1.1692716794/lib/luarocks/rocks-5.1/?.lua;/home/produktr/.cache/nvim/packer_hererocks/2.1.1692716794/lib/luarocks/rocks-5.1/?/init.lua" -local install_cpath_pattern = "/home/produktr/.cache/nvim/packer_hererocks/2.1.1692716794/lib/lua/5.1/?.so" -if not string.find(package.path, package_path_str, 1, true) then - package.path = package.path .. ';' .. package_path_str -end - -if not string.find(package.cpath, install_cpath_pattern, 1, true) then - package.cpath = package.cpath .. ';' .. install_cpath_pattern -end - -time([[Luarocks path setup]], false) -time([[try_loadstring definition]], true) -local function try_loadstring(s, component, name) - local success, result = pcall(loadstring(s), name, _G.packer_plugins[name]) - if not success then - vim.schedule(function() - vim.api.nvim_notify('packer.nvim: Error running ' .. component .. ' for ' .. name .. ': ' .. result, vim.log.levels.ERROR, {}) - end) - end - return result -end - -time([[try_loadstring definition]], false) -time([[Defining packer_plugins]], true) -_G.packer_plugins = { - ["SyntaxAttr.vim"] = { - loaded = true, - path = "/home/produktr/.local/share/nvim/site/pack/packer/start/SyntaxAttr.vim", - url = "https://github.com/vim-scripts/SyntaxAttr.vim" - }, - ["deadcolumn.nvim"] = { - loaded = true, - path = "/home/produktr/.local/share/nvim/site/pack/packer/start/deadcolumn.nvim", - url = "https://github.com/Bekaboo/deadcolumn.nvim" - }, - gruvbox = { - loaded = true, - path = "/home/produktr/.local/share/nvim/site/pack/packer/start/gruvbox", - url = "https://github.com/morhetz/gruvbox" - }, - ["indent-blankline.nvim"] = { - loaded = true, - path = "/home/produktr/.local/share/nvim/site/pack/packer/start/indent-blankline.nvim", - url = "https://github.com/lukas-reineke/indent-blankline.nvim" - }, - ["lualine.nvim"] = { - loaded = true, - path = "/home/produktr/.local/share/nvim/site/pack/packer/start/lualine.nvim", - url = "https://github.com/nvim-lualine/lualine.nvim" - }, - ["marks.nvim"] = { - loaded = true, - path = "/home/produktr/.local/share/nvim/site/pack/packer/start/marks.nvim", - url = "https://github.com/chentoast/marks.nvim" - }, - ["mason-lspconfig.nvim"] = { - loaded = true, - path = "/home/produktr/.local/share/nvim/site/pack/packer/start/mason-lspconfig.nvim", - url = "https://github.com/williamboman/mason-lspconfig.nvim" - }, - ["mason.nvim"] = { - loaded = true, - path = "/home/produktr/.local/share/nvim/site/pack/packer/start/mason.nvim", - url = "https://github.com/williamboman/mason.nvim" - }, - ["nvim-colorizer.lua"] = { - loaded = true, - path = "/home/produktr/.local/share/nvim/site/pack/packer/start/nvim-colorizer.lua", - url = "https://github.com/norcalli/nvim-colorizer.lua" - }, - ["nvim-lspconfig"] = { - loaded = true, - path = "/home/produktr/.local/share/nvim/site/pack/packer/start/nvim-lspconfig", - url = "https://github.com/neovim/nvim-lspconfig" - }, - ["nvim-tree.lua"] = { - loaded = true, - path = "/home/produktr/.local/share/nvim/site/pack/packer/start/nvim-tree.lua", - url = "https://github.com/nvim-tree/nvim-tree.lua" - }, - ["nvim-treesitter"] = { - loaded = true, - path = "/home/produktr/.local/share/nvim/site/pack/packer/start/nvim-treesitter", - url = "https://github.com/nvim-treesitter/nvim-treesitter" - }, - ["nvim-web-devicons"] = { - loaded = true, - path = "/home/produktr/.local/share/nvim/site/pack/packer/start/nvim-web-devicons", - url = "https://github.com/nvim-tree/nvim-web-devicons" - }, - ["packer.nvim"] = { - loaded = true, - path = "/home/produktr/.local/share/nvim/site/pack/packer/start/packer.nvim", - url = "https://github.com/wbthomason/packer.nvim" - }, - ["plenary.nvim"] = { - loaded = true, - path = "/home/produktr/.local/share/nvim/site/pack/packer/start/plenary.nvim", - url = "https://github.com/nvim-lua/plenary.nvim" - }, - ["rainbow-delimiters.nvim"] = { - loaded = true, - path = "/home/produktr/.local/share/nvim/site/pack/packer/start/rainbow-delimiters.nvim", - url = "https://github.com/HiPhish/rainbow-delimiters.nvim" - }, - tagbar = { - loaded = true, - path = "/home/produktr/.local/share/nvim/site/pack/packer/start/tagbar", - url = "https://github.com/majutsushi/tagbar" - }, - ["telescope.nvim"] = { - loaded = true, - path = "/home/produktr/.local/share/nvim/site/pack/packer/start/telescope.nvim", - url = "https://github.com/nvim-telescope/telescope.nvim" - }, - ["vim-fugitive"] = { - loaded = true, - path = "/home/produktr/.local/share/nvim/site/pack/packer/start/vim-fugitive", - url = "https://github.com/tpope/vim-fugitive" - }, - ["vim-gitgutter"] = { - loaded = true, - path = "/home/produktr/.local/share/nvim/site/pack/packer/start/vim-gitgutter", - url = "https://github.com/airblade/vim-gitgutter" - } -} - -time([[Defining packer_plugins]], false) - -_G._packer.inside_compile = false -if _G._packer.needs_bufread == true then - vim.cmd("doautocmd BufRead") -end -_G._packer.needs_bufread = false - -if should_profile then save_profiles() end - -end) - -if not no_errors then - error_msg = error_msg:gsub('"', '\\"') - vim.api.nvim_command('echohl ErrorMsg | echom "Error in packer_compiled: '..error_msg..'" | echom "Please check your config for correctness" | echohl None') -end