> When I do complex substitutions,  I want to see inspect subst,
> undo the substitution, before moving to the next one match
> (gnuemacs has something similar called "recursive-edit")
> 
> Eg. my file contains thousands of dates as seconds, and I want to reformat
> the date (but seeing the context around the date)
> :%s,\<\(1[45678]\d\d\d\d\d\d\d\d\)\>,\=system("date +' %F-%H:%M' -d
> @".submatch(1)." "),gc
> 
>  I need an option to show-susbt-pause-undo the substitution and continue to
> next.
> p[subst and pause]/u [undo, and goto next] in
> 
> The options y/n/a/q/l/^E/^Y
> Help:
> :h :s
> [c] Confirm each substitution.  Vim highlights the matching string (with
> |hl-IncSearch|).  You can type: *:s_c*
>    'y'    to substitute this match
>    'l'    to substitute this match and then quit ("last")
>    'n'    to skip this match
>    <Esc>   to quit substituting
>    'a'    to substitute this and all remaining matches
>    'q'    to quit substituting
>    CTRL-E  to scroll the screen up
>    CTRL-Y  to scroll the screen down

Hmm, you should just not use :substitute for that.  Use the right search
pattern, then record a change into a register (so you can repeat it).
You can also record two or more different changes, and use the one you
like with @a, @b, etc.  And undo if it wasn't the right one and retry at
the same position.  Then finally hit "n" to go to the next match.

There isn't really a good reason to expand the functionality of
:substitute to make it even more complex.  It is really meant for bulk
changes, not complex stuff.

-- 
If they don't keep on exercising their lips, he thought, their brains
start working.
                -- Douglas Adams, "The Hitchhiker's Guide to the Galaxy"

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" 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_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20221105225757.821371C10D8%40moolenaar.net.

Raspunde prin e-mail lui