macos 无法在 Mac 的终端中有效地使用 Screen

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/810025/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 06:07:22  来源:igfitidea点击:

Unable to use Screen efficiently in Mac's Terminal

macosterminalgnu-screen

提问by Léo Léopold Hertz ??

The post summarizes problems in using Screen in Mac's terminal when you have the following in your .zshrc

当您的 .zshrc 中有以下内容时,该帖子总结了在 Mac 终端中使用 Screen 的问题

if [[ $STY = '' ]] then screen -xR; fi 
  1. Solution #1 is not working but Solution #2 works:Clipboard programs: pbcopy, pbpaste and xsel do not work at all
  2. Bug in Vim when used in Mac: Unable to have no scattered windows in Screen by .Xresources.
  3. Solved:Ctrl A stops working in terminal. This suggests me that Screen's keyboard bindings need to be changed slightly.
  4. Solved:The scrolling with touchpad does not work. By editing your .screenrc the scrollback works normally (including touchpad)
  5. Solved: Unable to have Dvorak keybindings for Screen for moving in Scrollback mod.
  6. How can you use pbcopy/pbpaste/xsel inside Screen?
  1. 解决方案 #1 不起作用,但解决方案 #2 有效剪贴板程序:pbcopy、pbpaste 和 xsel 根本不起作用
  2. 在 Mac 中使用时 Vim 中的错误:无法在 Screen by .Xresources 中没有分散的窗口。
  3. 已解决Ctrl A 在终端中停止工作。这表明我需要稍微更改 Screen 的键盘绑定。
  4. 已解决使用触摸板滚动不起作用。通过编辑您的 .screenrc 回滚正常工作(包括触摸板)
  5. 已解决:无法为 Screen 设置 Dvorak 键绑定以在 Scrollback mod 中移动。
  6. 如何在 Screen 中使用 pbcopy/pbpaste/xsel?

采纳答案by Brian Campbell

I usually solve the ctrl-aproblem by setting my escape character to ctrl-z(which you generally don't need to use as often when you're running screen, since instead of backgrounding a process, you can just start up a new screen). In my .screenrc:

我通常解决了ctrl-a我的转义字符设置问题ctrl- z(你一般不需要经常使用,当你运行屏幕,因为不是backgrounding的过程,你可以只启动一个新的屏幕)。在我的.screenrc

escape ^Zz

Scrolling using the touchpad just isn't going to work; screen is acting as a terminal emulator inside a terminal emulator, and it's just not possible for screen to switch the scrollback buffer in Terminal.app whenever you switch between screens. You're going to have to use screen's scrollback features. See this articlefor some tips on using screen's scrollback features.

使用触摸板滚动是行不通的;screen 在终端模拟器中充当终端模拟器,并且无论何时在屏幕之间切换, screen 都不可能在 Terminal.app 中切换回滚缓冲区。您将不得不使用屏幕的回滚功能。有关使用屏幕回滚功能的一些提示,请参阅本文

回答by dmw

In screenrc:

screenrc

# Make xterm scrolling work properly with screen.
termcapinfo xterm-256color|xterm-color|xterm|xterms|xs|rxvt ti@:te@

Works for Terminal.app too.

也适用于 Terminal.app。

回答by runako

The default OS X Terminal app is weak. Get iTerm instead:

默认的 OS X 终端应用程序很弱。改为获取 iTerm:

iTerm

术语

If I'm not mistaken, iTerm solves all of these out of the box (my install is a couple years old, so I can't test that theory now).

如果我没记错的话,iTerm 开箱即用地解决了所有这些问题(我的安装已经有几年了,所以我现在无法测试该理论)。

回答by staticsan

Problem #3 might be solvable if you enable the alternate screen buffer. Use altscreen onin .screenrc

如果您启用备用屏幕缓冲区,问题 #3 可能可以解决。使用altscreen on.screenrc

回答by Léo Léopold Hertz ??

Solution #1 which does not work

解决方案#1 不起作用

To be able to copy/paste in OSX put the following to your .screenrc

为了能够在 OSX 中复制/粘贴,将以下内容放入您的 .screenrc

bind b eval "writebuf" "exec sh -c 'pbcopy < /tmp/screen-exchange'"

> Th[e] line - - sends that file to pbcopy - -.

> Th[e] 行 - - 将该文件发送到 pbcopy - -。

The command is bound to C-a b (in my case, C-z b).

命令绑定到 Ca b(在我的例子中,Cz b)。

Solution #2 which works but is rather slow to type

解决方案#2 有效但打字很慢

Use Scrollback mode i.e. copy mode by

使用回滚模式,即复制模式

Coping

应对

C-A [

Pasting

粘贴

C-A ]

The solution is great, since it is the same in all terminal apps. It is similar to the clipboard as you use with your mouse.

解决方案很棒,因为它在所有终端应用程序中都是相同的。它类似于您使用鼠标的剪贴板。

回答by Léo Léopold Hertz ??

Q5: Impossible: The scrolling with touchpad does not work.

Q5:不可能:用触摸板滚动不起作用。

You can use ^A Esc to scroll up the screen. You cannot use Touchpad in Screen.

您可以使用 ^A Esc 向上滚动屏幕。您不能在屏幕中使用触摸板。

回答by ACoolie

This solves the scrollback issue, although it is somewhat broken in that it isn't aware of screen's buffers. env TERM=vt100 screen

这解决了回滚问题,尽管它有点坏,因为它不知道屏幕的缓冲区。 env TERM=vt100 screen