New Features
Display the window decision chars in the mode line
Enable ace-window-display-mode
for this. This gives you the advantage of always being aware which window corresponds to which char.
New defcustom: aw-ignore-current
This is off by default. When t, ace-window
will ignore selected-window
.
Allow to switch the window action midway
Ace-window has many commands available, like:
ace-select-window
ace-delete-window
ace-swap-window
- ...
But did you wish sometimes when you called ace-select-window
that you should have called ace-delete-window
? In the old way, you would cancel ace-select-window
with C-g and call ace-delete-window
.
With the new way, you can, just press x followed by the decision char. All keys are customizable through aw-dispatch-alist
.
(defvar aw-dispatch-alist
'((?x aw-delete-window " Ace - Delete Window")
(?m aw-swap-window " Ace - Swap Window")
(?n aw-flip-window)
(?v aw-split-window-vert " Ace - Split Vert Window")
(?b aw-split-window-horz " Ace - Split Horz Window")
(?i delete-other-windows " Ace - Maximize Window")
(?o delete-other-windows))
"List of actions for `aw-dispatch-default'.")
The strings beside each command are important: they are used to update the mode line when you press a char. They also mean that a window should be selected using aw-keys
for the corresponding command. If there's no string, the command is just called straight away, with no arguments. To reiterate, for each entry without a string, its command will be called immediately, and for others the window will be selected first.
Also, take note of aw-flip-window
. Suppose the you have a lot (say 7) windows, but you only want to cycle between the most recent two. You can do so with n, with no need to press the decision char.
I call this feature "the dispatch". The dispatch normally happens when:
- you're prompted for
aw-keys
- you press a char that isn't in
aw-keys
- there's an entry in
aw-dispatch-alist
for this char
If you want to skip step 1 always (since, by default, you're not prompted for aw-keys
when you have 2 or less windows), use:
(setq aw-dispatch-always t)
Be careful though, setting this means that you'll always have to select a window with aw-keys
, even if there are only two. This is a large toll on the muscle memory. On the other hand, even with one window, assuming you've bound ace-window
to M-p, you get:
split-window-vertically
on M-p vsplit-window-horizontally
on M-p bdelete-other-windows
on M-p o
What's also nice is that these commands scale with the amount of windows: if you have only one window, you get no prompt for M-p v, so it acts just like C-x 2. But if you have more windows, you don't have to select the window that you want to split beforehand: you can select it after you decided to issue a split operation.
See the wiki for a nice customization setup by @joedicastro.