You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I select a word or even multiples words and use the :ObsidianLinkNew command, it successfully create a new file with the name rightly formated, but throw a lua error and dont create the link, leaving the visual selection the same as before, plain text.
Config
return {
"epwalsh/obsidian.nvim",
version="*", -- recommended, use latest release instead of latest commitlazy=false,
ft="markdown",
-- 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= {
disable_frontmatter=true,
sort_by="accessed",
picker= {
name="fzf-lua",
sort_reversed=true,
},
workspaces= {
{
name="personal",
path="~/Documents/Obsidian/mainVault/",
},
vim.keymap.set('n', '<leader>of', ':ObsidianFollowLink<CR>', {}),
vim.keymap.set('n', '<leader>oq', ':ObsidianQuickSwitch<CR>', {}),
vim.keymap.set('n', '<leader>oo', ':ObsidianTOC<CR>', {}),
vim.keymap.set('n', '<leader>og', ':ObsidianTags<CR>', {}),
vim.keymap.set('n', '<leader>od', ':ObsidianToday<CR>', {}),
vim.keymap.set('n', '<leader>op', ':ObsidianPasteImg<CR>', {}),
vim.keymap.set('n', '<leader>ob', ':ObsidianBacklinks<CR>', {}),
vim.keymap.set('v', '<C-l>', [[:'<,'>ObsidianLinkNew<CR>]], { noremap=true, silent=true }),
vim.keymap.set('n', '<leader>ot', ':ObsidianTemplate<CR>', {}),
-- vim.keymap.set('n', '<leader>or',-- ':call system("find ~/Documents/Obsidian/mainVault/ -type f | awk -v var=$(($RANDOM)) "NR==var {print $0}" | xargs nvim")<CR>',-- {}),vim.keymap.set('n', '<leader>on',
function()
localtitle=vim.fn.input('Enter note title: ')
iftitle~='' thenvim.cmd('ObsidianNew ' ..title)
elseprint('Title cannot be empty')
endend, {})
},
-- Optional, customize how note IDs are generated given an optional title.---@paramtitlestring|?---@returnstringnote_id_func=function(title)
iftitle~=nilthen-- If title is given, transform it into a valid file name and return it as the ID.returntitle:gsub("", "-"):gsub("[^A-Za-z0-9-]", ""):lower()
else-- If no title is given, fall back to generating an ID with 4 random letters or a timestamp.localsuffix=""for_=1, 4dosuffix=suffix..string.char(math.random(65, 90))
endreturntostring(os.time()) .."-" ..suffixendend,
attachments= {
img_folder="~/Documents/Obsidian/mainVault/files/",
},
daily_notes= {
-- Optional, if you keep daily notes in a separate directory.folder="Daily",
-- Optional, if you want to change the date format for the ID of daily notes.date_format="%Y-%m-%d",
-- Optional, if you want to change the date format of the default alias of daily notes.alias_format="%B %-d, %Y",
-- Optional, default tags to add to each new daily note created.default_tags= { "daily-notes" },
-- Optional, if you want to automatically insert a template from your template directory like 'daily.md'template="Daily template"
},
templates= {
folder="~/Documents/Obsidian/mainVault/templates",
date_format="%Y-%m-%d",
time_format="%H:%M",
-- A map for custom variables, the key should be the variable and the value a functionsubstitutions= {},
},
wiki_link_func=function(opts)
returnrequire("obsidian.util").wiki_link_path(opts)
end,
ui= {
enable=false, -- set to false to disable all additional syntax features
},
}
}
{{{
###Environment```textNVIMv0.10.3
Buildtype: RelWithDebInfoLuaJIT2.1.1731601260
Run"nvim -V1 -v" formoreinfoObsidian.nvimv3.9.0 (ae1f76a75c7ce36866e1d9342a8f6f5b9c2caf9b)
Status:
• bufferdirectory: nil
• workingdirectory: /home/zachWorkspaces:
✓ activeworkspace: Workspace(name='personal', path='/home/zach/Documents/Obsidian/mainVault', root='/home/zach/Documents/Obsidian/mainVault')
Dependencies:
✓ plenary.nvim: 2d9b06177a975543726ce5c73fca176cedbffe9d
✓ telescope.nvim: a0bbec21143c7bc5f8bb02e0005fa0b982edc026
✓ fzf-lua: 21849312a3eae7d8115a83b7a3f9c54a4e29c611
Integrations:
✓ picker: FzfPicker()
✗ completion: disabledTools:
✓ rg: ripgrep14.1.1
Environment:
• operatingsystem: LinuxConfig:
• notes_subdir: nil⏎
Error
Error executing Lua callback: /home/zach/.config/nvim/lua/zach/plugins/obsidian.lua:100: attempt to call field 'wiki_link_path' (a nil value)
stack traceback:
/home/zach/.config/nvim/lua/zach/plugins/obsidian.lua:100: in function 'format_link'
...im/lazy/obsidian.nvim/lua/obsidian/commands/link_new.lua:27: in function 'func'
...e/nvim/lazy/obsidian.nvim/lua/obsidian/commands/init.lua:70: in function <...e/nvim/lazy/obsidian.nvim/lua/obsidian/commands/init.lua:69>
The text was updated successfully, but these errors were encountered:
🐛 Describe the bug
When I select a word or even multiples words and use the :ObsidianLinkNew command, it successfully create a new file with the name rightly formated, but throw a lua error and dont create the link, leaving the visual selection the same as before, plain text.
Config
Error
The text was updated successfully, but these errors were encountered: