lualine.nvim
lualine.nvim copied to clipboard
feat: add option on how to get a devicon
Within the filetype component, Lualine always gets filetype devicon by file path, and fallback to using filetype only when unsuccessful. This design leads to problems when:
- Changing the filetype--the accompanying devicon will not be updated, if displayed #537
- (More practically) Editing a file with an extension shared across multiple filetypes; a notable example is
.pl
which is used by both Prolog and Perl. Merely checking the file path (devicons.get_icon(vim.fn.expand('%:t'))
) will always result in Perl's devicon regardless actual filetype
My proposal is to allow user decide how should the devicon be determined with option get_icon_by
, with valid inputs 'filename'
(traditional behaviour) or 'filetype'
(prioritising get_icon_by_filetype
over get_icon
). I'm uncertain if this change should become the default behaviour; feel free to make it so if there's no strong reason.