Emacs or Vi? Why the answer is neither.

Bruno Medeiros brunodomedeiros+spam at com.gmail
Mon Jun 20 09:57:30 PDT 2011


On 11/06/2011 19:51, Jesse Phillips wrote:
> On Thu, 02 Jun 2011 17:49:52 +0100, Bruno Medeiros wrote:
>
>> It seems to be article season, and I'm on a bit of a punditry mood, so
>> here's a blog post I wrote recently:
>>
>> http://pureconcepture.blogspot.com/2011/05/emacs-or-vi-why-answer-is-
> neither.html
>>
>> It's not about D, but it's a software development issue that has popped
>> up several times here in the NG... :)
>
> I'm sorry but your conclusion is something I cannot agree with on many
> points. The big thing you miss is that most code is text. I can agree
> that Vim (I will not speak for Emacs) is not a good IDE and is bad at
> understanding the semantics of a language. But to dismiss a text editor
> for writing code because it is textual...
>

Yes, most code is text. So what?


>
> The strangest credit you gave an IDE, "navigate to member/element above/
> below - Ctrl-Shift-Up/Down), word navigate (Ctrl-Left/Right)" This is Vim
> territory here. And you left off search, that one is simple in any
> editor, but with Vim you can be selecting text and search to where you
> want to end the selection. There are tons of ways to navigate in vim.
> Using * to find the next instance of a word, w to jump a word, % to
> navigate to the matching paren/bracket/etc.
>

Ok, maybe word navigate Ctrl-Left/Right is mostly textual than otherwise 
(although in JDT that is still done with knowledge of the language). But 
that is just one of several tasks I mentioned. Not enough to turn the 
argument.
And navigate to member/element above/below is not Vim territory, from 
what I understand of your posts. This requires a basic semantic 
understanding, it's not the same as (or replaceable with) bracket 
matching. Do you understand how it works? Say you have the cursor inside 
a function (or next to the name of the function). If you navigate member 
up/down, the cursor will go the name of the function sibling to the one 
you are now. Does Vim have this operation?

> I'd like to leave you with a thought experiment. The next time you need
> to change a word (not rename a variable), or change all the content
> inside quotes and think to yourself, this would be easier in Vim. You
> don't have to believe it, but I bet you if you remember to tell yourself
> this you'll see how common it is. I've done this very thing except mine
> was "If I could just remember that command to do this."

If by word you mean something in a string literal (something inside 
quotes), or a word in documentation, then I can tell you already it's 
really uncommon for me do that, if not downright rare. The closest thing 
I have is changing code that is commented, that one happens sometimes. 
But it doesn't happen nearly as often as the other semantic operations 
Vim doesn't have.




 > Personally I don't like working in Java without Eclipse and in C# without
 > VS or MonoDevelop. But many times I will open the file in Vim or just
 > copy and past a section of code in Vim just so I can have a text editor
 > to edit my text. I miss Vim in my terminal.
 >
 > I don't claim to know the ins and outs of an IDE, but you haven't
 > convinced me. Vim's understanding of the code is zero, the closest thing
 > it has is the ability to navigate tags which are generated by ctags. It
 > only works for navigation and those languages supported by the program
 > (just like an IDE). But some things, like a Type Hierarchy and Outline
 > should be created by the documentation generator.
 >
 > Some other items are very nice, but are not common during a days coding.
 > I rename variables all the time, but usually these are local in scope and
 > and can be done with a quick search and replace on a selection or file.
 >

Why is it that it is not common "during a days coding"? Why local 
variables are common, but not functions, methods, classes, modules, 
etc.? What languages are talking about here?

For me to convince (or just argue) any further, I would have to look at 
your work patterns and workflow. It's hard to make a concrete and more 
objective argument otherwise.
But my suspicion is that you (as well as many other programmers) mostly 
use languages that are very hard to have semantic operations available 
in tools (like C/C++ by "virtue" of their preprocessor and 
metaprogramming, or dynamic and scripting languages by "virtue" of their 
lack of static typing). Thus you never understand the potential of it, 
because you never fully experienced it. Note that this is not something 
you can just try in a few days of trying Java and an IDE, rather it 
grows on you after long periods of development experience. A bit quicker 
if you are wiser ;)

Reminds me of when I was a kid in high school, and I knew a fair amount 
of C, and did a fair amount of toy coding there. I had a friend who 
coded in Pascal, he didn't know C. I tried to explain him that C was 
better, I said stuff like "the syntax is cleaner, it's more simple yet 
more powerful, it's more elegant" etc., etc. but my friend did not 
understand and never agreed. He saw no reason to change. Only later, 
when he actually tried and learned C (before, and because of, going to 
college), he came back to me said, yeah, "you were right", "now I see 
what you mean, C is much better".

A similar thing happens today. Think of the DVCS "revolution". How many 
coders, even though they were not fans of Subversion, and knew branching 
and merging was hard and could be better, only understood the power, 
benefits, and "paradigm shift" of DVCS when they actually started using 
them for a while?? Whereas before they were a bit skeptical of all the 
benefits? (See the Joel on Software intro to Mercurial for example)


This is the same feeling I have whenever I discuss this IDE vs. not 
issue. It just seem to me the people on the not camp don't get the 
paradigm shift. Case in point: I've yet to meet an experienced Java 
programmer who would fundamentally disagree with me on this issue. Yes, 
this anecdotal, but note that in any case meeting *one* such programmer 
would not counter my point: which is that in the Java world virtually 
everyone uses (prefers) an IDE.
Some will say that's a fault of Java, and that Java "requires an IDE", 
like Ary said. But that is another discussion (which I strongly 
disagree, of course).


-- 
Bruno Medeiros - Software Engineer


More information about the Digitalmars-d-ide mailing list