OS X Byobu垂直拆分 [英] OS X Byobu Vertical Split

查看:93
本文介绍了OS X Byobu垂直拆分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前在OS X上使用iTerm2和byobu,我不知道如何在OS X上垂直分割屏幕.在Linux上,我可以使用Ctrl + F2垂直分割屏幕,但是在OSX上,由于苹果使用了不同的键盘,因此无法正常工作.

I'm currently on OS X using iTerm2 and byobu, and I can't figure out how to split my screen vertically on OS X. On Linux, I can split my screen vertically with Ctrl+F2, but on OSX, that doesn't work, thanks to Apple's different keyboard.

我到处搜索Google解决方案,但我无法弄清楚.我可以使用Shift + F2来水平拆分屏幕,但是我需要能够垂直拆分.有没有人想过如何让byobu的键盘绑定功能与Apple计算机配合使用?

I Googled all around for the solution, and I can't figure this out. I can split my screen horizontally with Shift+F2, but I need to be able to split vertically. Has anyone figured out how to get byobu's keyboard bindings to work well with Apple computers?

先谢谢了.

推荐答案

好像打开了这个问题的错误.

我能够将iTerm2配置为在OS X上本地使用byobu,以及在Ubuntu 14.04服务器上通过ssh远程使用.

I was able to configure iTerm2 to use byobu locally on OS X as well as remotely over ssh on an Ubuntu 14.04 server.

使用:

  • OS X版本:10.9.5 Build 13F34
  • iTerm2版本:内部版本1.0.0.20140629

首先,在OS X系统偏好设置中,编辑键盘设置并删除或更改可能与byobu冲突的任何快捷设置(即 Ctrl + F1 - F12 ).

First, in your OS X system preferences, edit your keyboard settings and remove or change any shortcut settings that may conflict with byobu (i.e. Ctrl + F1-F12).

这是一种解决方法,可以在不向 FN 键添加完整功能的情况下工作.这将允许您使用byobu退出键在垂直方向上拆分窗口:

Here's a workaround that will work without adding full functionality to the FN keys. This will allow you to split windows vertically using the byobu escape key:

  1. 开始byobu.

通过运行以下命令来设置所需的 Ctrl - A 行为:byobu-ctrl-a.我选择使用Emacs模式.

Set your desired Ctrl-A behavior by running: byobu-ctrl-a. I chose to go with Emacs-mode.

运行byobu-config并选择或更改您的转义序列.我使用了新的默认 Ctrl + S . F12 密钥也是一个转义序列

Run byobu-config and choose or change your escape sequence. I went with the new default Ctrl + S. The F12 key is also an escape sequence

现在,您可以使用转义序列发出命令.尝试先按 F12 然后按 Ctrl + s 然后按垂直拆分窗口.有关命令的完整列表,请尝试先按 Ctrl + s ,然后按?或先按 F12 然后按?.

Now you can issue a command with your escape sequence. Try F12 then % or Ctrl + s then % to split a window vertically. For a full list of commands, try Ctrl + s then ? or F12 then ?.

选项2:设置iTerm2密钥映射以完全使用所有 FN 密钥.

您可以向iTerm2配置文件添加一些键映射,以获取 CTRL ALT SHIFT FN 键可与byobu一起使用.这很乏味,但我进行了练习,似乎很奏效.我认为没有使用iTerm2保存这些键映射的自动方法.

Option 2: Setting iTerm2 key mappings to fully use all FN keys.

