Declare function for ash commands

This commit is contained in:
syl20bnr 2014-12-11 00:48:48 -05:00
parent f1e9396fcb
commit 9e9ce528be
3 changed files with 15 additions and 17 deletions

View file

@ -1164,11 +1164,6 @@ Key Binding | Description
<kbd>SPC s b</kbd> | go to the last searched occurrence of the last highlighted symbol
<kbd>SPC s e</kbd> | edit all occurrences of the current symbol
<kbd>SPC s h</kbd> | highlight the current symbol and all its occurrence within the current range
<kbd>SPC s n</kbd> | go to next occurrence and initiate navigation micro-state
<kbd>SPC s N</kbd> | go to previous occurrence and initiate navigation micro-state
<kbd>SPC s r b</kbd> | change range to `whole buffer`
<kbd>SPC s r d</kbd> | change range to `display area`
<kbd>SPC s r f</kbd> | change range to `function`
<kbd>SPC s R</kbd> | change range to default (`whole buffer`)
In 'Spacemacs' highlight symbol micro-state:

View file

@ -17,7 +17,6 @@
("p4" . "perforce")
("r" . "registers/rings")
("s" . "search/symbol")
("sr" . "symbol-range")
("S" . "spelling")
("t" . "toggles")
("tm" . "toggles-modeline")

View file

@ -356,20 +356,24 @@ which require an initialization must be listed explicitly in the list.")
(define-key evil-normal-state-map (kbd "*") 'spacemacs/quick-ahs-forward)
(define-key evil-normal-state-map (kbd "#") 'spacemacs/quick-ahs-backward)))))
(defun spacemacs/symbol-highlight ()
"Highlight the symbol under point with `auto-highlight-symbol'."
(interactive)
(eval '(progn
(ahs-highlight-now)
(setq spacemacs-last-ahs-highlight-p (ahs-highlight-p))
(spacemacs/auto-highlight-symbol-overlay-map)) nil))
(defun spacemacs/symbol-highlight-reset-range ()
"Reset the range for `auto-highlight-symbol'."
(interactive)
(eval '(ahs-change-range ahs-default-range) nil))
(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)))
"sh" 'spacemacs/symbol-highlight
"sR" 'spacemacs/symbol-highlight-reset-range)
(spacemacs|hide-lighter auto-highlight-symbol-mode)
;; micro-state to easily jump from a highlighted symbol to the others