vim: how to use back reference to compare strings?

2013-08-09 Thread ping song
hi guys:
I run into a scenario that , I need to compare 2 part of the regex string
in one line :

"abc123456 bla bla bla abc1234"

so I'm thinking, can we use the backreference, to compare the first abc\d\+
with the second one and only print out a message in case we detect the
different ones ? preferably if this can be done with one command...

thanks!

-- 
-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: compiling gvim statically

2013-08-09 Thread Linda W

kamaraju kusumanchi wrote:
I am trying to compile a static version of gvim on a machine running a 
combination of Debian GNU/Linux Squeeze and Wheezy.




(.text+0xe12): warning: Using 'getaddrinfo' in statically linked 
applications requires at runtime the shared libraries from the glibc 
version used for linking

.


(.text+0x652): undefined reference to `xcb_take_socket'
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/libX11.a(xcb_io.o): 
In function `poll_for_event':



It isn't a problem with gvim, it's a problem with the libraries you are 
using.


1) don't use gnu libc.  Find another one, likehttp://www.musl-libc.org/
I tried a few boot utils, and it worked great! 




2) you need to have your Xlibs compiled statically as well... They likely
aren't coming that way...so you need to go through whatever work to
recompile them...

Don't expect it to be trivial...




--
--
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Match all characters enclosed in brackets

2013-08-09 Thread Tim Chase
Sorry, I missed the 2nd half of your email:

On 2013-08-09 00:46, rameo wrote:
> I have trouble finding the correct regex.
> p.e. 

I'm not sure what "p.e." is supposed to mean in this context.

> Match first an uppercase character then all lowercase characters
> with at least 1 uppercase character This would be easier if the
> sequence of characters enclosed in brackets aren't optional.
> 
> Something like this:
> \u[a-zA-Z]

That would work, though it sounds like you want to ensure that
there's at least one lowercase character, so you'd want something like

  \u\a*\l\a*

or possibly one uppercase letter among the remainder, in which case
you'd do

  \u\a*\u\a*

possibly changing "*" to "\+" if you want to assert that you don't
want things like "HI"

-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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Match all characters enclosed in brackets

2013-08-09 Thread Linda W

Tim Chase wrote:

On 2013-08-09 00:46, rameo wrote:
  

I have trouble finding the correct regex.

I know that a sequence of characters enclosed in brackets means
their optional: [xyz] means any 'x' OR 'y' OR 'z'

but how can I find them all?
 any 'x' AND 'y' AND 'z' in whatever sequence and quantit



all together? -- like any 3 matching?
/[xyz]\{3\}

or an x y or z anywhere in the line?
[xyz]\+




--
--
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: How to autopipe through dos2unix when banging out

2013-08-09 Thread Paul
On Tuesday, August 6, 2013 11:02:12 AM UTC-4, Paul wrote:
> I use both the PC-based [g]vim and cygwin's [g]vim.  There are many
> times when I need the behaviour of PC vim, but I also want to bang
> out to bash.  With help from this forum and much trial and error, I
> found that the following is a robust way to allow this:
> 
>let &shell='set HOME=c:\cygwin\home\' . $USERNAME . 
>\ '& c:\cygwin\bin\bash.exe -i'
> 
> This fails when I bang out to unix's arithmetic interpreter 'bc'
> from files that have ff=dos, which applies to most file that I work
> on.  I simply set ff=unix temporarily.  I can avoid this by writing
> a wrapper around bc or bash (not that I will find the time to
> robustify such a solution any time soon), but I was wondering if
> there is a simpler way to do this?  I tried the following, but it
> generates "E485: Can't read file
> c:/Users/$USER/AppDAta/Local/Temp/1/VIoEED3.tmp".
> 
>let &shell='set HOME=c:\cygwin\home\' . $USERNAME .
>\ '& C:\cygwin\bin\dos2unixe.exe | ' .
>\ c:\cygwin\bin\bash.exe -i'

OK, I have 2 nonideal solutions.  The first is a 1-line script wrapper around 
bc:

   dosbc:
   --
   #!/bin/bash -i
   dos2unix | bc

The second is to use the open source math package Octave, which doesn't seem to 
trip over the DOS line endings.  To bang out from vim, however, I need to 
suppress the splash message and complaints about X11 not being set up:

   alias octxt='octave --no-window-system --silent'

-- 
-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Match all characters enclosed in brackets

2013-08-09 Thread Tim Chase
On 2013-08-09 00:46, rameo wrote:
> I have trouble finding the correct regex.
> 
> I know that a sequence of characters enclosed in brackets means
> their optional: [xyz] means any 'x' OR 'y' OR 'z'
> 
> but how can I find them all?
>  any 'x' AND 'y' AND 'z' in whatever sequence and quantity

Because the syntax "[xyz]" means "'x' at this location or 'y' at this
location or 'z' at this location", using AND would automatically fail
for this context.  Only one character can be at a given place in the
text.

If you want them in sequence, then you want "x.*y.*z" which means any
'x' followed eventually by a 'y', followed eventually by a 'z'

If you want to assert that all 3 exist on the same line but in any
order, that's a bit uglier, but made easier by Dr. Chip's logipat.vim
plugin.  Using that suggests

  \%(.*x.*\&\%(.*y.*\&.*z.*\)\)

where the "\&" atom asserts that each of the pattern parts have to
match.

-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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Match all characters enclosed in brackets

2013-08-09 Thread rameo
I have trouble finding the correct regex.

I know that a sequence of characters enclosed in brackets means their optional: 
[xyz] means any 'x' OR 'y' OR 'z'

but how can I find them all?
 any 'x' AND 'y' AND 'z' in whatever sequence and quantity

p.e. 
Match first an uppercase character then all lowercase characters with at least 
1 uppercase character
This would be easier if the sequence of characters enclosed in brackets aren't 
optional.

Something like this:
\u[a-zA-Z]




-- 
-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.