emacs - add hydra for expand region
authorPeng Li <seudut@gmail.com>
Sun, 24 Jul 2016 08:15:38 +0000 (16:15 +0800)
committerPeng Li <seudut@gmail.com>
Sun, 24 Jul 2016 08:15:38 +0000 (16:15 +0800)
emacs.d/config.org

index 18d02b9..7d3586b 100644 (file)
@@ -1951,7 +1951,7 @@ Use =gnuplot= on =Org-mode= file, see [[http://orgmode.org/worg/org-contrib/babe
     :commands (bing-dict-brief))
 #+END_SRC
 
-* NEXT Key Bindings
+* Key Bindings
 Here are some global key bindings for basic editting
 ** Esc in minibuffer
 Use =ESC= to exit minibuffer. Also I map =Super-h= the same as =C-g=
@@ -2494,6 +2494,45 @@ stolen from [[https://github.com/mariolong/emacs.d/blob/f6a061594ef1b5d1f4750e9d
                                          (insert (format "%s" (with-ivy-window (thing-at-point 'symbol)))))))
 #+END_SRC
 
+** TODO Expand region map
+#+BEGIN_SRC emacs-lisp :tangle yes :results silent
+  (defhydra sd/expand-selected (:color red :columns nil
+                                       :post (deactivate-mark))
+    "Selected"
+    ;; select
+    ("e" er/expand-region "+")
+    ("c" er/contract-region "-")
+    ;; ("\"" er/mark-inside-quotes "inside \"")
+    ;; ("a\"" er/mark-outside-quotes "inside \"")
+    ;; exchange
+    ("x" exchange-point-and-mark "exchange")
+    ("o" exchange-point-and-mark "exchange")
+    ;; exit
+    ("d" kill-region "delete" :exit t)
+    ("i" kill-region "delete" :exit t)
+    ("y" kill-ring-save "yank" :exit t)
+    ("q" nil "quit" :exit t))
+
+  (global-set-key (kbd "C-=") (lambda ()
+                                (interactive)
+                                (er/mark-word)
+                                (sd/expand-selected/body)))
+
+  ;; er/mark-word
+  ;; er/mark-symbol
+  ;; er/mark-symbol-with-prefix
+  ;; er/mark-next-accessor
+  ;; er/mark-method-call
+  ;; er/mark-inside-quotes
+  ;; er/mark-outside-quotes
+  ;; er/mark-inside-pairs
+  ;; er/mark-outside-pairs
+  ;; er/mark-comment
+  ;; er/mark-url
+  ;; er/mark-email
+  ;; er/mark-defun
+#+END_SRC
+
 * TODO Convert ASCII to key
 ** map =function-key-map= [[http://academic.evergreen.edu/projects/biophysics/technotes/program/ascii_ctrl.htm][ascii_ctrl]]
 new file =C-x C-f C-f=
@@ -2571,4 +2610,3 @@ When define a key to a anonymous function, the lambda function should be interac
 #+END_SRC
 
 * TODO ibuffer hydra
-* TODO expand region action, selected mode map