mirror of
https://github.com/nvim-tree/nvim-tree.lua.git
synced 2026-07-28 15:59:44 +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 M = {}
|
||||||
|
|
||||||
local CMDS = {
|
local CMDS = {
|
||||||
@@ -12,7 +9,7 @@ local CMDS = {
|
|||||||
complete = "dir",
|
complete = "dir",
|
||||||
},
|
},
|
||||||
command = function(c)
|
command = function(c)
|
||||||
api.tree.open({ path = c.args })
|
require("nvim-tree.api").tree.open({ path = c.args })
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -22,7 +19,7 @@ local CMDS = {
|
|||||||
bar = true,
|
bar = true,
|
||||||
},
|
},
|
||||||
command = function()
|
command = function()
|
||||||
api.tree.close()
|
require("nvim-tree.api").tree.close()
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -33,7 +30,7 @@ local CMDS = {
|
|||||||
complete = "dir",
|
complete = "dir",
|
||||||
},
|
},
|
||||||
command = function(c)
|
command = function(c)
|
||||||
api.tree.toggle({
|
require("nvim-tree.api").tree.toggle({
|
||||||
find_file = false,
|
find_file = false,
|
||||||
focus = true,
|
focus = true,
|
||||||
path = c.args,
|
path = c.args,
|
||||||
@@ -48,7 +45,7 @@ local CMDS = {
|
|||||||
bar = true,
|
bar = true,
|
||||||
},
|
},
|
||||||
command = function()
|
command = function()
|
||||||
api.tree.open()
|
require("nvim-tree.api").tree.open()
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -58,7 +55,7 @@ local CMDS = {
|
|||||||
bar = true,
|
bar = true,
|
||||||
},
|
},
|
||||||
command = function()
|
command = function()
|
||||||
api.tree.reload()
|
require("nvim-tree.api").tree.reload()
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -68,7 +65,7 @@ local CMDS = {
|
|||||||
bar = true,
|
bar = true,
|
||||||
},
|
},
|
||||||
command = function()
|
command = function()
|
||||||
api.fs.print_clipboard()
|
require("nvim-tree.api").fs.print_clipboard()
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -79,7 +76,7 @@ local CMDS = {
|
|||||||
bar = true,
|
bar = true,
|
||||||
},
|
},
|
||||||
command = function(c)
|
command = function(c)
|
||||||
api.tree.find_file({
|
require("nvim-tree.api").tree.find_file({
|
||||||
open = true,
|
open = true,
|
||||||
focus = true,
|
focus = true,
|
||||||
update_root = c.bang,
|
update_root = c.bang,
|
||||||
@@ -95,7 +92,7 @@ local CMDS = {
|
|||||||
complete = "dir",
|
complete = "dir",
|
||||||
},
|
},
|
||||||
command = function(c)
|
command = function(c)
|
||||||
api.tree.toggle({
|
require("nvim-tree.api").tree.toggle({
|
||||||
find_file = true,
|
find_file = true,
|
||||||
focus = true,
|
focus = true,
|
||||||
path = c.args,
|
path = c.args,
|
||||||
@@ -111,7 +108,7 @@ local CMDS = {
|
|||||||
bar = true,
|
bar = true,
|
||||||
},
|
},
|
||||||
command = function(c)
|
command = function(c)
|
||||||
view.resize(c.args)
|
require("nvim-tree.view").resize(c.args)
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -121,7 +118,7 @@ local CMDS = {
|
|||||||
bar = true,
|
bar = true,
|
||||||
},
|
},
|
||||||
command = function()
|
command = function()
|
||||||
api.tree.collapse_all(false)
|
require("nvim-tree.api").tree.collapse_all(false)
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -131,7 +128,7 @@ local CMDS = {
|
|||||||
bar = true,
|
bar = true,
|
||||||
},
|
},
|
||||||
command = function()
|
command = function()
|
||||||
api.tree.collapse_all(true)
|
require("nvim-tree.api").tree.collapse_all(true)
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -139,7 +136,9 @@ local CMDS = {
|
|||||||
opts = {
|
opts = {
|
||||||
desc = "nvim-tree: highlight test",
|
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