Re: matchit doesn't work for php

2006-07-12 Thread Pete Johns
On Thu, 2006-07-13 at 06:42:43 +0200, Cesar Romani sent:
>In the following function the bracket at 3 doesn't match the
>bracket at 17 And the bracket at 5 doesn't match the bracket at
>8
>
I don't think matchit.vim is to blame here. I have tried your
code with VIM - Vi IMproved 7.0 (2006 May 7, compiled Jun 26 2006
20:24:17) with matchit.vim removed and it still misbehaves.

Somewhat surprisingly, though, matchparen.vim is highlighting the
correct braces!

I'm sorry I cannot provide a solution, but hopefully this will
point you in the right direction.


Best wishes;


--paj
-- 
Pete Johns   
Contact Information  
Bothered   


pgpMJdEjnEt04.pgp
Description: PGP signature


Re: How do I stop a mapping from looking like a mapping?

2006-07-12 Thread Yakov Lerner

On 7/13/06, Peter Hodge <[EMAIL PROTECTED]> wrote:

However, if I type anything beginning with 'for', the letters disappear
until I
type something that is not part of the mapping.  I understand this is
the
standard behaviour, but is there any way to change it so I can see
 what I am
typing?


Although there is no stardard option for imap to do this (make incompete
mapping visible; yes I'd find it seful, too), I found  a weird trick that
does what you want.
Does the following do what you want:
-
:imap h =PrecedingChars(6) !=# 'foreac' ? 'h' : ExpandForeach() 

function! ExpandForeach() " expansion of the foreach mapping
   " nb: 'foreac' is already there. So we don't need to repeat it
   return "h() {\n}\"
endfunction

function! PrecedingChars(n)
   " return n chars preceding cursor in rhs of :imap mapping
   return getline('.')[col('.')-1-a:n : col('.')-2]
endfunction
---

Explanation: this remaps 'h' character to check 6 preceding chars.
If 6 preceding chars are 'foreac', then it is expanded into your you
foreach-template. Otherwise, literas 'h' is inserted. Since this is
1-char-length mapping, there's no delay and no invisibilities.

If you wonder where is expansion (rhs) of your template, it's
inside function ExpandForeach(). The function PrecedingChars()
is generic and doesn't change when you change rhs of your template.

2.
If you find this too complex, and you don't want to
press space or tab after 'foreach' (supposedly because it
makes 8 chars instead of 7?) , then can I suggest either this simple weirdity:

:iab foreac foreach ...

(In which case, you get to type 'foreac' then space, which makes
total 7 characters not 8.), or this mapping

   :imap f foreach 

which is economy of 5 chars on the lhs side. (You type ctrl-z then f)

Yakov


matchit doesn't work for php

2006-07-12 Thread Cesar Romani
 
In the following function the bracket at 3 doesn't match the bracket at 17
And the bracket at 5 doesn't match the bracket at 8

 1 s=$s;
14 $this->a=$a;
15 $this->b=$b;
16 $this->c=$c;
17   }
18 ?>

Many thanks in advance.

Cesar



Re: How do I stop a mapping from looking like a mapping?

2006-07-12 Thread Peter Hodge

--- Tim Chase <[EMAIL PROTECTED]> wrote:

> > I want to make a mapping like this:
> > 
> >   :inoremap foreach foreach() {}k$3hi
> > 
> > The end result being that when I type:
> > 
> >   foreach
> > 
> > I should get
> > 
> >   foreach() {
> >   }
> 
> Sounds more like you're reaching for an abbreviation rather than 
> a mapping.
> 

I don't want to have to press space or tab after 'foreach'.

regards,
Peter

Send instant messages to your online friends http://au.messenger.yahoo.com 


Re: Tag completion of tag root

2006-07-12 Thread Hari Krishna Dara

On Wed, 12 Jul 2006 at 11:48am, Max Dyckhoff wrote:

