学习 Vim 有什么好处?

发布于 2024-07-14 20:28:06 字数 444 浏览 9 评论 0 原文

作为一名程序员,我在键盘上花费了大量的时间,并且在过去的 12 年里我一直这样做,或多或少。 如果说有什么事情是我在这段时间里从未习惯过的,那就是我在编码时由于一些最常见的代码编辑任务而经历的这些恼人且几乎无意识的持续微中断。 诸如简单的副本和内容之类的事情 从不同的行(甚至同一行)粘贴,或者从当前位置向上或向下移动 1 或 2 行需要太多的打字或涉及使用箭头键......当我想要移动时,情况会变得更糟进一步 - 我最终使用了鼠标。 现在想象一下同样的场景,但在笔记本电脑上。

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

我想听听那些已经学会了它的人的意见,以及它是否最终成为你离不开的东西之一。

在工作中,我使用 VS2008、C# 和 R#,它们一起使编辑代码比以往更快、更容易,但即便如此,我认为我可以享受完全不使用鼠标的感觉。

甚至连箭头键都没有。

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.

I've always considered learning VIM but the amount of time needed to master it has always made me want to step back.

I'd like to hear from people who have learnt it and if it ends up being one of those things you cannot live without.

At work, I use VS2008, C# and R#, which together make editing code a lot faster and easier than ever, but even so I think I could enjoy not having to use the mouse at all.

