fiatjaf / neuron.vim

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

neuron v2 support #62

Open srid opened 3 years ago

srid commented 3 years ago

The query has changed; will need something like this to quickly pull in all zettels.

let l:cmd = g:neuron_executable.' -d "'.g:neuron_dir.'" query --cached | jq ".result | .vertices | to_entries[] | [.value]"'
chiefnoah commented 3 years ago

Sorry, slightly off topic for this issue, but was this actually a v2 change? I've noticed this plugin being broken on neuron 1.9.6.5 for what looks like this issue.

srid commented 3 years ago

1.9.6.5 is pre-v2, and v2 is designed to break a number of things (so as to accomodate the new architectural changes). v1 (which this plugin works with) can still be installed using:

nix-env -if https://github.com/srid/neuron/archive/v1.tar.gz
chiefnoah commented 3 years ago

It looks like this might be a more extensive change than just tweaking the command for listing zettels. Is there any documentation on the return format for neuron query? I have some changes necessary to get refresh_cache_callback not immediately failing, but it's not immediately clear to me how to fix zettelQueries no longer being a direct child of the zettel objects.

I'd also be hesitant to rely on jq for this plugin. My WIP changes currently expect that, but IMO it'd be better to just traverse the json structure in viml directly.

fiatjaf commented 3 years ago

Will there be a binary release of Neuron 2? I need that to use the plugin against since I deleted all my Nix environment (I love Nix, but my computer is not good enough for it).

srid commented 3 years ago

nixpkgs static builds are broken in master ... so unless somebody volunteers to resolve it, I'd say unlikely.

srid commented 3 years ago

Is there any documentation on the return format for neuron query?

Nope; but we should probably clean up its JSON output before finalizing 2.0.

chiefnoah commented 3 years ago

Nope; but we should probably clean up its JSON output before finalizing 2.0.

I sadly don't know Haskell or have time to learn it right now, but once the JSON format is 'stable' for v2.0 I plan on attempting to fix up this plugin for it.

fiatjaf commented 3 years ago

nixpkgs static builds are broken in master ... so unless somebody volunteers to resolve it, I'd say unlikely.

Oh, ok, I didn't know that. I thought binaries were still a thing. I guess I will reinstall nix then.

srid commented 3 years ago

I've added neuron query --zettels and neuron query --tags that should be helpful for editor support.

Change: https://github.com/srid/neuron/pull/547

Docs: https://neuron.zettel.page/query.html (do a full browser refresh if you see the old docs)

srid commented 3 years ago

@chiefnoah take a look at the new (final?) query interface ^

hopefully that's sufficient to use it in neuron.vim

srid commented 3 years ago

also checkout --cached mode, which really makes things fast on larger zks.

chiefnoah commented 3 years ago

The PluginData JSON structure is still rather confusing. Can you write up some documentation on how to correctly interpret that?

Example:

    "PluginData": [
      [
        [
          "DirTree",
          []
        ],
        {
          "dirParent": "index",
          "meta": null,
          "childrenTag": null,
          "tags": [
            "root"
          ]
        }
      ],
      [
        [
          "Links",
          []
        ],
        [
          [
            [
              "0de24d86",
              "cf"
            ],
            []
          ],
          [
            [
              "neuron",
              "folge"
            ],
            []
          ]
        ]
      ],
      [
        [
          "Tags",
          []
        ],
        {
          "Queries": [
            [
              "TagQuery_TagZettel",
              "zettelkasten"
            ]
          ],
          "Tagged": [
            "zettelkasten"
          ]
        }
      ],
      [
        [
          "UpTree",
          []
        ],
        []
      ]
    ]

The rest of it is fairly obvious, but this is laid out in a rather confusing way and I'm not quite sure how to interpret it.

srid commented 3 years ago

PluginData is an internal detail of neuron (used by plugins to store internal data); what are you looking to use it for? ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐ On Saturday, January 30th, 2021 at 4:39 PM, Noah Pederson notifications@github.com wrote:

The PluginData JSON structure is still rather confusing. Can you write up some documentation on how to correctly interpret that?

Example:

"

PluginData

"

: [ [ [

"

DirTree

"

, [] ], {

"

dirParent

"

:

"

index

"

,

"

meta

"

:

null

,

"

childrenTag

"

:

null

,

"

tags

"

: [

"

root

"

] } ], [ [

"

Links

"

, [] ], [ [ [

"

0de24d86

"

,

"

cf

"

], [] ], [ [

"

neuron

"

,

"

folge

"

], [] ] ] ], [ [

"

Tags

"

, [] ], {

"

Queries

"

: [ [

"

TagQuery_TagZettel

"

,

"

zettelkasten

"

] ],

"

Tagged

"

: [

"

zettelkasten

"

] } ], [ [

"

UpTree

"

, [] ], [] ] ]

The rest of it is fairly obvious, but this is laid out in a rather confusing way and I'm not quite sure how to interpret it.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

chiefnoah commented 3 years ago

For fixing neuron#tags_search, which queries for zettels based on tags.

srid commented 3 years ago

@chiefnoah Just added neuron query --tag=foo

chiefnoah commented 3 years ago

I think my changes to support v2 are done and can be seen on this branch.

@fiatjaf how do you want to handle the v1/v2 split for this plugin?