From 4ff7208c668ffa8d4898bb4a6bfa435b2f1c2e98 Mon Sep 17 00:00:00 2001 From: siduck76 Date: Sun, 18 Jul 2021 22:11:52 +0530 Subject: [PATCH] lazy loading 100%!! --- init.lua | 36 +++++++++++++----------------------- lua/pluginList.lua | 18 +++++++++++++----- lua/theme.lua | 1 + lua/themes/nord.lua | 6 +++--- 4 files changed, 30 insertions(+), 31 deletions(-) diff --git a/init.lua b/init.lua index cde42ff..a1ac6ef 100644 --- a/init.lua +++ b/init.lua @@ -1,27 +1,17 @@ --- load all options require "options" --- load stuff only if theme is initialized -if require "theme" then - local async - async = - vim.loop.new_async( - vim.schedule_wrap( - function() - require "pluginList" - require "plugins.bufferline" - require "highlights" - require "mappings" - require("utils").hideStuff() +local async +async = + vim.loop.new_async( + vim.schedule_wrap( + function() + require "pluginList" + require "plugins.bufferline" + require "mappings" + require("utils").hideStuff() - async:close() - end - ) + async:close() + end ) - async:send() -else - -- otherwise run PackerSync - require "pluginList" - print("Now PackerSync will be executed, after completion, restart nvim.\n") - vim.cmd("PackerSync") -end +) +async:send() diff --git a/lua/pluginList.lua b/lua/pluginList.lua index fadafbb..d95c7cc 100644 --- a/lua/pluginList.lua +++ b/lua/pluginList.lua @@ -1,3 +1,5 @@ +vim.cmd [[packadd packer.nvim]] + local present, _ = pcall(require, "packerInit") if present then @@ -10,20 +12,26 @@ local use = packer.use return packer.startup( function() - use "wbthomason/packer.nvim" + use {"wbthomason/packer.nvim", event = "VimEnter"} - use {"akinsho/nvim-bufferline.lua", event = "VimEnter"} + use {"akinsho/nvim-bufferline.lua", after = "nvim-base16.lua"} use { "glepnir/galaxyline.nvim", - event = "VimEnter", + after = "nvim-base16.lua", config = function() require "plugins.statusline" end } -- color related stuff - use "siduck76/nvim-base16.lua" + use { + "siduck76/nvim-base16.lua", + after = "packer.nvim", + config = function() + require "theme" + end + } use { "norcalli/nvim-colorizer.lua", @@ -100,7 +108,7 @@ return packer.startup( use { "kyazdani42/nvim-web-devicons", - event = "VimEnter", + after = "nvim-base16.lua", config = function() require "plugins.icons" end diff --git a/lua/theme.lua b/lua/theme.lua index c87aa51..8d90ec2 100644 --- a/lua/theme.lua +++ b/lua/theme.lua @@ -4,6 +4,7 @@ local present, base16 = pcall(require, "base16") if present then base16(base16.themes["onedark"], true) + pcall(require, "highlights") return true else return false diff --git a/lua/themes/nord.lua b/lua/themes/nord.lua index 095dd18..7f67627 100644 --- a/lua/themes/nord.lua +++ b/lua/themes/nord.lua @@ -3,9 +3,9 @@ local colors = { darker_black = "#2a303c", black = "#2E3440", -- nvim bg black2 = "#343a46", - one_bg = "#353b47", -- real bg of onedark - one_bg2 = "#383e4a", - one_bg3 = "#3b414d", + one_bg = "#373d49", + one_bg2 = "#3a404c", + one_bg3 = "#3d434f", grey = "#474d59", grey_fg = "#565c68", grey_fg2 = "#606672",