Permalink
Browse files

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.
  • Loading branch information...
1 parent ac6e159 commit 8f25f74815e38c5731f126456c28dee73a7e189c @jimeh committed Mar 31, 2012
Showing with 20 additions and 3 deletions.
  1. +19 −3 behavior.el
  2. +1 −0 packages.el
View
@@ -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)
View
@@ -135,6 +135,7 @@
(append
'(auto-complete
auto-complete-emacs-lisp
+ autopair
coffee-mode
ecb
evil

0 comments on commit 8f25f74

Please sign in to comment.