Skip to content

Commit c2328dc

Browse files
committed
Add C-e in copy mode to stop at last non-whitespace character
Terminal lines are padded with spaces to the full width, so the default move-end-of-line jumps to the far right edge. The new command skips back over trailing whitespace.
1 parent ea4353f commit c2328dc

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

ghostel.el

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -751,6 +751,12 @@ pasted using bracketed paste."
751751
(ghostel--redraw ghostel--term))
752752
(goto-char (point-max))))
753753

754+
(defun ghostel-copy-mode-end-of-line ()
755+
"Move to the last non-whitespace character on the line."
756+
(interactive)
757+
(end-of-line)
758+
(skip-chars-backward " \t"))
759+
754760
;;; Mouse input
755761

756762
(defun ghostel--mouse-button-number (event)
@@ -834,6 +840,7 @@ pasted using bracketed paste."
834840
(define-key map (kbd "C-p") #'ghostel-copy-mode-previous-line)
835841
(define-key map (kbd "M-<") #'ghostel-copy-mode-beginning-of-buffer)
836842
(define-key map (kbd "M->") #'ghostel-copy-mode-end-of-buffer)
843+
(define-key map (kbd "C-e") #'ghostel-copy-mode-end-of-line)
837844
map)
838845
"Keymap for `ghostel-copy-mode'.
839846
Standard Emacs navigation works.

0 commit comments

Comments
 (0)