summaryrefslogtreecommitdiffstats
path: root/lisp/ravi-init-helm.el
blob: 1d7835910188b0bd0cb50cb57486bfc20dc58efe (plain)
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
120
121
122
123
124
125
126
127
128
;;; ravi-init-helm.el --- helm initialization        -*- lexical-binding: t; -*-

;; Copyright (C) 2015

;; Author:  <ravi@nero.lan>
;; Keywords: abbrev

;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.

;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with this program.  If not, see <http://www.gnu.org/licenses/>.

;;; Commentary:

;; Initialize helm instead of ido. The code in this file may steal
;; global keybindings that are currently used for ido-mode/smex.

;;; Code:

(use-package helm
  :bind (("H-h" . helm-command-prefix)
         ("M-x" . helm-M-x)
         ("<f1>" . helm-multi-files)
         ("<f2>" . helm-find-files)
         ("M-y" . helm-show-kill-ring)
         ("H-`" . helm-all-mark-rings))
  :commands helm-command-prefix
  :init
  (progn
    (require 'helm-config)
    (setq helm-candidate-number-limit 100)
    ;; (bind-key (xterm-kitty-make-binding-sequence "<escape>" 'escape))

    ;; From https://gist.github.com/antifuchs/9238468
    (setq helm-idle-delay 0.0 ; update fast sources immediately (doesn't).
          helm-input-idle-delay 0.01  ; this actually updates things
          helm-quick-update t
          helm-M-x-requires-pattern nil
          helm-ff-skip-boring-files t)

    (setq helm-ff-file-name-history-use-recentf t)

    (helm-mode))
  :config
  (progn
    (unbind-key "C-x c")                ; default helm prefix key
    (bind-key (xterm-kitty-make-binding-sequence "<tab>" ?\t) 'helm-execute-persistent-action helm-map)
    (bind-key (xterm-kitty-make-binding-sequence "H-<tab>" ?\t 'hyper) 'helm-select-action helm-map)

    (use-package helm-posframe
      :if window-system
      :config
      (helm-posframe-enable)
      (setq helm-posframe-parameters '((left-fringe . 10)
                                       (right-fringe . 10)
                                       (width . 1.0)))
      (setq helm-posframe-poshandler #'posframe-poshandler-frame-bottom-center))

    (use-package helm-proc
      :commands helm-proc
      :init
      (progn
        (bind-key "q" 'helm-proc helm-command-map)))

    (use-package helm-git-grep
      :commands (helm-git-grep-from-isearch helm-git-grep-from-helm)
      :init
      (progn
        (bind-key "C-c g" 'helm-git-grep-from-helm helm-map)
        (bind-key "C-c g" 'helm-git-grep-from-isearch isearch-mode-map)))

    (use-package helm-ls-git
      :bind (("C-x v j" . helm-ls-git-ls)))

    (use-package helm-ag
      :config
      (progn
        (setq helm-ag-insert-at-point 'symbol)))

    (use-package helm-dash
      :commands (helm-dash
                 helm-dash-at-point
                 helm-dash-install-docset
                 helm-dash-install-user-docset)
      :init
      (progn
        (bind-key "d" 'helm-dash-at-point helm-command-map)
        (bind-key "D" 'helm-dash helm-command-map)))

    (use-package helm-xref
      :commands helm-xref-show-refs
      :init
      (progn
        (setq xref-show-xrefs-function 'helm-xref-show-xrefs))))
  :if ravi/use-helm-instead-of-ido
  :diminish helm-mode)

(use-package helm-swoop
  :bind (("M-i" . helm-swoop))
  :commands helm-swoop-from-isearch
  :init
  (progn
    (bind-key "M-i" 'helm-swoop-from-isearch isearch-mode-map)
    )
  :config
  (progn
    (bind-key "M-i" 'helm-multi-swoop-all-from-helm-swoop helm-swoop-map)

    ;; Save buffer when helm-multi-swoop-edit complete
    (setq helm-multi-swoop-edit-save t)

    ;; If this value is t, split window inside the current window
    ;; (setq helm-swoop-split-with-multiple-windows nil)

    ;; Split direcion. 'split-window-vertically or 'split-window-horizontally
    ;; (setq helm-swoop-split-direction 'split-window-vertically)
    ))

(provide 'ravi-init-helm)
;;; ravi-init-helm.el ends here