我正在使用centered-cursor-mode在 Emacs 中,我真的很喜欢它。不过,光标的位置设置得比中心低,这让我很困扰,而且我实际上更希望它比中心高。
每隔几个月,我都会感到恼火,试图对此采取一些措施,但到目前为止我还没有成功。我的印象是答案是改变这个位中的数字
(defcustom ccm-vpos-init '(round (window-text-height) 2)
"This is the screen line position where the cursor initially stays."
:group 'centered-cursor
:tag "Vertical cursor position"
:type '(choice (const :tag "Center" (round (window-text-height) 2))
(const :tag "Golden ratio" (round (* 21 (window-text-height)) 34))
(integer :tag "Lines from top" :value 10)))
(make-variable-buffer-local 'ccm-vpos-init)
但好像不是。
有人知道如何更改“centered-cursor-mode.el”中光标的居中位置吗?
最佳答案
您可以使用M-C-+和M-C--调整当前缓冲区中的行位置。前缀参数指定要移动光标的行数,例如如果你想让光标向上两行,你可以输入:
C-u 2 C-M-+
为了获得更永久的解决方案,您还可以自定义“垂直光标位置”(又名 ccm-vpos-init
)的条目,正如您的问题已经建议的那样。通过 M-xcustomize-group RET centered-cursor RET 访问该条目,您会发现三个基本选项:
- 居中(默认)
- 黄金比例
- 从顶部开始的线条
恕我直言,只有当您始终使用完全相同的窗口大小(因此水平分割窗口将成为问题)时,第三个选项才有意义,而第二点可能是您的一个选择?
但是,您可以非常轻松地在 ccm-vpos-init
的定义中添加第四个选项,该选项允许您将光标精确定位在您想要的位置,例如:
(defcustom ccm-vpos-init '(round (window-text-height) 2)
"This is the screen line position where the cursor initially stays."
:group 'centered-cursor
:tag "Vertical cursor position"
:type '(choice (const :tag "Center" (round (window-text-height) 2))
(const :tag "Golden ratio" (round (* 21 (window-text-height)) 34))
(integer :tag "Lines from top" :value 10)
(const :tag "2 Lines above center" (- (round (window-text-height) 2) 2))))
下次启动 Emacs 时,第四个选项将在上述“垂直光标位置”条目中可用。
关于emacs - 如何在Emacs中更改 "centered-cursor-mode"中光标的位置?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9221429/