On 4/8/25 20:26, Maxim Kim wrote:
When you do `:<C-U>` you effectively exit visual mode.
Instead try to use `xnoremap <F5> <cmd>echow getpos(".") getpos("v")<CR>`
Hi, i found out about <cmd> a short time ago.
vim9script
def g:Comment(m: string)
if m == 'v'
var l1 = line("'<")
append(l1 - 1, ["assert(0);", "#if 0"])
var l2 = line("'>")
append(l2, ["#endif"])
else
var l1 = line(".")
append(l1 - 1, ["assert(0);", "#if 0"])
var l2 = line(".")
append(l2, ["#endif"])
endif
enddef
map \cm <CMD>let m = mode(1)<CR>:<C-U>call Comment(m)<CR>
--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/vim_use/13239d4e-4d35-4e78-a62d-4b8483890f5b%40gmail.com.