Merge branch 'develop' into helm-posframe

This commit is contained in:
Henrik Lissner 2018-06-01 13:00:23 +02:00 committed by GitHub
commit a3915dfc91
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
36 changed files with 1131 additions and 473 deletions

View file

@ -5,7 +5,9 @@
"Toggle as-you-type code completion."
(interactive)
(require 'company)
(setq company-idle-delay (unless company-idle-delay 0.2)))
(setq company-idle-delay (unless company-idle-delay 0.2))
(message "Auto completion %s"
(if company-idle-delay "enabled" "disabled")))
;;;###autoload
(defun +company/complete ()

View file

@ -58,3 +58,31 @@
(let ((helm-ag-base-command "rg --no-heading --maxdepth 1"))
(+helm--file-search beg end query default-directory
(if bang (list "-uu")))))
;;;###autoload
(defun +helm--set-prompt-display (pos)
"TODO"
(let (beg state region-active m)
(with-selected-window (minibuffer-window)
(setq beg (save-excursion (vertical-motion 0 (helm-window)) (point))
state evil-state
region-active (region-active-p)
m (mark t)))
(when region-active
(setq m (- m beg))
;; Increment pos to handle the space before prompt (i.e `pref').
(put-text-property (1+ (min m pos)) (+ 2 (max m pos))
'face
(list :background (face-background 'region))
header-line-format))
(put-text-property
;; Increment pos to handle the space before prompt (i.e `pref').
(+ 1 pos) (+ 2 pos)
'face
(if (eq state 'insert)
'underline
;; Don't just use 'cursor, this can hide the current character.
(list :inverse-video t
:foreground (face-background 'cursor)
:background (face-background 'default)))
header-line-format)))

View file

@ -38,23 +38,13 @@
(def-package! helm
:after helm-mode
: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
(setq helm-candidate-number-limit 50
;; 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)
helm-mode-handle-completion-in-region nil)
:config
(setq projectile-completion-system 'helm)
@ -105,19 +95,38 @@
(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 #'+helm*hide-minibuffer-maybe)
)
(add-hook 'helm-minibuffer-set-up-hook #'+helm*hide-minibuffer-maybe))
(def-package! helm-locate
:defer t
:init (defvar helm-generic-files-map (make-sparse-keymap))
:config (set-keymap-parent helm-generic-files-map helm-map))
(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))
(after! helm-bookmark
(setq-default helm-bookmark-show-location t))
;; `helm-locate'
(defvar helm-generic-files-map (make-sparse-keymap))
(after! helm-locate (set-keymap-parent helm-generic-files-map helm-map))
;; `helm-bookmark'
(setq helm-bookmark-show-location t)
(after! helm-files
@ -131,9 +140,9 @@
:map helm-ag-edit-map [remap quit-window] #'helm-ag--edit-abort)
(after! 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-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)
(def-package! helm-swoop ; https://github.com/ShingoFukuyama/helm-swoop
@ -149,6 +158,71 @@
:commands wgrep-change-to-wgrep-mode
:config (setq wgrep-auto-save-buffer t))
(def-package! posframe
:after helm
:when (and EMACS26+ (featurep! +childframe)))
:when (and EMACS26+ (featurep! +childframe))
:after helm)
;;
;; Evil integration
;;
(when (featurep! :feature evil +everywhere)
(setq helm-default-prompt-display-function #'+helm--set-prompt-display)
(map! (:after helm
:map helm-map
:ni "M-[" #'helm-previous-source
:ni "M-]" #'helm-next-source
:ni "M-l" #'helm-execute-persistent-action
:ni "M-j" #'helm-next-line
:ni "M-k" #'helm-previous-line
:ni "C-f" #'helm-next-page
:ni "C-b" #'helm-previous-page
:n "<tab>" #'helm-select-action ; TODO: Ivy has "ga".
:n "[" #'helm-previous-source
:n "]" #'helm-next-source
:n "gk" #'helm-previous-source
:n "gj" #'helm-next-source
:n "(" #'helm-prev-visible-mark
:n ")" #'helm-next-visible-mark
:n "j" #'helm-next-line
:n "k" #'helm-previous-line
:n "gg" #'helm-beginning-of-buffer
:n "G" #'helm-end-of-buffer
:n "/" #'helm-quit-and-find-file
:n "gr" #'helm-refresh
:n "yp" #'helm-yank-selection
:n "yP" #'helm-copy-to-buffer
:n "yy" #'helm-kill-selection-and-quit)
(:after helm-files
:map (helm-find-files-map helm-read-file-map)
:n "go" #'helm-ff-run-switch-other-window
:n "/" #'helm-ff-run-find-sh-command
:ni "S-<return>" #'helm-ff-run-switch-other-window
:ni "M-h" #'helm-find-files-up-one-level
:n "=" #'helm-ff-run-ediff-file
:n "%" #'helm-ff-run-query-replace-regexp
:n "D" #'helm-ff-run-delete-file) ; Ivy has "D".
(:after helm-locate
:map helm-generic-files-map
:n "go" #'helm-ff-run-switch-other-window
:ni "S-<return>" #'helm-ff-run-switch-other-window)
(:after helm-buffers
:map helm-buffer-map
:n "go" #'helm-buffer-switch-other-window
:n "gO" #'display-buffer
:ni "S-<return>" #'helm-buffer-switch-other-window
:ni "M-<return>" #'display-buffer
:n "=" #'helm-buffer-run-ediff
:n "%" #'helm-buffer-run-query-replace-regexp
:n "D" #'helm-buffer-run-kill-persistent) ; Ivy has "D".
(:after helm-regexp
:map helm-moccur-map
:n "go" #'helm-moccur-run-goto-line-ow
:ni "S-<return>" #'helm-moccur-run-goto-line-ow)
(:after helm-grep
:map helm-grep-map
:n "go" #'helm-grep-run-other-window-action
:ni "S-<return>" #'helm-grep-run-other-window-action)))

View file

@ -10,5 +10,7 @@
(package! helm-projectile)
(package! helm-swoop)
(package! wgrep)
(when (featurep! +fuzzy)
(package! helm-flx))
(when (and EMACS26+ (featurep! +childframe))
(package! posframe))

View file

@ -28,7 +28,6 @@ immediately runs it on the current candidate (ending the ivy session)."
:after-call pre-command-hook
:config
(setq ivy-height 15
ivy-do-completion-in-region nil
ivy-wrap t
ivy-fixed-height-minibuffer t
projectile-completion-system 'ivy
@ -67,16 +66,8 @@ immediately runs it on the current candidate (ending the ivy session)."
(ivy-set-display-transformer cmd '+ivy-buffer-transformer)))
(def-package! swiper :commands (swiper swiper-all))
(def-package! counsel
:commands (counsel-ag counsel-rg counsel-pt counsel-apropos counsel-bookmark
counsel-describe-function counsel-describe-variable
counsel-describe-face counsel-M-x counsel-file-jump
counsel-find-file counsel-find-library counsel-info-lookup-symbol
counsel-imenu counsel-recentf counsel-yank-pop
counsel-descbinds counsel-org-capture counsel-grep-or-swiper)
:commands counsel-describe-face
:init
(map! [remap apropos] #'counsel-apropos
[remap bookmark-jump] #'counsel-bookmark
@ -127,9 +118,7 @@ immediately runs it on the current candidate (ending the ivy session)."
;; Used by `counsel-M-x'
(def-package! smex
:commands (smex smex-major-mode-commands)
:config
(after! smex
(setq smex-save-file (concat doom-cache-dir "/smex-items"))
(smex-initialize))
@ -220,3 +209,64 @@ immediately runs it on the current candidate (ending the ivy session)."
;; posframe doesn't work well with async sources
(dolist (fn '(swiper counsel-rg counsel-ag counsel-pt counsel-grep counsel-git-grep))
(map-put ivy-display-functions-alist fn nil)))
(def-package! flx
:when (featurep! +fuzzy)
:defer t ; is loaded by ivy
:init
(setq ivy-re-builders-alist
'((counsel-ag . ivy--regex-plus)
(counsel-rg . ivy--regex-plus)
(counsel-pt . ivy--regex-plus)
(counsel-grep-or-swiper . ivy--regex-plus)
(t . ivy--regex-fuzzy))
ivy-initial-inputs-alist nil))
;;
;; Evil key fixes
;;
(map! :when (featurep! :feature evil +everywhere)
:after ivy
:map ivy-occur-mode-map
:n [mouse-1] #'ivy-occur-click
:n "<return>" #'ivy-occur-press-and-switch
:m "j" #'ivy-occur-next-line
:m "k" #'ivy-occur-previous-line
:m "h" #'evil-backward-char
:m "l" #'evil-forward-char
:m "g" nil
:m "gg" #'evil-goto-first-line
:n "gf" #'ivy-occur-press
:n "ga" #'ivy-occur-read-action
:n "go" #'ivy-occur-dispatch
:n "gc" #'ivy-occur-toggle-calling
:n "gr" #'ivy-occur-revert-buffer
:n "q" #'quit-window
:map ivy-occur-grep-mode-map
:v "j" #'evil-next-line
:v "k" #'evil-previous-line
:n "D" #'ivy-occur-delete-candidate
:n "C-d" #'evil-scroll-down
:n "d" #'ivy-occur-delete-candidate
:n "C-x C-q" #'ivy-wgrep-change-to-wgrep-mode
:n "i" #'ivy-wgrep-change-to-wgrep-mode
:n "gd" #'ivy-occur-delete-candidate
:n [mouse-1] #'ivy-occur-click
:n "<return>" #'ivy-occur-press-and-switch
:m "j" #'ivy-occur-next-line
:m "k" #'ivy-occur-previous-line
:m "h" #'evil-backward-char
:m "l" #'evil-forward-char
:m "g" nil
:m "gg" #'evil-goto-first-line
:n "gf" #'ivy-occur-press
:n "gr" #'ivy-occur-revert-buffer
:n "ga" #'ivy-occur-read-action
:n "go" #'ivy-occur-dispatch
:n "gc" #'ivy-occur-toggle-calling
;; quit
:n "q" #'quit-window)

View file

@ -10,5 +10,8 @@
(package! ivy-rich)
(package! wgrep)
(when (featurep! +fuzzy)
(package! flx))
(when (and EMACS26+ (featurep! +childframe))
(package! ivy-posframe))