In emacs, sometimes I will be in the middle of finding a file or switching buffers or doing something in the minibuffer, and I will click somewhere else for some reason. When I go back, the only way to make the minibuffer prompt active again is to click inside the minibuffer, which is annoying because it is a thin area. Is there any way to switch back to an active minibuffer prompt without using the mouse?
This will do what you want. Bind to the key of your choice:
(defun switch-to-minibuffer-window () "switch to minibuffer window (if active)" (interactive) (when (active-minibuffer-window) (select-frame-set-input-focus (window-frame (active-minibuffer-window))) (select-window (active-minibuffer-window)))) (global-set-key (kbd "<f7>") 'switch-to-minibuffer-window)
Repeat as necessary.
C-x o runs the command other-window, which is an interactive built-in function in `C source code'.
If you do not want to cycle through windows, you can add a function in your init file and bind it to a key. Something like this might work:
(defun select-minibuffer () "Make the active minibuffer the selected window." (interactive) (when (active-minibuffer-window) (select-window (active-minibuffer-window))))
Another option is using
I find it to be a really useful package: it allows you to quickly move to any Emacs window, visually (and I do use a lot of open windows in Emacs).
But I just find out it also allows you to move to the minibuffer, if it is active:
Hope it helps.
;; faster switching between windows in the same frame (windmove-default-keybindings)
Adding two above lines of code to .emacs.el will enable simple and efficient moving, not just to minibuffer, but also navigating all other windows on Emacs frame using Shift-Arrow.