mirror of
https://github.com/nvim-tree/nvim-tree.lua.git
synced 2026-07-28 07:49:46 +05:30
perf(commands): defer module loading (#3210)
This commit is contained in:
@@ -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,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user