简体   繁体   English

ctrl-x o向后(与其他窗口相对)?

[英]ctrl-x o backwards (opposite of other-window)?

CTRL-x o - switch cursor to other window CTRL-x o - 将光标切换到其他窗口

I would like to have the ability to reverse what control-x o does. 我希望能够反转control-x o功能。 Something like control-x p that does exactly what control-x o does, but backwards. control-x p这样的东西完全与control-x o ,但是向后。 The reason for this request is that I often have two buffers open that are code and one buffer open that is a repl. 这个请求的原因是我经常打开两个代码,一个缓冲打开,这是一个repl。 I often have to move across one of the buffers to get to the other, that is annoying. 我经常不得不穿过其中一个缓冲区来到另一个缓冲区,这很烦人。

Say I have 3 buffers open (A, B, C), and I am on buffer B. The buffers are in alphabetical order in terms of control-x o . 假设我打开了3个缓冲区(A,B,C),并且我在缓冲区B上。缓冲区按control-x o字母顺序排列。 When I want to go to A, I want to just press control-x p , rather than having to press control-x o twice. 当我想要去A时,我想按下control-x p ,而不是按两次control-x o

Any help is appreciated, Thank you. 感谢任何帮助,谢谢。

Call other-window with a negative count. 使用否定计数调用other-window This can be done interactively by pressing C-- Cx o . 这可以通过按C-- Cx o以交互方式完成。 The "C--" is supplying a numeric argument of -1. “C--”提供-1的数字参数。 You can supply any numeric (NUM) by pressing Cu num . Cu num可以提供任何数字(NUM)。

If you don't want to press the additional key cord, just write you own command command to hard code the "-1" argument: 如果您不想按其他键盘,只需编写自己的命令命令来硬编码“-1”参数:

Add this code to your .emacs file 将此代码添加到.emacs文件中

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

How does it work? 它是如何工作的? "Cx o" calls the function other-window (to find that out use Ch k and then type the key combo). “Cx o”调用函数other-window (找出使用Ch k然后键入键组合)。

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 Cx p . 然后我们将该函数绑定到组合键Cx p

I was using emacs for a bit and i dont renember having any backward option of Ctrl-x o. 我正在使用emacs,我不会重新考虑任何向后选项Ctrl-x o。 Anyway i always prefaired using Ctrl-x Ctrl-f, this let you circle between files, using simple, text based file explorer. 无论如何,我总是使用Ctrl-x Ctrl-f进行预设,这使您可以使用简单的基于文本的文件浏览器在文件之间进行循环。 Previous file is in bacground. 以前的文件是免费的。 You can combine both. 你可以两者结合起来。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM