在Emacs中更快地更改窗口(或通过单击执行重复最后一个快捷方式)

rab*_*ne9 6 emacs keyboard-shortcuts

如果我想改变emacs中的窗口,我会做Cx o,这对我很好......但是当我想连续多次更改窗口时Cx o不是那么方便...有没有办法改变窗口第一次Cx后只有一次罢工?一般来说......是否有(单一)罢工会重复我最后的捷径?

Tyl*_*ler 6

我使用C-tab切换窗口:

(global-set-key [C-tab] 'other-window)
Run Code Online (Sandbox Code Playgroud)

按住Control键,只需按Tab键即可反复跳转窗口.

编辑:我的原始答案包含以下内容

我不认为有一种内置的方法可以为这样的基本命令重复上一个命令......

这不再是真的.Emacs现在包含repeat.el,它允许rabidmachine9要求的行为.

下面的代码将创建一个重复other-window,这样C-x o在第一次按下o之后,按下之后将继续移动到下一个窗口.

(require 'repeat)
(defun make-repeatable-command (cmd)
  "Returns a new command that is a repeatable version of CMD.
The new command is named CMD-repeat.  CMD should be a quoted
command.

This allows you to bind the command to a compound keystroke and
repeat it with just the final key.  For example:

  (global-set-key (kbd \"C-c a\") (make-repeatable-command 'foo))

will create a new command called foo-repeat.  Typing C-c a will
just invoke foo.  Typing C-c a a a will invoke foo three times,
and so on.

See related discussion here: 
http://batsov.com/articles/2012/03/08/emacs-tip-number-4-repeat-last-command/#comment-459843643
https://groups.google.com/forum/?hl=en&fromgroups=#!topic/gnu.emacs.help/RHKP2gjx7I8"
  (fset (intern (concat (symbol-name cmd) "-repeat"))
        `(lambda ,(help-function-arglist cmd) ;; arg list
           ,(format "A repeatable version of `%s'." (symbol-name cmd)) ;; doc string
           ,(interactive-form cmd) ;; interactive form
           ;; see also repeat-message-function
           (setq last-repeatable-command ',cmd)
           (repeat nil)))
  (intern (concat (symbol-name cmd) "-repeat")))

(global-set-key (kbd "C-x o") (make-repeatable-command 'other-window))
Run Code Online (Sandbox Code Playgroud)

该函数make-repeatable-command用于创建其他重复命令,使用相同的模板.


Nic*_*ley 5

看看windmove ; 它让你只需按住一个修改键,然后按箭头键移动到那个方向的窗口.我已经使用默认修饰符(移位)多年了,奇怪的是它不会干扰我在其他应用程序中使用移位箭头文本选择的冲动.

还有一个相当于帧,我应该尝试...