hengxing 写道:
> Hi all!
> 
> I wrote a function in my vim script like following:
> 
> func Foo()
>     let g:fn= "/tmp/aa.txt"
>     return g:fn
> endfunc
> And at the same time, I wanted to create a 'map',
> which can read the file content under cursor in  vim,
> which filename is the Foo return.
> 
> I've written like the following but it doesn't work:
> 
> map kkk :call Foo()|read<cr>
> How can I pass the result of Foo to the "read" command?
> 
> Ps: I don't want to read the file in the Foo function, because
> I want the method which can pass the functions return to
> the Ex-command. Or tell me it can't implement for some reasons.
> 
> Thanks!

You can use something discussed in my previous thread: <C-R>=

nmap kkk :<C-R>=Foo()<cr><cr>

would do what you want.



--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to