And not even the arrow keys.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(30

且行且努力 2024-07-21 20:28:07

不要被命令的数量吓倒,我还没有见过最多使用超过几十个的人。 我发现它是不可或缺的,因为当我考虑代码时,我正在考虑文本,而转向考虑鼠标只会让我感到困惑。 我认为,最大的技巧是一次学习一点,然后毫不犹豫地尝试 - 撤消功能非常适合探索其行为。

另外,如果你深入了解,vim 是可以编写脚本的。 可能性实际上是无限的。

(是的,所有这些也适用于 emacs...)

Don't be scared off by the number of commands, I've not met anyone who used more than a couple dozen at most. I find it indispensable, because when I'm thinking about code I'm thinking about text, moving to thinking about mice just messes me up. The big tricks, I think, are to learn it a little at a time, and don't be hesitant to play around - the undo features is great for exploring its behaviors.

Also, if you get deeply into it, vim is scriptable. The possibilities are literally endless.

(Yes, all of this applies to emacs too...)

葬心 2024-07-21 20:28:07

我对我的文本板和 ecplise 世界很满意,直到我不得不开始使用在 Linux 下运行的服务器。 需要远程脚本编写和设置配置文件!

一开始很困难,但现在我可以轻松设置和调整我的服务器。

I was happy at my textpad and ecplise world until i had to start working with servers running under linux. Remote scripting and set up of config files was needed!

It was hard at the begining but now i can easily set up and tune up my servers.

似梦非梦 2024-07-21 20:28:07

您可能想学习 vim,因为您可能对已经使用的编辑器不满意。

你可能想学习 vim,因为很多人说它很酷。 看看你对这个问题有多少个答案。

我将提供学习 vim 的另一个原因。 它以其文档的质量和完整性而享有盛誉。 因此,只要您设法在帮助查询中添加正确的关键字,您就可以在其帮助系统中找到问题的大部分答案。

You might want to learn vim because you might not be happy with the editors you're already using.

You might want to learn vim because many people say it is cool. Just look how many answers you've got to this question.

I will provide an additional reason for learning vim. It has a reputation for the quality and the completeness of its docs. So you will find most answers to your questions in its help system as soon as you will manage to stick the proper keywords in your help queries.

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

jk Enter arrows
0 美元
WB
控制单元
控制
人机界面语言
fX FX tX TX , ;
%
GGG

mX 'X ''

还有更多,列举起来会很无聊。 其中许多都支持命令前的计数,例如 4j 向上移动 4 行。

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

这个设计相当给力。 它还可以减少或组织您需要学习的内容。
当然,第一步是学习一些光标移动命令。 比如说,一开始是8个或10个。 然后你就快完成了。

To learn vi(m) fast one must first understand the whole design.
Vim has a great set of cursor-movement commands, check a few (X is a character, # a digit):

j k enter arrows
0 $
w W b B
ctrolD crtolU
ctrolE ctrolY
H M L
fX FX tX TX , ;
%
gg G
n N
mX 'X ''

and many more it would be boring to enumerate. Many of these support a count before the command, like 4j to move 4 lines up.

Now, back to the design, you type a command like d for delete followed by a cursor movement and the command applies to the piece of text from the cursor position till the movement end. For example H moves to the top of the screen, dH deletes to the top of the screen and cH changes (replaces) to the top of the screen.

This design is quite powerful. It also reduces, or organizes, what you need to learn.
Definitively the first step is to learn a few cursor movement commands. Say,8 or 10 at first. Then you are almost done.

孤独患者 2024-07-21 20:28:07

恕我直言,学习新东西总是值得付出努力的。 我建议你打印一份备忘单并强迫自己日复一日地使用它。

Learning something new is always worth the effort, IMHO. I suggest you print out a cheat sheet and force yourself to use it day-in and day-out.

错爱 2024-07-21 20:28:07

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

  • Vi/Vim 可以在大多数 UNIX 系统上找到。
  • Vim 使您无需将手离开键盘即可轻松编码。
  • 如果您计划在基于 UNIX 的系统中配置任何内容,您可能会编辑相当多的配置文件,因此您需要学习基于终端的编辑器,其中 vim 是最好的编辑器之一(对不起 emacs)。
  • Vim 为几乎所有操作系统编译/预编译了二进制文件。 无需发布“我需要 [插入操作系统] 的文本伴侣替代品”,您将拥有 Vim!
  • 有很多好的插件可以添加很多功能,例如编辑器内的 cvs diff,尽管其中一些需要大量的修改。

另外,如果您发现自己喜欢 Vim 键绑定,还有一些 IDE 在其编辑器中包含用于简单命令的 vim 绑定,例如 科莫多编辑

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

Vim is definitely worth learning to partly summarize what has been stated previously here are the main reasons:

  • 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.

Also on a side note if you find you like the Vim key bindings, there are also IDEs which include vim bindings in their editors for simple commands, for example Komodo Edit.

For help on learning Vim, try typing 'vimtutor' into your terminal and follow the instructions. There is also a book which is particularly good Hacking Vim

人心善变 2024-07-21 20:28:07

不,学习 vim 比付出努力更值得。

No. Learning vim is worth more than the effort.

时光无声 2024-07-21 20:28:06

我使用 vi 和 vim 也有大约 20 年了,而且我仍在学习新东西。

David Rayner 的 Best of Vim Tips 网站是一个很好的列表,尽管一旦您掌握了一些技巧,它可能会更有用熟悉 vim。

我还想提一下 ViEmu 网站,该网站提供了一些关于 vi/vim 技巧,尤其是文章 为什么,哦为什么,那些疯子使用 vi? (存档版本)

I've been using vi and vim also for some 20 years, and I'm still learning new things.

David Rayner's Best of Vim Tips site is an excellent list, though it's probably more useful once you have some familiarity with vim.

I also want to mention the ViEmu site which has some great info on vi/vim tips and especially the article Why, oh WHY, do those nutheads use vi? (archived version)

终止放荡 2024-07-21 20:28:06

没有它我还能活吗? 容易地。

有用吗? 是的。

学习原因

  • vi 保证存在于所有 Unix 系统上,并且也存在于大多数 Linux 系统上。 这种广泛的覆盖面使得学习它是值得的。

  • 使用 vi 进行 sudo 编辑要快得多:

    $ sudo vi

  • 此外,GMail 使用 vi-ish 命令来选择 & 移动电子邮件!

你不必成为大师。

只需学习

基础知识:

  • 如何从命令模式切换到插入模式 i
  • 如何从插入模式切换到命令模式 Esc
  • 如何在命令模式下向上导航行 k
  • 如何在命令模式下向下导航一行 j
  • 如何在命令模式下向左导航一个字符 h
  • 如何向右导航一个字符 l
  • 如何保存文件 :wEnter(写入)
  • 如何退出而不保存(在命令模式下) :q!< kbd>Enter
  • 如何撤消 u
  • 如何重做 Ctrl+r
  • 您可以将写入和退出结合起来(在命令模式下): :wqEnter

从这里开始,剩下的只会让你更快。

Could I live without it? Easily.

Is it useful? Yes.

Reasons for Learning

  • vi is guaranteed to exist on all Unix systems and exists on most Linux ones as well. That kind of broad coverage makes learning it worth it.

  • It's much quicker to use vi for a sudo edit:

    $ sudo vi

  • Also, GMail uses vi-ish commands for selecting & moving emails around!

You don't have to be a master.

Just learn

The basics:

  • How to switch from command mode to insert mode i
  • How to switch from insert mode to command mode Esc
  • How to navigate up a line in command mode k
  • How to navigate down a line in command mode j
  • How to navigate left a character in command mode h
  • How to navigate right a character l
  • How to save a file :wEnter (write)
  • How to exit without saving (in command mode) :q!Enter
  • How to Undo u
  • How to Redo Ctrl+r
  • You can combine writing and quitting (in command mode): :wqEnter

From there the rest will just make you faster.

淡墨 2024-07-21 20:28:06

运行 vimtutor 只花了我 30 分钟,这足以熟悉与维姆。 每一秒都是值得的。

Running through vimtutor only took me 30 minutes, which was enough to get familiar with vim. It was worth every second of it.

不念旧人 2024-07-21 20:28:06

如果您是一名编辑大量文本的程序员,那么学习一个严肃的文本编辑器很重要。 您学习哪种严肃的文本编辑器并不是非常重要,很大程度上取决于您期望编辑的环境类型。

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

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

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

切换到其中任何一个的技巧是强迫自己按照预期的方式使用它们。 例如,在 vim 中,如果您手动执行多步骤过程中的每个步骤,或者使用箭头键或鼠标,那么可能有更好的方法来执行此操作。 停下你正在做的事情并查看一下。

如果您不做其他事情,请学习 vim 和 Emacs 的基本导航控件,因为它们随处可见。 例如,您可以在 Mac OS、大多数 Unix shell、Eclipse 等中的任何文本输入字段中使用 Emacs 样式控件。您可以在 less(1) 命令,位于 Slashdotgmail 等。

玩得开心!

If you're a programmer who edits a lot of text, then it's important to learn an A Serious Text Editor. Which Serious Text Editor you learn is not terribly important and is largely dependent on the types of environments you expect to be editing in.

The reason is that these editors are highly optimized to perform the kinds of tasks that you will be doing a lot. For example, consider adding the same bit of text to the end of every line. This is trivial in A Serious Text Editor, but ridiculously cumbersome otherwise.

Usually vim's killer features are considered: A) that it's available on pretty much every Unix you'll ever encounter and B) your fingers very rarely have to leave the home row, which means you'll be able to edit text very, very quickly. It's also usually very fast and lightweight even when editing huge files.

There are plenty of alternatives, however. Emacs is the most common example, of course, and it's much more than just an advanced text editor if you really dig into it. I'm personally a very happy TextMate user now after years of using vim/gvim.

The trick to switching to any of these is to force yourself to use them the way they were intended. For example, in vim, if you're manually performing every step in a multi-step process or if you're using the arrow keys or the mouse then there's probably a better way to do it. Stop what you're doing and look it up.

If you do nothing else, learn the basic navigation controls for both vim and Emacs since they pop up all over the place. For example, you can use Emacs-style controls in any text input field in Mac OS, in most Unix shells, in Eclipse, etc. You can use vim-style controls in the less(1) command, on Slashdot, on gmail, etc.

Have fun!

南汐寒笙箫 2024-07-21 20:28:06

绝对值得付出努力。

有一个明显的原因任何使用 Vi(m) 的人都会告诉您,还有另外两个原因人们似乎从未提及。

显而易见的是:

  1. vi 无处不在,而且功能极其强大,只要学习一次,您就可以在几乎任何有键盘的计算机上运用这种功能。

这些是学习 Vim 的鲜为人知的原因:

  1. 这并不像您想象的那么努力。 在 shell 中运行 Vim coach 一次(vimtutor ,或者在 Windows 中从开始菜单中的 Vim 文件夹运行它),你就已经在通往能力的路上了,从那里开始一切都是下坡路。 我已经达到了可以在工作中使用 Vim 的水平,而在不到一周的午餐时间内,工作效率不会受到任何明显的影响。

  2. 很有趣! 现在编辑文本对我来说就像一个游戏。 我非常喜欢它——仔细想想,这真是太荒谬了。

还有两个不学习 Vim 的充分理由:

  1. 它会让人上瘾,你会发现自己希望能够在所有中使用 Vim 命令> 你的计算能力,只要你不能计算就咒骂。 幸运的是,至少在某些情况下,有方法 获取 周围 < a href="http://vimperator.org/" rel="nofollow noreferrer">这个。

  2. 再说一遍,它会让人上瘾,虽然您不会因为实际使用 Vim 而损失任何生产力,但您会浪费时间寻找好的技巧来提高您的 Vim 体验甚至更好,并且阅读 Stack Overflow 上的 Vim 标签

It's definitely worth the effort.

There's one obvious reason that anyone who uses Vi(m) will tell you, and two others that people never seem to mention.

Here's the obvious one:

  1. vi is at once ubiquitous and incredibly powerful, and by learning it once, you gain the ability to exercise that power on pretty much any computer that has a keyboard.

And these are the lesser known reasons to learn Vim:

  1. It's not half as much effort as you think it's going to be. Run through the Vim tutor once (vimtutor at a shell, or in Windows run it from the Vim folder in the Start Menu), and you'll already be well on your way to competence, and it's all downhill from there. I was up to the level where I could use Vim at work without taking any noticeable productivity hit within less than a week's worth of lunchtimes.

  2. It's fun! Editing text is like a game to me now. I actively enjoy it--which is pretty ridiculous, when you think about it.

There's also two good reasons not to learn Vim:

  1. It's addictive, and you'll find yourself wishing you could use Vim commands in all your computing, and cursing whenever you can't. Fortunately, at least for some situations, there's ways to get around this.

  2. Again, it's addictive, and although you won't lose any productivity from actually using Vim, you will waste hours searching for good tips to make your Vim experience even better, and reading the Vim tag on Stack Overflow.

只涨不跌 2024-07-21 20:28:06

vim 或 emacs 绝对值得学习。 触摸打字也值得学习。 在这两种情况下,原因都是相同的:你的思维不再被将代码显示到屏幕上的机械过程所打断

至于如何开始,只需深入研究并开始使用 vim 来完成所有事情。

PS 关于 emacs-vs-vi 的争论是无休无止的。 我使用 emacs 已有 26 年了。 如果我今天重新开始,我会学习 vim,因为 (a) 它变得更好了,(b) 修饰键(Ctl-Alt-V,任何人)少了很多,而且 vim 用户似乎受到的打字伤害要少得多。

It's definitely worth learning either vim or emacs. It's also worth learning to touch-type. In both cases the reasons are the same: your thinking is no longer interrupted by the mechanical process of getting your code onto the screen.

As to how to start, just dive in and start using vim for everything.

P.S. The emacs-vs-vi debate is endless. I've been using emacs for 26 years. If I started again today I'd learn vim because (a) it's gotten better and (b) there are many fewer modifier keys (Ctl-Alt-V, anyone) and vim users seem to get much less typing injury.

新雨望断虹 2024-07-21 20:28:06

只需学习 16 个键的含义即可从 Vim 中获得良好的功能:ijkdbw9:q!%s/nNEsc。 您只需使用 i:wqEsc 即可完成基本操作。

您需要知道的前两个键是:Esc 带您进入命令模式(您开始的模式),i 带您进入插入模式(正常打字)。


要保存,您需要

  1. 退出输入模式 (Esc),
  2. 输入冒号 :
  3. 输入小写字母 w,然后输入 Enter

要保存并退出,您需要

  1. 退出输入模式 (Esc),
  2. 输入冒号 :
  3. 输入小写字母 wq,然后输入 Enter

要不保存并强制退出,您需要

  1. 退出打字模式 (Esc),
  2. 输入冒号 :
  3. 输入小写 q! 然后 Enter

要了解更多信息,您可以在命令行运行 vimtutor。 这是一堂中等长度、结构良好的课程。

超越 iEsc:您只需使用 jkwbd3:%s/nN 即可复制或超越某些 MS Word 功能。

  1. b 让您后退一个单词 (Ctrl+)
  2. w 让您前进一个单词 (Ctrl +)
  3. 9w 带您前进九个单词
  4. db 删除前面的单词 (Ctrl+< kbd>Backspace)
  5. d3b 删除前面的三个单词
  6. 9j 向下移动 9 行
  7. / ornithopter Enter 会将您带到单词“ornithopter”的下一个实例,然后将 nN 分别带到下一个和上一个出现的“ornithopter”。
  8. :%s/confounded/dangfangled/ Enter 将每个“confounded”替换为“dangfangled”(例如查找并替换所有) code> in MS Word)

其中任何一个都应该在“命令”模式(Esc)下运行,而不是插入模式(i)。

You can get good functionality out of vim by learning the meanings of only 16 keys: ijkdbw9:q!%s/nNEsc. You can do the bare bones with just i:wqEsc.

The first two keys you need to know are: Esc takes you to command mode (the mode you start in), and i takes you to insert mode (normal typing).


To save you need to

  1. get out of typing mode (Esc)
  2. type a colon :
  3. type lowercase w then Enter

To save-and-quit you need to

  1. get out of typing mode (Esc)
  2. type a colon :
  3. type lowercase wq then Enter

To not-save-and-force-quit you need to

  1. get out of typing mode (Esc)
  2. type a colon :
  3. type lowercase q! then Enter

To learn more you can run vimtutor at the command line. It's a medium-length, well-structured lesson.

Beyond i and Esc: you can replicate or surpass some MS Word functionality with only jkwbd3:%s/nN.

  1. b takes you back a word (Ctrl+)
  2. w takes you forward a word (Ctrl+)
  3. 9w takes you forward nine words
  4. db deletes the preceding word (Ctrl+Backspace)
  5. d3b deletes three preceding words
  6. 9j moves down 9 lines
  7. / ornithopter Enter takes you to the next instance of the word "ornithopter", then n and N to the next and previous occurrence of "ornithopter" respectively.
  8. :%s/confounded/dangfangled/ Enter substitutes every "confounded" with "dangfangled" (like find and replace all in MS Word)

Any of those should be run in "command" mode (Esc), not insert mode (i).

不奢求什么 2024-07-21 20:28:06

我最近转向了 VIM,我认为这是值得的。 如果您需要“只是完成某件事”,您可以始终保持插入模式,其中 vim (大部分)就像普通的文本编辑器。

我注意到,以前不困扰我的事情,比如伸手去拿方向键,现在感觉不对劲,而且太费力了。 它确实减少了我的手部动作和鼠标的使用,这对人体工程学和生产力都有好处

I recently switched to VIM, and I think it's worth it. If you need to "just get something done", you can always stay in insert mode, where vim is (mostly) like a normal text editor.

I've noticed that things that didn't use to bother me, like reaching for the arrow keys, now feel wrong and too much effort. It's definitely decreased my hand motion and usage of the mouse, which is good for both ergonomics and productivity

梦回旧景 2024-07-21 20:28:06

这取决于你想用 VIM 做什么。 仅仅因为很多人没有它就无法生活,所以学习它是没有意义的。

当我在 UNIX 环境中进行大量工作时,没有它我就无法生存。 即使UNIX机器上没有安装VIM,我至少可以使用vi。 您始终可以信赖它——即使机器不是您的(来自客户的)。

现在我用C#编程,主要在windows环境下工作。 我已经在我的电脑上安装了 VIM...但我不需要它。

评估您是否真的需要 VIM 以及它是否支持您的“工作流程”。 试试看。 玩它。 如果您认为需要它,请坚持下去......学习曲线非常陡峭。

It depends what you want to do with VIM. It doesn't make sense to learn it only because many people cannot live without it.

When I was working a lot on UNIX environments, I couldn't live without it. Even when VIM was not installed on a UNIX machine, I could at least use vi. You could always count on it -- even if the machine is not yours (that from the customer).

Now I program in C# and mostly work on windows environment. I have installed VIM on my PC ... and I don't need it.

Evaluate if you really need VIM and if it supports you in your "flow of work". Try it out. Play with it. If you think you need it, stick to it ... the learning curve is very steep.

清风无影 2024-07-21 20:28:06

我学习 vi 因为我不得不学。

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

这确实很痛苦,但值得。

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

当我必须去做一个项目时,我宁愿使用 IDE。 就我而言,IntelliJ idea 非常擅长这项任务,因为我可以在不抓住鼠标的情况下编写几个小时的代码。

我不知道VS2008有多少快捷键,但是如果它们像Eclipse一样容易被发现,我想你用vi就有麻烦了。

如果您不在 IDE 之外编辑代码,并且您的 IDE 有很好的快捷方式,那么您最好学习这些,然后无论如何都去学习 vi。

:)

