Emacs:如何在 Cx 0 上自动选择下一个而不是上一个窗口(窗格)

Emacs:如何在 Cx 0 上自动选择下一个而不是上一个窗口(窗格)

假设我有一个 Emacs 框架(普通人称之为窗口),其中有三个窗口(普通人称之为窗格或框架),它看起来像这样,光标位于X

+-----------------------------------+ (original state)
| EMACS                             |
+-----------------+-----------------+
| a               | b     X         |
|                 +-----------------+
|                 | c               |
+-----------------+-----------------+

如果我输入C-x 0,Emacs 将关闭b窗口,并且光标将放在a窗口中,如下所示:

+-----------------------------------+ (current result after C-x 0)
| EMACS                             |
+-----------------+-----------------+
| a               | c               |
|                 |                 |
|           X     |                 |
+-----------------+-----------------+

我如何配置 Emacs 来选择下一个窗口而不是以前的窗口,例如

+-----------------------------------+ (desired result after C-x 0)
| EMACS                             |
+-----------------+-----------------+
| a               | c               |
|                 |    X            |
|                 |                 |
+-----------------+-----------------+

答案1

根据@lawlist 的评论,这是我现在正在使用的。

(defun delete-window-then-next ()
  ; Makes this bindable to global-set-key
  (interactive)
  ; delete the current window, moving to the previous
  (delete-window)
  ; go to the next now
  (other-window 1))
(global-set-key (kbd "C-x o") 'delete-window-then-next)

相关内容