Skip to main content
added 28 characters in body
Source Link
Drew
  • 80.9k
  • 10
  • 125
  • 265
(cond ((fboundp 'move-beginning-of-line) (substitute-key-definition 'move-beginning-of-line 'beginning-of-line+ global-map) (substitute-key-definition 'move-end-of-line 'end-of-line+ global-map)) (t (substitute-key-definition 'beginning-of-line 'beginning-of-line+ global-map) (substitute-key-definition 'end-of-line 'end-of-line+ global-map))) (when (boundp 'visual-line-mode-map) (define-key visual-line-mode-map [remap move-beginning-of-line] nil) (define-key visual-line-mode-map [remap move-end-of-line] nil) (define-key visual-line-mode-map [home] 'beginning-of-line+) (define-key visual-line-mode-map [end] 'end-of-line+) (define-key visual-line-mode-map "\C-a" 'beginning-of-visual-line+) (define-key visual-line-mode-map "\C-e" 'end-of-visual-line+))) 
(cond ((fboundp 'move-beginning-of-line) (substitute-key-definition 'move-beginning-of-line 'beginning-of-line+ global-map) (substitute-key-definition 'move-end-of-line 'end-of-line+ global-map)) (t (substitute-key-definition 'beginning-of-line 'beginning-of-line+ global-map) (substitute-key-definition 'end-of-line 'end-of-line+ global-map))) (when (boundp 'visual-line-mode-map) (define-key visual-line-mode-map [remap move-beginning-of-line] nil) (define-key visual-line-mode-map [remap move-end-of-line] nil) (define-key visual-line-mode-map [home] 'beginning-of-line+) (define-key visual-line-mode-map [end] 'end-of-line+) (define-key visual-line-mode-map "\C-a" 'beginning-of-visual-line+) (define-key visual-line-mode-map "\C-e" 'end-of-visual-line+))) 
(cond ((fboundp 'move-beginning-of-line) (substitute-key-definition 'move-beginning-of-line 'beginning-of-line+ global-map) (substitute-key-definition 'move-end-of-line 'end-of-line+ global-map)) (t (substitute-key-definition 'beginning-of-line 'beginning-of-line+ global-map) (substitute-key-definition 'end-of-line 'end-of-line+ global-map))) (when (boundp 'visual-line-mode-map) (define-key visual-line-mode-map [remap move-beginning-of-line] nil) (define-key visual-line-mode-map [remap move-end-of-line] nil) (define-key visual-line-mode-map [home] 'beginning-of-line+) (define-key visual-line-mode-map [end] 'end-of-line+) (define-key visual-line-mode-map "\C-a" 'beginning-of-visual-line+) (define-key visual-line-mode-map "\C-e" 'end-of-visual-line+))) 
(cond ((fboundp 'move-beginning-of-line) (substitute-key-definition 'move-beginning-of-line 'beginning-of-line+ global-map) (substitute-key-definition 'move-end-of-line 'end-of-line+ global-map)) (t (substitute-key-definition 'beginning-of-line 'beginning-of-line+ global-map) (substitute-key-definition 'end-of-line 'end-of-line+ global-map))) (when (boundp 'visual-line-mode-map) (define-key visual-line-mode-map [remap move-beginning-of-line] nil) (define-key visual-line-mode-map [remap move-end-of-line] nil) (define-key visual-line-mode-map [home] 'beginning-of-line+) (define-key visual-line-mode-map [end] 'end-of-line+) (define-key visual-line-mode-map "\C-a" 'beginning-of-visual-line+) (define-key visual-line-mode-map "\C-e" 'end-of-visual-line+))) 
added 184 characters in body
Source Link
Drew
  • 80.9k
  • 10
  • 125
  • 265

Library misc-cmds.el has long had this feature. These

These are the relevant commands, and suggested key bindings: (these bindings are made in setup-keys.el).

(cond ((fboundp The'move-beginning-of-line)  first two  (substitute-key-definition 'move-beginning-of-line these'beginning-of-line+ areglobal-map)  needed to remove the default remappings. (substitute-key-definition 'move-end-of-line 'end-of-line+ global-map)) (t (substitute-key-definition 'beginning-of-line 'beginning-of-line+ global-map) (substitute-key-definition 'end-of-line 'end-of-line+ global-map))) (when (boundp 'visual-line-mode-map) (define-key visual-line-mode-map [remap move-beginning-of-line] nil) (define-key visual-line-mode-map [remap move-end-of-line]  nil) (define-key visual-line-mode-map [home] 'beginning-of-line+) (define-key visual-line-mode-map [end] 'end-of-line+) (define-key visual-line-mode-map "\C-a" 'beginning-of-visual-line+) (define-key visual-line-mode-map "\C-e" 'end-of-visual-line+))) 

