emacs-evil / emacs-evil/evil

key-chord does not work in concert with already-defined keys?

Open
#443 1 comment 0 reactions 0 assignees View on GitHub
bug major
Dominant language
Emacs Lisp
Stars
3.9k
Forks
307
PR merge metrics
No merged PRs in 30d

Description

Originally reported by: **Jason Rose-Kuhrt (Bitbucket: [jasonkuhrt](https://bitbucket.org/jasonkuhrt), GitHub: [jasonkuhrt](https://github.com/jasonkuhrt))**

----------------------------------------

I have an init.el script that includes:

```
(key-chord-define evil-normal-state-map "ws" 'evil-window-split)
(key-chord-define evil-insert-state-map "kj" 'evil-normal-state)
(Key-chord-define evil-visual-state-map "kj" 'evil-normal-state)
```

The `kj` bindings work perfectly to escape me from `insert` state.
However, the `ws` binding fails to work, instead just moving my `pointer` and then substituting. If I rebind like so:

```
(key-chord-define evil-normal-state-map "tt" 'evil-window-split)
```

Then it works! What is different? Well, `t` appears to not be bound to anything in `normal` state, whereas `w` and `s` are. I haven't tried unbinding `w` to see if that would permit `ws` to work (I don't know how to unbind keys actually, set them to `nil`?), however, that wouldn't be a solution at all since what should happen is this:

When `w` is pressed wait to see what the next key will be:
- if 300ms expires then execute solo `w`
- if another key is pressed and it is NOT `s` then execute `w` and whatever key was pressed normally
- if another key is pressed and it IS `s` then execute `'evil-window-split`.

This seems like pretty intensely important functionality, since its what patterns like `` etc is based on.

I'm marking as a "major" bug.

And thanks for all your work on Evil! Its allowed me to try Emacs.

----------------------------------------
- Bitbucket: https://bitbucket.org/lyro/evil/issue/443

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue from the init.el examples using key-chord-define with evil-normal-state-map, especially the w/s chord versus the t/t chord. Read the key-chord handling and existing evil key bindings first. Done means a chord involving already-defined keys waits for the next key, preserves normal key behavior on timeout or mismatch, and invokes evil-window-split for ws.

Written by the indexing model from the issue text.

Assessment

Tech stack
emacs-lisp
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.