visual-studio Visual Studio 的 viEmu 插件有什么意义?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/719735/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-22 10:20:34  来源:igfitidea点击:

What's the point of viEmu plugin for Visual Studio?

visual-studiovimviviemu

提问by zvolkov

This may sound a bit provocative but it actually is a real question. Feel free to edit if you don't like the tone.

这听起来可能有点挑衅,但实际上这是一个真实的问题。如果您不喜欢这种语气,请随时进行编辑。

Now, as much as I understand vi from my short experience with it like 10 years ago, it's a primitive text editor with one editable line at the bottom of the screen created before the scrollbars were invented, with some crazy shortcuts to overcome this limitation.

现在,就我 10 年前对 vi 的短暂体验而言,我对 vi 的理解是,它是一个原始文本编辑器,在滚动条发明之前创建的屏幕底部有一个可编辑的行,并有一些疯狂的快捷方式来克服这个限制。

Can somebody explain me how one can be more productive with it than with, say normal VS.NET editor? Moreover, why would anybody want to use viEmu which supposedly turns your VS.NET into an ancient vi?

有人可以解释一下如何使用它比使用普通的 VS.NET 编辑器更有效率吗?此外,为什么有人想要使用 viEmu,据说它会将您的 VS.NET 变成古老的 vi?

I'm willing to give it a try but I need some motivation to overcome the learning curve.

我愿意尝试一下,但我需要一些动力来克服学习曲线。

回答by mmcdole

It honestly sounds like you have never seen someone use Vi who is truly proficient in it. When you normally use Visual Studio you frequently will move your hand over to your mouse, click through options, dialogs, classes, etc.

老实说,您从未见过真正精通 Vi 的人使用 Vi。当您通常使用 Visual Studio 时,您会经常将手移到鼠标上,单击选项、对话框、类等。

With ViEmu your hand never leaves the keyboard. You are compiling, switching files, highlighting groups of text, fixing indentation, performing complex motions on your code and running regular expression searches in seconds. For people who are fast typists it allows you to achieve a speed for tasks you would not be able to otherwise.

使用 ViEmu,您的手永远不会离开键盘。您正在编译、切换文件、突出显示文本组、修复缩进、在代码上执行复杂的动作并在几秒钟内运行正则表达式搜索。对于打字速度快的人来说,它可以让您以其他方式无法完成的任务实现速度。

Many people will counter this by saying things like, "Most of my development time is spent thinking. The extra speed I gain from using tools like these is negligible.".

许多人会反驳说,“我的大部分开发时间都花在思考上。我从使用这些工具中获得的额外速度可以忽略不计。”。

That is a non-argument in my opinion. It is true, for most large programming tasks you spend far more time planning and thinking then you do actually slinging code. But that doesn'tmean that being able to express yourself through your IDE 2x faster doesn't have an impact on your productivity as a programmer.

这在我看来是不争的事实。确实,对于大多数大型编程任务,您花在计划和思考上的时间要多于实际执行代码的时间。但这并不意味着能够以 2 倍的速度通过 IDE 表达自己不会影响您作为程序员的生产力。

回答by Chad Birch

The viEmu page itself has a pretty good article that might help to answer your question: Why, oh WHY, do those #?@! nutheads use vi?

viEmu 页面本身有一篇很好的文章,可能有助于回答您的问题:为什么,哦,为什么,做那些 ​​#?@! 疯子们使用vi?

I've spent the last couple months trying to teach myself to use vim "properly" and now I can hardly stand using other editors because they seem underpowered and clunky. For a random example, imagine you have a line of code that looks like this:

在过去的几个月里,我一直试图自学“正确”使用 vim,现在我几乎无法忍受使用其他编辑器,因为它们似乎功能不足且笨拙。对于随机示例,假设您有一行代码,如下所示:

$welcomeMessage = "Welcome to SiteName!"; // shows at the top of homepage

In a normal editor, how would you change the string? You'd probably have to reach over and grab your mouse and carefully select it, or you'd move your cursor inside the first quotation mark, and hold down Shift and the right-arrow until you got to the closing quotation mark.

在普通编辑器中,您将如何更改字符串?您可能需要伸手抓住鼠标并仔细选择它,或者将光标移到第一个引号内,然后按住 Shift 和向右箭头直到到达结束引号。

In vim, with my cursor anywhere in-between the quotes, I type ci"and it erases everything inside the quotation marks and puts me into insert-mode so I can type the new value I want. My hands didn't even have to move from my normal typing position.

在 vim 中,我的光标位于引号之间的任何位置,我输入ci"并删除引号内的所有内容并将我置于插入模式,以便我可以输入我想要的新值。我的手甚至不必从我正常的打字位置移开。

There are so many things like this, I think you really have to spend a while using the editor to understand how powerful it is. It's very slow and hard to use at first, that's why a lot of people try it for a short time and think "this is dumb, everything is way harder", but after a while you start thinking in terms of the motions, it all starts to become automatic and it's much, much faster than using a "normal" editor. As I said, I can't go back now.

