This repository has been archived on 2022-12-11. You can view files and clone it, but cannot push or open issues or pull requests.
dot-files/.emacs.d/config/helm.el

52 lines
2.0 KiB
EmacsLisp

;; (C) Copyright Collin J. Doering 2014
;;
;; 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/>.
;; File: helm.el
;; Author: Collin J. Doering <collin.doering@rekahsoft.ca>
;; Date: Oct 22, 2014
;; Use helm-mode
(require 'helm-config)
(helm-mode 1)
;; Thanks to: http://www.emacswiki.org/emacs/Yasnippet#toc7
(defun shk-yas/helm-prompt (prompt choices &optional display-fn)
"Use helm to select a snippet. Put this into `yas/prompt-functions.'"
(interactive)
(setq display-fn (or display-fn 'identity))
(if (require 'helm-config)
(let (tmpsource cands result rmap)
(setq cands (mapcar (lambda (x) (funcall display-fn x)) choices))
(setq rmap (mapcar (lambda (x) (cons (funcall display-fn x) x)) choices))
(setq tmpsource
(list
(cons 'name prompt)
(cons 'candidates cands)
'(action . (("Expand" . (lambda (selection) selection))))
))
(setq result (helm-other-buffer '(tmpsource) "*helm-select-yasnippet"))
(if (null result)
(signal 'quit "user quit!")
(cdr (assoc result rmap))))
nil))
;; Setup helm-swoop *TODO* key bindings?
;; See: https://github.com/ShingoFukuyama/helm-swoop
(require 'helm-swoop) ;; ELPA
;; Setup helm-ls-git to quickly select files from the current vc dir
(require 'helm-ls-git)
(global-set-key (kbd "C-x C-d") 'helm-browse-project)