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. >
