Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,14 @@ Each number represents a window. Windows followed by H or V, are internal Horizo
First you need to select a window on which to operate, by entering it's number. RET will select it. ^, >, v, and < will split it.

It's also possible to enter an operation without specifying a window, in which case the root window will be used.

##### Integration with helm

Add the following code to your init.el:
```elisp
(require 'esw-helm)
```

From helm-find-files, helm-buffer-list, helm-mini, helm-projectile (buffers and files), use *C-c C-w* to call esw to select the target window.

![screenshot4](https://github.com/kassick/es-windows/raw/master/esw-helm-screencast2.gif)
Binary file added esw-helm-screencast.webm
Binary file not shown.
Binary file added esw-helm-screencast2.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
68 changes: 68 additions & 0 deletions esw-helm.el
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
;;; esw-helm.el -- Helm support for es-windows -*- lexical-binding: t; -*-

;; Copyright (C) 2017 kassick

;; Author: kassick <kassick@gmail.com>
;; Keywords:

;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.

;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.

;;; Code:

(defun helm-esw/show-buffer (candidate)
(set-window-buffer (esw/select-window nil t t) (get-buffer candidate)))

(defun helm-esw/find-file (candidate)
(set-window-buffer (esw/select-window nil t t) (find-file-noselect candidate)))

(defun helm-esw/run-show-buffer ()
"Show the selected buffer in the selected window."
(interactive)
(with-helm-alive-p
(helm-exit-and-execute-action 'helm-esw/show-buffer)))

(defun helm-esw/run-find-file ()
"Show the selected buffer in the selected window."
(interactive)
(with-helm-alive-p
(helm-exit-and-execute-action 'helm-esw/find-file)))

(eval-after-load 'helm-files
(lambda ()
(if (locate-library "es-windows")
(progn
;; Add description
(add-to-list 'helm-find-files-actions
'("Find file in in new splited window `C-c C-w'" . helm-esw/find-file ) t)
;; Bind C-c C-w
(define-key helm-find-files-map (kbd "C-c C-w") 'helm-esw/run-find-file)))))

(eval-after-load 'helm-buffers
(lambda ()
(if (locate-library "es-windows")
(progn
;; Add description
(add-to-list 'helm-type-buffer-actions
'("Display buffer(s) in new splited window `C-c C-w'" . helm-esw/show-buffer) t)
;; Bind C-c C-w
(define-key helm-buffer-map (kbd "C-c C-w") 'helm-esw/run-show-buffer)))))

(eval-after-load 'helm-projectile
(lambda ()
(if (locate-library "es-windows")
(define-key helm-projectile-find-file-map (kbd "C-c C-w") 'helm-esw/run-find-file))))


(provide 'esw-helm.el)
;; esw-helm.el ends here