Skip to content

Commit

Permalink
Declare function for ash commands
Browse files Browse the repository at this point in the history
Also removed not useful bindings which are available in the
micro state.
  • Loading branch information
syl20bnr committed Dec 11, 2014
1 parent ee5498a commit c2a3c80
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 17 deletions.
5 changes: 0 additions & 5 deletions doc/DOCUMENTATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 0 additions & 1 deletion spacemacs/config.el
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
("p4" . "perforce")
("r" . "registers/rings")
("s" . "search/symbol")
("sr" . "symbol-range")
("S" . "spelling")
("t" . "toggles")
("tm" . "toggles-modeline")
Expand Down
26 changes: 15 additions & 11 deletions spacemacs/packages.el
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c2a3c80

Please sign in to comment.