Closed CaeChao closed 1 month ago
Can you try using this branch and see if it works?
The Error message is replaced with a warning message in feat/new-links
Please provide exact steps how to reproduce. I'm not able to reproduce it. I tried these formats and none of them error/warning:
* Headline
Non existing file:
[[file:./test_file.org]]
[[./test_file.org]]
Existing file:
[[file:./todos.org]]
[[./todos.org]]
test.org:
[[./test_file.org][Test file]]
test_file.org:
* Headline
** Head 2
org_open_at_point
under the link showed above
After I added a return before the vim.cmd at line 919 lua/orgmode/org/mappings.lua in master branch
if link.url:is_file_only() then
local file_path = link.url:get_file()
local cmd = file_path and string.format('edit %s', fs.get_real_path(file_path)) or ''
vim.cmd(cmd)
return vim.cmd([[normal! zv]]) -- line 919
end
none of error/warning appear again
Since https://github.com/nvim-orgmode/orgmode/pull/803 will be merged fairly soon, I fixed the issue there.
PR https://github.com/nvim-orgmode/orgmode/pull/803 is merged, so I'm considering this issue solved. If you run into anything let me know.
Describe the bug
Error message: attempt to index field 'file' (a nil value) I think it is caused by the line 919 in lua/orgmode/org/mappings.lua: which the line
vim.cmd([[normal! zv]])
should be executed with a return, so that the function won't continue its execution to line 957self:_goto_headline(headline)
when the link isis_file_only
Steps to reproduce
create a file only link and open it at point
Expected behavior
should not popup error message
Emacs functionality
No response
Minimal init.lua
Screenshots and recordings
No response
OS / Distro
Linux
Neovim version/commit
v0.10.0
Additional context
No response