nvim-tree.lua/lua/nvim-tree/renderer/decorator/cut.lua

30 lines
821 B
Lua

local Decorator = require("nvim-tree.renderer.decorator")
---@class (exact) DecoratorCut: Decorator
---@field private explorer Explorer
local DecoratorCut = Decorator:extend()
---@class DecoratorCut
---@overload fun(args: DecoratorArgs): DecoratorCut
---@protected
---@param args DecoratorArgs
function DecoratorCut:new(args)
self.explorer = args.explorer
self.enabled = true
self.highlight_range = self.explorer.opts.renderer.highlight_clipboard or "none"
self.icon_placement = "none"
end
---Cut highlight: renderer.highlight_clipboard and node is cut
---@param node Node
---@return string? highlight_group
function DecoratorCut:highlight_group(node)
if self.highlight_range ~= "none" and self.explorer.clipboard:is_cut(node) then
return "NvimTreeCutHL"
end
end
return DecoratorCut