You can add some key mappings to your iTerm2 profile to get the CTRL, ALT, SHIFT, and FN keys to work with byobu. This is tedious, but I went through the exercise and it seems to work. I don't think there's an automated way to save these key mappings with iTerm2.

  1. 打开iTerm2首选项,然后选择配置文件.
  2. 选择您要使用的个人资料.
  3. 打开终端"窗格,然后在报告终端类型"下选择"linux".
  4. 打开键"窗格,然后手动添加以下键绑定.这是一个如何添加一个键绑定的示例:

  1. Open iTerm2 preference and select Profiles.
  2. Choose the profile you'd like to use.
  3. Open the Terminal pane and under "Report terminal type" choose "linux".
  4. Open the Keys pane and manually add the following key bindings. Here's an example how to add one key binding:

  • 点击"+"图标.
  • 在第一个字段中输入要映射的键盘快捷键.示例:CTRL + F2
  • 在操作"字段中选择发送转义序列".
  • 在第三个字段中输入字符.示例:[1;5Q
  • Click the '+' icon.
  • Enter the keyboard shortcut being mapped in the first field. Example: CTRL + F2
  • Select "Send Escape Sequence" in the Action field.
  • Enter the characters in the third field. Example: [1;5Q

您可以通过参考 tmux源代码.

对所有这些映射重复此操作,以使相应的byobu命令起作用:

Repeat this for all of these mappings to make the corresponding byobu command work:

  • CTRL + F2 :[1;5Q
  • CTRL + SHIFT + F2 :[1;6Q
  • ALT + LEFT :[1;3D
  • ALT + RIGHT :[1;3C
  • ALT + UP :[1;3A
  • ALT + DOWN :[1;3B
  • CTRL + F3 :[1;5R
  • CTRL + F4 :[1;5S
  • CTRL + SHIFT + F3:[1;6R
  • CTRL + SHIFT + F4:[1;6S
  • SHIFT + ALT + LEFT :[1;4D
  • Shift + ALT + RIGHT :[1;4C
  • Shift + ALT + UP :[1;4A
  • Shift + ALT + DOWN :[1;4B
  • CTRL + F5 :[15;5~
  • CTRL + SHIFT + F5 :[15;6~
  • ALT + F6 :[17;3~
  • CTRL + F6 :[17;5~
  • ALT + PPAGE :[5;3~
  • ALT + NPAGE :[6;3~
  • CTRL + F8 :[19;5~
  • ALT + SHIFT + F8 :[19;4~
  • CTRL + SHIFT + F8 :[19;6~
  • CTRL + F9 :[20;5~
  • ALT + F11 :[23;3~
  • CTRL + F11 :[23;5~
  • ALT + F12 :[24;3~
  • CTRL + F12 :[24;5~
  • ALT + INS :[2;3~
  • CTRL + F2 : [1;5Q
  • CTRL + SHIFT + F2 : [1;6Q
  • ALT + LEFT : [1;3D
  • ALT + RIGHT : [1;3C
  • ALT + UP : [1;3A
  • ALT + DOWN : [1;3B
  • CTRL + F3 : [1;5R
  • CTRL + F4 : [1;5S
  • CTRL + SHIFT + F3 : [1;6R
  • CTRL + SHIFT + F4 : [1;6S
  • SHIFT + ALT + LEFT : [1;4D
  • SHIFT + ALT + RIGHT : [1;4C
  • SHIFT + ALT + UP : [1;4A
  • SHIFT + ALT + DOWN : [1;4B
  • CTRL + F5 : [15;5~
  • CTRL + SHIFT + F5 : [15;6~
  • ALT + F6 : [17;3~
  • CTRL + F6 : [17;5~
  • ALT + PPAGE : [5;3~
  • ALT + NPAGE : [6;3~
  • CTRL + F8 : [19;5~
  • ALT + SHIFT + F8 : [19;4~
  • CTRL + SHIFT + F8 : [19;6~
  • CTRL + F9 : [20;5~
  • ALT + F11 : [23;3~
  • CTRL + F11 : [23;5~
  • ALT + F12 : [24;3~
  • CTRL + F12 : [24;5~
  • ALT + INS: [2;3~

要使事情正常进行,我们需要:

To get things to work we needed to:

  • 删除与OS X键盘快捷键的冲突.
  • 编辑终端键映射,以在使用功能键时发送正确的转义序列.
  • 将iTerm2终端类型设置为"Linux",这会将TERM环境变量设置为"linux". Byobu和/或Tmux似乎对此很敏感.

有关转义序列的其他参考: xterm-keys.c

Some other references on escape sequences: SO link and xterm-keys.c

tmux窗口默认目录似乎在tmux 1.8和tmux 1.9之间有所不同( Src Src ).如果将byobu与tmux 1.9一起使用,则可以尝试将其添加到~/.byobu/keybindings.tmux文件中,以便在创建新窗口或垂直/水平拆分时,它们在与当前窗格相同的目录中打开:

It looks like there are some difference in tmux window default directory between tmux 1.8 and tmux 1.9 (Src, Src, Src). If you are using byobu with tmux 1.9 you can try adding this to your ~/.byobu/keybindings.tmux file so that when you create new windows or vertical/horizontal splits that they open in the same directory as the current pane:

unbind-key -n F2
bind-key -n F2 display-panes \; new-window -c "#{pane_current_path}" -n -
unbind-key -n C-F2
bind-key -n C-F2 display-panes \; split-window -hc "#{pane_current_path}"
unbind-key -n  S-F2
bind-key -n S-F2 display-panes \; split-window -vc "#{pane_current_path}"
unbind-key %
bind-key % display-panes \; split-window -hc "#{pane_current_path}"
unbind-key |
bind-key | display-panes \; split-window -vc "#{pane_current_path}"

F5 重新加载设置.

这篇关于OS X Byobu垂直拆分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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