I learnt vi because I had to.

My crazy teacher forced us to learn to program in C using a terminal to an AIX system.

It was a real pain, but worth it.

Today, I only use vi for quick edits or small programs.

When I have to go for a project, I rather use and IDE. In my case IntelliJ idea is very good at the task, because I can code for hours without grabbing the mouse.

I don't know how much shortcuts does VS2008 has, but if they are as discoverable as Eclipse, I think you are in trouble go for vi.

If you DON'T edit code outside the IDE and your IDE has good shortcuts, you better learn those, and then, go and learn vi anyway.

:)

围归者 2024-07-21 20:28:06

我使用 vi/vim 已有 25 年以上了。 如果您已经了解一些命令行编辑器,那么也许您不需要学习 vi/vim。 但如果您不太了解其他命令行编辑器,那么值得学习它。 毫不费力地在 vi/vim 中提高工作效率非常容易。

I've used vi/vim for 25+ years. If you already know some command-line editor, then maybe you don't need to learn vi/vim. But if you don't know any other command-line editors very well, it's worth learning it. It's pretty easy to be productive in vi/vim with little effort.

情话难免假 2024-07-21 20:28:06

我现在几乎只使用 VIM。

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

感谢 Viemu,我什至不需要再进行切换了。 它还不是完美的解决方案(代码补全有时不如原生 vim 优雅,宏录制也不完美),但比不断地来回切换要好得多。

