forked from vjohansen/emacs-config
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvj-helm.el
119 lines (93 loc) · 3.36 KB
/
vj-helm.el
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
;;(require 'helm-vps) <--- outcomment fixes the problem
(require 'vj-helm-simple-git-grep)
(global-set-key (kbd "C-x g") 'vj-helm-git-grep)
(global-set-key (kbd "C-'") 'helm-vps-index-db)
(global-set-key (kbd "C-x c o") 'helm-occur)
(global-set-key (kbd "M-x") 'helm-M-x)
;;(global-set-key (kbd "C-x C-f") 'helm-find-files)
(setq it "") ;; helm-aif macro sets `it´
(require 'helm-config)
(require 'helm-files)
(require 'helm-command)
(require 'helm-buffers)
(require 'helm-misc) ;; enables C-r in minibuffer
(require 'helm-grep) ;for grep to work
(require 'helm-vps) ;; NOT in helm git repo
;; Added to helm-locate.el
;; (define-key map (kbd "M-]") 'helm-ff-run-toggle-basename)
(if (eq system-type 'windows-nt)
(setq helm-locate-command "c:/tools/Locate32/Locate.exe %s %s"))
(setq helm-ff-transformer-show-only-basename nil)
(global-set-key (kbd "C-å") 'vj-helm)
(global-set-key (kbd "C-x b") 'helm-mini)
(defvar vj-fav-fn "~/.fav")
(defvar vj-fav-list
(with-temp-buffer
(when (and vj-fav-fn (file-exists-p vj-fav-fn))
(insert-file-contents vj-fav-fn)
(mapcar 'expand-file-name (split-string (buffer-string))))))
(defun vj-fav-fn2 () vj-fav-fn)
(defclass helm-test-fav (helm-source-in-file helm-type-file)
((candidates-file :initform (vj-fav-fn2))))
;; (helm :sources (helm-make-source "fav" 'helm-test-fav) :buffer "*helm test*")
(defvar vj-helm-source-fav (helm-make-source "Favorites" 'helm-test-fav))
(require 'helm-for-files)
(defvar vj-helm-list
'(
helm-source-recentf
helm-source-vps-files
vj-helm-source-fav
helm-source-buffers-list
;; helm-source-files-in-current-dir
;; helm-c-source-locate
))
(defun vj-helm ()
(interactive)
(if current-prefix-arg
(if (eq system-type 'windows-nt)
(vj-helm-wdsgrep)
(vj-helm-local-locate))
(helm-other-buffer vj-helm-list "*vj-helm*")))
;; Desktop search for windows
(defvar helm-source-wdsgrep
'((name . "Desktop Search")
(candidates . (lambda ()
(start-process "wdsgrep-process" nil
"c:\\tools\\wdsgrep\\wdsgrep.exe" helm-pattern)))
(type . file)
(requires-pattern . 4)
(delayed))
"Source for retrieving files via W. Desktop Search.")
(if (eq system-type 'windows-nt)
;; Windows
(defun vj-helm-wdsgrep ()
(interactive)
(helm-other-buffer '(helm-source-wdsgrep) "*helm Desktop Search*"))
;; else
(defun vj-helm-local-locate ()
(interactive)
(when (not (file-exists-p "~/.vj-locate.db"))
(message
(propertize "Run: updatedb -l 0 -o ~/.vj-locate.db -U ~"
'face 'compilation-info))
(sit-for 2.0))
(let ((helm-c-locate-command "locate -d ~/.vj-locate.db -i -r %s"))
(helm-other-buffer
'(helm-c-source-locate)
"*vj-helm-local-locate*"))))
(helm-add-action-to-source
"kill-ring-save"
#'(lambda (_candidate)
(with-helm-buffer (kill-new _candidate)))
helm-source-recentf
1)
(defun my-no-helm-M-x ()
(interactive)
(let
((helm-completing-read-handlers-alist '((execute-extended-command . nil))))
(call-interactively 'execute-extended-command)))
(global-set-key (kbd "ESC x") 'my-no-helm-M-x)
;; (setq helm-completion-window-scroll-margin 0)
;; (setq helm-echo-input-in-header-line t)
;; (helm-autoresize-mode -1)
;; (add-hook 'helm-minibuffer-set-up-hook 'helm-hide-minibuffer-maybe)