Emacs

GNU / Linux Terminal Tips

I'm using GNOME terminal (bash) in Ubuntu. These tips should work on other terminals also.

Cursor Movement

You can navigate with the cursor using the same keystrokes as you would use in Emacs. A few examples:

C means the "Ctrl" key. M means the "Alt" key (meta key). Often the Ctrl key will act on one character (or smaller unit) and the Meta key (Alt) will act on one word (or larger unit).

  • C-f — Forward one character.
  • C-b — Backwards one character.
  • M-f — Forward one word.
  • M-b — Backwards one word.
  • C-a — Move to the beginning of the line.
  • C-e — Move to the end of the line.
  • C-d — Delete one character.
  • M-d — Delete one word.

You can also highlight text and use Ctrl-Shift-c to copy, and Ctrl-Shift v to paste (at least in GNOME Terminal in Ubuntu).

Scrolling the Terminal

To scroll the terminal text, use Shift-PageUp and Shift-PageDown. In GNOME terminal you can also use the mouse wheel to scroll.

Terminal History

Your computer stores a history of commands that you type. You can use the up arrow key or down arrow key to navigate through your history.

You can view your history by typing history in the terminal.

You can search for a previously typed command by using the key combination C-r (which means "reverse search" in Emacs).

You can also use grep to find previously typed commands like this: history | grep "search words here"

GNU / Linux documentation

Your computer has documentation built in. The two commands are man and info. For example, if you want to learn more about the history command, just type man history in the terminal. You could alternatively type info history.


Emacs HTML Helper Mode Demonstration

GNU Emacs is a free editor for GNU/Linux, Mac OS X, and many other operating systems, including Microsoft Windows.

Emacs can be frustrating to learn, but after forcing myself to use it for a while it became much faster to use than other text editors. It doesn't work like other text editors like Windows Notepad, or GNOME's gedit. You get a lot of power to move around and manipulate text with keyboard commands. You can use Emacs Lisp to add new features to the editor. The Emacs manual is something like 600 pages. I haven't read all 600 pages yet, but there is some good information in there.


How to Change the Default Text Editor on Ubuntu With Nautilus

Further experimentation with editors for Ruby on Rails led to the question "how do I change the default editor on Ubuntu?" All of my files were opening in gedit and to override it I had to right-click on my .rb and .rhtml files and then choose my desired editor.

I finally figured out how to quickly change Ubuntu's default text editor with Nautilus:

  1. Right click on a text file
  2. Choose "Properties"
  3. Click on the "Open With" tab
  4. Choose your new default text editor

Changing the default Ubuntu text editor


Ruby on Rails Editors and IDEs: Ubuntu: jEdit, emacs, RadRails, Cream, SciTE

I spent many hours today trying to find a good editor on Ubuntu Linux for working with Ruby on Rails.

Emacs, gedit, and other editors were not working well for me. I was having problem with indentation and syntax highlighting with .rhtml files so I began investigating other editors for Ruby on Rails that would run on Ubuntu Dapper Drake.


Syndicate content