Skip to content

Instantly share code, notes, and snippets.

Last active January 8, 2021 21:19
What would you like to do?
nanoish reference window for emacs
(defun make-nanoish-ref-buffer-and-window ()
"Create a buffer showing a reference of Emacs' standard shortcuts, and then display it at the bottom a la nano."
;; ensure the rules for displaying the window are set up.
(setq display-buffer-alist (assoc-delete-all "*nanoish-ref*" display-buffer-alist #'equal))
(push '("*nanoish-ref*"
(window-height . 2)
(preserve-size . (nil . t))
(dedicated . t)
(window-parameters . ((no-other-window . t)
(no-delete-other-windws . t)
(mode-line-format . none))))
;; create the buffer
(let ((buf (get-buffer-create "*nanoish-ref*")))
(with-current-buffer buf
(delete-region (point-min) (point-max))
(insert "[C-n] next line [C-p] previous line [C-v] page down [C-l] recenter [C-w] kill (cut) [C-y] yank (paste) [C-g] cancel [C-h k] key help [C-x C-f] open file [C-x k] kill buffer [C-x 1] one window [C-x 2] split vertically" ?\n
"[C-f] forward char [C-b] backward char [M-v] page up [C-k] kill line [M-w] kill (copy) [C-s] search [M-x] command [C-h f] function help [C-x b] switch buffer [C-x o] next window [C-x 0] delete window [C-x 3] split horizontally"))
;; display it!
(display-buffer buf)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment