hlissner / evil-snipe

2-char searching ala vim-sneak & vim-seek, for evil-mode
MIT License
340 stars 25 forks source link

Problem with aliases #32

Closed dvzubarev closed 8 years ago

dvzubarev commented 8 years ago

Hi, I have emacs 24.5.1, with installed evil and evil-snipe. I sequentially evaled following expressions in scratch buffer.

(evil-mode)
(setq evil-snipe-scope 'buffer)
(evil-snipe-override-mode 1)
(evil-snipe-mode 1)
(evil-snipe-add-alias ?\[ "[[{(]")

Then I press f[ and '(' are highlighted, it is OK. After creating new file with some text "(test { test)", the defined alias is not working, i.e. { or ( are not highlighted and I can not jump to them by hitting f[. The output of M-x describe-key is evil-snipe-f though.

hlissner commented 8 years ago

Ah, I made a huge oversight with evil-snipe-add-alias. You see, evil-snipe-symbol-groups is buffer local, so any aliases you define with evil-snipe-add-alias will only apply to your current buffer. Whoops!

You can define global aliases with:

(setq-default evil-snipe-symbol-groups '((?\[ "[[{(]")))

I will push an update later tonight that will change evil-snipe-add-alias to (evil-snipe-add-alias MODE CHAR REGEX), for mode-specific aliases (and global aliases if MODE is nil).

In either case, setting evil-snipe-symbol-groups directly will work in any version of evil-snipe.

hlissner commented 8 years ago

Alright, I ended up getting rid of evil-snipe-add-alias for simplicity's sake.

To parrot the README (that will be updated in a few moments):

Note: evil-snipe-alias is aliased to evil-snipe-symbol-groups, so this shouldn't break backwards compatibility. Well, unless you use evil-snipe-add-alias.

i.e. This will still work fine:

(setq-default evil-snipe-symbol-groups '((?\[ "[[{(]")))