about summary refs log tree commit diff
path: root/emacs/wc-helm-functions.el
blob: 52319f18da5e75b5e81fe441e5897d13ab33c173 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
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 *"))