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."
then use this action:
'("Switch to buffer in Ace window ‘C-c C-e'" . helm-buffer-ace-window)
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 (
(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 ()
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."
'("Find File in Ace window" . helm-find-ace-window)
(defun helm-file-run-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)