From 8f25f74815e38c5731f126456c28dee73a7e189c Mon Sep 17 00:00:00 2001 From: Jim Myhrberg Date: Sat, 31 Mar 2012 11:19:54 +0100 Subject: [PATCH] Replace electric-pair-mode with autopair-mode To make this work without any issues, I also had to switch from delete-selection-mode to cua-mode, disabling a number of cua-mode's default keybindings which just annoyed me. Read the comment in behavior.el for more details. --- behavior.el | 22 +++++++++++++++++++--- packages.el | 1 + 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/behavior.el b/behavior.el index 66f9d30..f3744fe 100644 --- a/behavior.el +++ b/behavior.el @@ -2,7 +2,6 @@ (setq-default tab-width 2) ;; Electric behavior -(electric-pair-mode t) (electric-layout-mode t) ;; Always indent with spaces @@ -15,8 +14,25 @@ (put 'downcase-region 'disabled nil) (put 'upcase-region 'disabled nil) -;; Globally enable delete-selection-mode -(delete-selection-mode 1) +;; Autopair mode. I'm sorry, electric-pair mode just isn't as good, mainly +;; cause it can't wrap the region in the pair-character you type. +(when (require 'autopair nil 'noerror) + (autopair-global-mode)) + +;; When using autopair, ECB and delete-selection-mode there's a weird conflict +;; which disables delete-selection-mode whenever you click on a directory of +;; file in ECB's tree buffer. For that reason, and for it's neat rectangle +;; selection feature we're using cua-mode as it's delete-selection-ish feature +;; is not effected by the issue. +(setq cua-rectangle-mark-key (kbd "M-RET")) +(cua-mode t) + +;; Disable cua-mode's fancy keys like C-z, C-v, etc. cause we use them for +;; other things, and we already have good keybindings for cut, copy, paste and +;; undo. +(setq cua-enable-cua-keys nil + cua-remap-control-v nil + cua-remap-control-z nil) ;; Use textmate-mode (when (require 'textmate nil 'noerror) diff --git a/packages.el b/packages.el index 66039fb..878bd3b 100644 --- a/packages.el +++ b/packages.el @@ -135,6 +135,7 @@ (append '(auto-complete auto-complete-emacs-lisp + autopair coffee-mode ecb evil