Tuesday, March 8, 2011

Re: Inserting trimmed command output at cursor

Hi

martin f krafft wrote:
>
> does anyone have a good reusable solution for :read!, which inserts
> the command output, trimmed of newlines, at the cursor position
> (i.e. not into a new line)?
>
> I am sure this can be done with a macro or function, but before
> I reinvent the wheel, I better ask… (and I could not find anything
> on the web).

enter something like

<C-R>=substitute(system('your-command'), '\n', ' ', 'g')<CR>

in insert-mode.

Regards,
Jürgen

--
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)

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