Wednesday, June 1, 2011

Re: expand "(" doesn't work

On 2011-06-01, sinbad wrote:
> hi,
>
> doesn't expand("<cword>") work if the cursor is under "(".
> it works for ")" though. any reason for this ?
> i am running vim 7.0

I'm running 7.3.189 and it behaves differently. I started vim as

$ vim -N -u NONE

and used the line

Now is the (time) for all good men

and the command

:echo expand("<cword>")

with the following results.

Cursor Command
Location Output
-------- -------
( time
t time
e time
) for

So, <cword> appears to refer to the word under the cursor or to
the first word to the right if the cursor is not on a word. This
agrees with the documentation:

:help cword
:help star

The behavior at 5.4m.23 was to expand <cword> to an empty string.
(See $VIMRUNTIME/doc/version5.txt.) I don't know when this changed
to the current behavior or what the behavior was at 7.0.

Regards,
Gary

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

No comments:

Post a Comment