other-window advances me to the next frame in my frame list. But I also want a way to advance me to the previous frame.
Emacs has next-buffer and previous-buffer, but not a next-window, previous-window. Just other-window.
other-window advances me to the next frame in my frame list. But I also want a way to advance me to the previous frame.
Emacs has next-buffer and previous-buffer, but not a next-window, previous-window. Just other-window.
Put this in your .emacs, and bind it to whatever key you like
(defun back-window () (interactive) (other-window -1))
Provide a negative argument with "C-u -" ("Control+U" then "minus")
C-u - C-x o
C-u - C-x 5 o
From code, (other-window -1)
or (other-frame -1)
will do the same thing.
Check out the help for the key you want to reverse (e.g. C-h k C-x o
to show help for C-x o) and if it says "A negative argument..." you know you can use "C-u -".
Different from what you asked for, but the windmove package lets you move between windows according to their relative screen locations, which can be much easier than repeatedly doing C-x o.
Instead of C-u -
, you can also give a negative prefix argument with just M--
(Meta-Minus) , i.e. switch to previous window with M-- C-x o
.