Sunday, January 4, 2015

Re: counting words in highlighted regions

On Sun, 4 Jan 2015 08:47:57 -0600 Tim Chase <vim@tim.thechases.com> wrote:

> On 2015-01-04 16:19, Gevisz wrote:
> > Is there any way to get a number of words in a highlighted
> > region to the "+ register? Or, even better, to add
> > (or concatinate via the plus sign) a number of words
> > in a highlighted region to the number already in the "+ register?
>
> Well, with modification, you can use a combination of :redir with
> either v_g_CTRL-G or the "n" flag to the :s command. It's not purely
> the number so you might have to do some post-processing on the
> result, but you can use
>
> :vnoremap <f2> :<home>redir @+<bar><end>s/\w\+//gn<bar>redir END<cr>
>
> This populates the "+ register with something like
>
> 28 matches on 3 lines

I have not tried that (using the solution from Christian) but thank you as well.

--
--
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.
For more options, visit https://groups.google.com/d/optout.

No comments: