add counsel-dash

This commit is contained in:
ralesi 2016-06-20 00:13:20 -07:00 committed by syl20bnr
parent 94969fd81d
commit d22616a590
3 changed files with 40 additions and 12 deletions

View File

@ -11,10 +11,9 @@
- [[#zeal-linux--windows][Zeal (Linux & Windows)]]
- [[#check-documentation-for-x-at-point][Check Documentation for x-at-point]]
- [[#key-bindings][Key bindings]]
- [[#helm-dash][helm-dash]]
- [[#helm-dash-and-counsel-dash][helm-dash and counsel-dash]]
* Description
+*This layer works only on OS X for the moment*+
- [[http://kapeli.com/dash][dash]] :: Is a great tool for quick access to various sets of documentation,
only available in OS X.
@ -58,13 +57,14 @@ information on customizing specific docsets for modes.
|-------------+-----------------------------------------------------------------|
| ~SPC d d~ | Lookup thing at point in Dash or Zeal |
| ~SPC d D~ | Lookup thing at point in Dash or Zeal within a specified Docset |
| ~SPC d h~ | Lookup thing at point in helm-dash |
| ~SPC d H~ | Lookup thing at point in helm-dash within a specified Docset |
| ~SPC d h~ | Lookup thing at point in helm-dash or counsel-dash |
| ~SPC d H~ | Lookup in helm-dash or counsel-dash within a specified Docset |
** helm-dash
** helm-dash and counsel-dash
=dash-at-point= is linked to the GUI app and is only available for OSX. On
linux, you can use =zeal-at-point= which is linked to the GUI app too, but it's
open source.
Or you can use [[https://github.com/areina/helm-dash][helm-dash]] instead, it requires no app. You can use
Or you can use [[https://github.com/areina/helm-dash][helm-dash]] when using =helm= and [[https://github.com/nathankot/counsel-dash][counsel-dash]] when using =ivy=,
which requires no additional application. You can use
=dash/helm-dash-docset-newpath= to set the location path of your docsets.

View File

@ -0,0 +1,16 @@
;;; funcs.el --- Dash Layer functions File for Spacemacs
;;
;; Copyright (c) 2012-2016 Sylvain Benner & Contributors
;;
;; URL: https://github.com/syl20bnr/spacemacs
;;
;; This file is not part of GNU Emacs.
;;
;;; License: GPLv3
(defun dash//activate-package-docsets (path)
"Add dash docsets from specified PATH."
(setq helm-dash-docsets-path path
helm-dash-common-docsets (helm-dash-installed-docsets))
(message (format "activated %d docsets from: %s"
(length helm-dash-common-docsets) path)))

View File

@ -2,6 +2,7 @@
(setq dash-packages
'(
(helm-dash :toggle (configuration-layer/package-usedp 'helm))
(counsel-dash :toggle (configuration-layer/package-usedp 'ivy))
))
(cond
@ -19,12 +20,23 @@
"dh" 'helm-dash-at-point
"dH" 'helm-dash)
:config
(defun dash//activate-package-docsets (path)
"Add dash docsets from specified PATH."
(setq helm-dash-docsets-path path
helm-dash-common-docsets (helm-dash-installed-docsets))
(message (format "activated %d docsets from: %s"
(length helm-dash-common-docsets) path)))
(dash//activate-package-docsets helm-dash-docset-newpath)))
(defun dash/init-counsel-dash ()
(use-package counsel-dash
:defer t
:init
(spacemacs/set-leader-keys
"dh" 'counsel-dash-at-point
"dH" 'counsel-dash)
(defun counsel-dash-at-point ()
"Counsel dash with selected point"
(interactive)
(counsel-dash
(if (use-region-p)
(buffer-substring-no-properties (region-beginning) (region-end))
(substring-no-properties (or (thing-at-point 'symbol) "")))))
:config
(dash//activate-package-docsets helm-dash-docset-newpath)))
(defun dash/init-dash-at-point ()