I ran across this thread on easier window switching within emacs using the windmove-xxx commands on gnu.emacs.help a few days ago. It’s always nice to find out about commands I didn’t know about… kinda like C-x M-c M-butterfly. I have always used C-x o and C-x b to move between windows and buffers, but my work monitor is large enough to allow me to split my frame into four windows. Using C-x o to move around has been somewhat of an annoyance. The windmove commands allow you to move up, down, left, and right between windows using a prefix key and the arrows on your keyboard. I have added the following to my .emacs:
(windmove-default-keybindings 'meta)
If you invoke the command without an argument then shift is used as the prefix. I also had to place this below the turning on of pc-selection-mode because it also sets the M-up, M-down, M-left, and M-right keys.
9 responses so far ↓
I was unable to get this to work on Mac OS X. I’m going to try Ubuntu when I get home. Any hints for Mac OS X? I’m new to it.
Ah… Nice trick…
@Luke – I am using carbon emacs on Mac OS X. What version are you using?
It works perfectly for me on the zenitani’s carbon emacs.
This is a nice one. Thanks a lot.
I’m an Emacs heretic, and defined a whole mess of CUA-style bindings (C-o for find-file, C-s for save-buffer, etc.), so my arrow keys are spoken for with things like M-left as backward-word.
But I’ve found C-n for other-window and C-b for switch-to-buffer to be quite nice in my 3 window setup.
Works like a champ in Aquamacs
Does this work in XEMACS
brilliant!
Leave a Comment