在 Bash/Windows 10 中使用 nano 編輯檔案時出現問題

在 Bash/Windows 10 中使用 nano 編輯檔案時出現問題

每當我在 Windows 10 Linux 子系統中使用 nano 編輯檔案時,都會遇到顯示問題。

我將使用 Bash/SSH 連接到遠端系統(Virtualbox 上的本機 CentOS7 VM)。然後,我將繼續使用 nano 編輯所述遠端系統上的檔案。

我將打開一個文件,開始刪除文本,突然間,整行文本開始消失。我必須關閉並重新開始我的工作。當我厭倦了,我就會切換到 vim。我寧願使用 Nano,它非常適合我所做的基本工作。

有其他人看到這個嗎?

編輯#1

  • 簡單地在 nano 中導航文件可能會導致此問題
  • vim 和 Putty 的行為方式不同
  • Ctrl+Shift+6 無法解決問題
  • 本質上使用 CentOS7 的普通安裝,無需修改 shell
  • AFAIK,當我訪問我的 Ubuntu Server VPS 時似乎不會發生這個問題

答案1

這是由於遠端 terminfo 不相容造成的。你可以嘗試這個修復:

TARobison commented on Feb 22, 2017 •
@ShimShamSam I had the exact same problem and it was killing me.
I work on a few different servers and only the CentOS one was behaving
like this. Using the following when I log in has so far fixed the problem
for me.

stty sane
export TERM=linux

I'm new to all of this, so maybe we aren't talking about the same thing
here, but I thought I'd offer what little I could.`

更多資訊請點這裡:https://github.com/Microsoft/WSL/issues/1436

這是一個類似的問題。如果您無法解決問題,您可以檢查一下:https://serverfault.com/questions/329154/ssh-garbling-characters-in-vim-nano-on-remote-server

相關內容