From f40a34576603e8bd8ec712ca5f0b0cfb8ab95481 Mon Sep 17 00:00:00 2001 From: William Carroll Date: Thu, 15 Jun 2017 17:21:22 -0400 Subject: [PATCH] Moves helm helper functions to a separate file --- emacs/wc-helm-functions.lisp | 78 ++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 emacs/wc-helm-functions.lisp diff --git a/emacs/wc-helm-functions.lisp b/emacs/wc-helm-functions.lisp new file mode 100644 index 000000000..52319f18d --- /dev/null +++ b/emacs/wc-helm-functions.lisp @@ -0,0 +1,78 @@ +(defvar wc/helm-git-tracked-staged + (helm-build-in-buffer-source "Tracked, Staged" + :candidates (shell-command-to-string "git --no-pager diff --name-only --staged") + :action 'wc/handle-branch)) + + +(defvar wc/helm-print-default-directory + (helm-build-in-buffer-source "Tracked, Staged" + :candidates (lambda () '((default-directory))) + :action 'wc/handle-branch)) + + +(defvar wc/helm-git-tracked-unstaged + (helm-build-in-buffer-source "Tracked, Unstaged" + :candidates (shell-command-to-string "git --no-pager diff --name-only") + :action 'wc/handle-branch)) + + +(defvar wc/helm-git-untracked-unstaged + (helm-build-in-buffer-source "Untracked, Unstaged" + :candidates (shell-command-to-string "git ls-files --others --exclude-standard") + :action 'wc/handle-branch)) + + +(defun wc/helm-git-altered-files () + "View a categorized list of altered files within a project." + (interactive) + (helm :sources '(wc/helm-print-default-directory + ;; wc/helm-git-tracked-staged + ;; wc/helm-git-tracked-unstaged + ;; wc/helm-git-untracked-unstaged + ) + :buffer "*helm git altered files*")) + + +(defun wc/helm-git-branches () + "Reverse-I search using Helm." + (interactive) + (helm :sources (helm-build-in-buffer-source "test1" + :data (wc/git-branches) + :action 'wc/handle-branch) + :buffer "*helm git branches*")) + + +(defun wc/open-terminals () + "Lists active terminal buffers." + (interactive) + (helm :sources (helm-build-in-buffer-source "test1" + :data (wc/list-project-terminals) + :action 'switch-to-buffer) + :buffer "*helm projectile terminals*")) + + +(defun wc/helm-autojump () + "Helm interface to autojump." + (interactive) + (helm :sources (helm-build-in-buffer-source "test1" + :data (wc/autojump-directories) + :action (lambda (path) (wc/exec-cmd (format "cd %s" path)))) + :buffer "*helm git branches*")) + + +(defun wc/helm-shell-history () + "Reverse-I search using Helm." + (interactive) + (helm :sources (helm-build-in-buffer-source "test1" + :data (wc/shell-history) + :action 'wc/exec-cmd) + :buffer "*helm shell history*")) + + +(defun wc/helm-ctrl-t-find-files () + "Fuzzily searches files within a directory." + (interactive) + (helm :sources (helm-build-in-buffer-source "test1" + :data (shell-command-to-string "ag --hidden --ignore .git -l -g \"\"") + :action 'term-send-raw-string) + :buffer "*helm CTRL_T find files *"))