> Has anyone written some useful script which will allow me to press some
> key combination and get vim to insert the common root of all matching
> tags. I don't think that's a very good explanation, so here's an
> example:
>
> For this example, imagine the tags are "wibble, foobar, food,
> foonicular, foot". I type "f" and then press . Normally the first
> matching tag would be inserted, for example "food". Instead I would like
> it to enter the common root of all found tags, namely "foo". The popup
> menu would still be visible so I could select from it, or type more and
> then press  again for more refined matches.
>
> Ideas?
>
> Cheers!
>
> Max
> --
> Max Dyckhoff
> AI Engineer
> Bungie Studios
>

Looks like you are looking for the "longest" option in 'completeopt'.

-- 
HTH,
Hari

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


Re: How do I stop a mapping from looking like a mapping?

2006-07-12 Thread Tim Chase

I want to make a mapping like this:

  :inoremap foreach foreach() {}k$3hi

The end result being that when I type:

  foreach

I should get

  foreach() {
  }


Sounds more like you're reaching for an abbreviation rather than 
a mapping.


:iab foreach foreach() {^M}^[O

where ^M is control+V followed by the  key, and the ^[ is 
control+V followed by the  key (and that's an "oh", not a 
zero.  If you don't want a fresh blank line, on which to start, 
you can change the "O" to an "I" (that's "capital oh" to "capital 
eye" in the event fonts are ambiguous on your end of things)


With this mapping, you can type

foreach

followed by  or  and it will automatically insert the 
code as you describe.


It shouldn't have the same hidden/pause behavior that is 
rightfully annoying you. :)


For more info, you can read about abbreviations (why is that such 
a long word..."you can learn more about abrvs...") in the help under


:help :ab

(the short paragraph above this landing spot might also be 
helpful to include in your reading)


HTH,

-tim





First attempt at tangofied icon

2006-07-12 Thread Panos Laganakos

Here's a first attempt at a tangofied vim icon:

http://panos.solhost.org/vim-01.png
http://panos.solhost.org/vim-02.png


How do I stop a mapping from looking like a mapping?

2006-07-12 Thread Peter Hodge
Hello all,

I want to make a mapping like this:

  :inoremap foreach foreach() {}k$3hi

The end result being that when I type:

  foreach

I should get

  foreach() {
  }

However, if I type anything beginning with 'for', the letters disappear until I
type something that is not part of the mapping.  I understand this is the
standard behaviour, but is there any way to change it so I can see what I am
typing?

regards,
Peter



===
Fluent in more than 100 programming languages;
Astoundingly fast;
Works without complaint when given hardware from the medieval era;
VIM makes up for all my shortcomings.



 
Do you Yahoo!? 
Check out gigs in your area on the comprehensive Yahoo! Music Gig Guide 
http://au.music.yahoo.com/gig-guide


Awareness of python import semantics for "[i", etc.?

2006-07-12 Thread John Reese

So there's this handy "[i" command that, when filetype=c, displays the
first line mentioning the identifier under the cursor, which will
often be its definition.  The especially handy thing about it is that
it knows about #include lines and will search through them as well
when looking for the first match.  You can also put the cursor over
the .h file between the quotes and hit "gf", and if the path and
suffixesadd options are set appropriately, it will jump you to the .h
file.

The point is, vim can be configured to know how to find C include
files and use them in various ways.

I was wondering if there was a way to get it to have a similar level
of knowledge about Python modules.  In C,

 #include "z.h"
will look for z.h in the current directory.  That's easy enough... the
Python equivalent is something like
 import z

But that actually just loads z.py from the current directory (or from
a bunch of other possible places, including system library directories
and directories listed in the PYTHONPATH environment variable) and
puts the name z into your namespace, and if you want to refer to
something defined in z.py, you qualify it:  z.someFunction().  A
Python-aware "[i" would know that if I have the cursor on the
someFunction in z.someFunction, then it needs to look for the word
someFunction in z.py.

There's also this from path import syntax:
 from a.b.c import z

which might mean that relative to the current directory there's a file
a/b/c/z.py that would need to be looked through if you used "[i".

So, anyway, this all seems very complicated, but I figured it wasn't
entirely out of the question that something was supported or
available, especially given the existence of the compiled-in Python
scripting option.  Does anyone know of anything to let vim understand
Python import syntax and use it for "[i" and similar commands?


Repaint delay/hang of rxvt when closing gvim/vim if ctfmon.exe is running

2006-07-12 Thread cygwin . t . bnelson

I'm posting this to get it into the archives in case anyone else has
the same problem.  It took me a long time to figure this out.

Rxvt is a terminal emulator from cygwin.

If you're running rxvt on Windows with a vim/gvim window on top of it and you
close gvim, the rxvt window should redraw immediately.  But if you
have ctfmon.exe running, it will cause about a 1 second hang before
the rxvt window will redraw or respond.

Other applications do not cause this behavior.  For example, closing
notepad.exe does not cause the hang.  In addition, the delay does not
occur in other windows--only rxvt has the delay.

The ctfmon program activates the Alternative User Input Text Input
Processor (TIP).  I guess some interaction between it and gvim and
rxvt causes this delay.  I ended up enabling ctfmon on my system when
I enabled some additional languages in the "Text Services and Input
Languages" of the "Regional and Language Options" application in the
control panel.  Disabling the additional languages got rid of the
problem.


popupmenus in textmode

2006-07-12 Thread Tobias Pflug

Hi,

I was wondering if someone could give me some hints on creating/using
popup menues in scripts such as those used for omnicomplete ? I had a
look at what I could find in vim help but somehow did not get very far.

Maybe someone could give me a mini example on how to create a menu with 
some entries

and how to call it ? That'd be great.

regards,
Tobi


Re: Error when running :Explore

2006-07-12 Thread Curtis Spencer

> > I am getting a transient error with vim 7.0.17 when I run :Explore.
> > 
> > I get this error text:
> > Error detected while processing function 31_Highlight_Matching_Pair
> > 
> > E316: ml_get: cannot find line 8
> > 
> > and then I get a stream of E316s with increasing line #'s.
> > 
> > Anyone see this before?
> 
> That should not happen.  Can you describe how to reproduce this?
> 

Bram,

 It is hard to get an accurate test case because it is transient error,
 but it occurs usually after running a long time and doing an :Explore
 right after a delete of a few lines.  If hold down enter for a while to
 go through all of the ml_get errors, I then get a buffer entitled ???,
 and I can then reproduce the error at will by doing more :Explore
 calls.  Also, I use f that is bound to the :Explore, but I
 doubt that matters at all.

 -Curtis




Re: :call append()

2006-07-12 Thread Yakov Lerner

On 7/12/06, Bram Moolenaar <[EMAIL PROTECTED]> wrote:


Yakov Lerner wrote:

> I wanted to insert multiline text using :call append().
>
> 1. I tried  :call append(1, "a\nb\n");
>-- Not good, insert null-bytes (^@)
> 2. I tried :call append(1, "a\rb\r")
>-- Not good, inserts ^M (I'm on Linux)
> 3. I tried :call append(1, "a\b\")
>Not good, same as (2)
>
> So, how do I append() multiline text ?

:call append(1, ["a", "b"])
:call append(1, split("a\nb"))


Thanks
Yakov


Re: open Explore in new tab

2006-07-12 Thread Yakov Lerner

On 7/12/06, Cesar Romani <[EMAIL PROTECTED]> wrote:

How to open a new tab with Explore?
I've read about ":tab {cmd}" but it works only when cmd is "split" or
"help".
Anyway I can open a new tab with :tabe or :tabnew and then I can run
:Explore on it but I wanted to do it in one step.


How about:

   :tab split +Explore

?

Yakov


Re: Autoselect language for spell

2006-07-12 Thread Stefan Karlsson
> Is there an easy way to autoselect language for the builtin
> spell checker in vim 7.0? Vimspell plugin has this functionality:
> the plugin looks for a specified number of lines and try to guess
> which language should it use.
>

Set spelllang -- yes there is three "l" in that option :-) -- to a 
comma-separated list of the languages you're interested in. Vim will figure 
out which of them to use.

For example, this is how I do it in my .vimrc (I want US English and Swedish):

  set spelllang=en_us,sv

-- 
Stefan


open Explore in new tab

2006-07-12 Thread Cesar Romani
How to open a new tab with Explore?
I've read about ":tab {cmd}" but it works only when cmd is "split" or
"help".
Anyway I can open a new tab with :tabe or :tabnew and then I can run
:Explore on it but I wanted to do it in one step. Is it possible?
Many thanks in advance.

Cesar



Tag completion of tag root

2006-07-12 Thread Max Dyckhoff
Has anyone written some useful script which will allow me to press some
key combination and get vim to insert the common root of all matching
tags. I don't think that's a very good explanation, so here's an
example:

For this example, imagine the tags are "wibble, foobar, food,
foonicular, foot". I type "f" and then press . Normally the first
matching tag would be inserted, for example "food". Instead I would like
it to enter the common root of all found tags, namely "foo". The popup
menu would still be visible so I could select from it, or type more and
then press  again for more refined matches.

Ideas?

Cheers!

Max
--
Max Dyckhoff 
AI Engineer
Bungie Studios


Re: :call append()

2006-07-12 Thread Bram Moolenaar

Yakov Lerner wrote:

> I wanted to insert multiline text using :call append().
> 
> 1. I tried  :call append(1, "a\nb\n");
>-- Not good, insert null-bytes (^@)
> 2. I tried :call append(1, "a\rb\r")
>-- Not good, inserts ^M (I'm on Linux)
> 3. I tried :call append(1, "a\b\")
>Not good, same as (2)
> 
> So, how do I append() multiline text ?

:call append(1, ["a", "b"])
:call append(1, split("a\nb"))

-- 
It's totally unfair to suggest - as many have - that engineers are socially
inept.  Engineers simply have different objectives when it comes to social
interaction.
(Scott Adams - The Dilbert principle)

 /// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net   \\\
///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\download, build and distribute -- http://www.A-A-P.org///
 \\\help me help AIDS victims -- http://ICCF-Holland.org///


:call append()

2006-07-12 Thread Yakov Lerner

I wanted to insert multiline text using :call append().

1. I tried  :call append(1, "a\nb\n");
  -- Not good, insert null-bytes (^@)
2. I tried :call append(1, "a\rb\r")
  -- Not good, inserts ^M (I'm on Linux)
3. I tried :call append(1, "a\b\")
  Not good, same as (2)

So, how do I append() multiline text ?

Yakov


Re: language menu

2006-07-12 Thread Andy Wokula
Cesar Romani schrieb:
> Normally the language of my vim's menu is Italian.
> How can I change it to English?
> Many thanks in advance,
> 
> Cesar

:set langmenu=none

works for me.  Put it early in your .vimrc,

:help 'langmenu'

says: "This option must be set before loading menus, switching on
filetype detection or syntax highlighting."

Andy


___ 
Telefonate ohne weitere Kosten vom PC zum PC: http://messenger.yahoo.de


Re: Remapping - how to get the count

2006-07-12 Thread Andy Wokula
Yakov Lerner schrieb:
> On 7/8/06, Andy Wokula <[EMAIL PROTECTED]> wrote:
>> I want to remap Ctrl-A (normal mode) to do something similar with other
>> data, e.g.
>>
>> :nmap  ciw=IncRoman(@-)
>>
>> Now if a count is provided this will mess up the text, e.g.
>> 10 does 10ciw...
>>
>> What is a good way to catch the count and make it available to the
>> function call?
> 
> :help v:count
> 
> Yakov

Vim überrascht einen doch immer wieder, ich hab nicht mal versucht, nach
"count" zu suchen ...

Thanks for the tip, now I'm quite happy with

:nmap   :let c=v:count1ciw=IncRoman(@-,c)
:nmap   :let c=v:count1ciw=DecRoman(@-,c)

The only thing I don't like is the use of a variable.

Thanks for the other replies as well
(still have to look at the solution with ).

Andy





___ 
Der frühe Vogel fängt den Wurm. Hier gelangen Sie zum neuen Yahoo! Mail: 
http://mail.yahoo.de


RE: [Bulk] Re: Shortest Pattern Match

2006-07-12 Thread Bob Fleming

Perfect, thanks very much. 

-Original Message-
From: Jürgen Krämer [mailto:[EMAIL PROTECTED] 
Sent: Wed 12 July 2006 09:14
To: vim mailing list
Subject: [Bulk] Re: Shortest Pattern Match


Hi,

Bob Fleming wrote:
> Hi all, 
> 
> I believe vim carries out greedy pattern matching, i.e. the longest
pattern
> found will be used. Is there a way of performing shortest matching ?
> 
> As an example, I have the following text:
> 
> fe fi fo united kingdom fe fi fo 0911 209 30 30
> 
> and I want to delete everything up to the word united so I used :%s/.*fo
//
> but this deleted everything up to 0911.

have a look at ":help /\{"

  :%s/.\{-\}fo //

Another way to remove everything in front of "united" is

  :%s/.*\zeunited//

for the last "united" on the line and

  :%s/.\{-}\zeunited//

for the first "united" (see ":help /\ze" for the special meaning of \ze)

Regards,
Jürgen

-- 
Jürgen Krämer  Softwareentwicklung
HABEL GmbH & Co. KGmailto:[EMAIL PROTECTED]
Hinteres Öschle 2  Tel: +49 / 74 61 / 93 53 - 15
78604 Rietheim-WeilheimFax: +49 / 74 61 / 93 53 - 99



Re: Remapping - how to get the count

2006-07-12 Thread Tim Chase

 Why not just use  in the mapping (after the : ) to clear the
command line, then use v:count or v:count1 instead of the second
argument?


Because they're not in my active vimming vocabulary... :)

Yes, using v:count/v:count1 is a much cleaner & more 
understandable way to do it.


-tim





Re: How generate tags from /usr/include?

2006-07-12 Thread Widmann Bruno
-Ursprüngliche Nachricht-
Von: eldruida [mailto:[EMAIL PROTECTED]
> When I do tags, with ctags, in /usr/include/stdio.h
> But, I want  i  want   declarations of functions, example:
I think it is:
ctags --C-kinds=+p
see ctags --list-kinds=C

--
Die Uebermittlung von Nachrichten per e-mail erfolgt ausschliesslich zu 
Informationszwecken. Rechtsverbindliche Erklaerungen werden ueber dieses Medium 
nicht abgegeben.

This message and any attached files are only for information purposes. E-Mail 
is not used for the exchange of legally binding statements.




Re: a question about subsitution....

2006-07-12 Thread Yakov Lerner

On 7/12/06, Yakov Lerner <[EMAIL PROTECTED]> wrote:

\< requires alphabetic char right after it. Thisis the reason
\<\* never matches.


I guess I forgot to mention that '*' is not alphabetic character.

Yakov


Re: perlcomplete.vim -- anyone working on this?

2006-07-12 Thread Dr Bean
On Wed, 12 Jul 2006, Hakim Cassimally wrote:

> Also... at the moment the script in the manpage doesn't have a mapping
> to refresh the tags file.  If you defined the sub after opening the
> file, it won't be seen until you close and reopen.  (I'll probably fix
> this soon, but patches welcome :-)

Making s:do_tags a global function, Do_tags allows you to call it
yourself, call Do_tags(expand('%')).

I don't understand why this doesn't work when you source
perl.vim.

-- 
Dr Bean  If I did not see further, it was because those
 who would stand on my shoulders would not
 have me stand on their shoulders.
 --Dr Bean


Re: substitute a char with newline

2006-07-12 Thread Yakov Lerner

On 7/12/06, Wim R. Crols <[EMAIL PROTECTED]> wrote:

Jürgen Krämer wrote:
> Hi,
>
> Fabio Rotondo schrieb:
>
>> I have a text file with many lines made like this:
>>
>> [EMAIL PROTECTED]@[EMAIL PROTECTED]@
>>
>> And I'd like to have them splitted on "@" in newlines.
>>
>> I have tried:
>>
>> :%s/@/\n/g
>>
>> but it does not work.
>> What am I missing?
>>
>
> \n in the second part of a substitution denotes the NUL character which
> is used internally to represent end-of-line. To insert newlines you
> have to use \r:
>
>   :%s/@/\r/g
>
> Regards,
> Jürgen
>
>
Side-question: What line endings does \r insert? Or is this dependant on
fileformat?


\r, on the replace-part of s/search/seplace/,
inserts file-native linebreak. If shall be dependent on
fileformat, yes:
:help s/\r

Yakov


Re: substitute a char with newline

2006-07-12 Thread Jürgen Krämer

Hi,

Wim R. Crols wrote:
> 
> Side-question: What line endings does \r insert? Or is this dependant on 
> fileformat?

\r only inserts a end-of-line-marker which is then represented by NUL
internally (more or less). The actual line ending that is visible in the
file is determined when the file is written by inspecting the fileformat
option.

Regards,
Jürgen

-- 
Jürgen Krämer  Softwareentwicklung
HABEL GmbH & Co. KGmailto:[EMAIL PROTECTED]
Hinteres Öschle 2  Tel: +49 / 74 61 / 93 53 - 15
78604 Rietheim-WeilheimFax: +49 / 74 61 / 93 53 - 99


Re: a question about subsitution....

2006-07-12 Thread Yakov Lerner

On 7/12/06, Robert Cussons <[EMAIL PROTECTED]> wrote:

Thanks Max and Chip, I didn't realis that \< and \> were used to denote
the beginning and end of the word and therefore they could be used
separately, I always just thought of them as a way of getting an exact
match, which I suppose is almost the same thing, however, I still don't
understand why you can't exclusively mark the start of this string with \<



Try /\*\
, it will work.

But /\<\*
will never match, becuse \< requires alphabetic character after it.
When you put non-alphabetic char [*] to the right of \<, \<
will *NEVER* match. I know this is non-intuituve, but
this is how it works. \< requires alphabetic char to the right of it.
This is why \<[*] never matches.

\< requires alphabetic char to the right of it. This is why
\<\* never matches.

\< requires alphabetic char right after it. Thisis the reason
\<\* never matches.

Yakov


Re: [VIM] substitute a char with newline

2006-07-12 Thread Walter Cazzola

On Wed, 12 Jul 2006, Peter Palm wrote:


In my view two things are wrong:
  - instead of 'g' use 'cg' to apply the change to all the occurrence
of @ in a line;



So you have to confirm every substitution? Why?


whoops, I make a mistake, I'm so used to check what I substitute that I
forgot its meaning :-D

Walter

--
Walter Cazzola, PhD - Assistant Professor, DICo, University of Milano
E-mail [EMAIL PROTECTED] Ph.: +39 010 353 6637  Fax: +39 010 353 6699
· · · --- · · · --- · · ·
   ... recursive: adjective, see recursive ...
· · · --- · · · --- · · ·

Re: substitute a char with newline

2006-07-12 Thread Wim R. Crols

Jürgen Krämer wrote:

Hi,

Fabio Rotondo schrieb:
  

I have a text file with many lines made like this:

[EMAIL PROTECTED]@[EMAIL PROTECTED]@

And I'd like to have them splitted on "@" in newlines.

I have tried:

:%s/@/\n/g

but it does not work.
What am I missing?



\n in the second part of a substitution denotes the NUL character which
is used internally to represent end-of-line. To insert newlines you
have to use \r:

  :%s/@/\r/g

Regards,
Jürgen

  
Side-question: What line endings does \r insert? Or is this dependant on 
fileformat?


Wim


Re: substitute a char with newline

2006-07-12 Thread Jürgen Krämer

Hi,

Fabio Rotondo schrieb:
> 
> I have a text file with many lines made like this:
> 
> [EMAIL PROTECTED]@[EMAIL PROTECTED]@
> 
> And I'd like to have them splitted on "@" in newlines.
> 
> I have tried:
> 
> :%s/@/\n/g
> 
> but it does not work.
> What am I missing?

\n in the second part of a substitution denotes the NUL character which
is used internally to represent end-of-line. To insert newlines you
have to use \r:

  :%s/@/\r/g

Regards,
Jürgen

-- 
Jürgen Krämer  Softwareentwicklung
HABEL GmbH & Co. KGmailto:[EMAIL PROTECTED]
Hinteres Öschle 2  Tel: +49 / 74 61 / 93 53 - 15
78604 Rietheim-WeilheimFax: +49 / 74 61 / 93 53 - 99


Re: Shortest Pattern Match

2006-07-12 Thread Jürgen Krämer

Hi,

Bob Fleming wrote:
> Hi all, 
> 
> I believe vim carries out greedy pattern matching, i.e. the longest pattern
> found will be used. Is there a way of performing shortest matching ?
> 
> As an example, I have the following text:
> 
> fe fi fo united kingdom fe fi fo 0911 209 30 30
> 
> and I want to delete everything up to the word united so I used :%s/.*fo //
> but this deleted everything up to 0911.

have a look at ":help /\{"

  :%s/.\{-\}fo //

Another way to remove everything in front of "united" is

  :%s/.*\zeunited//

for the last "united" on the line and

  :%s/.\{-}\zeunited//

for the first "united" (see ":help /\ze" for the special meaning of \ze)

Regards,
Jürgen

-- 
Jürgen Krämer  Softwareentwicklung
HABEL GmbH & Co. KGmailto:[EMAIL PROTECTED]
Hinteres Öschle 2  Tel: +49 / 74 61 / 93 53 - 15
78604 Rietheim-WeilheimFax: +49 / 74 61 / 93 53 - 99


Re: [VIM] substitute a char with newline

2006-07-12 Thread Walter Cazzola

On Wed, 12 Jul 2006, Fabio Rotondo wrote:


I have a text file with many lines made like this:



[EMAIL PROTECTED]@[EMAIL PROTECTED]@



And I'd like to have them splitted on "@" in newlines.



I have tried:



:%s/@/\n/g



but it does not work.
What am I missing?


In my view two things are wrong:
 - instead of 'g' use 'cg' to apply the change to all the occurrence of
   @ in a line;
 - instead of \n use 
(that you can abtain as 


I hope this help.

Walter
--
Walter Cazzola, PhD - Assistant Professor, DICo, University of Milano
E-mail [EMAIL PROTECTED] Ph.: +39 010 353 6637  Fax: +39 010 353 6699
· · · --- · · · --- · · ·
   ... recursive: adjective, see recursive ...
· · · --- · · · --- · · ·

substitute a char with newline

2006-07-12 Thread Fabio Rotondo
Hi,

I have a text file with many lines made like this:

[EMAIL PROTECTED]@[EMAIL PROTECTED]@

And I'd like to have them splitted on "@" in newlines.

I have tried:

:%s/@/\n/g

but it does not work.
What am I missing?

Thanks,

Fabio


Shortest Pattern Match

2006-07-12 Thread Bob Fleming
Hi all, 

I believe vim carries out greedy pattern matching, i.e. the longest pattern
found will be used. Is there a way of performing shortest matching ?

As an example, I have the following text:

fe fi fo united kingdom fe fi fo 0911 209 30 30

and I want to delete everything up to the word united so I used :%s/.*fo //
but this deleted everything up to 0911.

Thanks in advance, 

Bob




Re: a question about subsitution....

2006-07-12 Thread Robert Cussons
Thanks Max and Chip, I didn't realis that \< and \> were used to denote 
the beginning and end of the word and therefore they could be used 
separately, I always just thought of them as a way of getting an exact 
match, which I suppose is almost the same thing, however, I still don't 
understand why you can't exclusively mark the start of this string with \<


Thanks for the help,
Rob.

Charles E Campbell Jr wrote:

Max Dyckhoff wrote:


As I understand it, the \< and \> tokens represent the beginning and end
of a word. This means that the character immediately after the \< token
must be a word character, namely letters, numbers, and underscore (as
defined by the iskeyword option).

Max
 




...snip: At some points in my code I had a variable that was a pointer
  


that
 


was denoted (in C) by:

*iterNum

I wanted to replace instances of exactly this string globally between
  


my
 


present position and line 791, with:

j
  



So try

 :791,.s/\*iterNum\>/j/g

(or :.,791s/...  depending on what your current line is rltv to 791)

Regards,
Chip Campbell