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

ObsidianToday command creating directories instead of files: #436

Closed
bcl1713 opened this issue Feb 25, 2024 · 2 comments · Fixed by #437
Closed

ObsidianToday command creating directories instead of files: #436

bcl1713 opened this issue Feb 25, 2024 · 2 comments · Fixed by #437
Labels
bug Something isn't working

Comments

@bcl1713
Copy link

bcl1713 commented Feb 25, 2024

🐛 Describe the bug

When I run :ObsidianToday, the plugin is creating a directory instead of a file and throwing the following error:

Unable to write note at '/home/brian/Documents/wiki/dailies/2024-02-25.md'
Error executing Lua callback: ...e/nvim/lazy/plenary.nvim/lua/plenary/context_manager.lua:24: ...ocal/share/nvim/
lazy/obsidian.nvim/lua/obsidian/note.lua:274: Is a directory
stack traceback:
        [C]: in function 'assert'
        ...e/nvim/lazy/plenary.nvim/lua/plenary/context_manager.lua:24: in function 'with'
        ...ocal/share/nvim/lazy/obsidian.nvim/lua/obsidian/note.lua:189: in function 'from_file'
        ...al/share/nvim/lazy/obsidian.nvim/lua/obsidian/client.lua:1404: in function 'daily'
        .../nvim/lazy/obsidian.nvim/lua/obsidian/commands/today.lua:17: in function 'func'
        ...e/nvim/lazy/obsidian.nvim/lua/obsidian/commands/init.lua:67: in function <...e/nvim/lazy/obsidian.nvim
/lua/obsidian/commands/init.lua:66>

Config

local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
  vim.fn.system({
    "git",
    "clone",
    "--filter=blob:none",
    "https://github.com/folke/lazy.nvim.git",
    "--branch=stable", -- latest stable release
    lazypath,
  })
end
vim.opt.rtp:prepend(lazypath)

require("lazy").setup({
  {
    "epwalsh/obsidian.nvim",
    version = "*",
    lazy = false,
    ft = "markdown",
    dependencies = {
      "nvim-lua/plenary.nvim",
    },
    opts = {

      templates = {
        subdir = "templates",
      },

      workspaces = {
        {
          name = "personal",
          path = "~/Documents/wiki",
        },
      },

      daily_notes = {
        folder = "dailies",
        template = "daily template.md",
      },

      notes_subdir = ".",

      new_notes_location = "notes_subdir",
    }
  }
})

Environment

nvim --version
NVIM v0.9.6-dev-18+g0ef27180e
Build type: RelWithDebInfo
LuaJIT 2.1.1692716794
Compilation: /usr/bin/cc -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wvla -Wdouble-promotion -Wmissing-noreturn -Wmissing-format-attribute -Wmissing-prototypes -fno-common -Wno-unused-result -Wimplicit-fallthrough -fdiagnostics-color=always -fstack-protector-strong -DUNIT_TESTING -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -I/home/brian/dev/neovim/.deps/usr/include/luajit-2.1 -I/usr/include -I/home/brian/dev/neovim/.deps/usr/include -I/home/brian/dev/neovim/build/src/nvim/auto -I/home/brian/dev/neovim/build/include -I/home/brian/dev/neovim/build/cmake.config -I/home/brian/dev/neovim/src -I/usr/include -I/home/brian/dev/neovim/.deps/usr/include -I/home/brian/dev/neovim/.deps/usr/include -I/home/brian/dev/neovim/.deps/usr/include -I/home/brian/dev/neovim/.deps/usr/include -I/home/brian/dev/neovim/.deps/usr/include -I/home/brian/dev/neovim/.deps/usr/include

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/local/share/nvim"

Run :checkhealth for more info
nvim --headless -c 'lua require("obsidian").info()' -c q
Plugins:
  [obsidian.nvim (v3.5.1)] Commit SHA: 4eb44381811ab6af67b9f9fe3117616afbe1e118
  [plenary.nvim] Commit SHA: 4f71c0c4a196ceb656c824a70792f3df3ce6bb6d
Tools:
  [rg] ripgrep 13.0.0
Environment:
  [OS] Linux%                               
@bcl1713 bcl1713 added the bug Something isn't working label Feb 25, 2024
epwalsh added a commit that referenced this issue Feb 25, 2024
@epwalsh
Copy link
Owner

epwalsh commented Feb 25, 2024

@bcl1713 thanks, #437 should fix.

epwalsh added a commit that referenced this issue Feb 25, 2024
@bcl1713
Copy link
Author

bcl1713 commented Feb 25, 2024

Works. Thanks so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants