Swapping Windows with Ace-window

By way of background, I need to remind you that I use ace-window for switching between windows. I think of it like ibuffer: it’s so much better than the default command that everyone should configure it automatically when setting up their Emacs. I have it mapped to Ctrl+x o which is convenient because it acts identically to other-window when there are only two windows.

I was getting ready to write something else for today’s post when I noticed that my two side-by-side windows were not in the usual blog writing order. My OCD immediately kicked in and I decided to swap them. The other day I was reading that you can change the default ace-window action before selecting the window to change to. By pressing m you can swap the current window with one of the others. Of course, that only works when there are three or more windows. When there are two windows it simply changes window focus immediately.

I wondered if there was a way to force one of the alternate actions so I typed Ctrl+u Ctrl+x o as an experiment. It immediately swapped the windows. I checked the documentation and discovered that if you type Ctrl+u twice before calling ace-window it will delete the current window. I’m not sure why you’d want that instead of the easier Ctrl+x k but that’s what happens.

Afterwards, I vaguely remembered knowing all this but I’d completely forgotten it. In case you’ve forgotten it too or didn’t know it, consider this a PSA. If you’re interested in what other actions you can perform when you have three or more windows, see here.

This entry was posted in General and tagged . Bookmark the permalink.