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

我相信。

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

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

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

更新(2009年4月)

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

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


当前回答

不久前,我写了一篇使用Vim进行高效编辑的指南。你会发现它很有用。

我会退一步问自己“为什么我想要学习这个编辑器?”是什么让我认为它会比我现在的文本编辑器更快或更好?”然后学习那些使Vi(m)对您不可或缺的特性。

例如,Vim的CTags集成对我来说是完全不可或缺的。我使用的是一个非常非常大的代码库,在一次击键中跳转到函数或类定义的能力(不管它在哪个文件中)绝对是一个杀手级特性,没有它我就很难工作。

使用.vimrc文件来创建宏,使常见任务自动化。

你的自动编辑选择器会选择一个最快完成工作且花费最少脑力的编辑器。一点准备工作将确保编辑器是Vim。: -)

其他回答

ESC gg=G重缩代码和:retab将制表符转换为空格或空格转换为制表符是吸引我到vim的原因。所以实际上你不需要被迫使用它,你只需要学习什么时候它可以帮助你提高速度。

通过vimtutor。

开始使用vim进行简单的编辑,比如配置文件或html。根据需要学习命令。

在谷歌中搜索一个好的。vimrc,这个人使用的工具链与你的类似。打开语法高亮显示。找一个漂亮的配色方案。

学习宏,因为Vim最适合自动化任务和代码片段插入,比如将几个单词格式化为复杂的XML标记或将CSV转换为HTML表。

这些年来,我一直断断续续地使用vim(偶尔做一些系统管理工作)。我最近才开始花更多的时间在里面做我的编程工作。我建议也从gvim开始。它与大多数操作系统环境集成得很好,(甚至更好),当你需要时,你可以回到鼠标:)。

要开始使用vim,运行一次或两次vimtutor(与gVim捆绑在一起)(大约需要一个小时)。我不能夸大它对我的帮助!尤其是第一部分,关于在文档中移动的不同方式,以及如何用运动命令记录编辑动作,等等。在那之后,事情就会清楚得多。

然后,开始对它进行快速、小的编辑(替换记事本的东西),直到你能舒服地快速进行有用的剪辑。然后试着在里面做你的日常工作。你会发现自己非常渴望在其他编辑器中使用“重复最后一个动作”命令!

您要求获得一些好的技巧来帮助您度过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了。

虽然我是vi的忠实粉丝,特别是vim,但有很多功能强大的编辑器,你不应该觉得你必须使用vi,或者它在某种程度上是某种绝对完美的编辑器,因为它不是。

If you have to force yourself to use vi, I would be concerned that you don't feel productive using it. However, if you insist on persisting, I would probably just make sure I used vi for every single editing task. Whenever I need to do something and I don't quite no the best way to do it, I'd try to find the optimal (in terms of minimal keystrokes) to do it in vi after I did it a non-optimal normal way. I'd then make a post-it note with this little tip (or maybe just a text file) so I would remember it for next time.

随着时间的推移,您使用vi的效率将显著提高。

你可以在网上找到许多Vi/Vim备忘单,打印出来,强迫自己坚持几周。

一旦你学会了一些基本的命令,你就会非常有效率。从那里开始,只要坚持不懈,每隔一段时间学习一个新命令。你不可能学会所有的vi命令。我相信vi命令比宇宙中的原子还多!!:)