与任何其他 IDE 或文本编辑器相比,使用 emacs、vim 和 nano 等有什么好处?

发布于 2024-09-30 13:33:52 字数 108 浏览 5 评论 0原文

从我所看到的来看。 emacs 等..在终端中运行。这有什么好处吗?看来写东西和整理东西会比较麻烦。我并不是想变得主观,我对 emacs、vim、nano 等一无所知。并且想了解更多,也许使用其中之一。

From what Ive seen. emacs etc.. run in terminal. Is there any benefit to this? It seems that it would be more of a hassle to write and organize things. I'm not trying to be subjective I literally know nothing of emacs, vim, nano etc.. and would like to know more, maybe use one of them.

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

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

发布评论

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

评论(9

仄言 2024-10-07 13:33:52

你的问题很难回答。即使它们确实在终端中运行,这也不是它们的主要优势。我现在谈论的是 Emacs 和 Vim。简而言之,它们已经存在了至少 20 年 (Vim) 或更长时间 (Emacs),它们有一个非常活跃的社区,它们是可编写脚本的,所以如果您知道如何使用它们,您可以用它们做几乎任何事情。非常强大。

它们有一个相当大的学习曲线,所以你可能最终会在它们中摸索数周,甚至数月,然后才能熟练。学习它们的主要动机是生产力。与记事本相比,您可以通过最少的按键次数完成一些非常惊人的事情。

尝试一个。如果你喜欢它,坚持一段时间,忍受痛苦,然后你就会看到好处。这几乎就像去健身房一样。

Your question is a tough one. Even if they do run in terminal, it's not their primary advantage. I'm talking about Emacs and Vim right now. To be short, they've been around for at least 20 years (Vim) or more (Emacs), they have a pretty active community, they're scriptable so you can do pretty much anything with them if you know how and they're extremely powerful.

They have a pretty big learning curve, so you'll probably end up fumbling around in them for weeks, if not months, before becoming proficient. The primary motivation for learning them is productivity. You can do some pretty amazing things in a minimal amount of keystrokes compared to, let's say, Notepad.

Try one. If you like it, stick with it for some time, endure the pain and then you'll see the benefits. It's almost like going to the gym.

任性一次 2024-10-07 13:33:52

现在大多数人都使用 IDE。它们可以帮助您通过分析已经编写的内容来获得一些信息。这些东西可能非常有用和有帮助,但它们并不能真正帮助完成实际编辑代码的核心任务。工具制造商所指望的是,这些额外的东西所提供的好处足以超过 vim 和 emacs 作为编辑器的效率。他们在大多数社区中几乎赢得了这场战斗,主要是因为新开发人员面临着出色的代码完成和易于使用的重构支持之间的选择,而他们在大约 6 个月内不会看到任何好处的编辑器简单的方法。我知道我做到了。

我现在是一个 vim 人了。 Vim 似乎并没有真正具有相同的生产力上限,我已经使用它一年多了,并且仍然半定期地遇到一些我不知道的事情,这些事情让我更快。即使没有这个,我用它越多,对我正在做的事情的思考就越少,这又让我更快。此外,vim 适用于每种语言和平台,并且可以开箱即用地安装在任何 UNIX 服务器上。它没有任何加载屏幕,几乎可以跳到屏幕上,可以出色地处理大文件,并且永远不会减慢或崩溃。您通过它学到的技能将适用于您余下职业生涯中所做的一切,而 IDE 则不同,IDE 会随着您更换平台而发生变化。

Vim 是一项投资,但如果你谈论的是你几乎余生每天都会使用 8-10 小时的东西,那么学习曲线就完全无关紧要了。

Most people use IDEs nowadays. They help with things that you can get through analysis of things you have already written. That stuff can be very useful and helpful, but they don't really help with the core task of actually editing code. What toolmakers are banking on is that those extra things provide enough of a benefit that it will outweigh how effective vim and emacs are as editors. They have pretty much won that battle in most communities, mostly because new developers faced with a choice between great code completion and refactoring support that is simple to use, and an editor that they won't see any benefits from for about 6 months go the easy way. I know I did.

I am a vim guy now. Vim doesn't really seem to have the same upper bound of productivity, I have been using it for over a year and semi-regularly still run into things I didn't know about that make me faster. Even without that, the more I use it, the less thinking goes into what I am doing, which again, makes me faster. Also, vim exists for every language and platform, and is installed on any UNIX server out of the box. It doesn't have any load screens, virtually leaps on to the screen, works fantastically with large files, and never slows down or crashes. The skills that you learn with it will be applicable to everything you ever do for the rest of your career, as opposed to an IDE which will change when you change platforms.

Vim is an investment, but if you are talking about something you will use for 8-10 hours a day for almost the rest of your life, learning curve becomes completely irrelevant.

心碎无痕… 2024-10-07 13:33:52

没有真正的理由使用 Nano。几乎任何事情都更好。

至于 vim 和 emacs,这是我上次提到的上次出现的内容< /a>:

我对 vi 键绑定半熟练,但总的来说我更喜欢 Emacs。这些编辑器拥有如此狂热的追随者的原因是因为它们提供的编辑模型比新系统更强大,这就是为什么提供“vi 键绑定”或“emacs 键绑定”是不够的,即使您没有使用任何扩展功能或 emacs 或 vi 的自定义。

我只想谈论 Emacs 的模型,因为我最了解它。当今文本编辑的常见模型涉及文本缓冲区,可以在其中插入、删除、选择文本以及将文本剪切/复制/粘贴到系统剪贴板。

当然,Emacs 缓冲区可以支持这些操作。除了跟踪它们在其中可见的每个窗口的光标位置之外,它们还跟踪在其中所做的“标记”。 “点”(光标位置)和“标记”之间的文本称为“区域”,大致对应于主流编辑器中的选择。

不同之处在于,Emacs 会跟踪标记环中最后设置的几个位置,您可以通过一次击键(或两次,具体取决于您的配置)返回到它们。我发现这非常有用,特别是因为许多 Emacs 命令会更改缓冲区中的位置,并在旧位置设置标记。一个例子是,当我编辑 Python 模块并需要将 import 语句添加到文件顶部时。用于转到缓冲区顶部的击键 (Alt-<) 设置标记。我添加导入语句。我按 Ctrl-u Ctrl-Space,然后我又回到了开始的地方。我也可以继续这样做以循环回到之前的位置。 (也许我需要在添加 import 语句时选择一些文本。)

Emacs 的另一个(也是更广为人知的)区别是 Kill Ring。大多数用于从缓冲区中删除文本的击键都会将文本保存到终止环中,然后可以使用“yank”命令(Ctrl-y)重新调用该终止环。基本功能是后续的 yank 命令会检索较旧的已删除文本。因此,您可以连续删除几个文本部分,然后按顺序检索它们。您还可以在猛拉后使用 Alt-y 在删除环中循环,删除检索到的文本并在环中插入下一个条目。

Emacs 在 1978 年就具备了这些功能。唯一在一定程度上采用这些功能的主要系统是 NeXTStep(现在由 Cocoa 继承)。其他工具为特定任务提供更多功能,可以用比 Emacs Lisp 更容易使用的语言进行扩展,并且具有更好的可视化界面......但 Emacs 在文本编辑方面仍然更好。这就是为什么一旦你知道如何使用它,就很难戒掉。

There's no real reason to use nano. Pretty much anything is better.

As for vim and emacs, here's what I said last time this came up:

I'm semi-competent with vi keybindings, but I prefer Emacs overall. The reason these editors have such fervent adherents is because the editing model they provide is more powerful than newer systems, which is why providing "vi keybindings" or "emacs keybindings" isn't enough, even if you aren't using any extension features or customizations for emacs or vi.

I'm only going to talk about Emacs' model because I understand it best. The common model for text editing today involves a buffer of text, in which text can be inserted, deleted, selected, and cut/copied/pasted to the system clipboard.

Emacs buffers, of course, can support these operations. Along with tracking cursor position for each window they're visible in, they also keep track of "marks" made in them. The text between the "point" (cursor position) and the "mark" is called the "region", and roughly corresponds to the selection in mainstream editors.

The difference is that Emacs keeps track of the last several locations the mark was set at in the mark ring, and you can return to them with a keystroke (or two, depending on your configuration). I find this extremely useful, especially since a lot of Emacs commands that change your location in the buffer set the mark at your old location. An example is when I'm editing a Python module and need to add an import statement to the top of the file. The keystroke for going to the top of the buffer (Alt-<) sets the mark. I add the import statement. I press Ctrl-u Ctrl-Space and I'm back where i started. I can keep doing this to cycle back to previous positions as well. (Maybe I needed to select some text while adding that import statement.)

The other (and more well-known) Emacs difference is the kill ring. Most of the keystrokes for removing text from the buffer save text to the kill ring, which can then be recalled with the "yank" command (Ctrl-y). The essential feature is that subsequent yank commands retrieve older killed text. So you can kill several sections of text in a row, then retrieve them in order. You can also cycle through the kill ring with Alt-y after a yank, removing the retrieved text and inserting the next entry in the ring.

Emacs had these features in 1978. The only other major system to adopt them to any extent is NeXTStep (and now inherited by Cocoa). Other tools provide more features for specific tasks, can be extended in languages way easier to use than Emacs Lisp, and have nicer visual interfaces... but Emacs remains better at text editing. Which is why, once you know how to use it, it's so hard to quit.

隐诗 2024-10-07 13:33:52

Vim 震撼

Vim 更难学(你必须记住你想要使用的命令),但比我见过的任何 IDE 或 GUI 编辑器都要强大得多。

vim 的部分秘密在于它最终继承自 Ken Thompson 自己编写的 ed(1) 文本编辑器的行模式。它非常强大:它可以用于重构,甚至可以放入脚本中。它基于正则表达式模式替换。

凭借所有这些功能,因为它是一个老式的 Terminal/xterm 应用程序,所以它可以立即启动,并且永远不会有可检测到的延迟。

我已经多次切换到 IDE 和 gui 编辑器,但还是会继续使用 vim。我想,这次我还是坚持下去吧,少走弯路。



笔记:

如果您的 IDE 支持重构,那就是使用 IDE 的理由。我只是将其用作复杂编辑任务的示例。

值得注意的是,vim 似乎有助于对抗 RSI 并使您的双手更加放松。这些命令是未经修改的键,因此您无需绷紧手腕按住 control 或 meta 或 command 或 blech 或其他任何东西。

Vim rocks

Vim is harder to learn (you have to memorize the commands you want to use) but vastly more powerful than any IDE or GUI editor I've seen.

Part of the secret to vim is the line mode it inherited, ultimately, from the ed(1) text editor that was written by Ken Thompson himself. It is remarkably powerful: it can be used for refactoring and even placed into scripts. It is based on regular expression pattern replacement.

And with all this power, because it's an old-school Terminal/xterm app, it's starts up instantly and never has a detectable lag.

I've switched to IDE and gui editors many times but keep coming back to vim. I think this time I'll just stick with it and save myself the detour.



Notes:

If your IDE supports refactoring, that's a find reason to use the IDE. I'm just using that as a complex-editing-task example.

Remarkably, vim seems to help fight RSI and leave your hands more relaxed. The commands are unmodified keys, so you don't need to tense up your wrists holding down control or meta or command or bletch or whatever.

╭⌒浅淡时光〆 2024-10-07 13:33:52

使用 VIM/Emacs 可以(大致)获得两件事:

  1. 可定制性
  2. 它们可以随处运行

两者都需要投入时间来学习。但是一旦你学会了它们,使用任何其他编辑器就会感到自卑。

There are two things (roughly) that you get from using VIM/Emacs:

  1. Customizability
  2. They run everywhere

Both take an investment in time to learn. But once you learn them using any other editor will feel inferior.

遇见了你 2024-10-07 13:33:52

Emacs 和 Vim 是我能想到的最精致、最多功能的软件。

在 UNIX 环境中工作时更是如此,纯文本文件用于所有内容(代码、脚本、配置、进程等)。

这些工具需要一些时间来学习,甚至需要更多时间来掌握,但它们可以给你一整天带来意想不到的生产力。

我在 1990 年左右开始使用它们。二十年后,它们仍然是我的首选。它们是我在配置机器时安装的第一个工具,当我当前的 IDE 卡住时,它们总是可以让我更进一步......想想 regex 重命名数千个文件,应用文本文件或任何其他文本的复杂重新格式化定向任务。

Emacs and Vim are the most polished and multi-purpose software I can think about.

This is more specifically true when working in a unix environment, where plain text files are used for everything (code, scripting, config, processes,... etc).

These tools takes some time to learn, even more to master, but then they can give you an unexpected productivity all day long.

I start using them both around 1990. Twenty years later, they are sill at the top of my list. They are the first tools I install when I configure a machine and they can always bring me one step further when my current IDE is stuck... think about regexrename thousands of files, apply a complex reformatting of a text file, or any other text oriented task.

不寐倦长更 2024-10-07 13:33:52

emacs——我想还有 vim——有几个优点:

  1. 更多的屏幕空间。
  2. 真正的终极可扩展性
  3. 最小的内存使用量。我使用不到 35 MB 的内存打开了 100 多个文件,包括多个远程编辑文件。
  4. Emacs 永远不必关闭,除非您必须重新启动计算机或升级 emacs。我通常会连续运行一个 emacs 进程数周。
  5. 修改起来非常容易。如果我愿意的话,我可以在一天之内为 DSL 开发出一个突出显示模式。带有或多或少有效的缩进。而且我什至不太擅长 emacs。
  6. 手部更轻松,因为您可以轻松重新映射按键以支持您的个人手形和首选键盘形状。
  7. 可靠的。我可能曾经强迫 emacs 崩溃过一次。
  8. 在我可以访问的任何地方运行。可能一些较旧的 IBM 390 系统可能无法运行它...

我已经使用过 Visual Studio 和 eclipse 。他们不擅长
作为 emacs 的原始文本编辑。它们速度慢得多并且支持
更少的语言。

我听到的关于 emacs 的唯一有意义的反对意见是“不
intellisense”。我在编辑时不使用 VS/Eclipse Intellisense
那里。此外,emacs 中的自动完成机制更优越,
据我所知。 (例如,自动完成变量名称)。

当然,这确实需要一个学习曲线。对于 emacs,我认为日常使用 1 个月就能让你达到日常使用的舒适能力。

emacs - and, I suppose, vim, maybe - have several advantages:

  1. More screen real estate.
  2. Real Ultimate Extensibility
  3. Minimal memory usage. I've had over 100 files open, including multiple remote editing files, using under 35 MB of ram.
  4. Emacs never has to close unless you have to restart your computer or upgrade emacs. I usually run a single emacs process for weeks on end.
  5. Trivially easy to modify. I can bang out a highlighting mode for a DSL in a day, if I want. With indentation that more or less works. And I'm not even that good at emacs.
  6. Easier on the hands since you can remap keys easily to support your personal hand shape and preferred keyboard shape.
  7. Reliable. I might have forced an emacs crash once.
  8. Runs everywhere I can access. Possibly some older IBM 390 systems might not run it...

I've used Visual Studio and eclipse somewhat. They are not as good at
raw text editing as emacs. They are considerably slower and support
less languages.

The only meaningful objection I hear raised in regards to emacs is "no
intellisense". I don't use VS/Eclipse Intellisense when I do edit
there. Further, the auto-complete mechanisms in emacs are superior,
from what I can tell. (e.g., autocompleting variable names).

Of course, it does take a learning curve. For emacs, I'd judge 1 months of daily use will take you to the point of comfortable competency for everyday use.

孤寂小茶 2024-10-07 13:33:52

我经常使用 vi(我现在在工作中使用它,因为我懒得启动 xserver,而且它启动很快),但只是因为我必须学习它(我所说的“它”是指一个相当小的命令子集)很多年前,它对于远程编辑文件很有用,有时 gedit 或其他不可用的东西。

只是为了旧时光的缘故,我刚刚再次启动 emacs 来看看我有多讨厌它,然后我不得不在 google 上搜索一份备忘单来告诉我如何关闭它。所以我认为可以公平地说它不直观。

我认为,当使用神秘的组合键在绿黑终端上工作时,比坐在那里使用友好的 GUI 更容易将自己视为 Neo(矩阵)。

I use vi a lot (I'm using it now at work because I can't be bothered to start an xserver and because it's quick to start up), but only because I had to learn it (and by 'it' I mean a fairly small subset of commands) many years ago, it's useful for remotely editing files and sometimes gedit or whatever isn't available.

Just for old times sake, I've just started emacs again to see how much I hate it and then I had to google for a cheatsheet to tell me how to close it. So I think it's fair to say it's not intuitive.

It's my opinion that it's a lot easier to think of yourself as Neo (Matrix) when working on a green on black terminal using arcane key combinations than to sit there using a friendly GUI.

和影子一齐双人舞 2024-10-07 13:33:52

Vim 具有大量命令,如果这些命令不足以完成您重复执行的任务,您可以定义自己的命令。但是,在您只了解其中很少一部分命令后,您就可以有效地使用 Vim,因此您无需学习大量内容就可以开始使用(尽管您会摸索几天)。您还可以应用基于正则表达式搜索的命令,如果您想对满足某些复杂条件的每一行应用特定的更改,这会非常方便。我无法想象这些天不使用 Vim 编码会怎样。

Vim has an enormous number of commands, and if those aren't sufficient for tasks you do repeatedly, you can define your own. But, you can use Vim effectively after you know only a very small number of those commands, so you don't have a huge amount to learn to get started (though you will fumble around for a few days). You can also apply commands based on regular expression searches, which can be enormously handy if you want to apply a particular change to every line which meets some complex condition. I can't imagine not coding in Vim these days.

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