Issue #61 invalid

* in Evil uses another definition of symbol under point than * in Vim

Titus von der Malsburg
created an issue

Consider this string:

{{{ abc---def }}}

When I put the cursor on abc and hit *, Evil searches for {{{abc---def}}} where Vim would only search for {{{abc}}}. I think Vim's definitions makes more sense because in text {{{---}}} is punctuation separating words. Similarly, in most programming languages {{{abc-def}}} is not one symbol but an operation involving two symbols.

Evil uses thing-at-point as the search string but should probably use something that uses the vim-definition of word.

Comments (5)

  1. Titus von der Malsburg reporter

    A part of the problem can be fixed by using the below function instead of thing-at-point in evil-find-symbol. (Setting text properties to nil is probably not necessary anymore then.)

    (defun evil-word-at-point ()
      (let ((iw (evil-inner-word)))
        (buffer-substring-no-properties (car iw) (cadr iw))))

    This selects the inner word as the search term. I'm not sure if this is the correct behavior but it's at least closer to what Vim does.

    The remaining problem is then the regexpr that is used for searching. When I put the cursor on abc in the following example and execute the modified evil-search-symbol, the cursor doesn't jump to the second occurrence of abc because the regexpr apparently restricts the search to instances of abc that are surrounded by whitespaces which is not the correct behavior.

  2. Titus von der Malsburg reporter

    The search can apparently be fixed by using \\<%s\\> as the search pattern in evil-search-symbol instead of \\_<%s\\_>.

    The drawback of implementing true Vim behavior is perhaps that you can't do * on lisp-symbols anymore because * on, e.g., a-lisp-symbol searches only one token but not the whole symbol.

  3. Titus von der Malsburg reporter

    Only slowly I learn about the wonders of Emacs. I didn't know that thing-at-point is syntax-aware. So this bug report doesn't make any sense. I don't see an option for deleting issues so I'll just set it to invalid.

  4. Log in to comment