-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Insert mode keybindings not working correctly for variable #86
Comments
Probably should do #44 first to avoid confusion. |
Closed; no practical need for this, and no-one's asking for it! |
Oh no I was late:( I'm looking for Insert mode support and found this issue. My rationale is that this plugin inserts text to the buffer, so I think it's appropriate to do so while being in Insert mode. Please allow me to demo with the following example: async function fetchData() {
const response = await fetch(API_URL);
const data = await response.json();
|
} The Before discovering this plugin, I used the following local log_snippet = s({ trig = "log", wordTrig = true }, {
f(function()
local func_name = get_current_function_name()
return string.format("console.log('%s %s: ', ", func_name)
end),
i(1),
t({ ");" }),
}) When I type But to be fair, it's rather minor and I'm satisfied with this plugin as-is. Regardless, thank you for developing this awesome plugin! There are valid use cases when adding debugging statements is more than enough over using a debugger. Thank you again! |
Ok, well, I'm willing to reconsider :) If I added insert mode support I think it would only make sense to do it for 'plain' debug lines, as there's no meaningful way to select a variable (except perhaps with a prompt) would you agree? |
Issue reopened for discussion. I think I could potentially support:
The variable lines would have to prompt for a variable name I think, because there would have to be an assumption that wherever you were in insert mode you weren't on top of a variable, but instead a fresh line / white space. |
I've implemented this now in the main branch; it's not in a release yet. @kohane27 Please try it out and see how well it works for you :) |
Wow! Thank you so much for such a quick response and implementation! I updated and tried with the following config: return {
"andrewferrier/debugprint.nvim",
opts = {
keymaps = {
insert = {
plain = "<C-G>p",
variable = "<C-G>v",
}
},
},
}
cursor-block-upload.mp4Thank you again! |
OK, thanks for the feedback, this is good to know. debugprint uses
|
@andrewferrier Sorry that I missed the following crucial info. I actually have the following config: return {
"andrewferrier/debugprint.nvim",
opts = {
keymaps = {
insert = {
plain = "<C-G>p",
variable = "<C-G>v",
},
normal = {
plain_below = "<leader>pp",
plain_above = "<leader>pP",
variable_below = "<leader>pv",
variable_above = "<leader>pV",
variable_below_alwaysprompt = nil,
variable_above_alwaysprompt = nil,
textobj_below = nil,
textobj_above = nil,
toggle_comment_debug_prints = nil,
delete_debug_prints = nil,
},
visual = {
variable_below = nil,
variable_above = nil,
},
},
},
}
Thank you again! |
OK, thanks for doing that further testing. So it seems it really is just that keybinding. I'm testing it with a plain NeoVim with no other plugins and it works, so I think it must be conflicting with something in your setup. Do you know if you have any plugins which might override or change the standard NeoVim UI behaviour? Do you use a NeoVim distribution like LazyVim for example? If you're able to share a list of your plugins that would be very helpful. |
OK, I managed to recreate |
Further narrowing of the problem: it appears that with @kohane27 it would be helpful to understand if you do use noice. This might be a noice problem but I have to investigate further. |
@kohane27 FYI - I've opened a noice issue as above. My educated guess would be that this is what is causing your issue, but even if not, I think the noice issue is valid standalone anyway. |
@andrewferrier Hello and apologies for my late reply. You're absolute correct: I'm using noice.nvim. After disabling it, One extra info is that, without disabling noice.nvim, Normal mode's I'll disable noice.nvim for now. Regardless, thank you so much for following up and testing it for me; I really appreciate it:) |
Thanks for confirming. Yes, that's the behaviour I would expect; it seems to be only in insert mode that noice has this issue. Right now I don't think I have a working apart from obviously not using that key or disabling noice. Let's see what happens with the issue I opened. Thanks! |
@kohane27 I think I've fixed this now, even when noice is installed - I've switched to a different style of mapping which seems to be resilient to this problem. Please update to the latest on the main branch and re-test :) |
Hello @andrewferrier |
Excellent, that's great, thank you for the feedback! |
No description provided.
The text was updated successfully, but these errors were encountered: