Giter VIP home page Giter VIP logo

nvim-web-devicons's People

Contributors

adrian5 avatar akinsho avatar akmadan23 avatar alex-courtis avatar alexandrosalexiou avatar chmln avatar chrisgrieser avatar elianiva avatar gegoune avatar github-actions[bot] avatar hasecilu avatar kevinhwang91 avatar kyazdani42 avatar mcauley-penney avatar mg979 avatar nobuhikosawai avatar ofseed avatar philopence avatar ribru17 avatar romgrk avatar ronitkrshah avatar shatur avatar softinio avatar steschwa avatar t-727 avatar theblckbird avatar uga-rosa avatar vinibispo avatar wesleimp avatar yorik1984 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nvim-web-devicons's Issues

Use prefix for highlight groups

By conventions, plugins usually use a prefix rather than a suffix for their hl group names:

JavascriptDevIcon => DevIconJavascript

Get icon by filetype

The icons are classified by filename and/or extension. It would be nice to be able to get an icon by filetype.

Eg vim's help files have the help filetype, but their extension is still .txt.

The icon for directory does not show up.

Hi,
As the title said, the icon for any directory does not display. I tried by overriding in the setup.
image
The icon for the test.js file is displayed as expected, however, the icon for other two dirs are not work.
Thank you!

Question: is intended behavior to return custom icon only on exact match?

There are some file names that have special icons, different for the icon related to the file extension.
Example: the .gitlab-ci.yml has its own icon, which is different from the icon for other .yml files.

That's great! But the custom icon is only returned if I call the get_icon function with the exact filename. If the special file is under another path, the default icon is returned:
If call :lua print(require('nvim-web-devicons').get_icon('.gitlab-ci.yml')) I get the special gitlab icon. (Great!)
But if I call :lua print(require('nvim-web-devicons').get_icon('otherdir/.gitlab-ci.yml')) I get default .yml icon.

The same happens if I define some special icon by myself, like package.json or .eslintrc.js.

This can be resolved by using the function vim.fn.fnamemodify with the flag ':t' to provide get_icon only the tail of the file path.

I would like to know if this is the intended behavior. If it is, I think a tip could be added to the README instructing the user about using vim.fn.fnamemodify to not miss the special icons.

I notice that using telescope.nvim. With the fuzzy finder, the special icons are rendered only if the file is in the vim current directory, otherwise the 'defaults' icons are displayed. I just want to check with you before submitting a PR to telescope about using vim.fn.fnamemodify to avoid this inconsistency.

[Question] How do I get a `default_icon`?

Thank you for creating a wonderful library!

I wanted to get the default icon with a get_icon(), but I couldn't get it right, so I have a question for you.

It could not be obtained below.

local devicons = require'nvim-web-devicons'
print(devicons.get_icon('default_icon'))

But when I overruled it, I got it right.

local devicons = require'nvim-web-devicons'
devicons.setup({
  default = true,
  override = {
    ["default_icon"] = {
      icon = "xx",
      color = "#6d8086",
      name = "Default",
    }
  }
})

print(devicons.get_icon('default_icon'))
-- xx DevIconDefault

Should this change be made?

diff --git a/lua/nvim-web-devicons.lua b/lua/nvim-web-devicons.lua
index bb301cc..9b69048 100644
--- a/lua/nvim-web-devicons.lua
+++ b/lua/nvim-web-devicons.lua
@@ -851,7 +851,8 @@ local function setup(opts)

   icons = vim.tbl_extend("force", icons, user_icons.override or {});

-  table.insert(icons, default_icon)
+  -- table.insert(icons, default_icon)
+  icons["default_icon"] = default_icon
   for _, icon_data in pairs(icons) do
     if icon_data.color and icon_data.name then
       local hl_group = get_highlight_name(icon_data)

How to change directory icon

my nerd font can't type the default directory icon
i want to change it to another one what is the directory extension

Im using telescope not nvim-tree

How to override icons that start with a dot?

require'nvim-web-devicons'.setup {
    -- your personnal icons can go here (to override)
    -- DevIcon will be appended to `name`
    override = {
        lua = {icon = "", color = colors.nord15, name = "lua"},
        .gitignore = {icon = "", color = colors.nord4, name = "GitIgnore"},
    },
    -- globally enable default icons (default to false)
    -- will get overriden by `get_icons` option
    default = true
}

This gives an error.

How do i properly override the .gitignore icons? (And others that start with a dot)

Icons are incorrectly labeled

