Skip to content

Commit f21ba7c

Browse files
jalvesaqvim-scripts
authored andcommitted
Version 101107
* New feature: complete chunk block when '<' is pressed in rnoweb files. * New option: vimrplugin_rnowebchunk. * New key bindings in Normal mode for Rnoweb files: gn (go to next R code chunk) and gN (go to previous R code chunk). * New command: :RBuildTags. * Added fold capability to syntax/r.vim. * Improved indentation of rnoweb files: thanks to Johannes Tanzler for writing the tex.vim indent script and for permitting its inclusion in the Vim-R-plugin. * R CMD BATCH now is called with --no-restore --no-save (key binding \ro). * The file r-plugin/omnilist now has an additional field and was renamed as omni_list. * Use 64 bit version of R by default on Windows if the directory bin/x64 exists. * New Windows only option: vimrplugin_i386.
1 parent bad1c92 commit f21ba7c

25 files changed

Lines changed: 5714 additions & 3885 deletions

README

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,36 +6,39 @@ Screenshots and Debian package: http://sites.google.com/site/jalvesaq/vimrplugin
66

77
MAIN FEATURES:
88

9-
109
* Syntax highlighting for R syntax, including:
1110
- Special characters in strings.
1211
- Functions of all installed packages (must be updated manually).
1312
- Special highlighting for R output (.Rout files).
13+
- Spell check only strings and comments.
14+
- Fold code when foldmethod=syntax.
1415
* Smart indentation for R syntax.
1516
* Integrated communication with R:
1617
- Start/Close R.
1718
- Send lines, selection, paragraphs, functions, blocks, entire file.
1819
- Send commands with the object under cursor as argument: help, args, plot, print, str, summary, example, names.
1920
- Send to R the Sweave and pdflatex commands.
2021
- Run R inside a Vim's buffer (with Conque Shell plugin; currently available only on Unix -- Linux or OS X).
21-
* Omni completion (auto-completion) for R objects (.GlobalEnv and installed packages. The list of installed packages must be updated manually.
22+
* Omni completion (auto-completion) for R objects (.GlobalEnv and installed
23+
packages. The list of installed packages must be updated manually.
2224
* Ability to see R's documentation in a Vim's buffer:
23-
- Automatic calculation of the best layout of the R documentation buffer (split the window either horizontally or vertically according to the available room).
25+
- Automatic calculation of the best layout of the R documentation buffer (split the window either horizontally
26+
or vertically according to the available room).
2427
- Automatic formating of the text to fit the panel width.
2528
- Send code and commands to R (useful to run examples).
2629
- Jump to another R documentation.
2730
- Syntax highlighting of R documentation.
2831
* Object browser (.GlobalEnv and loaded packages; must be updated manually):
29-
- Send commands with object under cursor as argument.
30-
- Call R's help() with object under cursor as argument.
32+
- Send commands with the object under cursor as argument.
33+
- Call R's help() with the object under cursor as argument.
3134
- Syntax highlighting of the object browser.
3235
* Most of the plugin's behavior is customizable.
3336

3437

35-
3638
USE: Please, read the plugin's documentation.
3739

3840
FILES:
41+
3942
autoload/rcomplete.vim
4043
autoload/rplugin.vim
4144
bitmaps/RClearAll.bmp
@@ -69,19 +72,21 @@ FILES:
6972
ftplugin/r.vim
7073
ftplugin/rbrowser.vim
7174
indent/r.vim
75+
indent/rnoweb.vim
7276
r-plugin/build_omni_list.R
7377
r-plugin/etags2ctags.R
7478
r-plugin/functions.vim
75-
r-plugin/omnilist
79+
r-plugin/omni_list
7680
r-plugin/vimbrowser.R
7781
r-plugin/vimhelp.R
82+
r-plugin/r.snippets
7883
r-plugin/rpager.sh
79-
r-plugin/rperl.vim
8084
r-plugin/rpython.vim
85+
r-plugin/rsyntax.vim
8186
r-plugin/specialfuns.R
87+
r-plugin/tex_indent.vim
8288
r-plugin/vimActivate.js
8389
syntax/rbrowser.vim
84-
syntax/rdoc.vim
8590
syntax/rout.vim
8691
syntax/r.vim
8792

autoload/rcomplete.vim

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
" Vim completion script
22
" Language: R
33
" Maintainer: Jakson Alves de Aquino <jalvesaq@gmail.com>
4-
" Last Change: Fri Oct 22, 2010 06:01PM
4+
" Last Change: Fri Nov 05, 2010 06:29AM
55
"
66

77
fun! rcomplete#CompleteR(findstart, base)
@@ -32,7 +32,18 @@ fun! rcomplete#CompleteR(findstart, base)
3232
continue
3333
endif
3434
let tmp1 = split(line, ':')
35-
let tmp2 = {'word': tmp1[0], 'menu': tmp1[1] . ' ' . tmp1[2], 'info': tmp1[3]}
35+
if len(tmp1) == 5
36+
let info = tmp1[4]
37+
else
38+
let tlen = len(tmp1)
39+
let info = tmp1[4]
40+
let i = 5
41+
while i < tlen
42+
let info = info . ':' . tmp1[i]
43+
let i += 1
44+
endwhile
45+
endif
46+
let tmp2 = {'word': tmp1[0], 'menu': tmp1[1] . ' ' . tmp1[3], 'info': info}
3647
call add(res, tmp2)
3748
endif
3849
endfor

autoload/rplugin.vim

Lines changed: 69 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"
2020
" Based on previous work by Johannes Ranke
2121
"
22-
" Last Change: Mon Oct 25, 2010 08:18AM
22+
" Last Change: Sun Nov 07, 2010 08:21AM
2323
"
2424
" Please see doc/r-plugin.txt for usage details.
2525
"==========================================================================
@@ -84,17 +84,23 @@ function! rplugin#ShowRDoc(rkeyword)
8484
call delete(g:rplugin_docfile)
8585
endif
8686

87-
if bufname("%") == "Object_Browser"
87+
if bufname("%") =~ "Object_Browser"
8888
let savesb = &switchbuf
8989
set switchbuf=useopen,usetab
90-
exe "sb " . g:rplugin_curscriptbuf
90+
exe "sb " . b:rscript_buffer
9191
exe "set switchbuf=" . savesb
9292
endif
9393

9494
if g:vimrplugin_vimpager == "tabnew"
9595
let s:rdoctitle = a:rkeyword . "\\ -\\ help"
9696
else
97-
let s:rdoctitle = "R_doc"
97+
let s:tnr = tabpagenr()
98+
if g:vimrplugin_vimpager != "tab" && s:tnr > 1
99+
let s:rdoctitle = "R_doc" . s:tnr
100+
else
101+
let s:rdoctitle = "R_doc"
102+
endif
103+
unlet s:tnr
98104
endif
99105

100106
call s:SetRTextWidth()
@@ -115,6 +121,14 @@ function! rplugin#ShowRDoc(rkeyword)
115121
return
116122
endif
117123

124+
" Local variables that must be inherited by the rdoc buffer
125+
let g:tmp_screensname = b:screensname
126+
let g:tmp_objbrtitle = b:objbrtitle
127+
if g:vimrplugin_conqueplugin == 1
128+
let g:tmp_conqueshell = b:conqueshell
129+
let g:tmp_conque_bufname = b:conque_bufname
130+
endif
131+
118132
if bufloaded(s:rdoctitle)
119133
let savesb = &switchbuf
120134
set switchbuf=useopen,usetab
@@ -145,19 +159,31 @@ function! rplugin#ShowRDoc(rkeyword)
145159
set buftype=nofile
146160
autocmd VimResized <buffer> let g:vimrplugin_newsize = 1
147161
setlocal modifiable
162+
set filetype=rdoc
163+
let g:rplugin_curbuf = bufname("%")
164+
165+
" Inheritance of local variables from the script buffer
166+
let b:objbrtitle = g:tmp_objbrtitle
167+
let b:screensname = g:tmp_screensname
168+
unlet g:tmp_objbrtitle
169+
if g:vimrplugin_conqueplugin == 1
170+
let b:conqueshell = g:tmp_conqueshell
171+
let b:conque_bufname = g:tmp_conque_bufname
172+
unlet g:tmp_conqueshell
173+
unlet g:tmp_conque_bufname
174+
endif
175+
148176
normal! ggdG
149177
exe "silent read " . g:rplugin_docfile
150178
exe "silent %s/_//g"
151179
let has_ex = search("^Examples:$")
152180
if has_ex
153181
let lnr = line("$") + 1
154-
call setline(lnr, "###")
155-
let lnr = lnr + 1
156-
call setline(lnr, "")
182+
call setline(lnr, '###')
157183
endif
158-
setlocal nomodified
159-
set filetype=rdoc
160184
normal! ggdd
185+
setlocal nomodified
186+
setlocal nomodifiable
161187

162188
endfunction
163189

@@ -318,6 +344,40 @@ function! rplugin#ControlMenu()
318344
call rplugin#RCreateMenuItem("nvi", 'Control.Summary\ (cur)', '<Plug>RSummary', 'rs', ':call rplugin#RAction("summary")')
319345
call rplugin#RCreateMenuItem("nvi", 'Control.Plot\ (cur)', '<Plug>RPlot', 'rg', ':call rplugin#RAction("plot")')
320346
call rplugin#RCreateMenuItem("nvi", 'Control.Plot\ and\ summary\ (cur)', '<Plug>RSPlot', 'rb', ':call rplugin#RAction("plot")<CR>:call rplugin#RAction("summary")')
347+
"-------------------------------
348+
menu R.Control.-Sep4- <nul>
349+
call rplugin#RCreateMenuItem("nvi", 'Control.Update\ object\ browser', '<Plug>RUpdateObjBrowser', 'ro', ':call RObjBrowser()')
350+
let g:rplugin_hasmenu = 1
351+
endfunction
352+
353+
function! rplugin#ControlMaps()
354+
" List space, clear console, clear all
355+
"-------------------------------------
356+
call rplugin#RCreateMaps("nvi", '<Plug>RListSpace', 'rl', ':call SendCmdToScreen("ls()", 0)<CR>:echon')
357+
call rplugin#RCreateMaps("nvi", '<Plug>RClearConsole', 'rr', ':call RClearConsole()')
358+
call rplugin#RCreateMaps("nvi", '<Plug>RClearAll', 'rm', ':call RClearAll()')
359+
360+
" Print, names, structure
361+
"-------------------------------------
362+
call rplugin#RCreateMaps("nvi", '<Plug>RObjectPr', 'rp', ':call rplugin#RAction("print")')
363+
call rplugin#RCreateMaps("nvi", '<Plug>RObjectNames', 'rn', ':call rplugin#RAction("names")')
364+
call rplugin#RCreateMaps("nvi", '<Plug>RObjectStr', 'rt', ':call rplugin#RAction("str")')
365+
366+
" Arguments, example, help
367+
"-------------------------------------
368+
call rplugin#RCreateMaps("nvi", '<Plug>RShowArgs', 'ra', ':call rplugin#RAction("args")')
369+
call rplugin#RCreateMaps("nvi", '<Plug>RShowEx', 're', ':call rplugin#RAction("example")')
370+
call rplugin#RCreateMaps("nvi", '<Plug>RHelp', 'rh', ':call rplugin#RAction("help")')
371+
372+
" Summary, plot, both
373+
"-------------------------------------
374+
call rplugin#RCreateMaps("nvi", '<Plug>RSummary', 'rs', ':call rplugin#RAction("summary")')
375+
call rplugin#RCreateMaps("nvi", '<Plug>RPlot', 'rg', ':call rplugin#RAction("plot")')
376+
call rplugin#RCreateMaps("nvi", '<Plug>RSPlot', 'rb', ':call rplugin#RAction("plot")<CR>:call rplugin#RAction("summary")')
377+
378+
" Build list of objects for omni completion
379+
"-------------------------------------
380+
call rplugin#RCreateMaps("nvi", '<Plug>RUpdateObjBrowser', 'ro', ':call RObjBrowser()')
321381
endfunction
322382

323383

0 commit comments

Comments
 (0)