A ‘long, long, long while back’, the first real editor I used was Vi. After that, I used a great editor on VMS called Eve.
Then, just ‘a long while back’, I made the switch from bare-bones VI to Emacs. That was what all the cool kids were using (middle 90’s). Then I even moved to XEmacs, since it was the best of the bunch. After a while, though, I got tired of all the problems. I didn’t want to be an elisp programmer in order to debug the frequent problems. For example, to set up an advanced IDE mode seemed to require all these packages that never seemed to be the right version. These packages were huge. This meant that they were hard to understand or modify. Things would break and it was no longer fun. I also noticed that I was getting the emacs pinkie problem. Double no fun. Where is the performance boost that this environment was supposed to deliver?
At about that time, VIm became popular and life was good again. It had most of the features that I missed from Emacs (aka: the features I could get running). So, for a long time I kept VIm as my editor of choice on the command line. This era also had me using Eclipse briefly, Visual Studio with Visual Assist heavily, and a few brief moments with some attempts at IDEs for Python.
Now it is 2008 and I’ve heard the Yegge rants. I’ve decided to give Emacs another go. Besides, a practical programmer should always continue to learn. After going back to Emacs, I now use Emacs in VIPER mode for VI compatability. I use a mixture of the two systems, and it works pretty well. I’m kind of cheating. It isn’t so strange when you consider the fact, that I always preferred or had the emacs keyboard navigation shortcuts on any OS I use. (note:the old C-e, C-a are really from the DEC Tenex OS)
This recent switch has brought me to an interesting understanding. It is kind of like the ‘worse is better’ understanding that was a popular read many moons back.
Emacs, by default, is in a mode for text creation. Text manipulation and navigation require chorded keypresses and thus cost more.
VI, by default has 2 modes, and it is cheap to switch between those modes. Each of those modes reuses the same keys, but keeps the costs low for all three modes: (text creation, text manipulation and text navigation).
I think this is why VI is such a winner. If you are doing any programming, you spend as much time doing navigation and manipulation as you do creating text. The costs for these chorded key sequences start to pile up on that left hand pretty quickly. This last point is the greatest discovery for me so far. Why? It seems like a little forethought by the Emacs team could have spotted this and made the same change a while back. It will be hard to change now. (Just look at Steve Jobs… it is going to be d-i-f-f-i-c-u-l-t to get rid of that crappy menu bar at the top). (I wonder if there are a few other tools that I use, that could be looked at with the same analysis? Maybe some programming languages??)
So why use Emacs? Well, the architecture of that system is a lot better than the VI system. I can do some powerful text manipulation with that system via the elisp and macro system. I feel and know I can build real ‘systems’ in elisp. I will say, though, that the cc-mode and other language mode support systems for emacs are really poor compared to the modern IDEs of today.
It is also interesting to point out where they both fail. Both systems are mired in the 1970s when it comes to UI. They are stuck in the old tty/terminal interface era. Neither system works or looks ‘just right’ on a modern operating system. This last point is easily seen as a big hole when you see the success of an editor like TextMate.
I just recently switched from Textmate to MacVim on the mac. Nice, native-ish interface that supports all the VIM commands as well as the native Mac (command-O, etc.). I too used Xemacs in the mid 90’s for a while, but the insanely long key commands (C-G C-X C-turnheadand_cough …) drove me nuts and gave me hand cramps. Why MacVim instead of Textmate, after 3 years of TM? TM is a great editor, but I work in several environments, and my brain needs one set of keystrokes to remember.
I love Emacs and Vim. i use Emacs for creating file, and Vim for editing, and i dont have any problem about shortcuts.
I’ve used many editors over the years. It’s nice that vi/vim is available on most Unix operating systems so it’s good to know the basics of vi/vim especially if you have to support multiple flavors of Unix. On the other hand, I started using Microemacs 3.9 for programming back in the Xenix days and still use the same version today (20 years later) with a little vi on the side. The only reason I still use MicroEmacs today is because the version I inherited came with key bindings mapped to the function keys F1-F12 and that’s what makes it efficient. Here are the basic function keys that I have used over the years to develop code…
Search: F1 = search F2 = search/replace
Cut/paste: F5+F5 = set mark F5+F3 = cut from mark into buffer Shift + F3 = paste buffer F4 = cut current line into buffer
Files: F7 = save all of your buffers and exit (that’s as easy as it gets) F8 = Read a new file into buffer F6 = Change the buffer you are viewing F9 = Show online help
Moving about: (F10 = Do key) F10 + “f” = go to matching fence F10 + “right arrow” = move to end of line F11 = scroll up one line F12 = scroll down one line
Like Microsoft word, the Arrow keys, Enter, Insert, Home, Delete, End, Page-up, and Page-down all work as you would expect them to work. You are always in “edit” mode with Microemacs.
Other stuff: F5 + “2” = Split screen into 2 windows (buffers) F5 + “3” = Split screen into 3 windows (buffers) F5 + = Switch windows = cancel what you are in the middle of doing
One of the handy feature of any editor is cut/paste. Using the functions keys above, here’s how you do it in MicroEmacs: F5 + “2” = split screen into two windows F6 = read in second file F5 + F5 = set mark of text you want to cut (then move to end of text) F5 + F3 = cut the text into memory + F3 = paste it back where you cut it from F5 + = change windows (buffers) + F3 = paste text into other window
With a little practice, cut/paste is very easy to perform.
It’s also crucial that you use a keyboard that has the function keys separated from the other keys on the keyboard. Once you start reaching for function keys, you will not want other keys nearby.
If you are comparing emacs and vi side by side with no function keys mapped, you might not see a benefit either way. They both have some awkward key mappings (in my opinion).
If you have never used F1-F12 with an editor, give it a try!