Vim 的学习曲线可能有点夸张。 我认为一旦你进入其中,就会非常直观。

I use VIM pretty much exclusively now.

I used to use Vim for editing and VS Editor for debugging. This probably seems a bit crazy, but I found the Vi paradigm (macros, home key based editing etc) such a boost to my productivity, that editing in VS was paintful.

Thanks to Viemu, I don't even have to do the switching any more. It is not the perfect solution yet (code completion is sometimes not as elegant as in native vim and the macro recording isn't perfect), but it is much better than switching back and forth constantly.

The learning curve for Vim is probably exaggerated. I think once you get into it, it is pretty intuitive.

七堇年 2024-07-21 20:28:06

我的工作迫使我学会了 vim,它很快就成为了我的第二天性。 现在我的抱怨是关于没有 vim 模拟或插件的 IDE。 我确实注意到 esc 键在 vim 之外已经成为我的敌人。

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

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

My job forced me to pick up vim and it has quickly become second nature. Now my complaints are about IDE's that do not have vim emulation or plugins. I do notice that the esc key has become my enemy outside of vim.

I did find several emulators for vi within Visual Studio:

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

同尘 2024-07-21 20:28:06

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

除了管理方面的东西之外,如果您使用符合人体工学的键盘有效地使用 vim 输入法,它将是您对抗腕管的最佳防御手段。

