On Fri, Aug 27, 2010 at 11:55 AM, bill lam <[email protected]> wrote:
> Птн, 27 Авг 2010, Gusman писал(а):
> > Hi,
> >
> > Currently I want to make to script that grepping word under cursor in my
> > project files.
> > But until know I still confuse how to get the word under cursor, I've
> been
> > used expand("<cword>") but
> > I just return the first word of line and the last one.
> >
> > Thank you.
> >
> > Best Regards,
> >
> >
> > Gusman Dharma P
>
> It works for me. Can you report what if you input a line such as
> cat mouse dog
>
> then move cursor on any one word, then switch to command mode, type
> :echo expand("<cword>")
>
> --
> regards,
> ====================================================
> GPG key 1024D/4434BAB3 2008-08-24
> gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
>
> --
> 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
>
When I use try* :echo expand("<cword>")*, it return the correct value.
But when I put it in a function like below:
*
function! WordEcho()
echo expand("<cWORD>")
endfunction
nnoremap <silent> <LocalLeader>k: call WordEcho() <CR>*
Then I type* \k* in normal mode, it return wrong value, but when
I call it from prompt :*call WordEcho()*, it return correct value.
Do anyone know why it happens, I am getting frustated with this.
Thank you.
--
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