Hel*_*iro 12 navigation emacs elisp editor
我很熟悉并经常使用C-l(recenter-top-bottom)来
将当前行连续移动到窗口中心,顶部和底部.
我想有一个等效的命令来连续地将当前列移动到窗口中心,左右边界.内置或Elisp的片段.
Tre*_*son 12
干得好:
(defun my-horizontal-recenter ()
"make the point horizontally centered in the window"
(interactive)
(let ((mid (/ (window-width) 2))
(line-len (save-excursion (end-of-line) (current-column)))
(cur (current-column)))
(if (< mid cur)
(set-window-hscroll (selected-window)
(- cur mid)))))
Run Code Online (Sandbox Code Playgroud)
明显的绑定(来自obvio171)是:
(global-set-key (kbd "C-S-l") 'my-horizontal-recenter)
Run Code Online (Sandbox Code Playgroud)