Move and add helm-c-source-zsh-history to compile hydra

This commit is contained in:
Ivan Malison 2016-06-28 17:14:22 -07:00
parent 9723eec2f5
commit f0550b347b

View File

@ -1154,6 +1154,7 @@ Sets environment variables by starting a shell
(imalison:named-compile "glide up"))
(defhydra imalison:compile nil "Compile"
("s" helm-command-from-zsh "Select a command from shell history")
("c" imalison:named-compile "Enter Custom Command")
("t" imalison:make-test "Test")
("u" imalison:glide-up "Update Dependencies"))))
@ -1662,39 +1663,6 @@ I use helm for almost all emacs completion
(projectile-all-project-files))))
:candidate-number-limit 99999
:buffer "*helm org inbuffer*"))
;; helm zsh source history
(defvar helm-c-source-zsh-history
'((name . "Zsh History")
(candidates . helm-c-zsh-history-set-candidates)
(action . (("Execute Command" . helm-c-zsh-history-action)))
(volatile)
(requires-pattern . 3)
(delayed)))
(defun helm-c-zsh-history-set-candidates (&optional request-prefix)
(let ((pattern (replace-regexp-in-string
" " ".*"
(or (and request-prefix
(concat request-prefix
" " helm-pattern))
helm-pattern))))
(with-current-buffer (find-file-noselect "~/.zsh_history" t t)
(auto-revert-mode -1)
(goto-char (point-max))
(loop for pos = (re-search-backward pattern nil t)
while pos
collect (replace-regexp-in-string
"\\`:.+?;" ""
(buffer-substring (line-beginning-position)
(line-end-position)))))))
(defun helm-c-zsh-history-action (candidate)
(async-shell-command candidate))
(defun helm-command-from-zsh ()
(interactive)
(require 'helm)
(helm-other-buffer 'helm-c-source-zsh-history "*helm zsh history*"))
(use-package helm-descbinds
:demand t
@ -1821,6 +1789,42 @@ I use helm for almost all emacs completion
(use-package jump-char
:bind (("C-;" . jump-char-forward)))
#+END_SRC
**** helm-zsh-history
This was stolen from https://github.com/jwiegley/dot-emacs
#+BEGIN_SRC emacs-lisp
(defvar helm-c-source-zsh-history
'((name . "Zsh History")
(candidates . helm-c-zsh-history-set-candidates)
(action . (("Execute Command" . helm-c-zsh-history-action)))
(volatile)
(requires-pattern . 3)
(delayed)))
(defun helm-c-zsh-history-set-candidates (&optional request-prefix)
(let ((pattern (replace-regexp-in-string
" " ".*"
(or (and request-prefix
(concat request-prefix
" " helm-pattern))
helm-pattern))))
(with-current-buffer (find-file-noselect "~/.zsh_history" t t)
(auto-revert-mode -1)
(goto-char (point-max))
(loop for pos = (re-search-backward pattern nil t)
while pos
collect (replace-regexp-in-string
"\\`:.+?;" ""
(buffer-substring (line-beginning-position)
(line-end-position)))))))
(defun helm-c-zsh-history-action (candidate)
(imalison:named-compile candidate))
(defun helm-command-from-zsh ()
(interactive)
(require 'helm)
(helm-other-buffer 'helm-c-source-zsh-history "*helm zsh history*"))
#+END_SRC
** Text Manipulation
*** smartparens
#+BEGIN_SRC emacs-lisp