了解 vim 的最佳方式是在家开始一个休闲项目,拔掉鼠标并用胶带粘住箭头键。

并阅读帮助

Firstly good vi(m) knowledge will save you the time you have to hustle to do emergency editing of config files on a server under seige. It can hold up on a laggy ssh connection.

Admin stuff aside vim's input method will be your best defence against carpal tunnel if you use it effectively with an ergonomic keyboard.

The best way to see the point of vim is to start a casual project at home, unplug your mouse and tape over your arrow keys.

And read the help

李不 2024-07-21 20:28:06

vi/vim 的两个优点:

  • 它非常轻量级

  • 它安装在几乎每个 *NIX 系统上

Two advantages of vi/vim:

  • it is very light-weight

  • it is installed on almost every *NIX system

心如荒岛 2024-07-21 20:28:06

我正在远程计算机上维护一个非常大的Linux项目。 无法选择使用 Eclipse 或类似的基于 GTK 的 IDE。 我已经在那里工作了 3 年。
我专门为这个项目设置了 vim。 并且仍在调整。

现在我可以通过 Vim 执行任何操作:源代码控制、sql、调试、编译、浏览 - 非常快速地浏览超过 1Gb 的源代码。

Visual Studio 或 Eclipse 无法处理所有这些。 如果我有选择,我不会将 Vim 更改为其他编辑器或 IDE。

