On 2009-10-27, Robbo wrote:

> On 27 Ott, 19:54, Gary Johnson <[email protected]> wrote:
> > On 2009-10-27, Robbo wrote:
> > > Hello,
> > > I need to execute:
> >
> > > :'<,'>s/,/,^M/g
> >
> > > and than, select by visual all the lines affected by the previous
> > > command and execute
> > > :normal ==
> >
> > If by "affected" you mean the entire visually-selected region rather
> > than just those lines modified by the substitute command, you can
> > reselect that region with
> >
> >     gv
> >
> > To indent those selected lines, just type
> >
> >     =
> >
> > --there's no need to use ":normal ==".

> I need to put all the command in a mapping, for example
> 
> :map <C-F10> :s/,/,\r/g | normal gv | normal =
> 
> but it doesn't work correctly

That's because the first | terminated the map command.  You'll need
to quote the | or use <Bar> instead.  See

    :help :bar

and especially

    :help map_bar

for a better explanation of this than I can give, including
solutions.  When it comes to these sorts of nested and compound
commands, it usually takes me a few tries to get the quoting and
the use of exe and <bar> right.

Also, you can replace those two normal commands with one:

    normal gv=

Note, too, that the convention on this list is to bottom-post.

Regards,
Gary



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

Reply via email to