> Execute the current line (minus the leading "#") as a shell
> command and insert its output at +1, keeping the current line in
> place.
>
> Yp:.!sed 's/^\#//' | sh
>
> Is there a simpler way to do that ? Like a built-in command ?
It's uncommon enough (especially the "minus the leading #" bit)
that it's certainly not built-in. However, it's easy enough to
map. I'd personally use ":t." instead of "Yp" just so I don't
tromp the contents of my scratch-register. I'd also just use vim
to strip the "#". You could try
:nnoremap <f4> :t.<bar>s/^#//e<bar>.! sh<cr>
which should have the same behavior. I might also tweak the
regexp to
s/^\s*#\+//e
just to catch a few odd edge cases that occur to me.
-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:
Post a Comment