On Thursday, February 21, 2013 8:34:17 AM UTC-6, ping wrote:
> On 2/20/2013 4:36 PM, Ben Fritz wrote:
> 
> > Your mapping should look like:
> 
> >
> 
> >    :nnore <expr> ,gg ':'.MyGit("new post")
> 
> that really works!, so looks the key here is
> 
> 1) use <expr> as you mentioned,
> 
> 2) use ":" . func()
> 
> 3) return the command string from the func
> 
> 
> 
> great to learn!
> 
> >
> 
> > Then your command can look something like:
> 
> >
> 
> >    :command! MyGit exec MyGit(<q-args>)
> 
> this also works, but
> 
> it seems the exec helps to
> 
> 1) evaluate the expression, but also
> 
> 2) execute the result right away.
> 
> is there a way to evaluate the express (1)  , but not to "execute" 
> 
> them(2) , in "command" ?
> 
> 
> 
> none of these works...
> 
> command! -nargs=* MyGit  call MyGit(<q-args>)
> 
> command! -nargs=* MyGit  eval(":" . MyGit(<q-args>))
> 

For that, I'd use an <expr> cabbrev similar to your <expr> map.

Then you would type :MyGit<Space> and it would expand to something completely 
different which you could then edit, or you could type :MyGit<Enter> to execute 
the default.

A similar cabbrev technique is used here for vimgrep:

  http://vim.wikia.com/wiki/Find_in_files_within_Vim

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

--- 
You received this message because you are subscribed to the Google Groups 
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to