Not sure what happened but it seems that the icons are named incorrectly. For example under the python label their seems to be a database icon and under the c label their is a icon that says npm. These files are from a direct git clone so I think these are the latest version.

image
image

icon for org

The org icon is normally a unicorn. Have u ever come across it. If yes please add it. I have searched my pants of and I couldn't find it.

Auto-setup

Have you thought about running .setup() automatically? What would you recommend for a plugin that depends on this? Do you have any reasons not to run .setup() automatically? If I may argue, anyone that has the plugin in their config is very highly to want .setup() to be called.

Reference: romgrk/barbar.nvim#11

File Icons does not work for nvimTree

As the title states. My file icons works for telescope and bufferline but not nvimTree.

Example that it does not work for nvimTree but does work for bufferline
image

Example that shows it works for telescope
image

Dealing with upper and lower cases in extensions

Some file extensions allow several forms which differ only in letter cases: '.r' and '.R', '.Rmd' and '.rmd', etc. Currently to account for this, manual extra search should be done (like devicons.get_icon(file_name, file_ext) or devicons.get_icon(string.lower(file_name), string.lower(file_ext), { default = true })).

Maybe it is a good idea to incorporate some form of case insensitiveness into plugin directly?

How to override multiple filetypes?

I'm trying to override both gitignore and gitconfig file icons. My current config looks like this:

git = {
    icon = '<icon>',
    color = '#e06c75',
    name = 'gitignore'
},

This works fine, but when I do something like name = ['gitconfig', 'gitignore'] or name = {'gitconfig', 'gitignore'} it doesn't work. Grateful for any tips on how to do this!

How to vim

I don't know how to re-apply the highlights could someone give me a code snippet, i have a single init.vim file

About default icon.

Hi, Some times we want get an icon that even it doesn't match the ext or name, so use unknown replace default more better and remove opts? If we dosen't find an icon in icon_data we return unknown icon. What do you think?

Change all icon colors

Is it possible to change the colors of all icons somehow (without going through them one by one)?

Feature Request: enable an option to exclude predefined icons

Is there currently a way to disable the use of the predefined icons? I was thinking maybe it can be an option during the setup.

require('nvim-web-devicons').setup {
  override = {},     -- we define all our icons here
  predefined = false -- use none of the predefined icons
}

The reason for this is so that I can define a universal default icon for every single filetype. Can you suggest a better approach perhaps?

Deferred highlighting with vim.schedule causes issue

The previous API was defininig the highlight groups synchronously. Now that vim.schedule is used, the function returns the HL group name but it's not defined yet because the scheduled function hasn't run yet.

Not sure why you've enabled that but I would tend to believe that this new behavior is incorrect.

Users of barbar.nvim who update their packages are all affected by this issue, LMK what's the ETA and resolution when you have more details.

Link: romgrk/barbar.nvim#98

add docs

add documentation for developers and users on how to use/setup this plugin.

How to get fileformat icon ?

Hi, Thank you for your work. I use lightline and vim-devicons to get icon in statusline. I want to know how to use nvim-web-devicons to get file icon and fileformat icon ,just look like this figure? I notice that nvim-web-devicons doesn't seem to provide such a approach.
Snipaste_2021-03-31_23-28-35

Wrong devicon when .vimrc/.zshrc opened from startify screen

The devicons for files like .vimrc, .zshrc is incorrect when file is opened from vim-startify screen. The icons are correct if these files are opened directly using commands like :e .vimrc<CR>/ :e.zshrc<CR>. The same problem does not occur for most of the other file types (including files that end in .vim).

Steps to recreate:

  1. Install vim-startify
  2. Reopen nvim
  3. Open .vimrc file using usual command :e .vimrc<CR>.
  4. Close, and reopen nvim
  5. Open .vimrc file by pressing <CR> on .vimrc file in the MRU buffer list of vim-startify's startup screen.

How to change default global icon?

Hey @kyazdani42 , thanks so much for this port.

I'd like to change default_icon to something else

I tried

require'nvim-web-devicons'.setup {
 override = {
   default_icon = {
     icon = "",
     color = "#6d8086",
     name = "Default",
    }
  };
}

But didn't work for me

Thanks again

I can't get colors to work

I can't get colors to work in nvim-tree or telescope. I have been troubleshooting this problem on and off for months. I am at my wits end, I give up. I'm dumping my config folder here in case you feel like figuring out what's breaking icon colors.

In short, my nvim-tree config looks like this:

require("nvim-web-devicons").setup{ default = true }