I am maintaining a very big linux project on the remote computer. There is no choise to use Eclipse or similar GTK based IDE. I've been working there for 3 years.
And I set my vim just for this project. And still tweaking.

Now I can do any thing from the Vim: source control, sql, debug, compile, browsing - really fast browsing over 1Gb source code.

Visual Studio or Eclipse couldn't handle all of this. And If I had a choice I would'n change Vim to other editor or IDE.

冬天旳寂寞 2024-07-21 20:28:06

我学会了 Vim。 并没有付出太多的努力。 现在我绝对喜欢 ci" ci( CW V:s/from/to/g

I learned Vim. It wasn't too much effort. Now I absolutely love ci" ci( cw V:s/from/to/g

情独悲 2024-07-21 20:28:06

我想说 vim 绝对值得学习。 我去年夏天选择了它,现在它是我几乎所有内容的编辑器(java 是一个延伸,但当我不需要广泛的分析支持时是可行的)。 正如每个人都已经肯定的那样,它是一个非常高效的工具。

无论如何,我只从 图解教程,以及此处(长读),以及搜索和替换功能,我被迷住了。 从那时起我就开始学习一些东西,但都是在闲暇时。 我想说,学习曲线在这一点上趋于平缓,但后来,我大量使用它,并且周围的其他人也同样使用它。

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.

