Jump to content
View in the app

A better way to browse. Learn more.

PHP论坛人

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

解決vi/vim方向鍵與Backspace後退鍵無法使用的問題

Featured Replies

--------------------------------------------------------
解決vi/vim方向鍵與Backspace後退鍵無法使用的問題
--------------------------------------------------------


在部分Linux發行版或最小化系統中,初次使用vi或vim編輯時,常會遇到以下困擾:

按方向鍵卻出現 A、B、C、D 等字母

按後退鍵 (Backspace) 時無法刪除文字,或出現奇怪的符號

此問題通常發生於系統預設安裝 vim.tiny (vim精簡版),為節省系統資源移除了:完整鍵盤支援、部分終端相容設定、進階編輯功能







修改全系統設定檔,這會影響所有使用者 (需root權限)
vi /etc/vim/vimrc



在檔案末尾加入以下兩行

set nocompatible
set backspace=indent,eol,start




儲存檔案並離開vi編輯器
按 Esc,輸入 :wq,按 Enter




---------------------------------
登出
---------------------------------

SSH登出
exit





---------------------------------
測試
---------------------------------


再SSH登入



如何確認是否已修復?
vim test.txt


確認以下動作正常:

← ↑ ↓ → 可移動游標

Backspace 可刪字

不會出現 A/B/C/D



離開vi編輯器,不儲存
按 Esc,輸入 :q! ,按 Enter





或者安裝完整版 vim

apt update

apt install vim


安裝後可確認版本,若看到Huge / Normal 版,代表已安裝完整版
vim --version





----------------
補充說明
----------------

set nocompatible (關閉vi相容模式,啟用完整Vim功能)

set backspace=2 (為舊寫法,允許Backspace刪除縮排、換行、文字)

現代Vim官方建議寫法為 set backspace=indent,eol,start

Edited by Jack

Create an account or sign in to comment

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.