这样的东西太多了,我想你真的需要花点时间使用编辑器才能了解它的强大之处。一开始很慢而且很难用,这就是为什么很多人尝试了很短的时间并认为“这很愚蠢,一切都很难”,但过了一段时间你开始考虑动作,这一切开始变得自动,并且比使用“普通”编辑器快得多。正如我所说,我现在不能回去。

回答by Smilediver

I've also had trouble understanding why people choose vim as their editor, even though I was using it from time to time, until I've finally "got it". I think most explanations of "why?" fails, because they fail to show couple crucial points. To explain those points, first you need to understand that in vim you are manipulating text primarily being in command mode. Ie by default your key presses are commands, and do not usually insert any text, unless those commands (like append, insert, change) switch to insert mode. This lets you navigate and edit your text easily without ever touching your mouse or moving your hands away from "editing pose".

我也很难理解为什么人们选择 vim 作为他们的编辑器,即使我不时使用它,直到我终于“明白了”。我认为大多数关于“为什么?”的解释 失败,因为他们没有显示几个关键点。要解释这些要点,首先您需要了解在 vim 中您主要是在命令模式下操作文本。即默认情况下,您的按键是命令,通常不会插入任何文本,除非这些命令(如append、insert、change)切换到插入模式。这使您可以轻松导航和编辑文本,而无需触摸鼠标或将手从“编辑姿势”上移开。

Now the crucial points are:

现在的关键点是:

  • Vim commands are divided into nouns, verbs and modifiers.
  • Editing is performed by combining them.
  • Vim 命令分为名词、动词和修饰语。
  • 编辑是通过组合它们来执行的。

And this is what gives vim the power. To ilustrate the point, here are some most used commands:

这就是赋予 vim 力量的原因。为了说明这一点,以下是一些最常用的命令:

  • Nouns: word, sentence, block, quotes and braces.
  • Verbs: cchange, insert, visual, delete
  • Modifiers: inside, around, till
  • 名词:word、sentence、block、引号和大括号。
  • 动词:cchange ivnsert、isual、delete
  • 修饰符:inside、around、till

And to ilustrate how you can mix them:

