diff --git a/layers/+completion/helm/packages.el b/layers/+completion/helm/packages.el index 1cefdc943..6569646d8 100644 --- a/layers/+completion/helm/packages.el +++ b/layers/+completion/helm/packages.el @@ -10,7 +10,9 @@ ;;; License: GPLv3 (setq helm-packages - '(ace-jump-helm-line + '( + ace-jump-helm-line + auto-highlight-symbol bookmark helm helm-ag @@ -21,7 +23,8 @@ helm-projectile helm-swoop helm-themes - (helm-spacemacs-help :location local))) + (helm-spacemacs-help :location local) + )) ;; Initialization of packages @@ -32,6 +35,18 @@ (with-eval-after-load 'helm (define-key helm-map (kbd "C-q") 'ace-jump-helm-line)))) +(defun helm/pre-init-auto-highlight-symbol () + (spacemacs|use-package-add-hook auto-highlight-symbol + :post-init + ;; add some functions to ahs transient states + (setq spacemacs--symbol-highlight-transient-state-doc + (concat spacemacs--symbol-highlight-transient-state-doc + " [_b_] search buffers [_/_] search proj [_f_] search files") + spacemacs-symbol-highlight-transient-state-add-bindings + '(("/" spacemacs/helm-project-smart-do-search-region-or-symbol :exit t) + ("b" spacemacs/helm-buffers-smart-do-search-region-or-symbol :exit t) + ("f" spacemacs/helm-files-smart-do-search-region-or-symbol :exit t))))) + (defun helm/post-init-bookmark () (spacemacs/set-leader-keys "fb" 'helm-filtered-bookmarks)) diff --git a/layers/+completion/ivy/funcs.el b/layers/+completion/ivy/funcs.el index c99bbc7d6..6e166a924 100644 --- a/layers/+completion/ivy/funcs.el +++ b/layers/+completion/ivy/funcs.el @@ -246,28 +246,6 @@ To prevent this error we just wrap `describe-mode' to defeat the (swiper--cleanup) (swiper--add-overlays (ivy--regex ivy-text))))))) - -;; Evil - -(defun spacemacs/ivy-evil-registers () - "Show evil registers" - (interactive) - (let ((ivy-height 24)) - (ivy-read "Evil Registers:" - (cl-loop for (key . val) in (evil-register-list) - collect (eval `(format "%s : %s" (propertize ,(char-to-string key) 'face 'font-lock-builtin-face) - ,(or (and val - (stringp val) - (replace-regexp-in-string "\n" "^J" val)) - "")))) - :action #'spacemacs/ivy-insert-evil-register))) - -(defun spacemacs/ivy-insert-evil-register (candidate) - (insert (replace-regexp-in-string "\\^J" "\n" - (substring-no-properties candidate 4)))) - - - ;; Ivy (defun spacemacs//ivy-command-not-implemented-yet (key) @@ -289,7 +267,24 @@ To prevent this error we just wrap `describe-mode' to defeat the (require (car repl)) (call-interactively (cdr repl)))))) +;; Evil +(defun spacemacs/ivy-evil-registers () + "Show evil registers" + (interactive) + (let ((ivy-height 24)) + (ivy-read "Evil Registers:" + (cl-loop for (key . val) in (evil-register-list) + collect (eval `(format "%s : %s" (propertize ,(char-to-string key) 'face 'font-lock-builtin-face) + ,(or (and val + (stringp val) + (replace-regexp-in-string "\n" "^J" val)) + "")))) + :action #'spacemacs/ivy-insert-evil-register))) + +(defun spacemacs/ivy-insert-evil-register (candidate) + (insert (replace-regexp-in-string "\\^J" "\n" + (substring-no-properties candidate 4)))) ;; Layouts diff --git a/layers/+completion/ivy/packages.el b/layers/+completion/ivy/packages.el index 0e0966aa3..14cbc7483 100644 --- a/layers/+completion/ivy/packages.el +++ b/layers/+completion/ivy/packages.el @@ -10,7 +10,8 @@ ;;; License: GPLv3 (setq ivy-packages - '(auto-highlight-symbol + '( + auto-highlight-symbol counsel (counsel-projectile :toggle (configuration-layer/package-usedp 'projectile)) evil @@ -23,15 +24,20 @@ projectile smex swiper - wgrep)) + wgrep + )) -(defun ivy/post-init-auto-highlight-symbol () - (setq spacemacs-symbol-highlight-transient-state-remove-bindings - '("/" "b" "f")) - (setq spacemacs-symbol-highlight-transient-state-add-bindings - '(("/" spacemacs/search-project-auto-region-or-symbol :exit t) - ("b" spacemacs/swiper-all-region-or-symbol :exit t) - ("f" spacemacs/search-auto-region-or-symbol :exit t)))) +(defun ivy/pre-init-auto-highlight-symbol () + (spacemacs|use-package-add-hook auto-highlight-symbol + :post-init + ;; add some functions to ahs transient states + (setq spacemacs--symbol-highlight-transient-state-doc + (concat spacemacs--symbol-highlight-transient-state-doc + " [_b_] search buffers [_/_] search proj [_f_] search files") + spacemacs-symbol-highlight-transient-state-add-bindings + '(("/" spacemacs/search-project-auto-region-or-symbol :exit t) + ("b" spacemacs/swiper-all-region-or-symbol :exit t) + ("f" spacemacs/search-auto-region-or-symbol :exit t))))) (defun ivy/init-counsel () (use-package counsel diff --git a/layers/+spacemacs/spacemacs-editing-visual/packages.el b/layers/+spacemacs/spacemacs-editing-visual/packages.el index 1a483c826..912fe45f0 100644 --- a/layers/+spacemacs/spacemacs-editing-visual/packages.el +++ b/layers/+spacemacs/spacemacs-editing-visual/packages.el @@ -45,7 +45,11 @@ ;; current symbol can always be highlighted with `SPC s h' ahs-idle-timer 0 ahs-idle-interval 0.25 - ahs-inhibit-face-list nil) + ahs-inhibit-face-list nil + spacemacs--symbol-highlight-transient-state-doc + " + %s [_n_] next [_N_/_p_] previous [_r_] change range [_R_] reset [_e_] iedit + %s [_d_/_D_] next/previous definition") ;; since we are creating our own maps, ;; prevent the default keymap from getting created @@ -243,12 +247,16 @@ (iedit-restrict-region (ahs-current-plugin-prop 'start) (ahs-current-plugin-prop 'end))) (t (ahs-edit-mode t)))) - + ;; transient state + (defun spacemacs//symbol-highlight-ts-doc () + (spacemacs//transient-state-make-doc + 'symbol-highlight + (format spacemacs--symbol-highlight-transient-state-doc + (symbol-highlight-doc) + (make-string (length (symbol-highlight-doc)) 32)))) (spacemacs|define-transient-state symbol-highlight :title "Symbol Highlight Transient State" - :doc " -%s(symbol-highlight-doc) [_n_/_N_/_p_] next/prev/prev [_R_] restart [_e_] iedit [_b_] search buffers -%s(make-string (length (symbol-highlight-doc)) 32) [_d_/_D_]^^ next/prev def'n [_r_] change range [_/_] search proj [_f_] search files" + :dynamic-hint (spacemacs//symbol-highlight-ts-doc) :before-exit (spacemacs//ahs-ms-on-exit) :bindings ("d" ahs-forward-definition) @@ -259,9 +267,6 @@ ("p" spacemacs/quick-ahs-backward) ("R" ahs-back-to-start) ("r" ahs-change-range) - ("/" spacemacs/helm-project-smart-do-search-region-or-symbol :exit t) - ("b" spacemacs/helm-buffers-smart-do-search-region-or-symbol :exit t) - ("f" spacemacs/helm-files-smart-do-search-region-or-symbol :exit t) ("q" nil :exit t))))) (defun spacemacs-editing-visual/init-column-enforce-mode ()