Visual Studio 的 viEmu 插件有何意义?

发布于 2024-07-16 08:16:52 字数 271 浏览 9 评论 0原文

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

现在,据我从 10 年前的短暂使用经历中了解到,它是一个原始的文本编辑器,在滚动条发明之前创建的屏幕底部有一个可编辑行,并有一些疯狂的快捷方式来克服这一限制。

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

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

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.

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?

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

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

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

发布评论

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

评论(11

为人所爱 2024-07-23 08:16:52

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

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

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

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

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.

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.

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't mean that being able to express yourself through your IDE 2x faster doesn't have an impact on your productivity as a programmer.

宛菡 2024-07-23 08:16:52

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

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

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

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

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

这样的事情有很多,我想你真的需要花一些时间来了解它有多么强大。一开始又慢又难用,这就是为什么很多人尝试了很短一段时间并认为“这很愚蠢,一切都变得更难”,但过了一会儿你开始思考动作,一切都开始变得简单。变得自动化,而且比使用“普通”编辑器快得多,正如我所说,我现在不能回去了。

The viEmu page itself has a pretty good article that might help to answer your question: Why, oh WHY, do those #?@! nutheads use 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:

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

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.

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.

情域 2024-07-23 08:16:52

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

现在关键点是:

  • Vim 命令分为名词、动词和修饰语。
  • 编辑是通过组合它们来执行的。

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

  • 名词:word、sentence、block、引号和大括号。
  • 动词:cchange、insert、visual、delete
  • 修饰语:inside、around、till

并说明如何混合它们:

  • 想要更改一个单词吗? cw
  • 相同,但光标位于单词中间? caw
  • 更改引号内的文本? ci",也更改引号吗?ca"< /kbd>
  • 删除函数体? di{
  • 删除直到第一个逗号吗? dt,
  • 删除直到第二个逗号吗? d2t,
  • 跳转到第一个逗号? t,
  • 选择单词? viw

另请注意所有命令如何很好地转换为自然语言:

  • delete word
  • change inside {

在 vi​​m 中,如果你学习一个新的动词、名词或修饰语,你可以轻松地与它混合和匹配你已经知道了。 所以基本上只学习一件事,你就会学会如何做很多不同的事情。

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

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

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

PS2。 我还建议将 Esc 键映射到 jjkk,其中让事情变得容易多了。

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

Now the crucial points are:

  • Vim commands are divided into nouns, verbs and modifiers.
  • Editing is performed by combining them.

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

  • Nouns: word, sentence, block, quotes and braces.
  • Verbs: cchange, insert, visual, delete
  • Modifiers: 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

Also notice how all commands nicely translate into natural language:

  • delete word
  • change inside {

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.

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

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

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.

P.S.2. I also recommend to map Esc key to jj and kk, which makes things a lot easier.

豆芽 2024-07-23 08:16:52

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

也许您无意中将其置于“ex模式”。 这很容易完成,但可能会造成混乱。

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.

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

冷血 2024-07-23 08:16:52

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

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

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.

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

耀眼的星火 2024-07-23 08:16:52

如果您需要灵感或想看看真正了解 Vim 用途的人,请查看 Gary Bernhardt 的 Python 中的字符串计算器 Kata,看看他吧! http://vimeo.com/8569257

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

独守阴晴ぅ圆缺 2024-07-23 08:16:52

我认为他们在 viEmu 主页上对你的问题有一个很长且可以接受的答案:

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

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

我大约半年前安装了viEmu。 但我不得不说(也许没有丰富的linux经验)我从来没有使用过它。 太陌生、太远、太复杂。

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

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

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

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

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

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

各自安好 2024-07-23 08:16:52

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

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

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.

Top 10 things Vi user need to know about Vim

清风无影 2024-07-23 08:16:52

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

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

因此,我认为对于已经了解 Vi 的人来说,最大的胜利是无需学习 VS.Net 即可高效工作。

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

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

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.

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

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

绝不服输 2024-07-23 08:16:52

我认为你真的应该尝试一下 Vim。
如果您十年前快速尝试过 Vi,我可能会理解您并不欣赏它。 乍一看,它并不是很用户友好。 实际上,当您开始对动作感到舒适并开始通过定制将其打造为您自己的动作时,它的真正力量就会显现出来。
一旦你熟悉了 Vim,你就会明白为什么它值得学习。

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.

诠释孤独 2024-07-23 08:16:52

其实我现在用VS只是为了调试。 使用 vim(真正的 vim,而不是 viemu)编码是一种更好的体验。

现在,我不会声称使用一种替代另一种会对生产力产生任何影响 - 毕竟我大部分时间都花在试图找出如何解决问题 - 输入代码是最容易的部分。

I actually use VS only for debugging these days. Coding with vim (real vim, not viemu) is just a better experience.

Now, I am not going to claim that using one over another makes any difference in productivity - after all I spend most of my time trying to figure out how to solve a problem - entering the code is the easy part.

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