Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
How to "filter" a plaintext pattern in a separate fullpage buffer to work on it separately ?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  12 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
tjg  
View profile  
 More options Nov 1 2012, 11:13 am
From: tjg <tguille...@gmail.com>
Date: Thu, 1 Nov 2012 08:12:46 -0700 (PDT)
Local: Thurs, Nov 1 2012 11:12 am
Subject: How to "filter" a plaintext pattern in a separate fullpage buffer to work on it separately ?
Let us say I have this plaintext file (no code) :

~ Robert is tall
~ Linda is a brunette
~ Dieter who lives in Berlin speaks English fluently
~ Robert is smaller than Linda
~ Dieter said : Speak you Deutsch ?
~ Linda is as blonde as Robert is dark, and, at 5ft 6, much taller than him
etc…

NB : each line is tagged, thanks to a Dictionary (for example : Robert is
tall @RN &Washington), and those tags are highlighted.

In order to verify that there are no errors/contradictions in my text, 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)

Is there a way to achieve what I wish ?

--
View this message in context: http://vim.1045645.n5.nabble.com/How-to-filter-a-plaintext-pattern-in...
Sent from the Vim - General mailing list archive at Nabble.com.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ben Fritz  
View profile  
 More options Nov 1 2012, 11:28 am
From: Ben Fritz <fritzophre...@gmail.com>
Date: Thu, 1 Nov 2012 08:28:41 -0700 (PDT)
Local: Thurs, Nov 1 2012 11:28 am
Subject: Re: How to "filter" a plaintext pattern in a separate fullpage buffer to work on it separately ?

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 must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
tjg  
View profile  
 More options Nov 1 2012, 1:02 pm
From: tjg <tguille...@gmail.com>
Date: Thu, 1 Nov 2012 10:01:43 -0700 (PDT)
Local: Thurs, Nov 1 2012 1:01 pm
Subject: Re: How to "filter" a plaintext pattern in a separate fullpage buffer to work on it separately ?
Thanks for your answer.

In fact I simply want to suppress errors manually, so, no need for
automation, nor AI.
All I wish is to have the possibility :
- to "filter" the relevant lines into a full-page buffer (and not a window
at the bottom of the screen)
- ... as if all the other lines had disappeared
- where I can see them with their highlighting preserved
- where I can modify them efficiently by concentrating on one pattern at a
time
- and then go back to the file and find the lines as modified by me in the
"filtering buffer".

Thanks again

--
View this message in context: http://vim.1045645.n5.nabble.com/How-to-filter-a-plaintext-pattern-in...
Sent from the Vim - General mailing list archive at Nabble.com.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ben Fritz  
View profile   Translate to Translated (View Original)
 More options Nov 1 2012, 1:08 pm
From: Ben Fritz <fritzophre...@gmail.com>
Date: Thu, 1 Nov 2012 10:08:21 -0700 (PDT)
Local: Thurs, Nov 1 2012 1:08 pm
Subject: Re: How to "filter" a plaintext pattern in a separate fullpage buffer to work on it separately ?

OK, so you don't want to actually get a new scratch buffer.

Try :tab split followed by this:

http://vim.wikia.com/wiki/Folding_with_Regular_Expression


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
tjg  
View profile  
 More options Nov 1 2012, 2:54 pm
From: tjg <tguille...@gmail.com>
Date: Thu, 1 Nov 2012 11:53:59 -0700 (PDT)
Local: Thurs, Nov 1 2012 2:53 pm
Subject: Re: How to "filter" a plaintext pattern in a separate fullpage buffer to work on it separately ?
Thank you very much for your answer.

One question, nevertheless : I have already set my fold method to an
expression found in the Vim documentation :

/This will make a fold out of paragraphs separated by blank lines:
:set foldexpr=getline(v:lnum)=~'^\\s*$'&&getline(v:lnum+1)=~'\\S'?'<1':1/

Is it possible to have 1 fold method (expression) and 2 expressions for 2
different situations, and in that case, a usual expression (folding on
paragraphs) plus an expression specific to a tab split ?

Thanks again

--
View this message in context: http://vim.1045645.n5.nabble.com/How-to-filter-a-plaintext-pattern-in...
Sent from the Vim - General mailing list archive at Nabble.com.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
sc  
View profile  
 More options Nov 1 2012, 2:55 pm
From: sc <tooth...@swbell.net>
Date: Thu, 1 Nov 2012 13:54:39 -0500
Local: Thurs, Nov 1 2012 2:54 pm
Subject: Re: How to "filter" a plaintext pattern in a separate fullpage buffer to work on it separately ?

On Thu, Nov 01, 2012 at 10:01:43AM -0700, tjg wrote:
> Thanks for your answer.
> In fact I simply want to suppress errors manually, so, no need for
> automation, nor AI.
> All I wish is to have the possibility :
> - to "filter" the relevant lines into a full-page buffer (and not a window
> at the bottom of the screen)
> - ... as if all the other lines had disappeared
> - where I can see them with their highlighting preserved
> - where I can modify them efficiently by concentrating on one pattern at a
> time
> - and then go back to the file and find the lines as modified by me in the
> "filtering buffer".

