On 07/13/12 07:10, Axel Bender wrote:
> Is there a way to change the content of the command line from
> within a function?

I think you'd have to explain a bit more what you're trying to do
and how your function is invoked.

The content of the previous command-line is available in the ":"
register, so you can

  function! Foo()
    echo @:
  endfunction

However, that register is readonly, so you can use the histadd()
function to insert new entries in the command-line history.  That
said, you can combine them to do something like

  function! Foo()
    call histadd(":", substitute(@:, 'old', 'new', 'g'))
  endfunction

Alternatively, if you're executing the function in a mapping, the
mapping can just modify the command-line as you see fit.

-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

Reply via email to