`i_<C-\><C-o>gcc` prints `g@$`
Thank you for this amazing plugin! (TJ brought me here) I found this strange bug that happens for your plugin, but doesn't occur with Tpope's. Write the following: (I used python for this example)
print("hello world")
When while still in insert mode write: <C-\><C-o>gcc
(<C-\><C-o>) takes you into normal mode for a single command before returning to insert mode)
expected behavior:
# print("hello world")
actual behavior:
print("hello world")g@$
setup (default):
lua require("Comment").setup()
nvim v0.7.0-dev
Let me know if you need any other information please!
I am not sure about the <C-\><C-o> combination but AFAIK even <C-o> is enough to put you on normal mode from insert mode.
for some strange reason even <C-o>gcc exhibits the same behavior as above
(also it's not easy to find but the help menu is :help i_CTRL-\_CTRL-O in case you were having trouble [I did personally])
I see, that both <C-\><C-o> and <C-o> are similar. Although, I am not sure how to fix this as of now. vim-commentary must be doing something to prevent this, might be a workaround or something trivial.
Hmm, I found another bug that I fixed with might actually lead to some clues as to what the problem might be with this plugin. So let this be a motivating example:
nnoremap J mzJ`z
This map ensures the cursor stays where it is when joining lines together. So let this be a motivating example, with the cursor placed at the end of the first line:
print("hello world")
print("hello world")
Now, when I try joining the lines in insert mode using the <C-o> hack this happens:
print("hello world")J`z
print("hello world")
Essentially, it seems that the remap doesn't seem to completely work here as it makes a mark for the first command mz, but then returns to insert mode before the other commands are completed.
I found that this solves the problem:
function! LineJoin()
norm! mzJ`z
end function
nnoremap J :call LineJoin()<cr>
It seems like a function call fixed the problem, but I can't be entirely sure without diving deeper into the code.
print("hello world") print("hello world")
Hey @Josiah-tan, Sorry for coming on this so late. But would you mind trying #204 and let me know whether this fixes the issue?