this isn't exactly what you are asking for, but it's close, and I feel
may be of use to some, possibly yourself.  I've had fun with a folding
tool:

nnoremap <silent> <Leader>o :setlocal foldexpr=(getline(v:lnum)=~@/)?0:(getline(v:lnum-1)=~@/)\\|\\|(getline(v:ln um+1)=~@/)?1:2 foldmethod=expr foldlevel=0 foldcolumn=2<CR>
nnoremap <silent> <Leader>oo :call UnsetFolds()<CR>

the first mapping of <Leader>o is supposed to be all one line

UnsetFolds is defined as

function! UnsetFolds()
    setlocal foldexpr=0
    setlocal foldcolumn=0
endfunction

with these mappings, after any search if I hit <Leader>o I get every
line that doesn't have my search pattern folded away into oblivion and
only lines with my search pattern are visible (and easy to work with).
My mnemonic when working with these mappings is to think "only."

<Leader>oo then unfolds all

hth,

sc


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ben Fritz  
View profile   Translate to Translated (View Original)
 More options Nov 1 2012, 4:07 pm
From: Ben Fritz <fritzophre...@gmail.com>
Date: Thu, 1 Nov 2012 13:07:36 -0700 (PDT)
Local: Thurs, Nov 1 2012 4:07 pm
Subject: Re: How to "filter" a plaintext pattern in a separate fullpage buffer to work on it separately ?

Yes. The 'foldexpr' option is local to the Window. So you can do whatever you want in a split window/tab without affecting the first window/tab. Just be sure to use :setlocal and not :set.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
tjg  
View profile  
 More options Nov 1 2012, 4:54 pm
From: tjg <tguille...@gmail.com>
Date: Thu, 1 Nov 2012 13:53:47 -0700 (PDT)
Local: Thurs, Nov 1 2012 4:53 pm
Subject: Re: How to "filter" a plaintext pattern in a separate fullpage buffer to work on it separately ?
Thank you for your answer.

If I understand well, I must

- first search a pattern, e.g. /Robert
- then apply your local expression fold method, here <leader>o

Am I right ?

Thanks again

--
View this message in context: http://vim.1045645.n5.nabble.com/How-to-filter-a-plaintext-pattern-in...
Sent from the Vim - General mailing list archive at Nabble.com.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
tjg  
View profile  
 More options Nov 1 2012, 4:57 pm
From: tjg <tguille...@gmail.com>
Date: Thu, 1 Nov 2012 13:57:09 -0700 (PDT)
Local: Thurs, Nov 1 2012 4:57 pm
Subject: Re: How to "filter" a plaintext pattern in a separate fullpage buffer to work on it separately ?
@Ben Fritz

This is very clear
Thank you

--
View this message in context: http://vim.1045645.n5.nabble.com/How-to-filter-a-plaintext-pattern-in...
Sent from the Vim - General mailing list archive at Nabble.com.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
sc  
View profile  
 More options Nov 2 2012, 6:20 pm
From: sc <tooth...@swbell.net>
Date: Fri, 2 Nov 2012 17:20:30 -0500
Local: Fri, Nov 2 2012 6:20 pm
Subject: Re: How to "filter" a plaintext pattern in a separate fullpage buffer to work on it separately ?

On Thu, Nov 01, 2012 at 01:53:47PM -0700, tjg wrote:
> Thank you for your answer.
> If I understand well, I must
> - first search a pattern, e.g. /Robert
> - then apply your local expression fold method, here <leader>o
> Am I right ?

yes, that's it exactly -- it's very useful

when done you can restore normality via <Leader>oo


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
stosss  
View profile  
 More options Nov 2 2012, 7:21 pm
From: stosss <sto...@gmail.com>
Date: Fri, 2 Nov 2012 19:21:14 -0400
Local: Fri, Nov 2 2012 7:21 pm
Subject: Re: How to "filter" a plaintext pattern in a separate fullpage buffer to work on it separately ?

On Fri, Nov 2, 2012 at 6:20 PM, sc <tooth...@swbell.net> wrote:
> On Thu, Nov 01, 2012 at 01:53:47PM -0700, tjg wrote:
>> Thank you for your answer.

>> If I understand well, I must

>> - first search a pattern, e.g. /Robert
>> - then apply your local expression fold method, here <leader>o

>> Am I right ?

> yes, that's it exactly -- it's very useful

> when done you can restore normality via <Leader>oo

Trying to learn.

Okay what is <Leader> or <leader>

All I found when I ran :h leader

was these

*g:html_map_leader
*g:html_map_entity_leader

Thanks


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
stosss  
View profile  
 More options Nov 2 2012, 7:35 pm
From: stosss <sto...@gmail.com>
Date: Fri, 2 Nov 2012 19:35:05 -0400
Local: Fri, Nov 2 2012 7:35 pm
Subject: Re: How to "filter" a plaintext pattern in a separate fullpage buffer to work on it separately ?

> Trying to learn.

> Okay what is <Leader> or <leader>

> All I found when I ran :h leader

> was these

> *g:html_map_leader
> *g:html_map_entity_leader

sorry found <Leader> when I used :h <Leader>

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »