Bit side of life

Technical notes of digital heart

Emacs Windows Switching

| Comments

It takes a few days for beginner Emacs user to learn what’s the difference between windows and frames. Then usually next question arises: how to switch between multiple windows within same Emacs frame?

The most obvious way is to use mouse/touchpad of course. It’s easy at the beginning but horribly distracting in a long term. Emacs unfortunately doesn’t really help with its crazy default shortcuts. There is C-x o described as “select another window” which cycles through all available windows. Well, good luck with selecting windows this way longer than a day.

But hey, there is a hope. Default windows switching is so insane that lot of people tried to address this problem with additional packages. One of the most popular is window numbering:

Enable window-numbering-mode and use M-1 through M-0 to navigate.

Yup, that’s what we really need - simple shortcuts to activate immediately each window in a frame. But there is something more. Having frame split into multiple windows sooner or later makes some of them awfully hard to use beacuse of little space they occupy. Time to introduce a real hero - golden ratio package which resizes seleted windows to the size specified in the “Golden Ratio”. Sounds cool, works even cooler when bound with shortcuts provided by window-numbering:

(defadvice select-window-by-number (after select-window activate)

This is how it looks like in action: