When I jump to bottom part of the buffer using vi
I does not show any empty lines.
On 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 vim
on emacs
?
When I jump to bottom part of the buffer using vi
I does not show any empty lines.
On 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 vim
on emacs
?
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 set-window-start
section.
(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)
(forward-line (/ (window-height
(selected-window)) 2)))
(global-set-key "\C-x\ ." 'my-bottom)