|
Grex > Systems > #74: The Great Text-Editor Holy War Item. | |
|
| Author |
Message |
cross
|
|
The Great Text-Editor Holy War Item.
|
Apr 22 03:42 UTC 2007 |
Vi or emacs? I prefer acme (under Plan 9, or ported to Unix) or TextMate
(under Mac OS X).
This is the great text-editor holy war item. Best to testify in the name
here....
|
| 80 responses total. |
mcnally
|
|
response 1 of 80:
|
Apr 22 03:47 UTC 2007 |
vim for me, unless I'm doing something very specialized.
|
nharmon
|
|
response 2 of 80:
|
Apr 22 12:52 UTC 2007 |
pico/nano because I'm lazy and haven't learned very much vi. :)
|
cross
|
|
response 3 of 80:
|
Apr 22 16:19 UTC 2007 |
Remmers had a great post about this subject on M-Net; I'm hoping he will
repost that with context here.
|
kingjon
|
|
response 4 of 80:
|
Apr 22 18:10 UTC 2007 |
Vim. I do need to learn Emacs sometime, if only to take advantage of the
Emacs-like features of the Bash shell, but I've already got an operating
system; I don't want one in my editor.
|
cross
|
|
response 5 of 80:
|
Apr 23 03:32 UTC 2007 |
Here's a blog post on switching from emacs to TextMate on the Mac:
http://www.oreillynet.com/mac/blog/2006/05/emacs_est_mort_vive_le_textmat_1
.ht
ml
The best line in it (regarding Emacs LISP): "Dont get me wrong, being fluent
in a programing language from 1958 gets me plenty of trim at parties."
Yea!
|
maus
|
|
response 6 of 80:
|
Apr 23 06:18 UTC 2007 |
I prefer vi, because I am guaranteed to have the same base functionality
on UNIX, BSD, Linux, etc. I also like the fact that I don't hurt my
wrists trying to hold Esc+Shift+Control+K to make things happen. I also
don't like waiting longer for a text editor to start up than I do for a
full-blown GUI application like Gnumeric. Most of all, I learned vi
first, so I have an inherent bias towards it.
|
mcnally
|
|
response 7 of 80:
|
Apr 23 16:16 UTC 2007 |
There's apparently no truth to the canard that emacs was named as it is
to be an acronym for "escape-meta-alt-control-shift". But it should have
been.
C-x C-c
|
cross
|
|
response 8 of 80:
|
Apr 23 20:53 UTC 2007 |
Heh. Emacs was actually originally a set of macros for the TECO text editor
on the DEC PDP series of machines. It stood for Editor MACroS.
|
ball
|
|
response 9 of 80:
|
Apr 23 20:56 UTC 2007 |
"joe" for me, because I'm from a CP/M background.
Does EMACS have Ctrl-S and Ctrl-Q bound to functions in the
software? If so, I think that qualifies Stallman as a
lunatic (in case anyone was left wondering ;-)
|
mcnally
|
|
response 10 of 80:
|
Apr 23 22:16 UTC 2007 |
re #9: (regarding XOFF/XON -- nothing is bound to ^S, ^Q by default,
so far as I know. But it's not uncommon for people to customize emacs
with a site-specific customization file that binds functions to those
keys. Obviously, though, that doesn't work well via a terminal session.
|
albaugh
|
|
response 11 of 80:
|
Apr 23 22:18 UTC 2007 |
I use vi because I do UNIX/Linux based editing so infrequently that I'm not
going to be learning something better, and knowing vi is fairly transportable
to the various *x flavors.
|
maus
|
|
response 12 of 80:
|
Apr 24 06:03 UTC 2007 |
To be fair, vi has its quirks as well. The last time I drank with a
friend from UT Austin, he put it very well: "vi has two modes: one which
beeps at me, and one which mangles my file". A mode-oriented editor
either requires you to set a bit in your brain for which mode it is in,
or be prepared to hit Esc button before doing anything to know with some
certainty which mode you are in.
Oh, and be prepared to retrain your br@n3 when coming back to windows.
Apparently Notepad does not care much for trying to end a file by typing
"Esc :wq", though the version I had when I had that trouble was nice
enough to beep at me, just like vi.
|
mcnally
|
|
response 13 of 80:
|
Apr 24 15:37 UTC 2007 |
In any vi made in the last 10 years or so you can probably ":set showmode"
to fix the awkward problem off not knowing when you're in insert mode..
|
remmers
|
|
response 14 of 80:
|
Apr 24 18:07 UTC 2007 |
Re #10: In just about every version of emacs I've used, ^s and ^q are
bound to the functions "isearch-forward" (incremental search) and
"quoted-insert" (for inserting control characters and such in the
buffer), respectively. I can't recall ever having a problem with them
working correctly in an emacs terminal session. I'm sure emacs
accomplishes this by putting the terminal in raw or cbreak mode.
Stallman has a lengthy explanation somewhere as to why he thinks this is
appropriate and that binding ^s and ^q to XOFF and XON is "wrong".
I posted a lengthy response on M-Net recently about vi vs. emacs and why
I prefer the latter for source code and some other kinds of highly
structured text. Will repost it here eventually, possibly shortened.
|
ball
|
|
response 15 of 80:
|
Apr 24 22:50 UTC 2007 |
It's not a question of binding ^S and ^Q to XOFF and XON,
they /are/ XOFF and XON by virtue of being DC3 and DC1! If
you're on a link that's using hardware flow control and
ignoring software flow control, it's no problem. If you're
on a link that requires (or respects) software flow control,
you're screwed.
|
mcnally
|
|
response 16 of 80:
|
Apr 25 02:14 UTC 2007 |
You're not getting the meaning I intended -- perhaps I was unclear.
What I meant was that (presumably because of their flow control functions)
emacs doesn't by default bind anything to ^S or ^Q. But some sites choose
to override the defaults, especially if they're mostly editing in an
environment where serial flow control is not a big issue for users.
That can, of course, create problems when people are logging in remotely
over some types of connections. None of which is RMS's responsibility..
|
remmers
|
|
response 17 of 80:
|
Apr 25 13:40 UTC 2007 |
Re #16: "emacs doesn't by default bind anything to ^S or ^Q."
Maybe I'm misunderstanding you, but on the face of it that's contrary
to all the documentation I've ever seen, e.g. this from the tutorial
that comes with GNU emacs:
The command to initiate a search is C-s for forward search, and C-r
for reverse search.
Or this, from http://www.phys.unsw.edu.au/~mcba/newunix/node6.html:
One problem with emacs is that the author, Richard Stallman, has
used C-q and C-s as commands. The difficulty with this is that
these two characters are used by most terminals and computers for
flow control (i.e., if a computer receives a C-s it stops sending
output to the terminal until it receives a C-q). There are two ways
around this problem... [The author goes on describe a fix to the
problem Andy describes in #15.]
Besides ^S for forward search, emacs uses ^S as parts of other commands,
e.g. ^X^S for "save file".
|
mcnally
|
|
response 18 of 80:
|
Apr 25 16:50 UTC 2007 |
I stand corrected, then. And yeah, that's a pretty darn stupid thing to do.
|
easlern
|
|
response 19 of 80:
|
Apr 26 16:48 UTC 2007 |
I use vi unless I'm on a terminal that messes up my arrow keys. Then I use
pico. I'm not sure if it's really vi or vim that I use, but the shift-v thing
to highlight text, which you can then save in a separate file and later bring
back just by using :r is pretty handy in a terminal. Also the auto-indentation
stuff is nice for C, and the language-specific color coding is pretty handy,
but I think most of the editors have that feature by now. . .
|
kingjon
|
|
response 20 of 80:
|
Apr 26 18:31 UTC 2007 |
All of that is vim. (Strict vi doesn't allow arrow keys at all, but most
variants have added that.)
|
mcnally
|
|
response 21 of 80:
|
Apr 27 00:18 UTC 2007 |
Autoindent has been an option in VI for as long as I can remember.
It's not very smart about it, though..
|
remmers
|
|
response 22 of 80:
|
Apr 27 17:53 UTC 2007 |
Re #20: "Strict" vi has supported arrow keys since the 1980s when
properly specified in the termcap. Given the terminals and slow
connection speeds of those times, they often didn't work very well.
Re #21: In vi, doesn't the "autoindent" option simply consist of
indenting each line the same amount as the previous line, with special
keys (^T, ^D) to increase and decrease the indentation level? Right -
not smart.
Smart indenting requires teaching the editor something about the grammar
of the language being edited. Thanks to emacs' extensibility via its
embedded lisp interpreter, you can do that in emacs. It has a great C
mode that indents and exdents automatically - e.g. "{" increases the
indentation level, "}" decreases it. Recent versions also do color
syntax highlighting. I find these things very helpful when editing
source code; they're a major reason I prefer emacs for editing
structured text. Standard emacs distributions now come standard with
editing modes for a number of languages - Perl, PHP, Pythong, Ruby, etc.
|
kingjon
|
|
response 23 of 80:
|
Apr 27 23:21 UTC 2007 |
#22, first paragraph: I seem to have sent my copy of _UNIX Power Tools_ home
ahead of me; it has an article on the subject as its first or second article in
the chapter on vi. Most of what that article says that I was going to quote
here is that strict vi is a modal editor; use of arrow keys in command mode may
be permissible, but in an insertion mode it either inserts the control sequence
or just beeps. Most vendors have extended strict vi to allow arrow keys even in
insertion modes, but that leads to user confusion between the modes.
In re your third paragraph: Vim has all of those features by now, too.
|
remmers
|
|
response 24 of 80:
|
Apr 28 17:08 UTC 2007 |
Right - early arrow key support allowed it only in command mode, not
insert mode.
You're right, vim has similar features, and is extensible via a scripting
language. I haven't looked at it closely enough to know how it compares
in power to emacs lisp.
One nice feature of emacs is vi-mode, a pretty accurate and complete vi
emulation. You can switch in and out of it with a single keystroke (^Z in
my setup), and it gives me access to a few operations that are easier in
vi than emacs (e.g. repeated search-and-replace, or filtering text through
an external command) without leaving emacs. Best of both worlds.
|