Add switch-to-help-buffer function and keybinding

`SPC b H` is available, for opening or selecting the help buffer (if it
exists). This makes it much easier to open the help buffer, than having
to open the buffer list (`SPC b b`), then typing one or more characters,
to select the help buffer, and finally pressing `RET`.
This commit is contained in:
duianto 2018-01-03 14:18:45 +01:00 committed by syl20bnr
parent dea1e9b468
commit 3dba3f6794
3 changed files with 9 additions and 0 deletions

View File

@ -2146,6 +2146,7 @@ Buffer manipulation commands (start with ~b~):
| ~SPC b C-D~ | kill buffers using a regular expression |
| ~SPC b e~ | erase the content of the buffer (ask for confirmation) |
| ~SPC b h~ | open =*spacemacs*= home buffer |
| ~SPC b H~ | open or select the =*Help*= buffer |
| ~SPC b n~ | switch to next buffer avoiding special buffers |
| ~SPC b m~ | open =*Messages*= buffer |
| ~SPC u SPC b m~ | kill all buffers and windows except the current one |

View File

@ -1154,6 +1154,13 @@ a split-side entry, its value must be usable as the SIDE argument for
(let ((buffer (find-file-noselect file)))
(pop-to-buffer buffer '(spacemacs//display-in-split (split-side . below)))))
(defun spacemacs/switch-to-help-buffer ()
"Open or select the `*Help*' buffer, if it exists."
(interactive)
(if (get-buffer "*Help*")
(switch-to-buffer (help-buffer))
(message "No previous Help buffer found")))
(defun spacemacs/switch-to-scratch-buffer (&optional arg)
"Switch to the `*scratch*' buffer, creating it first if needed.
if prefix argument ARG is given, switch to it in an other, possibly new window."

View File

@ -127,6 +127,7 @@
"bd" 'spacemacs/kill-this-buffer
"be" 'spacemacs/safe-erase-buffer
"bh" 'spacemacs/home
"bH" 'spacemacs/switch-to-help-buffer
"b C-d" 'spacemacs/kill-other-buffers
"b C-S-d" 'spacemacs/kill-matching-buffers-rudely
"bn" 'next-buffer