summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lisp/init-ess.el17
1 files changed, 17 insertions, 0 deletions
diff --git a/lisp/init-ess.el b/lisp/init-ess.el
index e2edaf9..fb6376a 100644
--- a/lisp/init-ess.el
+++ b/lisp/init-ess.el
@@ -21,4 +21,21 @@
(add-to-list 'auto-mode-alist '("\\.[rR]\\'" . R-mode))
+(defvar km/ess-dplry-pipe-key "|")
+
+(defun km/ess-insert-dplyr-pipe ()
+ "Insert `km/ess-dplry-pipe' using `ess-smart-S-assign'.
+Based on instructions in `ess-smart-S-assign-key', I didn't think
+this would work, but it seems to so far."
+ (interactive)
+ (let ((ess-S-assign " %>% ")
+ (ess-smart-S-assign-key km/ess-dplry-pipe-key))
+ (call-interactively #'ess-smart-S-assign)))
+
+(after 'ess-mode
+ (define-key ess-mode-map "|" 'km/ess-insert-dplyr-pipe))
+
+(after 'ess-inf
+ (define-key inferior-ess-mode-map "|" 'km/ess-insert-dplyr-pipe))
+
(provide 'init-ess)