Emacs ESS and the use of techniques.

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 esspackage.

2. Use the ESS

  • After entering GNU Emacs interface, input M-X Rto 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
    1. Start R. R is as running buffer under run Emacs editor, so called the inferior (Emacs document referred iESS buffer).
    2. C-u M-x R RET --no-save RET: Start R and not saved.
    3. M-x ess-transcript-clean-region: Clean R interface.
    4. C-c C-z: Forced stop running R process.
    • C-c C-x
    1. Instead of ls()function.
    2. C-c C-s: Instead of search()a function.
    3. C-c C-d: Modify the object has been created, very practical.
    • C-c C-n
    1. The current line to R.
    2. C-c C-c: The current segment to R.
    3. C-c C-b: The entire file to the current R.
    • C-c tab: R autocomplete code.
    • C-x o: Scroll the screen.
    • C--
    1. R automatically gives a unique language <-.
    2. C---: Double-click - it can display underlined.
    • C-c C-o C-o
    1. In the first function is activated by pressing the R ESS code annotations.
    2. M-x customize-group RET ess RET: Configure the default template, if you need to insert a blank line, enter useless, jabbed spaces.
    3. C-c C-o C-c: The code comments as roxygen the ##'beginning of the format, especially when the annotation example of good use.
    4. C-c C-o p: The cursor jumps to the beginning of the comment paragraph.
    5. Large columns   Emacs and ESS of tips.
    6. C-c C-o n: The cursor jumps to the end of the paragraph function annotation resides.
    7. 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-packagethe installation.

  • Autocomplete: auto-completePackage

  • 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)

Guess you like

Origin www.cnblogs.com/lijianming180/p/12037937.html