As a programmer I spend a lot of hours at the keyboard and I've been doing it for the last 12 years, more or less. If there's something I've never gotten used to during all this time, it's these annoying and almost unconscious constant micro-interruptions I experience while coding, due to some of the most common code editing tasks. Things like a simple copy & paste from a different line (or even the same line), or moving 1 or 2 lines up or down from the current position require too much typing or involve the use of the arrow keys ...and it gets worse when I want to move further - I end up using the mouse. Now imagine this same scenario but on a laptop.

我一直在考虑学习VIM,但掌握它所需的时间总是让我想后退一步。

我想听听那些学会了它的人的意见,如果它最终成为你生活中不可或缺的东西之一。

在工作中,我使用VS2008, c#和r#,它们一起使编辑代码比以前更快更容易,但即使如此,我认为我可以享受根本不需要使用鼠标。

甚至连方向键都没有。


当前回答

我现在几乎只使用VIM。

我以前使用Vim进行编辑,使用VS Editor进行调试。这可能看起来有点疯狂,但我发现Vi模式(宏,基于home键的编辑等)对我的工作效率有很大的提高,在VS中编辑是很痛苦的。

多亏了Viemu,我甚至不用再做切换了。它还不是完美的解决方案(代码完成有时不像原生vim中那样优雅,宏记录也不完美),但它比不断地来回切换要好得多。

Vim的学习曲线可能被夸大了。我认为一旦你进入它,它是相当直观的。

其他回答

I'd say vim is definitely worth learning. I picked it up last summer, and it is now my editor of choice for just about everything (java is a stretch, but doable when I don't need extensive analysis support). As everyone has already affirmed, it is a wonderfully efficient tool. For what it's worth, I only learned a fairly small subset of vim's features (which took a day or two) from a graphical tutorial, and a few odds and ends from here (long read), and the search and replace functionality, and I was hooked. I've learned things since then, but at my leisure. I'd say the learning curve flattens out at this point, but then, I was using it pretty heavily and was surrounded by others who were, too.

我学过Vim。这并不费劲。现在我绝对喜欢ci”ci(cw V:s/from/to/g

我的工作迫使我学习vim,这很快就成为了我的第二天性。现在我抱怨的是没有vim仿真或插件的IDE。我注意到esc键已经成为我在vim之外的敌人。

我确实在Visual Studio中找到了几个vi模拟器:

http://code.google.com/p/vim-visual-studio/

如果你是一个编辑大量文本的程序员,那么学习一个严肃的文本编辑器是很重要的。你学习哪种严肃文本编辑器并不是特别重要,它在很大程度上取决于你期望在其中编辑的环境类型。

原因是这些编辑器经过高度优化,可以执行您将经常执行的各种任务。例如,考虑在每行末尾添加相同的文本位。这在一个严肃的文本编辑器中是微不足道的,但在其他方面却非常麻烦。

通常vim的杀手特性被认为:A)它在你遇到的几乎所有Unix上都可用;B)你的手指很少需要离开主行,这意味着你可以非常非常快地编辑文本。即使在编辑巨大的文件时,它也通常非常快速和轻量级。

然而,还有很多替代方案。Emacs是最常见的例子,当然,如果你深入研究它,它不仅仅是一个高级文本编辑器。在使用vim/gvim多年后,我个人现在是一个非常满意的TextMate用户。

切换到其中任何一种的诀窍是强迫自己按照它们的意图使用它们。例如,在vim中,如果您手动执行一个多步骤过程中的每一步,或者如果您使用方向键或鼠标,那么可能有更好的方法来完成它。停下手头的工作去查一下。

如果不做其他事情,可以学习vim和Emacs的基本导航控件,因为它们会到处弹出。例如,你可以在Mac OS、大多数Unix shell、Eclipse等任何文本输入字段中使用emacs风格的控件。你可以在less(1)命令、Slashdot、gmail等中使用vim风格的控件。

玩得开心!

我已经使用vi/vim超过25年了。如果你已经知道一些命令行编辑器,那么你可能不需要学习vi/vim。但是如果您不太了解其他命令行编辑器,那么学习它是值得的。在vi/vim中很容易轻松地提高效率。