neorg
neorg copied to clipboard
Neorg cannot create a folder and throws error while creating a file inside a non existing folder
Prerequisites
- [X] I have read contribution guidelines
- [X] I am using the latest version of the plugin
- [X] I am using either 0.6 stable or the latest compiled neovim version
Neovim Version
0.7.2
Neorg setup
require('neorg').setup { load = { ["core.defaults"] = {}, ["core.norg.dirman"] = { config = { workspaces = { home = "~/notes/home", work = "~/notes/work", } } }, ["core.norg.completion"] = { config = { engine = "nvim-cmp", } }, ["core.norg.concealer"] = { config = { icon_preset = "varied" } } } }
Actual behavior
Neorg is unable to create a new folder when a path is provided with a new folder.
Expected behavior
New folder should be automatically created
Steps to reproduce
New folder should be automatically created
Potentially conflicting plugins
No response
Other information
No response
Help
No
Implementation help
No response
The statement
New folder should be automatically created
Is a dogma. Can you elaborate why this should be the case ?
I created a link to another norg file by {:folder/test:}[test_file] Then I went into the file and added some things. While saving the file, it throws me an error saying: "Can't open file for writing: no such file or directory".
I previously used vimwiki which created a new folder in such cases, and I did not have to think about creating a folder before writing contents to a file.
Hmm interesting. @danymat it makes sense for this to be builtin imo. I'll implement this when I can :)
This now seems to be addressed by Neovim itself.
Authors who want this can do :w ++p
to ask Neovim to create the folder structure if it doesn't exist.
:h :w
and :h ++opt
in Neovim for more info.
In light of this, is this still something that should be builtin to neorg?
Yep! Now that this is available by default inside of Neovim making Neorg auto-create these directories is a bit unwarranted in my opinion? It's still a bit of a difficult choice to make, but I think it's best to leave creation of files up to the user to prevent Neorg from creating random files whenever you enter a link by accident. This annoyance is especially amplified when you create a typo in a link, enter the link, and then you not only have to change the link you have to remove the file it created automatically. Closing as wontfix
:)