-
Notifications
You must be signed in to change notification settings - Fork 180
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
Basic config on Windows 10 raises a fatal error. #88
Comments
Have you tried specifying the |
Yes, I did. The path seems to be understood. The tilde expansion works as expected (see the end of the path) It appears that the config directory path is prepended to the path using the windows-style notation.
|
Hmm, weird. I don't have access to a Windows comp so you may have to help me debug. Could you these lines right before this line and tell me what it prints? print("A:", tostring(opts.dir))
print("B:", vim.fs.normalize(tostring(opts.dir)))
print("C:", tostring(Path:new(vim.fs.normalize(tostring(opts.dir))))) |
All the same...
|
It seems like a bug with Plenary's |
Thanks for your quick follow-up on this. |
I just tried to configure this for myself and it works fine. I added edit: Windows 11, lunarvim on neovim 0.8.0 and iCloud for syncing Obsidian with my other devices. |
yes, the |
Sounds like this was resolved. If anyone is still having this issue I'll reopen. |
Hello everyone, I am also Window user, but the use of solution above did not work for me. Is there any solution? Thank you. |
I am also getting a similar error whenever I call "ObsidianToday" for a non-existing daily note:
Edit: seems to only occur when a template is used with daily notes. |
@nevenoomo can you post your config? |
Here you go: return {
"epwalsh/obsidian.nvim",
version = "*", -- recommended, use latest release instead of latest commit
lazy = true,
ft = "markdown",
cmd = {
"ObsidianOpen",
"ObsidianNew",
"ObsidianQuickSwitch",
"ObsidianFollowLink",
"ObsidianBacklinks",
"ObsidianTags",
"ObsidianToday",
"ObsidianYesterday",
"ObsidianTomorrow",
"ObsidianTemplate",
"ObsidianSearch",
"ObsidianLink",
"ObsidianLinkNew",
"ObsidianWorkspace",
"ObsidianPasteImg",
"ObsidianRename",
},
-- Replace the above line with this if you only want to load obsidian.nvim for markdown files in your vault:
-- event = {
-- -- If you want to use the home shortcut '~' here you need to call 'vim.fn.expand'.
-- -- E.g. "BufReadPre " .. vim.fn.expand "~" .. "/my-vault/**.md"
-- "BufReadPre path/to/my-vault/**.md",
-- "BufNewFile path/to/my-vault/**.md",
-- },
dependencies = {
-- Required.
"nvim-lua/plenary.nvim",
},
opts = {
workspaces = {
{
name = "main",
path = "~/OneDrive/Documents/Obsidian Vaults/Main Workspace",
},
},
daily_notes = {
folder = "📆Journals",
template = "New Day",
},
templates = {
subdir = "📜Templates",
-- A map for custom variables, the key should be the variable and the value a function
substitutions = {},
},
completion = {
-- Set to false to disable completion.
nvim_cmp = true,
-- Trigger completion at 2 chars.
min_chars = 2,
-- Where to put new notes created from completion. Valid options are
-- * "current_dir" - put new notes in same directory as the current buffer.
-- * "notes_subdir" - put new notes in the default notes subdirectory.
new_notes_location = "current_dir",
-- Control how wiki links are completed with these (mutually exclusive) options:
--
-- 1. Whether to add the note ID during completion.
-- E.g. "[[Foo" completes to "[[foo|Foo]]" assuming "foo" is the ID of the note.
-- Mutually exclusive with 'prepend_note_path' and 'use_path_only'.
prepend_note_id = true,
-- 2. Whether to add the note path during completion.
-- E.g. "[[Foo" completes to "[[notes/foo|Foo]]" assuming "notes/foo.md" is the path of the note.
-- Mutually exclusive with 'prepend_note_id' and 'use_path_only'.
prepend_note_path = false,
-- 3. Whether to only use paths during completion.
-- E.g. "[[Foo" completes to "[[notes/foo]]" assuming "notes/foo.md" is the path of the note.
-- Mutually exclusive with 'prepend_note_id' and 'prepend_note_path'.
use_path_only = false,
},
},
config = function(_, opts)
require("obsidian").setup(opts)
vim.o.conceallevel = 2
end
} Important note: I have tried all the different variations of the I have also tried different template referencing options, like "New Day", "New Day.md", "📜Templates/New Day", and other permutations. |
Thanks @nevenoomo, I don't see any issues with your config. Can you run this from a note buffer and post the output: :lua vim.print(require("obsidian").get_client():daily_note_path(os.time())) I suspect the issue comes from this method, so that will confirm it for me. |
I am not sure that's the problem, the path seems correct, even with the mixed slashes: {
_sep = "\\",
filename = "C:/Users/user/OneDrive/Documents/Obsidian Vaults/Main Workspace\\📆Journals\\2024-01-26.md",
<metatable> = {
__concat = <function 1>,
__div = <function 2>,
__index = <function 3>,
__tostring = <function 4>,
_fs_filename = <function 5>,
_read = <function 6>,
_read_async = <function 7>,
_split = <function 8>,
_st_mode = <function 9>,
_stat = <function 10>,
absolute = <function 11>,
close = <function 12>,
copy = <function 13>,
exists = <function 14>,
expand = <function 15>,
find_upwards = <function 16>,
head = <function 17>,
is_absolute = <function 18>,
is_dir = <function 19>,
is_file = <function 20>,
is_path = <function 21>,
iter = <function 22>,
joinpath = <function 23>,
make_relative = <function 24>,
mkdir = <function 25>,
new = <function 26>,
normalize = <function 27>,
open = <function 28>,
parent = <function 29>,
parents = <function 30>,
path = {
S_IF = {
DIR = 16384,
REG = 32768
},
home = "C:\\Users\\user",
root = <function 31>,
sep = "\\"
},
read = <function 32>,
readbyterange = <function 33>,
readlines = <function 34>,
rename = <function 35>,
rm = <function 36>,
rmdir = <function 37>,
shorten = <function 38>,
tail = <function 39>,
touch = <function 40>,
write = <function 41>
}
} |
Ah, okay, maybe the issue is from converting that |
Unfortunately, it does not seem to solve the problem:
Notice, that the erroneous path has changed. It seems to be set to |
So maybe :lua vim.print(require("obsidian").get_client():daily_note_path(os.time()):parent()) |
That seems to be the case: {
_sep = "\\",
filename = "C:\\Users\\user\\AppData\\Local\\nvim\\C:/Users/user/OneDrive/Documents/Obsidian Vaults/Main Workspace\\📆Journals",
<metatable> = {
__concat = <function 1>,
__div = <function 2>,
__index = <function 3>,
__tostring = <function 4>,
_fs_filename = <function 5>,
_read = <function 6>,
_read_async = <function 7>,
_split = <function 8>,
_st_mode = <function 9>,
_stat = <function 10>,
absolute = <function 11>,
close = <function 12>,
copy = <function 13>,
exists = <function 14>,
expand = <function 15>,
find_upwards = <function 16>,
head = <function 17>,
is_absolute = <function 18>,
is_dir = <function 19>,
is_file = <function 20>,
is_path = <function 21>,
iter = <function 22>,
joinpath = <function 23>,
make_relative = <function 24>,
mkdir = <function 25>,
new = <function 26>,
normalize = <function 27>,
open = <function 28>,
parent = <function 29>,
parents = <function 30>,
path = {
S_IF = {
DIR = 16384,
REG = 32768
},
home = "C:\\Users\\user",
root = <function 31>,
sep = "\\"
},
read = <function 32>,
readbyterange = <function 33>,
readlines = <function 34>,
rename = <function 35>,
rm = <function 36>,
rmdir = <function 37>,
shorten = <function 38>,
tail = <function 39>,
touch = <function 40>,
write = <function 41>
}
} |
Looks like this bug was already reported in nvim-lua/plenary.nvim#489 |
Great! Thanks, @epwalsh! |
I added a work-around in #349. Can you try that again? |
It works! |
@nevenoomo, I'll merge and release. |
Great work, @epwalsh! |
🐛 Describe the bug
When I try to use the basic config on Windows 10:
I get the following error message:
Obviously, there is a problem with the concatenation of a Windows and a Unix path.
It could be a bug in my config, but I couldn't find the answer in the manual or online.
Thanks for advice on this.
Versions
1.6.1
The text was updated successfully, but these errors were encountered: