* feat(#2415): granular highlight_diagnostics, normalise groups (#2454) * chore: normalise colours and enable cterm (#2471) * feat(#2415): granular highlight_git, normalise git groups (#2487) * docs: update CONTRIBUTING.md (#2485) * feat(#2415): granular highlight_git, normalise git groups * feat(#2415): normalise and add modified groups * feat(#2415): create Decorator class for modified and bookmarks * feat(#2415): create DecoratorDiagnostics * feat(#2415): create DecoratorGit * feat(#2415): create DecoratorGit * add DecoratorCopied DecoratorCut * add DecoratorOpened * remove unloaded_bufnr checks as the view debouncer takes care of it * Add `renderer.highlight_git` to accepted strings * fix(#2415): builder refactor (#2538) * simplify builder signs * decorators take care of themselves and are priority ordered * simplify builder hl groups * refactor builder for icon arrays * builder use decorators generically * fix(#2415): harden sign creation (#2539) * fix(#2415): harden unicode signs * Decorator tidy * normalise git sign creation and tidy * tidy builder * NvimTreeBookmarkIcon * tidy HL doc * tidy HL doc * tidy HL doc * tidy builder doc * standardise on '---@param' * DiagnosticWarning -> DiagnosticWarn * annotate decorators * limit to two highlight groups for line rendering * style * apply #2519 * feat(#2415): combined hl groups (#2601) * feat(#2415): create combined highlight groups * feat(#2415): create combined highlight groups * feat(#2415): create combined highlight groups * ci: allow workflow_dispatch (#2620) * one and only one hl namespace, required winhl removal * small tidies * colors.lua -> appearance.lua * full-name uses one and only namespace * don't highlight fast, just apply to namespace, safer win_set_hl * gut builder (#2622) collapse Builder * fix group_empty function check * feat(#2415): highlight-overhaul release date --------- Co-authored-by: Akmadan23 <azadahmadi@mailo.com>
39 lines
1.0 KiB
Lua
39 lines
1.0 KiB
Lua
local copy_paste
|
|
|
|
local HL_POSITION = require("nvim-tree.enum").HL_POSITION
|
|
local ICON_PLACEMENT = require("nvim-tree.enum").ICON_PLACEMENT
|
|
|
|
local Decorator = require "nvim-tree.renderer.decorator"
|
|
|
|
---@class DecoratorCopied: Decorator
|
|
---@field enabled boolean
|
|
---@field icon HighlightedString|nil
|
|
local DecoratorCopied = Decorator:new()
|
|
|
|
---@param opts table
|
|
---@return DecoratorCopied
|
|
function DecoratorCopied:new(opts)
|
|
local o = Decorator.new(self, {
|
|
enabled = true,
|
|
hl_pos = HL_POSITION[opts.renderer.highlight_clipboard] or HL_POSITION.none,
|
|
icon_placement = ICON_PLACEMENT.none,
|
|
})
|
|
---@cast o DecoratorCopied
|
|
|
|
-- cyclic
|
|
copy_paste = copy_paste or require "nvim-tree.actions.fs.copy-paste"
|
|
|
|
return o
|
|
end
|
|
|
|
---Copied highlight: renderer.highlight_clipboard and node is copied
|
|
---@param node Node
|
|
---@return string|nil group
|
|
function DecoratorCopied:calculate_highlight(node)
|
|
if self.hl_pos ~= HL_POSITION.none and copy_paste.is_copied(node) then
|
|
return "NvimTreeCopiedHL"
|
|
end
|
|
end
|
|
|
|
return DecoratorCopied
|