2017-06-09 13:36:58 +02:00
|
|
|
|
;;; completion/helm/config.el -*- lexical-binding: t; -*-
|
2017-02-13 21:12:02 -05:00
|
|
|
|
|
|
|
|
|
(defvar +helm-global-prompt "››› "
|
|
|
|
|
"The helm text prompt prefix string is globally replaced with this string.")
|
|
|
|
|
|
2018-07-23 00:06:47 +02:00
|
|
|
|
(defvar +helm-project-search-engines '(rg ag pt)
|
|
|
|
|
"What search tools for `+helm/project-search' (and `+helm-file-search' when no
|
|
|
|
|
ENGINE is specified) to try, and in what order.
|
|
|
|
|
|
|
|
|
|
To disable a particular tool, remove it from this list. To prioritize a tool
|
|
|
|
|
over others, move it to the front of the list. Later duplicates in this list are
|
|
|
|
|
silently ignored.
|
|
|
|
|
|
|
|
|
|
If you want to already use git-grep or grep, set this to nil.")
|
|
|
|
|
|
2017-02-21 03:46:22 -05:00
|
|
|
|
|
2017-02-13 21:12:02 -05:00
|
|
|
|
;;
|
|
|
|
|
;; Packages
|
|
|
|
|
;;
|
|
|
|
|
|
2018-03-02 23:11:49 -05:00
|
|
|
|
(def-package! helm-mode
|
2018-05-25 00:46:11 +02:00
|
|
|
|
:defer 1
|
|
|
|
|
:after-call pre-command-hook
|
2018-05-25 11:49:59 +02:00
|
|
|
|
:init
|
2018-06-03 15:46:00 +02:00
|
|
|
|
(define-key! 'global
|
|
|
|
|
[remap apropos] #'helm-apropos
|
|
|
|
|
[remap bookmark-jump] #'helm-bookmarks
|
|
|
|
|
[remap execute-extended-command] #'helm-M-x
|
|
|
|
|
[remap find-file] #'helm-find-files
|
|
|
|
|
[remap imenu-anywhere] #'helm-imenu-anywhere
|
|
|
|
|
[remap imenu] #'helm-semantic-or-imenu
|
|
|
|
|
[remap noop-show-kill-ring] #'helm-show-kill-ring
|
2018-08-04 16:00:11 +02:00
|
|
|
|
[remap projectile-find-file] #'+helm/projectile-find-file
|
2018-06-03 15:46:00 +02:00
|
|
|
|
[remap projectile-recentf] #'helm-projectile-recentf
|
|
|
|
|
[remap projectile-switch-project] #'helm-projectile-switch-project
|
|
|
|
|
[remap projectile-switch-to-buffer] #'helm-projectile-switch-to-buffer
|
|
|
|
|
[remap recentf-open-files] #'helm-recentf)
|
2018-03-02 23:11:49 -05:00
|
|
|
|
:config
|
2018-05-14 20:45:47 +02:00
|
|
|
|
(helm-mode +1)
|
2018-03-02 23:11:49 -05:00
|
|
|
|
;; helm is too heavy for find-file-at-point
|
2018-06-23 16:48:58 +02:00
|
|
|
|
(add-to-list 'helm-completing-read-handlers-alist (cons #'find-file-at-point nil)))
|
2018-03-02 23:11:49 -05:00
|
|
|
|
|
|
|
|
|
|
2017-06-09 13:36:58 +02:00
|
|
|
|
(def-package! helm
|
2018-03-02 23:11:49 -05:00
|
|
|
|
:after helm-mode
|
2017-02-13 21:12:02 -05:00
|
|
|
|
:init
|
2018-05-30 10:52:44 +02:00
|
|
|
|
(setq helm-candidate-number-limit 50
|
2017-02-13 21:12:02 -05:00
|
|
|
|
;; Display extraineous helm UI elements
|
|
|
|
|
helm-display-header-line nil
|
|
|
|
|
helm-ff-auto-update-initial-value nil
|
|
|
|
|
helm-find-files-doc-header nil
|
|
|
|
|
;; Don't override evil-ex's completion
|
2018-05-30 10:52:44 +02:00
|
|
|
|
helm-mode-handle-completion-in-region nil)
|
2017-02-13 21:12:02 -05:00
|
|
|
|
|
|
|
|
|
:config
|
2017-06-09 13:36:58 +02:00
|
|
|
|
(defun +helm*replace-prompt (plist)
|
2017-06-09 19:44:02 +02:00
|
|
|
|
"Globally replace helm prompts with `+helm-global-prompt'."
|
2018-06-15 22:10:40 +02:00
|
|
|
|
(cond ((not +helm-global-prompt) plist)
|
|
|
|
|
((keywordp (car plist))
|
|
|
|
|
(plist-put plist :prompt +helm-global-prompt))
|
|
|
|
|
((setf (nth 2 plist) +helm-global-prompt)
|
|
|
|
|
plist)))
|
2017-06-09 13:36:58 +02:00
|
|
|
|
(advice-add #'helm :filter-args #'+helm*replace-prompt)
|
2017-02-13 21:12:02 -05:00
|
|
|
|
|
2017-06-09 19:44:02 +02:00
|
|
|
|
(defun +helm*hide-header (&rest _)
|
|
|
|
|
"Hide header-line & mode-line in helm windows."
|
|
|
|
|
(setq mode-line-format nil))
|
2017-06-09 13:36:58 +02:00
|
|
|
|
(advice-add #'helm-display-mode-line :override #'+helm*hide-header)
|
|
|
|
|
|
2018-03-02 23:11:49 -05:00
|
|
|
|
(defun +helm*hide-minibuffer-maybe ()
|
|
|
|
|
"Hide minibuffer in Helm session if we use the header line as input field."
|
2018-05-14 01:19:54 +02:00
|
|
|
|
(when (with-current-buffer (helm-buffer-get) helm-echo-input-in-header-line)
|
2018-03-02 23:11:49 -05:00
|
|
|
|
(let ((ov (make-overlay (point-min) (point-max) nil nil t)))
|
|
|
|
|
(overlay-put ov 'window (selected-window))
|
|
|
|
|
(overlay-put ov 'face
|
|
|
|
|
(let ((bg-color (face-background 'default nil)))
|
|
|
|
|
`(:background ,bg-color :foreground ,bg-color)))
|
|
|
|
|
(setq-local cursor-type nil))))
|
2018-05-30 13:46:09 +10:00
|
|
|
|
(add-hook 'helm-minibuffer-set-up-hook #'+helm*hide-minibuffer-maybe))
|
2018-03-02 23:11:49 -05:00
|
|
|
|
|
2017-02-13 21:12:02 -05:00
|
|
|
|
|
2018-05-30 10:52:44 +02:00
|
|
|
|
(def-package! helm-flx
|
|
|
|
|
:when (featurep! +fuzzy)
|
|
|
|
|
:after helm
|
|
|
|
|
:init
|
|
|
|
|
(setq helm-candidate-number-limit 40
|
|
|
|
|
helm-M-x-fuzzy-match t
|
|
|
|
|
helm-apropos-fuzzy-match t
|
|
|
|
|
helm-bookmark-show-location t
|
|
|
|
|
helm-buffers-fuzzy-matching t
|
|
|
|
|
helm-completion-in-region-fuzzy-match t
|
|
|
|
|
helm-file-cache-fuzzy-match t
|
|
|
|
|
helm-imenu-fuzzy-match t
|
|
|
|
|
helm-locate-fuzzy-match t
|
|
|
|
|
helm-flx-for-helm-locate t
|
|
|
|
|
helm-mode-fuzzy-match t
|
|
|
|
|
helm-projectile-fuzzy-match t
|
|
|
|
|
helm-recentf-fuzzy-match t
|
|
|
|
|
helm-semantic-fuzzy-match t)
|
|
|
|
|
:config
|
|
|
|
|
(helm-flx-mode +1))
|
2017-02-13 21:12:02 -05:00
|
|
|
|
|
|
|
|
|
|
2018-06-16 15:04:27 +02:00
|
|
|
|
;; `helm-ag'
|
|
|
|
|
(after! helm-ag
|
2018-07-26 14:48:21 +02:00
|
|
|
|
(map! :map helm-ag-edit-map :n "RET" #'compile-goto-error)
|
2018-06-16 15:04:27 +02:00
|
|
|
|
(define-key helm-ag-edit-map [remap quit-window] #'helm-ag--edit-abort)
|
2018-06-18 02:26:05 +02:00
|
|
|
|
(set-popup-rule! "^\\*helm-ag-edit" :size 0.35 :ttl 0 :quit nil))
|
2017-02-13 21:12:02 -05:00
|
|
|
|
|
|
|
|
|
|
2018-05-31 13:42:07 +02:00
|
|
|
|
;; `helm-bookmark'
|
|
|
|
|
(setq helm-bookmark-show-location t)
|
2017-02-13 21:12:02 -05:00
|
|
|
|
|
|
|
|
|
|
2018-06-16 15:04:27 +02:00
|
|
|
|
;; `helm-css-scss' -- https://github.com/ShingoFukuyama/helm-css-scss
|
|
|
|
|
(setq helm-css-scss-split-direction #'split-window-vertically
|
|
|
|
|
helm-css-scss-split-with-multiple-windows t)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; `helm-files'
|
2018-05-25 11:49:59 +02:00
|
|
|
|
(after! helm-files
|
2017-02-13 21:12:02 -05:00
|
|
|
|
(setq helm-boring-file-regexp-list
|
|
|
|
|
(append (list "\\.projects$" "\\.DS_Store$")
|
2017-06-09 19:44:02 +02:00
|
|
|
|
helm-boring-file-regexp-list)))
|
2017-02-13 21:12:02 -05:00
|
|
|
|
|
|
|
|
|
|
2018-06-16 15:04:27 +02:00
|
|
|
|
;; `helm-locate'
|
|
|
|
|
(defvar helm-generic-files-map (make-sparse-keymap))
|
|
|
|
|
(after! helm-locate (set-keymap-parent helm-generic-files-map helm-map))
|
2017-02-13 21:12:02 -05:00
|
|
|
|
|
|
|
|
|
|
2018-06-16 15:04:52 +02:00
|
|
|
|
;; `helm-projectile'
|
|
|
|
|
(def-package! helm-projectile
|
|
|
|
|
:commands (helm-projectile-find-file
|
|
|
|
|
helm-projectile-recentf
|
|
|
|
|
helm-projectile-switch-project
|
|
|
|
|
helm-projectile-switch-to-buffer)
|
|
|
|
|
:init
|
|
|
|
|
(setq projectile-completion-system 'helm)
|
|
|
|
|
(defvar helm-projectile-find-file-map (make-sparse-keymap))
|
|
|
|
|
:config
|
|
|
|
|
(set-keymap-parent helm-projectile-find-file-map helm-map))
|
2017-02-13 21:12:02 -05:00
|
|
|
|
|
|
|
|
|
|
2017-02-23 00:06:12 -05:00
|
|
|
|
(def-package! helm-swoop ; https://github.com/ShingoFukuyama/helm-swoop
|
2018-05-25 11:49:59 +02:00
|
|
|
|
:commands helm-multi-swoop-all
|
2017-02-13 21:12:02 -05:00
|
|
|
|
:config
|
|
|
|
|
(setq helm-swoop-use-line-number-face t
|
|
|
|
|
helm-swoop-candidate-number-limit 200
|
|
|
|
|
helm-swoop-speed-or-color t
|
2018-06-17 17:19:33 +02:00
|
|
|
|
;; no initial input
|
|
|
|
|
helm-swoop-pre-input-function (lambda () "")
|
|
|
|
|
;; Always split below current window
|
|
|
|
|
helm-swoop-split-with-multiple-windows t))
|
2017-02-13 21:12:02 -05:00
|
|
|
|
|
|
|
|
|
|
2018-01-14 02:04:30 -05:00
|
|
|
|
(def-package! wgrep
|
2018-05-25 11:49:59 +02:00
|
|
|
|
:commands wgrep-change-to-wgrep-mode
|
2018-01-14 02:04:30 -05:00
|
|
|
|
:config (setq wgrep-auto-save-buffer t))
|
2018-05-31 13:16:57 +10:00
|
|
|
|
|
2018-05-31 13:44:04 +02:00
|
|
|
|
|
2018-05-31 13:16:57 +10:00
|
|
|
|
(def-package! posframe
|
2018-06-01 13:00:23 +02:00
|
|
|
|
:when (and EMACS26+ (featurep! +childframe))
|
2018-06-01 13:03:25 +02:00
|
|
|
|
:after helm
|
|
|
|
|
:config
|
|
|
|
|
(defvar +helm--posframe-buffer nil)
|
|
|
|
|
|
|
|
|
|
(defun +helm-posframe-display (buffer &optional _resume)
|
|
|
|
|
(posframe-show
|
|
|
|
|
(setq +helm--posframe-buffer buffer)
|
|
|
|
|
:poshandler #'posframe-poshandler-frame-bottom-left-corner
|
|
|
|
|
:left-fringe 10
|
|
|
|
|
:width (frame-width)
|
|
|
|
|
:height 16 ;; ivy/+childframe uses 16
|
|
|
|
|
:respect-header-line t))
|
|
|
|
|
|
|
|
|
|
(defun +helm|posframe-cleanup ()
|
|
|
|
|
(posframe-hide +helm--posframe-buffer))
|
|
|
|
|
|
2018-06-01 13:06:30 +02:00
|
|
|
|
(add-hook 'helm-cleanup-hook #'+helm|posframe-cleanup)
|
2018-06-01 13:03:25 +02:00
|
|
|
|
(setq helm-display-function #'+helm-posframe-display))
|
2018-06-01 13:00:23 +02:00
|
|
|
|
|
|
|
|
|
|
2018-05-31 13:44:04 +02:00
|
|
|
|
;;
|
|
|
|
|
;; Evil integration
|
|
|
|
|
;;
|
|
|
|
|
|
|
|
|
|
(when (featurep! :feature evil +everywhere)
|
|
|
|
|
(setq helm-default-prompt-display-function #'+helm--set-prompt-display)
|
|
|
|
|
|
|
|
|
|
(map! (:after helm
|
|
|
|
|
:map helm-map
|
2018-07-30 02:53:17 +02:00
|
|
|
|
"C-S-p" #'helm-previous-source
|
|
|
|
|
"C-S-n" #'helm-next-source
|
|
|
|
|
"C-l" #'helm-execute-persistent-action
|
|
|
|
|
"C-j" #'helm-next-line
|
|
|
|
|
"C-k" #'helm-previous-line
|
|
|
|
|
"C-f" #'helm-next-page
|
|
|
|
|
"C-u" #'helm-previous-page
|
|
|
|
|
[tab] #'helm-select-action)
|
2018-05-31 13:44:04 +02:00
|
|
|
|
(:after helm-files
|
|
|
|
|
:map (helm-find-files-map helm-read-file-map)
|
2018-07-30 02:53:17 +02:00
|
|
|
|
[M-return] #'helm-ff-run-switch-other-window
|
|
|
|
|
"M-h" #'helm-find-files-up-one-level)
|
2018-05-31 13:44:04 +02:00
|
|
|
|
(:after helm-locate
|
|
|
|
|
:map helm-generic-files-map
|
2018-07-30 02:53:17 +02:00
|
|
|
|
"S-<return>" #'helm-ff-run-switch-other-window)
|
2018-05-31 13:44:04 +02:00
|
|
|
|
(:after helm-buffers
|
|
|
|
|
:map helm-buffer-map
|
2018-07-30 02:53:17 +02:00
|
|
|
|
[M-return] #'helm-buffer-switch-other-window
|
|
|
|
|
[return] #'display-buffer)
|
2018-05-31 13:44:04 +02:00
|
|
|
|
(:after helm-regexp
|
|
|
|
|
:map helm-moccur-map
|
2018-07-30 02:53:17 +02:00
|
|
|
|
[M-return] #'helm-moccur-run-goto-line-ow)
|
2018-05-31 13:44:04 +02:00
|
|
|
|
(:after helm-grep
|
|
|
|
|
:map helm-grep-map
|
2018-07-30 02:53:17 +02:00
|
|
|
|
[M-return] #'helm-grep-run-other-window-action)))
|