War of Emacs Vs Vi

==================================================                                                                      
   This artical came from:http://c2.com/cgi/wiki?EmacsVsVi
==================================================
GreatEmacsFeatures vs GreatVimFeatures (see also EmacsAndVi) - One of the first big HolyWars to take place on the internet.  HEATHENS! EdIsTheStandardTextEditor! Vim Vim evolved from the original visual mode for the ed editor, BillJoy's Vi, and maintains full backward-compatibility with it. But it's scripted in any scripting language you like, it runs on any operating system you like, it has every text-editing feature known to man, it's clean, reliable, easy to use, symmetrical, and low on bullshit. EmacsI use emacs, which might be thought of as a thermonuclear word processor. It was created by Richard Stallman; enough said. It is written in Lisp, which is the only computer language that is beautiful. It is colossal, and yet (throughout most of its history) it only edited straight ASCII text files, which is to say, no fonts, no boldface, no underlining. (Recent versions of GNU Emacs have some primitive support for fonts and faces.) In other words, the engineer-hours that, in the case of Microsoft Word, were devoted to features like mail merge, and the ability to embed feature-length motion pictures in corporate memoranda, were, in the case of emacs, focused with maniacal intensity on the deceptively simple-seeming problem of editing text. If you are a professional writer -- i.e., if someone else is getting paid to worry about how your words are formatted and printed -- emacs outshines all other editing software in approximately the same way that the noonday sun does the stars. It is not just bigger and brighter; it simply makes everything else vanish. For page layout and printing you can use TeX: a vast corpus of typesetting lore also available on the Net for free.
from Neal Stephenson's "In the beginning was the command line" http://hobbes.ncsa.uiuc.edu/nealstephensonOS.html
What makes Emacs so much better for writers? Do they use the regex features, or what? Was Cryptonomicom typed in Emacs? It is entirely likely that Stephenson wrote CryptoNomicon in Emacs and did his formatting using TeX (see the above quotation from "In the Beginning..."). Emacs is great for writers because it allows them to concentrate on their text, not the formatting thereof. [Granted, this is true of any ASCII editor, even (shudder) VI.] The larger the piece of text, the more the advantage is seen, as performance in emacs does not degrade the way it does in, say, Word, with text size. Emacs/LaTeX using the AUCTeX package (with the RefTeX and BibTeX add-ons) is a truly excellent environment for writing a large book (or technical manual).
Just for those who would prefer something less drastic than editing pure LaTeX (nothing against those who love it), I would recommend LyX (LyEks) http://www.lyx.org. It is really "LaTeX for the rest of us". It's so much more simple and so much more concentration can go to the content, than to looking for that f....ing parenthesis. Use it and love it!
Bunch of funny stuff moved to RealEditors
Do we UseTheToolsWeLikeOrLikeTheToolsWeUse? I personally suspect that many people "like the tools they use" -- this is the only way I can understand why so many people still use Vi, and some even heroically defend it. Right from the start I hated Vi because it is so modey -- what it does in response to the keys you type is VERY dependent on what MODE you are in, and so you have to constantly be aware of this extra state information. The consequences of forgetting this and just typing words you want to put in the file can be disasterous, since EACH CHARACTER can be a command! My mental model of a text editor is that by default, I type characters and they are appended to the file at the cursor location; anything else I want to do is a command or function (which could make "big" changes to the file) and I should have to do something special or different to make it happen (like use a control- or alt- key combination, or select a menu item or button with a mouse, etc.) Vi completely inverts this: by default, you are doing commands, and you have to do something special to just insert characters. Aggh! Curious, because I seem to never have had that mental model - I like vi, because I do well with the modal method - I detest having to move my hands away from the regular keys to the arrow keys/mouse to go up a line and over 3 words in order to correct a typo. I'm much happier when I can make one swift move (hit Escape) and return to the keys to move and correct. Perhaps it's a learned habit to use the Escape key "correctly" and shift modes? --PeteHardie My take on EmacsVsVi (for text editing, ignoring all the additional stuff Emacs can do) has always been that Emacs is easier to learn, but Vi is easier to use. A modeless tool is easier to get a handle on, because there's never any question as to what state it's in. But it means you need a lot more knobs and buttons to get everything done, making it necessarily bigger and klunkier. A tool with modes is harder to learn, but once you get the hang of it, can be quicker to use if well design. --StefanVorkoetter (who uses Vi after a brief stint with Emacs in the late 80's). There's no doubt that different people have different preferences, styles, modes, priorities, etc. and that each should be able to choose the tool that best fits their style. I can't stand Vi, but I would defend YOUR right to use it to the death (and hope that you would do the same for me). As long as we're not short of disk space.....:-> However, be careful with statements (like your last sentence above) that imply that the reason someone doesn't like your favorite tool is that they haven't learned to use it properly. It could be argued the other way, that you have overcome some fundamental weaknesses and limitations of Vi's modes by learning and habit. Take that to an extreme and we could argue that we don't need to write any new software; that people should just learn to live with the various limitations of existing tools. Thank goodness we don't have to settle, and can have an ongoing evolution in software, and have the freedom of choice to pick from a wide range of tools... Note that I did say it could be a learned trait, and that "correctly" is emphasized as perhaps virtual. --PeteHardie
I think I've hit on the difference between Emacs and Vi users. Emacs users expect the computer to intuit what the user is currently trying to do (btw, those who claim Emacs is modeless needs to think again; I've found myself in tons of "tiny modes" where it was expecting me to hit a key for some action but I wasn't aware of it. These are all learnable, but to say Emacs is modeless is 100% inaccurate. C-X is proof). Vi users expect to tell the computer what to do. Vi makes no assumptions. If you're in command mode, it's because you told it to go there. --SamuelFalvo?
There is only one problem with being a user of vi(m): every six months, your escape key is worn out. (Versus the one problem of being an Emacs user, where your CTRL and X keys are permanently damaged after only 15 minutes of use, to say nothing of the arthritis you get. ;) --SamuelFalvo?) My mitigation strategy: learn to use right-control instead of left-control, then switch keyboards with an emacs user every six months. :) When vi was my main editor (now emacs) I was always annoyed with esc as a meta replacement, since most of my keyboards had meta. My solution was to train my fingers to use C-[. Of course on the PC's I mapped the caps-lock <-> left ctrl, so that ctrl was in the right place, but other than that it worked great and kept my hands on home row...
GZ: There's no learning curve for vi. You can be an effective vi user in 10 minutes. The best thing about vi is the modal editing feature which allows your hands to stay on the home keys of your keyboard, all the time. My primary complaint about vi's key usage is that, while HJKL is on the home row, it is not in the home position (one's right-hand fingers should rest on JKL;). When I use vi, I always end up with my right hand being one key to the left or right of where I think it is, leading to a lot of typos. --KrisJohnson I used to move my right hand to do cursor movement in vim, as well, until a friend convinced me otherwise. His argument was that the most common cursor movement operations are moving down a line and moving up a line; if you leave your hand in home position, these operations map to the strongest and second-strongest fingers, which is not the case if you move your hand. Being able to move the cursor right or left is less important, especially if you learn to rely on f/F or incremental search to jump immediately to a specific character.
I haven't used Emacs since the mid 80's, after the "standard" keyboard moved the Ctrl- key to where it strained my little pinky to find it. Emacs became too uncomfortable. And recently, it has been noted that old-time Emacs users (e.g., Stallman, Gosling) suffer from RepetitiveStressInjury at a greater rate than old-time Vi users. --DaveSmith (OK, I don't like Emacs any more than the next Vi guy, but, this sounds awfully fishy to me. Is there a source for this research? --SamuelFalvo?) I started using Emacs 25 years ago on TOPS-20, and so found vi quite primitive. But after about ten years I started to suffer RSI problems. So I bought a Kinesis Classic keyboard (http://www.kinesis-ergo.com) with two foot switches, and mapped one to Ctrl and one to Alt. No more pain, and it's really fast. --KevinCline Yay, pedals! I wonder how many programmers are OrganistsAtHeart?, who'd like to use pedals for modifier keys, and maybe even have multiple keyboards for typing things into different places... The use of pedals would almost certainly make me switch to using Emacs (or, actually, something more like JefRaskin's HumaneInterface-type editing environment). Pedals are not standard (or cheap!) fare however. --SamuelFalvo? {Pedals do sound sweet. What I really want, however, is a system that reads my mind (or at least my posture, facial expressions, gestures, eyes, and prior communications habits - especially undos and explicit commands) and correctly determines the 'mode' or 'context' of my communications and keystrokes. If Derren Brown (MindControlWithDerrenBrown) can do it, why can't my computer?}
I don't have any 'standard' keyboards; the few intel machines I use have been re-mapped or replaced. I don't know if your statistics are meaningful on the RSI front certainly a couple of highly-likely-to-get-RSI types like those don't mean anything. Anyway, with my bindings (highly customised) I don't find emacs pushes me off home more than vi did. I left vi begrudgingly, as at the time the feature set of emacs was a big win
If those folks remapped their keyboards differently then they might not have got RSI. If a vi user remaps ESC to where an emacs user has Ctrl/Meta/Alt or vice versa would there be a difference? In the end if all those people chucked out the Qwerty and got a DvorakKeyboard instead perhaps none of them would have RSI. A question of layout, DvorakVsQwerty? perhaps, In the end and as a SysAdmin I often find I need to be able to use both, and neither seems any nearer perfection than the other. Comments like this always get me ROTFLing. Or am I missing something? Has someone extended one of the vi clones into an environment in which you could develop several e-mail clients, a newsreader, a web browser, and adventure game, a towers-of-hanoi animation, and more? Ignorance is bliss, I suppose. Luckily for the systems that they admin, I know several sysadmins who use both editors but are well aware that the difference is not the keyboard layout. Yes, you are indeed missing something. It's obviously true that Emacs can do all that and more -- much more than vi and its clones. But what you are missing is that not everyone cares. Some people only want a text editor to do text editing, and think that it is the shell that should do process control, and that it is the job of programming languages to implement new programs. For those people, the question of how Emacs and vi (clones) are different is just a question of key bindings of common editing operations -- and like he said, there's not THAT much difference in that area (although people do tend to have their preferences). Do you make fun of RollerBlades, snow skis, and bicycles for being so much less capable than 747 jet airliners? Different tools have different purposes, and different people do, too. Some people wouldn't dream of roller blading. If they're going to travel, they're going to use a 747, because of all of its obvious advantages. That doesn't mean there is no place in the world for other people with other preferences -- like for small tools that do just ONE job well. There's nothing wrong with my bicycle. I only ride it to work 10 minutes away, it fits in my garage, I can afford a new one if it gets stolen -- none of that is true of a 747. And I can pack it in the back of my car for longer road trips. (Bicycle isn't the most flattering analogy for vi, so that's damning it with faint praise, but currently I have a mental block on a better one. Vi and its predecessor ed have had regular expression search and search-and-replace from day 1, while emacs took years to get around to stealing the idea...so there was a period of time when vi was just plain superior to Emacs for many common operations.) Back when I used emacs under TOPS-20, I used it for a zillion things other than text editing, because there really wasn't any other way to go. The TOPS-20 command interpreter couldn't do Unix-style shell scripting -- it didn't have grep and sed and awk and all that. All of which I missed, since I used Unix before TOPS-20. So Emacs was great. When I went back to Unix, Emacs was no longer absolutely essential, it was a matter of preference; all that other stuff could be done in other ways. I know (well, used to know) both vi and emacs extremely well. I use vi these days. It's not out of ignorance. I like the vi key bindings, and no matter what emacs fans say, there is no vi major mode emulation that does a decent job of offering the vi key bindings (unless someone has done a new one just recently). All the other stuff Emacs wants to do for me, I instead do in shell/sed/perl/awk/clisp/scheme/C/whatever. What is wrong with Emacs mode "Viper" (http://www.delorie.com/gnu/docs/emacs/viper.html)? It can be easily customized from total compatibility with original Vi, to any mixture of Vi and Emacs key bindings. Or I am missing something? On the other hand, I find strange that a clisp/scheme user prefer a vi clone to Emacs. Bottom line: Emacs is ultra-powerful but bloated as hell. Small is beautiful, and so I like vi clones. And nobody ever claimed that vi causes RSI. ;-) PC keyboards with braindead control-key and shiftlock-key placement sure don't help, either. They're not braindead at all. I prefer the CTRL key where it's at, because I have little use for it except for CTRL-[ZXCV] and the occasional CTRL-G. If I need other control characters for some reason, I alternate between the two CTRL keys the same way I alternate between the two SHIFT keys while touch-typing. No RSI. No nonsense. If you want to remap the caps lock key, remap it to backspace, where it'll be substantially more useful anyway. --SamuelFalvo? Eric Raymond's "Art of Unix Programming" is one-sidedly bigoted about Emacs through missing the above not-so-subtle points, btw. --DougMerritt
When I started using emacs under HP-UX, I came to like it - I never left it. However, I did use the vi mode constantly. However, there are no clones that come even close to what emacs can do. The clones don't have lisp, and they don't have the equivalent shell mode that emacs does. The emacs clones don't have the power of emacs, and are normally only good for editing. However, vi clones are plentiful (and have been for decades) and a regular vi user can use a clone and not know the difference. vi is also considerably smaller and can fit onto a low density floppy disk. Emacs for DOS required special memory handling; vi never did. Oh yes we can. ;) VIM vs. Elvis -- I can't believe some systems choose Elvis over Vim. But I digress. --SamuelFalvo?vi is also available as the standard editor on every UNIX and Linux installation - so there's no hunting for a missing editor, or being upset because the system doesn't have enough disk space for it. Acutally, that is not true. Neither Emacs, nor Vi come standard with a Gentoo system, though of course you can install either or both of them.
  :  It is notable, though, that vi is on every UNIX system: if it does not have vi, it isn't UNIX (based on the single UNIX specification).

As a touch typist (60-80wpm or better) vi is also much faster. So here you have an editor which is:
  • everywhere
  • fast
  • small
  • portable
  • capable
  • clonable
emacs has a lot of power and is very nice, but the power comes at a cost.
'Using vi is not a sin, it's a penance.' -- RMS Actually 'It's true that ViViVi? is the editor of the beast, but using a free version of Vi is not a sin, is a penitence.'
I use both, for different things. Am I going to catch flak from both sides now?
vi is cute
Is the Unix tradition not "Do one thing, and do it well."? In my opinion, Emacs having a shell, programming language, mail reader, man page viewer, info viewer, web browser, and a thousand other things is a far cry from this. I prefer vi (I actually use vim).
^^^ I agree completely with the above. Vi[m] does all I need and more. Emacs' syntax and interface feel far too bulky and awkward for my needs. I can't imagine Emacs is not a capable and powerful "environment" or it wouldn't still be around nor have such a following, but it's not for me.
Regarding the above two comments: What a lot of people fail to understand about Emacs is that it is not a large text editor. Emacs is a small Lisp machine. "Emacs" also commonly refers to a reasonably small text editor which runs on that Lisp machine, and serves as it's primary user interface. "Emacs" can also be used to refer collectively to the Lisp machine, the editor, and the entire massive collection of software which runs on it - mostly small programs that do one thing and do it well. This is no more opposed to the Unix philosophy than Unix (or Linux) itself, which refers to a kernel, a (variety of) command shell(s), and an entire massive collection of software which runs on it.
I am a vi user (in addition to various text editors for Windows), but the one thing Emacs has in its favor is that you can have "documents" that are really interactions with command line tools. For example, you can have a document that's a running log of interactions with a Python interpreter. It's more than just a telnet window. You can type code anywhere in your document, highlight it, send it to the Python interpreter running in the background, and have the output automatically inserted into your document. This makes Emacs be a live editing environment, which is wonderful if you use interpreted programming languages. vi only lets you run selections through a filter, which isn't the same thing. An excellent point, and I've been researching Emacs for precisely this reason. However, in my recent forays into Emacs, I've found that my Vi habits interfered too much. So, who's up for writing a Vi clone in ANSI Common Lisp to put Emacs out of its misery? ;D --SamuelFalvo?
I took a course on Unix basics a couple of years ago. We worked with both Vi and Emacs, and both experiences were firsts for me. When I finished the course, I could edit text files and use a few arcane commands in Emacs, but to this day I still don't know how to get Vi into edit mode.
  • "i" puts vi into Insert mode. Long and complex, non-mnemonic, incredibly hard to memorize, who could fault you? You're not a rocket scientist, after all.
  • "A" puts vi into Insert mode too, to append to the current line.
There's also "O" and "a", but I leave it to you to try it and be pleasantly surprised.
There's a lot of good discussion on this page but no one has yet mentioned Emacs' greatest strength: EVERYTHING is a buffer. If you are an Emacs user and you learn to get really fast at editing text in a "normal" buffer then you can bring that same textual alacrity to every other operation: writing emails, constructing complex shell commands, logging into version control systems, composing a blog entry for blogspot, maintaining a calendar, even remotely editing this wiki! Imagine the common situation of editing some code until it works, saving those changes to a version control system, and then emailing your collaborators about your progress. In vi, (correct me if I'm wrong about this...) you edit the code, exit vi (ugh!) or use a tool like screen or another terminal (better!) to pop into the shell, compile your source, pop back into vi to fix errors, repeat...repeat...now it's compiled so use the shell to run it and see if it works...it doesn't, so repeat...repeat...finally it works so you fire up SVN (or git or whatever you use) which starts a NEW vi in which you write your log message...and then you pop over to a Pine or a Mutt and write your email. During this whole process you're constantly switching mental models of the tool you're using and its interface for inputting text. You can muck with your inputrc to make the shell "feel like" vi but your shell will never BE vi. It will inevitably lack some advanced vi feature that you're used to using when normally manipulating text. And let's not forget the constant killing/opening of vi (or fg/bg of it). In Emacs, you have your source, the output of "make" (or whatever compilation command you want to use), the shell, your version control summary, and your email client open at the same time in the same place as BUFFERS: you edit your source, you compile it (with a single command instead of having to pop over to another tool), you see the compilation output, any errors are immediately hyperlinked by Emacs back to the offending line in the source (this feature is indispensible!), and so the "code, compile, correct" inner-loop is FAR tighter than it would be when wrangling together several tools. Having gotten your code to compile, the shell is waiting for you in another buffer to run it and (if needed) go back to that "code, compile, correct" inner loop. Having finished your work, you use the version control buffer to commit your changes and when typing your log message (in the same Emacs that you've been using this whole time) you have access to the entire history of your compilation and shell buffers waiting and ready to be searched. You can diff your new, working source against the old copy in the version control repository without leaving Emacs by just having the version control buffer pop open a diff buffer. When you've finished, you use the same tool you're already in to compose an email to your collaborators and you're done. The entire time, the way you deal with the text you're writing is identical and there's no need to switch mental gears and you can freely move text from one buffer to another. Oh, and Emacs will also pop open a reminder in the middle of it all to tell you to buy your girlfriend flowers for your anniversary that night and you can either deal with it immediately by finding a florist online (in Emacs!) and opening the BBDB (contacts manager) file you have on your girlfriend to remember that she'd prefer orchids to roses and then immediately pop back to the set of buffers that you were using to code and compile, or decide to defer it all to another time using one of Emacs' many time and information managers. I think that people who like to work on one task at a time in a sequence would prefer vi but those who are able to "hyper-thread", as it were, would benefit from Emacs' ability to integrate a host of tools and services under a common text processing metaphor. I routinely use :!make in vim, and have my .vimrc edited to make git blame and many other operations simple and quick commands. If you decide to customize vi, there is very little standing in the way of your productivity. Vim of course has similar functionality for compiling and fixing errors in the manner explained above “:help quickfix.txt”.
For me the main difference is that vi is an editor with advanced features, while emacs is a full text-based desktop environment with a focus on the content, and it even includes vi as editor via viper-mode or vimpulse (there you have your vi-clone in elisp :) ), the first available in emacs, the second in the emacs wiki: http://www.emacswiki.org/emacs/VimpulseAlso I just discovered control-lock in emacs which allows for modal editing in emacs using native emacs keys :) A modal system is useful if you often do long streaks of commands interspersed with short editing (cut+yank are commands :) ). For example it is useful if you do errorchecking. For example po-mode in emacs is strictly modal. On the other hand, when you input new content, the only need few commands now and then, and there switching between the modes is unnecessary overhead. For example po-mode in emacs is strictly modal. Aside from that, I’d simply like to name some things I found useful:
  • tramp (network transparent editing)
  • M-! for a shell command. In vi in edit mode it is ESC-:!, IIRC.
  • emacs daemon: start your emacs at system start.
  • w3m (I write this in w3m-mode).
  • remember-mode and org-mode for tagging, text-based task lists.
  • outline-mode for LaTeX (in AUCTeX).
  • RefTeX, referencing in LaTeX never was as easy :)
  • A graphical mode with images by default, but at the same time usable in the shell – when you use the daemon, you can even begin a set of buffers in the shell and continue seamlessly in X.
  • VC-mode (using any version control system, committing via C-x vv).
-- ArneBab
Nep, nep ArneBab:
  • Vim also uses network "transparent" editing. ssh/ftp/http, etcetera.
  • You have to type what? I just type ! in normal mode to issue shell commands on Vim (map ! :!<cr>)
You can't assume a nice text editor is what you get after fresh install.
  • Why would someone want to start an editor at system start-up? Oh, I see, to make up the fact that's bloated.
  • Why would I ever need a specific "w3m mode" when I just open an html/xml file to get all the formating and smart completion I need via default mime-types plus snipMate?
  • Ever heard of ctags and -more recently- cscope?
  • Outline and WIKI mode ready to spit standard html or html-ized code, what's up with that?
  • What is X? Oh, yes, that in which gVim and vim-x operate. Q.E.D.
  • TeX/LaTeX/ConTeXt capabilities are readily available and easily expandable to suit user needs (with very simple commands or basic scripting instead of messing with Lisp)
  • VC-mode? Meh! I can achieve the same results in Vim without breaking my wrists...
Use whatever you like but remember to avoid RSI. I'm really sorry for Richard -enough said. -- MarioGarciaH
Good news everybody! The Emacs vs Vim wars are over. James Gosling uses Vim (revealed in a recent interview). When one of the original authors of Emacs switches to Vim you can kiss the argument goodbye. -- DavidPlumpton Um, no. James Gosling wrote a clone with a mocklisp interpreter and emacs was a collection of macros for a derivative of TECO made by Stallman in 1976. Gosling emacs, however was written in 1981 and became proprietary software in 1984. GNU Emacs was started as a free software alternative to Gosling Emacs. --GoodwillStranger
Emacs all the way. Why use a regular knife when you can have a Swiss Army knife?
CategoryEmacs, CategoryVi, CategoryComparisons, CategoryPerpetualArgument, CategoryRant

EditText of this page (last edited January 25, 2012) or FindPage with title or text search

原文地址:https://www.cnblogs.com/lvpengms/p/2329706.html