按年被提到
20112012 · 5 次2026
开源书›编程语言·No.65·简称 LVTHW

Learn Vimscript the Hard Way

笨办法学 Vimscript
Steve Losh

靠一章章小练习学会 Vim 脚本,并写出自己的插件

免费阅读 ↗
被推荐 · 28 人首次 2011-10-07 · 最近 2026-07-02官方免费在线(版权保留,作者或出版社免费放出)
28不同的人
28活跃月份
11有推荐的月份
29讨论串

Steve Losh 写的 Vimscript 入门教程,按短章节逐步讲解映射、选项、变量、函数、自动命令,最后带读者写一个完整的插件。风格沿用“笨办法”系列:每章都有要敲进编辑器的例子。内容基于传统 Vimscript,书中也讲了不少 Vim 本身的运作逻辑。和直接翻 Vim 帮助文档相比,它的顺序更适合循序渐进地学。

HN 为什么推荐它

HN 上的人推荐它,是因为写 Vim 插件时它几乎是最好的入门资料;也有人说读完后对 Vim 的语义理解更深。2026 年有评论提到它有些过时,但对理解传统 Vimscript 仍有帮助。

难度 2 / 5约 12 小时
适合谁

已经会用 Vim、想自定义配置或写插件的人

读之前最好知道
1Vim 基本操作
2任意一门编程语言

怎么读

由 Claude 根据这本书和 HN 上的说法整理,可能有错
  1. 1先会用 Vim 的基本操作,再从映射和选项几章开始读
  2. 2每章的例子都亲手敲进 Vim 里试一遍
  3. 3读完前面基础后,跟着书里的插件项目走一遍
  4. 4只想用 Vim 不写插件,也可以挑讲映射、operator 的章节读

HN 书评

推荐在前,同类按时间 · 每本最多保留 20 条,统计用全部提及 · 作者本人贴的不算
强烈推荐ElHacker · 2020-11

“I highly recommend taking a look at Learn Vimscript the Hard Way to learn how to do it. Thanks to that guide I was able to write my first simple plugin”

强烈推荐用它学写插件,靠它写出了第一个插件
I Still Use Vim原评论 ↗
强烈推荐alexhans · 2026-05

“Learn Vim script the hard way [1], even if you didn't end up writing any actual vim script, was a game changer in terms of understanding the semantics.”

强烈推荐:即使不写脚本,也大大加深对 Vim 语义的理解
It's time to talk about my writerdeck原评论 ↗
推荐pash · 2012-07

“The two things that most helped me learn Vim, beyond the very basics, were Drew Neil's excellent Vimcasts [0] and Steve's own Learn Vimscript the Hard Way [1]”

称它和 Vimcasts 是帮自己学会基础之外 Vim 的资源
Coming Home to Vim原评论 ↗
推荐bstar77 · 2012-12

“Use this to learn vim:”

推荐用它学 Vim
The Vim Beginners’ Site原评论 ↗
推荐mpercy · 2014-07

“And if you use Vim or a Vim-mode in your IDE, remap the sequence 'jk' to Esc. I never leave the home row anymore. See Learn Vimscript the Hard Way”

建议把 jk 映射成 Esc,并以此书作参考
Ask HN: Does touch typing make you a better programmer?原评论 ↗
推荐stevebmark · 2015-10

“if you're ever in the unfortunate position of needing to write or edit a Vim plugin, "Learn Vimscript the Hard Way" is invaluable Learn Vimscript the Hard Way”

需要写或改 Vim 插件时,称它极有价值
To Master Vim, Use It Like Language原评论 ↗
看全部 19 条 →
推荐barcher · 2016-10

“Better to learn foundational vim concepts, and then make this decision.”

建议先学 Vim 基础概念,再做决定
Vim for Humans原评论 ↗
推荐jez · 2022-10

“Steve Losh is also the author of Learn Vimscript the Hard Way, one of the best resources for writing Vim plugins.”

称它是学写 Vim 插件的最佳资源之一
Coming Home to Vim (2010)原评论 ↗
推荐enasterosophes · 2023-11

“Not sure if you've seen this, but worth working through, sooner or later (no rush): Learn Vimscript the Hard Way”

推荐找时间学一遍,不用着急
Ask HN: Comment here about whatever you're passionate about at the moment原评论 ↗
推荐sodapopcan · 2026-02

“There is also Learn VimScript the Hard Way, which is of course a bit outdated, but it does help to know "legacy" vimscript.”

推荐用它了解 legacy vimscript,虽然有些过时
Vim 9.2 Released原评论 ↗
推荐alexhans · 2026-07

“I always liked this site to grok some of those vim fundamentals [1]”

推荐用它掌握 Vim 基础
引用irahul · 2012-07

“Consider this sample grap extension take from Steve Losh's Learn Vimscript the Hard Way”

引它里面的 grep 运算符扩展作 Vimscript 示例
Vim Creep原评论 ↗
引用dewitt · 2013-04

“Also, Steve, would you consider using the Creative Commons Attribution-NoDerivs 3.0 license instead of a homemade license?”

建议作者改用 Creative Commons 许可证,不用自制许可证
Learn Vimscript the Hard Way原评论 ↗
引用cabacon · 2013-08

“which ties in with Steve's quote in Learn Vimscript the Hard Way, "The idea of operators and movements is one of the most important concepts in Vim”

引用书中话:operators 和 movements 是 Vim 最重要的概念之一
Learn Vimscript the Hard Way原评论 ↗
引用normalocity · 2013-12

“Sorry, I guess I didn't describe that in the article. I've updated the article to include this link:”

在文章里补充了链接,用来解释 leader key
Vim: Spacebar as leader key, CapsLock as Esc原评论 ↗
引用elg0nz · 2016-09

“:inoremap jk <esc>”

给出把 jk 映射为 Esc 的例子
Use caps lock as a language switch原评论 ↗
引用bilalq · 2016-12

“The difference is that the noremap variant is non-recursive [0].”

用它说明 noremap 是非递归映射
Escape key alternatives in Vim原评论 ↗
引用NoodleIncident · 2019-11

“If a vim-only solution is good enough, then this could be accomplished using the "abbreviations" feature: Learn Vimscript the Hard Way”

指出只用 Vim 的话可以用 abbreviations 功能
APLcart – Find Your Way in APL原评论 ↗
引用skydhash · 2026-03

“Lazyloading is already present in Vim, it’s called autoload and most plugins I’ve seen use that feature”

说明 Vim 已有 autoload 机制可做懒加载
Neovim 0.12.0原评论 ↗
被提交为 story · 11 次