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#,它们一起使编辑代码比以前更快更容易,但即使如此,我认为我可以享受根本不需要使用鼠标。

甚至连方向键都没有。


当前回答

恕我直言,学习新东西总是值得努力的。我建议你打印一张小抄单,强迫自己日复一日地使用它。

其他回答

要快速学习vi(m),首先必须理解整个设计。 Vim有一组很棒的光标移动命令,检查一些(X是一个字符,#是一个数字):

J k进入箭头 0美元 w w b b ctrolD crtolU ctrolE ctrolY H m l fX fX tX tX,; % gg G n n mX 'X”

还有很多,要一一列举是很无聊的。其中许多工具都支持在命令之前添加计数,比如用4j向上移动4行。

现在,回到设计中,键入一个命令,如d,用于删除,然后移动光标,该命令应用于从光标位置到移动结束的文本段。例如,H移动到屏幕顶部,dH删除到屏幕顶部,cH更改(替换)到屏幕顶部。

这个设计很强大。它还可以减少或组织你需要学习的内容。 毫无疑问,第一步是学习一些光标移动命令。比如说,一开始是8到10个。那么你就差不多完成了。

就我个人而言,

我发现许多终端文本编辑器有时无能为力。我会花时间买一个吗?绝对的!我将继续学习一个IDE。当然,最终还是要看个人喜好。

我学vi是因为我必须学。

我那疯狂的老师强迫我们学习用C语言在AIX系统上用终端编程。

这真的很痛苦,但值得。

今天,我只在快速编辑或小程序时使用vi。

当我必须去做一个项目时,我宁愿使用IDE。在我的案例中,IntelliJ idea非常适合这个任务,因为我可以在不抓鼠标的情况下编写数小时的代码。

我不知道VS2008有多少快捷方式,但如果它们像Eclipse一样容易被发现,我认为你有麻烦了,去vi吧。

如果你不在IDE外编辑代码,而你的IDE有很好的快捷方式,你最好学习这些,然后,无论如何,去学习vi。

:)

首先,良好的vi(m)知识将节省您在被围困的服务器上紧急编辑配置文件的时间。它可以支持延迟的ssh连接。

管理的东西除了vim的输入法将是你最好的防御腕管,如果你有效地使用它与人体工程学键盘。

要了解vim的意义,最好的方法是在家里开始一个休闲的项目,拔掉鼠标插头,用胶带遮住方向键。

阅读帮助

Vim绝对值得学习,以下是部分总结前面所述的主要原因:

Vi/Vim can be found on most unix systems. Vim allows you to easily code without taking your hands off the keyboard. If you plan you configure anything in a unix based system likelihood is you going to be editing a fair few config files, therefore you'll want to learn a terminal based editor, of which vim is one of the best (sorry emacs). Vim compiles/has precompiled binaries for almost every OS out there. No need to post "I need a textmate alternative for [insert OS]", you'll have Vim instead! There are a lot of good plugins out there to add alot of functionality, such as in-editor cvs diffs, although some of these require a fair amount of tinkering.

另外,如果您喜欢Vim键绑定,也有一些ide在它们的编辑器中包含了Vim绑定,用于简单的命令,例如Komodo Edit。

要获得学习Vim的帮助,请尝试在终端中输入'vimtutor'并按照说明进行操作。还有一本书是特别好的Hacking Vim