stevearc / oil.nvim

Neovim file explorer: edit your filesystem like a buffer
MIT License
3.64k stars 103 forks source link

bug: icons not appearing in windows terminal #447

Closed Parad0x84 closed 1 month ago

Parad0x84 commented 1 month ago

Did you check the docs and existing issues?

Neovim version (nvim -v)

0.10.0

Operating system/version

Win11

Describe the bug

Icons looks weird (mini.icons)

image

What is the severity of this bug?

minor (annoyance)

Steps To Reproduce

I have following lua file included by Lazy oil-nvim.txt

Expected Behavior

I expect to see real icons. Currently it looks like icons have very low width

Directory structure

Anything

Repro

-- save as repro.lua
-- run with nvim -u repro.lua
-- DO NOT change the paths
local root = vim.fn.fnamemodify("./.repro", ":p")

-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "runtime", "cache" }) do
  vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end

-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
  vim.fn.system({
    "git",
    "clone",
    "--filter=blob:none",
    "--single-branch",
    "https://github.com/folke/lazy.nvim.git",
    lazypath,
  })
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
  "folke/tokyonight.nvim",
  {
        "stevearc/oil.nvim",
        config = function()
            require("oil").setup({
                dependencies = { 'echasnovski/mini.icons' },
                -- dependencies = { 'nvim-tree/nvim-web-devicons' },
                opts = {
                  default_file_explorer = true,
                  delete_to_trash = true,
                  watch_for_changes = true,  -- Set to true to watch the filesystem for changes and reload oil

                  columns = {
                    "icon",
                    -- "permissions",
                    -- "size",
                    -- "mtime",
                  },

                  keymaps = {
                    ["<CR>"] = "actions.select",
                    ["<C-t>"] = { "actions.select", opts = { tab = true }, desc = "Open the entry in new tab" },
                    ["<C-p>"] = "actions.preview",
                    ["<C-c>"] = "actions.close",
                    ["<C-l>"] = "actions.refresh",
                    ["-"] = "actions.parent",
                    ["_"] = "actions.open_cwd",
                    ["`"] = "actions.cd",
                    ["~"] = { "actions.cd", opts = { scope = "tab" }, desc = ":tcd to the current oil directory" },
                    ["gs"] = "actions.change_sort",
                    ["gx"] = "actions.open_external",
                    ["g."] = "actions.toggle_hidden",

                    --["<C-h>"] = { "actions.select", opts = { horizontal = true }, desc = "Open the entry in a horizontal split" },
                    --["<C-s>"] = { "actions.select", opts = { vertical = true }, desc = "Open the entry in a vertical split" },
                    --["g?"] = "actions.show_help",
                    --["g\\"] = "actions.toggle_trash",
                  },
                  -- Set to false to disable all of the above keymaps
                  use_default_keymaps = true,
                },
            })
        end,
  },
  {
    'echasnovski/mini.nvim',
    config = function()
      -- Better Around/Inside textobjects
      --
      -- Examples:
      --  - va)  - [V]isually select [A]round [)]paren
      --  - yinq - [Y]ank [I]nside [N]ext [']quote
      --  - ci'  - [C]hange [I]nside [']quote
      require('mini.ai').setup { n_lines = 500 }

      -- Add/delete/replace surroundings (brackets, quotes, etc.)
      --
      -- - saiw) - [S]urround [A]dd [I]nner [W]ord [)]Paren
      -- - sd'   - [S]urround [D]elete [']quotes
      -- - sr)'  - [S]urround [R]eplace [)] [']
      require('mini.surround').setup()
      require('mini.icons').setup()

      -- Simple and easy statusline.
      --  You could remove this setup call if you don't like it,
      --  and try some other statusline plugin
      local statusline = require 'mini.statusline'
      -- set use_icons to true if you have a Nerd Font
      statusline.setup { use_icons = vim.g.have_nerd_font }

      -- You can configure sections in the statusline by overriding their
      -- default behavior. For example, here we set the section for
      -- cursor location to LINE:COLUMN
      ---@diagnostic disable-next-line: duplicate-set-field
      statusline.section_location = function()
        return '%2l:%-2v'
      end

      -- ... and there is more!
      --  Check out: https://github.com/echasnovski/mini.nvim
    end,
  }
  -- add any other plugins here
}
require("lazy").setup(plugins, {
  root = root .. "/plugins",
})

vim.cmd.colorscheme("tokyonight")
-- add anything else here

Did you check the bug with a clean config?

keyclicker commented 1 month ago

Sorry to ask, but do you have any of the Nerd Fonts installed?

Parad0x84 commented 1 month ago

@keyclicker Well I have some installed on system, but nowhere in neovim config I specified any. So it shouldn't effect things, right? Or is it a requirement? I didn't see it in the readme

keyclicker commented 1 month ago

You should install one of this fonts as your terminal emulator font. (I guess it's Windows Terminal in your case.)

Parad0x84 commented 1 month ago

I installed this one, but still same result image

stevearc commented 1 month ago

As previously commented, this looks like you haven't set up your terminal to use a patched font. I can't speak to how you would do this on Windows, but here's how you can verify if it's working: copy the glyph below and paste it into your terminal (in the prompt is fine, doesn't have to be in neovim). If you see a circle with a check, your font is working. If not, your font is not set up properly.

It should look like this:

Screenshot 2024-07-15 at 11 53 04 PM
Parad0x84 commented 1 month ago

Well, it looks fine image

stevearc commented 1 month ago

Iiiinteresting. In neovim, what do you see if you run this command

:=require("mini.icons").get("file", "test.lua")
Parad0x84 commented 1 month ago

Here: image image

stevearc commented 1 month ago

Well, that is strange that it appears to work in your terminal but doesn't work in Neovim. I don't have any other debugging ideas, but at this point it is also very clearly nothing to do with oil.nvim. You could try posting an issue on mini.nvim about the problem, including the debugging steps you've already taken with pasting the icon in the terminal and the output of :=require("mini.icons").get("file", "test.lua")

Parad0x84 commented 1 month ago

It turns out that specific font has something to do with the issue (MesloLGS NF) After installing another one (FiraCodeNerdFont), issue seems to be resolved. Thanks for your help :)

image image