I'm trying to map <leader>ox to call ObsidianExtractNote from obsidian.nvim plugin
vim.keymap.set('x', '<leader>ox', '<cmd>ObsidianExtractNote<cr>')
When I just call :ObsidianExtractNote in command mode it prompts to name a new note and works just fine.
But pressing <leader>ox fails with an error:
attempt to index local 'new_id'
I also tried to map this command with a constant name to avoid the prompt:
vim.keymap.set('x', '<leader>ox', '<cmd>ObsidianExtractNote note_name<cr>')
But this time the new error occurred:
Invalid 'start_col': out of range
Finally found a solution.
I thought that
<cmd>and:are equals but they are not.<cmd>doesn't change mode instead of:.After changing mapping to
vim.keymap.set('x', '<leader>ox', ':ObsidianExtractNote<cr>')all errors are gone.