简体   繁体   English

Emacs - 让PgDn结束缓冲区

[英]Emacs - Getting PgDn to End of Buffer

I'm fairly new to Emacs, and I was wondering how to get the PageDown key to function so that it will send the point to the end of the buffer on the last PageDown instead of just printing "End of Buffer" in the minibuffer. 我对Emacs很新,我想知道如何让PageDown键运行,以便它将点发送到最后一个PageDown上的缓冲区的末尾,而不是仅仅在迷你缓冲区中打印“缓冲区结束”。

If there is some kind of benefit to keeping this behavior as-is, that would be interesting and helpful information as well. 如果保持这种行为有某种好处,那么这也是有趣且有用的信息。

Set scroll-error-top-bottom to a non-nil value, either via Mx customize-variable RET scroll-error-top-bottom , or by adding the following line to your init.el : scroll-error-top-bottom设置为非零值,可以通过Mx customize-variable RET scroll-error-top-bottom ,也可以init.el添加到init.el

(setq scroll-error-top-bottom t)

From Ch v scroll-error-top-bottom : Ch v scroll-error-top-bottom

Move point to top/bottom of buffer before signaling a scrolling error. 在发出滚动错误信号之前,将指针移动到缓冲区的顶部/底部。 A value of nil means just signal an error if no more scrolling possible. 如果不再滚动,则值为nil意味着仅发出错误信号。 A value of t means point moves to the beginning or the end of the buffer (depending on scrolling direction) when no more scrolling possible. 值t表示当不再滚动时,点移动到缓冲区的开头或结尾(取决于滚动方向)。 When point is already on that position, then signal an error. 当点已经在该位置时,则发出错误信号。

This is the standard solution without CUA or key remapping. 这是没有CUA或密钥重映射的标准解决方案。

The cua mode provides a cua-scroll-up command which does this. cua模式提供cua-scroll-up命令来执行此操作。 There are several ways to use it: 有几种方法可以使用它:

  1. activate cua-selection-mode , to get not only this scrolling behaviour, but also a large number of improvements in CUA. 激活cua-selection-mode ,不仅可以获得此滚动行为,还可以获得CUA中的大量改进。 This is the solution I would recommand. 这是我建议的解决方案。 Just put this in your init file ( .emacs or .emacs.d/init.el ) : 只需将它放在init文件中( .emacs.emacs.d/init.el ):

     (cua-selection-mode +1) 
  2. import only the scrolling behaviour from cua: 仅导入cua的滚动行为:

     (require 'cua-base) (global-set-key [remap scroll-up] 'cua-scroll-up) (global-set-key [remap scroll-down] 'cua-scroll-down) 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM