2

I can't jump to every instance of a character, for instance consider this line :

if( c == '\n' || c == ' ' || c == '\n') continue;

Pressing avy-shortcut SPACE to label all the white spaces will only allow me to jump at the spaces between the c and the =, all the other spaces after and before the (, ), | are ignored. Any idea on how to fix this behavior ?

ChiseledAbs
  • 449
  • 1
  • 4
  • 12

1 Answers1

6

It looks like your avy shortcut is bound to avy-goto-word-1, while what you want here is avy-goto-char.

Try M-x avy-goto-char SPC and you will see that when word boundaries are ignored, all spaces are matched. On the other hand, avy-goto-word-1 is searching for a word boundary followed by a space. In your example text that happens to find the spaces following the word "c".

You'll see the same behavior with M-x search-forward-regexp RET \b SPC (ie search forward for the regular expression \b followed by a space). In Emacs regular expressions, \b matches the empty string at the beginning or end of word, where the current syntax table defines what characters are considered part of a word.

glucas
  • 20,175
  • 1
  • 51
  • 83