Log in

No account? Create an account
Corin Anderson's Journal
[Most Recent Entries] [Calendar View] [Friends View]

Thursday, September 1st, 2005

Time Event
I like rectangles
Someone at work introduced me to rectangle commands in emacs. Suppose you have several lines of text, like:


A rectangle command lets you take actions on a logical rectangle of the text. For example, you could cut all the usernames out by setting the point after the first users/, setting the mark at the end of person/, and then running kill-rectangle. You can put it back with yank-rectangle. You can also add new text in, the same text on each line, with string-insert-rectangle.

I like these commands enough that I added keybindings for them. I use a Windows keyboard, which is happily endowed with some extra modifiers. The windows key is my new friend, generating the "super" modifier. I've added this to my .emacs file:

;; Operate on rectangles. Pretty fun stuff.
(global-set-key [?\s-w] 'kill-rectangle)
(global-set-key [?\s-y] 'yank-rectangle)
(global-set-key [?\s-i] 'string-insert-rectangle)

Thus, Windows-w is analogous to C-w, Windows-y to C-y, and Windows-i inserts a string.

This is just the latest installment of my unintended charge this week, of being more productive by making many little tasks more efficient. I think the hour or so spent on them will easily be paid off in the coming days and weeks.

<< Previous Day 2005/09/01
Next Day >>
My Website   About LiveJournal.com