2019-07-21 00:37:46 +02:00
|
|
|
|
;;; helm.el --- Module file for Helm configuration.
|
2017-08-27 20:13:04 +01:00
|
|
|
|
;;
|
2019-07-21 00:37:46 +02:00
|
|
|
|
;; Copyright (C) 2017-2019 Wojciech Kozlowski
|
2017-08-27 20:13:04 +01:00
|
|
|
|
;;
|
2018-02-04 17:18:18 +00:00
|
|
|
|
;; Author: Wojciech Kozlowski <wk@wojciechkozlowski.eu>
|
2019-07-21 00:37:46 +02:00
|
|
|
|
;; Created: 2017-08-27
|
2017-08-27 20:13:04 +01:00
|
|
|
|
;;
|
|
|
|
|
;; This file is not part of GNU Emacs.
|
|
|
|
|
;;
|
|
|
|
|
;;; Commentary:
|
|
|
|
|
;;
|
|
|
|
|
;; This module sets up configuration for the helm package.
|
|
|
|
|
;;
|
|
|
|
|
;;; License: GPLv3
|
|
|
|
|
|
|
|
|
|
;;; Required packages:
|
|
|
|
|
|
2018-07-07 21:34:00 +01:00
|
|
|
|
;;; Code:
|
2017-08-27 20:13:04 +01:00
|
|
|
|
|
2019-07-21 00:37:46 +02:00
|
|
|
|
(defvar emodule/helm-packages
|
2017-08-27 20:13:04 +01:00
|
|
|
|
|
2019-07-21 22:08:29 +02:00
|
|
|
|
'(ace-jump-helm-line
|
|
|
|
|
helm
|
2019-07-24 08:32:55 +02:00
|
|
|
|
helm-flyspell
|
2019-07-21 22:08:29 +02:00
|
|
|
|
helm-projectile
|
|
|
|
|
swiper-helm)
|
2018-07-07 21:34:00 +01:00
|
|
|
|
|
|
|
|
|
)
|
2017-08-27 20:13:04 +01:00
|
|
|
|
|
|
|
|
|
;;; Configuration:
|
|
|
|
|
|
2019-07-21 00:37:46 +02:00
|
|
|
|
(defun emodule/helm-init ()
|
|
|
|
|
"Initialise the `helm' module."
|
2017-08-27 20:13:04 +01:00
|
|
|
|
|
2019-07-21 22:08:29 +02:00
|
|
|
|
;; --------------------------------------------------------------------------
|
|
|
|
|
;; `ace-jump-helm-line'
|
|
|
|
|
;; --------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
(use-package ace-jump-helm-line
|
|
|
|
|
:after helm
|
|
|
|
|
:bind
|
|
|
|
|
(:map helm-map
|
|
|
|
|
("C-'" . ace-jump-helm-line)))
|
|
|
|
|
|
|
|
|
|
;; --------------------------------------------------------------------------
|
|
|
|
|
;; `helm'
|
|
|
|
|
;; --------------------------------------------------------------------------
|
|
|
|
|
|
2017-08-27 20:13:04 +01:00
|
|
|
|
(use-package helm
|
2018-07-08 02:11:37 +01:00
|
|
|
|
:init
|
2019-07-21 00:37:46 +02:00
|
|
|
|
(require 'helm-config)
|
2017-08-27 20:13:04 +01:00
|
|
|
|
:bind
|
|
|
|
|
(("C-x C-f" . helm-find-files)
|
2018-07-08 14:02:55 +01:00
|
|
|
|
("C-x C-r" . helm-resume)
|
2017-08-27 20:13:04 +01:00
|
|
|
|
("M-x" . helm-M-x)
|
|
|
|
|
("M-y" . helm-show-kill-ring)
|
|
|
|
|
("C-x b" . helm-mini)
|
|
|
|
|
("C-M-j" . helm-semantic-or-imenu)
|
2017-08-27 21:57:18 +01:00
|
|
|
|
("C-h SPC" . helm-all-mark-rings))
|
2017-08-27 20:13:04 +01:00
|
|
|
|
:config
|
2019-07-21 00:37:46 +02:00
|
|
|
|
(helm-mode 1)
|
2017-08-27 20:13:04 +01:00
|
|
|
|
|
|
|
|
|
;; Helm prefix ------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
;; The default "C-x c" is quite close to "C-x C-c", which quits Emacs.
|
|
|
|
|
;; Changed to "C-c h". Note: We must set "C-c h" globally, because we
|
|
|
|
|
;; cannot change `helm-command-prefix-key' once `helm-config' is loaded.
|
|
|
|
|
(global-set-key (kbd "C-c h") 'helm-command-prefix)
|
|
|
|
|
(global-unset-key (kbd "C-x c"))
|
|
|
|
|
|
|
|
|
|
;; Helm settings ----------------------------------------------------------
|
|
|
|
|
|
2017-08-28 15:33:56 +01:00
|
|
|
|
(setq-default
|
2017-08-27 20:13:04 +01:00
|
|
|
|
;; Open helm buffer inside current window, not occupy whole other window.
|
|
|
|
|
helm-split-window-in-side-p t
|
|
|
|
|
;; Move to end or beginning of list when reaching top or bottom of list.
|
|
|
|
|
helm-move-to-line-cycle-in-source t
|
|
|
|
|
;; Search for library in `require' and `declare-function' sexp.
|
|
|
|
|
helm-ff-search-library-in-sexp t
|
|
|
|
|
;; Use ‘recentf-list’ instead of ‘file-name-history’.
|
|
|
|
|
helm-ff-file-name-history-use-recentf t
|
|
|
|
|
;; Echo iput to helm header.
|
|
|
|
|
helm-echo-input-in-header-line t
|
|
|
|
|
;; Fuzzy matching.
|
|
|
|
|
helm-M-x-fuzzy-match t
|
|
|
|
|
helm-buffers-fuzzy-matching t
|
|
|
|
|
helm-recentf-fuzzy-match t
|
|
|
|
|
helm-semantic-fuzzy-match t
|
|
|
|
|
helm-imenu-fuzzy-match t
|
|
|
|
|
helm-apropos-fuzzy-match t
|
|
|
|
|
helm-lisp-fuzzy-completion t
|
|
|
|
|
;; Autoresize settings - by setting max = 0, these settings are used to
|
|
|
|
|
;; control the helm window size.
|
|
|
|
|
helm-autoresize-max-height 0
|
|
|
|
|
helm-autoresize-min-height 35)
|
|
|
|
|
|
|
|
|
|
;; Enable autoresize to adjust helm window size.
|
|
|
|
|
(helm-autoresize-mode 1)
|
|
|
|
|
|
|
|
|
|
;; Hide minibuffer --------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
(defun x-helm-hide-minibuffer-maybe ()
|
|
|
|
|
"Hide minibuffer in Helm session if we use the header line
|
|
|
|
|
as input field."
|
|
|
|
|
(when (with-helm-buffer helm-echo-input-in-header-line)
|
|
|
|
|
(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))))
|
|
|
|
|
|
|
|
|
|
(add-hook 'helm-minibuffer-set-up-hook 'x-helm-hide-minibuffer-maybe)
|
|
|
|
|
|
|
|
|
|
;; Key-bindings -----------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
;; Rebind tab to run persistent action.
|
|
|
|
|
(define-key helm-map (kbd "<tab>") 'helm-execute-persistent-action)
|
2019-07-21 00:37:46 +02:00
|
|
|
|
(define-key helm-map (kbd "TAB") 'helm-execute-persistent-action)
|
2017-08-27 20:13:04 +01:00
|
|
|
|
;; List actions using C-z.
|
2019-07-21 00:37:46 +02:00
|
|
|
|
(define-key helm-map (kbd "C-z") 'helm-select-action)
|
2017-08-27 20:13:04 +01:00
|
|
|
|
|
2017-08-27 21:57:18 +01:00
|
|
|
|
;; Change some Helm default key-bindings. Due to the `helm-config' require
|
|
|
|
|
;; these have to overridden here rather than with other keys in `:bind'.
|
|
|
|
|
(global-set-key (kbd "C-c h x") 'helm-register)
|
2018-07-08 00:29:39 +01:00
|
|
|
|
(global-set-key (kbd "C-c h M-o") 'helm-occur))
|
|
|
|
|
|
2019-07-24 08:32:55 +02:00
|
|
|
|
;; --------------------------------------------------------------------------
|
|
|
|
|
;; `helm-flyspell'
|
|
|
|
|
;; --------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
(use-package helm-flyspell
|
|
|
|
|
:bind (("C-c C-'" . helm-flyspell-correct)))
|
|
|
|
|
|
2018-07-08 00:29:39 +01:00
|
|
|
|
;; ------------------------------------------------------------------------
|
2019-07-21 22:08:29 +02:00
|
|
|
|
;; `helm-projectile'
|
2018-07-08 00:29:39 +01:00
|
|
|
|
;; ------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
(use-package helm-projectile
|
2019-07-21 00:37:46 +02:00
|
|
|
|
:after projectile
|
2018-07-08 00:29:39 +01:00
|
|
|
|
:config
|
|
|
|
|
(setq-default projectile-completion-system 'helm)
|
|
|
|
|
(helm-projectile-on))
|
|
|
|
|
|
2019-07-21 22:08:29 +02:00
|
|
|
|
;; --------------------------------------------------------------------------
|
|
|
|
|
;; `swiper-helm'
|
|
|
|
|
;; --------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
(use-package swiper-helm
|
|
|
|
|
:after helm
|
|
|
|
|
:bind
|
|
|
|
|
(("C-s" . swiper-helm)
|
2019-08-07 11:55:17 +02:00
|
|
|
|
("C-c C-s" . isearch-forward))
|
2019-07-21 22:08:29 +02:00
|
|
|
|
:config
|
|
|
|
|
(setq swiper-helm-display-function 'helm-default-display-buffer))
|
|
|
|
|
|
2017-08-27 20:13:04 +01:00
|
|
|
|
)
|
2018-07-07 21:34:00 +01:00
|
|
|
|
|
2019-07-21 00:37:46 +02:00
|
|
|
|
(provide 'emodule/helm)
|
|
|
|
|
;;; helm.el ends here
|