累赘 2024-07-21 20:28:06

我和你的情况一样,作为 Vim 的初学者,我最初发现它有点令人畏惧 - 学习曲线似乎很陡峭。
从我在短短几个小时内学到的东西来看,我已经感觉没有它我将无法生活。

此处 少数 a> 链接< /a> 我发现了有用的 Vim 截屏视频来向您展示它的功能。

Bram Moolenaar(Vim 的仁慈独裁者)在最后一个链接中给出的一个很好的建议是,尝试学习每一个命令和功能是低效的,只需弄清楚你正在做什么而不是做什么工作得很好,寻找一种方法让它更有效率,然后让它成为一种习惯。

I'm in the same situation as you, and as a beginner to Vim I originally found it a little daunting - the learning curve seems steep.
From what I've learned in just a few hours I'm already feeling like I won't be able to live without it.

Here are a few links that I've found for useful Vim screencasts to show you what it's capable of.

A good bit of advice that Bram Moolenaar (benevolent dictator of Vim) gave in that last link is that it would be inefficient to try to learn every single command and function, just figure out what it is that you're doing that isn't working very well, look for a way to make it more efficient and then make it a habit.

仅一夜美梦 2024-07-21 20:28:06

是的,一定要花时间学习至少一点“vi”和“vim”。 它行驶得很好。

当您面对您没有安装能力的客户 Unix/Linux/Mac 系统时,您永远不会陷入困境。 即使在 Windows 上(如果您有安装功能),“Vim”也是免费且易于安装的。 (而不是纯粹将您的学习曲线投入到像 UltraEdit 这样的东西上,尽管优秀的编辑器可能并不总是适合您......)。

