diff options
Diffstat (limited to 'emacs/.config')
-rw-r--r-- | emacs/.config/emacs-kj/init.el | 91 |
1 files changed, 75 insertions, 16 deletions
diff --git a/emacs/.config/emacs-kj/init.el b/emacs/.config/emacs-kj/init.el index ef74cb8..1808130 100644 --- a/emacs/.config/emacs-kj/init.el +++ b/emacs/.config/emacs-kj/init.el @@ -155,13 +155,13 @@ :config (setq avy-keys '(?a ?o ?e ?u ?i ?d ?h ?t ?n ?s)) (defun avy-action-embark (pt) - (unwind-protect - (save-excursion - (goto-char pt) - (embark-act)) - (select-window - (cdr (ring-ref avy-ring 0)))) - t) + (unwind-protect + (save-excursion + (goto-char pt) + (embark-act)) + (select-window + (cdr (ring-ref avy-ring 0)))) + t) (setf (alist-get ?. avy-dispatch-alist) 'avy-action-embark) ) @@ -620,15 +620,74 @@ (set-face-attribute 'idle-highlight nil :inherit 'underline) :hook ((prog-mode text-mode) . idle-highlight-mode)) -(use-package paredit - :hook ((lisp-mode emacs-lisp-mode) . paredit-mode) - :bind (:map paredit-mode-map - ("M-k" . paredit-raise-sexp) - ("M-I" . paredit-splice-sexp)) - :hook (paredit-mode - . (lambda () - (unbind-key "M-r" paredit-mode-map) - (unbind-key "M-s" paredit-mode-map)))) +(defun kj/smartparens-config () + (require 'smartparens-config) + (bind-keys :map smartparens-mode-map + ("C-M-a" . sp-beginning-of-sexp) + ("C-M-e" . sp-end-of-sexp) + + ("C-<down>" . sp-down-sexp) + ("C-<up>" . sp-up-sexp) + ("M-<down>" . sp-backward-down-sexp) + ("M-<up>" . sp-backward-up-sexp) + + ("C-M-f" . sp-forward-sexp) + ("C-M-b" . sp-backward-sexp) + + ("C-M-n" . sp-next-sexp) + ("C-M-p" . sp-previous-sexp) + + ("C-S-f" . sp-forward-symbol) + ("C-S-b" . sp-backward-symbol) + + ("C-<right>" . sp-forward-slurp-sexp) + ("M-<right>" . sp-forward-barf-sexp) + ("C-<left>" . sp-backward-slurp-sexp) + ("M-<left>" . sp-backward-barf-sexp) + + ("C-M-t" . sp-transpose-sexp) + ("C-M-k" . sp-kill-sexp) + ("C-k" . sp-kill-hybrid-sexp) + ("C-M-w" . sp-copy-sexp) + ("C-M-d" . delete-sexp) + + ("M-<backspace>" . backward-kill-word) + ("C-<backspace>" . sp-backward-kill-word) + ([remap sp-backward-kill-word] . backward-kill-word) + + ("M-[" . sp-backward-unwrap-sexp) + ("M-]" . sp-unwrap-sexp) + + ("C-x C-t" . sp-transpose-hybrid-sexp) + + ("C-c (" . wrap-with-parens) + ("C-c [" . wrap-with-brackets) + ("C-c {" . wrap-with-braces) + ("C-c '" . wrap-with-single-quotes) + ("C-c \"" . wrap-with-double-quotes) + ("C-c _" . wrap-with-underscores) + ("C-c `" . wrap-with-back-quotes) + + ("M-k" . sp-raise-sexp) + ("M-S" . sp-split-sexp) + ("M-I" . sp-splice-sexp)) + ) + +(use-package smartparens + :init + (kj/smartparens-config) + :hook ((prog-mode lisp-mode) . smartparens-strict-mode) + ) + +;; (use-package paredit +;; :hook ((lisp-mode emacs-lisp-mode) . paredit-mode) +;; :bind (:map paredit-mode-map +;; ("M-k" . paredit-raise-sexp) +;; ("M-I" . paredit-splice-sexp)) +;; :hook (paredit-mode +;; . (lambda () +;; (unbind-key "M-r" paredit-mode-map) +;; (unbind-key "M-s" paredit-mode-map)))) (defun kj/kill-word-or-region (arg) (interactive "p") |