coffebar / neovim-project

Neovim project plugin simplifies project management by maintaining project history and providing quick access to projects via Telescope or fzf-lua..
https://www.buymeacoffee.com/coffebar
Apache License 2.0
187 stars 9 forks source link

No lazy loading support #7

Open TroySigX opened 1 year ago

TroySigX commented 1 year ago

Problem:

I'm in my project directory and opens nvim for the first time (no previous session was saved). After exiting neovim, I'd expect `neovim-project' to not open any buffer (since no file was opened last time) the next time I type 'nvim', but instead, it opens an empty buffer

Reproduction

  1. Delete previous session save via :Telescope neovim-project history 2.Enter nvim from the terminal, from here, I have my startup dashboard show up like this: image

  2. Exit neovim

  3. Enter nvim again, from this, I'd expect to see my dashboard again, but instead, an empty buffer was opened, as in the picture: image

TroySigX commented 1 year ago

Hmm, this issue only persists only when I set event = 'VeryLazy' in lazy.nvim. Could it somehow be fixed?

coffebar commented 1 year ago

Hi, installation instruction contains priority=100, this option is mutually exclusive with lazy loading. Please don't use event and add lazy = false if you have enabled lazy by default.

coffebar commented 1 year ago

If you open nvim in the project directory (that matches the pattern) its expected behavior is to see an empty buffer or saved session. The only way to see your StartupPage is to open nvim outside the projects dir with option last_session_on_startup = false

The reason why it is done in this way: I believe that switching to the project directory in the terminal expresses the intention to work with this particular project. This is one of the possible ways to choose a project

coffebar commented 1 year ago

If you want to bypass session loading and open Dashboard only, you can create some alias, for example:

alias vd="nvim -c Dashboard -- _" add this to your .zshrc or .bashrc

and use vd instead of nvim to open the Dashboard

TroySigX commented 1 year ago

Hi, installation instruction contains priority=100, this option is mutually exclusive with lazy loading. Please don't use event and add lazy = false if you have enabled lazy by default.

Yes, but is there any way for the plugin to be lazy loaded?

TroySigX commented 1 year ago

Hmm, it seems that neovim-project won't work correctly when lazy-loaded

coffebar commented 1 year ago

Hmm, it seems that neovim-project won't work correctly when lazy-loaded

yes, that's right

Phystro commented 9 months ago

Just discovered this wonderful plugin and I am loving it.

I was also wondering if it would be possible to have a dashboard (if it exists in one's config) being displayed. Is this feature queued for development, given that the issue has been open for a while now?

coffebar commented 9 months ago

I was also wondering if it would be possible to have a dashboard (if it exists in one's config) being displayed.

this feature is not related to the opened issue. Yes, you can disable session auto loading in config and use your dashboard

coffebar commented 9 months ago

last_session_on_startup = false

szevzol commented 7 months ago

last_session_on_startup = false

Actually I can't use NVimTree if I don't set this to false. Worth to put this into README?

Update: even if I set it to false, I have to open NVimTree once, before opening any project from the history. Otherwise NVimTree will be broken.

coffebar commented 7 months ago

last_session_on_startup = false

Actually I can't use NVimTree if I don't set this to false. Worth to put this into README?

Update: even if I set it to false, I have to open NVimTree once, before opening any project from the history. Otherwise NVimTree will be broken.

Worth to open an issue, not sure here or maybe in the NVimTree repo. NeoTree works fine for me, didn't test with NVimTree.

szevzol commented 7 months ago

last_session_on_startup = false

Actually I can't use NVimTree if I don't set this to false. Worth to put this into README? Update: even if I set it to false, I have to open NVimTree once, before opening any project from the history. Otherwise NVimTree will be broken.

Worth to open an issue, not sure here or maybe in the NVimTree repo. NeoTree works fine for me, didn't test with NVimTree.

Thanks, I will use neotree, which is also a nice plugin :)

szevzol commented 7 months ago

I don't want to hijack this thread, but I thought it's worth to share my finding about using NvimTree together with neovim-project:

You have to call nvim-tree's setup function explicitly in your neovim-project configuration:

    init = function()
      -- enable saving the state of plugins in the session
      vim.opt.sessionoptions:append("globals") -- save global variables that start with an uppercase letter and contain at least one lowercase letter.
      require("nvim-tree").setup {}
    end,
jonestristand commented 7 months ago

Also had this issue, unclear why. Is the high priority loading of nvim-project preventing other plugins from loading for some reason?

szevzol commented 7 months ago

Also had this issue, unclear why. Is the high priority loading of nvim-project preventing other plugins from loading for some reason?

I removed the priority setting and unfortunately it didn't help.

jonestristand commented 7 months ago

This also seems to break changing the nvim-tree root directory with cd.... @coffebar