学习 vi 可以帮助您学习其他工具,例如“sed”和一般的正则表达式:通常可以转移的东西。

另外,如果你想成为一个真正的极客,你只需要知道“vi/m”,否则你会看起来像个骗子;-)

Yes, definately take the time to learn at least a bit of 'vi' and 'vim'. It travels very well.

You'll never be stuck when you are faced with a customer Unix/Linux/Mac system that you don't have install capabilities for. Even on Windows (if you do have install capabilities) 'Vim' is free and easy to install. (As opposed to investing your learning curve purely in something like UltraEdit, which although an excellent editor might not be available for you all the time...).

Learning vi can set you up for learning other tools like 'sed', and regex in general: stuff that is generally transferable.

Plus if you want to be a proper geek, you just simply need to know 'vi/m' or you'll look like a faker ;-)

放肆 2024-07-21 20:28:06

我认为学习 vim 绝对值得花时间和精力。 对我来说,它使文本输入和导航变得如此高效,很难想象回到 emacs 或 ctrl/shift/alt/meta 组合键。

不要被 vim 的所有奇特功能吓倒。 一旦你足够多地使用它,你就会找出你最常使用哪些命令,并且你会找出你可以忘记哪些事情。

I think it's definitely worth the time and effort to learn vim. To me, it makes typing and navigating around text so efficient, it's hard to imagine going back to emacs or ctrl/shift/alt/meta key combos.

Don't get intimidated by all the fancy features of vim. Once you've used it enough, you'll figure out which commands you use the most, and you'll figure out which things you can forget about.

英雄似剑 2024-07-21 20:28:06

Vim 令人惊奇的普遍存在,以及 Vi-clones 更令人惊奇的普遍存在,仅在 Unix 系统上就足以使其值得学习。

除此之外,我真的认为整个 Vi 风格的思维让我的工作效率更高了。 对于不习惯命令模式和插入模式等模式的人来说,仅仅为了插入文本就必须进入模式似乎有点过分。 但是,当一个人使用 Vim 几个月,并且学到了很多提示和技巧时,Vim 似乎是一项值得的资产。

当然,Emacs 人群对于 Emacs 风格的思维也有同样的看法,但我放弃了学习 Emacs,因为 Vim 更简单并且可以帮我完成这项工作。

The amazing ubiquity of Vim, and the even more amazing ubiquity of Vi-clones in general, on Unix systems alone is enough to make it worth learning.

Besides that, the whole Vi-style thinking is something that I really think has made me a bit more productive. For a person not used to modes such as the command mode and insert mode, it seems a bit excessive to have to enter a mode just to insert text. But, when one has been using Vim for a few months, and has learned quite a few tips and tricks, Vim seems to be an asset that seems to be worth it.

Of course, the Emacs crowd says the same thing regarding Emacs-style thinking, but I gave up on learning Emacs because Vim was simpler and did the job for me.

陈独秀 2024-07-21 20:28:06

在看到一个非常熟练使用 vi 的人以惊人的速度进行编辑后,我学会了喜欢 vi。 你真的可以用它快速编码。 我喜欢它的另一个原因是,有时我发现在 IDE 中移动鼠标一段时间后真的会伤害我的手,而 vi 提供了一个很好的改变。 正如其他人提到的,它几乎总是在 UNIX 系统上可用,并且即使在糟糕的连接上也能正常工作。

我没有看到提到的一件事是,了解 vi 在某些圈子中具有“极客信誉”的额外好处。 我能想到至少有一些人在看到新程序员启动 nedit 对文件进行一些更改时会咯咯地笑。

I learned to like vi after watching someone who was very skilled with it navigate around to make edits at an insanely fast clip. You really can code quickly with it. Another reason I like it is that sometimes I find that mousing around in an IDE really hurts my hands after a while and vi provides a nice change. As others have mentioned it's also almost always available on unix systems and works well even over lousy connections.

One thing that I haven't seen mentioned is that knowing vi has the added benefit of "geek cred" in some circles. I can think of at least a few people who chuckle when they see a new programmer fire up nedit to make some changes to a file.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文