The great vi - emacs war

What is it all about?

Anything that doesn't fit anywhere else below.

Moderators: Calilasseia, ADParker

The great vi - emacs war

#1  Postby lpetrich » May 19, 2012 7:16 pm

Does anyone know much about the great war of vi partisans vs. emacs partisans? I've read about it, but I've never been caught in its crossfire.


For those of you not familiar with vi or emacs, they are both text editors that create ASCII-art GUI's. I call it that because they run on a command line, while sending "escape sequences" that make the cursor jump around and do other formatting things. These work on many of the earlier display terminals, and these work on command-line software for full-scale GUI systems.

It's possible to have a pure command-line text editor that does not make an ASCII-art GUI, and I had gotten started on some of those.


vi has a feature that I've seen in no other GUI text editor: its dual mode. It's either in edit mode or in input mode. When in edit mode, keystrokes get interpreted as editor commands, like h j k l for moving the cursor one step in each direction. But when in input mode, keystrokes get inserted into the text.

That confused me terribly, and I remember doing all my editing on a machine with a nicer text editor, then sending it over to that vi-using machine.

emacs has single-mode editing, always being in input mode, but being able to accept many editing commands. However, some commands make one use a command line at the bottom, so it's somewhat multimodal. Several other ASCII-art-GUI text editors, like vi, also have that feature, because it's useful for entering file names.

Most other ASCII-art-GUI text editors that I know about are like emacs in being primarily single-mode. pico, nano, VMS edt, VMS eve, ... All the fullscale-GUI ones that I've ever used are also single-mode, except for fullscale-GUI versions of vi. This includes every editable text area that I've ever edited.


So what's the fight all about? From the outside, it looks as if the winner is emacs-style single-mode editing. Or are there some other issues in this great fight?
lpetrich
THREAD STARTER
 
Posts: 638
Age: 56
Male

United States (us)
Print view this post

Ads by Google


Re: The great vi - emacs war

#2  Postby Calilasseia » May 19, 2012 8:03 pm

I suspect it's a case of whatever you grew up with. Incidentally, both of these text editors are principally Unix/Linux editors, but I suspect ports have been made to other operating systems.

In the case of vi, if memory serves, it started life as an attempt to make the even more rudimentary text editor known as ed a little more friendly to newcomers. The ed text editor first saw the light of day with the first ever operational versions of Unix, and it may be possible to find ed lurking somewhere even on modern Linux systems with GUIs, as a fallback in case you need to dive into the OS without the GUI running, and edit key system files to resurrect the system after someone's been futzing about with it.

When cursor-addressable terminals started to appear, sometime in the late 1970s, Unix programmers sought to take advantage of this, and thus set about producing a front end for ed. Somewhere along the way, an extended version of ed, called ex, put in an appearance, and it was decided to integrate the forthcoming front end with the new, enhanced ex version of the line editor. The end result was vi.

Since vi has been something of a standard amongst text editors on Unix systems since the late 1970s, it's hardly surprising that a lot of Unix/Linux programmers like it. It's what they first encountered when learning the dark arts of Unix shell scripting and C programming, and as a consequence, they've come to regard it as a family friend, so to speak.

In the case of emacs, this was originally derived from a mainframe editor called TECO, about which much has been written with respect to the hilarity of using this 1960s-vintage product. TECO was the classic piece of 1960s mainframe software - unforgiving, littered with counter-intuitive commands and command sequences, and generally a pain in the arse to use. The emacs editor began life as a set of TECO macros, which proved to be so popular amongst benighted TECO users, that they demanded a proper, native implementation, which duly emerged. The ability to automate editing sequences with custom macros you can define yourself, as well as a small army of existing macros to perform just about any editing task you can think of, makes emacs popular with those who grew up with it. Anyone whose programming history revolves around the VMS operating system, or various DEC minicomputer operating systems of 1970s vintage, will know all about TECO and emacs. There was even an implementation of emacs for the Amiga computer in the 1980s, based upon the MicroEmacs project. Incidentally, one of the interesting features of this editor, is that its development history is intertwined with the Lisp programming language, and people whose careers were based upon Lisp projects, are likely to have been emacs users and fans from early in their careers.

