Tuesday, April 24, 2012

Re: :il[ist] with numeric patterns

Hi,

esquifit wrote:
> According to the help (:he :ilist)
> :il /foo/
> would find all occurrences of the string 'foo' while
> :il foo
> would find all occurrences of the pattern \<foo\>, that is, 'foo' as a
> whole word.
>
> I've found that when the pattern is a number this is no longer the case:
> :il /20/
> finds all occurrences of the string '20' as expected, but
> :il 20
> gives an "E389 Couldn't find the pattern" even if '20' does occur as a
> whole word. In fact,
> :il /\<20\>/
> effectively finds all occurrences of '20' as a whole word.
>
> Is this a bug or am I missing something?

as far as I understand it, :ilist is supposed to be used for searching
for keywords like identifiers in a programming language. See the fourth
paragraph at ":help include-search".

With the slashes around the pattern you explicitly tell Vim to search
for only a part of a keyword, but without the slashes Vim searches for a
word (in Vim's sense of word, see ":help word") that is also a keyword.
Presumably, without looking at Vim's source code, a keyword must start
with a letter, so '20' would not be found.

Regards,
Jürgen

--
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)

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