0

I am trying out evil mode, and I want to rebind something to four arrows so I can move conveniently up-down-left-right when I am in insert state. In other words, which functions in emacs/evil that I can call to make the cursor move like pressing the arrows?

If you do not use the arrows to move in insert state, how do you move?

  • 1
    Opinion-based response: As a general principle, you're probably better off getting into the habit of dropping back to normal state to do movement and then re-entering insert state. It'll feel awkward at first, but your brain will rewire and you'll come to appreciate the speed and precision you gain by using the full range of movements available in normal state. The arrow keys are very far from home row, so moving your hand to use them will slow you down. They're crutches, so I'd suggest you don't bind them in order to train your hands not to use them. – Dan Aug 13 '15 at 12:58
  • I agree with you @Dan, I end up using some key-chords for search and jump around my file, but not for arrow keys replacement. I find myself use them very rarely when I bind a key-chord to ESC. – biocyberman Aug 17 '15 at 22:24
0

To find what command is bound to key, simply do C-h k key.

C-h k <left>:

<left> runs the command left-char (found in global-map), which is an interactive compiled Lisp function in bindings.el.

It is bound to <left>.

(left-char &optional N)

Move point N characters to the left (to the right if N is negative). On reaching beginning or end of buffer, stop and signal error.

If visual-order-cursor-movement is non-nil, this always moves to the left on display, wherever that is in the buffer. Otherwise, depending on the bidirectional context, this may move one position either backward or forward in the buffer. This is in contrast with M-x forward-char and M-x backward-char, which see.

Try this for the other arrow keys.

  • Thanks for reminding me of the useful C-h k sequence. I use it for more complicated functions, but never thought of the simple arrow keys. I accept the answer because it address my question, but after experimenting with key-chord rebindings for arrows, I agree with @Dan. The rebinding introduces more much more typos. This is because I sometimes fail to hit the key-chords timely. But I still find it excellent for use with common tasks (i.e. helm- functions) – biocyberman Aug 17 '15 at 22:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.