Excerpts from Aman Jain's message of Thu Feb 11 09:30:47 +0100 2010:
> Hi
> 
> I am trying to build a lexical analyzer using flex. Following is a
> line which shows a regular expression and its corresponding action.
> 
> [0-9] {printf("yada yada \n");} //regex1
> Is there a way to reuse {printf("yada yada \n");} from regex1 by auto-
> completion features of vim, so that I don't need to write the whole
> thing again while writing regex2?
> 
> e.g.
> 
> .* {printf("yada yada \n");} //regex2
> This goes beyond word completion, so I was wondering is this doable in
> vim?
> 
> P.S.
>  I know one can do this by storing the text in a register("aymotion),

You can make Vim do almost everything. WHat exactly are you looking for?

i_<c-y> : copy character from line above. So you can use this to write
you second line

<c-x> l : line completion: you can use this to get the same line quickly
then changing what is different.


> but I am looking for some divine vim auto-completion.
How should it behave? If you can't describe it you can't implement it.

Of course you can write a script which get's this part:
> .* {printf("yada yada \n");} //regex2
     ^^^^^^^^^^^^^^^^^^^^^^^^^
and allows you to complete against them. (:h line(), getline()
Also :h compl-func -> examples

However you can consider using a plugin such as snipMate to insert
templates such as:
$regex {printf("$string");} // regex$N

last but not least in this case you can do 
yy (yank the current line)
20p (paste it 20 times)
and start editing (this is very fast for most use cases)

where cursor is placed at $.

So refine your wish, please.

Marc Weber

-- 
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php

Reply via email to