Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
key-translation-map not honored in Evil O state #177
Because C-c is one way of escaping in Vim, and because it is more ergonomic than C-g, I aim to use it for escaping insert state and keyboard-quit. I use this in my .emacs .
(As an aside, I've also created:
I've found this works in all cases except when I'm in the Operator Pending state.
When I do:
However, I find that when I use
I get the behavior I seek when I put this in my .emacs:
Operator state is somehow special. When a command is called its interactive statement is responsible for getting the motion. This implies that the key sequence for the motion is read while the command is about being executed. In order to do this evil reads the key sequence manually and translates it using the currently active keymaps. I do not know for sure but it may be possible that this approach does not respect
I looked it over a little and found evil-read-motion calls evil-keypress-parser, then reads events iteratively using read-event. I put (read-event) in scratch and evaluated it. Inputting C-c returned 3 in the minibuffer and C-g quit the input. The Elisp manual (http://www.gnu.org/software/emacs/manual/html_mono/elisp.html#Translation-Keymaps) says that read-key-sequence uses the key-translation-map. I put (read-key-sequence) in scratch and evaluated it. Whether I type C-c or C-g, I see "^G" displayed in the minibuffer. Would read-key-sequence be appropriate for Evil to use in operator pending state?
Maybe, but there are probably some difficulties. First, evil advices
Another possibility would be to stay with