Thursday, November 1, 2012

Re: How to "filter" a plaintext pattern in a separate fullpage buffer to work on it separately ?

On Thursday, November 1, 2012 10:13:20 AM UTC-5, tjg wrote:
> what I wish is :
>
> 1) to "filter" patterns (e.g. Robert)
> 2) into a different full-page buffer (not in a window at the bottom of the
> screen),
> 3) where I can suppress the errors/contradictions
> 4) while keeping the highlightings
>
> The possibilities seem (for a learner) to be :
>
> a) * on the word Robert : satisfies partly 1), 3) and 4) but is not
> efficient with a long file
> b) :g/Robert/p : satisfies 1) but not 2) (window at the bottom) nor 4) ; as
> for 3), I do not know
> c) [I : same results as with :g/Robert/p
> d) :vimgrep /Robert/ %, then :copen : same results as with :g/Robert/p, with
> a new inconvenience : each line is populated with its own path (which is of
> course necessary when quickfixing multiple files)
>

How about:

1. :%y to copy (yank) all text in the buffer
2. :tabnew to open a new, empty "full-page buffer"
3. p to paste (put) the copied text
4. do whatever you do to re-apply highlight
5. :v/Robert/d to remove all lines where "Robert" is not present

I have no idea whether you can "suppress the errors/contradictions" in an
automated fashion. If you can find an algorithm to do that in general, certainly
it can be done in Vimscript (or Perl, python, Lua, etc.), even if it takes some
heavy-duty scripting.

--
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

No comments:

Post a Comment