Closed prmadev closed 2 years ago
I do wonder if using this code would work better for you? https://github.com/mickael-menu/zk-nvim/pull/14
Since it's been merged in, not sure when (if not already) it'll be set for release.
I do wonder if using this code would work better for you? #14
Since it's been merged in, not sure when (if not already) it'll be set for release.
I think I'm already at the latest commit on main, which is one commit ahead of #14. And yet the problem persists, I'm not sure if the problem is caused by #14. Would you like me to try commits before its merge to see if the issue is present then as well?
If you were trying this via your N mapping. This mapping
vim.api.nvim_set_keymap("v", "N", ":ZkNewFromTitleSelection<CR>", { noremap = true })
should be
vim.api.nvim_set_keymap("v", "N", ":'<'>ZkNewFromTitleSelection<CR>", { noremap = true })
.
The '<'>
is important here, Neovim will only update these marks after you leave visual mode. This makes sure to leave visual mode before executing the command.
Just to be sure: First you make a selection, and then hit : which should automatically insert :'<,'>
for you, and the you complete this to :'<,'>ZkNewFromTitleSelection
and hit enter. Is this what you're doing?
y
If you were trying this via your N mapping. This mapping
vim.api.nvim_set_keymap("v", "N", ":ZkNewFromTitleSelection<CR>", { noremap = true })
should bevim.api.nvim_set_keymap("v", "N", ":'<'>ZkNewFromTitleSelection<CR>", { noremap = true })
.The
'<'>
is important here, Neovim will only update these marks after you leave visual mode. This makes sure to leave visual mode before executing the command.
oh yeah, I actually changed that, just because I saw that it was repeated in the cmdline, just to see if it had anything to do with my problem. However, no tangible difference was made.
Just to be sure: First you make a selection, and then hit : which should automatically insert
:'<,'>
for you, and the you complete this to:'<,'>ZkNewFromTitleSelection
and hit enter. Is this what you're doing?
Exactly. I have also tried differnet combinations of keymappings to invoke this function. Again, nothing substantial was changed.
I sometimes get lucky and the function executes correctly, but I am yet to pin-point the effective parameter.
Just trying to pin this down; does it maybe work if you make a selection, then hit esc to go back to normal mode first, then manually type :'<,'>ZkNewFromTitleSelection
?
ok so I tracked it down now. there is a bug in this neovim 0.6.1 function (https://github.com/neovim/neovim/blob/b4fbb9dcf2752d95b9be335d99b0c55efb5f17de/runtime/lua/vim/lsp/util.lua#L193), which causes vim.lsp.util.make_given_range_params()
to not always return the correct value on unsaved buffers.
I've made a workaround PR which fixes this on our side (https://github.com/mickael-menu/zk-nvim/pull/20/files), but I'll also create an issue/PR at Neovim to properly fix this on their side when I get time.
Thanks for reporting! I was previously testing this with Neovim 0.6.0 where the bug is not present.
I've reported this bug upstream. https://github.com/neovim/neovim/issues/16985
Hey! So when I select a range of characters, and invoke
'<,'>ZkNewFromTitleSelection
or'<,'>ZkNewFromContentSelection
, the earlier makes a note with the title of the first letter of range and the later, a note with content of the first range. As an example this is a note:When I enter visual mode and select
this should become a link
and invoke with the above commands I end up with the first note with this content:and another note with this content:
I have tried this with neovim versions
and also the latest nightly build available on git. I have also disabled all my other configurations.
Here is the content of my
.zk/config.toml
:Also here is the content of my
zk.lua
configuration file:Please tell me to provide any additional information, if needed.