12

CTRL-x o - 将光标切换到其他窗口

我想有能力扭转什么control-x o。类似的东西control-x p完全control-x o可以做,但是倒退了。这个请求的原因是我经常打开两个缓冲区是代码,一个缓冲区是 repl。我经常不得不穿过其中一个缓冲区才能到达另一个缓冲区,这很烦人。

假设我打开了 3 个缓冲区(A、B、C),并且我在缓冲区 B 上。缓冲区按字母顺序排列control-x o。当我想去 A 时,我只想按control-x p,而不是按control-x o两次。

任何帮助表示赞赏,谢谢。

4

2 回答 2

12

Call other-window with a negative count. This can be done interactively by pressing C-- C-x o. The "C--" is supplying a numeric argument of -1. You can supply any numeric (NUM) by pressing C-u num.

If you don't want to press the additional key cord, just write you own command command to hard code the "-1" argument:

Add this code to your .emacs file

(global-set-key "\C-xp" (lambda () 
                          (interactive)
                          (other-window -1)))

How does it work? "C-x o" calls the function other-window (to find that out use C-h k and then type the key combo).

In the code above we define an anonymous function, make it interactive and do what we want. Then we bind that function to the key combinaion C-x p.

于 2012-11-24T22:15:04.257 回答
0

I was using emacs for a bit and i dont renember having any backward option of Ctrl-x o. Anyway i always prefaired using Ctrl-x Ctrl-f, this let you circle between files, using simple, text based file explorer. Previous file is in bacground. You can combine both.

于 2012-11-24T22:15:27.967 回答