Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Neorg does not automatically create workspace directories #1060

Closed
2 tasks done
linguini1 opened this issue Sep 6, 2023 · 0 comments · Fixed by #1061
Closed
2 tasks done

Neorg does not automatically create workspace directories #1060

linguini1 opened this issue Sep 6, 2023 · 0 comments · Fixed by #1061
Labels
bug Issues related to bugs. Please attach a severity, a priority and category with this label.

Comments

@linguini1
Copy link
Contributor

Prerequisites

  • I am using the latest stable release of Neovim
  • I am using the latest version of the plugin

Neovim Version

NVIM v0.9.1

Neorg setup

require("neorg").setup({
    load = {
        ["core.defaults"] = {},
        ["core.completion"] = { config = { engine = "nvim-cmp" } },
        ["core.concealer"] = {},
        ["core.dirman"] = {
            config = {
                workspaces = {
                    school = "~/notes/school",
                    personal = "~/notes/personal",
                    projects = "~/notes/projects",
                },
                default_workspace = "personal",
            },
        },
    },
})

Actual behavior

The behaviour that I experience when running Neorg workspace school is the opening of a new workspace
named school, placing my cursor into index.norg.

When I write some text in the index file and save/write the file, I get the following error:

E212: Can't open file for writing: no such file or directory
Terminal.2023-09-06.11-18-08.mp4

Expected behavior

The behaviour I expected was for the file to be written/saved normally. In the tutorial videos on YouTube, it's
mentioned that Neorg will automatically create the necessary directories for you.

Said tutorial

Interestingly, if I change my setup function to this:

require("neorg").setup({
    load = {
        ["core.defaults"] = {},
        ["core.completion"] = { config = { engine = "nvim-cmp" } },
        ["core.concealer"] = {},
        ["core.dirman"] = {
            config = {
                workspaces = {
                    notes = "~/notes",
                    school = "~/notes/school",
                    personal = "~/notes/personal",
                    projects = "~/notes/projects",
                },
                default_workspace = "notes",
            },
        },
    },
})

Then the directories are created as expected. This leads me to believe that the issue is that Neorg has trouble creating
nested directories unless the parents are specifically listed as work spaces.

Steps to reproduce

  • Use Neovim 0.9.1 on Windows 11
  • Install Neorg using Lazy with the following setup:
--- /lua/plugins/neorg.lua (within neovim config)
return {
    "nvim-neorg/neorg",
    build = ":Neorg sync-parsers",
    dependencies = { "nvim-lua/plenary.nvim" },
    ft = "norg",
    cmd = "Neorg",
    priority = 30, -- Load after treesitter, with a priority of 50
    config = function()
        require("neorg").setup({
            load = {
                ["core.defaults"] = {},
                ["core.completion"] = { config = { engine = "nvim-cmp" } },
                ["core.concealer"] = {},
                ["core.dirman"] = {
                    config = {
                        workspaces = {
                            notes = "~/notes",
                            school = "~/notes/school",
                            personal = "~/notes/personal",
                            projects = "~/notes/projects",
                        },
                        default_workspace = "notes",
                    },
                },
            },
        })
    end,
}
  • Run :Neorg workspace school
  • Enter insert mode within the newly opened index.norg
  • Write some text, hit <Esc> and run :w

Potentially conflicting plugins

I think it's unlikely that this issue is caused by conflicting plugins, but below is a screenshot of all
the plugins I have installed:

capture

Other information

I noticed a previously closed issue here. It seemed like it was
unresolved (or at least the resolution wasn't mentioned there) and was related to the journal command. The setup is
not the same as mine, but I wonder if the journal command creates multiple directories?

This issue also linked to a discussion page here,
which I didn't find helpful in resolving this issue. Maybe the solution for the journal command could be applied here
as well.

Help

Yes, but I don't know how to start. I would need guidance (check question below)

Implementation help

I would need to know:

  • Is this expected behaviour (in other words, this isn't an issue)
  • Where to check for the core.dirman functionality that creates workspace directories (I presume at least that it's core.dirman which does this)
@linguini1 linguini1 added the bug Issues related to bugs. Please attach a severity, a priority and category with this label. label Sep 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issues related to bugs. Please attach a severity, a priority and category with this label.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant