Skip to content

Instantly share code, notes, and snippets.

@yasuyk
Created December 24, 2013 16:00
Show Gist options
  • Save yasuyk/8115086 to your computer and use it in GitHub Desktop.
Save yasuyk/8115086 to your computer and use it in GitHub Desktop.
(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