-
-
Notifications
You must be signed in to change notification settings - Fork 636
Closed
Labels
Description
Is your feature request related to a problem? Please describe.
Trying to build a good legendary.nvim extension for nvim-tree.lua
Describe the solution you'd like
You create the commands here:
nvim-tree.lua/lua/nvim-tree.lua
Lines 245 to 280 in aa99717
| local function setup_vim_commands() | |
| vim.api.nvim_create_user_command("NvimTreeOpen", function(res) | |
| require("nvim-tree.api").tree.open { path = res.args } | |
| end, { nargs = "?", complete = "dir" }) | |
| vim.api.nvim_create_user_command("NvimTreeClose", function() | |
| require("nvim-tree.api").tree.close() | |
| end, { bar = true }) | |
| vim.api.nvim_create_user_command("NvimTreeToggle", function(res) | |
| require("nvim-tree.api").tree.toggle { find_file = false, focus = true, path = res.args, update_root = false } | |
| end, { nargs = "?", complete = "dir" }) | |
| vim.api.nvim_create_user_command("NvimTreeFocus", function() | |
| require("nvim-tree.api").tree.focus() | |
| end, { bar = true }) | |
| vim.api.nvim_create_user_command("NvimTreeRefresh", function() | |
| require("nvim-tree.api").tree.reload() | |
| end, { bar = true }) | |
| vim.api.nvim_create_user_command("NvimTreeClipboard", function() | |
| require("nvim-tree.api").fs.print_clipboard() | |
| end, { bar = true }) | |
| vim.api.nvim_create_user_command("NvimTreeFindFile", function(res) | |
| require("nvim-tree.api").tree.find_file { open = true, update_root = res.bang } | |
| end, { bang = true, bar = true }) | |
| vim.api.nvim_create_user_command("NvimTreeFindFileToggle", function(res) | |
| require("nvim-tree.api").tree.toggle { find_file = true, focus = true, path = res.args, update_root = res.bang } | |
| end, { bang = true, nargs = "?", complete = "dir" }) | |
| vim.api.nvim_create_user_command("NvimTreeResize", function(res) | |
| M.resize(res.args) | |
| end, { nargs = 1, bar = true }) | |
| vim.api.nvim_create_user_command("NvimTreeCollapse", function() | |
| require("nvim-tree.api").tree.collapse_all(false) | |
| end, { bar = true }) | |
| vim.api.nvim_create_user_command("NvimTreeCollapseKeepBuffers", function() | |
| require("nvim-tree.api").tree.collapse_all(true) | |
| end, { bar = true }) | |
| vim.api.nvim_create_user_command("NvimTreeGenerateOnAttach", keymap_legacy.cmd_generate_on_attach, {}) | |
| end |
The vim.api.nvim_create_user_command function accepts a desc field to provide a description that will be shown if you look up the commands via the Neovim API.
Describe alternatives you've considered
Hard-coding the descriptions.
Additional context