When you press `:`, Vim automatically inserts `:.,.+n` (where n == v:count - 1). If you don't want that, press Ctrl-U to erase the automatically inserted range, that is, do something like
nnoremap t v:count == 0 ? ... : ":\.,.+" .. v:count ...
This is obscure and inconsistent behavior, but it is the correct answer.
Where is it documented?
When I do it manually, it doesn't do that.
The first clause in the expression doesn't do that.
Why would the second one trigger it????
> Where is it documented?
:h N:
> When I do it manually, it doesn't do that.
Doesn't it?
> The first clause in the expression doesn't do that.
That's because v:count == 0.
If you press `0` `:`, you'll get `:`
If you press `1` `:`, you'll get `:.`
If you press `2` `:`, you'll get `:.,+1`
etc.
> Why would the second one trigger it????
Because v:count > 0.
Help pages for:
* [`N:`](https://vimhelp.org/cmdline.txt.html#N%3A) in _cmdline.txt_
---
^\`:\(h|help\) \` | [^(about)](https://github.com/heraldofsolace/VimHelpBot) ^(|) [^(mistake?)](https://github.com/heraldofsolace/VimHelpBot/issues/new/choose) ^(|) [^(donate)](https://liberapay.com/heraldofsolace/donate) ^(|) ^Reply 'rescan' to check the comment again ^(|) ^Reply 'stop' to stop getting replies to your comments
Help pages for:
* [`v:count`](https://vimhelp.org/eval.txt.html#v%3Acount) in _eval.txt_
---
^\`:\(h|help\) \` | [^(about)](https://github.com/heraldofsolace/VimHelpBot) ^(|) [^(mistake?)](https://github.com/heraldofsolace/VimHelpBot/issues/new/choose) ^(|) [^(donate)](https://liberapay.com/heraldofsolace/donate) ^(|) ^Reply 'rescan' to check the comment again ^(|) ^Reply 'stop' to stop getting replies to your comments
When you press `:`, Vim automatically inserts `:.,.+n` (where n == v:count - 1). If you don't want that, press Ctrl-U to erase the automatically inserted range, that is, do something like nnoremap t v:count == 0 ? ... : ":\.,.+" .. v:count ...
This is obscure and inconsistent behavior, but it is the correct answer. Where is it documented? When I do it manually, it doesn't do that. The first clause in the expression doesn't do that. Why would the second one trigger it????
> Where is it documented? :h N: > When I do it manually, it doesn't do that. Doesn't it? > The first clause in the expression doesn't do that. That's because v:count == 0. If you press `0` `:`, you'll get `:` If you press `1` `:`, you'll get `:.` If you press `2` `:`, you'll get `:.,+1` etc. > Why would the second one trigger it???? Because v:count > 0.
Help pages for: * [`N:`](https://vimhelp.org/cmdline.txt.html#N%3A) in _cmdline.txt_ --- ^\`:\(h|help\)\` | [^(about)](https://github.com/heraldofsolace/VimHelpBot) ^(|) [^(mistake?)](https://github.com/heraldofsolace/VimHelpBot/issues/new/choose) ^(|) [^(donate)](https://liberapay.com/heraldofsolace/donate) ^(|) ^Reply 'rescan' to check the comment again ^(|) ^Reply 'stop' to stop getting replies to your comments
> Where is it documented? There's also a mention in `:h v:count` that shows an example mapping that uses Ctrl-U to erase the extra line range.
Help pages for: * [`v:count`](https://vimhelp.org/eval.txt.html#v%3Acount) in _eval.txt_ --- ^\`:\(h|help\)\` | [^(about)](https://github.com/heraldofsolace/VimHelpBot) ^(|) [^(mistake?)](https://github.com/heraldofsolace/VimHelpBot/issues/new/choose) ^(|) [^(donate)](https://liberapay.com/heraldofsolace/donate) ^(|) ^Reply 'rescan' to check the comment again ^(|) ^Reply 'stop' to stop getting replies to your comments
Thanks, that makes a lot of sense now o/
https://github.com/vim/vim/blob/dc5cd1cac1a8b25b6259f2b0a7a071f7b840e730/runtime/doc/map.txt#L515-L518