epwalsh / obsidian.nvim

Obsidian 🤝 Neovim
Apache License 2.0
4.21k stars 189 forks source link

Ability to configure default ID when creating new notes #516

Open jacobrreed opened 7 months ago

jacobrreed commented 7 months ago

🚀 The feature, motivation and pitch

I like my notes to have certain ids, and dont really like the default ids like 1711464520-VABT, but instead would like to enter the new note alias as well as the new notes id

Alternatives

No response

Additional context

No response

tgallacher commented 7 months ago

You can configure the "generate note ID" process using the opts.note_id_func -- more context about halfway down in the config block here.

If the note ID is non-consistently deterministic and you would like to specify it each time, you could use the above feature and do something like this (note: untested)

opts = {
  note_id_func = function(title)
    local utils = require("obsidian.util")

    local id = utils.input("Enter note ID: ")

    -- ... do some defensive checks for valid string etc (e.g. remove invalid chars etc)

    return id
  end
}