18

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.

Devan Buggay
  • 2,717
  • 4
  • 26
  • 35

9 Answers9

24

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.

darioo
  • 46,442
  • 10
  • 75
  • 103
  • Thanks for the answer, ill be sure to check one out. Which do you use if you don't mind me asking? – Devan Buggay Nov 02 '10 at 06:22
  • 46
    Notepad is not really an editor. It's an input field with a process id. :) – Brian Rasmussen Nov 02 '10 at 06:23
  • @pwnmonkey: I'm using Emacs, and I've used it for 3 years. I'm very happy with it, but it was a bit of a struggle in start to make it do what I want it to do. When you choose one editor, remember that you will be training your muscle memory and that always takes time. Search Stackoverflow for "emacs vim" and you'll see plenty of posts describing each editor's strengths. There's a kind of religious war between them going on for decades, and once you choose one, you might see why. – darioo Nov 02 '10 at 06:26
  • 10
    @Brian Rasmussen: yep, it's nice to have such an input field with a built in close button, so you can quickly kill it :-) – darioo Nov 02 '10 at 06:28
  • @zetetic: Your body has its limits. Emacs and Vim, in a kind of way, don't. – darioo Nov 02 '10 at 06:46
  • 6
    >weeks, if not months. Let me add: “if not decades”. – Benoit Nov 02 '10 at 07:22
  • 6
    The learning curves look like this: http://unix.rulez.org/~calver/pictures/curves.jpg – greyfade Nov 02 '10 at 17:35
  • Any other software or app that required "DECADES" to become proficient in would rightly be called a piece of crap. It baffles my mind why vim/emacs are somehow above this and not subjected to the same usability metric as everything else... Besides being vastly more intuitive, using my mouse and np++ means i can jump from line 2 to 37 to 5 to 88 while you are still holding down j to get to 37... – alnafie May 22 '12 at 21:08
  • 3
    Yeah, if only there was a vim command to jump to a particular line number :| – rjh Nov 12 '12 at 12:19
  • I don't get it. I think everyone over-hypes the learning curves. I learnt VIM to a IMO good standard in less than a day. Of course, I still pick up the odd trick here and there on occasion, but that happens too with other editors. – theonlygusti Dec 23 '16 at 08:41
13

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.

Matt Briggs
  • 41,224
  • 16
  • 95
  • 126
9

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.

Community
  • 1
  • 1
Allen
  • 5,034
  • 22
  • 30
  • +1 I do find Emacs ugly visually to use on Windows; but I use it on the Mac and Linux for virtually everything that is texty. (Although I may also have an IDE open) – Ilan Nov 02 '10 at 14:58
  • +1 for the link (and the example), as you said it's all been said before – timB33 Nov 03 '10 at 10:30
6

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.

DigitalRoss
  • 143,651
  • 25
  • 248
  • 329
4

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.

samdphillips
  • 131
  • 3
3

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.

Christian Lemer
  • 893
  • 9
  • 15
2

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.

Paul Nathan
  • 39,638
  • 28
  • 112
  • 212
  • "screen real estate" what does this mean? Thanks for the input though! – Devan Buggay Nov 02 '10 at 22:51
  • @pwnmonkey: pixels devoted to the job I'm doing. IE, word takes up a good top chunk of the screen, as does Firefox. VS takes up the top and at least 1 side, possibly the other 3 sides as well. With emacs, all I see is the windows title bar (hmmm, I wonder if I can remove that too...) – Paul Nathan Nov 02 '10 at 23:13
1

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.

timB33
  • 1,977
  • 16
  • 33
1

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.

uckelman
  • 25,298
  • 8
  • 64
  • 82