是否可以在Emacs中滚动缓冲区的整个可见部分,但是将点保留在原点。示例:point指向窗口的底部,我想看到一些从窗口顶部滚动而没有移动点的文本。
编辑:我认为C-l
C-l
符合我的要求。
答案 0 :(得分:11)
试试这些。根据您的口味更改M-n
和M-p
键绑定
;;; scrollers
(global-set-key "\M-n" "\C-u1\C-v")
(global-set-key "\M-p" "\C-u1\M-v")
答案 1 :(得分:8)
这可能有用。根据滚动的EmacsWiki页面;
变量
scroll-preserve-screen-position
可能对某些人有用。 当您向下滚动并向上滚动时,点应该以相同的方式结束 你开始的位置。可以通过构建来切换值 在模式M-x scroll-lock-mode
。
答案 2 :(得分:7)
;;;_*======================================================================
;;;_* define a function to scroll with the cursor in place, moving the
;;;_* page instead
;; Navigation Functions
(defun scroll-down-in-place (n)
(interactive "p")
(previous-line n)
(unless (eq (window-start) (point-min))
(scroll-down n)))
(defun scroll-up-in-place (n)
(interactive "p")
(next-line n)
(unless (eq (window-end) (point-max))
(scroll-up n)))
(global-set-key "\M-n" 'scroll-up-in-place)
(global-set-key "\M-p" 'scroll-down-in-place)
答案 3 :(得分:0)
;; Preserve the cursor position relative to the screen when scrolling
(setq scroll-preserve-screen-position 'always)
;; Scroll buffer under the point
;; 'scroll-preserve-screen-position' must be set to a non-nil, non-t value for
;; these to work as intended.
(global-set-key (kbd "M-p") #'scroll-down-line)
(global-set-key (kbd "M-n") #'scroll-up-line)