Wednesday, April 25, 2012

Re: :il[ist] with numeric patterns

On 25 Abr, 06:58, Jürgen Krämer <jottka...@googlemail.com> wrote:
> 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.

This was what I thought at first. However ":he word" says:

*word*
A word consists of a sequence of letters, digits and underscores, or a
sequence of other non-blank characters, separated with white space
(spaces,
tabs, <EOL>). This can be changed with the 'iskeyword' option. An
empty line
is also considered to be a word.
*WORD*
A WORD consists of a sequence of non-blank characters, separated with
white
space. An empty line is also considered to be a WORD.

My 'iskeyword' is
@,48-57,_,192-255
so digits are there (48-57). I found nothing about words having to
begin with a letter, although what you are saying makes sense. In this
case the documentation should be updated.

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