Back to dash-at-point! (and zeal-at-point)
This commit is contained in:
parent
7963c48600
commit
9e7749cf1d
28 changed files with 58 additions and 120 deletions
4
Cask
4
Cask
|
@ -74,6 +74,9 @@
|
|||
(depends-on "smart-forward")
|
||||
(depends-on "smartparens")
|
||||
|
||||
;; Documentation --- core/core-docs.el
|
||||
(depends-on "dash-at-point")
|
||||
|
||||
;; Completion --- core/core-company.el
|
||||
(depends-on "company")
|
||||
(depends-on "company-dict")
|
||||
|
@ -111,7 +114,6 @@
|
|||
(depends-on "helm-c-yasnippet")
|
||||
(depends-on "helm-company")
|
||||
(depends-on "helm-css-scss")
|
||||
(depends-on "helm-dash")
|
||||
(depends-on "helm-describe-modes" :git "https://github.com/emacs-helm/helm-describe-modes")
|
||||
(depends-on "helm-projectile")
|
||||
(depends-on "helm-swoop")
|
||||
|
|
24
core/core-docs.el
Normal file
24
core/core-docs.el
Normal file
|
@ -0,0 +1,24 @@
|
|||
;;; core-docs.el
|
||||
|
||||
(use-package dash-at-point
|
||||
:when IS-MAC
|
||||
:commands (dash-at-point dash-at-point-with-docset dash-at-point-run-search
|
||||
dash-at-point-guess-docset)
|
||||
:init
|
||||
(defmacro def-docset! (mode docset)
|
||||
`(add-hook! ,mode (setq-local dash-at-point-docset ,docset)))
|
||||
(defun doom-docs-lookup (&optional search docset)
|
||||
(dash-at-point-run-search search docset)))
|
||||
|
||||
(use-package zeal-at-point
|
||||
:when (not IS-MAC)
|
||||
:commands (zeal-at-point zeal-at-point-set-docset)
|
||||
:init
|
||||
(defmacro def-docset! (mode docset)
|
||||
`(add-hook! ,mode (setq-local zeal-at-point-docset ,docset)))
|
||||
(defun doom-docs-lookup (&optional search docset)
|
||||
(let ((zeal-at-point-docset (or docset zeal-at-point-docset)))
|
||||
(zeal-at-point search))))
|
||||
|
||||
(provide 'core-docs)
|
||||
;;; core-docs.el ends here
|
|
@ -73,13 +73,6 @@
|
|||
(defun helm*buffer-list (&rest _) (doom/get-buffer-names doom-helm-force-project-buffers))
|
||||
(advice-add 'helm-buffer-list :override 'helm*buffer-list))
|
||||
|
||||
(use-package helm-dash
|
||||
:when (not IS-WINDOWS)
|
||||
:commands (helm-dash helm-dash-at-point helm-dash-install-docset)
|
||||
:config
|
||||
(setq helm-dash-browser-func 'doom/dash-open
|
||||
helm-dash-candidate-format "%d → %n (%t)"))
|
||||
|
||||
(use-package helm-tags
|
||||
:commands (helm-tags-get-tag-file helm-etags-select))
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
|
||||
(use-package applescript-mode
|
||||
:mode "\\.applescript$"
|
||||
:config (def-docset! applescript-mode ("AppleScript")))
|
||||
:config (def-docset! applescript-mode "applescript"))
|
||||
|
||||
(def-project-type! lb6 "lb6"
|
||||
:match "\\.lb\\(action\\|ext\\)/.+$"
|
||||
|
|
|
@ -1,66 +0,0 @@
|
|||
;;; defuns-dash.el --- helm-dash integration
|
||||
|
||||
;;;###autoload
|
||||
(defun doom/dash-at-pt ()
|
||||
(interactive)
|
||||
(let (helm-dash-common-docsets)
|
||||
(call-interactively 'helm-dash-at-point)))
|
||||
|
||||
;;;###autoload
|
||||
(defun doom/dash-open (url)
|
||||
"Open url in an *eww* popup."
|
||||
(interactive)
|
||||
(save-window-excursion (eww url))
|
||||
(doom/popup-buffer "*eww*"))
|
||||
|
||||
;;;###autoload (autoload 'doom:dash "defuns-dash" nil t)
|
||||
(evil-define-command doom:dash (&optional bang input)
|
||||
""
|
||||
(interactive "<!><a>")
|
||||
(let ((helm-dash-common-docsets (when bang (helm-dash-installed-docsets))))
|
||||
(helm-dash-initialize-debugging-buffer)
|
||||
(helm-dash-create-common-connections)
|
||||
(helm-dash-create-buffer-connections)
|
||||
(helm :sources (helm-dash-sources--narrowed-docsets)
|
||||
:buffer "*helm-dash*"
|
||||
:prompt "Doc for: "
|
||||
:history 'helm-dash-history-input
|
||||
:input (or input "")
|
||||
:helm-candidate-number-limit 500)))
|
||||
|
||||
(defvar doom--dash-docsets nil)
|
||||
(defvar doom--dash-user-docsets nil)
|
||||
;;;###autoload (autoload 'doom:dash-install "defuns-dash" nil t)
|
||||
(evil-define-command doom:dash-install (&optional docset)
|
||||
"Async docset install."
|
||||
(interactive "<a>")
|
||||
(let ((docsets (or doom--dash-docsets
|
||||
(setq doom--dash-docsets (helm-dash-available-docsets))))
|
||||
(user-docsets (or doom--dash-user-docsets
|
||||
(setq doom--dash-user-docsets (helm-dash-search-all-user-docsets)))))
|
||||
(unless docset
|
||||
(setq docset (helm-dash-read-docset
|
||||
"Install docset"
|
||||
(append docsets (mapcar 'car user-docsets)))))
|
||||
(message "Installing ...")
|
||||
(async-start `(lambda ()
|
||||
,(async-inject-variables "\\`\\(load-path\\|helm-dash-*\\)$")
|
||||
(require 'f)
|
||||
(require 'helm)
|
||||
(require 'helm-dash)
|
||||
(cond ((member ,docset ',docsets)
|
||||
(helm-dash-install-docset ,docset)
|
||||
,docset)
|
||||
((assoc ,docset ',user-docsets)
|
||||
(helm-dash-install-user-docset ,docset)
|
||||
(f-no-ext (f-base (car-safe (cdr-safe (assoc ,docset ',user-docsets))))))))
|
||||
(lambda (doc)
|
||||
(unless doc
|
||||
(error "Invalid docset id" doc))
|
||||
(message "Installing docset %s ..." doc)
|
||||
(helm-dash-activate-docset doc)
|
||||
(setq helm-dash-common-docsets nil)
|
||||
(message "Docset %s installed" doc)))))
|
||||
|
||||
(provide 'defuns-dash)
|
||||
;;; defuns-dash.el ends here
|
17
core/defuns/defuns-docs.el
Normal file
17
core/defuns/defuns-docs.el
Normal file
|
@ -0,0 +1,17 @@
|
|||
;;; defuns-docs.el
|
||||
|
||||
;;;###autoload (autoload 'doom:docs-lookup "defuns-docs" nil t)
|
||||
(evil-define-command doom:docs-lookup (&optional bang input)
|
||||
"Look up INPUT (otherwise the current selection) in Dash or Zeal."
|
||||
(interactive "<!><a>")
|
||||
(let ((docset (unless bang (dash-at-point-guess-docset)))
|
||||
(query input))
|
||||
(when (evil-visual-state-p)
|
||||
(setq query (concat (buffer-substring-no-properties (region-beginning) (region-end))
|
||||
" " query)))
|
||||
(when (or (not query) (zerop (length query)))
|
||||
(setq query (thing-at-point 'symbol)))
|
||||
(doom-docs-lookup query docset)))
|
||||
|
||||
(provide 'defuns-docs)
|
||||
;;; defuns-docs.el ends here
|
|
@ -1,8 +0,0 @@
|
|||
;;; macros-dash.el
|
||||
|
||||
;;;###autoload
|
||||
(defmacro def-docset! (mode docsets)
|
||||
`(add-hook! ,mode (setq-local helm-dash-docsets ',docsets)))
|
||||
|
||||
(provide 'macros-dash)
|
||||
;;; macros-dash.el ends here
|
1
init.el
1
init.el
|
@ -42,6 +42,7 @@
|
|||
core-ui ; draw me like one of your French editors
|
||||
core-evil ; come to the dark side, we have cookies
|
||||
core-editor ; filling the editor-shaped hole in the emacs OS
|
||||
core-docs ; getting to the documentation
|
||||
core-company ; auto-completion, for the lazy typist
|
||||
core-yasnippet ; snippets, for the lazier typist
|
||||
core-autoinsert ; file templates, for the laziest typist
|
||||
|
|
|
@ -24,8 +24,6 @@
|
|||
:config
|
||||
(def-electric! (c-mode c++-mode objc-mode) :chars (?\n ?\}))
|
||||
(def-company-backend! (c-mode c++-mode objc-mode) (irony-c-headers irony))
|
||||
(def-docset! c-mode ("C" "org.libsdl.sdl20"))
|
||||
(def-docset! c++-mode ("C++" "C" "Boost" "Qt_4" "Qt_5" "Cocos2D" "Cocos2D-X" "org.libsdl.sdl20"))
|
||||
|
||||
(setq c-tab-always-indent nil
|
||||
c-electric-flag nil)
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
:mode "\\.cr$"
|
||||
:interpreter "crystal"
|
||||
:config
|
||||
(def-docset! crystal-mode ("crystal"))
|
||||
(def-docset! crystal-mode "crystal")
|
||||
(after! quickrun
|
||||
(quickrun-add-command
|
||||
"crystal" '((:command . "crystal")
|
||||
|
|
|
@ -37,7 +37,6 @@
|
|||
:config
|
||||
(def-builder! sass-mode doom/sass-build)
|
||||
(def-company-backend! sass-mode (css yasnippet))
|
||||
(def-docset! sass-mode ("CSS" "Sass" "Bourbon"))
|
||||
(push '("sass" "css") projectile-other-file-alist))
|
||||
|
||||
(use-package scss-mode
|
||||
|
@ -45,7 +44,7 @@
|
|||
:config
|
||||
(def-builder! scss-mode doom/scss-build)
|
||||
(def-company-backend! scss-mode (css yasnippet))
|
||||
(def-docset! scss-mode ("CSS" "Sass" "Bourbon"))
|
||||
(def-docset! scss-mode "sass,bourbon,compass,neat,css")
|
||||
(push '("scss" "css") projectile-other-file-alist)
|
||||
(setq scss-compile-at-save nil))
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
(use-package dockerfile-mode :mode "/Dockerfile$"
|
||||
:config
|
||||
(def-docset! dockerfile-mode ("Docker"))
|
||||
(def-docset! dockerfile-mode "docker")
|
||||
(def-builder! dockerfile-mode dockerfile-build-buffer "Dockerfile"))
|
||||
|
||||
;; For ROM hacking or debugging
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
(add-hook 'emacs-lisp-mode-hook 'doom/elisp-init)
|
||||
(defun doom/elisp-init ()
|
||||
(def-company-backend! emacs-lisp-mode (elisp yasnippet))
|
||||
(def-docset! emacs-lisp-mode ("Emacs Lisp"))
|
||||
(def-repl! emacs-lisp-mode doom/elisp-inf-ielm)
|
||||
(def-rotate! emacs-lisp-mode
|
||||
:symbols (("t" "nil")
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
:config
|
||||
(def-builder! go-mode "go build")
|
||||
(def-company-backend! go-mode (go yasnippet))
|
||||
(def-docset! go-mode ("Go"))
|
||||
(def-repl! go-mode gorepl-run)
|
||||
(map! :map go-mode-map
|
||||
:n "gd" 'godef-jump
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
("runhaskell" . haskell-mode))
|
||||
:init (add-hook! haskell-mode '(interactive-haskell-mode flycheck-mode))
|
||||
:config
|
||||
(def-docset! haskell-mode ("Haskell"))
|
||||
(def-popup! "*debug:haskell*" :size 20)
|
||||
(def-repl! haskell-mode switch-to-haskell)
|
||||
(push ".hi" completion-ignored-extensions))
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
;;; module-java.el
|
||||
|
||||
(after! c-initialization
|
||||
(def-docset! java-mode ("Java" "Android" "JavaFX")))
|
||||
(def-docset! java-mode "java,javafx,grails,groovy,playjava,spring,cvj,processing,javadoc"))
|
||||
|
||||
(defvar eclim-eclipse-dirs '("/Applications/eclipse"))
|
||||
(defvar eclim-executable "/Applications/eclipse/eclim")
|
||||
|
|
|
@ -7,10 +7,7 @@
|
|||
:config
|
||||
(def-repl! js2-mode nodejs-repl)
|
||||
(def-company-backend! js2-mode (tern yasnippet))
|
||||
(def-docset! js2-mode
|
||||
("JavaScript" "jQuery" "jQuery_Mobile" "jQuery_UI" "AngularJS" "BackboneJS"
|
||||
"D3JS" "EmberJS" "ExtJS" "KnockoutJS" "MarionetteJS" "MomentJS" "NodeJS"
|
||||
"PrototypeJS" "RequireJS" "SailsJS" "UnderscoreJS" "VueJS" "ZeptoJS"))
|
||||
(def-docset! js2-mode "js,jquery,nodejs,angularjs,express")
|
||||
(def-electric! js2-mode :chars (?\} ?\) ?.) :words ("||" "&&"))
|
||||
(setq-default
|
||||
js2-skip-preprocessor-directives t
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
:mode "\\.jl$"
|
||||
:interpreter "julia"
|
||||
:config
|
||||
(def-docset! julia-mode ("Julia"))
|
||||
(def-docset! julia-mode "julia")
|
||||
(def-repl! julia-mode doom/julia-repl))
|
||||
|
||||
(provide 'module-julia)
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
:init (add-hook 'lua-mode-hook 'flycheck-mode)
|
||||
:config
|
||||
(def-company-backend! lua-mode (lua yasnippet))
|
||||
(def-docset! lua-mode ("Lua_5.2" "Lua_5.3"))
|
||||
(def-electric! lua-mode :words ("else" "end"))
|
||||
(def-repl! lua-mode doom/inf-lua)
|
||||
(sp-with-modes '(lua-mode)
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
|
||||
:config
|
||||
(def-repl! php-mode php-boris)
|
||||
(def-docset! php-mode ("PHP" "Laravel" "PHPUnit"))
|
||||
(def-company-backend! php-mode '(php-extras-company company-yasnippet))
|
||||
|
||||
(map! :map php-mode-map (:localleader :nv ";" 'doom/append-semicolon))
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
:init (add-hook 'processing-compilation-mode-hook 'doom|hide-mode-line)
|
||||
:config
|
||||
(def-builder! processing-mode processing-sketch-build)
|
||||
(def-docset! processing-mode ("Processing"))
|
||||
(def-popup! "*processing-compilation*" :align below :size 10 :noselect t)
|
||||
(setq processing-location "/usr/local/bin/processing-java"
|
||||
processing-application-dir "/Applications/Processing.app"
|
||||
|
|
|
@ -21,13 +21,9 @@
|
|||
|
||||
:config
|
||||
(def-company-backend! python-mode (anaconda))
|
||||
(def-docset! python-mode ("OpenCV_Python"))
|
||||
(def-repl! python-mode doom/inf-python)
|
||||
(def-version-cmd! python-mode "python --version 2>&1 | cut -d' ' -f2")
|
||||
(define-key python-mode-map (kbd "DEL") nil) ; interferes with smartparens
|
||||
(add-hook 'doom-env-version-hook
|
||||
(lambda (v) (when (eq major-mode 'python-mode)
|
||||
(push (if (string-prefix-p "2" v) "Python_2" "Python_3") helm-dash-docsets)))))
|
||||
(define-key python-mode-map (kbd "DEL") nil)) ; interferes with smartparens
|
||||
|
||||
(use-package anaconda-mode
|
||||
:after python
|
||||
|
|
|
@ -8,17 +8,12 @@
|
|||
:config
|
||||
(def-builder! ruby-mode "rake %s" "Rakefile")
|
||||
(def-company-backend! ruby-mode (dabbrev-code))
|
||||
(def-docset! ruby-mode ("Ruby_2" "Ruby_on_Rails_5"))
|
||||
(def-electric! ruby-mode :words ("else" "end" "elseif"))
|
||||
(def-repl! ruby-mode inf-ruby)
|
||||
(def-version-cmd! ruby-mode "ruby --version | cut -d' ' -f2")
|
||||
(setq ruby-deep-indent-paren t)
|
||||
;; Don't interfere with my custom RET behavior
|
||||
(define-key ruby-mode-map [?\n] nil)
|
||||
|
||||
(add-hook 'doom-env-version-hook
|
||||
(lambda (v) (when (eq major-mode 'ruby-mode)
|
||||
(push (if (string-prefix-p "2" v) "Ruby_2" "Ruby") helm-dash-docsets)))))
|
||||
(define-key ruby-mode-map [?\n] nil))
|
||||
|
||||
(use-package ruby-refactor
|
||||
:after ruby-mode
|
||||
|
|
|
@ -5,8 +5,7 @@
|
|||
:init (add-hook 'rust-mode-hook 'flycheck-mode)
|
||||
:config
|
||||
(def-builder! rust-mode "cargo run" "Cargo.toml")
|
||||
(def-builder! toml-mode "cargo run" "Cargo.toml")
|
||||
(def-docset! rust-mode ("Rust")))
|
||||
(def-builder! toml-mode "cargo run" "Cargo.toml"))
|
||||
|
||||
(use-package flycheck-rust
|
||||
:after rust-mode)
|
||||
|
|
|
@ -3,9 +3,7 @@
|
|||
(use-package scala-mode
|
||||
:mode "\\.s\\(cala\\|bt\\)$"
|
||||
:init (add-hook 'scala-mode-hook 'turn-on-eldoc-mode)
|
||||
:config
|
||||
(def-company-backend! scala-mode '(ensime-company (company-yasnippet)))
|
||||
(def-docset! scala-mode ("Scala")))
|
||||
:config (def-company-backend! scala-mode '(ensime-company (company-yasnippet))))
|
||||
|
||||
(use-package sbt-mode
|
||||
:after scala-mode)
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
:init (add-hook 'swift-mode-hook 'flycheck-mode)
|
||||
:config
|
||||
(def-company-backend! swift-mode (sourcekit yasnippet))
|
||||
(def-docset! swift-mode ("Swift"))
|
||||
(def-docset! swift-mode "swift")
|
||||
(def-repl! swift-mode swift-mode-run-repl) ; TODO test this
|
||||
(after! flycheck (push 'swift flycheck-checkers)))
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
markdown-gfm-additional-languages '("sh"))
|
||||
|
||||
:config
|
||||
(def-docset! markdown-mode ("Markdown"))
|
||||
(map! :map markdown-mode-map
|
||||
"<backspace>" nil
|
||||
"<M-left>" nil
|
||||
|
|
|
@ -63,7 +63,7 @@
|
|||
:m "M-k" 'doom/multi-previous-line
|
||||
:n "M-r" 'doom:eval-buffer
|
||||
:v "M-r" 'doom:eval-region
|
||||
:ni "<M-f1>" 'doom/dash-at-pt
|
||||
:ni "<M-f1>" 'doom:docs-lookup
|
||||
;; Textmate-esque indent shift left/right
|
||||
:i "M-]" 'doom/smart-indent
|
||||
:i "M-[" 'doom/dumb-dedent
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue