summaryrefslogtreecommitdiff
path: root/lua/core/nvimtree.lua
diff options
context:
space:
mode:
authordevtoi <[email protected]>2021-08-22 20:03:19 +0200
committerGitHub <[email protected]>2021-08-22 20:03:19 +0200
commitd85584d09f9028fa4202cea473f7f0ae3c531aef (patch)
tree956d7d9909ca8e37ec604d96965ae7f878262388 /lua/core/nvimtree.lua
parentc5c9ae0fb68567c2a207c8c486b03bbafc650f98 (diff)
[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 <[email protected]> Co-authored-by: rebuilt <[email protected]> Co-authored-by: Luc Sinet <[email protected]> Co-authored-by: kylo252 <[email protected]>
Diffstat (limited to 'lua/core/nvimtree.lua')
-rw-r--r--lua/core/nvimtree.lua13
1 files changed, 9 insertions, 4 deletions
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 "<abuf>")
local ft = vim.api.nvim_buf_get_option(buf, "filetype")
if ft == "NvimTree" and package.loaded["bufferline.state"] then