Where emacs loses out, is that it's restricted with respect to file size. Ask it to edit a file bigger than 512 MB, and it curls up and dies. vi, as far as I'm aware, suffers no such restrictions, because it uses Unix standard filestream operations, which don't have any intrinsic limits on file size, other than those imposed by the CPU architecture upon which the Unix/Linux implementation is residing. So, for example, you can expect a 4 GB file size limit on systems with 32-bit CPUs, unless the version of Unix/Linux resident thereupon makes proper use of block filesystems, in which case on a 32-bit system with a 1K block size, the maximum file size is actually 4 TB. Where emacs scores is that it is practically infinitely extensible, all you need to do is figure out a way of implementing your desired features as a macro, and hey presto, emacs will implement that feature, without needing a major rewrite of the editor. Also, emacs had interactive help facilities and a built in tutorial from the start, features that were to be ruthlessly copied by other text editors that came after it. However, one feature that skews a lot of viewpoints is this: vi is free, and bundled with the operating system, whilst emacs (unless you obtain the GNU version) is a commercial product that can cost you a tidy sum of money.
Signature temporarily on hold until I can find a reliable image host ...
User avatar
Calilasseia
Moderator
 
Posts: 20483
Age: 55
Male

Country: England
United Kingdom (uk)
Print view this post

Re: The great vi - emacs war

#3  Postby lpetrich » May 19, 2012 10:14 pm

Thanx so much for going into all that detail. Nice to learn about how vi and emacs had originated.

I checked and OSX Snow Leopard has ed, ex, vi, vim, emacs, pico, and nano installed. All of these are in /usr/bin unless stated otherwise.
/bin/ed: 115K
ex, vi alias to vim: 2.7M
pico aliases to nano: 317K
emacs is several files:
emacs: 25M, emacs-i386: 12M, emacs-undumped: 7.4M, emacsclient: 103K, /usr/share/emacs total (found with du): 29M

So emacs's reputation for bulk is well-deserved, it seems.


For comparison to full-scale-GUI text editors, I tried OSX TextEdit.
/Applications/TextEdit.app/ (executable + data files) total size: 576K
/Applications/TextEdit.app/Contents/MacOS/TextEdit (executable) size: 280K
lpetrich
THREAD STARTER
 
Posts: 638
Age: 56
Male

United States (us)
Print view this post

Re: The great vi - emacs war

#4  Postby Xeno » May 19, 2012 11:17 pm

That does not seem a realistic view of TextEdit, in that (IIRC) Apple has buried quite a lot more of the basic text handling, formatting and editing functions into OS libraries since OS X emerged, to simplify and make more consistent editors built for it. Therefore, Textedit looks smaller than it might, being something of a front end such as vi is to ed (loosely put). This is no more than that a progression of commoditising other functions into the OS of course.

I started with vi, which is very easy and quite capable, so why learn emacs when I rarely need to work in terminal anyway? So I brokered local peace with vi and wars went on around me.
sinisterly annoying theists
User avatar
Xeno
 
Posts: 715
Male

Country: Australia
Australia (au)
Print view this post

Re: The great vi - emacs war

#5  Postby Pulvinar » May 20, 2012 12:08 am

vi has such screwy behavior, such as when you insert a word using i<word>$ then insert another word, it's placed in front of the last letter of the word you had just inserted! The only people I know who use it are those who've never tried a decent editor.
Pulvinar
 
Posts: 210

Print view this post

Re: The great vi - emacs war

#6  Postby byofrcs » May 20, 2012 12:28 am

iThis war is of little relevance to you puny mortals. The fate of the universe rests on this battle. You will just have to live with the outcome. <ESC>^Z^Z
In America the battle is between common cents distorted by profits and common sense distorted by prophets.
User avatar
byofrcs
RS Donator
 
Name: Lincoln Phipps
Posts: 7906
Age: 53
Male

Country: Tax, sleep, identity ?
European Union (eur)
Print view this post

Re: The great vi - emacs war

#7  Postby lpetrich » May 20, 2012 5:27 am

