Monday, November 16, 2015

Re: How to pass the word under curor as the para to the command

在 2015年11月16日星期一 UTC+8下午8:43:59,ZyX写道:
> 2015-11-16 15:20 GMT+03:00 <imleg...@gmail.com>:
> command! -nargs=1 -bar Pyhelp :call ShowPydoc(<f-args>)
>
>
>
>
> ​You explicitly request here to escape the function arguments by using `<f-args>`.​
>
>  
> nnoremap <buffer> <silent> K :exe ":Pyhelp expand('<cword>')"
>
>
>
>
> ​so that here actual argument is `"expand('<cword>')"` literally. Of course, this is not going to work. Move `expand('<cword>')` out of the quotes: `:execute 'Pyhelp' expand('<cword>')`​
>
>  
>
>
> I define a ShowPydoc func,
>
>
>
> If you type ":Pyhelp xxx"
>
>
>
> you will get the help of xxx.
>
>
>
> Now I want to map the K to the that if I move the curor on the word that I want to get the helpdoc.
>
>
>
> But expand('<cword>') here can't get the word under curor and pass the "expand(<'cword'>)" to the func.
>
>
>
> And I try :echo expand(<'cword'>) it worked,
>
>
>
> How can I fix it?
>
>
>
> --
>
> --
>
> 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 vim_use+u...@googlegroups.com.
>
> For more options, visit https://groups.google.com/d/optout.

tnx a lot for your help :)

--
--
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 vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: