I spend a fair amount of time ssh-ed into remote, headless linux servers. I often need to use a text editor to edit configuration files. Most don’t run X windows, so I can’t run emacs, my editor of choice, in graphical mode. I could use emacs -nw, which starts emacs in text mode, but emacs is still fairly heavy by default. These editing sessions are usually quick and simple, and I wouldn’t want to wait for a full-blown emacs to start every time.
I used pico for a while, since I use pine as my email client. However, I missed emacs’ depth and versatility. I considered vi, but I wasn’t exposed to it in the womb, and I’m not sure there’s any other way to learn it. :P
More importantly, I didn’t like using two different editors. Mental context switches are evil incarnate, and switching between text editors is a big context switch.
So, I set out to make the minimal emacs -nw setup – lightwight, fast to start, and still usable for casual editing. It actually turned out to be fairly easy. I use this command to start emacs:
emacs -nw --no-init-file --no-site-file \ --load .emacs.minimal
and this elisp in my my minimal .emacs:
; cutoff for word wrap (setq-default fill-column 79) ; F12 toggles auto-fill mode (global-set-key [f12] 'auto-fill-mode) ; C-- keybinding for undo (removes the shift) (global-set-key [(control -)] 'undo) ; turn on pending delete (when a region ; is selected, typing replaces it) (delete-selection-mode t) ; when on a tab, make the cursor the tab length (setq-default x-stretch-cursor t) ; avoid garbage collection (default is only 400k) (setq-default gc-cons-threshold 4000000) ; turn on random customization options (custom-set-variables '(sentence-end-double-space nil) '(truncate-partial-width-windows nil) '(line-number-mode t) '(column-number-mode t) '(query-user-mail-address nil) '(visible-bell t))
Your .emacs file is fairly personal, so you’ll probably want to customize it and add things from your standard .emacs. dotemacs.de is a good resource for writing and refining your .emacs file.