Re: Copy the matched substring only with :g

2014-01-18 Thread Tim Chase
On 2014-01-15 21:19, Christian Brabandt wrote: > Hi Tim! > > On Mi, 15 Jan 2014, Tim Chase wrote: > > > On 2014-01-15 15:29, Paul Isambert wrote: > > > g/\a*\(\l\u\|\u\l\)\a*/call setline(line('$')+1, > > > matchstr(getline('.'), '\a*\(\l\u\|\u\l\)\a*')) > > > > > > Riffing off Paul's solut

Re: Copy the matched substring only with :g

2014-01-15 Thread Christian Brabandt
Hi Tim! On Mi, 15 Jan 2014, Tim Chase wrote: > On 2014-01-15 15:29, Paul Isambert wrote: > > g/\a*\(\l\u\|\u\l\)\a*/call setline(line('$')+1, > > matchstr(getline('.'), '\a*\(\l\u\|\u\l\)\a*')) > > > Riffing off Paul's solution, I'd suggest > > :g/\<\w*\l\u\w*\>/call setline(line('$')+1,

Re: Copy the matched substring only with :g

2014-01-15 Thread BPJ
2014-01-15 20:50, Tim Chase skrev: On 2014-01-15 15:29, Paul Isambert wrote: g/\a*\(\l\u\|\u\l\)\a*/call setline(line('$')+1, matchstr(getline('.'), '\a*\(\l\u\|\u\l\)\a*')) Riffing off Paul's solution, I'd suggest :g/\<\w*\l\u\w*\>/call setline(line('$')+1, matchstr(getline('.'), @/)

Re: Copy the matched substring only with :g

2014-01-15 Thread Tim Chase
On 2014-01-15 15:29, Paul Isambert wrote: > g/\a*\(\l\u\|\u\l\)\a*/call setline(line('$')+1, > matchstr(getline('.'), '\a*\(\l\u\|\u\l\)\a*')) Riffing off Paul's solution, I'd suggest :g/\<\w*\l\u\w*\>/call setline(line('$')+1, matchstr(getline('.'), @/)) which removes the need to specify

Re: Copy the matched substring only with :g

2014-01-15 Thread BPJ
2014-01-15 15:42, Paul Isambert skrev: - I've replaced \l\u with \(\l\u\|\u\l\), otherwise words starting with an uppercase letter won't be found. Why so? Doesn't the \a* take care of it? No, there no way for '\a*\l\u\a*' to match on e.g. "Initial": if the first \a matches, then there is not

Re: Copy the matched substring only with :g

2014-01-15 Thread Paul Isambert
> > - I've replaced \l\u with \(\l\u\|\u\l\), otherwise words starting > > with an uppercase letter won't be found. > > Why so? Doesn't the \a* take care of it? No, there no way for '\a*\l\u\a*' to match on e.g. "Initial": if the first \a matches, then there is nothing left for \u; if that \a do

Re: Copy the matched substring only with :g

2014-01-15 Thread BPJ
2014-01-15 15:29, Paul Isambert skrev: "BPJ" : Is there any way when using :g to copy the matched substring only? I want to find all lines with CamelCase words and copy those words to the bottom of the buffer. :g/\a*\l\U\a*/t$ copies the whole line, but I want to get the part of the lin

Re: Copy the matched substring only with :g

2014-01-15 Thread Paul Isambert
"BPJ" : > Is there any way when using :g to copy the matched substring only? > > I want to find all lines with CamelCase words and copy those > words to the bottom of the buffer. > > :g/\a*\l\U\a*/t$ > > copies the whole line, but I want to get the part of the line > matching the pattern.

Copy the matched substring only with :g

2014-01-15 Thread BPJ
Is there any way when using :g to copy the matched substring only? I want to find all lines with CamelCase words and copy those words to the bottom of the buffer. :g/\a*\l\U\a*/t$ copies the whole line, but I want to get the part of the line matching the pattern. TIA, /bpj -- -- You rece