Xeno wrote:That does not seem a realistic view of TextEdit, in that (IIRC) Apple has buried quite a lot more of the basic text handling, formatting and editing functions into OS libraries since OS X emerged, to simplify and make more consistent editors built for it. Therefore, Textedit looks smaller than it might, being something of a front end such as vi is to ed (loosely put). This is no more than that a progression of commoditising other functions into the OS of course.

I will concede that it may be cheating not to count the OS libraries, and full-scale-GUI apps require a lot more than command-line / ASCII-art-GUI apps.
lpetrich
THREAD STARTER
 
Posts: 638
Age: 56
Male

United States (us)
Print view this post

Ads by Google


Re: The great vi - emacs war

#8  Postby Darwinsbulldog » May 20, 2012 9:39 am

Game over, vi rules bitches. :-)
Jayjay4547 wrote:
"When an animal carries a “branch” around as a defensive weapon, that branch is under natural selection".
Darwinsbulldog
 
Posts: 7440
Age: 62

Print view this post

Re: The great vi - emacs war

#9  Postby klazmon » May 20, 2012 10:55 am

I must admit that I have to use a cheat sheet when I need to use vi every once in a while. It does everything I need on those occasions.
User avatar
klazmon
 
Posts: 2030
Age: 107
Male

New Zealand (nz)
Print view this post

Re: The great vi - emacs war

#10  Postby Pulsar » May 20, 2012 12:48 pm

Darwinsbulldog wrote:Game over, vi rules bitches. :-)

In your dreams :evilgrin:

I've been using Emacs for 15 years, it's my default editor for basically everything. What I love most about it is that it recognizes a truckload of file types (programming languages, LaTeX files, HTML files,...) and adapts its behaviour accordingly: syntax highlighting, menus, compiling, etc. Don't know much about vi, I've never bothered to learn it.
"The longer I live the more I see that I am never wrong about anything, and that all the pains that I have so humbly taken to verify my notions have only wasted my time." - George Bernard Shaw
User avatar
Pulsar
 
Posts: 4312
Age: 39
Male

Country: Belgium
Belgium (be)
Print view this post

Re: The great vi - emacs war

#11  Postby Darwinsbulldog » May 20, 2012 2:13 pm

Pulsar wrote:
Darwinsbulldog wrote:Game over, vi rules bitches. :-)

In your dreams :evilgrin:

I've been using Emacs for 15 years, it's my default editor for basically everything. What I love most about it is that it recognizes a truckload of file types (programming languages, LaTeX files, HTML files,...) and adapts its behaviour accordingly: syntax highlighting, menus, compiling, etc. Don't know much about vi, I've never bothered to learn it.

vi is very simple, and lightning quick. Great for rescue and broken systems. Not all that hard to learn. :thumbup: Plus it is common to ALL "nixes.
Jayjay4547 wrote:
"When an animal carries a “branch” around as a defensive weapon, that branch is under natural selection".
Darwinsbulldog
 
Posts: 7440
Age: 62

Print view this post

Re: The great vi - emacs war

#12  Postby campermon » May 20, 2012 2:20 pm

I just use notepad....

:coffee:
Scarlett and Ironclad wrote:Campermon,...a middle aged, middle class, Guardian reading, dad of four, knackered hippy, woolly jumper wearing wino and science teacher.
User avatar
campermon
Moderator
 
Posts: 17032
Age: 46
Male

United Kingdom (uk)
Print view this post

Re: The great vi - emacs war

#13  Postby Joe09 » May 20, 2012 3:49 pm

we have to use emacs for coding at uni

emacs sucks
Joe09
 
Posts: 1268
Age: 27
Male

United Kingdom (uk)
Print view this post

Re: The great vi - emacs war

#14  Postby Darwinsbulldog » May 21, 2012 12:33 am

This blasphemy against the one true god vi is beyond the pale. You are all reported and will suffer for ever in hell for it. Daemons will give you the agony that you all truely deserve! :evilgrin:
Jayjay4547 wrote:
"When an animal carries a “branch” around as a defensive weapon, that branch is under natural selection".
Darwinsbulldog
 
Posts: 7440
Age: 62

Print view this post

Re: The great vi - emacs war

#15  Postby Alan B » May 21, 2012 9:04 am

