spacemacs/layers/+lang/coq/packages.el
syl20bnr fe168f07b3 coq: update key bindings and README
README:
- add `SPC m` prefixes to follow the style of the other READMEs
- Sort key bindings alphabetically

Key bindings changes made to be more mnemocnic and/or to better fit the other
key bindings of other layers:

- SPC m p b --> SPC m p p (show prover process buffer)
- SPC m p c --> SPC m p i (interrupt prover process)
- SPC m p x --> SPC m p q (quit prover process, maybe SPC m p k for kill would
  be better ?)

- SPC m a p --> SPC m a a to print query
- SPC m a n p --> SPC m a A to print query showing all
- SPC m a i p --> SPC m a i i to print query showing implicits
- Ask showing all bindings use the same keys as regular Ask but the last key
  is capitalized, example: SPC m a b (ask about) and SPC m a B (ask about
  showing all)
- Ask showing implicits are still on SPC m a i (we could also use Control key,
  for instance SPC m a b (ask about) and SPC m a C-b (ask about show implicit),
  it depends on how frequent showing implicits are used).

- SPC m g . --> SPC m g l (go to end of Locked command)
- SPC m g d --> SPC m g g (using the jump handlers facility of Spacemacs)
- SPC m g a --> SPC m g s (to go to start of command)
2017-02-12 22:24:25 -05:00

124 lines
3.9 KiB
EmacsLisp

;;; packages.el --- coq layer packages file for Spacemacs.
;;
;; Copyright (c) 2012-2016 Sylvain Benner & Contributors
;;
;; Author: Jeremy Bi <bixuanxbi@gmail.com>
;; URL: https://github.com/syl20bnr/spacemacs
;;
;; This file is not part of GNU Emacs.
;;
;;; License: GPLv3
;;; Code:
(setq coq-packages
'(
(company-coq :toggle (configuration-layer/package-usedp 'company))
(proof-general :location (recipe
:fetcher github
:repo "ProofGeneral/PG"
:files ("*")))
smartparens
vi-tilde-fringe
))
(defun coq/init-company-coq ()
(use-package company-coq
:defer t
:init
(progn
(add-hook 'coq-mode-hook #'company-coq-mode)
(add-to-list 'spacemacs-jump-handlers-coq-mode
'company-coq-jump-to-definition))
:config
(progn
(spacemacs/declare-prefix-for-mode
'coq-mode
"mi" "coq/insert")
(spacemacs/set-leader-keys-for-major-mode 'coq-mode
"il" 'company-coq-lemma-from-goal
"im" 'company-coq-insert-match-construct
"ao" 'company-coq-occur))))
(defun coq/init-proof-general ()
(use-package proof-site
:mode ("\\.v\\'" . coq-mode)
:defer t
:init
(progn
(setq coq/proof-general-load-path
(concat (configuration-layer/get-elpa-package-install-directory
'proof-general) "generic"))
(add-to-list 'load-path coq/proof-general-load-path))
:config
(progn
(spacemacs|diminish company-coq-mode)
(spacemacs|diminish holes-mode)
(spacemacs|diminish hs-minor-mode)
(spacemacs|diminish outline-minor-mode)
(spacemacs|diminish proof-active-buffer-fake-minor-mode)
(spacemacs|diminish yas-minor-mode "" " y")
(setq company-coq-disabled-features '(hello)
proof-three-window-mode-policy 'hybrid
proof-script-fly-past-comments t
proof-splash-seen t)
(dolist (prefix '(("ml" . "pg/layout")
("mp" . "pg/prover")
("ma" . "pg/ask-prover")
("mai" . "show-implicits")
("man" . "show-all") ; n is for notation
("mg" . "pg/goto")))
(spacemacs/declare-prefix-for-mode
'coq-mode
(car prefix) (cdr prefix)))
;; key bindings
(spacemacs/set-leader-keys-for-major-mode 'coq-mode
;; Basic proof management
"]" 'proof-assert-next-command-interactive
"[" 'proof-undo-last-successful-command
"." 'proof-goto-point
;; Layout
"lc" 'pg-response-clear-displays
"ll" 'proof-layout-windows
"lp" 'proof-prf
;; Prover Interaction
"pi" 'proof-interrupt-process
"pp" 'proof-process-buffer
"pq" 'proof-shell-exit
"pr" 'proof-retract-buffer
;; Prover queries ('ask prover')
"aa" 'coq-Print
"aA" 'coq-Print-with-all
"ab" 'coq-About
"aB" 'coq-About-with-all
"ac" 'coq-Check
"aC" 'coq-Check-show-all
"af" 'proof-find-theorems
"aib" 'coq-About-with-implicits
"aic" 'coq-Check-show-implicits
"aii" 'coq-Print-with-implicits
;; Moving the point (goto)
"ge" 'proof-goto-command-end
"gl" 'proof-goto-end-of-locked
"gs" 'proof-goto-command-start
;; Insertions
"ie" 'coq-end-Section))))
(defun coq/post-init-smartparens ()
(spacemacs/add-to-hooks
(if dotspacemacs-smartparens-strict-mode
'smartparens-strict-mode
'smartparens-mode)
'(coq-mode-hook)))
(defun coq/post-init-vi-tilde-fringe ()
(spacemacs/add-to-hooks 'spacemacs/disable-vi-tilde-fringe
'(coq-response-mode-hook
coq-goals-mode-hook)))
;;; packages.el ends here