From d85584d09f9028fa4202cea473f7f0ae3c531aef Mon Sep 17 00:00:00 2001 From: devtoi <508254+devtoi@users.noreply.github.com> Date: Sun, 22 Aug 2021 20:03:19 +0200 Subject: [Refactor/Bugfix] move on_config_done callbacks to relevant setup() (#1175) * Make autopairs config consistent with others * Fix two typos for autopairs * Remove extranous autopairs code. Return on setup * Remove extranous else for autopairs completion confirmation * Move on_config_done callbacks to setup functions. * Add on_config_done completion for builtins lacking a config function * enables galaxyline callbacks to work properly * Add modules for more builtins * Finish streamline of config function in plugin setup * Fix double use of which_key/wk * Fix erroneous remove of functionality in autopairs completion * consistency fixes * Work around telescope not found at config time * Match plugin definition of project and lualine with others * fix: restore config callback syntax Co-authored-by: Johan Melin Co-authored-by: rebuilt Co-authored-by: Luc Sinet Co-authored-by: kylo252 <59826753+kylo252@users.noreply.github.com> --- lua/core/nvimtree.lua | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'lua/core/nvimtree.lua') diff --git a/lua/core/nvimtree.lua b/lua/core/nvimtree.lua index ff52029d..bea1add4 100644 --- a/lua/core/nvimtree.lua +++ b/lua/core/nvimtree.lua @@ -1,9 +1,10 @@ local M = {} local Log = require "core.log" -M.config = function() +function M.config() lvim.builtin.nvimtree = { active = true, + on_config_done = nil, side = "left", width = 30, show_icons = { @@ -48,7 +49,7 @@ M.config = function() } end -M.setup = function() +function M.setup() local status_ok, nvim_tree_config = pcall(require, "nvim-tree.config") if not status_ok then Log:get_default().error "Failed to load nvim-tree.config" @@ -88,15 +89,19 @@ M.setup = function() end vim.cmd "au WinClosed * lua require('core.nvimtree').on_close()" + + if lvim.builtin.nvimtree.on_config_done then + lvim.builtin.nvimtree.on_config_done(nvim_tree_config) + end end -M.on_open = function() +function M.on_open() if package.loaded["bufferline.state"] and lvim.builtin.nvimtree.side == "left" then require("bufferline.state").set_offset(lvim.builtin.nvimtree.width + 1, "") end end -M.on_close = function() +function M.on_close() local buf = tonumber(vim.fn.expand "") local ft = vim.api.nvim_buf_get_option(buf, "filetype") if ft == "NvimTree" and package.loaded["bufferline.state"] then -- cgit v1.2.3