Pressed the wrong button.
Last edited by Alan B on May 21, 2012 9:11 am, edited 1 time in total.
I have NO BELIEF in the existence of a God or gods. I do not have to offer evidence nor do I have to determine absence of evidence because I do not ASSERT that a God does or does not or gods do or do not exist.
User avatar
Alan B
 
Posts: 8284
Age: 80
Male

Country: UK (Birmingham)
United Kingdom (uk)
Print view this post

Ads by Google


Re: The great vi - emacs war

#16  Postby Alan B » May 21, 2012 9:10 am

I used to use Brief (by Underware Inc.).
But that's going back to the REAL dark-ages...
Bloody hell! I just checked and you can still download it and it's still in use. I last used it when DOS 3.2 was the the 'thing' :nono: .
I have NO BELIEF in the existence of a God or gods. I do not have to offer evidence nor do I have to determine absence of evidence because I do not ASSERT that a God does or does not or gods do or do not exist.
User avatar
Alan B
 
Posts: 8284
Age: 80
Male

Country: UK (Birmingham)
United Kingdom (uk)
Print view this post

Re: The great vi - emacs war

#17  Postby jaydot » May 27, 2012 8:42 pm

never knew there was a war, just people and their preferences. i like nano meself, though vim (upgraded vi) is not too bad.
User avatar
jaydot
 
Posts: 1752

Print view this post

Re: The great vi - emacs war

#18  Postby VazScep » May 28, 2012 8:51 am

I use Emacs for pretty much everything. I don't have a lot of choice: most of the software I use is text-based, and my programming languages have better support on Emacs than as plugins to other IDEs.

My feelings about Emacs run along these lines.
Here we go again. First, we discover recursion.
VazScep
 
Posts: 4034

United Kingdom (uk)
Print view this post

Re: The great vi - emacs war

#19  Postby VazScep » Feb 17, 2017 10:45 am

Something good has happened upstream for my Linux distribution, and I'm now able to use something called pdf-tools in Emacs, which means I can do all my PDF reading in my editor. It supports search, annotations, editing PDF text and synchronisation with LaTeX. I'll need to add some stuff so that I can link to my PDF annotations from org files, but that shouldn't be too hard to write myself.

I'm getting close to living entirely within Emacs. I moved email entirely to Emacs a few years ago, and that was such a joy. Emacs has always had an email solution, but I've always struggled to get it to work. Then I discovered something called mu4e, which is awesome. It has a pretty novel approach to email: you don't organise your email by tags or folders. You just have big flat INBOXes, and then you use "bookmarks" which are search queries into a database of all your mail, bound to simple keystrokes. My email has never felt so uncluttered.

The latest major version of Emacs now has an experimental "Cairo" backend. Cairo is being pushed to be the official standard library for C++ vector graphics programming, and is the backend used by Mozilla for their GUIs. As such, it turns out that it isn't difficult to get the core of Firefox running directly inside Emacs, and thus start watching youtube videos in the editor.

The Cairo thing is experimental and apparently not stable, so I'm not trying it just yet. However, I'm excited to see what the future of Emacs modes will be with native support for vector graphics. As for surfing the web, I'll occasionally use w3m in Emacs (as I'm doing now), but I'm happy enough with Firefox, especially with the various extensions I use. I just need Vimperator to be working again: this lets you use Firefox in the style of Vim, with insert and command modes, and Vim keybindings. Vimperator should mean I'm not having to move my right arm constantly to do some pointless shit with the mouse.

I still haven't switched away from using xterm for command line stuff, but it won't be long before I've jumped that ship too.
Here we go again. First, we discover recursion.
VazScep
 
Posts: 4034

United Kingdom (uk)
Print view this post

Re: The great vi - emacs war

#20  Postby lpetrich » Feb 18, 2017 6:35 pm

Seems like emacs aims at being a complete platform, while vi sticks to being an editor. That may explain some of the emacs-vi war, with the vi supporters being content with a text editor.

That may also explain why the winner is a sort of hybrid: vi-scale text editors with emacs-style editing. Like pico and nano on the command line and just about every bitmapped-GUI text editor.
lpetrich
THREAD STARTER
 
Posts: 638
Age: 56
Male

United States (us)
Print view this post

Next

Return to General Science & Technology

Who is online

Users viewing this topic: No registered users and 1 guest