For example, I got a small window, a long whole line is split into multiple lines, not actually split, but with one arrow at the end of each line of the window, if I use C-e or End key, this will move end point to the end of this actual line.

(setq truncate-lines nil)is set in my init.el, how can I move my point to the end of the window/screen line?


You want visual-line-mode. You can enable it with M-x visual-line-mode.

See the EmacsWiki on:

See the GNU Emacs manual on:

  • No, I don't want to enable visual-line-mode, I just want the whole line that way in Emacs, I already find the solution, I can use beginning/end-of-visual-line.
    – CodyChan
    May 26 '15 at 3:51
  • 2
    Okay then, post it as an answer and wait for answer-own-question time limit.
    – PythonNut
    May 26 '15 at 3:53
  • 1
    For anyone who may be interested to know, enabling visual-line-mode remaps move-beginning-of-line to beginning-of-visual-line; and move-end-of-line to end-of-visual-line. For those who prefer that whole words not be broken up at widow-edge, visual-line-mode offers a wonderful built-in alternative. This is also ideal for anyone with a word-processing background.
    – lawlist
    May 26 '15 at 4:04

I already find the solution, I can use beginning/end-of-visual-line

(global-set-key (kbd "C-S-e") 'end-of-visual-line)
(global-set-key (kbd "C-S-a") 'beginning-of-visual-line)

Now, use C-S-a/e to do that motion.

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.