Problem with aliases
dvzubarev opened this issue · 2 comments
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.
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.
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):
-
To map [ to any opening parentheses or bracket in all modes:
(push '(?[ "[[{(]") evil-snipe-aliases)
Therefore, sa[ will match
a[
,a{
ora(
-
To map : to a python function (but only in
python-mode
):(add-hook 'python-mode-hook (lambda () (make-variable-buffer-local 'evil-snipe-aliases) (push '(?: "def .+:") evil-snipe-aliases)))
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 '((?\[ "[[{(]")))