跳到正文
DEV Community· The Practical Developer·· 3 小時前AI 評分36

Vim 解説:歷久不衰的編輯器

Vim Explained: The Editor That Never Dies

AI 導讀

Vim 是一款以模式和動作組合為核心的文字編輯器,至今仍常見於 Linux 伺服器及開發者的日常工作。Normal mode 用於輸入指令,Insert mode 用於輸入文字;將動作與移動方式組合,可用鍵盤完成編輯。Vim 的學習曲線較陡,內嵌 AI 自動補全及豐富的除錯功能則需要外掛或 Neovim 設定。

正文

The Practical Developer

Introduction

Every few years someone declares Vim dead — replaced by VS Code, replaced by AI editors, replaced by something newer. Yet Vim, released in 1991 and descended from vi (1976), is still everywhere: preinstalled on nearly every Linux server, embedded in editors as a plugin, and loved by developers who edit text all day. The reason is not nostalgia. Vim changes how editing works: instead of reaching for the mouse, you compose edits like sentences.

Modes and motions: editing as grammar

Vim's central idea is modes. Most editors have one mode: type and it appears. Vim has several, and the two you live in are:

  • Normal mode — the default, where keys are commands, not text. Pressing j moves down, w jumps a word, dd deletes a line.
  • Insert mode — entered with i, where keys type text as usual; Esc returns to Normal mode.

Commands compose like grammar: a verb, then a motion. d (delete) + w (word) = dw, delete a word. c (change) + i + " (inside quotes) = ci", change the text inside quotes. Once that grammar clicks, editing becomes fast in a way mouse-driven editing never is: you describe the edit, Vim performs it, and your hands never leave the keyboard. Add search (/pattern), macros (recorded keystroke sequences), and :s substitutions, and repetitive edits collapse to a few keystrokes.

The honest trade

Vim's trade is its learning curve: the first week is famously painful — new users famously cannot even quit (:q! exits without saving, if you ever need it). Configuration is a rabbit hole, and modern conveniences like inline AI completions or rich debugging need plugins or a Neovim setup. The rule of thumb: Vim when you edit text constantly, work on remote servers, or want keyboard-speed editing; a GUI editor like VS Code when you want batteries included and a gentler start — noting that many developers get both, running Vim keybindings inside VS Code.

Takeaway

Vim is a modal editor: Normal mode for commands, Insert mode for typing, and commands composed as verb plus motion. It trades a steep first week for editing speed that compounds for years — which is why, fifty years after vi, it is still not dead.

Originally published at https://practicaldevblog.blogspot.com/2026/10/vim-explained-editor-that-never-dies.html

來源:DEV Community · dev.to