Add smartparens keybindings
This commit is contained in:
parent
f330a4bae7
commit
7914736901
1 changed files with 19 additions and 6 deletions
|
|
@ -564,20 +564,33 @@
|
||||||
|
|
||||||
(use-package smartparens
|
(use-package smartparens
|
||||||
:hook ((prog-mode . smartparens-mode))
|
:hook ((prog-mode . smartparens-mode))
|
||||||
|
:bind
|
||||||
|
(:map smartparens-mode-map
|
||||||
|
("C-M-f" . sp-forward-sexp)
|
||||||
|
("C-M-b" . sp-backward-sexp)
|
||||||
|
("C-M-e" . sp-up-sexp)
|
||||||
|
("C-M-u" . sp-backward-up-sexp)
|
||||||
|
("C-M-t" . sp-transpose-sexp)
|
||||||
|
("C-M-k" . sp-kill-sexp)
|
||||||
|
("C-M-w" . sp-copy-sexp)
|
||||||
|
("C-M-]" . sp-forward-slurp-sexp)
|
||||||
|
("C-M-[" . sp-backward-slurp-sexp)
|
||||||
|
("C-M-}" . sp-forward-barf-sexp)
|
||||||
|
("C-M-{" . sp-backward-barf-sexp)
|
||||||
|
("M-<backspace>" . sp-unwrap-sexp))
|
||||||
:config
|
:config
|
||||||
(require 'smartparens-config)
|
(require 'smartparens-config)
|
||||||
(setq sp-base-key-bindings 'paredit)
|
|
||||||
(sp-use-paredit-bindings)
|
|
||||||
|
|
||||||
(defun indent-between-pair (&rest _ignored)
|
(defun to/indent-between-pair (&rest _ignored)
|
||||||
|
(message "to/indent-between-pair")
|
||||||
(newline)
|
(newline)
|
||||||
(indent-according-to-mode)
|
(indent-according-to-mode)
|
||||||
(forward-line -1)
|
(forward-line -1)
|
||||||
(indent-according-to-mode))
|
(indent-according-to-mode))
|
||||||
|
|
||||||
(sp-local-pair 'prog-mode "{" nil :post-handlers '((indent-between-pair "RET")))
|
(sp-local-pair 'prog-mode "{" nil :post-handlers '((to/indent-between-pair "RET")))
|
||||||
(sp-local-pair 'prog-mode "[" nil :post-handlers '((indent-between-pair "RET")))
|
(sp-local-pair 'prog-mode "[" nil :post-handlers '((to/indent-between-pair "RET")))
|
||||||
(sp-local-pair 'prog-mode "(" nil :post-handlers '((indent-between-pair "RET")))
|
(sp-local-pair 'prog-mode "(" nil :post-handlers '((to/indent-between-pair "RET")))
|
||||||
|
|
||||||
(sp-local-pair 'swift-mode "\\(" ")" :when '(sp-in-string-p)))
|
(sp-local-pair 'swift-mode "\\(" ")" :when '(sp-in-string-p)))
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue