mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-02-03 09:50:04 +08:00
41 lines
1.2 KiB
Lua
Vendored
41 lines
1.2 KiB
Lua
Vendored
-- This file contains the built-in components. Each componment is a function
|
|
-- that takes the following arguments:
|
|
-- config: A table containing the configuration provided by the user
|
|
-- when declaring this component in their renderer config.
|
|
-- node: A NuiNode object for the currently focused node.
|
|
-- state: The current state of the source providing the items.
|
|
--
|
|
-- The function should return either a table, or a list of tables, each of which
|
|
-- contains the following keys:
|
|
-- text: The text to display for this item.
|
|
-- highlight: The highlight group to apply to this text.
|
|
|
|
local highlights = require("neo-tree.ui.highlights")
|
|
local common = require("neo-tree.sources.common.components")
|
|
local utils = require("neo-tree.utils")
|
|
|
|
local M = {}
|
|
|
|
M.current_filter = function(config, node, state)
|
|
local filter = node.search_pattern or ""
|
|
if filter == "" then
|
|
return {}
|
|
end
|
|
return {
|
|
{
|
|
text = "Find",
|
|
highlight = highlights.DIM_TEXT,
|
|
},
|
|
{
|
|
text = string.format('"%s"', filter),
|
|
highlight = config.highlight or highlights.FILTER_TERM,
|
|
},
|
|
{
|
|
text = "in",
|
|
highlight = highlights.DIM_TEXT,
|
|
},
|
|
}
|
|
end
|
|
|
|
return vim.tbl_deep_extend("force", common, M)
|