/home/brad

My corner of the web

Browsing Posts tagged life-with-emacs

This installment of Life with Emacs doesn’t have much in the way of opinions or what I’m using it for, instead I’ll just be posting the cheatsheet I’ve been keeping in hopes that it might help someone else out. As time goes on, I’ll keep adding to this. For now, I present to you my Emacs cheatsheet:

-- Buffers --
C-x C-f         Open existing (or new) file
C-x C-s         Save buffer
C-x C-w         Save buffer as...
C-x C-c         Exit Emacs

C-x b                   Switch to buffer. Type in the name.
C-x     Cycle through buffers
C-x 1           Return to 1 window
C-x 2           Split window into two
C-x o           Switch windows

-- Moving / Editing --
C-a             Beginning of line
C-e             End of line
C-s             Search
M-x string      Find and replace
C-w             Cut
M-w             Copy
C-y             Paste (yank)
C-k             Cut text to end of line

Emacs might be thought of as a programmer’s editor, but it works just as well as a text editor. But Brad, isn’t it a bit overkill to use Emacs for text editing? I’m a fan of getting as much use as I can out of an editor, and what better way than this? The buffers are one of my favorite things about Emacs. Sure, Vim has buffers, too, but I like the navigation in Emacs better. In my work, I deal with support tickets. So, when I take on a ticket, the first thing I’ll do is this C-x C-f 1111111, where 1111111 represents the ticket number I’m working on. Then from that point, as I gather information, I copy things from one window to another into that buffer to keep it handy. Once in a while, I’ll save the buffer with C-x C-s so I don’t risk losing the notes. This is definitely an easy way to keep my notes separated by ticket, and if I happen to be working on multiple tickets, I can switch buffers with C-x b then the buffer name.

By default, Emacs starts you out in a scratch buffer. I keep this open and use it to copy / paste tidbits of information that I might need later in the day, such as commands or even some time tracking. It truly is a scratch buffer in this case, and it works wonders. That’s it for this week. I was going to share my cheatsheet, but sadly I lost it. I’ll have it for next week. For now, I leave you with a summary of commands I used this week. For each of the commands, please note that C is the Control key, and M is the Meta, or ALT, key.

Emacs Commands Used

  • C-x C-f filename – Create a new file called filename. Can include paths. Example: C-x C-f /home/fubar/temp.txt
  • C-x C-s – Save the current buffer
  • C-x b – Switch to buffer. Presents a default buffer name, but type the name of the buffer you want.
Powered by WordPress Web Design by SRS Solutions © 2010 /home/brad Design by SRS Solutions