From ca29b384784f4e0700677aa5c7a1718ef634e75e Mon Sep 17 00:00:00 2001 From: siduck76 Date: Sun, 27 Jun 2021 20:59:39 +0530 Subject: [PATCH] lazy load colorizer --- init.lua | 2 -- lua/mappings.lua | 23 ++++++++--------------- lua/pluginList.lua | 9 ++++++++- 3 files changed, 16 insertions(+), 18 deletions(-) diff --git a/init.lua b/init.lua index fc461cf..5a6191b 100644 --- a/init.lua +++ b/init.lua @@ -1,9 +1,7 @@ -- load all plugins require "pluginList" require "misc-utils" - require "top-bufferline" -require("colorizer").setup() local g = vim.g diff --git a/lua/mappings.lua b/lua/mappings.lua index 379225b..1bc0d86 100644 --- a/lua/mappings.lua +++ b/lua/mappings.lua @@ -1,5 +1,5 @@ local function map(mode, lhs, rhs, opts) - local options = {noremap = true} + local options = {noremap = true, silent = true} if opts then options = vim.tbl_extend("force", options, opts) end @@ -37,8 +37,8 @@ map("n", "", ":w ", opt) -- vim.cmd("inoremap jh ") -- Commenter Keybinding -map("n", "/", ":CommentToggle", {noremap = true, silent = true}) -map("v", "/", ":CommentToggle", {noremap = true, silent = true}) +map("n", "/", ":CommentToggle", opt) +map("v", "/", ":CommentToggle", opt) map("n", "", ":bpspbnbd! ", opt) @@ -94,17 +94,10 @@ map("i", "", "v:lua.s_tab_complete()", {expr = true}) map("s", "", "v:lua.s_tab_complete()", {expr = true}) map("i", "", "v:lua.completions()", {expr = true}) --- Mappings for nvimtree -map( - "n", - "", - ":NvimTreeToggle", - { - noremap = true, - silent = true - } -) +-- nvimtree +map("n", "", ":NvimTreeToggle", opt) +-- format code map("n", "fm", [[ Neoformat]], opt) -- dashboard stuff @@ -125,8 +118,8 @@ map("n", "fh", [[Telescope help_tags]], opt) map("n", "fo", [[Telescope oldfiles]], opt) -- bufferline tab stuff -map("n", "", [[tabnew]], opt) -- new tab -map("n", "", [[bdelete]], opt) -- close tab +map("n", "", ":tabnew", opt) -- new tab +map("n", "", ":bd!", opt) -- close tab -- move between tabs map("n", "", [[BufferLineCycleNext]], opt) diff --git a/lua/pluginList.lua b/lua/pluginList.lua index c2129bc..2abe4ca 100644 --- a/lua/pluginList.lua +++ b/lua/pluginList.lua @@ -10,7 +10,14 @@ return packer.startup( -- color related stuff use "siduck76/nvim-base16.lua" - use "norcalli/nvim-colorizer.lua" + + use { + "norcalli/nvim-colorizer.lua", + event = "BufWinEnter", + config = function() + require("colorizer").setup() + end + } -- language related plugins use {