3

In Sweave mode pressing tab doesn't move the cursor and kills my auto-complete options (when I hit tab to complete the code the completion disappears as opposed to completing the snippet).

If I space over to the center of the buffer, pressing tab snaps the cursor back to leftmost side of the file.

When I am editing a 'foo.tex' or 'foo.r 'file tab indents and autocomplete behave normally. Is there a way in which I can define tab behavior for Sweave (.rnw) files?

idclark
  • 948
  • 1
  • 8
  • 27

1 Answers1

0

You might try to set this in your init file.

(setq ess-tab-complete-in-script t)
(add-hook 'ess-mode-hook
      '(lambda()    
     (local-set-key (kbd "<tab>") 'ess-indent-or-complete)
     ))     

When you are inside an R code chunk, the first TAB hit will indent the line if it is not properly aligned, otherwise it will auto-complete the word. You can further customise this behaviour with the variable ess-first-tab-never-complete and decide if the completion should occur only at end of lines, end of words etc. (see variable description).

antonio
  • 10,629
  • 13
  • 68
  • 136