Le lundi 16 juin 2014 à 09:54, BaRud a écrit:
> Hi,
> I am trying to replace "=" by " = " only when the previous character is 
> [A-z0-9]
> so, "blah=" should be dynamically replaced by "blah = ", but not !=.
> 
> In a vim, I can do this by
> 
>    %s/\v([A-z0-9])\=/\1 = /g
> 
> but, can it be dynamic, or atleast check the current line for every = entered 
> and replace that?

You already have received solutions, here’s a one-liner:

    inoremap <expr> = getline(".")[col(".")-2] =~ '[[:alnum:]]' ? " = " : "="

Not thoroughly tested, mind you.

Best,
Paul

-- 
-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to