让Emacs将光标移开屏幕 [英] Let Emacs move the cursor off-screen

查看:176
本文介绍了让Emacs将光标移开屏幕的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以让Emacs将光标移离屏幕,就像大多数GUI文本编辑器一样?当我在任何GUI编辑器上使用Emacs时,这是最大的麻烦之一。当我向下滚动时,光标在缓冲区的顶部被推向前。



我以前认为这是完全不可能的,因为这是硬连线进入Emacs的架构,但后来我看到了多光标,这对于辅助光标是完全正确的(假设您可以防止滚动功能作用于辅助光标)。是否可能使用多个游标将主游标放在一些隐藏的缓冲区中,有效的光标是我实际编辑的?或者还有其他一些聪明的技巧?或者也许我的谷歌已经失败了我,这真的已经可以没有任何魔法?

解决方案

a href =http://elpa.gnu.org/ =nofollow noreferrer> GNU ELPA ,名为 scroll-restore 尝试解决这个问题。到目前为止,我遇到了一些错误,但是这个软件包似乎是大部分广告的工作。



你可以通过安装它/ p>

  Mx软件包安装RET滚动恢复RET 

安装软件包后,您可以使用

  Mx scroll-还原模式

个人而言,我绑定到 Scroll Lock 键因为它似乎是如此令人难以置信的apropos!这是我添加到我的init文件中:

 (需要滚动恢复)
(scroll-restore -mode 1)
;;允许滚动恢复修改光标面
(setq scroll-restore-handle-cursor t)
;;当POINT离线屏幕时,使光标不可见
(setq scroll-restore-cursor-type nil)
;;滚动后跳转到原始光标位置
(setq scroll-restore-jump-back t)
;;使用Scroll Lock键切换滚动恢复模式
(global-set-key(kbd< Scroll_Lock>)'scroll-restore-mode)
pre>

这是发布在这里的答案的直接副本: https ://emacs.stackexchange.com/a/2273/93


Is it possible to let Emacs have the cursor be moved off-screen, like most GUI text editors work? This is one of the biggest things that bothers me when I use Emacs over any GUI editor. When I scroll down, the cursor is "pushed forward" by the top of the buffer.

I had previously thought that this was completely impossible, because this is hard-wired into the architecture of Emacs, but then I saw multiple-cursors, which does exactly this for the secondary cursors (assuming you prevent the scrolling functions from acting on the secondary cursors). Is it maybe possible to use multiple-cursors to have the main cursor in some hidden buffer, and the effective cursor being what I actually edit with? Or maybe some other clever trick? Or maybe my Googling has failed me and this is really already possible without any magic?

解决方案

There is a new package available on GNU ELPA called scroll-restore that attempts to remedy this problem. So far, I have encountered a few bugs, but the package seems to work as-advertised for the most part.

You can test it out by installing it with

M-x package-install RET scroll-restore RET

After the package is installed, you can enable the minor mode with

M-x scroll-restore-mode

Personally, I am binding it to the Scroll Lock key because it seems so incredibly apropos! This is what I am adding to my init file:

(require 'scroll-restore)
(scroll-restore-mode 1)
;; Allow scroll-restore to modify the cursor face
(setq scroll-restore-handle-cursor t)
;; Make the cursor invisible while POINT is off-screen
(setq scroll-restore-cursor-type nil)
;; Jump back to the original cursor position after scrolling
(setq scroll-restore-jump-back t)
;; Toggle scroll-restore-mode with the Scroll Lock key
(global-set-key (kbd "<Scroll_Lock>") 'scroll-restore-mode)

This is a direct copy of an answer posted here: https://emacs.stackexchange.com/a/2273/93

这篇关于让Emacs将光标移开屏幕的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