Skip to content

Add configuration examples #36

@spenserblack

Description

@spenserblack

Under a directory lua/examples/, it would be nice to have some example configurations.

The examples should be unique and useful. They should not be examples for basic features, like sorting, but instead be the type of example that somebody would want to download and use as their own. In other words, the examples should also be considered as presets.

Example example

-- filepath: lua/examples/icons/extra-fancy.lua
-- This example provides tons of extra icons that aren't provided by default.
local filenames = {
  ["tsconfig.json"] = "",
  -- Obviously, add more for a real example/preset
}

local globs = {
  ["tsconfig.*.json"] = "",
  -- Obviously, add more for a real example/preset
}

local function icons(filepath, attributes, default)
  local filename = fancytree.path.filename(filepath)
  for key, icon in pairs(filenames) do
    if filename == key then return icon end
  end
  for glob, icon in pairs(globs) do
    if fancytree.path.glob_matches(glob, filename) then return icon end
  end

  return default
end

return icons

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions