Add ace-link package to spacemacs layer

This commit is contained in:
Daniel Wu 2015-04-04 22:36:39 -04:00 committed by syl20bnr
parent a8efc6f86f
commit 77b0cc4ba6
2 changed files with 40 additions and 0 deletions

View file

@ -1205,6 +1205,15 @@ Key Binding | Description
Hint: you may change to char mode by `C-c C-c` in word mode.
#### ace-link mode
Similar to `ace-jump-mode`, [ace-link][ace-link] allows one to jump to any link in
`help-mode` and `info-mode` with two key strokes.
Key Binding | Description
---------------------|------------------------------------------------------------------
<kbd>o</kbd> | initiate ace link mode in `help-mode` and `info-mode`
### Window manipulation
#### Window manipulation key bindings
@ -2445,6 +2454,7 @@ developers to elisp hackers!
[keychords]: http://www.emacswiki.org/emacs/KeyChord
[centered-cursor]: http://www.emacswiki.org/emacs/centered-cursor-mode.el
[ace-jump]: https://github.com/winterTTr/ace-jump-mode
[ace-link]: https://github.com/abo-abo/ace-link
[ace-window]: https://github.com/abo-abo/ace-window
[helm-link]: https://github.com/emacs-helm/helm
[helm-doc]: https://github.com/emacs-helm/helm/wiki

View file

@ -13,6 +13,7 @@
(defvar spacemacs-packages
'(
ace-jump-mode
ace-link
ace-window
adaptive-wrap
aggressive-indent
@ -136,6 +137,35 @@ which require an initialization must be listed explicitly in the list.")
(setq ace-jump-mode-scope 'global)
(evil-leader/set-key "`" 'ace-jump-mode-pop-mark))))
(defun spacemacs/init-ace-link ()
(use-package ace-link
:defer t
:init (ace-link-setup-default)
:config
(progn
(defvar spacemacs--link-pattern "~?/.+\\|\s\\[")
(defun spacemacs//collect-spacemacs-buffer-links ()
(let ((end (window-end))
points)
(save-excursion
(goto-char (window-start))
(while (re-search-forward spacemacs--link-pattern end t)
(push (+ (match-beginning 0) 1) points))
(nreverse points))))
(defun spacemacs//ace-buffer-links ()
"Ace jump to links in `spacemacs' buffer."
(interactive)
(ali-generic
(spacemacs//collect-spacemacs-buffer-links)
(forward-char 1)
(push-button)
))
(define-key spacemacs-mode-map "o" 'spacemacs//ace-buffer-links)
)))
(defun spacemacs/init-ace-window ()
(use-package ace-window
:defer t