放松OpenVMS的terminal大小

在OpenVMS中,虽然有些绿色,但是仍然在努力“完成任务”,我想在设置terminal的高度和宽度方面让事情变得容易一些。

目前,我可以通过SSH连接到基于OpenVMS-8.4的服务器(从我的Tmux会话中的一个窗格),但是与Linux不同,DCL命令shell不会自动获取我的terminal大小。

也就是说,在SSH进入和发行SHOW TERM ,我得到:

 Terminal: _FTA31: Device_Type: VT200_Series Owner: <elided> Input: 9600 LFfill: 0 Width: 80 Parity: None Output: 9600 CRfill: 0 Page: 24 Terminal Characteristics: Interactive Echo Type_ahead No Escape Hostsync TTsync Lowercase Tab Wrap Scope No Remote Eightbit Broadcast No Readsync No Form Fulldup No Modem No Local_echo No Autobaud No Hangup No Brdcstmbx No DMA No Altypeahd Set_speed No Commsync Line Editing Overstrike editing No Fallback No Dialup Secure server No Disconnect No Pasthru No Syspassword No SIXEL Graphics No Soft Characters No Printer Port Numeric Keypad ANSI_CRT No Regis No Block_mode Advanced_video Edit_mode DEC_CRT DEC_CRT2 No DEC_CRT3 No DEC_CRT4 No DEC_CRT5 No Ansi_Color VMS Style Input <CTRL-H> Backspace 

上面的重要位是Width: 80Page: 24 。 尽pipe发出一个Tmux :display "H: #{pane_height}, W: #{pane_width}"显示如下:

  H: 51, W: 92 

terminal特性不会自动更新,考虑到terminal似乎被解释为“ VT200_Series ”,这可能并不令人惊讶。 在任何情况下,我都注意到Tmux在与terminal交互的方式上相当灵活,特别是通过display-message命令可以显示一系列terminal属性。 如上所述,人们可以通过如下方式“获得”宽度和高度:

  :display-message -p "Width: #{pane_width}, Height: #{pane_height}" 

-p表示结果应该输出到stdout (Tmux清除显示并显示结果)。

另外,可以通过Tmux命令set-buffer将数据显式set-buffer ,如下所示:

  :set-buffer "Mary had a little lamb..." 

并将结果粘贴到窗格,就好像它已经使用paste-buffer Tmux命令以交互方式input。

我想要做的事情是这样的:

  :setb "SET TERM/PAGE=#{pane_height}/WIDTH=#{pane_width}";\ pasteb;\ send Enter 

当然, SET TERM/ ...位在OpenVMS中分别明确地设置了terminal的高度和宽度。

可悲的是,看起来像set-buffer命令的data参数没有经历“特殊variables”replace。

对于OpenVMS和Tmux都有一些新的东西,我需要一些指导,告诉我如何在这里做我需要做的事情。 另一种方法,我想只是使用一个特定大小的terminal,并在我的LOGIN.COM脚本中对这个大小进行硬编码,但是我希望能够dynamic地设置这个大小的“一等奖”(如果可以的话)上面的想法工作,我会,当然使用bind-key设置,以便能够迅速调用它)。

您可以使用Tmux的run-shell命令 – 根据手册页:

 run-shell -b [-t target-pane] shell-command ... shell-command is expanded using the rules specified in the FORMATS section ... 

FORMATS部分描述了如何通过像“ #{pane_width} ”这样的replace操作来格式化string。

所以,使用run-shell可以调用一个shell脚本,将任何有关Tmux会话,客户端,窗口或窗格的信息都传递给它。 Tmux 允许向命令行发送命令到服务器,指向一个窗格。 发出DCL命令来设置terminal宽度和高度的必要shell脚本变成:

 #!/usr/bin/env sh # We're assuming the pane identifier is passed as the first # argument. # PANE=$1 # It's possible to "fetch" information by invoking the # Tmux display-message command (short form: display) and # passing it the pane identifier with the target (-t) option. # WIDTH=$( tmux display -t $PANE -p "#{pane_width}" ) HEIGHT=$( tmux display -t $PANE -p "#{pane_height}" ) # # Construct the DCL command to set terminal width and # height explicitly. # CMD="SET TERM/PAGE=$HEIGHT/WIDTH=$WIDTH" # # Set the buffer to contain the DCL command string. # tmux setb "$CMD" # # Paste the buffer contents to the relevant pane. # tmux pasteb -t $PANE # # Press "Enter" in the relevant pane to execute the DCL command. # tmux send -t $PANE Enter 

剩下的就是设置一个绑定键,它将调用run-shell ,调用上面的脚本并将“当前”窗格标识符作为唯一parameter passing给它:

 bind-key Cr run-shell "~/bin/resizevms.sh #{pane_id}" 

把它放在你的~/.tmux.conf ,login后,一个快速的Cb Cr会为你设置。