Thanks, I did it! But still, how to send <CR> now? This is the
        function I'm trying to implement:

        function! RunProject(...)
             if !exists("s:project_command") || s:project_command=="" ||
        (a:0==1 && a:1=="alter")
                 let s:project_command=expand("%:p")
                 return ':!'.s:project_command
             else
                 return ':!'.s:project_command<CR>
             endif
        endfunction
        map <expr> <F12> RunProject()
        map <expr> <C-F12> RunProject("alter")


    Ok,

    return ':!'.s:project_command."\n"
    that works :)


I actually didn't consider one thing, after I return s:project_command I
can't update it with the new value. Is it possible to fetch a string
from command line after I hit enter?

The last issued command will be in the : register, @: in a script, if
that helps.

:help registers
:help expr-register

Alternatively, you could put a cmap on <CR> so that when you press <CR>
in commandline mode you intercept it.

:help map-modes

Ben.




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

Reply via email to