1. Install ESS
There are two ways to install, a direct use of the system comes package installation system, such as yum
:
# yum install emacs-ess
Sometimes, however, it may not be the latest version of ESS. Therefore, the second method recommended using Emacs carrying bag system, easy, timely update the reference setting method, the installation ess
package.
2. Use the ESS
-
After entering GNU Emacs interface, input
M-X R
to enter the R interface. In this process, you will be asked whether to run in the current directory to run R, you can choose to run in different directories.M-x R
:
- Start R. R is as running buffer under run Emacs editor, so called the inferior (Emacs document referred iESS buffer).
C-u M-x R RET --no-save RET
: Start R and not saved.M-x ess-transcript-clean-region
: Clean R interface.C-c C-z
: Forced stop running R process.
C-c C-x
:
- Instead of
ls()
function. C-c C-s
: Instead ofsearch()
a function.C-c C-d
: Modify the object has been created, very practical.
C-c C-n
:
- The current line to R.
C-c C-c
: The current segment to R.C-c C-b
: The entire file to the current R.
C-c tab
: R autocomplete code.C-x o
: Scroll the screen.C--
:
- R automatically gives a unique language
<-
. C---
: Double-click - it can display underlined.
C-c C-o C-o
:
- In the first function is activated by pressing the R ESS code annotations.
M-x customize-group RET ess RET
: Configure the default template, if you need to insert a blank line, enter useless, jabbed spaces.C-c C-o C-c
: The code comments as roxygen the##'
beginning of the format, especially when the annotation example of good use.C-c C-o p
: The cursor jumps to the beginning of the comment paragraph.
Large columns
Emacs and ESS of tips.
C-c C-o n
: The cursor jumps to the end of the paragraph function annotation resides.M-q
: Finishing roxygen comment, the multi-line comment compression finishing.
3. Advanced Settings
Emacs combination of auto-completion, completion brackets, color display and other functions, more powerful set of ESS editing environment. Adding additional environmental settings to Emacs setup file, for example ~/.emacs
. Packages needed to use M-x list-package
the installation.
- Autocomplete:
auto-complete
Package
- Folding Code:
hs-minor-mode
(the system comes) - Completion parentheses:
smartparens
- Color parentheses:
rainbow-delimiters
- Color Display:
rainbow-mode
Additional content
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; auto-completion
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(require 'auto-complete)
(require 'auto-complete-config)
(ac-config-default)
;;;;;;;;;;;;;;;;;;;;;;;
; ESS set
;;;;;;;;;;;;;;;;;;;;;;;
(require 'ess-site)
(setq ess-use-auto-complete t)
;;;;;;;;;;;;;;;;;;;;;;;;
;open hs-mode
;;;;;;;;;;;;;;;;;;;;;;;
(add-hook 'ess-mode-hook 'hs-minor-mode)
;;;;;;;;;;;;;;;;;;;;;
;smartparens
;;;;;;;;;;;;;;;;;;;;;
(require 'smartparens-config)
(show-smartparens-global-mode t)
(smartparens-global-mode t)
;;;;;;;;;;;;;;;;;;;;;
;rainbow mode
;;;;;;;;;;;;;;;;;;;;;
(require 'rainbow-mode)
(dolist (hook '(ess-mode-hook inferior-ess-mode-hook))
(add-hook hook 'rainbow-turn-on))
;;;;;;;;;;;;;;
;rainbow-delimiters
;;;;;;;;;;;;;;
(require 'rainbow-delimiters)
(add-hook 'prog-mode-hook 'rainbow-delimiters-mode)
(add-hook 'ess-mode-hook 'rainbow-delimiters-mode)