v:count in mapping gets E492: Not an editor command: count

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

v:count in mapping gets E492: Not an editor command: count

porphyry5
:h v:count includes the following example
map _x :<C-U>echo "the count is " . v:count<CR>

which works as expected, but using
map :let @n=v:count1<cr> ...

produces E492 etc; and instead I must use
map ;; :<C-U>exe 'let @n=v:count1'<cr> ...

for it to work.

Now I have a number of mappings in alternate .vimrc files that use the 'let' form that now fails, which strongly implies that at one time that method of saving v:count did work.
So is this a recent development? Or have I unwittingly set something in .vimrc that invalidates 'let'? Or is it a vim error that is likely to be corrected by reverting to the old form? Or ...?

--
--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/63e65a86-4f90-437d-a392-a423c0e8881eo%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: v:count in mapping gets E492: Not an editor command: count

Jürgen Krämer-4
Hi,

Graham Lawrence schrieb am 19.07.2020 um 22:07:

> :h v:count includes the following example
> |
> map _x :<C-U>echo "the count is ".v:count<CR>
> |
>
> which works as expected, but using
> |
> map :let @n=v:count1<cr>...
> |
>
did you really leave out the left-hand-side of the mapping in your .vimrc or is this just a typo in your mail?

> produces E492 etc; and instead I must use
> |
> map ;;:<C-U>exe 'let @n=v:count1'<cr>...
> |
>
> for it to work.
>
> Now I have a number of mappings in alternate .vimrc files that use the 'let' form that now fails, which strongly implies that at one time that method of saving v:count did work.
> So is this a recent development? Or have I unwittingly set something in .vimrc that invalidates 'let'? Or is it a vim error that is likely to be corrected by reverting to the old form? Or ...?

Regards,
Jürgen

--
--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/e18c4134-695a-1d51-1094-926d11ae7481%40googlemail.com.
Reply | Threaded
Open this post in threaded view
|

Re: v:count in mapping gets E492: Not an editor command: count

porphyry5
You have a very good point there, Jurgen. Somehow now, I have this uncontrollable urge to go baa-aa-aa at the moon.

On Mon, Jul 20, 2020 at 10:20 PM 'Jürgen Krämer' via vim_use <[hidden email]> wrote:
Hi,

Graham Lawrence schrieb am 19.07.2020 um 22:07:
> :h v:count includes the following example
> |
> map _x :<C-U>echo "the count is ".v:count<CR>
> |
>
> which works as expected, but using
> |
> map :let @n=v:count1<cr>...
> |
>
did you really leave out the left-hand-side of the mapping in your .vimrc or is this just a typo in your mail?

> produces E492 etc; and instead I must use
> |
> map ;;:<C-U>exe 'let @n=v:count1'<cr>...
> |
>
> for it to work.
>
> Now I have a number of mappings in alternate .vimrc files that use the 'let' form that now fails, which strongly implies that at one time that method of saving v:count did work.
> So is this a recent development? Or have I unwittingly set something in .vimrc that invalidates 'let'? Or is it a vim error that is likely to be corrected by reverting to the old form? Or ...?

Regards,
Jürgen

--
--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/e18c4134-695a-1d51-1094-926d11ae7481%40googlemail.com.


--
Graham Lawrence

--
--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CA%2BE5mK7ZedxExMv3QFNB4a5%3DK6STj4h6N-eTbE3C%2B-_r60vTkw%40mail.gmail.com.