Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add describe evil ex-command functionality #14634

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.develop
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,7 @@ Other:
after =spacemacs-scratch-mode= is applied to =*scratch*= buffer (thanks to rayw000)
- Add toggles for persistent which-key keymaps, (full)-major/minor mode
keymaps and top-level keymap, under prefix ~SPC t k~ (thanks to Daniel Nicolai)
- Add =describe-ex-command= on ~SPC h d x~ (thanks to Daniel Nicolai)
- Fixes:
- Avoid non-idempotent use of push in init code (thanks to Miciah Masters)
- Moved Spacemacs startup progress bar to =core-progress-bar.el=, removed
Expand Down
16 changes: 16 additions & 0 deletions core/core-debug.el
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,22 @@ seconds to load")
"You can paste it in the gitter chat.\n"
"Check the *Messages* buffer if you need to review it"))))

(defun spacemacs/describe-ex-command (ex-command)
(interactive (list (completing-read "Describe ex-command: " evil-ex-commands)))
(let* ((func (alist-get ex-command evil-ex-commands nil nil 'string=))
(prompt (if (stringp func)
"The ex-command :%s is an alias for the ex-command :%s. Describe :%s?"
"The ex-command :%s calls %s. Describe %s?")))
(when (y-or-n-p (format prompt
ex-command
func
func))
(if (stringp func)
(spacemacs/describe-ex-command func)
(if (configuration-layer/layer-usedp 'helpful)
(helpful-callable func)
(describe-function func))))))

(defun spacemacs/report-issue (arg)
"Open a spacemacs/report-issue-mode buffer prepopulated with
issue report template and system information.
Expand Down
1 change: 1 addition & 0 deletions doc/DOCUMENTATION.org
Original file line number Diff line number Diff line change
Expand Up @@ -2037,6 +2037,7 @@ thusly:
| ~SPC h d t~ | describe text properties |
| ~SPC h d T~ | describe a theme |
| ~SPC h d v~ | describe a variable |
| ~SPC h d x~ | describe an evil ex-command |

Other help key bindings:

Expand Down
13 changes: 7 additions & 6 deletions doc/QUICK_START.org
Original file line number Diff line number Diff line change
Expand Up @@ -166,12 +166,13 @@ backslash, an actual space and a lowercase ~b~.
=Describe functions= are powerful Emacs introspection commands to get information
about functions, variables, modes etc. These commands are bound thusly:

| Key binding | Description |
|-------------+-------------------|
| ~SPC h d f~ | describe-function |
| ~SPC h d k~ | describe-key |
| ~SPC h d m~ | describe-mode |
| ~SPC h d v~ | describe-variable |
| Key binding | Description |
|-------------+--------------------------|
| ~SPC h d f~ | describe-function |
| ~SPC h d k~ | describe-key |
| ~SPC h d m~ | describe-mode |
| ~SPC h d v~ | describe-variable |
| ~SPC h d x~ | describe-ex-command |

* How-To's
Some quick =how-to's= are compiled in the [[https://github.com/syl20bnr/spacemacs/blob/develop/doc/FAQ.org#how-do-i][FAQ.]]
1 change: 1 addition & 0 deletions layers/+completion/helm/packages.el
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@
;; various key bindings
(spacemacs||set-helm-key "fel" helm-locate-library)
(spacemacs||set-helm-key "hdm" describe-mode)
(spacemacs||set-helm-key "hdx" spacemacs/describe-ex-command)
(spacemacs||set-helm-key "swg" helm-google-suggest)
(with-eval-after-load 'helm-files
(define-key helm-find-files-map
Expand Down
1 change: 1 addition & 0 deletions layers/+completion/ivy/packages.el
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
"hdF" 'counsel-describe-face
"hdm" 'spacemacs/describe-mode
"hdv" 'counsel-describe-variable
"hdx" 'spacemacs/describe-ex-command
"hi" 'counsel-info-lookup-symbol
"hm" (if (spacemacs/system-is-mswindows) 'woman 'man)
"hR" 'spacemacs/counsel-search-docs
Expand Down