Allowing user to custom action is a great feature of helm, for example, to use ace-window to select a window for buffer to switch, all you need to do is implement it as an action:
(defun helm-buffer-ace-window (buffer) "Use ‘ace-window’ to select a window to display BUFFER." (ace-select-window) (switch-to-buffer buffer))
then use this action:
(add-to-list 'helm-type-buffer-actions '("Switch to buffer in Ace window ‘C-c C-e'" . helm-buffer-ace-window) :append)
Now, you should be able to use this new action from all helm sources which use helm-type-buffer-actions such as in C-c p b (helm-projectile-switch-to-buffer) and helm-buffers-list.
(Optional) Set up Key Binding for Action
You already can invoke the above action helm-buffer-ace-window from helm's Action Menu, if you like, it is also possible to assign a key binding for it, for example, C-c C-e
Firstly, wrap that action with a interactive command:
(defun helm-buffer-run-ace-window () (interactive) (with-helm-alive-p (helm-exit-and-execute-action 'helm-buffer-ace-window)))
Secondly, bind C-c C-e to the command:
(define-key helm-buffer-map (kbd "C-c C-e") #'helm-buffer-run-ace-window)
The rest of code for Files:
(defun helm-find-ace-window (file) "Use ‘ace-window' to select a window to display FILE." (ace-select-window) (find-file file)) (add-to-list 'helm-find-files-actions '("Find File in Ace window" . helm-find-ace-window) :append) (defun helm-file-run-ace-window () (interactive) (with-helm-alive-p (helm-exit-and-execute-action 'helm-find-ace-window))) ;;; For `helm-find-files' (define-key helm-find-files-map (kbd "C-c C-e") #'helm-file-run-ace-window) ;; For file commands in `helm-projectile' ;; NOTE: You have to restart Emacs to make following work since helm-projectile ;; can't recompute at-run-time, this is bad, it also has other issues, so I ;; don't use this package. (define-key helm-projectile-find-file-map (kbd "C-c C-e") #'helm-file-run-ace-window)