On Thu, Mar 29, 2007 at 04:29:38PM -0700, Joseph Barker wrote:
> Say I have the following line:
> 
> foo = getFoo()
> 
> It would be convenient to be able to do a single :s/foo/bar/g that respects 
> the case of the original input. It would transform the input line into the 
> following:
> 
> bar = getBar()
> 
> Would it be possible to add this as an option to :substitute somehow? I toyed 
> with writing a script to do it, but wasn't able to get very far (obviously, I 
> could do this by setting noignorecase and doing :s/foo/bar/g 
> and :s/Foo/Bar/g, but it would be more convenient to just use a single 
> command).
> 
> JKB

Have you tried: http://www.vim.org/scripts/script.php?script_id=6

I think it does exactly what you want.

--
Martin

Reply via email to