From 8ea0b4a7db135e51158209aeb40f686ab31c736e Mon Sep 17 00:00:00 2001 From: syl20bnr Date: Tue, 2 Dec 2014 16:27:27 -0500 Subject: [PATCH] Disable auto-highlight of symbol Must now be performed on demand with ` s h` --- DOCUMENTATION.md | 23 ++++++++++++++--------- spacemacs/packages.el | 13 ++++++++++--- 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/DOCUMENTATION.md b/DOCUMENTATION.md index 68a9a4ae0..5d19f228a 100644 --- a/DOCUMENTATION.md +++ b/DOCUMENTATION.md @@ -69,7 +69,7 @@ - [Project Searching](#project-searching) - [Persistent highlighting](#persistent-highlighting) - [Stacking highlights](#stacking-highlights) - - [Auto-highlight symbols](#auto-highlight-symbols) + - [Highlight current symbol](#highlight-current-symbol) - [Visual Star](#visual-star) - [Listing symbols by semantic](#listing-symbols-by-semantic) - [Helm-swoop](#helm-swoop) @@ -1030,16 +1030,19 @@ Key Binding | Description SPC h r | restore saved highlights in the current buffer SPC h s | save current highlights -### Auto-highlight symbols +### Highlight current symbol -`Spacemacs` supports auto highlighting of the current symbol (provided by the - [auto-highlight-symbol][auto-highlight] mode) and add a micro-state to it - which makes it a very handy tool to have in your tool belt. +`Spacemacs` supports highlighting of the current symbol on demand (provided by +the [auto-highlight-symbol][auto-highlight] mode) and add a micro-state to +easily navigate and rename this symbol. -Key Binding | Description ------------------------|---------------------------------------------------------------- -SPC s e | edit all occurrences of the current symbol -SPC t h | toggle the auto highlighting +It is also possible to change the range of the navigation on the fly to: +- buffer +- function +- visible area + +To initiate the highlighting of the current symbol under point press +SPC s h. Navigation between the highlighted symbols can be done with the commands: @@ -1047,6 +1050,8 @@ Key Binding | Description -----------------------|------------------------------------------------------------ * | initiate navigation micro-state SPC s b | go to the last searched occurrence of the last highlighted symbol +SPC s e | edit all occurrences of the current symbol +SPC s h | highlight the current symbol and all its occurrence within the current range SPC s n | go to next occurrence and initiate navigation micro-state SPC s N | go to previous occurrence and initiate navigation micro-state SPC s r b | change range to `whole buffer` diff --git a/spacemacs/packages.el b/spacemacs/packages.el index a947e2cae..50983bd34 100644 --- a/spacemacs/packages.el +++ b/spacemacs/packages.el @@ -292,6 +292,9 @@ which require an initialization must be listed explicitly in the list.") (custom-set-variables '(ahs-case-fold-search nil) '(ahs-default-range (quote ahs-range-whole-buffer)) + ;; disable auto-highlight of symbol + ;; current symbol should be highlight on demand with s h + '(ahs-idle-timer 0) '(ahs-idle-interval 0.25) '(ahs-inhibit-face-list nil)) @@ -312,13 +315,17 @@ which require an initialization must be listed explicitly in the list.") '(evil-leader/set-key "se" 'ahs-edit-mode "sb" 'spacemacs/goto-last-searched-ahs-symbol + "sh" (lambda () (interactive) + (eval '(progn + (ahs-highlight-now) + (setq spacemacs-last-ahs-highlight-p (ahs-highlight-p)) + (spacemacs/auto-highlight-symbol-overlay-map)) nil)) "sn" (lambda () (interactive) (eval '(progn (ahs-highlight-now) (ahs-forward)) nil)) "sN" (lambda () (interactive) (eval '(progn (ahs-highlight-now) (ahs-backward)) nil)) "srb" (lambda () (interactive) (eval '(ahs-change-range 'ahs-range-whole-buffer) nil)) "srd" (lambda () (interactive) (eval '(ahs-change-range 'ahs-range-display) nil)) "srf" (lambda () (interactive) (eval '(ahs-change-range 'ahs-range-beginning-of-defun) nil)) - "sR" (lambda () (interactive) (eval '(ahs-change-range ahs-default-range) nil)) - "th" 'auto-highlight-symbol-mode)) + "sR" (lambda () (interactive) (eval '(ahs-change-range ahs-default-range) nil)))) (spacemacs//hide-lighter auto-highlight-symbol-mode) ;; micro-state to easily jump from a highlighted symbol to the others (dolist (sym '(ahs-forward @@ -367,7 +374,7 @@ which require an initialization must be listed explicitly in the list.") (propx/y (propertize x/y 'face ahs-plugin-whole-buffer-face)) (hidden (if (< 0 (- overlay-count (nth 4 st))) "*" "")) (prophidden (propertize hidden 'face '(:weight bold)))) - (echo "%s %s%s press (n) or (N) to navigate, (R) for reset, (r) to change range" + (echo "%s %s%s press (n/N) to navigate, (e) to edit, (r) to change range or (R) for reset" propplugin propx/y prophidden))))))) (defun spacemacs/init-bookmark ()