When I jump to bottom part of the buffer using
vi I does not show any empty lines.
emacs when I got to bottom of the buffer I see empty lines even there is no new lines exist.
Is is possible to accomplish same behavior of
This answer uses following answer's code with a small change Can page-down clamp the last line to the bottom of the window?. I just replaced
(my-scroll-and-clamp--forward-line height) with
(end-of-buffer) that is followed by the
(defun my-bottom () (interactive) (let* ((height (window-height))) (end-of-buffer) ;; Move window. (set-window-start (selected-window) (min (save-excursion ;; new point. (forward-line (- (/ height 2))) (point)) (save-excursion ;; max point. (goto-char (point-max)) (beginning-of-line) (forward-line (- (- height (+ 1 (* 2 scroll-margin))))) (point))))) (redisplay) (end-of-visual-line) (next-line (/ (window-height (selected-window)) 2))) (global-set-key "\C-x\ ." 'my-bottom)