about summary refs log tree commit diff
path: root/emacs/wc-helm-functions.lisp
diff options
context:
space:
mode:
authorWilliam Carroll <wpcarro@gmail.com>2017-06-15T21·21-0400
committerWilliam Carroll <wpcarro@gmail.com>2017-06-15T21·21-0400
commitf40a34576603e8bd8ec712ca5f0b0cfb8ab95481 (patch)
tree8c59b524d1003b0828cdd34c4db2106119ddcb37 /emacs/wc-helm-functions.lisp
parentd9a05b322e0788ab9a7dc22591da4e17727a8e27 (diff)
Moves helm helper functions to a separate file
Diffstat (limited to 'emacs/wc-helm-functions.lisp')
-rw-r--r--emacs/wc-helm-functions.lisp78
1 files changed, 78 insertions, 0 deletions
diff --git a/emacs/wc-helm-functions.lisp b/emacs/wc-helm-functions.lisp
new file mode 100644
index 000000000000..52319f18da5e
--- /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 *"))