From 021012e6452e44675ac249d0e8dedc8f94d0de3f Mon Sep 17 00:00:00 2001 From: Jack Foltz Date: Fri, 21 Dec 2018 12:39:15 -0500 Subject: [PATCH] Add emacs smart parens --- lain/.emacs.d/config.org | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/lain/.emacs.d/config.org b/lain/.emacs.d/config.org index 86deff8..61d7ba5 100644 --- a/lain/.emacs.d/config.org +++ b/lain/.emacs.d/config.org @@ -606,7 +606,7 @@ Hotkeys for jumping to characters with =f= #+END_SRC * Programming Packages Configuration -** Autocompletion +** Autocomplete and Formatting *** Company company auto-completes stuff in the buffer, company-quickhelp shows documentation popups @@ -639,7 +639,45 @@ when idling on a completion candidate. (use-package company-quickhelp :hook (company-mode . company-quickhelp-mode)) #+END_SRC +*** smartparens +smartparens handles parens for languages that aren't lispy, +and paredit handles the rest. +Keybinds in =M-x sp-cheat-sheet=. +#+BEGIN_SRC emacs-lisp +(use-package paredit + :diminish + :commands enable-paredit-mode) + +(use-package smartparens + :diminish + :commands smartparens-strict-mode + :hook (prog-mode . foltz-paren-mode) + :config + (require 'smartparens-config)) +(use-package evil-smartparens + :commands evil-smartparens-mode + :hook (smartparens-enabled . evil-smartparens-mode)) + +(defun foltz-paren-mode () + "Enable a suitable paren editing mode for the current major mode" + (if (member major-mode + '(emacs-lisp-mode + lisp-mode + lisp-interaction-mode + scheme-mode)) + (enable-paredit-mode) + (smartparens-strict-mode))) +#+END_SRC +*** evil-surround +Use =S= and a delimiter to surround in visual mode. +#+BEGIN_SRC emacs-lisp +(use-package evil-surround + :after evil + :diminish + :config + (global-evil-surround-mode 1)) +#+END_SRC ** Prettification *** pretty-mode [[https://github.com/pretty-mode/pretty-mode][Redisplay parts of the Emacs buffer as pretty symbols.]]