You didn't actually read the whole thing I sent, did you... > Please note that you CAN get this effect with the built in :normal, > but you have to do something like this: > > :execute "normal i<span>\<cr></span>\<esc>"
Another advantage of using :Normal is in mappings: I have (occasionally) had to create mappings that ended up calling :normal from the command-line. Here's an actual example: " Displays the line that declares the variable. " Uses execute and Normal instead of just a normal to allow the internal <cr> to be broken up so it isn't processed as part of the mapping. nmap <silent> <buffer> <c-cr> :Lazy SS SP execute 'Normal gd:#<' . 'cr>'<cr> Please take a stab at expressing that broken up <cr> using a regular :normal in a mapping (where the "\<cr>" causes a newline following the \"). For the record, Lazy saves, sets and restores 'lazyredraw', SS saves and restores the search and SP saves and restores the position. Salman. > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Sent: Wednesday, April 25, 2007 11:27 AM > To: [email protected] > Subject: Re: Extended :normal > > You can almost do the same by using normal in conjunction > with execute :execute "normal i<span>\<cr></span>\<esc>" > > -dan > > > On Wed, 25 Apr 2007, Halim, Salman wrote: > > > Hello, > > > > Since tips on vim.sf.net have been disabled because of > spam, I thought > > I would share this here. I find the :Normal command > extremely useful: > > > > " Behaves like the built-in normal command, except that it > takes keys > > such as <f8> right on the command-line. > > function! Normal( bang, args ) > > execute 'map Normal_map ' . a:args > > > > execute 'normal' . a:bang . ' Normal_map' > > > > unmap Normal_map > > endfunction > > com! -bang -nargs=+ Normal call Normal( <q-bang>, <q-args> ) > > > > Typically, when you call :normal, you can't embed keys in > there easily > > -- an example: > > > > :normal i<span><cr></span><esc> > > > > Produces: > > > > <span><cr></span><esc> > > > > (Insert mode is automatically exited at the end of the normal > > command.) > > > > However, > > > > :Normal i<span><cr></span><esc> > > > > Produces: > > > > <span> > > </span> > > > > I use it all the time with things like :windo (I have a lot > of setting > > toggles mapped to function keys) to get things the way I > like them in > > one fell swoop. Also, if you prefer to use the old-style > keys (<c-v> > > followed by the key to get the actual key on the command-line), > > :Normal still works. > > > > Please note that you CAN get this effect with the built in :normal, > > but you have to do something like this: > > > > :execute "normal i<span>\<cr></span>\<esc>" > > > > (I've gone so far as to set up a command-line abbreviation > to always > > convert :normal to :Normal in my configuration.) > > > > Hope this helps, > > > > Salman. > > >
