Using the code provided here I can use the magrittr
package pipe %>%
. I want to switch to the new native R pipe |>
, but if I just substitute the old pipe with the new one the code is not recognized as continued and therefore is not indented. What it the best way to implement the new operator in ESS? This is the code in my .emacs
file:
(defun then_R_operator ()
"R - |> operator or 'then' pipe operator"
(interactive)
(just-one-space 1)
(insert "|>")
(just-one-space 1)
(indent)
(reindent-then-newline-and-indent))
(define-key ess-mode-map (kbd "C-S-m") 'then_R_operator)
(define-key inferior-ess-mode-map (kbd "C-S-m") 'then_R_operator)
This is an example of what I get:
data |>
some_function()
This is the expected result:
data |>
some_function()
|>
without customizationM-x ess-version