diff --git a/lua/nvim-tree/commands.lua b/lua/nvim-tree/commands.lua index bff880c14fd..8158465a4c7 100644 --- a/lua/nvim-tree/commands.lua +++ b/lua/nvim-tree/commands.lua @@ -1,6 +1,3 @@ -local api = require("nvim-tree.api") -local view = require("nvim-tree.view") - local M = {} local CMDS = { @@ -12,7 +9,7 @@ local CMDS = { complete = "dir", }, command = function(c) - api.tree.open({ path = c.args }) + require("nvim-tree.api").tree.open({ path = c.args }) end, }, { @@ -22,7 +19,7 @@ local CMDS = { bar = true, }, command = function() - api.tree.close() + require("nvim-tree.api").tree.close() end, }, { @@ -33,7 +30,7 @@ local CMDS = { complete = "dir", }, command = function(c) - api.tree.toggle({ + require("nvim-tree.api").tree.toggle({ find_file = false, focus = true, path = c.args, @@ -48,7 +45,7 @@ local CMDS = { bar = true, }, command = function() - api.tree.open() + require("nvim-tree.api").tree.open() end, }, { @@ -58,7 +55,7 @@ local CMDS = { bar = true, }, command = function() - api.tree.reload() + require("nvim-tree.api").tree.reload() end, }, { @@ -68,7 +65,7 @@ local CMDS = { bar = true, }, command = function() - api.fs.print_clipboard() + require("nvim-tree.api").fs.print_clipboard() end, }, { @@ -79,7 +76,7 @@ local CMDS = { bar = true, }, command = function(c) - api.tree.find_file({ + require("nvim-tree.api").tree.find_file({ open = true, focus = true, update_root = c.bang, @@ -95,7 +92,7 @@ local CMDS = { complete = "dir", }, command = function(c) - api.tree.toggle({ + require("nvim-tree.api").tree.toggle({ find_file = true, focus = true, path = c.args, @@ -111,7 +108,7 @@ local CMDS = { bar = true, }, command = function(c) - view.resize(c.args) + require("nvim-tree.view").resize(c.args) end, }, { @@ -121,7 +118,7 @@ local CMDS = { bar = true, }, command = function() - api.tree.collapse_all(false) + require("nvim-tree.api").tree.collapse_all(false) end, }, { @@ -131,7 +128,7 @@ local CMDS = { bar = true, }, command = function() - api.tree.collapse_all(true) + require("nvim-tree.api").tree.collapse_all(true) end, }, { @@ -139,7 +136,9 @@ local CMDS = { opts = { desc = "nvim-tree: highlight test", }, - command = api.diagnostics.hi_test, + command = function() + require("nvim-tree.api").diagnostics.hi_test() + end, }, }