不久前,我读了viemu创建者的一篇文章,澄清了许多关于vi的误解,并解释了为什么它是一个好主意(以及为什么它在过去30多年里非常流行)。同一个人还有一套很棒的图形备忘单,每次教一些基本知识。

我相信。

事实上,在过去的两年里,我一直被说服。但是我仍然没有强迫自己学习vi作为我的主要编辑器,学习曲线太高了。当我开始工作时,可接受的但即时的生产力(使用我当前的编辑器)到目前为止已经超过了进一步的巨大生产力(使用vi)。

有没有人有什么好的建议来帮助你度过学习曲线?它可以是直接的提示,一些其他教程或文章,无论什么。

编辑:注意,我知道vi的vim/gVim, Cream和MacVim(等等)变体。我的问题是指vi家族作为一个整体。谢谢你的精彩回答。

更新(2009年4月)

自去年12月以来,我一直在日常的职业生活中使用Vim(更准确地说,是MacVim)。我不会回去的。

祝大家在掌握Vim的过程中好运。


当前回答

步骤0:学会触摸打字。说真的,如果你的手指不知道键在哪里,那么vim将是一种痛苦。而且,即使你拒绝vim,触摸输入也会改善你的编程(问Steve Yegge),因为它可以让你的大脑去监视链接。有很多软件可以帮助你提高打字水平。

步骤1:使用vimtutor开始。它在gvim(下 我想是帮助菜单)或者你可以在命令中输入“vimtutor” 线。这将花费你30-45分钟的时间,然后你的手指会 了解vi/vim的基础知识,你应该能够编辑文件 想把键盘扔出窗外。

步骤2:在所有地方使用vim。看到这个 问题 在命令中使用vim和vi键绑定的提示和链接 行,从您的web浏览器,编写电子邮件,在您的IDE…你 需要使用vim将键绑定嵌入到肌肉记忆中。

步骤3:了解更多关于vim的知识。你只会划伤 表面与vimtutor。你可以看这个 视频或 阅读这篇文章(都是关于 “有效编辑文本的七个习惯”。你可以 读 关于 提示 而且 技巧 在 StackOverflow。 您可以浏览vimtips。学习一门 我的建议是“很少经常”——外面有太多这样的东西 坚持一口大小的知识块将是获取知识的最佳方式 棍子。

第四步:利润

其他回答

删除notepad.exe并创建vim的快捷方式notepad:)

或者通过ssh或在没有GUI的机器上进行所有的编码;)

你可以得到一个原始的快乐黑客键盘(没有方向键),每次开始编辑时把你的(无线)鼠标放在你够不到的地方。

在现代vi (vim?)中,我发现真正令人困惑的一件事是输入模式允许命令模式的一些功能,但不是所有功能。当输入模式完全简化为“只覆盖,不可能移动光标”时,我感觉舒服多了,就像老Solaris vi所拥有的那样。真正的vi需要您大部分时间保持在命令模式。

话虽如此,现在已经没有必要学习vi了——emacs同样无处不在。:)

您要求获得一些好的技巧来帮助您度过vi文本编辑器的学习曲线。以前的许多答案建议您不要使用其他编辑器。我认为这是一个很好的建议。从更图形化的编辑器切换到vi需要改变心态。它需要从命令的角度思考,而不是从视觉变化的角度。

I used nothing but vi for many years and believe the only way you can be productive is to memorize the commands you regularly use. The way I did this was to make a short list of the most common keyboard commands. I grouped and color-coded these commands by function, i.e. Moving the Cursor, Editing, Searching, etc. I was careful to only include the most commonly used commands I did not know. The idea is to create a quick reference that is also an aid in memorization – not to replace the available help screens. Then I printed this list and taped it to the wall behind my monitor so I could see it easily. (The graphical cheat sheets you mentioned might work better for some, but are probably a better reference source than a memorization tool.)

Here's the key. As I became comfortable with one of the commands, I drew a line through it with a pencil. I could still see it if I needed it, but it was symbolic to me that I had mastered that command. That gave me confidence and motivation as I could see regular progress. Once I had most of them crossed off, I removed them and added some of the more rarely used commands. I continued this process until I was satisfied with my command of vi. I knew I had reached that point when I realized I had not crossed off any commands or even looked at the list in a long time.

几年前,我需要在一个UNIX平台上工作,其中vi是唯一可用的编辑器。我买了一本关于vi的袖珍参考书,但几乎没用过。最后,我像第一次使用vi一样做了清单,并把它们贴在墙上。到第一周结束时,我感到非常舒服,尽管我已经有五年没有使用vi了。

当你需要快速搜索一些东西时,把它们都放在一个页面上会有所帮助。