Created
December 24, 2013 16:00
-
-
Save yasuyk/8115086 to your computer and use it in GitHub Desktop.
inspired by https://github.com/pjones/ido-select-window
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun helm-window-init () | |
(let* ((wins (cdr (window-list))) | |
(mapping (mapcar | |
(lambda (w) (cons (buffer-name (window-buffer w)) w)) | |
wins))) | |
(if (> (length wins) 1) | |
;; There are more than 2 windows in this frame. | |
(setq helm-window-list-cache mapping) | |
;; There are 2 or fewer windows in this frame. | |
(call-interactively 'other-window) | |
(helm-exit-minibuffer)))) | |
(defvar helm-source-window | |
'((name . "Window") | |
(init . helm-window-init) | |
(candidates . helm-window-list-cache) | |
(action . (("" . select-window))))) | |
;;;###autoload | |
(defun helm-select-window () | |
(interactive) | |
(helm :sources '(helm-source-window) | |
:buffer "*helm select window*")) | |
(provide 'helm-select-window) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment