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

时间:2021-10-10 01:28:58

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. 解决方案#1不起作用但解决方案#2工作:剪贴板程序:pbcopy,pbpaste和xsel完全不起作用

  3. Bug in Vim when used in Mac: Unable to have no scattered windows in Screen by .Xresources.
  4. 在Mac中使用Vim中的错误:无法在Screen by .Xresources中没有分散的窗口。

  5. Solved: Ctrl A stops working in terminal. This suggests me that Screen's keyboard bindings need to be changed slightly.
  6. 解决:Ctrl A停止在终端工作。这表明我需要稍微改变Screen的键盘绑定。

  7. Solved: The scrolling with touchpad does not work. By editing your .screenrc the scrollback works normally (including touchpad)
  8. 解决:使用触摸板滚动不起作用。通过编辑.screenrc,回滚功能正常(包括触摸板)

  9. Solved: Unable to have Dvorak keybindings for Screen for moving in Scrollback mod.
  10. 解决:无法使用Dvorak键绑定屏幕进行Scrollback mod移动。

  11. How can you use pbcopy/pbpaste/xsel inside Screen?
  12. 如何在屏幕内使用pbcopy / pbpaste / xsel?

7 个解决方案

#1


I usually solve the ctrl-a problem 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-z来解决ctrl-a问题(当你运行屏幕时,通常不需要经常使用它,因为不是后台处理过程,你可以启动一个新的屏幕)。在我的.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 article for some tips on using screen's scrollback features.

使用触摸板滚动不会起作用;屏幕充当终端仿真器内的终端仿真器,只要您在屏幕之间切换,屏幕就无法在Terminal.app中切换回滚缓冲区。您将不得不使用屏幕的回滚功能。有关使用屏幕的回滚功能的一些提示,请参阅此文章。

#2


In 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。

#3


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解决了所有这些问题(我的安装已经有几年了,所以我现在无法测试这个理论)。

#4


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

如果启用备用屏幕缓冲区,问题#3可能是可解决的。在.screenrc中使用altscreen

#5


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).

该命令绑定到C-a b(在我的例子中,C-z b)。

Solution #2 which works but is rather slow to type

解决方案#2有效,但输入速度相当慢

Use Scrollback mode i.e. copy mode by

使用Scrollback模式,即复制模式

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.

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

#6


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向上滚动屏幕。您无法在屏幕中使用触控板。

#7


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屏幕

#1


I usually solve the ctrl-a problem 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-z来解决ctrl-a问题(当你运行屏幕时,通常不需要经常使用它,因为不是后台处理过程,你可以启动一个新的屏幕)。在我的.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 article for some tips on using screen's scrollback features.

使用触摸板滚动不会起作用;屏幕充当终端仿真器内的终端仿真器,只要您在屏幕之间切换,屏幕就无法在Terminal.app中切换回滚缓冲区。您将不得不使用屏幕的回滚功能。有关使用屏幕的回滚功能的一些提示,请参阅此文章。

#2


In 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。

#3


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解决了所有这些问题(我的安装已经有几年了,所以我现在无法测试这个理论)。

#4


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

如果启用备用屏幕缓冲区,问题#3可能是可解决的。在.screenrc中使用altscreen

#5


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).

该命令绑定到C-a b(在我的例子中,C-z b)。

Solution #2 which works but is rather slow to type

解决方案#2有效,但输入速度相当慢

Use Scrollback mode i.e. copy mode by

使用Scrollback模式,即复制模式

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.

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

#6


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向上滚动屏幕。您无法在屏幕中使用触控板。

#7


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屏幕