: Learning GNU Emacs, 3rd Edition

5.2.1 Viewing and Editing Files

5.2.1 Viewing and Editing Files

When you look at a directory listing, you may want to get a quick look at the files. Dired's v command does just this: put the cursor on the file you want to view and press v (for dired-view-file). Emacs displays the file in view mode.[27] This is a read-only mode, so you can't modify the file. Press C-c or q to return to the directory listing. While you're viewing the file, you can use s to start an incremental search, or press Enter to scroll the display down one line. Typing = tells you what line the cursor is on. There are a number of shortcuts for other Emacs commands (like marking text), but frankly, the regular commands work correctly. There's no reason to remember a special set of commands when the ones you already know work.

If you want to edit a file from the Dired buffer, move to the line the file is on and press Enter (a variety of other keystrokes work as well, such as f for find or e for edit). Emacs finds the file and you can edit it. This is a completely normal editing buffer: you can make any changes you want, save them, visit other files, and so on. Typing C-x b followed by the name of the directory you were working in moves you back to the Dired buffer. Or you can use the buffer menu (C-x C-b) to find and display the Dired buffer.

Viewing and editing files is nice, but you already know how to do thatright? You're waiting for the interesting stuff: how to delete files.


: 0.255. /Cache: 3 / 1