How to make cursor stop at the last character of a line instead of at the linefeed character? I use evil-mode.

Steps to reproduce the issue:

  • Start Emacs in shell via emacs -nw -Q.
  • Press C-e to move focus to the end of the line.
  • You can see the yellow cursor stops at the linefeed character instead of the { character.

Example screenshot

UPDATE: Thanks guys. It turns out it's not a bug but just default behavior of Emacs.

My issue is actually I'm using evil-mode and I mistakenly turn off a useful feature of evil.

Here is the CORRECT setup code to turn that flag on in evil-mode:

(setq evil-move-cursor-back t)

2 Answers 2


(This is too long for a comment, and while not literally an answer, I hope it might help the OP.)

While Drew's answer covers what you literally want, this is probably not what you need. Point in Emacs is never on a character, it is between characters:

Like other positions, point designates a place between two characters (or before the first character, or after the last character), rather than a particular character. Usually terminals display the cursor over the character that immediately follows point; point is actually before the character on which the cursor sits.

Of course, both the display and some commands might mislead you. For instance, what-cursor-position

shows information about the current cursor position and the buffer contents at that position [...] After Char:, this shows the character in the buffer at point.

I am not sure whether the wording "at that position" and "at point" in this excerpt are bugs in the manual or not; I would consider reporting them with e.g. M-x report-emacs-bug.

  • 2
    Possibly related tip: (setq-default cursor-type 'bar) will make the cursor into a vertical bar that's clearly between characters. Nov 6, 2014 at 3:29

Bind C-e to a command that puts the cursor one char to the left of the line end.

(defun foo (arg)
  (interactive "p")
  (end-of-line arg)
  (unless (bolp) (backward-char)))

(global-set-key "\C-e" 'foo)

(Although I cannot imagine why you would want to move the cursor there.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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