summaryrefslogtreecommitdiff
path: root/emacs
diff options
context:
space:
mode:
Diffstat (limited to 'emacs')
-rw-r--r--emacs/.config/emacs/init.el49
1 files changed, 48 insertions, 1 deletions
diff --git a/emacs/.config/emacs/init.el b/emacs/.config/emacs/init.el
index 4e407fc..c8aab0a 100644
--- a/emacs/.config/emacs/init.el
+++ b/emacs/.config/emacs/init.el
@@ -445,12 +445,59 @@
445 445
446(use-package smartparens 446(use-package smartparens
447 :straight t 447 :straight t
448 ;; See: (sp-cheat-sheet) and make some cool keybinds :)
449 :init 448 :init
450 (defun arkta/disable-sp-strictness () 449 (defun arkta/disable-sp-strictness ()
451 (smartparens-strict-mode -1) 450 (smartparens-strict-mode -1)
452 (smartparens-mode +1)) 451 (smartparens-mode +1))
452
453 (defun arkta/delete-region-or-backchar (&optional arg)
454 "Delete the previous character as per `sp-backward-delete-char'. If
455Transient Mark mode is enabled, the mark is active, delete the text in
456the region and deactivate the mark instead. To disable this set option
457`delete-active-region' to nil. Essentially like a weird mix of
458`delete-backward-char' and `sp-backward-delete-char'."
459 (interactive "*P")
460 (if (and (use-region-p) delete-active-region)
461 (if (eq delete-active-region 'kill)
462 (sp-kill-region (region-beginning) (region-end))
463 (sp-delete-region (region-beginning) (region-end)))
464 (sp-backward-delete-char arg)))
465 :bind (:map smartparens-mode-map
466 ("C-M-f" . sp-forward-sexp)
467 ("C-M-b" . sp-backward-sexp)
468 ("C-M-d" . sp-down-sexp)
469 ("C-M-a" . sp-backward-down-sexp)
470 ("C-S-d" . sp-beginning-of-sexp)
471 ("C-S-a" . sp-end-of-sexp)
472 ("C-M-e" . sp-up-sexp)
473 ("C-M-u" . sp-backward-up-sexp)
474 ("C-M-n" . sp-next-sexp)
475 ("C-M-p" . sp-previous-sexp)
476 ("C-M-k" . sp-kill-sexp)
477 ("C-M-w" . sp-copy-sexp)
478 ("M-<delete>" . sp-unwrap-sexp)
479 ("M-<backspace>" . sp-backward-unwrap-sexp)
480 ("M-<right>" . sp-forward-slurp-sexp)
481 ("M-<left>" . sp-forward-barf-sexp)
482 ("C-M-<left>" . sp-backward-slurp-sexp)
483 ("C-M-<right>" . sp-backward-barf-sexp)
484 ("M-D" . sp-splice-sexp)
485 ("C-M-<delete>" . sp-splice-sexp-killing-forward)
486 ("C-M-<backspace>" . sp-splice-sexp-killing-backward)
487 ("C-S-<backspace>" . sp-splice-sexp-killing-around)
488 ("C-]" . sp-select-next-thing-exchange)
489 ("C-M-]" . sp-select-next-thing)
490 ("C-M-SPC" . sp-mark-sexp)
491 ("M-F" . sp-forward-symbol)
492 ("M-B" . sp-backward-symbol)
493 :map smartparens-strict-mode-map
494 ("<backspace>" . arkta/delete-region-or-backchar)
495 ([remap backward-delete-char-untabify] . arkta/delete-region-or-backchar)
496 ([remap backward-delete-char] . arkta/delete-region-or-backchar)
497 ([remap delete-backward-char] . arkta/delete-region-or-backchar))
453 :hook (prog-mode . smartparens-strict-mode) 498 :hook (prog-mode . smartparens-strict-mode)
499 :custom
500 (sp-base-key-bindings nil)
454 :config 501 :config
455 (require 'smartparens-config)) 502 (require 'smartparens-config))
456 503