简体   繁体   English

具有精确定位的Emacs滚动条

[英]Emacs scrollbars with exact positioning

How can I get scrollbars with exact positioning? 如何获得具有精确定位的滚动条?

To illustrate what I mean: 说明我的意思:

  1. Ch Cf (Read the The GNU Emacs FAQ) Ch Cf (阅读GNU Emacs FAQ)

  2. Now try to position the buffer content such that the paragraph starting with This is the version ... is on top. 现在尝试定位缓冲区内容,使得以This is the version ...开头的段落This is the version ...位于顶部。 With the default scrollbar you need several redraws to do this. 使用默认滚动条,您需要多次重绘才能执行此操作。 Or you left-click for cursor positioning then Cl Cl 或者左键单击光标定位,然后单击Cl Cl

  3. Now go back to where you have been before. 现在回到你以前的地方。 This is impossible with regular scrollbars. 对于常规滚动条,这是不可能的。

What I would like to have is to just click in the scrollbar at the height of This is the version ... to position this line on top for step 2. And to go back where I came from, I rightclick (without having moved the mouse, indeed). 我想要的是只需点击滚动条的高度This is the version ...将此行放在第2步的顶部。然后回到我来自的地方,我右键单击(没有移动老鼠,的确)。

In the past, I have always installed Emacs with the Athena widgets -like option to get such scrollbars, see a description of them . 在过去,我总是使用类似Athena 小部件的选项安装Emacs来获取这样的滚动条,查看它们的描述 But I wonder if there is now a better or more modern way to do this. 但我想知道现在是否有更好或更现代的方法来做到这一点。 After all, I'd rather like to use standard distributions. 毕竟,我更愿意使用标准发行版。

Maybe, it is not even necessary to change the scrollbars at all but to use rather the left-fringe for it. 也许,甚至根本不需要改变滚动条,而是使用左边缘。 After all, mouse clicking in the fringe is recognized as <left-fringe> 毕竟,鼠标在边缘点击被识别为<left-fringe>

Mx emacs-version Mx emacs-version
GNU Emacs 23.3.1 (x86_64-pc-linux-gnu, GTK+ Version 2.24.10) of 2012-09-21 on batsu, modified by Debian 2012-11-21关于batsu的GNU Emacs 23.3.1(x86_64-pc-linux-gnu,GTK +版本2.24.10),由Debian修改

Maybe a change of usage habits could help? 也许改变使用习惯会有所帮助? Some Emacs user recommend disabling the scrollbars completely and navigate Emacs exclusively with the keyboard. 一些Emacs用户建议完全禁用滚动条并使用键盘专门导航Emacs。 (This habit is also beneficial for using Emacs inside a shell.) (这种习惯也有利于在shell中使用Emacs。)

Emacs provides a large number of navigation shortcuts . Emacs提供了大量的导航快捷方式 For instance, for jumping up and down large amounts of buffer space, you have: 例如,对于大量缓冲区空间的上下跳跃,您可以:

Cv scroll-up Cv scroll-up

Mv scroll-down Mv scroll-down

M-} forward-paragraph M-} forward-paragraph

M-{ backward-paragaph M- { backward-paragaph

Cx ] forward-page Cx] forward-page

Cx [ backward-page Cx [ backward-page

However, I would argue that by far the most useful navigation commands are: 但是,我认为到目前为止最有用的导航命令是:

Cs isearch-forward Cs isearch-forward

Cr isearch-backward Cr isearch-backward

In Emacs, search is so cheap, it is such an integral part of the work flow that it's often times much faster to get to a different point in the buffer by using a reference word as an anchor for a quick search, rather than leaving the home row to reach for the mouse. 在Emacs中,搜索是如此便宜,它是工作流程中不可或缺的一部分,通过使用参考词作为快速搜索的锚点来获取缓冲区中的不同点通常要快得多,而不是离开主页行到达鼠标。 Hitting Cs or Cr repeatedly will move the point to consecutive matches. 反复击中CsCr会将该点移动到连续的匹配。 (You can even switch to regular expression search by hitting Mr while searching to make search even more powerful.) (你甚至可以通过点击Mr来切换到正则表达式搜索,同时搜索更强大的搜索功能。)

You already mentioned Cl Cl to view the current line at the top of the buffer. 您已经提到了Cl Cl来查看缓冲区顶部的当前行。

Now, if you want to go back to the previous location, you could use 现在,如果你想回到以前的位置,你可以使用

Cu Cx Cu Cx

which jumps back to the mark. 跳回到标记。 All the above commands for navigation push their start position on a "mark-ring" which means you can not only jump back one position, repeatedly hitting Cu Cx will take you back to many previous positions. 以上所有导航命令都将其开始位置推到“标记环”上,这意味着您不仅可以向后跳回一个位置,反复击中Cu Cx将带您回到之前的许多位置。

为此,我按Cl一次,两次,三次。他们将在中上下切换。

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

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