Skip to content

How to implement custom trash action? #2333

Answered by linrongbin16
linrongbin16 asked this question in Q&A
Discussion options

You must be logged in to vote

Oh, I suddenly found the custom action here: https://github.com/nvim-tree/nvim-tree.lua/blob/master/doc/nvim-tree-lua.txt#L1930C32-L1930C47

In case someone has similar issues, I post my config here:

local on_attach = function(bufnr)
    local api = require("nvim-tree.api")
    local function trash_put()
        local node = require("nvim-tree.api").tree.get_node_under_cursor()
        local function trash_impl(on_exit, on_stderr)
            local j =
                vim.fn.jobstart("trash" .. ' "' .. node.absolute_path .. '"', {
                    on_exit = on_exit,
                    on_stderr = on_stderr,
                })
            vim.fn.jobwait({ j })
        end

        local e…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@alex-courtis
Comment options

@linrongbin16
Comment options

Answer selected by linrongbin16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants