arch detail

arch detail

Friday, September 09, 2011

Better Emacs window switching

For years, I've hated the way emacs switches between windows with the next-window function (C-x o is the usual binding) - it operates as a cycle, which means that if you have 3 buffers open and you're doing editing in two of them, you always have to cycle through that last buffer (say, the one that holds compiler output) every time. This is irritating.

 Only today did I decide to find a better way. I found this: http://nex-3.com/posts/45-efficient-window-switching-in-emacs#comments

 (global-set-key [M-left] 'windmove-left)  
 (global-set-key [M-right] 'windmove-right)  
 (global-set-key [M-up] 'windmove-up) 
 (global-set-key [M-down] 'windmove-down)

Much better! Hold down your alt key and move around with your arrow keys. Nice! My ideal system would be to find a way to cycle through windows in order of last use, much like alt-tab works on most window managers. I'm not sure if this is possible in emacs, though; alt-tab works because you hold down the alt key and press tab as many times as you need. I don't think emacs supports that kind of key-press/key-release behavior, but maybe someone could prove me wrong?

No comments: