doomemacs/modules/completion/helm/config.el
Henrik Lissner 4984a548d1
Refactor DOOM init & add new init hooks
+ Add doom-init-hook and doom-post-init-hook to simplify Emacs init
  hooks into less ambiguous ones.
+ Attach former after-init-hook and emacs-startup-hook hooks to new doom
  init hooks.
+ Vastly improves daemon and tty support: preventing incorrect colors
  from bleeding across face class barriers, and into GUI Emacs and vice
  versa, when spawned with emacsclient.
+ Fix persp-mode breaking Emacs daemon, and ensuring that initialization
  is done properly in terminal Emacs (and emacsclient frames).
2017-06-12 00:37:14 +02:00

122 lines
4.1 KiB
EmacsLisp
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

;;; completion/helm/config.el -*- lexical-binding: t; -*-
;; Warning: since I don't use helm, this may be out of date.
(defvar +helm-global-prompt " "
"The helm text prompt prefix string is globally replaced with this string.")
;;
;; Packages
;;
(def-package! helm
:demand t
:init
(setq helm-quick-update t
;; Speedier without fuzzy matching
helm-mode-fuzzy-match nil
helm-buffers-fuzzy-matching nil
helm-apropos-fuzzy-match nil
helm-M-x-fuzzy-match nil
helm-recentf-fuzzy-match nil
helm-projectile-fuzzy-match nil
;; 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
helm-mode-handle-completion-in-region nil
helm-candidate-number-limit 50
;; Don't wrap item cycling
helm-move-to-line-cycle-in-source t)
:config
(load "helm-autoloads" nil t)
(add-hook 'doom-init-hook #'helm-mode)
(defvar helm-projectile-find-file-map (make-sparse-keymap))
(require 'helm-projectile)
(set-keymap-parent helm-projectile-find-file-map helm-map)
;; helm is too heavy for find-file-at-point
(after! helm-mode
(add-to-list 'helm-completing-read-handlers-alist '(find-file-at-point . nil)))
(set! :popup "\\` ?\\*[hH]elm.*?\\*\\'" :size 14 :regexp t)
(setq projectile-completion-system 'helm)
;;; Helm hacks
(defun +helm*replace-prompt (plist)
"Globally replace helm prompts with `+helm-global-prompt'."
(if (keywordp (car plist))
(plist-put plist :prompt +helm-global-prompt)
(setf (nth 2 plist) +helm-global-prompt)
plist))
(advice-add #'helm :filter-args #'+helm*replace-prompt)
(defun +helm*hide-header (&rest _)
"Hide header-line & mode-line in helm windows."
(setq mode-line-format nil))
(advice-add #'helm-display-mode-line :override #'+helm*hide-header)
(map! :map global-map
[remap apropos] #'helm-apropos
[remap find-file] #'helm-find-files
[remap recentf] #'helm-recentf
[remap projectile-switch-to-buffer] #'helm-projectile-switch-to-buffer
[remap projectile-recentf] #'helm-projectile-recentf
[remap projectile-find-file] #'helm-projectile-find-file
[remap imenu] #'helm-semantic-or-imenu
[remap bookmark-jump] #'helm-bookmarks
[remap noop-show-kill-ring] #'helm-show-kill-ring
[remap projectile-switch-project] #'helm-projectile-switch-project
[remap projectile-find-file] #'helm-projectile-find-file
[remap imenu-anywhere] #'helm-imenu-anywhere
[remap execute-extended-command] #'helm-M-x))
(def-package! helm-locate
:init (defvar helm-generic-files-map (make-sparse-keymap))
:config (set-keymap-parent helm-generic-files-map helm-map))
(def-package! helm-bookmark
:config (setq-default helm-bookmark-show-location t))
(def-package! helm-files
:config
(setq helm-boring-file-regexp-list
(append (list "\\.projects$" "\\.DS_Store$")
helm-boring-file-regexp-list)))
(def-package! helm-ag
:config
(map! :map helm-ag-edit-map
[remap doom/kill-this-buffer] #'helm-ag--edit-abort
[remap quit-window] #'helm-ag--edit-abort))
(def-package! helm-css-scss ; https://github.com/ShingoFukuyama/helm-css-scss
:commands (helm-css-scss
helm-css-scss-multi
helm-css-scss-insert-close-comment)
:config
(setq helm-css-scss-split-direction #'split-window-vertically
helm-css-scss-split-with-multiple-windows t))
(def-package! helm-swoop ; https://github.com/ShingoFukuyama/helm-swoop
:commands (helm-swoop helm-multi-swoop helm-multi-swoop-all)
:config
(setq helm-swoop-use-line-number-face t
helm-swoop-candidate-number-limit 200
helm-swoop-speed-or-color t
helm-swoop-pre-input-function (lambda () "")))
(def-package! helm-describe-modes :commands helm-describe-modes)