require("nvim-tree").setup {
  hijack_cursor = true,
  view = {
    width = 40
  }
}

Result:

image

Frustratingly, if I reload my plugin config (:so %) and open nvim-tree again, it now has colored icons, but telescope doesn't:

image

I have spent more hours troubleshooting this than I care to admit, shuffling things around, disabling various plugins, configuring plugins in different orders etc. If you have any suggestions for what else I can try, I'd appreciate it a lot.

Here is my nvim config: nvim-config.zip

Some icons use RTL unicode characters and can mess up surrounding text

Some icons switch the active direction of text to RTL and affect the surrounding text. Specific examples are the latex icon (extension .tex) and the SVG icon. I know there are others as well, but #46 is a result of this issue specifically for the latex icon.

I don't have a PR yet (I could produce one if desired), but I was able to completely resolve these issues in my config by overriding the offending icons to add LTR Unicode direction isolates around the icon text. The Unicode consortium introduced these isolates to specifically help with issues like this. Text inside the isolate markers cannot affect the direction of the surrounding text, and as long as the terminal emulator properly supports the Unicode bidi algorithm, using the isolates fixes many of the rendering issues.

I've verified that if the icon text is surrounded with LTR isolate markers (LRI .. icon .. PDI), then the icons will no longer mess up the rendering of surrounding text if the terminal emulator properly applies the bidi algorithm (modern terminal emulators do). Isolates specifically do not affect the direction of the surrounding text so this won't affect rendering if the icon appears in RTL text.

Maybe the icons that use codepoints that are designated as RTL (Tex, SVG, etc) should have LTR isolate markers around the unicode codepoint. This would involve something like:

["tex"] = {
    icon = "<U+2066>ﭨ<U+2069>", -- actual utf-8 encoded codepoints instead, this is for demonstration
    color = "#3D6117",
    name = "Tex"
  };
...

I have this override in my config and it corrected rendering issues with telescope.nvim and fzf-lua when they rendered the tex icon in their popup windows.

Another possibility is changing the get_icon() function to wrap the icon text in the isolate markers before returning, possibly with a memoization.

[Q] OSX support

Hi, how can I make it work with iterm2 on OSX?
I am using default iterm2 font - Monaco.

Use filetype instead of extension

Hi! First of all, thanks for the nice plugin.

Some syntaxes could have multiple extensions associated, for example (yaml,yml), (clj,cljc,cljs,edn), (c, h), (markdown, md) and so on, while some files might also not have the extension but force a filetype by modeline, for example, so instead of having an entry for each extension, maybe it's better to rely on ft. WDYT?

Update svelte icon

Hello, thank you for writing this Plugin!
For some reason, the default icon displayed for .svelte is a lying red glyph, that has very little to do with the logo of the language. I tried looking into this myself but I can't seem to get this to work, so perhaps you could update the icon in general?
I saw an Issue for an icon for "teal" so I thought perhaps you could help with this.
The correct icon for svelte would be:
This one, which was recently merged into devicons.
Thank you!

devicons highlight is no longer re-applied if re-sourcing init.vim

@kyazdani42 since #22 was merged and setup() is now only allowed to be called once, if you try and source your init.vim during an editing setting the highlights are no longer re-applied. I was solving this issue in nvim-bufferline by using an autocmd ColorScheme * lua.require'nvim-devicons'.setup() to re-apply the highlights since most colorschemes will clear the existing highlights if you re source your init.vim I think calling setup is now not possible more than once so you can't re-apply the highlights.

I think a solution could be adding the autocommand to the plugin directly? What are your thoughts? if you agree I can test if it works and make a PR later today?

How to add an icon for certain extensions?

How to add an icon for certain extensions?

I don't really know how to formulate my question, but with devicons I could do this let g: WebDevIconsUnicodeDecorateFileNodesPatternSymbols ['. * Test. * \. Js $'] = 'ﭧ'
And the result was the following:
image

How can I achieve the same result with this plugin?

bug: Unable to override/add icons after the latest commit

The solution in the latest commit (1a94ff0) does not seem to be good as that will not allow anyone to add/override an icon.

I have yamatsum/nvim-nonicons installed which overrides some of the icons from nvim-web-devicons, which is successful because it calls the setup function first. Then, I also have my own setup which adds custom icons (which now fails) and then there's tamago324/lir.nvim which adds its own folder icon (which also fails).

A solution would be to expose an override function which would allow anyone to add/override an icon without doing the setup call.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.