Open
Description
🐛 Describe the bug
I am trying to move a note from into a different folder without changing the id. Rename fails with the message "New note ID is the same, doing nothing".
I would expect this command to work when just the path is changed.
Steps to reproduce:
- Create a new note with id "test"
- execute
:ObsidianRename existing_folder/test
Config
{
"epwalsh/obsidian.nvim",
version = "*", -- recommended, use latest release instead of latest commit
lazy = true,
-- 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 " .. vim.fn.expand "~" .. "/Documents/notes/**.md",
"BufNewFile " .. vim.fn.expand "~" .. "/Documents/notes/**.md"
},
dependencies = {
-- Required.
"nvim-lua/plenary.nvim",
-- optional
"nvim-treesitter/nvim-treesitter",
"nvim-telescope/telescope.nvim",
},
opts = {
workspaces = {
--...
},
mappings = {
},
-- Optional, customize how note IDs are generated given an optional title.
---@param title string|?
---@return string
note_id_func = function(title)
-- Create note IDs in a Zettelkasten like format with a prefix and timestamp.
-- Zettelkasten uses timestamp and suffix instead.
-- In this case a note with the title 'My new note' will be given an ID that looks
-- like 'my-new-note--1657296016', and therefore the file name 'my-new-note--1657296016.md'
local prefix = ""
if title ~= nil then
-- If title is given, transform it into valid file name.
prefix = title:gsub(" ", "-"):gsub("[^A-Za-z0-9-]", ""):lower()
else
-- If title is nil, just add 4 random uppercase letters to the suffix.
for _ = 1, 4 do
prefix = prefix .. string.char(math.random(65, 90))
end
end
return prefix .. "--" .. tostring(os.time())
end,
-- Optional, customize how note file names are generated given the ID, target directory, and title.
---@param spec { id: string, dir: obsidian.Path, title: string|? }
---@return string|obsidian.Path The full path to the new note.
note_path_func = function(spec)
-- This is equivalent to the default behavior.
local path = spec.dir / tostring(spec.id)
return path:with_suffix(".md")
end,
prefered_link_style = "markdown",
---@param url string
follow_url_func = function(url)
-- Open the URL in the default web browser.
vim.fn.jobstart({ "xdg-open", url })
end,
},
}
Environment
nvim --version
NVIM v0.10.1
Build type: Release
LuaJIT 2.1.1713773202
Run "nvim -V1 -v" for more info
nvim --headless -c 'lua require("obsidian").info()' -c q
obsidian-tags loaded
Obsidian.nvim v3.9.0 (ae1f76a75c7ce36866e1d9342a8f6f5b9c2caf9b)
Status:
• buffer directory: nil
• working directory: /home/burkhard/Documents/notes/personal
Workspaces:
✓ active workspace: Workspace(name='personal', path='/home/burkhard/Documents/notes/personal', root='/home/burkhard/Documents/notes/personal')
Dependencies:
✓ plenary.nvim: 2d9b06177a975543726ce5c73fca176cedbffe9d
✓ nvim-cmp: ae644feb7b67bf1ce4260c231d1d4300b19c6f30
✓ telescope.nvim: 7011eaae0ac1afe036e30c95cf80200b8dc3f21a
Integrations:
✓ picker: TelescopePicker()
✓ completion: enabled (nvim-cmp) ✗ refs, ✗ tags, ✗ new
all sources:
• nvim_lsp
Tools:
✓ rg: ripgrep 14.1.0
Environment:
• operating system: Linux
Config:
• notes_subdir: inbox