![]() ![]() It’s still useful to know the emacs commands, because they often work in other places. Within the past year, I substantially increased my emacs usage to the point where I was using it almost everyday for most typing tasks, including LaTeX, and my pinky finger didn’t like the constant reliance of the control key. Personally, I started my programming career using the emacs text editor because that was the preference of my Computer Organization professor, so I didn’t see the need to deviate. I don’t have a good answer to this so I’ll opt-out and provide a lame one: the one that’s better is the one that you can use best. If I had to give a general rule, I’d just go with choosing the one that felt best to you in the tutorials, or the one that’s most common among your colleagues, professors, or other peers.Īnd besides, it’s difficult to say which one of these editors is better than the other. They both do basically the same thing, and with the variety of extensions and customizations possible, I’m not sure there’s anything they can’t do that any other text editor can do, to be honest. Of course, one should decide at an early step of his or her programming career: emacs or vim? This is certainly a non-trivial task. So read the tutorials before seriously using these text editors. (The control-g command to quit something was a HUGE help to me once I read about it in the emacs tutorial.) And judging by the emacs questions that other Williams College computer science students have asked me, I can tell that not everyone reads the tutorial. As a result, I experienced a lot of pain early on in my computer science career that could have been avoided by just reading the tutorial. I just went by a list of common commands given to me by my professor and picked things up by experience and intense Googling. I have to confess that I didn’t learn emacs by using their tutorial. But using hjkl you will be able to move around much faster, once you get used to it. From vim: The cursor keys should also work.You can use the arrow keys, but it’s more efficient to keep your hands in the standard position and use the commands C-p, C-b, C-f, and C-n. From emacs: There are several ways you can do this.They emphasize, for instance, that once a programmer gets used to the commands to move the cursors, using them will be faster than resorting to the arrow keys since one doesn’t have to move hands off of the keyboard: I think the vim tutorial is better because it’s more structured but again, both of them do the job. ![]() ![]() This method of learning is excellent since you get a copy of the tutorial and can go through steps and exercises to test out the commands while navigating or modifying the file. For vim, type in “vimtutor” from the command line.For emacs, type in “emacs” and then perform control-h (hold the control key while pressing “h”) and press “t.” In emacs terminology, C-h t.Open up your command line interface (e.g., the Terminal on Macs) or your method of opening these editors. So what’s the quickest way to get started with these editors to the point where someone can write a small program? In my opinion, the best way is to go through their tutorials. If you watch an emacs or vim master type in their preferred text editor, you will be amazed at how quickly he or she can perform fancy alignment of text, advanced finding/replacing involving regular expressions, and other tasks that would otherwise have taken excruciatingly long using “traditional methods.” (Unfortunately, these people are hard to find….) Once one becomes used to the commands, though, emacs and vim allow very fast typesetting. With vim, users have to press escape repeatedly to go into “insert” (i.e., one can type things in) versus “normal” (i.e., one can move the cursor around, perform fancy deletions, etc.) mode. Emacs commands often involve holding the control or escape/meta key while pressing some other letter on the keyboard. One of the biggest problems that people new to these editors face is having to memorize a bunch of obscure commands. For smaller tasks, two of the most commonly used text editors by programmers are emacs and vim. Large projects typically involve too many files interacting with each other to work on a single program in isolation (for instance, it can be confusing to know what methods to refer to from another program in a file), so using an advanced integrated development environment (IDE) like Eclipse is probably the norm. Programming as part of a large project, such as building a new C++ compiler from scratch, is vastly different compared to a smaller task, like writing a script to answer a random Project Euler question. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |