On 2020-07-24 03:48, Manas wrote:
> Hi folks, I have a markdown file containing a couple of headings and
> some pointers as shown below.
>
> ```
> # Heading 1
> - pointer 1
> - pointer 2
> - pointer 3
>
> ## Heading 2
> - pointer 4
> - pointer 5
> ```
>
> I wanted to visual select all pointers only. So what I did was
> `:g/^-/normal V` but it only selects the last pointer (i.e. pointer
> 5). Shouldn't it select all pointers?
Vim doesn't (to the best of my knowledge without hacky plugins)
support disjoint selections. That said, you don't mention what you
want to *do* with those lines once you've selected them. Change
their case? Indent them? Only do a :substitute command on
list-items and not headings? I presume you don't just want the lines
visually-selected for aesthetic reasons. ;-)
> Is this normal behaviour? And what am I missing here?
Yes, it is the normal/expected behavior, so you're not missing
anything. :-)
> Also according to `:h :normal` while writing `:normal {commands}`,
>
> {commands} cannot start with a space. Put a count of
> 1 (one) before it, "1 " is one space.
>
> I did not quite get the meaning out of it. Can someone help me?
Though mostly orthogonal to your previous text, this means that when
vim is parsing the "normal" command
:normal ~
^
and
:normal ~
^^^^^
are both the same thing, that the normal-command(s)-to-be-executed
don't start until after the leading whitespace. Thus if you really
do want the first character of your "normal" command to be a space,
you have to do
:normal 1 ~
:normal 1 ~
Alternatively, I prefer to execute the expression-register as a macro
instead:
@=' ~'
which is similar. That said, I'm not sure it has much to do with
your previous issues.
-tim
--
--
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 on the web visit https://groups.google.com/d/msgid/vim_use/20200723175751.6ac1b668%40bigbox.attlocal.net.
No comments:
Post a Comment