There's nothing that hard-core Unix and Linux users are more fanatical about than their text editor. Editors are the subject of adoration and worship, or of scorn and ridicule, depending upon whether the topic of discussion is your editor or someone else's. vi has been the standard editor for close to 30 years. Popular on Unix and Linux, it has a growing following on Windows systems, too. Most experienced system administrators cite vi as their tool of choice. And since 1986, this book has been the guide for vi. However, Unix systems are not what they were 30 years ago, and neither is this book. While retaining all the valuable features of previous editions, the 7th edition of Learning the vi and vim Editors has been expanded to include detailed information on vim, the leading vi clone. vim is the default version of vi on most Linux systems and on Mac OS X, and is available for many other operating systems too.
AI Reading Assistant
Whole-book reading guide from stratified index samples; jump to passages in the text
Tip the Site
Support this siteYour recognition and a small knowledge-service contribution help keep this technical work open source.Scan the WeChat Pay or Alipay code below. Logged-in and guest visitors can both tip.
WeChat Pay
Alipay
Open WeChat or Alipay and scan. No login required.
AI guide
【One-Line Pitch】
If you spend any time in a terminal, this is the definitive guide to mastering vi and Vim—the editors that power Unix, Linux, and macOS. From your first keystroke to advanced scripting, it turns a frustrating tool into your fastest path from thought to text.
【Book Arc】
- **Opening (~0%–9%)**: Introduces vi's philosophy and history, explains why it's not a WYSIWYG word processor, and covers opening/closing files, quitting, and the basic command structure. This stage solves the "where do I start?" problem with a clear mental model.
- **Early (~9%–25%)**: Dives into simple editing—cursor movement, insert/delete/change commands, undo/redo, and screen navigation (H/M/L, scrolling). It also introduces the general command pattern (command + number + text object), which is the key to vi's power. This stage builds muscle memory for everyday editing.
- **Early–Middle (~25%–38%)**: Explores global replacement with :g and :s, including regular expressions, special replacement characters (&, ~, \u, \l), and the :set command for customizing options. This stage solves the "I need to change this everywhere" problem efficiently.
- **Middle (~38%–47%)**: Covers advanced editing—abbreviations, key mapping with :map, named buffers, and autoindent for source code. It also introduces shift commands (>>, <<) and tabstop/shiftwidth settings. This stage is about personalizing your workflow.
- **Late (~47%–end)**: Moves into Vim-specific features and power tools: interval expressions in regex, enhanced tags with Exuberant ctags, and tag stacks for navigating code. This stage is for users ready to go beyond basic vi into clone-specific optimizations.
【Key Takeaways】
- **The command pattern is everything** (Early): Most vi commands follow `(command)(number)(text object)`—like `d2w` to delete two words. Understanding this unlocks the editor's composability; you can mix and match commands (c, d, y) with movements to do complex edits in a few keystrokes.
- **Undo is more powerful than you think** (Early): `u` undoes the last command, `U` undoes all edits on a line, and you can toggle between versions by undoing the undo. Vim adds `CTRL-R` for redo and infinite undo history, letting you move forward and backward through your edit history.
- **Global replacement is a lifesaver** (Early): The `:s/old/new/g` command changes every occurrence on a line, while `:%s/old/new/g` does it file-wide. Special characters like `&` (replay the match) and `\u`/`\l` (change case) make it a precision tool, not just a find-and-replace.
- **Customize with :set and .exrc** (Middle): Toggle options like `:set ic` (ignore case) or value options like `:set window=20` change how vi behaves. Startup files (.exrc in home and local directories, plus EXINIT) let you define different environments for different tasks—English text vs. source code.
- **Abbreviations and mappings save keystrokes** (Middle): `:ab` expands short phrases into long ones (watch out for infinite loops), while `:map` assigns complex command sequences to unused keys. These turn repetitive tasks into single keystrokes, dramatically speeding up your workflow.
- **Autoindent is a coder's best friend** (Middle): The `autoindent` option, combined with `>>`/`<<` shift commands and `shiftwidth` settings, keeps source code properly indented. Special `CTRL-D` variants handle C preprocessor lines and reset indentation levels, helping you avoid bugs from mismatched braces.
- **Vim's regex and tags go deeper** (Late): Interval expressions like `{n,m}` give precise control over repetitions, and Exuberant ctags (supported by most clones) enables powerful tag stacks—saving multiple locations as you jump through code. This is where vi stops being an editor and becomes a navigation system.
【Reading Tips】
- **Skim the problem checklists** (Early): Each major section includes troubleshooting lists for common mistakes. Don't read them upfront—just know they're there and return when you hit a snag.
- **Deep-read the command pattern chapter** (Early): The `(command)(number)(text object)` structure is the foundation. Spend extra time here; it's the difference between memorizing commands and truly understanding vi.
- **Practice the global replacement examples** (Early–Middle): The `:s` and `:g` commands have many subtle options. Work through the examples with a test file—especially the `&`, `~`, and case-conversion characters—to see the results firsthand.
- **Skip the clone-specific sections initially** (Late): The book covers vi, nvi, elvis, Vim, and vile. If you're on Linux or macOS, focus on Vim sections first; come back to the others only if you need them.
- **Take away the .exrc setup** (Middle): Even if you skim the rest, learn how to create a .exrc file with your preferred :set options. It's a small investment that pays off every time you open the editor.
【Coverage Limits】
This guide synthesizes the first ~47% of the book in depth; the later portions on Vim-specific features, multi-window editing, and scripting are covered only at a high level. Excerpts do not cover the book's appendices or advanced Vim scripting.
Page 9
. . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 Movement by Screens 35 Movement by Text Blocks 38 Movement by Searches 39 Movement by Line Number...
edraw part of (or all of) the screen, so you can always get rid of unwanted messages by scrolling them off the screen and then returning to your previous pos...
character in the replacement text to mean “the replacement text of the last substitute command.” Pattern-Matching Rules | 79 www.it-ebooks.info As the first ...
hen doing indenting. Usually, when you see text indented by eight spaces at a time, vi will actually insert tab characters into the file, since tabs usually
88 | Chapter 11: Multiple Windows in Vim www.it-ebooks.info Choosing an alternate color scheme depending on the time of day may seem trite, but maybe not as ...
n commands, or other methods, and then reenter insert mode. Superficially, this seems like a great idea, but in practice it will appeal to only a subset of u...
o retrieve getchar getcwd getdirentries getenv getgrent ... The first two lines are typical English-language synonyms (matching “fun” and “fun- ny,” respecti...
Support this siteYour recognition and a small knowledge-service contribution help keep this technical work open source.
Scan the WeChat Pay or Alipay code below. Logged-in and guest visitors can both tip.
WeChat PayAlipay
Open WeChat or Alipay and scan. No login required.
Add Tag
Enter tag name (max 50 characters)
Share E-Book
Learning the vi and Vim Editors, Seventh Edition Text processing at maximum speed and power (Arnold Robbins, Elbert Hannah, Linda Lamb)(Z-Library)
Scan QR code with your phone to access
Copy the link or scan the QR code to access this e-book on your phone
Share to WeChat Moments
Learning the vi and Vim Editors, Seventh Edition Text processing at maximum speed and power (Arnold Robbins, Elbert Hannah, Linda Lamb)(Z-Library)
Scan the QR code with WeChat to open this book
Tap the ··· menu in the top-right corner
Choose Share to Moments
You are already in WeChat. Tap ··· in the top-right corner and choose Share to Moments.
Share E-Book via Email
Please enter email address
Donation Statistics
¥.00
Total Donations
0
Donation Count
Learning the vi and Vim Editors, Seventh Edition Text processing at maximum speed and power (Arnold Robbins, Elbert Hannah, Linda Lamb)(Z-Library)
Find Your Favorite Books
Only registered users can comment after logging in. Comments need to be reviewed by administrators before being displayed
这本书围绕 vi 与 Vim 这两款 Unix/Linux 环境下的经典文本编辑器展开,讲的是如何借助它们实现高速、高效的文本处理。作者从 vi 近三十年的标准编辑器地位说起,说明它不仅在 Unix 与 Linux 上流行,在 Windows 系统上也拥有日益增长的使用者,由此引出学习这套编辑器的现实意义。全书的主线是带领读者从基本操作走向高级技巧:先建立 vi 命令的通用语法框架,再逐步过渡到光标移动、插入删除、撤销、按屏幕与段落导航、缓冲区与标记的使用,以及全局替换和正则表达式的基础应用,让读者从“能编辑”进阶到“会批量处理”。
在此基础上,书中深入讲解 :set 选项定制、缩写与映射等节省按键的手段,并针对程序员介绍自动缩进与代码块移位等实用功能,同时涉及 nvi、elvis、vim 等克隆版本之间的差异。摘录中可以看到几条具体线索:一是屏幕重绘,说明如何通过滚动清掉不需要的消息并回到先前位置,也可以不滚动而直接重绘;二是 map 命令,它类似 ab,但定义的是命令模式下的宏,可把一段序列绑定到某个未使用的键上;三是 Vim 的编译过程,出现了 gcc 编译 chars...
Digital LibraryAI Assistant
Hi — I can help you pick a book. Tell me a topic, language, or level, e.g. “a light English read”. If that's too broad, I'll ask one follow-up.
Loading comments...
Reply to Comment
Edit Comment