Saturday, July 26, 2025

Re: Calling a vim9script function with a range

On 22/7/25 22:41, Igbanam Ogbuluijah wrote:
> May not be the most efficient way but… I'll accept a "mode" in g:Comment() as
> g:Comment(mode: string). Then in the mappings, I'd explicitly map modes with
> their strings
>
> vmap \c :<C-U>call Comment("visual")<CR>

vim9script
map <F5> :echo "N" .. mode()<CR>
vmap <F5> :<C-U>echo "V" .. mode()<CR>

In normal mode, pressing F5 gives "Nn", in visual mode, pressing F5 gives "Vn".

Why doesn't mode() print "v" in the visual mode ?

--
--
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 vim_use+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/vim_use/5692bfe6-e2e6-4839-b3f3-51221fe79bf8%40gmail.com.

No comments: