From 702d2989ddebef01ea9f056671b62242355be616 Mon Sep 17 00:00:00 2001 From: Jim Myhrberg Date: Tue, 10 Dec 2019 15:22:42 +0000 Subject: [PATCH] Use smart-shift package for indenting and undenting --- core/siren-core-modules.el | 2 +- modules/text-editing/siren-smart-shift.el | 24 ++++++++++++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/core/siren-core-modules.el b/core/siren-core-modules.el index 7b5f704..91f1fdc 100644 --- a/core/siren-core-modules.el +++ b/core/siren-core-modules.el @@ -83,7 +83,7 @@ (require 'siren-move-dup) (require 'siren-multiple-cursors) (require 'siren-randomize-region) -(require 'siren-shift-text) +(require 'siren-smart-shift) (require 'siren-smartparens) (require 'siren-sort-symbols) (require 'siren-sort-words) diff --git a/modules/text-editing/siren-smart-shift.el b/modules/text-editing/siren-smart-shift.el index 9ffb8eb..8543b24 100644 --- a/modules/text-editing/siren-smart-shift.el +++ b/modules/text-editing/siren-smart-shift.el @@ -11,7 +11,29 @@ ("C-c [" . smart-shift-left) ("C-c ]" . smart-shift-right) ("M-{" . smart-shift-left) - ("M-}" . smart-shift-right)) + ("M-}" . smart-shift-right) + + :config + ;; Override default keymap adding support additional keybindings once + ;; smart-shift is activated. + (defun smart-shift-override-local-map () + "Override local key map for continuous indentation." + (setq overriding-local-map + (let ((map (copy-keymap smart-shift-mode-map))) + (define-key map (kbd "[") 'smart-shift-left) + (define-key map (kbd "]") 'smart-shift-right) + (define-key map (kbd "C-b") 'smart-shift-left) + (define-key map (kbd "C-f") 'smart-shift-right) + (define-key map (kbd "C-p") 'smart-shift-up) + (define-key map (kbd "C-b") 'smart-shift-down) + (define-key map (kbd "") 'smart-shift-left) + (define-key map (kbd "") 'smart-shift-right) + (define-key map (kbd "") 'smart-shift-up) + (define-key map (kbd "") 'smart-shift-down) + (define-key map [t] 'smart-shift-pass-through) ;done with shifting + map)) + (message (propertize "Still in smart-shift key chord..." + 'face 'error)))) (provide 'siren-smart-shift) ;;; siren-smart-shift.el ends here