并说明如何混合它们:

  • Want to change a word? cw
  • Same, but cursor in the middle of the word? caw
  • Change text inside quotes? ci", also change quotes? ca"
  • Delete function body? di{
  • Delete up till first comma? dt,
  • Delete up till second comma? d2t,
  • Jump to first comma? t,
  • Select word? viw
  • 想换个词? cw
  • 一样,但是光标在单词中间? caw
  • 更改引号内的文本?ci",还要改引号?ca"
  • 删除函数体? di{
  • 删除直到第一个逗号? dt,
  • 删除到第二个逗号? d2t,
  • 跳到第一个逗号? t,
  • 选词? viw

Also notice how all commands nicely translate into natural language:

还要注意所有命令如何很好地翻译成自然语言:

  • delete word
  • change inside {
  • d删除w顺序
  • c焊割in面{

In vim if you learn a new verb, noun or modifier, you can easily mix and match with what you already know. So basically learning just one thing, you learn how to do a lot of different things.

在 vim 中,如果你学习一个新的动词、名词或修饰语,你可以很容易地混合和匹配你已经知道的东西。所以基本上只学习一件事,你就会学习如何做很多不同的事情。

Another great thing is that vim remembers what commands you have used, and you can repeat the sequence just by pressing .. For this post I've had to surround a lot of letters with <kbd> tag. But I've did that only once, and then just went over each letter and pressed ..

另一个很棒的事情是 vim 会记住您使用过的命令,您只需按 就可以重复该序列.。对于这篇文章,我不得不用 <kbd> 标签包围很多字母。但我只这样做过一次,然后只是检查每个字母并按.

And that's basically the thing you "need to get" to understand the power of vim and become advanced user overnight.

这基本上是您“需要”了解 vim 的强大功能并在一夜之间成为高级用户的事情。

P.S. if you don't like vim because it's console based and want a modern text editor, then I suggest looking into Sublime Text editor, which is a great editor and also supports vim mode.

PS 如果你不喜欢 vim 因为它是基于控制台的并且想要一个现代的文本编辑器,那么我建议你看看 Sublime Text 编辑器,它是一个很棒的编辑器,也支持 vim 模式。

P.S.2. I also recommend to map Esckey to jjand kk, which makes things a lot easier.

PS2。我还建议将Esckey映射到jjand kk,这会让事情变得容易得多。

回答by finnw

You are wrong about "one editable line at the bottom of the screen." All the text in the window is editable. And it does scroll (all versions) and in the case of gvim, has scrollbars.

您对“屏幕底部的一个可编辑行”的看法是错误的。窗口中的所有文本都是可编辑的。它确实滚动(所有版本),在 gvim 的情况下,有滚动条。

Maybe you inadvertently put it in "ex mode". This is easily done and can be confusing.

也许你不经意间把它置于“ex 模式”。这很容易完成,但可能会令人困惑。

回答by finnw

Another answer got me thinking that watching some skilled editing using vim would be pretty revealing so I dug up this video showing basic and more advance motions while coding. This person could get even a bit efficient using some marks, etc but it gives an idea.

另一个答案让我想到使用 vim 观看一些熟练的编辑会很有启发性,所以我挖了这个视频,显示编码时的基本和更高级的动作。这个人可以使用一些标记等来提高效率,但它提供了一个想法。

http://www.youtube.com/watch?v=FcpQ7koECgk&feature=related

http://www.youtube.com/watch?v=FcpQ7koECgk&feature=related

回答by 7wp

If you need inspiration or want to see someone who really knows what they are doing with Vim, check out Gary Bernhardt's String Calculator Kata In Python, look at him go! http://vimeo.com/8569257

如果您需要灵感或想见见真正知道如何使用 Vim 的人,请查看 Gary Bernhardt 的 String Calculator Kata In Python,看看他吧!http://vimeo.com/8569257

回答by boj

I think they have a long and acceptable answer for your question on the viEmu hompage:

我认为他们在 viEmu 主页上为您的问题提供了一个很长且可接受的答案:

One other even more powerful example: let's take the 'ce' command, which is composed of 'c' and 'e'. The 'c'hange command deletes the range specified by the next motion command, and also enters insert mode. It's the same as 'd', but with the distinction that it enters insert mode, instead of staying in normal mode. The boon is that the text you type in the next (short) input session is also part of the command. So if you do 'ceHello>', what you do is replace from the cursor to the end of the word by 'Hello', and the '.' command afterwards will work exactly like that: replace up to the end of the word with 'Hello'.

另一个更强大的例子:让我们以“ce”命令为例,它由“c”和“e”组成。'c'hange 命令删除下一个运动命令指定的范围,并进入插入模式。它与 'd' 相同,但区别在于它进入插入模式,而不是停留在正常模式。好处是您在下一个(短)输入会话中键入的文本也是命令的一部分。因此,如果您执行 'ceHello>',您所做的就是将光标到单词末尾的位置替换为 'Hello' 和 '.'。之后的命令将完全像那样工作:将单词的末尾替换为“Hello”。

From: http://www.viemu.com/a-why-vi-vim.html

来自:http: //www.viemu.com/a-why-vi-vim.html

I have viEmuinstalled ~half year ago. But I have to say (maybe without strong linux experiences) I've never used it. Too alien, too far, too complex.

我在半年前安装了viEmu。但我不得不说(也许没有强大的 linux 经验)我从未使用过它。太陌生,太远,太复杂。

So IMHO viEmuit's a great technical&historical challenge but no more for the 95% of the developers.

所以恕我直言,viEmu这是一个巨大的技术和历史挑战,但对于 95% 的开发人员来说不再是了。

回答by bywronski

Basically with Vi (or ViM) you get faster because you don't need to touch the mouse and the key-map is improved (this represent learning curve cost but worth the effort) for do any text manipulation in a very easy way once that the fundamentals are learned.

基本上使用 Vi(或 ViM)你会变得更快,因为你不需要触摸鼠标并且键映射得到改进(这代表学习曲线成本但值得付出努力)以非常简单的方式进行任何文本操作基本功都学好了。

Top 10 things Vi user need to know about Vim

Vi 用户需要了解的关于 Vim 的 10 件事

回答by Taurus Olson

I think you really should give Vim a try.
If you quickly tried Vi ten years ago, I may understand you didn't appreciate it. It's not really user-friendly at first sight. Actually its real power is revealed when you start feeling comfortable with the movements and start making it your own with customisation. Once Vim is familiar to you you may understand why it deserves to be learnt.

我认为你真的应该试试 Vim。
如果你在十年前快速尝试 Vi,我可能会理解你不喜欢它。乍一看,它并不是真正的用户友好型。实际上,当您开始对动作感到满意并开始通过自定义使其成为您自己的动作时,它的真正力量就会显现出来。一旦你熟悉 Vim,你就会明白为什么它值得学习。

回答by John Nilsson

I have not experience with VS.Net but I guess it has the same features that any other IDE has.

我没有使用 VS.Net 的经验,但我想它具有与任何其他 IDE 相同的功能。

I have found that learning the all the key commands of the editor in my IDE was a sufficient replacement for Vi. Things like renaming, indenting, formatting, moving lines and that kind of stuff.

我发现在我的 IDE 中学习编辑器的所有关键命令足以替代 Vi。诸如重命名、缩进、格式化、移动线条之类的东西。

So I guess the major win would be for someone who already know Vi to be productive without having to learn VS.Net.

所以我想最大的胜利是那些已经知道 Vi 的人无需学习 VS.Net 就可以提高工作效率。

But then again, Vi has some truly esoteric but powerful features that probably can't be matched by you standard IDE editor.

但话又说回来,Vi 有一些真正深奥但功能强大的功能,这些功能可能是您的标准 IDE 编辑器无法比拟的。