Emacs 在指定方向上围绕拆分窗口移动? [英] Emacs move around split windows in a specified direction?

查看:21
本文介绍了Emacs 在指定方向上围绕拆分窗口移动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在终端 Emacs(无鼠标)中,我使用拆分窗口同时处理多个缓冲区.我发现在拆分窗口之间移动比在 Vim 中移动要痛苦得多.阅读文档看起来我做对了(C-x o),但这只是以顺时针方向在窗口周围循环.如果我移动到相邻的窗口进行快速编辑,则需要按 C-x o 几次,然后才能回到原来的位置.有时我不小心匆忙按了太多次,不得不再次从窗户骑回来.

In Terminal Emacs (no mouse), I'm using split windows to work with multiple buffers at the same time. I'm finding moving between the split windows much more painful than how I do it in Vim. Reading the documentation it looks like I'm doing it correctly (C-x o), but that just cycles around the windows in a clockwise direction. If I move to an adjacent window to make a quick edit, I need to hit C-x o a few times before I'm back where I was. Sometimes I accidentally press it too many times in a hurry and have to cycle all the way back through the windows again.

远没有安装另一个外部包,有什么办法可以直接移动到一个窗口(例如,通过一个数字),或者至少在相反的方向上绕着窗口循环?

Far from install yet-another-external-package, is there any way I can just either move directly to a window (by, say, a number), or at least cycle around the windows in the opposite direction?

在 Vim 中 Cw Cw 就像 Emacs 中的 Cx o,但也有 Cw ARROW 向指定方向移动......像那样?:)

In Vim C-w C-w is like C-x o in Emacs, but there's also C-w ARROW to move in a specified direction... something like that? :)

推荐答案

将此添加到您的 init 文件中:

Add this to your init file:

(windmove-default-keybindings)

然后您可以使用SHIFT+箭头移动到指定方向的下一个相邻窗口.

Then you can use SHIFT+arrow to move to the next adjacent window in the specified direction.

如果您愿意,可以通过传递参数(默认为 'shift)指定不同的修饰符.

You can specify a different modifier if you prefer, by passing an argument (defaults to 'shift).

或者只是将您喜欢的任何内容绑定到这些函数:

Or just bind whatever you like to these functions:

  • windmove-up
  • windmove-down
  • windmove-left
  • windmove-right

您还可以将 FrameMove 添加到组合中,以使这项工作在多个框架中透明地进行.

You can also add FrameMove to the mix, to make this work transparently across multiple frames.

对于编号窗口导航,有 switch-window.el.

For numbered window navigation, there's switch-window.el.

这篇关于Emacs 在指定方向上围绕拆分窗口移动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