GithubHelp home page GithubHelp logo

Comments (13)

dpetka2001 avatar dpetka2001 commented on June 13, 2024

Can't reproduce with a fresh LazyVim starter template. Even tried the repro you provided (with some slight changes, since Util cannot be resolved and threw an error and mapleader was also not set) and the same result.

from lazyvim.

steve-down avatar steve-down commented on June 13, 2024

Thanks for the response. So, if I started this all from scratch - no ~/.config/nvim folder, and I've removed ~/.local/share/nvim and ~/.local/state/nvim and ~/.repro, and I just run nvim -u repro.lua ., where do you suggest I look? I'm able to repro this with the repro lua pretty easily.

(also, that repro is the lua template supplied on the issue submission page, with a minimal neo-tree config added).

from lazyvim.

dpetka2001 avatar dpetka2001 commented on June 13, 2024

Can you try the following

1. `mkdir ~/.config/lazytest`
2. `git clone https://github.com/LazyVim/starter ~/.config/lazytest`
3. `NVIM_APPNAME=lazytest nvim` and wait for the installation to complete
4. Restart Neovim with the command provided in step 3

Do you observe the same behavior with LazyVim defaults? Don't make any changes of your own.

For cleanup

rm -rf ~/.config/lazytest
rm -rf ~/.local/share/lazytest
rm -rf ~/.local/state/lazytest
rm -rf ~/.cache/lazytest

from lazyvim.

steve-down avatar steve-down commented on June 13, 2024

Oh, this is weird:

If I run exactly your steps, culminating in NVIM_APPNAME=lazytest nvim, I get

image

If I run these steps but provide a directory to open? As in NVIM_APPNAME=lazytest nvim . ? I get

image

Now, if I put my setup back in place and just run nvim, and launch the tree with <leader>E, it also works:

image

It sure would be nice to be able to open a path from the command line, but with that particular wrinkle it feels like it's a neo-tree issue? Thanks for the updated repro steps!

from lazyvim.

kobzar avatar kobzar commented on June 13, 2024

Its look like some ptoblem with your color theme
So, the betrer way to test
Install fresh version of LazyVim
Check if all look nice, aplly your color theme - check again and back to default color theme to last check.

from lazyvim.

dpetka2001 avatar dpetka2001 commented on June 13, 2024

@steve-down
Yes, I can reproduce when opening a directory. However I don't believe it's a LazyVim issue. In the repro file that you provided I commented out folke/LazyVim, so the only plugins that are installed then are lazy.nvim, neo-tree.nvim, nui.nvim, plenary.nvim and tokyonight.nvim. So, I was able to reproduce this without LazyVim by commenting it out in your repro.lua.

That's why I believe it has something to do with neo-tree itself.

from lazyvim.

steve-down avatar steve-down commented on June 13, 2024

I agree - it's a strange edge condition, it would seem - no command-line == OK. file on the command line == OK. Directory on the command line == failed.

Thanks so much for your help!

from lazyvim.

dpetka2001 avatar dpetka2001 commented on June 13, 2024

@steve-down
Can you try the following? Instead of the init function that you use in your configuration, try to replace it with this

    init = function()
      vim.api.nvim_create_autocmd("BufEnter", {
        -- make a group to be able to delete it later
        group = vim.api.nvim_create_augroup("NeoTreeInit", { clear = true }),
        callback = function()
          local f = vim.fn.expand("%:p")
          if vim.fn.isdirectory(f) ~= 0 then
            vim.cmd("Neotree left dir=" .. f)
            -- neo-tree is loaded now, delete the init autocmd
            vim.api.nvim_clear_autocmds({ group = "NeoTreeInit" })
          end
        end,
      })
    end,

I'm not exactly sure why, but this seems to avoid the problem you're observing. I'm not sure why this happens and not familiar with neo-tree's internals, so you might want to ask a question at their repo as to what the correct approach should be.

from lazyvim.

steve-down avatar steve-down commented on June 13, 2024

Um, this is embarrassing... I think... you see the 0.10.0-dev version up there?

brew remove neovim
brew install neovim

Problem appears solved against this repro.lua. Will also try your change to it. Thanks again!

from lazyvim.

dpetka2001 avatar dpetka2001 commented on June 13, 2024

What is the Neovim version you use that solved your issue?

from lazyvim.

steve-down avatar steve-down commented on June 13, 2024

The latest version available with Homebrew:

NVIM v0.9.5
Build type: Release
LuaJIT 2.1.1703358377

from lazyvim.

dpetka2001 avatar dpetka2001 commented on June 13, 2024

@folke

Whenever you read this, I believe that the colorscheme doesn't load immediately in the init function of neo-tree. In Neovim 0.9.5 I also see a different colorscheme for the menu when trying to delete a file than the default tokyonight.

My local workaround for this is the following

    init = function()
      if vim.fn.argc(-1) == 1 then
        local plugin = require("lazy.core.config").spec.plugins["LazyVim"]
        local Opts = require("lazy.core.plugin").values(plugin, "opts", false)
        local stat = vim.loop.fs_stat(vim.fn.argv(0))
        if stat and stat.type == "directory" then
          require("neo-tree")
          vim.defer_fn(function()
            return Opts.colorscheme and vim.cmd.colorscheme(Opts.colorscheme) or vim.cmd.colorscheme("tokyonight")
          end, 100)
        end
      end
    end,

Not sure if it's the best way to deal with this, that's why I'm hesitant to make a PR with this change. I hope you can shed more light into this and a better solution.

from lazyvim.

folke avatar folke commented on June 13, 2024

If this is the case, then this should be fixed in neotree.
They should llisten for ColorScheme events and update their default colors accordingly.

from lazyvim.

Related Issues (20)

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.