Tuesday, December 6, 2011

Re: Problem using :g/pattern/command

On 12/06/11 17:13, Gary Johnson wrote:
> :%s/^.*[[:backspace:]]//
>
> but I'm looking for a more general solution that also fixes lines
> where the user has backspaced over a

You might try:

:%s/\(\_[^[:backspace:]]\+\)\([[:backspace:]]\+\)/\=strlen(submatch(1))==strlen(submatch(2))?'':(submatch(1)[:(strlen(submatch(1))-(strlen(submatch(2))+1))])/ge

It's a bit ugly, but seems to work pretty quickly against all the
tests I threw at it.

-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

No comments: