Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add more match for bufferline icons #1270

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 85 additions & 3 deletions lua/lualine/components/buffers/buffer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,94 @@ function Buffer:get_props()
local status, _ = pcall(require, 'nvim-web-devicons')
if not status then
dev, _ = '', ''
elseif self.filetype == 'minideps-confirm' then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you put a comment at the start of these and at the end of these. stating the icons in this block exist in mini.icons (with link). and that it's relying on the fact that mini.icons patching nvim-web-devicons interface. Tbh this feels like an anti-pattern that they are patching other modules like this. I'm still not sure about relying on it like this. especially not without proper documentation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe you are right, these adjustments can wait until the subsequent development of nvim-web-devicons or is lualine directly compatible with mini.icons?

dev, _ = require('nvim-web-devicons').get_icon_by_filetype('minideps-confirm')
elseif self.filetype == 'minifiles' then
dev, _ = require('nvim-web-devicons').get_icon_by_filetype('minifiles')
elseif self.filetype == 'minifiles-help' then
dev, _ = require('nvim-web-devicons').get_icon_by_filetype('minifiles-help')
elseif self.filetype == 'mininotify' then
dev, _ = require('nvim-web-devicons').get_icon_by_filetype('mininotify')
elseif self.filetype == 'mininotify-history' then
dev, _ = require('nvim-web-devicons').get_icon_by_filetype('mininotify-history')
elseif self.filetype == 'minipick' then
require('nvim-web-devicons').get_icon_by_filetype('minipick')
elseif self.filetype == 'ministarter' then
dev, _ = require('nvim-web-devicons').get_icon_by_filetype('ministarter')
elseif self.filetype == 'neogitcommitselectview' then
dev, _ = require('nvim-web-devicons').get_icon_by_filetype('neogitcommitselectview')
elseif self.filetype == 'neogitcommitview' then
dev, _ = require('nvim-web-devicons').get_icon_by_filetype('neogitcommitview')
elseif self.filetype == 'neogitconsole' then
dev, _ = require('nvim-web-devicons').get_icon_by_filetype('neogitconsole')
elseif self.filetype == 'neogitdiffview' then
dev, _ = require('nvim-web-devicons').get_icon_by_filetype('neogitdiffview')
elseif self.filetype == 'neogitgitcommandhistory' then
dev, _ = require('nvim-web-devicons').get_icon_by_filetype('neogitgitcommandhistory')
elseif self.filetype == 'neogitlogview' then
dev, _ = require('nvim-web-devicons').get_icon_by_filetype('neogitlogview')
elseif self.filetype == 'neogitpopup' then
dev, _ = require('nvim-web-devicons').get_icon_by_filetype('neogitpopup')
elseif self.filetype == 'neogitrebasetodo' then
dev, _ = require('nvim-web-devicons').get_icon_by_filetype('neogitrebasetodo')
elseif self.filetype == 'neogitreflogview' then
dev, _ = require('nvim-web-devicons').get_icon_by_filetype('neogitreflogview')
elseif self.filetype == 'neogitrefsview' then
dev, _ = require('nvim-web-devicons').get_icon_by_filetype('neogitrefsview')
elseif self.filetype == 'neogitstatus' then
dev, _ = require('nvim-web-devicons').get_icon_by_filetype('neogitstatus')
elseif self.filetype == 'nvimtree' then
dev, _ = require('nvim-web-devicons').get_icon_by_filetype('nvimtree')
elseif self.filetype == 'overseerform' then
dev, _ = require('nvim-web-devicons').get_icon_by_filetype('overseerform')
elseif self.filetype == 'overseerlist' then
dev, _ = require('nvim-web-devicons').get_icon_by_filetype('overseerlist')
elseif self.filetype == 'trouble' then
dev, _ = require('nvim-web-devicons').get_icon_by_filetype('trouble')
elseif self.filetype == 'aerial' then
dev, _ = require('nvim-web-devicons').get_icon_by_filetype('aerial')
elseif self.filetype == 'alpha' then
dev, _ = require('nvim-web-devicons').get_icon_by_filetype('alpha')
elseif self.filetype == 'dapui_breakpoints' then
dev, _ = require('nvim-web-devicons').get_icon_by_filetype('dapui_breakpoints')
elseif self.filetype == 'dapui_console' then
dev, _ = require('nvim-web-devicons').get_icon_by_filetype('dapui_console')
elseif self.filetype == 'dapui_hover' then
dev, _ = require('nvim-web-devicons').get_icon_by_filetype('dapui_hover')
elseif self.filetype == 'dapui_scopes' then
dev, _ = require('nvim-web-devicons').get_icon_by_filetype('dapui_scopes')
elseif self.filetype == 'dapui_stacks' then
dev, _ = require('nvim-web-devicons').get_icon_by_filetype('dapui_stacks')
elseif self.filetype == 'dapui_watches' then
dev, _ = require('nvim-web-devicons').get_icon_by_filetype('dapui_watches')
elseif self.filetype == 'dashboard' then
dev, _ = require('nvim-web-devicons').get_icon_by_filetype('dashboard')
elseif self.filetype == 'edgy' then
dev, _ = require('nvim-web-devicons').get_icon_by_filetype('edgy')
elseif self.filetype == 'fzf' then
dev, _ = require('nvim-web-devicons').get_icon_by_filetype('fzf')
elseif self.filetype == 'harpoon' then
dev, _ = require('nvim-web-devicons').get_icon_by_filetype('harpoon')
elseif self.filetype == 'lazy' then
dev, _ = require('nvim-web-devicons').get_icon_by_filetype('lazy')
elseif self.filetype == 'mason' then
dev, _ = require('nvim-web-devicons').get_icon_by_filetype('mason')
elseif self.filetype == 'neo-tree' then
dev, _ = require('nvim-web-devicons').get_icon_by_filetype('neo-tree')
elseif self.filetype == 'neo-tree-popup' then
dev, _ = require('nvim-web-devicons').get_icon_by_filetype('neo-tree-popup')
elseif self.filetype == 'neotest-output-panel' then
dev, _ = require('nvim-web-devicons').get_icon_by_filetype('neotest-output-panel')
elseif self.filetype == 'neotest-summary' then
dev, _ = require('nvim-web-devicons').get_icon_by_filetype('neotest-summary')
elseif self.filetype == 'oil' then
dev, _ = require('nvim-web-devicons').get_icon_by_filetype('oil')
elseif self.filetype == 'TelescopePrompt' then
dev, _ = require('nvim-web-devicons').get_icon('telescope')
dev, _ = require('nvim-web-devicons').get_icon_by_filetype('TelescopePrompt')
elseif self.filetype == 'fugitive' then
Copy link
Contributor Author

@Parsifa1 Parsifa1 Jul 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In fact, the original query statement does not work properly.
TelescopePrompt Never displays properly

dev, _ = require('nvim-web-devicons').get_icon('git')
dev, _ = require('nvim-web-devicons').get_icon_by_filetype('git')
elseif self.filetype == 'vimwiki' then
dev, _ = require('nvim-web-devicons').get_icon('markdown')
dev, _ = require('nvim-web-devicons').get_icon_by_filetype('markdown')
elseif self.buftype == 'terminal' then
dev, _ = require('nvim-web-devicons').get_icon('zsh')
elseif vim.fn.isdirectory(self.file) == 1 then
Expand Down
Loading