fiatjaf / neuron.vim

📝 Manage your Zettelkasten in {n}vim.
MIT License
83 stars 21 forks source link

Waiting cache populated takes forever #19

Closed bangedorrunt closed 3 years ago

bangedorrunt commented 4 years ago

Hi,

Sometimes, it takes forever to wait for cache populated. I have to restart Neovim to make it work from time to time.

Screen Shot 2020-09-29 at 3 44 58 pm

Moreover, how to make Neuron start caching when I first open Neovim. At this moment, I have to gzr everytime I open my zettel note.

bangedorrunt commented 4 years ago

I figured it out. All I need is cd to my note directory and open Neovim from there. I normally use Startify plugin to quickly open my note. And this way doesn't work with Neuron.

fiatjaf commented 4 years ago

We should address this.

vcavallo commented 4 years ago

I'm having the same issue. But for me, it never ends. (and I am starting Neovim from within the notes directory).

May very well be related to https://github.com/fiatjaf/neuron.vim/issues/22 - which might only be a problem on my system!

My issue, not yours :)

fenetikm commented 4 years ago

I'll have a look at this one too since I am seeing it - I think the caching "issue" should probably be non-blocking and maybe it should only use it once it is available and fallback to a live query when not ready. Maybe also a setting to turn it off all together.

fiatjaf commented 4 years ago

The problem is that neuron.vim should be still prepopulating the cache whenever one opens any Zettel, unless this configuration is missing something, which is very likely given my inexperience with Vim plugins:

https://github.com/fiatjaf/neuron.vim/blob/16464a8831bcaec0bd1f274b653802cb4036a8f3/ftdetect/neuron.vim#L15-L19

@babygau's issue with opening from different directories shouldn't be a concern, I don't understand it.

fiatjaf commented 4 years ago

Actually these parts might be relevant:

https://github.com/fiatjaf/neuron.vim/blob/16464a8831bcaec0bd1f274b653802cb4036a8f3/ftdetect/neuron.vim#L2-L12

I can't simulate any situation in which fnamemodify(expand("%:p") wouldn't give me the correct path, but maybe in your system that happens when you open zettels from other places. The solution would be to manually set g:neuron_dir.

fenetikm commented 4 years ago

cool and thanks for the lead - I'll come back with what I find 👍

vcavallo commented 4 years ago

Probably relevant for my case: I often open the directory (vim .), which starts in Explore mode - showing the file tree - so when I gzz I don't technically have any zettel open.

fiatjaf commented 4 years ago

@vcavallo fnamemodify(expand("%:p") doesn't work on these conditions. We must find something that gives us the current directory so we can identify it as part of the Zettelkasten and proceed to do the normal things.

fenetikm commented 4 years ago

I have fixed one problem so far. In my case it was because my path had a space in it - needed to run the dir through fnameescape. @vcavallo when you run vim . is that inside your zettelkasten directory? Also, do you have g:neuron_dir set in your vimrc or not?

fenetikm commented 4 years ago

Ok, I have created a PR for this: https://github.com/fiatjaf/neuron.vim/pull/27

fenetikm commented 4 years ago

I believe this has been addressed, let me know if you still have issues.

jrekier commented 3 years ago

Hi ! I also have the message waiting until chache is populated...and then nothing happens. I haven't quite understood what's the matter here...

fenetikm commented 3 years ago

Hi @jrekier thanks for that - could you tell me the following:

jrekier commented 3 years ago

Hi @fenetikm, thanks for your comment. Here are the answers to your questions:

Hope it's helpful ! Thanks for your help !

fenetikm commented 3 years ago

Hi @jrekier thanks for that - just wanted to check that you are on the latest version of the plugin too?

Could you please give me a list of steps that you did. e.g.

Also making sure that you have a neuron.dhall file in your zettelkasten directory?

Thanks.

jrekier commented 3 years ago

Hi @fenetikm

I think I am using the latest version. I have just moved to this fork from the original plugin yesterday. I started off by cleaning my list of plugins and installed the latest one. Here is a screeshot of where I'm standing after PlugUpdate

image

The bug happens after I do the following:

  1. open terminal and type in neuron search -e, select and open a zettel
  2. then typing gzz anywhere produces the following message waiting until chache is populated...which stays there and nothing happens.

alternative to 1. : the bug also happens when I open a zettel directly (i.e. not using the neuron command), e.g. nvim 03420c42.md will open a zettel in neovim and then step 2. proceeds with the same bug.

Here is the content of my /Users/jerem/zettelkasten/neuron.dhall:

{ siteTitle =
    "My Zettelkasten"
, theme =
    "red"
}

I am missing something there ?

fenetikm commented 3 years ago

Thanks for the details - will see if I can reproduce what you are seeing and let you know.

fenetikm commented 3 years ago

@jrekier oh hang on, which version of neuron are you running? (run neuron --version) - I am on 1.1.3.0.

jrekier commented 3 years ago

Oh my! I'm on 0.6.5.2 ... I just did a git pull on the neuron directory and this did not fix it! I must be doing something wrong with nix. How can I update to the latest version ? (sorry for the trouble !)

fenetikm commented 3 years ago

Ahh hopefully that is it. Have a look at the installation page that also mentions how to upgrade it.

nix-env -if https://github.com/srid/neuron/archive/master.tar.gz

from https://neuron.zettel.page/install.html

jrekier commented 3 years ago

yes!! That seems to have fixed it! Just checking the other commands atm and everything seems to fall into place. Thank you so much for your help @fenetikm ! Sorry that it was due to such a stupid oversight from my side...

fenetikm commented 3 years ago

No probs at all - finding this and what happened to you may help others. Cheers.

craigdallimore commented 3 years ago

Not sure if it is helpful, or another bug - I found that having this in my vimrc would have the unwanted effect:

let g:neuron_dir="~/Documents/zettle/"

By removing it, I'm able to use gzz and it is almost instant. I need to be in the zettel directory however. I figure I need declare the path in another way.

Edit

This works! Looks like it wanted an absolute path.

let g:neuron_dir=expand("~/Documents/zettle/")
fenetikm commented 3 years ago

Thanks @craigdallimore - yeah was just about to ask what the complete path was and if that would work. Cheers.

beandipper commented 3 years ago

I also wanted to add, that setting the neuron_dir path in my config had me stuck with the waiting until cache is populated... prompt when opening vim outside the zettelkasten directory and runnging gzz

Making the following change fixed the problem for me let g:neuron_dir=expand("~/Documents/zettle") to let g:neuron_dir=expand("~/Documents/zettle/")

So make sure that: