Skip to content

How to display file icons with Chezmoi #1637

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

You must be logged in to vote

hi!
Eventually I settled on this:

local fzf_chezmoi = function()
        local fzf_lua = require("fzf-lua.config")
        local chezmoi = require("chezmoi.commands")
        local files = chezmoi.list({
          args = {
            "--include=files",
          },
        })
        local opts = {
          fzf_opts = {},
          file_icons = true,
          actions = {
            ["default"] = function(selected)
              -- Remove the icon and leading whitespace from selected[1]
              local sanitized_path = selected[1]:gsub("^[^%w~/.]+", "") -- Matches the icon and trims it
              -- Use the sanitized path with chezmoi
              chezmoi.edit({
                t…

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@ReKylee
Comment options

@ibhagwan
Comment options

@ReKylee
Comment options

Answer selected by ibhagwan
@ibhagwan
Comment options

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