mirror of
https://github.com/hexedtech/codemp-nvim.git
synced 2024-12-23 13:54:54 +01:00
feat: delete command in neo-tree
This commit is contained in:
parent
a98c216a8f
commit
7fd36cf95c
1 changed files with 18 additions and 0 deletions
|
@ -72,6 +72,23 @@ M.move = function(state, path, extra)
|
|||
error("only buffers can be moved to current file")
|
||||
end
|
||||
|
||||
M.delete = function(state, path, extra)
|
||||
local selected = state.tree:get_node()
|
||||
if selected.type == "buffer" then
|
||||
if session.workspace == nil then error("join a workspace first") end
|
||||
session.workspace:delete_buffer(selected.name):await()
|
||||
print("deleted buffer " .. selected.name)
|
||||
manager.refresh("codemp")
|
||||
elseif selected.type == "workspace" then
|
||||
if session.client == nil then error("connect to server first") end
|
||||
session.client:delete_workspace(selected.name):await()
|
||||
print("deleted workspace " .. selected.name)
|
||||
manager.refresh("codemp")
|
||||
else
|
||||
print("/!\\ can only delete buffers and workspaces")
|
||||
end
|
||||
end
|
||||
|
||||
M.add = function(_state)
|
||||
if session.client == nil then
|
||||
vim.ui.input({ prompt = "server address" }, function(input)
|
||||
|
@ -91,6 +108,7 @@ M.add = function(_state)
|
|||
manager.refresh("codemp")
|
||||
end)
|
||||
end
|
||||
manager.refresh("codemp")
|
||||
end
|
||||
|
||||
cc._add_common_commands(M)
|
||||
|
|
Loading…
Reference in a new issue