简体   繁体   English

在 VSCode 上为 Remote-SSH 配置终端类型

[英]Configuring terminal type for Remote-SSH on VSCode

I'm using Remote-SSH for VSCode to connect to a linux server for development.我正在使用 VSCode 的 Remote-SSH 连接到 linux 服务器进行开发。 I need my terminal type to default to xterm instead of xterm-256color which seems to be the default terminal type when using Remote-SSH.我需要我的终端类型默认为 xterm 而不是 xterm-256color,这似乎是使用 Remote-SSH 时的默认终端类型。

I have tried adding SetEnv TERM=xterm as well as SendEnv TERM=xterm to the SSH config file but neither works.我尝试将 SetEnv TERM= SetEnv TERM=xtermSendEnv TERM=xterm添加到 SSH 配置文件中,但都不起作用。 The only way I can get it to work is by manually running export TERM=xterm in the bash terminal once I'm connected, but this setting is lost when I open a new bash.我可以让它工作的唯一方法是在我连接后在 bash 终端中手动运行export TERM=xterm ,但是当我打开一个新的 bash 时,此设置会丢失。

In VSCode, I can see that my terminal for linux is set to xterm so I'm not sure why it's still defaulting to xterm-256color when using Remote-SSH.在 VSCode 中,我可以看到我的 linux 终端设置为 xterm ,所以我不确定为什么在使用 Remote-SSH 时它仍然默认为 xterm-256color。 I don't have this problem when using Putty outside of VSCode.在 VSCode 之外使用 Putty 时,我没有这个问题。

Any ideas?有任何想法吗?

The setting you are referring to in your screenshot does not set the TERM variable but the executable that is run if you're using an external terminal.您在屏幕截图中引用的设置不会设置TERM变量,而是设置在您使用外部终端时运行的可执行文件。

Seems like the TERM value for the integrated terminal is hardcoded to xterm-256color .似乎集成终端的TERM被硬编码为xterm-256color

Easy workaround should be to set it in your ~/.profile or ~/.bash_profile on the remote:简单的解决方法应该是在您的~/.profile或远程~/.bash_profile中设置它:

export TERM=xterm

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM