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

我相信。

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

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

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

更新(2009年4月)

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

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


当前回答

每次你在做一项复杂的编辑任务时,都要思考是否有更有效的方法来完成它。大多数情况下,当您可以用简单的术语描述它时(如“交换文本段落”或“删除注释行中X字符后面的所有内容”),您只需在vim中敲击几下键就可以完成。

有一些关键特性非常有用,你会一直用到它们。我最喜欢的是:

方块选择(Ctrl-V) 宏记录(q) 虚拟编辑(:set ve=all) 正则表达式 连接到外部Unix程序 键映射 自动补全(C-p, C-x C-p, C-x C-f) 操作+移动组合(这是非常强大的)

询问其他程序员他们认为最有用的功能是什么,然后采用那些更适合你大脑的功能。从别人的。vimrcs中窃取想法(这是我的)

其他回答

当我还很小的时候(11岁),我的家人搬到德国住了几年。我能够通过沉浸式学习语言——我别无选择,只能说这门语言(尽管如果我在一个可怕的情况下,我可以找到一个会说英语的人)。

我的建议是你也这样做——除非你处于绝对绝望的境地。“好吧,我刚刚删除了/etc/passwd,需要放回root”),有意识地决定尽你最大的努力使用vi。实际上,如果你愿意,学习基本知识并不需要那么长时间。

正如其他人所说,

vim-tutor

可以作为一个很好的起点,就像这张照片一样。

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

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

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

十多年前我在攻读硕士学位时学习了vim/vi。当时我唯一能使用的机器是Sun Sparc站(我想是Sparc 20)。vi是唯一在上面的东西。因此,您可以做的一件事是“强迫”自己卸载您拥有的任何其他编辑器!

两件事将大大提高你的vi技能:

练习,练习,再练习 Nethack