Skip to content

how can i get restrict icon_only filetype component? #673

Answered by fitrh
diegodox asked this question in Q&A
Discussion options

You must be logged in to vote

You can use the fmt option for that, but first, if you have nvim-web-devicons configured, make sure you disable the default

{
    'filetype',
    fmt = function(str)
        local icon = require('nvim-web-devicons')
        if not icon.get_icon(vim.fn.expand('%:t'), vim.bo.filetype) then
        -- or if you have the latest version of nvim-web-devicon
        -- and don't care about buffer names
        -- if not icon.get_icon_by_filetype(vim.bo.filetype) then
            return nil
        end

        return str
    end,
    icon_only = true,
}

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@diegodox
Comment options

Answer selected by diegodox
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