Personally, I never use visual-line mode, so I just bind C-a and C-e to beginning-of-line+ and end-of-line+, respectively.

Here is what C-h f end-of-line+ says, as one example:

end-of-line+ is an interactive compiled Lisp function in `misc-cmds.el'. It is bound to C-e, end. (end-of-line+ &optional N) Move cursor to end of current line or end of next line if repeated. This is similar to `end-of-line', but: If called interactively with no prefix arg: If the previous command was also `end-of-line+', then move to the end of the next line. Else, move to the end of the current line. Otherwise, move to the end of the Nth next line (Nth previous line if N<0). Command `end-of-line', by contrast, moves to the end of the (N-1)th next line. 

Library misc-cmds.el has long had this feature. These are the relevant commands, and suggested key bindings:

 The first two of these are needed to remove the default remappings. (define-key visual-line-mode-map [remap move-beginning-of-line] nil) (define-key visual-line-mode-map [remap move-end-of-line] nil) (define-key visual-line-mode-map [home] 'beginning-of-line+) (define-key visual-line-mode-map [end] 'end-of-line+) (define-key visual-line-mode-map "\C-a" 'beginning-of-visual-line+) (define-key visual-line-mode-map "\C-e" 'end-of-visual-line+) 

Personally, I never use visual-line mode, so I just bind C-a and C-e to beginning-of-line+ and end-of-line+, respectively.

Here is what C-h f end-of-line+ says, as one example:

end-of-line+ is an interactive compiled Lisp function in `misc-cmds.el'. It is bound to C-e, end. (end-of-line+ &optional N) Move cursor to end of current line or end of next line if repeated. This is similar to `end-of-line', but: If called interactively with no prefix arg: If the previous command was also `end-of-line+', then move to the end of the next line. Else, move to the end of the current line. Otherwise, move to the end of the Nth next line (Nth previous line if N<0). Command `end-of-line', by contrast, moves to the end of the (N-1)th next line. 

Library misc-cmds.el has long had this feature.

These are the relevant commands, and suggested key bindings (these bindings are made in setup-keys.el).

(cond ((fboundp 'move-beginning-of-line)    (substitute-key-definition 'move-beginning-of-line 'beginning-of-line+ global-map)   (substitute-key-definition 'move-end-of-line 'end-of-line+ global-map)) (t (substitute-key-definition 'beginning-of-line 'beginning-of-line+ global-map) (substitute-key-definition 'end-of-line 'end-of-line+ global-map))) (when (boundp 'visual-line-mode-map) (define-key visual-line-mode-map [remap move-beginning-of-line] nil) (define-key visual-line-mode-map [remap move-end-of-line]  nil) (define-key visual-line-mode-map [home] 'beginning-of-line+) (define-key visual-line-mode-map [end] 'end-of-line+) (define-key visual-line-mode-map "\C-a" 'beginning-of-visual-line+) (define-key visual-line-mode-map "\C-e" 'end-of-visual-line+))) 

Here is what C-h f end-of-line+ says, as one example:

end-of-line+ is an interactive compiled Lisp function in `misc-cmds.el'. It is bound to C-e, end. (end-of-line+ &optional N) Move cursor to end of current line or end of next line if repeated. This is similar to `end-of-line', but: If called interactively with no prefix arg: If the previous command was also `end-of-line+', then move to the end of the next line. Else, move to the end of the current line. Otherwise, move to the end of the Nth next line (Nth previous line if N<0). Command `end-of-line', by contrast, moves to the end of the (N-1)th next line. 
Source Link
Drew
  • 80.9k
  • 10
  • 125
  • 265

Library misc-cmds.el has long had this feature. These are the relevant commands, and suggested key bindings:

 The first two of these are needed to remove the default remappings. (define-key visual-line-mode-map [remap move-beginning-of-line] nil) (define-key visual-line-mode-map [remap move-end-of-line] nil) (define-key visual-line-mode-map [home] 'beginning-of-line+) (define-key visual-line-mode-map [end] 'end-of-line+) (define-key visual-line-mode-map "\C-a" 'beginning-of-visual-line+) (define-key visual-line-mode-map "\C-e" 'end-of-visual-line+) 

Personally, I never use visual-line mode, so I just bind C-a and C-e to beginning-of-line+ and end-of-line+, respectively.

Here is what C-h f end-of-line+ says, as one example:

end-of-line+ is an interactive compiled Lisp function in `misc-cmds.el'. It is bound to C-e, end. (end-of-line+ &optional N) Move cursor to end of current line or end of next line if repeated. This is similar to `end-of-line', but: If called interactively with no prefix arg: If the previous command was also `end-of-line+', then move to the end of the next line. Else, move to the end of the current line. Otherwise, move to the end of the Nth next line (Nth previous line if N<0). Command `end-of-line', by contrast, moves to the end of the (N-1)th next line.