Update completion/helm
This commit is contained in:
parent
102c7df400
commit
e8e9f7683a
4 changed files with 106 additions and 84 deletions
44
modules/completion/helm/autoload/evil.el
Normal file
44
modules/completion/helm/autoload/evil.el
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
;;; completion/helm/autoload/evil.el -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
|
;;;###autoload (autoload '+helm:swoop "completion/helm/autoload/evil" nil t)
|
||||||
|
(evil-define-command +helm:swoop (&optional search bang)
|
||||||
|
"Invoke `swoop' with SEARCH. If BANG, do multiline search."
|
||||||
|
(interactive "<a><!>")
|
||||||
|
(helm-swoop :$query search :$multiline bang))
|
||||||
|
|
||||||
|
(defvar +helm--file-last-search nil)
|
||||||
|
;;;###autoload (autoload '+helm:ag "completion/helm/autoload/evil" nil t)
|
||||||
|
(evil-define-command +helm:ag (beg end query &optional bang directory)
|
||||||
|
"TODO"
|
||||||
|
(interactive "<r><a><!>")
|
||||||
|
(require 'helm-ag)
|
||||||
|
(helm-ag--init-state)
|
||||||
|
(let ((helm-ag--default-directory (or directory (doom-project-root)))
|
||||||
|
(helm-ag--last-query (or query
|
||||||
|
(and beg end
|
||||||
|
(> (abs (- end beg)) 1)
|
||||||
|
(setq +helm--file-last-search
|
||||||
|
(rxt-quote-pcre (buffer-substring-no-properties beg end))))
|
||||||
|
+helm--file-last-search))
|
||||||
|
(helm-ag-command-option (concat helm-ag-command-option (if bang " -a "))))
|
||||||
|
(helm-attrset 'search-this-file nil helm-ag-source)
|
||||||
|
(helm-attrset 'name (helm-ag--helm-header helm-ag--default-directory) helm-ag-source)
|
||||||
|
(helm :sources '(helm-ag-source)
|
||||||
|
:input query
|
||||||
|
:buffer "*helm-ag*"
|
||||||
|
:keymap helm-ag-map
|
||||||
|
:history 'helm-ag--helm-history)))
|
||||||
|
|
||||||
|
;;;###autoload (autoload '+helm:ag-cwd "completion/helm/autoload/evil" nil t)
|
||||||
|
(evil-define-command +helm:ag-cwd (beg end query &optional bang directory)
|
||||||
|
"TODO"
|
||||||
|
(interactive "<r><a><!>")
|
||||||
|
(let ((helm-ag-command-option (if bang " -n ")))
|
||||||
|
(+helm:ag beg end query t default-directory)))
|
||||||
|
|
||||||
|
;;;###autoload
|
||||||
|
(defun +helm:rg (&rest _) (interactive) (error "Not implemented yet"))
|
||||||
|
;;;###autoload
|
||||||
|
(defun +helm:rg-cwd (&rest _) (interactive) (error "Not implemented yet"))
|
||||||
|
;;;###autoload
|
||||||
|
(defun +helm:todo (&rest _) (interactive) (error "Not implemented yet"))
|
2
modules/completion/helm/autoload/helm.el
Normal file
2
modules/completion/helm/autoload/helm.el
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
;;; completion/helm/autoload/helm.el -*- lexical-binding: t; -*-
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
;;; completion/helm/config.el
|
;;; completion/helm/config.el -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
;; Warning: since I don't use helm, this may be out of date.
|
;; Warning: since I don't use helm, this may be out of date.
|
||||||
|
|
||||||
|
@ -10,7 +10,8 @@
|
||||||
;; Packages
|
;; Packages
|
||||||
;;
|
;;
|
||||||
|
|
||||||
(def-package! helm :demand t
|
(def-package! helm
|
||||||
|
:demand t
|
||||||
:init
|
:init
|
||||||
(setq helm-quick-update t
|
(setq helm-quick-update t
|
||||||
;; Speedier without fuzzy matching
|
;; Speedier without fuzzy matching
|
||||||
|
@ -31,13 +32,38 @@
|
||||||
helm-move-to-line-cycle-in-source t)
|
helm-move-to-line-cycle-in-source t)
|
||||||
|
|
||||||
:config
|
:config
|
||||||
|
(load "helm-autoloads" nil t)
|
||||||
(setq projectile-completion-system 'helm)
|
(setq projectile-completion-system 'helm)
|
||||||
|
(set! :popup "\\` ?\\*[hH]elm.*?\\*\\'" :size 14 :regexp t)
|
||||||
|
|
||||||
(map! "M-x" #'helm-M-x
|
(add-hook 'emacs-startup-hook #'helm-mode)
|
||||||
"A-x" #'helm-M-x
|
|
||||||
"M-X" #'helm-apropos
|
;;; Helm hacks
|
||||||
"A-X" #'helm-apropos
|
;; A simpler prompt: see `+helm-global-prompt'
|
||||||
"M-o" #'helm-find-files
|
(defun +helm*replace-prompt (plist)
|
||||||
|
(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)
|
||||||
|
|
||||||
|
;; Hide mode-line in helm windows
|
||||||
|
(defun +helm*hide-header (&rest _))
|
||||||
|
(advice-add #'helm-display-mode-line :override #'+helm*hide-header)
|
||||||
|
|
||||||
|
(map! [remap apropos] #'helm-apropos
|
||||||
|
[remap find-file] #'helm-find-files
|
||||||
|
[remap projectile-switch-to-buffer] #'helm-projectile-switch-to-buffer
|
||||||
|
[remap recentf] #'helm-recentf
|
||||||
|
[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
|
||||||
|
|
||||||
(:map helm-map
|
(:map helm-map
|
||||||
"C-S-n" #'helm-next-source
|
"C-S-n" #'helm-next-source
|
||||||
|
@ -57,64 +83,21 @@
|
||||||
(:map* helm-generic-files-map
|
(:map* helm-generic-files-map
|
||||||
:e "ESC" #'helm-keyboard-quit))
|
:e "ESC" #'helm-keyboard-quit))
|
||||||
|
|
||||||
;;; Popup setup
|
|
||||||
(set! :popup "\\` ?\\*[hH]elm.*?\\*\\'" :size 14 :regexp t)
|
|
||||||
|
|
||||||
;;; Helm hacks
|
|
||||||
(defconst doom-helm-header-fg (face-attribute 'helm-source-header :foreground))
|
|
||||||
;; Shrink source headers if there is only one source
|
|
||||||
(add-hook 'helm-after-initialize-hook #'doom*helm-hide-source-header-maybe)
|
|
||||||
;; A simpler prompt: see `+helm-global-prompt'
|
|
||||||
(advice-add #'helm :filter-args #'doom*helm-replace-prompt)
|
|
||||||
;; Hide mode-line in helm windows
|
|
||||||
(advice-add #'helm-display-mode-line :override #'doom*helm-hide-header)
|
|
||||||
|
|
||||||
(require 'helm-mode)
|
|
||||||
(helm-mode +1)
|
|
||||||
|
|
||||||
(map! :map helm-mode-map
|
|
||||||
[remap find-file] #'helm-find-files
|
|
||||||
[remap switch-to-buffer] #'doom/helm-buffers-dwim
|
|
||||||
[remap projectile-switch-to-buffer] (λ! (doom/helm-buffers-dwim t))
|
|
||||||
[remap recentf] #'helm-recentf
|
|
||||||
[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)
|
|
||||||
|
|
||||||
(defvar helm-projectile-find-file-map (make-sparse-keymap))
|
(defvar helm-projectile-find-file-map (make-sparse-keymap))
|
||||||
(require 'helm-projectile)
|
(require 'helm-projectile)
|
||||||
(set-keymap-parent helm-projectile-find-file-map helm-map))
|
(set-keymap-parent helm-projectile-find-file-map helm-map))
|
||||||
|
|
||||||
|
|
||||||
(def-package! helm-locate
|
(def-package! helm-locate
|
||||||
:init
|
:init (defvar helm-generic-files-map (make-sparse-keymap))
|
||||||
(defvar helm-generic-files-map (make-sparse-keymap)
|
|
||||||
"Generic Keymap for files.")
|
|
||||||
:config (set-keymap-parent helm-generic-files-map helm-map))
|
:config (set-keymap-parent helm-generic-files-map helm-map))
|
||||||
|
|
||||||
|
|
||||||
(def-package! helm-buffers
|
|
||||||
:commands (helm-buffers-list helm-mini)
|
|
||||||
:config (advice-add #'helm-buffer-list :override #'helm*buffer-list))
|
|
||||||
|
|
||||||
|
|
||||||
(def-package! helm-tags
|
|
||||||
:commands (helm-tags-get-tag-file helm-etags-select))
|
|
||||||
|
|
||||||
|
|
||||||
(def-package! helm-bookmark
|
(def-package! helm-bookmark
|
||||||
:commands (helm-bookmarks helm-filtered-bookmarks)
|
|
||||||
:config (setq-default helm-bookmark-show-location t))
|
:config (setq-default helm-bookmark-show-location t))
|
||||||
|
|
||||||
|
|
||||||
(def-package! helm-files
|
(def-package! helm-files
|
||||||
:commands (helm-browse-project helm-find helm-find-files helm-for-files helm-multi-files helm-recentf)
|
|
||||||
:config
|
:config
|
||||||
(setq helm-boring-file-regexp-list
|
(setq helm-boring-file-regexp-list
|
||||||
(append (list "\\.projects$" "\\.DS_Store$")
|
(append (list "\\.projects$" "\\.DS_Store$")
|
||||||
|
@ -126,23 +109,12 @@
|
||||||
|
|
||||||
|
|
||||||
(def-package! helm-ag
|
(def-package! helm-ag
|
||||||
:commands (helm-ag
|
|
||||||
helm-ag-mode
|
|
||||||
helm-do-ag
|
|
||||||
helm-do-ag-this-file
|
|
||||||
helm-do-ag-project-root
|
|
||||||
helm-do-ag-buffers
|
|
||||||
helm-ag-project-root
|
|
||||||
helm-ag-pop-stack
|
|
||||||
helm-ag-buffers
|
|
||||||
helm-ag-clear-stack)
|
|
||||||
:config
|
:config
|
||||||
(map! (:map helm-ag-map
|
(map! (:map helm-ag-map
|
||||||
"<backtab>" #'helm-ag-edit)
|
"<backtab>" #'helm-ag-edit)
|
||||||
(:map helm-ag-edit-map
|
(:map helm-ag-edit-map
|
||||||
"<escape>" #'helm-ag--edit-abort
|
[remap doom/kill-this-buffer] #'helm-ag--edit-abort
|
||||||
"C-c C-c" #'helm-ag--edit-commit
|
[remap quit-window] #'helm-ag--edit-abort)))
|
||||||
:n "zx" #'helm-ag--edit-abort)))
|
|
||||||
|
|
||||||
|
|
||||||
(def-package! helm-css-scss ; https://github.com/ShingoFukuyama/helm-css-scss
|
(def-package! helm-css-scss ; https://github.com/ShingoFukuyama/helm-css-scss
|
||||||
|
@ -164,10 +136,6 @@
|
||||||
|
|
||||||
|
|
||||||
(def-package! helm-describe-modes :commands helm-describe-modes)
|
(def-package! helm-describe-modes :commands helm-describe-modes)
|
||||||
(def-package! helm-ring :commands helm-show-kill-ring)
|
|
||||||
(def-package! helm-semantic :commands helm-semantic-or-imenu)
|
|
||||||
(def-package! helm-elisp :commands helm-apropos)
|
|
||||||
(def-package! helm-command :commands helm-M-x)
|
|
||||||
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
|
@ -188,18 +156,18 @@
|
||||||
|
|
||||||
(after! helm-ag
|
(after! helm-ag
|
||||||
;; This prevents helm-ag from switching between windows and buffers.
|
;; This prevents helm-ag from switching between windows and buffers.
|
||||||
(defadvice helm-ag--edit-abort (around helm-ag-edit-abort-popup-compat activate)
|
(defun +helm*ag-edit-done (orig-fn &rest args)
|
||||||
(cl-letf (((symbol-function 'select-window) #'ignore)) ad-do-it)
|
(cl-letf (((symbol-function 'select-window) #'ignore))
|
||||||
(doom/popup-close nil t))
|
(apply orig-fn args))
|
||||||
|
(doom/popup-close))
|
||||||
|
(advice-add #'helm-ag--edit-commit :around #'+helm*ag-edit-done)
|
||||||
|
(advice-add #'helm-ag--edit-abort :around #'+helm*ag-edit-done)
|
||||||
|
|
||||||
(defadvice helm-ag--edit-commit (around helm-ag-edit-commit-popup-compat activate)
|
(defun +helm*ag-edit (orig-fn &rest args)
|
||||||
(cl-letf (((symbol-function 'select-window) #'ignore)) ad-do-it)
|
|
||||||
(doom/popup-close nil t))
|
|
||||||
|
|
||||||
(defadvice helm-ag--edit (around helm-ag-edit-popup-compat activate)
|
|
||||||
(cl-letf (((symbol-function 'other-window) #'ignore)
|
(cl-letf (((symbol-function 'other-window) #'ignore)
|
||||||
((symbol-function 'switch-to-buffer) #'doom-popup-buffer))
|
((symbol-function 'switch-to-buffer) #'doom-popup-buffer))
|
||||||
ad-do-it
|
(apply orig-fn args)
|
||||||
(with-current-buffer (get-buffer "*helm-ag-edit*")
|
(with-current-buffer (get-buffer "*helm-ag-edit*")
|
||||||
(use-local-map helm-ag-edit-map)))))
|
(use-local-map helm-ag-edit-map))))
|
||||||
|
(advice-add #'helm-ag--edit :around #'+helm*ag-edit))
|
||||||
|
|
||||||
|
|
|
@ -57,18 +57,26 @@
|
||||||
|
|
||||||
;; Project navigation
|
;; Project navigation
|
||||||
(ex! "a" #'projectile-find-other-file)
|
(ex! "a" #'projectile-find-other-file)
|
||||||
(ex! "ag" #'+ivy:ag)
|
|
||||||
(ex! "agc[wd]" #'+ivy:ag-cwd)
|
|
||||||
(ex! "rg" #'+ivy:rg)
|
|
||||||
(ex! "rgc[wd]" #'+ivy:rg-cwd)
|
|
||||||
(ex! "cd" #'+hlissner:cd)
|
(ex! "cd" #'+hlissner:cd)
|
||||||
(ex! "sw[iper]" #'+ivy:swiper) ; in-file search
|
(cond ((featurep! :completion ivy)
|
||||||
|
(ex! "ag" #'+ivy:ag)
|
||||||
|
(ex! "agc[wd]" #'+ivy:ag-cwd)
|
||||||
|
(ex! "rg" #'+ivy:rg)
|
||||||
|
(ex! "rgc[wd]" #'+ivy:rg-cwd)
|
||||||
|
(ex! "sw[iper]" #'+ivy:swiper)
|
||||||
|
(ex! "todo" #'+ivy:todo))
|
||||||
|
((featurep! :completion helm)
|
||||||
|
(ex! "ag" #'+helm:ag)
|
||||||
|
(ex! "agc[wd]" #'+helm:ag-cwd)
|
||||||
|
(ex! "rg" #'+helm:rg)
|
||||||
|
(ex! "rgc[wd]" #'+helm:rg-cwd)
|
||||||
|
(ex! "sw[oop]" #'+helm:swoop)
|
||||||
|
(ex! "todo" #'+helm:todo)))
|
||||||
|
|
||||||
;; Project tools
|
;; Project tools
|
||||||
(ex! "build" #'+eval/build)
|
(ex! "build" #'+eval/build)
|
||||||
(ex! "debug" #'+debug/run)
|
(ex! "debug" #'+debug/run)
|
||||||
(ex! "er[rors]" #'flycheck-list-errors)
|
(ex! "er[rors]" #'flycheck-list-errors)
|
||||||
(ex! "todo" #'+ivy:todo)
|
|
||||||
|
|
||||||
;; File operations
|
;; File operations
|
||||||
(ex! "cp" #'+evil:copy-this-file)
|
(ex! "cp" #'+evil:copy-this-file)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue