From a11737551fa84990a42866f87b158eee903e53b8 Mon Sep 17 00:00:00 2001 From: jcfaria Date: Tue, 28 Jun 2011 17:25:53 -0300 Subject: [PATCH 0001/1050] Version 110628 --- doc/r-plugin.txt | 16 ++++++++-------- ftplugin/rnoweb.vim | 8 ++++++-- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index c067fb9..2eff30a 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -5,7 +5,7 @@ Authors: Jakson A. Aquino Jose Claudio Faria -Version: 110614 +Version: 110628 For Vim version 7.3 1. Overview |r-plugin-overview| @@ -1594,19 +1594,19 @@ and the Vim-R-plugin functions and key bindings are lost. Consequently, the ftplugin/r.vim script must be sourced again by pressing for the second time. - 10.18. Vim-LaTeX-suite and Rnoweb files~ -If you want to use the Vim-LaTeX-suite plugin with Rnoweb files, create a file -named rnw.vim at ~/.vim/ftdetect with the following content: -> - autocmd BufRead,BufNewFile *.Rnw set filetype=tex - autocmd BufRead,BufNewFile *.rnw set filetype=tex -< +From Vim-R-plugin 110628 you can use all resources of Vim-LaTeX-suite plugin +with Rnoweb files without any additional configuration. For this, the necessary +code was added to the Vim-R-plugin/ftplugin/rnoweb.vim file. ============================================================================== 11. News~ *r-plugin-news* +110628 (2011-06-28) + * From this version you can use all resources of Vim-LaTeX-suite plugin + with Rnoweb files without any additional configuration. For this, + the necessary code was added to the Vim-R-plugin/ftplugin/rnoweb.vim file. 110614 (2011-06-14) * When doing the command \rh, the plugin tries to show the help for the diff --git a/ftplugin/rnoweb.vim b/ftplugin/rnoweb.vim index 2f51316..573ac6d 100644 --- a/ftplugin/rnoweb.vim +++ b/ftplugin/rnoweb.vim @@ -16,8 +16,8 @@ " " Authors: Jakson Alves de Aquino " Jose Claudio Faria -" -" Last Change: Sun May 22, 2011 08:27AM +" +" Last Change: Mon Jun 27, 2011 11:15AM "========================================================================== " Only do this when not yet done for this buffer @@ -25,6 +25,10 @@ if exists("b:did_rnoweb_ftplugin") || exists("disable_r_ftplugin") finish endif +" The below enables (g)Vim runs Vim-R-Plugin and Vim-Latex-Suite together to noweb files +" (Sweave) +runtime! ftplugin/tex_latexSuite.vim + " Don't load another plugin for this buffer let b:did_rnoweb_ftplugin = 1 From 68ba4c06119dae6c6da9a1bd3bc26523e8b74882 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Wed, 6 Jul 2011 09:02:30 -0300 Subject: [PATCH 0002/1050] Note on how to disable syntax hihglighting of R functions. --- doc/r-plugin.txt | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 2eff30a..e1af5aa 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -1594,19 +1594,20 @@ and the Vim-R-plugin functions and key bindings are lost. Consequently, the ftplugin/r.vim script must be sourced again by pressing for the second time. -10.18. Vim-LaTeX-suite and Rnoweb files~ -From Vim-R-plugin 110628 you can use all resources of Vim-LaTeX-suite plugin -with Rnoweb files without any additional configuration. For this, the necessary -code was added to the Vim-R-plugin/ftplugin/rnoweb.vim file. +10.18. Disable syntax highlight of R functions~ + +If you want to disable the syntax highlight of R functions edit the file +~/.vim/r-plugin/functions.vim and delete all lines, but do not delete the +file. + ============================================================================== 11. News~ *r-plugin-news* -110628 (2011-06-28) - * From this version you can use all resources of Vim-LaTeX-suite plugin - with Rnoweb files without any additional configuration. For this, - the necessary code was added to the Vim-R-plugin/ftplugin/rnoweb.vim file. + + * Vim-LaTeX-suite plugin can be used with Rnoweb files without any additional + configuration. The necessary code was added to the ftplugin/rnoweb.vim. 110614 (2011-06-14) * When doing the command \rh, the plugin tries to show the help for the From ce290a9a4cbaee060ef1a4e27dffa335c5b21596 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Wed, 6 Jul 2011 09:04:48 -0300 Subject: [PATCH 0003/1050] Try harder to find omniList and functions.vim. --- r-plugin/common_global.vim | 38 ++++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 66481d5..4c1b2f7 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -17,7 +17,7 @@ " " Based on previous work by Johannes Ranke " -" Last Change: Fri Jun 03, 2011 04:47PM +" Last Change: Mon Jun 27, 2011 08:40AM " " Purposes of this file: Create all functions and commands and Set the " value of all global variables and some buffer variables.for r, @@ -2230,30 +2230,36 @@ if g:rplugin_home != g:rplugin_uservimfiles if !isdirectory(g:rplugin_uservimfiles . "/r-plugin") call mkdir(g:rplugin_uservimfiles . "/r-plugin", "p") endif +endif - " If there is no functions.vim, copy the default one - if !filereadable(g:rplugin_uservimfiles . "/r-plugin/functions.vim") - if filereadable("/usr/share/vim/addons/r-plugin/functions.vim") - let ffile = readfile("/usr/share/vim/addons/r-plugin/functions.vim") +" If there is no functions.vim, copy the default one +if !filereadable(g:rplugin_uservimfiles . "/r-plugin/functions.vim") + if filereadable("/usr/share/vim/addons/r-plugin/functions.vim") + let ffile = readfile("/usr/share/vim/addons/r-plugin/functions.vim") + call writefile(ffile, g:rplugin_uservimfiles . "/r-plugin/functions.vim") + unlet ffile + else + if g:rplugin_home != g:rplugin_uservimfiles && filereadable(g:rplugin_home . "/r-plugin/functions.vim") + let ffile = readfile(g:rplugin_home . "/r-plugin/functions.vim") call writefile(ffile, g:rplugin_uservimfiles . "/r-plugin/functions.vim") unlet ffile endif endif +endif - " If there is no omniList, copy the default one - if !filereadable(g:rplugin_omnifname) - if filereadable("/usr/share/vim/addons/r-plugin/omniList") - let omnilines = readfile("/usr/share/vim/addons/r-plugin/omniList") +" If there is no omniList, copy the default one +if !filereadable(g:rplugin_omnifname) + if filereadable("/usr/share/vim/addons/r-plugin/omniList") + let omnilines = readfile("/usr/share/vim/addons/r-plugin/omniList") + else + if filereadable(g:rplugin_home . "/r-plugin/omniList") + let omnilines = readfile(g:rplugin_home . "/r-plugin/omniList") else - if filereadable(g:rplugin_home . "/r-plugin/omniList") - let omnilines = readfile(g:rplugin_home . "/r-plugin/omniList") - else - let omnilines = [] - endif + let omnilines = [] endif - call writefile(omnilines, g:rplugin_omnifname) - unlet omnilines endif + call writefile(omnilines, g:rplugin_omnifname) + unlet omnilines endif " Minimum width for the Object Browser From 3af08d9768d98e1f7f49b76dfa76cb7a1930c9f2 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Wed, 6 Jul 2011 09:07:57 -0300 Subject: [PATCH 0004/1050] Deleted file which are unnecessary on development code. --- ftplugin/rnoweb.vim | 5 +- r-plugin/functions.vim | 307 ----- r-plugin/omniList | 2909 ---------------------------------------- 3 files changed, 2 insertions(+), 3219 deletions(-) delete mode 100644 r-plugin/functions.vim delete mode 100644 r-plugin/omniList diff --git a/ftplugin/rnoweb.vim b/ftplugin/rnoweb.vim index 573ac6d..b707ca0 100644 --- a/ftplugin/rnoweb.vim +++ b/ftplugin/rnoweb.vim @@ -17,7 +17,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Mon Jun 27, 2011 11:15AM +" Last Change: Sun Jul 03, 2011 11:08AM "========================================================================== " Only do this when not yet done for this buffer @@ -25,8 +25,7 @@ if exists("b:did_rnoweb_ftplugin") || exists("disable_r_ftplugin") finish endif -" The below enables (g)Vim runs Vim-R-Plugin and Vim-Latex-Suite together to noweb files -" (Sweave) +" Enables Vim-Latex-Suite if it is installed runtime! ftplugin/tex_latexSuite.vim " Don't load another plugin for this buffer diff --git a/r-plugin/functions.vim b/r-plugin/functions.vim deleted file mode 100644 index 4155ba9..0000000 --- a/r-plugin/functions.vim +++ /dev/null @@ -1,307 +0,0 @@ -syn keyword rFunction acf acf2AR add1 addmargins add.scope aggregate aggregate.data.frame -syn keyword rFunction aggregate.default aggregate.ts AIC alias anova anova.glm anova.glmlist -syn keyword rFunction anovalist.lm anova.lm anova.lmlist anova.mlm ansari.test aov approx -syn keyword rFunction approxfun ar ar.burg arima arima0 arima0.diag arima.sim -syn keyword rFunction ARMAacf ARMAtoMA ar.mle ar.ols ar.yw as.dendrogram as.dist -syn keyword rFunction as.formula as.hclust asOneSidedFormula as.stepfun as.ts ave bandwidth.kernel -syn keyword rFunction bartlett.test binomial binom.test biplot Box.test bw.bcv bw.nrd -syn keyword rFunction bw.nrd0 bw.SJ bw.ucv C cancor case.names ccf -syn keyword rFunction .checkMFClasses chisq.test clearNames cmdscale coef coefficients complete.cases -syn keyword rFunction confint confint.default constrOptim contrasts contr.helmert contr.poly contr.SAS -syn keyword rFunction contr.sum contr.treatment convolve cooks.distance cophenetic cor cor.test -syn keyword rFunction cov cov2cor covratio cov.wt cpgram cutree cycle -syn keyword rFunction D dbeta dbinom dcauchy dchisq decompose delete.response -syn keyword rFunction deltat dendrapply density density.default deriv deriv3 deriv3.default -syn keyword rFunction deriv3.formula deriv.default deriv.formula deviance dexp df dfbeta -syn keyword rFunction dfbetas dffits df.kernel df.residual dgamma dgeom dhyper -syn keyword rFunction diffinv diff.ts dist dlnorm dlogis dmultinom dnbinom -syn keyword rFunction dnorm dpois drop1 drop.scope drop.terms dsignrank dt -syn keyword rFunction dummy.coef dunif dweibull dwilcox ecdf eff.aovlist effects -syn keyword rFunction embed end estVar expand.model.frame extractAIC factanal factor.scope -syn keyword rFunction family fft filter fisher.test fitted fitted.values fivenum -syn keyword rFunction fligner.test formula frequency friedman.test ftable Gamma gaussian -syn keyword rFunction getInitial .getXlevels glm glm.control glm.fit glm.fit.null hasTsp -syn keyword rFunction hat hatvalues hatvalues.lm hclust heatmap HoltWinters influence -syn keyword rFunction influence.measures integrate interaction.plot inverse.gaussian IQR is.empty.model is.leaf -syn keyword rFunction is.mts isoreg is.stepfun is.ts is.tskernel KalmanForecast KalmanLike -syn keyword rFunction KalmanRun KalmanSmooth kernapply kernel kmeans knots kruskal.test -syn keyword rFunction ksmooth ks.test lag lag.plot line lines.ts lm -syn keyword rFunction lm.fit lm.fit.null lm.influence lm.wfit lm.wfit.null loadings loess -syn keyword rFunction loess.control loess.smooth logLik loglin lowess ls.diag lsfit -syn keyword rFunction ls.print mad mahalanobis makeARIMA make.link makepredictcall manova -syn keyword rFunction mantelhaen.test mauchley.test mauchly.test mcnemar.test median median.default medpolish -syn keyword rFunction .MFclass model.extract model.frame model.frame.aovlist model.frame.default model.frame.glm model.frame.lm -syn keyword rFunction model.matrix model.matrix.default model.matrix.lm model.offset model.response model.tables model.weights -syn keyword rFunction monthplot mood.test mvfft na.action na.contiguous na.exclude na.fail -syn keyword rFunction na.omit na.pass napredict naprint naresid nextn nlm -syn keyword rFunction nlminb nls nls.control NLSstAsymptotic NLSstClosestX NLSstLfAsymptote NLSstRtAsymptote -syn keyword rFunction numericDeriv offset oneway.test optim optimise optimize order.dendrogram -syn keyword rFunction pacf p.adjust pairwise.prop.test pairwise.table pairwise.t.test pairwise.wilcox.test pbeta -syn keyword rFunction pbinom pbirthday pcauchy pchisq pexp pf pgamma -syn keyword rFunction pgeom phyper plclust plnorm plogis plot.density plot.ecdf -syn keyword rFunction plot.lm plot.mlm plot.spec plot.spec.coherency plot.spec.phase plot.stepfun plot.ts -syn keyword rFunction plot.TukeyHSD pnbinom pnorm poisson poisson.test poly polym -syn keyword rFunction power power.anova.test power.prop.test power.t.test ppoints ppois ppr -syn keyword rFunction PP.test prcomp predict predict.glm predict.lm predict.mlm predict.poly -syn keyword rFunction preplot princomp print.anova print.coefmat printCoefmat print.density print.family -syn keyword rFunction print.formula print.ftable print.glm print.infl print.integrate print.lm print.logLik -syn keyword rFunction print.terms print.ts profile proj promax prop.test prop.trend.test -syn keyword rFunction psignrank pt ptukey punif pweibull pwilcox qbeta -syn keyword rFunction qbinom qbirthday qcauchy qchisq qexp qf qgamma -syn keyword rFunction qgeom qhyper qlnorm qlogis qnbinom qnorm qpois -syn keyword rFunction qqline qqnorm qqnorm.default qqplot qsignrank qt qtukey -syn keyword rFunction quade.test quantile quantile.default quasi quasibinomial quasipoisson qunif -syn keyword rFunction qweibull qwilcox r2dtable rbeta rbinom rcauchy rchisq -syn keyword rFunction read.ftable rect.hclust reformulate relevel reorder replications reshape -syn keyword rFunction reshapeLong reshapeWide resid residuals residuals.default residuals.glm residuals.lm -syn keyword rFunction rexp rf rgamma rgeom rhyper rlnorm rlogis -syn keyword rFunction rmultinom rnbinom rnorm rpois rsignrank rstandard rstandard.glm -syn keyword rFunction rstandard.lm rstudent rstudent.glm rstudent.lm rt runif runmed -syn keyword rFunction rweibull rwilcox scatter.smooth screeplot sd se.contrast selfStart -syn keyword rFunction setNames shapiro.test simulate smooth smoothEnds smooth.spline sortedXyData -syn keyword rFunction spec.ar spec.pgram spec.taper spectrum spline splinefun splinefunH -syn keyword rFunction SSasymp SSasympOff SSasympOrig SSbiexp SSD SSfol SSfpl -syn keyword rFunction SSgompertz SSlogis SSmicmen SSweibull start stat.anova step -syn keyword rFunction stepfun stl StructTS summary.aov summary.aovlist summary.glm summary.infl -syn keyword rFunction summary.lm summary.manova summary.mlm summary.stepfun supsmu symnum termplot -syn keyword rFunction terms terms.aovlist terms.default terms.formula terms.terms time toeplitz -syn keyword rFunction ts tsdiag ts.intersect tsp ts.plot tsSmooth ts.union -syn keyword rFunction t.test TukeyHSD TukeyHSD.aov uniroot update update.default update.formula -syn keyword rFunction var variable.names varimax var.test vcov weighted.mean weighted.residuals -syn keyword rFunction weights wilcox.test window write.ftable xtabs abline arrows -syn keyword rFunction assocplot axis Axis axis.Date axis.POSIXct axTicks barplot -syn keyword rFunction barplot.default box boxplot boxplot.default boxplot.matrix bxp cdplot -syn keyword rFunction clip close.screen co.intervals contour contour.default coplot curve -syn keyword rFunction dotchart erase.screen filled.contour fourfoldplot frame grconvertX grconvertY -syn keyword rFunction grid hist hist.default identify image image.default layout -syn keyword rFunction layout.show lcm legend lines lines.default locator matlines -syn keyword rFunction matplot matpoints mosaicplot mtext pairs pairs.default panel.smooth -syn keyword rFunction par persp pie piechart plot plot.default plot.design -syn keyword rFunction plot.new plot.window plot.xy points points.default polygon polypath -syn keyword rFunction rasterImage rect rug screen segments smoothScatter spineplot -syn keyword rFunction split.screen stars stem strheight stripchart strwidth sunflowerplot -syn keyword rFunction symbols text text.default title xinch xspline xyinch -syn keyword rFunction yinch adjustcolor as.graphicsAnnot as.raster bitmap bmp boxplot.stats -syn keyword rFunction check.options chull CIDFont cm cm.colors col2rgb colorConverter -syn keyword rFunction colorRamp colorRampPalette colors colours contourLines convertColor densCols -syn keyword rFunction dev2bitmap devAskNewPage dev.control dev.copy dev.copy2eps dev.copy2pdf dev.cur -syn keyword rFunction deviceIsInteractive dev.interactive dev.list dev.new dev.next dev.off dev.prev -syn keyword rFunction dev.print dev.set dev.size embedFonts extendrange getGraphicsEvent getGraphicsEventEnv -syn keyword rFunction graphics.off gray gray.colors grey grey.colors hcl heat.colors -syn keyword rFunction hsv is.raster jpeg make.rgb n2mfrow nclass.FD nclass.scott -syn keyword rFunction nclass.Sturges palette pdf pdfFonts pdf.options pictex png -syn keyword rFunction postscript postscriptFont postscriptFonts ps.options quartz quartzFont quartzFonts -syn keyword rFunction quartz.options rainbow recordGraphics recordPlot replayPlot rgb rgb2hsv -syn keyword rFunction savePlot setEPS setGraphicsEventEnv setGraphicsEventHandlers setPS svg terrain.colors -syn keyword rFunction tiff topo.colors trans3d Type1Font x11 X11 X11Font -syn keyword rFunction X11Fonts X11.options xfig xy.coords xyTable xyz.coords alarm -syn keyword rFunction apropos argsAnywhere aspell as.person as.personList as.relistable as.roman -syn keyword rFunction assignInNamespace available.packages bibentry browseEnv browseURL browseVignettes bug.report -syn keyword rFunction capture.output checkCRAN chooseBioCmirror chooseCRANmirror citation citEntry citFooter -syn keyword rFunction citHeader close.socket combn compareVersion contrib.url count.fields CRAN.packages -syn keyword rFunction data dataentry data.entry de debugger demo de.ncols -syn keyword rFunction de.restore de.setup .DollarNames download.file download.packages dump.frames edit -syn keyword rFunction emacs example file.edit find findLineNum fix fixInNamespace -syn keyword rFunction flush.console formatOL formatUL getAnywhere getCRANmirrors getFromNamespace getS3method -syn keyword rFunction getTxtProgressBar glob2rx head head.matrix help help.request help.search -syn keyword rFunction help.start history installed.packages install.packages is.relistable limitedLabels loadhistory -syn keyword rFunction localeToCharset lsf.str ls.str maintainer make.packages.html makeRweaveLatexCodeRunner make.socket -syn keyword rFunction memory.limit memory.size menu methods mirror2html modifyList new.packages -syn keyword rFunction news normalizePath nsl object.size old.packages package.contents packageDescription -syn keyword rFunction package.skeleton packageStatus packageVersion page person personList pico -syn keyword rFunction prompt promptData promptPackage rc.getOption rc.options rc.settings rc.status -syn keyword rFunction readCitationFile read.csv read.csv2 read.delim read.delim2 read.DIF read.fortran -syn keyword rFunction read.fwf read.socket read.table recover relist remove.packages Rprof -syn keyword rFunction Rprofmem RShowDoc RSiteSearch rtags Rtangle RtangleSetup RtangleWritedoc -syn keyword rFunction RweaveChunkPrefix RweaveEvalWithOpt RweaveLatex RweaveLatexFinish RweaveLatexOptions RweaveLatexSetup RweaveLatexWritedoc -syn keyword rFunction RweaveTryStop savehistory select.list sessionInfo setBreakpoint setRepositories setTxtProgressBar -syn keyword rFunction stack Stangle str strOptions summaryRprof Sweave SweaveHooks -syn keyword rFunction SweaveSyntConv tail tail.matrix tar timestamp toBibtex toLatex -syn keyword rFunction txtProgressBar type.convert unstack untar unzip update.packages update.packageStatus -syn keyword rFunction upgrade URLdecode URLencode url.show vi View vignette -syn keyword rFunction write.csv write.csv2 write.socket write.table wsbrowser xedit xemacs -syn keyword rFunction zip.file.extract .First.lib addNextMethod allGenerics allNames Arith as -syn keyword rFunction asMethodDefinition assignClassDef assignMethodsMetaData balanceMethodsList cacheGenericsMetaData cacheMetaData cacheMethod -syn keyword rFunction callGeneric callNextMethod canCoerce cbind2 checkSlotAssignment classesToAM classMetaName -syn keyword rFunction coerce Compare completeClassDefinition completeExtends completeSubclasses Complex conformMethod -syn keyword rFunction defaultDumpName defaultPrototype doPrimitiveMethod .doTracePrint dumpMethod dumpMethods el -syn keyword rFunction elNamed empty.dump emptyMethodsList evalSource existsFunction existsMethod extends -syn keyword rFunction finalDefaultMethod findClass findFunction findMethod findMethods findMethodSignatures findUnique -syn keyword rFunction formalArgs functionBody generic.skeleton getAccess getAllMethods getAllSuperClasses getClass -syn keyword rFunction getClassDef getClasses getClassName getClassPackage getDataPart getExtends getFunction -syn keyword rFunction getGeneric getGenerics getGroup getGroupMembers getMethod getMethods getMethodsForDispatch -syn keyword rFunction getMethodsMetaData getPackageName getProperties getPrototype getRefClass getSlots getSubclasses -syn keyword rFunction getValidity getVirtual hasArg hasMethod hasMethods .hasSlot implicitGeneric -syn keyword rFunction inheritedSlotNames initFieldArgs initialize insertMethod insertSource is isClass -syn keyword rFunction isClassDef isClassUnion isGeneric isGrammarSymbol isGroup isSealedClass isSealedMethod -syn keyword rFunction isVirtualClass isXS3Class languageEl .Last.lib linearizeMlist listFromMethods listFromMlist -syn keyword rFunction loadMethod Logic makeClassRepresentation makeExtends makeGeneric makeMethodsList makePrototypeFromClassDef -syn keyword rFunction makeStandardGeneric matchSignature Math Math2 mergeMethods metaNameUndo MethodAddCoerce -syn keyword rFunction methodSignatureMatrix method.skeleton MethodsList MethodsListSelect methodsPackageMetaName missingArg mlistMetaName -syn keyword rFunction new newBasic newClassRepresentation newEmptyObject Ops packageSlot possibleExtends -syn keyword rFunction prohibitGeneric promptClass promptMethods prototype Quote rbind2 reconcilePropertiesAndPrototype -syn keyword rFunction registerImplicitGenerics rematchDefinition removeClass removeGeneric removeMethod removeMethods removeMethodsObject -syn keyword rFunction representation requireMethods resetClass resetGeneric S3Class S3Part sealClass -syn keyword rFunction seemsS4Object selectMethod selectSuperClasses .selectSuperClasses sessionData setAs setClass -syn keyword rFunction setClassUnion setDataPart setGeneric setGenericImplicit setGroupGeneric setIs setMethod -syn keyword rFunction setOldClass setPackageName setPrimitiveMethods setRefClass setReplaceMethod setValidity show -syn keyword rFunction showClass showDefault showExtends showMethods showMlist signature SignatureMethod -syn keyword rFunction sigToEnv slot slotNames .slotNames slotsFromS3 substituteDirect substituteFunctionArgs -syn keyword rFunction Summary superClassDepth testInheritedMethods testVirtual traceOff traceOn .TraceWithMethods -syn keyword rFunction tryNew trySilent unRematchDefinition .untracedFunction validObject validSlotNames .valueClassTest -syn keyword rFunction abbreviate abs acos acosh addNA addTaskCallback agrep -syn keyword rFunction .Alias alist all all.equal all.equal.character all.equal.default all.equal.factor -syn keyword rFunction all.equal.formula all.equal.language all.equal.list all.equal.numeric all.equal.POSIXct all.equal.raw all.names -syn keyword rFunction all.vars any anyDuplicated anyDuplicated.array anyDuplicated.data.frame anyDuplicated.default anyDuplicated.matrix -syn keyword rFunction aperm append apply Arg args array arrayInd -syn keyword rFunction as.array as.array.default as.call as.character as.character.condition as.character.Date as.character.default -syn keyword rFunction as.character.error as.character.factor as.character.hexmode as.character.numeric_version as.character.octmode as.character.POSIXt as.character.srcref -syn keyword rFunction as.complex as.data.frame as.data.frame.array as.data.frame.AsIs as.data.frame.character as.data.frame.complex as.data.frame.data.frame -syn keyword rFunction as.data.frame.Date as.data.frame.default as.data.frame.difftime as.data.frame.factor as.data.frame.integer as.data.frame.list as.data.frame.logical -syn keyword rFunction as.data.frame.matrix as.data.frame.model.matrix as.data.frame.numeric as.data.frame.numeric_version as.data.frame.ordered as.data.frame.POSIXct as.data.frame.POSIXlt -syn keyword rFunction as.data.frame.raw as.data.frame.table as.data.frame.ts as.data.frame.vector as.Date as.Date.character as.Date.date -syn keyword rFunction as.Date.dates as.Date.default as.Date.factor as.Date.numeric as.Date.POSIXct as.Date.POSIXlt as.difftime -syn keyword rFunction as.double as.double.difftime as.double.POSIXlt as.environment as.expression as.expression.default as.factor -syn keyword rFunction as.function as.function.default as.hexmode asin asinh as.integer as.list -syn keyword rFunction as.list.data.frame as.list.Date as.list.default as.list.environment as.list.factor as.list.function as.list.numeric_version -syn keyword rFunction as.list.POSIXct as.logical as.logical.factor as.matrix as.matrix.data.frame as.matrix.default as.matrix.noquote -syn keyword rFunction as.matrix.POSIXlt as.name asNamespace as.null as.null.default as.numeric as.numeric_version -syn keyword rFunction as.octmode as.ordered as.package_version as.pairlist as.POSIXct as.POSIXct.date as.POSIXct.Date -syn keyword rFunction as.POSIXct.dates as.POSIXct.default as.POSIXct.numeric as.POSIXct.POSIXlt as.POSIXlt as.POSIXlt.character as.POSIXlt.date -syn keyword rFunction as.POSIXlt.Date as.POSIXlt.dates as.POSIXlt.default as.POSIXlt.factor as.POSIXlt.numeric as.POSIXlt.POSIXct as.qr -syn keyword rFunction as.raw as.real asS3 asS4 assign as.single as.single.default -syn keyword rFunction as.symbol as.table as.table.default as.vector as.vector.factor atan atan2 -syn keyword rFunction atanh attach attachNamespace attr attr.all.equal attributes autoload -syn keyword rFunction autoloader backsolve baseenv basename besselI besselJ besselK -syn keyword rFunction besselY beta bindingIsActive bindingIsLocked bindtextdomain body bquote -syn keyword rFunction browser browserCondition browserSetDebug browserText builtins by by.data.frame -syn keyword rFunction by.default bzfile c .C .cache_class call .Call -syn keyword rFunction callCC .Call.graphics capabilities casefold cat category cbind -syn keyword rFunction cbind.data.frame c.Date ceiling character char.expand charmatch charToRaw -syn keyword rFunction chartr chol chol2inv chol.default choose class close -syn keyword rFunction closeAllConnections close.connection close.srcfile c.noquote c.numeric_version codes codes.factor -syn keyword rFunction codes.ordered col colMeans colnames colSums commandArgs comment -syn keyword rFunction complex computeRestarts conditionCall conditionCall.condition conditionMessage conditionMessage.condition conflicts -syn keyword rFunction Conj contributors cos cosh c.POSIXct c.POSIXlt crossprod -syn keyword rFunction cummax cummin cumprod cumsum cut cut.Date cut.default -syn keyword rFunction cut.POSIXt data.class data.frame data.matrix date debug debugonce -syn keyword rFunction .decode_numeric_version default.stringsAsFactors .Defunct delay delayedAssign deparse .deparseOpts -syn keyword rFunction .Deprecated det detach determinant determinant.matrix dget diag -syn keyword rFunction diff diff.Date diff.default diff.POSIXt difftime .difftime digamma -syn keyword rFunction dim dim.data.frame dimnames dimnames.data.frame dir dir.create dirname -syn keyword rFunction do.call .doTrace double dput dQuote drop droplevels -syn keyword rFunction droplevels.data.frame droplevels.factor dump duplicated duplicated.array duplicated.data.frame duplicated.default -syn keyword rFunction duplicated.matrix duplicated.numeric_version duplicated.POSIXlt .dynLibs dyn.load dyn.unload eapply -syn keyword rFunction eigen emptyenv enc2native enc2utf8 .encode_numeric_version encodeString Encoding -syn keyword rFunction enquote environment environmentIsLocked environmentName env.profile eval eval.parent -syn keyword rFunction evalq exists exp expand.grid .expand_R_libs_env_var expm1 .Export -syn keyword rFunction expression .External .External.graphics factor factorial fifo file -syn keyword rFunction file.access file.append file.choose file.copy file.create file.exists file.info -syn keyword rFunction file.path file.remove file.rename file.show file.symlink Filter Find -syn keyword rFunction findInterval .find.package findPackageEnv findRestart .First.sys floor flush -syn keyword rFunction flush.connection force formals format format.AsIs formatC format.char -syn keyword rFunction format.data.frame format.Date format.default format.difftime formatDL format.factor format.hexmode -syn keyword rFunction format.info format.numeric_version format.octmode format.POSIXct format.POSIXlt format.pval .Fortran -syn keyword rFunction forwardsolve function gamma gammaCody gc gcinfo gc.time -syn keyword rFunction gctorture get getAllConnections getCallingDLL getCallingDLLe getCConverterDescriptions getCConverterStatus -syn keyword rFunction getConnection getDLLRegisteredRoutines getDLLRegisteredRoutines.character getDLLRegisteredRoutines.DLLInfo getenv geterrmessage getExportedValue -syn keyword rFunction getHook getLoadedDLLs getNamespace getNamespaceExports getNamespaceImports getNamespaceInfo getNamespaceName -syn keyword rFunction getNamespaceUsers getNamespaceVersion getNativeSymbolInfo getNumCConverters getOption .getRequiredPackages .getRequiredPackages2 -syn keyword rFunction getRversion getSrcLines getTaskCallbackNames gettext gettextf getwd gl -syn keyword rFunction globalenv gregexpr grep grepl gsub .gt .gtn -syn keyword rFunction gzcon gzfile .handleSimpleError httpclient I iconv iconvlist -syn keyword rFunction icuSetCollate identical identity ifelse Im .Import .ImportFrom -syn keyword rFunction importIntoEnv inherits integer interaction interactive .Internal intersect -syn keyword rFunction intToBits intToUtf8 inverse.rle invisible invokeRestart invokeRestartInteractively is.array -syn keyword rFunction is.atomic isatty isBaseNamespace is.call is.character is.complex is.data.frame -syn keyword rFunction isdebugged is.double is.element is.environment is.expression is.factor is.finite -syn keyword rFunction is.function isIncomplete is.infinite is.integer is.language is.list is.loaded -syn keyword rFunction is.logical is.matrix .isMethodsDispatchOn is.na is.na.data.frame is.name isNamespace -syn keyword rFunction is.nan is.na.numeric_version is.na.POSIXlt is.null is.numeric is.numeric.Date is.numeric.difftime -syn keyword rFunction is.numeric.POSIXt is.numeric_version is.object ISOdate ISOdatetime isOpen .isOpen -syn keyword rFunction is.ordered is.package_version is.pairlist is.primitive is.qr is.R is.raw -syn keyword rFunction is.real is.recursive isRestart isS4 isSeekable is.single is.symbol -syn keyword rFunction isSymmetric isSymmetric.matrix is.table isTRUE is.unsorted is.vector jitter -syn keyword rFunction julian julian.Date julian.POSIXt kappa kappa.default kappa.lm kappa.qr -syn keyword rFunction kappa.tri kronecker labels labels.default La.chol La.chol2inv La.eigen -syn keyword rFunction lapply .Last.value$value La.svd lazyLoad lazyLoadDBfetch lbeta lchoose -syn keyword rFunction length length.POSIXlt levels levels.default lfactorial lgamma .libPaths -syn keyword rFunction library library.dynam library.dynam.unload licence license list list2env -syn keyword rFunction list.files load loadedNamespaces loadingNamespaceInfo loadNamespace loadURL local -syn keyword rFunction lockBinding lockEnvironment log log10 log1p log2 logb -syn keyword rFunction logical lower.tri ls machine Machine makeActiveBinding .makeMessage -syn keyword rFunction make.names .make_numeric_version make.unique manglePackageName Map mapply margin.table -syn keyword rFunction match match.arg match.call match.fun Math.data.frame Math.Date Math.difftime -syn keyword rFunction Math.factor Math.POSIXt mat.or.vec matrix max max.col mean -syn keyword rFunction mean.data.frame mean.Date mean.default mean.difftime mean.POSIXct mean.POSIXlt memCompress -syn keyword rFunction memDecompress mem.limits memory.profile merge merge.data.frame merge.default .mergeExportMethods -syn keyword rFunction .mergeImportMethods message mget min missing Mod mode -syn keyword rFunction months months.Date months.POSIXt names namespaceExport namespaceImport namespaceImportClasses -syn keyword rFunction namespaceImportFrom namespaceImportMethods nargs nchar ncol NCOL Negate -syn keyword rFunction new.env NextMethod ngettext nlevels noquote norm .NotYetImplemented -syn keyword rFunction .NotYetUsed nrow NROW numeric nzchar objects oldClass -syn keyword rFunction on.exit open open.connection open.srcfile open.srcfilecopy Ops.data.frame Ops.Date -syn keyword rFunction Ops.difftime Ops.factor Ops.numeric_version Ops.ordered Ops.POSIXt options .OptRequireMethods -syn keyword rFunction order ordered outer package.description packageEvent packageHasNamespace .packages -syn keyword rFunction packageStartupMessage .packageStartupMessage packBits pairlist parent.env parent.frame parse -syn keyword rFunction parse.dcf parseNamespaceFile paste path.expand .path.package pentagamma pipe -syn keyword rFunction Platform pmatch pmax pmax.int pmin pmin.int polyroot -syn keyword rFunction Position .POSIXct .POSIXlt pos.to.env pretty pretty.default prettyNum -syn keyword rFunction .Primitive .primTrace .primUntrace print print.AsIs print.by print.condition -syn keyword rFunction print.connection print.data.frame print.Date print.default print.difftime print.DLLInfo print.DLLInfoList -syn keyword rFunction print.DLLRegisteredRoutines print.factor print.function print.hexmode print.libraryIQR print.listof print.NativeRoutineList -syn keyword rFunction printNoClass print.noquote print.numeric_version print.octmode print.packageInfo print.POSIXct print.POSIXlt -syn keyword rFunction print.proc_time print.restart print.rle print.simple.list print.srcfile print.srcref print.summaryDefault -syn keyword rFunction print.summary.table print.table print.warnings prmatrix proc.time prod prop.table -syn keyword rFunction provide psigamma pushBack pushBackLength q qr qr.coef -syn keyword rFunction qr.default qr.fitted qr.Q qr.qty qr.qy qr.R qr.resid -syn keyword rFunction qr.solve qr.X quarters quarters.Date quarters.POSIXt quit quote -syn keyword rFunction range range.default rank rapply raw rawConnection rawConnectionValue -syn keyword rFunction rawShift rawToBits rawToChar rbind rbind.data.frame rcond Re -syn keyword rFunction readBin readChar read.dcf readline readLines .readRDS readRenviron -syn keyword rFunction read.table.url real Recall Reduce regexpr reg.finalizer registerS3method -syn keyword rFunction registerS3methods remove removeCConverter removeTaskCallback rep rep.Date rep.factor -syn keyword rFunction rep.int replace replicate rep.numeric_version rep.POSIXct rep.POSIXlt require -syn keyword rFunction restart restartDescription restartFormals retracemem return rev rev.default -syn keyword rFunction R.home rle rm RNGkind RNGversion round round.Date -syn keyword rFunction round.POSIXt row rowMeans rownames row.names row.names.data.frame row.names.default -syn keyword rFunction .row_names_info rowsum rowsum.data.frame rowsum.default rowSums R.Version .S3method -syn keyword rFunction sample sample.int sapply save save.image .saveRDS scale -syn keyword rFunction scale.default scan scan.url .Script search searchpaths seek -syn keyword rFunction seek.connection seq seq.Date seq.default seq.int seq.POSIXt sequence -syn keyword rFunction serialize setCConverterStatus setdiff setequal setHook setNamespaceInfo .set_row_names -syn keyword rFunction set.seed setSessionTimeLimit setTimeLimit setwd showConnections shQuote sign -syn keyword rFunction signalCondition .signalSimpleWarning signif simpleCondition simpleError simpleMessage simpleWarning -syn keyword rFunction sin single sinh sink sink.number slice.index socketConnection -syn keyword rFunction socketSelect solve solve.default solve.qr sort sort.default sort.int -syn keyword rFunction sort.list sort.POSIXlt source source.url split split.data.frame split.Date -syn keyword rFunction split.default split.POSIXct sprintf sqrt sQuote srcfile srcfilecopy -syn keyword rFunction srcref standardGeneric .standard_regexps stderr stdin stdout stop -syn keyword rFunction stopifnot storage.mode strftime strptime strsplit strtoi strtrim -syn keyword rFunction structure strwrap sub subset .subset .subset2 subset.data.frame -syn keyword rFunction subset.default subset.matrix substitute substr substring sum summary -syn keyword rFunction summary.connection summary.data.frame Summary.data.frame summary.Date Summary.Date summary.default Summary.difftime -syn keyword rFunction summary.factor Summary.factor summary.matrix Summary.numeric_version summary.POSIXct Summary.POSIXct summary.POSIXlt -syn keyword rFunction Summary.POSIXlt summary.srcfile summary.srcref summary.table suppressMessages suppressPackageStartupMessages suppressWarnings -syn keyword rFunction svd sweep switch symbol.C symbol.For sys.call sys.calls -syn keyword rFunction Sys.chmod Sys.Date sys.frame sys.frames sys.function Sys.getenv Sys.getlocale -syn keyword rFunction Sys.getpid Sys.glob Sys.info sys.load.image Sys.localeconv sys.nframe sys.on.exit -syn keyword rFunction sys.parent sys.parents Sys.putenv Sys.readlink sys.save.image Sys.setenv Sys.setlocale -syn keyword rFunction Sys.sleep sys.source sys.status system system2 system.file system.time -syn keyword rFunction Sys.time Sys.timezone Sys.umask Sys.unsetenv Sys.which t table -syn keyword rFunction tabulate tan tanh .TAOCP1997init tapply taskCallbackManager tcrossprod -syn keyword rFunction t.data.frame t.default tempdir tempfile testPlatformEquivalence tetragamma textConnection -syn keyword rFunction textConnectionValue tolower topenv toString toString.default toupper trace -syn keyword rFunction traceback tracemem tracingState transform transform.data.frame transform.default trigamma -syn keyword rFunction trunc truncate truncate.connection trunc.Date trunc.POSIXt try tryCatch -syn keyword rFunction typeof unclass undebug union unique unique.array unique.data.frame -syn keyword rFunction unique.default unique.matrix unique.numeric_version unique.POSIXlt units units.difftime unix -syn keyword rFunction unix.time unlink unlist unloadNamespace unlockBinding unname unserialize -syn keyword rFunction unsplit untrace untracemem unz upper.tri url UseMethod -syn keyword rFunction utf8ToInt vapply vector Vectorize Version warning warnings -syn keyword rFunction weekdays weekdays.Date weekdays.POSIXt which which.max which.min with -syn keyword rFunction withCallingHandlers with.default within within.data.frame within.list withRestarts withVisible -syn keyword rFunction write writeBin writeChar write.dcf writeLines write.table0 xor -syn keyword rFunction xor.hexmode xor.octmode xpdrows.data.frame xtfrm xtfrm.AsIs xtfrm.Date xtfrm.default -syn keyword rFunction xtfrm.difftime xtfrm.factor xtfrm.numeric_version xtfrm.POSIXct xtfrm.POSIXlt xtfrm.Surv xzfile -syn keyword rFunction zapsmall diff --git a/r-plugin/omniList b/r-plugin/omniList deleted file mode 100644 index 9bb351d..0000000 --- a/r-plugin/omniList +++ /dev/null @@ -1,2909 +0,0 @@ -acf;function;function;stats;x, lag.max = NULL, type = c("correlation", "covariance", "partial"), plot = TRUE, na.action = na.fail, demean = TRUE, ... -acf2AR;function;function;stats;acf -add1;function;function;stats;Generic Method -addmargins;function;function;stats;A, margin = seq_along(dim(A)), FUN = sum, quiet = FALSE -add.scope;function;function;stats;terms1, terms2 -aggregate;function;function;stats;x, ... -aggregate.data.frame;function;function;stats;x, by, FUN, ..., simplify = TRUE -aggregate.default;function;function;stats;x, ... -aggregate.ts;function;function;stats;x, nfrequency = 1, FUN = sum, ndeltat = 1, ts.eps = getOption("ts.eps"), ... -AIC;function;function;stats;Generic Method -alias;function;function;stats;object, ... -anova;function;function;stats;Generic Method -anova.glm;function;function;stats;object, ..., dispersion = NULL, test = NULL -anova.glmlist;function;function;stats;object, ..., dispersion = NULL, test = NULL -anovalist.lm;function;function;stats;object, ..., test = NULL -anova.lm;function;function;stats;object, ... -anova.lmlist;function;function;stats;object, ..., scale = 0, test = "F" -anova.mlm;function;function;stats;object, ..., test = c("Pillai", "Wilks", "Hotelling-Lawley", "Roy", "Spherical"), Sigma = diag(nrow = p), T = Thin.row(proj(M) - proj(X)), M = diag(nrow = p), X = ~0, idata = data.frame(index = seq_len(p)), tol = 1e-07 -ansari.test;function;function;stats;x, ... -aov;function;function;stats;formula, data = NULL, projections = FALSE, qr = TRUE, contrasts = NULL, ... -approx;function;function;stats;x, y = NULL, xout, method = "linear", n = 50, yleft, yright, rule = 1, f = 0, ties = mean -approxfun;function;function;stats;x, y = NULL, method = "linear", yleft, yright, rule = 1, f = 0, ties = mean -ar;function;function;stats;x, aic = TRUE, order.max = NULL, method = c("yule-walker", "burg", "ols", "mle", "yw"), na.action = na.fail, series = deparse(substitute(x)), ... -ar.burg;function;function;stats;x, ... -arima;function;function;stats;x, order = c(0, 0, 0), seasonal = list(order = c(0, 0, 0), period = NA), xreg = NULL, include.mean = TRUE, transform.pars = TRUE, fixed = NULL, init = NULL, method = c("CSS-ML", "ML", "CSS"), n.cond, optim.method = "BFGS", optim.control = list(), kappa = 1e+06 -arima0;function;function;stats;x, order = c(0, 0, 0), seasonal = list(order = c(0, 0, 0), period = NA), xreg = NULL, include.mean = TRUE, delta = 0.01, transform.pars = TRUE, fixed = NULL, init = NULL, method = c("ML", "CSS"), n.cond, optim.control = list() -arima0.diag;function;function;stats;... -arima.sim;function;function;stats;model, n, rand.gen = rnorm, innov = rand.gen(n, ...), n.start = NA, start.innov = rand.gen(n.start, ...), ... -ARMAacf;function;function;stats;ar = numeric(0), ma = numeric(0), lag.max = r, pacf = FALSE -ARMAtoMA;function;function;stats;ar = numeric(0), ma = numeric(0), lag.max -ar.mle;function;function;stats;x, aic = TRUE, order.max = NULL, na.action = na.fail, demean = TRUE, series = NULL, ... -ar.ols;function;function;stats;x, aic = TRUE, order.max = NULL, na.action = na.fail, demean = TRUE, intercept = demean, series = NULL, ... -ar.yw;function;function;stats;x, ... -as.dendrogram;function;function;stats;object, ... -as.dist;function;function;stats;m, diag = FALSE, upper = FALSE -as.formula;function;function;stats;object, env = parent.frame() -as.hclust;function;function;stats;x, ... -asOneSidedFormula;function;function;stats;object -as.stepfun;function;function;stats;x, ... -as.ts;function;function;stats;x, ... -ave;function;function;stats;x, ..., FUN = mean -bandwidth.kernel;function;function;stats;k -bartlett.test;function;function;stats;x, ... -binomial;function;function;stats;link = "logit" -binom.test;function;function;stats;x, n, p = 0.5, alternative = c("two.sided", "less", "greater"), conf.level = 0.95 -biplot;function;function;stats;Generic Method -Box.test;function;function;stats;x, lag = 1, type = c("Box-Pierce", "Ljung-Box"), fitdf = 0 -bw.bcv;function;function;stats;x, nb = 1000, lower = 0.1 * hmax, upper = hmax, tol = 0.1 * lower -bw.nrd;function;function;stats;x -bw.nrd0;function;function;stats;x -bw.SJ;function;function;stats;x, nb = 1000, lower = 0.1 * hmax, upper = hmax, method = c("ste", "dpi"), tol = 0.1 * lower -bw.ucv;function;function;stats;x, nb = 1000, lower = 0.1 * hmax, upper = hmax, tol = 0.1 * lower -C;function;function;stats;object, contr, how.many, ... -cancor;function;function;stats;x, y, xcenter = TRUE, ycenter = TRUE -case.names;function;function;stats;object, ... -ccf;function;function;stats;x, y, lag.max = NULL, type = c("correlation", "covariance"), plot = TRUE, na.action = na.fail, ... -.checkMFClasses;function;function;stats;cl, m, ordNotOK = FALSE -chisq.test;function;function;stats;x, y = NULL, correct = TRUE, p = rep(1/length(x), length(x)), rescale.p = FALSE, simulate.p.value = FALSE, B = 2000 -clearNames;function;function;stats;object -cmdscale;function;function;stats;d, k = 2, eig = FALSE, add = FALSE, x.ret = FALSE -coef;function;function;stats;Generic Method -coefficients;function;function;stats;object, ... -complete.cases;function;function;stats;... -confint;function;function;stats;Generic Method -confint.default;function;function;stats;object, parm, level = 0.95, ... -constrOptim;function;function;stats;theta, f, grad, ui, ci, mu = 1e-04, control = list(), method = if (is.null(grad)) "Nelder-Mead" else "BFGS", outer.iterations = 100, outer.eps = 1e-05, ..., hessian = FALSE -contrasts;function;function;stats;x, contrasts = TRUE, sparse = FALSE -contrasts<-;function;function;stats;x, how.many, value -contr.helmert;function;function;stats;n, contrasts = TRUE, sparse = FALSE -contr.poly;function;function;stats;n, scores = 1:n, contrasts = TRUE, sparse = FALSE -contr.SAS;function;function;stats;n, contrasts = TRUE, sparse = FALSE -contr.sum;function;function;stats;n, contrasts = TRUE, sparse = FALSE -contr.treatment;function;function;stats;n, base = 1, contrasts = TRUE, sparse = FALSE -convolve;function;function;stats;x, y, conj = TRUE, type = c("circular", "open", "filter") -cooks.distance;function;function;stats;model, ... -cophenetic;function;function;stats;x -cor;function;function;stats;x, y = NULL, use = "everything", method = c("pearson", "kendall", "spearman") -cor.test;function;function;stats;x, ... -cov;function;function;stats;x, y = NULL, use = "everything", method = c("pearson", "kendall", "spearman") -cov2cor;function;function;stats;V -covratio;function;function;stats;model, infl = lm.influence(model, do.coef = FALSE), res = weighted.residuals(model) -cov.wt;function;function;stats;x, wt = rep(1/nrow(x), nrow(x)), cor = FALSE, center = TRUE, method = c("unbiased", "ML") -cpgram;function;function;stats;ts, taper = 0.1, main = paste("Series: ", deparse(substitute(ts))), ci.col = "blue" -cutree;function;function;stats;tree, k = NULL, h = NULL -cycle;function;function;stats;x, ... -D;function;function;stats;expr, name -dbeta;function;function;stats;x, shape1, shape2, ncp = 0, log = FALSE -dbinom;function;function;stats;x, size, prob, log = FALSE -dcauchy;function;function;stats;x, location = 0, scale = 1, log = FALSE -dchisq;function;function;stats;x, df, ncp = 0, log = FALSE -decompose;function;function;stats;x, type = c("additive", "multiplicative"), filter = NULL -delete.response;function;function;stats;termobj -deltat;function;function;stats;x, ... -dendrapply;function;function;stats;X, FUN, ... -density;function;function;stats;x, ... -density.default;function;function;stats;x, bw = "nrd0", adjust = 1, kernel = c("gaussian", "epanechnikov", "rectangular", "triangular", "biweight", "cosine", "optcosine"), weights = NULL, window = kernel, width, give.Rkern = FALSE, n = 512, from, to, cut = 3, na.rm = FALSE, ... -deriv;function;function;stats;expr, ... -deriv3;function;function;stats;expr, ... -deriv3.default;function;function;stats;expr, namevec, function.arg = NULL, tag = ".expr", hessian = TRUE, ... -deriv3.formula;function;function;stats;expr, namevec, function.arg = NULL, tag = ".expr", hessian = TRUE, ... -deriv.default;function;function;stats;expr, namevec, function.arg = NULL, tag = ".expr", hessian = FALSE, ... -deriv.formula;function;function;stats;expr, namevec, function.arg = NULL, tag = ".expr", hessian = FALSE, ... -deviance;function;function;stats;Generic Method -dexp;function;function;stats;x, rate = 1, log = FALSE -df;function;function;stats;x, df1, df2, ncp, log = FALSE -dfbeta;function;function;stats;model, ... -dfbetas;function;function;stats;model, ... -dffits;function;function;stats;model, infl = lm.influence(model, do.coef = FALSE), res = weighted.residuals(model) -df.kernel;function;function;stats;k -df.residual;function;function;stats;Generic Method -dgamma;function;function;stats;x, shape, rate = 1, scale = 1/rate, log = FALSE -dgeom;function;function;stats;x, prob, log = FALSE -dhyper;function;function;stats;x, m, n, k, log = FALSE -diffinv;function;function;stats;x, ... -diff.ts;function;function;stats;x, lag = 1, differences = 1, ... -dist;function;function;stats;x, method = "euclidean", diag = FALSE, upper = FALSE, p = 2 -dlnorm;function;function;stats;x, meanlog = 0, sdlog = 1, log = FALSE -dlogis;function;function;stats;x, location = 0, scale = 1, log = FALSE -dmultinom;function;function;stats;x, size = NULL, prob, log = FALSE -dnbinom;function;function;stats;x, size, prob, mu, log = FALSE -dnorm;function;function;stats;x, mean = 0, sd = 1, log = FALSE -dpois;function;function;stats;x, lambda, log = FALSE -drop1;function;function;stats;Generic Method -drop.scope;function;function;stats;terms1, terms2 -drop.terms;function;function;stats;termobj, dropx = NULL, keep.response = FALSE -dsignrank;function;function;stats;x, n, log = FALSE -dt;function;function;stats;x, df, ncp, log = FALSE -dummy.coef;function;function;stats;object, ... -dunif;function;function;stats;x, min = 0, max = 1, log = FALSE -dweibull;function;function;stats;x, shape, scale = 1, log = FALSE -dwilcox;function;function;stats;x, m, n, log = FALSE -ecdf;function;function;stats;x -eff.aovlist;function;function;stats;aovlist -effects;function;function;stats;object, ... -embed;function;function;stats;x, dimension = 1 -end;function;function;stats;x, ... -estVar;function;function;stats;object, ... -expand.model.frame;function;function;stats;model, extras, envir = environment(formula(model)), na.expand = FALSE -extractAIC;function;function;stats;Generic Method -factanal;function;function;stats;x, factors, data = NULL, covmat = NULL, n.obs = NA, subset, na.action, start = NULL, scores = c("none", "regression", "Bartlett"), rotation = "varimax", control = NULL, ... -factor.scope;function;function;stats;factor, scope -family;function;function;stats;object, ... -fft;function;function;stats;z, inverse = FALSE -filter;function;function;stats;x, filter, method = c("convolution", "recursive"), sides = 2, circular = FALSE, init = NULL -fisher.test;function;function;stats;x, y = NULL, workspace = 2e+05, hybrid = FALSE, control = list(), or = 1, alternative = "two.sided", conf.int = TRUE, conf.level = 0.95, simulate.p.value = FALSE, B = 2000 -fitted;function;function;stats;Generic Method -fitted.values;function;function;stats;object, ... -fivenum;function;function;stats;x, na.rm = TRUE -fligner.test;function;function;stats;x, ... -formula;function;function;stats;Generic Method -frequency;function;function;stats;x, ... -friedman.test;function;function;stats;y, ... -ftable;function;function;stats;x, ... -Gamma;function;function;stats;link = "inverse" -gaussian;function;function;stats;link = "identity" -get_all_vars;function;function;stats;formula, data = NULL, ... -getInitial;function;function;stats;object, data, ... -.getXlevels;function;function;stats;Terms, m -glm;function;function;stats;formula, family = gaussian, data, weights, subset, na.action, start = NULL, etastart, mustart, offset, control = list(...), model = TRUE, method = "glm.fit", x = FALSE, y = TRUE, contrasts = NULL, ... -glm.control;function;function;stats;epsilon = 1e-08, maxit = 25, trace = FALSE -glm.fit;function;function;stats;x, y, weights = rep(1, nobs), start = NULL, etastart = NULL, mustart = NULL, offset = rep(0, nobs), family = gaussian(), control = list(), intercept = TRUE -glm.fit.null;function;function;stats;x, y, weights, start = NULL, etastart = NULL, mustart = NULL, offset, family = gaussian(), control = glm.control(), intercept = FALSE -hasTsp;function;function;stats;x -hat;function;function;stats;x, intercept = TRUE -hatvalues;function;function;stats;model, ... -hatvalues.lm;function;function;stats;model, infl = lm.influence(model, do.coef = FALSE), ... -hclust;function;function;stats;d, method = "complete", members = NULL -heatmap;function;function;stats;x, Rowv = NULL, Colv = if (symm) "Rowv" else NULL, distfun = dist, hclustfun = hclust, reorderfun = function(d, w) reorder(d, w), add.expr, symm = FALSE, revC = identical(Colv, "Rowv"), scale = c("row", "column", "none"), na.rm = TRUE, margins = c(5, 5), ColSideColors, RowSideColors, cexRow = 0.2 + 1/log10(nr), cexCol = 0.2 + 1/log10(nc), labRow = NULL, labCol = NULL, main = NULL, xlab = NULL, ylab = NULL, keep.dendro = FALSE, verbose = getOption("verbose"), ... -HoltWinters;function;function;stats;x, alpha = NULL, beta = NULL, gamma = NULL, seasonal = c("additive", "multiplicative"), start.periods = 2, l.start = NULL, b.start = NULL, s.start = NULL, optim.start = c(alpha = 0.3, beta = 0.1, gamma = 0.1), optim.control = list() -influence;function;function;stats;model, ... -influence.measures;function;function;stats;model -integrate;function;function;stats;f, lower, upper, ..., subdivisions = 100, rel.tol = .Machine$double.eps^0.25, abs.tol = rel.tol, stop.on.error = TRUE, keep.xy = FALSE, aux = NULL -interaction.plot;function;function;stats;x.factor, trace.factor, response, fun = mean, type = c("l", "p", "b"), legend = TRUE, trace.label = deparse(substitute(trace.factor)), fixed = FALSE, xlab = deparse(substitute(x.factor)), ylab = ylabel, ylim = range(cells, na.rm = TRUE), lty = nc:1, col = 1, pch = c(1L:9, 0, letters), xpd = NULL, leg.bg = par("bg"), leg.bty = "n", xtick = FALSE, xaxt = par("xaxt"), axes = TRUE, ... -inverse.gaussian;function;function;stats;link = "1/mu^2" -IQR;function;function;stats;x, na.rm = FALSE -is.empty.model;function;function;stats;x -is.leaf;function;function;stats;object -is.mts;function;function;stats;x -isoreg;function;function;stats;x, y = NULL -is.stepfun;function;function;stats;x -is.ts;function;function;stats;x -is.tskernel;function;function;stats;k -KalmanForecast;function;function;stats;n.ahead = 10, mod, fast = TRUE -KalmanLike;function;function;stats;y, mod, nit = 0, fast = TRUE -KalmanRun;function;function;stats;y, mod, nit = 0, fast = TRUE -KalmanSmooth;function;function;stats;y, mod, nit = 0 -kernapply;function;function;stats;x, ... -kernel;function;function;stats;coef, m = length(coef) + 1, r, name = "unknown" -kmeans;function;function;stats;x, centers, iter.max = 10, nstart = 1, algorithm = c("Hartigan-Wong", "Lloyd", "Forgy", "MacQueen") -knots;function;function;stats;Fn, ... -kruskal.test;function;function;stats;x, ... -ksmooth;function;function;stats;x, y, kernel = c("box", "normal"), bandwidth = 0.5, range.x = range(x), n.points = max(100, length(x)), x.points -ks.test;function;function;stats;x, y, ..., alternative = c("two.sided", "less", "greater"), exact = NULL -lag;function;function;stats;x, ... -lag.plot;function;function;stats;x, lags = 1, layout = NULL, set.lags = 1L:lags, main = NULL, asp = 1, diag = TRUE, diag.col = "gray", type = "p", oma = NULL, ask = NULL, do.lines = (n <= 150), labels = do.lines, ... -line;function;function;stats;x, y = NULL -lines.ts;function;function;stats;x, ... -lm;function;function;stats;formula, data, subset, weights, na.action, method = "qr", model = TRUE, x = FALSE, y = FALSE, qr = TRUE, singular.ok = TRUE, contrasts = NULL, offset, ... -lm.fit;function;function;stats;x, y, offset = NULL, method = "qr", tol = 1e-07, singular.ok = TRUE, ... -lm.fit.null;function;function;stats;x, y, method = "qr", tol = 1e-07, ... -lm.influence;function;function;stats;model, do.coef = TRUE -lm.wfit;function;function;stats;x, y, w, offset = NULL, method = "qr", tol = 1e-07, singular.ok = TRUE, ... -lm.wfit.null;function;function;stats;x, y, w, method = "qr", tol = 1e-07, ... -loadings;function;function;stats;x -loess;function;function;stats;formula, data, weights, subset, na.action, model = FALSE, span = 0.75, enp.target, degree = 2, parametric = FALSE, drop.square = FALSE, normalize = TRUE, family = c("gaussian", "symmetric"), method = c("loess", "model.frame"), control = loess.control(...), ... -loess.control;function;function;stats;surface = c("interpolate", "direct"), statistics = c("approximate", "exact"), trace.hat = c("exact", "approximate"), cell = 0.2, iterations = 4, ... -loess.smooth;function;function;stats;x, y, span = 2/3, degree = 1, family = c("symmetric", "gaussian"), evaluation = 50, ... -logLik;function;function;stats;Generic Method -loglin;function;function;stats;table, margin, start = rep(1, length(table)), fit = FALSE, eps = 0.1, iter = 20, param = FALSE, print = TRUE -lowess;function;function;stats;x, y = NULL, f = 2/3, iter = 3, delta = 0.01 * diff(range(xy$x[o])) -ls.diag;function;function;stats;ls.out -lsfit;function;function;stats;x, y, wt = NULL, intercept = TRUE, tolerance = 1e-07, yname = NULL -ls.print;function;function;stats;ls.out, digits = 4, print.it = TRUE -mad;function;function;stats;x, center = median(x), constant = 1.4826, na.rm = FALSE, low = FALSE, high = FALSE -mahalanobis;function;function;stats;x, center, cov, inverted = FALSE, ... -makeARIMA;function;function;stats;phi, theta, Delta, kappa = 1e+06 -make.link;function;function;stats;link -makepredictcall;function;function;stats;var, call -manova;function;function;stats;... -mantelhaen.test;function;function;stats;x, y = NULL, z = NULL, alternative = c("two.sided", "less", "greater"), correct = TRUE, exact = FALSE, conf.level = 0.95 -mauchley.test;function;function;stats;... -mauchly.test;function;function;stats;object, ... -mcnemar.test;function;function;stats;x, y = NULL, correct = TRUE -median;function;function;stats;x, na.rm = FALSE -median.default;function;function;stats;x, na.rm = FALSE -medpolish;function;function;stats;x, eps = 0.01, maxiter = 10, trace.iter = TRUE, na.rm = FALSE -.MFclass;function;function;stats;x -model.extract;function;function;stats;frame, component -model.frame;function;function;stats;Generic Method -model.frame.aovlist;function;function;stats;formula, data = NULL, ... -model.frame.default;function;function;stats;formula, data = NULL, subset = NULL, na.action = na.fail, drop.unused.levels = FALSE, xlev = NULL, ... -model.frame.glm;function;function;stats;formula, ... -model.frame.lm;function;function;stats;formula, ... -model.matrix;function;function;stats;Generic Method -model.matrix.default;function;function;stats;object, data = environment(object), contrasts.arg = NULL, xlev = NULL, ... -model.matrix.lm;function;function;stats;object, ... -model.offset;function;function;stats;x -model.response;function;function;stats;data, type = "any" -model.tables;function;function;stats;x, ... -model.weights;function;function;stats;x -monthplot;function;function;stats;x, ... -mood.test;function;function;stats;x, ... -mvfft;function;function;stats;z, inverse = FALSE -na.action;function;function;stats;object, ... -na.contiguous;function;function;stats;object, ... -na.exclude;function;function;stats;object, ... -na.fail;function;function;stats;object, ... -na.omit;function;function;stats;object, ... -na.pass;function;function;stats;object, ... -napredict;function;function;stats;omit, x, ... -naprint;function;function;stats;x, ... -naresid;function;function;stats;omit, x, ... -nextn;function;function;stats;n, factors = c(2, 3, 5) -nlm;function;function;stats;f, p, ..., hessian = FALSE, typsize = rep(1, length(p)), fscale = 1, print.level = 0, ndigit = 12, gradtol = 1e-06, stepmax = max(1000 * sqrt(sum((p/typsize)^2)), 1000), steptol = 1e-06, iterlim = 100, check.analyticals = TRUE -nlminb;function;function;stats;start, objective, gradient = NULL, hessian = NULL, ..., scale = 1, control = list(), lower = -Inf, upper = Inf -nls;function;function;stats;formula, data = parent.frame(), start, control = nls.control(), algorithm = c("default", "plinear", "port"), trace = FALSE, subset, weights, na.action, model = FALSE, lower = -Inf, upper = Inf, ... -nls.control;function;function;stats;maxiter = 50, tol = 1e-05, minFactor = 1/1024, printEval = FALSE, warnOnly = FALSE -NLSstAsymptotic;function;function;stats;xy -NLSstClosestX;function;function;stats;xy, yval -NLSstLfAsymptote;function;function;stats;xy -NLSstRtAsymptote;function;function;stats;xy -numericDeriv;function;function;stats;expr, theta, rho = parent.frame(), dir = 1 -offset;function;function;stats;object -oneway.test;function;function;stats;formula, data, subset, na.action, var.equal = FALSE -optim;function;function;stats;par, fn, gr = NULL, ..., method = c("Nelder-Mead", "BFGS", "CG", "L-BFGS-B", "SANN"), lower = -Inf, upper = Inf, control = list(), hessian = FALSE -optimise;function;function;stats;f, interval, ..., lower = min(interval), upper = max(interval), maximum = FALSE, tol = .Machine$double.eps^0.25 -optimize;function;function;stats;f, interval, ..., lower = min(interval), upper = max(interval), maximum = FALSE, tol = .Machine$double.eps^0.25 -order.dendrogram;function;function;stats;x -pacf;function;function;stats;x, lag.max, plot, na.action, ... -p.adjust;function;function;stats;p, method = p.adjust.methods, n = length(p) -p.adjust.methods;character;character;stats;Not a function -pairwise.prop.test;function;function;stats;x, n, p.adjust.method = p.adjust.methods, ... -pairwise.table;function;function;stats;compare.levels, level.names, p.adjust.method -pairwise.t.test;function;function;stats;x, g, p.adjust.method = p.adjust.methods, pool.sd = !paired, paired = FALSE, alternative = c("two.sided", "less", "greater"), ... -pairwise.wilcox.test;function;function;stats;x, g, p.adjust.method = p.adjust.methods, paired = FALSE, ... -pbeta;function;function;stats;q, shape1, shape2, ncp = 0, lower.tail = TRUE, log.p = FALSE -pbinom;function;function;stats;q, size, prob, lower.tail = TRUE, log.p = FALSE -pbirthday;function;function;stats;n, classes = 365, coincident = 2 -pcauchy;function;function;stats;q, location = 0, scale = 1, lower.tail = TRUE, log.p = FALSE -pchisq;function;function;stats;q, df, ncp = 0, lower.tail = TRUE, log.p = FALSE -pexp;function;function;stats;q, rate = 1, lower.tail = TRUE, log.p = FALSE -pf;function;function;stats;q, df1, df2, ncp, lower.tail = TRUE, log.p = FALSE -pgamma;function;function;stats;q, shape, rate = 1, scale = 1/rate, lower.tail = TRUE, log.p = FALSE -pgeom;function;function;stats;q, prob, lower.tail = TRUE, log.p = FALSE -phyper;function;function;stats;q, m, n, k, lower.tail = TRUE, log.p = FALSE -plclust;function;function;stats;tree, hang = 0.1, unit = FALSE, level = FALSE, hmin = 0, square = TRUE, labels = NULL, plot. = TRUE, axes = TRUE, frame.plot = FALSE, ann = TRUE, main = "", sub = NULL, xlab = NULL, ylab = "Height" -plnorm;function;function;stats;q, meanlog = 0, sdlog = 1, lower.tail = TRUE, log.p = FALSE -plogis;function;function;stats;q, location = 0, scale = 1, lower.tail = TRUE, log.p = FALSE -plot.density;function;function;stats;x, main = NULL, xlab = NULL, ylab = "Density", type = "l", zero.line = TRUE, ... -plot.ecdf;function;function;stats;x, ..., ylab = "Fn(x)", verticals = FALSE, col.01line = "gray70", pch = 19 -plot.lm;function;function;stats;x, which = c(1L:3L, 5L), caption = list("Residuals vs Fitted", "Normal Q-Q", "Scale-Location", "Cook's distance", "Residuals vs Leverage", expression("Cook's dist vs Leverage " * h[ii]/(1 - h[ii]))), panel = if (add.smooth) panel.smooth else points, sub.caption = NULL, main = "", ask = prod(par("mfcol")) < length(which) && dev.interactive(), ..., id.n = 3, labels.id = names(residuals(x)), cex.id = 0.75, qqline = TRUE, cook.levels = c(0.5, 1), add.smooth = getOption("add.smooth"), label.pos = c(4, 2), cex.caption = 1 -plot.mlm;function;function;stats;x, ... -plot.spec;function;function;stats;x, add = FALSE, ci = 0.95, log = c("yes", "dB", "no"), xlab = "frequency", ylab = NULL, type = "l", ci.col = "blue", ci.lty = 3, main = NULL, sub = NULL, plot.type = c("marginal", "coherency", "phase"), ... -plot.spec.coherency;function;function;stats;x, ci = 0.95, xlab = "frequency", ylab = "squared coherency", ylim = c(0, 1), type = "l", main = NULL, ci.col = "blue", ci.lty = 3, ... -plot.spec.phase;function;function;stats;x, ci = 0.95, xlab = "frequency", ylab = "phase", ylim = c(-pi, pi), type = "l", main = NULL, ci.col = "blue", ci.lty = 3, ... -plot.stepfun;function;function;stats;x, xval, xlim, ylim = range(c(y, Fn.kn)), xlab = "x", ylab = "f(x)", main = NULL, add = FALSE, verticals = TRUE, do.points = (n < 1000), pch = par("pch"), col = par("col"), col.points = col, cex.points = par("cex"), col.hor = col, col.vert = col, lty = par("lty"), lwd = par("lwd"), ... -plot.ts;function;function;stats;x, y = NULL, plot.type = c("multiple", "single"), xy.labels, xy.lines, panel = lines, nc, yax.flip = FALSE, mar.multi = c(0, 5.1, 0, if (yax.flip) 5.1 else 2.1), oma.multi = c(6, 0, 5, 0), axes = TRUE, ... -plot.TukeyHSD;function;function;stats;x, ... -pnbinom;function;function;stats;q, size, prob, mu, lower.tail = TRUE, log.p = FALSE -pnorm;function;function;stats;q, mean = 0, sd = 1, lower.tail = TRUE, log.p = FALSE -poisson;function;function;stats;link = "log" -poisson.test;function;function;stats;x, T = 1, r = 1, alternative = c("two.sided", "less", "greater"), conf.level = 0.95 -poly;function;function;stats;x, ..., degree = 1, coefs = NULL, raw = FALSE -polym;function;function;stats;..., degree = 1, raw = FALSE -power;function;function;stats;lambda = 1 -power.anova.test;function;function;stats;groups = NULL, n = NULL, between.var = NULL, within.var = NULL, sig.level = 0.05, power = NULL -power.prop.test;function;function;stats;n = NULL, p1 = NULL, p2 = NULL, sig.level = 0.05, power = NULL, alternative = c("two.sided", "one.sided"), strict = FALSE -power.t.test;function;function;stats;n = NULL, delta = NULL, sd = 1, sig.level = 0.05, power = NULL, type = c("two.sample", "one.sample", "paired"), alternative = c("two.sided", "one.sided"), strict = FALSE -ppoints;function;function;stats;n, a = ifelse(n <= 10, 3/8, 1/2) -ppois;function;function;stats;q, lambda, lower.tail = TRUE, log.p = FALSE -ppr;function;function;stats;x, ... -PP.test;function;function;stats;x, lshort = TRUE -prcomp;function;function;stats;x, ... -predict;function;function;stats;Generic Method -predict.glm;function;function;stats;object, newdata = NULL, type = c("link", "response", "terms"), se.fit = FALSE, dispersion = NULL, terms = NULL, na.action = na.pass, ... -predict.lm;function;function;stats;object, newdata, se.fit = FALSE, scale = NULL, df = Inf, interval = c("none", "confidence", "prediction"), level = 0.95, type = c("response", "terms"), terms = NULL, na.action = na.pass, pred.var = res.var/weights, weights = 1, ... -predict.mlm;function;function;stats;object, newdata, se.fit = FALSE, na.action = na.pass, ... -predict.poly;function;function;stats;object, newdata, ... -preplot;function;function;stats;object, ... -princomp;function;function;stats;x, ... -print.anova;function;function;stats;x, digits = max(getOption("digits") - 2, 3), signif.stars = getOption("show.signif.stars"), ... -print.coefmat;function;function;stats;x, digits = max(3, getOption("digits") - 2), signif.stars = getOption("show.signif.stars"), dig.tst = max(1, min(5, digits - 1)), cs.ind, tst.ind, zap.ind = integer(0L), P.values = NULL, has.Pvalue, eps.Pvalue = .Machine$double.eps, na.print = "", ... -printCoefmat;function;function;stats;x, digits = max(3, getOption("digits") - 2), signif.stars = getOption("show.signif.stars"), signif.legend = signif.stars, dig.tst = max(1, min(5, digits - 1)), cs.ind = 1:k, tst.ind = k + 1, zap.ind = integer(0), P.values = NULL, has.Pvalue = nc >= 4 && substr(colnames(x)[nc], 1, 3) == "Pr(", eps.Pvalue = .Machine$double.eps, na.print = "NA", ... -print.density;function;function;stats;x, digits = NULL, ... -print.family;function;function;stats;x, ... -print.formula;function;function;stats;x, showEnv = !identical(e, .GlobalEnv), ... -print.ftable;function;function;stats;x, digits = getOption("digits"), ... -print.glm;function;function;stats;x, digits = max(3, getOption("digits") - 3), ... -print.infl;function;function;stats;x, digits = max(3, getOption("digits") - 4), ... -print.integrate;function;function;stats;x, digits = getOption("digits"), ... -print.lm;function;function;stats;x, digits = max(3, getOption("digits") - 3), ... -print.logLik;function;function;stats;x, digits = getOption("digits"), ... -print.terms;function;function;stats;x, ... -print.ts;function;function;stats;x, calendar, ... -profile;function;function;stats;Generic Method -proj;function;function;stats;object, ... -promax;function;function;stats;x, m = 4 -prop.test;function;function;stats;x, n, p = NULL, alternative = c("two.sided", "less", "greater"), conf.level = 0.95, correct = TRUE -prop.trend.test;function;function;stats;x, n, score = seq_along(x) -psignrank;function;function;stats;q, n, lower.tail = TRUE, log.p = FALSE -pt;function;function;stats;q, df, ncp, lower.tail = TRUE, log.p = FALSE -ptukey;function;function;stats;q, nmeans, df, nranges = 1, lower.tail = TRUE, log.p = FALSE -punif;function;function;stats;q, min = 0, max = 1, lower.tail = TRUE, log.p = FALSE -pweibull;function;function;stats;q, shape, scale = 1, lower.tail = TRUE, log.p = FALSE -pwilcox;function;function;stats;q, m, n, lower.tail = TRUE, log.p = FALSE -qbeta;function;function;stats;p, shape1, shape2, ncp = 0, lower.tail = TRUE, log.p = FALSE -qbinom;function;function;stats;p, size, prob, lower.tail = TRUE, log.p = FALSE -qbirthday;function;function;stats;prob = 0.5, classes = 365, coincident = 2 -qcauchy;function;function;stats;p, location = 0, scale = 1, lower.tail = TRUE, log.p = FALSE -qchisq;function;function;stats;p, df, ncp = 0, lower.tail = TRUE, log.p = FALSE -qexp;function;function;stats;p, rate = 1, lower.tail = TRUE, log.p = FALSE -qf;function;function;stats;p, df1, df2, ncp, lower.tail = TRUE, log.p = FALSE -qgamma;function;function;stats;p, shape, rate = 1, scale = 1/rate, lower.tail = TRUE, log.p = FALSE -qgeom;function;function;stats;p, prob, lower.tail = TRUE, log.p = FALSE -qhyper;function;function;stats;p, m, n, k, lower.tail = TRUE, log.p = FALSE -qlnorm;function;function;stats;p, meanlog = 0, sdlog = 1, lower.tail = TRUE, log.p = FALSE -qlogis;function;function;stats;p, location = 0, scale = 1, lower.tail = TRUE, log.p = FALSE -qnbinom;function;function;stats;p, size, prob, mu, lower.tail = TRUE, log.p = FALSE -qnorm;function;function;stats;p, mean = 0, sd = 1, lower.tail = TRUE, log.p = FALSE -qpois;function;function;stats;p, lambda, lower.tail = TRUE, log.p = FALSE -qqline;function;function;stats;y, datax = FALSE, ... -qqnorm;function;function;stats;Generic Method -qqnorm.default;function;function;stats;y, ylim, main = "Normal Q-Q Plot", xlab = "Theoretical Quantiles", ylab = "Sample Quantiles", plot.it = TRUE, datax = FALSE, ... -qqplot;function;function;stats;x, y, plot.it = TRUE, xlab = deparse(substitute(x)), ylab = deparse(substitute(y)), ... -qsignrank;function;function;stats;p, n, lower.tail = TRUE, log.p = FALSE -qt;function;function;stats;p, df, ncp, lower.tail = TRUE, log.p = FALSE -qtukey;function;function;stats;p, nmeans, df, nranges = 1, lower.tail = TRUE, log.p = FALSE -quade.test;function;function;stats;y, ... -quantile;function;function;stats;x, ... -quantile.default;function;function;stats;x, probs = seq(0, 1, 0.25), na.rm = FALSE, names = TRUE, type = 7, ... -quasi;function;function;stats;link = "identity", variance = "constant" -quasibinomial;function;function;stats;link = "logit" -quasipoisson;function;function;stats;link = "log" -qunif;function;function;stats;p, min = 0, max = 1, lower.tail = TRUE, log.p = FALSE -qweibull;function;function;stats;p, shape, scale = 1, lower.tail = TRUE, log.p = FALSE -qwilcox;function;function;stats;p, m, n, lower.tail = TRUE, log.p = FALSE -r2dtable;function;function;stats;n, r, c -rbeta;function;function;stats;n, shape1, shape2, ncp = 0 -rbinom;function;function;stats;n, size, prob -rcauchy;function;function;stats;n, location = 0, scale = 1 -rchisq;function;function;stats;n, df, ncp = 0 -read.ftable;function;function;stats;file, sep = "", quote = "\"", row.var.names, col.vars, skip = 0 -rect.hclust;function;function;stats;tree, k = NULL, which = NULL, x = NULL, h = NULL, border = 2, cluster = NULL -reformulate;function;function;stats;termlabels, response = NULL -relevel;function;function;stats;x, ref, ... -reorder;function;function;stats;x, ... -replications;function;function;stats;formula, data = NULL, na.action -reshape;function;function;stats;data, varying = NULL, v.names = NULL, timevar = "time", idvar = "id", ids = 1L:NROW(data), times = seq_along(varying[[1L]]), drop = NULL, direction, new.row.names = NULL, sep = ".", split = if (sep == "") { list(regexp = "[A-Za-z][0-9]", include = TRUE) } else { list(regexp = sep, include = FALSE, fixed = TRUE) } -reshapeLong;function;function;stats;x, jvars, ilev = row.names(x), jlev = names(x)[jvars], iname = "reshape.i", jname = "reshape.j", vname = "reshape.v" -reshapeWide;function;function;stats;x, i, j, val, jnames = levels(j) -resid;function;function;stats;object, ... -residuals;function;function;stats;Generic Method -residuals.default;function;function;stats;object, ... -residuals.glm;function;function;stats;object, type = c("deviance", "pearson", "working", "response", "partial"), ... -residuals.lm;function;function;stats;object, type = c("working", "response", "deviance", "pearson", "partial"), ... -rexp;function;function;stats;n, rate = 1 -rf;function;function;stats;n, df1, df2, ncp -rgamma;function;function;stats;n, shape, rate = 1, scale = 1/rate -rgeom;function;function;stats;n, prob -rhyper;function;function;stats;nn, m, n, k -rlnorm;function;function;stats;n, meanlog = 0, sdlog = 1 -rlogis;function;function;stats;n, location = 0, scale = 1 -rmultinom;function;function;stats;n, size, prob -rnbinom;function;function;stats;n, size, prob, mu -rnorm;function;function;stats;n, mean = 0, sd = 1 -rpois;function;function;stats;n, lambda -rsignrank;function;function;stats;nn, n -rstandard;function;function;stats;model, ... -rstandard.glm;function;function;stats;model, infl = lm.influence(model, do.coef = FALSE), ... -rstandard.lm;function;function;stats;model, infl = lm.influence(model, do.coef = FALSE), sd = sqrt(deviance(model)/df.residual(model)), ... -rstudent;function;function;stats;model, ... -rstudent.glm;function;function;stats;model, infl = influence(model, do.coef = FALSE), ... -rstudent.lm;function;function;stats;model, infl = lm.influence(model, do.coef = FALSE), res = infl$wt.res, ... -rt;function;function;stats;n, df, ncp -runif;function;function;stats;n, min = 0, max = 1 -runmed;function;function;stats;x, k, endrule = c("median", "keep", "constant"), algorithm = NULL, print.level = 0 -rweibull;function;function;stats;n, shape, scale = 1 -rwilcox;function;function;stats;nn, m, n -scatter.smooth;function;function;stats;x, y = NULL, span = 2/3, degree = 1, family = c("symmetric", "gaussian"), xlab = NULL, ylab = NULL, ylim = range(y, prediction$y, na.rm = TRUE), evaluation = 50, ... -screeplot;function;function;stats;x, ... -sd;function;function;stats;x, na.rm = FALSE -se.contrast;function;function;stats;Generic Method -selfStart;function;function;stats;model, initial, parameters, template -setNames;function;function;stats;object, nm -shapiro.test;function;function;stats;x -simulate;function;function;stats;object, nsim = 1, seed = NULL, ... -smooth;function;function;stats;x, kind = c("3RS3R", "3RSS", "3RSR", "3R", "3", "S"), twiceit = FALSE, endrule = "Tukey", do.ends = FALSE -smoothEnds;function;function;stats;y, k = 3 -smooth.spline;function;function;stats;x, y = NULL, w = NULL, df, spar = NULL, cv = FALSE, all.knots = FALSE, nknots = NULL, keep.data = TRUE, df.offset = 0, penalty = 1, control.spar = list() -sortedXyData;function;function;stats;x, y, data -spec.ar;function;function;stats;x, n.freq, order = NULL, plot = TRUE, na.action = na.fail, method = "yule-walker", ... -spec.pgram;function;function;stats;x, spans = NULL, kernel = NULL, taper = 0.1, pad = 0, fast = TRUE, demean = FALSE, detrend = TRUE, plot = TRUE, na.action = na.fail, ... -spec.taper;function;function;stats;x, p = 0.1 -spectrum;function;function;stats;x, ..., method = c("pgram", "ar") -spline;function;function;stats;x, y = NULL, n = 3 * length(x), method = "fmm", xmin = min(x), xmax = max(x), xout, ties = mean -splinefun;function;function;stats;x, y = NULL, method = c("fmm", "periodic", "natural", "monoH.FC"), ties = mean -splinefunH;function;function;stats;x, y, m -SSasymp;function;function;stats;input, Asym, R0, lrc -SSasympOff;function;function;stats;input, Asym, lrc, c0 -SSasympOrig;function;function;stats;input, Asym, lrc -SSbiexp;function;function;stats;input, A1, lrc1, A2, lrc2 -SSD;function;function;stats;object, ... -SSfol;function;function;stats;Dose, input, lKe, lKa, lCl -SSfpl;function;function;stats;input, A, B, xmid, scal -SSgompertz;function;function;stats;x, Asym, b2, b3 -SSlogis;function;function;stats;input, Asym, xmid, scal -SSmicmen;function;function;stats;input, Vm, K -SSweibull;function;function;stats;x, Asym, Drop, lrc, pwr -start;function;function;stats;x, ... -stat.anova;function;function;stats;table, test = c("Chisq", "F", "Cp"), scale, df.scale, n -step;function;function;stats;object, scope, scale = 0, direction = c("both", "backward", "forward"), trace = 1, keep = NULL, steps = 1000, k = 2, ... -stepfun;function;function;stats;x, y, f = as.numeric(right), ties = "ordered", right = FALSE -stl;function;function;stats;x, s.window, s.degree = 0, t.window = NULL, t.degree = 1, l.window = nextodd(period), l.degree = t.degree, s.jump = ceiling(s.window/10), t.jump = ceiling(t.window/10), l.jump = ceiling(l.window/10), robust = FALSE, inner = if (robust) 1 else 2, outer = if (robust) 15 else 0, na.action = na.fail -StructTS;function;function;stats;x, type = c("level", "trend", "BSM"), init = NULL, fixed = NULL, optim.control = NULL -summary.aov;function;function;stats;object, intercept = FALSE, split, expand.split = TRUE, keep.zero.df = TRUE, ... -summary.aovlist;function;function;stats;object, ... -summary.glm;function;function;stats;object, dispersion = NULL, correlation = FALSE, symbolic.cor = FALSE, ... -summary.infl;function;function;stats;object, digits = max(2, getOption("digits") - 5), ... -summary.lm;function;function;stats;object, correlation = FALSE, symbolic.cor = FALSE, ... -summary.manova;function;function;stats;object, test = c("Pillai", "Wilks", "Hotelling-Lawley", "Roy"), intercept = FALSE, tol = 1e-07, ... -summary.mlm;function;function;stats;object, ... -summary.stepfun;function;function;stats;object, ... -supsmu;function;function;stats;x, y, wt = rep(1, n), span = "cv", periodic = FALSE, bass = 0 -symnum;function;function;stats;x, cutpoints = c(0.3, 0.6, 0.8, 0.9, 0.95), symbols = if (numeric.x) c(" ", ".", ",", "+", "*", "B") else c(".", "|"), legend = length(symbols) >= 3, na = "?", eps = 1e-05, numeric.x = is.numeric(x), corr = missing(cutpoints) && numeric.x, show.max = if (corr) "1", show.min = NULL, abbr.colnames = has.colnames, lower.triangular = corr && is.numeric(x) && is.matrix(x), diag.lower.tri = corr && !is.null(show.max) -termplot;function;function;stats;model, data = NULL, envir = environment(formula(model)), partial.resid = FALSE, rug = FALSE, terms = NULL, se = FALSE, xlabs = NULL, ylabs = NULL, main = NULL, col.term = 2, lwd.term = 1.5, col.se = "orange", lty.se = 2, lwd.se = 1, col.res = "gray", cex = 1, pch = par("pch"), col.smth = "darkred", lty.smth = 2, span.smth = 2/3, ask = dev.interactive() && nb.fig < n.tms, use.factor.levels = TRUE, smooth = NULL, ylim = "common", ... -terms;function;function;stats;Generic Method -terms.aovlist;function;function;stats;x, ... -terms.default;function;function;stats;x, ... -terms.formula;function;function;stats;x, specials = NULL, abb = NULL, data = NULL, neg.out = TRUE, keep.order = FALSE, simplify = FALSE, ..., allowDotAsName = FALSE -terms.terms;function;function;stats;x, ... -time;function;function;stats;x, ... -toeplitz;function;function;stats;x -ts;function;function;stats;data = NA, start = 1, end = numeric(0), frequency = 1, deltat = 1, ts.eps = getOption("ts.eps"), class = if (nseries > 1) c("mts", "ts") else "ts", names = if (!is.null(dimnames(data))) colnames(data) else paste("Series", seq(nseries)) -tsdiag;function;function;stats;object, gof.lag, ... -ts.intersect;function;function;stats;..., dframe = FALSE -tsp;function;function;stats;x -tsp<-;function;function;stats;x, value -ts.plot;function;function;stats;..., gpars = list() -tsSmooth;function;function;stats;object, ... -ts.union;function;function;stats;..., dframe = FALSE -t.test;function;function;stats;x, ... -TukeyHSD;function;function;stats;x, which, ordered = FALSE, conf.level = 0.95, ... -TukeyHSD.aov;function;function;stats;x, which = seq_along(tabs), ordered = FALSE, conf.level = 0.95, ... -uniroot;function;function;stats;f, interval, ..., lower = min(interval), upper = max(interval), f.lower = f(lower, ...), f.upper = f(upper, ...), tol = .Machine$double.eps^0.25, maxiter = 1000 -update;function;function;stats;Generic Method -update.default;function;function;stats;object, formula., ..., evaluate = TRUE -update.formula;function;function;stats;old, new, ... -var;function;function;stats;x, y = NULL, na.rm = FALSE, use -variable.names;function;function;stats;object, ... -varimax;function;function;stats;x, normalize = TRUE, eps = 1e-05 -var.test;function;function;stats;x, ... -vcov;function;function;stats;Generic Method -weighted.mean;function;function;stats;x, w, ... -weighted.residuals;function;function;stats;obj, drop0 = TRUE -weights;function;function;stats;object, ... -wilcox.test;function;function;stats;x, ... -window;function;function;stats;x, ... -window<-;function;function;stats;x, ..., value -write.ftable;function;function;stats;x, file = "", quote = TRUE, append = FALSE, digits = getOption("digits") -xtabs;function;function;stats;formula = ~., data = parent.frame(), subset, sparse = FALSE, na.action, exclude = c(NA, NaN), drop.unused.levels = FALSE -abline;function;function;graphics;a = NULL, b = NULL, h = NULL, v = NULL, reg = NULL, coef = NULL, untf = FALSE, ... -arrows;function;function;graphics;x0, y0, x1 = x0, y1 = y0, length = 0.25, angle = 30, code = 2, col = par("fg"), lty = par("lty"), lwd = par("lwd"), ... -assocplot;function;function;graphics;x, col = c("black", "red"), space = 0.3, main = NULL, xlab = NULL, ylab = NULL -axis;function;function;graphics;side, at = NULL, labels = TRUE, tick = TRUE, line = NA, pos = NA, outer = FALSE, font = NA, lty = "solid", lwd = 1, lwd.ticks = lwd, col = NULL, col.ticks = NULL, hadj = NA, padj = NA, ... -Axis;function;function;graphics;x = NULL, at = NULL, ..., side, labels = NULL -axis.Date;function;function;graphics;side, x, at, format, labels = TRUE, ... -axis.POSIXct;function;function;graphics;side, x, at, format, labels = TRUE, ... -axTicks;function;function;graphics;side, axp = NULL, usr = NULL, log = NULL -barplot;function;function;graphics;height, ... -barplot.default;function;function;graphics;height, width = 1, space = NULL, names.arg = NULL, legend.text = NULL, beside = FALSE, horiz = FALSE, density = NULL, angle = 45, col = NULL, border = par("fg"), main = NULL, sub = NULL, xlab = NULL, ylab = NULL, xlim = NULL, ylim = NULL, xpd = TRUE, log = "", axes = TRUE, axisnames = TRUE, cex.axis = par("cex.axis"), cex.names = par("cex.axis"), inside = TRUE, plot = TRUE, axis.lty = 0, offset = 0, add = FALSE, args.legend = NULL, ... -box;function;function;graphics;which = "plot", lty = "solid", ... -boxplot;function;function;graphics;x, ... -boxplot.default;function;function;graphics;x, ..., range = 1.5, width = NULL, varwidth = FALSE, notch = FALSE, outline = TRUE, names, plot = TRUE, border = par("fg"), col = NULL, log = "", pars = list(boxwex = 0.8, staplewex = 0.5, outwex = 0.5), horizontal = FALSE, add = FALSE, at = NULL -boxplot.matrix;function;function;graphics;x, use.cols = TRUE, ... -bxp;function;function;graphics;z, notch = FALSE, width = NULL, varwidth = FALSE, outline = TRUE, notch.frac = 0.5, log = "", border = par("fg"), pars = NULL, frame.plot = axes, horizontal = FALSE, add = FALSE, at = NULL, show.names = NULL, ... -cdplot;function;function;graphics;x, ... -clip;function;function;graphics;x1, x2, y1, y2 -close.screen;function;function;graphics;n, all.screens = FALSE -co.intervals;function;function;graphics;x, number = 6, overlap = 0.5 -contour;function;function;graphics;Generic Method -contour.default;function;function;graphics;x = seq(0, 1, length.out = nrow(z)), y = seq(0, 1, length.out = ncol(z)), z, nlevels = 10, levels = pretty(zlim, nlevels), labels = NULL, xlim = range(x, finite = TRUE), ylim = range(y, finite = TRUE), zlim = range(z, finite = TRUE), labcex = 0.6, drawlabels = TRUE, method = "flattest", vfont, axes = TRUE, frame.plot = axes, col = par("fg"), lty = par("lty"), lwd = par("lwd"), add = FALSE, ... -coplot;function;function;graphics;formula, data, given.values, panel = points, rows, columns, show.given = TRUE, col = par("fg"), pch = par("pch"), bar.bg = c(num = gray(0.8), fac = gray(0.95)), xlab = c(x.name, paste("Given :", a.name)), ylab = c(y.name, paste("Given :", b.name)), subscripts = FALSE, axlabels = function(f) abbreviate(levels(f)), number = 6, overlap = 0.5, xlim, ylim, ... -curve;function;function;graphics;expr, from = NULL, to = NULL, n = 101, add = FALSE, type = "l", ylab = NULL, log = NULL, xlim = NULL, ... -dotchart;function;function;graphics;x, labels = NULL, groups = NULL, gdata = NULL, cex = par("cex"), pch = 21, gpch = 21, bg = par("bg"), color = par("fg"), gcolor = par("fg"), lcolor = "gray", xlim = range(x[is.finite(x)]), main = NULL, xlab = NULL, ylab = NULL, ... -erase.screen;function;function;graphics;n = cur.screen -filled.contour;function;function;graphics;x = seq(0, 1, length.out = nrow(z)), y = seq(0, 1, length.out = ncol(z)), z, xlim = range(x, finite = TRUE), ylim = range(y, finite = TRUE), zlim = range(z, finite = TRUE), levels = pretty(zlim, nlevels), nlevels = 20, color.palette = cm.colors, col = color.palette(length(levels) - 1), plot.title, plot.axes, key.title, key.axes, asp = NA, xaxs = "i", yaxs = "i", las = 1, axes = TRUE, frame.plot = axes, ... -fourfoldplot;function;function;graphics;x, color = c("#99CCFF", "#6699CC"), conf.level = 0.95, std = c("margins", "ind.max", "all.max"), margin = c(1, 2), space = 0.2, main = NULL, mfrow = NULL, mfcol = NULL -frame;function;function;graphics;No arguments -grconvertX;function;function;graphics;x, from = "user", to = "user" -grconvertY;function;function;graphics;y, from = "user", to = "user" -grid;function;function;graphics;nx = NULL, ny = nx, col = "lightgray", lty = "dotted", lwd = par("lwd"), equilogs = TRUE -hist;function;function;graphics;Generic Method -hist.default;function;function;graphics;x, breaks = "Sturges", freq = NULL, probability = !freq, include.lowest = TRUE, right = TRUE, density = NULL, angle = 45, col = NULL, border = NULL, main = paste("Histogram of", xname), xlim = range(breaks), ylim = NULL, xlab = xname, ylab, axes = TRUE, plot = TRUE, labels = FALSE, nclass = NULL, warn.unused = TRUE, ... -identify;function;function;graphics;Generic Method -image;function;function;graphics;Generic Method -image.default;function;function;graphics;x = seq(0, 1, length.out = nrow(z)), y = seq(0, 1, length.out = ncol(z)), z, zlim = range(z[is.finite(z)]), xlim = range(x), ylim = range(y), col = heat.colors(12), add = FALSE, xaxs = "i", yaxs = "i", xlab, ylab, breaks, oldstyle = FALSE, ... -layout;function;function;graphics;mat, widths = rep(1, ncol(mat)), heights = rep(1, nrow(mat)), respect = FALSE -layout.show;function;function;graphics;n = 1 -lcm;function;function;graphics;x -legend;function;function;graphics;x, y = NULL, legend, fill = NULL, col = par("col"), border = "black", lty, lwd, pch, angle = 45, density = NULL, bty = "o", bg = par("bg"), box.lwd = par("lwd"), box.lty = par("lty"), box.col = par("fg"), pt.bg = NA, cex = 1, pt.cex = cex, pt.lwd = lwd, xjust = 0, yjust = 1, x.intersp = 1, y.intersp = 1, adj = c(0, 0.5), text.width = NULL, text.col = par("col"), merge = do.lines && has.pch, trace = FALSE, plot = TRUE, ncol = 1, horiz = FALSE, title = NULL, inset = 0, xpd, title.col = text.col, title.adj = 0.5, seg.len = 2 -lines;function;function;graphics;Generic Method -lines.default;function;function;graphics;x, y = NULL, type = "l", ... -locator;function;function;graphics;n = 512, type = "n", ... -matlines;function;function;graphics;x, y, type = "l", lty = 1:5, lwd = 1, pch = NULL, col = 1:6, ... -matplot;function;function;graphics;x, y, type = "p", lty = 1:5, lwd = 1, lend = par("lend"), pch = NULL, col = 1:6, cex = NULL, bg = NA, xlab = NULL, ylab = NULL, xlim = NULL, ylim = NULL, ..., add = FALSE, verbose = getOption("verbose") -matpoints;function;function;graphics;x, y, type = "p", lty = 1:5, lwd = 1, pch = NULL, col = 1:6, ... -mosaicplot;function;function;graphics;x, ... -mtext;function;function;graphics;text, side = 3, line = 0, outer = FALSE, at = NA, adj = NA, padj = NA, cex = NA, col = NA, font = NA, ... -pairs;function;function;graphics;Generic Method -pairs.default;function;function;graphics;x, labels, panel = points, ..., lower.panel = panel, upper.panel = panel, diag.panel = NULL, text.panel = textPanel, label.pos = 0.5 + has.diag/3, cex.labels = NULL, font.labels = 1, row1attop = TRUE, gap = 1 -panel.smooth;function;function;graphics;x, y, col = par("col"), bg = NA, pch = par("pch"), cex = 1, col.smooth = "red", span = 2/3, iter = 3, ... -par;function;function;graphics;..., no.readonly = FALSE -persp;function;function;graphics;x, ... -pie;function;function;graphics;x, labels = names(x), edges = 200, radius = 0.8, clockwise = FALSE, init.angle = if (clockwise) 90 else 0, density = NULL, angle = 45, col = NULL, border = NULL, lty = NULL, main = NULL, ... -piechart;function;function;graphics;x, labels = names(x), edges = 200, radius = 0.8, density = NULL, angle = 45, col = NULL, main = NULL, ... -plot;function;function;graphics;Generic Method -plot.default;function;function;graphics;x, y = NULL, type = "p", xlim = NULL, ylim = NULL, log = "", main = NULL, sub = NULL, xlab = NULL, ylab = NULL, ann = par("ann"), axes = TRUE, frame.plot = axes, panel.first = NULL, panel.last = NULL, asp = NA, ... -plot.design;function;function;graphics;x, y = NULL, fun = mean, data = NULL, ..., ylim = NULL, xlab = "Factors", ylab = NULL, main = NULL, ask = NULL, xaxt = par("xaxt"), axes = TRUE, xtick = FALSE -plot.new;function;function;graphics;No arguments -plot.window;function;function;graphics;xlim, ylim, log = "", asp = NA, ... -plot.xy;function;function;graphics;xy, type, pch = par("pch"), lty = par("lty"), col = par("col"), bg = NA, cex = 1, lwd = par("lwd"), ... -points;function;function;graphics;Generic Method -points.default;function;function;graphics;x, y = NULL, type = "p", ... -polygon;function;function;graphics;x, y = NULL, density = NULL, angle = 45, border = NULL, col = NA, lty = par("lty"), ..., fillOddEven = FALSE -polypath;function;function;graphics;x, y = NULL, border = NULL, col = NA, lty = par("lty"), rule = "winding", ... -rasterImage;function;function;graphics;image, xleft, ybottom, xright, ytop, angle = 0, interpolate = TRUE, ... -rect;function;function;graphics;xleft, ybottom, xright, ytop, density = NULL, angle = 45, col = NA, border = NULL, lty = par("lty"), lwd = par("lwd"), ... -rug;function;function;graphics;x, ticksize = 0.03, side = 1, lwd = 0.5, col = par("fg"), quiet = getOption("warn") < 0, ... -screen;function;function;graphics;n = cur.screen, new = TRUE -segments;function;function;graphics;x0, y0, x1 = x0, y1 = y0, col = par("fg"), lty = par("lty"), lwd = par("lwd"), ... -smoothScatter;function;function;graphics;x, y = NULL, nbin = 128, bandwidth, colramp = colorRampPalette(c("white", blues9)), nrpoints = 100, pch = ".", cex = 1, col = "black", transformation = function(x) x^0.25, postPlotHook = box, xlab = NULL, ylab = NULL, xlim, ylim, xaxs = par("xaxs"), yaxs = par("yaxs"), ... -spineplot;function;function;graphics;x, ... -split.screen;function;function;graphics;figs, screen, erase = TRUE -stars;function;function;graphics;x, full = TRUE, scale = TRUE, radius = TRUE, labels = dimnames(x)[[1L]], locations = NULL, nrow = NULL, ncol = NULL, len = 1, key.loc = NULL, key.labels = dimnames(x)[[2L]], key.xpd = TRUE, xlim = NULL, ylim = NULL, flip.labels = NULL, draw.segments = FALSE, col.segments = 1L:n.seg, col.stars = NA, axes = FALSE, frame.plot = axes, main = NULL, sub = NULL, xlab = "", ylab = "", cex = 0.8, lwd = 0.25, lty = par("lty"), xpd = FALSE, mar = pmin(par("mar"), 1.1 + c(2 * axes + (xlab != ""), 2 * axes + (ylab != ""), 1, 0)), add = FALSE, plot = TRUE, ... -stem;function;function;graphics;x, scale = 1, width = 80, atom = 1e-08 -strheight;function;function;graphics;s, units = "user", cex = NULL, font = NULL, vfont = NULL, ... -stripchart;function;function;graphics;x, ... -strwidth;function;function;graphics;s, units = "user", cex = NULL, font = NULL, vfont = NULL, ... -sunflowerplot;function;function;graphics;x, y = NULL, number, log = "", digits = 6, xlab = NULL, ylab = NULL, xlim = NULL, ylim = NULL, add = FALSE, rotate = FALSE, pch = 16, cex = 0.8, cex.fact = 1.5, col = par("col"), bg = NA, size = 1/8, seg.col = 2, seg.lwd = 1.5, ... -symbols;function;function;graphics;x, y = NULL, circles, squares, rectangles, stars, thermometers, boxplots, inches = TRUE, add = FALSE, fg = par("col"), bg = NA, xlab = NULL, ylab = NULL, main = NULL, xlim = NULL, ylim = NULL, ... -text;function;function;graphics;Generic Method -text.default;function;function;graphics;x, y = NULL, labels = seq_along(x), adj = NULL, pos = NULL, offset = 0.5, vfont = NULL, cex = 1, col = NULL, font = NULL, ... -title;function;function;graphics;main = NULL, sub = NULL, xlab = NULL, ylab = NULL, line = NA, outer = FALSE, ... -xinch;function;function;graphics;x = 1, warn.log = TRUE -xspline;function;function;graphics;x, y = NULL, shape = 0, open = TRUE, repEnds = TRUE, draw = TRUE, border = par("fg"), col = NA, ... -xyinch;function;function;graphics;xy = 1, warn.log = TRUE -yinch;function;function;graphics;y = 1, warn.log = TRUE -adjustcolor;function;function;grDevices;col, alpha.f = 1, red.f = 1, green.f = 1, blue.f = 1, offset = c(0, 0, 0, 0), transform = diag(c(red.f, green.f, blue.f, alpha.f)) -as.graphicsAnnot;function;function;grDevices;x -as.raster;function;function;grDevices;x, ... -bitmap;function;function;grDevices;file, type = "png16m", height = 7, width = 7, res = 72, units = "in", pointsize, taa = NA, gaa = NA, ... -blues9;character;character;grDevices;Not a function -bmp;function;function;grDevices;filename = "Rplot%03d.bmp", width = 480, height = 480, units = "px", pointsize = 12, bg = "white", res = NA, ..., type = c("cairo", "Xlib", "quartz"), antialias -boxplot.stats;function;function;grDevices;x, coef = 1.5, do.conf = TRUE, do.out = TRUE -cairo_pdf;function;function;grDevices;filename = if (onefile) "Rplots.pdf" else "Rplot%03d.pdf", width = 7, height = 7, pointsize = 12, onefile = FALSE, bg = "white", antialias = c("default", "none", "gray", "subpixel") -cairo_ps;function;function;grDevices;filename = if (onefile) "Rplots.ps" else "Rplot%03d.ps", width = 7, height = 7, pointsize = 12, onefile = FALSE, bg = "white", antialias = c("default", "none", "gray", "subpixel") -check.options;function;function;grDevices;new, name.opt, reset = FALSE, assign.opt = FALSE, envir = .GlobalEnv, check.attributes = c("mode", "length"), override.check = FALSE -chull;function;function;grDevices;x, y = NULL -CIDFont;function;function;grDevices;family, cmap, cmapEncoding, pdfresource = "" -cm;function;function;grDevices;x -cm.colors;function;function;grDevices;n, alpha = 1 -col2rgb;function;function;grDevices;col, alpha = FALSE -colorConverter;function;function;grDevices;toXYZ, fromXYZ, name, white = NULL -colorRamp;function;function;grDevices;colors, bias = 1, space = c("rgb", "Lab"), interpolate = c("linear", "spline") -colorRampPalette;function;function;grDevices;colors, ... -colors;function;function;grDevices;No arguments -colorspaces;list;list;grDevices;Not a function -colorspaces$XYZ;colorConverter; ;grDevices;Not a function -colorspaces$Apple RGB;unknown; ;grDevices;Not a function -colorspaces$sRGB;RGBcolorConverter; ;grDevices;Not a function -colorspaces$CIE RGB;unknown; ;grDevices;Not a function -colorspaces$Lab;colorConverter; ;grDevices;Not a function -colorspaces$Luv;colorConverter; ;grDevices;Not a function -colours;function;function;grDevices;No arguments -contourLines;function;function;grDevices;x = seq(0, 1, length.out = nrow(z)), y = seq(0, 1, length.out = ncol(z)), z, nlevels = 10, levels = pretty(range(z, na.rm = TRUE), nlevels) -convertColor;function;function;grDevices;color, from, to, from.ref.white = NULL, to.ref.white = NULL, scale.in = 1, scale.out = 1, clip = TRUE -densCols;function;function;grDevices;x, y = NULL, nbin = 128, bandwidth, colramp = colorRampPalette(blues9[-(1:3)]) -dev2bitmap;function;function;grDevices;file, type = "png16m", height = 7, width = 7, res = 72, units = "in", pointsize, ..., method = c("postscript", "pdf"), taa = NA, gaa = NA -devAskNewPage;function;function;grDevices;ask = NULL -dev.control;function;function;grDevices;displaylist = c("inhibit", "enable") -dev.copy;function;function;grDevices;device, ..., which = dev.next() -dev.copy2eps;function;function;grDevices;... -dev.copy2pdf;function;function;grDevices;..., out.type = "pdf" -dev.cur;function;function;grDevices;No arguments -deviceIsInteractive;function;function;grDevices;name = NULL -dev.interactive;function;function;grDevices;orNone = FALSE -dev.list;function;function;grDevices;No arguments -dev.new;function;function;grDevices;... -dev.next;function;function;grDevices;which = dev.cur() -dev.off;function;function;grDevices;which = dev.cur() -dev.prev;function;function;grDevices;which = dev.cur() -dev.print;function;function;grDevices;device = postscript, ... -dev.set;function;function;grDevices;which = dev.next() -dev.size;function;function;grDevices;units = c("in", "cm", "px") -embedFonts;function;function;grDevices;file, format, outfile = file, fontpaths = "", options = "" -extendrange;function;function;grDevices;x, r = range(x, na.rm = TRUE), f = 0.05 -getGraphicsEvent;function;function;grDevices;prompt = "Waiting for input", onMouseDown = NULL, onMouseMove = NULL, onMouseUp = NULL, onKeybd = NULL, consolePrompt = prompt -getGraphicsEventEnv;function;function;grDevices;which = dev.cur() -graphics.off;function;function;grDevices;No arguments -gray;function;function;grDevices;level -gray.colors;function;function;grDevices;n, start = 0.3, end = 0.9, gamma = 2.2 -grey;function;function;grDevices;level -grey.colors;function;function;grDevices;n, start = 0.3, end = 0.9, gamma = 2.2 -hcl;function;function;grDevices;h = 0, c = 35, l = 85, alpha = 1, fixup = TRUE -heat.colors;function;function;grDevices;n, alpha = 1 -Hershey;list;list;grDevices;Not a function -Hershey$typeface;character;character;grDevices;Not a function -Hershey$fontindex;character;character;grDevices;Not a function -Hershey$allowed;matrix;numeric;grDevices;Not a function -hsv;function;function;grDevices;h = 1, s = 1, v = 1, gamma = 1, alpha = 1 -is.raster;function;function;grDevices;x -jpeg;function;function;grDevices;filename = "Rplot%03d.jpeg", width = 480, height = 480, units = "px", pointsize = 12, quality = 75, bg = "white", res = NA, ..., type = c("cairo", "Xlib", "quartz"), antialias -make.rgb;function;function;grDevices;red, green, blue, name = NULL, white = "D65", gamma = 2.2 -n2mfrow;function;function;grDevices;nr.plots -nclass.FD;function;function;grDevices;x -nclass.scott;function;function;grDevices;x -nclass.Sturges;function;function;grDevices;x -palette;function;function;grDevices;value -pdf;function;function;grDevices;file = ifelse(onefile, "Rplots.pdf", "Rplot%03d.pdf"), width, height, onefile, family, title, fonts, version, paper, encoding, bg, fg, pointsize, pagecentre, colormodel, useDingbats, useKerning, fillOddEven, maxRasters -pdfFonts;function;function;grDevices;... -pdf.options;function;function;grDevices;..., reset = FALSE -pictex;function;function;grDevices;file = "Rplots.tex", width = 5, height = 4, debug = FALSE, bg = "white", fg = "black" -png;function;function;grDevices;filename = "Rplot%03d.png", width = 480, height = 480, units = "px", pointsize = 12, bg = "white", res = NA, ..., type = c("cairo", "Xlib", "quartz"), antialias -postscript;function;function;grDevices;file = ifelse(onefile, "Rplots.ps", "Rplot%03d.ps"), onefile, family, title, fonts, encoding, bg, fg, width, height, horizontal, pointsize, paper, pagecentre, print.it, command, colormodel, useKerning, fillOddEven -postscriptFont;function;function;grDevices;family, metrics, encoding = "default" -postscriptFonts;function;function;grDevices;... -ps.options;function;function;grDevices;..., reset = FALSE, override.check = FALSE -quartz;function;function;grDevices;title, width, height, pointsize, family, fontsmooth, antialias, type, file = NULL, bg, canvas, dpi -quartzFont;function;function;grDevices;family -quartzFonts;function;function;grDevices;... -quartz.options;function;function;grDevices;..., reset = FALSE -rainbow;function;function;grDevices;n, s = 1, v = 1, start = 0, end = max(1, n - 1)/n, gamma = 1, alpha = 1 -recordGraphics;function;function;grDevices;expr, list, env -recordPlot;function;function;grDevices;No arguments -replayPlot;function;function;grDevices;x -rgb;function;function;grDevices;red, green, blue, alpha, names = NULL, maxColorValue = 1 -rgb2hsv;function;function;grDevices;r, g = NULL, b = NULL, gamma = 1, maxColorValue = 255 -savePlot;function;function;grDevices;filename = paste("Rplot", type, sep = "."), type = c("png", "jpeg", "tiff", "bmp"), device = dev.cur() -setEPS;function;function;grDevices;... -setGraphicsEventEnv;function;function;grDevices;which = dev.cur(), env -setGraphicsEventHandlers;function;function;grDevices;which = dev.cur(), ... -setPS;function;function;grDevices;... -svg;function;function;grDevices;filename = if (onefile) "Rplots.svg" else "Rplot%03d.svg", width = 7, height = 7, pointsize = 12, onefile = FALSE, bg = "white", antialias = c("default", "none", "gray", "subpixel") -terrain.colors;function;function;grDevices;n, alpha = 1 -tiff;function;function;grDevices;filename = "Rplot%03d.tiff", width = 480, height = 480, units = "px", pointsize = 12, compression = c("none", "rle", "lzw", "jpeg", "zip"), bg = "white", res = NA, ..., type = c("cairo", "Xlib", "quartz"), antialias -topo.colors;function;function;grDevices;n, alpha = 1 -trans3d;function;function;grDevices;x, y, z, pmat -Type1Font;function;function;grDevices;family, metrics, encoding = "default" -x11;function;function;grDevices;display = "", width, height, pointsize, gamma, bg, canvas, fonts, xpos, ypos, title, type, antialias -X11;function;function;grDevices;display = "", width, height, pointsize, gamma, bg, canvas, fonts, xpos, ypos, title, type, antialias -X11Font;function;function;grDevices;font -X11Fonts;function;function;grDevices;... -X11.options;function;function;grDevices;..., reset = FALSE -xfig;function;function;grDevices;file = ifelse(onefile, "Rplots.fig", "Rplot%03d.fig"), onefile = FALSE, encoding = "none", paper = "default", horizontal = TRUE, width = 0, height = 0, family = "Helvetica", pointsize = 12, bg = "transparent", fg = "black", pagecentre = TRUE, defaultfont = FALSE, textspecial = FALSE -xy.coords;function;function;grDevices;x, y = NULL, xlab = NULL, ylab = NULL, log = NULL, recycle = FALSE -xyTable;function;function;grDevices;x, y = NULL, digits -xyz.coords;function;function;grDevices;x, y = NULL, z = NULL, xlab = NULL, ylab = NULL, zlab = NULL, log = NULL, recycle = FALSE -?;function;function;utils;e1, e2 -alarm;function;function;utils;No arguments -apropos;function;function;utils;what, where = FALSE, ignore.case = TRUE, mode = "any" -argsAnywhere;function;function;utils;x -aspell;function;function;utils;files, filter, control = list(), encoding = "unknown", program = NULL -aspell_package_Rd_files;function;function;utils;dir, drop = "\\references", control = list(), program = NULL -aspell_package_vignettes;function;function;utils;dir, control = list(), program = NULL -aspell_write_personal_dictionary_file;function;function;utils;x, out, language = "en", program = NULL -as.person;function;function;utils;x -as.personList;function;function;utils;x -as.relistable;function;function;utils;x -as.roman;function;function;utils;x -assignInNamespace;function;function;utils;x, value, ns, pos = -1, envir = as.environment(pos) -available.packages;function;function;utils;contriburl = contrib.url(getOption("repos"), type), method, fields = NULL, type = getOption("pkgType"), filters = NULL -bibentry;function;function;utils;bibtype, textVersion = NULL, header = NULL, footer = NULL, key = NULL, ..., other = list(), mheader = NULL, mfooter = NULL -browseEnv;function;function;utils;envir = .GlobalEnv, pattern, excludepatt = "^last\\.warning", html = .Platform$OS.type != "mac", expanded = TRUE, properties = NULL, main = NULL, debugMe = FALSE -browseURL;function;function;utils;url, browser = getOption("browser"), encodeIfNeeded = FALSE -browseVignettes;function;function;utils;package = NULL, lib.loc = NULL, all = TRUE -bug.report;function;function;utils;subject = "", ccaddress = Sys.getenv("USER"), method = getOption("mailer"), address = "r-bugs@r-project.org", file = "R.bug.report", package = NULL, lib.loc = NULL -capture.output;function;function;utils;..., file = NULL, append = FALSE -checkCRAN;function;function;utils;method -chooseBioCmirror;function;function;utils;graphics = getOption("menu.graphics") -chooseCRANmirror;function;function;utils;graphics = getOption("menu.graphics") -citation;function;function;utils;package = "base", lib.loc = NULL, auto = NULL -citEntry;function;function;utils;entry, textVersion, header = NULL, footer = NULL, ... -citFooter;function;function;utils;... -citHeader;function;function;utils;... -close.socket;function;function;utils;socket, ... -combn;function;function;utils;x, m, FUN = NULL, simplify = TRUE, ... -compareVersion;function;function;utils;a, b -contrib.url;function;function;utils;repos, type = getOption("pkgType") -count.fields;function;function;utils;file, sep = "", quote = "\"'", skip = 0, blank.lines.skip = TRUE, comment.char = "#" -CRAN.packages;function;function;utils;CRAN = getOption("repos"), method, contriburl = contrib.url(CRAN) -data;function;function;utils;..., list = character(0L), package = NULL, lib.loc = NULL, verbose = getOption("verbose"), envir = .GlobalEnv -dataentry;function;function;utils;data, modes -data.entry;function;function;utils;..., Modes = NULL, Names = NULL -de;function;function;utils;..., Modes = list(), Names = NULL -debugger;function;function;utils;dump = last.dump -demo;function;function;utils;topic, package = NULL, lib.loc = NULL, character.only = FALSE, verbose = getOption("verbose"), echo = TRUE, ask = getOption("demo.ask") -de.ncols;function;function;utils;inlist -de.restore;function;function;utils;inlist, ncols, coltypes, argnames, args -de.setup;function;function;utils;ilist, list.names, incols -.DollarNames;function;function;utils;x, pattern -download.file;function;function;utils;url, destfile, method, quiet = FALSE, mode = "w", cacheOK = TRUE -download.packages;function;function;utils;pkgs, destdir, available = NULL, repos = getOption("repos"), contriburl = contrib.url(repos, type), method, type = getOption("pkgType"), ... -dump.frames;function;function;utils;dumpto = "last.dump", to.file = FALSE -edit;function;function;utils;Generic Method -emacs;function;function;utils;name = NULL, file = "" -example;function;function;utils;topic, package = NULL, lib.loc = NULL, local = FALSE, echo = TRUE, verbose = getOption("verbose"), setRNG = FALSE, ask = getOption("example.ask"), prompt.prefix = abbreviate(topic, 6) -file.edit;function;function;utils;..., title = file, editor = getOption("editor") -file_test;function;function;utils;op, x, y -find;function;function;utils;what, mode = "any", numeric = FALSE, simple.words = TRUE -findLineNum;function;function;utils;srcfile, line, nameonly = TRUE, envir = parent.frame(), lastenv -fix;function;function;utils;x, ... -fixInNamespace;function;function;utils;x, ns, pos = -1, envir = as.environment(pos), ... -flush.console;function;function;utils;No arguments -formatOL;function;function;utils;x, type = "arabic", offset = 0, start = 1, width = 0.9 * getOption("width") -formatUL;function;function;utils;x, label = "*", offset = 0, width = 0.9 * getOption("width") -getAnywhere;function;function;utils;x -getCRANmirrors;function;function;utils;all = FALSE, local.only = FALSE -getFromNamespace;function;function;utils;x, ns, pos = -1, envir = as.environment(pos) -getS3method;function;function;utils;f, class, optional = FALSE -getTxtProgressBar;function;function;utils;pb -glob2rx;function;function;utils;pattern, trim.head = FALSE, trim.tail = TRUE -head;function;function;utils;x, ... -head.matrix;function;function;utils;x, n = 6L, ... -help;function;function;utils;topic, package = NULL, lib.loc = NULL, verbose = getOption("verbose"), try.all.packages = getOption("help.try.all.packages"), help_type = getOption("help_type") -help.request;function;function;utils;subject = "", ccaddress = Sys.getenv("USER"), method = getOption("mailer"), address = "r-help@R-project.org", file = "R.help.request" -help.search;function;function;utils;pattern, fields = c("alias", "concept", "title"), apropos, keyword, whatis, ignore.case = TRUE, package = NULL, lib.loc = NULL, help.db = getOption("help.db"), verbose = getOption("verbose"), rebuild = FALSE, agrep = NULL, use_UTF8 = FALSE -help.start;function;function;utils;update = FALSE, gui = "irrelevant", browser = getOption("browser"), remote = NULL -history;function;function;utils;max.show = 25, reverse = FALSE, pattern, ... -installed.packages;function;function;utils;lib.loc = NULL, priority = NULL, noCache = FALSE, fields = NULL, subarch = .Platform$r_arch -install.packages;function;function;utils;pkgs, lib, repos = getOption("repos"), contriburl = contrib.url(repos, type), method, available = NULL, destdir = NULL, dependencies = NA, type = getOption("pkgType"), configure.args = getOption("configure.args"), configure.vars = getOption("configure.vars"), clean = FALSE, Ncpus = getOption("Ncpus"), libs_only = FALSE, INSTALL_opts, ... -is.relistable;function;function;utils;x -limitedLabels;function;function;utils;value, maxwidth = getOption("width") - 5 -loadhistory;function;function;utils;file = ".Rhistory" -localeToCharset;function;function;utils;locale = Sys.getlocale("LC_CTYPE") -lsf.str;function;function;utils;pos = -1, envir, ... -ls.str;function;function;utils;pos = -1, name, envir, all.names = FALSE, pattern, mode = "any" -maintainer;function;function;utils;pkg -make.packages.html;function;function;utils;lib.loc = .libPaths(), temp = TRUE, verbose = TRUE -makeRweaveLatexCodeRunner;function;function;utils;evalFunc = RweaveEvalWithOpt -make.socket;function;function;utils;host = "localhost", port, fail = TRUE, server = FALSE -memory.limit;function;function;utils;size = NA -memory.size;function;function;utils;max = FALSE -menu;function;function;utils;choices, graphics = FALSE, title = NULL -methods;function;function;utils;generic.function, class -mirror2html;function;function;utils;mirrors = NULL, file = "mirrors.html", head = "mirrors-head.html", foot = "mirrors-foot.html" -modifyList;function;function;utils;x, val -new.packages;function;function;utils;lib.loc = NULL, repos = getOption("repos"), contriburl = contrib.url(repos, type), instPkgs = installed.packages(lib.loc = lib.loc), method, available = NULL, ask = FALSE, ..., type = getOption("pkgType") -news;function;function;utils;query, package = "R", lib.loc = NULL, format = NULL, reader = NULL, db = NULL -normalizePath;function;function;utils;path -nsl;function;function;utils;hostname -object.size;function;function;utils;x -old.packages;function;function;utils;lib.loc = NULL, repos = getOption("repos"), contriburl = contrib.url(repos, type), instPkgs = installed.packages(lib.loc = lib.loc), method, available = NULL, checkBuilt = FALSE, type = getOption("pkgType") -package.contents;function;function;utils;pkg, lib.loc = NULL -packageDescription;function;function;utils;pkg, lib.loc = NULL, fields = NULL, drop = TRUE, encoding = "" -package.skeleton;function;function;utils;name = "anRpackage", list = character(), environment = .GlobalEnv, path = ".", force = FALSE, namespace = FALSE, code_files = character() -packageStatus;function;function;utils;lib.loc = NULL, repositories = NULL, method, type = getOption("pkgType") -packageVersion;function;function;utils;pkg, lib.loc = NULL -page;function;function;utils;x, method = c("dput", "print"), ... -person;function;function;utils;given = NULL, family = NULL, middle = NULL, email = NULL, role = NULL, comment = NULL, first = NULL, last = NULL -personList;function;function;utils;... -pico;function;function;utils;name = NULL, file = "" -prompt;function;function;utils;object, filename = NULL, name = NULL, ... -promptData;function;function;utils;object, filename = NULL, name = NULL -promptPackage;function;function;utils;package, lib.loc = NULL, filename = NULL, name = NULL, final = FALSE -rc.getOption;function;function;utils;name -rc.options;function;function;utils;... -rc.settings;function;function;utils;ops, ns, args, func, ipck, S3, data, help, argdb, files -rc.status;function;function;utils;No arguments -readCitationFile;function;function;utils;file, meta = NULL -read.csv;function;function;utils;file, header = TRUE, sep = ",", quote = "\"", dec = ".", fill = TRUE, comment.char = "", ... -read.csv2;function;function;utils;file, header = TRUE, sep = ";", quote = "\"", dec = ",", fill = TRUE, comment.char = "", ... -read.delim;function;function;utils;file, header = TRUE, sep = "\t", quote = "\"", dec = ".", fill = TRUE, comment.char = "", ... -read.delim2;function;function;utils;file, header = TRUE, sep = "\t", quote = "\"", dec = ",", fill = TRUE, comment.char = "", ... -read.DIF;function;function;utils;file, header = FALSE, dec = ".", row.names, col.names, as.is = !stringsAsFactors, na.strings = "NA", colClasses = NA, nrows = -1, skip = 0, check.names = TRUE, blank.lines.skip = TRUE, stringsAsFactors = default.stringsAsFactors(), transpose = FALSE -read.fortran;function;function;utils;file, format, ..., as.is = TRUE, colClasses = NA -read.fwf;function;function;utils;file, widths, header = FALSE, sep = "\t", skip = 0, row.names, col.names, n = -1, buffersize = 2000, ... -read.socket;function;function;utils;socket, maxlen = 256, loop = FALSE -read.table;function;function;utils;file, header = FALSE, sep = "", quote = "\"'", dec = ".", row.names, col.names, as.is = !stringsAsFactors, na.strings = "NA", colClasses = NA, nrows = -1, skip = 0, check.names = TRUE, fill = !blank.lines.skip, strip.white = FALSE, blank.lines.skip = TRUE, comment.char = "#", allowEscapes = FALSE, flush = FALSE, stringsAsFactors = default.stringsAsFactors(), fileEncoding = "", encoding = "unknown" -recover;function;function;utils;No arguments -relist;function;function;utils;flesh, skeleton = attr(flesh, "skeleton") -remove.packages;function;function;utils;pkgs, lib -Rprof;function;function;utils;filename = "Rprof.out", append = FALSE, interval = 0.02, memory.profiling = FALSE -Rprofmem;function;function;utils;filename = "Rprofmem.out", append = FALSE, threshold = 0 -RShowDoc;function;function;utils;what, type = c("pdf", "html", "txt"), package -RSiteSearch;function;function;utils;string, restrict = c("functions", "vignettes", "views"), format = c("normal", "short"), sortby = c("score", "date:late", "date:early", "subject", "subject:descending", "from", "from:descending", "size", "size:descending"), matchesPerPage = 20 -rtags;function;function;utils;path = ".", pattern = "\\.[RrSs]$", recursive = FALSE, src = list.files(path = path, pattern = pattern, full.names = TRUE, recursive = recursive), keep.re = NULL, ofile = "", append = FALSE, verbose = getOption("verbose") -Rtangle;function;function;utils;No arguments -RtangleSetup;function;function;utils;file, syntax, output = NULL, annotate = TRUE, split = FALSE, prefix = TRUE, quiet = FALSE -RtangleWritedoc;function;function;utils;object, chunk -RweaveChunkPrefix;function;function;utils;options -RweaveEvalWithOpt;function;function;utils;expr, options -RweaveLatex;function;function;utils;No arguments -RweaveLatexFinish;function;function;utils;object, error = FALSE -RweaveLatexOptions;function;function;utils;options -RweaveLatexSetup;function;function;utils;file, syntax, output = NULL, quiet = FALSE, debug = FALSE, stylepath, ... -RweaveLatexWritedoc;function;function;utils;object, chunk -RweaveTryStop;function;function;utils;err, options -savehistory;function;function;utils;file = ".Rhistory" -select.list;function;function;utils;choices, preselect = NULL, multiple = FALSE, title = NULL, graphics = getOption("menu.graphics") -sessionInfo;function;function;utils;package = NULL -setBreakpoint;function;function;utils;srcfile, line, nameonly = TRUE, envir = parent.frame(), lastenv, verbose = TRUE, tracer, print = FALSE, ... -setRepositories;function;function;utils;graphics = getOption("menu.graphics"), ind = NULL -setTxtProgressBar;function;function;utils;pb, value, title = NULL, label = NULL -stack;function;function;utils;x, ... -Stangle;function;function;utils;file, driver = Rtangle(), syntax = getOption("SweaveSyntax"), ... -str;function;function;utils;Generic Method -strOptions;function;function;utils;strict.width = "no", digits.d = 3, vec.len = 4, formatNum = function(x, ...) format(x, trim = TRUE, drop0trailing = TRUE, ...) -summaryRprof;function;function;utils;filename = "Rprof.out", chunksize = 5000, memory = c("none", "both", "tseries", "stats"), index = 2, diff = TRUE, exclude = NULL -Sweave;function;function;utils;file, driver = RweaveLatex(), syntax = getOption("SweaveSyntax"), ... -SweaveHooks;function;function;utils;options, run = FALSE, envir = .GlobalEnv -SweaveSyntaxLatex;SweaveSyntax;list;utils;Not a function -SweaveSyntaxLatex$doc;character;character;utils;Not a function -SweaveSyntaxLatex$code;character;character;utils;Not a function -SweaveSyntaxLatex$coderef;character;character;utils;Not a function -SweaveSyntaxLatex$docopt;character;character;utils;Not a function -SweaveSyntaxLatex$docexpr;character;character;utils;Not a function -SweaveSyntaxLatex$extension;character;character;utils;Not a function -SweaveSyntaxLatex$syntaxname;character;character;utils;Not a function -SweaveSyntaxLatex$input;character;character;utils;Not a function -SweaveSyntaxLatex$trans;list; ;utils;Not a function -SweaveSyntaxNoweb;SweaveSyntax;list;utils;Not a function -SweaveSyntaxNoweb$doc;character;character;utils;Not a function -SweaveSyntaxNoweb$code;character;character;utils;Not a function -SweaveSyntaxNoweb$coderef;character;character;utils;Not a function -SweaveSyntaxNoweb$docopt;character;character;utils;Not a function -SweaveSyntaxNoweb$docexpr;character;character;utils;Not a function -SweaveSyntaxNoweb$extension;character;character;utils;Not a function -SweaveSyntaxNoweb$syntaxname;character;character;utils;Not a function -SweaveSyntaxNoweb$input;character;character;utils;Not a function -SweaveSyntaxNoweb$trans;list; ;utils;Not a function -SweaveSyntConv;function;function;utils;file, syntax, output = NULL -tail;function;function;utils;x, ... -tail.matrix;function;function;utils;x, n = 6L, addrownums = TRUE, ... -tar;function;function;utils;tarfile, files = NULL, compression = c("none", "gzip", "bzip2", "xz"), compression_level = 6, tar = Sys.getenv("tar") -timestamp;function;function;utils;stamp = date(), prefix = "##------ ", suffix = " ------##", quiet = FALSE -toBibtex;function;function;utils;object, ... -toLatex;function;function;utils;object, ... -txtProgressBar;function;function;utils;min = 0, max = 1, initial = 0, char = "=", width = NA, title, label, style = 1 -type.convert;function;function;utils;x, na.strings = "NA", as.is = FALSE, dec = "." -unstack;function;function;utils;x, ... -untar;function;function;utils;tarfile, files = NULL, list = FALSE, exdir = ".", compressed = NA, extras = NULL, verbose = FALSE, tar = Sys.getenv("TAR") -unzip;function;function;utils;zipfile, files = NULL, list = FALSE, overwrite = TRUE, junkpaths = FALSE, exdir = "." -update.packages;function;function;utils;lib.loc = NULL, repos = getOption("repos"), contriburl = contrib.url(repos, type), method, instlib = NULL, ask = TRUE, available = NULL, oldPkgs = NULL, ..., checkBuilt = FALSE, type = getOption("pkgType") -update.packageStatus;function;function;utils;object, lib.loc = levels(object$inst$LibPath), repositories = levels(object$avail$Repository), ... -upgrade;function;function;utils;object, ... -URLdecode;function;function;utils;URL -URLencode;function;function;utils;URL, reserved = FALSE -url.show;function;function;utils;url, title = url, file = tempfile(), delete.file = TRUE, method, ... -vi;function;function;utils;name = NULL, file = "" -View;function;function;utils;x, title -vignette;function;function;utils;topic, package = NULL, lib.loc = NULL, all = TRUE -write.csv;function;function;utils;... -write.csv2;function;function;utils;... -write.socket;function;function;utils;socket, string -write.table;function;function;utils;x, file = "", append = FALSE, quote = TRUE, sep = " ", eol = "\n", na = "NA", dec = ".", row.names = TRUE, col.names = TRUE, qmethod = c("escape", "double") -wsbrowser;function;function;utils;IDS, IsRoot, IsContainer, ItemsPerContainer, ParentID, NAMES, TYPES, DIMS, expanded = TRUE, kind = "HTML", main = "R Workspace", properties = list(), browser = getOption("browser") -xedit;function;function;utils;name = NULL, file = "" -xemacs;function;function;utils;name = NULL, file = "" -zip.file.extract;function;function;utils;file, zipname = "R.zip", unzip = getOption("unzip"), dir = tempdir() -ability.cov;list;list;datasets;Not a function -ability.cov$cov;matrix;numeric;datasets;Not a function -ability.cov$center;numeric;numeric;datasets;Not a function -ability.cov$n.obs;numeric;numeric;datasets;Not a function -airmiles;ts;numeric;datasets;Not a function -AirPassengers;ts;numeric;datasets;Not a function -airquality;data.frame;data.frame;datasets;Not a function -airquality$Ozone;integer;numeric;datasets;Not a function -airquality$Solar.R;integer;numeric;datasets;Not a function -airquality$Wind;numeric;numeric;datasets;Not a function -airquality$Temp;integer;numeric;datasets;Not a function -airquality$Month;integer;numeric;datasets;Not a function -airquality$Day;integer;numeric;datasets;Not a function -anscombe;data.frame;data.frame;datasets;Not a function -anscombe$x1;numeric;numeric;datasets;Not a function -anscombe$x2;numeric;numeric;datasets;Not a function -anscombe$x3;numeric;numeric;datasets;Not a function -anscombe$x4;numeric;numeric;datasets;Not a function -anscombe$y1;numeric;numeric;datasets;Not a function -anscombe$y2;numeric;numeric;datasets;Not a function -anscombe$y3;numeric;numeric;datasets;Not a function -anscombe$y4;numeric;numeric;datasets;Not a function -attenu;data.frame;data.frame;datasets;Not a function -attenu$event;numeric;numeric;datasets;Not a function -attenu$mag;numeric;numeric;datasets;Not a function -attenu$station;factor;factor;datasets;Not a function -attenu$dist;numeric;numeric;datasets;Not a function -attenu$accel;numeric;numeric;datasets;Not a function -attitude;data.frame;data.frame;datasets;Not a function -attitude$rating;numeric;numeric;datasets;Not a function -attitude$complaints;numeric;numeric;datasets;Not a function -attitude$privileges;numeric;numeric;datasets;Not a function -attitude$learning;numeric;numeric;datasets;Not a function -attitude$raises;numeric;numeric;datasets;Not a function -attitude$critical;numeric;numeric;datasets;Not a function -attitude$advance;numeric;numeric;datasets;Not a function -austres;ts;numeric;datasets;Not a function -beaver1;data.frame;data.frame;datasets;Not a function -beaver1$day;numeric;numeric;datasets;Not a function -beaver1$time;numeric;numeric;datasets;Not a function -beaver1$temp;numeric;numeric;datasets;Not a function -beaver1$activ;numeric;numeric;datasets;Not a function -beaver2;data.frame;data.frame;datasets;Not a function -beaver2$day;numeric;numeric;datasets;Not a function -beaver2$time;numeric;numeric;datasets;Not a function -beaver2$temp;numeric;numeric;datasets;Not a function -beaver2$activ;numeric;numeric;datasets;Not a function -BJsales;ts;numeric;datasets;Not a function -BJsales.lead;ts;numeric;datasets;Not a function -BOD;data.frame;data.frame;datasets;Not a function -BOD$Time;numeric;numeric;datasets;Not a function -BOD$demand;numeric;numeric;datasets;Not a function -cars;data.frame;data.frame;datasets;Not a function -cars$speed;numeric;numeric;datasets;Not a function -cars$dist;numeric;numeric;datasets;Not a function -ChickWeight;nfnGroupedData;data.frame;datasets;Not a function -ChickWeight$weight;numeric;numeric;datasets;Not a function -ChickWeight$Time;numeric;numeric;datasets;Not a function -ChickWeight$Chick;ordered;factor;datasets;Not a function -ChickWeight$Diet;factor;factor;datasets;Not a function -chickwts;data.frame;data.frame;datasets;Not a function -chickwts$weight;numeric;numeric;datasets;Not a function -chickwts$feed;factor;factor;datasets;Not a function -co2;ts;numeric;datasets;Not a function -CO2;nfnGroupedData;data.frame;datasets;Not a function -CO2$Plant;ordered;factor;datasets;Not a function -CO2$Type;factor;factor;datasets;Not a function -CO2$Treatment;factor;factor;datasets;Not a function -CO2$conc;numeric;numeric;datasets;Not a function -CO2$uptake;numeric;numeric;datasets;Not a function -crimtab;table;numeric;datasets;Not a function -discoveries;ts;numeric;datasets;Not a function -DNase;nfnGroupedData;data.frame;datasets;Not a function -DNase$Run;ordered;factor;datasets;Not a function -DNase$conc;numeric;numeric;datasets;Not a function -DNase$density;numeric;numeric;datasets;Not a function -esoph;data.frame;data.frame;datasets;Not a function -esoph$agegp;ordered;factor;datasets;Not a function -esoph$alcgp;ordered;factor;datasets;Not a function -esoph$tobgp;ordered;factor;datasets;Not a function -esoph$ncases;numeric;numeric;datasets;Not a function -esoph$ncontrols;numeric;numeric;datasets;Not a function -euro;numeric;numeric;datasets;Not a function -euro.cross;matrix;numeric;datasets;Not a function -eurodist;dist;numeric;datasets;Not a function -EuStockMarkets;mts;numeric;datasets;Not a function -faithful;data.frame;data.frame;datasets;Not a function -faithful$eruptions;numeric;numeric;datasets;Not a function -faithful$waiting;numeric;numeric;datasets;Not a function -fdeaths;ts;numeric;datasets;Not a function -.First.lib;function;function;datasets;... -Formaldehyde;data.frame;data.frame;datasets;Not a function -Formaldehyde$carb;numeric;numeric;datasets;Not a function -Formaldehyde$optden;numeric;numeric;datasets;Not a function -freeny;data.frame;data.frame;datasets;Not a function -freeny$y;ts;numeric;datasets;Not a function -freeny$lag.quarterly.revenue;numeric;numeric;datasets;Not a function -freeny$price.index;numeric;numeric;datasets;Not a function -freeny$income.level;numeric;numeric;datasets;Not a function -freeny$market.potential;numeric;numeric;datasets;Not a function -freeny.x;matrix;numeric;datasets;Not a function -freeny.y;ts;numeric;datasets;Not a function -HairEyeColor;table;numeric;datasets;Not a function -Harman23.cor;list;list;datasets;Not a function -Harman23.cor$cov;matrix;numeric;datasets;Not a function -Harman23.cor$center;numeric;numeric;datasets;Not a function -Harman23.cor$n.obs;numeric;numeric;datasets;Not a function -Harman74.cor;list;list;datasets;Not a function -Harman74.cor$cov;matrix;numeric;datasets;Not a function -Harman74.cor$center;numeric;numeric;datasets;Not a function -Harman74.cor$n.obs;numeric;numeric;datasets;Not a function -Indometh;nfnGroupedData;data.frame;datasets;Not a function -Indometh$Subject;ordered;factor;datasets;Not a function -Indometh$time;numeric;numeric;datasets;Not a function -Indometh$conc;numeric;numeric;datasets;Not a function -infert;data.frame;data.frame;datasets;Not a function -infert$education;factor;factor;datasets;Not a function -infert$age;numeric;numeric;datasets;Not a function -infert$parity;numeric;numeric;datasets;Not a function -infert$induced;numeric;numeric;datasets;Not a function -infert$case;numeric;numeric;datasets;Not a function -infert$spontaneous;numeric;numeric;datasets;Not a function -infert$stratum;integer;numeric;datasets;Not a function -infert$pooled.stratum;numeric;numeric;datasets;Not a function -InsectSprays;data.frame;data.frame;datasets;Not a function -InsectSprays$count;numeric;numeric;datasets;Not a function -InsectSprays$spray;factor;factor;datasets;Not a function -iris;data.frame;data.frame;datasets;Not a function -iris$Sepal.Length;numeric;numeric;datasets;Not a function -iris$Sepal.Width;numeric;numeric;datasets;Not a function -iris$Petal.Length;numeric;numeric;datasets;Not a function -iris$Petal.Width;numeric;numeric;datasets;Not a function -iris$Species;factor;factor;datasets;Not a function -iris3;array;numeric;datasets;Not a function -islands;numeric;numeric;datasets;Not a function -JohnsonJohnson;ts;numeric;datasets;Not a function -LakeHuron;ts;numeric;datasets;Not a function -ldeaths;ts;numeric;datasets;Not a function -lh;ts;numeric;datasets;Not a function -LifeCycleSavings;data.frame;data.frame;datasets;Not a function -LifeCycleSavings$sr;numeric;numeric;datasets;Not a function -LifeCycleSavings$pop15;numeric;numeric;datasets;Not a function -LifeCycleSavings$pop75;numeric;numeric;datasets;Not a function -LifeCycleSavings$dpi;numeric;numeric;datasets;Not a function -LifeCycleSavings$ddpi;numeric;numeric;datasets;Not a function -Loblolly;nfnGroupedData;data.frame;datasets;Not a function -Loblolly$height;numeric;numeric;datasets;Not a function -Loblolly$age;numeric;numeric;datasets;Not a function -Loblolly$Seed;ordered;factor;datasets;Not a function -longley;data.frame;data.frame;datasets;Not a function -longley$GNP.deflator;numeric;numeric;datasets;Not a function -longley$GNP;numeric;numeric;datasets;Not a function -longley$Unemployed;numeric;numeric;datasets;Not a function -longley$Armed.Forces;numeric;numeric;datasets;Not a function -longley$Population;numeric;numeric;datasets;Not a function -longley$Year;integer;numeric;datasets;Not a function -longley$Employed;numeric;numeric;datasets;Not a function -lynx;ts;numeric;datasets;Not a function -mdeaths;ts;numeric;datasets;Not a function -morley;data.frame;data.frame;datasets;Not a function -morley$Expt;integer;numeric;datasets;Not a function -morley$Run;integer;numeric;datasets;Not a function -morley$Speed;integer;numeric;datasets;Not a function -mtcars;data.frame;data.frame;datasets;Not a function -mtcars$mpg;numeric;numeric;datasets;Not a function -mtcars$cyl;numeric;numeric;datasets;Not a function -mtcars$disp;numeric;numeric;datasets;Not a function -mtcars$hp;numeric;numeric;datasets;Not a function -mtcars$drat;numeric;numeric;datasets;Not a function -mtcars$wt;numeric;numeric;datasets;Not a function -mtcars$qsec;numeric;numeric;datasets;Not a function -mtcars$vs;numeric;numeric;datasets;Not a function -mtcars$am;numeric;numeric;datasets;Not a function -mtcars$gear;numeric;numeric;datasets;Not a function -mtcars$carb;numeric;numeric;datasets;Not a function -nhtemp;ts;numeric;datasets;Not a function -Nile;ts;numeric;datasets;Not a function -.noGenerics;logical;logical;datasets;Not a function -nottem;ts;numeric;datasets;Not a function -occupationalStatus;table;numeric;datasets;Not a function -Orange;nfnGroupedData;data.frame;datasets;Not a function -Orange$Tree;ordered;factor;datasets;Not a function -Orange$age;numeric;numeric;datasets;Not a function -Orange$circumference;numeric;numeric;datasets;Not a function -OrchardSprays;data.frame;data.frame;datasets;Not a function -OrchardSprays$decrease;numeric;numeric;datasets;Not a function -OrchardSprays$rowpos;numeric;numeric;datasets;Not a function -OrchardSprays$colpos;numeric;numeric;datasets;Not a function -OrchardSprays$treatment;factor;factor;datasets;Not a function -.packageName;character;character;datasets;Not a function -PlantGrowth;data.frame;data.frame;datasets;Not a function -PlantGrowth$weight;numeric;numeric;datasets;Not a function -PlantGrowth$group;factor;factor;datasets;Not a function -precip;numeric;numeric;datasets;Not a function -presidents;ts;numeric;datasets;Not a function -pressure;data.frame;data.frame;datasets;Not a function -pressure$temperature;numeric;numeric;datasets;Not a function -pressure$pressure;numeric;numeric;datasets;Not a function -Puromycin;data.frame;data.frame;datasets;Not a function -Puromycin$conc;numeric;numeric;datasets;Not a function -Puromycin$rate;numeric;numeric;datasets;Not a function -Puromycin$state;factor;factor;datasets;Not a function -quakes;data.frame;data.frame;datasets;Not a function -quakes$lat;numeric;numeric;datasets;Not a function -quakes$long;numeric;numeric;datasets;Not a function -quakes$depth;integer;numeric;datasets;Not a function -quakes$mag;numeric;numeric;datasets;Not a function -quakes$stations;integer;numeric;datasets;Not a function -randu;data.frame;data.frame;datasets;Not a function -randu$x;numeric;numeric;datasets;Not a function -randu$y;numeric;numeric;datasets;Not a function -randu$z;numeric;numeric;datasets;Not a function -rivers;numeric;numeric;datasets;Not a function -rock;data.frame;data.frame;datasets;Not a function -rock$area;integer;numeric;datasets;Not a function -rock$peri;numeric;numeric;datasets;Not a function -rock$shape;numeric;numeric;datasets;Not a function -rock$perm;numeric;numeric;datasets;Not a function -Seatbelts;mts;numeric;datasets;Not a function -sleep;data.frame;data.frame;datasets;Not a function -sleep$extra;numeric;numeric;datasets;Not a function -sleep$group;factor;factor;datasets;Not a function -sleep$ID;factor;factor;datasets;Not a function -stackloss;data.frame;data.frame;datasets;Not a function -stackloss$Air.Flow;numeric;numeric;datasets;Not a function -stackloss$Water.Temp;numeric;numeric;datasets;Not a function -stackloss$Acid.Conc.;numeric;numeric;datasets;Not a function -stackloss$stack.loss;numeric;numeric;datasets;Not a function -stack.loss;numeric;numeric;datasets;Not a function -stack.x;matrix;numeric;datasets;Not a function -state.abb;character;character;datasets;Not a function -state.area;numeric;numeric;datasets;Not a function -state.center;list;list;datasets;Not a function -state.center$x;numeric;numeric;datasets;Not a function -state.center$y;numeric;numeric;datasets;Not a function -state.division;factor;factor;datasets;Not a function -state.name;character;character;datasets;Not a function -state.region;factor;factor;datasets;Not a function -state.x77;matrix;numeric;datasets;Not a function -sunspot.month;ts;numeric;datasets;Not a function -sunspots;ts;numeric;datasets;Not a function -sunspot.year;ts;numeric;datasets;Not a function -swiss;data.frame;data.frame;datasets;Not a function -swiss$Fertility;numeric;numeric;datasets;Not a function -swiss$Agriculture;numeric;numeric;datasets;Not a function -swiss$Examination;integer;numeric;datasets;Not a function -swiss$Education;integer;numeric;datasets;Not a function -swiss$Catholic;numeric;numeric;datasets;Not a function -swiss$Infant.Mortality;numeric;numeric;datasets;Not a function -Theoph;nfnGroupedData;data.frame;datasets;Not a function -Theoph$Subject;ordered;factor;datasets;Not a function -Theoph$Wt;numeric;numeric;datasets;Not a function -Theoph$Dose;numeric;numeric;datasets;Not a function -Theoph$Time;numeric;numeric;datasets;Not a function -Theoph$conc;numeric;numeric;datasets;Not a function -Titanic;table;numeric;datasets;Not a function -ToothGrowth;data.frame;data.frame;datasets;Not a function -ToothGrowth$len;numeric;numeric;datasets;Not a function -ToothGrowth$supp;factor;factor;datasets;Not a function -ToothGrowth$dose;numeric;numeric;datasets;Not a function -treering;ts;numeric;datasets;Not a function -trees;data.frame;data.frame;datasets;Not a function -trees$Girth;numeric;numeric;datasets;Not a function -trees$Height;numeric;numeric;datasets;Not a function -trees$Volume;numeric;numeric;datasets;Not a function -UCBAdmissions;table;numeric;datasets;Not a function -UKDriverDeaths;ts;numeric;datasets;Not a function -UKgas;ts;numeric;datasets;Not a function -USAccDeaths;ts;numeric;datasets;Not a function -USArrests;data.frame;data.frame;datasets;Not a function -USArrests$Murder;numeric;numeric;datasets;Not a function -USArrests$Assault;integer;numeric;datasets;Not a function -USArrests$UrbanPop;integer;numeric;datasets;Not a function -USArrests$Rape;numeric;numeric;datasets;Not a function -USJudgeRatings;data.frame;data.frame;datasets;Not a function -USJudgeRatings$CONT;numeric;numeric;datasets;Not a function -USJudgeRatings$INTG;numeric;numeric;datasets;Not a function -USJudgeRatings$DMNR;numeric;numeric;datasets;Not a function -USJudgeRatings$DILG;numeric;numeric;datasets;Not a function -USJudgeRatings$CFMG;numeric;numeric;datasets;Not a function -USJudgeRatings$DECI;numeric;numeric;datasets;Not a function -USJudgeRatings$PREP;numeric;numeric;datasets;Not a function -USJudgeRatings$FAMI;numeric;numeric;datasets;Not a function -USJudgeRatings$ORAL;numeric;numeric;datasets;Not a function -USJudgeRatings$WRIT;numeric;numeric;datasets;Not a function -USJudgeRatings$PHYS;numeric;numeric;datasets;Not a function -USJudgeRatings$RTEN;numeric;numeric;datasets;Not a function -USPersonalExpenditure;matrix;numeric;datasets;Not a function -uspop;ts;numeric;datasets;Not a function -VADeaths;matrix;numeric;datasets;Not a function -volcano;matrix;numeric;datasets;Not a function -warpbreaks;data.frame;data.frame;datasets;Not a function -warpbreaks$breaks;numeric;numeric;datasets;Not a function -warpbreaks$wool;factor;factor;datasets;Not a function -warpbreaks$tension;factor;factor;datasets;Not a function -women;data.frame;data.frame;datasets;Not a function -women$height;numeric;numeric;datasets;Not a function -women$weight;numeric;numeric;datasets;Not a function -WorldPhones;matrix;numeric;datasets;Not a function -WWWusage;ts;numeric;datasets;Not a function -@<-;function;function;methods;object, name, value -addNextMethod;function;function;methods;method, f = "", mlist, optional = FALSE, envir -allGenerics;function;function;methods;... -allNames;function;function;methods;x -Arith;function;function;methods;e1, e2 -as;function;function;methods;object, Class, strict = TRUE, ext = possibleExtends(thisClass, Class) -as<-;function;function;methods;object, Class, value -asMethodDefinition;function;function;methods;def, signature = list(), sealed = FALSE, fdef = def -assignClassDef;function;function;methods;Class, def, where = .GlobalEnv, force = FALSE -assignMethodsMetaData;function;function;methods;f, value, fdef, where, deflt -balanceMethodsList;function;function;methods;mlist, args, check = TRUE -body<-;function;function;methods;fun, envir = environment(fun), value -.__C__<-;classRepresentation; ;methods;Not a function -.__C__(;classRepresentation; ;methods;Not a function -.__C__{;classRepresentation; ;methods;Not a function -cacheGenericsMetaData;function;function;methods;f, fdef, attach = TRUE, where = topenv(parent.frame()), package, methods -cacheMetaData;function;function;methods;where, attach = TRUE, searchWhere = as.environment(where), doCheck = TRUE -cacheMethod;function;function;methods;f, sig, def, args = names(sig), fdef, inherited = FALSE -.__C__activeBindingFunction;classRepresentation; ;methods;Not a function -callGeneric;function;function;methods;... -callNextMethod;function;function;methods;... -canCoerce;function;function;methods;object, Class -.__C__anova;classRepresentation; ;methods;Not a function -.__C__anova.glm;classRepresentation; ;methods;Not a function -.__C__anova.glm.null;classRepresentation; ;methods;Not a function -.__C__ANY;classRepresentation; ;methods;Not a function -.__C__aov;classRepresentation; ;methods;Not a function -.__C__array;classRepresentation; ;methods;Not a function -cbind2;function;function;methods;x, y -.__C__call;classRepresentation; ;methods;Not a function -.__C__character;classRepresentation; ;methods;Not a function -.__C__classPrototypeDef;classRepresentation; ;methods;Not a function -.__C__classRepresentation;classRepresentation; ;methods;Not a function -.__C__ClassUnionRepresentation;classRepresentation; ;methods;Not a function -.__C__complex;classRepresentation; ;methods;Not a function -.__C__conditionalExtension;classRepresentation; ;methods;Not a function -.__C__data.frame;classRepresentation; ;methods;Not a function -.__C__data.frameRowLabels;ClassUnionRepresentation; ;methods;Not a function -.__C__Date;classRepresentation; ;methods;Not a function -.__C__defaultBindingFunction;classRepresentation; ;methods;Not a function -.__C__density;classRepresentation; ;methods;Not a function -.__C__derivedDefaultMethod;classRepresentation; ;methods;Not a function -.__C__derivedDefaultMethodWithTrace;classRepresentation; ;methods;Not a function -.__C__dump.frames;classRepresentation; ;methods;Not a function -.__C__EmptyMethodsList;classRepresentation; ;methods;Not a function -.__C__environment;classRepresentation; ;methods;Not a function -.__C__.environment;classRepresentation; ;methods;Not a function -.__C__envRefClass;refClassRepresentation; ;methods;Not a function -.__C__expression;classRepresentation; ;methods;Not a function -.__C__externalptr;classRepresentation; ;methods;Not a function -.__C__.externalptr;classRepresentation; ;methods;Not a function -.__C__factor;classRepresentation; ;methods;Not a function -.__C__for;classRepresentation; ;methods;Not a function -.__C__formula;classRepresentation; ;methods;Not a function -.__C__function;classRepresentation; ;methods;Not a function -.__C__functionWithTrace;classRepresentation; ;methods;Not a function -.__C__genericFunction;classRepresentation; ;methods;Not a function -.__C__genericFunctionWithTrace;classRepresentation; ;methods;Not a function -.__C__glm;classRepresentation; ;methods;Not a function -.__C__glm.null;classRepresentation; ;methods;Not a function -.__C__groupGenericFunction;classRepresentation; ;methods;Not a function -.__C__groupGenericFunctionWithTrace;classRepresentation; ;methods;Not a function -checkSlotAssignment;function;function;methods;obj, name, value -.__C__hsearch;classRepresentation; ;methods;Not a function -.__C__if;classRepresentation; ;methods;Not a function -.__C__integer;classRepresentation; ;methods;Not a function -.__C__integrate;classRepresentation; ;methods;Not a function -.__C__language;classRepresentation; ;methods;Not a function -classesToAM;function;function;methods;classes, includeSubclasses = FALSE, abbreviate = 2 -classMetaName;function;function;methods;name -.__C__libraryIQR;classRepresentation; ;methods;Not a function -.__C__LinearMethodsList;classRepresentation; ;methods;Not a function -.__C__list;classRepresentation; ;methods;Not a function -.__C__listOfMethods;classRepresentation; ;methods;Not a function -.__C__lm;classRepresentation; ;methods;Not a function -.__C__logical;classRepresentation; ;methods;Not a function -.__C__logLik;classRepresentation; ;methods;Not a function -.__C__maov;classRepresentation; ;methods;Not a function -.__C__matrix;classRepresentation; ;methods;Not a function -.__C__MethodDefinition;classRepresentation; ;methods;Not a function -.__C__MethodDefinitionWithTrace;classRepresentation; ;methods;Not a function -.__C__MethodSelectionReport;classRepresentation; ;methods;Not a function -.__C__MethodsList;classRepresentation; ;methods;Not a function -.__C__MethodWithNext;classRepresentation; ;methods;Not a function -.__C__MethodWithNextWithTrace;classRepresentation; ;methods;Not a function -.__C__missing;classRepresentation; ;methods;Not a function -.__C__mlm;classRepresentation; ;methods;Not a function -.__C__mtable;classRepresentation; ;methods;Not a function -.__C__mts;classRepresentation; ;methods;Not a function -.__C__name;classRepresentation; ;methods;Not a function -.__C__.name;classRepresentation; ;methods;Not a function -.__C__namedList;classRepresentation; ;methods;Not a function -.__C__nonstandardGeneric;classRepresentation; ;methods;Not a function -.__C__nonstandardGenericFunction;classRepresentation; ;methods;Not a function -.__C__nonstandardGenericWithTrace;classRepresentation; ;methods;Not a function -.__C__nonstandardGroupGenericFunction;classRepresentation; ;methods;Not a function -.__C__nonStructure;classRepresentation; ;methods;Not a function -.__C__NULL;classRepresentation; ;methods;Not a function -.__C__.NULL;classRepresentation; ;methods;Not a function -.__C__numeric;classRepresentation; ;methods;Not a function -.__C__ObjectsWithPackage;classRepresentation; ;methods;Not a function -coerce;function;function;methods;from, to, strict = TRUE -coerce<-;function;function;methods;from, to, value -.__C__oldClass;classRepresentation; ;methods;Not a function -Compare;function;function;methods;e1, e2 -completeClassDefinition;function;function;methods;Class, ClassDef = getClassDef(Class), where, doExtends = TRUE -completeExtends;function;function;methods;ClassDef, class2, extensionDef, where -completeSubclasses;function;function;methods;classDef, class2, extensionDef, where, classDef2 = getClassDef(class2, where) -Complex;function;function;methods;z -conformMethod;function;function;methods;signature, mnames, fnames, f = "", fdef, method -.__C__OptionalFunction;ClassUnionRepresentation; ;methods;Not a function -.__C__optionalMethod;classRepresentation; ;methods;Not a function -.__C__ordered;classRepresentation; ;methods;Not a function -.__C__.Other;classRepresentation; ;methods;Not a function -.__C__packageInfo;classRepresentation; ;methods;Not a function -.__C__packageIQR;classRepresentation; ;methods;Not a function -.__C__POSIXct;classRepresentation; ;methods;Not a function -.__C__POSIXlt;classRepresentation; ;methods;Not a function -.__C__POSIXt;classRepresentation; ;methods;Not a function -.__C__PossibleMethod;ClassUnionRepresentation; ;methods;Not a function -.__C__raw;classRepresentation; ;methods;Not a function -.__C__recordedplot;classRepresentation; ;methods;Not a function -.__C__refClass;ClassUnionRepresentation; ;methods;Not a function -.__C__refClassRepresentation;classRepresentation; ;methods;Not a function -.__C__refMethodDef;classRepresentation; ;methods;Not a function -.__C__refObject;ClassUnionRepresentation; ;methods;Not a function -.__C__refObjectGenerator;refClassRepresentation; ;methods;Not a function -.__C__repeat;classRepresentation; ;methods;Not a function -.__C__rle;classRepresentation; ;methods;Not a function -.__C__S3;classRepresentation; ;methods;Not a function -.__C__S4;classRepresentation; ;methods;Not a function -.__C__SClassExtension;classRepresentation; ;methods;Not a function -.__C__SealedMethodDefinition;classRepresentation; ;methods;Not a function -.__C__signature;classRepresentation; ;methods;Not a function -.__C__socket;classRepresentation; ;methods;Not a function -.__C__sourceEnvironment;classRepresentation; ;methods;Not a function -.__C__standardGeneric;classRepresentation; ;methods;Not a function -.__C__standardGenericWithTrace;classRepresentation; ;methods;Not a function -.__C__structure;classRepresentation; ;methods;Not a function -.__C__summaryDefault;classRepresentation; ;methods;Not a function -.__C__summary.table;classRepresentation; ;methods;Not a function -.__C__SuperClassMethod;ClassUnionRepresentation; ;methods;Not a function -.__C__table;classRepresentation; ;methods;Not a function -.__C__traceable;classRepresentation; ;methods;Not a function -.__C__ts;classRepresentation; ;methods;Not a function -.__C__uninitializedField;classRepresentation; ;methods;Not a function -.__C__vector;classRepresentation; ;methods;Not a function -.__C__VIRTUAL;classRepresentation; ;methods;Not a function -.__C__while;classRepresentation; ;methods;Not a function -defaultDumpName;function;function;methods;generic, signature -defaultPrototype;function;function;methods;No arguments -doPrimitiveMethod;function;function;methods;name, def, call = sys.call(sys.parent()), ev = sys.frame(sys.parent(2)) -.doTracePrint;function;function;methods;msg = "" -dumpMethod;function;function;methods;f, signature = character(), file = defaultDumpName(f, signature), where = topenv(parent.frame()), def = getMethod(f, signature, where = where, optional = TRUE) -dumpMethods;function;function;methods;f, file = "", signature = NULL, methods = findMethods(f, where = where), where = topenv(parent.frame()) -el;function;function;methods;object, where -el<-;function;function;methods;No arguments -elNamed;function;function;methods;x, name, mustFind = FALSE -elNamed<-;function;function;methods;x, name, value -empty.dump;function;function;methods;No arguments -emptyMethodsList;function;function;methods;mlist, thisClass = "ANY", sublist = list() -.EmptyPrimitiveSkeletons;list;list;methods;Not a function -evalSource;function;function;methods;source, package = "", lock = TRUE, cache = FALSE -existsFunction;function;function;methods;f, generic = TRUE, where = topenv(parent.frame()) -existsMethod;function;function;methods;f, signature = character(), where = topenv(parent.frame()) -extends;function;function;methods;class1, class2, maybe = TRUE, fullInfo = FALSE -finalDefaultMethod;function;function;methods;method -findClass;function;function;methods;Class, where = topenv(parent.frame()), unique = "" -findFunction;function;function;methods;f, generic = TRUE, where = topenv(parent.frame()) -findMethod;function;function;methods;f, signature, where = topenv(parent.frame()) -findMethods;function;function;methods;f, where, classes = character(), inherited = FALSE -findMethodSignatures;function;function;methods;..., target = TRUE, methods = findMethods(...) -findUnique;function;function;methods;what, message, where = topenv(parent.frame()) -fixPre1.8;function;function;methods;names, where = topenv(parent.frame()) -formalArgs;function;function;methods;def -functionBody;function;function;methods;fun = sys.function(sys.parent()) -functionBody<-;function;function;methods;fun, envir = environment(fun), value -generic.skeleton;function;function;methods;name, fdef, fdefault -getAccess;function;function;methods;ClassDef -getAllMethods;function;function;methods;f, fdef, where = topenv(parent.frame()) -getAllSuperClasses;function;function;methods;ClassDef, simpleOnly = TRUE -getClass;function;function;methods;Class, .Force = FALSE, where = .classEnv(Class, topenv(parent.frame()), FALSE) -getClassDef;function;function;methods;Class, where = topenv(parent.frame()), package = packageSlot(Class), inherits = TRUE -getClasses;function;function;methods;where = .externalCallerEnv(), inherits = missing(where) -getClassName;function;function;methods;ClassDef -getClassPackage;function;function;methods;ClassDef -getDataPart;function;function;methods;object -getExtends;function;function;methods;ClassDef -getFunction;function;function;methods;name, generic = TRUE, mustFind = TRUE, where = topenv(parent.frame()) -getGeneric;function;function;methods;f, mustFind = FALSE, where, package = "" -getGenerics;function;function;methods;where, searchForm = FALSE -getGroup;function;function;methods;fdef, recursive = FALSE, where = topenv(parent.frame()) -getGroupMembers;function;function;methods;group, recursive = FALSE, character = TRUE -getMethod;function;function;methods;f, signature = character(), where = topenv(parent.frame()), optional = FALSE, mlist, fdef -getMethods;function;function;methods;f, where = topenv(parent.frame()), table = FALSE -getMethodsForDispatch;function;function;methods;fdef, inherited = FALSE -getMethodsMetaData;function;function;methods;f, where = topenv(parent.frame()) -getPackageName;function;function;methods;where = topenv(parent.frame()), create = TRUE -getProperties;function;function;methods;ClassDef -getPrototype;function;function;methods;ClassDef -getRefClass;function;function;methods;Class, where = topenv(parent.frame()) -getSlots;function;function;methods;x -getSubclasses;function;function;methods;ClassDef -getValidity;function;function;methods;ClassDef -getVirtual;function;function;methods;ClassDef -hasArg;function;function;methods;name -hasMethod;function;function;methods;f, signature = character(), where = .genEnv(f, topenv(parent.frame())) -hasMethods;function;function;methods;f, where, package -.hasSlot;function;function;methods;object, name -implicitGeneric;function;function;methods;name, where = topenv(parent.frame()), generic = getGeneric(name, where = where) -inheritedSlotNames;function;function;methods;Class, where = topenv(parent.frame()) -initFieldArgs;function;function;methods;.Object, classDef, selfEnv, ... -initialize;function;function;methods;.Object, ... -insertMethod;function;function;methods;mlist, signature, args, def, cacheOnly = FALSE -insertSource;function;function;methods;source, package = "", functions = allPlainObjects(), methods = (if (missing(functions)) allMethodTables() else NULL), force = missing(functions) & missing(methods) -is;function;function;methods;object, class2 -isClass;function;function;methods;Class, formal = TRUE, where = topenv(parent.frame()) -isClassDef;function;function;methods;object -isClassUnion;function;function;methods;Class -isGeneric;function;function;methods;f, where = topenv(parent.frame()), fdef = NULL, getName = FALSE -isGrammarSymbol;function;function;methods;symbol -isGroup;function;function;methods;f, where = topenv(parent.frame()), fdef = getGeneric(f, where = where) -isSealedClass;function;function;methods;Class, where = topenv(parent.frame()) -isSealedMethod;function;function;methods;f, signature, fdef = getGeneric(f, FALSE, where = where), where = topenv(parent.frame()) -isVirtualClass;function;function;methods;Class, where = topenv(parent.frame()) -isXS3Class;function;function;methods;classDef -languageEl;function;function;methods;object, which -languageEl<-;function;function;methods;object, which, value -.Last.lib;function;function;methods;libpath -linearizeMlist;function;function;methods;mlist, inherited = TRUE -listFromMethods;function;function;methods;generic, where, table -listFromMlist;function;function;methods;mlist, prefix = list(), sigs. = TRUE, methods. = TRUE -loadMethod;function;function;methods;method, fname, envir -Logic;function;function;methods;e1, e2 -makeClassRepresentation;function;function;methods;name, slots = list(), superClasses = character(), prototype = NULL, package, validity = NULL, access = list(), version = .newExternalptr(), sealed = FALSE, virtual = NA, where -makeExtends;function;function;methods;Class, to, coerce = NULL, test = NULL, replace = NULL, by = character(), package, slots = getSlots(classDef1), classDef1 = getClass(Class), classDef2 -makeGeneric;function;function;methods;f, fdef, fdefault = fdef, group = list(), valueClass = character(), package = getPackageName(environment(fdef)), signature = NULL, genericFunction = NULL, simpleInheritanceOnly = NULL -makeMethodsList;function;function;methods;object, level = 1 -makePrototypeFromClassDef;function;function;methods;slots, ClassDef, extends, where -makeStandardGeneric;function;function;methods;f, fdef -matchSignature;function;function;methods;signature, fun, where = baseenv() -Math;function;function;methods;Generic Method -Math2;function;function;methods;x, digits -mergeMethods;function;function;methods;m1, m2, genericLabel = character() -metaNameUndo;function;function;methods;strings, prefix, searchForm = FALSE -MethodAddCoerce;function;function;methods;method, argName, thisClass, methodClass -methodSignatureMatrix;function;function;methods;object, sigSlots = c("target", "defined") -method.skeleton;function;function;methods;generic, signature, file, external = FALSE, where = topenv(parent.frame()) -MethodsList;function;function;methods;.ArgName, ... -MethodsListSelect;function;function;methods;f, env, mlist = NULL, fEnv = if (is(fdef, "genericFunction")) environment(fdef) else baseenv(), finalDefault = finalDefaultMethod(mlist), evalArgs = TRUE, useInherited = TRUE, fdef = getGeneric(f, where = env), resetAllowed = TRUE -methodsPackageMetaName;function;function;methods;prefix, name, package = "" -missingArg;function;function;methods;symbol, envir = parent.frame(), eval = FALSE -mlistMetaName;function;function;methods;name = "", package = "" -new;function;function;methods;Class, ... -newBasic;function;function;methods;Class, ... -newClassRepresentation;function;function;methods;... -newEmptyObject;function;function;methods;No arguments -.OldClassesList;list;list;methods;Not a function -Ops;function;function;methods;Generic Method -packageSlot;function;function;methods;object -packageSlot<-;function;function;methods;object, value -possibleExtends;function;function;methods;class1, class2, ClassDef1 = getClassDef(class1), ClassDef2 = getClassDef(class2, where = .classEnv(ClassDef1)) -prohibitGeneric;function;function;methods;name, where = topenv(parent.frame()) -promptClass;function;function;methods;clName, filename = NULL, type = "class", keywords = "classes", where = topenv(parent.frame()) -promptMethods;function;function;methods;f, filename = NULL, methods -prototype;function;function;methods;... -Quote;function;function;methods;No arguments -rbind2;function;function;methods;x, y -reconcilePropertiesAndPrototype;function;function;methods;name, properties, prototype, superClasses, where -registerImplicitGenerics;function;function;methods;what = .ImplicitGenericsTable(where), where = topenv(parent.frame()) -rematchDefinition;function;function;methods;definition, generic, mnames, fnames, signature -removeClass;function;function;methods;Class, where = topenv(parent.frame()) -removeGeneric;function;function;methods;f, where = topenv(parent.frame()) -removeMethod;function;function;methods;f, signature = character(), where = topenv(parent.frame()) -removeMethods;function;function;methods;f, where = topenv(parent.frame()), all = missing(where) -removeMethodsObject;function;function;methods;f, where = topenv(parent.frame()) -representation;function;function;methods;... -requireMethods;function;function;methods;functions, signature, message = "", where = topenv(parent.frame()) -resetClass;function;function;methods;Class, classDef, where -resetGeneric;function;function;methods;f, fdef = getGeneric(f, where = where), mlist = getMethodsForDispatch(fdef), where = topenv(parent.frame()), deflt = finalDefaultMethod(mlist) -S3Class;function;function;methods;object -S3Class<-;function;function;methods;object, value -S3Part;function;function;methods;object, strictS3 = FALSE, S3Class -S3Part<-;function;function;methods;object, strictS3 = FALSE, needClass = .S3Class(object), value -sealClass;function;function;methods;Class, where = topenv(parent.frame()) -seemsS4Object;function;function;methods;object -selectMethod;function;function;methods;f, signature, optional = FALSE, useInherited = TRUE, mlist = if (!is.null(fdef)) getMethodsForDispatch(fdef), fdef = getGeneric(f, !optional), verbose = FALSE, doCache = FALSE -selectSuperClasses;function;function;methods;Class, dropVirtual = FALSE, namesOnly = TRUE, directOnly = TRUE, simpleOnly = directOnly, where = topenv(parent.frame()) -.selectSuperClasses;function;function;methods;ext, dropVirtual = FALSE, namesOnly = TRUE, directOnly = TRUE, simpleOnly = directOnly -sessionData;function;function;methods;No arguments -setAs;function;function;methods;from, to, def, replace = NULL, where = topenv(parent.frame()) -setClass;function;function;methods;Class, representation = list(), prototype = NULL, contains = character(), validity = NULL, access = list(), where = topenv(parent.frame()), version = .newExternalptr(), sealed = FALSE, package = getPackageName(where), S3methods = FALSE -setClassUnion;function;function;methods;name, members = character(), where = topenv(parent.frame()) -setDataPart;function;function;methods;object, value, check = TRUE -setGeneric;function;function;methods;name, def = NULL, group = list(), valueClass = character(), where = topenv(parent.frame()), package = NULL, signature = NULL, useAsDefault = NULL, genericFunction = NULL, simpleInheritanceOnly = NULL -setGenericImplicit;function;function;methods;name, where = topenv(parent.frame()), restore = TRUE -setGroupGeneric;function;function;methods;name, def = NULL, group = list(), valueClass = character(), knownMembers = list(), package = getPackageName(where), where = topenv(parent.frame()) -setIs;function;function;methods;class1, class2, test = NULL, coerce = NULL, replace = NULL, by = character(), where = topenv(parent.frame()), classDef = getClass(class1, TRUE, where = where), extensionObject = NULL, doComplete = TRUE -setMethod;function;function;methods;f, signature = character(), definition, where = topenv(parent.frame()), valueClass = NULL, sealed = FALSE -setOldClass;function;function;methods;Classes, prototype = NULL, where = topenv(parent.frame()), test = FALSE, S4Class -setPackageName;function;function;methods;pkg, env -setPrimitiveMethods;function;function;methods;f, fdef, code, generic, mlist = get(".Methods", envir = environment(generic)) -setRefClass;function;function;methods;Class, fields = character(), contains = character(), methods = list(), where = topenv(parent.frame()), ... -setReplaceMethod;function;function;methods;f, ..., where = topenv(parent.frame()) -setValidity;function;function;methods;Class, method, where = topenv(parent.frame()) -.ShortPrimitiveSkeletons;list;list;methods;Not a function -show;function;function;methods;object -showClass;function;function;methods;Class, complete = TRUE, propertiesAreCalled = "Slots" -showDefault;function;function;methods;object, oldMethods = TRUE -showExtends;function;function;methods;ext, printTo = stdout() -showMethods;function;function;methods;f = character(), where = topenv(parent.frame()), classes = NULL, includeDefs = FALSE, inherited = !includeDefs, showEmpty, printTo = stdout(), fdef = getGeneric(f, where = where) -showMlist;function;function;methods;mlist, includeDefs = TRUE, inherited = TRUE, classes = NULL, useArgNames = TRUE, printTo = stdout() -signature;function;function;methods;... -SignatureMethod;function;function;methods;names, signature, definition -sigToEnv;function;function;methods;signature, generic -slot;function;function;methods;object, name -slot<-;function;function;methods;object, name, check = TRUE, value -slotNames;function;function;methods;x -.slotNames;function;function;methods;x -slotsFromS3;function;function;methods;object -substituteDirect;function;function;methods;object, frame = parent.frame(), cleanFunction = TRUE -substituteFunctionArgs;function;function;methods;def, newArgs, args = formalArgs(def), silent = FALSE, functionName = "a function" -Summary;function;function;methods;Generic Method -superClassDepth;function;function;methods;ClassDef, soFar = ClassDef@className, simpleOnly = TRUE -.__T__addNextMethod:methods;environment; ;methods;Not a function -.__T__Arith:base;environment; ;methods;Not a function -.__T__[:base;environment; ;methods;Not a function -.__T__$<-:base;environment; ;methods;Not a function -.__T__$:base;environment; ;methods;Not a function -.__T__body<-:base;environment; ;methods;Not a function -.__T__cbind2:methods;environment; ;methods;Not a function -.__T__coerce<-:methods;environment; ;methods;Not a function -.__T__coerce:methods;environment; ;methods;Not a function -.__T__Compare:methods;environment; ;methods;Not a function -.__T__Complex:base;environment; ;methods;Not a function -testInheritedMethods;function;function;methods;f, signatures, test = TRUE, virtual = FALSE, groupMethods = TRUE, where = .GlobalEnv -testVirtual;function;function;methods;properties, extends, prototype, where -.__T__initialize:methods;environment; ;methods;Not a function -.__T__loadMethod:methods;environment; ;methods;Not a function -.__T__Logic:base;environment; ;methods;Not a function -.__T__Math2:methods;environment; ;methods;Not a function -.__T__Math:base;environment; ;methods;Not a function -.__T__Ops:base;environment; ;methods;Not a function -traceOff;function;function;methods;what -traceOn;function;function;methods;what, tracer = browseAll, exit = NULL -.TraceWithMethods;function;function;methods;what, tracer = NULL, exit = NULL, at = numeric(), print = TRUE, signature = NULL, where = .GlobalEnv, edit = FALSE, from = NULL, untrace = FALSE -.__T__rbind2:methods;environment; ;methods;Not a function -tryNew;function;function;methods;Class, where -trySilent;function;function;methods;expr -.__T__show:methods;environment; ;methods;Not a function -.__T__slotsFromS3:methods;environment; ;methods;Not a function -.__T__Summary:base;environment; ;methods;Not a function -unRematchDefinition;function;function;methods;definition -.untracedFunction;function;function;methods;f -validObject;function;function;methods;object, test = FALSE, complete = FALSE -validSlotNames;function;function;methods;names -.valueClassTest;function;function;methods;object, classes, fname -.Autoloaded;unknown; ;Autoloads;Not a function -^;function;function;base;No arguments -~;function;function;base;No arguments -<;function;function;base;No arguments -<<-;function;function;base;No arguments -<=;function;function;base;No arguments -<-;function;function;base;No arguments -=;function;function;base;No arguments -==;function;function;base;No arguments ->;function;function;base;No arguments ->=;function;function;base;No arguments -|;function;function;base;Generic Method -||;function;function;base;No arguments --;function;function;base;Generic Method -:;function;function;base;No arguments -::;function;function;base;pkg, name -:::;function;function;base;pkg, name -!;function;function;base;No arguments -!=;function;function;base;No arguments -/;function;function;base;Generic Method -(;function;function;base;No arguments -[;function;function;base;Generic Method -[<-;function;function;base;Generic Method -[[;function;function;base;Generic Method -[[<-;function;function;base;Generic Method -{;function;function;base;No arguments -@;function;function;base;No arguments -$;function;function;base;No arguments -$<-;function;function;base;No arguments -*;function;function;base;Generic Method -&;function;function;base;Generic Method -&&;function;function;base;No arguments -%/%;function;function;base;No arguments -%*%;function;function;base;No arguments -%%;function;function;base;No arguments -+;function;function;base;Generic Method -abbreviate;function;function;base;names.arg, minlength = 4, use.classes = TRUE, dot = FALSE, strict = FALSE, method = c("left.kept", "both.sides") -abs;function;function;base;No arguments -acos;function;function;base;No arguments -acosh;function;function;base;No arguments -addNA;function;function;base;x, ifany = FALSE -addTaskCallback;function;function;base;f, data = NULL, name = character(0L) -agrep;function;function;base;pattern, x, ignore.case = FALSE, value = FALSE, max.distance = 0.1, useBytes = FALSE -.Alias;function;function;base;expr -alist;function;function;base;... -all;function;function;base;No arguments -all.equal;function;function;base;target, current, ... -all.equal.character;function;function;base;target, current, check.attributes = TRUE, ... -all.equal.default;function;function;base;target, current, ... -all.equal.factor;function;function;base;target, current, check.attributes = TRUE, ... -all.equal.formula;function;function;base;target, current, ... -all.equal.language;function;function;base;target, current, ... -all.equal.list;function;function;base;target, current, check.attributes = TRUE, ... -all.equal.numeric;function;function;base;target, current, tolerance = .Machine$double.eps^0.5, scale = NULL, check.attributes = TRUE, ... -all.equal.POSIXct;function;function;base;target, current, ..., scale = 1 -all.equal.raw;function;function;base;target, current, check.attributes = TRUE, ... -all.names;function;function;base;expr, functions = TRUE, max.names = -1L, unique = FALSE -all.vars;function;function;base;expr, functions = FALSE, max.names = -1L, unique = TRUE -any;function;function;base;No arguments -anyDuplicated;function;function;base;x, incomparables = FALSE, ... -anyDuplicated.array;function;function;base;x, incomparables = FALSE, MARGIN = 1L, fromLast = FALSE, ... -anyDuplicated.data.frame;function;function;base;x, incomparables = FALSE, fromLast = FALSE, ... -anyDuplicated.default;function;function;base;x, incomparables = FALSE, fromLast = FALSE, ... -anyDuplicated.matrix;function;function;base;x, incomparables = FALSE, MARGIN = 1L, fromLast = FALSE, ... -aperm;function;function;base;a, perm = NULL, resize = TRUE -append;function;function;base;x, values, after = length(x) -apply;function;function;base;X, MARGIN, FUN, ... -Arg;function;function;base;No arguments -args;function;function;base;name -.ArgsEnv;environment; ;base;Not a function -array;function;function;base;data = NA, dim = length(data), dimnames = NULL -arrayInd;function;function;base;ind, .dim, .dimnames = NULL, useNames = FALSE -as.array;function;function;base;x, ... -as.array.default;function;function;base;x, ... -as.call;function;function;base;No arguments -as.character;function;function;base;Generic Method -as.character.condition;function;function;base;x, ... -as.character.Date;function;function;base;x, ... -as.character.default;function;function;base;x, ... -as.character.error;function;function;base;x, ... -as.character.factor;function;function;base;x, ... -as.character.hexmode;function;function;base;x, ... -as.character.numeric_version;function;function;base;x, ... -as.character.octmode;function;function;base;x, ... -as.character.POSIXt;function;function;base;x, ... -as.character.srcref;function;function;base;x, useSource = TRUE, ... -as.complex;function;function;base;No arguments -as.data.frame;function;function;base;Generic Method -as.data.frame.array;function;function;base;x, row.names = NULL, optional = FALSE, ... -as.data.frame.AsIs;function;function;base;x, row.names = NULL, optional = FALSE, ... -as.data.frame.character;function;function;base;x, ..., stringsAsFactors = default.stringsAsFactors() -as.data.frame.complex;function;function;base;x, row.names = NULL, optional = FALSE, ..., nm = paste(deparse(substitute(x), width.cutoff = 500L), collapse = " ") -as.data.frame.data.frame;function;function;base;x, row.names = NULL, ... -as.data.frame.Date;function;function;base;x, row.names = NULL, optional = FALSE, ..., nm = paste(deparse(substitute(x), width.cutoff = 500L), collapse = " ") -as.data.frame.default;function;function;base;x, ... -as.data.frame.difftime;function;function;base;x, row.names = NULL, optional = FALSE, ..., nm = paste(deparse(substitute(x), width.cutoff = 500L), collapse = " ") -as.data.frame.factor;function;function;base;x, row.names = NULL, optional = FALSE, ..., nm = paste(deparse(substitute(x), width.cutoff = 500L), collapse = " ") -as.data.frame.integer;function;function;base;x, row.names = NULL, optional = FALSE, ..., nm = paste(deparse(substitute(x), width.cutoff = 500L), collapse = " ") -as.data.frame.list;function;function;base;x, row.names = NULL, optional = FALSE, ..., stringsAsFactors = default.stringsAsFactors() -as.data.frame.logical;function;function;base;x, row.names = NULL, optional = FALSE, ..., nm = paste(deparse(substitute(x), width.cutoff = 500L), collapse = " ") -as.data.frame.matrix;function;function;base;x, row.names = NULL, optional = FALSE, ..., stringsAsFactors = default.stringsAsFactors() -as.data.frame.model.matrix;function;function;base;x, row.names = NULL, optional = FALSE, ... -as.data.frame.numeric;function;function;base;x, row.names = NULL, optional = FALSE, ..., nm = paste(deparse(substitute(x), width.cutoff = 500L), collapse = " ") -as.data.frame.numeric_version;function;function;base;x, row.names = NULL, optional = FALSE, ..., nm = paste(deparse(substitute(x), width.cutoff = 500L), collapse = " ") -as.data.frame.ordered;function;function;base;x, row.names = NULL, optional = FALSE, ..., nm = paste(deparse(substitute(x), width.cutoff = 500L), collapse = " ") -as.data.frame.POSIXct;function;function;base;x, row.names = NULL, optional = FALSE, ..., nm = paste(deparse(substitute(x), width.cutoff = 500L), collapse = " ") -as.data.frame.POSIXlt;function;function;base;x, row.names = NULL, optional = FALSE, ... -as.data.frame.raw;function;function;base;x, row.names = NULL, optional = FALSE, ..., nm = paste(deparse(substitute(x), width.cutoff = 500L), collapse = " ") -as.data.frame.table;function;function;base;x, row.names = NULL, ..., responseName = "Freq", stringsAsFactors = TRUE -as.data.frame.ts;function;function;base;x, ... -as.data.frame.vector;function;function;base;x, row.names = NULL, optional = FALSE, ..., nm = paste(deparse(substitute(x), width.cutoff = 500L), collapse = " ") -as.Date;function;function;base;x, ... -as.Date.character;function;function;base;x, format = "", ... -as.Date.date;function;function;base;x, ... -as.Date.dates;function;function;base;x, ... -as.Date.default;function;function;base;x, ... -as.Date.factor;function;function;base;x, ... -as.Date.numeric;function;function;base;x, origin, ... -as.Date.POSIXct;function;function;base;x, tz = "UTC", ... -as.Date.POSIXlt;function;function;base;x, ... -as.difftime;function;function;base;tim, format = "%X", units = "auto" -as.double;function;function;base;Generic Method -as.double.difftime;function;function;base;x, units = "auto", ... -as.double.POSIXlt;function;function;base;x, ... -as.environment;function;function;base;No arguments -as.expression;function;function;base;x, ... -as.expression.default;function;function;base;x, ... -as.factor;function;function;base;x -as.function;function;function;base;x, ... -as.function.default;function;function;base;x, envir = parent.frame(), ... -as.hexmode;function;function;base;x -asin;function;function;base;No arguments -asinh;function;function;base;No arguments -as.integer;function;function;base;No arguments -[.AsIs;function;function;base;x, i, ... -as.list;function;function;base;x, ... -as.list.data.frame;function;function;base;x, ... -as.list.Date;function;function;base;x, ... -as.list.default;function;function;base;x, ... -as.list.environment;function;function;base;x, all.names = FALSE, ... -as.list.factor;function;function;base;x, ... -as.list.function;function;function;base;x, ... -as.list.numeric_version;function;function;base;x, ... -as.list.POSIXct;function;function;base;x, ... -as.logical;function;function;base;Generic Method -as.logical.factor;function;function;base;x, ... -as.matrix;function;function;base;Generic Method -as.matrix.data.frame;function;function;base;x, rownames.force = NA, ... -as.matrix.default;function;function;base;x, ... -as.matrix.noquote;function;function;base;x, ... -as.matrix.POSIXlt;function;function;base;x, ... -as.name;function;function;base;x -asNamespace;function;function;base;ns, base.OK = TRUE -as.null;function;function;base;x, ... -as.null.default;function;function;base;x, ... -as.numeric;function;function;base;No arguments -as.numeric_version;function;function;base;x -as.octmode;function;function;base;x -as.ordered;function;function;base;x -as.package_version;function;function;base;x -as.pairlist;function;function;base;x -as.POSIXct;function;function;base;x, tz = "", ... -as.POSIXct.date;function;function;base;x, ... -as.POSIXct.Date;function;function;base;x, ... -as.POSIXct.dates;function;function;base;x, ... -as.POSIXct.default;function;function;base;x, tz = "", ... -as.POSIXct.numeric;function;function;base;x, tz = "", origin, ... -as.POSIXct.POSIXlt;function;function;base;x, tz = "", ... -as.POSIXlt;function;function;base;x, tz = "", ... -as.POSIXlt.character;function;function;base;x, tz = "", format, ... -as.POSIXlt.date;function;function;base;x, ... -as.POSIXlt.Date;function;function;base;x, ... -as.POSIXlt.dates;function;function;base;x, ... -as.POSIXlt.default;function;function;base;x, tz = "", ... -as.POSIXlt.factor;function;function;base;x, ... -as.POSIXlt.numeric;function;function;base;x, tz = "", origin, ... -as.POSIXlt.POSIXct;function;function;base;x, tz = "", ... -as.qr;function;function;base;x -as.raw;function;function;base;No arguments -as.real;function;function;base;No arguments -asS3;function;function;base;object, flag = TRUE, complete = TRUE -asS4;function;function;base;object, flag = TRUE, complete = TRUE -assign;function;function;base;x, value, pos = -1, envir = as.environment(pos), inherits = FALSE, immediate = TRUE -as.single;function;function;base;x, ... -as.single.default;function;function;base;x, ... -as.symbol;function;function;base;x -as.table;function;function;base;x, ... -as.table.default;function;function;base;x, ... -as.vector;function;function;base;Generic Method -as.vector.factor;function;function;base;x, mode = "any" -atan;function;function;base;No arguments -atan2;function;function;base;y, x -atanh;function;function;base;No arguments -attach;function;function;base;what, pos = 2, name = deparse(substitute(what)), warn.conflicts = TRUE -attachNamespace;function;function;base;ns, pos = 2, dataPath = NULL, depends = NULL -attr;function;function;base;No arguments -attr<-;function;function;base;No arguments -attr.all.equal;function;function;base;target, current, check.attributes = TRUE, check.names = TRUE, ... -attributes;function;function;base;No arguments -attributes<-;function;function;base;No arguments -autoload;function;function;base;name, package, reset = FALSE, ... -.AutoloadEnv;environment; ;base;Not a function -autoloader;function;function;base;name, package, ... -backsolve;function;function;base;r, x, k = ncol(r), upper.tri = TRUE, transpose = FALSE -baseenv;function;function;base;No arguments -basename;function;function;base;path -.BaseNamespaceEnv;environment; ;base;Not a function -besselI;function;function;base;x, nu, expon.scaled = FALSE -besselJ;function;function;base;x, nu -besselK;function;function;base;x, nu, expon.scaled = FALSE -besselY;function;function;base;x, nu -beta;function;function;base;a, b -bindingIsActive;function;function;base;sym, env -bindingIsLocked;function;function;base;sym, env -bindtextdomain;function;function;base;domain, dirname = NULL -body;function;function;base;fun = sys.function(sys.parent()) -body<-;function;function;base;fun, envir = environment(fun), value -bquote;function;function;base;expr, where = parent.frame() -break;flow-control;flow-control;base;Not a function -browser;function;function;base;No arguments -browserCondition;function;function;base;n = 1L -browserSetDebug;function;function;base;n = 1L -browserText;function;function;base;n = 1L -builtins;function;function;base;internal = FALSE -by;function;function;base;data, INDICES, FUN, ..., simplify = TRUE -by.data.frame;function;function;base;data, INDICES, FUN, ..., simplify = TRUE -by.default;function;function;base;data, INDICES, FUN, ..., simplify = TRUE -bzfile;function;function;base;description, open = "", encoding = getOption("encoding"), compression = 9 -c;function;function;base;Generic Method -.C;function;function;base;No arguments -.cache_class;function;function;base;No arguments -call;function;function;base;No arguments -.Call;function;function;base;No arguments -callCC;function;function;base;fun -.Call.graphics;function;function;base;No arguments -capabilities;function;function;base;what = NULL -casefold;function;function;base;x, upper = FALSE -cat;function;function;base;..., file = "", sep = " ", fill = FALSE, labels = NULL, append = FALSE -category;function;function;base;... -cbind;function;function;base;Generic Method -cbind.data.frame;function;function;base;..., deparse.level = 1 -c.Date;function;function;base;..., recursive = FALSE -ceiling;function;function;base;No arguments -character;function;function;base;length = 0 -char.expand;function;function;base;input, target, nomatch = stop("no match") -charmatch;function;function;base;x, table, nomatch = NA_integer_ -charToRaw;function;function;base;x -chartr;function;function;base;old, new, x -check_tzones;function;function;base;... -chol;function;function;base;x, ... -chol2inv;function;function;base;x, size = NCOL(x), LINPACK = FALSE -chol.default;function;function;base;x, pivot = FALSE, LINPACK = pivot, ... -choose;function;function;base;n, k -class;function;function;base;No arguments -class<-;function;function;base;No arguments -close;function;function;base;con, ... -closeAllConnections;function;function;base;No arguments -close.connection;function;function;base;con, type = "rw", ... -close.srcfile;function;function;base;con, ... -c.noquote;function;function;base;..., recursive = FALSE -c.numeric_version;function;function;base;..., recursive = FALSE -codes;function;function;base;x, ... -codes<-;function;function;base;x, ..., value -codes.factor;function;function;base;x, ... -codes.ordered;function;function;base;x, ... -col;function;function;base;x, as.factor = FALSE -colMeans;function;function;base;x, na.rm = FALSE, dims = 1L -colnames;function;function;base;x, do.NULL = TRUE, prefix = "col" -colnames<-;function;function;base;x, value -colSums;function;function;base;x, na.rm = FALSE, dims = 1L -commandArgs;function;function;base;trailingOnly = FALSE -comment;function;function;base;x -comment<-;function;function;base;x, value -complex;function;function;base;length.out = 0, real = numeric(), imaginary = numeric(), modulus = 1, argument = 0 -computeRestarts;function;function;base;cond = NULL -conditionCall;function;function;base;c -conditionCall.condition;function;function;base;c -conditionMessage;function;function;base;c -conditionMessage.condition;function;function;base;c -conflicts;function;function;base;where = search(), detail = FALSE -Conj;function;function;base;No arguments -contributors;function;function;base;No arguments -cos;function;function;base;No arguments -cosh;function;function;base;No arguments -c.POSIXct;function;function;base;..., recursive = FALSE -c.POSIXlt;function;function;base;..., recursive = FALSE -crossprod;function;function;base;x, y = NULL -Cstack_info;function;function;base;No arguments -cummax;function;function;base;No arguments -cummin;function;function;base;No arguments -cumprod;function;function;base;No arguments -cumsum;function;function;base;No arguments -cut;function;function;base;x, ... -cut.Date;function;function;base;x, breaks, labels = NULL, start.on.monday = TRUE, right = FALSE, ... -cut.default;function;function;base;x, breaks, labels = NULL, include.lowest = FALSE, right = TRUE, dig.lab = 3, ordered_result = FALSE, ... -cut.POSIXt;function;function;base;x, breaks, labels = NULL, start.on.monday = TRUE, right = FALSE, ... -data.class;function;function;base;x -[<-.data.frame;function;function;base;x, i, j, value -[.data.frame;function;function;base;x, i, j, drop = if (missing(i)) TRUE else length(cols) == 1 -[[<-.data.frame;function;function;base;x, i, j, value -[[.data.frame;function;function;base;x, ..., exact = TRUE -$<-.data.frame;function;function;base;x, name, value -data.frame;function;function;base;..., row.names = NULL, check.rows = FALSE, check.names = TRUE, stringsAsFactors = default.stringsAsFactors() -data.matrix;function;function;base;frame, rownames.force = NA -date;function;function;base;No arguments --.Date;function;function;base;e1, e2 -[<-.Date;function;function;base;x, ..., value -[.Date;function;function;base;x, ..., drop = TRUE -[[.Date;function;function;base;x, ..., drop = TRUE -+.Date;function;function;base;e1, e2 -debug;function;function;base;fun, text = "", condition = NULL -debugonce;function;function;base;fun, text = "", condition = NULL -.decode_numeric_version;function;function;base;x, base = NULL -default.stringsAsFactors;function;function;base;No arguments -.Defunct;function;function;base;new, package = NULL, msg -delay;function;function;base;x, env = .GlobalEnv -delayedAssign;function;function;base;x, value, eval.env = parent.frame(1), assign.env = parent.frame(1) -deparse;function;function;base;expr, width.cutoff = 60L, backtick = mode(expr) %in% c("call", "expression", "(", "function"), control = c("keepInteger", "showAttributes", "keepNA"), nlines = -1L -.deparseOpts;function;function;base;control -.Deprecated;function;function;base;new, package = NULL, msg -det;function;function;base;x, ... -detach;function;function;base;name, pos = 2, unload = FALSE, character.only = FALSE, force = FALSE -determinant;function;function;base;x, logarithm = TRUE, ... -determinant.matrix;function;function;base;x, logarithm = TRUE, ... -.Device;character;character;base;Not a function -.Devices;pairlist;list;base;Not a function -dget;function;function;base;file -diag;function;function;base;x = 1, nrow, ncol -diag<-;function;function;base;x, value -diff;function;function;base;x, ... -diff.Date;function;function;base;x, lag = 1L, differences = 1L, ... -diff.default;function;function;base;x, lag = 1L, differences = 1L, ... -diff.POSIXt;function;function;base;x, lag = 1L, differences = 1L, ... -difftime;function;function;base;time1, time2, tz, units = c("auto", "secs", "mins", "hours", "days", "weeks") -/.difftime;function;function;base;e1, e2 -.difftime;function;function;base;xx, units -[.difftime;function;function;base;x, ..., drop = TRUE -*.difftime;function;function;base;e1, e2 -digamma;function;function;base;No arguments -dim;function;function;base;Generic Method -dim<-;function;function;base;No arguments -dim.data.frame;function;function;base;x -dimnames;function;function;base;Generic Method -dimnames<-;function;function;base;Generic Method -dimnames<-.data.frame;function;function;base;x, value -dimnames.data.frame;function;function;base;x -dir;function;function;base;path = ".", pattern = NULL, all.files = FALSE, full.names = FALSE, recursive = FALSE, ignore.case = FALSE -dir.create;function;function;base;path, showWarnings = TRUE, recursive = FALSE, mode = "0777" -dirname;function;function;base;path -$.DLLInfo;function;function;base;x, name -do.call;function;function;base;what, args, quote = FALSE, envir = parent.frame() -.doTrace;function;function;base;expr, msg -double;function;function;base;length = 0 -dput;function;function;base;x, file = "", control = c("keepNA", "keepInteger", "showAttributes") -dQuote;function;function;base;x -drop;function;function;base;x -droplevels;function;function;base;x, ... -droplevels.data.frame;function;function;base;x, except = NULL, ... -droplevels.factor;function;function;base;x, ... -dump;function;function;base;list, file = "dumpdata.R", append = FALSE, control = "all", envir = parent.frame(), evaluate = TRUE -duplicated;function;function;base;x, incomparables = FALSE, ... -duplicated.array;function;function;base;x, incomparables = FALSE, MARGIN = 1L, fromLast = FALSE, ... -duplicated.data.frame;function;function;base;x, incomparables = FALSE, fromLast = FALSE, ... -duplicated.default;function;function;base;x, incomparables = FALSE, fromLast = FALSE, ... -duplicated.matrix;function;function;base;x, incomparables = FALSE, MARGIN = 1L, fromLast = FALSE, ... -duplicated.numeric_version;function;function;base;x, incomparables = FALSE, ... -duplicated.POSIXlt;function;function;base;x, incomparables = FALSE, ... -.dynLibs;function;function;base;new -dyn.load;function;function;base;x, local = TRUE, now = TRUE, ... -dyn.unload;function;function;base;x -eapply;function;function;base;env, FUN, ..., all.names = FALSE, USE.NAMES = TRUE -eigen;function;function;base;x, symmetric, only.values = FALSE, EISPACK = FALSE -emptyenv;function;function;base;No arguments -enc2native;function;function;base;No arguments -enc2utf8;function;function;base;No arguments -.encode_numeric_version;function;function;base;x, base = NULL -encodeString;function;function;base;x, width = 0, quote = "", na.encode = TRUE, justify = c("left", "right", "centre", "none") -Encoding;function;function;base;x -Encoding<-;function;function;base;x, value -enquote;function;function;base;cl -environment;function;function;base;fun = NULL -environment<-;function;function;base;No arguments -environmentIsLocked;function;function;base;env -environmentName;function;function;base;env -env.profile;function;function;base;env -eval;function;function;base;expr, envir = parent.frame(), enclos = if (is.list(envir) || is.pairlist(envir)) parent.frame() else baseenv() -eval.parent;function;function;base;expr, n = 1 -evalq;function;function;base;expr, envir = parent.frame(), enclos = if (is.list(envir) || is.pairlist(envir)) parent.frame() else baseenv() -exists;function;function;base;x, where = -1, envir = if (missing(frame)) as.environment(where) else sys.frame(frame), frame, mode = "any", inherits = TRUE -exp;function;function;base;No arguments -expand.grid;function;function;base;..., KEEP.OUT.ATTRS = TRUE, stringsAsFactors = TRUE -.expand_R_libs_env_var;function;function;base;x -expm1;function;function;base;No arguments -.Export;function;function;base;... -expression;function;function;base;No arguments -.External;function;function;base;No arguments -.External.graphics;function;function;base;No arguments -F;logical;logical;base;Not a function -factor;function;function;base;x = character(), levels, labels = levels, exclude = NA, ordered = is.ordered(x) -[<-.factor;function;function;base;x, ..., value -[.factor;function;function;base;x, ..., drop = FALSE -[[<-.factor;function;function;base;x, ..., value -[[.factor;function;function;base;x, ... -factorial;function;function;base;x -fifo;function;function;base;description, open = "", blocking = FALSE, encoding = getOption("encoding") -file;function;function;base;description = "", open = "", blocking = TRUE, encoding = getOption("encoding"), raw = FALSE -file.access;function;function;base;names, mode = 0 -file.append;function;function;base;file1, file2 -file.choose;function;function;base;new = FALSE -file.copy;function;function;base;from, to, overwrite = recursive, recursive = FALSE -file.create;function;function;base;..., showWarnings = TRUE -file.exists;function;function;base;... -file.info;function;function;base;... -file.path;function;function;base;..., fsep = .Platform$file.sep -file.remove;function;function;base;... -file.rename;function;function;base;from, to -file.show;function;function;base;..., header = rep("", nfiles), title = "R Information", delete.file = FALSE, pager = getOption("pager"), encoding = "" -file.symlink;function;function;base;from, to -Filter;function;function;base;f, x -Find;function;function;base;f, x, right = FALSE, nomatch = NULL -findInterval;function;function;base;x, vec, rightmost.closed = FALSE, all.inside = FALSE -.find.package;function;function;base;package = NULL, lib.loc = NULL, quiet = FALSE, verbose = getOption("verbose") -findPackageEnv;function;function;base;info -findRestart;function;function;base;name, cond = NULL -.First.sys;function;function;base;No arguments -floor;function;function;base;No arguments -flush;function;function;base;con -flush.connection;function;function;base;con -for;flow-control;flow-control;base;Not a function -force;function;function;base;x -formals;function;function;base;fun = sys.function(sys.parent()) -formals<-;function;function;base;fun, envir = environment(fun), value -format;function;function;base;x, ... -format.AsIs;function;function;base;x, width = 12, ... -formatC;function;function;base;x, digits = NULL, width = NULL, format = NULL, flag = "", mode = NULL, big.mark = "", big.interval = 3L, small.mark = "", small.interval = 5L, decimal.mark = ".", preserve.width = "individual", zero.print = NULL, drop0trailing = FALSE -format.char;function;function;base;x, width = NULL, flag = "-" -format.data.frame;function;function;base;x, ..., justify = "none" -format.Date;function;function;base;x, ... -format.default;function;function;base;x, trim = FALSE, digits = NULL, nsmall = 0L, justify = c("left", "right", "centre", "none"), width = NULL, na.encode = TRUE, scientific = NA, big.mark = "", big.interval = 3L, small.mark = "", small.interval = 5L, decimal.mark = ".", zero.print = NULL, drop0trailing = FALSE, ... -format.difftime;function;function;base;x, ... -formatDL;function;function;base;x, y, style = c("table", "list"), width = 0.9 * getOption("width"), indent = NULL -format.factor;function;function;base;x, ... -format.hexmode;function;function;base;x, width = NULL, upper.case = FALSE, ... -format.info;function;function;base;x, digits = NULL, nsmall = 0 -format.numeric_version;function;function;base;x, ... -format.octmode;function;function;base;x, width = NULL, ... -format.POSIXct;function;function;base;x, format = "", tz = "", usetz = FALSE, ... -format.POSIXlt;function;function;base;x, format = "", usetz = FALSE, ... -format.pval;function;function;base;pv, digits = max(1, getOption("digits") - 2), eps = .Machine$double.eps, na.form = "NA", ... -.Fortran;function;function;base;No arguments -forwardsolve;function;function;base;l, x, k = ncol(l), upper.tri = FALSE, transpose = FALSE -function;function;function;base;No arguments -gamma;function;function;base;No arguments -gammaCody;function;function;base;x -gc;function;function;base;verbose = getOption("verbose"), reset = FALSE -gcinfo;function;function;base;verbose -gc.time;function;function;base;No arguments -gctorture;function;function;base;on = TRUE -.GenericArgsEnv;environment; ;base;Not a function -get;function;function;base;x, pos = -1, envir = as.environment(pos), mode = "any", inherits = TRUE -getAllConnections;function;function;base;No arguments -getCallingDLL;function;function;base;f = sys.function(-1), doStop = FALSE -getCallingDLLe;function;function;base;e -getCConverterDescriptions;function;function;base;No arguments -getCConverterStatus;function;function;base;No arguments -getConnection;function;function;base;what -getDLLRegisteredRoutines;function;function;base;dll, addNames = TRUE -getDLLRegisteredRoutines.character;function;function;base;dll, addNames = TRUE -getDLLRegisteredRoutines.DLLInfo;function;function;base;dll, addNames = TRUE -getenv;function;function;base;... -geterrmessage;function;function;base;No arguments -getExportedValue;function;function;base;ns, name -getHook;function;function;base;hookName -getLoadedDLLs;function;function;base;No arguments -getNamespace;function;function;base;name -getNamespaceExports;function;function;base;ns -getNamespaceImports;function;function;base;ns -getNamespaceInfo;function;function;base;ns, which -getNamespaceName;function;function;base;ns -getNamespaceUsers;function;function;base;ns -getNamespaceVersion;function;function;base;ns -getNativeSymbolInfo;function;function;base;name, PACKAGE, unlist = TRUE, withRegistrationInfo = FALSE -getNumCConverters;function;function;base;No arguments -getOption;function;function;base;x, default = NULL -.getRequiredPackages;function;function;base;file = "DESCRIPTION", lib.loc = NULL, quietly = FALSE, useImports = FALSE -.getRequiredPackages2;function;function;base;pkgInfo, quietly = FALSE, lib.loc = NULL, useImports = FALSE -getRversion;function;function;base;No arguments -getSrcLines;function;function;base;srcfile, first, last -getTaskCallbackNames;function;function;base;No arguments -gettext;function;function;base;..., domain = NULL -gettextf;function;function;base;fmt, ..., domain = NULL -getwd;function;function;base;No arguments -gl;function;function;base;n, k, length = n * k, labels = 1:n, ordered = FALSE -globalenv;function;function;base;No arguments -.GlobalEnv;environment; ;base;Not a function -gregexpr;function;function;base;pattern, text, ignore.case = FALSE, perl = FALSE, fixed = FALSE, useBytes = FALSE -grep;function;function;base;pattern, x, ignore.case = FALSE, perl = FALSE, value = FALSE, fixed = FALSE, useBytes = FALSE, invert = FALSE -grepl;function;function;base;pattern, x, ignore.case = FALSE, perl = FALSE, fixed = FALSE, useBytes = FALSE -gsub;function;function;base;pattern, replacement, x, ignore.case = FALSE, perl = FALSE, fixed = FALSE, useBytes = FALSE -.gt;function;function;base;x, i, j -.gtn;function;function;base;x, strictly -gzcon;function;function;base;con, level = 6, allowNonCompressed = TRUE -gzfile;function;function;base;description, open = "", encoding = getOption("encoding"), compression = 6 -.handleSimpleError;function;function;base;h, msg, call -.__H__.cbind;function;function;base;..., deparse.level = 1 -|.hexmode;function;function;base;a, b -[.hexmode;function;function;base;x, i -&.hexmode;function;function;base;a, b -.__H__.rbind;function;function;base;..., deparse.level = 1 -httpclient;function;function;base;url, port = 80, error.is.fatal = TRUE, check.MIME.type = TRUE, file = tempfile(), drop.ctrl.z = TRUE -I;function;function;base;x -iconv;function;function;base;x, from = "", to = "", sub = NA, mark = TRUE -iconvlist;function;function;base;No arguments -icuSetCollate;function;function;base;... -identical;function;function;base;x, y, num.eq = TRUE, single.NA = TRUE, attrib.as.set = TRUE -identity;function;function;base;x -if;flow-control;flow-control;base;Not a function -ifelse;function;function;base;test, yes, no -Im;function;function;base;No arguments -.Import;function;function;base;... -.ImportFrom;function;function;base;name, ... -importIntoEnv;function;function;base;impenv, impnames, expenv, expnames -%in%;function;function;base;x, table -inherits;function;function;base;x, what, which = FALSE -integer;function;function;base;length = 0 -interaction;function;function;base;..., drop = FALSE, sep = ".", lex.order = FALSE -interactive;function;function;base;No arguments -.Internal;function;function;base;No arguments -intersect;function;function;base;x, y -intToBits;function;function;base;x -intToUtf8;function;function;base;x, multiple = FALSE -inverse.rle;function;function;base;x, ... -invisible;function;function;base;No arguments -invokeRestart;function;function;base;r, ... -invokeRestartInteractively;function;function;base;r -is.array;function;function;base;No arguments -is.atomic;function;function;base;No arguments -isatty;function;function;base;con -isBaseNamespace;function;function;base;ns -is.call;function;function;base;No arguments -is.character;function;function;base;No arguments -is.complex;function;function;base;No arguments -is.data.frame;function;function;base;x -isdebugged;function;function;base;fun -is.double;function;function;base;No arguments -is.element;function;function;base;el, set -is.environment;function;function;base;No arguments -is.expression;function;function;base;No arguments -is.factor;function;function;base;x -is.finite;function;function;base;No arguments -is.function;function;function;base;No arguments -isIncomplete;function;function;base;con -is.infinite;function;function;base;No arguments -is.integer;function;function;base;No arguments -is.language;function;function;base;No arguments -is.list;function;function;base;No arguments -is.loaded;function;function;base;symbol, PACKAGE = "", type = "" -is.logical;function;function;base;No arguments -is.matrix;function;function;base;No arguments -.isMethodsDispatchOn;function;function;base;onOff = NULL -is.na;function;function;base;Generic Method -is.na<-;function;function;base;x, value -is.na.data.frame;function;function;base;x -is.na<-.default;function;function;base;x, value -is.na<-.factor;function;function;base;x, value -is.name;function;function;base;No arguments -isNamespace;function;function;base;ns -is.nan;function;function;base;No arguments -is.na.numeric_version;function;function;base;x -is.na.POSIXlt;function;function;base;x -is.null;function;function;base;No arguments -is.numeric;function;function;base;Generic Method -is.numeric.Date;function;function;base;x -is.numeric.difftime;function;function;base;x -is.numeric.POSIXt;function;function;base;x -is.numeric_version;function;function;base;x -is.object;function;function;base;No arguments -ISOdate;function;function;base;year, month, day, hour = 12, min = 0, sec = 0, tz = "GMT" -ISOdatetime;function;function;base;year, month, day, hour, min, sec, tz = "" -isOpen;function;function;base;con, rw = "" -.isOpen;function;function;base;srcfile -is.ordered;function;function;base;x -is.package_version;function;function;base;x -is.pairlist;function;function;base;No arguments -is.primitive;function;function;base;x -is.qr;function;function;base;x -is.R;function;function;base;No arguments -is.raw;function;function;base;No arguments -is.real;function;function;base;No arguments -is.recursive;function;function;base;No arguments -isRestart;function;function;base;x -isS4;function;function;base;object -isSeekable;function;function;base;con -is.single;function;function;base;No arguments -is.symbol;function;function;base;No arguments -isSymmetric;function;function;base;object, ... -isSymmetric.matrix;function;function;base;object, tol = 100 * .Machine$double.eps, ... -is.table;function;function;base;x -isTRUE;function;function;base;x -is.unsorted;function;function;base;x, na.rm = FALSE, strictly = FALSE -is.vector;function;function;base;x, mode = "any" -jitter;function;function;base;x, factor = 1, amount = NULL -julian;function;function;base;x, ... -julian.Date;function;function;base;x, origin = as.Date("1970-01-01"), ... -julian.POSIXt;function;function;base;x, origin = as.POSIXct("1970-01-01", tz = "GMT"), ... -kappa;function;function;base;z, ... -kappa.default;function;function;base;z, exact = FALSE, norm = NULL, method = c("qr", "direct"), ... -kappa.lm;function;function;base;z, ... -kappa.qr;function;function;base;z, ... -kappa.tri;function;function;base;z, exact = FALSE, LINPACK = TRUE, norm = NULL, ... -.knownS3Generics;character;character;base;Not a function -kronecker;function;function;base;X, Y, FUN = "*", make.dimnames = FALSE, ... -l10n_info;function;function;base;No arguments -labels;function;function;base;Generic Method -labels.default;function;function;base;object, ... -La.chol;function;function;base;x -La.chol2inv;function;function;base;x, size = ncol(x) -La.eigen;function;function;base;x, symmetric, only.values = FALSE, method = c("dsyevr", "dsyev") -lapply;function;function;base;X, FUN, ... -.Last.value;list;list;base;Not a function -.Last.value$value;function;function;base;Unknown arguments -.Last.value$visible;logical;logical;base;Not a function -La.svd;function;function;base;x, nu = min(n, p), nv = min(n, p) -lazyLoad;function;function;base;filebase, envir = parent.frame(), filter -lazyLoadDBfetch;function;function;base;No arguments -lbeta;function;function;base;a, b -lchoose;function;function;base;n, k -.leap.seconds;POSIXct; ;base;Not a function -length;function;function;base;Generic Method -length<-;function;function;base;Generic Method -length<-.factor;function;function;base;x, value -length.POSIXlt;function;function;base;x -letters;character;character;base;Not a function -LETTERS;character;character;base;Not a function -levels;function;function;base;x -levels<-;function;function;base;Generic Method -levels.default;function;function;base;x -levels<-.factor;function;function;base;x, value -lfactorial;function;function;base;x -lgamma;function;function;base;No arguments -.libPaths;function;function;base;new -library;function;function;base;package, help, pos = 2, lib.loc = NULL, character.only = FALSE, logical.return = FALSE, warn.conflicts = TRUE, quietly = FALSE, keep.source = getOption("keep.source.pkgs"), verbose = getOption("verbose") -.Library;character;character;base;Not a function -library.dynam;function;function;base;chname, package = NULL, lib.loc = NULL, verbose = getOption("verbose"), file.ext = .Platform$dynlib.ext, ... -library.dynam.unload;function;function;base;chname, libpath, verbose = getOption("verbose"), file.ext = .Platform$dynlib.ext -.Library.site;character;character;base;Not a function -licence;function;function;base;No arguments -license;function;function;base;No arguments -list;function;function;base;No arguments -list2env;function;function;base;x, envir = NULL, parent = parent.frame(), hash = FALSE, size = 29L -list.files;function;function;base;path = ".", pattern = NULL, all.files = FALSE, full.names = FALSE, recursive = FALSE, ignore.case = FALSE -[.listof;function;function;base;x, i, ... -load;function;function;base;file, envir = parent.frame() -loadedNamespaces;function;function;base;No arguments -loadingNamespaceInfo;function;function;base;No arguments -loadNamespace;function;function;base;package, lib.loc = NULL, keep.source = getOption("keep.source.pkgs"), partial = FALSE, declarativeOnly = FALSE -loadURL;function;function;base;url, envir = parent.frame(), quiet = TRUE, ... -local;function;function;base;expr, envir = new.env() -lockBinding;function;function;base;sym, env -lockEnvironment;function;function;base;env, bindings = FALSE -log;function;function;base;No arguments -log10;function;function;base;No arguments -log1p;function;function;base;No arguments -log2;function;function;base;No arguments -logb;function;function;base;x, base = exp(1) -logical;function;function;base;length = 0 -lower.tri;function;function;base;x, diag = FALSE -ls;function;function;base;name, pos = -1, envir = as.environment(pos), all.names = FALSE, pattern -machine;function;function;base;No arguments -Machine;function;function;base;No arguments -.Machine;list;list;base;Not a function -.Machine$double.eps;numeric;numeric;base;Not a function -.Machine$double.neg.eps;numeric;numeric;base;Not a function -.Machine$double.xmin;numeric;numeric;base;Not a function -.Machine$double.xmax;numeric;numeric;base;Not a function -.Machine$double.base;integer;numeric;base;Not a function -.Machine$double.digits;integer;numeric;base;Not a function -.Machine$double.rounding;integer;numeric;base;Not a function -.Machine$double.guard;integer;numeric;base;Not a function -.Machine$double.ulp.digits;integer;numeric;base;Not a function -.Machine$double.neg.ulp.digits;integer;numeric;base;Not a function -.Machine$double.exponent;integer;numeric;base;Not a function -.Machine$double.min.exp;integer;numeric;base;Not a function -.Machine$double.max.exp;integer;numeric;base;Not a function -.Machine$integer.max;integer;numeric;base;Not a function -.Machine$sizeof.long;integer;numeric;base;Not a function -.Machine$sizeof.longlong;integer;numeric;base;Not a function -.Machine$sizeof.longdouble;integer;numeric;base;Not a function -.Machine$sizeof.pointer;integer;numeric;base;Not a function -makeActiveBinding;function;function;base;sym, fun, env -.makeMessage;function;function;base;..., domain = NULL, appendLF = FALSE -make.names;function;function;base;names, unique = FALSE, allow_ = TRUE -.make_numeric_version;function;function;base;x, strict = TRUE, regexp, classes = NULL -make.unique;function;function;base;names, sep = "." -manglePackageName;function;function;base;pkgName, pkgVersion -Map;function;function;base;f, ... -mapply;function;function;base;FUN, ..., MoreArgs = NULL, SIMPLIFY = TRUE, USE.NAMES = TRUE -margin.table;function;function;base;x, margin = NULL -match;function;function;base;x, table, nomatch = NA_integer_, incomparables = NULL -match.arg;function;function;base;arg, choices, several.ok = FALSE -match.call;function;function;base;definition = NULL, call = sys.call(sys.parent()), expand.dots = TRUE -match.fun;function;function;base;FUN, descend = TRUE -Math.data.frame;function;function;base;x, ... -Math.Date;function;function;base;x, ... -Math.difftime;function;function;base;x, ... -Math.factor;function;function;base;x, ... -Math.POSIXt;function;function;base;x, ... -mat.or.vec;function;function;base;nr, nc -matrix;function;function;base;data = NA, nrow = 1, ncol = 1, byrow = FALSE, dimnames = NULL -max;function;function;base;No arguments -max.col;function;function;base;m, ties.method = c("random", "first", "last") -mean;function;function;base;x, ... -mean.data.frame;function;function;base;x, ... -mean.Date;function;function;base;x, ... -mean.default;function;function;base;x, trim = 0, na.rm = FALSE, ... -mean.difftime;function;function;base;x, ... -mean.POSIXct;function;function;base;x, ... -mean.POSIXlt;function;function;base;x, ... -memCompress;function;function;base;from, type = c("gzip", "bzip2", "xz", "none") -memDecompress;function;function;base;from, type = c("unknown", "gzip", "bzip2", "xz", "none"), asChar = FALSE -mem.limits;function;function;base;nsize = NA, vsize = NA -memory.profile;function;function;base;No arguments -merge;function;function;base;x, y, ... -merge.data.frame;function;function;base;x, y, by = intersect(names(x), names(y)), by.x = by, by.y = by, all = FALSE, all.x = all, all.y = all, sort = TRUE, suffixes = c(".x", ".y"), incomparables = NULL, ... -merge.default;function;function;base;x, y, ... -.mergeExportMethods;function;function;base;new, ns -.mergeImportMethods;function;function;base;impenv, expenv, metaname -message;function;function;base;..., domain = NULL, appendLF = TRUE -.methodsNamespace;environment; ;base;Not a function -mget;function;function;base;x, envir, mode = "any", ifnotfound = list(function(x) stop(paste("value for '", x, "' not found", sep = ""), call. = FALSE)), inherits = FALSE -min;function;function;base;No arguments -missing;function;function;base;No arguments -Mod;function;function;base;No arguments -mode;function;function;base;x -mode<-;function;function;base;x, value -month.abb;character;character;base;Not a function -month.name;character;character;base;Not a function -months;function;function;base;x, abbreviate -months.Date;function;function;base;x, abbreviate = FALSE -months.POSIXt;function;function;base;x, abbreviate = FALSE -mostattributes<-;function;function;base;obj, value -names;function;function;base;No arguments -names<-;function;function;base;No arguments -namespaceExport;function;function;base;ns, vars -namespaceImport;function;function;base;self, ... -namespaceImportClasses;function;function;base;self, ns, vars -namespaceImportFrom;function;function;base;self, ns, vars, generics, packages -namespaceImportMethods;function;function;base;self, ns, vars -nargs;function;function;base;No arguments -nchar;function;function;base;x, type = "chars", allowNA = FALSE -ncol;function;function;base;x -NCOL;function;function;base;x -Negate;function;function;base;f -new.env;function;function;base;hash = FALSE, parent = parent.frame(), size = 29L -next;flow-control;flow-control;base;Not a function -NextMethod;function;function;base;generic = NULL, object = NULL, ... -ngettext;function;function;base;n, msg1, msg2, domain = NULL -nlevels;function;function;base;x -.noGenerics;logical;logical;base;Not a function -noquote;function;function;base;obj -[.noquote;function;function;base;x, ... -norm;function;function;base;x, type = c("O", "I", "F", "M") -.NotYetImplemented;function;function;base;No arguments -.NotYetUsed;function;function;base;arg, error = TRUE -nrow;function;function;base;x -NROW;function;function;base;x -numeric;function;function;base;length = 0 -[.numeric_version;function;function;base;x, i, j -[[<-.numeric_version;function;function;base;x, ..., value -[[.numeric_version;function;function;base;x, ..., exact = NA -numeric_version;function;function;base;x, strict = TRUE -nzchar;function;function;base;No arguments -%o%;function;function;base;X, Y -objects;function;function;base;name, pos = -1, envir = as.environment(pos), all.names = FALSE, pattern -|.octmode;function;function;base;a, b -[.octmode;function;function;base;x, i -&.octmode;function;function;base;a, b -oldClass;function;function;base;No arguments -oldClass<-;function;function;base;No arguments -on.exit;function;function;base;No arguments -open;function;function;base;con, ... -open.connection;function;function;base;con, open = "r", blocking = TRUE, ... -open.srcfile;function;function;base;con, line, ... -open.srcfilecopy;function;function;base;con, line, ... -Ops.data.frame;function;function;base;e1, e2 = NULL -Ops.Date;function;function;base;e1, e2 -Ops.difftime;function;function;base;e1, e2 -Ops.factor;function;function;base;e1, e2 -Ops.numeric_version;function;function;base;e1, e2 -Ops.ordered;function;function;base;e1, e2 -Ops.POSIXt;function;function;base;e1, e2 -options;function;function;base;... -.Options;pairlist;list;base;Not a function -.Options$prompt;unknown; ;base;Not a function -.Options$continue;unknown; ;base;Not a function -.Options$expressions;unknown; ;base;Not a function -.Options$width;unknown; ;base;Not a function -.Options$digits;unknown; ;base;Not a function -.Options$echo;unknown; ;base;Not a function -.Options$verbose;unknown; ;base;Not a function -.Options$check.bounds;logical;logical;base;Not a function -.Options$keep.source;logical;logical;base;Not a function -.Options$keep.source.pkgs;logical;logical;base;Not a function -.Options$warning.length;integer;numeric;base;Not a function -.Options$OutDec;unknown; ;base;Not a function -.Options$rl_word_breaks;unknown; ;base;Not a function -.Options$warn;unknown; ;base;Not a function -.Options$timeout;unknown; ;base;Not a function -.Options$encoding;unknown; ;base;Not a function -.Options$show.error.messages;logical;logical;base;Not a function -.Options$scipen;unknown; ;base;Not a function -.Options$max.print;numeric;numeric;base;Not a function -.Options$add.smooth;logical;logical;base;Not a function -.Options$stringsAsFactors;unknown; ;base;Not a function -.Options$defaultPackages;unknown; ;base;Not a function -.Options$papersize;unknown; ;base;Not a function -.Options$printcmd;unknown; ;base;Not a function -.Options$dvipscmd;unknown; ;base;Not a function -.Options$texi2dvi;unknown; ;base;Not a function -.Options$browser;unknown; ;base;Not a function -.Options$pager;unknown; ;base;Not a function -.Options$pdfviewer;unknown; ;base;Not a function -.Options$useFancyQuotes;unknown; ;base;Not a function -.Options$help.try.all.packages;logical;logical;base;Not a function -.Options$internet.info;numeric;numeric;base;Not a function -.Options$pkgType;unknown; ;base;Not a function -.Options$str;unknown; ;base;Not a function -.Options$demo.ask;character;character;base;Not a function -.Options$example.ask;character;character;base;Not a function -.Options$HTTPUserAgent;unknown; ;base;Not a function -.Options$menu.graphics;logical;logical;base;Not a function -.Options$mailer;unknown; ;base;Not a function -.Options$unzip;unknown; ;base;Not a function -.Options$editor;unknown; ;base;Not a function -.Options$repos;unknown; ;base;Not a function -.Options$locatorBell;unknown; ;base;Not a function -.Options$device.ask.default;logical;logical;base;Not a function -.Options$bitmapType;unknown; ;base;Not a function -.Options$device;unknown; ;base;Not a function -.Options$contrasts;unknown; ;base;Not a function -.Options$na.action;character;character;base;Not a function -.Options$show.coef.Pvalues;logical;logical;base;Not a function -.Options$show.signif.stars;logical;logical;base;Not a function -.Options$ts.eps;numeric;numeric;base;Not a function -.Options$ts.S.compat;logical;logical;base;Not a function -.OptRequireMethods;function;function;base;No arguments -order;function;function;base;..., na.last = TRUE, decreasing = FALSE -ordered;function;function;base;x, ... -outer;function;function;base;X, Y, FUN = "*", ... -package.description;function;function;base;pkg, lib.loc = NULL, fields = NULL -packageEvent;function;function;base;pkgname, event = c("onLoad", "attach", "detach", "onUnload") -packageHasNamespace;function;function;base;package, package.lib -.packages;function;function;base;all.available = FALSE, lib.loc = NULL -packageStartupMessage;function;function;base;..., domain = NULL, appendLF = TRUE -.packageStartupMessage;function;function;base;message, call = NULL -$.package_version;function;function;base;x, name -package_version;function;function;base;x, strict = TRUE -packBits;function;function;base;x, type = c("raw", "integer") -pairlist;function;function;base;... -parent.env;function;function;base;env -parent.env<-;function;function;base;env, value -parent.frame;function;function;base;n = 1 -parse;function;function;base;file = "", n = NULL, text = NULL, prompt = "?", srcfile = NULL, encoding = "unknown" -parse.dcf;function;function;base;text = NULL, file = "", fields = NULL, versionfix = FALSE -parseNamespaceFile;function;function;base;package, package.lib, mustExist = TRUE -paste;function;function;base;..., sep = " ", collapse = NULL -path.expand;function;function;base;path -.path.package;function;function;base;package = NULL, quiet = FALSE -pentagamma;function;function;base;x -pi;numeric;numeric;base;Not a function -pipe;function;function;base;description, open = "", encoding = getOption("encoding") -Platform;function;function;base;No arguments -.Platform;list;list;base;Not a function -.Platform$OS.type;character;character;base;Not a function -.Platform$file.sep;character;character;base;Not a function -.Platform$dynlib.ext;character;character;base;Not a function -.Platform$GUI;unknown; ;base;Not a function -.Platform$endian;unknown; ;base;Not a function -.Platform$pkgType;unknown; ;base;Not a function -.Platform$path.sep;character;character;base;Not a function -.Platform$r_arch;unknown; ;base;Not a function -pmatch;function;function;base;x, table, nomatch = NA_integer_, duplicates.ok = FALSE -pmax;function;function;base;..., na.rm = FALSE -pmax.int;function;function;base;..., na.rm = FALSE -pmin;function;function;base;..., na.rm = FALSE -pmin.int;function;function;base;..., na.rm = FALSE -polyroot;function;function;base;z -Position;function;function;base;f, x, right = FALSE, nomatch = NA_integer_ -.POSIXct;function;function;base;xx, tz = NULL -[<-.POSIXct;function;function;base;x, ..., value -[.POSIXct;function;function;base;x, ..., drop = TRUE -[[.POSIXct;function;function;base;x, ..., drop = TRUE -.POSIXlt;function;function;base;xx, tz = NULL -[<-.POSIXlt;function;function;base;x, i, value -[.POSIXlt;function;function;base;x, ..., drop = TRUE --.POSIXt;function;function;base;e1, e2 -+.POSIXt;function;function;base;e1, e2 -pos.to.env;function;function;base;No arguments -pretty;function;function;base;x, ... -pretty.default;function;function;base;x, n = 5, min.n = n%/%3, shrink.sml = 0.75, high.u.bias = 1.5, u5.bias = 0.5 + 1.5 * high.u.bias, eps.correct = 0, ... -prettyNum;function;function;base;x, big.mark = "", big.interval = 3L, small.mark = "", small.interval = 5L, decimal.mark = ".", preserve.width = c("common", "individual", "none"), zero.print = NULL, drop0trailing = FALSE, is.cmplx = NA, ... -.Primitive;function;function;base;No arguments -.primTrace;function;function;base;No arguments -.primUntrace;function;function;base;No arguments -print;function;function;base;Generic Method -print.AsIs;function;function;base;x, ... -print.by;function;function;base;x, ..., vsep -print.condition;function;function;base;x, ... -print.connection;function;function;base;x, ... -print.data.frame;function;function;base;x, ..., digits = NULL, quote = FALSE, right = TRUE, row.names = TRUE -print.Date;function;function;base;x, ... -print.default;function;function;base;x, digits = NULL, quote = TRUE, na.print = NULL, print.gap = NULL, right = FALSE, max = NULL, useSource = TRUE, ... -print.difftime;function;function;base;x, digits = getOption("digits"), ... -print.DLLInfo;function;function;base;x, ... -print.DLLInfoList;function;function;base;x, ... -print.DLLRegisteredRoutines;function;function;base;x, ... -print.factor;function;function;base;x, quote = FALSE, max.levels = NULL, width = getOption("width"), ... -print.function;function;function;base;x, useSource = TRUE, ... -print.hexmode;function;function;base;x, ... -print.libraryIQR;function;function;base;x, ... -print.listof;function;function;base;x, ... -print.NativeRoutineList;function;function;base;x, ... -printNoClass;function;function;base;x, digits = NULL, quote = TRUE, na.print = NULL, print.gap = NULL, right = FALSE, ... -print.noquote;function;function;base;x, ... -print.numeric_version;function;function;base;x, ... -print.octmode;function;function;base;x, ... -print.packageInfo;function;function;base;x, ... -print.POSIXct;function;function;base;x, ... -print.POSIXlt;function;function;base;x, ... -print.proc_time;function;function;base;x, ... -print.restart;function;function;base;x, ... -print.rle;function;function;base;x, digits = getOption("digits"), prefix = "", ... -print.simple.list;function;function;base;x, ... -print.srcfile;function;function;base;x, ... -print.srcref;function;function;base;x, useSource = TRUE, ... -print.summaryDefault;function;function;base;x, ... -print.summary.table;function;function;base;x, digits = max(1, getOption("digits") - 3), ... -print.table;function;function;base;x, digits = getOption("digits"), quote = FALSE, na.print = "", zero.print = "0", justify = "none", ... -print.warnings;function;function;base;x, ... -prmatrix;function;function;base;x, rowlab = dn[[1]], collab = dn[[2]], quote = TRUE, right = FALSE, na.print = NULL, ... -proc.time;function;function;base;No arguments -prod;function;function;base;No arguments -prop.table;function;function;base;x, margin = NULL -provide;function;function;base;package -psigamma;function;function;base;x, deriv = 0 -pushBack;function;function;base;data, connection, newLine = TRUE -pushBackLength;function;function;base;connection -q;function;function;base;save = "default", status = 0, runLast = TRUE -qr;function;function;base;x, ... -qr.coef;function;function;base;qr, y -qr.default;function;function;base;x, tol = 1e-07, LAPACK = FALSE, ... -qr.fitted;function;function;base;qr, y, k = qr$rank -qr.Q;function;function;base;qr, complete = FALSE, Dvec = rep.int(if (cmplx) 1 + (0+0i) else 1, if (complete) dqr[1] else min(dqr)) -qr.qty;function;function;base;qr, y -qr.qy;function;function;base;qr, y -qr.R;function;function;base;qr, complete = FALSE -qr.resid;function;function;base;qr, y -qr.solve;function;function;base;a, b, tol = 1e-07 -qr.X;function;function;base;qr, complete = FALSE, ncol = if (complete) nrow(R) else min(dim(R)) -quarters;function;function;base;x, abbreviate -quarters.Date;function;function;base;x, ... -quarters.POSIXt;function;function;base;x, ... -quit;function;function;base;save = "default", status = 0, runLast = TRUE -quote;function;function;base;No arguments -range;function;function;base;Generic Method -range.default;function;function;base;..., na.rm = FALSE, finite = FALSE -rank;function;function;base;x, na.last = TRUE, ties.method = c("average", "first", "random", "max", "min") -rapply;function;function;base;object, f, classes = "ANY", deflt = NULL, how = c("unlist", "replace", "list"), ... -raw;function;function;base;length = 0 -rawConnection;function;function;base;object, open = "r" -rawConnectionValue;function;function;base;con -rawShift;function;function;base;x, n -rawToBits;function;function;base;x -rawToChar;function;function;base;x, multiple = FALSE -rbind;function;function;base;Generic Method -rbind.data.frame;function;function;base;..., deparse.level = 1 -rcond;function;function;base;x, norm = c("O", "I", "1"), triangular = FALSE, ... -Re;function;function;base;No arguments -readBin;function;function;base;con, what, n = 1L, size = NA_integer_, signed = TRUE, endian = .Platform$endian -readChar;function;function;base;con, nchars, useBytes = FALSE -read.dcf;function;function;base;file, fields = NULL, all = FALSE -readline;function;function;base;prompt = "" -readLines;function;function;base;con = stdin(), n = -1L, ok = TRUE, warn = TRUE, encoding = "unknown" -.readRDS;function;function;base;file, refhook = NULL -readRenviron;function;function;base;path -read.table.url;function;function;base;url, method, ... -real;function;function;base;length = 0 -Recall;function;function;base;... -Reduce;function;function;base;f, x, init, right = FALSE, accumulate = FALSE -regexpr;function;function;base;pattern, text, ignore.case = FALSE, perl = FALSE, fixed = FALSE, useBytes = FALSE -reg.finalizer;function;function;base;e, f, onexit = FALSE -registerS3method;function;function;base;genname, class, method, envir = parent.frame() -registerS3methods;function;function;base;info, package, env -remove;function;function;base;..., list = character(0L), pos = -1, envir = as.environment(pos), inherits = FALSE -removeCConverter;function;function;base;id -removeTaskCallback;function;function;base;id -rep;function;function;base;Generic Method -rep.Date;function;function;base;x, ... -repeat;flow-control;flow-control;base;Not a function -rep.factor;function;function;base;x, ... -rep.int;function;function;base;x, times -replace;function;function;base;x, list, values -replicate;function;function;base;n, expr, simplify = TRUE -rep.numeric_version;function;function;base;x, ... -rep.POSIXct;function;function;base;x, ... -rep.POSIXlt;function;function;base;x, ... -require;function;function;base;package, lib.loc = NULL, quietly = FALSE, warn.conflicts = TRUE, keep.source = getOption("keep.source.pkgs"), character.only = FALSE, save = FALSE -restart;function;function;base;No arguments -restartDescription;function;function;base;r -restartFormals;function;function;base;r -retracemem;function;function;base;No arguments -return;function;function;base;No arguments -rev;function;function;base;x -rev.default;function;function;base;x -R.home;function;function;base;component = "home" -rle;function;function;base;x -rm;function;function;base;..., list = character(0L), pos = -1, envir = as.environment(pos), inherits = FALSE -RNGkind;function;function;base;kind = NULL, normal.kind = NULL -RNGversion;function;function;base;vstr -round;function;function;base;Generic Method -round.Date;function;function;base;x, ... -round.POSIXt;function;function;base;x, units = c("secs", "mins", "hours", "days") -row;function;function;base;x, as.factor = FALSE -rowMeans;function;function;base;x, na.rm = FALSE, dims = 1L -rownames;function;function;base;x, do.NULL = TRUE, prefix = "row" -row.names;function;function;base;x -row.names<-;function;function;base;x, value -rownames<-;function;function;base;x, value -row.names<-.data.frame;function;function;base;x, value -row.names.data.frame;function;function;base;x -row.names<-.default;function;function;base;x, value -row.names.default;function;function;base;x -.row_names_info;function;function;base;x, type = 1L -rowsum;function;function;base;x, group, reorder = TRUE, ... -rowsum.data.frame;function;function;base;x, group, reorder = TRUE, na.rm = FALSE, ... -rowsum.default;function;function;base;x, group, reorder = TRUE, na.rm = FALSE, ... -rowSums;function;function;base;x, na.rm = FALSE, dims = 1L -R_system_version;function;function;base;x, strict = TRUE -R.version;simple.list;list;base;Not a function -R.version$platform;character;character;base;Not a function -R.version$arch;character;character;base;Not a function -R.version$os;character;character;base;Not a function -R.version$system;character;character;base;Not a function -R.version$status;character;character;base;Not a function -R.version$major;character;character;base;Not a function -R.version$minor;character;character;base;Not a function -R.version$year;character;character;base;Not a function -R.version$month;character;character;base;Not a function -R.version$day;character;character;base;Not a function -R.version$svn rev;unknown; ;base;Not a function -R.version$language;character;character;base;Not a function -R.version$version.string;character;character;base;Not a function -R.Version;function;function;base;No arguments -R.version.string;character;character;base;Not a function -.S3method;function;function;base;generic, class, method -.__S3MethodsTable__.;environment; ;base;Not a function -.S3PrimitiveGenerics;character;character;base;Not a function -sample;function;function;base;x, size, replace = FALSE, prob = NULL -sample.int;function;function;base;n, size = n, replace = FALSE, prob = NULL -sapply;function;function;base;X, FUN, ..., simplify = TRUE, USE.NAMES = TRUE -save;function;function;base;..., list = character(0L), file = stop("'file' must be specified"), ascii = FALSE, version = NULL, envir = parent.frame(), compress = !ascii, compression_level, eval.promises = TRUE, precheck = TRUE -save.image;function;function;base;file = ".RData", version = NULL, ascii = FALSE, compress = !ascii, safe = TRUE -.saveRDS;function;function;base;object, file = "", ascii = FALSE, version = NULL, compress = TRUE, refhook = NULL -scale;function;function;base;x, center = TRUE, scale = TRUE -scale.default;function;function;base;x, center = TRUE, scale = TRUE -scan;function;function;base;file = "", what = double(0), nmax = -1, n = -1, sep = "", quote = if (identical(sep, "\n")) "" else "'\"", dec = ".", skip = 0, nlines = 0, na.strings = "NA", flush = FALSE, fill = FALSE, strip.white = FALSE, quiet = FALSE, blank.lines.skip = TRUE, multi.line = TRUE, comment.char = "", allowEscapes = FALSE, fileEncoding = "", encoding = "unknown" -scan.url;function;function;base;url, file = tempfile(), method, ... -.Script;function;function;base;interpreter, script, args, ... -search;function;function;base;No arguments -searchpaths;function;function;base;No arguments -seek;function;function;base;con, ... -seek.connection;function;function;base;con, where = NA, origin = "start", rw = "", ... -seq;function;function;base;Generic Method -seq_along;function;function;base;No arguments -seq.Date;function;function;base;from, to, by, length.out = NULL, along.with = NULL, ... -seq.default;function;function;base;from = 1, to = 1, by = ((to - from)/(length.out - 1)), length.out = NULL, along.with = NULL, ... -seq.int;function;function;base;No arguments -seq_len;function;function;base;No arguments -seq.POSIXt;function;function;base;from, to, by, length.out = NULL, along.with = NULL, ... -sequence;function;function;base;nvec -serialize;function;function;base;object, connection, ascii = FALSE, refhook = NULL -setCConverterStatus;function;function;base;id, status -setdiff;function;function;base;x, y -setequal;function;function;base;x, y -setHook;function;function;base;hookName, value, action = c("append", "prepend", "replace") -setNamespaceInfo;function;function;base;ns, which, val -.set_row_names;function;function;base;n -set.seed;function;function;base;seed, kind = NULL, normal.kind = NULL -setSessionTimeLimit;function;function;base;cpu = Inf, elapsed = Inf -setTimeLimit;function;function;base;cpu = Inf, elapsed = Inf, transient = FALSE -setwd;function;function;base;dir -showConnections;function;function;base;all = FALSE -shQuote;function;function;base;string, type = c("sh", "csh", "cmd") -sign;function;function;base;No arguments -signalCondition;function;function;base;cond -.signalSimpleWarning;function;function;base;msg, call -signif;function;function;base;No arguments -simpleCondition;function;function;base;message, call = NULL -simpleError;function;function;base;message, call = NULL -[.simple.list;function;function;base;x, i, ... -simpleMessage;function;function;base;message, call = NULL -simpleWarning;function;function;base;message, call = NULL -sin;function;function;base;No arguments -single;function;function;base;length = 0 -sinh;function;function;base;No arguments -sink;function;function;base;file = NULL, append = FALSE, type = c("output", "message"), split = FALSE -sink.number;function;function;base;type = c("output", "message") -slice.index;function;function;base;x, MARGIN -socketConnection;function;function;base;host = "localhost", port, server = FALSE, blocking = FALSE, open = "a+", encoding = getOption("encoding") -socketSelect;function;function;base;socklist, write = FALSE, timeout = NULL -solve;function;function;base;Generic Method -solve.default;function;function;base;a, b, tol = ifelse(LINPACK, 1e-07, .Machine$double.eps), LINPACK = FALSE, ... -solve.qr;function;function;base;a, b, ... -sort;function;function;base;x, decreasing = FALSE, ... -sort.default;function;function;base;x, decreasing = FALSE, na.last = NA, ... -sort.int;function;function;base;x, partial = NULL, na.last = NA, decreasing = FALSE, method = c("shell", "quick"), index.return = FALSE -sort.list;function;function;base;x, partial = NULL, na.last = TRUE, decreasing = FALSE, method = c("shell", "quick", "radix") -sort.POSIXlt;function;function;base;x, decreasing = FALSE, na.last = NA, ... -source;function;function;base;file, local = FALSE, echo = verbose, print.eval = echo, verbose = getOption("verbose"), prompt.echo = getOption("prompt"), max.deparse.length = 150, chdir = FALSE, encoding = getOption("encoding"), continue.echo = getOption("continue"), skip.echo = 0, keep.source = getOption("keep.source") -source.url;function;function;base;url, file = tempfile(), method, ... -split;function;function;base;x, f, drop = FALSE, ... -split<-;function;function;base;x, f, drop = FALSE, ..., value -split<-.data.frame;function;function;base;x, f, drop = FALSE, ..., value -split.data.frame;function;function;base;x, f, drop = FALSE, ... -split.Date;function;function;base;x, f, drop = FALSE, ... -split<-.default;function;function;base;x, f, drop = FALSE, ..., value -split.default;function;function;base;x, f, drop = FALSE, ... -split.POSIXct;function;function;base;x, f, drop = FALSE, ... -sprintf;function;function;base;fmt, ... -sqrt;function;function;base;No arguments -sQuote;function;function;base;x -srcfile;function;function;base;filename, encoding = getOption("encoding"), Enc = "unknown" -srcfilecopy;function;function;base;filename, lines -srcref;function;function;base;srcfile, lloc -standardGeneric;function;function;base;No arguments -.standard_regexps;function;function;base;No arguments -stderr;function;function;base;No arguments -stdin;function;function;base;No arguments -stdout;function;function;base;No arguments -stop;function;function;base;..., call. = TRUE, domain = NULL -stopifnot;function;function;base;... -storage.mode;function;function;base;x -storage.mode<-;function;function;base;No arguments -strftime;function;function;base;x, format = "", tz = "", usetz = FALSE, ... -strptime;function;function;base;x, format, tz = "" -strsplit;function;function;base;x, split, fixed = FALSE, perl = FALSE, useBytes = FALSE -strtoi;function;function;base;x, base = 0L -strtrim;function;function;base;x, width -structure;function;function;base;.Data, ... -strwrap;function;function;base;x, width = 0.9 * getOption("width"), indent = 0, exdent = 0, prefix = "", simplify = TRUE, initial = prefix -sub;function;function;base;pattern, replacement, x, ignore.case = FALSE, perl = FALSE, fixed = FALSE, useBytes = FALSE -subset;function;function;base;x, ... -.subset;function;function;base;No arguments -.subset2;function;function;base;No arguments -subset.data.frame;function;function;base;x, subset, select, drop = FALSE, ... -subset.default;function;function;base;x, subset, ... -subset.matrix;function;function;base;x, subset, select, drop = FALSE, ... -substitute;function;function;base;No arguments -substr;function;function;base;x, start, stop -substr<-;function;function;base;x, start, stop, value -substring;function;function;base;text, first, last = 1000000L -substring<-;function;function;base;text, first, last = 1000000L, value -sum;function;function;base;No arguments -summary;function;function;base;Generic Method -summary.connection;function;function;base;object, ... -summary.data.frame;function;function;base;object, maxsum = 7, digits = max(3, getOption("digits") - 3), ... -Summary.data.frame;function;function;base;..., na.rm -summary.Date;function;function;base;object, digits = 12, ... -Summary.Date;function;function;base;..., na.rm -summary.default;function;function;base;object, ..., digits = max(3, getOption("digits") - 3) -Summary.difftime;function;function;base;..., na.rm -summary.factor;function;function;base;object, maxsum = 100, ... -Summary.factor;function;function;base;..., na.rm -summary.matrix;function;function;base;object, ... -Summary.numeric_version;function;function;base;..., na.rm -summary.POSIXct;function;function;base;object, digits = 15, ... -Summary.POSIXct;function;function;base;..., na.rm -summary.POSIXlt;function;function;base;object, digits = 15, ... -Summary.POSIXlt;function;function;base;..., na.rm -summary.srcfile;function;function;base;object, ... -summary.srcref;function;function;base;object, useSource = FALSE, ... -summary.table;function;function;base;object, ... -suppressMessages;function;function;base;expr -suppressPackageStartupMessages;function;function;base;expr -suppressWarnings;function;function;base;expr -svd;function;function;base;x, nu = min(n, p), nv = min(n, p), LINPACK = FALSE -sweep;function;function;base;x, MARGIN, STATS, FUN = "-", check.margin = TRUE, ... -switch;function;function;base;No arguments -symbol.C;function;function;base;name -symbol.For;function;function;base;name -sys.call;function;function;base;which = 0 -sys.calls;function;function;base;No arguments -Sys.chmod;function;function;base;paths, mode = "0777" -Sys.Date;function;function;base;No arguments -sys.frame;function;function;base;which = 0 -sys.frames;function;function;base;No arguments -sys.function;function;function;base;which = 0 -Sys.getenv;function;function;base;x = NULL, unset = "" -Sys.getlocale;function;function;base;category = "LC_ALL" -Sys.getpid;function;function;base;No arguments -Sys.glob;function;function;base;paths, dirmark = FALSE -Sys.info;function;function;base;No arguments -sys.load.image;function;function;base;name, quiet -Sys.localeconv;function;function;base;No arguments -sys.nframe;function;function;base;No arguments -sys.on.exit;function;function;base;No arguments -sys.parent;function;function;base;n = 1 -sys.parents;function;function;base;No arguments -Sys.putenv;function;function;base;... -Sys.readlink;function;function;base;paths -sys.save.image;function;function;base;name -Sys.setenv;function;function;base;... -Sys.setlocale;function;function;base;category = "LC_ALL", locale = "" -Sys.sleep;function;function;base;time -sys.source;function;function;base;file, envir = baseenv(), chdir = FALSE, keep.source = getOption("keep.source.pkgs") -sys.status;function;function;base;No arguments -system;function;function;base;command, intern = FALSE, ignore.stdout = FALSE, ignore.stderr = FALSE, wait = TRUE, input = NULL, show.output.on.console = TRUE, minimized = FALSE, invisible = TRUE -system2;function;function;base;command, args = character(), stdout = "", stderr = "", stdin = "", input = NULL, env = character(), wait = TRUE, minimized = FALSE, invisible = TRUE -system.file;function;function;base;..., package = "base", lib.loc = NULL -system.time;function;function;base;expr, gcFirst = TRUE -Sys.time;function;function;base;No arguments -Sys.timezone;function;function;base;No arguments -Sys.umask;function;function;base;mode = "0000" -Sys.unsetenv;function;function;base;x -Sys.which;function;function;base;names -t;function;function;base;Generic Method -T;logical;logical;base;Not a function -table;function;function;base;..., exclude = if (useNA == "no") c(NA, NaN), useNA = c("no", "ifany", "always"), dnn = list.names(...), deparse.level = 1 -tabulate;function;function;base;bin, nbins = max(1L, bin, na.rm = TRUE) -tan;function;function;base;No arguments -tanh;function;function;base;No arguments -.TAOCP1997init;function;function;base;seed -tapply;function;function;base;X, INDEX, FUN = NULL, ..., simplify = TRUE -taskCallbackManager;function;function;base;handlers = list(), registered = FALSE, verbose = FALSE -tcrossprod;function;function;base;x, y = NULL -t.data.frame;function;function;base;x -t.default;function;function;base;x -tempdir;function;function;base;No arguments -tempfile;function;function;base;pattern = "file", tmpdir = tempdir() -testPlatformEquivalence;function;function;base;built, run -tetragamma;function;function;base;x -textConnection;function;function;base;object, open = "r", local = FALSE, encoding = c("", "bytes", "UTF-8") -textConnectionValue;function;function;base;con -tolower;function;function;base;x -topenv;function;function;base;envir = parent.frame(), matchThisEnv = getOption("topLevelEnvironment") -toString;function;function;base;x, ... -toString.default;function;function;base;x, width = NULL, ... -toupper;function;function;base;x -trace;function;function;base;what, tracer, exit, at, print, signature, where = topenv(parent.frame()), edit = FALSE -traceback;function;function;base;x = NULL, max.lines = getOption("deparse.max.lines") -tracemem;function;function;base;No arguments -tracingState;function;function;base;on = NULL -transform;function;function;base;`_data`, ... -transform.data.frame;function;function;base;`_data`, ... -transform.default;function;function;base;`_data`, ... -trigamma;function;function;base;No arguments -trunc;function;function;base;Generic Method -truncate;function;function;base;con, ... -truncate.connection;function;function;base;con, ... -trunc.Date;function;function;base;x, ... -trunc.POSIXt;function;function;base;x, units = c("secs", "mins", "hours", "days"), ... -try;function;function;base;expr, silent = FALSE -tryCatch;function;function;base;expr, ..., finally -typeof;function;function;base;x -unclass;function;function;base;No arguments -undebug;function;function;base;fun -union;function;function;base;x, y -unique;function;function;base;x, incomparables = FALSE, ... -unique.array;function;function;base;x, incomparables = FALSE, MARGIN = 1, fromLast = FALSE, ... -unique.data.frame;function;function;base;x, incomparables = FALSE, fromLast = FALSE, ... -unique.default;function;function;base;x, incomparables = FALSE, fromLast = FALSE, ... -unique.matrix;function;function;base;x, incomparables = FALSE, MARGIN = 1, fromLast = FALSE, ... -unique.numeric_version;function;function;base;x, incomparables = FALSE, ... -unique.POSIXlt;function;function;base;x, incomparables = FALSE, ... -units;function;function;base;x -units<-;function;function;base;x, value -units<-.difftime;function;function;base;x, value -units.difftime;function;function;base;x -unix;function;function;base;call, intern = FALSE -unix.time;function;function;base;expr, gcFirst = TRUE -unlink;function;function;base;x, recursive = FALSE -unlist;function;function;base;Generic Method -unloadNamespace;function;function;base;ns -unlockBinding;function;function;base;sym, env -unname;function;function;base;obj, force = FALSE -unserialize;function;function;base;connection, refhook = NULL -unsplit;function;function;base;value, f, drop = FALSE -untrace;function;function;base;what, signature = NULL, where = topenv(parent.frame()) -untracemem;function;function;base;No arguments -unz;function;function;base;description, filename, open = "", encoding = getOption("encoding") -upper.tri;function;function;base;x, diag = FALSE -url;function;function;base;description, open = "", blocking = TRUE, encoding = getOption("encoding") -UseMethod;function;function;base;No arguments -.userHooksEnv;environment; ;base;Not a function -utf8ToInt;function;function;base;x -vapply;function;function;base;X, FUN, FUN.VALUE, ..., USE.NAMES = TRUE -vector;function;function;base;mode = "logical", length = 0 -Vectorize;function;function;base;FUN, vectorize.args = arg.names, SIMPLIFY = TRUE, USE.NAMES = TRUE -version;simple.list;list;base;Not a function -version$platform;character;character;base;Not a function -version$arch;character;character;base;Not a function -version$os;character;character;base;Not a function -version$system;character;character;base;Not a function -version$status;character;character;base;Not a function -version$major;character;character;base;Not a function -version$minor;character;character;base;Not a function -version$year;character;character;base;Not a function -version$month;character;character;base;Not a function -version$day;character;character;base;Not a function -version$svn rev;unknown; ;base;Not a function -version$language;character;character;base;Not a function -version$version.string;character;character;base;Not a function -Version;function;function;base;No arguments -warning;function;function;base;..., call. = TRUE, immediate. = FALSE, domain = NULL -warnings;function;function;base;... -weekdays;function;function;base;x, abbreviate -weekdays.Date;function;function;base;x, abbreviate = FALSE -weekdays.POSIXt;function;function;base;x, abbreviate = FALSE -which;function;function;base;x, arr.ind = FALSE, useNames = TRUE -which.max;function;function;base;x -which.min;function;function;base;x -while;flow-control;flow-control;base;Not a function -with;function;function;base;data, expr, ... -withCallingHandlers;function;function;base;expr, ... -with.default;function;function;base;data, expr, ... -within;function;function;base;data, expr, ... -within.data.frame;function;function;base;data, expr, ... -within.list;function;function;base;data, expr, ... -withRestarts;function;function;base;expr, ... -withVisible;function;function;base;x -write;function;function;base;x, file = "data", ncolumns = if (is.character(x)) 1 else 5, append = FALSE, sep = " " -writeBin;function;function;base;object, con, size = NA_integer_, endian = .Platform$endian, useBytes = FALSE -writeChar;function;function;base;object, con, nchars = nchar(object, type = "chars"), eos = "", useBytes = FALSE -write.dcf;function;function;base;x, file = "", append = FALSE, indent = 0.1 * getOption("width"), width = 0.9 * getOption("width") -writeLines;function;function;base;text, con = stdout(), sep = "\n", useBytes = FALSE -write.table0;function;function;base;x, file = "", append = FALSE, quote = TRUE, sep = " ", eol = "\n", na = "NA", dec = ".", row.names = TRUE, col.names = TRUE, qmethod = c("escape", "double") -%x%;function;function;base;X, Y -xor;function;function;base;x, y -xor.hexmode;function;function;base;a, b -xor.octmode;function;function;base;a, b -xpdrows.data.frame;function;function;base;x, old.rows, new.rows -xtfrm;function;function;base;Generic Method -xtfrm.AsIs;function;function;base;x -xtfrm.Date;function;function;base;x -xtfrm.default;function;function;base;x -xtfrm.difftime;function;function;base;x -xtfrm.factor;function;function;base;x -xtfrm.numeric_version;function;function;base;x -xtfrm.POSIXct;function;function;base;x -xtfrm.POSIXlt;function;function;base;x -xtfrm.Surv;function;function;base;x -xzfile;function;function;base;description, open = "", encoding = getOption("encoding"), compression = 6 -zapsmall;function;function;base;x, digits = getOption("digits") From 5e6680d92f7f9266c5eb9acdc441659a0367cd67 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Wed, 6 Jul 2011 12:18:38 -0300 Subject: [PATCH 0005/1050] Adapted the README to the development code available in this directory tree. --- README | 98 +++------------------------------------------------------- 1 file changed, 4 insertions(+), 94 deletions(-) diff --git a/README b/README index e5d3188..3ac2717 100644 --- a/README +++ b/README @@ -1,98 +1,8 @@ -This is a mirror of http://www.vim.org/scripts/script.php?script_id=2628 +This is the development code of Vim-R-plugin -This plugin improves Vim's support for editing R code and makes it possible to integrate Vim with R. The functionality is similar to what you can find in Tinn-R and ess mode of emacs. This filetype plugin uses either screen (Linux, OS X, or other Unix, optionally with the Screen plugin, vimscript #2711) or Python (Microsoft Windows) or Conque Shell plugin (all platforms, vimscript #2771) or Apple Script (Mac OS X) to communicate with R. +Stable versions are released at +http://www.vim.org/scripts/script.php?script_id=2628 -Screenshots and Debian package: http://sites.google.com/site/jalvesaq/vimrplugin +Please, read the file doc/r-plugin.txt for usage details. -MAIN FEATURES: - - * Syntax highlighting for R syntax, including: - - Special characters in strings. - - Functions of all installed packages (must be updated manually). - - Special highlighting for R output (.Rout files). - - Spell check only strings and comments. - - Fold code when foldmethod=syntax. - * Syntax highlighting for RHelp syntax. - * Smart indentation for R syntax. - * Smart indentation for RHelp syntax. - * Integrated communication with R: - - Start/Close R. - - Send lines, selection, paragraphs, functions, blocks, entire file. - - Send commands with the object under cursor as argument: help, args, - plot, print, str, summary, example, names. - - Send to R the Sweave and pdflatex commands. - - Run R inside a Vim's buffer. - * Omni completion (auto-completion) for R objects (.GlobalEnv and installed - packages. The list of installed packages must be updated manually. - * Ability to see R's documentation in a Vim's buffer: - - Automatic calculation of the best layout of the R documentation buffer - (split the window either horizontally or vertically according to the - available room). - - Automatic formating of the text to fit the panel width. - - Send code and commands to R (useful to run examples). - - Jump to another R documentation. - - Syntax highlighting of R documentation. - * Object Browser (.GlobalEnv and loaded packages; must be updated manually): - - Send commands with the object under cursor as argument. - - Call R's help() with the object under cursor as argument. - - Syntax highlighting of the Object Browser. - * Most of the plugin's behavior is customizable. - - -USE: Please, read the plugin's documentation. - -FILES: - - autoload/rcomplete.vim - bitmaps/RClearAll.bmp - bitmaps/RClearAll.png - bitmaps/RClear.bmp - bitmaps/RClear.png - bitmaps/RClose.bmp - bitmaps/RClose.png - bitmaps/ricon.png - bitmaps/ricon.xbm - bitmaps/RListSpace.bmp - bitmaps/RListSpace.png - bitmaps/RSendBlock.bmp - bitmaps/RSendBlock.png - bitmaps/RSendFile.bmp - bitmaps/RSendFile.png - bitmaps/RSendFunction.bmp - bitmaps/RSendFunction.png - bitmaps/RSendLine.bmp - bitmaps/RSendLine.png - bitmaps/RSendParagraph.bmp - bitmaps/RSendParagraph.png - bitmaps/RSendSelection.bmp - bitmaps/RSendSelection.png - bitmaps/RStart.bmp - bitmaps/RStart.png - doc/r-plugin.txt - ftdetect/r.vim - ftplugin/rhelp.vim - ftplugin/rnoweb.vim - ftplugin/r.vim - ftplugin/rbrowser.vim - indent/r.vim - indent/rhelp.vim - indent/rnoweb.vim - r-plugin/build_omniList.R - r-plugin/common_buffer.vim - r-plugin/common_global.vim - r-plugin/etags2ctags.R - r-plugin/functions.vim - r-plugin/omniList - r-plugin/vimbrowser.R - r-plugin/vimhelp.R - r-plugin/vimprint.R - r-plugin/vimSweave.R - r-plugin/r.snippets - r-plugin/specialfuns.R - r-plugin/tex_indent.vim - r-plugin/vimActivate.js - r-plugin/windows.py - syntax/rbrowser.vim - syntax/rout.vim - syntax/r.vim From 74c8e8ffe1f1d7758363d1bb677d53400a7bba5c Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Wed, 6 Jul 2011 12:57:35 -0300 Subject: [PATCH 0006/1050] Script to build the distribution files (zip and deb) of the plugin. --- make_dist.sh | 250 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 250 insertions(+) create mode 100755 make_dist.sh diff --git a/make_dist.sh b/make_dist.sh new file mode 100755 index 0000000..ae1cbd1 --- /dev/null +++ b/make_dist.sh @@ -0,0 +1,250 @@ +#!/bin/sh + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# A copy of the GNU General Public License is available at +# http://www.r-project.org/Licenses/ + + +############################################################ +# This script builds both the zip and the deb files of ## +# released versions of the plugin. The files are ## +# created at the /tmp directory. ## +############################################################ + + +# It's necessary to run the script as root to have the files permissions and +# ownership correctly set in the Debian package. +# The script requires the use of sudo to become root. +if [ "$USER" != "root" ] +then + echo "You must be root to run this script!" + exit 0 +fi + +PLUGINHOME=`pwd` +PLUGINVERSION=`date +%y%m%d` + +# To make the distribution version of the plugin the files +# functions.vim.vanilla and omniList.vanilla must exist. To generate these +# files, the Vim command :RUpdateObjList must be run with R vanilla running +# (that is, R with only the default libraries loaded) and, then, the files +# functions.vim and omniList must be renamed. +cd r-plugin +mv functions.vim functions.vim.current +mv omniList omniList.current +cp functions.vim.vanilla functions.vim +cp omniList.vanilla omniList + +# Go back to the plugin direictory +cd - + +# Update the version date in doc/r-plugin.txt header +sed -i -e "s/Version: [0-9][0-9][0-9][0-9][0-9][0-9]/Version: $PLUGINVERSION/" doc/r-plugin.txt + +# Create a tar.gz file +tar -cvzf /tmp/vimrplugintmpfile.tar.gz ftdetect/r.vim indent/r.vim \ + indent/rnoweb.vim indent/rhelp.vim autoload/rcomplete.vim ftplugin/r*.vim \ + syntax/rout.vim syntax/r.vim syntax/rhelp.vim syntax/rdoc.vim syntax/rbrowser.vim \ + r-plugin/*.R doc/r-plugin.txt r-plugin/functions.vim \ + r-plugin/global_r_plugin.vim r-plugin/omniList r-plugin/windows.py \ + r-plugin/vimActivate.js r-plugin/tex_indent.vim r-plugin/r.snippets \ + r-plugin/common_buffer.vim r-plugin/common_global.vim \ + bitmaps/ricon.xbm bitmaps/ricon.png \ + bitmaps/RStart.png bitmaps/RStart.bmp \ + bitmaps/RClose.png bitmaps/RClose.bmp \ + bitmaps/RSendFile.png bitmaps/RSendFile.bmp \ + bitmaps/RSendBlock.png bitmaps/RSendBlock.bmp \ + bitmaps/RSendFunction.png bitmaps/RSendFunction.bmp \ + bitmaps/RSendParagraph.png bitmaps/RSendParagraph.bmp \ + bitmaps/RSendSelection.png bitmaps/RSendSelection.bmp \ + bitmaps/RSendLine.png bitmaps/RSendLine.bmp \ + bitmaps/RListSpace.png bitmaps/RListSpace.bmp \ + bitmaps/RClear.png bitmaps/RClear.bmp \ + bitmaps/RClearAll.png bitmaps/RClearAll.bmp + +# Rename the functions.vim and omniList files +cd $PLUGINHOME/r-plugin +mv functions.vim.current functions.vim +mv omniList.current omniList + +######################################################## +## Create a Debian package ## + +# Create the directory of a Debian package +cd /tmp +mkdir -p vim-r-plugin-tmp/usr/share/vim/addons +mkdir -p vim-r-plugin-tmp/usr/share/vim/registry +mkdir -p vim-r-plugin-tmp/usr/share/doc/vim-r-plugin + +# Create the Debian changelog +DEBIANTIME=`date -R` +echo "vim-r-plugin ($PLUGINVERSION-1) unstable; urgency=low + +* Initial Release. + +-- Jakson Alves de Aquino $DEBIANTIME +" > vim-r-plugin-tmp/usr/share/doc/vim-r-plugin/changelog +gzip --best vim-r-plugin-tmp/usr/share/doc/vim-r-plugin/changelog + +# Create the yaml script +echo "addon: r-plugin +description: "Filetype plugin to work with R" +disabledby: "let disable_r_ftplugin = 1" +files: +- autoload/rcomplete.vim +- bitmaps/RClose.png +- bitmaps/RClear.png +- bitmaps/RClearAll.png +- bitmaps/RListSpace.png +- bitmaps/RSendBlock.png +- bitmaps/RSendFile.png +- bitmaps/RSendFunction.png +- bitmaps/RSendLine.png +- bitmaps/RSendParagraph.png +- bitmaps/RSendSelection.png +- bitmaps/RStart.png +- bitmaps/ricon.png +- bitmaps/ricon.xbm +- doc/r-plugin.txt +- ftdetect/r.vim +- ftplugin/r.vim +- ftplugin/rbrowser.vim +- ftplugin/rdoc.vim +- ftplugin/rhelp.vim +- ftplugin/rnoweb.vim +- indent/r.vim +- indent/rnoweb.vim +- indent/rhelp.vim +- r-plugin/build_omniList.R +- r-plugin/common_buffer.vim +- r-plugin/common_global.vim +- r-plugin/etags2ctags.R +- r-plugin/global_r_plugin.vim +- r-plugin/specialfuns.R +- r-plugin/tex_indent.vim +- r-plugin/vimbrowser.R +- r-plugin/vimhelp.R +- r-plugin/vimprint.R +- r-plugin/vimSweave.R +- syntax/r.vim +- syntax/rdoc.vim +- syntax/rout.vim +- syntax/rhelp.vim +- syntax/rbrowser.vim +" > vim-r-plugin-tmp/usr/share/vim/registry/vim-r-plugin.yaml + +# Create the copyright +echo "Copyright (C) 2011 Jakson Aquino + +License: GPLv2+ + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. + +See /usr/share/common-licenses/GPL-2, or + for the terms of the latest version +of the GNU General Public License. +" > vim-r-plugin-tmp/usr/share/doc/vim-r-plugin/copyright + +# Unpack the tar.gz and create the zip file +tar -xvzf vimrplugintmpfile.tar.gz -C vim-r-plugin-tmp/usr/share/vim/addons > /dev/null +rm vimrplugintmpfile.tar.gz +chown -R root.root vim-r-plugin-tmp +cd vim-r-plugin-tmp/usr/share/vim/addons +chmod +w r-plugin/tex_indent.vim +rm -f /tmp/vim-r-plugin-$PLUGINVERSION.zip +zip -r /tmp/vim-r-plugin-$PLUGINVERSION.zip . + +# Delete the files unnecessary in a Debian system +rm bitmaps/*.bmp r-plugin/windows.py r-plugin/vimActivate.js + +# Create the DEBIAN directory +cd /tmp/vim-r-plugin-tmp +mkdir DEBIAN +INSTALLEDSIZE=`du -s | sed -e 's/\t.*//'` + +# Create the control file +echo "Package: vim-r-plugin +Version: $PLUGINVERSION +Architecture: all +Maintainer: Jakson Alves de Aquino +Installed-Size: $INSTALLEDSIZE +Depends: vim | vim-gtk | vim-gnome, screen, vim-addon-manager, r-base | r-base-core +Enhances: vim +Section: text +Priority: extra +Homepage: http://www.vim.org/scripts/script.php?script_id=2628 +Description: Plugin to work with R + This filetype plugin uses screen to communicate with R, but the communication + does not work on Microsoft Windows. The new functions are similar to what you + can find in Tinn-R and ess mode of emacs." > DEBIAN/control + +# Create the md5sum file +arquivos=`find -type f | grep -v DEBIAN | sed -e 's/^\.\///'` +for i in $arquivos +do + md5sum $i >> DEBIAN/md5sums +done + +# Create the posinst and postrm scripts +echo '#!/bin/sh +set -e + +helpztags /usr/share/vim/addons/doc + +exit 0 +' > DEBIAN/postinst + +echo '#!/bin/sh +set -e + +helpztags /usr/share/vim/addons/doc + +exit 0 +' > DEBIAN/postrm + +chmod +x DEBIAN/postrm DEBIAN/postinst + +# Build the Debian package +cd /tmp +dpkg-deb -b vim-r-plugin-tmp vim-r-plugin_$PLUGINVERSION-1_all.deb + +# Clean +rm -rf vim-r-plugin-tmp + +# Change the ownership of both the zip and the deb files, so you can move and +# delete them without becoming root. +if [ "x$SUDO_USER" != "x" ] +then + cd /tmp + chown $SUDO_USER.$SUDO_USER vim-r-plugin-$PLUGINVERSION.zip vim-r-plugin_$PLUGINVERSION-1_all.deb +fi + +# Warn if the date in the doc is outdated +PLUGINVERSION=`date +"%Y-%m-%d"` +DOCDATEOK=`grep $PLUGINVERSION $PLUGINHOME/doc/r-plugin.txt` +if [ "x$DOCDATEOK" = "x" ] +then + echo "\033[31mYou must update the version date in r-plugin.txt\033[0m" +fi + From a55482c8e9b08718822edf42591199b076cc95eb Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 9 Jul 2011 20:38:33 -0300 Subject: [PATCH 0007/1050] Uses tmux as the default application to communicate with R on Linux when running Vim in a terminal emulator and no longer recommends the use of Conque Shell. --- doc/r-plugin.txt | 421 +++++++++++++++++++------------------ make_dist.sh | 12 +- r-plugin/common_global.vim | 80 +++---- r-plugin/screenrc | 8 + r-plugin/tmux.conf | 14 ++ 5 files changed, 281 insertions(+), 254 deletions(-) create mode 100644 r-plugin/screenrc create mode 100644 r-plugin/tmux.conf diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index e1af5aa..b46540f 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -5,7 +5,7 @@ Authors: Jakson A. Aquino Jose Claudio Faria -Version: 110628 +Version: 110706 For Vim version 7.3 1. Overview |r-plugin-overview| @@ -32,7 +32,7 @@ It uses some ideas and code from Johannes Ranke's (vim-r-plugin), Eric Van Dewoestine's (screen plugin), Vincent Nijs (R.vim for Mac OS X) and some ideas from the Tinn-R (Windows only) project. -The latest version of this plugin is available at: +The latest stable version of this plugin is available at: http://www.vim.org/scripts/script.php?script_id=2628 @@ -102,16 +102,16 @@ replaced. Please, look at |r-plugin-files| to see the list of files. 3.2.1. Unix (Linux, OS X, etc.)~ In addition to having R installed in your system, this plugin requires users -to install either: +to install: - Conque Shell: http://www.vim.org/scripts/script.php?script_id=2771 - or screen: http://www.gnu.org/software/screen + tmux: http://tmux.sourceforge.net + screen: http://www.gnu.org/s/screen + screen plugin: http://www.vim.org/scripts/script.php?script_id=2711 - Note: The screen application is already packaged for most GNU/Linux - distributions and other Unix variants. In fact, screen is installed by - default on many Linux distributions. Unfortunately, installation - instructions for these dependencies vary widely and are beyond the scope of - this documentation. + Note: The tmux and screen applications are already packaged for most + GNU/Linux distributions and other Unix variants. Unfortunately its + installation instructions vary widely and are beyond the scope of this + documentation. Uncompress the archive: > @@ -122,10 +122,20 @@ are in at the same directory): > :helptags ~/.vim/doc < -You may be interested in integrating the Vim-R-plugin with either screen.vim -plugin or Conque Shell plugin. See |vimrplugin_screenplugin| and -|vimrplugin_conqueplugin| for details. +If you do not have a custom tmux configuration file yet, copy the file +~/.vim/r-plugin/tmux.conf to ~/.tmux.conf +If you are using Vim (not GVim), the plugin will run inside a tmux session. If +are not already an user of tmux, please, read the |r-plugin-tmux| section to +learn a few useful shortcuts. The tmux.conf file that ships with this plugin +sets tmux to work with vi key bindings. + +Note: The recommended way of using the plugin on Linux is running Vim in a +terminal emulator, using tmux to split the terminal in two regions. This is +the default configuration when running Vim in a terminal emulator. It is also +possible to use the plugin with GVim and R in a external terminal emulator, +Vim in a terminal emulator and R in an external terminal emulator, and using +screen instead of tmux to split the terminal emulator in two regions. 3.2.2. Windows~ @@ -459,6 +469,60 @@ referencing source code located in other directories, including the entire R source code. +4.7. Tmux usage~ + *r-plugin-tmux* +When running Vim in an terminal emulator (Linux/Unix only), the Vim-R-plugin +will use the screen.vim plugin to restart Vim and start R in a tmux session. +The tmux configuration file provided by the Vim-R-plugin configures tmux to +use vi key bindings. The configuration script also sets as the tmux +scape character (the default is ), that is, you have to type before +typing a tmux command. Below are the most useful key bindings to use the +Vim-R-plugin with the provided tmux.conf. + + arrow keys : Move the cursor to the tmux panel above, below, at the + right or at the left of the current one. + + : Move the panel division upward one line, that is, resize + the panels. Repeat to move more. will + move the division downward one line. If you are using + the vertical split, you should use and + to resize the panels. + + [ : Enter the copy/scroll back mode. You can use vi key + bindings to move the cursor around the panel. Press + to exit the copy mode. Please, read the tmux + manual to learn how to copy and paste code between + panels. + +Please, read the manual page of tmux if you want to change the tmux +configuration and learn more commands. To read the tmux manual, type in the +terminal emulator: +> + man tmux +> +Note: was configured as the tmux scape character, and it will not be +passed to applications running under tmux. To send to either R or Vim +you have to type a. You can also set a different escape character in your +~/.tmux.conf. + +Note: Read the screen plugin documentation, especially the section +|screen-gotchas| (the E325 is caused by the presence of 'swapfile'). This +problem will not happen if you start Vim from within a tmux session, as in the +example below. + +A sample detachable session could be: + + - Start tmux: + tmux + - Start vim: + vim theScript.R + - Use Vim to start an R session: + \rf + - Send code from Vim to R, and, then, detach Vim and R with d + - Some time latter reattach the tmux session: + tmux attach + + ============================================================================== 5. How the plugin works~ *r-plugin-functioning* @@ -546,17 +610,17 @@ the R session, open a new terminal window and type: 6.4. The clipboard's content is lost (Windows only)~ On Windows, the plugin copies the command that will be sent to R into the -clipboard when not using the Conque Shell plugin. Thus, if you have anything -in the clipboard it will be lost while using the plugin. +clipboard. Thus, if you have anything in the clipboard it will be lost while +using the plugin. 6.5. The buffer name must be in the window title (Windows only)~ -On Windows, when not using the Conque Shell plugin, the plugin tries to -activate the "R Console" window, paste the command that is being sent to R, -and, then, activate the GVim window. To activate the GVim window the plugin -requires that the name of the file being edited be in the GVim windows title. -This is the default on Vim if you have not set the option 'titlestring'. +On Windows the plugin tries to activate the "R Console" window, paste the +command that is being sent to R, and, then, activate the GVim window. To +activate the GVim window the plugin requires that the name of the file being +edited be in the GVim windows title. This is the default on Vim if you have +not set the option 'titlestring'. 6.6. The menu may not reflect some of your custom key bindings~ @@ -568,11 +632,10 @@ Normal, Visual and Insert modes. 6.7. quit(save = "yes") may not work properly~ -If you are using either the Conque Shell plugin or the Screen plugin (and are -not running R in an external terminal), the R command quit(save = "yes") may -not have time enough to save the workspace. Vim will sleep for 1 second after -the command \rw before killing R but this time is not enough for big -workspaces. +If you are using either the Screen plugin (and are not running R in an +external terminal), the R command quit(save = "yes") may not have time enough +to save the workspace. Vim will sleep for 1 second after the command \rw +before killing R but this time is not enough for big workspaces. 6.8. Syntactically correct code may be wrongly indented~ @@ -623,9 +686,7 @@ indentation by adding braces and line breaks to it. Example: |vimrplugin_noscreenrc| Do not write custom screenrc |vimrplugin_screenplugin| Use the screen plugin |vimrplugin_screenvsplit| Split the window vertically with screen plugin -|vimrplugin_conqueplugin| Use the Conque Shell plugin -|vimrplugin_conquevsplit| Split the window vertically for Conque Shell -|vimrplugin_conquesleep| Time that Conque Shell will wait for output +|vimrplugin_tmux| Choose between tmux and screen |vimrplugin_applescript| Use osascript in Mac OS X. |vimrplugin_open_df| Show data.frame elements in the Object Browser |vimrplugin_open_list| Show list elements in the Object Browser @@ -689,17 +750,12 @@ put in your |vimrc|: *vimrplugin_open_df* *vimrplugin_open_list* *vimrplugin_allnames* -The Object Browser may be created in four different places: at the right/left -of the script windows or (if using Conque Shell) at the right/left of the R -Console window (see |vimrplugin_conqueplugin| for details on the use of Conque -Shell). By default, the Object Browser will be created with 40 columns at the -right side of the R Console. If Conque Shell is not being used, the Object -Browser will be at the right side of the script window. You can change the -Object Browser's default width and placement by putting different values in -your |vimrc|, as in the examples below: +By default, the Object Browser will be created with 40 columns at the right +side of the script window. You can change the Object Browser's default width +and placement by putting different values in your |vimrc|, as in the examples +below: > let vimrplugin_objbr_place = "script,right" - let vimrplugin_objbr_place = "console,left" let vimrplugin_objbr_w = 30 < The minimum width of the Object Browser windows is 9 columns. @@ -762,7 +818,7 @@ values to some variables in your |vimrc|, as in the example: 7.5. Number of R processes (Linux/Unix only)~ *vimrplugin_nosingler* *vimrplugin_by_vim_instance* -7.5.1 Using (G)Vim without the Conque Shell plugin or the Screen plugin~ +7.5.1 Using (G)Vim without the Screen plugin~ By default, all buffers of all (G)Vim instances send code to the same R process. If you prefer that each Vim buffer uses its own R process, put the following @@ -791,17 +847,6 @@ Both options are ignored when using Vim in a terminal emulator and using the Screen plugin. The plugin behaves as if the |vimrplugin_by_instance| was enabled. -7.5.3 Using the Conque Shell plugin~ - -By default, each Vim buffer sends code to its own R process. You can set -|vimrplugin_by_vim_instance| value to 1 if you prefer that all buffers of each -(G)Vim instance sends code to the same R process. When using the Conque Shell -plugin, there is no need of setting a Vim server because R will be running -inside a Vim's buffer, and, thus, Vim has direct access to R's input and -output. - -The option |vimrplugin_nosingler| is ignored. - 7.6. Use 32 bit version of R (Windows and Mac OS X only)~ *vimrplugin_i386* @@ -847,15 +892,7 @@ set the value of |vimrplugin_buildwait| to a higher value. Example: *vimrplugin_routmorecolors* By default, the R commands in .Rout files are highlighted with the color of comments, and only the output of commands has some of its elements highlighted -(numbers, strings, index of vectors, warnings and errors). The same -highlighting scheme is applied to the R Console when using the Conque Shell -plugin to run R inside a Vim's buffer. For one hand, we do not need to -highlight R commands in the Console if they were sent by the plugin from an R -script buffer since we have the code highlighted in the script buffer and in -the Console we want to pay attention to the output. A too colorful -highlighting scheme would be distracting. On the other hand, if we were typing -commands directly in the Console it would be beneficial to have the R syntax -highlighted. +(numbers, strings, index of vectors, warnings and errors). If you prefer that R commands in the R output are highlighted as they are in R scripts, put the following in your |vimrc|: @@ -876,13 +913,13 @@ a new split window, put in your |vimrc|: 7.12. Indent commented lines~ *vimrplugin_indent_commented* You can type \cc (where "\" is the ) to comment out a line or -selected lines. If the line alredy starts with a comment string, it will be +selected lines. If the line already starts with a comment string, it will be removed. After adding the comment string, the line will be reindented by default. To turn off the automatic indentation, put in your |vimrc|: > let vimrplugin_indent_commented = 0 < -What string wil be added to the beginning of the line depends on the values of +What string will be added to the beginning of the line depends on the values of vimrplugin_indent_commented and r_indent_ess_comments (see section 10.8 of this document), according to the table below: > @@ -895,180 +932,57 @@ this document), according to the table below: 7.13. Sleep time (Windows only)~ *vimrplugin_sleeptime* -The plugin gives to R a small amount of time to process the paste command when -not using the Conque Shell plugin. The default value is 0.2 second, but you -should experiment different values. The example show how to adjust the value -of sleeptime in your |vimrc|: +The plugin gives to R a small amount of time to process the paste command. The +default value is 0.2 second, but you should experiment different values. The +example show how to adjust the value of sleeptime in your |vimrc|: > let vimrplugin_sleeptime = 0.1 < -7.14. Screen configuration (Linux/Unix only)~ +7.14. Tmux and Screen configuration (Linux/Unix only)~ *vimrplugin_noscreenrc* -Vim runs screen with a special configuration file. If you want to use -your own ~/.screenrc, put in your |vimrc|: +GVim (or Vim running R in an external terminal emulator) runs +screen with the configuration files located at ~/.vim/r-plugin. If you want to +use your own ~/.tmux.conf or ~/.screenrc, put in your |vimrc|: > let vimrplugin_noscreenrc = 1 < -Below is a sample ~/.screenrc you may consider as a starting point to create -your own: -> - msgwait 0 - termcapinfo xterm* 'ti@:te@' - vbell off - term screen-256color -< 7.15. Integration with screen.vim (Linux/Unix only)~ *vimrplugin_screenplugin* *vimrplugin_screenvsplit* -By default, Vim-R-plugin will use the screen.vim plugin if it is installed -unless Conque Shell plugin is installed too. If you prefer to use both -Vim-R-plugin and screen plugin at the same time, download and install the -screen.vim from: - - http://www.vim.org/scripts/script.php?script_id=2711 - + *vimrplugin_tmux* +By default, when running in a terminal emulator, the Vim-R-plugin uses the +screen.vim plugin if it is installed and, by default, it will use tmux instead +of screen. If you prefer to use the screen application, put in your |vimrc|: +> + let vimrplugin_tmux = 0 +< Start Vim and do the command rf. The screen plugin will split the terminal in two regions and will run R in one of them. Using both plugins at the same time is especially useful for users who may prefer to use Vim and R in a terminal emulator, rather than using the graphical interface provided by GVim. -If you have the screen plugin installed but prefer do not integrate the it +If you have the screen plugin installed but prefer do not integrate it with the Vim-R-plugin you will need to add the following to your |vimrc|: > let vimrplugin_screenplugin = 0 < -The screen.vim plugin also supports tmux, which allows you to split the -terminal vertically. Please read |screen-intro| and |screen-shell-vertical| -for details. By default, the Vim-R-plugin will tell the screen plugin to -split the terminal horizontally. If you preffer to split it vertically, -install tmux and put in your |vimrc|: +The screen.vim plugin supports both screen and tmux, but only tmux allows you +to split the terminal vertically. Please read |screen-intro| and +|screen-shell-vertical| for details. By default, the Vim-R-plugin will tell +the screen plugin to split the terminal horizontally. If you prefer to split +it vertically put in your |vimrc|: > let vimrplugin_screenvsplit = 1 - let ScreenImpl = 'Tmux' < -Note that the second line is an option of the screen plugin and that it is -also possible to split the terminal vertically if using the correct version of -the screen application (see |screen-shell-vertical|). - -Note: Read the screen's documentation, especially the section |screen-gotchas| -(the E325 is caused by the presence of 'swapfile'). This problem will not -happen if you start Vim from within a screen session, as in the example below. -However, when starting Vim from within screen you will not be able to start a -new R session after closing the first one with the \rq command. Moreover, you -will have to manually switch from one screen region to another and kill them. - -A sample detachable session could be: - - - Start Vim through screen: - screen vim theScript.R - - Use Vim to start an R session: - \rf - - Send code from Vim to R, and, then, detach Vim and R with d - - Some time latter reattach the screen session: - screen -r - - Type S to split the region, to go the other region and - n until you get one region with Vim and the other with R. - - When you have finished to use Vim and R close them and type exit to - quit the screen session. - -Here are several useful screen shortcuts (please look at the screen man page -for a complete list): - - go from Vim to R and vice-versa - :resize N set the height of the current window to N lines - n switch to the next screen session - p switch to the previous screen session - S split the current region in two new ones - X kill the current region - Esc enter copy/scrollback mode - Esc quit the copy/scrollback mode - -By default, screen waits briefly after it receives external commands and other -default options may not be what you want. Please read screen documentation to -know how to configure it (see also |vimrplugin_noscreenrc|). - -Note: is the screen scape character, and it will not be passed to -applications running under screen. To send to either R or Vim you have -to type a. You can also set a different escape character in your -~/.screenrc (see |vimrplugin_noscreenrc|). - - -7.16. Integration with Conque Shell plugin~ - *vimrplugin_conqueplugin* - *vimrplugin_conquevsplit* - *vimrplugin_conquesleep* -The Conque Shell plugin is available at: - - http://www.vim.org/scripts/script.php?script_id=2771 - -By default, the Conque Shell plugin will be used if installed, unless you have -vimrplugin_screenplugin = 1 in your |vimrc|. If you installed the Conque -Shell but don't want to use it with the Vim-R-plugin, then you should put in -your |vimrc|: -> - let vimrplugin_conqueplugin = 0 -< -By default, the window will be split horizontally. Put the following in your -|vimrc| if you prefer to split the window vertically: -> - let vimrplugin_conquevsplit = 1 -< -Note: Nico Raffo's Conque Shell plugin is not perfect yet, but its use already -has some advantages: the ability to edit R's output, and the syntax -highlighting of the output. The three main problems of Conque Shell are due to -Vim limitations: the lack of a feature that may be called InsertCharPre event, -the impossibility of scrolling a buffer which is not being edited, and the use -of the same variable, 'updatetime', to do both save swap files and trigger -|CursorHold| events. - -As a consequence of the first limitation, Conque Shell sometimes gets confused -while converting typed text to strings to be sent to the application running -in a Vim buffer. With the current version of Conque Shell (2.0), on Windows, -only ascii characters can be either sent to or typed in the Conque Term. On -Linux or other system whose encoding is UTF-8, characters of any encoding can -be sent to the Conque Term, but only Latin-1 characters can be typed directly -in the Conque Term. - -The second limitation has a more obvious consequence: the shell buffer does -not scroll when there is new output but it is not the currently active buffer. -After a command is sent to the Conque buffer, the Conque Shell plugin waits -100 milliseconds (on Linux) or 200 milliseconds (on Windows) before reading -R's output. Longer values for the waiting time will increase the chances that -the output of R commands will be immediately shown in the R Console. To set a -different waiting time, change the value of vimrplugin_conquesleep in your -|vimrc| as in the example: -> - let vimrplugin_conquesleep = 300 -< -To manually scroll the R Console buffer, put the following in your |vimrc| -(replace with your preferred key): -> - nmap :call RScrollTerm() -< -Then, you will be able to scroll the R Console buffer at any time by pressing the - key in Normal mode. Of course, you should replace with your -preferred key. - -You may also want to put the following Conque options in your |vimrc| (look at -the Conque Shell documentations for details): -> - let ConqueTerm_CWInsert = 1 - let ConqueTerm_Color = 0 - let ConqueTerm_ReadUnfocused = 1 -< -Note: The use of |ConqueTerm_ReadUnfocused| will set the value of 'updatetime' -to 1000 milliseconds. - 7.17. Integration with Apple Script (OS X only)~ *vimrplugin_applescript* In Mac OS X, the plugin will try to send commands to R gui using Apple Script -if the Screen plugin and the Conque Shell plugin are not installed. If you -prefer to have R running in an external terminal emulator, put in your -|vimrc|: +if the Screen plugin is not installed. If you prefer to have R running in an +external terminal emulator, put in your |vimrc|: > let vimrplugin_applescript = 0 < @@ -1557,13 +1471,15 @@ called it will enter in debugging mode. Once debugging a function, you can hit to evaluate the current line, go(n) to go to line n in the function and qqq() to quit the function (See debug's help for details). +There is also the R package "edtdbg" which aims to integrate R debugging +facilities with Vim. 10.17. Turn the R-plugin into a global plugin~ *r-plugin-global* The Vim-R-plugin is a file type plugin. If you want its functionality available for all file types, then do one of the following: -10.17.1. When using either GVim or Vim + Conque Shell plugin~ +10.17.1. When using GVim~ Go to your ~/.vim/plugin directory and create a symbolic link to ~/.vim/r-plugin/global_r_plugin.vim. That is, type the following @@ -1579,7 +1495,7 @@ make a copy of the file to the ~/.vim/plugin directory and edit it. On Windows, you probably will have to make a copy of the file to the ~/vimfiles/plugin directory. -10.17.2. When using Vim + screen plugin (either screen or tmux)~ +10.17.2. When using Vim + screen plugin (either tmux or screen)~ Put in your |vimrc| (replace with the shortcut of your preference): > @@ -1603,9 +1519,98 @@ file. ============================================================================== -11. News~ +11. Integration with the Conque Shell plugin~ + +In addition to being integrated with the screen.vim plugin the Vim-R-plugin +can also use the Conque Shell plugin, but the Conque Shell still has some +important bugs and Vim has limitations that make the use of Conque Shell not +fully satisfying. The most important bug of Conque Shell is that it sometimes +do not show the complete output of an R command. This problem happens more +frequently when there are non ascii letters in the output. The three most +important Vim limitations are: + + - We cannot scroll the windows of a buffer that is not being edited and, + thus, we have to go to the R buffer to scroll it. This is a problem if we + are running an R command that slowly generates a lot of output because the + shell buffer does not scroll when there is new output but it is not the + currently active buffer. + + - The InsertCharPre event was implemented in a way that causes problems to + Conque Shell. We have to patch Vim's source code. + + - Vim does not have an timer which would make the Conque Shell more + efficient. Vim uses the same variable, 'updatetime', to do both save swap + files and trigger |CursorHold| events. + +In spite of these problems, the use of Conque Shell already has some +advantages: the ability to edit R's output, and the syntax highlighting of the +output. If you want to try the Conque Shell, install it from: + + http://www.vim.org/scripts/script.php?script_id=2771 + +and put in your |vimrc|: +> + let vimrplugin_conqueplugin = 1 +< +By default, the window will be split horizontally. Put the following in your +|vimrc| if you prefer to split the window vertically: +> + let vimrplugin_conquevsplit = 1 +< +You may also need to change the time that the Conque Shell waits for R output: + +After a command is sent to the Conque buffer, the Conque Shell plugin waits +100 milliseconds (on Linux) or 200 milliseconds (on Windows) before reading +R's output. Longer values for the waiting time will increase the chances that +the output of R commands will be immediately shown in the R Console. To set a +different waiting time, change the value of vimrplugin_conquesleep in your +|vimrc| as in the example: +> + let vimrplugin_conquesleep = 300 +< +To manually scroll the R Console buffer, put the following in your |vimrc| +(replace with your preferred key): +> + nmap :call RScrollTerm() +< +Then, you will be able to scroll the R Console buffer at any time by pressing the + key in Normal mode. Of course, you should replace with your +preferred key. + +You may also want to put the following Conque options in your |vimrc| (look at +the Conque Shell documentations for details): +> + let ConqueTerm_CWInsert = 1 + let ConqueTerm_Color = 0 + let ConqueTerm_ReadUnfocused = 1 +< +Note: The use of |ConqueTerm_ReadUnfocused| will set the value of 'updatetime' +to 1000 milliseconds. +> + let vimrplugin_conquesleep = 1 +< +With the Conque Shell, the option |vimrplugin_nosingler| is ignored, and, by +default, the object browser window will be created at the right of the R +Console window. + +The same highlighting scheme used for .Rout files is applied to the R Console +when using the Conque Shell plugin to run R inside a Vim's buffer. For one +hand, we do not need to highlight R commands in the Console if they were sent +by the plugin from an R script buffer since we have the code highlighted in +the script buffer and in the Console we want to pay attention to the output. A +too colorful highlighting scheme would be distracting. On the other hand, if +we were typing commands directly in the Console it would be beneficial to have +the R syntax highlighted. + + + +============================================================================== +12. News~ *r-plugin-news* + * New option: vimrplugin_tmux. + * Set tmux as the default instead of either screen or conque shell. + * Document tmux as the prefered way of running the plugin on Linux. * Vim-LaTeX-suite plugin can be used with Rnoweb files without any additional configuration. The necessary code was added to the ftplugin/rnoweb.vim. diff --git a/make_dist.sh b/make_dist.sh index ae1cbd1..21ba606 100755 --- a/make_dist.sh +++ b/make_dist.sh @@ -14,11 +14,11 @@ # http://www.r-project.org/Licenses/ -############################################################ -# This script builds both the zip and the deb files of ## -# released versions of the plugin. The files are ## -# created at the /tmp directory. ## -############################################################ +########################################################### +# This script builds both the zip and the deb files of # +# released versions of the plugin. The files are # +# created at the /tmp directory. # +########################################################### # It's necessary to run the script as root to have the files permissions and @@ -189,7 +189,7 @@ Version: $PLUGINVERSION Architecture: all Maintainer: Jakson Alves de Aquino Installed-Size: $INSTALLEDSIZE -Depends: vim | vim-gtk | vim-gnome, screen, vim-addon-manager, r-base | r-base-core +Depends: vim | vim-gtk | vim-gnome, screen, tmux, ncurses-term, vim-addon-manager, r-base | r-base-core Enhances: vim Section: text Priority: extra diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 4c1b2f7..49df9e6 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -17,7 +17,7 @@ " " Based on previous work by Johannes Ranke " -" Last Change: Mon Jun 27, 2011 08:40AM +" Last Change: Sat Jul 09, 2011 08:31PM " " Purposes of this file: Create all functions and commands and Set the " value of all global variables and some buffer variables.for r, @@ -2000,6 +2000,7 @@ call RSetDefaultValue("g:vimrplugin_underscore", 1) call RSetDefaultValue("g:vimrplugin_rnowebchunk", 1) call RSetDefaultValue("g:vimrplugin_i386", 0) call RSetDefaultValue("g:vimrplugin_applescript", 1) +call RSetDefaultValue("g:vimrplugin_tmux", 1) call RSetDefaultValue("g:vimrplugin_screenvsplit", 0) call RSetDefaultValue("g:vimrplugin_conquevsplit", 0) call RSetDefaultValue("g:vimrplugin_listmethods", 0) @@ -2126,12 +2127,15 @@ if has("gui_win32") let g:vimrplugin_sleeptime = 0.02 endif else - if !executable('screen') && !exists("g:ConqueTerm_Version") - if has("python") || has("python3") - call RWarningMsg("Please, install either the 'screen' application or the 'Conque Shell' plugin to enable the Vim-R-plugin.") - else - call RWarningMsg("Please, install the 'screen' application to enable the Vim-R-plugin.") - endif + if (has("gui_running") || g:vimrplugin_tmux == 0) && !executable('screen') + let s:rplugin_missing_screen = 1 + call RWarningMsg("Please, install the 'screen' application to enable the Vim-R-plugin with GVim.") + endif + if !has("gui_running") && !executable('tmux') && g:vimrplugin_tmux == 1 + let s:rplugin_missing_tmux = 1 + call RWarningMsg("Please, install the 'tmux' application to enable the Vim-R-plugin.") + endif + if exists("s:rplugin_missing_tmux") || exists("s:rplugin_missing_screen") call input("Press to continue. ") let g:rplugin_failed = 1 finish @@ -2159,34 +2163,10 @@ endif let g:rplugin_docfile = $VIMRPLUGIN_TMPDIR . "/Rdoc" let g:rplugin_globalenvfname = $VIMRPLUGIN_TMPDIR . "/GlobalEnvList" -" Use Conque Shell plugin by default... -if exists("g:ConqueTerm_Loaded") && !exists("g:vimrplugin_conqueplugin") - if has("python") || has("python3") - let g:vimrplugin_conqueplugin = 1 - " ... unless explicitly told otherwise in the vimrc - if exists("g:vimrplugin_screenplugin") && g:vimrplugin_screenplugin == 1 - let g:vimrplugin_conqueplugin = 0 - endif - else - call RWarningMsg("Python interface must be enabled to run Vim-R-Plugin with Conque Shell.") - let g:vimrplugin_conqueplugin = 0 - sleep 2 - endif -endif -if exists("g:vimrplugin_conqueplugin") && g:vimrplugin_conqueplugin == 1 - if !exists("g:ConqueTerm_Version") || (exists("g:ConqueTerm_Version") && g:ConqueTerm_Version < 120) - let g:vimrplugin_conqueplugin = 0 - call RWarningMsg("Vim-R-plugin requires Conque Shell plugin >= 1.2") - call input("Press to continue. ") - endif -endif - -if !exists("g:vimrplugin_conqueplugin") - let g:vimrplugin_conqueplugin = 0 -endif - -if g:vimrplugin_conqueplugin == 1 - let g:vimrplugin_screenplugin = 0 +if g:vimrplugin_tmux + let g:ScreenImpl = 'Tmux' +else + let g:ScreenImpl = 'GnuScreen' endif if !exists("g:vimrplugin_screenplugin") @@ -2211,13 +2191,33 @@ if !exists("g:vimrplugin_screenplugin") || has('gui_running') let g:vimrplugin_screenplugin = 0 endif +" Use Conque Shell plugin +if g:vimrplugin_screenplugin == 0 && !exists("g:vimrplugin_conqueplugin") + if exists("g:ConqueTerm_Loaded") + if has("python") || has("python3") + let g:vimrplugin_conqueplugin = 1 + else + call RWarningMsg("Python interface must be enabled to run Vim-R-Plugin with Conque Shell.") + let g:vimrplugin_conqueplugin = 0 + sleep 2 + endif + endif + if !exists("g:vimrplugin_conqueplugin") + let g:vimrplugin_conqueplugin = 0 + endif +endif + +if exists("g:vimrplugin_conqueplugin") && g:vimrplugin_conqueplugin == 1 + if !exists("g:ConqueTerm_Version") || (exists("g:ConqueTerm_Version") && g:ConqueTerm_Version < 210) + let g:vimrplugin_conqueplugin = 0 + call RWarningMsg("Vim-R-plugin requires Conque Shell plugin >= 2.1") + call input("Press to continue. ") + endif +endif + " Check again if screen is installed if !has("gui_win32") && g:vimrplugin_conqueplugin == 0 && g:vimrplugin_screenplugin == 0 && !executable("screen") - if (has("python") || has("python3")) && !exists("g:ConqueTerm_Version") - call RWarningMsg("Please, install either the 'screen' application or the 'Conque Shell' plugin to enable the Vim-R-plugin.") - else - call RWarningMsg("Please, install the 'screen' application to enable the Vim-R-plugin.") - endif + call RWarningMsg("Please, install both the 'screen' and the 'tmux' applications to enable the Vim-R-plugin.") call input("Press to continue. ") let g:rplugin_failed = 1 finish diff --git a/r-plugin/screenrc b/r-plugin/screenrc new file mode 100644 index 0000000..19e311b --- /dev/null +++ b/r-plugin/screenrc @@ -0,0 +1,8 @@ +msgwait 0 +termcapinfo xterm* 'ti@:te@' +vbell off +term screen-256color +startup_message off +bind a resize +1 +bind z resize -1 + diff --git a/r-plugin/tmux.conf b/r-plugin/tmux.conf new file mode 100644 index 0000000..b5b96e1 --- /dev/null +++ b/r-plugin/tmux.conf @@ -0,0 +1,14 @@ +# changing the main key binding +set-option -g prefix C-a +unbind-key C-b +bind-key C-a send-prefix + +# changing the mode-keys to vi +set-window-option -g mode-keys vi + +# 256 colors +set -g default-terminal "screen-256color" + +# Disable the status bar +set -g status off + From d9070d6240ef3c4ef213d9110b4b18b3a521c54b Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 9 Jul 2011 21:01:44 -0300 Subject: [PATCH 0008/1050] Added r-plugin/tmux.conf and r-plugin/screenrc. --- make_dist.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/make_dist.sh b/make_dist.sh index 21ba606..203df1b 100755 --- a/make_dist.sh +++ b/make_dist.sh @@ -54,10 +54,11 @@ sed -i -e "s/Version: [0-9][0-9][0-9][0-9][0-9][0-9]/Version: $PLUGINVERSION/" d tar -cvzf /tmp/vimrplugintmpfile.tar.gz ftdetect/r.vim indent/r.vim \ indent/rnoweb.vim indent/rhelp.vim autoload/rcomplete.vim ftplugin/r*.vim \ syntax/rout.vim syntax/r.vim syntax/rhelp.vim syntax/rdoc.vim syntax/rbrowser.vim \ - r-plugin/*.R doc/r-plugin.txt r-plugin/functions.vim \ + doc/r-plugin.txt r-plugin/*.R r-plugin/functions.vim \ r-plugin/global_r_plugin.vim r-plugin/omniList r-plugin/windows.py \ r-plugin/vimActivate.js r-plugin/tex_indent.vim r-plugin/r.snippets \ r-plugin/common_buffer.vim r-plugin/common_global.vim \ + r-plugin/tmux.conf r-plugin/screenrc \ bitmaps/ricon.xbm bitmaps/ricon.png \ bitmaps/RStart.png bitmaps/RStart.bmp \ bitmaps/RClose.png bitmaps/RClose.bmp \ @@ -131,6 +132,8 @@ files: - r-plugin/global_r_plugin.vim - r-plugin/specialfuns.R - r-plugin/tex_indent.vim +- r-plugin/tmux.conf +- r-plugin/screenrc - r-plugin/vimbrowser.R - r-plugin/vimhelp.R - r-plugin/vimprint.R From d206e43f49d600bcfebbe613f3edf9fbddfe9030 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 9 Jul 2011 23:47:09 -0300 Subject: [PATCH 0009/1050] Improved dependency check. --- r-plugin/common_global.vim | 68 ++++++++++++++++++++------------------ 1 file changed, 36 insertions(+), 32 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 49df9e6..e40ba22 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -17,7 +17,7 @@ " " Based on previous work by Johannes Ranke " -" Last Change: Sat Jul 09, 2011 08:31PM +" Last Change: Sat Jul 09, 2011 11:33PM " " Purposes of this file: Create all functions and commands and Set the " value of all global variables and some buffer variables.for r, @@ -2127,15 +2127,43 @@ if has("gui_win32") let g:vimrplugin_sleeptime = 0.02 endif else - if (has("gui_running") || g:vimrplugin_tmux == 0) && !executable('screen') - let s:rplugin_missing_screen = 1 - call RWarningMsg("Please, install the 'screen' application to enable the Vim-R-plugin with GVim.") + if !has("gui_running") + if g:vimrplugin_tmux == 1 && (!exists("g:vimrplugin_screenplugin") || (exists("g:vimrplugin_screenplugin") && g:vimrplugin_screenplugin == 1)) && !executable('tmux') + let rplugin_missing_tmux = 1 + call RWarningMsg("Please, either install the 'tmux' application (recommended) or put 'let vimrplugin_screenplugin = 0' in your vimrc to enable the Vim-R-plugin.") + endif + + if !exists("g:vimrplugin_screenplugin") + if exists("g:ScreenVersion") + let g:vimrplugin_screenplugin = 1 + else + call RWarningMsg("Please, either install the screen plugin (http://www.vim.org/scripts/script.php?script_id=2711) (recommended) or put 'let vimrplugin_screenplugin = 0' in your vimrc.") + call input("Press to continue. ") + let g:rplugin_failed = 1 + finish + endif + endif + + if !exists("g:ScreenVersion") + " g:ScreenVersion was introduced in screen plugin 1.3 + if g:vimrplugin_screenplugin == 1 + call RWarningMsg("Vim-R-plugin requires Screen plugin >= 1.3") + call input("Press to continue. ") + endif + let g:vimrplugin_screenplugin = 0 + endif endif - if !has("gui_running") && !executable('tmux') && g:vimrplugin_tmux == 1 - let s:rplugin_missing_tmux = 1 - call RWarningMsg("Please, install the 'tmux' application to enable the Vim-R-plugin.") + + if (has("gui_running") || (!has("gui_running") && (g:vimrplugin_tmux == 0 || g:vimrplugin_screenplugin == 0))) && !executable('screen') + let rplugin_missing_screen = 1 + if has("gui_running") + call RWarningMsg("Please, install the 'screen' application to enable the Vim-R-plugin with GVim.") + else + call RWarningMsg("Please, install the 'screen' application to enable the Vim-R-plugin.") + endif endif - if exists("s:rplugin_missing_tmux") || exists("s:rplugin_missing_screen") + + if exists("rplugin_missing_tmux") || exists("rplugin_missing_screen") call input("Press to continue. ") let g:rplugin_failed = 1 finish @@ -2169,23 +2197,6 @@ else let g:ScreenImpl = 'GnuScreen' endif -if !exists("g:vimrplugin_screenplugin") - if exists("g:ScreenVersion") - let g:vimrplugin_screenplugin = 1 - else - let g:vimrplugin_screenplugin = 0 - endif -endif - -if !exists("g:ScreenVersion") - " g:ScreenVersion was introduced in screen plugin 1.3 - if g:vimrplugin_screenplugin == 1 - call RWarningMsg("Vim-R-plugin requires Screen plugin >= 1.3") - call input("Press to continue. ") - endif - let g:vimrplugin_screenplugin = 0 -endif - " The screen.vim plugin only works on terminal emulators if !exists("g:vimrplugin_screenplugin") || has('gui_running') let g:vimrplugin_screenplugin = 0 @@ -2215,13 +2226,6 @@ if exists("g:vimrplugin_conqueplugin") && g:vimrplugin_conqueplugin == 1 endif endif -" Check again if screen is installed -if !has("gui_win32") && g:vimrplugin_conqueplugin == 0 && g:vimrplugin_screenplugin == 0 && !executable("screen") - call RWarningMsg("Please, install both the 'screen' and the 'tmux' applications to enable the Vim-R-plugin.") - call input("Press to continue. ") - let g:rplugin_failed = 1 - finish -endif " Are we in a Debian package? Is the plugin being running for the first time? let g:rplugin_omnifname = g:rplugin_uservimfiles . "/r-plugin/omniList" From 2c4d54f01bb1b78eb0b87d8d439340519d0a3d11 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sun, 10 Jul 2011 07:38:55 -0300 Subject: [PATCH 0010/1050] Only use the Conque Shell if explicitly told in the vimrc. --- doc/r-plugin.txt | 1 + r-plugin/common_global.vim | 22 +++------------------- 2 files changed, 4 insertions(+), 19 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index b46540f..17258a7 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -1550,6 +1550,7 @@ output. If you want to try the Conque Shell, install it from: and put in your |vimrc|: > + let vimrplugin_screenplugin = 0 let vimrplugin_conqueplugin = 1 < By default, the window will be split horizontally. Put the following in your diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index e40ba22..ca58aa2 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -17,7 +17,7 @@ " " Based on previous work by Johannes Ranke " -" Last Change: Sat Jul 09, 2011 11:33PM +" Last Change: Sun Jul 10, 2011 07:31AM " " Purposes of this file: Create all functions and commands and Set the " value of all global variables and some buffer variables.for r, @@ -2003,6 +2003,7 @@ call RSetDefaultValue("g:vimrplugin_applescript", 1) call RSetDefaultValue("g:vimrplugin_tmux", 1) call RSetDefaultValue("g:vimrplugin_screenvsplit", 0) call RSetDefaultValue("g:vimrplugin_conquevsplit", 0) +call RSetDefaultValue("g:vimrplugin_conqueplugin", 0) call RSetDefaultValue("g:vimrplugin_listmethods", 0) call RSetDefaultValue("g:vimrplugin_specialplot", 0) call RSetDefaultValue("g:vimrplugin_nosingler", 0) @@ -2202,23 +2203,7 @@ if !exists("g:vimrplugin_screenplugin") || has('gui_running') let g:vimrplugin_screenplugin = 0 endif -" Use Conque Shell plugin -if g:vimrplugin_screenplugin == 0 && !exists("g:vimrplugin_conqueplugin") - if exists("g:ConqueTerm_Loaded") - if has("python") || has("python3") - let g:vimrplugin_conqueplugin = 1 - else - call RWarningMsg("Python interface must be enabled to run Vim-R-Plugin with Conque Shell.") - let g:vimrplugin_conqueplugin = 0 - sleep 2 - endif - endif - if !exists("g:vimrplugin_conqueplugin") - let g:vimrplugin_conqueplugin = 0 - endif -endif - -if exists("g:vimrplugin_conqueplugin") && g:vimrplugin_conqueplugin == 1 +if g:vimrplugin_conqueplugin == 1 if !exists("g:ConqueTerm_Version") || (exists("g:ConqueTerm_Version") && g:ConqueTerm_Version < 210) let g:vimrplugin_conqueplugin = 0 call RWarningMsg("Vim-R-plugin requires Conque Shell plugin >= 2.1") @@ -2226,7 +2211,6 @@ if exists("g:vimrplugin_conqueplugin") && g:vimrplugin_conqueplugin == 1 endif endif - " Are we in a Debian package? Is the plugin being running for the first time? let g:rplugin_omnifname = g:rplugin_uservimfiles . "/r-plugin/omniList" if g:rplugin_home != g:rplugin_uservimfiles From 8f8b36e9030210780b7855342502f4871ffe5807 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sun, 10 Jul 2011 11:08:20 -0300 Subject: [PATCH 0011/1050] Use the expression "screen.vim plugin" to avoid confusion with the screen application. Added ncurses-term to the list of dependencies. --- doc/r-plugin.txt | 49 +++++++++++++++++++++++++----------------------- 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 17258a7..714d27e 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -29,8 +29,8 @@ This plugin improves Vim's support for editing R code and makes it possible to integrate Vim with R. It uses some ideas and code from Johannes Ranke's (vim-r-plugin), Eric Van -Dewoestine's (screen plugin), Vincent Nijs (R.vim for Mac OS X) and some ideas -from the Tinn-R (Windows only) project. +Dewoestine's (screen.vim plugin), Vincent Nijs (R.vim for Mac OS X) and some +ideas from the Tinn-R (Windows only) project. The latest stable version of this plugin is available at: @@ -104,11 +104,12 @@ replaced. Please, look at |r-plugin-files| to see the list of files. In addition to having R installed in your system, this plugin requires users to install: - tmux: http://tmux.sourceforge.net - screen: http://www.gnu.org/s/screen - screen plugin: http://www.vim.org/scripts/script.php?script_id=2711 + Tmux: http://tmux.sourceforge.net + GNU Screen: http://www.gnu.org/s/screen + screen.vim plugin: http://www.vim.org/scripts/script.php?script_id=2711 + ncurses-term: http://invisible-island.net/ncurses - Note: The tmux and screen applications are already packaged for most + Note: Tmux, GNU Screen and ncurses-term are already packaged for most GNU/Linux distributions and other Unix variants. Unfortunately its installation instructions vary widely and are beyond the scope of this documentation. @@ -505,7 +506,7 @@ passed to applications running under tmux. To send to either R or Vim you have to type a. You can also set a different escape character in your ~/.tmux.conf. -Note: Read the screen plugin documentation, especially the section +Note: Read the screen.vim plugin documentation, especially the section |screen-gotchas| (the E325 is caused by the presence of 'swapfile'). This problem will not happen if you start Vim from within a tmux session, as in the example below. @@ -684,7 +685,7 @@ indentation by adding braces and line breaks to it. Example: |vimrplugin_indent_commented| Indent lines commented with the \cc command |vimrplugin_sleeptime| Delay while sending commands in MS Windows |vimrplugin_noscreenrc| Do not write custom screenrc -|vimrplugin_screenplugin| Use the screen plugin +|vimrplugin_screenplugin| Use the screen.vim plugin |vimrplugin_screenvsplit| Split the window vertically with screen plugin |vimrplugin_tmux| Choose between tmux and screen |vimrplugin_applescript| Use osascript in Mac OS X. @@ -958,24 +959,26 @@ of screen. If you prefer to use the screen application, put in your |vimrc|: > let vimrplugin_tmux = 0 < -Start Vim and do the command rf. The screen plugin will split the -terminal in two regions and will run R in one of them. Using both plugins at -the same time is especially useful for users who may prefer to use Vim and R -in a terminal emulator, rather than using the graphical interface provided by -GVim. +Start Vim and do the command rf. The screen.vim plugin will split +the terminal in two regions and will run R in one of them. Using both plugins +at the same time is especially useful for users who may prefer to use Vim and +R in a terminal emulator, rather than using the graphical interface provided +by GVim. -If you have the screen plugin installed but prefer do not integrate it +If you have the screen.vim plugin installed but prefer do not integrate it with the Vim-R-plugin you will need to add the following to your |vimrc|: > let vimrplugin_screenplugin = 0 < The screen.vim plugin supports both screen and tmux, but only tmux allows you -to split the terminal vertically. Please read |screen-intro| and -|screen-shell-vertical| for details. By default, the Vim-R-plugin will tell -the screen plugin to split the terminal horizontally. If you prefer to split -it vertically put in your |vimrc|: +to split the terminal vertically (that is, to have the panels side by side). +Please read |screen-intro| and |screen-shell-vertical| for details. By +default, the Vim-R-plugin will tell the screen.vim plugin to split the +terminal horizontally. If you prefer to split it vertically put in your +|vimrc|: > let vimrplugin_screenvsplit = 1 + let g:ScreenImpl = 'Tmux' < 7.17. Integration with Apple Script (OS X only)~ @@ -1495,7 +1498,7 @@ make a copy of the file to the ~/.vim/plugin directory and edit it. On Windows, you probably will have to make a copy of the file to the ~/vimfiles/plugin directory. -10.17.2. When using Vim + screen plugin (either tmux or screen)~ +10.17.2. When using Vim + screen.vim plugin (either tmux or screen)~ Put in your |vimrc| (replace with the shortcut of your preference): > @@ -1505,10 +1508,10 @@ Press \rf to use R. Tha is, press before AND after starting R with the shortcut rf (or any other key binding that you have defined in your |vimrc| as the shortcut to start R). The first time that is pressed, the plugin's functions and key bindings are made available. -However, when R is started, Vim is closed and restarted by the screen plugin, -and the Vim-R-plugin functions and key bindings are lost. Consequently, the -ftplugin/r.vim script must be sourced again by pressing for the second -time. +However, when R is started, Vim is closed and restarted by the screen.vim +plugin, and the Vim-R-plugin functions and key bindings are lost. +Consequently, the ftplugin/r.vim script must be sourced again by pressing +for the second time. 10.18. Disable syntax highlight of R functions~ From 4856ba0a5a543b2c4a4181f3366430161a5042c1 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sun, 10 Jul 2011 11:10:40 -0300 Subject: [PATCH 0012/1050] Fix some bugs related with tmux condition of default interface to communicate with R. --- r-plugin/common_global.vim | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index ca58aa2..f13a4c4 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -17,7 +17,7 @@ " " Based on previous work by Johannes Ranke " -" Last Change: Sun Jul 10, 2011 07:31AM +" Last Change: Sun Jul 10, 2011 10:53AM " " Purposes of this file: Create all functions and commands and Set the " value of all global variables and some buffer variables.for r, @@ -384,7 +384,7 @@ function StartR(whatr) if exists(":ScreenShellVertical") == 2 exec 'ScreenShellVertical ' . rcmd else - call RWarningMsg("The screen plugin version >= 1.1 is required to split the window vertically.") + call RWarningMsg("Did you put \"let g:ScreenImpl = 'Tmux'\" in your vimrc?") call input("Press to continue. ") exec 'ScreenShell ' . rcmd endif @@ -1784,9 +1784,9 @@ function MakeRMenu() amenu R.Help\ (plugin).Options.Underscore\ and\ Rnoweb\ code :help vimrplugin_underscore amenu R.Help\ (plugin).Options.Object\ Browser :help vimrplugin_objbr_place + amenu R.Help\ (plugin).Options.Vim\ as\ pager\ for\ R\ help :help vimrplugin_vimpager if !has("gui_win32") amenu R.Help\ (plugin).Options.Terminal\ emulator :help vimrplugin_term - amenu R.Help\ (plugin).Options.Vim\ as\ pager\ for\ R\ help :help vimrplugin_vimpager amenu R.Help\ (plugin).Options.Number\ of\ R\ processes :help vimrplugin_nosingler amenu R.Help\ (plugin).Options.Screen\ configuration :help vimrplugin_noscreenrc amenu R.Help\ (plugin).Options.Screen\ plugin :help vimrplugin_screenplugin @@ -1794,7 +1794,6 @@ function MakeRMenu() if !has("gui_macvim") amenu R.Help\ (plugin).Options.Integration\ with\ Apple\ Script :help vimrplugin_applescript endif - amenu R.Help\ (plugin).Options.Conque\ Shell\ plugin :help vimrplugin_conqueplugin if has("gui_win32") amenu R.Help\ (plugin).Options.Use\ 32\ bit\ version\ of\ R :help vimrplugin_i386 amenu R.Help\ (plugin).Options.Sleep\ time :help vimrplugin_sleeptime @@ -2004,6 +2003,7 @@ call RSetDefaultValue("g:vimrplugin_tmux", 1) call RSetDefaultValue("g:vimrplugin_screenvsplit", 0) call RSetDefaultValue("g:vimrplugin_conquevsplit", 0) call RSetDefaultValue("g:vimrplugin_conqueplugin", 0) +call RSetDefaultValue("g:vimrplugin_screenplugin", 1) call RSetDefaultValue("g:vimrplugin_listmethods", 0) call RSetDefaultValue("g:vimrplugin_specialplot", 0) call RSetDefaultValue("g:vimrplugin_nosingler", 0) @@ -2128,31 +2128,30 @@ if has("gui_win32") let g:vimrplugin_sleeptime = 0.02 endif else + if has("gui_running") + let g:vimrplugin_screenplugin = 0 + endif if !has("gui_running") - if g:vimrplugin_tmux == 1 && (!exists("g:vimrplugin_screenplugin") || (exists("g:vimrplugin_screenplugin") && g:vimrplugin_screenplugin == 1)) && !executable('tmux') + if g:vimrplugin_tmux && g:vimrplugin_screenplugin && !executable('tmux') let rplugin_missing_tmux = 1 call RWarningMsg("Please, either install the 'tmux' application (recommended) or put 'let vimrplugin_screenplugin = 0' in your vimrc to enable the Vim-R-plugin.") endif - if !exists("g:vimrplugin_screenplugin") - if exists("g:ScreenVersion") - let g:vimrplugin_screenplugin = 1 - else + if g:vimrplugin_screenplugin + if !exists("g:ScreenVersion") call RWarningMsg("Please, either install the screen plugin (http://www.vim.org/scripts/script.php?script_id=2711) (recommended) or put 'let vimrplugin_screenplugin = 0' in your vimrc.") call input("Press to continue. ") let g:rplugin_failed = 1 finish + else + if g:ScreenVersion < "1.4" + call RWarningMsg("Vim-R-plugin requires Screen plugin >= 1.3") + call input("Press to continue. ") + let g:rplugin_failed = 1 + finish + endif endif endif - - if !exists("g:ScreenVersion") - " g:ScreenVersion was introduced in screen plugin 1.3 - if g:vimrplugin_screenplugin == 1 - call RWarningMsg("Vim-R-plugin requires Screen plugin >= 1.3") - call input("Press to continue. ") - endif - let g:vimrplugin_screenplugin = 0 - endif endif if (has("gui_running") || (!has("gui_running") && (g:vimrplugin_tmux == 0 || g:vimrplugin_screenplugin == 0))) && !executable('screen') @@ -2206,8 +2205,9 @@ endif if g:vimrplugin_conqueplugin == 1 if !exists("g:ConqueTerm_Version") || (exists("g:ConqueTerm_Version") && g:ConqueTerm_Version < 210) let g:vimrplugin_conqueplugin = 0 - call RWarningMsg("Vim-R-plugin requires Conque Shell plugin >= 2.1") + call RWarningMsg("You are using Conque Shell plugin " . g:ConqueTerm_Version . ". Vim-R-plugin requires Conque Shell >= 2.1") call input("Press to continue. ") + finish endif endif From d37d963f6f276ba7ad7d4579f43c637c57da991f Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Mon, 11 Jul 2011 00:16:08 -0300 Subject: [PATCH 0013/1050] Standardize the names of screen.vim plugin and GNU Screen and Tmux applications. --- doc/r-plugin.txt | 168 ++++++++++++++++++++++++----------------------- 1 file changed, 87 insertions(+), 81 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 714d27e..6dd1224 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -3,9 +3,9 @@ Plugin to work with R~ Authors: Jakson A. Aquino - Jose Claudio Faria + Jose Claudio Faria -Version: 110706 +Version: 110710 For Vim version 7.3 1. Overview |r-plugin-overview| @@ -24,7 +24,6 @@ For Vim version 7.3 ============================================================================== 1. Overview~ *r-plugin-overview* - This plugin improves Vim's support for editing R code and makes it possible to integrate Vim with R. @@ -47,7 +46,6 @@ to deal with. ============================================================================== 2. Main features~ *r-plugin-features* - * Syntax highlighting for R syntax, including: - Special characters in strings. - Functions of all installed packages (must be updated manually). @@ -83,7 +81,6 @@ to deal with. ============================================================================== 3. Installation~ *r-plugin-installation* - 3.1. General instructions I~ You need to activate plugins and indentation according to 'filetype'. You @@ -123,20 +120,20 @@ are in at the same directory): > :helptags ~/.vim/doc < -If you do not have a custom tmux configuration file yet, copy the file +If you do not have a custom Tmux configuration file yet, copy the file ~/.vim/r-plugin/tmux.conf to ~/.tmux.conf -If you are using Vim (not GVim), the plugin will run inside a tmux session. If -are not already an user of tmux, please, read the |r-plugin-tmux| section to +If you are using Vim (not GVim), the plugin will run inside a Tmux session. If +are not already an user of Tmux, please, read the |r-plugin-tmux| section to learn a few useful shortcuts. The tmux.conf file that ships with this plugin -sets tmux to work with vi key bindings. +sets Tmux to work with vi key bindings. Note: The recommended way of using the plugin on Linux is running Vim in a -terminal emulator, using tmux to split the terminal in two regions. This is +terminal emulator, using Tmux to split the terminal in two regions. This is the default configuration when running Vim in a terminal emulator. It is also possible to use the plugin with GVim and R in a external terminal emulator, Vim in a terminal emulator and R in an external terminal emulator, and using -screen instead of tmux to split the terminal emulator in two regions. +GNU Screen instead of Tmux to split the terminal emulator in two regions. 3.2.2. Windows~ @@ -161,7 +158,7 @@ similar to one of the following: > C:\Documents and Settings\yourlogin\vimfiles C:\Users\yourlogin\vimfiles - +< Uncompress the archive. Right click on the plugin's zip file and choose "Extract all". Then choose ~/vimfiles as the destination directory. @@ -197,19 +194,19 @@ you may prefer to install the Debian package available at: 3.4. General instructions II (optional steps)~ -update list of objects~ +Update list of objects~ Start R and update the list of objects for omni completion and syntax highlight (see |:RUpdateObjList| for details). -customize the plugin~ +Customize the plugin~ Please, read the section |r-plugin-options|. Emacs/ESS users should read the -section 10.8 of this document (Indenting setup). +section Indenting setup (|r-plugin-indenting|) of this document. -hide unused buttons~ +Hide unused buttons~ Edit Vim's toolbar and remove the buttons that you never use. The plugin adds some buttons to the toolbar, but you may not see them because gvim has too @@ -219,7 +216,7 @@ on the toolbar: http://vim.wikia.com/wiki/Hide_toolbar_or_menus_to_see_more_text -install additional plugins~ +Install additional plugins~ You may be interested in installing additional general plugins to get functionality not provided by this file type plugin. ShowMarks and snipMate @@ -229,7 +226,6 @@ are particularly interesting. Please read |r-plugin-tips| for details. ============================================================================== 4. Use~ *r-plugin-use* - 4.1. Key bindings~ To use the plugin, open a .R or .Rnw or .Rd file with Vim and type \rf @@ -242,13 +238,12 @@ some cases, toolbar buttons. In the list below, the backslash represents the enabled in all filetypes supported by the plugin (r, rnoweb, rhelp): Start/Close - . Start R (default) \rf - . Start R --vanilla \rv - . Start R (custom) \rc - ---------------------------------------------------------- - . Close R (no save) \rq - . Close R (save workspace) \rw -------------------------------------------------------------- + . Start R (default) \rf + . Start R --vanilla \rv + . Start R (custom) \rc + -------------------------------------------------------- + . Close R (no save) \rq +----------------------------------------------------------- Send . File \aa @@ -280,7 +275,7 @@ Send . Line (and new one) \q ----------------------------------------------------------- -Control +Command . List space \rl . Clear console \rr . Clear all \rm @@ -302,27 +297,39 @@ Control . Sweave (cur file) \sw . Sweave and PDF (cur file) \sp . Sweave, BibTeX and PDF (cur file) \sb ----------------------------------------------------------- + -------------------------------------------------------- + . Build tags file (cur dir) :RBuildTags +----------------------------------------------------------- Edit + . Insert "<-" + -------------------------------------------------------- . Indent (line) == . Indent (selected lines) = . Indent (whole buffer) gg=G + -------------------------------------------------------- . Comment/Uncomment (line, sel) \cc . Add/Align right comment (line, sel) \; + -------------------------------------------------------- . Go (next R chunk) gn . Go (previous R chunk) gN - . Build omniList (loaded packages) :RUpdateObjList +----------------------------------------------------------- + +Syntax + . Build omniList (loaded packages) :RUpdateObjList . Build omniList (installed packages) :RUpdateObjListAll - . Build R tags file :RBuildTags ----------------------------------------------------------- +----------------------------------------------------------- Object Browser . Show/Update \ro . Expand (all lists) \r= . Collapse (all lists) \r- . Toggle (cur) Enter - -------------------------------------------------------- +----------------------------------------------------------- + +Help (plugin) +Help (R) +----------------------------------------------------------- Please see |r-plugin-key-bindings| to learn how to customize the key bindings without editing the plugin directly. @@ -473,14 +480,14 @@ source code. 4.7. Tmux usage~ *r-plugin-tmux* When running Vim in an terminal emulator (Linux/Unix only), the Vim-R-plugin -will use the screen.vim plugin to restart Vim and start R in a tmux session. -The tmux configuration file provided by the Vim-R-plugin configures tmux to -use vi key bindings. The configuration script also sets as the tmux +will use the screen.vim plugin to restart Vim and start R in a Tmux session. +The Tmux configuration file provided by the Vim-R-plugin configures Tmux to +use vi key bindings. The configuration script also sets as the Tmux scape character (the default is ), that is, you have to type before -typing a tmux command. Below are the most useful key bindings to use the +typing a Tmux command. Below are the most useful key bindings to use the Vim-R-plugin with the provided tmux.conf. - arrow keys : Move the cursor to the tmux panel above, below, at the + arrow keys : Move the cursor to the Tmux panel above, below, at the right or at the left of the current one. : Move the panel division upward one line, that is, resize @@ -491,36 +498,36 @@ Vim-R-plugin with the provided tmux.conf. [ : Enter the copy/scroll back mode. You can use vi key bindings to move the cursor around the panel. Press - to exit the copy mode. Please, read the tmux + to exit the copy mode. Please, read the Tmux manual to learn how to copy and paste code between panels. -Please, read the manual page of tmux if you want to change the tmux -configuration and learn more commands. To read the tmux manual, type in the +Please, read the manual page of Tmux if you want to change the Tmux +configuration and learn more commands. To read the Tmux manual, type in the terminal emulator: > man tmux > -Note: was configured as the tmux scape character, and it will not be -passed to applications running under tmux. To send to either R or Vim +Note: was configured as the Tmux scape character, and it will not be +passed to applications running under Tmux. To send to either R or Vim you have to type a. You can also set a different escape character in your ~/.tmux.conf. Note: Read the screen.vim plugin documentation, especially the section |screen-gotchas| (the E325 is caused by the presence of 'swapfile'). This -problem will not happen if you start Vim from within a tmux session, as in the +problem will not happen if you start Vim from within a Tmux session, as in the example below. A sample detachable session could be: - - Start tmux: + - Start Tmux: tmux - - Start vim: + - Start Vim: vim theScript.R - Use Vim to start an R session: \rf - Send code from Vim to R, and, then, detach Vim and R with d - - Some time latter reattach the tmux session: + - Some time latter reattach the Tmux session: tmux attach @@ -558,16 +565,16 @@ command: |:RUpdateObjList|. Vim and R run as independent processes. The main disadvantage is that we have limited communication between the two applications: Vim can send strings to R -through screen and R can write files to be read by Vim. That's all. The main +through GNU Screen and R can write files to be read by Vim. That's all. The main advantage is that Vim's or the plugin's bugs will not affect R. -The r-plugin uses screen to communicate with R. First, the plugin initiates a -new screen session and uses this to start a new R process. The plugin's menu +The Vim-R-plugin uses GNU Screen to communicate with R. First, the plugin initiates a +new GNU Screen session and uses this to start a new R process. The plugin's menu options, toolbar buttons and key bindings can then be used to communicate with -the newly started R process. The plugin sends commands to R through screen. By +the newly started R process. The plugin sends commands to R through GNU Screen. By default, all Vim buffers share the same R process, but it is also possible to configure Vim so that each buffer runs its own instance of R in a separate -terminal emulator. In this case, the screen sessions have unique names. The +terminal emulator. In this case, the GNU Screen sessions have unique names. The names are made using the user name and the seconds of localtime(). Hence, a name clash is possible if a single user starts more than one Vim buffer at the same second. To change the default behavior and force all Vim buffers to use @@ -633,10 +640,10 @@ Normal, Visual and Insert modes. 6.7. quit(save = "yes") may not work properly~ -If you are using either the Screen plugin (and are not running R in an -external terminal), the R command quit(save = "yes") may not have time enough -to save the workspace. Vim will sleep for 1 second after the command \rw -before killing R but this time is not enough for big workspaces. +If you are using either the screen.vim plugin (not running R in an external +terminal), the R command quit(save = "yes") may not have time enough to save +the workspace. Vim will sleep for 1 second after the command \rw before +killing R but this time is not enough for big workspaces. 6.8. Syntactically correct code may be wrongly indented~ @@ -687,7 +694,7 @@ indentation by adding braces and line breaks to it. Example: |vimrplugin_noscreenrc| Do not write custom screenrc |vimrplugin_screenplugin| Use the screen.vim plugin |vimrplugin_screenvsplit| Split the window vertically with screen plugin -|vimrplugin_tmux| Choose between tmux and screen +|vimrplugin_tmux| Choose between Tmux and GNU Screen |vimrplugin_applescript| Use osascript in Mac OS X. |vimrplugin_open_df| Show data.frame elements in the Object Browser |vimrplugin_open_list| Show list elements in the Object Browser @@ -751,8 +758,8 @@ put in your |vimrc|: *vimrplugin_open_df* *vimrplugin_open_list* *vimrplugin_allnames* -By default, the Object Browser will be created with 40 columns at the right -side of the script window. You can change the Object Browser's default width +By default, the object browser will be created with 40 columns at the right +side of the script window. You can change the object browser's default width and placement by putting different values in your |vimrc|, as in the examples below: > @@ -761,7 +768,7 @@ below: < The minimum width of the Object Browser windows is 9 columns. -By default, the elements of data.frames are shown in the Object Browser, but +By default, the elements of data.frames are shown in the object browser, but not the elements of other types of lists. You can put the following in your |vimrc| to change this behavior: > @@ -769,7 +776,7 @@ not the elements of other types of lists. You can put the following in your let vimrplugin_open_list = 1 < By default, names of objects which begin with a . are omitted. If you prefer -to see them in the Object Browser, put in your |vimrc|: +to see them in the object browser, put in your |vimrc|: > let vimrplugin_allnames = 1 < @@ -819,7 +826,7 @@ values to some variables in your |vimrc|, as in the example: 7.5. Number of R processes (Linux/Unix only)~ *vimrplugin_nosingler* *vimrplugin_by_vim_instance* -7.5.1 Using (G)Vim without the Screen plugin~ +7.5.1 Using (G)Vim without the screen.vim plugin~ By default, all buffers of all (G)Vim instances send code to the same R process. If you prefer that each Vim buffer uses its own R process, put the following @@ -835,17 +842,17 @@ code to other R processes then put the following in your |vimrc|: > The |vimrplugin_by_vim_instance| option requires that Vim is acting as a command server because the variable |v:servername| is used to make the name of -the screen session which will run R. By default, GVim runs as server, but Vim +the GNU Screen session which will run R. By default, GVim runs as server, but Vim does not. Hence, if you are using Vim you have either to start Vim with the argument --servername or use the screen.vim plugin which tries to restart Vim with the --servername argument. If you want to use more than nine GVim instances you will have to use the --servername argument because screen will not differentiate between the names "GVIM1" and "GVIM10". -7.5.2 Using the Screen plugin~ +7.5.2 Using the screen.vim plugin~ -Both options are ignored when using Vim in a terminal emulator and using -the Screen plugin. The plugin behaves as if the |vimrplugin_by_instance| was +Both options are ignored when using Vim in a terminal emulator and using the +screen.vim plugin. The plugin behaves as if the |vimrplugin_by_instance| was enabled. @@ -929,7 +936,7 @@ this document), according to the table below: 0 1 # 1 1 ## 0 0 ### - +< 7.13. Sleep time (Windows only)~ *vimrplugin_sleeptime* @@ -942,20 +949,21 @@ example show how to adjust the value of sleeptime in your |vimrc|: 7.14. Tmux and Screen configuration (Linux/Unix only)~ *vimrplugin_noscreenrc* -GVim (or Vim running R in an external terminal emulator) runs -screen with the configuration files located at ~/.vim/r-plugin. If you want to -use your own ~/.tmux.conf or ~/.screenrc, put in your |vimrc|: +GVim (or Vim running R in an external terminal emulator) runs GNU Screen with +the configuratio file. If you want to use your own ~/.screenrc, put in your +|vimrc|: > let vimrplugin_noscreenrc = 1 < -7.15. Integration with screen.vim (Linux/Unix only)~ +7.15. Integration with screen.vim plugin (Linux/Unix only)~ *vimrplugin_screenplugin* *vimrplugin_screenvsplit* *vimrplugin_tmux* By default, when running in a terminal emulator, the Vim-R-plugin uses the -screen.vim plugin if it is installed and, by default, it will use tmux instead -of screen. If you prefer to use the screen application, put in your |vimrc|: +screen.vim plugin if it is installed and, by default, it will use Tmux instead +of GNU Screen. If you prefer to use the GNU Screen application, put in your +|vimrc|: > let vimrplugin_tmux = 0 < @@ -970,7 +978,7 @@ with the Vim-R-plugin you will need to add the following to your |vimrc|: > let vimrplugin_screenplugin = 0 < -The screen.vim plugin supports both screen and tmux, but only tmux allows you +The screen.vim plugin supports both screen and Tmux, but only Tmux allows you to split the terminal vertically (that is, to have the panels side by side). Please read |screen-intro| and |screen-shell-vertical| for details. By default, the Vim-R-plugin will tell the screen.vim plugin to split the @@ -984,7 +992,7 @@ terminal horizontally. If you prefer to split it vertically put in your 7.17. Integration with Apple Script (OS X only)~ *vimrplugin_applescript* In Mac OS X, the plugin will try to send commands to R gui using Apple Script -if the Screen plugin is not installed. If you prefer to have R running in an +if the screen.vim plugin is not installed. If you prefer to have R running in an external terminal emulator, put in your |vimrc|: > let vimrplugin_applescript = 0 @@ -1110,11 +1118,11 @@ gender. To make it even easier to use this function, you could write a custom key binding that would allow you to rapidly get the levels of the object under your cursor. Add the following to your |vimrc| to have an easy way to pass R -the levels command. +the levels command: > map rk :call RAction("levels") < -then (assuming that the local leader key is "\") if you type \rk R will +Then (assuming that the local leader key is "\") if you type \rk R will receive the command > levels(myObject) @@ -1188,7 +1196,6 @@ directory after the installation: ============================================================================== 10. FAQ and tips~ *r-plugin-tips* - 10.1. Is it possible to stop R from within Vim?~ Sorry, it is not possible. You have to press ^C into R's terminal emulator. @@ -1498,7 +1505,7 @@ make a copy of the file to the ~/.vim/plugin directory and edit it. On Windows, you probably will have to make a copy of the file to the ~/vimfiles/plugin directory. -10.17.2. When using Vim + screen.vim plugin (either tmux or screen)~ +10.17.2. When using Vim + screen.vim plugin (either Tmux or GNU Screen)~ Put in your |vimrc| (replace with the shortcut of your preference): > @@ -1561,8 +1568,7 @@ By default, the window will be split horizontally. Put the following in your > let vimrplugin_conquevsplit = 1 < -You may also need to change the time that the Conque Shell waits for R output: - +You may also need to change the time that the Conque Shell waits for R output. After a command is sent to the Conque buffer, the Conque Shell plugin waits 100 milliseconds (on Linux) or 200 milliseconds (on Windows) before reading R's output. Longer values for the waiting time will increase the chances that @@ -1613,8 +1619,8 @@ the R syntax highlighted. *r-plugin-news* * New option: vimrplugin_tmux. - * Set tmux as the default instead of either screen or conque shell. - * Document tmux as the prefered way of running the plugin on Linux. + * Set Tmux as the default instead of either GNU Screen or Conque Shell. + * Document Tmux as the prefered way of running the plugin on Linux. * Vim-LaTeX-suite plugin can be used with Rnoweb files without any additional configuration. The necessary code was added to the ftplugin/rnoweb.vim. From 6ccf6b5bc66c2d7cca64a39307012c92ae02098a Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Tue, 12 Jul 2011 07:55:56 -0300 Subject: [PATCH 0014/1050] Flag that it is necessary to rebuild the .GlobalEnv omni list after sweaving a document. --- ftplugin/rnoweb.vim | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ftplugin/rnoweb.vim b/ftplugin/rnoweb.vim index b707ca0..301f60e 100644 --- a/ftplugin/rnoweb.vim +++ b/ftplugin/rnoweb.vim @@ -17,7 +17,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Sun Jul 03, 2011 11:08AM +" Last Change: Mon Jul 11, 2011 11:13PM "========================================================================== " Only do this when not yet done for this buffer @@ -117,6 +117,7 @@ function! RMakePDF(bibtex) endif let pdfcmd = pdfcmd . ")" + let b:needsnewomnilist = 1 let ok = SendCmdToR(pdfcmd) if ok == 0 return @@ -127,6 +128,7 @@ endfunction " Sweave the current buffer content function! RSweave() update + let b:needsnewomnilist = 1 call RSetWD() call SendCmdToR('Sweave("' . expand("%:t") . '")') echon From 742d44e0de5b9ffc0929f5f504cab3ab6f84bccc Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Tue, 12 Jul 2011 22:30:35 -0300 Subject: [PATCH 0015/1050] Plot "integer" as "numeric" (histogram and boxplot). --- r-plugin/specialfuns.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/r-plugin/specialfuns.R b/r-plugin/specialfuns.R index f546db2..e351f8e 100644 --- a/r-plugin/specialfuns.R +++ b/r-plugin/specialfuns.R @@ -42,7 +42,7 @@ .vim.plot <- function(x) { xname <- deparse(substitute(x)) - if(length(grep("numeric", class(x))) > 0){ + if(length(grep("numeric", class(x))) > 0 || length(grep("integer", class(x))) > 0){ oldpar <- par(no.readonly = TRUE) par(mfrow = c(2, 1)) hist(x, col = "lightgray", main = paste("Histogram of", xname), xlab = xname) From de4ad7c43838a241e234ab1dc5192dd73f0b8e7d Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Tue, 12 Jul 2011 22:33:07 -0300 Subject: [PATCH 0016/1050] Improved Tmux usage tips. Minor grammar corrections. --- doc/r-plugin.txt | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 6dd1224..5fc618f 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -62,7 +62,7 @@ to deal with. - Send to R the Sweave and pdflatex commands. - Run R inside a Vim's buffer. * Omni completion (auto-completion) for R objects (.GlobalEnv and installed - packages. The list of installed packages must be updated manually. + packages). The list of installed packages must be updated manually. * Ability to see R's documentation in a Vim's buffer: - Automatic calculation of the best layout of the R documentation buffer (split the window either horizontally or vertically according to the @@ -124,14 +124,14 @@ If you do not have a custom Tmux configuration file yet, copy the file ~/.vim/r-plugin/tmux.conf to ~/.tmux.conf If you are using Vim (not GVim), the plugin will run inside a Tmux session. If -are not already an user of Tmux, please, read the |r-plugin-tmux| section to +are not already a user of Tmux, please, read the |r-plugin-tmux| section to learn a few useful shortcuts. The tmux.conf file that ships with this plugin sets Tmux to work with vi key bindings. Note: The recommended way of using the plugin on Linux is running Vim in a terminal emulator, using Tmux to split the terminal in two regions. This is the default configuration when running Vim in a terminal emulator. It is also -possible to use the plugin with GVim and R in a external terminal emulator, +possible to use the plugin with GVim and R in an external terminal emulator, Vim in a terminal emulator and R in an external terminal emulator, and using GNU Screen instead of Tmux to split the terminal emulator in two regions. @@ -479,7 +479,7 @@ source code. 4.7. Tmux usage~ *r-plugin-tmux* -When running Vim in an terminal emulator (Linux/Unix only), the Vim-R-plugin +When running Vim in a terminal emulator (Linux/Unix only), the Vim-R-plugin will use the screen.vim plugin to restart Vim and start R in a Tmux session. The Tmux configuration file provided by the Vim-R-plugin configures Tmux to use vi key bindings. The configuration script also sets as the Tmux @@ -496,11 +496,18 @@ Vim-R-plugin with the provided tmux.conf. the vertical split, you should use and to resize the panels. - [ : Enter the copy/scroll back mode. You can use vi key - bindings to move the cursor around the panel. Press - to exit the copy mode. Please, read the Tmux - manual to learn how to copy and paste code between - panels. + [ : Enter the copy/scroll back mode. You can use , + and vi key bindings to move the cursor around + the panel. Press q to quit copy mode. + ] : Paste the content of Tmux paste buffer. + +While in the copy and scroll back mode, the following key bindings are very +useful: + + q : Quit the copy and scroll mode. + : Start text selection. + v : Start retangular text selection. + : Copy the selection to Tmux paste buffer. Please, read the manual page of Tmux if you want to change the Tmux configuration and learn more commands. To read the Tmux manual, type in the @@ -741,8 +748,8 @@ The last argument must be the one which precedes the command to be executed. 7.2. Underscore and Rnoweb completion of code block~ *vimrplugin_underscore* *vimrplugin_rnowebchunk* -While editing R code, '_' is replace with ' <- '. To disable this feature, put -in your |vimrc|: +While editing R code, '_' is replaced with ' <- '. To disable this feature, +put in your |vimrc|: > let vimrplugin_underscore = 0 < @@ -1203,7 +1210,7 @@ Sorry, it is not possible. You have to press ^C into R's terminal emulator. 10.2. Html help and custom pager~ -If you prefer to see help pages in a html browser, put in your ~/.Rprofile: +If you prefer to see help pages in an html browser, put in your ~/.Rprofile: > options(help_type = "html") < @@ -1493,7 +1500,7 @@ available for all file types, then do one of the following: Go to your ~/.vim/plugin directory and create a symbolic link to ~/.vim/r-plugin/global_r_plugin.vim. That is, type the following -in an terminal emulator: +in a terminal emulator: > cd ~/.vim/plugin/ ln -s ../r-plugin/global_r_plugin.vim @@ -1548,7 +1555,7 @@ important Vim limitations are: - The InsertCharPre event was implemented in a way that causes problems to Conque Shell. We have to patch Vim's source code. - - Vim does not have an timer which would make the Conque Shell more + - Vim does not have a timer which would make the Conque Shell more efficient. Vim uses the same variable, 'updatetime', to do both save swap files and trigger |CursorHold| events. From 529eac6eeaa226f0eb48e3cde1bbbb79ad88e997 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Fri, 15 Jul 2011 08:02:12 -0300 Subject: [PATCH 0017/1050] Revised the text. --- doc/r-plugin.txt | 162 ++++++++++++++++++++++++----------------------- 1 file changed, 84 insertions(+), 78 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 5fc618f..733a525 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -60,7 +60,6 @@ to deal with. - Send commands with the object under cursor as argument: help, args, plot, print, str, summary, example, names. - Send to R the Sweave and pdflatex commands. - - Run R inside a Vim's buffer. * Omni completion (auto-completion) for R objects (.GlobalEnv and installed packages). The list of installed packages must be updated manually. * Ability to see R's documentation in a Vim's buffer: @@ -107,16 +106,17 @@ to install: ncurses-term: http://invisible-island.net/ncurses Note: Tmux, GNU Screen and ncurses-term are already packaged for most - GNU/Linux distributions and other Unix variants. Unfortunately its - installation instructions vary widely and are beyond the scope of this - documentation. + GNU/Linux distributions and other Unix variants. The library ncurses-term + is necessary only for 256 color support in the terminal emulator. + Unfortunately its installation instructions vary widely and are beyond the + scope of this documentation. Uncompress the archive: > unzip vim-r-plugin-*.zip -d ~/.vim < Start Vim and build the tags file for this document (and others that eventually -are in at the same directory): +are in the same directory): > :helptags ~/.vim/doc < @@ -130,10 +130,11 @@ sets Tmux to work with vi key bindings. Note: The recommended way of using the plugin on Linux is running Vim in a terminal emulator, using Tmux to split the terminal in two regions. This is -the default configuration when running Vim in a terminal emulator. It is also -possible to use the plugin with GVim and R in an external terminal emulator, -Vim in a terminal emulator and R in an external terminal emulator, and using -GNU Screen instead of Tmux to split the terminal emulator in two regions. +the default configuration when running Vim in a terminal emulator, but it is +also possible to use the plugin with GVim and R in an external terminal +emulator, Vim in a terminal emulator and R in an external terminal emulator, +and using GNU Screen instead of Tmux to split the terminal emulator in two +regions. 3.2.2. Windows~ @@ -302,7 +303,7 @@ Command ----------------------------------------------------------- Edit - . Insert "<-" + . Insert "<-" _ -------------------------------------------------------- . Indent (line) == . Indent (selected lines) = @@ -414,9 +415,10 @@ and, then, build the "omniList". You have to do \ro to either start or updated the Object Browser. The Object Browser has two views: .GlobalEnv and Libraries. If you either press -or double click on the first line of the Object Browser it will toggle the -view between the objects in .GlobalEnv and the currently loaded libraries (but -only libraries loaded when |:RUpdateObjList| was run will be shown). +or double click (GVim only) on the first line of the Object Browser it will +toggle the view between the objects in .GlobalEnv and the currently loaded +libraries (but only libraries loaded when |:RUpdateObjList| was run will be +shown). In the .GlobalEnv view, if an object has the attribute "label", it will be displayed in the Object Browser. The options |vimrplugin_open_df| and @@ -517,13 +519,16 @@ terminal emulator: > Note: was configured as the Tmux scape character, and it will not be passed to applications running under Tmux. To send to either R or Vim -you have to type a. You can also set a different escape character in your +you have to type a. You can also set a different escape character in your ~/.tmux.conf. -Note: Read the screen.vim plugin documentation, especially the section -|screen-gotchas| (the E325 is caused by the presence of 'swapfile'). This -problem will not happen if you start Vim from within a Tmux session, as in the -example below. +With Tmux, you can the detach the Vim-R session and reattach it latter. This +is useful if you plan to begin the use the Vim-R-plugin in a machine and +latter move to another another computer. However, normally you will get +|E325|, caused by the presence of a 'swapfile' (please, read the screen.vim +plugin documentation, especially the section |screen-gotchas| for details). +This problem will not happen if you start Vim from within a Tmux session, as +in the example below. A sample detachable session could be: @@ -533,8 +538,9 @@ A sample detachable session could be: vim theScript.R - Use Vim to start an R session: \rf - - Send code from Vim to R, and, then, detach Vim and R with d - - Some time latter reattach the Tmux session: + - Send code from Vim to R, and, then, detach Vim and R with d + - Some time latter (even if accessing the machine remotely) reattach the + Tmux session: tmux attach @@ -557,10 +563,6 @@ complete the name of a data.frame, the columns are not shown. But when the data.frame name is already complete, and you have inserted the '$' symbol, omni completion will show the column names. -The file containing the list of objects used for omni completion is built by -the R function contained in the script ~/.vim/r-plugin/buil_omniList.R. This -function is sourced by R, which causes R to create the list used by Vim. - Vim uses two files: one for the objects of .GlobalEnv and the other for all other objects. The .GlobalEnv list is stored in the /tmp/r-plugin-yourlogin directory and, thus, is deleted after each reboot. The other file is stored in @@ -575,17 +577,19 @@ limited communication between the two applications: Vim can send strings to R through GNU Screen and R can write files to be read by Vim. That's all. The main advantage is that Vim's or the plugin's bugs will not affect R. -The Vim-R-plugin uses GNU Screen to communicate with R. First, the plugin initiates a -new GNU Screen session and uses this to start a new R process. The plugin's menu -options, toolbar buttons and key bindings can then be used to communicate with -the newly started R process. The plugin sends commands to R through GNU Screen. By -default, all Vim buffers share the same R process, but it is also possible to -configure Vim so that each buffer runs its own instance of R in a separate -terminal emulator. In this case, the GNU Screen sessions have unique names. The -names are made using the user name and the seconds of localtime(). Hence, a -name clash is possible if a single user starts more than one Vim buffer at the -same second. To change the default behavior and force all Vim buffers to use -different R processes see |vimrplugin_single_r|. +If the screen.vim plugin is not installed or if you are using GVim, the +Vim-R-plugin uses GNU Screen to communicate with R. First, the plugin +initiates a new GNU Screen session and uses this to start a new R process. +The plugin's menu options, toolbar buttons and key bindings can then be used +to communicate with the newly started R process. The plugin sends commands to +R through GNU Screen. By default, all Vim buffers share the same R process, +but it is also possible to configure Vim so that each buffer runs its own +instance of R in a separate terminal emulator. In this case, the GNU Screen +sessions have unique names. The names are made using the user name and the +seconds of localtime(). Hence, a name clash is possible if a single user +starts more than one Vim buffer at the same second. To change the default +behavior and force all Vim buffers to use different R processes see +|vimrplugin_single_r|. ============================================================================== @@ -614,10 +618,10 @@ to another. 6.3. R session is detached when GVim is closed (Linux/Unix only)~ If you launch GVim through a custom keyboard shortcut, the problem may be -solved if you add -f as parameter to GVim. The R session will also be detached -when GVim is closed if you launch GVim by the command line in a terminal -emulator, and, then, close the terminal-emulator. In any case, to reattach to -the R session, open a new terminal window and type: +solved if you add -f as parameter to GVim. The R session also used to be +detached when GVim is closed if you launched GVim by the command line in a +terminal emulator, and, then, closed the terminal-emulator. In any case, to +reattach to the R session, open a new terminal window and type: > screen -r < @@ -647,7 +651,7 @@ Normal, Visual and Insert modes. 6.7. quit(save = "yes") may not work properly~ -If you are using either the screen.vim plugin (not running R in an external +If you are using the screen.vim plugin (not running R in an external terminal), the R command quit(save = "yes") may not have time enough to save the workspace. Vim will sleep for 1 second after the command \rw before killing R but this time is not enough for big workspaces. @@ -854,7 +858,7 @@ does not. Hence, if you are using Vim you have either to start Vim with the argument --servername or use the screen.vim plugin which tries to restart Vim with the --servername argument. If you want to use more than nine GVim instances you will have to use the --servername argument because screen will -not differentiate between the names "GVIM1" and "GVIM10". +not differentiate between names like "GVIM1" and "GVIM10". 7.5.2 Using the screen.vim plugin~ @@ -934,9 +938,9 @@ default. To turn off the automatic indentation, put in your |vimrc|: > let vimrplugin_indent_commented = 0 < -What string will be added to the beginning of the line depends on the values of -vimrplugin_indent_commented and r_indent_ess_comments (see section 10.8 of -this document), according to the table below: +What string will be added to the beginning of the line depends on the values +of vimrplugin_indent_commented and r_indent_ess_comments according to the +table below (see |r-plugin-indenting|): > vimrplugin_indent_commented r_indent_ess_comments string 1 0 # @@ -957,8 +961,8 @@ example show how to adjust the value of sleeptime in your |vimrc|: 7.14. Tmux and Screen configuration (Linux/Unix only)~ *vimrplugin_noscreenrc* GVim (or Vim running R in an external terminal emulator) runs GNU Screen with -the configuratio file. If you want to use your own ~/.screenrc, put in your -|vimrc|: +a specially built configuration file. If you want to use your own ~/.screenrc, +put in your |vimrc|: > let vimrplugin_noscreenrc = 1 < @@ -1008,7 +1012,7 @@ external terminal emulator, put in your |vimrc|: 7.18. Special R functions~ *vimrplugin_listmethods* *vimrplugin_specialplot* -The R function args() list the arguments of a function, but not the arguments +The R function args() lists the arguments of a function, but not the arguments of its methods. If you want that the plugin calls the function .vim.list.args() after ra, you have to add to your |vimrc|: > @@ -1046,7 +1050,7 @@ vimrplugin_sweaveargs variable. *vimrplugin_never_unmake_menu* Use this option if you want that the menu item R and the R related tool bar buttons are not deleted when you change from one buffer to another, for -example, when go from an .R file to a .txt one: +example, when going from an .R file to a .txt one: > let vimrplugin_never_unmake_menu = 1 < @@ -1056,16 +1060,15 @@ type. 7.22. Map 'r'~ *vimrplugin_map_r* -Some users may already be familiar with the key bindings from earlier releases -of the Vim-R-plugin. If the variable |vimrplugin_map_r| exists, the plugin -will map the letter 'r' to send lines to R when there are visually selected -lines, for compatibility with the original plugin. To activate this option, -insert the following into |vimrc|: +If the variable |vimrplugin_map_r| exists, the plugin will map the letter 'r' +to send lines to R when there are visually selected lines, for compatibility +with the original plugin. To activate this option, insert the following into +|vimrc|: > let vimrplugin_map_r = 1 < -You may want to add the following three lines to your |vimrc| which were in -the original plugin and will increase compatibility with code edited with +You may want to add the following three lines to your |vimrc| which were in +Johannes Ranke's plugin and will increase compatibility with code edited with Emacs: > set expandtab @@ -1087,9 +1090,8 @@ To customize a key binding you should put in your |vimrc| something like: imap RStart vmap RStart < -The above example shows how you can increase compatibility with old versions -of the Vim-R-plugin, by changing the key binding used to start R from -rf to the old default value, F2. +The above example shows how to change key binding used to start R from +rf to . Only the custom key bindings for Normal mode are shown in Vim's menu, but you can type |:map| to see the complete list of current mappings, and below is the @@ -1190,8 +1192,10 @@ directory after the installation: r-plugin/vimprint.R r-plugin/vimSweave.R r-plugin/r.snippets + r-plugin/screenrc r-plugin/specialfuns.R r-plugin/tex_indent.vim + r-plugin/tmux.conf r-plugin/vimActivate.js r-plugin/windows.py syntax/rbrowser.vim @@ -1223,10 +1227,11 @@ and in your |vimrc| (see |vimrplugin_vimpager|): *r-plugin-showmarks* Vim allows several marks (bookmarks). The most commonly used marks are the lowercase alphabet letters. If the cursor is between any two marks, the -plugin will send all of the lines between them to R. +plugin will send all of the lines between them to R. To create a mark, press +m in Normal mode. -To make it easier to remember where blocks begin and end, we recommended that -you use the ShowMarks plugin available at: +We recommended the use of ShowMarks plugin which show what lines have marks +defined. The plugin is available at: http://www.vim.org/scripts/script.php?script_id=152 @@ -1305,8 +1310,8 @@ Example on how to test whether your setup is ok: 1. Type "mapply()" in an R script and save the buffer. 2. Press CTRL-] over "mapply" (Vim should jump to "mapply.R"). - 4. Locate the string "do_mapply", which is the name of a C function. - 5. Press CTRL-] over "do_mapply" (Vim sould jump to "mapply.c"). + 3. Locate the string "do_mapply", which is the name of a C function. + 4. Press CTRL-] over "do_mapply" (Vim sould jump to "mapply.c"). 10.8. Indenting setup~ @@ -1417,12 +1422,12 @@ at the "Window Management" section for "Group and Tab Windows"). It is because Vim and R run as separate processes and, thus, it is not possible to Vim to know whether R is busy or not. If R was running as part of -the text editor, as happens with JGR and RKward, which are linked to libR.so, -it would be possible to wait for R to finish processing a command before -sending to it a command to rebuild the list of objects for the Object Browser. -This command should be sent after each line sent to R. But if the -Vim-R-plugin did this, the use of Vim would be blocked until R finished its -processing. +the text editor, as happens with RStudio, JGR, RKward, and others, which are +linked to libR.so, it would be possible to wait for R to finish processing a +command before sending to it a command to rebuild the list of objects for the +Object Browser. This command should be sent after each line sent to R. But if +the Vim-R-plugin did this, the use of Vim would be blocked until R finished +its processing. 10.15. Edit your ~/.Rprofile~ @@ -1434,7 +1439,6 @@ options and some others: if (interactive()) { local({ options(editor = 'gvim -f -c "set ft=r"') - options(warn = 1) options(max.print = 999) if(nchar(Sys.getenv("DISPLAY")) > 1){ options(help_type = "html") @@ -1483,10 +1487,12 @@ the R package "debug": mtrace(function) < Once the library is installed and loaded, you should use mtrace(function_name) -to enable debugging a function. Then, the next time that the function is -called it will enter in debugging mode. Once debugging a function, you can hit - to evaluate the current line, go(n) to go to line n in the function -and qqq() to quit the function (See debug's help for details). +to enable the debugging of a function. Then, the next time that the function +is called it will enter in debugging mode. Once debugging a function, you can +hit to evaluate the current line, go(n) to go to line n in the +function and qqq() to quit the function (See debug's help for details). An +useful tip is to click on the title bar of the debug window and choose "Always +on top" or a similar option provided by your desktop manager. There is also the R package "edtdbg" which aims to integrate R debugging facilities with Vim. @@ -1518,7 +1524,7 @@ Put in your |vimrc| (replace with the shortcut of your preference): > nmap :runtime ftplugin/r.vim < -Press \rf to use R. Tha is, press before AND after starting R +Press \rf to use R. That is, press before AND after starting R with the shortcut rf (or any other key binding that you have defined in your |vimrc| as the shortcut to start R). The first time that is pressed, the plugin's functions and key bindings are made available. @@ -1543,7 +1549,7 @@ can also use the Conque Shell plugin, but the Conque Shell still has some important bugs and Vim has limitations that make the use of Conque Shell not fully satisfying. The most important bug of Conque Shell is that it sometimes do not show the complete output of an R command. This problem happens more -frequently when there are non ascii letters in the output. The three most +frequently when there are non ascii characters in the output. The three most important Vim limitations are: - We cannot scroll the windows of a buffer that is not being edited and, @@ -1627,7 +1633,7 @@ the R syntax highlighted. * New option: vimrplugin_tmux. * Set Tmux as the default instead of either GNU Screen or Conque Shell. - * Document Tmux as the prefered way of running the plugin on Linux. + * Document Tmux as the preferred way of running the plugin on Linux. * Vim-LaTeX-suite plugin can be used with Rnoweb files without any additional configuration. The necessary code was added to the ftplugin/rnoweb.vim. @@ -1636,7 +1642,7 @@ the R syntax highlighted. method corresponding to the class of the object passed as argument to the function. The same with \rp (thanks to Thomas Scheike for suggesting the feature). - * Removed scipt rpager.sh. + * Removed script rpager.sh. * Added script global_r_plugin.vim to allow the use of the plugin with any file type. From b16f3dead88a8d829e32d8868b6575fa16319939 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Fri, 15 Jul 2011 22:15:37 -0300 Subject: [PATCH 0018/1050] Added roxterm to the list of supported terminal emulators. --- doc/r-plugin.txt | 3 ++- r-plugin/common_global.vim | 9 +++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 733a525..f43f443 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -730,7 +730,8 @@ list: 5. Eterm, 6. rxvt, 7. aterm, - 8. xterm. + 8. roxterm, + 9. xterm. If Vim does not select your favorite terminal emulator, you may define it in your |vimrc| by setting the variable vimrplugin_term, as shown below: diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index f13a4c4..0acfe79 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -17,7 +17,7 @@ " " Based on previous work by Johannes Ranke " -" Last Change: Sun Jul 10, 2011 10:53AM +" Last Change: Fri Jul 15, 2011 10:10PM " " Purposes of this file: Create all functions and commands and Set the " value of all global variables and some buffer variables.for r, @@ -2278,7 +2278,7 @@ if has("gui_win32") " No external terminal emulator will be called, so any value is good let g:vimrplugin_term = "xterm" else - let s:terminals = ['gnome-terminal', 'konsole', 'xfce4-terminal', 'Eterm', 'rxvt', 'aterm', 'xterm'] + let s:terminals = ['gnome-terminal', 'konsole', 'xfce4-terminal', 'Eterm', 'rxvt', 'aterm', 'roxterm', 'xterm'] if has('mac') let s:terminals = ['iTerm', 'Terminal.app'] + s:terminals endif @@ -2318,6 +2318,11 @@ if g:vimrplugin_term == "rxvt" || g:vimrplugin_term == "aterm" let g:rplugin_termcmd = g:vimrplugin_term . " -e" endif +if g:vimrplugin_term == "roxterm" + " Cannot set icon: http://bugzilla.gnome.org/show_bug.cgi?id=126081 + let g:rplugin_termcmd = g:vimrplugin_term . " --directory='" . expand("%:p:h") . "' --title R -e" +endif + if g:vimrplugin_term == "xterm" || g:vimrplugin_term == "uxterm" let g:rplugin_termcmd = g:vimrplugin_term . " -xrm '*iconPixmap: " . g:rplugin_home . "/bitmaps/ricon.xbm' -e" endif From 42ad5fe526f92bd01224c26509b69752dec2339f Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Fri, 15 Jul 2011 22:55:51 -0300 Subject: [PATCH 0019/1050] Source only the first tex_latexSuite.vim script found. --- ftplugin/rnoweb.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ftplugin/rnoweb.vim b/ftplugin/rnoweb.vim index 301f60e..4a0d8b3 100644 --- a/ftplugin/rnoweb.vim +++ b/ftplugin/rnoweb.vim @@ -17,7 +17,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Mon Jul 11, 2011 11:13PM +" Last Change: Fri Jul 15, 2011 10:54PM "========================================================================== " Only do this when not yet done for this buffer @@ -26,7 +26,7 @@ if exists("b:did_rnoweb_ftplugin") || exists("disable_r_ftplugin") endif " Enables Vim-Latex-Suite if it is installed -runtime! ftplugin/tex_latexSuite.vim +runtime ftplugin/tex_latexSuite.vim " Don't load another plugin for this buffer let b:did_rnoweb_ftplugin = 1 From 2d7b874147e8c9ad35dfd2eb2e0fd47e52d5fc35 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 16 Jul 2011 13:10:52 -0300 Subject: [PATCH 0020/1050] Fix version number of screen.vim plugin requirement warning. --- r-plugin/common_global.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 0acfe79..107f83d 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -17,7 +17,7 @@ " " Based on previous work by Johannes Ranke " -" Last Change: Fri Jul 15, 2011 10:10PM +" Last Change: Sat Jul 16, 2011 12:42PM " " Purposes of this file: Create all functions and commands and Set the " value of all global variables and some buffer variables.for r, @@ -2145,7 +2145,7 @@ else finish else if g:ScreenVersion < "1.4" - call RWarningMsg("Vim-R-plugin requires Screen plugin >= 1.3") + call RWarningMsg("Vim-R-plugin requires Screen plugin >= 1.4") call input("Press to continue. ") let g:rplugin_failed = 1 finish From c8ab826cdaedc9c5a7a745f01540d00427957be7 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 16 Jul 2011 13:13:46 -0300 Subject: [PATCH 0021/1050] Move some code. --- ftplugin/rnoweb.vim | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ftplugin/rnoweb.vim b/ftplugin/rnoweb.vim index 4a0d8b3..fe4cf19 100644 --- a/ftplugin/rnoweb.vim +++ b/ftplugin/rnoweb.vim @@ -17,7 +17,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Fri Jul 15, 2011 10:54PM +" Last Change: Sat Jul 16, 2011 12:14PM "========================================================================== " Only do this when not yet done for this buffer @@ -25,12 +25,12 @@ if exists("b:did_rnoweb_ftplugin") || exists("disable_r_ftplugin") finish endif -" Enables Vim-Latex-Suite if it is installed -runtime ftplugin/tex_latexSuite.vim - " Don't load another plugin for this buffer let b:did_rnoweb_ftplugin = 1 +" Enables Vim-Latex-Suite if it is installed +runtime ftplugin/tex_latexSuite.vim + " Enable syntax highlight of LaTeX errors in R Console (if using Conque " Shell) let syn_rout_latex = 1 From 9438ff798d22d3b01ed0d4bb57e35e2f16fe6472 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 30 Jul 2011 12:26:40 -0300 Subject: [PATCH 0022/1050] Add count argument to commands gn and GN Add count argument to normal mode commands gn and gN. --- doc/r-plugin.txt | 8 ++++--- ftplugin/rnoweb.vim | 53 ++++++++++++++++++++++++++------------------- 2 files changed, 36 insertions(+), 25 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index f43f443..eef29c4 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -5,7 +5,7 @@ Authors: Jakson A. Aquino Jose Claudio Faria -Version: 110710 +Version: 110716 For Vim version 7.3 1. Overview |r-plugin-overview| @@ -375,8 +375,8 @@ shortcut to send the current line makes the cursor to jump to the next chunk. While editing rnoweb files, the following commands are available in Normal mode: - gn : go to the next chunk of R code - gN : go to the previous chunk of R code + [count]gn : go to the next chunk of R code + [count]gN : go to the previous chunk of R code 4.3. Omni completion and the highlighting of functions~ @@ -1637,6 +1637,8 @@ the R syntax highlighted. * Document Tmux as the preferred way of running the plugin on Linux. * Vim-LaTeX-suite plugin can be used with Rnoweb files without any additional configuration. The necessary code was added to the ftplugin/rnoweb.vim. + * Added count argument to normal mode commands gn and gN (thanks to Ivan + Bezerra for the suggestion). 110614 (2011-06-14) * When doing the command \rh, the plugin tries to show the help for the diff --git a/ftplugin/rnoweb.vim b/ftplugin/rnoweb.vim index fe4cf19..afda3ed 100644 --- a/ftplugin/rnoweb.vim +++ b/ftplugin/rnoweb.vim @@ -17,7 +17,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Sat Jul 16, 2011 12:14PM +" Last Change: Sat Jul 30, 2011 11:31AM "========================================================================== " Only do this when not yet done for this buffer @@ -67,34 +67,43 @@ function! RnwIsInRCode() endif endfunction -function! RnwPreviousChunk() +function! RnwPreviousChunk() range echon - let curline = line(".") - if RnwIsInRCode() + let rg = range(a:firstline, a:lastline) + let chunk = len(rg) + for var in range(1, chunk) + let curline = line(".") + if RnwIsInRCode() + let i = search("^<<.*$", "bnW") + if i != 0 + call cursor(i-1, 1) + endif + endif let i = search("^<<.*$", "bnW") - if i != 0 - call cursor(i-1, 1) + if i == 0 + call cursor(curline, 1) + call RWarningMsg("There is no previous R code chunk to go.") + return + else + call cursor(i+1, 1) endif - endif - - let i = search("^<<.*$", "bnW") - if i == 0 - call cursor(curline, 1) - call RWarningMsg("There is no previous R code chunk to go.") - else - call cursor(i+1, 1) - endif + endfor return endfunction -function! RnwNextChunk() +function! RnwNextChunk() range echon - let i = search("^<<.*$", "nW") - if i == 0 - call RWarningMsg("There is no next R code chunk to go.") - else - call cursor(i+1, 1) - endif + let rg = range(a:firstline, a:lastline) + let chunk = len(rg) + for var in range(1, chunk) + let i = search("^<<.*$", "nW") + if i == 0 + call RWarningMsg("There is no next R code chunk to go.") + return + else + call cursor(i+1, 1) + endif + endfor return endfunction From 8f6f44fb65c184706661210d5dec5a2a50bb9b20 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 6 Aug 2011 10:55:35 -0300 Subject: [PATCH 0023/1050] Scape double quotation marks of label attributes. --- r-plugin/vimbrowser.R | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/r-plugin/vimbrowser.R b/r-plugin/vimbrowser.R index 82ec8eb..8d5075e 100644 --- a/r-plugin/vimbrowser.R +++ b/r-plugin/vimbrowser.R @@ -16,7 +16,10 @@ cat("'", x.name, "': {'class': \"", x.class, '"', sep = "") x.label <- attr(x, "label", exact = TRUE) if(length(x.label) > 1) x.label <- x.label[[1]] - if(!is.null(x.label)) cat(", 'label': \"", x.label, '"', sep = "") + if(!is.null(x.label)){ + x.label <- gsub('"', '\\\\"', x.label) + cat(", 'label': \"", x.label, '"', sep = "") + } if(is.list(x)){ x.names <- names(x) llen <- length(x) From 43a0e7b233cdae57cae634ec64621df59c17c496 Mon Sep 17 00:00:00 2001 From: Gunnlaugur Thor Briem Date: Tue, 16 Aug 2011 16:28:47 +0000 Subject: [PATCH 0024/1050] Boilerplate Rakefile for janus support --- Rakefile | 97 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 Rakefile diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..1d99dc2 --- /dev/null +++ b/Rakefile @@ -0,0 +1,97 @@ +# Copyright (c) 2009 Travis Jeffery +# +# Permission is hereby granted, free of charge, to any person +# obtaining a copy of this software and associated documentation +# files (the "Software"), to deal in the Software without +# restriction, including without limitation the rights to use, +# copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following +# conditions: +# +# The above copyright notice and this permission notice shall be +# included in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. + +# Contributions by scrooloose + +require 'rake' +require 'find' +require 'pathname' + +IGNORE = [/\.gitignore$/, /Rakefile$/] + +files = `git ls-files`.split("\n") +files.reject! { |f| IGNORE.any? { |re| f.match(re) } } + +desc 'Zip up the project files' +task :zip do + zip_name = File.basename(File.dirname(__FILE__)) + zip_name.gsub!(/ /, '_') + zip_name = "#{zip_name}.zip" + + if File.exist?(zip_name) + abort("Zip file #{zip_name} already exists. Remove it first.") + end + + puts "Creating zip file: #{zip_name}" + system("zip #{zip_name} #{files.join(" ")}") +end + +desc 'Install plugin and documentation' +task :install do + vimfiles = if ENV['VIMFILES'] + ENV['VIMFILES'] + elsif RUBY_PLATFORM =~ /(win|w)32$/ + File.expand_path("~/vimfiles") + else + File.expand_path("~/.vim") + end + files.each do |file| + target_file = File.join(vimfiles, file) + FileUtils.mkdir_p File.dirname(target_file) + FileUtils.cp file, target_file + + puts "Installed #{file} to #{target_file}" + end + +end + +desc 'Pulls from origin' +task :pull do + puts "Updating local repo..." + system("cd " << Dir.new(File.dirname(__FILE__)).path << " && git pull") +end + +desc 'Calls pull task and then install task' +task :update => ['pull', 'install'] do + puts "Update of vim script complete." +end + +desc 'Uninstall plugin and documentation' +task :uninstall do + vimfiles = if ENV['VIMFILES'] + ENV['VIMFILES'] + elsif RUBY_PLATFORM =~ /(win|w)32$/ + File.expand_path("~/vimfiles") + else + File.expand_path("~/.vim") + end + files.each do |file| + target_file = File.join(vimfiles, file) + FileUtils.rm target_file + + puts "Uninstalled #{target_file}" + end + +end + +task :default => ['update'] From b92343aa0512c781ffdb12497539f2c6bcc543c5 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Mon, 22 Aug 2011 22:17:29 -0300 Subject: [PATCH 0025/1050] Correctly indent code when r_indent_align_args = 0 Fix bug that was causing wrong indentation after lines with unbalanced '(' and ')' when r_indent_align_args = 0. --- indent/r.vim | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/indent/r.vim b/indent/r.vim index b6787a2..f8d2eb0 100644 --- a/indent/r.vim +++ b/indent/r.vim @@ -2,7 +2,7 @@ " Language: R " Author: Jakson Alves de Aquino " URL: http://www.vim.org/scripts/script.php?script_id=2628 -" Last Change: Tue Feb 08, 2011 10:03AM +" Last Change: Mon Aug 22, 2011 10:11PM " Only load this indent file when no other was loaded. @@ -451,17 +451,24 @@ function GetRIndent() let ind = indent(lnum) let pind = indent(plnum) + if g:r_indent_align_args == 0 && pb != 0 + let ind += pb * &sw + return ind + endif + if ind == pind || (ind == (pind + &sw) && pline =~ '{$' && ppost_else == 0) return ind endif - while pind < ind && plnum > 0 + while pind < ind && plnum > 0 && ppb == 0 let ind = pind let plnum = s:Get_prev_line(plnum) let pline = getline(plnum) + let ppb = s:Get_paren_balance(pline, '(', ')') while pline =~ '^\s*else' let plnum = s:Get_matching_if(plnum, 1) let pline = getline(plnum) + let ppb = s:Get_paren_balance(pline, '(', ')') endwhile let pind = indent(plnum) if ind == (pind + &sw) && pline =~ '{$' From 8ae513492b024293f565264f320126343054f444 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sun, 28 Aug 2011 10:57:43 -0300 Subject: [PATCH 0026/1050] More details on how to install Python on Windows --- doc/r-plugin.txt | 37 +++++++++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index eef29c4..25d0d7a 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -5,7 +5,7 @@ Authors: Jakson A. Aquino Jose Claudio Faria -Version: 110716 +Version: 110824 For Vim version 7.3 1. Overview |r-plugin-overview| @@ -144,15 +144,28 @@ to install several external dependencies: * Vim's version must be >= 7.3 * Python: http://www.python.org/download/ + + Note: The official Vim is 32 bit and, thus, Python must be 32 bit too. + Note: Be careful to download the correct Python version because Vim - needs a specific version of Python DLL. For example, the official Vim - 7.3 for Windows needs either Python 2.7 or 3.1. Note: the official Vim - is 32 bit and, thus, Python must be 32 bit too. + needs a specific version of Python DLL. For example, the official + Vim 7.3 for Windows needs either Python 2.7 or 3.1. To discover + what Python version Vim was compiled against, do the following: + + 1. Type :version in Vim (normal mode). + + 2. Look for a string like -DDYNAMIC_PYTHON_DLL="python27.dll". + 3. Install the Python version which corresponds to the version + which Vim was linked against. In the example of step 2 + (python27.dll) the required Python version is 2.7.x. + * pywin32: http://sourceforge.net/projects/pywin32/ + Note: The default download may not match the Python version Vim was - linked with. You have to "View all files" on the download page to find - the file that matches the version of Python that you installed. + linked against. You have to "View all files" on the download page to + find the file that matches exactly the version of Python that you + installed. Create your |vimfiles| directory if you do not have it yet. Its path will be similar to one of the following: @@ -1382,6 +1395,14 @@ prefer to start editing files with all folds open, put in your |vimrc|: Notes: (1) Enabling folding may slow down Vim. (2) Folding is not a file type plugin option. It is a feature defined in syntax/r.vim. +Note: Indentation of R code is very slow because the indentation algorithm +sometimes goes backwards looking for an opening parenthesis or brace or for +the beginning of a "for", "if" or "while" statement. This is necessary because +the indentation level of a given line depends on the indentation level of the +previous line, but the previous line is not always the line above. It's the +line where the statement immediately above started. Of course someone may +develop a better algorithm in the future. + 10.10. Automatically close parenthesis~ @@ -1632,6 +1653,10 @@ the R syntax highlighted. 12. News~ *r-plugin-news* + * Fixed bug in code indentation after unbalanced parentesis when + r_indent_align_args = 0 (thanks to Peng Yu for reporting the bug). + +110805 (2011-08-05) * New option: vimrplugin_tmux. * Set Tmux as the default instead of either GNU Screen or Conque Shell. * Document Tmux as the preferred way of running the plugin on Linux. From d9fc132172d3fbfbca70a56e37cc79ec35f4d96f Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Tue, 30 Aug 2011 09:25:22 -0300 Subject: [PATCH 0027/1050] Correct spell mistakes. --- ftplugin/rnoweb.vim | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ftplugin/rnoweb.vim b/ftplugin/rnoweb.vim index afda3ed..0fdceab 100644 --- a/ftplugin/rnoweb.vim +++ b/ftplugin/rnoweb.vim @@ -17,7 +17,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Sat Jul 30, 2011 11:31AM +" Last Change: Tue Aug 30, 2011 09:25AM "========================================================================== " Only do this when not yet done for this buffer @@ -35,14 +35,14 @@ runtime ftplugin/tex_latexSuite.vim " Shell) let syn_rout_latex = 1 -" Source scripts common to R, Rnoweb, Rhelp and rdoc files: +" Source scripts common to R, Rnoweb, Rhelp and Rdoc: runtime r-plugin/common_global.vim if exists("g:rplugin_failed") finish endif -" Some buffer variables common to R, Rnoweb, Rhelp and rdoc file need be -" defined after the global ones: +" Some buffer variables common to R, Rnoweb, Rhelp and Rdoc need to be defined +" after the global ones: runtime r-plugin/common_buffer.vim setlocal iskeyword=@,48-57,_,. @@ -144,7 +144,7 @@ function! RSweave() endfunction if g:vimrplugin_rnowebchunk == 1 - " Write code chunck in rnoweb files + " Write code chunk in rnoweb files imap < :call RWriteChunk()a endif From ca550449de7b9ee3c5b35c8ec43a34186948fbbf Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Tue, 30 Aug 2011 09:27:11 -0300 Subject: [PATCH 0028/1050] Add note to r-plugin.txt on Debian package. --- make_dist.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/make_dist.sh b/make_dist.sh index 203df1b..ec3ec2d 100755 --- a/make_dist.sh +++ b/make_dist.sh @@ -181,6 +181,9 @@ zip -r /tmp/vim-r-plugin-$PLUGINVERSION.zip . # Delete the files unnecessary in a Debian system rm bitmaps/*.bmp r-plugin/windows.py r-plugin/vimActivate.js +# Add a comment to r-plugin.txt: +sed -e 's/3.2.1. Unix (Linux, OS X, etc.)./3.2.1. Unix (Linux, OS X, etc.)~\n\nNote: If the plugin was installed from the Debian package, then the\ninstallation is finished and you should now read sections 3.3 and 3.4./' -i doc/r-plugin.txt + # Create the DEBIAN directory cd /tmp/vim-r-plugin-tmp mkdir DEBIAN From affea17bda987fb9e0d1c1c48897957aff5c7eb0 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Tue, 30 Aug 2011 09:31:02 -0300 Subject: [PATCH 0029/1050] Make the use of AppleScript the default on OS X. --- doc/r-plugin.txt | 24 ++++++++++++++---------- r-plugin/common_global.vim | 9 ++++++++- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 25d0d7a..e404e7f 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -5,7 +5,7 @@ Authors: Jakson A. Aquino Jose Claudio Faria -Version: 110824 +Version: 110830 For Vim version 7.3 1. Overview |r-plugin-overview| @@ -97,6 +97,19 @@ replaced. Please, look at |r-plugin-files| to see the list of files. 3.2.1. Unix (Linux, OS X, etc.)~ +Uncompress the archive: +> + unzip vim-r-plugin-*.zip -d ~/.vim +< +Start Vim and build the tags file for this document (and others that eventually +are in the same directory): +> + :helptags ~/.vim/doc +< +Note: If you are using OS X and prefer that Vim uses AppleScript to send +commands to R, then the installation is finished and you should now read +sections 3.3 and 3.4. + In addition to having R installed in your system, this plugin requires users to install: @@ -111,15 +124,6 @@ to install: Unfortunately its installation instructions vary widely and are beyond the scope of this documentation. -Uncompress the archive: -> - unzip vim-r-plugin-*.zip -d ~/.vim -< -Start Vim and build the tags file for this document (and others that eventually -are in the same directory): -> - :helptags ~/.vim/doc -< If you do not have a custom Tmux configuration file yet, copy the file ~/.vim/r-plugin/tmux.conf to ~/.tmux.conf diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 107f83d..5e5764e 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -17,7 +17,7 @@ " " Based on previous work by Johannes Ranke " -" Last Change: Sat Jul 16, 2011 12:42PM +" Last Change: Tue Aug 30, 2011 08:50AM " " Purposes of this file: Create all functions and commands and Set the " value of all global variables and some buffer variables.for r, @@ -2176,6 +2176,13 @@ else if !exists("g:vimrplugin_r_args") let g:vimrplugin_r_args = " " endif + + if has("gui_macvim") && g:vimrplugin_applescript && !exists("g:ScreenVersion") + let g:vimrplugin_screenplugin = 0 + let g:vimrplugin_conqueplugin = 0 + let g:vimrplugin_term_cmd = "none" + let g:vimrplugin_term = "none" + endif endif if isdirectory("/tmp") From b547d9256e0304d289e6105cb69f0222f40f814b Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sun, 11 Sep 2011 23:08:47 -0300 Subject: [PATCH 0030/1050] Fix indentation bug after unbalanced bracket. Fixed bug in code indentation after unbalanced brackets when r_indent_align_args = 0 (thanks to Chris Neff for reporting the bug). --- doc/r-plugin.txt | 21 +++++++++++---------- indent/r.vim | 14 ++++++++++++-- 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index e404e7f..ee36a21 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -185,8 +185,8 @@ are in the same directory): > :helptags ~\vimfiles\doc < -Start R and try to send some lines from GVim to R Console. You may have to -adjust the value of |vimrplugin_sleeptime|. +Start editing an R file with GVim and try to send some lines to R Console. You +may have to adjust the value of |vimrplugin_sleeptime|. 3.3. Troubleshooting (if the plugin doesn't work)~ @@ -1018,9 +1018,9 @@ terminal horizontally. If you prefer to split it vertically put in your let g:ScreenImpl = 'Tmux' < -7.17. Integration with Apple Script (OS X only)~ +7.17. Integration with AppleScript (OS X only)~ *vimrplugin_applescript* -In Mac OS X, the plugin will try to send commands to R gui using Apple Script +In Mac OS X, the plugin will try to send commands to R gui using AppleScript if the screen.vim plugin is not installed. If you prefer to have R running in an external terminal emulator, put in your |vimrc|: > @@ -1575,7 +1575,7 @@ can also use the Conque Shell plugin, but the Conque Shell still has some important bugs and Vim has limitations that make the use of Conque Shell not fully satisfying. The most important bug of Conque Shell is that it sometimes do not show the complete output of an R command. This problem happens more -frequently when there are non ascii characters in the output. The three most +frequently when there are non ascii characters in the output. The two most important Vim limitations are: - We cannot scroll the windows of a buffer that is not being edited and, @@ -1584,9 +1584,6 @@ important Vim limitations are: shell buffer does not scroll when there is new output but it is not the currently active buffer. - - The InsertCharPre event was implemented in a way that causes problems to - Conque Shell. We have to patch Vim's source code. - - Vim does not have a timer which would make the Conque Shell more efficient. Vim uses the same variable, 'updatetime', to do both save swap files and trigger |CursorHold| events. @@ -1657,8 +1654,12 @@ the R syntax highlighted. 12. News~ *r-plugin-news* - * Fixed bug in code indentation after unbalanced parentesis when + * Fixed bug in code indentation after unbalanced brackets when + r_indent_align_args = 0 (thanks to Chris Neff for reporting the bug). + * Fixed bug in code indentation after unbalanced parenthesis when r_indent_align_args = 0 (thanks to Peng Yu for reporting the bug). + * Really make the use of AppleScript the default on OS X (thanks for Jason + for reporting the bug). 110805 (2011-08-05) * New option: vimrplugin_tmux. @@ -1710,7 +1711,7 @@ the R syntax highlighted. * Don't send "^@$" as part of a paragraph in rnoweb files (thanks to Fabio Correa for reporting the bug). * More useful warning message when PyWin32 isn't installed. - * Initial support to Apple Script on Mac OS X (thanks to Vincent Nijs for + * Initial support to AppleScript on Mac OS X (thanks to Vincent Nijs for writing and testing the code). 101121 (2010-11-21) diff --git a/indent/r.vim b/indent/r.vim index f8d2eb0..b69abd5 100644 --- a/indent/r.vim +++ b/indent/r.vim @@ -2,7 +2,7 @@ " Language: R " Author: Jakson Alves de Aquino " URL: http://www.vim.org/scripts/script.php?script_id=2628 -" Last Change: Mon Aug 22, 2011 10:11PM +" Last Change: Sun Sep 11, 2011 10:55PM " Only load this indent file when no other was loaded. @@ -456,19 +456,29 @@ function GetRIndent() return ind endif + if g:r_indent_align_args == 0 && bb != 0 + let ind += bb * &sw + return ind + endif + if ind == pind || (ind == (pind + &sw) && pline =~ '{$' && ppost_else == 0) return ind endif - while pind < ind && plnum > 0 && ppb == 0 + let pline = getline(plnum) + let pbb = s:Get_paren_balance(pline, '[', ']') + + while pind < ind && plnum > 0 && ppb == 0 && pbb == 0 let ind = pind let plnum = s:Get_prev_line(plnum) let pline = getline(plnum) let ppb = s:Get_paren_balance(pline, '(', ')') + let pbb = s:Get_paren_balance(pline, '[', ']') while pline =~ '^\s*else' let plnum = s:Get_matching_if(plnum, 1) let pline = getline(plnum) let ppb = s:Get_paren_balance(pline, '(', ')') + let pbb = s:Get_paren_balance(pline, '[', ']') endwhile let pind = indent(plnum) if ind == (pind + &sw) && pline =~ '{$' From 284c47b105a5914515e94ceba683257f27a09f7f Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Mon, 12 Sep 2011 21:45:48 -0300 Subject: [PATCH 0031/1050] Improve a couple of error messages on Windows. --- r-plugin/common_global.vim | 5 +++-- r-plugin/windows.py | 5 ++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 5e5764e..e3bc88a 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -17,7 +17,7 @@ " " Based on previous work by Johannes Ranke " -" Last Change: Tue Aug 30, 2011 08:50AM +" Last Change: Mon Sep 12, 2011 09:44PM " " Purposes of this file: Create all functions and commands and Set the " value of all global variables and some buffer variables.for r, @@ -2093,7 +2093,8 @@ if has("gui_win32") else exe s:py . " GetRPathPy()" if s:rinstallpath == "Not found" - call RWarningMsg('Could not find R path in Windows Registry.') + call RWarningMsg("Could not find R path in Windows Registry.") + call RWarningMsg("Please, either install R or set the value of 'vimrplugin_r_path'.") call input("Press to continue. ") let g:rplugin_failed = 1 finish diff --git a/r-plugin/windows.py b/r-plugin/windows.py index 21ed90e..e2a3a01 100644 --- a/r-plugin/windows.py +++ b/r-plugin/windows.py @@ -115,6 +115,9 @@ def StartRPy(): else: vim.command("RWarningMsg('Personal folder not found in registry')") - os.spawnv(os.P_NOWAIT, rpath, rargs) + if os.path.exists(rpath): + os.spawnv(os.P_NOWAIT, rpath, rargs) + else: + vim.command("echoerr 'File ' . g:rplugin_Rgui . ' not found.'") # vim: sw=4 tabstop=4 expandtab From 08b89e2b4f03ca10698388b1b0d8edd825057d77 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Wed, 21 Sep 2011 09:18:14 -0300 Subject: [PATCH 0032/1050] Update Conque Shell plugin version requirement. --- r-plugin/common_global.vim | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index e3bc88a..6aedd3e 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -17,7 +17,7 @@ " " Based on previous work by Johannes Ranke " -" Last Change: Mon Sep 12, 2011 09:44PM +" Last Change: Wed Sep 21, 2011 09:16AM " " Purposes of this file: Create all functions and commands and Set the " value of all global variables and some buffer variables.for r, @@ -2180,7 +2180,6 @@ else if has("gui_macvim") && g:vimrplugin_applescript && !exists("g:ScreenVersion") let g:vimrplugin_screenplugin = 0 - let g:vimrplugin_conqueplugin = 0 let g:vimrplugin_term_cmd = "none" let g:vimrplugin_term = "none" endif @@ -2211,9 +2210,9 @@ if !exists("g:vimrplugin_screenplugin") || has('gui_running') endif if g:vimrplugin_conqueplugin == 1 - if !exists("g:ConqueTerm_Version") || (exists("g:ConqueTerm_Version") && g:ConqueTerm_Version < 210) + if !exists("g:ConqueTerm_Version") || (exists("g:ConqueTerm_Version") && g:ConqueTerm_Version < 230) let g:vimrplugin_conqueplugin = 0 - call RWarningMsg("You are using Conque Shell plugin " . g:ConqueTerm_Version . ". Vim-R-plugin requires Conque Shell >= 2.1") + call RWarningMsg("You are using Conque Shell plugin " . g:ConqueTerm_Version . ". Vim-R-plugin requires Conque Shell >= 2.3") call input("Press to continue. ") finish endif From dd1d3dfa37c7f8c56f5e58165a874cd508300516 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Wed, 21 Sep 2011 10:13:13 -0300 Subject: [PATCH 0033/1050] Note on Screen plugin version. --- doc/r-plugin.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index ee36a21..574cca3 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -5,7 +5,7 @@ Authors: Jakson A. Aquino Jose Claudio Faria -Version: 110830 +Version: 110921 For Vim version 7.3 1. Overview |r-plugin-overview| @@ -140,6 +140,8 @@ emulator, Vim in a terminal emulator and R in an external terminal emulator, and using GNU Screen instead of Tmux to split the terminal emulator in two regions. +Note: Tmux 1.3 needs Screen plugin 1.4 and Tmux 1.5 needs Screen plugin 1.5. + 3.2.2. Windows~ In addition to having R installed in your system, this plugin requires users From 695802fc0c1779dc581e5c6feb129abeda6f6cee Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 22 Sep 2011 13:28:53 -0300 Subject: [PATCH 0034/1050] New option: vimrplugin_notmuxconf. --- doc/r-plugin.txt | 14 ++++++++------ r-plugin/common_global.vim | 12 +++++++++++- r-plugin/tmux.conf | 3 --- 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 574cca3..ac7baef 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -121,11 +121,8 @@ to install: Note: Tmux, GNU Screen and ncurses-term are already packaged for most GNU/Linux distributions and other Unix variants. The library ncurses-term is necessary only for 256 color support in the terminal emulator. - Unfortunately its installation instructions vary widely and are beyond the - scope of this documentation. - -If you do not have a custom Tmux configuration file yet, copy the file -~/.vim/r-plugin/tmux.conf to ~/.tmux.conf + Unfortunately their installation instructions vary widely and are beyond + the scope of this documentation. If you are using Vim (not GVim), the plugin will run inside a Tmux session. If are not already a user of Tmux, please, read the |r-plugin-tmux| section to @@ -140,7 +137,7 @@ emulator, Vim in a terminal emulator and R in an external terminal emulator, and using GNU Screen instead of Tmux to split the terminal emulator in two regions. -Note: Tmux 1.3 needs Screen plugin 1.4 and Tmux 1.5 needs Screen plugin 1.5. +Note: Tmux 1.3 requires Screen plugin 1.4 and Tmux 1.5 needs Screen plugin 1.5. 3.2.2. Windows~ @@ -980,12 +977,17 @@ example show how to adjust the value of sleeptime in your |vimrc|: 7.14. Tmux and Screen configuration (Linux/Unix only)~ *vimrplugin_noscreenrc* + *vimrplugin_notmuxconf* GVim (or Vim running R in an external terminal emulator) runs GNU Screen with a specially built configuration file. If you want to use your own ~/.screenrc, put in your |vimrc|: > let vimrplugin_noscreenrc = 1 < +If you want to use your own ~/.tmux.conf, put in your vimrc: +> + let vimrplugin_notmuxconf = 1 +< 7.15. Integration with screen.vim plugin (Linux/Unix only)~ *vimrplugin_screenplugin* diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 6aedd3e..a3ce641 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -17,7 +17,7 @@ " " Based on previous work by Johannes Ranke " -" Last Change: Wed Sep 21, 2011 09:16AM +" Last Change: Thu Sep 22, 2011 12:47PM " " Purposes of this file: Create all functions and commands and Set the " value of all global variables and some buffer variables.for r, @@ -380,6 +380,7 @@ function StartR(whatr) endif if g:vimrplugin_screenplugin + let rcmd = "export VIMRPLUGIN_TMPDIR=" . $VIMRPLUGIN_TMPDIR . " ; ". rcmd if g:vimrplugin_screenvsplit if exists(":ScreenShellVertical") == 2 exec 'ScreenShellVertical ' . rcmd @@ -2008,6 +2009,7 @@ call RSetDefaultValue("g:vimrplugin_listmethods", 0) call RSetDefaultValue("g:vimrplugin_specialplot", 0) call RSetDefaultValue("g:vimrplugin_nosingler", 0) call RSetDefaultValue("g:vimrplugin_noscreenrc", 0) +call RSetDefaultValue("g:vimrplugin_notmuxconf", 0) call RSetDefaultValue("g:vimrplugin_routnotab", 0) call RSetDefaultValue("g:vimrplugin_editor_w", 66) call RSetDefaultValue("g:vimrplugin_help_w", 46) @@ -2200,6 +2202,14 @@ let g:rplugin_globalenvfname = $VIMRPLUGIN_TMPDIR . "/GlobalEnvList" if g:vimrplugin_tmux let g:ScreenImpl = 'Tmux' + if g:ScreenShellTmuxInitArgs == "" + if $DISPLAY != "" + let g:ScreenShellTmuxInitArgs = "-2" + endif + if g:vimrplugin_notmuxconf == 0 + let g:ScreenShellTmuxInitArgs = g:ScreenShellTmuxInitArgs . " -f " . rplugin_home . "/r-plugin/tmux.conf" + endif + endif else let g:ScreenImpl = 'GnuScreen' endif diff --git a/r-plugin/tmux.conf b/r-plugin/tmux.conf index b5b96e1..0f37d3d 100644 --- a/r-plugin/tmux.conf +++ b/r-plugin/tmux.conf @@ -6,9 +6,6 @@ bind-key C-a send-prefix # changing the mode-keys to vi set-window-option -g mode-keys vi -# 256 colors -set -g default-terminal "screen-256color" - # Disable the status bar set -g status off From c086b106df7adf17de9912b1c1b5ef9fce159c75 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 22 Sep 2011 14:03:36 -0300 Subject: [PATCH 0035/1050] New tip: Vim with 256 colors in terminal emulator. --- doc/r-plugin.txt | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index ac7baef..279e65a 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -1430,6 +1430,28 @@ code automatically, breaking only comment lines, put in your |vimrc|: autocmd FileType r setlocal formatoptions=cq < +10.12. Vim with 256 colors in a terminal emulator (Linux/Unix only)~ + +If you want 256 colors support in Vim, install the package ncurses-term. Then +put in your ~/.bashrc: +> + if [ "x" != "x$DISPLAY" ] + then + export TERM=xterm-256color + fi +< +Finally, put in your |vimrc|: +> + if &term =~ "xterm" || &term =~ "256" || $DISPLAY != "" + set t_Co=256 + endif + colorscheme your_prefered_color_scheme +< +You have to search the internet for color schemes supporting 256 colors, +download and copy them to ~/.vim/colors. You may use the command +|:colorscheme| to try them all before setting your preference in your |vimrc|. + + 10.12. Run your Makefile from within R~ Do you have many Rnoweb files included in a master tex or Rnoweb file and use @@ -1658,6 +1680,7 @@ the R syntax highlighted. 12. News~ *r-plugin-news* + * New option: vimrplugin_notmuxconf. * Fixed bug in code indentation after unbalanced brackets when r_indent_align_args = 0 (thanks to Chris Neff for reporting the bug). * Fixed bug in code indentation after unbalanced parenthesis when From 359ca927aaabe3377ccca027afd52f689b1f2da6 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 22 Sep 2011 14:06:06 -0300 Subject: [PATCH 0036/1050] Fix tips numbers. --- doc/r-plugin.txt | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 279e65a..dcfbfa8 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -1452,7 +1452,7 @@ download and copy them to ~/.vim/colors. You may use the command |:colorscheme| to try them all before setting your preference in your |vimrc|. -10.12. Run your Makefile from within R~ +10.13. Run your Makefile from within R~ Do you have many Rnoweb files included in a master tex or Rnoweb file and use a Makefile to build the pdf? You may consider it useful to put the following @@ -1461,7 +1461,7 @@ line in your |vimrc|: nmap sm :update:call SendCmdToR('system("make")') < -10.13. Group windows with compiz~ +10.14. Group windows with compiz~ If you are using Compiz, it may be easier to work with the plugin if the various related windows (editor, terminal, and graphics window) are grouped @@ -1470,7 +1470,7 @@ may need CompizConfig Settings Manager installed to enable this feature (look at the "Window Management" section for "Group and Tab Windows"). -10.14. Why do I have to updated the Object Browser manually?~ +10.15. Why do I have to updated the Object Browser manually?~ It is because Vim and R run as separate processes and, thus, it is not possible to Vim to know whether R is busy or not. If R was running as part of @@ -1482,7 +1482,7 @@ the Vim-R-plugin did this, the use of Vim would be blocked until R finished its processing. -10.15. Edit your ~/.Rprofile~ +10.16. Edit your ~/.Rprofile~ You may want to edit your ~/.Rprofile. Two common options are the use of GVim as the text editor and the use of html help. Example for Linux with these two @@ -1529,7 +1529,7 @@ An example for Windows: } < -10.16. Debugging R functions~ +10.17. Debugging R functions~ The Vim-R-Plugin does not have debugging facilities, but you may want to use the R package "debug": @@ -1549,12 +1549,12 @@ on top" or a similar option provided by your desktop manager. There is also the R package "edtdbg" which aims to integrate R debugging facilities with Vim. -10.17. Turn the R-plugin into a global plugin~ +10.18. Turn the R-plugin into a global plugin~ *r-plugin-global* The Vim-R-plugin is a file type plugin. If you want its functionality available for all file types, then do one of the following: -10.17.1. When using GVim~ +10.18.1. When using GVim~ Go to your ~/.vim/plugin directory and create a symbolic link to ~/.vim/r-plugin/global_r_plugin.vim. That is, type the following @@ -1570,7 +1570,7 @@ make a copy of the file to the ~/.vim/plugin directory and edit it. On Windows, you probably will have to make a copy of the file to the ~/vimfiles/plugin directory. -10.17.2. When using Vim + screen.vim plugin (either Tmux or GNU Screen)~ +10.18.2. When using Vim + screen.vim plugin (either Tmux or GNU Screen)~ Put in your |vimrc| (replace with the shortcut of your preference): > @@ -1586,7 +1586,7 @@ Consequently, the ftplugin/r.vim script must be sourced again by pressing for the second time. -10.18. Disable syntax highlight of R functions~ +10.19. Disable syntax highlight of R functions~ If you want to disable the syntax highlight of R functions edit the file ~/.vim/r-plugin/functions.vim and delete all lines, but do not delete the From 5ac49368a2599c1fd555de03599c082855f89bde Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Fri, 23 Sep 2011 18:27:19 -0300 Subject: [PATCH 0037/1050] Improve description of Tmux usage. --- doc/r-plugin.txt | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index dcfbfa8..2a822c1 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -548,13 +548,22 @@ in the example below. A sample detachable session could be: + - Create your ~/.tmux.conf if it does not exist yet. You may use the + r-plugin/tmux.conf as a starting point to your own configuration file. + - Start Tmux: tmux + - Start Vim: vim theScript.R + - Use Vim to start an R session: \rf + - Send code from Vim to R, and, then, detach Vim and R with d + The command will be d if you have not set as the scape + character in your ~/.tmux.conf. + - Some time latter (even if accessing the machine remotely) reattach the Tmux session: tmux attach @@ -731,7 +740,7 @@ indentation by adding braces and line breaks to it. Example: |vimrplugin_maxdeparse| Argument to R args() function |vimrplugin_latexcmd| Command to run on .tex files |vimrplugin_sweaveargs| Arguments do Sweave() -|vimrplugin_never_unmake_menu| Do not unmake menu when switching buffers +|vimrplugin_never_unmake_menu| Do not unmake the menu when switching buffers |vimrplugin_map_r| Use 'r' to send lines and selected text @@ -1542,7 +1551,7 @@ Once the library is installed and loaded, you should use mtrace(function_name) to enable the debugging of a function. Then, the next time that the function is called it will enter in debugging mode. Once debugging a function, you can hit to evaluate the current line, go(n) to go to line n in the -function and qqq() to quit the function (See debug's help for details). An +function and qqq() to quit the function (See debug's help for details). A useful tip is to click on the title bar of the debug window and choose "Always on top" or a similar option provided by your desktop manager. @@ -1616,7 +1625,7 @@ important Vim limitations are: In spite of these problems, the use of Conque Shell already has some advantages: the ability to edit R's output, and the syntax highlighting of the -output. If you want to try the Conque Shell, install it from: +output. If you want to try the Conque Shell, install it from http://www.vim.org/scripts/script.php?script_id=2771 @@ -1681,6 +1690,10 @@ the R syntax highlighted. *r-plugin-news* * New option: vimrplugin_notmuxconf. + * Fixed bug when starting tmux before vim: the environment variable + VIMRPLUGIN_TMPDIR was not being set. Thanks to Michel Lang for reporting + the bug and helping to track its source, and thanks to Eric Dewoestine for + explaining how to fix the bug. * Fixed bug in code indentation after unbalanced brackets when r_indent_align_args = 0 (thanks to Chris Neff for reporting the bug). * Fixed bug in code indentation after unbalanced parenthesis when From 3d9d33cb161e30dcbf0919bf468bc25980815927 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 24 Sep 2011 16:56:33 -0300 Subject: [PATCH 0038/1050] Use fakeroot to build the Debian package. --- make_dist.sh | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/make_dist.sh b/make_dist.sh index ec3ec2d..78ed0dd 100755 --- a/make_dist.sh +++ b/make_dist.sh @@ -21,14 +21,6 @@ ########################################################### -# It's necessary to run the script as root to have the files permissions and -# ownership correctly set in the Debian package. -# The script requires the use of sudo to become root. -if [ "$USER" != "root" ] -then - echo "You must be root to run this script!" - exit 0 -fi PLUGINHOME=`pwd` PLUGINVERSION=`date +%y%m%d` @@ -172,7 +164,6 @@ of the GNU General Public License. # Unpack the tar.gz and create the zip file tar -xvzf vimrplugintmpfile.tar.gz -C vim-r-plugin-tmp/usr/share/vim/addons > /dev/null rm vimrplugintmpfile.tar.gz -chown -R root.root vim-r-plugin-tmp cd vim-r-plugin-tmp/usr/share/vim/addons chmod +w r-plugin/tex_indent.vim rm -f /tmp/vim-r-plugin-$PLUGINVERSION.zip @@ -233,18 +224,11 @@ chmod +x DEBIAN/postrm DEBIAN/postinst # Build the Debian package cd /tmp -dpkg-deb -b vim-r-plugin-tmp vim-r-plugin_$PLUGINVERSION-1_all.deb +fakeroot dpkg-deb -b vim-r-plugin-tmp vim-r-plugin_$PLUGINVERSION-1_all.deb # Clean rm -rf vim-r-plugin-tmp -# Change the ownership of both the zip and the deb files, so you can move and -# delete them without becoming root. -if [ "x$SUDO_USER" != "x" ] -then - cd /tmp - chown $SUDO_USER.$SUDO_USER vim-r-plugin-$PLUGINVERSION.zip vim-r-plugin_$PLUGINVERSION-1_all.deb -fi # Warn if the date in the doc is outdated PLUGINVERSION=`date +"%Y-%m-%d"` From e40ae43f80f30ab82d87d9a2b57094c963d9bb3c Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 24 Sep 2011 20:50:13 -0300 Subject: [PATCH 0039/1050] Avoid lintian warnings on Debian changelog. --- make_dist.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/make_dist.sh b/make_dist.sh index 78ed0dd..a7004fa 100755 --- a/make_dist.sh +++ b/make_dist.sh @@ -82,9 +82,9 @@ mkdir -p vim-r-plugin-tmp/usr/share/doc/vim-r-plugin DEBIANTIME=`date -R` echo "vim-r-plugin ($PLUGINVERSION-1) unstable; urgency=low -* Initial Release. + * Initial Release. --- Jakson Alves de Aquino $DEBIANTIME + -- Jakson Alves de Aquino $DEBIANTIME " > vim-r-plugin-tmp/usr/share/doc/vim-r-plugin/changelog gzip --best vim-r-plugin-tmp/usr/share/doc/vim-r-plugin/changelog From 7d1a2b5e508123464756232f1bc62c2073198965 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Mon, 3 Oct 2011 00:20:50 -0300 Subject: [PATCH 0040/1050] Improved default startup. Improved how the default mode of starting R is defined (AppleScript, GNU Screen, Tmux, external terminal). --- doc/r-plugin.txt | 103 +++++++++++++++++------------- r-plugin/common_global.vim | 126 ++++++++++++++++++++++--------------- 2 files changed, 137 insertions(+), 92 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 2a822c1..d775c54 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -5,7 +5,7 @@ Authors: Jakson A. Aquino Jose Claudio Faria -Version: 110921 +Version: 111002 For Vim version 7.3 1. Overview |r-plugin-overview| @@ -113,7 +113,7 @@ sections 3.3 and 3.4. In addition to having R installed in your system, this plugin requires users to install: - Tmux: http://tmux.sourceforge.net + Tmux (>= 1.5): http://tmux.sourceforge.net GNU Screen: http://www.gnu.org/s/screen screen.vim plugin: http://www.vim.org/scripts/script.php?script_id=2711 ncurses-term: http://invisible-island.net/ncurses @@ -135,9 +135,23 @@ the default configuration when running Vim in a terminal emulator, but it is also possible to use the plugin with GVim and R in an external terminal emulator, Vim in a terminal emulator and R in an external terminal emulator, and using GNU Screen instead of Tmux to split the terminal emulator in two -regions. +regions. The two lists below show how the plugin will work in different +conditions: + + Vim Condition + ------------------------------ ------------------------------------- + Screen plugin (Tmux) default on Linux + Screen plugin (GNU Screen) vimrplugin_tmux = 0 or Tmux not found + GNU Screen (external terminal) vimrplugin_screenplugin = 0 + Conque Shell vimrplugin_screenplugin = 0 and + vimrplugin_conqueplugin = 1 + + + GVim Condition + ------------------------------ ------------------------------------- + GNU Screen (external terminal) default on Linux + Conque Shell vimrplugin_conqueplugin = 1 -Note: Tmux 1.3 requires Screen plugin 1.4 and Tmux 1.5 needs Screen plugin 1.5. 3.2.2. Windows~ @@ -708,40 +722,40 @@ indentation by adding braces and line breaks to it. Example: ============================================================================== 7. Options~ *r-plugin-options* -|vimrplugin_term| External terminal to be used -|vimrplugin_term_cmd| Complete command to open an external terminal -|vimrplugin_underscore| Convert '_' into ' <- ' -|vimrplugin_rnowebchunk| Convert '<' into '<<>>=\n@' in Rnoweb files -|vimrplugin_objbr_place| Placement of Object Browser -|vimrplugin_objbr_w| Initial width of Object Browser window -|vimrplugin_vimpager| Use Vim to see R documentation -|vimrplugin_editor_w| Minimum width of R script buffer -|vimrplugin_help_w| Desired width of R documentation buffer -|vimrplugin_nosingler| A single R process for all Vim instances -|vimrplugin_by_vim_instance| Each Vim instance runs its own R -|vimrplugin_i386| Use 32 bit version of R -|vimrplugin_r_path| Directory where R is -|vimrplugin_r_args| Arguments to pass to R -|vimrplugin_buildwait| Time to wait for :RUpdateObjList to finish -|vimrplugin_routmorecolors| More syntax highlighting in R output -|vimrplugin_routnotab| Show output of R CMD BATCH in new window -|vimrplugin_indent_commented| Indent lines commented with the \cc command -|vimrplugin_sleeptime| Delay while sending commands in MS Windows -|vimrplugin_noscreenrc| Do not write custom screenrc -|vimrplugin_screenplugin| Use the screen.vim plugin -|vimrplugin_screenvsplit| Split the window vertically with screen plugin -|vimrplugin_tmux| Choose between Tmux and GNU Screen -|vimrplugin_applescript| Use osascript in Mac OS X. -|vimrplugin_open_df| Show data.frame elements in the Object Browser -|vimrplugin_open_list| Show list elements in the Object Browser -|vimrplugin_allnames| Show names which begin with a dot -|vimrplugin_listmethods| Do .vim.list.args() instead of args() -|vimrplugin_specialplot| Do .vim.plot() instead of plot() -|vimrplugin_maxdeparse| Argument to R args() function -|vimrplugin_latexcmd| Command to run on .tex files -|vimrplugin_sweaveargs| Arguments do Sweave() -|vimrplugin_never_unmake_menu| Do not unmake the menu when switching buffers -|vimrplugin_map_r| Use 'r' to send lines and selected text +|vimrplugin_term| External terminal to be used +|vimrplugin_term_cmd| Complete command to open an external terminal +|vimrplugin_underscore| Convert '_' into ' <- ' +|vimrplugin_rnowebchunk| Convert '<' into '<<>>=\n@' in Rnoweb files +|vimrplugin_objbr_place| Placement of Object Browser +|vimrplugin_objbr_w| Initial width of Object Browser window +|vimrplugin_vimpager| Use Vim to see R documentation +|vimrplugin_editor_w| Minimum width of R script buffer +|vimrplugin_help_w| Desired width of R documentation buffer +|vimrplugin_nosingler| A single R process for all Vim instances +|vimrplugin_by_vim_instance| Each Vim instance runs its own R +|vimrplugin_i386| Use 32 bit version of R +|vimrplugin_r_path| Directory where R is +|vimrplugin_r_args| Arguments to pass to R +|vimrplugin_buildwait| Time to wait for :RUpdateObjList to finish +|vimrplugin_routmorecolors| More syntax highlighting in R output +|vimrplugin_routnotab| Show output of R CMD BATCH in new window +|vimrplugin_indent_commented| Indent lines commented with the \cc command +|vimrplugin_sleeptime| Delay while sending commands in MS Windows +|vimrplugin_noscreenrc| Do not write custom screenrc +|vimrplugin_screenplugin| Use the screen.vim plugin +|vimrplugin_screenvsplit| Split the window vertically (screen plugin) +|vimrplugin_tmux| Choose between Tmux and GNU Screen +|vimrplugin_applescript| Use osascript in Mac OS X. +|vimrplugin_open_df| Show data.frame elements in the Obj. Browser +|vimrplugin_open_list| Show list elements in the Object Browser +|vimrplugin_allnames| Show names which begin with a dot +|vimrplugin_listmethods| Do .vim.list.args() instead of args() +|vimrplugin_specialplot| Do .vim.plot() instead of plot() +|vimrplugin_maxdeparse| Argument to R args() function +|vimrplugin_latexcmd| Command to run on .tex files +|vimrplugin_sweaveargs| Arguments do Sweave() +|vimrplugin_never_unmake_menu| Do not unmake the menu when switching buffers +|vimrplugin_map_r| Use 'r' to send lines and selected text 7.1. Terminal emulator (Linux/Unix only)~ @@ -1004,11 +1018,13 @@ If you want to use your own ~/.tmux.conf, put in your vimrc: *vimrplugin_tmux* By default, when running in a terminal emulator, the Vim-R-plugin uses the screen.vim plugin if it is installed and, by default, it will use Tmux instead -of GNU Screen. If you prefer to use the GNU Screen application, put in your -|vimrc|: +of GNU Screen. If both GNU Screen and Tmux are installed but you prefer to use +the GNU Screen application, put in your |vimrc|: > let vimrplugin_tmux = 0 < +If Tmux is not installed, the Vim-R-plugin will use GNU Screen. + Start Vim and do the command rf. The screen.vim plugin will split the terminal in two regions and will run R in one of them. Using both plugins at the same time is especially useful for users who may prefer to use Vim and @@ -1034,10 +1050,11 @@ terminal horizontally. If you prefer to split it vertically put in your 7.17. Integration with AppleScript (OS X only)~ *vimrplugin_applescript* In Mac OS X, the plugin will try to send commands to R gui using AppleScript -if the screen.vim plugin is not installed. If you prefer to have R running in an +if running the GUI version of MacVim. If you prefer to have R running in an external terminal emulator, put in your |vimrc|: > let vimrplugin_applescript = 0 + let vimrplugin_screenplugin = 0 < 7.18. Special R functions~ @@ -1876,7 +1893,7 @@ the R syntax highlighted. 100512 (2010-05-12) * Thanks to Tortonesi Mauro who wrote a patch to make the plugin work with pathogen.vim. - * Added simple syntax hightlight for .Rout files. + * Added simple syntax highlight for .Rout files. * Increased the time limit of RUpdateObjList to two minutes. * Improvement in the syntax highlight based on code written by Zhuojun Chen. * Thanks to Scott Kostyshak who helped to improve the documentation. @@ -1933,7 +1950,7 @@ the R syntax highlighted. * Better word detection before calling R's help(). * Fixed bug in underscore replacement. * Fixed small bug in code indentation. - * Added scipt rpager.sh. + * Added script rpager.sh. * Added two new plugin options: no underscore replacement and fixed name for the pipe file instead of random one. diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index a3ce641..6d7173c 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -17,7 +17,7 @@ " " Based on previous work by Johannes Ranke " -" Last Change: Thu Sep 22, 2011 12:47PM +" Last Change: Mon Oct 03, 2011 12:17AM " " Purposes of this file: Create all functions and commands and Set the " value of all global variables and some buffer variables.for r, @@ -349,8 +349,13 @@ function StartR(whatr) endif endif - if has("gui_macvim") && g:vimrplugin_applescript && g:vimrplugin_screenplugin == 0 && g:vimrplugin_conqueplugin == 0 - if isdirectory("/Applications/R64.app") && g:vimrplugin_i386 == 0 + if g:vimrplugin_applescript && g:vimrplugin_screenplugin == 0 && g:vimrplugin_conqueplugin == 0 + if isdirectory("/Applications/R64.app") + let g:rplugin_r64app = 1 + else + let g:rplugin_r64app = 0 + endif + if g:rplugin_r64app && g:vimrplugin_i386 == 0 let rcmd = "/Applications/R64.app" else let rcmd = "/Applications/R.app" @@ -358,7 +363,10 @@ function StartR(whatr) if g:rplugin_r_args != " " let rcmd = rcmd . " " . g:rplugin_r_args endif - call system("open " . rcmd) + let rlog = system("open " . rcmd) + if v:shell_error + call RWarningMsg(rlog) + endif lcd - return endif @@ -682,8 +690,8 @@ function SendCmdToR(cmd) return 1 endif - if has("gui_macvim") && g:vimrplugin_applescript && g:vimrplugin_screenplugin == 0 && g:vimrplugin_conqueplugin == 0 - if isdirectory("/Applications/R64.app") && g:vimrplugin_i386 == 0 + if g:vimrplugin_applescript && g:vimrplugin_screenplugin == 0 && g:vimrplugin_conqueplugin == 0 + if g:rplugin_r64app && g:vimrplugin_i386 == 0 let rcmd = "R64" else let rcmd = "R" @@ -1792,7 +1800,7 @@ function MakeRMenu() amenu R.Help\ (plugin).Options.Screen\ configuration :help vimrplugin_noscreenrc amenu R.Help\ (plugin).Options.Screen\ plugin :help vimrplugin_screenplugin endif - if !has("gui_macvim") + if has("gui_macvim") | has("gui_mac") | has("mac") | has("macunix") amenu R.Help\ (plugin).Options.Integration\ with\ Apple\ Script :help vimrplugin_applescript endif if has("gui_win32") @@ -1999,12 +2007,9 @@ call RSetDefaultValue("g:vimrplugin_allnames", 0) call RSetDefaultValue("g:vimrplugin_underscore", 1) call RSetDefaultValue("g:vimrplugin_rnowebchunk", 1) call RSetDefaultValue("g:vimrplugin_i386", 0) -call RSetDefaultValue("g:vimrplugin_applescript", 1) -call RSetDefaultValue("g:vimrplugin_tmux", 1) call RSetDefaultValue("g:vimrplugin_screenvsplit", 0) call RSetDefaultValue("g:vimrplugin_conquevsplit", 0) call RSetDefaultValue("g:vimrplugin_conqueplugin", 0) -call RSetDefaultValue("g:vimrplugin_screenplugin", 1) call RSetDefaultValue("g:vimrplugin_listmethods", 0) call RSetDefaultValue("g:vimrplugin_specialplot", 0) call RSetDefaultValue("g:vimrplugin_nosingler", 0) @@ -2022,12 +2027,63 @@ call RSetDefaultValue("g:vimrplugin_vimpager", "'vertical'") call RSetDefaultValue("g:vimrplugin_latexcmd", "'pdflatex'") call RSetDefaultValue("g:vimrplugin_objbr_place", "'console,right'") +if has("gui_macvim") | has("gui_mac") | has("mac") | has("macunix") + call RSetDefaultValue("g:vimrplugin_applescript", 1) +else + call RSetDefaultValue("g:vimrplugin_applescript", 0) +endif + +if g:vimrplugin_applescript == 0 + call RSetDefaultValue("g:vimrplugin_screenplugin", 1) +else + call RSetDefaultValue("g:vimrplugin_screenplugin", 0) +endif + +if g:vimrplugin_applescript + let g:vimrplugin_term_cmd = "none" + let g:vimrplugin_term = "none" +endif + if has("gui_win32") - call RSetDefaultValue("g:vimrplugin_conquesleep", 200) + call RSetDefaultValue("g:vimrplugin_conquesleep", 200) + let vimrplugin_screenplugin = 0 else - call RSetDefaultValue("g:vimrplugin_conquesleep", 100) + call RSetDefaultValue("g:vimrplugin_conquesleep", 100) endif +if g:vimrplugin_screenplugin + if has("gui_running") + let g:vimrplugin_tmux = 0 + let g:vimrplugin_screenplugin = 0 + else + if !exists("g:vimrplugin_tmux") + if executable('tmux') + let g:vimrplugin_tmux = 1 + let rplugin_missing_tmux = 0 + else + let g:vimrplugin_tmux = 0 + let rplugin_missing_tmux = 1 + endif + endif + if !exists("g:ScreenVersion") + call RWarningMsg("Please, either install the screen plugin (http://www.vim.org/scripts/script.php?script_id=2711) (recommended) or put 'let vimrplugin_screenplugin = 0' in your vimrc.") + call input("Press to continue. ") + let g:rplugin_failed = 1 + finish + else + if g:ScreenVersion < "1.5" + call RWarningMsg("Vim-R-plugin requires Screen plugin >= 1.5") + call input("Press to continue. ") + let g:rplugin_failed = 1 + finish + endif + endif + endif +else + let g:vimrplugin_tmux = 0 +endif + + " g:rplugin_home should be the directory where the r-plugin files are. For " users following the installation instructions it will be at ~/.vim or " ~/vimfiles, that is, the same value of g:rplugin_uservimfiles. However the @@ -2062,7 +2118,6 @@ else endif if has("gui_win32") - let vimrplugin_screenplugin = 0 " python has priority over python3, unless ConqueTerm_PyVersion == 3 if has("python") let s:py = "py" @@ -2131,46 +2186,18 @@ if has("gui_win32") let g:vimrplugin_sleeptime = 0.02 endif else - if has("gui_running") - let g:vimrplugin_screenplugin = 0 - endif - if !has("gui_running") - if g:vimrplugin_tmux && g:vimrplugin_screenplugin && !executable('tmux') - let rplugin_missing_tmux = 1 - call RWarningMsg("Please, either install the 'tmux' application (recommended) or put 'let vimrplugin_screenplugin = 0' in your vimrc to enable the Vim-R-plugin.") - endif - - if g:vimrplugin_screenplugin - if !exists("g:ScreenVersion") - call RWarningMsg("Please, either install the screen plugin (http://www.vim.org/scripts/script.php?script_id=2711) (recommended) or put 'let vimrplugin_screenplugin = 0' in your vimrc.") - call input("Press to continue. ") - let g:rplugin_failed = 1 - finish - else - if g:ScreenVersion < "1.4" - call RWarningMsg("Vim-R-plugin requires Screen plugin >= 1.4") - call input("Press to continue. ") - let g:rplugin_failed = 1 - finish - endif - endif - endif - endif - - if (has("gui_running") || (!has("gui_running") && (g:vimrplugin_tmux == 0 || g:vimrplugin_screenplugin == 0))) && !executable('screen') + if g:vimrplugin_applescript == 0 && (has("gui_running") || (!has("gui_running") && (g:vimrplugin_tmux == 0 || g:vimrplugin_screenplugin == 0))) && !executable('screen') let rplugin_missing_screen = 1 if has("gui_running") call RWarningMsg("Please, install the 'screen' application to enable the Vim-R-plugin with GVim.") else call RWarningMsg("Please, install the 'screen' application to enable the Vim-R-plugin.") endif - endif - - if exists("rplugin_missing_tmux") || exists("rplugin_missing_screen") call input("Press to continue. ") let g:rplugin_failed = 1 finish endif + if exists("g:vimrplugin_r_path") let g:rplugin_R = g:vimrplugin_r_path . "/R" else @@ -2179,12 +2206,6 @@ else if !exists("g:vimrplugin_r_args") let g:vimrplugin_r_args = " " endif - - if has("gui_macvim") && g:vimrplugin_applescript && !exists("g:ScreenVersion") - let g:vimrplugin_screenplugin = 0 - let g:vimrplugin_term_cmd = "none" - let g:vimrplugin_term = "none" - endif endif if isdirectory("/tmp") @@ -2299,6 +2320,13 @@ else if has('mac') let s:terminals = ['iTerm', 'Terminal.app'] + s:terminals endif + if exists("g:vimrplugin_term") + if !executable(g:vimrplugin_term) + call RWarningMsg("'" . g:vimrplugin_term . "' not found. Please change the value of 'vimrplugin_term' in your vimrc.") + call input("Press to continue. ") + unlet g:vimrplugin_term + endif + endif if !exists("g:vimrplugin_term") for term in s:terminals if executable(term) From 2c064a413e7aab36155d8633c948367f8d85d76a Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Wed, 5 Oct 2011 19:17:19 -0300 Subject: [PATCH 0041/1050] Fix scroll bug when copying and pasting. --- r-plugin/tmux.conf | 3 +++ 1 file changed, 3 insertions(+) diff --git a/r-plugin/tmux.conf b/r-plugin/tmux.conf index 0f37d3d..442594e 100644 --- a/r-plugin/tmux.conf +++ b/r-plugin/tmux.conf @@ -9,3 +9,6 @@ set-window-option -g mode-keys vi # Disable the status bar set -g status off +# Avoid scroll bug when copying and pasting text +set -g terminal-overrides 'xterm*:smcup@:rmcup@' + From 3d24d662a74d5c550b6471f4ac730eeee632d98e Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 6 Oct 2011 00:31:21 -0300 Subject: [PATCH 0042/1050] Make sure some warn messages will be visible. --- r-plugin/common_global.vim | 39 +++++++++++++++++--------------------- 1 file changed, 17 insertions(+), 22 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 6d7173c..8808c09 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -17,7 +17,7 @@ " " Based on previous work by Johannes Ranke " -" Last Change: Mon Oct 03, 2011 12:17AM +" Last Change: Thu Oct 06, 2011 12:28AM " " Purposes of this file: Create all functions and commands and Set the " value of all global variables and some buffer variables.for r, @@ -47,6 +47,12 @@ function RWarningMsg(wmsg) echohl Normal endfunction +function RWarningMsgInp(wmsg) + echohl WarningMsg + call input(a:wmsg . " [Press to continue] ") + echohl Normal +endfunction + " Set default value of some variables: function RSetDefaultValue(var, val) if !exists(a:var) @@ -393,8 +399,7 @@ function StartR(whatr) if exists(":ScreenShellVertical") == 2 exec 'ScreenShellVertical ' . rcmd else - call RWarningMsg("Did you put \"let g:ScreenImpl = 'Tmux'\" in your vimrc?") - call input("Press to continue. ") + call RWarningMsgInp("Did you put \"let g:ScreenImpl = 'Tmux'\" in your vimrc?") exec 'ScreenShell ' . rcmd endif else @@ -2066,14 +2071,12 @@ if g:vimrplugin_screenplugin endif endif if !exists("g:ScreenVersion") - call RWarningMsg("Please, either install the screen plugin (http://www.vim.org/scripts/script.php?script_id=2711) (recommended) or put 'let vimrplugin_screenplugin = 0' in your vimrc.") - call input("Press to continue. ") + call RWarningMsgInp("Please, either install the screen plugin (http://www.vim.org/scripts/script.php?script_id=2711) (recommended) or put 'let vimrplugin_screenplugin = 0' in your vimrc.") let g:rplugin_failed = 1 finish else if g:ScreenVersion < "1.5" - call RWarningMsg("Vim-R-plugin requires Screen plugin >= 1.5") - call input("Press to continue. ") + call RWarningMsgInp("Vim-R-plugin requires Screen plugin >= 1.5") let g:rplugin_failed = 1 finish endif @@ -2133,9 +2136,7 @@ if has("gui_win32") endif if s:py == "" - call RWarningMsg("Python interface must be enabled to run Vim-R-Plugin.") - call RWarningMsg("Please do ':h r-plugin-installation' for details.") - call input("Press to continue. ") + call RWarningMsgInp("Python interface must be enabled to run Vim-R-Plugin. Please do ':h r-plugin-installation' for details.") let g:rplugin_failed = 1 finish endif @@ -2150,9 +2151,7 @@ if has("gui_win32") else exe s:py . " GetRPathPy()" if s:rinstallpath == "Not found" - call RWarningMsg("Could not find R path in Windows Registry.") - call RWarningMsg("Please, either install R or set the value of 'vimrplugin_r_path'.") - call input("Press to continue. ") + call RWarningMsgInp("Could not find R path in Windows Registry. Please, either install R or set the value of 'vimrplugin_r_path'.") let g:rplugin_failed = 1 finish endif @@ -2189,11 +2188,10 @@ else if g:vimrplugin_applescript == 0 && (has("gui_running") || (!has("gui_running") && (g:vimrplugin_tmux == 0 || g:vimrplugin_screenplugin == 0))) && !executable('screen') let rplugin_missing_screen = 1 if has("gui_running") - call RWarningMsg("Please, install the 'screen' application to enable the Vim-R-plugin with GVim.") + call RWarningMsgInp("Please, install the 'screen' application to enable the Vim-R-plugin with GVim.") else - call RWarningMsg("Please, install the 'screen' application to enable the Vim-R-plugin.") + call RWarningMsgInp("Please, install the 'screen' application to enable the Vim-R-plugin.") endif - call input("Press to continue. ") let g:rplugin_failed = 1 finish endif @@ -2243,8 +2241,7 @@ endif if g:vimrplugin_conqueplugin == 1 if !exists("g:ConqueTerm_Version") || (exists("g:ConqueTerm_Version") && g:ConqueTerm_Version < 230) let g:vimrplugin_conqueplugin = 0 - call RWarningMsg("You are using Conque Shell plugin " . g:ConqueTerm_Version . ". Vim-R-plugin requires Conque Shell >= 2.3") - call input("Press to continue. ") + call RWarningMsgInp("You are using Conque Shell plugin " . g:ConqueTerm_Version . ". Vim-R-plugin requires Conque Shell >= 2.3") finish endif endif @@ -2322,8 +2319,7 @@ else endif if exists("g:vimrplugin_term") if !executable(g:vimrplugin_term) - call RWarningMsg("'" . g:vimrplugin_term . "' not found. Please change the value of 'vimrplugin_term' in your vimrc.") - call input("Press to continue. ") + call RWarningMsgInp("'" . g:vimrplugin_term . "' not found. Please change the value of 'vimrplugin_term' in your vimrc.") unlet g:vimrplugin_term endif endif @@ -2340,8 +2336,7 @@ else endif if !exists("g:vimrplugin_term") && !exists("g:vimrplugin_term_cmd") - call RWarningMsg("Please, set the variable 'g:vimrplugin_term_cmd' in your .vimrc.\nRead the plugin documentation for details.") - call input("Press to continue. ") + call RWarningMsgInp("Please, set the variable 'g:vimrplugin_term_cmd' in your .vimrc.\nRead the plugin documentation for details.") let g:rplugin_failed = 1 finish endif From 6c3142f530d74a8042fbc8067dcdcefa0ef00d64 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 6 Oct 2011 00:44:26 -0300 Subject: [PATCH 0043/1050] Improve configuration of default terminal. --- r-plugin/common_global.vim | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 8808c09..21dddbf 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -17,7 +17,7 @@ " " Based on previous work by Johannes Ranke " -" Last Change: Thu Oct 06, 2011 12:28AM +" Last Change: Thu Oct 06, 2011 12:42AM " " Purposes of this file: Create all functions and commands and Set the " value of all global variables and some buffer variables.for r, @@ -2044,11 +2044,6 @@ else call RSetDefaultValue("g:vimrplugin_screenplugin", 0) endif -if g:vimrplugin_applescript - let g:vimrplugin_term_cmd = "none" - let g:vimrplugin_term = "none" -endif - if has("gui_win32") call RSetDefaultValue("g:vimrplugin_conquesleep", 200) let vimrplugin_screenplugin = 0 @@ -2309,7 +2304,7 @@ let s:all_marks = "abcdefghijklmnopqrstuvwxyz" call writefile([], g:rplugin_globalenvfname) " Choose a terminal (code adapted from screen.vim) -if has("gui_win32") +if has("gui_win32") || vimrplugin_applescript " No external terminal emulator will be called, so any value is good let g:vimrplugin_term = "xterm" else @@ -2341,6 +2336,8 @@ if !exists("g:vimrplugin_term") && !exists("g:vimrplugin_term_cmd") finish endif +let g:rplugin_termcmd = g:vimrplugin_term . " -e" + if g:vimrplugin_term == "gnome-terminal" || g:vimrplugin_term == "xfce4-terminal" " Cannot set icon: http://bugzilla.gnome.org/show_bug.cgi?id=126081 let g:rplugin_termcmd = g:vimrplugin_term . " --working-directory='" . expand("%:p:h") . "' --title R -e" @@ -2354,10 +2351,6 @@ if g:vimrplugin_term == "Eterm" let g:rplugin_termcmd = "Eterm --icon " . g:rplugin_home . "/bitmaps/ricon.png -e" endif -if g:vimrplugin_term == "rxvt" || g:vimrplugin_term == "aterm" - let g:rplugin_termcmd = g:vimrplugin_term . " -e" -endif - if g:vimrplugin_term == "roxterm" " Cannot set icon: http://bugzilla.gnome.org/show_bug.cgi?id=126081 let g:rplugin_termcmd = g:vimrplugin_term . " --directory='" . expand("%:p:h") . "' --title R -e" From d8ff333c6761704a1f9b8803a4b5a6ac20f224bf Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 6 Oct 2011 10:14:43 -0300 Subject: [PATCH 0044/1050] Improve Debian package description. --- make_dist.sh | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/make_dist.sh b/make_dist.sh index a7004fa..92fec18 100755 --- a/make_dist.sh +++ b/make_dist.sh @@ -186,15 +186,21 @@ Version: $PLUGINVERSION Architecture: all Maintainer: Jakson Alves de Aquino Installed-Size: $INSTALLEDSIZE -Depends: vim | vim-gtk | vim-gnome, screen, tmux, ncurses-term, vim-addon-manager, r-base | r-base-core +Depends: vim | vim-gtk | vim-gnome, screen, tmux, ncurses-term, vim-addon-manager, r-base-core Enhances: vim Section: text Priority: extra Homepage: http://www.vim.org/scripts/script.php?script_id=2628 Description: Plugin to work with R - This filetype plugin uses screen to communicate with R, but the communication - does not work on Microsoft Windows. The new functions are similar to what you - can find in Tinn-R and ess mode of emacs." > DEBIAN/control + This filetype plugin has the following main features: + - Start/Close R. + - Send lines, selection, paragraphs, functions, blocks, entire file. + - Send commands with the object under cursor as argument: + help, args, plot, print, str, summary, example, names. + - Support for editing Rnoweb files. + - Omni completion (auto-completion) for R objects. + - Ability to see R documentation in a Vim buffer. + - Object Browser." > DEBIAN/control # Create the md5sum file arquivos=`find -type f | grep -v DEBIAN | sed -e 's/^\.\///'` From fc363ff92746ab23b5493ef803fe98ae51be60a3 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 6 Oct 2011 10:18:31 -0300 Subject: [PATCH 0045/1050] Minor improvements. --- doc/r-plugin.txt | 49 ++++++++++++++++++++++++++---------------------- 1 file changed, 27 insertions(+), 22 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index d775c54..14888b2 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -5,7 +5,7 @@ Authors: Jakson A. Aquino Jose Claudio Faria -Version: 111002 +Version: 111006 For Vim version 7.3 1. Overview |r-plugin-overview| @@ -129,28 +129,23 @@ are not already a user of Tmux, please, read the |r-plugin-tmux| section to learn a few useful shortcuts. The tmux.conf file that ships with this plugin sets Tmux to work with vi key bindings. -Note: The recommended way of using the plugin on Linux is running Vim in a -terminal emulator, using Tmux to split the terminal in two regions. This is -the default configuration when running Vim in a terminal emulator, but it is -also possible to use the plugin with GVim and R in an external terminal -emulator, Vim in a terminal emulator and R in an external terminal emulator, -and using GNU Screen instead of Tmux to split the terminal emulator in two -regions. The two lists below show how the plugin will work in different -conditions: +Note: The plugin can use different mechanisms to send commands to R. The +mechanism that will be used depends on both what applications and plugins you +have installed and what options you have in your |vimrc|. The two lists below +show how the plugin will work in different conditions: - Vim Condition - ------------------------------ ------------------------------------- - Screen plugin (Tmux) default on Linux - Screen plugin (GNU Screen) vimrplugin_tmux = 0 or Tmux not found - GNU Screen (external terminal) vimrplugin_screenplugin = 0 - Conque Shell vimrplugin_screenplugin = 0 and - vimrplugin_conqueplugin = 1 + Vim Condition + ------------------------------ ------------------------------------- + Screen plugin (Tmux) default on Linux + Screen plugin (GNU Screen) vimrplugin_tmux = 0 or Tmux not found + GNU Screen (external terminal) vimrplugin_screenplugin = 0 + Conque Shell idem and vimrplugin_conqueplugin = 1 - GVim Condition - ------------------------------ ------------------------------------- - GNU Screen (external terminal) default on Linux - Conque Shell vimrplugin_conqueplugin = 1 + GVim Condition + ------------------------------ ------------------------------------- + GNU Screen (external terminal) default on Linux + Conque Shell vimrplugin_conqueplugin = 1 3.2.2. Windows~ @@ -163,6 +158,8 @@ to install several external dependencies: * Python: http://www.python.org/download/ Note: The official Vim is 32 bit and, thus, Python must be 32 bit too. + However, Vim and R run as independent processes, that is, you may have + 32 bit Vim sending commands to 64 bit R. Note: Be careful to download the correct Python version because Vim needs a specific version of Python DLL. For example, the official @@ -719,6 +716,12 @@ indentation by adding braces and line breaks to it. Example: class(x) <- c(if(ordered) "ordered", "factor") < +6.9. Commands are sent twice on Mac OS X~ + +If you use the screen plugin with GNU Screen, individual lines may be sent +duplicated to R on Mac OS X. + + ============================================================================== 7. Options~ *r-plugin-options* @@ -1018,8 +1021,10 @@ If you want to use your own ~/.tmux.conf, put in your vimrc: *vimrplugin_tmux* By default, when running in a terminal emulator, the Vim-R-plugin uses the screen.vim plugin if it is installed and, by default, it will use Tmux instead -of GNU Screen. If both GNU Screen and Tmux are installed but you prefer to use -the GNU Screen application, put in your |vimrc|: +of GNU Screen. Tmux was chosen as default because it may be split vertically +and its regions are easier to resize. If both GNU Screen and Tmux are +installed but you prefer to use the GNU Screen application, put in your +|vimrc|: > let vimrplugin_tmux = 0 < From 74a2875f7ae018f3247ef0e8c4f27062c0ba6742 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 6 Oct 2011 15:18:43 -0300 Subject: [PATCH 0046/1050] Add section on GNU Screen usage. --- doc/r-plugin.txt | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 14888b2..09161b3 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -579,7 +579,35 @@ A sample detachable session could be: Tmux session: tmux attach - + +4.8. GNU Screen usage~ + *r-plugin-screen* +When running Vim in a terminal emulator (Linux/Unix only), the Vim-R-plugin +will use the screen.vim plugin to restart Vim and start R in a Tmux session. +However, the plugin will use GNU Screen if Tmux is not installed or you have +set the value of vimrplugin_tmux = 0 in your |vimrc|. + +You may want to create your own ~/.screenrc to customize GNU Screen behavior. +The Vim-R-plugin comes with a sample screenrc (at r-plugin directory) that you +can use. Below are the most useful key bindings to use the Vim-R-plugin with +the provided screenrc: + + : Move the cursor to the next panel. + a : Decrease the height of the current panel. + z : Increase the height of the current panel. + [ : Enter the copy/scroll back mode. You can use , + and vi key bindings to move the cursor around + the panel. Press q to quit copy mode. + ] : Paste the content of GNU Screen paste buffer. + +While in the copy and scroll back mode, the following key bindings are very +useful: + + q : Quit the copy and scroll mode. + : Start text selection. + : Copy the selection to GNU Screen paste buffer. + + ============================================================================== 5. How the plugin works~ *r-plugin-functioning* From 053225d076e33cfda1063a8d702ca156ae7996ec Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 6 Oct 2011 15:19:08 -0300 Subject: [PATCH 0047/1050] Require Tmux >= 1.5. --- make_dist.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/make_dist.sh b/make_dist.sh index 92fec18..3249cb3 100755 --- a/make_dist.sh +++ b/make_dist.sh @@ -186,7 +186,7 @@ Version: $PLUGINVERSION Architecture: all Maintainer: Jakson Alves de Aquino Installed-Size: $INSTALLEDSIZE -Depends: vim | vim-gtk | vim-gnome, screen, tmux, ncurses-term, vim-addon-manager, r-base-core +Depends: vim | vim-gtk | vim-gnome, screen, tmux (>= 1.5), ncurses-term, vim-addon-manager, r-base-core Enhances: vim Section: text Priority: extra From d69c947fd3f682eb4ffd56c068aa3d3fe3c80481 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Fri, 7 Oct 2011 00:02:54 -0300 Subject: [PATCH 0048/1050] Do not beep when sending commands to R. --- r-plugin/common_global.vim | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 21dddbf..74897b7 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -17,7 +17,7 @@ " " Based on previous work by Johannes Ranke " -" Last Change: Thu Oct 06, 2011 12:42AM +" Last Change: Thu Oct 06, 2011 10:31PM " " Purposes of this file: Create all functions and commands and Set the " value of all global variables and some buffer variables.for r, @@ -624,8 +624,11 @@ endfunction " Function to send commands " return 0 on failure and 1 on success function SendCmdToR(cmd) - " ^K clean from cursor to the right and ^U clean from cursor to the left - let cmd = "\013" . "\025" . a:cmd + " ^K (\013) cleans from cursor to the right and ^U (\025) cleans from + " cursor to the left. However, ^U causes a beep if there is nothing to + " clean. The solution is to use ^A (\001) to move the cursor to the + " beginning of the line before sending ^K. + let cmd = "\001" . "\013" . a:cmd if has("gui_win32") && g:vimrplugin_conqueplugin == 0 let cmd = cmd . "\n" @@ -2183,9 +2186,9 @@ else if g:vimrplugin_applescript == 0 && (has("gui_running") || (!has("gui_running") && (g:vimrplugin_tmux == 0 || g:vimrplugin_screenplugin == 0))) && !executable('screen') let rplugin_missing_screen = 1 if has("gui_running") - call RWarningMsgInp("Please, install the 'screen' application to enable the Vim-R-plugin with GVim.") + call RWarningMsgInp("Please, install the 'GNU Screen' application to enable the Vim-R-plugin with GVim.") else - call RWarningMsgInp("Please, install the 'screen' application to enable the Vim-R-plugin.") + call RWarningMsgInp("Please, install the 'GNU Screen' application to enable the Vim-R-plugin.") endif let g:rplugin_failed = 1 finish From e263b9d92ae19a1047ccf44c9a04b04e22ca8d44 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Fri, 7 Oct 2011 08:43:15 -0300 Subject: [PATCH 0049/1050] Spell check normal text in R documentation files. --- syntax/rhelp.vim | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/syntax/rhelp.vim b/syntax/rhelp.vim index 7d76191..d26a403 100644 --- a/syntax/rhelp.vim +++ b/syntax/rhelp.vim @@ -2,7 +2,7 @@ " Language: R Help File " Maintainer: Jakson Aquino " Former Maintainer: Johannes Ranke -" Last Change: Thu Apr 14, 2011 05:03PM +" Last Change: Fri Oct 07, 2011 08:37AM " Version: 0.7.4 " SVN: $Id: rhelp.vim 90 2010-11-22 10:58:11Z ranke $ " Remarks: - Includes R syntax highlighting in the appropriate @@ -193,9 +193,9 @@ syn match rhelpDelimiter "{\|\[\|(\|)\|\]\|}" syn match rhelpComment /%.*$/ " Error {{{1 -syn region rhelpRegion matchgroup=Delimiter start=/(/ matchgroup=Delimiter end=/)/ transparent contains=ALLBUT,rhelpError,rhelpBraceError,rhelpCurlyError -syn region rhelpRegion matchgroup=Delimiter start=/{/ matchgroup=Delimiter end=/}/ transparent contains=ALLBUT,rhelpError,rhelpBraceError,rhelpParenError -syn region rhelpRegion matchgroup=Delimiter start=/\[/ matchgroup=Delimiter end=/]/ transparent contains=ALLBUT,rhelpError,rhelpCurlyError,rhelpParenError +syn region rhelpRegion matchgroup=Delimiter start=/(/ matchgroup=Delimiter end=/)/ contains=@Spell,rhelpCodeSpecial,rhelpComment,rhelpDelimiter,rhelpDots,rhelpFreesec,rhelpFreesubsec,rhelpIdentifier,rhelpKeyword,rhelpLink,rhelpPreProc,rhelpRComment,rhelpRcode,rhelpRegion,rhelpS4method,rhelpSection,rhelpSexpr,rhelpSpecialChar,rhelpString,rhelpType,rhelpVerbatim +syn region rhelpRegion matchgroup=Delimiter start=/{/ matchgroup=Delimiter end=/}/ contains=@Spell,rhelpCodeSpecial,rhelpComment,rhelpDelimiter,rhelpDots,rhelpFreesec,rhelpFreesubsec,rhelpIdentifier,rhelpKeyword,rhelpLink,rhelpPreProc,rhelpRComment,rhelpRcode,rhelpRegion,rhelpS4method,rhelpSection,rhelpSexpr,rhelpSpecialChar,rhelpString,rhelpType,rhelpVerbatim +syn region rhelpRegion matchgroup=Delimiter start=/\[/ matchgroup=Delimiter end=/]/ contains=@Spell,rhelpCodeSpecial,rhelpComment,rhelpDelimiter,rhelpDots,rhelpFreesec,rhelpFreesubsec,rhelpIdentifier,rhelpKeyword,rhelpLink,rhelpPreProc,rhelpRComment,rhelpRcode,rhelpRegion,rhelpS4method,rhelpSection,rhelpSexpr,rhelpSpecialChar,rhelpString,rhelpType,rhelpVerbatim syn match rhelpError /[)\]}]/ syn match rhelpBraceError /[)}]/ contained syn match rhelpCurlyError /[)\]]/ contained From a7811b03e38f2978a6a9e1eac2cc21f02c4cbd07 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Fri, 7 Oct 2011 10:52:26 -0300 Subject: [PATCH 0050/1050] Improve warning message followed by input request. --- r-plugin/common_global.vim | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 74897b7..2a17ecc 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -17,7 +17,7 @@ " " Based on previous work by Johannes Ranke " -" Last Change: Thu Oct 06, 2011 10:31PM +" Last Change: Fri Oct 07, 2011 10:40AM " " Purposes of this file: Create all functions and commands and Set the " value of all global variables and some buffer variables.for r, @@ -48,9 +48,17 @@ function RWarningMsg(wmsg) endfunction function RWarningMsgInp(wmsg) + let savelz = &lazyredraw + set lazyredraw echohl WarningMsg - call input(a:wmsg . " [Press to continue] ") + echomsg a:wmsg echohl Normal + call input("[Press to continue] ") + if savelz + set lazyredraw + else + set nolazyredraw + endif endfunction " Set default value of some variables: From 68d183f322810c0682aeb793624a790d222f5b72 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Fri, 7 Oct 2011 21:21:11 -0300 Subject: [PATCH 0051/1050] Use different screenrc (X11 and Linux Console). Use the screen plugin variable ScreenShellScreenInitArgs to start GNU Screen with different configuration files (screenrc and screenrc.xterm, for Linux Console and X11, respectively). --- doc/r-plugin.txt | 14 +++-- make_dist.sh | 3 +- r-plugin/common_global.vim | 120 +++++++++++++++++++------------------ r-plugin/screenrc | 3 +- r-plugin/screenrc.xterm | 9 +++ 5 files changed, 83 insertions(+), 66 deletions(-) create mode 100644 r-plugin/screenrc.xterm diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 09161b3..8136dba 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -5,7 +5,7 @@ Authors: Jakson A. Aquino Jose Claudio Faria -Version: 111006 +Version: 111007 For Vim version 7.3 1. Overview |r-plugin-overview| @@ -113,7 +113,7 @@ sections 3.3 and 3.4. In addition to having R installed in your system, this plugin requires users to install: - Tmux (>= 1.5): http://tmux.sourceforge.net + Tmux (>= 1.4): http://tmux.sourceforge.net GNU Screen: http://www.gnu.org/s/screen screen.vim plugin: http://www.vim.org/scripts/script.php?script_id=2711 ncurses-term: http://invisible-island.net/ncurses @@ -1274,6 +1274,7 @@ directory after the installation: r-plugin/vimSweave.R r-plugin/r.snippets r-plugin/screenrc + r-plugin/screenrc.xterm r-plugin/specialfuns.R r-plugin/tex_indent.vim r-plugin/tmux.conf @@ -1739,15 +1740,16 @@ the R syntax highlighted. 12. News~ *r-plugin-news* + * Fixed spell check bug in R documentation files (.Rd). + * Fixed beep bug when sending commands to R. * New option: vimrplugin_notmuxconf. * Fixed bug when starting tmux before vim: the environment variable VIMRPLUGIN_TMPDIR was not being set. Thanks to Michel Lang for reporting the bug and helping to track its source, and thanks to Eric Dewoestine for explaining how to fix the bug. - * Fixed bug in code indentation after unbalanced brackets when - r_indent_align_args = 0 (thanks to Chris Neff for reporting the bug). - * Fixed bug in code indentation after unbalanced parenthesis when - r_indent_align_args = 0 (thanks to Peng Yu for reporting the bug). + * Fixed bug in code indentation after unbalanced brackets and parenthesis + when r_indent_align_args = 0 (thanks to Chris Neff and Peng Yu for + reporting the bugs). * Really make the use of AppleScript the default on OS X (thanks for Jason for reporting the bug). diff --git a/make_dist.sh b/make_dist.sh index 3249cb3..7cf0e1a 100755 --- a/make_dist.sh +++ b/make_dist.sh @@ -50,7 +50,7 @@ tar -cvzf /tmp/vimrplugintmpfile.tar.gz ftdetect/r.vim indent/r.vim \ r-plugin/global_r_plugin.vim r-plugin/omniList r-plugin/windows.py \ r-plugin/vimActivate.js r-plugin/tex_indent.vim r-plugin/r.snippets \ r-plugin/common_buffer.vim r-plugin/common_global.vim \ - r-plugin/tmux.conf r-plugin/screenrc \ + r-plugin/tmux.conf r-plugin/screenrc r-plugin/screenrc.xterm \ bitmaps/ricon.xbm bitmaps/ricon.png \ bitmaps/RStart.png bitmaps/RStart.bmp \ bitmaps/RClose.png bitmaps/RClose.bmp \ @@ -126,6 +126,7 @@ files: - r-plugin/tex_indent.vim - r-plugin/tmux.conf - r-plugin/screenrc +- r-plugin/screenrc.xterm - r-plugin/vimbrowser.R - r-plugin/vimhelp.R - r-plugin/vimprint.R diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 2a17ecc..97ce77a 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -17,7 +17,7 @@ " " Based on previous work by Johannes Ranke " -" Last Change: Fri Oct 07, 2011 10:40AM +" Last Change: Fri Oct 07, 2011 09:14PM " " Purposes of this file: Create all functions and commands and Set the " value of all global variables and some buffer variables.for r, @@ -49,14 +49,14 @@ endfunction function RWarningMsgInp(wmsg) let savelz = &lazyredraw - set lazyredraw + if savelz == 0 + set lazyredraw + endif echohl WarningMsg echomsg a:wmsg echohl Normal call input("[Press to continue] ") - if savelz - set lazyredraw - else + if savelz == 0 set nolazyredraw endif endfunction @@ -2015,6 +2015,21 @@ command RBuildTags :call SendCmdToR('rtags(ofile = "TAGS")') " rplugin_ for internal parameters "========================================================================== +" g:rplugin_home should be the directory where the r-plugin files are. For +" users following the installation instructions it will be at ~/.vim or +" ~/vimfiles, that is, the same value of g:rplugin_uservimfiles. However the +" variables will have different values if the plugin is installed somewhere +" else in the runtimepath. +let g:rplugin_home = expand(":h:h") + +" g:rplugin_uservimfiles must be a writable directory. It will be g:rplugin_home +" unless it's not writable. Then it wil be ~/.vim or ~/vimfiles. +if filewritable(g:rplugin_home) == 2 + let g:rplugin_uservimfiles = g:rplugin_home +else + let g:rplugin_uservimfiles = split(&runtimepath, ",")[0] +endif + " Variables whose default value is fixed call RSetDefaultValue("g:vimrplugin_map_r", 0) call RSetDefaultValue("g:vimrplugin_open_df", 1) @@ -2055,6 +2070,12 @@ else call RSetDefaultValue("g:vimrplugin_screenplugin", 0) endif +" The screen.vim plugin only works on terminal emulators +if has('gui_running') + let g:vimrplugin_screenplugin = 0 + let g:vimrplugin_tmux = 0 +endif + if has("gui_win32") call RSetDefaultValue("g:vimrplugin_conquesleep", 200) let vimrplugin_screenplugin = 0 @@ -2063,51 +2084,55 @@ else endif if g:vimrplugin_screenplugin - if has("gui_running") - let g:vimrplugin_tmux = 0 - let g:vimrplugin_screenplugin = 0 + if !exists("g:ScreenVersion") + call RWarningMsgInp("Please, either install the screen plugin (http://www.vim.org/scripts/script.php?script_id=2711) (recommended) or put 'let vimrplugin_screenplugin = 0' in your vimrc.") + let g:rplugin_failed = 1 + finish else - if !exists("g:vimrplugin_tmux") - if executable('tmux') - let g:vimrplugin_tmux = 1 - let rplugin_missing_tmux = 0 - else - let g:vimrplugin_tmux = 0 - let rplugin_missing_tmux = 1 - endif - endif - if !exists("g:ScreenVersion") - call RWarningMsgInp("Please, either install the screen plugin (http://www.vim.org/scripts/script.php?script_id=2711) (recommended) or put 'let vimrplugin_screenplugin = 0' in your vimrc.") + if g:ScreenVersion < "1.5" + call RWarningMsgInp("Vim-R-plugin requires Screen plugin >= 1.5") let g:rplugin_failed = 1 finish + endif + endif + if !exists("g:vimrplugin_tmux") + if executable('tmux') + let g:vimrplugin_tmux = 1 + let rplugin_missing_tmux = 0 else - if g:ScreenVersion < "1.5" - call RWarningMsgInp("Vim-R-plugin requires Screen plugin >= 1.5") - let g:rplugin_failed = 1 - finish + let g:vimrplugin_tmux = 0 + let rplugin_missing_tmux = 1 + endif + endif + + " To get 256 colors you have to set the $TERM environment variable to + " xterm-256color. See :h r-plugin-tips + if g:vimrplugin_tmux + let g:ScreenImpl = 'Tmux' + if g:ScreenShellTmuxInitArgs == "" + if $DISPLAY != "" || $TERM =~ "xterm" + let g:ScreenShellTmuxInitArgs = "-2" + endif + if g:vimrplugin_notmuxconf == 0 + let g:ScreenShellTmuxInitArgs = g:ScreenShellTmuxInitArgs . " -f " . rplugin_home . "/r-plugin/tmux.conf" + endif + endif + else + let g:ScreenImpl = 'GnuScreen' + if g:vimrplugin_noscreenrc == 0 && exists("g:ScreenShellScreenInitArgs") && g:ScreenShellScreenInitArgs == "" + if $DISPLAY != "" || $TERM =~ "xterm" + let g:ScreenShellScreenInitArgs = " -c " . g:rplugin_home . "/r-plugin/screenrc.xterm " + else + let g:ScreenShellScreenInitArgs = " -c " . g:rplugin_home . "/r-plugin/screenrc " endif endif endif + else let g:vimrplugin_tmux = 0 endif -" g:rplugin_home should be the directory where the r-plugin files are. For -" users following the installation instructions it will be at ~/.vim or -" ~/vimfiles, that is, the same value of g:rplugin_uservimfiles. However the -" variables will have different values if the plugin is installed somewhere -" else in the runtimepath. -let g:rplugin_home = expand(":h:h") - -" g:rplugin_uservimfiles must be a writable directory. It will be g:rplugin_home -" unless it's not writable. Then it wil be ~/.vim or ~/vimfiles. -if filewritable(g:rplugin_home) == 2 - let g:rplugin_uservimfiles = g:rplugin_home -else - let g:rplugin_uservimfiles = split(&runtimepath, ",")[0] -endif - " Start with an empty list of objects in the workspace let g:rplugin_globalenvlines = [] @@ -2225,25 +2250,6 @@ endif let g:rplugin_docfile = $VIMRPLUGIN_TMPDIR . "/Rdoc" let g:rplugin_globalenvfname = $VIMRPLUGIN_TMPDIR . "/GlobalEnvList" -if g:vimrplugin_tmux - let g:ScreenImpl = 'Tmux' - if g:ScreenShellTmuxInitArgs == "" - if $DISPLAY != "" - let g:ScreenShellTmuxInitArgs = "-2" - endif - if g:vimrplugin_notmuxconf == 0 - let g:ScreenShellTmuxInitArgs = g:ScreenShellTmuxInitArgs . " -f " . rplugin_home . "/r-plugin/tmux.conf" - endif - endif -else - let g:ScreenImpl = 'GnuScreen' -endif - -" The screen.vim plugin only works on terminal emulators -if !exists("g:vimrplugin_screenplugin") || has('gui_running') - let g:vimrplugin_screenplugin = 0 -endif - if g:vimrplugin_conqueplugin == 1 if !exists("g:ConqueTerm_Version") || (exists("g:ConqueTerm_Version") && g:ConqueTerm_Version < 230) let g:vimrplugin_conqueplugin = 0 diff --git a/r-plugin/screenrc b/r-plugin/screenrc index 19e311b..2a725d1 100644 --- a/r-plugin/screenrc +++ b/r-plugin/screenrc @@ -1,8 +1,7 @@ msgwait 0 -termcapinfo xterm* 'ti@:te@' vbell off -term screen-256color startup_message off bind a resize +1 bind z resize -1 +termcapinfo xterm* 'ti@:te@' diff --git a/r-plugin/screenrc.xterm b/r-plugin/screenrc.xterm new file mode 100644 index 0000000..86563e2 --- /dev/null +++ b/r-plugin/screenrc.xterm @@ -0,0 +1,9 @@ +msgwait 0 +vbell off +startup_message off +bind a resize +1 +bind z resize -1 +termcapinfo xterm* 'ti@:te@' +terminfo rxvt-unicode 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm' +term screen-256color + From 197567ad3264169e4032899ccab5e6fcaff80977 Mon Sep 17 00:00:00 2001 From: Jakson Date: Sun, 9 Oct 2011 14:20:23 -0300 Subject: [PATCH 0052/1050] Fix condition bug (| instead of ||). --- r-plugin/common_global.vim | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 97ce77a..d9951ce 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -17,7 +17,7 @@ " " Based on previous work by Johannes Ranke " -" Last Change: Fri Oct 07, 2011 09:14PM +" Last Change: Sun Oct 09, 2011 02:19PM " " Purposes of this file: Create all functions and commands and Set the " value of all global variables and some buffer variables.for r, @@ -1816,7 +1816,7 @@ function MakeRMenu() amenu R.Help\ (plugin).Options.Screen\ configuration :help vimrplugin_noscreenrc amenu R.Help\ (plugin).Options.Screen\ plugin :help vimrplugin_screenplugin endif - if has("gui_macvim") | has("gui_mac") | has("mac") | has("macunix") + if has("gui_macvim") || has("gui_mac") || has("mac") || has("macunix") amenu R.Help\ (plugin).Options.Integration\ with\ Apple\ Script :help vimrplugin_applescript endif if has("gui_win32") @@ -2058,7 +2058,7 @@ call RSetDefaultValue("g:vimrplugin_vimpager", "'vertical'") call RSetDefaultValue("g:vimrplugin_latexcmd", "'pdflatex'") call RSetDefaultValue("g:vimrplugin_objbr_place", "'console,right'") -if has("gui_macvim") | has("gui_mac") | has("mac") | has("macunix") +if has("gui_macvim") || has("gui_mac") || has("mac") || has("macunix") call RSetDefaultValue("g:vimrplugin_applescript", 1) else call RSetDefaultValue("g:vimrplugin_applescript", 0) From f6cce9f9536f66b846742fa98c94786baf0d7c40 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Mon, 10 Oct 2011 23:40:15 -0300 Subject: [PATCH 0053/1050] Improve Tmux and Screen plugin version detection. --- doc/r-plugin.txt | 10 ++++++--- r-plugin/common_global.vim | 44 +++++++++++++++++++++++++++++--------- 2 files changed, 41 insertions(+), 13 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 8136dba..8765467 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -5,7 +5,7 @@ Authors: Jakson A. Aquino Jose Claudio Faria -Version: 111007 +Version: 111010 For Vim version 7.3 1. Overview |r-plugin-overview| @@ -113,7 +113,7 @@ sections 3.3 and 3.4. In addition to having R installed in your system, this plugin requires users to install: - Tmux (>= 1.4): http://tmux.sourceforge.net + Tmux: http://tmux.sourceforge.net GNU Screen: http://www.gnu.org/s/screen screen.vim plugin: http://www.vim.org/scripts/script.php?script_id=2711 ncurses-term: http://invisible-island.net/ncurses @@ -132,7 +132,7 @@ sets Tmux to work with vi key bindings. Note: The plugin can use different mechanisms to send commands to R. The mechanism that will be used depends on both what applications and plugins you have installed and what options you have in your |vimrc|. The two lists below -show how the plugin will work in different conditions: +show how the plugin will work on Linux in different conditions: Vim Condition ------------------------------ ------------------------------------- @@ -148,6 +148,10 @@ show how the plugin will work in different conditions: Conque Shell vimrplugin_conqueplugin = 1 +Note: On Mac OS X the plugin will use AppleScript in both Vim and GVim unless +vimrplugin_applescript = 0. + + 3.2.2. Windows~ In addition to having R installed in your system, this plugin requires users diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index d9951ce..704a6d1 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -17,7 +17,7 @@ " " Based on previous work by Johannes Ranke " -" Last Change: Sun Oct 09, 2011 02:19PM +" Last Change: Mon Oct 10, 2011 11:30PM " " Purposes of this file: Create all functions and commands and Set the " value of all global variables and some buffer variables.for r, @@ -2067,7 +2067,8 @@ endif if g:vimrplugin_applescript == 0 call RSetDefaultValue("g:vimrplugin_screenplugin", 1) else - call RSetDefaultValue("g:vimrplugin_screenplugin", 0) + let g:vimrplugin_screenplugin = 0 + let g:vimrplugin_conqueplugin = 0 endif " The screen.vim plugin only works on terminal emulators @@ -2084,24 +2085,17 @@ else endif if g:vimrplugin_screenplugin + let g:vimrplugin_conqueplugin = 0 if !exists("g:ScreenVersion") call RWarningMsgInp("Please, either install the screen plugin (http://www.vim.org/scripts/script.php?script_id=2711) (recommended) or put 'let vimrplugin_screenplugin = 0' in your vimrc.") let g:rplugin_failed = 1 finish - else - if g:ScreenVersion < "1.5" - call RWarningMsgInp("Vim-R-plugin requires Screen plugin >= 1.5") - let g:rplugin_failed = 1 - finish - endif endif if !exists("g:vimrplugin_tmux") if executable('tmux') let g:vimrplugin_tmux = 1 - let rplugin_missing_tmux = 0 else let g:vimrplugin_tmux = 0 - let rplugin_missing_tmux = 1 endif endif @@ -2132,6 +2126,26 @@ else let g:vimrplugin_tmux = 0 endif +if g:vimrplugin_screenplugin + " Future: Remove this Tmux version test on 2014 + if g:vimrplugin_tmux + let s:xx = system("tmux -V") + let s:xx = substitute(s:xx, '.*tmux \([0-9]\.[0-9]\).*', '\1', '') + if strlen(s:xx) > 6 && g:ScreenVersion > "1.4" + call RWarningMsgInp("Tmux <= 1.3 requires Screen plugin <= 1.4. You should either upgrade Tmux or downgrade the Screen plugin.") + endif + if strlen(s:xx) < 7 && g:ScreenVersion < "1.5" + call RWarningMsgInp("Vim-R-plugin requires Screen plugin >= 1.5") + let g:rplugin_failed = 1 + finish + endif + unlet s:xx + elseif g:ScreenVersion < "1.5" + call RWarningMsgInp("Vim-R-plugin requires Screen plugin >= 1.5") + let g:rplugin_failed = 1 + finish + endif +endif " Start with an empty list of objects in the workspace let g:rplugin_globalenvlines = [] @@ -2382,3 +2396,13 @@ if exists("g:vimrplugin_term_cmd") let g:rplugin_termcmd = g:vimrplugin_term_cmd endif +" Debugging code: +if g:vimrplugin_screenplugin && g:vimrplugin_conqueplugin + echoerr "Error number 1" +endif +if g:vimrplugin_screenplugin && g:vimrplugin_applescript + echoerr "Error number 2" +endif +if g:vimrplugin_conqueplugin && g:vimrplugin_applescript + echoerr "Error number 3" +endif From 0dfb4d10b971ca723b628b1e74c6554133beb184 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Tue, 11 Oct 2011 09:54:30 -0300 Subject: [PATCH 0054/1050] Move upward the info on screenvsplit. --- doc/r-plugin.txt | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 8765467..bb5fe1c 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -1051,6 +1051,16 @@ If you want to use your own ~/.tmux.conf, put in your vimrc: *vimrplugin_screenplugin* *vimrplugin_screenvsplit* *vimrplugin_tmux* +The screen.vim plugin supports both screen and Tmux, but only Tmux allows you +to split the terminal vertically (that is, to have the panels side by side). +Please read |screen-intro| and |screen-shell-vertical| for details. By +default, the Vim-R-plugin will tell the screen.vim plugin to split the +terminal horizontally. If you prefer to split it vertically put in your +|vimrc|: +> + let vimrplugin_screenvsplit = 1 + let g:ScreenImpl = 'Tmux' +< By default, when running in a terminal emulator, the Vim-R-plugin uses the screen.vim plugin if it is installed and, by default, it will use Tmux instead of GNU Screen. Tmux was chosen as default because it may be split vertically @@ -1073,16 +1083,6 @@ with the Vim-R-plugin you will need to add the following to your |vimrc|: > let vimrplugin_screenplugin = 0 < -The screen.vim plugin supports both screen and Tmux, but only Tmux allows you -to split the terminal vertically (that is, to have the panels side by side). -Please read |screen-intro| and |screen-shell-vertical| for details. By -default, the Vim-R-plugin will tell the screen.vim plugin to split the -terminal horizontally. If you prefer to split it vertically put in your -|vimrc|: -> - let vimrplugin_screenvsplit = 1 - let g:ScreenImpl = 'Tmux' -< 7.17. Integration with AppleScript (OS X only)~ *vimrplugin_applescript* From 6faedbba4c06e5e890eafacb9055f4e6949361ae Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Wed, 12 Oct 2011 09:56:42 -0300 Subject: [PATCH 0055/1050] More specific path test. --- r-plugin/windows.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/r-plugin/windows.py b/r-plugin/windows.py index e2a3a01..46b4934 100644 --- a/r-plugin/windows.py +++ b/r-plugin/windows.py @@ -115,7 +115,7 @@ def StartRPy(): else: vim.command("RWarningMsg('Personal folder not found in registry')") - if os.path.exists(rpath): + if os.path.isfile(rpath): os.spawnv(os.P_NOWAIT, rpath, rargs) else: vim.command("echoerr 'File ' . g:rplugin_Rgui . ' not found.'") From abe8ed4f96df0ca1ea09c5fcf01e6da8bc0a9845 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Wed, 12 Oct 2011 11:15:06 -0300 Subject: [PATCH 0056/1050] Improve missing PyWin32 warning. --- r-plugin/windows.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/r-plugin/windows.py b/r-plugin/windows.py index 46b4934..30a9a9c 100644 --- a/r-plugin/windows.py +++ b/r-plugin/windows.py @@ -10,11 +10,10 @@ import win32com.client import win32con except ImportError: - vim.command("call RWarningMsg('Did you install PyWin32?')") import platform myPyVersion = platform.python_version() myArch = platform.architecture() - vim.command("call RWarningMsg('The Python version being used is: " + myPyVersion + " (" + myArch[0] + ")')") + vim.command("call RWarningMsgInp('Did you install PyWin32? The Python version being used is: " + myPyVersion + " (" + myArch[0] + ")')") def SendToRPy(aString): From 98a8cee1c118b760dff8428043b4479beed3b052 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Wed, 12 Oct 2011 12:59:41 -0300 Subject: [PATCH 0057/1050] Finish the plugin if PyWin32 is not installed. --- r-plugin/common_global.vim | 7 ++++++- r-plugin/windows.py | 3 ++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 704a6d1..647703d 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -17,7 +17,7 @@ " " Based on previous work by Johannes Ranke " -" Last Change: Mon Oct 10, 2011 11:30PM +" Last Change: Wed Oct 12, 2011 12:57PM " " Purposes of this file: Create all functions and commands and Set the " value of all global variables and some buffer variables.for r, @@ -2185,7 +2185,12 @@ if has("gui_win32") let g:rplugin_failed = 1 finish endif + let rplugin_pywin32 = 1 exe s:py . "file " . substitute(g:rplugin_home, " ", '\ ', "g") . '\r-plugin\windows.py' + if rplugin_pywin32 == 0 + let g:rplugin_failed = 1 + finish + endif let g:rplugin_jspath = g:rplugin_home . "\\r-plugin\\vimActivate.js" let g:rplugin_home = substitute(g:rplugin_home, "\\", "/", "g") let g:rplugin_uservimfiles = substitute(g:rplugin_uservimfiles, "\\", "/", "g") diff --git a/r-plugin/windows.py b/r-plugin/windows.py index 30a9a9c..6afbd9d 100644 --- a/r-plugin/windows.py +++ b/r-plugin/windows.py @@ -13,7 +13,8 @@ import platform myPyVersion = platform.python_version() myArch = platform.architecture() - vim.command("call RWarningMsgInp('Did you install PyWin32? The Python version being used is: " + myPyVersion + " (" + myArch[0] + ")')") + vim.command("call RWarningMsgInp('Please install PyWin32. The Python version being used is: " + myPyVersion + " (" + myArch[0] + ")')") + vim.command("let rplugin_pywin32 = 0") def SendToRPy(aString): From 0ca8f731f937dbb2c5097bf33e65920a70dec99a Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Wed, 12 Oct 2011 17:32:42 -0300 Subject: [PATCH 0058/1050] More help for correct Python installation. --- r-plugin/common_global.vim | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 647703d..8a4e47a 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -17,7 +17,7 @@ " " Based on previous work by Johannes Ranke " -" Last Change: Wed Oct 12, 2011 12:57PM +" Last Change: Wed Oct 12, 2011 05:32PM " " Purposes of this file: Create all functions and commands and Set the " value of all global variables and some buffer variables.for r, @@ -2181,7 +2181,29 @@ if has("gui_win32") endif if s:py == "" - call RWarningMsgInp("Python interface must be enabled to run Vim-R-Plugin. Please do ':h r-plugin-installation' for details.") + redir => s:vimversion + silent version + redir END + let s:haspy2 = stridx(s:vimversion, '+python ') + if s:haspy2 < 0 + let s:haspy2 = stridx(s:vimversion, '+python/dyn') + endif + let s:haspy3 = stridx(s:vimversion, '+python3') + if s:haspy2 || s:haspy3 + let s:pyver = "" + if s:haspy2 && s:haspy3 + let s:pyver = " (" . substitute(s:vimversion, '.*\(python2.\.dll\).*', '\1', '') . ", " + let s:pyver = s:pyver . substitute(s:vimversion, '.*\(python3.\.dll\).*', '\1', '') . ")" + elseif s:haspy3 && s:haspy2 < 0 + let s:pyver = " (" . substitute(s:vimversion, '.*\(python3.\.dll\).*', '\1', '') . ")" + elseif s:haspy2 && s:haspy3 < 0 + let s:pyver = " (" . substitute(s:vimversion, '.*\(python2.\.dll\).*', '\1', '') . ")" + endif + let s:xx = substitute(s:vimversion, '.*\([0-9][0-9]-bit\).*', '\1', "") + call RWarningMsgInp("This version of Vim was compiled against Python" . s:pyver . ", but Python was not found. Please, install " . s:xx . " Python from www.python.org.") + else + call RWarningMsgInp("This version of Vim was not compiled with Python support.") + endif let g:rplugin_failed = 1 finish endif From e8555c66147c988d829d8ace92daa13af571f87b Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Wed, 12 Oct 2011 18:26:41 -0300 Subject: [PATCH 0059/1050] Fix conditions. --- r-plugin/common_global.vim | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 8a4e47a..6e63d01 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -17,7 +17,7 @@ " " Based on previous work by Johannes Ranke " -" Last Change: Wed Oct 12, 2011 05:32PM +" Last Change: Wed Oct 12, 2011 06:25PM " " Purposes of this file: Create all functions and commands and Set the " value of all global variables and some buffer variables.for r, @@ -2189,14 +2189,14 @@ if has("gui_win32") let s:haspy2 = stridx(s:vimversion, '+python/dyn') endif let s:haspy3 = stridx(s:vimversion, '+python3') - if s:haspy2 || s:haspy3 + if s:haspy2 > 0 || s:haspy3 > 0 let s:pyver = "" - if s:haspy2 && s:haspy3 + if s:haspy2 > 0 && s:haspy3 > 0 let s:pyver = " (" . substitute(s:vimversion, '.*\(python2.\.dll\).*', '\1', '') . ", " let s:pyver = s:pyver . substitute(s:vimversion, '.*\(python3.\.dll\).*', '\1', '') . ")" - elseif s:haspy3 && s:haspy2 < 0 + elseif s:haspy3 > 0 && s:haspy2 < 0 let s:pyver = " (" . substitute(s:vimversion, '.*\(python3.\.dll\).*', '\1', '') . ")" - elseif s:haspy2 && s:haspy3 < 0 + elseif s:haspy2 > 0 && s:haspy3 < 0 let s:pyver = " (" . substitute(s:vimversion, '.*\(python2.\.dll\).*', '\1', '') . ")" endif let s:xx = substitute(s:vimversion, '.*\([0-9][0-9]-bit\).*', '\1', "") From e306e189fa741b24e005db4cde74afb1ee58a41b Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Wed, 12 Oct 2011 23:30:24 -0300 Subject: [PATCH 0060/1050] Increase the chances that messages will be read. --- r-plugin/common_global.vim | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 6e63d01..e625baa 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -17,7 +17,7 @@ " " Based on previous work by Johannes Ranke " -" Last Change: Wed Oct 12, 2011 06:25PM +" Last Change: Wed Oct 12, 2011 11:21PM " " Purposes of this file: Create all functions and commands and Set the " value of all global variables and some buffer variables.for r, @@ -48,17 +48,24 @@ function RWarningMsg(wmsg) endfunction function RWarningMsgInp(wmsg) - let savelz = &lazyredraw - if savelz == 0 + let savedlz = &lazyredraw + if savedlz == 0 set lazyredraw endif + let savedsm = &shortmess + set shortmess-=T echohl WarningMsg echomsg a:wmsg echohl Normal + " The message disappears if starting to edit an empty buffer + if line("$") == 1 && strlen(getline("$")) == 0 + sleep 2 + endif call input("[Press to continue] ") - if savelz == 0 + if savedlz == 0 set nolazyredraw endif + let &shortmess = savedsm endfunction " Set default value of some variables: From 9e71ca63312f7cdbb14a70057d5ec3cab6d46358 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 13 Oct 2011 12:00:09 -0300 Subject: [PATCH 0061/1050] Use script dir as R working dir (Conque Shell). --- r-plugin/common_global.vim | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index e625baa..6a44046 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -17,7 +17,7 @@ " " Based on previous work by Johannes Ranke " -" Last Change: Wed Oct 12, 2011 11:21PM +" Last Change: Thu Oct 13, 2011 11:57AM " " Purposes of this file: Create all functions and commands and Set the " value of all global variables and some buffer variables.for r, @@ -436,6 +436,8 @@ function StartR(whatr) endif let savesb = &switchbuf + let savewd = &autochdir + set noautochdir set switchbuf=useopen,usetab if g:vimrplugin_conquevsplit == 1 let l:sr = &splitright @@ -478,6 +480,11 @@ function StartR(whatr) exe "setlocal syntax=rout" exe "sil noautocmd sb " . g:rplugin_curbuf exe "set switchbuf=" . savesb + if savewd + set autochdir + else + set noautochdir + endif else if g:vimrplugin_noscreenrc == 1 let scrrc = " " From 7ed4a8c45804f6c335d47b18cfebda10122d8f0c Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Fri, 14 Oct 2011 12:57:39 -0300 Subject: [PATCH 0062/1050] Don't send ^A^K to Conque Term. --- r-plugin/common_global.vim | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 6a44046..bd30ac5 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -17,7 +17,7 @@ " " Based on previous work by Johannes Ranke " -" Last Change: Thu Oct 13, 2011 11:57AM +" Last Change: Fri Oct 14, 2011 12:56PM " " Purposes of this file: Create all functions and commands and Set the " value of all global variables and some buffer variables.for r, @@ -649,8 +649,13 @@ function SendCmdToR(cmd) " ^K (\013) cleans from cursor to the right and ^U (\025) cleans from " cursor to the left. However, ^U causes a beep if there is nothing to " clean. The solution is to use ^A (\001) to move the cursor to the - " beginning of the line before sending ^K. - let cmd = "\001" . "\013" . a:cmd + " beginning of the line before sending ^K. But the control characters may + " cause Conque to show the output incompletely. + if vimrplugin_conqueplugin + let cmd = a:cmd + else + let cmd = "\001" . "\013" . a:cmd + endif if has("gui_win32") && g:vimrplugin_conqueplugin == 0 let cmd = cmd . "\n" From 15e33c6167d7877eb4093722918b4ea2b77bb63c Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Fri, 14 Oct 2011 12:59:38 -0300 Subject: [PATCH 0063/1050] Update (version 111014). --- doc/r-plugin.txt | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index bb5fe1c..2ca3b0e 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -5,7 +5,7 @@ Authors: Jakson A. Aquino Jose Claudio Faria -Version: 111010 +Version: 111014 For Vim version 7.3 1. Overview |r-plugin-overview| @@ -46,7 +46,7 @@ to deal with. ============================================================================== 2. Main features~ *r-plugin-features* - * Syntax highlighting for R syntax, including: + * Syntax highlighting for R code, including: - Special characters in strings. - Functions of all installed packages (must be updated manually). - Special highlighting for R output (.Rout files). @@ -106,14 +106,14 @@ are in the same directory): > :helptags ~/.vim/doc < -Note: If you are using OS X and prefer that Vim uses AppleScript to send +Note: If you are using Mac OS X and prefer that Vim uses AppleScript to send commands to R, then the installation is finished and you should now read sections 3.3 and 3.4. In addition to having R installed in your system, this plugin requires users to install: - Tmux: http://tmux.sourceforge.net + Tmux >= 1.3: http://tmux.sourceforge.net GNU Screen: http://www.gnu.org/s/screen screen.vim plugin: http://www.vim.org/scripts/script.php?script_id=2711 ncurses-term: http://invisible-island.net/ncurses @@ -155,7 +155,7 @@ vimrplugin_applescript = 0. 3.2.2. Windows~ In addition to having R installed in your system, this plugin requires users -to install several external dependencies: +to install external dependencies: * Vim's version must be >= 7.3 @@ -167,8 +167,10 @@ to install several external dependencies: Note: Be careful to download the correct Python version because Vim needs a specific version of Python DLL. For example, the official - Vim 7.3 for Windows needs either Python 2.7 or 3.1. To discover - what Python version Vim was compiled against, do the following: + Vim 7.3 for Windows needs either Python 2.7 or 3.1. If Python was + not installed or was not found, the Vim-R-plugin will output + information about what Python version Vim was compiled against. Do + the following if you want to discover this information manually: 1. Type :version in Vim (normal mode). @@ -211,7 +213,7 @@ the key bindings will not be active while editing either unnamed files or files with name extensions other than .R or .Rnw. If the plugin is active, pressing rf should start R (the is '\' by default). -Look at the ~/.vim (Linux, Unix, Os X) or ~/vimfiles (Windows) directory. Is +Look at the ~/.vim (Linux, Unix, OS X) or ~/vimfiles (Windows) directory. Is there a subdirectory named "r-plugin"? If not, then you unpacked the plugin in the wrong place. @@ -1744,6 +1746,7 @@ the R syntax highlighted. 12. News~ *r-plugin-news* +111014 (2011-10-14) * Fixed spell check bug in R documentation files (.Rd). * Fixed beep bug when sending commands to R. * New option: vimrplugin_notmuxconf. From ea802248d88807e82cd568323bcd3b90b8bd3a39 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Fri, 14 Oct 2011 19:46:40 -0300 Subject: [PATCH 0064/1050] Fix bug in function that sends commands to R. --- r-plugin/common_global.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index bd30ac5..e2f1a37 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -17,7 +17,7 @@ " " Based on previous work by Johannes Ranke " -" Last Change: Fri Oct 14, 2011 12:56PM +" Last Change: Fri Oct 14, 2011 07:40PM " " Purposes of this file: Create all functions and commands and Set the " value of all global variables and some buffer variables.for r, @@ -651,7 +651,7 @@ function SendCmdToR(cmd) " clean. The solution is to use ^A (\001) to move the cursor to the " beginning of the line before sending ^K. But the control characters may " cause Conque to show the output incompletely. - if vimrplugin_conqueplugin + if g:vimrplugin_conqueplugin let cmd = a:cmd else let cmd = "\001" . "\013" . a:cmd From 5040aac8c20902ad2a6b0182c4a19f789ccafc56 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Wed, 2 Nov 2011 15:39:13 -0300 Subject: [PATCH 0065/1050] Set the value of rplugin_r64app before starting R. --- r-plugin/common_global.vim | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index e2f1a37..a14f289 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -17,7 +17,7 @@ " " Based on previous work by Johannes Ranke " -" Last Change: Fri Oct 14, 2011 07:40PM +" Last Change: Tue Nov 01, 2011 11:04PM " " Purposes of this file: Create all functions and commands and Set the " value of all global variables and some buffer variables.for r, @@ -371,11 +371,6 @@ function StartR(whatr) endif if g:vimrplugin_applescript && g:vimrplugin_screenplugin == 0 && g:vimrplugin_conqueplugin == 0 - if isdirectory("/Applications/R64.app") - let g:rplugin_r64app = 1 - else - let g:rplugin_r64app = 0 - endif if g:rplugin_r64app && g:vimrplugin_i386 == 0 let rcmd = "/Applications/R64.app" else @@ -2088,6 +2083,11 @@ if g:vimrplugin_applescript == 0 else let g:vimrplugin_screenplugin = 0 let g:vimrplugin_conqueplugin = 0 + if isdirectory("/Applications/R64.app") + let g:rplugin_r64app = 1 + else + let g:rplugin_r64app = 0 + endif endif " The screen.vim plugin only works on terminal emulators From 0bd62f975e1274294025103e0535cfd62a5f6104 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Fri, 4 Nov 2011 08:45:13 -0300 Subject: [PATCH 0066/1050] Remove no support to spell checking remark. --- syntax/rhelp.vim | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/syntax/rhelp.vim b/syntax/rhelp.vim index d26a403..03c85f8 100644 --- a/syntax/rhelp.vim +++ b/syntax/rhelp.vim @@ -2,9 +2,7 @@ " Language: R Help File " Maintainer: Jakson Aquino " Former Maintainer: Johannes Ranke -" Last Change: Fri Oct 07, 2011 08:37AM -" Version: 0.7.4 -" SVN: $Id: rhelp.vim 90 2010-11-22 10:58:11Z ranke $ +" Last Change: Wed Nov 02, 2011 03:47PM " Remarks: - Includes R syntax highlighting in the appropriate " sections if an r.vim file is in the same directory or in the " default debian location. @@ -13,7 +11,6 @@ " - No support for \if, \ifelse and \out as I don't understand " them and have no examples at hand (help welcome). " - No support for \var tag within quoted string (dito) -" - No support for spell checking. " Version Clears: {{{1 " For version 5.x: Clear all syntax items From fb0fb8a3178108c8e2088f9ea9593ec278c13e1b Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Fri, 4 Nov 2011 09:29:50 -0300 Subject: [PATCH 0067/1050] Add function SendChunkToR() and its key bindings. --- doc/r-plugin.txt | 65 ++++++++++++++++++++++---------------- ftplugin/rnoweb.vim | 25 ++++++++++++++- r-plugin/common_global.vim | 46 ++++++++++++++++----------- 3 files changed, 89 insertions(+), 47 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 2ca3b0e..9b4e599 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -5,7 +5,7 @@ Authors: Jakson A. Aquino Jose Claudio Faria -Version: 111014 +Version: 111104 For Vim version 7.3 1. Overview |r-plugin-overview| @@ -289,6 +289,11 @@ Send . Block (cur, down) \bd . Block (cur, echo and down) \ba -------------------------------------------------------- + . Chunk (cur) \cc + . Chunk (cur, echo) \ce + . Chunk (cur, down) \cd + . Chunk (cur, echo and down) \ca + -------------------------------------------------------- . Function (cur) \ff . Function (cur, echo) \fe . Function (cur and down) \fd @@ -342,7 +347,7 @@ Edit . Indent (selected lines) = . Indent (whole buffer) gg=G -------------------------------------------------------- - . Comment/Uncomment (line, sel) \cc + . Comment/Uncomment (line, sel) \xx . Add/Align right comment (line, sel) \; -------------------------------------------------------- . Go (next R chunk) gn @@ -487,7 +492,7 @@ classify the objects: 4.5. Commenting and uncommenting lines~ You can toogle the state of a line as either commented or uncommented by -typing cc. +typing xx. You can also add comments to the right of a line with the ; shortcut. By default, the comment starts at the 40th column, which can be @@ -557,11 +562,11 @@ you have to type a. You can also set a different escape character in your With Tmux, you can the detach the Vim-R session and reattach it latter. This is useful if you plan to begin the use the Vim-R-plugin in a machine and -latter move to another another computer. However, normally you will get -|E325|, caused by the presence of a 'swapfile' (please, read the screen.vim -plugin documentation, especially the section |screen-gotchas| for details). -This problem will not happen if you start Vim from within a Tmux session, as -in the example below. +latter move to another computer. However, normally you will get |E325|, caused +by the presence of a 'swapfile' (please, read the screen.vim plugin +documentation, especially the section |screen-gotchas| for details). This +problem will not happen if you start Vim from within a Tmux session, as in the +example below. A sample detachable session could be: @@ -776,7 +781,7 @@ duplicated to R on Mac OS X. |vimrplugin_buildwait| Time to wait for :RUpdateObjList to finish |vimrplugin_routmorecolors| More syntax highlighting in R output |vimrplugin_routnotab| Show output of R CMD BATCH in new window -|vimrplugin_indent_commented| Indent lines commented with the \cc command +|vimrplugin_indent_commented| Indent lines commented with the \xx command |vimrplugin_sleeptime| Delay while sending commands in MS Windows |vimrplugin_noscreenrc| Do not write custom screenrc |vimrplugin_screenplugin| Use the screen.vim plugin @@ -890,11 +895,11 @@ document. The valid values of vimrplugin_vimpager are: - "horizontal": Split the window horizontally. "vertical" : Split the window vertically if the editor width is large enough; otherwise, split the window horizontally and attempt to set the window height to at least 20 lines. This is the default. + "horizontal": Split the window horizontally. "tab" : Show the help document in a new tab. If there is already a tab with an R help document, use it. "tabnew" : Show the help document in a new tab. @@ -1008,7 +1013,7 @@ a new split window, put in your |vimrc|: 7.12. Indent commented lines~ *vimrplugin_indent_commented* -You can type \cc (where "\" is the ) to comment out a line or +You can type \xx (where "\" is the ) to comment out a line or selected lines. If the line already starts with a comment string, it will be removed. After adding the comment string, the line will be reindented by default. To turn off the automatic indentation, put in your |vimrc|: @@ -1184,22 +1189,23 @@ Only the custom key bindings for Normal mode are shown in Vim's menu, but you can type |:map| to see the complete list of current mappings, and below is the list of the names for custom key bindings: > - RBibTeX RESendFile RSendFunction - RCommentLine RESendFunction RSendLAndOpenNewOne - RClearAll RESendMBlock RSendLine - RClearConsole RESendParagraph RSendMBlock - RClose RESendSelection RSendParagraph - RCustomStart RHelp RSendSelection - RDSendFunction RListSpace RSetwd - RDSendLine RMakePDF RShowArgs - RDSendMBlock RObjectNames RShowEx - RDSendParagraph RObjectPr RShowRout - RDSendSelection RObjectStr RStart - REDSendFunction RPlot RSummary - REDSendMBlock RSPlot RSweave - REDSendParagraph RSaveClose RUpdateObjBrowser - REDSendSelection RSendFile RVanillaStart - + RBibTeX RSendChunk RObjectNames + RClearAll RDSendChunk RObjectPr + RClearConsole RESendChunk RObjectStr + RClose REDSendChunk RPlot + RCommentLine RSendParagraph RSPlot + RCustomStart RDSendParagraph RSaveClose + RSendFunction RESendParagraph RSetwd + RDSendFunction REDSendParagraph RShowArgs + RESendFunction RSendSelection RShowEx + REDSendFunction RDSendSelection RShowRout + RSendLine RESendSelection RStart + RDSendLine REDSendSelection RSummary + RSendLAndOpenNewOne RSendFile RSweave + RSendMBlock RESendFile RUpdateObjBrowser + RDSendMBlock RHelp RVanillaStart + RESendMBlock RListSpace + REDSendMBlock RMakePDF < The plugin also contains a function called RAction which allows you to build ad-hoc commands to R. This function takes the name of an R function such as @@ -1746,6 +1752,11 @@ the R syntax highlighted. 12. News~ *r-plugin-news* + * Changed key binding for commenting/uncommenting code from \cc to \xx. + * Added function SendChunkToR() and its corresponding key bindings: + \cc, \ce, \cd and \ca (thanks to Xavier Fernández i Marín for suggesting + the feature). + 111014 (2011-10-14) * Fixed spell check bug in R documentation files (.Rd). * Fixed beep bug when sending commands to R. diff --git a/ftplugin/rnoweb.vim b/ftplugin/rnoweb.vim index 0fdceab..8f8a4a0 100644 --- a/ftplugin/rnoweb.vim +++ b/ftplugin/rnoweb.vim @@ -17,7 +17,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Tue Aug 30, 2011 09:25AM +" Last Change: Fri Nov 04, 2011 08:38AM "========================================================================== " Only do this when not yet done for this buffer @@ -134,6 +134,25 @@ function! RMakePDF(bibtex) echon endfunction +" Send Sweave chunk to R +function SendChunkToR(e, m) + if RnwIsInRCode() == 0 + call RWarningMsg("Not inside an R code chunk.") + return + endif + let chunkline = search("^<<", "bncW") + 1 + let docline = search("^@", "ncW") - 1 + let lines = getline(chunkline, docline) + let ok = RSourceLines(lines, a:e) + if ok == 0 + return + endif + if a:m == "down" + call RnwNextChunk() + endif + echon +endfunction + " Sweave the current buffer content function! RSweave() update @@ -162,6 +181,10 @@ call RCreateMaps("nvi", 'RSweave', 'sw', ':call RSweave()') call RCreateMaps("nvi", 'RMakePDF', 'sp', ':call RMakePDF("nobib")') call RCreateMaps("nvi", 'RBibTeX', 'sb', ':call RMakePDF("bibtex")') call RCreateMaps("nvi", 'RIndent', 'si', ':call RnwToggleIndentSty()') +call RCreateMaps("ni", 'RSendChunk', 'cc', ':call SendChunkToR("silent", "stay")') +call RCreateMaps("ni", 'RESendChunk', 'ce', ':call SendChunkToR("echo", "stay")') +call RCreateMaps("ni", 'RDSendChunk', 'cd', ':call SendChunkToR("silent", "down")') +call RCreateMaps("ni", 'REDSendChunk', 'ca', ':call SendChunkToR("echo", "down")') nmap gn :call RnwNextChunk() nmap gN :call RnwPreviousChunk() diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index a14f289..effd6bb 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -17,7 +17,7 @@ " " Based on previous work by Johannes Ranke " -" Last Change: Tue Nov 01, 2011 11:04PM +" Last Change: Fri Nov 04, 2011 08:41AM " " Purposes of this file: Create all functions and commands and Set the " value of all global variables and some buffer variables.for r, @@ -238,7 +238,7 @@ function MovePosRLineComment(lnum, cpos) let ok = 0 endif if ok == 0 - call RWarningMsg("Not inside a R code chunk.") + call RWarningMsg("Not inside an R code chunk.") return endif endif @@ -252,7 +252,7 @@ function MovePosRLineComment(lnum, cpos) let ok = 0 endif if ok == 0 - call RWarningMsg("Not inside a R code section.") + call RWarningMsg("Not inside an R code section.") return endif endif @@ -802,7 +802,7 @@ endfunction " Function to get the marks which the cursor is between function SendMBlockToR(e, m) if &filetype == "rnoweb" && RnwIsInRCode() == 0 - call RWarningMsg("Not inside a R code chunk.") + call RWarningMsg("Not inside an R code chunk.") return endif if &filetype == "rdoc" && search("^Examples:$", "bncW") == 0 @@ -848,7 +848,7 @@ endfunction function SendFunctionToR(e, m) echon if &filetype == "rnoweb" && RnwIsInRCode() == 0 - call RWarningMsg("Not inside a R code chunk.") + call RWarningMsg("Not inside an R code chunk.") return endif if &filetype == "rdoc" && search("^Examples:$", "bncW") == 0 @@ -911,7 +911,7 @@ endfunction function SendSelectionToR(e, m) echon if &filetype == "rnoweb" && RnwIsInRCode() == 0 - call RWarningMsg("Not inside a R code chunk.") + call RWarningMsg("Not inside an R code chunk.") return endif if &filetype == "rdoc" && search("^Examples:$", "bncW") == 0 @@ -946,7 +946,7 @@ endfunction " Send paragraph to R function SendParagraphToR(e, m) if &filetype == "rnoweb" && RnwIsInRCode() == 0 - call RWarningMsg("Not inside a R code chunk.") + call RWarningMsg("Not inside an R code chunk.") return endif if &filetype == "rdoc" && search("^Examples:$", "bncW") == 0 @@ -1002,7 +1002,7 @@ function SendLineToR(godown) return endif if RnwIsInRCode() == 0 - call RWarningMsg("Not inside a R code chunk.") + call RWarningMsg("Not inside an R code chunk.") return endif endif @@ -1726,25 +1726,33 @@ function MakeRMenu() call RCreateMenuItem("ni", 'Send.Block\ (cur,\ down)', 'RDSendMBlock', 'bd', ':call SendMBlockToR("silent", "down")') call RCreateMenuItem("ni", 'Send.Block\ (cur,\ echo\ and\ down)', 'REDSendMBlock', 'ba', ':call SendMBlockToR("echo", "down")') "------------------------------- - menu R.Send.-Sep2- + if &filetype == "rnoweb" || g:vimrplugin_never_unmake_menu + menu R.Send.-Sep2- + call RCreateMenuItem("ni", 'Send.Chunk\ (cur)', 'RSendChunk', 'cc', ':call SendChunkToR("silent", "stay")') + call RCreateMenuItem("ni", 'Send.Chunk\ (cur,\ echo)', 'RESendChunk', 'ce', ':call SendChunkToR("echo", "stay")') + call RCreateMenuItem("ni", 'Send.Chunk\ (cur,\ down)', 'RDSendChunk', 'cd', ':call SendChunkToR("silent", "down")') + call RCreateMenuItem("ni", 'Send.Chunk\ (cur,\ echo\ and\ down)', 'REDSendChunk', 'ca', ':call SendChunkToR("echo", "down")') + endif + "------------------------------- + menu R.Send.-Sep3- call RCreateMenuItem("ni", 'Send.Function\ (cur)', 'RSendFunction', 'ff', ':call SendFunctionToR("silent", "stay")') call RCreateMenuItem("ni", 'Send.Function\ (cur,\ echo)', 'RESendFunction', 'fe', ':call SendFunctionToR("echo", "stay")') call RCreateMenuItem("ni", 'Send.Function\ (cur\ and\ down)', 'RDSendFunction', 'fd', ':call SendFunctionToR("silent", "down")') call RCreateMenuItem("ni", 'Send.Function\ (cur,\ echo\ and\ down)', 'REDSendFunction', 'fa', ':call SendFunctionToR("echo", "down")') "------------------------------- - menu R.Send.-Sep3- + menu R.Send.-Sep4- call RCreateMenuItem("v", 'Send.Selection', 'RSendSelection', 'ss', ':call SendSelectionToR("silent", "stay")') call RCreateMenuItem("v", 'Send.Selection\ (echo)', 'RESendSelection', 'se', ':call SendSelectionToR("echo", "stay")') call RCreateMenuItem("v", 'Send.Selection\ (and\ down)', 'RDSendSelection', 'sd', ':call SendSelectionToR("silent", "down")') call RCreateMenuItem("v", 'Send.Selection\ (echo\ and\ down)', 'REDSendSelection', 'sa', ':call SendSelectionToR("echo", "down")') "------------------------------- - menu R.Send.-Sep4- + menu R.Send.-Sep5- call RCreateMenuItem("ni", 'Send.Paragraph', 'RSendParagraph', 'pp', ':call SendParagraphToR("silent", "stay")') call RCreateMenuItem("ni", 'Send.Paragraph\ (echo)', 'RESendParagraph', 'pe', ':call SendParagraphToR("echo", "stay")') call RCreateMenuItem("ni", 'Send.Paragraph\ (and\ down)', 'RDSendParagraph', 'pd', ':call SendParagraphToR("silent", "down")') call RCreateMenuItem("ni", 'Send.Paragraph\ (echo\ and\ down)', 'REDSendParagraph', 'pa', ':call SendParagraphToR("echo", "down")') "------------------------------- - menu R.Send.-Sep5- + menu R.Send.-Sep6- call RCreateMenuItem("ni0", 'Send.Line', 'RSendLine', 'l', ':call SendLineToR("stay")') call RCreateMenuItem("ni0", 'Send.Line\ (and\ down)', 'RDSendLine', 'd', ':call SendLineToR("down")') call RCreateMenuItem("i", 'Send.Line\ (and\ new\ one)', 'RSendLAndOpenNewOne', 'q', ':call SendLineToR("newline")') @@ -1754,19 +1762,19 @@ function MakeRMenu() "---------------------------------------------------------------------------- call RControlMenu() "------------------------------- - menu R.Command.-Sep5- + menu R.Command.-Sep1- if &filetype != "rdoc" call RCreateMenuItem("nvi", 'Command.Set\ working\ directory\ (cur\ file\ path)', 'RSetwd', 'rd', ':call RSetWD()') endif "------------------------------- if &filetype == "rnoweb" || g:vimrplugin_never_unmake_menu - menu R.Command.-Sep6- + menu R.Command.-Sep2- call RCreateMenuItem("nvi", 'Command.Sweave\ (cur\ file)', 'RSweave', 'sw', ':call RSweave()') call RCreateMenuItem("nvi", 'Command.Sweave\ and\ PDF\ (cur\ file)', 'RMakePDF', 'sp', ':call RMakePDF("nobib")') call RCreateMenuItem("nvi", 'Command.Sweave,\ BibTeX\ and\ PDF\ (cur\ file)', 'RMakePDF', 'sb', ':call RMakePDF("bibtex")') endif "------------------------------- - menu R.Command.-Sep6a- + menu R.Command.-Sep3- if &filetype == "r" || &filetype == "rnoweb" || g:vimrplugin_never_unmake_menu nmenu R.Command.Build\ tags\ file\ (cur\ dir):RBuildTags :call SendCmdToR('rtags(ofile = "TAGS")') imenu R.Command.Build\ tags\ file\ (cur\ dir):RBuildTags :call SendCmdToR('rtags(ofile = "TAGS")')a @@ -1786,8 +1794,8 @@ function MakeRMenu() vmenu R.Edit.Indent\ (selected\ lines)= = nmenu R.Edit.Indent\ (whole\ buffer)gg=G gg=G menu R.Edit.-Sep72- - call RCreateMenuItem("ni", 'Edit.Comment/Uncomment\ (line/sel)', 'RCommentLine', 'cc', ':call RComment("normal")') - call RCreateMenuItem("v", 'Edit.Comment/Uncomment\ (line/sel)', 'RCommentLine', 'cc', ':call RComment("selection")') + call RCreateMenuItem("ni", 'Edit.Comment/Uncomment\ (line/sel)', 'RCommentLine', 'xx', ':call RComment("normal")') + call RCreateMenuItem("v", 'Edit.Comment/Uncomment\ (line/sel)', 'RCommentLine', 'xx', ':call RComment("selection")') call RCreateMenuItem("ni", 'Edit.Add/Align\ right\ comment\ (line,\ sel)', 'RRightComment', ';', ':call MovePosRCodeComment("normal")') call RCreateMenuItem("v", 'Edit.Add/Align\ right\ comment\ (line,\ sel)', 'RRightComment', ';', ':call MovePosRCodeComment("selection")') if &filetype == "rnoweb" || g:vimrplugin_never_unmake_menu @@ -1963,8 +1971,8 @@ endfunction function RCreateEditMaps() " Edit "------------------------------------- - call RCreateMaps("ni", 'RCommentLine', 'cc', ':call RComment("normal")') - call RCreateMaps("v", 'RCommentLine', 'cc', ':call RComment("selection")') + call RCreateMaps("ni", 'RCommentLine', 'xx', ':call RComment("normal")') + call RCreateMaps("v", 'RCommentLine', 'xx', ':call RComment("selection")') call RCreateMaps("ni", 'RRightComment', ';', ':call MovePosRCodeComment("normal")') call RCreateMaps("v", 'RRightComment', ';', ':call MovePosRCodeComment("selection")') " Replace 'underline' with '<-' From 185782f6fc6f51513f280ddd6c8610a929a157b9 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Mon, 7 Nov 2011 08:39:29 -0300 Subject: [PATCH 0068/1050] Avoid problems with ^A^K. --- doc/r-plugin.txt | 17 +++++++++++++++++ ftplugin/r.vim | 8 +++++++- ftplugin/rbrowser.vim | 8 +++++++- ftplugin/rdoc.vim | 8 +++++++- ftplugin/rhelp.vim | 7 ++++++- ftplugin/rnoweb.vim | 8 +++++++- r-plugin/common_global.vim | 24 +++++++++++++++--------- 7 files changed, 66 insertions(+), 14 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 9b4e599..3c79185 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -798,6 +798,7 @@ duplicated to R on Mac OS X. |vimrplugin_sweaveargs| Arguments do Sweave() |vimrplugin_never_unmake_menu| Do not unmake the menu when switching buffers |vimrplugin_map_r| Use 'r' to send lines and selected text +|vimrplugin_ca_ck| Add ^A^K to the beginning of commands. 7.1. Terminal emulator (Linux/Unix only)~ @@ -1168,6 +1169,20 @@ Emacs: set tabstop=8 < +7.23. Add ^A^K to the beginning of commands~ + *vimrplugin_ca_ck* +When one types in the R Console the cursor goes to the beginning of the +line and one types the characters to the right of the cursor are +deleted. Sending may be problematic if using GNU Screen in some systems +and may cause incomplete output when using the Conque Shell plugin. The +Vim-R-plugin will add to every command, unless +|vimrplugin_conqueplugin| = 1 or |vimrplugin_screenplugin| = 1 and +|vimrplugin_tmux| = 0. You can change this behavior by setting the value of +|vimrplugin_ca_ck| in your |vimrc|. Example: +> + let vimrplugin_ca_ck = 1 +< + ============================================================================== 8. Custom key bindings~ *r-plugin-key-bindings* @@ -1756,6 +1771,8 @@ the R syntax highlighted. * Added function SendChunkToR() and its corresponding key bindings: \cc, \ce, \cd and \ca (thanks to Xavier Fernández i Marín for suggesting the feature). + * New option (vimrplugin_ca_ck) was created to fix bug reported by Xavier + Fernández i Marín: spurious ^A^K being added to lines sent to R. 111014 (2011-10-14) * Fixed spell check bug in R documentation files (.Rd). diff --git a/ftplugin/r.vim b/ftplugin/r.vim index 2ac9632..6af6549 100644 --- a/ftplugin/r.vim +++ b/ftplugin/r.vim @@ -19,7 +19,7 @@ " " Based on previous work by Johannes Ranke " -" Last Change: Tue Feb 08, 2011 09:31AM +" Last Change: Fri Nov 04, 2011 10:02PM " " Please see doc/r-plugin.txt for usage details. "========================================================================== @@ -32,6 +32,9 @@ endif " Don't load another plugin for this buffer let b:did_r_ftplugin = 1 +let s:cpo_save = &cpo +set cpo&vim + setlocal commentstring=#%s setlocal comments=b:#,b:##,b:### @@ -107,3 +110,6 @@ endif " Menu R call MakeRMenu() +let &cpo = s:cpo_save +unlet s:cpo_save + diff --git a/ftplugin/rbrowser.vim b/ftplugin/rbrowser.vim index 86803aa..2a3a115 100644 --- a/ftplugin/rbrowser.vim +++ b/ftplugin/rbrowser.vim @@ -16,7 +16,7 @@ " " Author: Jakson Alves de Aquino " -" Last Change: Sat Mar 19, 2011 10:35AM +" Last Change: Fri Nov 04, 2011 08:43PM "========================================================================== " Only do this when not yet done for this buffer @@ -27,6 +27,9 @@ endif " Don't load another plugin for this buffer let b:did_ftplugin = 1 +let s:cpo_save = &cpo +set cpo&vim + setlocal noswapfile set buftype=nofile setlocal nowrap @@ -649,3 +652,6 @@ au BufEnter call MakeRBrowserMenu() au BufLeave call UnMakeRBrowserMenu() exe "augroup END" +let &cpo = s:cpo_save +unlet s:cpo_save + diff --git a/ftplugin/rdoc.vim b/ftplugin/rdoc.vim index 1b3d865..ed6d133 100644 --- a/ftplugin/rdoc.vim +++ b/ftplugin/rdoc.vim @@ -19,7 +19,7 @@ " " Based on previous work by Johannes Ranke " -" Last Change: Sat Feb 05, 2011 08:08AM +" Last Change: Fri Nov 04, 2011 08:42PM " " Please see doc/r-plugin.txt for usage details. "========================================================================== @@ -32,6 +32,9 @@ endif " Don't load another plugin for this buffer let b:did_rdoc_ftplugin = 1 +let s:cpo_save = &cpo +set cpo&vim + " Source scripts common to R, Rnoweb, Rhelp and rdoc files: runtime r-plugin/common_global.vim @@ -54,3 +57,6 @@ setlocal noswapfile set buftype=nofile autocmd VimResized let g:vimrplugin_newsize = 1 +let &cpo = s:cpo_save +unlet s:cpo_save + diff --git a/ftplugin/rhelp.vim b/ftplugin/rhelp.vim index d308800..20993c4 100644 --- a/ftplugin/rhelp.vim +++ b/ftplugin/rhelp.vim @@ -19,7 +19,7 @@ " " Based on previous work by Johannes Ranke " -" Last Change: Sat Feb 05, 2011 09:18AM +" Last Change: Fri Nov 04, 2011 08:42PM " " Please see doc/r-plugin.txt for usage details. "========================================================================== @@ -32,6 +32,9 @@ endif " Don't load another plugin for this buffer let b:did_rhelp_ftplugin = 1 +let s:cpo_save = &cpo +set cpo&vim + " Source scripts common to R, Rnoweb, Rhelp and rdoc files: runtime r-plugin/common_global.vim if exists("g:rplugin_failed") @@ -89,4 +92,6 @@ call RCreateMaps("nvi", 'RSetwd', 'rd', ':call RSetWD()') " Menu R call MakeRMenu() +let &cpo = s:cpo_save +unlet s:cpo_save diff --git a/ftplugin/rnoweb.vim b/ftplugin/rnoweb.vim index 8f8a4a0..4fbef6a 100644 --- a/ftplugin/rnoweb.vim +++ b/ftplugin/rnoweb.vim @@ -17,7 +17,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Fri Nov 04, 2011 08:38AM +" Last Change: Fri Nov 04, 2011 08:43PM "========================================================================== " Only do this when not yet done for this buffer @@ -28,6 +28,9 @@ endif " Don't load another plugin for this buffer let b:did_rnoweb_ftplugin = 1 +let s:cpo_save = &cpo +set cpo&vim + " Enables Vim-Latex-Suite if it is installed runtime ftplugin/tex_latexSuite.vim @@ -191,3 +194,6 @@ nmap gN :call RnwPreviousChunk() " Menu R call MakeRMenu() +let &cpo = s:cpo_save +unlet s:cpo_save + diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index effd6bb..1983e49 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -17,7 +17,7 @@ " " Based on previous work by Johannes Ranke " -" Last Change: Fri Nov 04, 2011 08:41AM +" Last Change: Sat Nov 05, 2011 10:39AM " " Purposes of this file: Create all functions and commands and Set the " value of all global variables and some buffer variables.for r, @@ -641,15 +641,10 @@ endfunction " Function to send commands " return 0 on failure and 1 on success function SendCmdToR(cmd) - " ^K (\013) cleans from cursor to the right and ^U (\025) cleans from - " cursor to the left. However, ^U causes a beep if there is nothing to - " clean. The solution is to use ^A (\001) to move the cursor to the - " beginning of the line before sending ^K. But the control characters may - " cause Conque to show the output incompletely. - if g:vimrplugin_conqueplugin - let cmd = a:cmd - else + if g:vimrplugin_ca_ck let cmd = "\001" . "\013" . a:cmd + else + let cmd = a:cmd endif if has("gui_win32") && g:vimrplugin_conqueplugin == 0 @@ -2380,6 +2375,17 @@ if !exists("g:rplugin_hasmenu") let g:rplugin_hasmenu = 0 endif +" ^K (\013) cleans from cursor to the right and ^U (\025) cleans from cursor +" to the left. However, ^U causes a beep if there is nothing to clean. The +" solution is to use ^A (\001) to move the cursor to the beginning of the line +" before sending ^K. But the control characters may cause problems in some +" circumstances. +if g:vimrplugin_conqueplugin || (g:vimrplugin_screenplugin && g:vimrplugin_tmux == 0) + call RSetDefaultValue("g:vimrplugin_ca_ck", 0) +else + call RSetDefaultValue("g:vimrplugin_ca_ck", 1) +endif + " List of marks that the plugin seeks to find the block to be sent to R let s:all_marks = "abcdefghijklmnopqrstuvwxyz" From 67e1ef7dc787c98eff3a165141c91b450c701912 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 10 Nov 2011 11:56:50 -0300 Subject: [PATCH 0069/1050] Set the default value of vimrplugin_ca_ck = 0. --- r-plugin/common_global.vim | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 1983e49..caed834 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -17,10 +17,10 @@ " " Based on previous work by Johannes Ranke " -" Last Change: Sat Nov 05, 2011 10:39AM +" Last Change: Thu Nov 10, 2011 11:56AM " -" Purposes of this file: Create all functions and commands and Set the -" value of all global variables and some buffer variables.for r, +" Purposes of this file: Create all functions and commands and set the +" value of all global variables and some buffer variables.for r, " rnoweb, rhelp, rdoc, and rbrowser files " " Why not an autoload script? Because autoload was designed to store @@ -1221,7 +1221,7 @@ function SetRTextWidth() let min_h = (g:vimrplugin_help_w > 73) ? g:vimrplugin_help_w : 73 if wwidth > (min_e + min_h) - " The editor window is large enough to be splitted as either >80+73 or + " The editor window is large enough to be split as either >80+73 or " the user defined minimum values let s:hwidth = min_h elseif wwidth > (min_e + g:vimrplugin_help_w) @@ -2075,6 +2075,13 @@ call RSetDefaultValue("g:vimrplugin_vimpager", "'vertical'") call RSetDefaultValue("g:vimrplugin_latexcmd", "'pdflatex'") call RSetDefaultValue("g:vimrplugin_objbr_place", "'console,right'") +" ^K (\013) cleans from cursor to the right and ^U (\025) cleans from cursor +" to the left. However, ^U causes a beep if there is nothing to clean. The +" solution is to use ^A (\001) to move the cursor to the beginning of the line +" before sending ^K. But the control characters may cause problems in some +" circumstances. +call RSetDefaultValue("g:vimrplugin_ca_ck", 0) + if has("gui_macvim") || has("gui_mac") || has("mac") || has("macunix") call RSetDefaultValue("g:vimrplugin_applescript", 1) else @@ -2375,17 +2382,6 @@ if !exists("g:rplugin_hasmenu") let g:rplugin_hasmenu = 0 endif -" ^K (\013) cleans from cursor to the right and ^U (\025) cleans from cursor -" to the left. However, ^U causes a beep if there is nothing to clean. The -" solution is to use ^A (\001) to move the cursor to the beginning of the line -" before sending ^K. But the control characters may cause problems in some -" circumstances. -if g:vimrplugin_conqueplugin || (g:vimrplugin_screenplugin && g:vimrplugin_tmux == 0) - call RSetDefaultValue("g:vimrplugin_ca_ck", 0) -else - call RSetDefaultValue("g:vimrplugin_ca_ck", 1) -endif - " List of marks that the plugin seeks to find the block to be sent to R let s:all_marks = "abcdefghijklmnopqrstuvwxyz" @@ -2466,3 +2462,4 @@ endif if g:vimrplugin_conqueplugin && g:vimrplugin_applescript echoerr "Error number 3" endif + From 33012cd78e462479c3631fe46955ffe737a8c2fd Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Fri, 11 Nov 2011 00:15:29 -0300 Subject: [PATCH 0070/1050] Don't blink buttons/menu during omnicompletion. --- doc/r-plugin.txt | 47 ++++++++-------------------- ftplugin/r.vim | 6 ++-- ftplugin/rbrowser.vim | 27 +++++++--------- ftplugin/rdoc.vim | 6 ++-- ftplugin/rhelp.vim | 6 ++-- ftplugin/rnoweb.vim | 6 ++-- r-plugin/common_buffer.vim | 11 ++----- r-plugin/common_global.vim | 64 +++++++++++++++++++++++++++----------- 8 files changed, 88 insertions(+), 85 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 3c79185..0c1d402 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -491,12 +491,12 @@ classify the objects: 4.5. Commenting and uncommenting lines~ -You can toogle the state of a line as either commented or uncommented by +You can toggle the state of a line as either commented or uncommented by typing xx. You can also add comments to the right of a line with the ; shortcut. By default, the comment starts at the 40th column, which can be -changed by setting the valude of r_indent_comment_column, as below: +changed by setting the value of r_indent_comment_column, as below: > let r_indent_comment_column = 20 < @@ -546,7 +546,7 @@ useful: q : Quit the copy and scroll mode. : Start text selection. - v : Start retangular text selection. + v : Start rectangular text selection. : Copy the selection to Tmux paste buffer. Please, read the manual page of Tmux if you want to change the Tmux @@ -679,18 +679,7 @@ entire code is sourced, which makes it more difficult to find errors in the code sent to R. -6.2. GVim's toolbar buttons, menu and title bar blink during omni completion~ - -The plugin unmakes the R menu and the related toolbar buttons when Vim leaves -the R buffer. During omni completion, Vim leaves the R buffer and goes to the -scratch window which is not recognized as an R file type. Consequently, the -plugin unmakes the toolbar buttons and R related menu items. If you prefer, -you can use the option |vimrplugin_never_unmake_menu| but, then, the menu and -tool bar buttons will never be deleted, even if you change from one file type -to another. - - -6.3. R session is detached when GVim is closed (Linux/Unix only)~ +6.2. R session is detached when GVim is closed (Linux/Unix only)~ If you launch GVim through a custom keyboard shortcut, the problem may be solved if you add -f as parameter to GVim. The R session also used to be @@ -701,38 +690,30 @@ reattach to the R session, open a new terminal window and type: screen -r < -6.4. The clipboard's content is lost (Windows only)~ +6.3. The clipboard's content is lost (Windows only)~ On Windows, the plugin copies the command that will be sent to R into the clipboard. Thus, if you have anything in the clipboard it will be lost while using the plugin. -6.5. The buffer name must be in the window title (Windows only)~ +6.4. The buffer name must be in the window title (Windows only)~ On Windows the plugin tries to activate the "R Console" window, paste the command that is being sent to R, and, then, activate the GVim window. To activate the GVim window the plugin requires that the name of the file being -edited be in the GVim windows title. This is the default on Vim if you have -not set the option 'titlestring'. +edited be in the GVim window title. This is the default if you have not set +the option 'titlestring'. -6.6. The menu may not reflect some of your custom key bindings~ +6.5. The menu may not reflect some of your custom key bindings~ If you have created a custom key binding for the Vim-R-plugin, the menu in GVim will not always reflect the correct key binding if it is not the same for Normal, Visual and Insert modes. -6.7. quit(save = "yes") may not work properly~ - -If you are using the screen.vim plugin (not running R in an external -terminal), the R command quit(save = "yes") may not have time enough to save -the workspace. Vim will sleep for 1 second after the command \rw before -killing R but this time is not enough for big workspaces. - - -6.8. Syntactically correct code may be wrongly indented~ +6.6. Syntactically correct code may be wrongly indented~ If the Vim-R-plugin indents your code wrongly you may get the correct indentation by adding braces and line breaks to it. Example: @@ -755,7 +736,7 @@ indentation by adding braces and line breaks to it. Example: class(x) <- c(if(ordered) "ordered", "factor") < -6.9. Commands are sent twice on Mac OS X~ +6.7. Commands are sent twice on Mac OS X~ If you use the screen plugin with GNU Screen, individual lines may be sent duplicated to R on Mac OS X. @@ -1175,10 +1156,7 @@ When one types in the R Console the cursor goes to the beginning of the line and one types the characters to the right of the cursor are deleted. Sending may be problematic if using GNU Screen in some systems and may cause incomplete output when using the Conque Shell plugin. The -Vim-R-plugin will add to every command, unless -|vimrplugin_conqueplugin| = 1 or |vimrplugin_screenplugin| = 1 and -|vimrplugin_tmux| = 0. You can change this behavior by setting the value of -|vimrplugin_ca_ck| in your |vimrc|. Example: +Vim-R-plugin will add to every command if you put in your |vimrc|: > let vimrplugin_ca_ck = 1 < @@ -1773,6 +1751,7 @@ the R syntax highlighted. the feature). * New option (vimrplugin_ca_ck) was created to fix bug reported by Xavier Fernández i Marín: spurious ^A^K being added to lines sent to R. + * Don't blink the menu and toolbar buttons when doing omni completion. 111014 (2011-10-14) * Fixed spell check bug in R documentation files (.Rd). diff --git a/ftplugin/r.vim b/ftplugin/r.vim index 6af6549..f121322 100644 --- a/ftplugin/r.vim +++ b/ftplugin/r.vim @@ -19,7 +19,7 @@ " " Based on previous work by Johannes Ranke " -" Last Change: Fri Nov 04, 2011 10:02PM +" Last Change: Thu Nov 10, 2011 11:57PM " " Please see doc/r-plugin.txt for usage details. "========================================================================== @@ -108,7 +108,9 @@ endif " Menu R -call MakeRMenu() +if has("gui") + call MakeRMenu() +endif let &cpo = s:cpo_save unlet s:cpo_save diff --git a/ftplugin/rbrowser.vim b/ftplugin/rbrowser.vim index 2a3a115..29e8fdd 100644 --- a/ftplugin/rbrowser.vim +++ b/ftplugin/rbrowser.vim @@ -16,7 +16,7 @@ " " Author: Jakson Alves de Aquino " -" Last Change: Fri Nov 04, 2011 08:43PM +" Last Change: Thu Nov 10, 2011 11:53PM "========================================================================== " Only do this when not yet done for this buffer @@ -619,7 +619,7 @@ function! MakeRBrowserMenu() call RBrowserMenu() endfunction -function! UnMakeRBrowserMenu() +function! LeaveRBrowser() if g:rplugin_curview == "libraries" let g:rplugin_curlline = line(".") let g:rplugin_curlcol = col(".") @@ -627,30 +627,27 @@ function! UnMakeRBrowserMenu() let g:rplugin_curbline = line(".") let g:rplugin_curbcol = col(".") endif - if !has("gui_running") || g:rplugin_hasmenu == 0 || g:vimrplugin_never_unmake_menu == 1 || &previewwindow - return - endif - aunmenu R - let g:rplugin_hasmenu = 0 endfunction nmap :call RBrowserDoubleClick() nmap <2-LeftMouse> :call RBrowserDoubleClick() nmap :call RBrowserRightClick() -call RControlMenu() call RControlMaps() -call RBrowserMenu() setlocal winfixwidth setlocal bufhidden=wipe -let s:thisbuffname = substitute(bufname("%"), '\.', '', "g") -let s:thisbuffname = substitute(s:thisbuffname, ' ', '', "g") -exe "augroup " . s:thisbuffname -au BufEnter call MakeRBrowserMenu() -au BufLeave call UnMakeRBrowserMenu() -exe "augroup END" +if has("gui") + call RControlMenu() + call RBrowserMenu() + let s:thisbuffname = substitute(bufname("%"), '\.', '', "g") + let s:thisbuffname = substitute(s:thisbuffname, ' ', '', "g") + exe "augroup " . s:thisbuffname + au BufLeave call LeaveRBrowser() + exe "augroup END" + unlet s:thisbuffname +endif let &cpo = s:cpo_save unlet s:cpo_save diff --git a/ftplugin/rdoc.vim b/ftplugin/rdoc.vim index ed6d133..031af52 100644 --- a/ftplugin/rdoc.vim +++ b/ftplugin/rdoc.vim @@ -19,7 +19,7 @@ " " Based on previous work by Johannes Ranke " -" Last Change: Fri Nov 04, 2011 08:42PM +" Last Change: Thu Nov 10, 2011 11:58PM " " Please see doc/r-plugin.txt for usage details. "========================================================================== @@ -50,7 +50,9 @@ call RCreateSendMaps() call RControlMaps() " Menu R -call MakeRMenu() +if has("gui") + call MakeRMenu() +endif setlocal bufhidden=wipe setlocal noswapfile diff --git a/ftplugin/rhelp.vim b/ftplugin/rhelp.vim index 20993c4..36bb772 100644 --- a/ftplugin/rhelp.vim +++ b/ftplugin/rhelp.vim @@ -19,7 +19,7 @@ " " Based on previous work by Johannes Ranke " -" Last Change: Fri Nov 04, 2011 08:42PM +" Last Change: Thu Nov 10, 2011 11:57PM " " Please see doc/r-plugin.txt for usage details. "========================================================================== @@ -90,7 +90,9 @@ call RControlMaps() call RCreateMaps("nvi", 'RSetwd', 'rd', ':call RSetWD()') " Menu R -call MakeRMenu() +if has("gui") + call MakeRMenu() +endif let &cpo = s:cpo_save unlet s:cpo_save diff --git a/ftplugin/rnoweb.vim b/ftplugin/rnoweb.vim index 4fbef6a..b39c07f 100644 --- a/ftplugin/rnoweb.vim +++ b/ftplugin/rnoweb.vim @@ -17,7 +17,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Fri Nov 04, 2011 08:43PM +" Last Change: Thu Nov 10, 2011 11:58PM "========================================================================== " Only do this when not yet done for this buffer @@ -192,7 +192,9 @@ nmap gn :call RnwNextChunk() nmap gN :call RnwPreviousChunk() " Menu R -call MakeRMenu() +if has("gui") + call MakeRMenu() +endif let &cpo = s:cpo_save unlet s:cpo_save diff --git a/r-plugin/common_buffer.vim b/r-plugin/common_buffer.vim index 635abd2..85bc894 100644 --- a/r-plugin/common_buffer.vim +++ b/r-plugin/common_buffer.vim @@ -19,7 +19,7 @@ " " Based on previous work by Johannes Ranke " -" Last Change: Mon Feb 07, 2011 08:07PM +" Last Change: Thu Nov 10, 2011 01:35PM " " Please see doc/r-plugin.txt for usage details. "========================================================================== @@ -98,12 +98,5 @@ if g:vimrplugin_by_vim_instance == 1 unlet s:sname endif -let s:thisbuffname = substitute(bufname("%"), '\.', '', "g") -let s:thisbuffname = substitute(s:thisbuffname, ' ', '', "g") -exe "augroup " . s:thisbuffname - au FileType call MakeRMenu() - au BufEnter call RBufEnter() - au BufLeave call UnMakeRMenu() -exe "augroup END" -unlet s:thisbuffname +let g:rplugin_lastft = &filetype diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index caed834..229f0d2 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -17,7 +17,7 @@ " " Based on previous work by Johannes Ranke " -" Last Change: Thu Nov 10, 2011 11:56AM +" Last Change: Fri Nov 11, 2011 12:11AM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -1591,6 +1591,7 @@ function RBrowserMenu() imenu R.Object\ browser.Toggle\ (cur)Enter :call RBrowserDoubleClick() nmenu R.Object\ browser.Toggle\ (cur)Enter :call RBrowserDoubleClick() endif + let g:rplugin_hasmenu = 1 endfunction function RControlMenu() @@ -1689,7 +1690,7 @@ function RCreateMaps(type, plug, combo, target) endfunction function MakeRMenu() - if g:rplugin_hasmenu == 1 || !has("gui_running") + if g:rplugin_hasmenu == 1 return endif @@ -1865,6 +1866,7 @@ function MakeRMenu() amenu R.Help\ (plugin).News :help r-plugin-news amenu R.Help\ (R) :call SendCmdToR("help.start()") + let g:rplugin_hasmenu = 1 "---------------------------------------------------------------------------- " ToolBar @@ -1908,28 +1910,31 @@ function MakeRMenu() tmenu ToolBar.RListSpace List objects tmenu ToolBar.RClear Clear the console screen tmenu ToolBar.RClearAll Remove objects from workspace and clear the console screen - let g:rplugin_hasmenu = 1 + let g:rplugin_hasbuttons = 1 endfunction function UnMakeRMenu() - if !has("gui_running") || g:rplugin_hasmenu == 0 || g:vimrplugin_never_unmake_menu == 1 || &previewwindow + if g:rplugin_hasmenu == 0 || g:vimrplugin_never_unmake_menu == 1 || &previewwindow || (&buftype == "nofile" && &filetype != "conque_term" && &filetype != "rbrowser") return endif aunmenu R - aunmenu ToolBar.RClearAll - aunmenu ToolBar.RClear - aunmenu ToolBar.RListSpace - aunmenu ToolBar.RSendLine - aunmenu ToolBar.RSendSelection - aunmenu ToolBar.RSendParagraph - aunmenu ToolBar.RSendFunction - aunmenu ToolBar.RSendBlock - if &filetype == "r" - aunmenu ToolBar.RSendFile - endif - aunmenu ToolBar.RClose - aunmenu ToolBar.RStart let g:rplugin_hasmenu = 0 + if g:rplugin_hasbuttons + aunmenu ToolBar.RClearAll + aunmenu ToolBar.RClear + aunmenu ToolBar.RListSpace + aunmenu ToolBar.RSendLine + aunmenu ToolBar.RSendSelection + aunmenu ToolBar.RSendParagraph + aunmenu ToolBar.RSendFunction + aunmenu ToolBar.RSendBlock + if g:rplugin_lastft == "r" + aunmenu ToolBar.RSendFile + endif + aunmenu ToolBar.RClose + aunmenu ToolBar.RStart + let g:rplugin_hasbuttons = 0 + endif endfunction @@ -2018,8 +2023,19 @@ function RCreateSendMaps() endfunction function RBufEnter() - call MakeRMenu() - let g:rplugin_curbuf = bufname("%") + if &filetype != g:rplugin_lastft + call UnMakeRMenu() + if &filetype == "r" || &filetype == "rnoweb" || &filetype == "rdoc" || &filetype == "rbrowser" || &filetype == "rhelp" + if &filetype == "rbrowser" + call MakeRBrowserMenu() + else + call MakeRMenu() + endif + endif + endif + if &buftype != "nofile" || &filetype == "conque_term" || &filetype == "rbrowser" + let g:rplugin_lastft = &filetype + endif endfunction command RUpdateObjList :call RBuildSyntaxFile("loaded") @@ -2452,6 +2468,16 @@ if exists("g:vimrplugin_term_cmd") let g:rplugin_termcmd = g:vimrplugin_term_cmd endif +augroup RBufControl + au BufEnter * let g:rplugin_curbuf = bufname("%") +augroup END + +if has("gui") + augroup RMenuControl + au BufEnter * call RBufEnter() + augroup END +endif + " Debugging code: if g:vimrplugin_screenplugin && g:vimrplugin_conqueplugin echoerr "Error number 1" From ea18d0c5fa5b3ad3ecc33c588955b627398d7445 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Fri, 11 Nov 2011 11:24:56 -0300 Subject: [PATCH 0071/1050] Replace make_dist.sh with Makefile. --- Makefile | 229 +++++++++++++++++++++++++++++++++++++++++++++++ make_dist.sh | 247 --------------------------------------------------- 2 files changed, 229 insertions(+), 247 deletions(-) create mode 100644 Makefile delete mode 100755 make_dist.sh diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..466c769 --- /dev/null +++ b/Makefile @@ -0,0 +1,229 @@ + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# A copy of the GNU General Public License is available at +# http://www.r-project.org/Licenses/ + + +########################################################### +# This script builds both the zip and the deb files of # +# released versions of the plugin. The files are # +# created at the /tmp directory. # +########################################################### + + + +PLUGINHOME=`pwd` +PLUGINVERSION=`date +%y%m%d` +DEBIANTIME=`date -R` +PLUGINDOCVERSION=`date +"%Y-%m-%d"` + +zip: + # Clean previously created files + (cd /tmp ;\ + rm -rf vim-r-plugin-tmp/usr/share/vim/addons ;\ + mkdir -p vim-r-plugin-tmp/usr/share/vim/addons ) + rm -f /tmp/vim-r-plugin-$(PLUGINVERSION).zip + # To make the distribution version of the plugin the files + # functions.vim.vanilla and omniList.vanilla must exist. To generate these + # files, the Vim command :RUpdateObjList must be run with R vanilla running + # (that is, R with only the default libraries loaded) and, then, the files + # functions.vim and omniList must be renamed. + ( cd r-plugin ;\ + mv functions.vim functions.vim.current ;\ + mv omniList omniList.current ;\ + cp functions.vim.vanilla functions.vim ;\ + cp omniList.vanilla omniList ) + # Update the version date in doc/r-plugin.txt header + sed -i -e "s/Version: [0-9][0-9][0-9][0-9][0-9][0-9]/Version: $(PLUGINVERSION)/" doc/r-plugin.txt + # Create a tar.gz file + tar -cvzf /tmp/vimrplugintmpfile.tar.gz ftdetect/r.vim indent/r.vim \ + indent/rnoweb.vim indent/rhelp.vim autoload/rcomplete.vim ftplugin/r*.vim \ + syntax/rout.vim syntax/r.vim syntax/rhelp.vim syntax/rdoc.vim syntax/rbrowser.vim \ + doc/r-plugin.txt r-plugin/*.R r-plugin/functions.vim \ + r-plugin/global_r_plugin.vim r-plugin/omniList r-plugin/windows.py \ + r-plugin/vimActivate.js r-plugin/tex_indent.vim r-plugin/r.snippets \ + r-plugin/common_buffer.vim r-plugin/common_global.vim \ + r-plugin/tmux.conf r-plugin/screenrc r-plugin/screenrc.xterm \ + bitmaps/ricon.xbm bitmaps/ricon.png \ + bitmaps/RStart.png bitmaps/RStart.bmp \ + bitmaps/RClose.png bitmaps/RClose.bmp \ + bitmaps/RSendFile.png bitmaps/RSendFile.bmp \ + bitmaps/RSendBlock.png bitmaps/RSendBlock.bmp \ + bitmaps/RSendFunction.png bitmaps/RSendFunction.bmp \ + bitmaps/RSendParagraph.png bitmaps/RSendParagraph.bmp \ + bitmaps/RSendSelection.png bitmaps/RSendSelection.bmp \ + bitmaps/RSendLine.png bitmaps/RSendLine.bmp \ + bitmaps/RListSpace.png bitmaps/RListSpace.bmp \ + bitmaps/RClear.png bitmaps/RClear.bmp \ + bitmaps/RClearAll.png bitmaps/RClearAll.bmp + # Rename the functions.vim and omniList files + ( cd $(PLUGINHOME)/r-plugin ;\ + mv functions.vim.current functions.vim ;\ + mv omniList.current omniList ) + # Unpack the tar.gz and create the zip file + (cd /tmp ;\ + tar -xvzf vimrplugintmpfile.tar.gz -C vim-r-plugin-tmp/usr/share/vim/addons > /dev/null ;\ + rm vimrplugintmpfile.tar.gz ) + (cd /tmp/vim-r-plugin-tmp/usr/share/vim/addons ;\ + chmod +w r-plugin/tex_indent.vim ;\ + rm -f /tmp/vim-r-plugin-$(PLUGINVERSION).zip ;\ + zip -r /tmp/vim-r-plugin-$(PLUGINVERSION).zip . ) + # Warn if the date in the doc is outdated + -grep $(PLUGINDOCVERSION) doc/r-plugin.txt > /tmp/docdateok + if [ "x`cat /tmp/docdateok`" = "x" ] ; then echo "\033[31mYou must update the version date in r-plugin.txt\033[0m" ; fi + +deb: + # Clean previously created files + (cd /tmp ; rm -rf vim-r-plugin-tmp ) + # Create the directory of a Debian package + ( cd /tmp ;\ + mkdir -p vim-r-plugin-tmp/usr/share/vim/addons ;\ + mkdir -p vim-r-plugin-tmp/usr/share/vim/registry ;\ + mkdir -p vim-r-plugin-tmp/usr/share/doc/vim-r-plugin ) + # Create the Debian changelog + echo $(DEBCHANGELOG) "vim-r-plugin ($(PLUGINVERSION)-1) unstable; urgency=low\n\ + \n\ + * Initial Release.\n\ + \n\ + -- Jakson Alves de Aquino $(DEBIANTIME)\n\ + " | gzip --best > /tmp/vim-r-plugin-tmp/usr/share/doc/vim-r-plugin/changelog.gz + # Create the yaml script + echo "addon: r-plugin\n\ + description: \"Filetype plugin to work with R\"\n\ + disabledby: \"let disable_r_ftplugin = 1\"\n\ + files:\n\ + - autoload/rcomplete.vim\n\ + - bitmaps/RClose.png\n\ + - bitmaps/RClear.png\n\ + - bitmaps/RClearAll.png\n\ + - bitmaps/RListSpace.png\n\ + - bitmaps/RSendBlock.png\n\ + - bitmaps/RSendFile.png\n\ + - bitmaps/RSendFunction.png\n\ + - bitmaps/RSendLine.png\n\ + - bitmaps/RSendParagraph.png\n\ + - bitmaps/RSendSelection.png\n\ + - bitmaps/RStart.png\n\ + - bitmaps/ricon.png\n\ + - bitmaps/ricon.xbm\n\ + - doc/r-plugin.txt\n\ + - ftdetect/r.vim\n\ + - ftplugin/r.vim\n\ + - ftplugin/rbrowser.vim\n\ + - ftplugin/rdoc.vim\n\ + - ftplugin/rhelp.vim\n\ + - ftplugin/rnoweb.vim\n\ + - indent/r.vim\n\ + - indent/rnoweb.vim\n\ + - indent/rhelp.vim\n\ + - r-plugin/build_omniList.R\n\ + - r-plugin/common_buffer.vim\n\ + - r-plugin/common_global.vim\n\ + - r-plugin/etags2ctags.R\n\ + - r-plugin/global_r_plugin.vim\n\ + - r-plugin/specialfuns.R\n\ + - r-plugin/tex_indent.vim\n\ + - r-plugin/tmux.conf\n\ + - r-plugin/screenrc\n\ + - r-plugin/screenrc.xterm\n\ + - r-plugin/vimbrowser.R\n\ + - r-plugin/vimhelp.R\n\ + - r-plugin/vimprint.R\n\ + - r-plugin/vimSweave.R\n\ + - syntax/r.vim\n\ + - syntax/rdoc.vim\n\ + - syntax/rout.vim\n\ + - syntax/rhelp.vim\n\ + - syntax/rbrowser.vim\n\ + " > /tmp/vim-r-plugin-tmp/usr/share/vim/registry/vim-r-plugin.yaml + # Create the copyright + echo "Copyright (C) 2011 Jakson Aquino\n\ + \n\ + License: GPLv2+\n\ + \n\ + This program is free software; you can redistribute it and/or modify\n\ + it under the terms of the GNU General Public License as published by\n\ + the Free Software Foundation; either version 2 of the License, or\n\ + (at your option) any later version.\n\ + \n\ + This program is distributed in the hope that it will be useful,\n\ + but WITHOUT ANY WARRANTY; without even the implied warranty of\n\ + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\ + GNU General Public License for more details.\n\ + \n\ + You should have received a copy of the GNU General Public License\n\ + along with this program; if not, write to the Free Software\n\ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.\n\ + \n\ + See /usr/share/common-licenses/GPL-2, or\n\ + for the terms of the latest version\n\ + of the GNU General Public License.\n\ + " > /tmp/vim-r-plugin-tmp/usr/share/doc/vim-r-plugin/copyright + unzip /tmp/vim-r-plugin-$(PLUGINVERSION).zip -d /tmp/vim-r-plugin-tmp/usr/share/vim/addons + # Delete the files unnecessary in a Debian system + (cd /tmp/vim-r-plugin-tmp/usr/share/vim/addons ;\ + rm bitmaps/*.bmp r-plugin/windows.py r-plugin/vimActivate.js ) + # Add a comment to r-plugin.txt + (cd /tmp/vim-r-plugin-tmp/usr/share/vim/addons ;\ + sed -e 's/3.2.1. Unix (Linux, OS X, etc.)./3.2.1. Unix (Linux, OS X, etc.)~\n\nNote: If the plugin was installed from the Debian package, then the\ninstallation is finished and you should now read sections 3.3 and 3.4./' -i doc/r-plugin.txt ) + # Create the DEBIAN directory + ( cd /tmp/vim-r-plugin-tmp ;\ + mkdir DEBIAN ;\ + INSTALLEDSIZE=`du -s | sed -e 's/\t.*//'` ) + # Create the control file + echo "Package: vim-r-plugin\n\ + Version: $(PLUGINVERSION)\n\ + Architecture: all\n\ + Maintainer: Jakson Alves de Aquino \n\ + Installed-Size: $(INSTALLEDSIZE)\n\ + Depends: vim | vim-gtk | vim-gnome, screen, tmux (>= 1.5), ncurses-term, vim-addon-manager, r-base-core\n\ + Enhances: vim\n\ + Section: text\n\ + Priority: extra\n\ + Homepage: http://www.vim.org/scripts/script.php?script_id=2628\n\ + Description: Plugin to work with R\n\ + This filetype plugin has the following main features:\n\ + - Start/Close R.\n\ + - Send lines, selection, paragraphs, functions, blocks, entire file.\n\ + - Send commands with the object under cursor as argument:\n\ + help, args, plot, print, str, summary, example, names.\n\ + - Support for editing Rnoweb files.\n\ + - Omni completion (auto-completion) for R objects.\n\ + - Ability to see R documentation in a Vim buffer.\n\ + - Object Browser." > /tmp/vim-r-plugin-tmp/DEBIAN/control + # Create the md5sum file + (cd /tmp/vim-r-plugin-tmp/ ;\ + find usr -type f -print0 | xargs -0 md5sum > DEBIAN/md5sums ) + # Create the posinst and postrm scripts + echo '#!/bin/sh\n\ + set -e\n\ + \n\ + helpztags /usr/share/vim/addons/doc\n\ + \n\ + exit 0\n\ + ' > /tmp/vim-r-plugin-tmp/DEBIAN/postinst + echo '#!/bin/sh\n\ + set -e\n\ + \n\ + helpztags /usr/share/vim/addons/doc\n\ + \n\ + exit 0\n\ + ' > /tmp/vim-r-plugin-tmp/DEBIAN/postrm + # Fix permissions + (cd /tmp/vim-r-plugin-tmp ;\ + chmod g-w -R * ;\ + chmod +x DEBIAN/postinst DEBIAN/postrm ) + # Build the Debian package + ( cd /tmp ;\ + fakeroot dpkg-deb -b vim-r-plugin-tmp vim-r-plugin_$(PLUGINVERSION)-1_all.deb ) + + diff --git a/make_dist.sh b/make_dist.sh deleted file mode 100755 index 7cf0e1a..0000000 --- a/make_dist.sh +++ /dev/null @@ -1,247 +0,0 @@ -#!/bin/sh - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# A copy of the GNU General Public License is available at -# http://www.r-project.org/Licenses/ - - -########################################################### -# This script builds both the zip and the deb files of # -# released versions of the plugin. The files are # -# created at the /tmp directory. # -########################################################### - - - -PLUGINHOME=`pwd` -PLUGINVERSION=`date +%y%m%d` - -# To make the distribution version of the plugin the files -# functions.vim.vanilla and omniList.vanilla must exist. To generate these -# files, the Vim command :RUpdateObjList must be run with R vanilla running -# (that is, R with only the default libraries loaded) and, then, the files -# functions.vim and omniList must be renamed. -cd r-plugin -mv functions.vim functions.vim.current -mv omniList omniList.current -cp functions.vim.vanilla functions.vim -cp omniList.vanilla omniList - -# Go back to the plugin direictory -cd - - -# Update the version date in doc/r-plugin.txt header -sed -i -e "s/Version: [0-9][0-9][0-9][0-9][0-9][0-9]/Version: $PLUGINVERSION/" doc/r-plugin.txt - -# Create a tar.gz file -tar -cvzf /tmp/vimrplugintmpfile.tar.gz ftdetect/r.vim indent/r.vim \ - indent/rnoweb.vim indent/rhelp.vim autoload/rcomplete.vim ftplugin/r*.vim \ - syntax/rout.vim syntax/r.vim syntax/rhelp.vim syntax/rdoc.vim syntax/rbrowser.vim \ - doc/r-plugin.txt r-plugin/*.R r-plugin/functions.vim \ - r-plugin/global_r_plugin.vim r-plugin/omniList r-plugin/windows.py \ - r-plugin/vimActivate.js r-plugin/tex_indent.vim r-plugin/r.snippets \ - r-plugin/common_buffer.vim r-plugin/common_global.vim \ - r-plugin/tmux.conf r-plugin/screenrc r-plugin/screenrc.xterm \ - bitmaps/ricon.xbm bitmaps/ricon.png \ - bitmaps/RStart.png bitmaps/RStart.bmp \ - bitmaps/RClose.png bitmaps/RClose.bmp \ - bitmaps/RSendFile.png bitmaps/RSendFile.bmp \ - bitmaps/RSendBlock.png bitmaps/RSendBlock.bmp \ - bitmaps/RSendFunction.png bitmaps/RSendFunction.bmp \ - bitmaps/RSendParagraph.png bitmaps/RSendParagraph.bmp \ - bitmaps/RSendSelection.png bitmaps/RSendSelection.bmp \ - bitmaps/RSendLine.png bitmaps/RSendLine.bmp \ - bitmaps/RListSpace.png bitmaps/RListSpace.bmp \ - bitmaps/RClear.png bitmaps/RClear.bmp \ - bitmaps/RClearAll.png bitmaps/RClearAll.bmp - -# Rename the functions.vim and omniList files -cd $PLUGINHOME/r-plugin -mv functions.vim.current functions.vim -mv omniList.current omniList - -######################################################## -## Create a Debian package ## - -# Create the directory of a Debian package -cd /tmp -mkdir -p vim-r-plugin-tmp/usr/share/vim/addons -mkdir -p vim-r-plugin-tmp/usr/share/vim/registry -mkdir -p vim-r-plugin-tmp/usr/share/doc/vim-r-plugin - -# Create the Debian changelog -DEBIANTIME=`date -R` -echo "vim-r-plugin ($PLUGINVERSION-1) unstable; urgency=low - - * Initial Release. - - -- Jakson Alves de Aquino $DEBIANTIME -" > vim-r-plugin-tmp/usr/share/doc/vim-r-plugin/changelog -gzip --best vim-r-plugin-tmp/usr/share/doc/vim-r-plugin/changelog - -# Create the yaml script -echo "addon: r-plugin -description: "Filetype plugin to work with R" -disabledby: "let disable_r_ftplugin = 1" -files: -- autoload/rcomplete.vim -- bitmaps/RClose.png -- bitmaps/RClear.png -- bitmaps/RClearAll.png -- bitmaps/RListSpace.png -- bitmaps/RSendBlock.png -- bitmaps/RSendFile.png -- bitmaps/RSendFunction.png -- bitmaps/RSendLine.png -- bitmaps/RSendParagraph.png -- bitmaps/RSendSelection.png -- bitmaps/RStart.png -- bitmaps/ricon.png -- bitmaps/ricon.xbm -- doc/r-plugin.txt -- ftdetect/r.vim -- ftplugin/r.vim -- ftplugin/rbrowser.vim -- ftplugin/rdoc.vim -- ftplugin/rhelp.vim -- ftplugin/rnoweb.vim -- indent/r.vim -- indent/rnoweb.vim -- indent/rhelp.vim -- r-plugin/build_omniList.R -- r-plugin/common_buffer.vim -- r-plugin/common_global.vim -- r-plugin/etags2ctags.R -- r-plugin/global_r_plugin.vim -- r-plugin/specialfuns.R -- r-plugin/tex_indent.vim -- r-plugin/tmux.conf -- r-plugin/screenrc -- r-plugin/screenrc.xterm -- r-plugin/vimbrowser.R -- r-plugin/vimhelp.R -- r-plugin/vimprint.R -- r-plugin/vimSweave.R -- syntax/r.vim -- syntax/rdoc.vim -- syntax/rout.vim -- syntax/rhelp.vim -- syntax/rbrowser.vim -" > vim-r-plugin-tmp/usr/share/vim/registry/vim-r-plugin.yaml - -# Create the copyright -echo "Copyright (C) 2011 Jakson Aquino - -License: GPLv2+ - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. - -See /usr/share/common-licenses/GPL-2, or - for the terms of the latest version -of the GNU General Public License. -" > vim-r-plugin-tmp/usr/share/doc/vim-r-plugin/copyright - -# Unpack the tar.gz and create the zip file -tar -xvzf vimrplugintmpfile.tar.gz -C vim-r-plugin-tmp/usr/share/vim/addons > /dev/null -rm vimrplugintmpfile.tar.gz -cd vim-r-plugin-tmp/usr/share/vim/addons -chmod +w r-plugin/tex_indent.vim -rm -f /tmp/vim-r-plugin-$PLUGINVERSION.zip -zip -r /tmp/vim-r-plugin-$PLUGINVERSION.zip . - -# Delete the files unnecessary in a Debian system -rm bitmaps/*.bmp r-plugin/windows.py r-plugin/vimActivate.js - -# Add a comment to r-plugin.txt: -sed -e 's/3.2.1. Unix (Linux, OS X, etc.)./3.2.1. Unix (Linux, OS X, etc.)~\n\nNote: If the plugin was installed from the Debian package, then the\ninstallation is finished and you should now read sections 3.3 and 3.4./' -i doc/r-plugin.txt - -# Create the DEBIAN directory -cd /tmp/vim-r-plugin-tmp -mkdir DEBIAN -INSTALLEDSIZE=`du -s | sed -e 's/\t.*//'` - -# Create the control file -echo "Package: vim-r-plugin -Version: $PLUGINVERSION -Architecture: all -Maintainer: Jakson Alves de Aquino -Installed-Size: $INSTALLEDSIZE -Depends: vim | vim-gtk | vim-gnome, screen, tmux (>= 1.5), ncurses-term, vim-addon-manager, r-base-core -Enhances: vim -Section: text -Priority: extra -Homepage: http://www.vim.org/scripts/script.php?script_id=2628 -Description: Plugin to work with R - This filetype plugin has the following main features: - - Start/Close R. - - Send lines, selection, paragraphs, functions, blocks, entire file. - - Send commands with the object under cursor as argument: - help, args, plot, print, str, summary, example, names. - - Support for editing Rnoweb files. - - Omni completion (auto-completion) for R objects. - - Ability to see R documentation in a Vim buffer. - - Object Browser." > DEBIAN/control - -# Create the md5sum file -arquivos=`find -type f | grep -v DEBIAN | sed -e 's/^\.\///'` -for i in $arquivos -do - md5sum $i >> DEBIAN/md5sums -done - -# Create the posinst and postrm scripts -echo '#!/bin/sh -set -e - -helpztags /usr/share/vim/addons/doc - -exit 0 -' > DEBIAN/postinst - -echo '#!/bin/sh -set -e - -helpztags /usr/share/vim/addons/doc - -exit 0 -' > DEBIAN/postrm - -chmod +x DEBIAN/postrm DEBIAN/postinst - -# Build the Debian package -cd /tmp -fakeroot dpkg-deb -b vim-r-plugin-tmp vim-r-plugin_$PLUGINVERSION-1_all.deb - -# Clean -rm -rf vim-r-plugin-tmp - - -# Warn if the date in the doc is outdated -PLUGINVERSION=`date +"%Y-%m-%d"` -DOCDATEOK=`grep $PLUGINVERSION $PLUGINHOME/doc/r-plugin.txt` -if [ "x$DOCDATEOK" = "x" ] -then - echo "\033[31mYou must update the version date in r-plugin.txt\033[0m" -fi - From b919c84a0f175734b3e5045f221ddf7674ef018c Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Fri, 11 Nov 2011 22:32:12 -0300 Subject: [PATCH 0072/1050] Convert doc/r-plugin.txt into html. --- Makefile | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Makefile b/Makefile index 466c769..0accdef 100644 --- a/Makefile +++ b/Makefile @@ -80,6 +80,7 @@ zip: # Warn if the date in the doc is outdated -grep $(PLUGINDOCVERSION) doc/r-plugin.txt > /tmp/docdateok if [ "x`cat /tmp/docdateok`" = "x" ] ; then echo "\033[31mYou must update the version date in r-plugin.txt\033[0m" ; fi + rm /tmp/docdateok deb: # Clean previously created files @@ -226,4 +227,10 @@ deb: ( cd /tmp ;\ fakeroot dpkg-deb -b vim-r-plugin-tmp vim-r-plugin_$(PLUGINVERSION)-1_all.deb ) +htmldoc: + (cd doc ;\ + /usr/local/share/vim/vim73/doc/vim2html.pl tags r-plugin.txt ;\ + mv r-plugin.html /tmp ) + +all: zip deb htmldoc From 01e10c85ed80f2799fbaf7e3cccc1d89d60cdfd4 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Fri, 11 Nov 2011 22:38:49 -0300 Subject: [PATCH 0073/1050] Convert doc/r-plugin.txt into html. --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 0accdef..5955f1b 100644 --- a/Makefile +++ b/Makefile @@ -25,6 +25,7 @@ PLUGINHOME=`pwd` PLUGINVERSION=`date +%y%m%d` DEBIANTIME=`date -R` PLUGINDOCVERSION=`date +"%Y-%m-%d"` +VIM2HTML=/usr/local/share/vim/vim73/doc/vim2html.pl zip: # Clean previously created files @@ -229,7 +230,7 @@ deb: htmldoc: (cd doc ;\ - /usr/local/share/vim/vim73/doc/vim2html.pl tags r-plugin.txt ;\ + $(VIM2HTML) tags r-plugin.txt ;\ mv r-plugin.html /tmp ) all: zip deb htmldoc From c33361a1047926bb06cc081527f1274db76bc8d7 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 12 Nov 2011 20:16:16 -0300 Subject: [PATCH 0074/1050] Put section titles below their links. --- doc/r-plugin.txt | 38 ++++++++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 0c1d402..88f0e61 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -5,7 +5,7 @@ Authors: Jakson A. Aquino Jose Claudio Faria -Version: 111104 +Version: 111112 For Vim version 7.3 1. Overview |r-plugin-overview| @@ -22,8 +22,9 @@ For Vim version 7.3 ============================================================================== -1. Overview~ *r-plugin-overview* +1. Overview~ + This plugin improves Vim's support for editing R code and makes it possible to integrate Vim with R. @@ -44,8 +45,9 @@ to deal with. ============================================================================== -2. Main features~ *r-plugin-features* +2. Main features~ + * Syntax highlighting for R code, including: - Special characters in strings. - Functions of all installed packages (must be updated manually). @@ -78,8 +80,13 @@ to deal with. ============================================================================== -3. Installation~ *r-plugin-installation* +3. Installation~ + +The installation instructions are split in three sections: (1) general +instructions for all operating systems; (2) instructions that are specific for +Unix/Linux, OS X or Windows; and (3) troubleshooting. + 3.1. General instructions I~ You need to activate plugins and indentation according to 'filetype'. You @@ -258,8 +265,9 @@ are particularly interesting. Please read |r-plugin-tips| for details. ============================================================================== -4. Use~ *r-plugin-use* +4. Use~ + 4.1. Key bindings~ To use the plugin, open a .R or .Rnw or .Rd file with Vim and type \rf @@ -620,8 +628,8 @@ useful: ============================================================================== -5. How the plugin works~ *r-plugin-functioning* +5. How the plugin works~ 5.1. Omni completion~ @@ -668,8 +676,8 @@ behavior and force all Vim buffers to use different R processes see ============================================================================== -6. Known bugs and workarounds~ *r-plugin-known-bugs* +6. Known bugs and workarounds~ 6.1. R's source() issues~ @@ -743,8 +751,9 @@ duplicated to R on Mac OS X. ============================================================================== -7. Options~ *r-plugin-options* +7. Options~ + |vimrplugin_term| External terminal to be used |vimrplugin_term_cmd| Complete command to open an external terminal |vimrplugin_underscore| Convert '_' into ' <- ' @@ -1162,8 +1171,9 @@ Vim-R-plugin will add to every command if you put in your |vimrc|: < ============================================================================== -8. Custom key bindings~ *r-plugin-key-bindings* +8. Custom key bindings~ + When creating custom key bindings for the Vim-R-plugin, it is necessary to create three maps for most functions because the way the function is called is different in each Vim mode. Thus, key bindings must be made for Normal mode, @@ -1227,8 +1237,9 @@ and "levels" with the R function that you want to call. ============================================================================== -9. Files~ *r-plugin-files* +9. Files~ + The following files are part of the plugin and should be in your ~/.vim directory after the installation: @@ -1292,8 +1303,9 @@ directory after the installation: 8 directories, 39 files ============================================================================== -10. FAQ and tips~ *r-plugin-tips* +10. FAQ and tips~ + 10.1. Is it possible to stop R from within Vim?~ Sorry, it is not possible. You have to press ^C into R's terminal emulator. @@ -1659,6 +1671,7 @@ file. ============================================================================== + *r-plugin-conque* 11. Integration with the Conque Shell plugin~ In addition to being integrated with the screen.vim plugin the Vim-R-plugin @@ -1742,9 +1755,10 @@ the R syntax highlighted. ============================================================================== -12. News~ *r-plugin-news* +12. News~ +111112 (2011-11-12) * Changed key binding for commenting/uncommenting code from \cc to \xx. * Added function SendChunkToR() and its corresponding key bindings: \cc, \ce, \cd and \ca (thanks to Xavier Fernández i Marín for suggesting From 4b81d7636a21faaa36805c2727f6b8a78ff14706 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 12 Nov 2011 20:17:24 -0300 Subject: [PATCH 0075/1050] Move vim-stylesheet.css to /tmp directory. --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 5955f1b..de8b8f3 100644 --- a/Makefile +++ b/Makefile @@ -231,7 +231,8 @@ deb: htmldoc: (cd doc ;\ $(VIM2HTML) tags r-plugin.txt ;\ - mv r-plugin.html /tmp ) + sed -i -e 's///' r-plugin.html ;\ + mv r-plugin.html vim-stylesheet.css /tmp ) all: zip deb htmldoc From da4471e8cd9cf2acae2588656f9e0dd932c13aae Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sun, 13 Nov 2011 11:24:47 -0300 Subject: [PATCH 0076/1050] New transitional option: vimrplugin_gvimtmux. The Vim-R-plugin still depends on GNU Screen because it is used to run R in an external terminal emulator from within GVim. Now the code to use Tmux instead of GNU Screen is written and might be activated by putting in the vimrc: let vimrplugin_gvimtmux = 1 --- doc/r-plugin.txt | 13 ++++--- r-plugin/common_global.vim | 72 +++++++++++++++++++++++++++++--------- 2 files changed, 63 insertions(+), 22 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 88f0e61..120cf6f 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -5,7 +5,7 @@ Authors: Jakson A. Aquino Jose Claudio Faria -Version: 111112 +Version: 111113 For Vim version 7.3 1. Overview |r-plugin-overview| @@ -83,9 +83,9 @@ to deal with. *r-plugin-installation* 3. Installation~ -The installation instructions are split in three sections: (1) general +The installation instructions are split in four sections: (1) general instructions for all operating systems; (2) instructions that are specific for -Unix/Linux, OS X or Windows; and (3) troubleshooting. +either Unix/Linux/OSX or Windows; (3) troubleshooting; and (4) optional steps. 3.1. General instructions I~ @@ -230,7 +230,7 @@ read them? Type the command |:messages| in Normal mode to see them again. Are you using Debian, Ubuntu or other Debian based Linux distribution? If yes, you may prefer to install the Debian package available at: - https://sites.google.com/site/jalvesaq/vimrplugin + http://www.lepem.ufc.br/jaa/vim-r-plugin.html 3.4. General instructions II (optional steps)~ @@ -1758,7 +1758,7 @@ the R syntax highlighted. *r-plugin-news* 12. News~ -111112 (2011-11-12) +111113 (2011-11-13) * Changed key binding for commenting/uncommenting code from \cc to \xx. * Added function SendChunkToR() and its corresponding key bindings: \cc, \ce, \cd and \ca (thanks to Xavier Fernández i Marín for suggesting @@ -1766,6 +1766,9 @@ the R syntax highlighted. * New option (vimrplugin_ca_ck) was created to fix bug reported by Xavier Fernández i Marín: spurious ^A^K being added to lines sent to R. * Don't blink the menu and toolbar buttons when doing omni completion. + * New experimental feature: when running GVim, run external terminal emulator + using Tmux instead of GNU Screen. The option is activated by + vimrplugin_gvimtmux. 111014 (2011-10-14) * Fixed spell check bug in R documentation files (.Rd). diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 229f0d2..2cec919 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -17,7 +17,7 @@ " " Based on previous work by Johannes Ranke " -" Last Change: Fri Nov 11, 2011 12:11AM +" Last Change: Sun Nov 13, 2011 11:14AM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -481,16 +481,38 @@ function StartR(whatr) set noautochdir endif else - if g:vimrplugin_noscreenrc == 1 - let scrrc = " " - else - let scrrc = RWriteScreenRC() - endif - " Some terminals want quotes (see screen.vim) - if g:rplugin_termcmd =~ "gnome-terminal" || g:rplugin_termcmd =~ "xfce4-terminal" || g:rplugin_termcmd =~ "iterm" - let opencmd = printf("%s 'screen %s -d -RR -S %s %s' &", g:rplugin_termcmd, scrrc, b:screensname, rcmd) + if g:vimrplugin_tmux + if g:vimrplugin_notmuxconf + let tmxcnf = " " + else + let tmxcnf = "-f " . g:rplugin_home . "/r-plugin/tmux.conf" + endif + call system("tmux has-session -t" . b:screensname) + if v:shell_error + if g:rplugin_termcmd =~ "gnome-terminal" || g:rplugin_termcmd =~ "xfce4-terminal" || g:rplugin_termcmd =~ "iterm" + let opencmd = printf("%s 'tmux %s new-session -s %s \"%s\"' &", g:rplugin_termcmd, tmxcnf, b:screensname, rcmd) + else + let opencmd = printf("%s tmux %s new-session -s %s \"%s\" &", g:rplugin_termcmd, tmxcnf, b:screensname, rcmd) + endif + else + if g:rplugin_termcmd =~ "gnome-terminal" || g:rplugin_termcmd =~ "xfce4-terminal" || g:rplugin_termcmd =~ "iterm" + let opencmd = printf("%s 'tmux %s attach-session -d -t %s' &", g:rplugin_termcmd, tmxcnf, b:screensname) + else + let opencmd = printf("%s tmux %s attach-session -d -t %s &", g:rplugin_termcmd, tmxcnf, b:screensname) + endif + endif else - let opencmd = printf("%s screen %s -d -RR -S %s %s &", g:rplugin_termcmd, scrrc, b:screensname, rcmd) + if g:vimrplugin_noscreenrc == 1 + let scrrc = " " + else + let scrrc = RWriteScreenRC() + endif + " Some terminals want quotes (see screen.vim) + if g:rplugin_termcmd =~ "gnome-terminal" || g:rplugin_termcmd =~ "xfce4-terminal" || g:rplugin_termcmd =~ "iterm" + let opencmd = printf("%s 'screen %s -d -RR -S %s %s' &", g:rplugin_termcmd, scrrc, b:screensname, rcmd) + else + let opencmd = printf("%s screen %s -d -RR -S %s %s &", g:rplugin_termcmd, scrrc, b:screensname, rcmd) + endif endif let rlog = system(opencmd) if v:shell_error @@ -733,13 +755,24 @@ function SendCmdToR(cmd) " Send the command to R running in an external terminal emulator let str = substitute(cmd, "'", "'\\\\''", "g") - let scmd = 'screen -S ' . b:screensname . " -X stuff '" . str . "\'" - let rlog = system(scmd) - if v:shell_error - let rlog = substitute(rlog, '\n', ' ', 'g') - let rlog = substitute(rlog, '\r', ' ', 'g') - call RWarningMsg(rlog) - return 0 + if g:vimrplugin_tmux + let tcmd = 'tmux send-keys -t ' . b:screensname . " '" . str . "\'" + let rlog = system(tcmd) + if v:shell_error + let rlog = substitute(rlog, '\n', ' ', 'g') + let rlog = substitute(rlog, '\r', ' ', 'g') + call RWarningMsg(rlog) + return 0 + endif + else + let scmd = 'screen -S ' . b:screensname . " -X stuff '" . str . "\'" + let rlog = system(scmd) + if v:shell_error + let rlog = substitute(rlog, '\n', ' ', 'g') + let rlog = substitute(rlog, '\r', ' ', 'g') + call RWarningMsg(rlog) + return 0 + endif endif return 1 endfunction @@ -2064,6 +2097,7 @@ else endif " Variables whose default value is fixed +call RSetDefaultValue("g:vimrplugin_gvimtmux", 0) call RSetDefaultValue("g:vimrplugin_map_r", 0) call RSetDefaultValue("g:vimrplugin_open_df", 1) call RSetDefaultValue("g:vimrplugin_open_list", 0) @@ -2171,6 +2205,10 @@ else let g:vimrplugin_tmux = 0 endif +if g:vimrplugin_gvimtmux + let g:vimrplugin_tmux = 1 +endif + if g:vimrplugin_screenplugin " Future: Remove this Tmux version test on 2014 if g:vimrplugin_tmux From 33b22343a93fa4eb1a20673d77e8ac0487df0cdb Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sun, 13 Nov 2011 15:20:27 -0300 Subject: [PATCH 0077/1050] Send correctly non ascii letters to R (GVim+Tmux). --- r-plugin/common_global.vim | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 2cec919..a57dc9e 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -17,7 +17,7 @@ " " Based on previous work by Johannes Ranke " -" Last Change: Sun Nov 13, 2011 11:14AM +" Last Change: Sun Nov 13, 2011 03:12PM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -756,7 +756,15 @@ function SendCmdToR(cmd) " Send the command to R running in an external terminal emulator let str = substitute(cmd, "'", "'\\\\''", "g") if g:vimrplugin_tmux - let tcmd = 'tmux send-keys -t ' . b:screensname . " '" . str . "\'" + let tcmd = "tmux set-buffer '" . str . "\'" + let rlog = system(tcmd) + if v:shell_error + let rlog = substitute(rlog, '\n', ' ', 'g') + let rlog = substitute(rlog, '\r', ' ', 'g') + call RWarningMsg(rlog) + return 0 + endif + let tcmd = 'tmux paste-buffer -t ' . b:screensname let rlog = system(tcmd) if v:shell_error let rlog = substitute(rlog, '\n', ' ', 'g') From 7fd5b1ce05fae96acf0a6dd93bc763b0608a3d88 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sun, 13 Nov 2011 19:57:18 -0300 Subject: [PATCH 0078/1050] Simplify the code of SendCmdToR function. --- r-plugin/common_global.vim | 33 +++++++++------------------------ 1 file changed, 9 insertions(+), 24 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index a57dc9e..099af22 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -17,7 +17,7 @@ " " Based on previous work by Johannes Ranke " -" Last Change: Sun Nov 13, 2011 03:12PM +" Last Change: Sun Nov 13, 2011 07:54PM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -756,31 +756,16 @@ function SendCmdToR(cmd) " Send the command to R running in an external terminal emulator let str = substitute(cmd, "'", "'\\\\''", "g") if g:vimrplugin_tmux - let tcmd = "tmux set-buffer '" . str . "\'" - let rlog = system(tcmd) - if v:shell_error - let rlog = substitute(rlog, '\n', ' ', 'g') - let rlog = substitute(rlog, '\r', ' ', 'g') - call RWarningMsg(rlog) - return 0 - endif - let tcmd = 'tmux paste-buffer -t ' . b:screensname - let rlog = system(tcmd) - if v:shell_error - let rlog = substitute(rlog, '\n', ' ', 'g') - let rlog = substitute(rlog, '\r', ' ', 'g') - call RWarningMsg(rlog) - return 0 - endif + let scmd = "tmux set-buffer '" . str . "\' && tmux paste-buffer -t " . b:screensname else let scmd = 'screen -S ' . b:screensname . " -X stuff '" . str . "\'" - let rlog = system(scmd) - if v:shell_error - let rlog = substitute(rlog, '\n', ' ', 'g') - let rlog = substitute(rlog, '\r', ' ', 'g') - call RWarningMsg(rlog) - return 0 - endif + endif + let rlog = system(scmd) + if v:shell_error + let rlog = substitute(rlog, '\n', ' ', 'g') + let rlog = substitute(rlog, '\r', ' ', 'g') + call RWarningMsg(rlog) + return 0 endif return 1 endfunction From 1666b49cb7c40c3531f02dd205b0c9ae9114bad6 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sun, 13 Nov 2011 20:27:59 -0300 Subject: [PATCH 0079/1050] Tips for Tmux in copy mode behaving more like Vi. --- r-plugin/tmux.conf | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/r-plugin/tmux.conf b/r-plugin/tmux.conf index 442594e..9d006eb 100644 --- a/r-plugin/tmux.conf +++ b/r-plugin/tmux.conf @@ -5,6 +5,12 @@ bind-key C-a send-prefix # changing the mode-keys to vi set-window-option -g mode-keys vi +# unbind [ +# bind Escape copy-mode +# unbind p +# bind p paste-buffer +# bind-key -t vi-copy 'v' begin-selection +# bind-key -t vi-copy 'y' copy-selection # Disable the status bar set -g status off From 32d511f376d2d1854f16809618acfe93281008cc Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sun, 13 Nov 2011 22:51:18 -0300 Subject: [PATCH 0080/1050] Fix vim-addon registry. --- Makefile | 94 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 47 insertions(+), 47 deletions(-) diff --git a/Makefile b/Makefile index de8b8f3..60aefa9 100644 --- a/Makefile +++ b/Makefile @@ -100,53 +100,53 @@ deb: " | gzip --best > /tmp/vim-r-plugin-tmp/usr/share/doc/vim-r-plugin/changelog.gz # Create the yaml script echo "addon: r-plugin\n\ - description: \"Filetype plugin to work with R\"\n\ - disabledby: \"let disable_r_ftplugin = 1\"\n\ - files:\n\ - - autoload/rcomplete.vim\n\ - - bitmaps/RClose.png\n\ - - bitmaps/RClear.png\n\ - - bitmaps/RClearAll.png\n\ - - bitmaps/RListSpace.png\n\ - - bitmaps/RSendBlock.png\n\ - - bitmaps/RSendFile.png\n\ - - bitmaps/RSendFunction.png\n\ - - bitmaps/RSendLine.png\n\ - - bitmaps/RSendParagraph.png\n\ - - bitmaps/RSendSelection.png\n\ - - bitmaps/RStart.png\n\ - - bitmaps/ricon.png\n\ - - bitmaps/ricon.xbm\n\ - - doc/r-plugin.txt\n\ - - ftdetect/r.vim\n\ - - ftplugin/r.vim\n\ - - ftplugin/rbrowser.vim\n\ - - ftplugin/rdoc.vim\n\ - - ftplugin/rhelp.vim\n\ - - ftplugin/rnoweb.vim\n\ - - indent/r.vim\n\ - - indent/rnoweb.vim\n\ - - indent/rhelp.vim\n\ - - r-plugin/build_omniList.R\n\ - - r-plugin/common_buffer.vim\n\ - - r-plugin/common_global.vim\n\ - - r-plugin/etags2ctags.R\n\ - - r-plugin/global_r_plugin.vim\n\ - - r-plugin/specialfuns.R\n\ - - r-plugin/tex_indent.vim\n\ - - r-plugin/tmux.conf\n\ - - r-plugin/screenrc\n\ - - r-plugin/screenrc.xterm\n\ - - r-plugin/vimbrowser.R\n\ - - r-plugin/vimhelp.R\n\ - - r-plugin/vimprint.R\n\ - - r-plugin/vimSweave.R\n\ - - syntax/r.vim\n\ - - syntax/rdoc.vim\n\ - - syntax/rout.vim\n\ - - syntax/rhelp.vim\n\ - - syntax/rbrowser.vim\n\ - " > /tmp/vim-r-plugin-tmp/usr/share/vim/registry/vim-r-plugin.yaml + description: \"Filetype plugin to work with R\"\n\ + disabledby: \"let disable_r_ftplugin = 1\"\n\ + files:\n\ + - autoload/rcomplete.vim\n\ + - bitmaps/RClose.png\n\ + - bitmaps/RClear.png\n\ + - bitmaps/RClearAll.png\n\ + - bitmaps/RListSpace.png\n\ + - bitmaps/RSendBlock.png\n\ + - bitmaps/RSendFile.png\n\ + - bitmaps/RSendFunction.png\n\ + - bitmaps/RSendLine.png\n\ + - bitmaps/RSendParagraph.png\n\ + - bitmaps/RSendSelection.png\n\ + - bitmaps/RStart.png\n\ + - bitmaps/ricon.png\n\ + - bitmaps/ricon.xbm\n\ + - doc/r-plugin.txt\n\ + - ftdetect/r.vim\n\ + - ftplugin/r.vim\n\ + - ftplugin/rbrowser.vim\n\ + - ftplugin/rdoc.vim\n\ + - ftplugin/rhelp.vim\n\ + - ftplugin/rnoweb.vim\n\ + - indent/r.vim\n\ + - indent/rnoweb.vim\n\ + - indent/rhelp.vim\n\ + - r-plugin/build_omniList.R\n\ + - r-plugin/common_buffer.vim\n\ + - r-plugin/common_global.vim\n\ + - r-plugin/etags2ctags.R\n\ + - r-plugin/global_r_plugin.vim\n\ + - r-plugin/specialfuns.R\n\ + - r-plugin/tex_indent.vim\n\ + - r-plugin/tmux.conf\n\ + - r-plugin/screenrc\n\ + - r-plugin/screenrc.xterm\n\ + - r-plugin/vimbrowser.R\n\ + - r-plugin/vimhelp.R\n\ + - r-plugin/vimprint.R\n\ + - r-plugin/vimSweave.R\n\ + - syntax/r.vim\n\ + - syntax/rdoc.vim\n\ + - syntax/rout.vim\n\ + - syntax/rhelp.vim\n\ + - syntax/rbrowser.vim\n\ + " > /tmp/vim-r-plugin-tmp/usr/share/vim/registry/vim-r-plugin.yaml # Create the copyright echo "Copyright (C) 2011 Jakson Aquino\n\ \n\ From 09dff4a7545c368effd9b52ad654b36b75ceefc6 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Mon, 14 Nov 2011 00:44:05 -0300 Subject: [PATCH 0081/1050] Use Tmux to run R in an external terminal. --- doc/r-plugin.txt | 91 +++++++++++++++++++------------------- r-plugin/common_global.vim | 51 ++++++++++----------- 2 files changed, 68 insertions(+), 74 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 120cf6f..fc70527 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -121,37 +121,38 @@ In addition to having R installed in your system, this plugin requires users to install: Tmux >= 1.3: http://tmux.sourceforge.net - GNU Screen: http://www.gnu.org/s/screen screen.vim plugin: http://www.vim.org/scripts/script.php?script_id=2711 ncurses-term: http://invisible-island.net/ncurses - Note: Tmux, GNU Screen and ncurses-term are already packaged for most - GNU/Linux distributions and other Unix variants. The library ncurses-term - is necessary only for 256 color support in the terminal emulator. + Note: Tmux and ncurses-term are already packaged for most GNU/Linux + distributions and other Unix variants. The library ncurses-term is + necessary only for 256 color support in the terminal emulator. Unfortunately their installation instructions vary widely and are beyond the scope of this documentation. If you are using Vim (not GVim), the plugin will run inside a Tmux session. If -are not already a user of Tmux, please, read the |r-plugin-tmux| section to -learn a few useful shortcuts. The tmux.conf file that ships with this plugin -sets Tmux to work with vi key bindings. +you are not already a user of Tmux, please, read the |r-plugin-tmux| section +to learn a few useful shortcuts. The tmux.conf file that ships with this +plugin sets Tmux to work with Vi key bindings. Note: The plugin can use different mechanisms to send commands to R. The mechanism that will be used depends on both what applications and plugins you have installed and what options you have in your |vimrc|. The two lists below show how the plugin will work on Linux in different conditions: - Vim Condition + Vim Condition~ ------------------------------ ------------------------------------- Screen plugin (Tmux) default on Linux Screen plugin (GNU Screen) vimrplugin_tmux = 0 or Tmux not found - GNU Screen (external terminal) vimrplugin_screenplugin = 0 + Tmux (external terminal) vimrplugin_screenplugin = 0 + GNU Screen (external terminal) vimrplugin_screenplugin = 0 and no Tmux Conque Shell idem and vimrplugin_conqueplugin = 1 - GVim Condition + GVim Condition~ ------------------------------ ------------------------------------- - GNU Screen (external terminal) default on Linux + Tmux (external terminal) default on Linux + GNU Screen (external terminal) vimrplugin_tmux = 0 or Tmux not found Conque Shell vimrplugin_conqueplugin = 1 @@ -603,8 +604,8 @@ A sample detachable session could be: *r-plugin-screen* When running Vim in a terminal emulator (Linux/Unix only), the Vim-R-plugin will use the screen.vim plugin to restart Vim and start R in a Tmux session. -However, the plugin will use GNU Screen if Tmux is not installed or you have -set the value of vimrplugin_tmux = 0 in your |vimrc|. +However, the plugin will use GNU Screen if Tmux is not installed or if you +have set the value of vimrplugin_tmux = 0 in your |vimrc|. You may want to create your own ~/.screenrc to customize GNU Screen behavior. The Vim-R-plugin comes with a sample screenrc (at r-plugin directory) that you @@ -653,26 +654,25 @@ directory and, thus, is deleted after each reboot. The other file is stored in command: |:RUpdateObjList|. -5.2. Communication through screen, without the screen plugin (Linux/Unix only)~ +5.2. Communication through Tmux, without the screen plugin (Linux/Unix only)~ Vim and R run as independent processes. The main disadvantage is that we have limited communication between the two applications: Vim can send strings to R -through GNU Screen and R can write files to be read by Vim. That's all. The main +through Tmux and R can write files to be read by Vim. That's all. The main advantage is that Vim's or the plugin's bugs will not affect R. If the screen.vim plugin is not installed or if you are using GVim, the -Vim-R-plugin uses GNU Screen to communicate with R. First, the plugin -initiates a new GNU Screen session and uses this to start a new R process. -The plugin's menu options, toolbar buttons and key bindings can then be used -to communicate with the newly started R process. The plugin sends commands to -R through GNU Screen. By default, all Vim buffers share the same R process, -but it is also possible to configure Vim so that each buffer runs its own -instance of R in a separate terminal emulator. In this case, the GNU Screen -sessions have unique names. The names are made using the user name and the -seconds of localtime(). Hence, a name clash is possible if a single user -starts more than one Vim buffer at the same second. To change the default -behavior and force all Vim buffers to use different R processes see -|vimrplugin_single_r|. +Vim-R-plugin uses Tmux to communicate with R. First, the plugin initiates a +new Tmux session and uses this to start a new R process. The plugin's menu +options, toolbar buttons and key bindings can then be used to communicate with +the newly started R process. The plugin sends commands to R through Tmux. By +default, all Vim buffers share the same R process, but it is also possible to +configure Vim so that each buffer runs its own instance of R in a separate +terminal emulator. In this case, the Tmux sessions have unique names. The +names are made using the user name and the seconds of localtime(). Hence, a +name clash is possible if a single user starts more than one Vim buffer at the +same second. To change the default behavior and force all Vim buffers to use +different R processes see |vimrplugin_single_r|. ============================================================================== @@ -926,7 +926,7 @@ code to other R processes then put the following in your |vimrc|: > The |vimrplugin_by_vim_instance| option requires that Vim is acting as a command server because the variable |v:servername| is used to make the name of -the GNU Screen session which will run R. By default, GVim runs as server, but Vim +the Tmux session which will run R. By default, GVim runs as server, but Vim does not. Hence, if you are using Vim you have either to start Vim with the argument --servername or use the screen.vim plugin which tries to restart Vim with the --servername argument. If you want to use more than nine GVim @@ -1034,24 +1034,24 @@ example show how to adjust the value of sleeptime in your |vimrc|: 7.14. Tmux and Screen configuration (Linux/Unix only)~ *vimrplugin_noscreenrc* *vimrplugin_notmuxconf* -GVim (or Vim running R in an external terminal emulator) runs GNU Screen with -a specially built configuration file. If you want to use your own ~/.screenrc, +GVim (or Vim running R in an external terminal emulator) runs Tmux with a +specially built configuration file. If you want to use your own ~/.tmux.conf, put in your |vimrc|: > - let vimrplugin_noscreenrc = 1 + let vimrplugin_notmuxconf = 1 < -If you want to use your own ~/.tmux.conf, put in your vimrc: +If you want to use your own ~/.screenrc, put in your vimrc: > - let vimrplugin_notmuxconf = 1 + let vimrplugin_noscreenrc = 1 < 7.15. Integration with screen.vim plugin (Linux/Unix only)~ *vimrplugin_screenplugin* *vimrplugin_screenvsplit* *vimrplugin_tmux* -The screen.vim plugin supports both screen and Tmux, but only Tmux allows you -to split the terminal vertically (that is, to have the panels side by side). -Please read |screen-intro| and |screen-shell-vertical| for details. By +The screen.vim plugin supports both GNU Screen and Tmux, but only Tmux allows +you to split the terminal vertically (that is, to have the panels side by +side). Please read |screen-intro| and |screen-shell-vertical| for details. By default, the Vim-R-plugin will tell the screen.vim plugin to split the terminal horizontally. If you prefer to split it vertically put in your |vimrc|: @@ -1061,9 +1061,9 @@ terminal horizontally. If you prefer to split it vertically put in your < By default, when running in a terminal emulator, the Vim-R-plugin uses the screen.vim plugin if it is installed and, by default, it will use Tmux instead -of GNU Screen. Tmux was chosen as default because it may be split vertically -and its regions are easier to resize. If both GNU Screen and Tmux are -installed but you prefer to use the GNU Screen application, put in your +of GNU Screen. Tmux was chosen as default because it may split the terminal +vertically and its regions are easier to resize. If both GNU Screen and Tmux +are installed but you prefer to use the GNU Screen application, put in your |vimrc|: > let vimrplugin_tmux = 0 @@ -1163,9 +1163,10 @@ Emacs: *vimrplugin_ca_ck* When one types in the R Console the cursor goes to the beginning of the line and one types the characters to the right of the cursor are -deleted. Sending may be problematic if using GNU Screen in some systems -and may cause incomplete output when using the Conque Shell plugin. The -Vim-R-plugin will add to every command if you put in your |vimrc|: +deleted. Sending may be problematic if using either Tmux or GNU Screen +in some systems and may cause incomplete output when using the Conque Shell +plugin. The Vim-R-plugin will add to every command if you put in +your |vimrc|: > let vimrplugin_ca_ck = 1 < @@ -1758,7 +1759,7 @@ the R syntax highlighted. *r-plugin-news* 12. News~ -111113 (2011-11-13) +111114 (2011-11-14) * Changed key binding for commenting/uncommenting code from \cc to \xx. * Added function SendChunkToR() and its corresponding key bindings: \cc, \ce, \cd and \ca (thanks to Xavier Fernández i Marín for suggesting @@ -1766,9 +1767,7 @@ the R syntax highlighted. * New option (vimrplugin_ca_ck) was created to fix bug reported by Xavier Fernández i Marín: spurious ^A^K being added to lines sent to R. * Don't blink the menu and toolbar buttons when doing omni completion. - * New experimental feature: when running GVim, run external terminal emulator - using Tmux instead of GNU Screen. The option is activated by - vimrplugin_gvimtmux. + * Use Tmux to run R in an external terminal emulator. 111014 (2011-10-14) * Fixed spell check bug in R documentation files (.Rd). diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 099af22..b2f696f 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -17,7 +17,7 @@ " " Based on previous work by Johannes Ranke " -" Last Change: Sun Nov 13, 2011 07:54PM +" Last Change: Mon Nov 14, 2011 12:31AM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -2090,7 +2090,6 @@ else endif " Variables whose default value is fixed -call RSetDefaultValue("g:vimrplugin_gvimtmux", 0) call RSetDefaultValue("g:vimrplugin_map_r", 0) call RSetDefaultValue("g:vimrplugin_open_df", 1) call RSetDefaultValue("g:vimrplugin_open_list", 0) @@ -2133,9 +2132,11 @@ endif if g:vimrplugin_applescript == 0 call RSetDefaultValue("g:vimrplugin_screenplugin", 1) + call RSetDefaultValue("g:vimrplugin_tmux", 1) else let g:vimrplugin_screenplugin = 0 let g:vimrplugin_conqueplugin = 0 + let g:vimrplugin_tmux = 0 if isdirectory("/Applications/R64.app") let g:rplugin_r64app = 1 else @@ -2146,16 +2147,35 @@ endif " The screen.vim plugin only works on terminal emulators if has('gui_running') let g:vimrplugin_screenplugin = 0 - let g:vimrplugin_tmux = 0 endif if has("gui_win32") call RSetDefaultValue("g:vimrplugin_conquesleep", 200) let vimrplugin_screenplugin = 0 + let vimrplugin_tmux = 0 else call RSetDefaultValue("g:vimrplugin_conquesleep", 100) endif +if g:vimrplugin_applescript == 0 && !has("gui_win32") + let s:hastmux = executable('tmux') + let s:hasscreen = executable('screen') + if s:hastmux == 0 && s:hasscreen == 0 + call RWarningMsgInp("Please, install the 'Tmux' application to enable the Vim-R-plugin.") + let g:rplugin_failed = 1 + finish + endif + if s:hastmux == 0 && s:hasscreen == 1 + let g:vimrplugin_tmux = 0 + endif + if g:vimrplugin_tmux == 0 && s:hasscreen == 0 + call RWarningMsgInp("The value of vimrplugin_tmux = 0 but the GNU Screen application was not found.") + let g:rplugin_failed = 1 + finish + endif +endif + + if g:vimrplugin_screenplugin let g:vimrplugin_conqueplugin = 0 if !exists("g:ScreenVersion") @@ -2163,13 +2183,6 @@ if g:vimrplugin_screenplugin let g:rplugin_failed = 1 finish endif - if !exists("g:vimrplugin_tmux") - if executable('tmux') - let g:vimrplugin_tmux = 1 - else - let g:vimrplugin_tmux = 0 - endif - endif " To get 256 colors you have to set the $TERM environment variable to " xterm-256color. See :h r-plugin-tips @@ -2193,13 +2206,6 @@ if g:vimrplugin_screenplugin endif endif endif - -else - let g:vimrplugin_tmux = 0 -endif - -if g:vimrplugin_gvimtmux - let g:vimrplugin_tmux = 1 endif if g:vimrplugin_screenplugin @@ -2333,17 +2339,6 @@ if has("gui_win32") let g:vimrplugin_sleeptime = 0.02 endif else - if g:vimrplugin_applescript == 0 && (has("gui_running") || (!has("gui_running") && (g:vimrplugin_tmux == 0 || g:vimrplugin_screenplugin == 0))) && !executable('screen') - let rplugin_missing_screen = 1 - if has("gui_running") - call RWarningMsgInp("Please, install the 'GNU Screen' application to enable the Vim-R-plugin with GVim.") - else - call RWarningMsgInp("Please, install the 'GNU Screen' application to enable the Vim-R-plugin.") - endif - let g:rplugin_failed = 1 - finish - endif - if exists("g:vimrplugin_r_path") let g:rplugin_R = g:vimrplugin_r_path . "/R" else From 7ab20b0d4fc69f491ae18dee944a0474cc259440 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Mon, 14 Nov 2011 09:45:48 -0300 Subject: [PATCH 0082/1050] Debian package no longer depends on GNU Screen. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 60aefa9..502094f 100644 --- a/Makefile +++ b/Makefile @@ -187,7 +187,7 @@ deb: Architecture: all\n\ Maintainer: Jakson Alves de Aquino \n\ Installed-Size: $(INSTALLEDSIZE)\n\ - Depends: vim | vim-gtk | vim-gnome, screen, tmux (>= 1.5), ncurses-term, vim-addon-manager, r-base-core\n\ + Depends: vim | vim-gtk | vim-gnome, tmux (>= 1.5), ncurses-term, vim-addon-manager, r-base-core\n\ Enhances: vim\n\ Section: text\n\ Priority: extra\n\ From 4750355b75f65862abb438b5d17cb66c6d741dda Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Mon, 14 Nov 2011 09:47:24 -0300 Subject: [PATCH 0083/1050] Version 111114. --- doc/r-plugin.txt | 4 ++-- r-plugin/common_global.vim | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index fc70527..4bb9d10 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -5,7 +5,7 @@ Authors: Jakson A. Aquino Jose Claudio Faria -Version: 111113 +Version: 111114 For Vim version 7.3 1. Overview |r-plugin-overview| @@ -153,7 +153,7 @@ show how the plugin will work on Linux in different conditions: ------------------------------ ------------------------------------- Tmux (external terminal) default on Linux GNU Screen (external terminal) vimrplugin_tmux = 0 or Tmux not found - Conque Shell vimrplugin_conqueplugin = 1 + Conque Shell idem and vimrplugin_conqueplugin = 1 Note: On Mac OS X the plugin will use AppleScript in both Vim and GVim unless diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index b2f696f..ff193a5 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -17,7 +17,7 @@ " " Based on previous work by Johannes Ranke " -" Last Change: Mon Nov 14, 2011 12:31AM +" Last Change: Mon Nov 14, 2011 12:53AM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -2160,7 +2160,7 @@ endif if g:vimrplugin_applescript == 0 && !has("gui_win32") let s:hastmux = executable('tmux') let s:hasscreen = executable('screen') - if s:hastmux == 0 && s:hasscreen == 0 + if s:hastmux == 0 && s:hasscreen == 0 && g:vimrplugin_conqueplugin == 0 call RWarningMsgInp("Please, install the 'Tmux' application to enable the Vim-R-plugin.") let g:rplugin_failed = 1 finish @@ -2168,7 +2168,7 @@ if g:vimrplugin_applescript == 0 && !has("gui_win32") if s:hastmux == 0 && s:hasscreen == 1 let g:vimrplugin_tmux = 0 endif - if g:vimrplugin_tmux == 0 && s:hasscreen == 0 + if g:vimrplugin_tmux == 0 && s:hasscreen == 0 && g:vimrplugin_conqueplugin == 0 call RWarningMsgInp("The value of vimrplugin_tmux = 0 but the GNU Screen application was not found.") let g:rplugin_failed = 1 finish From d127befafc3ed4e8cab5b47f50a821ea1e63467a Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 17 Nov 2011 12:39:10 -0300 Subject: [PATCH 0084/1050] Overwrite SendChunkToR() if already declared. --- ftplugin/rnoweb.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ftplugin/rnoweb.vim b/ftplugin/rnoweb.vim index b39c07f..8e1dd39 100644 --- a/ftplugin/rnoweb.vim +++ b/ftplugin/rnoweb.vim @@ -17,7 +17,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Thu Nov 10, 2011 11:58PM +" Last Change: Mon Nov 14, 2011 10:01PM "========================================================================== " Only do this when not yet done for this buffer @@ -138,7 +138,7 @@ function! RMakePDF(bibtex) endfunction " Send Sweave chunk to R -function SendChunkToR(e, m) +function! SendChunkToR(e, m) if RnwIsInRCode() == 0 call RWarningMsg("Not inside an R code chunk.") return From 471850a31c63752ff51031a397135b9e75c16cfc Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 17 Nov 2011 12:45:25 -0300 Subject: [PATCH 0085/1050] Be able to read R docs even on R console. --- doc/r-plugin.txt | 14 ++++++++------ ftplugin/rdoc.vim | 17 ++++++++++++++++- r-plugin/common_global.vim | 13 ++----------- 3 files changed, 26 insertions(+), 18 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 4bb9d10..9ccb263 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -876,6 +876,11 @@ If you do not want to see R documentation in a Vim's buffer, put in your > let vimrplugin_vimpager = "no" < +If you want to use Vim to see R documentation even when looking for help in +the R console, put in your .Rprofile: +> + options(pager = "vim -c 'set ft=rdoc' -") +< 7.4.2. Details and other options:~ @@ -1568,15 +1573,12 @@ options and some others: > if (interactive()) { local({ - options(editor = 'gvim -f -c "set ft=r"') + options(editor = "gvim -f -c 'set ft=r'") + options(pager = "vim -c 'set ft=rdoc' -") options(max.print = 999) - if(nchar(Sys.getenv("DISPLAY")) > 1){ - options(help_type = "html") + if(nchar(Sys.getenv("DISPLAY")) > 1) grDevices::X11.options(width = 4.5, height = 4, xpos = 1000, ypos = 0, pointsize = 10) - } else { - options(help_type = "text") - } }) } < diff --git a/ftplugin/rdoc.vim b/ftplugin/rdoc.vim index 031af52..202cb47 100644 --- a/ftplugin/rdoc.vim +++ b/ftplugin/rdoc.vim @@ -19,7 +19,7 @@ " " Based on previous work by Johannes Ranke " -" Last Change: Thu Nov 10, 2011 11:58PM +" Last Change: Thu Nov 17, 2011 12:41PM " " Please see doc/r-plugin.txt for usage details. "========================================================================== @@ -42,6 +42,19 @@ runtime r-plugin/common_global.vim " defined after the global ones: runtime r-plugin/common_buffer.vim +" Prepare R documentation output to be displayed by Vim +function FixRdoc() + let lnr = line("$") + for i in range(1, lnr) + call setline(i, substitute(getline(i), "_\010", "", "g")) + endfor + let has_ex = search("^Examples:$") + if has_ex + let lnr = line("$") + 1 + call setline(lnr, '###') + endif + normal! gg +endfunction "========================================================================== " Key bindings and menu items @@ -58,6 +71,8 @@ setlocal bufhidden=wipe setlocal noswapfile set buftype=nofile autocmd VimResized let g:vimrplugin_newsize = 1 +call FixRdoc() +autocmd FileType rdoc call FixRdoc() let &cpo = s:cpo_save unlet s:cpo_save diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index ff193a5..50a69c6 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -17,7 +17,7 @@ " " Based on previous work by Johannes Ranke " -" Last Change: Mon Nov 14, 2011 12:53AM +" Last Change: Thu Nov 17, 2011 12:21PM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -1423,7 +1423,6 @@ function ShowRDoc(rkeyword, package) endif endif - set filetype=rdoc setlocal modifiable let g:rplugin_curbuf = bufname("%") @@ -1440,15 +1439,7 @@ function ShowRDoc(rkeyword, package) normal! ggdG exe "read " . g:rplugin_docfile - let lnr = line("$") - for i in range(1, lnr) - call setline(i, substitute(getline(i), "_\010", "", "g")) - endfor - let has_ex = search("^Examples:$") - if has_ex - let lnr = line("$") + 1 - call setline(lnr, '###') - endif + set filetype=rdoc normal! ggdd setlocal nomodified setlocal nomodifiable From ffcb672779d010cc90ed31578c65276bf083c866 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 17 Nov 2011 13:16:24 -0300 Subject: [PATCH 0086/1050] Add "terminal" to the list of known terminals. --- doc/r-plugin.txt | 3 +++ r-plugin/common_global.vim | 10 +++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 9ccb263..55fc0a7 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -1761,6 +1761,9 @@ the R syntax highlighted. *r-plugin-news* 12. News~ + * Add "terminal" to the list of known terminal emulators (thanks for "i5m" + for the patch). + 111114 (2011-11-14) * Changed key binding for commenting/uncommenting code from \cc to \xx. * Added function SendChunkToR() and its corresponding key bindings: diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 50a69c6..269f551 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -489,13 +489,13 @@ function StartR(whatr) endif call system("tmux has-session -t" . b:screensname) if v:shell_error - if g:rplugin_termcmd =~ "gnome-terminal" || g:rplugin_termcmd =~ "xfce4-terminal" || g:rplugin_termcmd =~ "iterm" + if g:rplugin_termcmd =~ "gnome-terminal" || g:rplugin_termcmd =~ "xfce4-terminal" || g:rplugin_termcmd =~ "terminal" || g:rplugin_termcmd =~ "iterm" let opencmd = printf("%s 'tmux %s new-session -s %s \"%s\"' &", g:rplugin_termcmd, tmxcnf, b:screensname, rcmd) else let opencmd = printf("%s tmux %s new-session -s %s \"%s\" &", g:rplugin_termcmd, tmxcnf, b:screensname, rcmd) endif else - if g:rplugin_termcmd =~ "gnome-terminal" || g:rplugin_termcmd =~ "xfce4-terminal" || g:rplugin_termcmd =~ "iterm" + if g:rplugin_termcmd =~ "gnome-terminal" || g:rplugin_termcmd =~ "xfce4-terminal" || g:rplugin_termcmd =~ "terminal" || g:rplugin_termcmd =~ "iterm" let opencmd = printf("%s 'tmux %s attach-session -d -t %s' &", g:rplugin_termcmd, tmxcnf, b:screensname) else let opencmd = printf("%s tmux %s attach-session -d -t %s &", g:rplugin_termcmd, tmxcnf, b:screensname) @@ -508,7 +508,7 @@ function StartR(whatr) let scrrc = RWriteScreenRC() endif " Some terminals want quotes (see screen.vim) - if g:rplugin_termcmd =~ "gnome-terminal" || g:rplugin_termcmd =~ "xfce4-terminal" || g:rplugin_termcmd =~ "iterm" + if g:rplugin_termcmd =~ "gnome-terminal" || g:rplugin_termcmd =~ "xfce4-terminal" || g:rplugin_termcmd =~ "terminal"|| g:rplugin_termcmd =~ "iterm" let opencmd = printf("%s 'screen %s -d -RR -S %s %s' &", g:rplugin_termcmd, scrrc, b:screensname, rcmd) else let opencmd = printf("%s screen %s -d -RR -S %s %s &", g:rplugin_termcmd, scrrc, b:screensname, rcmd) @@ -2428,7 +2428,7 @@ if has("gui_win32") || vimrplugin_applescript " No external terminal emulator will be called, so any value is good let g:vimrplugin_term = "xterm" else - let s:terminals = ['gnome-terminal', 'konsole', 'xfce4-terminal', 'Eterm', 'rxvt', 'aterm', 'roxterm', 'xterm'] + let s:terminals = ['gnome-terminal', 'konsole', 'xfce4-terminal', 'terminal', 'Eterm', 'rxvt', 'aterm', 'roxterm', 'xterm'] if has('mac') let s:terminals = ['iTerm', 'Terminal.app'] + s:terminals endif @@ -2458,7 +2458,7 @@ endif let g:rplugin_termcmd = g:vimrplugin_term . " -e" -if g:vimrplugin_term == "gnome-terminal" || g:vimrplugin_term == "xfce4-terminal" +if g:vimrplugin_term == "gnome-terminal" || g:vimrplugin_term == "xfce4-terminal" || g:vimrplugin_term == "terminal" " Cannot set icon: http://bugzilla.gnome.org/show_bug.cgi?id=126081 let g:rplugin_termcmd = g:vimrplugin_term . " --working-directory='" . expand("%:p:h") . "' --title R -e" endif From f1fa851cfa75f0566827d04ed972cc783be3a833 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 19 Nov 2011 17:21:27 -0300 Subject: [PATCH 0087/1050] Enable 256 colors in Tmux called by GVim. --- r-plugin/common_global.vim | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 269f551..7be6fb3 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -17,7 +17,7 @@ " " Based on previous work by Johannes Ranke " -" Last Change: Thu Nov 17, 2011 12:21PM +" Last Change: Sat Nov 19, 2011 05:05PM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -490,15 +490,15 @@ function StartR(whatr) call system("tmux has-session -t" . b:screensname) if v:shell_error if g:rplugin_termcmd =~ "gnome-terminal" || g:rplugin_termcmd =~ "xfce4-terminal" || g:rplugin_termcmd =~ "terminal" || g:rplugin_termcmd =~ "iterm" - let opencmd = printf("%s 'tmux %s new-session -s %s \"%s\"' &", g:rplugin_termcmd, tmxcnf, b:screensname, rcmd) + let opencmd = printf("%s 'tmux -2 %s new-session -s %s \"%s\"' &", g:rplugin_termcmd, tmxcnf, b:screensname, rcmd) else - let opencmd = printf("%s tmux %s new-session -s %s \"%s\" &", g:rplugin_termcmd, tmxcnf, b:screensname, rcmd) + let opencmd = printf("%s tmux -2 %s new-session -s %s \"%s\" &", g:rplugin_termcmd, tmxcnf, b:screensname, rcmd) endif else if g:rplugin_termcmd =~ "gnome-terminal" || g:rplugin_termcmd =~ "xfce4-terminal" || g:rplugin_termcmd =~ "terminal" || g:rplugin_termcmd =~ "iterm" - let opencmd = printf("%s 'tmux %s attach-session -d -t %s' &", g:rplugin_termcmd, tmxcnf, b:screensname) + let opencmd = printf("%s 'tmux -2 %s attach-session -d -t %s' &", g:rplugin_termcmd, tmxcnf, b:screensname) else - let opencmd = printf("%s tmux %s attach-session -d -t %s &", g:rplugin_termcmd, tmxcnf, b:screensname) + let opencmd = printf("%s tmux -2 %s attach-session -d -t %s &", g:rplugin_termcmd, tmxcnf, b:screensname) endif endif else @@ -508,7 +508,7 @@ function StartR(whatr) let scrrc = RWriteScreenRC() endif " Some terminals want quotes (see screen.vim) - if g:rplugin_termcmd =~ "gnome-terminal" || g:rplugin_termcmd =~ "xfce4-terminal" || g:rplugin_termcmd =~ "terminal"|| g:rplugin_termcmd =~ "iterm" + if g:rplugin_termcmd =~ "gnome-terminal" || g:rplugin_termcmd =~ "xfce4-terminal" || g:rplugin_termcmd =~ "terminal" || g:rplugin_termcmd =~ "iterm" let opencmd = printf("%s 'screen %s -d -RR -S %s %s' &", g:rplugin_termcmd, scrrc, b:screensname, rcmd) else let opencmd = printf("%s screen %s -d -RR -S %s %s &", g:rplugin_termcmd, scrrc, b:screensname, rcmd) From 287286868a9887d17b1f319deea5e38da4128a18 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sun, 20 Nov 2011 18:38:32 -0300 Subject: [PATCH 0088/1050] Better highlighting for help.search output. --- syntax/rdoc.vim | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/syntax/rdoc.vim b/syntax/rdoc.vim index fc709b4..02100cf 100644 --- a/syntax/rdoc.vim +++ b/syntax/rdoc.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Test version of R documentation " Maintainer: Jakson A. Aquino -" Last Change: Wed Oct 20, 2010 01:04PM +" Last Change: Sun Nov 20, 2011 06:36PM if exists("b:current_syntax") finish @@ -15,6 +15,7 @@ if !exists("rdoc_maxlines") endif exec "syn sync minlines=" . rdoc_minlines . " maxlines=" . rdoc_maxlines + syn match rdocTitle "^[A-Z].*:" syn match rdocTitle "^\S.*R Documentation$" syn region rdocStringS start="‘" end="’" @@ -27,6 +28,11 @@ syn match rdocArg "^\s*\([a-z]\|[A-Z]\|[0-9]\|\.\)*: " syn include @rdocR syntax/r.vim syn region rdocExample matchgroup=rdocExTitle start="^Examples:$" matchgroup=rdocExEnd end='^###$' contains=@rdocR keepend +" When using vim as R pager to see the output of help.search(): +syn region rdocPackage start="^[A-Za-z]\S*::" end="[\s\r]" contains=rdocPackName,rdocFuncName transparent +syn match rdocPackName "^[A-Za-z][A-Za-z0-9\.]*" contained +syn match rdocFuncName "::[A-Za-z0-9\.\-]*" contained + " Define the default highlighting. hi def link rdocTitle Title hi def link rdocExTitle Title @@ -37,6 +43,8 @@ hi def link rdocURL HtmlLink hi def link rdocArg Special hi def link rdocNote Todo +hi def link rdocPackName Title +hi def link rdocFuncName Function let b:current_syntax = "rdoc" From 77c4c1359c8c74019d704a6db49d7eee02f2c48f Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sun, 20 Nov 2011 18:43:53 -0300 Subject: [PATCH 0089/1050] New style of version numbering. --- Makefile | 13 +++++-------- doc/r-plugin.txt | 4 +++- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 502094f..d098c65 100644 --- a/Makefile +++ b/Makefile @@ -22,9 +22,9 @@ PLUGINHOME=`pwd` -PLUGINVERSION=`date +%y%m%d` +PLUGINVERSION=1.0 DEBIANTIME=`date -R` -PLUGINDOCVERSION=`date +"%Y-%m-%d"` +PLUGINRELEASEDATE=`date +"%Y-%m-%d"` VIM2HTML=/usr/local/share/vim/vim73/doc/vim2html.pl zip: @@ -43,8 +43,9 @@ zip: mv omniList omniList.current ;\ cp functions.vim.vanilla functions.vim ;\ cp omniList.vanilla omniList ) - # Update the version date in doc/r-plugin.txt header - sed -i -e "s/Version: [0-9][0-9][0-9][0-9][0-9][0-9]/Version: $(PLUGINVERSION)/" doc/r-plugin.txt + # Update the version date in doc/r-plugin.txt header and in the news + sed -i -e "s/^Version: [0-9].[0-9]/Version: $(PLUGINVERSION)/" doc/r-plugin.txt + sed -i -e "s/^$(PLUGINVERSION) (201[0-9]-[0-9][0-9]-[0-9][0-9])/$(PLUGINVERSION) ($(PLUGINRELEASEDATE))/" doc/r-plugin.txt # Create a tar.gz file tar -cvzf /tmp/vimrplugintmpfile.tar.gz ftdetect/r.vim indent/r.vim \ indent/rnoweb.vim indent/rhelp.vim autoload/rcomplete.vim ftplugin/r*.vim \ @@ -78,10 +79,6 @@ zip: chmod +w r-plugin/tex_indent.vim ;\ rm -f /tmp/vim-r-plugin-$(PLUGINVERSION).zip ;\ zip -r /tmp/vim-r-plugin-$(PLUGINVERSION).zip . ) - # Warn if the date in the doc is outdated - -grep $(PLUGINDOCVERSION) doc/r-plugin.txt > /tmp/docdateok - if [ "x`cat /tmp/docdateok`" = "x" ] ; then echo "\033[31mYou must update the version date in r-plugin.txt\033[0m" ; fi - rm /tmp/docdateok deb: # Clean previously created files diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 55fc0a7..5965ce7 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -5,7 +5,7 @@ Authors: Jakson A. Aquino Jose Claudio Faria -Version: 111114 +Version: 1.0 For Vim version 7.3 1. Overview |r-plugin-overview| @@ -1761,6 +1761,8 @@ the R syntax highlighted. *r-plugin-news* 12. News~ +1.0 (2011-11-20) + * Add "terminal" to the list of known terminal emulators (thanks for "i5m" for the patch). From cea6d2ea9ac381bda066d0d9aae404eb43e1c898 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Mon, 21 Nov 2011 08:56:34 -0300 Subject: [PATCH 0090/1050] Add ! to FixRdoc() to avoid E122. --- ftplugin/rdoc.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ftplugin/rdoc.vim b/ftplugin/rdoc.vim index 202cb47..762c32b 100644 --- a/ftplugin/rdoc.vim +++ b/ftplugin/rdoc.vim @@ -19,7 +19,7 @@ " " Based on previous work by Johannes Ranke " -" Last Change: Thu Nov 17, 2011 12:41PM +" Last Change: Mon Nov 21, 2011 08:55AM " " Please see doc/r-plugin.txt for usage details. "========================================================================== @@ -43,7 +43,7 @@ runtime r-plugin/common_global.vim runtime r-plugin/common_buffer.vim " Prepare R documentation output to be displayed by Vim -function FixRdoc() +function! FixRdoc() let lnr = line("$") for i in range(1, lnr) call setline(i, substitute(getline(i), "_\010", "", "g")) From 2f74b669b0934b6a5d8866bd1d294addc1e8216f Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Fri, 25 Nov 2011 09:07:58 -0300 Subject: [PATCH 0091/1050] Suggest the installation of R package 'colorout'. --- doc/r-plugin.txt | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 5965ce7..12d84e8 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -117,19 +117,26 @@ Note: If you are using Mac OS X and prefer that Vim uses AppleScript to send commands to R, then the installation is finished and you should now read sections 3.3 and 3.4. -In addition to having R installed in your system, this plugin requires users -to install: +In addition to having R installed in your system, this plugin has the +following dependencies: + + Depends:~ + Tmux >= 1.3: http://tmux.sourceforge.net + Screen plugin: http://www.vim.org/scripts/script.php?script_id=2711 - Tmux >= 1.3: http://tmux.sourceforge.net - screen.vim plugin: http://www.vim.org/scripts/script.php?script_id=2711 - ncurses-term: http://invisible-island.net/ncurses + Recommends:~ + ncurses-term: http://invisible-island.net/ncurses + colorout: An R package. Note: Tmux and ncurses-term are already packaged for most GNU/Linux distributions and other Unix variants. The library ncurses-term is necessary only for 256 color support in the terminal emulator. Unfortunately their installation instructions vary widely and are beyond - the scope of this documentation. - + the scope of this documentation. The colorout package colorizes the R + output and can be installed from within R: +> + install.packages("colorout") +< If you are using Vim (not GVim), the plugin will run inside a Tmux session. If you are not already a user of Tmux, please, read the |r-plugin-tmux| section to learn a few useful shortcuts. The tmux.conf file that ships with this @@ -1695,9 +1702,9 @@ important Vim limitations are: efficient. Vim uses the same variable, 'updatetime', to do both save swap files and trigger |CursorHold| events. -In spite of these problems, the use of Conque Shell already has some -advantages: the ability to edit R's output, and the syntax highlighting of the -output. If you want to try the Conque Shell, install it from +These limitations will be solved only if someone with good knowledge of C +programming writes patches to Vim source code. Anyway, if you want to try the +Conque Shell, install it from http://www.vim.org/scripts/script.php?script_id=2771 From e6e66c35113500c5e43675eab046034f697eb645 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Fri, 25 Nov 2011 19:56:31 -0300 Subject: [PATCH 0092/1050] Use to avoid the need of echon. --- ftplugin/rnoweb.vim | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/ftplugin/rnoweb.vim b/ftplugin/rnoweb.vim index 8e1dd39..047f350 100644 --- a/ftplugin/rnoweb.vim +++ b/ftplugin/rnoweb.vim @@ -17,7 +17,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Mon Nov 14, 2011 10:01PM +" Last Change: Fri Nov 25, 2011 04:20PM "========================================================================== " Only do this when not yet done for this buffer @@ -71,7 +71,6 @@ function! RnwIsInRCode() endfunction function! RnwPreviousChunk() range - echon let rg = range(a:firstline, a:lastline) let chunk = len(rg) for var in range(1, chunk) @@ -95,7 +94,6 @@ function! RnwPreviousChunk() range endfunction function! RnwNextChunk() range - echon let rg = range(a:firstline, a:lastline) let chunk = len(rg) for var in range(1, chunk) @@ -134,7 +132,6 @@ function! RMakePDF(bibtex) if ok == 0 return endif - echon endfunction " Send Sweave chunk to R @@ -153,7 +150,6 @@ function! SendChunkToR(e, m) if a:m == "down" call RnwNextChunk() endif - echon endfunction " Sweave the current buffer content @@ -162,12 +158,11 @@ function! RSweave() let b:needsnewomnilist = 1 call RSetWD() call SendCmdToR('Sweave("' . expand("%:t") . '")') - echon endfunction if g:vimrplugin_rnowebchunk == 1 " Write code chunk in rnoweb files - imap < :call RWriteChunk()a + imap < :call RWriteChunk()a endif "========================================================================== @@ -188,8 +183,8 @@ call RCreateMaps("ni", 'RSendChunk', 'cc', ':call SendChunkToR("silent call RCreateMaps("ni", 'RESendChunk', 'ce', ':call SendChunkToR("echo", "stay")') call RCreateMaps("ni", 'RDSendChunk', 'cd', ':call SendChunkToR("silent", "down")') call RCreateMaps("ni", 'REDSendChunk', 'ca', ':call SendChunkToR("echo", "down")') -nmap gn :call RnwNextChunk() -nmap gN :call RnwPreviousChunk() +nmap gn :call RnwNextChunk() +nmap gN :call RnwPreviousChunk() " Menu R if has("gui") From 1a85b6580c33feb28340824fe781eb90ccb39086 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Fri, 25 Nov 2011 19:58:05 -0300 Subject: [PATCH 0093/1050] Use Tmux to open Object Browser beside R console. --- ftplugin/rbrowser.vim | 51 +++++++------- r-plugin/common_global.vim | 132 +++++++++++++++++++++++++++++-------- r-plugin/tmux.conf | 5 ++ 3 files changed, 138 insertions(+), 50 deletions(-) diff --git a/ftplugin/rbrowser.vim b/ftplugin/rbrowser.vim index 29e8fdd..8e98880 100644 --- a/ftplugin/rbrowser.vim +++ b/ftplugin/rbrowser.vim @@ -16,7 +16,7 @@ " " Author: Jakson Alves de Aquino " -" Last Change: Thu Nov 10, 2011 11:53PM +" Last Change: Fri Nov 25, 2011 04:31PM "========================================================================== " Only do this when not yet done for this buffer @@ -24,12 +24,20 @@ if exists("b:did_ftplugin") finish endif + " Don't load another plugin for this buffer let b:did_ftplugin = 1 let s:cpo_save = &cpo set cpo&vim +" Source scripts common to R, Rnoweb, Rhelp and rdoc files: +runtime r-plugin/common_global.vim + +" Some buffer variables common to R, Rnoweb, Rhelp and rdoc file need be +" defined after the global ones: +runtime r-plugin/common_buffer.vim + setlocal noswapfile set buftype=nofile setlocal nowrap @@ -406,11 +414,9 @@ function! RBrowserFill(fromother) else call RBrowserShowGE(a:fromother) endif - echon endfunction function! RBrowserDoubleClick() - echon " Toggle view: Objects in the workspace X List of libraries if line(".") == 1 if g:rplugin_curview == "libraries" @@ -430,21 +436,22 @@ function! RBrowserDoubleClick() break endif endfor - echon endfunction function! RBrowserOpenCloseLists(status) - if ! buflisted("Object_Browser") - call RWarningMsg('There is no "Object_Browser" buffer.') - return - endif + if !exists("b:isremoteobjbr") + if !buflisted("Object_Browser") + call RWarningMsg('There is no "Object_Browser" buffer.') + return + endif - let switchedbuf = 0 - if g:rplugin_curbuf != "Object_Browser" - let savesb = &switchbuf - set switchbuf=useopen,usetab - sil noautocmd sb Object_Browser - let switchedbuf = 1 + let switchedbuf = 0 + if g:rplugin_curbuf != "Object_Browser" + let savesb = &switchbuf + set switchbuf=useopen,usetab + sil noautocmd sb Object_Browser + let switchedbuf = 1 + endif endif for key in keys(g:rplugin_opendict) @@ -452,15 +459,15 @@ function! RBrowserOpenCloseLists(status) endfor call RBrowserFill(0) - if switchedbuf - exe "sil noautocmd sb " . g:rplugin_curbuf - exe "set switchbuf=" . savesb + if !exists("b:isremoteobjbr") + if switchedbuf + exe "sil noautocmd sb " . g:rplugin_curbuf + exe "set switchbuf=" . savesb + endif endif - echon endfunction function! RBrowserRightClick() - echon if line(".") == 1 return endif @@ -629,9 +636,9 @@ function! LeaveRBrowser() endif endfunction -nmap :call RBrowserDoubleClick() -nmap <2-LeftMouse> :call RBrowserDoubleClick() -nmap :call RBrowserRightClick() +nmap :call RBrowserDoubleClick() +nmap <2-LeftMouse> :call RBrowserDoubleClick() +nmap :call RBrowserRightClick() call RControlMaps() diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 7be6fb3..a9b5aee 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -17,7 +17,7 @@ " " Based on previous work by Johannes Ranke " -" Last Change: Sat Nov 19, 2011 05:05PM +" Last Change: Fri Nov 25, 2011 07:53PM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -132,7 +132,6 @@ function RCommentLine(lnum, ind, cmt) endfunction function RComment(mode) - echon let cpos = getpos(".") if a:mode == "selection" let fline = line("'<") @@ -191,7 +190,6 @@ function RComment(mode) endfunction function MovePosRCodeComment(mode) - echon if a:mode == "selection" let fline = line("'<") let lline = line("'>") @@ -283,7 +281,6 @@ function CountBraces(line) endfunction function RnwPreviousChunk() - echon let curline = line(".") if RnwIsInRCode() let i = search("^<<.*$", "bnW") @@ -303,7 +300,6 @@ function RnwPreviousChunk() endfunction function RnwNextChunk() - echon let linenr = search("^<<.*", "nW") if linenr == 0 call RWarningMsg("There is no next R code chunk to go.") @@ -530,7 +526,7 @@ endfunction " Open an Object Browser window function RObjBrowser() " Only opens the Object Browser if R is running - if g:vimrplugin_screenplugin && !exists("g:ScreenShellSend") + if g:vimrplugin_screenplugin && !exists("g:ScreenShellSend") && !exists("b:isremoteobjbr") return endif if g:vimrplugin_conqueplugin && !exists("b:conque_bufname") @@ -541,9 +537,9 @@ function RObjBrowser() let lockfile = $VIMRPLUGIN_TMPDIR . "/objbrowser" . "lock" call writefile(["Wait!"], lockfile) if g:vimrplugin_allnames == 1 - call SendCmdToR("source('" . g:rplugin_home . "/r-plugin/vimbrowser.R') ; .vim.browser(TRUE)") + call SendCmdToR('source("' . g:rplugin_home . '/r-plugin/vimbrowser.R") ; .vim.browser(TRUE)') else - call SendCmdToR("source('" . g:rplugin_home . "/r-plugin/vimbrowser.R') ; .vim.browser()") + call SendCmdToR('source("' . g:rplugin_home . '/r-plugin/vimbrowser.R") ; .vim.browser()') endif sleep 50m let i = 0 @@ -563,6 +559,86 @@ function RObjBrowser() let g:rplugin_origbuf = bufname("%") + " Start the object browser in a new vim instance on a Tmux pane: + if g:vimrplugin_screenplugin && g:vimrplugin_objbr_place =~ "console" + let objbr = $VIMRPLUGIN_TMPDIR . "/objbrowser" + let i = 1 + while !filereadable(objbr) + sleep 100m + if i == 20 + return + endif + endwhile + + " This is the Object Browser + if exists("b:isremoteobjbr") + setlocal modifiable + let curline = line(".") + let curcol = col(".") + normal! ggdG + exe "source " . objbr + call RBrowserFillCloseList() + call RBrowserFill(0) + setlocal nomodified + call cursor(curline, curcol) + redraw + echon + return + endif + + " Start the Object Browser if it doesn't exist yet + let slist = serverlist() + if slist !~ "OBJBROWSER" + if g:vimrplugin_objbr_place =~ "right" + " not implemented yet + endif + + let cmd = "tmux split-window -d -h -l " . g:vimrplugin_objbr_w . ' -t 1 "vim --servername OBJBROWSER"' + let rlog = system(cmd) + if v:shell_error + let rlog = substitute(rlog, '\n', ' ', 'g') + let rlog = substitute(rlog, '\r', ' ', 'g') + call RWarningMsg(rlog) + return 0 + endif + endif + + let objbrowserfile = $VIMRPLUGIN_TMPDIR . "/objbrowserInit" + call writefile([ + \ 'let b:objbrtitle = "' . b:objbrtitle . '"', + \ 'let b:screensname = "' . b:screensname . '"', + \ 'let b:rscript_buffer = "' . bufname("%") . '"', + \ 'let b:isremoteobjbr = 1', + \ 'let b:myservername = "' . v:servername . '"', + \ 'set filetype=rbrowser', + \ 'set statusline=lc', + \ 'setlocal modifiable', + \ 'let curline = line(".")', + \ 'let curcol = col(".")', + \ 'normal! ggdG', + \ 'source ' . objbr, + \ 'call RBrowserFillCloseList()', + \ 'call RBrowserFill(0)', + \ 'setlocal nomodified', + \ 'call cursor(curline, curcol)', + \ 'redraw'], objbrowserfile) + + " Wait while Vim starts + let idx = 0 + while idx < 20 + sleep 300m + let slist = serverlist() + if slist =~ "OBJBROWSER" + break + endif + let idx = idx + 1 + endwhile + + call remote_send("OBJBROWSER", ":source " . objbrowserfile . "") + call remote_send("OBJBROWSER", ":echon") + return + endif + " Either load or reload the Object Browser let savesb = &switchbuf set switchbuf=useopen,usetab @@ -660,6 +736,12 @@ function RScrollTerm() exe "set switchbuf=" . savesb endfunction +" Called by the Object Browser when running remotely: +function RGetRemoteCmd(cmd) + call SendCmdToR(a:cmd) + echon +endfunction + " Function to send commands " return 0 on failure and 1 on success function SendCmdToR(cmd) @@ -684,6 +766,10 @@ function SendCmdToR(cmd) if g:vimrplugin_screenplugin if !exists("g:ScreenShellSend") + if exists("b:isremoteobjbr") + call remote_send(b:myservername, ":call RGetRemoteCmd('" . a:cmd . "')") + return 1 + endif call RWarningMsg("Did you already start R?") return 0 endif @@ -809,7 +895,6 @@ endfunction " Send file to R function SendFileToR(e) - echon let b:needsnewomnilist = 1 let lines = getline("1", line("$")) let ok = RSourceLines(lines, a:e) @@ -862,12 +947,10 @@ function SendMBlockToR(e, m) call cursor(lineB, 1) call GoDown() endif - echon endfunction " Send functions to R function SendFunctionToR(e, m) - echon if &filetype == "rnoweb" && RnwIsInRCode() == 0 call RWarningMsg("Not inside an R code chunk.") return @@ -925,12 +1008,10 @@ function SendFunctionToR(e, m) call cursor(lastline, 1) call GoDown() endif - echon endfunction " Send selection to R function SendSelectionToR(e, m) - echon if &filetype == "rnoweb" && RnwIsInRCode() == 0 call RWarningMsg("Not inside an R code chunk.") return @@ -1007,12 +1088,10 @@ function SendParagraphToR(e, m) else call cursor(i, c) endif - echon endfunction " Send current line to R. Don't go down if called by . function SendLineToR(godown) - echon let line = getline(".") if &filetype == "rnoweb" @@ -1081,7 +1160,6 @@ function RSetWD() if ok == 0 return endif - echon endfunction " Quit R @@ -1113,7 +1191,6 @@ function RQuit(how) if bufloaded(b:objbrtitle) exe "bunload! " . b:objbrtitle endif - echon endfunction " Tell R to create a list of objects file listing all currently available @@ -1454,13 +1531,12 @@ function PrintRObject(rkeyword) if classfor == "" call SendCmdToR("print(" . a:rkeyword . ")") else - call SendCmdToR("source('" . g:rplugin_home . "/r-plugin/vimprint.R') ; .vim.print('" . a:rkeyword . "', " . classfor . ")") + call SendCmdToR('source("' . g:rplugin_home . '/r-plugin/vimprint.R") ; .vim.print("' . a:rkeyword . '", ' . classfor . ")") endif endfunction " Call R functions for the word under cursor function RAction(rcmd) - echon if &filetype == "rbrowser" let rkeyword = RBrowserGetName(1) else @@ -1636,7 +1712,7 @@ endfunction function RControlMaps() " List space, clear console, clear all "------------------------------------- - call RCreateMaps("nvi", 'RListSpace', 'rl', ':call SendCmdToR("ls()"):echon') + call RCreateMaps("nvi", 'RListSpace', 'rl', ':call SendCmdToR("ls()")') call RCreateMaps("nvi", 'RClearConsole', 'rr', ':call RClearConsole()') call RCreateMaps("nvi", 'RClearAll', 'rm', ':call RClearAll()') @@ -1685,23 +1761,23 @@ function RCreateMaps(type, plug, combo, target) endif if a:type =~ "n" if hasmapto(a:plug, "n") - exec 'noremap ' . a:plug . ' ' . tg + exec 'noremap ' . a:plug . ' ' . tg else - exec 'noremap ' . a:combo . ' ' . tg + exec 'noremap ' . a:combo . ' ' . tg endif endif if a:type =~ "v" if hasmapto(a:plug, "v") - exec 'vnoremap ' . a:plug . ' ' . tg + exec 'vnoremap ' . a:plug . ' ' . tg else - exec 'vnoremap ' . a:combo . ' ' . tg + exec 'vnoremap ' . a:combo . ' ' . tg endif endif if a:type =~ "i" if hasmapto(a:plug, "i") - exec 'inoremap ' . a:plug . ' ' . tg . il + exec 'inoremap ' . a:plug . ' ' . tg . il else - exec 'inoremap ' . a:combo . ' ' . tg . il + exec 'inoremap ' . a:combo . ' ' . tg . il endif endif endfunction @@ -1994,7 +2070,7 @@ function RCreateEditMaps() call RCreateMaps("v", 'RRightComment', ';', ':call MovePosRCodeComment("selection")') " Replace 'underline' with '<-' if g:vimrplugin_underscore == 1 - imap _ :call ReplaceUnderS()a + imap _ :call ReplaceUnderS()a endif endfunction @@ -2035,7 +2111,7 @@ function RCreateSendMaps() " For compatibility with Johannes Ranke's plugin if g:vimrplugin_map_r == 1 - vnoremap r :call SendSelectionToR("silent", "down") + vnoremap r :call SendSelectionToR("silent", "down") endif endfunction diff --git a/r-plugin/tmux.conf b/r-plugin/tmux.conf index 9d006eb..45393ce 100644 --- a/r-plugin/tmux.conf +++ b/r-plugin/tmux.conf @@ -18,3 +18,8 @@ set -g status off # Avoid scroll bug when copying and pasting text set -g terminal-overrides 'xterm*:smcup@:rmcup@' +# Mouse support +set -g mode-mouse on +set -g mouse-select-pane on +set -g mouse-resize-pane on + From 9b4f503fae92f7dd074e633230fc7a85405cd77d Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Fri, 25 Nov 2011 23:34:22 -0300 Subject: [PATCH 0094/1050] Improvements in Object Browser beside R Console. - Support for vimrplugin_objbr_place = "console,left". - Use different tmux.conf for GVim and Vim. --- doc/r-plugin.txt | 26 ++++++++- r-plugin/common_global.vim | 111 ++++++++++++++++++++++++------------- r-plugin/tmux.conf | 7 +-- 3 files changed, 100 insertions(+), 44 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 12d84e8..6b74249 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -767,6 +767,7 @@ duplicated to R on Mac OS X. |vimrplugin_rnowebchunk| Convert '<' into '<<>>=\n@' in Rnoweb files |vimrplugin_objbr_place| Placement of Object Browser |vimrplugin_objbr_w| Initial width of Object Browser window +|vimrplugin_console_w| Width of R Console after starting Object Browser |vimrplugin_vimpager| Use Vim to see R documentation |vimrplugin_editor_w| Minimum width of R script buffer |vimrplugin_help_w| Desired width of R documentation buffer @@ -846,6 +847,7 @@ put in your |vimrc|: 7.3. Object Browser options~ *vimrplugin_objbr_place* *vimrplugin_objbr_w* + *vimrplugin_console_w* *vimrplugin_open_df* *vimrplugin_open_list* *vimrplugin_allnames* @@ -855,10 +857,28 @@ and placement by putting different values in your |vimrc|, as in the examples below: > let vimrplugin_objbr_place = "script,right" + let vimrplugin_objbr_place = "console,left" let vimrplugin_objbr_w = 30 < -The minimum width of the Object Browser windows is 9 columns. +Valid values for the Object Browser placement are "script" or "console" and +"right" or "left". The default value of |vimrplugin_objbr_place| is +"console,right" if running in a terminal emulator and "script,right" if +running in GVim. If running GVim, the Object Browser will always be created by +splitting the GVim window. +The minimum width of the Object Browser window is 9 columns. + +While splitting a Tmux pane, we can only define the width of the right pane. +Thus, if the value of |vimrplugin_objbr_place| == "console,left", we have to +calculate the width of R Console instead of using the value of +|vimrplugin_objbr_w|. If |vimrplugin_screenvsplit| == 0, the Vim-R-plugin will +use the value of 'columns' to calculate the width of R Console, but if its +value is 1, you have to set the value of |vimrplugin_console_w| according to +the width of the terminal emulator that you usually use (the default value is +80): +> + let vimrplugin_console_w = 90 +< By default, the elements of data.frames are shown in the object browser, but not the elements of other types of lists. You can put the following in your |vimrc| to change this behavior: @@ -1768,10 +1788,12 @@ the R syntax highlighted. *r-plugin-news* 12. News~ -1.0 (2011-11-20) +1.0 (2011-11-25) * Add "terminal" to the list of known terminal emulators (thanks for "i5m" for the patch). + * Use Tmux to start the Object Browser beside the R console if + vimrplugin_objbr_place =~ "console". 111114 (2011-11-14) * Changed key binding for commenting/uncommenting code from \cc to \xx. diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index a9b5aee..877fc6d 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -17,7 +17,7 @@ " " Based on previous work by Johannes Ranke " -" Last Change: Fri Nov 25, 2011 07:53PM +" Last Change: Fri Nov 25, 2011 11:22PM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -589,11 +589,16 @@ function RObjBrowser() " Start the Object Browser if it doesn't exist yet let slist = serverlist() if slist !~ "OBJBROWSER" - if g:vimrplugin_objbr_place =~ "right" - " not implemented yet + if g:vimrplugin_objbr_place =~ "left" + if g:vimrplugin_screenvsplit + let console_w = g:vimrplugin_console_w + else + let console_w = &columns - g:vimrplugin_objbr_w + endif + let cmd = "tmux split-window -d -h -l " . console_w . ' -t 1 "vim --servername OBJBROWSER"' + else + let cmd = "tmux split-window -d -h -l " . g:vimrplugin_objbr_w . ' -t 1 "vim --servername OBJBROWSER"' endif - - let cmd = "tmux split-window -d -h -l " . g:vimrplugin_objbr_w . ' -t 1 "vim --servername OBJBROWSER"' let rlog = system(cmd) if v:shell_error let rlog = substitute(rlog, '\n', ' ', 'g') @@ -601,6 +606,9 @@ function RObjBrowser() call RWarningMsg(rlog) return 0 endif + if g:vimrplugin_objbr_place =~ "left" + call system("tmux swap-pane -s 1 -t 2") + endif endif let objbrowserfile = $VIMRPLUGIN_TMPDIR . "/objbrowserInit" @@ -767,7 +775,12 @@ function SendCmdToR(cmd) if g:vimrplugin_screenplugin if !exists("g:ScreenShellSend") if exists("b:isremoteobjbr") - call remote_send(b:myservername, ":call RGetRemoteCmd('" . a:cmd . "')") + let remotemode = remote_expr(b:myservername, "mode()") + if remotemode == "n" + call remote_send(b:myservername, ":call RGetRemoteCmd('" . a:cmd . "')") + else + call remote_send(b:myservername, ":call RGetRemoteCmd('" . a:cmd . "')") + endif return 1 endif call RWarningMsg("Did you already start R?") @@ -2156,6 +2169,34 @@ else let g:rplugin_uservimfiles = split(&runtimepath, ",")[0] endif +" From changelog.vim, with bug fixed by "Si" ("i5ivem") +" Windows logins can include domain, e.g: 'DOMAIN\Username', need to remove +" the backslash from this as otherwise cause file path problems. +let g:rplugin_userlogin = substitute(system('whoami'), "\\", "-", "") + +if v:shell_error + let g:rplugin_userlogin = 'unknown' +else + let newuline = stridx(g:rplugin_userlogin, "\n") + if newuline != -1 + let g:rplugin_userlogin = strpart(g:rplugin_userlogin, 0, newuline) + endif + unlet newuline +endif + +if isdirectory("/tmp") + let $VIMRPLUGIN_TMPDIR = "/tmp/r-plugin-" . g:rplugin_userlogin +else + let $VIMRPLUGIN_TMPDIR = g:rplugin_uservimfiles . "/r-plugin" +endif + +if !isdirectory($VIMRPLUGIN_TMPDIR) + call mkdir($VIMRPLUGIN_TMPDIR, "p", 0700) +endif + +let g:rplugin_docfile = $VIMRPLUGIN_TMPDIR . "/Rdoc" +let g:rplugin_globalenvfname = $VIMRPLUGIN_TMPDIR . "/GlobalEnvList" + " Variables whose default value is fixed call RSetDefaultValue("g:vimrplugin_map_r", 0) call RSetDefaultValue("g:vimrplugin_open_df", 1) @@ -2176,13 +2217,18 @@ call RSetDefaultValue("g:vimrplugin_routnotab", 0) call RSetDefaultValue("g:vimrplugin_editor_w", 66) call RSetDefaultValue("g:vimrplugin_help_w", 46) call RSetDefaultValue("g:vimrplugin_objbr_w", 40) +call RSetDefaultValue("g:vimrplugin_console_w", 80) call RSetDefaultValue("g:vimrplugin_buildwait", 120) call RSetDefaultValue("g:vimrplugin_indent_commented", 1) call RSetDefaultValue("g:vimrplugin_by_vim_instance", 0) call RSetDefaultValue("g:vimrplugin_never_unmake_menu", 0) call RSetDefaultValue("g:vimrplugin_vimpager", "'vertical'") call RSetDefaultValue("g:vimrplugin_latexcmd", "'pdflatex'") -call RSetDefaultValue("g:vimrplugin_objbr_place", "'console,right'") +if has("gui_running") + call RSetDefaultValue("g:vimrplugin_objbr_place", "'script,right'") +else + call RSetDefaultValue("g:vimrplugin_objbr_place", "'console,right'") +endif " ^K (\013) cleans from cursor to the right and ^U (\025) cleans from cursor " to the left. However, ^U causes a beep if there is nothing to clean. The @@ -2260,7 +2306,18 @@ if g:vimrplugin_screenplugin let g:ScreenShellTmuxInitArgs = "-2" endif if g:vimrplugin_notmuxconf == 0 - let g:ScreenShellTmuxInitArgs = g:ScreenShellTmuxInitArgs . " -f " . rplugin_home . "/r-plugin/tmux.conf" + let tmxcnf = $VIMRPLUGIN_TMPDIR . "/tmux.conf" + call writefile([ + \ 'set-option -g prefix C-a', + \ 'unbind-key C-b', + \ 'bind-key C-a send-prefix', + \ 'set-window-option -g mode-keys vi', + \ 'set -g status off', + \ "set -g terminal-overrides 'xterm*:smcup@:rmcup@'", + \ 'set -g mode-mouse on', + \ 'set -g mouse-select-pane on', + \ 'set -g mouse-resize-pane on'], tmxcnf) + let g:ScreenShellTmuxInitArgs = g:ScreenShellTmuxInitArgs . " -f " . tmxcnf endif endif else @@ -2296,24 +2353,17 @@ if g:vimrplugin_screenplugin endif endif -" Start with an empty list of objects in the workspace -let g:rplugin_globalenvlines = [] - -" From changelog.vim, with bug fixed by "Si" ("i5ivem") -" Windows logins can include domain, e.g: 'DOMAIN\Username', need to remove -" the backslash from this as otherwise cause file path problems. -let g:rplugin_userlogin = substitute(system('whoami'), "\\", "-", "") - -if v:shell_error - let g:rplugin_userlogin = 'unknown' -else - let newuline = stridx(g:rplugin_userlogin, "\n") - if newuline != -1 - let g:rplugin_userlogin = strpart(g:rplugin_userlogin, 0, newuline) +" To run the Object Browser beside R Console with Tmux, Vim must have the +" +clientserver feature and the X server must be running. +if g:vimrplugin_screenplugin && g:vimrplugin_objbr_place =~ "console" + if !has("clientserver") || $DISPLAY == "" + let g:vimrplugin_objbr_place = substitute(g:vimrplugin_objbr_place, "console", "script", "") endif - unlet newuline endif +" Start with an empty list of objects in the workspace +let g:rplugin_globalenvlines = [] + if has("gui_win32") " python has priority over python3, unless ConqueTerm_PyVersion == 3 if has("python") @@ -2416,19 +2466,6 @@ else endif endif -if isdirectory("/tmp") - let $VIMRPLUGIN_TMPDIR = "/tmp/r-plugin-" . g:rplugin_userlogin -else - let $VIMRPLUGIN_TMPDIR = g:rplugin_uservimfiles . "/r-plugin" -endif - -if !isdirectory($VIMRPLUGIN_TMPDIR) - call mkdir($VIMRPLUGIN_TMPDIR, "p", 0700) -endif - -let g:rplugin_docfile = $VIMRPLUGIN_TMPDIR . "/Rdoc" -let g:rplugin_globalenvfname = $VIMRPLUGIN_TMPDIR . "/GlobalEnvList" - if g:vimrplugin_conqueplugin == 1 if !exists("g:ConqueTerm_Version") || (exists("g:ConqueTerm_Version") && g:ConqueTerm_Version < 230) let g:vimrplugin_conqueplugin = 0 @@ -2565,7 +2602,7 @@ augroup RBufControl au BufEnter * let g:rplugin_curbuf = bufname("%") augroup END -if has("gui") +if has("gui_running") augroup RMenuControl au BufEnter * call RBufEnter() augroup END diff --git a/r-plugin/tmux.conf b/r-plugin/tmux.conf index 45393ce..6c4ceaf 100644 --- a/r-plugin/tmux.conf +++ b/r-plugin/tmux.conf @@ -1,3 +1,5 @@ +# tmux.conf for use with GVim + # changing the main key binding set-option -g prefix C-a unbind-key C-b @@ -18,8 +20,3 @@ set -g status off # Avoid scroll bug when copying and pasting text set -g terminal-overrides 'xterm*:smcup@:rmcup@' -# Mouse support -set -g mode-mouse on -set -g mouse-select-pane on -set -g mouse-resize-pane on - From 1b2db435fa7de401527b5149f1507b7bf2572a71 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Fri, 25 Nov 2011 23:37:32 -0300 Subject: [PATCH 0095/1050] Replace has("gui") with has("gui_running"). --- ftplugin/r.vim | 4 ++-- ftplugin/rbrowser.vim | 4 ++-- ftplugin/rdoc.vim | 11 +++++++++-- ftplugin/rhelp.vim | 4 ++-- ftplugin/rnoweb.vim | 4 ++-- 5 files changed, 17 insertions(+), 10 deletions(-) diff --git a/ftplugin/r.vim b/ftplugin/r.vim index f121322..c9fc968 100644 --- a/ftplugin/r.vim +++ b/ftplugin/r.vim @@ -19,7 +19,7 @@ " " Based on previous work by Johannes Ranke " -" Last Change: Thu Nov 10, 2011 11:57PM +" Last Change: Fri Nov 25, 2011 08:43PM " " Please see doc/r-plugin.txt for usage details. "========================================================================== @@ -108,7 +108,7 @@ endif " Menu R -if has("gui") +if has("gui_running") call MakeRMenu() endif diff --git a/ftplugin/rbrowser.vim b/ftplugin/rbrowser.vim index 8e98880..fc21b1f 100644 --- a/ftplugin/rbrowser.vim +++ b/ftplugin/rbrowser.vim @@ -16,7 +16,7 @@ " " Author: Jakson Alves de Aquino " -" Last Change: Fri Nov 25, 2011 04:31PM +" Last Change: Fri Nov 25, 2011 08:44PM "========================================================================== " Only do this when not yet done for this buffer @@ -645,7 +645,7 @@ call RControlMaps() setlocal winfixwidth setlocal bufhidden=wipe -if has("gui") +if has("gui_running") call RControlMenu() call RBrowserMenu() let s:thisbuffname = substitute(bufname("%"), '\.', '', "g") diff --git a/ftplugin/rdoc.vim b/ftplugin/rdoc.vim index 762c32b..9f9917d 100644 --- a/ftplugin/rdoc.vim +++ b/ftplugin/rdoc.vim @@ -19,7 +19,7 @@ " " Based on previous work by Johannes Ranke " -" Last Change: Mon Nov 21, 2011 08:55AM +" Last Change: Fri Nov 25, 2011 08:52PM " " Please see doc/r-plugin.txt for usage details. "========================================================================== @@ -54,6 +54,13 @@ function! FixRdoc() call setline(lnr, '###') endif normal! gg + + " Clear undo history + let old_undolevels = &undolevels + set undolevels=-1 + exe "normal a \\" + let &undolevels = old_undolevels + unlet old_undolevels endfunction "========================================================================== @@ -63,7 +70,7 @@ call RCreateSendMaps() call RControlMaps() " Menu R -if has("gui") +if has("gui_running") call MakeRMenu() endif diff --git a/ftplugin/rhelp.vim b/ftplugin/rhelp.vim index 36bb772..ef0efe5 100644 --- a/ftplugin/rhelp.vim +++ b/ftplugin/rhelp.vim @@ -19,7 +19,7 @@ " " Based on previous work by Johannes Ranke " -" Last Change: Thu Nov 10, 2011 11:57PM +" Last Change: Fri Nov 25, 2011 08:43PM " " Please see doc/r-plugin.txt for usage details. "========================================================================== @@ -90,7 +90,7 @@ call RControlMaps() call RCreateMaps("nvi", 'RSetwd', 'rd', ':call RSetWD()') " Menu R -if has("gui") +if has("gui_running") call MakeRMenu() endif diff --git a/ftplugin/rnoweb.vim b/ftplugin/rnoweb.vim index 047f350..c40a295 100644 --- a/ftplugin/rnoweb.vim +++ b/ftplugin/rnoweb.vim @@ -17,7 +17,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Fri Nov 25, 2011 04:20PM +" Last Change: Fri Nov 25, 2011 08:43PM "========================================================================== " Only do this when not yet done for this buffer @@ -187,7 +187,7 @@ nmap gn :call RnwNextChunk() nmap gN :call RnwPreviousChunk() " Menu R -if has("gui") +if has("gui_running") call MakeRMenu() endif From 3364188a6a3359e18f631219fa5e1ac0b300d501 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Fri, 25 Nov 2011 23:58:30 -0300 Subject: [PATCH 0096/1050] Fix Vim freezing when \rp at column 1 over space. --- r-plugin/common_global.vim | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 877fc6d..023fe3e 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -17,7 +17,7 @@ " " Based on previous work by Johannes Ranke " -" Last Change: Fri Nov 25, 2011 11:22PM +" Last Change: Fri Nov 25, 2011 11:56PM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -876,6 +876,9 @@ function RGetKeyWord() let save_cursor = getpos(".") let curline = line(".") let line = getline(curline) + if strlen(line) == 0 + return "" + endif " line index starts in 0; cursor index starts in 1: let i = col(".") - 1 while i > 0 && "({[ " =~ line[i] @@ -1363,7 +1366,7 @@ function RGetClassFor(rkeyword) let begin = col(".") if strlen(line) > begin let piece = strpart(line, begin) - while piece !~ '^' . a:rkeyword + while piece !~ '^' . a:rkeyword && begin >= 0 let begin -= 1 let piece = strpart(line, begin) endwhile From 0005cd784bd098f25b6e304f869b15ee77c58057 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 26 Nov 2011 12:44:22 -0300 Subject: [PATCH 0097/1050] Update. --- doc/r-plugin.txt | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 6b74249..ade9de6 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -851,31 +851,33 @@ put in your |vimrc|: *vimrplugin_open_df* *vimrplugin_open_list* *vimrplugin_allnames* -By default, the object browser will be created with 40 columns at the right -side of the script window. You can change the object browser's default width -and placement by putting different values in your |vimrc|, as in the examples -below: +By default, the object browser will be created with 40 columns. The minimum +width of the Object Browser window is 9 columns. You can change the object +browser's default width by setting the value of |vimrplugin_objbr_w| in your +|vimrc|, as below: +> + let vimrplugin_objbr_w = 30 +< +The Object Browser will always be created by splitting the Vim script window +if you are running GVim or Vim in the Linux console (without the X server). +However, if running Vim in a terminal emulator under the X Server, the Object +Browser can be created in a independent Vim instance in a Tmux panel beside +the R Console. The Vim feature |+clientserver| is required to put the Object +Browser beside the R Console and this feature only works when the X server is +running. Valid values for the Object Browser placement are "script" or +"console" and "right" or "left". Examples: > let vimrplugin_objbr_place = "script,right" let vimrplugin_objbr_place = "console,left" - let vimrplugin_objbr_w = 30 < -Valid values for the Object Browser placement are "script" or "console" and -"right" or "left". The default value of |vimrplugin_objbr_place| is -"console,right" if running in a terminal emulator and "script,right" if -running in GVim. If running GVim, the Object Browser will always be created by -splitting the GVim window. - -The minimum width of the Object Browser window is 9 columns. - While splitting a Tmux pane, we can only define the width of the right pane. Thus, if the value of |vimrplugin_objbr_place| == "console,left", we have to calculate the width of R Console instead of using the value of |vimrplugin_objbr_w|. If |vimrplugin_screenvsplit| == 0, the Vim-R-plugin will -use the value of 'columns' to calculate the width of R Console, but if its -value is 1, you have to set the value of |vimrplugin_console_w| according to -the width of the terminal emulator that you usually use (the default value is -80): +use the value of 'columns' to calculate the width of R Console, but if +|vimrplugin_screenvsplit| == 1, you have to set the value of +|vimrplugin_console_w| according to the width of the terminal emulator that +you usually use (the default value is 80): > let vimrplugin_console_w = 90 < From 62ea1ef62772392f6fc1e55534b454d1f6240a52 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 26 Nov 2011 12:44:37 -0300 Subject: [PATCH 0098/1050] Be more silent. --- r-plugin/common_global.vim | 43 ++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 23 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 023fe3e..d91b97a 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -17,7 +17,7 @@ " " Based on previous work by Johannes Ranke " -" Last Change: Fri Nov 25, 2011 11:56PM +" Last Change: Sat Nov 26, 2011 12:43PM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -526,7 +526,7 @@ endfunction " Open an Object Browser window function RObjBrowser() " Only opens the Object Browser if R is running - if g:vimrplugin_screenplugin && !exists("g:ScreenShellSend") && !exists("b:isremoteobjbr") + if g:vimrplugin_screenplugin && !exists("g:ScreenShellSend") && !exists("b:myservername") return endif if g:vimrplugin_conqueplugin && !exists("b:conque_bufname") @@ -571,18 +571,11 @@ function RObjBrowser() endwhile " This is the Object Browser - if exists("b:isremoteobjbr") - setlocal modifiable - let curline = line(".") - let curcol = col(".") - normal! ggdG - exe "source " . objbr - call RBrowserFillCloseList() - call RBrowserFill(0) - setlocal nomodified - call cursor(curline, curcol) - redraw - echon + if exists("b:myservername") + if remote_expr(b:myservername, "mode()") != "n" + call remote_send(b:myservername, "") + endif + call remote_expr(b:myservername, "RObjBrowser()") return endif @@ -607,7 +600,7 @@ function RObjBrowser() return 0 endif if g:vimrplugin_objbr_place =~ "left" - call system("tmux swap-pane -s 1 -t 2") + call system("tmux swap-pane -d -s 1 -t 2") endif endif @@ -616,10 +609,8 @@ function RObjBrowser() \ 'let b:objbrtitle = "' . b:objbrtitle . '"', \ 'let b:screensname = "' . b:screensname . '"', \ 'let b:rscript_buffer = "' . bufname("%") . '"', - \ 'let b:isremoteobjbr = 1', \ 'let b:myservername = "' . v:servername . '"', \ 'set filetype=rbrowser', - \ 'set statusline=lc', \ 'setlocal modifiable', \ 'let curline = line(".")', \ 'let curcol = col(".")', @@ -774,13 +765,11 @@ function SendCmdToR(cmd) if g:vimrplugin_screenplugin if !exists("g:ScreenShellSend") - if exists("b:isremoteobjbr") - let remotemode = remote_expr(b:myservername, "mode()") - if remotemode == "n" - call remote_send(b:myservername, ":call RGetRemoteCmd('" . a:cmd . "')") - else - call remote_send(b:myservername, ":call RGetRemoteCmd('" . a:cmd . "')") + if exists("b:myservername") + if remote_expr(b:myservername, "mode()") != "n" + call remote_send(b:myservername, "") endif + call remote_expr(b:myservername, "RGetRemoteCmd('" . a:cmd . "')") return 1 endif call RWarningMsg("Did you already start R?") @@ -1180,6 +1169,11 @@ endfunction " Quit R function RQuit(how) + if serverlist() =~ "OBJBROWSER" + call remote_send("OBJBROWSER", ":q") + sleep 500m + endif + if a:how == "save" call SendCmdToR('quit(save = "yes")') sleep 1 @@ -2621,4 +2615,7 @@ endif if g:vimrplugin_conqueplugin && g:vimrplugin_applescript echoerr "Error number 3" endif +if g:vimrplugin_screenplugin && has("gui_running") + echoerr "Error number 4" +endif From e110e763ca4ce51620d2fb3575a7628ae418a15c Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 26 Nov 2011 15:54:55 -0300 Subject: [PATCH 0099/1050] Increase the scope of vimrplugin_notmuxconf. The option vimrplugin_notmuxconf now refers to both ~/.tmux.conf and g:ScreenShellTmuxInitArgs. --- doc/r-plugin.txt | 7 ++++--- r-plugin/common_global.vim | 41 +++++++++++++++++++++----------------- 2 files changed, 27 insertions(+), 21 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index ade9de6..061e410 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -1069,8 +1069,9 @@ example show how to adjust the value of sleeptime in your |vimrc|: *vimrplugin_noscreenrc* *vimrplugin_notmuxconf* GVim (or Vim running R in an external terminal emulator) runs Tmux with a -specially built configuration file. If you want to use your own ~/.tmux.conf, -put in your |vimrc|: +specially built configuration file. It also overwrite the value of +|g:ScreenShellTmuxInitArgs|. If you want to use your own ~/.tmux.conf and +|g:ScreenShellTmuxInitArgs|, put in your |vimrc|: > let vimrplugin_notmuxconf = 1 < @@ -1790,7 +1791,7 @@ the R syntax highlighted. *r-plugin-news* 12. News~ -1.0 (2011-11-25) +1.0 (2011-11-26) * Add "terminal" to the list of known terminal emulators (thanks for "i5m" for the patch). diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index d91b97a..58adbca 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -17,7 +17,7 @@ " " Based on previous work by Johannes Ranke " -" Last Change: Sat Nov 26, 2011 12:43PM +" Last Change: Sat Nov 26, 2011 03:44PM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -2221,7 +2221,8 @@ call RSetDefaultValue("g:vimrplugin_by_vim_instance", 0) call RSetDefaultValue("g:vimrplugin_never_unmake_menu", 0) call RSetDefaultValue("g:vimrplugin_vimpager", "'vertical'") call RSetDefaultValue("g:vimrplugin_latexcmd", "'pdflatex'") -if has("gui_running") + +if has("gui_running") || !has("clientserver") call RSetDefaultValue("g:vimrplugin_objbr_place", "'script,right'") else call RSetDefaultValue("g:vimrplugin_objbr_place", "'console,right'") @@ -2298,24 +2299,22 @@ if g:vimrplugin_screenplugin " xterm-256color. See :h r-plugin-tips if g:vimrplugin_tmux let g:ScreenImpl = 'Tmux' - if g:ScreenShellTmuxInitArgs == "" + if g:vimrplugin_notmuxconf == 0 if $DISPLAY != "" || $TERM =~ "xterm" let g:ScreenShellTmuxInitArgs = "-2" endif - if g:vimrplugin_notmuxconf == 0 - let tmxcnf = $VIMRPLUGIN_TMPDIR . "/tmux.conf" - call writefile([ - \ 'set-option -g prefix C-a', - \ 'unbind-key C-b', - \ 'bind-key C-a send-prefix', - \ 'set-window-option -g mode-keys vi', - \ 'set -g status off', - \ "set -g terminal-overrides 'xterm*:smcup@:rmcup@'", - \ 'set -g mode-mouse on', - \ 'set -g mouse-select-pane on', - \ 'set -g mouse-resize-pane on'], tmxcnf) - let g:ScreenShellTmuxInitArgs = g:ScreenShellTmuxInitArgs . " -f " . tmxcnf - endif + let tmxcnf = $VIMRPLUGIN_TMPDIR . "/tmux.conf" + call writefile([ + \ 'set-option -g prefix C-a', + \ 'unbind-key C-b', + \ 'bind-key C-a send-prefix', + \ 'set-window-option -g mode-keys vi', + \ 'set -g status off', + \ "set -g terminal-overrides 'xterm*:smcup@:rmcup@'", + \ 'set -g mode-mouse on', + \ 'set -g mouse-select-pane on', + \ 'set -g mouse-resize-pane on'], tmxcnf) + let g:ScreenShellTmuxInitArgs = g:ScreenShellTmuxInitArgs . " -f " . tmxcnf endif else let g:ScreenImpl = 'GnuScreen' @@ -2353,7 +2352,13 @@ endif " To run the Object Browser beside R Console with Tmux, Vim must have the " +clientserver feature and the X server must be running. if g:vimrplugin_screenplugin && g:vimrplugin_objbr_place =~ "console" - if !has("clientserver") || $DISPLAY == "" + if $DISPLAY == "" + let g:vimrplugin_objbr_place = substitute(g:vimrplugin_objbr_place, "console", "script", "") + elseif !has("clientserver") + " Cannot use RWarningMsgInp because the message would be visible but + " Vim would wait for when R was started. + call RWarningMsg("Your Vim was not compiled with the 'clientserver' feature. You will not be able to start the Object Browser beside the R Console.") + sleep 1 let g:vimrplugin_objbr_place = substitute(g:vimrplugin_objbr_place, "console", "script", "") endif endif From e1422c0726aa6d917246b5ebb61102669c57d0b2 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 26 Nov 2011 16:09:52 -0300 Subject: [PATCH 0100/1050] Write tmux.conf according to Tmux version. --- r-plugin/common_global.vim | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 58adbca..428352d 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -17,7 +17,7 @@ " " Based on previous work by Johannes Ranke " -" Last Change: Sat Nov 26, 2011 03:44PM +" Last Change: Sat Nov 26, 2011 04:06PM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -2299,21 +2299,27 @@ if g:vimrplugin_screenplugin " xterm-256color. See :h r-plugin-tips if g:vimrplugin_tmux let g:ScreenImpl = 'Tmux' + let s:tmuxversion = system("tmux -V") + let s:tmuxversion = substitute(s:tmuxversion, '.*tmux \([0-9]\.[0-9]\).*', '\1', '') if g:vimrplugin_notmuxconf == 0 if $DISPLAY != "" || $TERM =~ "xterm" let g:ScreenShellTmuxInitArgs = "-2" endif let tmxcnf = $VIMRPLUGIN_TMPDIR . "/tmux.conf" - call writefile([ + let cnflines = [ \ 'set-option -g prefix C-a', \ 'unbind-key C-b', \ 'bind-key C-a send-prefix', \ 'set-window-option -g mode-keys vi', \ 'set -g status off', - \ "set -g terminal-overrides 'xterm*:smcup@:rmcup@'", - \ 'set -g mode-mouse on', - \ 'set -g mouse-select-pane on', - \ 'set -g mouse-resize-pane on'], tmxcnf) + \ "set -g terminal-overrides 'xterm*:smcup@:rmcup@'"] + if s:tmuxversion >= "1.5" + let cnflines += [ + \ 'set -g mode-mouse on', + \ 'set -g mouse-select-pane on', + \ 'set -g mouse-resize-pane on'] + endif + call writefile(cnflines, tmxcnf) let g:ScreenShellTmuxInitArgs = g:ScreenShellTmuxInitArgs . " -f " . tmxcnf endif else @@ -2331,17 +2337,14 @@ endif if g:vimrplugin_screenplugin " Future: Remove this Tmux version test on 2014 if g:vimrplugin_tmux - let s:xx = system("tmux -V") - let s:xx = substitute(s:xx, '.*tmux \([0-9]\.[0-9]\).*', '\1', '') - if strlen(s:xx) > 6 && g:ScreenVersion > "1.4" + if strlen(s:tmuxversion) > 6 && g:ScreenVersion > "1.4" call RWarningMsgInp("Tmux <= 1.3 requires Screen plugin <= 1.4. You should either upgrade Tmux or downgrade the Screen plugin.") endif - if strlen(s:xx) < 7 && g:ScreenVersion < "1.5" + if strlen(s:tmuxversion) < 7 && g:ScreenVersion < "1.5" call RWarningMsgInp("Vim-R-plugin requires Screen plugin >= 1.5") let g:rplugin_failed = 1 finish endif - unlet s:xx elseif g:ScreenVersion < "1.5" call RWarningMsgInp("Vim-R-plugin requires Screen plugin >= 1.5") let g:rplugin_failed = 1 From b386da691f0022b985d42bbacced4cb9acf7464c Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 26 Nov 2011 16:15:34 -0300 Subject: [PATCH 0101/1050] No need to type ":q" twice to finish Vim. --- r-plugin/common_global.vim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 428352d..378ed92 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -17,7 +17,7 @@ " " Based on previous work by Johannes Ranke " -" Last Change: Sat Nov 26, 2011 04:06PM +" Last Change: Sat Nov 26, 2011 04:12PM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -1183,6 +1183,7 @@ function RQuit(how) endif if g:vimrplugin_screenplugin && exists(':ScreenQuit') ScreenQuit + q elseif g:vimrplugin_conqueplugin sleep 200m exe "sil bdelete " . b:conque_bufname From c7e39be56e38de4c8e75a1f80bc629ecf73f9fd0 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 26 Nov 2011 17:27:58 -0300 Subject: [PATCH 0102/1050] Don't do ":q" after ScreenQuit. If there are other tabs open, they will all be closed and data may be lost. --- r-plugin/common_global.vim | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 378ed92..17f337d 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -17,7 +17,7 @@ " " Based on previous work by Johannes Ranke " -" Last Change: Sat Nov 26, 2011 04:12PM +" Last Change: Sat Nov 26, 2011 05:27PM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -400,7 +400,7 @@ function StartR(whatr) endif if g:vimrplugin_screenplugin - let rcmd = "export VIMRPLUGIN_TMPDIR=" . $VIMRPLUGIN_TMPDIR . " ; ". rcmd + let rcmd = "VIMRPLUGIN_TMPDIR=" . $VIMRPLUGIN_TMPDIR . " ". rcmd if g:vimrplugin_screenvsplit if exists(":ScreenShellVertical") == 2 exec 'ScreenShellVertical ' . rcmd @@ -1183,7 +1183,6 @@ function RQuit(how) endif if g:vimrplugin_screenplugin && exists(':ScreenQuit') ScreenQuit - q elseif g:vimrplugin_conqueplugin sleep 200m exe "sil bdelete " . b:conque_bufname From 83a143c65d3c469a5addd2441fba8e623463b98e Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 26 Nov 2011 22:20:09 -0300 Subject: [PATCH 0103/1050] Make \r- and \r= work again. --- ftplugin/rbrowser.vim | 6 +++--- r-plugin/common_global.vim | 33 ++++++++++++++++++++++++++------- 2 files changed, 29 insertions(+), 10 deletions(-) diff --git a/ftplugin/rbrowser.vim b/ftplugin/rbrowser.vim index fc21b1f..302b6e8 100644 --- a/ftplugin/rbrowser.vim +++ b/ftplugin/rbrowser.vim @@ -16,7 +16,7 @@ " " Author: Jakson Alves de Aquino " -" Last Change: Fri Nov 25, 2011 08:44PM +" Last Change: Sat Nov 26, 2011 09:13PM "========================================================================== " Only do this when not yet done for this buffer @@ -439,7 +439,7 @@ function! RBrowserDoubleClick() endfunction function! RBrowserOpenCloseLists(status) - if !exists("b:isremoteobjbr") + if !exists("b:myservername") if !buflisted("Object_Browser") call RWarningMsg('There is no "Object_Browser" buffer.') return @@ -459,7 +459,7 @@ function! RBrowserOpenCloseLists(status) endfor call RBrowserFill(0) - if !exists("b:isremoteobjbr") + if !exists("b:myservername") if switchedbuf exe "sil noautocmd sb " . g:rplugin_curbuf exe "set switchbuf=" . savesb diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 17f337d..21416bb 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -17,7 +17,7 @@ " " Based on previous work by Johannes Ranke " -" Last Change: Sat Nov 26, 2011 05:27PM +" Last Change: Sat Nov 26, 2011 09:49PM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -612,9 +612,12 @@ function RObjBrowser() \ 'let b:myservername = "' . v:servername . '"', \ 'set filetype=rbrowser', \ 'setlocal modifiable', + \ 'set shortmess=atI', + \ 'set rulerformat=%3(%l%)', + \ 'set noruler', \ 'let curline = line(".")', \ 'let curcol = col(".")', - \ 'normal! ggdG', + \ 'normal! ggDjdG', \ 'source ' . objbr, \ 'call RBrowserFillCloseList()', \ 'call RBrowserFill(0)', @@ -634,7 +637,6 @@ function RObjBrowser() endwhile call remote_send("OBJBROWSER", ":source " . objbrowserfile . "") - call remote_send("OBJBROWSER", ":echon") return endif @@ -715,6 +717,15 @@ function RObjBrowser() exe "set switchbuf=" . savesb endfunction +function RObjBrowserOCLists(status) + if exists("*RBrowserOpenCloseLists") + call RBrowserOpenCloseLists(a:status) + elseif serverlist() =~ "OBJBROWSER" + call remote_expr("OBJBROWSER", "RBrowserOpenCloseLists(" . a:status . ")") + call remote_send("OBJBROWSER", ":redraw:echon ' '") + endif +endfunction + " Scroll conque term buffer (called by CursorHold event) function RScrollTerm() if &ft != "r" && &ft != "rnoweb" && &ft != "rhelp" && &ft != "rdoc" @@ -1747,8 +1758,13 @@ function RControlMaps() " Build list of objects for omni completion "------------------------------------- call RCreateMaps("nvi", 'RUpdateObjBrowser', 'ro', ':call RObjBrowser()') - call RCreateMaps("nvi", 'ROpenLists', 'r=', ':call RBrowserOpenCloseLists(1)') - call RCreateMaps("nvi", 'RCloseLists', 'r-', ':call RBrowserOpenCloseLists(0)') + if &filetype == "rbrowser" + call RCreateMaps("nvi", 'ROpenLists', 'r=', ':call RBrowserOpenCloseLists(1)') + call RCreateMaps("nvi", 'RCloseLists', 'r-', ':call RBrowserOpenCloseLists(0)') + else + call RCreateMaps("nvi", 'ROpenLists', 'r=', ':call RObjBrowserOCLists(1)') + call RCreateMaps("nvi", 'RCloseLists', 'r-', ':call RObjBrowserOCLists(0)') + endif endfunction @@ -2301,6 +2317,9 @@ if g:vimrplugin_screenplugin let g:ScreenImpl = 'Tmux' let s:tmuxversion = system("tmux -V") let s:tmuxversion = substitute(s:tmuxversion, '.*tmux \([0-9]\.[0-9]\).*', '\1', '') + if strlen(s:tmuxversion) != 3 + let s:tmuxversion = "1.0" + endif if g:vimrplugin_notmuxconf == 0 if $DISPLAY != "" || $TERM =~ "xterm" let g:ScreenShellTmuxInitArgs = "-2" @@ -2337,10 +2356,10 @@ endif if g:vimrplugin_screenplugin " Future: Remove this Tmux version test on 2014 if g:vimrplugin_tmux - if strlen(s:tmuxversion) > 6 && g:ScreenVersion > "1.4" + if s:tmuxversion == "1.0" && g:ScreenVersion > "1.4" call RWarningMsgInp("Tmux <= 1.3 requires Screen plugin <= 1.4. You should either upgrade Tmux or downgrade the Screen plugin.") endif - if strlen(s:tmuxversion) < 7 && g:ScreenVersion < "1.5" + if s:tmuxversion < "1.5" && g:ScreenVersion < "1.5" call RWarningMsgInp("Vim-R-plugin requires Screen plugin >= 1.5") let g:rplugin_failed = 1 finish From c14c5bc0c0f8d94af3cef47dbafea50bf5d74ce7 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sun, 27 Nov 2011 09:33:04 -0300 Subject: [PATCH 0104/1050] Add noten about what is. --- doc/r-plugin.txt | 150 +++++++++++++++++++++++------------------------ 1 file changed, 74 insertions(+), 76 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 061e410..40406cc 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -5,7 +5,7 @@ Authors: Jakson A. Aquino Jose Claudio Faria -Version: 1.0 +Version: 0.9 For Vim version 7.3 1. Overview |r-plugin-overview| @@ -89,6 +89,9 @@ either Unix/Linux/OSX or Windows; (3) troubleshooting; and (4) optional steps. 3.1. General instructions I~ +Note: Most of the plugin commands require that you type the +which is '\' by default. + You need to activate plugins and indentation according to 'filetype'. You should have at least the following options in your |vimrc|: > @@ -222,11 +225,13 @@ may have to adjust the value of |vimrplugin_sleeptime|. 3.3. Troubleshooting (if the plugin doesn't work)~ +Note: The is '\' by default. + The plugin is a |file-type| plugin. It will be active only if you are editing a .R or .Rnw file. The menu items and tool bar buttons will not be visible and the key bindings will not be active while editing either unnamed files or files with name extensions other than .R or .Rnw. If the plugin is active, -pressing rf should start R (the is '\' by default). +pressing rf should start R. Look at the ~/.vim (Linux, Unix, OS X) or ~/vimfiles (Windows) directory. Is there a subdirectory named "r-plugin"? If not, then you unpacked the plugin in @@ -243,19 +248,19 @@ you may prefer to install the Debian package available at: 3.4. General instructions II (optional steps)~ -Update list of objects~ +3.4.1 Update list of objects~ Start R and update the list of objects for omni completion and syntax highlight (see |:RUpdateObjList| for details). -Customize the plugin~ +3.4.2 Customize the plugin~ Please, read the section |r-plugin-options|. Emacs/ESS users should read the section Indenting setup (|r-plugin-indenting|) of this document. -Hide unused buttons~ +3.4.3 Hide unused buttons~ Edit Vim's toolbar and remove the buttons that you never use. The plugin adds some buttons to the toolbar, but you may not see them because gvim has too @@ -265,7 +270,7 @@ on the toolbar: http://vim.wikia.com/wiki/Hide_toolbar_or_menus_to_see_more_text -Install additional plugins~ +3.4.4 Install additional plugins~ You may be interested in installing additional general plugins to get functionality not provided by this file type plugin. ShowMarks and snipMate @@ -278,13 +283,19 @@ are particularly interesting. Please read |r-plugin-tips| for details. 4.1. Key bindings~ -To use the plugin, open a .R or .Rnw or .Rd file with Vim and type \rf -(replace \ with the key used as ). Then, you will be able to use -the plugin key bindings to send commands to R. +Note: The is '\' by default. + +Note: It is recommended the use of different keys for and + to avoid clashes between filetype plugins and general plugins +key binds. See |filetype-plugins| and |maplocalleader|. + +To use the plugin, open a .R or .Rnw or .Rd file with Vim and type +rf. Then, you will be able to use the plugin key bindings to send +commands to R. This plugin has many key bindings, which correspond with menu entries and, in some cases, toolbar buttons. In the list below, the backslash represents the - (see |maplocalleader|). Not all menu items and key bindings are +. Not all menu items and key bindings are enabled in all filetypes supported by the plugin (r, rnoweb, rhelp): Start/Close @@ -389,30 +400,31 @@ Help (R) Please see |r-plugin-key-bindings| to learn how to customize the key bindings without editing the plugin directly. -After the command \ao, Vim will save the current buffer if it has any pending -changes, run "R CMD BATCH --no-restore --no-save" on the current file and show -the resulting .Rout file in a new tab. Please see |vimrplugin_routnotab| if -you prefer that the file is open in a new split window. Note: The command -\ao, silently writes the current buffer to its file if it was modified and -deletes the .Rout file if it exists. +After the command ao, Vim will save the current buffer if it has +any pending changes, run "R CMD BATCH --no-restore --no-save" on the current +file and show the resulting .Rout file in a new tab. Please see +|vimrplugin_routnotab| if you prefer that the file is open in a new split +window. Note: The command ao, silently writes the current buffer +to its file if it was modified and deletes the .Rout file if it exists. R syntax uses " <- " to assign values to variables which is inconvenient to type. In insert mode, typing a single underscore, "_", will write " <- ", unless you are typing inside a string. The replacement will always happen if syntax highlighting is off (see |:syn-on| and |:syn-off|). If necessary, it is possible to insert an actual underscore into your file by typing a second -underscore. This behavior is similar to the EMACS ESS mode some users may be +underscore. This behavior is similar to the EMACS ESS mode some users may be familiar with and is enabled by default. You have to change the value of |vimrplugin_underscore| to disable underscore replacement. -When you press \rh, the plugin shows the help for the function under the -cursor. The plugin also checks the class of the object passed as argument to -the function to try to figure out whether the function is a generic one and -whether it is more appropriate to show a specific method. The same procedure -is followed with \rp, that is, while printing an object. For example, if you -run the code below and, then, press rh and rp over -the two occurrences of summary, the plugin will show different documentations -and print different objects in each case: +When you press rh, the plugin shows the help for the function +under the cursor. The plugin also checks the class of the object passed as +argument to the function to try to figure out whether the function is a +generic one and whether it is more appropriate to show a specific method. The +same procedure is followed with rp, that is, while printing an +object. For example, if you run the code below and, then, press +rh and rp over the two occurrences of summary, the +plugin will show different documentations and print different objects in each +case: > y <- rnorm(100) x <- rnorm(100) @@ -423,7 +435,7 @@ and print different objects in each case: 4.2. Edition of rnoweb files~ -In Rnoweb files (.Rnw), when the cursor is over the @ character, which +In Rnoweb files (.Rnw), when the cursor is over the "@" character, which finishes an R chunk, the sending of all commands to R is suspended and the shortcut to send the current line makes the cursor to jump to the next chunk. While editing rnoweb files, the following commands are available in Normal @@ -467,12 +479,12 @@ and, then, build the "omniList". 4.4. The Object Browser~ -You have to do \ro to either start or updated the Object Browser. The Object -Browser has two views: .GlobalEnv and Libraries. If you either press -or double click (GVim only) on the first line of the Object Browser it will -toggle the view between the objects in .GlobalEnv and the currently loaded -libraries (but only libraries loaded when |:RUpdateObjList| was run will be -shown). +You have to do ro to either start or updated the Object Browser. +The Object Browser has two views: .GlobalEnv and Libraries. If you either +press or double click (GVim only) on the first line of the Object +Browser it will toggle the view between the objects in .GlobalEnv and the +currently loaded libraries (but only libraries loaded when |:RUpdateObjList| +was run will be shown). In the .GlobalEnv view, if an object has the attribute "label", it will be displayed in the Object Browser. The options |vimrplugin_open_df| and @@ -596,7 +608,7 @@ A sample detachable session could be: vim theScript.R - Use Vim to start an R session: - \rf + rf - Send code from Vim to R, and, then, detach Vim and R with d The command will be d if you have not set as the scape @@ -643,14 +655,14 @@ useful: Vim can automatically complete the names of R objects when CTRL-X CTRL-O is pressed in insert mode (see |omni-completion| for details and 'completeopt' to -know how to customize the |omni-completion|). Omni completion shows in a pop +know how to customize the |omni-completion|). Omni completion shows in a pop up menu the name of the object, its class and its environment (most frequently, its package name). If the object is a function, its arguments are shown in a separate window. If a data.frame is found, while building the list of objects, the columns in the data.frame are added to the list. When you try to use omni completion to -complete the name of a data.frame, the columns are not shown. But when the +complete the name of a data.frame, the columns are not shown. But when the data.frame name is already complete, and you have inserted the '$' symbol, omni completion will show the column names. @@ -708,7 +720,7 @@ reattach to the R session, open a new terminal window and type: 6.3. The clipboard's content is lost (Windows only)~ On Windows, the plugin copies the command that will be sent to R into the -clipboard. Thus, if you have anything in the clipboard it will be lost while +clipboard. Thus, if you have anything in the clipboard it will be lost while using the plugin. @@ -767,7 +779,6 @@ duplicated to R on Mac OS X. |vimrplugin_rnowebchunk| Convert '<' into '<<>>=\n@' in Rnoweb files |vimrplugin_objbr_place| Placement of Object Browser |vimrplugin_objbr_w| Initial width of Object Browser window -|vimrplugin_console_w| Width of R Console after starting Object Browser |vimrplugin_vimpager| Use Vim to see R documentation |vimrplugin_editor_w| Minimum width of R script buffer |vimrplugin_help_w| Desired width of R documentation buffer @@ -847,7 +858,6 @@ put in your |vimrc|: 7.3. Object Browser options~ *vimrplugin_objbr_place* *vimrplugin_objbr_w* - *vimrplugin_console_w* *vimrplugin_open_df* *vimrplugin_open_list* *vimrplugin_allnames* @@ -870,17 +880,6 @@ running. Valid values for the Object Browser placement are "script" or let vimrplugin_objbr_place = "script,right" let vimrplugin_objbr_place = "console,left" < -While splitting a Tmux pane, we can only define the width of the right pane. -Thus, if the value of |vimrplugin_objbr_place| == "console,left", we have to -calculate the width of R Console instead of using the value of -|vimrplugin_objbr_w|. If |vimrplugin_screenvsplit| == 0, the Vim-R-plugin will -use the value of 'columns' to calculate the width of R Console, but if -|vimrplugin_screenvsplit| == 1, you have to set the value of -|vimrplugin_console_w| according to the width of the terminal emulator that -you usually use (the default value is 80): -> - let vimrplugin_console_w = 90 -< By default, the elements of data.frames are shown in the object browser, but not the elements of other types of lists. You can put the following in your |vimrc| to change this behavior: @@ -915,7 +914,7 @@ the R console, put in your .Rprofile: The plugin key bindings will remain active in the documentation buffer, and, thus, you will be able to send commands to R as you do while editing an R -script. You can, for example, use rh to jump to another R help +script. You can, for example, use rh to jump to another R help document. The valid values of vimrplugin_vimpager are: @@ -933,7 +932,7 @@ The valid values of vimrplugin_vimpager are: The window will be considered large enough if it has more columns than vimrplugin_editor_w + vimrplugin_help_w. These variables control the minimum width of the editor window and the help window, and their default values are, -respectively, 66 and 46. Thus, if you want to have more control over Vim's +respectively, 66 and 46. Thus, if you want to have more control over Vim's behavior while opening R's documentations, you will want to set different values to some variables in your |vimrc|, as in the example: > @@ -1028,20 +1027,20 @@ scripts, put the following in your |vimrc|: 7.11. How to automatically open the .Rout file~ *vimrplugin_routnotab* -After the command \ao, Vim will save the current buffer if it has any pending -changes, run "R CMD BATCH --no-restore --no-save" on the current file and show -the resulting .Rout file in a new tab. If you prefer that the file is open in -a new split window, put in your |vimrc|: +After the command ao, Vim will save the current buffer if it has +any pending changes, run "R CMD BATCH --no-restore --no-save" on the current +file and show the resulting .Rout file in a new tab. If you prefer that the +file is open in a new split window, put in your |vimrc|: > let vimrplugin_routnotab = 1 < 7.12. Indent commented lines~ *vimrplugin_indent_commented* -You can type \xx (where "\" is the ) to comment out a line or -selected lines. If the line already starts with a comment string, it will be -removed. After adding the comment string, the line will be reindented by -default. To turn off the automatic indentation, put in your |vimrc|: +You can type xx to comment out a line or selected lines. If the +line already starts with a comment string, it will be removed. After adding +the comment string, the line will be reindented by default. To turn off the +automatic indentation, put in your |vimrc|: > let vimrplugin_indent_commented = 0 < @@ -1086,7 +1085,7 @@ If you want to use your own ~/.screenrc, put in your vimrc: *vimrplugin_tmux* The screen.vim plugin supports both GNU Screen and Tmux, but only Tmux allows you to split the terminal vertically (that is, to have the panels side by -side). Please read |screen-intro| and |screen-shell-vertical| for details. By +side). Please read |screen-intro| and |screen-shell-vertical| for details. By default, the Vim-R-plugin will tell the screen.vim plugin to split the terminal horizontally. If you prefer to split it vertically put in your |vimrc|: @@ -1263,8 +1262,7 @@ the levels command: > map rk :call RAction("levels") < -Then (assuming that the local leader key is "\") if you type \rk R will -receive the command +Then if you type rk R will receive the command > levels(myObject) < @@ -1361,10 +1359,10 @@ and in your |vimrc| (see |vimrplugin_vimpager|): 10.3. How do marked blocks work?~ *r-plugin-showmarks* Vim allows several marks (bookmarks). The most commonly used marks are the -lowercase alphabet letters. If the cursor is between any two marks, the +lowercase alphabet letters. If the cursor is between any two marks, the plugin will send all of the lines between them to R. To create a mark, press m in Normal mode. - + We recommended the use of ShowMarks plugin which show what lines have marks defined. The plugin is available at: @@ -1416,7 +1414,7 @@ as the instead of the default backslash (see |maplocalleader|): 10.7. Use a tags file to jump to function definitions~ *r-plugin-tagsfile* Vim can jump to a function definition if it finds a "tags" file with the -information about the place where the function is defined. To generate the +information about the place where the function is defined. To generate the tags file, use the R function rtags(), which will build an Emacs tags file. If Vim was compiled with the feature |emacs_tags|, it will be able to read the tags file. Otherwise, you can use the function etags2ctags() from the script @@ -1578,9 +1576,9 @@ line in your |vimrc|: If you are using Compiz, it may be easier to work with the plugin if the various related windows (editor, terminal, and graphics window) are grouped -because they will be raised together when one of them receives the focus. You -may need CompizConfig Settings Manager installed to enable this feature (look -at the "Window Management" section for "Group and Tab Windows"). +because they will be raised together when one of them receives the focus. +You may need CompizConfig Settings Manager installed to enable this feature +(look at the "Window Management" section for "Group and Tab Windows"). 10.15. Why do I have to updated the Object Browser manually?~ @@ -1590,7 +1588,7 @@ possible to Vim to know whether R is busy or not. If R was running as part of the text editor, as happens with RStudio, JGR, RKward, and others, which are linked to libR.so, it would be possible to wait for R to finish processing a command before sending to it a command to rebuild the list of objects for the -Object Browser. This command should be sent after each line sent to R. But if +Object Browser. This command should be sent after each line sent to R. But if the Vim-R-plugin did this, the use of Vim would be blocked until R finished its processing. @@ -1686,12 +1684,12 @@ Put in your |vimrc| (replace with the shortcut of your preference): > nmap :runtime ftplugin/r.vim < -Press \rf to use R. That is, press before AND after starting R -with the shortcut rf (or any other key binding that you have -defined in your |vimrc| as the shortcut to start R). The first time that -is pressed, the plugin's functions and key bindings are made available. -However, when R is started, Vim is closed and restarted by the screen.vim -plugin, and the Vim-R-plugin functions and key bindings are lost. +Press rf to use R. That is, press before AND after +starting R with the shortcut rf (or any other key binding that +you have defined in your |vimrc| as the shortcut to start R). The first time +that is pressed, the plugin's functions and key bindings are made +available. However, when R is started, Vim is closed and restarted by the +screen.vim plugin, and the Vim-R-plugin functions and key bindings are lost. Consequently, the ftplugin/r.vim script must be sourced again by pressing for the second time. @@ -1791,7 +1789,7 @@ the R syntax highlighted. *r-plugin-news* 12. News~ -1.0 (2011-11-26) +0.9 (2011-11-26) * Add "terminal" to the list of known terminal emulators (thanks for "i5m" for the patch). From a23c57a438791179e67004f12593af57a3357527 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sun, 27 Nov 2011 09:35:12 -0300 Subject: [PATCH 0105/1050] Do not use vimrplugin_console_w anymore. --- r-plugin/common_global.vim | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 21416bb..d4888de 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -17,7 +17,7 @@ " " Based on previous work by Johannes Ranke " -" Last Change: Sat Nov 26, 2011 09:49PM +" Last Change: Sun Nov 27, 2011 12:15AM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -583,15 +583,19 @@ function RObjBrowser() let slist = serverlist() if slist !~ "OBJBROWSER" if g:vimrplugin_objbr_place =~ "left" - if g:vimrplugin_screenvsplit - let console_w = g:vimrplugin_console_w - else - let console_w = &columns - g:vimrplugin_objbr_w + " Get the R Console width: + let conw = system("tmux list-panes | cat") + let conw = substitute(conw, '.*\n1: \[\([0-9]*\)x.*', '\1', "") + let panewidth = conw - g:vimrplugin_objbr_w + " Just to be safe: If the above code doesn't work as expected + " and we get a spurious value: + if panewidth < 40 || panewidth > 180 + let panewidth = 80 endif - let cmd = "tmux split-window -d -h -l " . console_w . ' -t 1 "vim --servername OBJBROWSER"' else - let cmd = "tmux split-window -d -h -l " . g:vimrplugin_objbr_w . ' -t 1 "vim --servername OBJBROWSER"' + let panewidth = g:vimrplugin_objbr_w endif + let cmd = "tmux split-window -d -h -l " . panewidth . ' -t 1 "vim --servername OBJBROWSER"' let rlog = system(cmd) if v:shell_error let rlog = substitute(rlog, '\n', ' ', 'g') @@ -2230,7 +2234,6 @@ call RSetDefaultValue("g:vimrplugin_routnotab", 0) call RSetDefaultValue("g:vimrplugin_editor_w", 66) call RSetDefaultValue("g:vimrplugin_help_w", 46) call RSetDefaultValue("g:vimrplugin_objbr_w", 40) -call RSetDefaultValue("g:vimrplugin_console_w", 80) call RSetDefaultValue("g:vimrplugin_buildwait", 120) call RSetDefaultValue("g:vimrplugin_indent_commented", 1) call RSetDefaultValue("g:vimrplugin_by_vim_instance", 0) From afc11b8a0705626834e2470bddb823f170c45ca2 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sun, 27 Nov 2011 16:49:36 -0300 Subject: [PATCH 0106/1050] Work with MS Windows console version of Vim. --- ftplugin/r.vim | 4 ++-- ftplugin/rhelp.vim | 4 ++-- r-plugin/common_global.vim | 22 +++++++++++----------- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/ftplugin/r.vim b/ftplugin/r.vim index c9fc968..7507edb 100644 --- a/ftplugin/r.vim +++ b/ftplugin/r.vim @@ -19,7 +19,7 @@ " " Based on previous work by Johannes Ranke " -" Last Change: Fri Nov 25, 2011 08:43PM +" Last Change: Sun Nov 27, 2011 04:35PM " " Please see doc/r-plugin.txt for usage details. "========================================================================== @@ -59,7 +59,7 @@ function! ShowRout() " if not silent, the user will have to type silent update - if has("gui_win32") + if has("win32") | has("win64") let rcmd = 'Rcmd.exe BATCH --no-restore --no-save "' . expand("%") . '" "' . routfile . '"' else let rcmd = g:rplugin_R . " CMD BATCH --no-restore --no-save '" . expand("%") . "' '" . routfile . "'" diff --git a/ftplugin/rhelp.vim b/ftplugin/rhelp.vim index ef0efe5..a4f3c7e 100644 --- a/ftplugin/rhelp.vim +++ b/ftplugin/rhelp.vim @@ -19,7 +19,7 @@ " " Based on previous work by Johannes Ranke " -" Last Change: Fri Nov 25, 2011 08:43PM +" Last Change: Sun Nov 27, 2011 04:35PM " " Please see doc/r-plugin.txt for usage details. "========================================================================== @@ -56,7 +56,7 @@ function! ShowRout() " if not silent, the user will have to type silent update - if has("gui_win32") + if has("win32") || has("win64") let rcmd = 'Rcmd.exe BATCH --no-restore --no-save "' . expand("%") . '" "' . routfile . '"' else let rcmd = g:rplugin_R . " CMD BATCH --no-restore --no-save '" . expand("%") . "' '" . routfile . "'" diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index d4888de..12e6657 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -17,7 +17,7 @@ " " Based on previous work by Johannes Ranke " -" Last Change: Sun Nov 27, 2011 12:15AM +" Last Change: Sun Nov 27, 2011 04:40PM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -383,7 +383,7 @@ function StartR(whatr) return endif - if has("gui_win32") + if has("win32") || has("win64") if g:vimrplugin_conqueplugin == 0 exe s:py . " StartRPy()" lcd - @@ -765,7 +765,7 @@ function SendCmdToR(cmd) let cmd = a:cmd endif - if has("gui_win32") && g:vimrplugin_conqueplugin == 0 + if (has("win32") || has("win64")) && g:vimrplugin_conqueplugin == 0 let cmd = cmd . "\n" let slen = len(cmd) let str = "" @@ -1155,7 +1155,7 @@ endfunction " Clear the console screen function RClearConsole() - if has("gui_win32") && g:vimrplugin_conqueplugin == 0 + if (has("win32") || has("win64")) && g:vimrplugin_conqueplugin == 0 exe s:py . " RClearConsolePy()" silent exe '!start WScript "' . g:rplugin_jspath . '" "' . expand("%") . '"' else @@ -1173,7 +1173,7 @@ endfunction "Set working directory to the path of current buffer function RSetWD() let wdcmd = 'setwd("' . expand("%:p:h") . '")' - if has("gui_win32") + if has("win32") || has("win64") let wdcmd = substitute(wdcmd, "\\", "/", "g") endif let ok = SendCmdToR(wdcmd) @@ -1319,7 +1319,7 @@ endfunction function SetRTextWidth() if !bufloaded(s:rdoctitle) || g:vimrplugin_newsize == 1 " Bug fix for Vim < 7.2.318 - if !has("gui_win32") + if !(has("win32") || has("win64")) let curlang = v:lang language C endif @@ -1363,7 +1363,7 @@ function SetRTextWidth() endif let htw = printf("%f", htwf) let g:rplugin_htw = substitute(htw, "\\..*", "", "") - if !has("gui_win32") + if !(has("win32") || has("win64")) exe "language " . curlang endif endif @@ -2279,7 +2279,7 @@ if has('gui_running') let g:vimrplugin_screenplugin = 0 endif -if has("gui_win32") +if has("win32") || has("win64") call RSetDefaultValue("g:vimrplugin_conquesleep", 200) let vimrplugin_screenplugin = 0 let vimrplugin_tmux = 0 @@ -2287,7 +2287,7 @@ else call RSetDefaultValue("g:vimrplugin_conquesleep", 100) endif -if g:vimrplugin_applescript == 0 && !has("gui_win32") +if g:vimrplugin_applescript == 0 && !(has("win32") || has("win64")) let s:hastmux = executable('tmux') let s:hasscreen = executable('screen') if s:hastmux == 0 && s:hasscreen == 0 && g:vimrplugin_conqueplugin == 0 @@ -2391,7 +2391,7 @@ endif " Start with an empty list of objects in the workspace let g:rplugin_globalenvlines = [] -if has("gui_win32") +if has("win32") || has("win64") " python has priority over python3, unless ConqueTerm_PyVersion == 3 if has("python") let s:py = "py" @@ -2564,7 +2564,7 @@ let s:all_marks = "abcdefghijklmnopqrstuvwxyz" call writefile([], g:rplugin_globalenvfname) " Choose a terminal (code adapted from screen.vim) -if has("gui_win32") || vimrplugin_applescript +if has("win32") || has("win64") || vimrplugin_applescript " No external terminal emulator will be called, so any value is good let g:vimrplugin_term = "xterm" else From d34c8343b5d03ccad586048b1479b736cf1bb99d Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Mon, 28 Nov 2011 01:24:56 -0300 Subject: [PATCH 0107/1050] Add library(colorout) to ~/.Rprofile suggestion. --- doc/r-plugin.txt | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 40406cc..599bf36 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -1596,18 +1596,16 @@ its processing. 10.16. Edit your ~/.Rprofile~ You may want to edit your ~/.Rprofile. Two common options are the use of GVim -as the text editor and the use of html help. Example for Linux with these two -options and some others: -> - if (interactive()) { - local({ - options(editor = "gvim -f -c 'set ft=r'") - options(pager = "vim -c 'set ft=rdoc' -") - options(max.print = 999) - if(nchar(Sys.getenv("DISPLAY")) > 1) - grDevices::X11.options(width = 4.5, height = 4, - xpos = 1000, ypos = 0, pointsize = 10) - }) +as the text editor and the use of Vim as pager. Example for Linux with these +two options and some others: +> + if(interactive()){ + options(editor = "gvim -f -c 'set ft=r'") + options(pager = "vim -c 'set ft=rdoc' -") + library(colorout) + if(nchar(Sys.getenv("DISPLAY")) > 1) + grDevices::X11.options(width = 4.5, height = 4, xpos = 1000, + ypos = 0, pointsize = 10) } < The test for the environment variable DISPLAY is useful if you eventually use @@ -1789,7 +1787,7 @@ the R syntax highlighted. *r-plugin-news* 12. News~ -0.9 (2011-11-26) +0.9 (2011-11-27) * Add "terminal" to the list of known terminal emulators (thanks for "i5m" for the patch). From 66b6d360c30edc1f9cb5c94f81e4b6d53dc9f41f Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Mon, 28 Nov 2011 01:26:02 -0300 Subject: [PATCH 0108/1050] Set options(width) when creating and quiting OB. --- ftplugin/rbrowser.vim | 12 +++++++++++- r-plugin/common_global.vim | 3 ++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/ftplugin/rbrowser.vim b/ftplugin/rbrowser.vim index 302b6e8..56b8f63 100644 --- a/ftplugin/rbrowser.vim +++ b/ftplugin/rbrowser.vim @@ -16,7 +16,7 @@ " " Author: Jakson Alves de Aquino " -" Last Change: Sat Nov 26, 2011 09:13PM +" Last Change: Mon Nov 28, 2011 01:22AM "========================================================================== " Only do this when not yet done for this buffer @@ -636,6 +636,14 @@ function! LeaveRBrowser() endif endfunction +function! ObBrBufUnload() + if exists("b:myservername") + let colcmd = 'Sys.sleep(1) ; options(width = getOption("width") + ' . &columns . ')' + call remote_expr(b:myservername, "RGetRemoteCmd('" . colcmd . "')") + call system("tmux select-pane -t 0") + endif +endfunction + nmap :call RBrowserDoubleClick() nmap <2-LeftMouse> :call RBrowserDoubleClick() nmap :call RBrowserRightClick() @@ -656,6 +664,8 @@ if has("gui_running") unlet s:thisbuffname endif +au BufUnload call ObBrBufUnload() + let &cpo = s:cpo_save unlet s:cpo_save diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 12e6657..7725bb5 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -17,7 +17,7 @@ " " Based on previous work by Johannes Ranke " -" Last Change: Sun Nov 27, 2011 04:40PM +" Last Change: Mon Nov 28, 2011 01:16AM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -606,6 +606,7 @@ function RObjBrowser() if g:vimrplugin_objbr_place =~ "left" call system("tmux swap-pane -d -s 1 -t 2") endif + call SendCmdToR("options(width = as.numeric(Sys.getenv('COLUMNS')))") endif let objbrowserfile = $VIMRPLUGIN_TMPDIR . "/objbrowserInit" From dd38d9844f7a4cb1b71436c18ef7e7c0fd67eebf Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Mon, 28 Nov 2011 09:43:31 -0300 Subject: [PATCH 0109/1050] Write a tmux.conf instead of shipping one. --- doc/r-plugin.txt | 40 +++++++++++----- r-plugin/common_global.vim | 93 +++++++++++++++++++++----------------- 2 files changed, 79 insertions(+), 54 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 599bf36..d765afc 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -142,8 +142,8 @@ following dependencies: < If you are using Vim (not GVim), the plugin will run inside a Tmux session. If you are not already a user of Tmux, please, read the |r-plugin-tmux| section -to learn a few useful shortcuts. The tmux.conf file that ships with this -plugin sets Tmux to work with Vi key bindings. +to learn a few useful shortcuts. The tmux.conf file created by the plugin sets +Tmux to work with Vi key bindings. Note: The plugin can use different mechanisms to send commands to R. The mechanism that will be used depends on both what applications and plugins you @@ -550,10 +550,17 @@ source code. When running Vim in a terminal emulator (Linux/Unix only), the Vim-R-plugin will use the screen.vim plugin to restart Vim and start R in a Tmux session. The Tmux configuration file provided by the Vim-R-plugin configures Tmux to -use vi key bindings. The configuration script also sets as the Tmux -scape character (the default is ), that is, you have to type before -typing a Tmux command. Below are the most useful key bindings to use the -Vim-R-plugin with the provided tmux.conf. +use vi key bindings. It also configures Tmux to react to mouse clicks. You +should be able to switch the active pane by clicking on an inactive pane, to +resize the panes by clicking on the border line and dragging it, and to scroll +the R Console with the mouse wheel. When you use the mouse wheel, Tmux enters +in its copy/scroll back mode (see below). + +The configuration script also sets as the Tmux scape character (the +default is ), that is, you have to type before typing a Tmux +command. Below are the most useful key bindings to use Tmux with the tmux.conf +created by the Vim-R-plugin (see |vimrplugin_notmuxconf| if you prefer to use +your own ~/.tmux.conf) arrow keys : Move the cursor to the Tmux panel above, below, at the right or at the left of the current one. @@ -585,8 +592,7 @@ terminal emulator: > Note: was configured as the Tmux scape character, and it will not be passed to applications running under Tmux. To send to either R or Vim -you have to type a. You can also set a different escape character in your -~/.tmux.conf. +you have to type a. With Tmux, you can the detach the Vim-R session and reattach it latter. This is useful if you plan to begin the use the Vim-R-plugin in a machine and @@ -598,9 +604,20 @@ example below. A sample detachable session could be: - - Create your ~/.tmux.conf if it does not exist yet. You may use the - r-plugin/tmux.conf as a starting point to your own configuration file. - + - Create your ~/.tmux.conf if it does not exist yet. You may put the lines + below in your ~/.tmux.conf as a starting point to your own configuration + file: +> + set-option -g prefix C-a + unbind-key C-b + bind-key C-a send-prefix + set-window-option -g mode-keys vi + set -g status off + set -g terminal-overrides 'xterm*:smcup@:rmcup@' + set -g mode-mouse on + set -g mouse-select-pane on + set -g mouse-resize-pane on +< - Start Tmux: tmux @@ -1327,7 +1344,6 @@ directory after the installation: r-plugin/screenrc.xterm r-plugin/specialfuns.R r-plugin/tex_indent.vim - r-plugin/tmux.conf r-plugin/vimActivate.js r-plugin/windows.py syntax/rbrowser.vim diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 7725bb5..b384af6 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -17,7 +17,7 @@ " " Based on previous work by Johannes Ranke " -" Last Change: Mon Nov 28, 2011 01:16AM +" Last Change: Mon Nov 28, 2011 09:34AM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -481,7 +481,16 @@ function StartR(whatr) if g:vimrplugin_notmuxconf let tmxcnf = " " else - let tmxcnf = "-f " . g:rplugin_home . "/r-plugin/tmux.conf" + let tmxcnf = $VIMRPLUGIN_TMPDIR . "/tmux.conf" + let cnflines = [ + \ 'set-option -g prefix C-a', + \ 'unbind-key C-b', + \ 'bind-key C-a send-prefix', + \ 'set-window-option -g mode-keys vi', + \ 'set -g status off', + \ "set -g terminal-overrides 'xterm*:smcup@:rmcup@'"] + call writefile(cnflines, tmxcnf) + let tmxcnf = "-f " . tmxcnf endif call system("tmux has-session -t" . b:screensname) if v:shell_error @@ -1679,25 +1688,25 @@ function RCreateMenuItem(type, label, plug, combo, target) if a:type =~ "n" if hasmapto(a:plug, "n") let boundkey = RNMapCmd(a:plug) - exec 'nmenu &R.' . a:label . '' . boundkey . ' ' . tg + exec 'nmenu &R.' . a:label . '' . boundkey . ' ' . tg else - exec 'nmenu &R.' . a:label . s:tll . a:combo . ' ' . tg + exec 'nmenu &R.' . a:label . s:tll . a:combo . ' ' . tg endif endif if a:type =~ "v" if hasmapto(a:plug, "v") let boundkey = RVMapCmd(a:plug) - exec 'vmenu &R.' . a:label . '' . boundkey . ' ' . '' . tg + exec 'vmenu &R.' . a:label . '' . boundkey . ' ' . '' . tg else - exec 'vmenu &R.' . a:label . s:tll . a:combo . ' ' . '' . tg + exec 'vmenu &R.' . a:label . s:tll . a:combo . ' ' . '' . tg endif endif if a:type =~ "i" if hasmapto(a:plug, "i") let boundkey = RIMapCmd(a:plug) - exec 'imenu &R.' . a:label . '' . boundkey . ' ' . '' . tg . il + exec 'imenu &R.' . a:label . '' . boundkey . ' ' . '' . tg . il else - exec 'imenu &R.' . a:label . s:tll . a:combo . ' ' . '' . tg . il + exec 'imenu &R.' . a:label . s:tll . a:combo . ' ' . '' . tg . il endif endif endfunction @@ -1707,8 +1716,8 @@ function RBrowserMenu() call RCreateMenuItem("nvi", 'Object\ browser.Expand\ (all\ lists)', 'ROpenLists', 'r=', ':call RBrowserOpenCloseLists(1)') call RCreateMenuItem("nvi", 'Object\ browser.Collapse\ (all\ lists)', 'RCloseLists', 'r-', ':call RBrowserOpenCloseLists(0)') if &filetype == "rbrowser" - imenu R.Object\ browser.Toggle\ (cur)Enter :call RBrowserDoubleClick() - nmenu R.Object\ browser.Toggle\ (cur)Enter :call RBrowserDoubleClick() + imenu R.Object\ browser.Toggle\ (cur)Enter :call RBrowserDoubleClick() + nmenu R.Object\ browser.Toggle\ (cur)Enter :call RBrowserDoubleClick() endif let g:rplugin_hasmenu = 1 endfunction @@ -1896,8 +1905,8 @@ function MakeRMenu() "------------------------------- menu R.Command.-Sep3- if &filetype == "r" || &filetype == "rnoweb" || g:vimrplugin_never_unmake_menu - nmenu R.Command.Build\ tags\ file\ (cur\ dir):RBuildTags :call SendCmdToR('rtags(ofile = "TAGS")') - imenu R.Command.Build\ tags\ file\ (cur\ dir):RBuildTags :call SendCmdToR('rtags(ofile = "TAGS")')a + nmenu R.Command.Build\ tags\ file\ (cur\ dir):RBuildTags :call SendCmdToR('rtags(ofile = "TAGS")') + imenu R.Command.Build\ tags\ file\ (cur\ dir):RBuildTags :call SendCmdToR('rtags(ofile = "TAGS")')a endif menu R.-Sep7- @@ -1907,12 +1916,12 @@ function MakeRMenu() "---------------------------------------------------------------------------- if &filetype == "r" || &filetype == "rnoweb" || &filetype == "rhelp" || g:vimrplugin_never_unmake_menu if g:vimrplugin_underscore == 1 - imenu R.Edit.Insert\ \"\ <-\ \"_ :call ReplaceUnderS()a + imenu R.Edit.Insert\ \"\ <-\ \"_ :call ReplaceUnderS()a endif menu R.Edit.-Sep71- - nmenu R.Edit.Indent\ (line)== == - vmenu R.Edit.Indent\ (selected\ lines)= = - nmenu R.Edit.Indent\ (whole\ buffer)gg=G gg=G + nmenu R.Edit.Indent\ (line)== == + vmenu R.Edit.Indent\ (selected\ lines)= = + nmenu R.Edit.Indent\ (whole\ buffer)gg=G gg=G menu R.Edit.-Sep72- call RCreateMenuItem("ni", 'Edit.Comment/Uncomment\ (line/sel)', 'RCommentLine', 'xx', ':call RComment("normal")') call RCreateMenuItem("v", 'Edit.Comment/Uncomment\ (line/sel)', 'RCommentLine', 'xx', ':call RComment("selection")') @@ -1920,8 +1929,8 @@ function MakeRMenu() call RCreateMenuItem("v", 'Edit.Add/Align\ right\ comment\ (line,\ sel)', 'RRightComment', ';', ':call MovePosRCodeComment("selection")') if &filetype == "rnoweb" || g:vimrplugin_never_unmake_menu menu R.Edit.-Sep73- - nmenu R.Edit.Go\ (next\ R\ chunk)gn :call RnwNextChunk() - nmenu R.Edit.Go\ (previous\ R\ chunk)gN :call RnwPreviousChunk() + nmenu R.Edit.Go\ (next\ R\ chunk)gn :call RnwNextChunk() + nmenu R.Edit.Go\ (previous\ R\ chunk)gN :call RnwPreviousChunk() endif endif @@ -1933,10 +1942,10 @@ function MakeRMenu() "---------------------------------------------------------------------------- " Syntax "---------------------------------------------------------------------------- - nmenu R.Syntax.Build\ omniList\ (loaded):RUpdateObjList :call RBuildSyntaxFile("loaded") - imenu R.Syntax.Build\ omniList\ (loaded):RUpdateObjList :call RBuildSyntaxFile("loaded")a - nmenu R.Syntax.Build\ omniList\ (installed):RUpdateObjListAll :call RBuildSyntaxFile("installed") - imenu R.Syntax.Build\ omniList\ (installed):RUpdateObjListAll :call RBuildSyntaxFile("installed")a + nmenu R.Syntax.Build\ omniList\ (loaded):RUpdateObjList :call RBuildSyntaxFile("loaded") + imenu R.Syntax.Build\ omniList\ (loaded):RUpdateObjList :call RBuildSyntaxFile("loaded")a + nmenu R.Syntax.Build\ omniList\ (installed):RUpdateObjListAll :call RBuildSyntaxFile("installed") + imenu R.Syntax.Build\ omniList\ (installed):RUpdateObjListAll :call RBuildSyntaxFile("installed")a "---------------------------------------------------------------------------- " Help @@ -1996,29 +2005,29 @@ function MakeRMenu() " ToolBar "---------------------------------------------------------------------------- " Buttons - amenu ToolBar.RStart :call StartR("R") - amenu ToolBar.RClose :call SendCmdToR('quit(save = "no")') + amenu ToolBar.RStart :call StartR("R") + amenu ToolBar.RClose :call SendCmdToR('quit(save = "no")') "--------------------------- if &filetype == "r" || g:vimrplugin_never_unmake_menu - nmenu ToolBar.RSendFile :call SendFileToR("echo") - imenu ToolBar.RSendFile :call SendFileToR("echo") - endif - nmenu ToolBar.RSendBlock :call SendMBlockToR("echo", "down") - imenu ToolBar.RSendBlock :call SendMBlockToR("echo", "down") - nmenu ToolBar.RSendFunction :call SendFunctionToR("echo", "down") - imenu ToolBar.RSendFunction :call SendFunctionToR("echo", "down") - vmenu ToolBar.RSendSelection :call SendSelectionToR("echo", "down") - nmenu ToolBar.RSendParagraph :call SendParagraphToR("echo", "down") - imenu ToolBar.RSendParagraph :call SendParagraphToR("echo", "down") - nmenu ToolBar.RSendLine :call SendLineToR("down") - imenu ToolBar.RSendLine :call SendLineToR("down") + nmenu ToolBar.RSendFile :call SendFileToR("echo") + imenu ToolBar.RSendFile :call SendFileToR("echo") + endif + nmenu ToolBar.RSendBlock :call SendMBlockToR("echo", "down") + imenu ToolBar.RSendBlock :call SendMBlockToR("echo", "down") + nmenu ToolBar.RSendFunction :call SendFunctionToR("echo", "down") + imenu ToolBar.RSendFunction :call SendFunctionToR("echo", "down") + vmenu ToolBar.RSendSelection :call SendSelectionToR("echo", "down") + nmenu ToolBar.RSendParagraph :call SendParagraphToR("echo", "down") + imenu ToolBar.RSendParagraph :call SendParagraphToR("echo", "down") + nmenu ToolBar.RSendLine :call SendLineToR("down") + imenu ToolBar.RSendLine :call SendLineToR("down") "--------------------------- - nmenu ToolBar.RListSpace :call SendCmdToR("ls()") - imenu ToolBar.RListSpace :call SendCmdToR("ls()") - nmenu ToolBar.RClear :call RClearConsole() - imenu ToolBar.RClear :call RClearConsole() - nmenu ToolBar.RClearAll :call RClearAll() - imenu ToolBar.RClearAll :call RClearAll() + nmenu ToolBar.RListSpace :call SendCmdToR("ls()") + imenu ToolBar.RListSpace :call SendCmdToR("ls()") + nmenu ToolBar.RClear :call RClearConsole() + imenu ToolBar.RClear :call RClearConsole() + nmenu ToolBar.RClearAll :call RClearAll() + imenu ToolBar.RClearAll :call RClearAll() " Hints tmenu ToolBar.RStart Start R (default) From e381e5b9b5db4ed8428e4b55fc94330974efaef6 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Mon, 28 Nov 2011 09:46:03 -0300 Subject: [PATCH 0110/1050] Delete tmux.conf. --- r-plugin/tmux.conf | 22 ---------------------- 1 file changed, 22 deletions(-) delete mode 100644 r-plugin/tmux.conf diff --git a/r-plugin/tmux.conf b/r-plugin/tmux.conf deleted file mode 100644 index 6c4ceaf..0000000 --- a/r-plugin/tmux.conf +++ /dev/null @@ -1,22 +0,0 @@ -# tmux.conf for use with GVim - -# changing the main key binding -set-option -g prefix C-a -unbind-key C-b -bind-key C-a send-prefix - -# changing the mode-keys to vi -set-window-option -g mode-keys vi -# unbind [ -# bind Escape copy-mode -# unbind p -# bind p paste-buffer -# bind-key -t vi-copy 'v' begin-selection -# bind-key -t vi-copy 'y' copy-selection - -# Disable the status bar -set -g status off - -# Avoid scroll bug when copying and pasting text -set -g terminal-overrides 'xterm*:smcup@:rmcup@' - From e754dbd3e90d6e824f80f8fe86e3cd15d0109aef Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Mon, 28 Nov 2011 11:23:17 -0300 Subject: [PATCH 0111/1050] Delete screenrc and screenrc.xterm. --- doc/r-plugin.txt | 9 ++--- r-plugin/common_global.vim | 71 +++++++++++++++++++++++--------------- r-plugin/screenrc | 7 ---- r-plugin/screenrc.xterm | 9 ----- 4 files changed, 46 insertions(+), 50 deletions(-) delete mode 100644 r-plugin/screenrc delete mode 100644 r-plugin/screenrc.xterm diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index d765afc..10ab18b 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -643,10 +643,9 @@ will use the screen.vim plugin to restart Vim and start R in a Tmux session. However, the plugin will use GNU Screen if Tmux is not installed or if you have set the value of vimrplugin_tmux = 0 in your |vimrc|. -You may want to create your own ~/.screenrc to customize GNU Screen behavior. -The Vim-R-plugin comes with a sample screenrc (at r-plugin directory) that you -can use. Below are the most useful key bindings to use the Vim-R-plugin with -the provided screenrc: +You may want to create your own ~/.screenrc to customize GNU Screen behavior +(see |vimrplugin_noscreenrc|). Below are the most useful key bindings to use +the Vim-R-plugin with the screenrc that the plugin creates: : Move the cursor to the next panel. a : Decrease the height of the current panel. @@ -1340,8 +1339,6 @@ directory after the installation: r-plugin/vimprint.R r-plugin/vimSweave.R r-plugin/r.snippets - r-plugin/screenrc - r-plugin/screenrc.xterm r-plugin/specialfuns.R r-plugin/tex_indent.vim r-plugin/vimActivate.js diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index b384af6..e7be9a1 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -15,9 +15,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Based on previous work by Johannes Ranke -" -" Last Change: Mon Nov 28, 2011 09:34AM +" Last Change: Mon Nov 28, 2011 11:18AM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -335,18 +333,43 @@ function GoDown() endfunction function RWriteScreenRC() - let b:scrfile = $VIMRPLUGIN_TMPDIR . "/" . b:screensname . ".screenrc" - if g:vimrplugin_nosingler == 1 - let scrtitle = 'hardstatus string "' . expand("%:t") . '"' + if g:vimrplugin_noscreenrc + return " " + endif + + let scrcnf = $VIMRPLUGIN_TMPDIR . "/" . b:screensname . ".screenrc" + + if g:vimrplugin_screenplugin + let cnflines = [ + \ 'msgwait 0', + \ 'vbell off', + \ 'startup_message off', + \ 'bind a resize +1', + \ 'bind z resize -1', + \ "termcapinfo xterm* 'ti@:te@'"] + if $DISPLAY != "" || $TERM =~ "xterm" + let cnflines = cnflines + [ + \ "terminfo rxvt-unicode 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm'", + \ 'term screen-256color'] + endif else - let scrtitle = "hardstatus string R" - endif - let scrtxt = ["msgwait 1", "hardstatus lastline", scrtitle, - \ "caption splitonly", 'caption string "Vim-R-plugin"', - \ "termcapinfo xterm* 'ti@:te@'", 'vbell off'] - call writefile(scrtxt, b:scrfile) - let scrrc = "-c " . b:scrfile - return scrrc + if g:vimrplugin_nosingler == 1 + let scrtitle = 'hardstatus string "' . expand("%:t") . '"' + else + let scrtitle = "hardstatus string R" + endif + + let cnflines = ["msgwait 1", + \ "hardstatus lastline", + \ scrtitle, + \ "caption splitonly", + \ 'caption string "Vim-R-plugin"', + \ "termcapinfo xterm* 'ti@:te@'", + \ 'vbell off'] + endif + + call writefile(cnflines, scrcnf) + return " -c " . scrcnf endfunction " Start R @@ -400,7 +423,10 @@ function StartR(whatr) endif if g:vimrplugin_screenplugin - let rcmd = "VIMRPLUGIN_TMPDIR=" . $VIMRPLUGIN_TMPDIR . " ". rcmd + let rcmd = "VIMRPLUGIN_TMPDIR=" . $VIMRPLUGIN_TMPDIR . " " . rcmd + if g:vimrplugin_tmux == 0 && g:vimrplugin_noscreenrc == 0 && exists("g:ScreenShellScreenInitArgs") + let g:ScreenShellScreenInitArgs = RWriteScreenRC() + endif if g:vimrplugin_screenvsplit if exists(":ScreenShellVertical") == 2 exec 'ScreenShellVertical ' . rcmd @@ -507,11 +533,7 @@ function StartR(whatr) endif endif else - if g:vimrplugin_noscreenrc == 1 - let scrrc = " " - else - let scrrc = RWriteScreenRC() - endif + let scrrc = RWriteScreenRC() " Some terminals want quotes (see screen.vim) if g:rplugin_termcmd =~ "gnome-terminal" || g:rplugin_termcmd =~ "xfce4-terminal" || g:rplugin_termcmd =~ "terminal" || g:rplugin_termcmd =~ "iterm" let opencmd = printf("%s 'screen %s -d -RR -S %s %s' &", g:rplugin_termcmd, scrrc, b:screensname, rcmd) @@ -2356,13 +2378,6 @@ if g:vimrplugin_screenplugin endif else let g:ScreenImpl = 'GnuScreen' - if g:vimrplugin_noscreenrc == 0 && exists("g:ScreenShellScreenInitArgs") && g:ScreenShellScreenInitArgs == "" - if $DISPLAY != "" || $TERM =~ "xterm" - let g:ScreenShellScreenInitArgs = " -c " . g:rplugin_home . "/r-plugin/screenrc.xterm " - else - let g:ScreenShellScreenInitArgs = " -c " . g:rplugin_home . "/r-plugin/screenrc " - endif - endif endif endif @@ -2387,7 +2402,7 @@ endif " To run the Object Browser beside R Console with Tmux, Vim must have the " +clientserver feature and the X server must be running. if g:vimrplugin_screenplugin && g:vimrplugin_objbr_place =~ "console" - if $DISPLAY == "" + if $DISPLAY == "" || g:vimrplugin_tmux == 0 let g:vimrplugin_objbr_place = substitute(g:vimrplugin_objbr_place, "console", "script", "") elseif !has("clientserver") " Cannot use RWarningMsgInp because the message would be visible but diff --git a/r-plugin/screenrc b/r-plugin/screenrc deleted file mode 100644 index 2a725d1..0000000 --- a/r-plugin/screenrc +++ /dev/null @@ -1,7 +0,0 @@ -msgwait 0 -vbell off -startup_message off -bind a resize +1 -bind z resize -1 -termcapinfo xterm* 'ti@:te@' - diff --git a/r-plugin/screenrc.xterm b/r-plugin/screenrc.xterm deleted file mode 100644 index 86563e2..0000000 --- a/r-plugin/screenrc.xterm +++ /dev/null @@ -1,9 +0,0 @@ -msgwait 0 -vbell off -startup_message off -bind a resize +1 -bind z resize -1 -termcapinfo xterm* 'ti@:te@' -terminfo rxvt-unicode 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm' -term screen-256color - From 03d9b568596d4e387697a2cd02bd1b2b52fc1838 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Mon, 28 Nov 2011 12:06:59 -0300 Subject: [PATCH 0112/1050] Correctly calculate the doc tab width. --- r-plugin/common_global.vim | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index e7be9a1..0173f19 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -15,7 +15,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Mon Nov 28, 2011 11:18AM +" Last Change: Mon Nov 28, 2011 11:59AM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -1363,20 +1363,19 @@ function SetRTextWidth() let s:vimpager = g:vimrplugin_vimpager let wwidth = winwidth(0) - if wwidth <= (g:vimrplugin_help_w + g:vimrplugin_editor_w) - let s:vimpager = "horizontal" - endif - if g:vimrplugin_vimpager == "tab" || g:vimrplugin_vimpager == "tabnew" + " Not enough room to split vertically + if g:vimrplugin_vimpager == "vertical" && wwidth <= (g:vimrplugin_help_w + g:vimrplugin_editor_w) let s:vimpager = "horizontal" endif - if s:vimpager != "vertical" - "Default help_text_width: + if s:vimpager == "horizontal" + " Use the window width (at most 80 columns) + let htwf = (wwidth > 80) ? 88.1 : ((wwidth - 1) / 0.9) + elseif g:vimrplugin_vimpager == "tab" || g:vimrplugin_vimpager == "tabnew" + let wwidth = &columns let htwf = (wwidth > 80) ? 88.1 : ((wwidth - 1) / 0.9) else - " Not enough room to split vertically - let min_e = (g:vimrplugin_editor_w > 80) ? g:vimrplugin_editor_w : 80 let min_h = (g:vimrplugin_help_w > 73) ? g:vimrplugin_help_w : 73 From 040bad69f900a56a27465a2d536e42211be2071f Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Tue, 29 Nov 2011 00:15:29 -0300 Subject: [PATCH 0113/1050] Do not try to set "width" option. --- ftplugin/rbrowser.vim | 4 +--- r-plugin/common_global.vim | 3 +-- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/ftplugin/rbrowser.vim b/ftplugin/rbrowser.vim index 56b8f63..82ebf1c 100644 --- a/ftplugin/rbrowser.vim +++ b/ftplugin/rbrowser.vim @@ -16,7 +16,7 @@ " " Author: Jakson Alves de Aquino " -" Last Change: Mon Nov 28, 2011 01:22AM +" Last Change: Tue Nov 29, 2011 12:13AM "========================================================================== " Only do this when not yet done for this buffer @@ -638,8 +638,6 @@ endfunction function! ObBrBufUnload() if exists("b:myservername") - let colcmd = 'Sys.sleep(1) ; options(width = getOption("width") + ' . &columns . ')' - call remote_expr(b:myservername, "RGetRemoteCmd('" . colcmd . "')") call system("tmux select-pane -t 0") endif endfunction diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 0173f19..23536d3 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -15,7 +15,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Mon Nov 28, 2011 11:59AM +" Last Change: Tue Nov 29, 2011 12:12AM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -637,7 +637,6 @@ function RObjBrowser() if g:vimrplugin_objbr_place =~ "left" call system("tmux swap-pane -d -s 1 -t 2") endif - call SendCmdToR("options(width = as.numeric(Sys.getenv('COLUMNS')))") endif let objbrowserfile = $VIMRPLUGIN_TMPDIR . "/objbrowserInit" From e981080a27e13755bbce9dc58b0db8126bd8a607 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Fri, 2 Dec 2011 21:36:31 -0300 Subject: [PATCH 0114/1050] Be quieter when updating the Object Browser. --- ftplugin/rbrowser.vim | 6 +++++- r-plugin/common_global.vim | 5 +++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/ftplugin/rbrowser.vim b/ftplugin/rbrowser.vim index 82ebf1c..fb6743d 100644 --- a/ftplugin/rbrowser.vim +++ b/ftplugin/rbrowser.vim @@ -16,7 +16,7 @@ " " Author: Jakson Alves de Aquino " -" Last Change: Tue Nov 29, 2011 12:13AM +" Last Change: Wed Nov 30, 2011 05:17PM "========================================================================== " Only do this when not yet done for this buffer @@ -642,6 +642,10 @@ function! ObBrBufUnload() endif endfunction +function! SourceObjBrLines() + exe "source " . $VIMRPLUGIN_TMPDIR . "/objbrowserInit" +endfunction + nmap :call RBrowserDoubleClick() nmap <2-LeftMouse> :call RBrowserDoubleClick() nmap :call RBrowserRightClick() diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 23536d3..f999992 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -15,7 +15,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Tue Nov 29, 2011 12:12AM +" Last Change: Wed Nov 30, 2011 08:42PM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -672,6 +672,7 @@ function RObjBrowser() endwhile call remote_send("OBJBROWSER", ":source " . objbrowserfile . "") + call remote_send("OBJBROWSER", ":echon") return endif @@ -1767,7 +1768,7 @@ endfunction function RControlMaps() " List space, clear console, clear all "------------------------------------- - call RCreateMaps("nvi", 'RListSpace', 'rl', ':call SendCmdToR("ls()")') + call RCreateMaps("nvi", 'RListSpace', 'rl', ':call SendCmdToR("ls()")') call RCreateMaps("nvi", 'RClearConsole', 'rr', ':call RClearConsole()') call RCreateMaps("nvi", 'RClearAll', 'rm', ':call RClearAll()') From 49ecf8c0dd459a178e98d99d0bda1988e5727ee7 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Mon, 5 Dec 2011 07:31:37 -0300 Subject: [PATCH 0115/1050] Change SendMBlockToR() behavior. --- r-plugin/common_global.vim | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index f999992..634aff3 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -15,7 +15,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Wed Nov 30, 2011 08:42PM +" Last Change: Mon Dec 05, 2011 07:27AM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -970,8 +970,8 @@ function SendMBlockToR(e, m) let b:needsnewomnilist = 1 let curline = line(".") - let lineA = -1 - let lineB = line("$") + 1 + let lineA = 1 + let lineB = line("$") let maxmarks = strlen(s:all_marks) let n = 0 while n < maxmarks @@ -986,10 +986,13 @@ function SendMBlockToR(e, m) endif let n = n + 1 endwhile - if lineA == -1 || lineB == (line("$") + 1) - call RWarningMsg("The cursor is not between two marks!") + if lineA == 1 && lineB == (line("$")) + call RWarningMsg("The file has no mark!") return endif + if lineB < line("$") + let lineB -= 1 + endif let lines = getline(lineA, lineB) let ok = RSourceLines(lines, a:e) if ok == 0 From 08d2497586cef291a936a3ff26db9267495542c1 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Tue, 6 Dec 2011 10:23:45 -0300 Subject: [PATCH 0116/1050] Suggest the use of R package setwidth. --- doc/r-plugin.txt | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 10ab18b..caebd4d 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -130,15 +130,19 @@ following dependencies: Recommends:~ ncurses-term: http://invisible-island.net/ncurses colorout: An R package. + setwidth: An R package. Note: Tmux and ncurses-term are already packaged for most GNU/Linux distributions and other Unix variants. The library ncurses-term is necessary only for 256 color support in the terminal emulator. Unfortunately their installation instructions vary widely and are beyond - the scope of this documentation. The colorout package colorizes the R - output and can be installed from within R: + the scope of this documentation. + + The colorout package colorizes the R output and the setwidth package + adjusts the value of options("width") whenever the terminal is resized. + Both can be installed from within R: > - install.packages("colorout") + install.packages(c("colorout", "setwidth")) < If you are using Vim (not GVim), the plugin will run inside a Tmux session. If you are not already a user of Tmux, please, read the |r-plugin-tmux| section @@ -1613,12 +1617,17 @@ as the text editor and the use of Vim as pager. Example for Linux with these two options and some others: > if(interactive()){ - options(editor = "gvim -f -c 'set ft=r'") - options(pager = "vim -c 'set ft=rdoc' -") library(colorout) - if(nchar(Sys.getenv("DISPLAY")) > 1) - grDevices::X11.options(width = 4.5, height = 4, xpos = 1000, - ypos = 0, pointsize = 10) + library(setwidth) + if(nchar(Sys.getenv("DISPLAY")) > 1){ + grDevices::X11.options(width = 4.5, height = 4, ypos = 0, + xpos = 1000, pointsize = 10) + options(editor = 'gvim -f -c "set ft=r"') + options(pager = "gvim -c 'set ft=rdoc' -") + } else { + options(editor = 'vim -c "set ft=r"') + options(pager = "vim -c 'set ft=rdoc' -") + } } < The test for the environment variable DISPLAY is useful if you eventually use @@ -1800,7 +1809,7 @@ the R syntax highlighted. *r-plugin-news* 12. News~ -0.9 (2011-11-27) +0.9 (2011-11-28) * Add "terminal" to the list of known terminal emulators (thanks for "i5m" for the patch). From 3e65b581452ade6cf901b449c5a81ece61e05919 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Tue, 6 Dec 2011 10:26:39 -0300 Subject: [PATCH 0117/1050] Change the way that blocks are sent to R. --- doc/r-plugin.txt | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index caebd4d..04b0a13 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -1376,9 +1376,13 @@ and in your |vimrc| (see |vimrplugin_vimpager|): 10.3. How do marked blocks work?~ *r-plugin-showmarks* Vim allows several marks (bookmarks). The most commonly used marks are the -lowercase alphabet letters. If the cursor is between any two marks, the -plugin will send all of the lines between them to R. To create a mark, press -m in Normal mode. +lowercase alphabet letters. If the cursor is between any two marks, the plugin +will send the lines between them to R. If the cursor is above the first mark, +the plugin will send from the beginning of the file to the mark. If the cursor +is below the last mark, the plugin will send from the mark to the end of the +file. The mark above the cursor is included and the mark below is excluded +from the block to be sent to R. To create a mark, press m in Normal +mode. We recommended the use of ShowMarks plugin which show what lines have marks defined. The plugin is available at: @@ -1811,7 +1815,8 @@ the R syntax highlighted. 0.9 (2011-11-28) - * Add "terminal" to the list of known terminal emulators (thanks for "i5m" + * Changed the way that blocks are sent to R. + * Added "terminal" to the list of known terminal emulators (thanks for "i5m" for the patch). * Use Tmux to start the Object Browser beside the R console if vimrplugin_objbr_place =~ "console". From b5ce82b5e20a1f480b20c993554ca902432aa746 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Wed, 7 Dec 2011 13:52:31 -0300 Subject: [PATCH 0118/1050] Version 0.9.5. --- Makefile | 10 +++------- doc/r-plugin.txt | 4 ++-- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index d098c65..0e8c90b 100644 --- a/Makefile +++ b/Makefile @@ -22,7 +22,7 @@ PLUGINHOME=`pwd` -PLUGINVERSION=1.0 +PLUGINVERSION=0.9.5 DEBIANTIME=`date -R` PLUGINRELEASEDATE=`date +"%Y-%m-%d"` VIM2HTML=/usr/local/share/vim/vim73/doc/vim2html.pl @@ -44,8 +44,8 @@ zip: cp functions.vim.vanilla functions.vim ;\ cp omniList.vanilla omniList ) # Update the version date in doc/r-plugin.txt header and in the news - sed -i -e "s/^Version: [0-9].[0-9]/Version: $(PLUGINVERSION)/" doc/r-plugin.txt - sed -i -e "s/^$(PLUGINVERSION) (201[0-9]-[0-9][0-9]-[0-9][0-9])/$(PLUGINVERSION) ($(PLUGINRELEASEDATE))/" doc/r-plugin.txt + sed -i -e "s/^Version: [0-9].[0-9].[0-9]/Version: $(PLUGINVERSION)/" doc/r-plugin.txt + sed -i -e "s/^[0-9].[0-9].[0-9] (201[0-9]-[0-9][0-9]-[0-9][0-9])$$/$(PLUGINVERSION) ($(PLUGINRELEASEDATE))/" doc/r-plugin.txt # Create a tar.gz file tar -cvzf /tmp/vimrplugintmpfile.tar.gz ftdetect/r.vim indent/r.vim \ indent/rnoweb.vim indent/rhelp.vim autoload/rcomplete.vim ftplugin/r*.vim \ @@ -54,7 +54,6 @@ zip: r-plugin/global_r_plugin.vim r-plugin/omniList r-plugin/windows.py \ r-plugin/vimActivate.js r-plugin/tex_indent.vim r-plugin/r.snippets \ r-plugin/common_buffer.vim r-plugin/common_global.vim \ - r-plugin/tmux.conf r-plugin/screenrc r-plugin/screenrc.xterm \ bitmaps/ricon.xbm bitmaps/ricon.png \ bitmaps/RStart.png bitmaps/RStart.bmp \ bitmaps/RClose.png bitmaps/RClose.bmp \ @@ -131,9 +130,6 @@ deb: - r-plugin/global_r_plugin.vim\n\ - r-plugin/specialfuns.R\n\ - r-plugin/tex_indent.vim\n\ - - r-plugin/tmux.conf\n\ - - r-plugin/screenrc\n\ - - r-plugin/screenrc.xterm\n\ - r-plugin/vimbrowser.R\n\ - r-plugin/vimhelp.R\n\ - r-plugin/vimprint.R\n\ diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 04b0a13..881c19e 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -5,7 +5,7 @@ Authors: Jakson A. Aquino Jose Claudio Faria -Version: 0.9 +Version: 0.9.5 For Vim version 7.3 1. Overview |r-plugin-overview| @@ -1813,7 +1813,7 @@ the R syntax highlighted. *r-plugin-news* 12. News~ -0.9 (2011-11-28) +0.9.5 (2011-12-07) * Changed the way that blocks are sent to R. * Added "terminal" to the list of known terminal emulators (thanks for "i5m" From d0e9564d114ec3ceef43deb2d2fc7056492608ac Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 10 Dec 2011 12:18:06 -0300 Subject: [PATCH 0119/1050] Do not send empty line to R. --- r-plugin/common_global.vim | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 634aff3..d7b5ec1 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -15,7 +15,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Mon Dec 05, 2011 07:27AM +" Last Change: Sat Dec 10, 2011 12:16PM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -1148,6 +1148,12 @@ endfunction " Send current line to R. Don't go down if called by . function SendLineToR(godown) let line = getline(".") + if strlen(line) == 0 + if a:godown =~ "down" + call GoDown() + endif + return + endif if &filetype == "rnoweb" if line =~ "^@$" From 69cec4fc61f0a7c7f0f87b751db2063611a41b1c Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sun, 11 Dec 2011 22:38:03 -0300 Subject: [PATCH 0120/1050] New default values for objbr_place and vimpager. --- doc/r-plugin.txt | 20 +++++++++++++------- r-plugin/common_global.vim | 18 ++++++++++-------- 2 files changed, 23 insertions(+), 15 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 881c19e..db19ad6 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -144,10 +144,11 @@ following dependencies: > install.packages(c("colorout", "setwidth")) < -If you are using Vim (not GVim), the plugin will run inside a Tmux session. If -you are not already a user of Tmux, please, read the |r-plugin-tmux| section -to learn a few useful shortcuts. The tmux.conf file created by the plugin sets -Tmux to work with Vi key bindings. +The plugin will run R inside a Tmux session. If you are using Vim (not GVim), +you may be interested in reading |r-plugin-tmux| section to learn a few useful +shortcuts. The tmux.conf file created by the plugin sets Tmux to work with Vi +key bindings, as the escape character and also enables the mouse for +Tmux. Note: The plugin can use different mechanisms to send commands to R. The mechanism that will be used depends on both what applications and plugins you @@ -939,13 +940,13 @@ document. The valid values of vimrplugin_vimpager are: + "tab" : Show the help document in a new tab. If there is already a + tab with an R help document, use it. + This is the default. "vertical" : Split the window vertically if the editor width is large enough; otherwise, split the window horizontally and attempt to set the window height to at least 20 lines. - This is the default. "horizontal": Split the window horizontally. - "tab" : Show the help document in a new tab. If there is already a - tab with an R help document, use it. "tabnew" : Show the help document in a new tab. "no" : Do not show R documentation in Vim. @@ -1813,6 +1814,11 @@ the R syntax highlighted. *r-plugin-news* 12. News~ +0.9.6 (2011-12-11) + + * New default value of vimrplugin_vimpager = "tab". + * New default value of vimrplugin_objbr_place = "editor,right" + 0.9.5 (2011-12-07) * Changed the way that blocks are sent to R. diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index d7b5ec1..da97d85 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -15,7 +15,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Sat Dec 10, 2011 12:16PM +" Last Change: Sun Dec 11, 2011 10:32PM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -2278,14 +2278,16 @@ call RSetDefaultValue("g:vimrplugin_buildwait", 120) call RSetDefaultValue("g:vimrplugin_indent_commented", 1) call RSetDefaultValue("g:vimrplugin_by_vim_instance", 0) call RSetDefaultValue("g:vimrplugin_never_unmake_menu", 0) -call RSetDefaultValue("g:vimrplugin_vimpager", "'vertical'") +call RSetDefaultValue("g:vimrplugin_vimpager", "'tab'") call RSetDefaultValue("g:vimrplugin_latexcmd", "'pdflatex'") - -if has("gui_running") || !has("clientserver") - call RSetDefaultValue("g:vimrplugin_objbr_place", "'script,right'") -else - call RSetDefaultValue("g:vimrplugin_objbr_place", "'console,right'") -endif +call RSetDefaultValue("g:vimrplugin_objbr_place", "'script,right'") + +" Old default value. +"if has("gui_running") || !has("clientserver") +" call RSetDefaultValue("g:vimrplugin_objbr_place", "'script,right'") +"else +" call RSetDefaultValue("g:vimrplugin_objbr_place", "'console,right'") +"endif " ^K (\013) cleans from cursor to the right and ^U (\025) cleans from cursor " to the left. However, ^U causes a beep if there is nothing to clean. The From 5b9cadc05ab1d2bc487d486146df2c2c0035e7e2 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Mon, 12 Dec 2011 15:38:09 -0300 Subject: [PATCH 0121/1050] Use ^X^A to complete function arguments. --- r-plugin/common_global.vim | 85 +++++++++++++++++++++++++++++++++++++- 1 file changed, 84 insertions(+), 1 deletion(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index da97d85..92a8444 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -15,7 +15,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Sun Dec 11, 2011 10:32PM +" Last Change: Mon Dec 12, 2011 03:28PM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -106,6 +106,84 @@ function ReplaceUnderS() endif endfunction +function RCompleteArgs() + let lnum = line(".") + let line = getline(".") + let cpos = getpos(".") + let idx = cpos[2] - 2 + let idx2 = cpos[2] - 2 + call cursor(lnum, cpos[2] - 1) + if line[idx2] == ' ' || line[idx2] == ',' || line[idx2] == '(' + let idx2 = cpos[2] + let argkey = '' + else + let argkey = RGetKeyWord() + let idx2 = cpos[2] - strlen(argkey) + endif + let np = 1 + let nl = 0 + while np != 0 && nl < 10 + if line[idx] == '(' + let np -= 1 + elseif line[idx] == ')' + let np += 1 + endif + if np == 0 + call cursor(lnum, idx) + let rkeyword = '^' . RGetKeyWord() . ';' + call cursor(cpos[1], cpos[2]) + for omniL in g:rplugin_liblist + if omniL =~ rkeyword + let tmp1 = split(omniL, ';') + if len(tmp1) == 5 + let info = tmp1[4] + else + let tlen = len(tmp1) + let info = tmp1[4] + let i = 5 + while i < tlen + let info = info . ';' . tmp1[i] + let i += 1 + endwhile + endif + let info = substitute(info, "\t", '', "g") + let argsL = split(info, ",") + let args = [] + for id in range(len(argsL)) + let newkey = '^' . argkey + let tmp2 = split(substitute(argsL[id], "^ *", '', ""), "=") + if argkey == '' || tmp2[0] =~ newkey + if len(tmp2) == 2 + let tmp2[0] = tmp2[0] . "= " + let tmp3 = {'word': tmp2[0], 'menu': tmp2[1]} + else + if tmp2[0] != '...' + let tmp2[0] = tmp2[0] . " = " + endif + let tmp3 = {'word': tmp2[0], 'menu': ''} + endif + call add(args, tmp3) + endif + endfor + call complete(idx2, args) + return '' + endif + endfor + break + endif + let idx -= 1 + if idx == 0 + let lnum -= 1 + if lnum == 0 + break + endif + let line = getline(lnum) + let idx = strlen(line) + let nl +=1 + endif + endwhile +endfunction + function RCommentLine(lnum, ind, cmt) let line = getline(a:lnum) call cursor(a:lnum, 0) @@ -2142,6 +2220,11 @@ function RCreateEditMaps() if g:vimrplugin_underscore == 1 imap _ :call ReplaceUnderS()a endif + if hasmapto("RCompleteArgs", "i") + imap RCompleteArgs =RCompleteArgs() + else + imap =RCompleteArgs() + endif endfunction function RCreateSendMaps() From 5898957ea6c4e84c33ca9260e67ed0138035d338 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Mon, 12 Dec 2011 15:54:29 -0300 Subject: [PATCH 0122/1050] Fix path to R source() command on Windows. --- r-plugin/common_global.vim | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 92a8444..9d72ee2 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -15,7 +15,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Mon Dec 12, 2011 03:28PM +" Last Change: Mon Dec 12, 2011 03:43PM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -2324,6 +2324,11 @@ else unlet newuline endif +if has("win32") || has("win64") + let g:rplugin_home = substitute(g:rplugin_home, "\\", "/", "g") + let g:rplugin_uservimfiles = substitute(g:rplugin_uservimfiles, "\\", "/", "g") +endif + if isdirectory("/tmp") let $VIMRPLUGIN_TMPDIR = "/tmp/r-plugin-" . g:rplugin_userlogin else @@ -2558,8 +2563,6 @@ if has("win32") || has("win64") finish endif let g:rplugin_jspath = g:rplugin_home . "\\r-plugin\\vimActivate.js" - let g:rplugin_home = substitute(g:rplugin_home, "\\", "/", "g") - let g:rplugin_uservimfiles = substitute(g:rplugin_uservimfiles, "\\", "/", "g") if !exists("g:rplugin_rpathadded") if exists("g:vimrplugin_r_path") let $PATH = g:vimrplugin_r_path . ";" . $PATH From c3669f612a04d17aac2a75f6e256b4658b8d35bb Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Mon, 12 Dec 2011 22:13:59 -0300 Subject: [PATCH 0123/1050] Avoid infinite loop. --- r-plugin/common_global.vim | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 9d72ee2..d7ed57d 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -15,7 +15,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Mon Dec 12, 2011 03:43PM +" Last Change: Mon Dec 12, 2011 10:12PM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -172,7 +172,7 @@ function RCompleteArgs() break endif let idx -= 1 - if idx == 0 + if idx <= 0 let lnum -= 1 if lnum == 0 break @@ -182,6 +182,8 @@ function RCompleteArgs() let nl +=1 endif endwhile + call cursor(cpos[1], cpos[2]) + return '' endfunction function RCommentLine(lnum, ind, cmt) From 6a70ea6cd8a0236e9edc31b7c6cb732016e2e052 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Tue, 13 Dec 2011 08:54:26 -0300 Subject: [PATCH 0124/1050] Autocompletion of function arguments. --- doc/r-plugin.txt | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index db19ad6..d0c5d15 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -5,7 +5,7 @@ Authors: Jakson A. Aquino Jose Claudio Faria -Version: 0.9.5 +Version: 0.9.6 For Vim version 7.3 1. Overview |r-plugin-overview| @@ -374,6 +374,8 @@ Command Edit . Insert "<-" _ + . Complete function name ^X^O + . Complete function arguments ^X^A -------------------------------------------------------- . Indent (line) == . Indent (selected lines) = @@ -437,6 +439,12 @@ case: summary(x) summary(m) < +When completing function names (CTRL-X CTRL-O) and function arguments (CTRL-X +CTRL-A) you have to press CTRL-N to go foward in the list and CTRL-P to go +backward (see |popupmenu-completion|). Note: if using Vim in a terminal +emulator, Tmux will capture the CTRL-A command. You have to do CTRL-A twice to +pass a single CTRL-A to Vim. + 4.2. Edition of rnoweb files~ @@ -1263,9 +1271,14 @@ list of the names for custom key bindings: RSendLAndOpenNewOne RSendFile RSweave RSendMBlock RESendFile RUpdateObjBrowser RDSendMBlock RHelp RVanillaStart - RESendMBlock RListSpace + RESendMBlock RListSpace RCompleteArgs REDSendMBlock RMakePDF < +The completion of function arguments only happens in Insert mode. To customize +its keybind you should put in your |vimrc| something as in the example: +> + imap RCompleteArgs +< The plugin also contains a function called RAction which allows you to build ad-hoc commands to R. This function takes the name of an R function such as "levels" or "table" and the word under the cursor, and passes them to R as a @@ -1814,10 +1827,12 @@ the R syntax highlighted. *r-plugin-news* 12. News~ -0.9.6 (2011-12-11) +0.9.6 (2011-12-12) + * Fix path to R source() command on Windows. * New default value of vimrplugin_vimpager = "tab". * New default value of vimrplugin_objbr_place = "editor,right" + * Autocompletion of function arguments with . 0.9.5 (2011-12-07) From 84723bf1a2eaa8102236eacb02a51884b1516fb8 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Tue, 13 Dec 2011 08:54:55 -0300 Subject: [PATCH 0125/1050] Add autocompletion to GVim menu. --- r-plugin/common_global.vim | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index d7ed57d..1e71d5c 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -15,7 +15,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Mon Dec 12, 2011 10:12PM +" Last Change: Tue Dec 13, 2011 08:44AM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -2027,6 +2027,13 @@ function MakeRMenu() if &filetype == "r" || &filetype == "rnoweb" || &filetype == "rhelp" || g:vimrplugin_never_unmake_menu if g:vimrplugin_underscore == 1 imenu R.Edit.Insert\ \"\ <-\ \"_ :call ReplaceUnderS()a + imenu R.Edit.Complete\ function\ name^X^O + if hasmapto("RCompleteArgs", "i") + let boundkey = RIMapCmd("RCompleteArgs") + exe "imenu R.Edit.Complete\\ function\\ arguments" . boundkey . " " . boundkey + else + imenu R.Edit.Complete\ function\ arguments^X^A + endif endif menu R.Edit.-Sep71- nmenu R.Edit.Indent\ (line)== == From e9d8195e5fd4db37126f8d87954204c9a39b4da8 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Tue, 13 Dec 2011 20:08:46 -0300 Subject: [PATCH 0126/1050] Version 0.9.6. --- Makefile | 4 ++-- doc/r-plugin.txt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 0e8c90b..13d1993 100644 --- a/Makefile +++ b/Makefile @@ -22,7 +22,7 @@ PLUGINHOME=`pwd` -PLUGINVERSION=0.9.5 +PLUGINVERSION=0.9.6 DEBIANTIME=`date -R` PLUGINRELEASEDATE=`date +"%Y-%m-%d"` VIM2HTML=/usr/local/share/vim/vim73/doc/vim2html.pl @@ -45,7 +45,7 @@ zip: cp omniList.vanilla omniList ) # Update the version date in doc/r-plugin.txt header and in the news sed -i -e "s/^Version: [0-9].[0-9].[0-9]/Version: $(PLUGINVERSION)/" doc/r-plugin.txt - sed -i -e "s/^[0-9].[0-9].[0-9] (201[0-9]-[0-9][0-9]-[0-9][0-9])$$/$(PLUGINVERSION) ($(PLUGINRELEASEDATE))/" doc/r-plugin.txt + sed -i -e "s/^$(PLUGINVERSION) (201[0-9]-[0-9][0-9]-[0-9][0-9])$$/$(PLUGINVERSION) ($(PLUGINRELEASEDATE))/" doc/r-plugin.txt # Create a tar.gz file tar -cvzf /tmp/vimrplugintmpfile.tar.gz ftdetect/r.vim indent/r.vim \ indent/rnoweb.vim indent/rhelp.vim autoload/rcomplete.vim ftplugin/r*.vim \ diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index d0c5d15..60023b5 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -1827,7 +1827,7 @@ the R syntax highlighted. *r-plugin-news* 12. News~ -0.9.6 (2011-12-12) +0.9.6 (2011-12-13) * Fix path to R source() command on Windows. * New default value of vimrplugin_vimpager = "tab". From 17d4285aee4d3a0290a6c9fc7e26fe4c5a01152b Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Wed, 14 Dec 2011 08:06:51 -0300 Subject: [PATCH 0127/1050] Python interface to vimcom package. --- r-plugin/vimcom_client.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 r-plugin/vimcom_client.py diff --git a/r-plugin/vimcom_client.py b/r-plugin/vimcom_client.py new file mode 100644 index 0000000..feef29a --- /dev/null +++ b/r-plugin/vimcom_client.py @@ -0,0 +1,17 @@ +import socket + +def SendToR(aString): + HOST, PORT = "localhost", 9999 + + sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) + sock.settimeout(3.0) + + try: + sock.connect((HOST, PORT)) + sock.send(aString) + received = sock.recv(1024) + finally: + sock.close() + + print "Sent: {}".format(aString) + print "Received: {}".format(received) From 705344e543e872a5445a6feb695af627d4a84419 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Wed, 14 Dec 2011 08:07:34 -0300 Subject: [PATCH 0128/1050] Initial support to vimcom package. --- r-plugin/common_global.vim | 101 ++++++++++++++++++++++--------------- 1 file changed, 61 insertions(+), 40 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 1e71d5c..0a8d0ed 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -15,7 +15,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Tue Dec 13, 2011 08:44AM +" Last Change: Wed Dec 14, 2011 08:05AM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -503,7 +503,9 @@ function StartR(whatr) endif if g:vimrplugin_screenplugin - let rcmd = "VIMRPLUGIN_TMPDIR=" . $VIMRPLUGIN_TMPDIR . " " . rcmd + if g:vimrplugin_vimcom == 0 + let rcmd = "VIMRPLUGIN_TMPDIR=" . $VIMRPLUGIN_TMPDIR . " " . rcmd + endif if g:vimrplugin_tmux == 0 && g:vimrplugin_noscreenrc == 0 && exists("g:ScreenShellScreenInitArgs") let g:ScreenShellScreenInitArgs = RWriteScreenRC() endif @@ -645,28 +647,33 @@ function RObjBrowser() endif " R builds the Object Browser contents. - let lockfile = $VIMRPLUGIN_TMPDIR . "/objbrowser" . "lock" - call writefile(["Wait!"], lockfile) - if g:vimrplugin_allnames == 1 - call SendCmdToR('source("' . g:rplugin_home . '/r-plugin/vimbrowser.R") ; .vim.browser(TRUE)') + if g:vimrplugin_vimcom + let objbr = "'" . $VIMRPLUGIN_TMPDIR . "/objbrowser" . "'" + exe 'python SendToR("\004vim.browser(' . g:vimrplugin_allnames . ', ' . objbr . ')")' else - call SendCmdToR('source("' . g:rplugin_home . '/r-plugin/vimbrowser.R") ; .vim.browser()') - endif - sleep 50m - let i = 0 - while filereadable(lockfile) - let i = i + 1 + let lockfile = $VIMRPLUGIN_TMPDIR . "/objbrowser" . "lock" + call writefile(["Wait!"], lockfile) + if g:vimrplugin_allnames == 1 + call SendCmdToR('source("' . g:rplugin_home . '/r-plugin/vimbrowser.R") ; .vim.browser(TRUE)') + else + call SendCmdToR('source("' . g:rplugin_home . '/r-plugin/vimbrowser.R") ; .vim.browser()') + endif sleep 50m - if i == 40 - call delete(lockfile) - call RWarningMsg("No longer waiting for Object Browser to finish...") - if exists("g:rplugin_r_output") - echo g:rplugin_r_output + let i = 0 + while filereadable(lockfile) + let i = i + 1 + sleep 50m + if i == 40 + call delete(lockfile) + call RWarningMsg("No longer waiting for Object Browser to finish...") + if exists("g:rplugin_r_output") + echo g:rplugin_r_output + endif + sleep 2 + return endif - sleep 2 - return - endif - endwhile + endwhile + endif let g:rplugin_origbuf = bufname("%") @@ -1582,28 +1589,33 @@ function ShowRDoc(rkeyword, package) call SetRTextWidth() - call writefile(['Wait...'], g:rplugin_docfile . "lock") - if classfor == "" - if a:package == "" - call SendCmdToR("source('" . g:rplugin_home . "/r-plugin/vimhelp.R') ; .vim.help('" . a:rkeyword . "', " . g:rplugin_htw . "L)") + if g:vimrplugin_vimcom + exe 'python SendToR("\004vim.help(' . "'" . a:rkeyword . "', " . g:rplugin_htw . 'L)")' + exe 'python SendToR("\004vim.help(' . "'" . a:rkeyword . "', " . g:rplugin_htw . "L, '" . classfor . "')". '")' + else + call writefile(['Wait...'], g:rplugin_docfile . "lock") + if classfor == "" + if a:package == "" + call SendCmdToR("source('" . g:rplugin_home . "/r-plugin/vimhelp.R') ; .vim.help('" . a:rkeyword . "', " . g:rplugin_htw . "L)") + else + call SendCmdToR("source('" . g:rplugin_home . "/r-plugin/vimhelp.R') ; .vim.help('" . a:rkeyword . "', " . g:rplugin_htw . "L, package = '" . a:package . "')") + endif else - call SendCmdToR("source('" . g:rplugin_home . "/r-plugin/vimhelp.R') ; .vim.help('" . a:rkeyword . "', " . g:rplugin_htw . "L, package = '" . a:package . "')") + call SendCmdToR("source('" . g:rplugin_home . "/r-plugin/vimhelp.R') ; .vim.help('" . a:rkeyword . "', " . g:rplugin_htw . "L, " . classfor . ")") endif - else - call SendCmdToR("source('" . g:rplugin_home . "/r-plugin/vimhelp.R') ; .vim.help('" . a:rkeyword . "', " . g:rplugin_htw . "L, " . classfor . ")") - endif - sleep 50m - - let i = 0 - while filereadable(g:rplugin_docfile . "lock") && i < 40 sleep 50m - let i += 1 - endwhile - if i == 40 - echohl WarningMsg - echomsg "Waited too much time..." - echohl Normal - return + + let i = 0 + while filereadable(g:rplugin_docfile . "lock") && i < 40 + sleep 50m + let i += 1 + endwhile + if i == 40 + echohl WarningMsg + echomsg "Waited too much time..." + echohl Normal + return + endif endif " Local variables that must be inherited by the rdoc buffer @@ -2362,6 +2374,7 @@ call RSetDefaultValue("g:vimrplugin_i386", 0) call RSetDefaultValue("g:vimrplugin_screenvsplit", 0) call RSetDefaultValue("g:vimrplugin_conquevsplit", 0) call RSetDefaultValue("g:vimrplugin_conqueplugin", 0) +call RSetDefaultValue("g:vimrplugin_vimcom", 0) call RSetDefaultValue("g:vimrplugin_listmethods", 0) call RSetDefaultValue("g:vimrplugin_specialplot", 0) call RSetDefaultValue("g:vimrplugin_nosingler", 0) @@ -2386,6 +2399,14 @@ call RSetDefaultValue("g:vimrplugin_objbr_place", "'script,right'") " call RSetDefaultValue("g:vimrplugin_objbr_place", "'console,right'") "endif +if has("python") + if g:vimrplugin_vimcom + exe "pyfile " . g:rplugin_home . "/r-plugin/vimcom_client.py" + endif +else + g:vimrplugin_vimcom = 0 +endif + " ^K (\013) cleans from cursor to the right and ^U (\025) cleans from cursor " to the left. However, ^U causes a beep if there is nothing to clean. The " solution is to use ^A (\001) to move the cursor to the beginning of the line From 81bb1aee8762562ccd166d018ad8f10d1565d3cf Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Wed, 14 Dec 2011 08:31:36 -0300 Subject: [PATCH 0129/1050] More support to vimcom. --- r-plugin/common_global.vim | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 0a8d0ed..16ba02e 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -15,7 +15,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Wed Dec 14, 2011 08:05AM +" Last Change: Wed Dec 14, 2011 08:28AM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -1357,7 +1357,11 @@ function BuildROmniList(env, what) endif let lockfile = rtf . ".locked" call writefile(["Wait!"], lockfile) - let omnilistcmd = 'source("' . g:rplugin_home . '/r-plugin/build_omniList.R") ; .vim.bol("' . rtf . '"' + if g:vimrplugin_vimcom + let omnilistcmd = 'vim.bol("' . rtf . '"' + else + let omnilistcmd = 'source("' . g:rplugin_home . '/r-plugin/build_omniList.R") ; .vim.bol("' . rtf . '"' + endif if a:env == "libraries" && a:what == "installed" let omnilistcmd = omnilistcmd . ', what = "installed"' endif @@ -1688,7 +1692,11 @@ function PrintRObject(rkeyword) if classfor == "" call SendCmdToR("print(" . a:rkeyword . ")") else - call SendCmdToR('source("' . g:rplugin_home . '/r-plugin/vimprint.R") ; .vim.print("' . a:rkeyword . '", ' . classfor . ")") + if g:vimrplugin_vimcom + call SendCmdToR('vim.print("' . a:rkeyword . '", ' . classfor . ")") + else + call SendCmdToR('source("' . g:rplugin_home . '/r-plugin/vimprint.R") ; .vim.print("' . a:rkeyword . '", ' . classfor . ")") + endif endif endfunction @@ -1714,10 +1722,18 @@ function RAction(rcmd) endif let rfun = a:rcmd if a:rcmd == "args" && g:vimrplugin_listmethods == 1 - let rfun = "source('" . g:rplugin_home . "/r-plugin/specialfuns.R') ; .vim.list.args" + if g:vimrplugin_vimcom + let rfun = "vim.list.args" + else + let rfun = "source('" . g:rplugin_home . "/r-plugin/specialfuns.R') ; .vim.list.args" + endif endif if a:rcmd == "plot" && g:vimrplugin_specialplot == 1 - let rfun = "source('" . g:rplugin_home . "/r-plugin/specialfuns.R') ; .vim.plot" + if g:vimrplugin_vimcom + let rfun = "vim.plot" + else + let rfun = "source('" . g:rplugin_home . "/r-plugin/specialfuns.R') ; .vim.plot" + endif endif let raction = rfun . "(" . rkeyword . ")" let ok = SendCmdToR(raction) From a577eddd62b8c9ba2127d6eda82fadc6204765cd Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Fri, 16 Dec 2011 09:08:24 -0300 Subject: [PATCH 0130/1050] Improvements in the use of vimcom package. Discover the vimcom R port (allow to run multiple instances of Vim and R). Handle help topics present in more than one library. Complete arguments of .GlobalEnv functions. Automatically update Object Browser on BufEnter. --- ftplugin/rbrowser.vim | 11 +++- r-plugin/common_buffer.vim | 14 +++- r-plugin/common_global.vim | 128 ++++++++++++++++++++++++++----------- r-plugin/vimcom_client.py | 42 +++++++++++- 4 files changed, 151 insertions(+), 44 deletions(-) diff --git a/ftplugin/rbrowser.vim b/ftplugin/rbrowser.vim index fb6743d..bd76336 100644 --- a/ftplugin/rbrowser.vim +++ b/ftplugin/rbrowser.vim @@ -16,7 +16,7 @@ " " Author: Jakson Alves de Aquino " -" Last Change: Wed Nov 30, 2011 05:17PM +" Last Change: Wed Dec 14, 2011 10:13PM "========================================================================== " Only do this when not yet done for this buffer @@ -646,6 +646,14 @@ function! SourceObjBrLines() exe "source " . $VIMRPLUGIN_TMPDIR . "/objbrowserInit" endfunction +function! OnOBBufEnter() + if exists("b:myservername") + call remote_expr(b:myservername, "RObjBrowser()") + else + call RObjBrowser() + endif +endfunction + nmap :call RBrowserDoubleClick() nmap <2-LeftMouse> :call RBrowserDoubleClick() nmap :call RBrowserRightClick() @@ -667,6 +675,7 @@ if has("gui_running") endif au BufUnload call ObBrBufUnload() +au BufEnter call OnOBBufEnter() let &cpo = s:cpo_save unlet s:cpo_save diff --git a/r-plugin/common_buffer.vim b/r-plugin/common_buffer.vim index 85bc894..7033418 100644 --- a/r-plugin/common_buffer.vim +++ b/r-plugin/common_buffer.vim @@ -19,7 +19,7 @@ " " Based on previous work by Johannes Ranke " -" Last Change: Thu Nov 10, 2011 01:35PM +" Last Change: Thu Dec 15, 2011 10:27PM " " Please see doc/r-plugin.txt for usage details. "========================================================================== @@ -98,5 +98,17 @@ if g:vimrplugin_by_vim_instance == 1 unlet s:sname endif + +if g:vimrplugin_screenplugin + let s:uniquename = b:screensname . g:rplugin_firstbuffer +else + let s:uniquename = b:screensname +endif +let $VIMINSTANCEID = $VIMRPLUGIN_TMPDIR . "/" . s:uniquename . "-port" +let b:objbr_server = "OB" . s:uniquename +unlet s:uniquename +let b:objbr_server = toupper(substitute(b:objbr_server, '\W', "", "g")) + + let g:rplugin_lastft = &filetype diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 16ba02e..1f5e931 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -15,7 +15,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Wed Dec 14, 2011 08:28AM +" Last Change: Fri Dec 16, 2011 01:47AM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -120,6 +120,10 @@ function RCompleteArgs() let argkey = RGetKeyWord() let idx2 = cpos[2] - strlen(argkey) endif + if b:needsnewomnilist == 1 + call BuildROmniList("GlobalEnv", "none") + endif + let flines = g:rplugin_globalenvlines + g:rplugin_liblist let np = 1 let nl = 0 while np != 0 && nl < 10 @@ -132,7 +136,7 @@ function RCompleteArgs() call cursor(lnum, idx) let rkeyword = '^' . RGetKeyWord() . ';' call cursor(cpos[1], cpos[2]) - for omniL in g:rplugin_liblist + for omniL in flines if omniL =~ rkeyword let tmp1 = split(omniL, ';') if len(tmp1) == 5 @@ -636,6 +640,7 @@ function StartR(whatr) echon endfunction + " Open an Object Browser window function RObjBrowser() " Only opens the Object Browser if R is running @@ -645,11 +650,17 @@ function RObjBrowser() if g:vimrplugin_conqueplugin && !exists("b:conque_bufname") return endif + if g:rplugin_running_objbr == 1 + " Called twice due to BufEnter event + return + endif + + let g:rplugin_running_objbr = 1 " R builds the Object Browser contents. if g:vimrplugin_vimcom let objbr = "'" . $VIMRPLUGIN_TMPDIR . "/objbrowser" . "'" - exe 'python SendToR("\004vim.browser(' . g:vimrplugin_allnames . ', ' . objbr . ')")' + exe 'python SendToR("vim.browser(' . g:vimrplugin_allnames . ', ' . objbr . ')")' else let lockfile = $VIMRPLUGIN_TMPDIR . "/objbrowser" . "lock" call writefile(["Wait!"], lockfile) @@ -670,6 +681,7 @@ function RObjBrowser() echo g:rplugin_r_output endif sleep 2 + let g:rplugin_running_objbr = 0 return endif endwhile @@ -684,8 +696,10 @@ function RObjBrowser() while !filereadable(objbr) sleep 100m if i == 20 + let g:rplugin_running_objbr = 0 return endif + let i += 1 endwhile " This is the Object Browser @@ -694,12 +708,13 @@ function RObjBrowser() call remote_send(b:myservername, "") endif call remote_expr(b:myservername, "RObjBrowser()") + let g:rplugin_running_objbr = 0 return endif " Start the Object Browser if it doesn't exist yet let slist = serverlist() - if slist !~ "OBJBROWSER" + if slist !~ b:objbr_server if g:vimrplugin_objbr_place =~ "left" " Get the R Console width: let conw = system("tmux list-panes | cat") @@ -713,12 +728,13 @@ function RObjBrowser() else let panewidth = g:vimrplugin_objbr_w endif - let cmd = "tmux split-window -d -h -l " . panewidth . ' -t 1 "vim --servername OBJBROWSER"' + let cmd = "tmux split-window -d -h -l " . panewidth . ' -t 1 "vim --servername ' . b:objbr_server . '"' let rlog = system(cmd) if v:shell_error let rlog = substitute(rlog, '\n', ' ', 'g') let rlog = substitute(rlog, '\r', ' ', 'g') call RWarningMsg(rlog) + let g:rplugin_running_objbr = 0 return 0 endif if g:vimrplugin_objbr_place =~ "left" @@ -741,6 +757,7 @@ function RObjBrowser() \ 'let curcol = col(".")', \ 'normal! ggDjdG', \ 'source ' . objbr, + \ 'call delete("' . objbr . '")', \ 'call RBrowserFillCloseList()', \ 'call RBrowserFill(0)', \ 'setlocal nomodified', @@ -752,14 +769,15 @@ function RObjBrowser() while idx < 20 sleep 300m let slist = serverlist() - if slist =~ "OBJBROWSER" + if slist =~ b:objbr_server break endif let idx = idx + 1 endwhile - call remote_send("OBJBROWSER", ":source " . objbrowserfile . "") - call remote_send("OBJBROWSER", ":echon") + call remote_send(b:objbr_server, ":source " . objbrowserfile . "") + call remote_send(b:objbr_server, ":echon") + let g:rplugin_running_objbr = 0 return endif @@ -820,8 +838,10 @@ function RObjBrowser() if i == 20 exe "sb " . g:rplugin_origbuf exe "set switchbuf=" . savesb + let g:rplugin_running_objbr = 0 return endif + let i += 1 endwhile setlocal modifiable let curline = line(".") @@ -838,14 +858,16 @@ function RObjBrowser() redraw exe "sb " . g:rplugin_origbuf exe "set switchbuf=" . savesb + call delete(objbr) + let g:rplugin_running_objbr = 0 endfunction function RObjBrowserOCLists(status) if exists("*RBrowserOpenCloseLists") call RBrowserOpenCloseLists(a:status) - elseif serverlist() =~ "OBJBROWSER" - call remote_expr("OBJBROWSER", "RBrowserOpenCloseLists(" . a:status . ")") - call remote_send("OBJBROWSER", ":redraw:echon ' '") + elseif serverlist() =~ b:objbr_server + call remote_expr(b:objbr_server, "RBrowserOpenCloseLists(" . a:status . ")") + call remote_send(b:objbr_server, ":redraw:echon ' '") endif endfunction @@ -1312,8 +1334,8 @@ endfunction " Quit R function RQuit(how) - if serverlist() =~ "OBJBROWSER" - call remote_send("OBJBROWSER", ":q") + if serverlist() =~ b:objbr_server + call remote_send(b:objbr_server, ":q") sleep 500m endif @@ -1369,36 +1391,40 @@ function BuildROmniList(env, what) let omnilistcmd = omnilistcmd . ', allnames = TRUE' endif let omnilistcmd = omnilistcmd . ')' - let ok = SendCmdToR(omnilistcmd) - if ok == 0 - return - endif - - " Wait while R is writing the list of objects into the file - sleep 50m - let i = 0 - let s = 0 - while filereadable(lockfile) - let s = s + 1 - if s == 4 && a:env !~ "GlobalEnv" - let s = 0 - let i = i + 1 - let k = g:vimrplugin_buildwait - i - let themsg = "\rPlease, wait! [" . i . ":" . k . "]" - echon themsg - endif - sleep 250m - if i == g:vimrplugin_buildwait - call delete(lockfile) - call RWarningMsg("No longer waiting. See :h vimrplugin_buildwait for details.") + if g:vimrplugin_vimcom && a:env =~ "GlobalEnv" + exe "python SendToR('" . omnilistcmd . "')" + else + let ok = SendCmdToR(omnilistcmd) + if ok == 0 return endif - endwhile + + " Wait while R is writing the list of objects into the file + sleep 50m + let i = 0 + let s = 0 + while filereadable(lockfile) + let s = s + 1 + if s == 4 && a:env !~ "GlobalEnv" + let s = 0 + let i = i + 1 + let k = g:vimrplugin_buildwait - i + let themsg = "\rPlease, wait! [" . i . ":" . k . "]" + echon themsg + endif + sleep 250m + if i == g:vimrplugin_buildwait + call delete(lockfile) + call RWarningMsg("No longer waiting. See :h vimrplugin_buildwait for details.") + return + endif + endwhile + endif if a:env == "GlobalEnv" let g:rplugin_globalenvlines = readfile(g:rplugin_globalenvfname) endif - if i > 2 + if g:vimrplugin_vimcom == 0 && i > 2 echon "\rFinished in " . i . " seconds." endif endfunction @@ -1594,8 +1620,28 @@ function ShowRDoc(rkeyword, package) call SetRTextWidth() if g:vimrplugin_vimcom - exe 'python SendToR("\004vim.help(' . "'" . a:rkeyword . "', " . g:rplugin_htw . 'L)")' - exe 'python SendToR("\004vim.help(' . "'" . a:rkeyword . "', " . g:rplugin_htw . "L, '" . classfor . "')". '")' + let g:rplugin_lastrpl = "" + if classfor == "" + exe 'python SendToR("vim.help(' . "'" . a:rkeyword . "', " . g:rplugin_htw . 'L)")' + else + exe 'python SendToR("vim.help(' . "'" . a:rkeyword . "', " . g:rplugin_htw . "L, '" . classfor . "')". '")' + endif + if g:rplugin_lastrpl != "VIMHELP" + if g:rplugin_lastrpl =~ "^MULTILIB" + echo "The topic '" . a:rkeyword . "' was found in more than one library:" + let libs = split(g:rplugin_lastrpl) + for idx in range(1, len(libs) - 1) + echo idx . " : " . libs[idx] + endfor + let chn = input("Please, select one of them: ") + if chn > 0 && chn < len(libs) + exe 'python SendToR("vim.help(' . "'" . a:rkeyword . "', " . g:rplugin_htw . "L, package='" . libs[chn] . "')" . '")' + endif + else + call RWarningMsg(g:rplugin_lastrpl) + return + endif + endif else call writefile(['Wait...'], g:rplugin_docfile . "lock") if classfor == "" @@ -2802,6 +2848,10 @@ if has("gui_running") augroup END endif +let g:rplugin_firstbuffer = expand("%") +let g:rplugin_firstbuffer = substitute(g:rplugin_firstbuffer, " ", "", "") +let g:rplugin_running_objbr = 0 + " Debugging code: if g:vimrplugin_screenplugin && g:vimrplugin_conqueplugin echoerr "Error number 1" diff --git a/r-plugin/vimcom_client.py b/r-plugin/vimcom_client.py index feef29a..ca88f8e 100644 --- a/r-plugin/vimcom_client.py +++ b/r-plugin/vimcom_client.py @@ -1,7 +1,40 @@ import socket +import vim +import time + +PORT = 0 + +def DiscoverVimComPort(): + global PORT + HOST = "localhost" + PORT = 9998 + repl = "NOTHING" + correct_repl = vim.eval("$VIMINSTANCEID") + + while repl != correct_repl and PORT < 10005: + PORT = PORT + 1 + sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) + sock.settimeout(0.1) + try: + sock.connect((HOST, PORT)) + sock.send("\002What port?") + repl = sock.recv(1024) + except: + pass + sock.close() + + if PORT >= 10005: + PORT = 0 + vim.command("call RWarningMsg('VimCom Port not found.')") + return(PORT) def SendToR(aString): - HOST, PORT = "localhost", 9999 + HOST = "localhost" + global PORT + if PORT == 0: + PORT = DiscoverVimComPort() + if PORT == 0: + return sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) sock.settimeout(3.0) @@ -13,5 +46,8 @@ def SendToR(aString): finally: sock.close() - print "Sent: {}".format(aString) - print "Received: {}".format(received) + if received is None: + vim.command("let g:rplugin_lastrpl = 'NOANSWER'") + else: + vim.command("let g:rplugin_lastrpl = '" + received + "'") + From 0d2013f7871c2316bd7ff3be2ea8a9c9bd684436 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Wed, 21 Dec 2011 00:14:04 -0300 Subject: [PATCH 0131/1050] Renamed vimcom_client.py to vimcom.py. --- r-plugin/{vimcom_client.py => vimcom.py} | 33 ++++++++++++++++++++---- 1 file changed, 28 insertions(+), 5 deletions(-) rename r-plugin/{vimcom_client.py => vimcom.py} (60%) diff --git a/r-plugin/vimcom_client.py b/r-plugin/vimcom.py similarity index 60% rename from r-plugin/vimcom_client.py rename to r-plugin/vimcom.py index ca88f8e..491dc0a 100644 --- a/r-plugin/vimcom_client.py +++ b/r-plugin/vimcom.py @@ -1,17 +1,20 @@ + import socket import vim -import time - +import threading +from os import getenv PORT = 0 +KeepChecking = 1 + def DiscoverVimComPort(): global PORT HOST = "localhost" PORT = 9998 repl = "NOTHING" - correct_repl = vim.eval("$VIMINSTANCEID") + correct_repl = getenv("VIMINSTANCEID") - while repl != correct_repl and PORT < 10005: + while repl != correct_repl and PORT < 10050: PORT = PORT + 1 sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) sock.settimeout(0.1) @@ -23,11 +26,12 @@ def DiscoverVimComPort(): pass sock.close() - if PORT >= 10005: + if PORT >= 10050: PORT = 0 vim.command("call RWarningMsg('VimCom Port not found.')") return(PORT) + def SendToR(aString): HOST = "localhost" global PORT @@ -51,3 +55,22 @@ def SendToR(aString): else: vim.command("let g:rplugin_lastrpl = '" + received + "'") + +def CheckObjects(): + global KeepChecking + if KeepChecking == 0: + return + SendToR("\007Objects and Libraries?") + ans = vim.eval("g:rplugin_lastrpl") + if ans == "1": + vim.command("call UpdateGlobalEnv()") + else: + if ans == "2": + vim.command("call UpdateLibraries()") + else: + if ans == "3": + vim.command("call UpdateGlobalEnv()") + vim.command("call UpdateLibraries()") + t = threading.Timer(1.0, CheckObjects) + t.start() + From e6a870042564839f4ca17f58f599ad863be216b6 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Wed, 21 Dec 2011 00:15:32 -0300 Subject: [PATCH 0132/1050] Add bibtex argument to RMakePDF(). --- ftplugin/r.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ftplugin/r.vim b/ftplugin/r.vim index 7507edb..564f7cb 100644 --- a/ftplugin/r.vim +++ b/ftplugin/r.vim @@ -19,7 +19,7 @@ " " Based on previous work by Johannes Ranke " -" Last Change: Sun Nov 27, 2011 04:35PM +" Last Change: Tue Dec 20, 2011 11:38PM " " Please see doc/r-plugin.txt for usage details. "========================================================================== @@ -102,7 +102,7 @@ call RCreateMaps("nvi", 'RSetwd', 'rd', ':call RSetWD()') "------------------------------------- if &filetype == "rnoweb" call RCreateMaps("nvi", 'RSweave', 'sw', ':call RSweave()') - call RCreateMaps("nvi", 'RMakePDF', 'sp', ':call RMakePDF()') + call RCreateMaps("nvi", 'RMakePDF', 'sp', ':call RMakePDF("nobib")') call RCreateMaps("nvi", 'RIndent', 'si', ':call RnwToggleIndentSty()') endif From 01e6c529101975a49861a7b1addccefe01ef5bc6 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Wed, 21 Dec 2011 18:22:25 -0300 Subject: [PATCH 0133/1050] Improvements in the use of vimcom package. Start a server in the Object Browser if it's running as an independent Vim instance in a Tmux panel and, then, receive R messages to update the lists of objects and libraries. --- ftplugin/rbrowser.vim | 98 +++++++++++++++-- r-plugin/common_global.vim | 217 ++++++++++++++++++++++++++++++++----- r-plugin/vimcom.py | 102 ++++++++++++++--- 3 files changed, 360 insertions(+), 57 deletions(-) diff --git a/ftplugin/rbrowser.vim b/ftplugin/rbrowser.vim index bd76336..79f0736 100644 --- a/ftplugin/rbrowser.vim +++ b/ftplugin/rbrowser.vim @@ -16,7 +16,7 @@ " " Author: Jakson Alves de Aquino " -" Last Change: Wed Dec 14, 2011 10:13PM +" Last Change: Wed Dec 21, 2011 04:49PM "========================================================================== " Only do this when not yet done for this buffer @@ -79,6 +79,57 @@ let b:list_order = {} let b:liblist = [] +function! UpdateGlobalEnv() + if g:rplugin_curview == "libraries" + return + endif + if exists("g:rplugin_curbuf") && g:rplugin_curbuf != "Object_Browser" + let savesb = &switchbuf + set switchbuf=useopen,usetab + sil noautocmd sb Object_Browser + let g:rplugin_switchedbuf = 1 + else + let g:rplugin_switchedbuf = 0 + endif + set modifiable + let curline = line(".") + let curcol = col(".") + if !exists("curline") + let curline = 3 + endif + if !exists("curcol") + let curcol = 1 + endif + sil normal! ggdG + call setline(1, ".GlobalEnv | Libraries") + exe "silent read " . $VIMRPLUGIN_TMPDIR . "/object_browser" + call cursor(curline, curcol) + set nomodifiable + if g:rplugin_switchedbuf + exe "sil noautocmd sb " . g:rplugin_curbuf + exe "set switchbuf=" . savesb + endif +endfunction + +function! UpdateLibraries() + if exists("g:rplugin_curbuf") && g:rplugin_curbuf != "Object_Browser" + let savesb = &switchbuf + set switchbuf=useopen,usetab + sil noautocmd sb Object_Browser + let g:rplugin_switchedbuf = 1 + else + let g:rplugin_switchedbuf = 0 + endif + exe "silent source " . $VIMRPLUGIN_TMPDIR . "/liblist" + if g:rplugin_curview == "libraries" + call RBrowserShowLibs(0) + endif + if g:rplugin_switchedbuf + exe "sil noautocmd sb " . g:rplugin_curbuf + exe "set switchbuf=" . savesb + endif +endfunction + function! RBrowserMakeLibDict() let b:libdict = {} let nobjs = len(g:rplugin_liblist) @@ -323,6 +374,11 @@ function! RBrowserFillCloseList() endfunction function! RBrowserShowGE(fromother) + if g:vimrplugin_vimcom + let g:rplugin_curview = "GlobalEnv" + call UpdateGlobalEnv() + return + endif let g:rplugin_curview = "GlobalEnv" if a:fromother == 0 let g:rplugin_curbline = line(".") @@ -351,9 +407,7 @@ function! RBrowserShowLibs(fromother) let g:rplugin_curlcol = col(".") endif - if !exists("b:libdict") - call RBrowserMakeLibDict() - endif + call RBrowserMakeLibDict() setlocal modifiable sil normal! ggdG @@ -373,7 +427,7 @@ function! RBrowserShowLibs(fromother) let hasmissing = 0 let misslibs = [] for lib in b:liblist - if search('#' . lib, "wn") == 0 + if lib != "setwidth" && search('#' . lib, "wn") == 0 let hasmissing += 1 call add(misslibs, lib) endif @@ -428,6 +482,13 @@ function! RBrowserDoubleClick() endif " Toggle state of list or data.frame: open X closed + if g:vimrplugin_vimcom && g:rplugin_curview == "GlobalEnv" + let key = RBrowserGetName(1) + exe 'python SendToR("' . "\005" . '-' . substitute(key, '\$', '-', "g") . '")' + call UpdateGlobalEnv() + return + endif + let key = RBrowserGetName(0) for i in keys(g:rplugin_opendict) if i == key @@ -454,10 +515,19 @@ function! RBrowserOpenCloseLists(status) endif endif - for key in keys(g:rplugin_opendict) - let g:rplugin_opendict[key] = a:status - endfor - call RBrowserFill(0) + if g:vimrplugin_vimcom + exe 'python SendToR("' . "\006" . a:status . '")' + if g:rplugin_curview == "GlobalEnv" + call UpdateGlobalEnv() + else + call UpdateLibraries() + endif + else + for key in keys(g:rplugin_opendict) + let g:rplugin_opendict[key] = a:status + endfor + call RBrowserFill(0) + endif if !exists("b:myservername") if switchedbuf @@ -637,6 +707,10 @@ function! LeaveRBrowser() endfunction function! ObBrBufUnload() + py SendToR("\x08Stop Updating Info") + py StopOBServer() + call delete($VIMRPLUGIN_TMPDIR . "/object_browser") + call delete($VIMRPLUGIN_TMPDIR . "/liblist") if exists("b:myservername") call system("tmux select-pane -t 0") endif @@ -647,6 +721,9 @@ function! SourceObjBrLines() endfunction function! OnOBBufEnter() + if g:vimrplugin_vimcom + return + endif if exists("b:myservername") call remote_expr(b:myservername, "RObjBrowser()") else @@ -674,6 +751,9 @@ if has("gui_running") unlet s:thisbuffname endif +call writefile([], $VIMRPLUGIN_TMPDIR . "/object_browser") +call writefile([], $VIMRPLUGIN_TMPDIR . "/liblist") + au BufUnload call ObBrBufUnload() au BufEnter call OnOBBufEnter() diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 1f5e931..46b7c18 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -15,7 +15,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Fri Dec 16, 2011 01:47AM +" Last Change: Wed Dec 21, 2011 04:20PM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -458,6 +458,9 @@ endfunction " Start R function StartR(whatr) + call writefile([], $VIMRPLUGIN_TMPDIR . "/object_browser") + call writefile([], $VIMRPLUGIN_TMPDIR . "/liblist") + " Change to buffer's directory before starting R lcd %:p:h @@ -640,6 +643,152 @@ function StartR(whatr) echon endfunction +function StartObjectBrowser() + if g:vimrplugin_screenplugin && g:vimrplugin_objbr_place =~ "console" + + if exists("b:myservername") + " This is the Object Browser + if remote_expr(b:myservername, "mode()") != "n" + call remote_send(b:myservername, "") + endif + call remote_expr(b:myservername, "RObjBrowser()") + let g:rplugin_running_objbr = 0 + return + endif + + " Start the Object Browser if it doesn't exist yet + let slist = serverlist() + if slist !~ b:objbr_server + if g:vimrplugin_objbr_place =~ "left" + " Get the R Console width: + let conw = system("tmux list-panes | cat") + let conw = substitute(conw, '.*\n1: \[\([0-9]*\)x.*', '\1', "") + let panewidth = conw - g:vimrplugin_objbr_w + " Just to be safe: If the above code doesn't work as expected + " and we get a spurious value: + if panewidth < 40 || panewidth > 180 + let panewidth = 80 + endif + else + let panewidth = g:vimrplugin_objbr_w + endif + let cmd = "tmux split-window -d -h -l " . panewidth . ' -t 1 "vim --servername ' . b:objbr_server . '"' + let rlog = system(cmd) + if v:shell_error + let rlog = substitute(rlog, '\n', ' ', 'g') + let rlog = substitute(rlog, '\r', ' ', 'g') + call RWarningMsg(rlog) + let g:rplugin_running_objbr = 0 + return 0 + endif + if g:vimrplugin_objbr_place =~ "left" + call system("tmux swap-pane -d -s 1 -t 2") + endif + endif + + " Wait while Vim starts + let idx = 0 + while idx < 20 + sleep 300m + let slist = serverlist() + if slist =~ b:objbr_server + break + endif + let idx = idx + 1 + endwhile + + let objbrowserfile = $VIMRPLUGIN_TMPDIR . "/objbrowserInit" + if g:vimrplugin_objbr_place =~ "console" && g:vimrplugin_conqueplugin == 0 + let obscmd = 'python RunOBServer()' + else + let obscmd = ' ' + endif + call writefile([ + \ 'let b:objbrtitle = "' . b:objbrtitle . '"', + \ 'let b:screensname = "' . b:screensname . '"', + \ 'let b:rscript_buffer = "' . bufname("%") . '"', + \ 'let b:myservername = "' . v:servername . '"', + \ 'set filetype=rbrowser', + \ 'let $VIMINSTANCEID="' . $VIMINSTANCEID . '"', + \ 'setlocal modifiable', + \ 'set shortmess=atI', + \ 'set rulerformat=%3(%l%)', + \ 'set noruler', + \ 'let curline = line(".")', + \ 'let curcol = col(".")', + \ 'normal! ggdG', + \ 'setlocal nomodified', + \ 'call cursor(curline, curcol)', + \ 'exe "pyfile " . g:rplugin_home . "/r-plugin/vimcom.py"', + \ 'python SendToR("\003GlobalEnv")', + \ 'python SendToR("\004Libraries")', + \ 'call UpdateGlobalEnv()', + \ 'call UpdateLibraries()', + \ obscmd, + \ 'redraw'], objbrowserfile) + + call remote_send(b:objbr_server, ":source " . objbrowserfile . "") + call remote_send(b:objbr_server, ":echon") + return + endif + + " Either load or reload the Object Browser + let savesb = &switchbuf + set switchbuf=useopen,usetab + if bufloaded(b:objbrtitle) + exe "sb " . b:objbrtitle + else + " Copy the values of some local variables that will be inherited + let g:tmp_objbrtitle = b:objbrtitle + let g:tmp_screensname = b:screensname + let g:tmp_curbufname = bufname("%") + + if g:vimrplugin_conqueplugin == 1 + " Copy the values of some local variables that will be inherited + let g:tmp_conqueshell = b:conqueshell + let g:tmp_conque_bufname = b:conque_bufname + + if g:vimrplugin_objbr_place =~ "console" + exe "sil sb " . b:conque_bufname + normal! G0 + endif + endif + + let l:sr = &splitright + if g:vimrplugin_objbr_place =~ "right" + set splitright + else + set nosplitright + endif + exe "vsplit " . b:objbrtitle + let &splitright = l:sr + exe "vertical resize " . g:vimrplugin_objbr_w + set filetype=rbrowser + + " Inheritance of some local variables + if g:vimrplugin_conqueplugin == 1 + let b:conqueshell = g:tmp_conqueshell + let b:conque_bufname = g:tmp_conque_bufname + unlet g:tmp_conqueshell + unlet g:tmp_conque_bufname + endif + let b:screensname = g:tmp_screensname + let b:objbrtitle = g:tmp_objbrtitle + let b:rscript_buffer = g:tmp_curbufname + unlet g:tmp_objbrtitle + unlet g:tmp_screensname + unlet g:tmp_curbufname + exe "pyfile " . g:rplugin_home . "/r-plugin/vimcom.py" + python SendToR("\003GlobalEnv") + python SendToR("\004Libraries") + call UpdateGlobalEnv() + call UpdateLibraries() + if g:vimrplugin_objbr_place =~ "console" && g:vimrplugin_conqueplugin == 0 + python RunOBServer() + endif + endif + +endfunction " Open an Object Browser window function RObjBrowser() @@ -657,35 +806,42 @@ function RObjBrowser() let g:rplugin_running_objbr = 1 - " R builds the Object Browser contents. if g:vimrplugin_vimcom - let objbr = "'" . $VIMRPLUGIN_TMPDIR . "/objbrowser" . "'" - exe 'python SendToR("vim.browser(' . g:vimrplugin_allnames . ', ' . objbr . ')")' - else - let lockfile = $VIMRPLUGIN_TMPDIR . "/objbrowser" . "lock" - call writefile(["Wait!"], lockfile) - if g:vimrplugin_allnames == 1 - call SendCmdToR('source("' . g:rplugin_home . '/r-plugin/vimbrowser.R") ; .vim.browser(TRUE)') - else - call SendCmdToR('source("' . g:rplugin_home . '/r-plugin/vimbrowser.R") ; .vim.browser()') + call StartObjectBrowser() + python SendToR("\003GlobalEnv") + python SendToR("\004Libraries") + if exists("*UpdateGlobalEnv") + call UpdateGlobalEnv() + call UpdateLibraries() endif + let g:rplugin_running_objbr = 0 + return + endif + + " R builds the Object Browser contents. + let lockfile = $VIMRPLUGIN_TMPDIR . "/objbrowser" . "lock" + call writefile(["Wait!"], lockfile) + if g:vimrplugin_allnames == 1 + call SendCmdToR('source("' . g:rplugin_home . '/r-plugin/vimbrowser.R") ; .vim.browser(TRUE)') + else + call SendCmdToR('source("' . g:rplugin_home . '/r-plugin/vimbrowser.R") ; .vim.browser()') + endif + sleep 50m + let i = 0 + while filereadable(lockfile) + let i = i + 1 sleep 50m - let i = 0 - while filereadable(lockfile) - let i = i + 1 - sleep 50m - if i == 40 - call delete(lockfile) - call RWarningMsg("No longer waiting for Object Browser to finish...") - if exists("g:rplugin_r_output") - echo g:rplugin_r_output - endif - sleep 2 - let g:rplugin_running_objbr = 0 - return + if i == 40 + call delete(lockfile) + call RWarningMsg("No longer waiting for Object Browser to finish...") + if exists("g:rplugin_r_output") + echo g:rplugin_r_output endif - endwhile - endif + sleep 2 + let g:rplugin_running_objbr = 0 + return + endif + endwhile let g:rplugin_origbuf = bufname("%") @@ -702,8 +858,8 @@ function RObjBrowser() let i += 1 endwhile - " This is the Object Browser if exists("b:myservername") + " This is the Object Browser if remote_expr(b:myservername, "mode()") != "n" call remote_send(b:myservername, "") endif @@ -755,7 +911,7 @@ function RObjBrowser() \ 'set noruler', \ 'let curline = line(".")', \ 'let curcol = col(".")', - \ 'normal! ggDjdG', + \ 'silent normal! ggdG', \ 'source ' . objbr, \ 'call delete("' . objbr . '")', \ 'call RBrowserFillCloseList()', @@ -827,7 +983,6 @@ function RObjBrowser() unlet g:tmp_objbrtitle unlet g:tmp_screensname unlet g:tmp_curbufname - endif @@ -2463,7 +2618,7 @@ call RSetDefaultValue("g:vimrplugin_objbr_place", "'script,right'") if has("python") if g:vimrplugin_vimcom - exe "pyfile " . g:rplugin_home . "/r-plugin/vimcom_client.py" + exe "pyfile " . g:rplugin_home . "/r-plugin/vimcom.py" endif else g:vimrplugin_vimcom = 0 @@ -2851,6 +3006,8 @@ endif let g:rplugin_firstbuffer = expand("%") let g:rplugin_firstbuffer = substitute(g:rplugin_firstbuffer, " ", "", "") let g:rplugin_running_objbr = 0 +let g:rplugin_has_new_lib = 0 +let g:rplugin_has_new_obj = 0 " Debugging code: if g:vimrplugin_screenplugin && g:vimrplugin_conqueplugin diff --git a/r-plugin/vimcom.py b/r-plugin/vimcom.py index 491dc0a..f0c35bc 100644 --- a/r-plugin/vimcom.py +++ b/r-plugin/vimcom.py @@ -2,9 +2,10 @@ import socket import vim import threading -from os import getenv +import os PORT = 0 -KeepChecking = 1 +OBPort = 0 +sock = None def DiscoverVimComPort(): @@ -12,9 +13,14 @@ def DiscoverVimComPort(): HOST = "localhost" PORT = 9998 repl = "NOTHING" - correct_repl = getenv("VIMINSTANCEID") + correct_repl = vim.eval("$VIMINSTANCEID") + if correct_repl is None: + correct_repl = os.getenv("VIMINSTANCEID") + if correct_repl is None: + vim.command("call RWarningMsg('VIMINSTANCEID not found.')") + return - while repl != correct_repl and PORT < 10050: + while correct_repl.find(repl) < 0 and PORT < 10050: PORT = PORT + 1 sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) sock.settimeout(0.1) @@ -39,6 +45,7 @@ def SendToR(aString): PORT = DiscoverVimComPort() if PORT == 0: return + received = None sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) sock.settimeout(3.0) @@ -47,6 +54,8 @@ def SendToR(aString): sock.connect((HOST, PORT)) sock.send(aString) received = sock.recv(1024) + except: + pass finally: sock.close() @@ -56,21 +65,78 @@ def SendToR(aString): vim.command("let g:rplugin_lastrpl = '" + received + "'") -def CheckObjects(): - global KeepChecking - if KeepChecking == 0: +def OBServer(): + global sock + global OBPort + UDP_IP="127.0.0.1" + OBPort=5005 + + while True and OBPort < 5100: + try: + OBPort += 1 + sock = socket.socket( socket.AF_INET, socket.SOCK_DGRAM ) + sock.bind( (UDP_IP,OBPort) ) + except: + continue + else: + break + + if sock == None: + OBPort = 0 return - SendToR("\007Objects and Libraries?") - ans = vim.eval("g:rplugin_lastrpl") - if ans == "1": - vim.command("call UpdateGlobalEnv()") else: - if ans == "2": - vim.command("call UpdateLibraries()") - else: - if ans == "3": + SendToR("\007" + str(OBPort)) + + while True: + try: + data, addr = sock.recvfrom( 1024 ) # buffer size is 1024 bytes + if data.find("G") >= 0: vim.command("call UpdateGlobalEnv()") - vim.command("call UpdateLibraries()") - t = threading.Timer(1.0, CheckObjects) - t.start() + else: + if data.find("L") >= 0: + vim.command("call UpdateLibraries()") + else: + if data.find("B") >= 0: + vim.command("call UpdateGlobalEnv()") + vim.command("call UpdateLibraries()") + else: + try: + sock.shutdown(socket.SHUT_RDWR) + except: + vim.command("call RWarningMsg('OBS 001')") + sock.close() + return + except: + OBPort = 0 + vim.command("call RWarningMsg('OBS 002')") + try: + sock.shutdown(socket.SHUT_RDWR) + except: + vim.command("call RWarningMsg('OBS 003')") + sock.close() + return + try: + sock.shutdown(socket.SHUT_RDWR) + except: + pass + sock.close() + sock = socket.socket( socket.AF_INET, socket.SOCK_DGRAM ) + sock.bind( (UDP_IP,OBPort) ) + + +def RunOBServer(): + th = threading.Thread(target=OBServer) + th.start() + +def StopOBServer(): + global sock + global OBPort + if OBPort == 0: + return + try: + sock.shutdown(socket.SHUT_RDWR) + except: + pass + sock.close() + OBPort = 0 From dfad3442272778e141635bd446e10eac8bff4809 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 22 Dec 2011 23:51:18 -0300 Subject: [PATCH 0134/1050] The R scripts are now part of the vimcom package. --- r-plugin/build_omniList.R | 174 -------------------------------------- r-plugin/etags2ctags.R | 71 ---------------- r-plugin/specialfuns.R | 56 ------------ r-plugin/vimSweave.R | 13 --- r-plugin/vimbrowser.R | 69 --------------- r-plugin/vimhelp.R | 59 ------------- r-plugin/vimprint.R | 26 ------ 7 files changed, 468 deletions(-) delete mode 100644 r-plugin/build_omniList.R delete mode 100644 r-plugin/etags2ctags.R delete mode 100644 r-plugin/specialfuns.R delete mode 100644 r-plugin/vimSweave.R delete mode 100644 r-plugin/vimbrowser.R delete mode 100644 r-plugin/vimhelp.R delete mode 100644 r-plugin/vimprint.R diff --git a/r-plugin/build_omniList.R b/r-plugin/build_omniList.R deleted file mode 100644 index 206bf56..0000000 --- a/r-plugin/build_omniList.R +++ /dev/null @@ -1,174 +0,0 @@ -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# A copy of the GNU General Public License is available at -# http://www.r-project.org/Licenses/ - -### Jakson Alves de Aquino -### Tue, January 18, 2011 - - -# Build Omni List -.vim.bol <- function(omnilist, what = "loaded", allnames = FALSE) { - - vim.list.args2 <- function(ff){ - knownGenerics <- c(names(.knownS3Generics), - tools:::.get_internal_S3_generics()) # from methods() - ff.pat <- gsub('\\?', '\\\\?', ff) - ff.pat <- gsub('\\*', '\\\\*', ff.pat) - ff.pat <- gsub('\\(', '\\\\(', ff.pat) - ff.pat <- gsub('\\[', '\\\\[', ff.pat) - ff.pat <- gsub('\\{', '\\\\{', ff.pat) - ff.pat <- gsub('\\|', '\\\\|', ff.pat) - ff.pat <- gsub('\\+', '\\\\+', ff.pat) - keyf <- paste("^", ff.pat, "$", sep="") - is.generic <- (length(grep(keyf, knownGenerics)) > 0) - if(is.generic){ - if(length(methods(ff)) > 0){ - return("Generic Method") - } - } - - ff.formals <- formals(ff) - if(is.null(ff.formals)){ - return("No arguments") - } else { - ff.args <- capture.output(args(ff)) - len <- length(ff.args) - 1 - ff.args <- ff.args[1:len] - ff.args[1] <- sub("function \\(", "", ff.args[1]) - ff.args[len] <- sub("\\) $", "", ff.args[len]) - ff.args <- sub("^ ", "", ff.args) - ff.args <- paste(ff.args, collapse = "\t") - return(ff.args) - } - } - - # Only recent versions of R have the grepl() function. We can replace - # vim.grepl() with grepl() in the near future. - vim.grepl <- function(pattern, x){ - res <- grep(pattern, x) - if(length(res) == 0){ - return(FALSE) - } else { - return(TRUE) - } - } - - vim.omni.line <- function(x, envir, printenv, curlevel){ - if(curlevel == 0){ - xx <- get(x, envir) - } else { - x.clean <- gsub("$", "", x, fixed = TRUE) - x.clean <- gsub("_", "", x.clean, fixed = TRUE) - haspunct <- vim.grepl("[[:punct:]]", x.clean) - if(haspunct[1]){ - ok <- vim.grepl("[[:alnum:]]\\.[[:alnum:]]", x.clean) - if(ok[1]){ - haspunct <- FALSE - haspp <- vim.grepl("[[:punct:]][[:punct:]]", x.clean) - if(haspp[1]) haspunct <- TRUE - } - } - - # No support for names with spaces - if(vim.grepl(" ", x)){ - haspunct <- TRUE - } - - if(haspunct[1]){ - xx <- NULL - } else { - xx <- try(eval(parse(text=x)), silent = TRUE) - if(class(xx)[1] == "try-error"){ - xx <- NULL - } - } - } - - if(is.null(xx)){ - x.group <- " " - x.class <- "unknown" - } else { - if(x == "break" || x == "next" || x == "for" || x == "if" || x == "repeat" || x == "while"){ - x.group <- "flow-control" - x.class <- "flow-control" - } else { - if(is.function(xx)) x.group <- "function" - else if(is.numeric(xx)) x.group <- "numeric" - else if(is.factor(xx)) x.group <- "factor" - else if(is.character(xx)) x.group <- "character" - else if(is.logical(xx)) x.group <- "logical" - else if(is.data.frame(xx)) x.group <- "data.frame" - else if(is.list(xx)) x.group <- "list" - else x.group <- " " - x.class <- class(xx)[1] - } - } - - if(x.group == "function"){ - if(curlevel == 0){ - cat(x, ";", "function;function", ";", printenv, ";", vim.list.args2(x), "\n", sep="") - } else { - # some libraries have function as list elements - cat(x, ";", "function;function", ";", printenv, ";", "Unknown arguments", "\n", sep="") - } - } else { - if(is.list(xx)){ - if(curlevel == 0){ - cat(x, ";", x.class, ";", x.group, ";", printenv, ";", "Not a function", "\n", sep="") - } else { - cat(x, ";", x.class, ";", " ", ";", printenv, ";", "Not a function", "\n", sep="") - } - } else { - cat(x, ";", x.class, ";", x.group, ";", printenv, ";", "Not a function", "\n", sep="") - } - } - - if(is.list(xx) && curlevel == 0){ - obj.names <- names(xx) - curlevel <- curlevel + 1 - if(length(xx) > 0){ - for(k in obj.names){ - vim.omni.line(paste(x, "$", k, sep=""), envir, printenv, curlevel) - } - } - } - } - - # Begin of .vim.bol() - vim.OutDec <- options("OutDec")[[1]] - options(OutDec = ".") - if(what == "installed"){ - cat("Loading all installed packages...\n") - for(vim.pack in installed.packages()[, "Package"]){ - library(vim.pack, character.only = TRUE) - } - } - noGlobalEnv <- vim.grepl("/r-plugin/omniList", omnilist) - if(noGlobalEnv){ - cat("Building file with list of objects in", what, "packages for omni completion and Object Browser...\n") - } - envnames <- search() - sink(omnilist, append = FALSE) - for(curenv in envnames){ - if((curenv == ".GlobalEnv" && noGlobalEnv) | (curenv != ".GlobalEnv" && noGlobalEnv == FALSE)) next - obj.list <- objects(curenv, all.names = allnames) - envir <- sub("package:", "", curenv) - l <- length(obj.list) - if(l > 0){ - for(obj in obj.list) vim.omni.line(obj, curenv, envir, 0) - } - } - sink() - options(OutDec = vim.OutDec) - unlink(paste(omnilist, ".locked", sep = "")) -} - diff --git a/r-plugin/etags2ctags.R b/r-plugin/etags2ctags.R deleted file mode 100644 index 0520bec..0000000 --- a/r-plugin/etags2ctags.R +++ /dev/null @@ -1,71 +0,0 @@ -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# A copy of the GNU General Public License is available at -# http://www.r-project.org/Licenses/ - -### Jakson Alves de Aquino -### Sat, July 17, 2010 - -# Note: Emacs TAGS file can be read by Vim if the feature -# +emacs_tags was enabled while compiling Vim. If your Vim does -# not have this feature, you can try the function below: - -# Function to convert from Emacs' TAGS file into Vim's tags file. -# See http://en.wikipedia.org/wiki/Ctags on the web and ":help -# ctags" in Vim for details on the two file formats. -# Note: This function only works with a tags file created by the R -# function rtags(). -# Arguments: -# etagsfile = character string with path to original TAGS -# ctagsfile = character string with path to destination tags -# Example: -# setwd("/path/to/R-2.11.1/src/library/base/R") -# rtags(ofile = "TAGS") -# etags2ctags("TAGS", "tags") -# After the above commands you should be able to jump from on file -# to another with Vim by hitting CTRL-] over function names. -etags2ctags <- function(etagsfile, ctagsfile){ - elines <- readLines(etagsfile) - filelen <- length(elines) - nfread <- sum(elines == "\x0c") - nnames <- filelen - (2 * nfread) - clines <- vector(mode = "character", length = nnames) - i <- 1 - k <- 1 - while (i < filelen) { - if(elines[i] == "\x0c"){ - i <- i + 1 - curfile <- sub(",.*", "", elines[i]) - i <- i + 1 - curflines <- readLines(curfile) - while(elines[i] != "\x0c" && i <= filelen){ - curname <- sub(".\x7f(.*)\x01.*", "\\1", elines[i]) - curlnum <- as.numeric(sub(".*\x01(.*),.*", "\\1", elines[i])) - curaddr <- curflines[as.numeric(curlnum)] - curaddr <- gsub("\\\\", "\\\\\\\\", curaddr) - curaddr <- gsub("\t", "\\\\t", curaddr) - curaddr <- gsub("/", "\\\\/", curaddr) - curaddr <- paste("/^", curaddr, "$", sep = "") - clines[k] <- paste(curname, curfile, curaddr, sep = "\t") - i <- i + 1 - k <- k + 1 - } - } else { - stop("Error while trying to interpret line ", i, " of '", etagsfile, "'.\n") - } - } - curcollate <- Sys.getlocale(category = "LC_COLLATE") - invisible(Sys.setlocale(category = "LC_COLLATE", locale = "C")) - clines <- sort(clines) - invisible(Sys.setlocale(category = "LC_COLLATE", locale = curcollate)) - writeLines(clines, ctagsfile) -} - diff --git a/r-plugin/specialfuns.R b/r-plugin/specialfuns.R deleted file mode 100644 index e351f8e..0000000 --- a/r-plugin/specialfuns.R +++ /dev/null @@ -1,56 +0,0 @@ -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# A copy of the GNU General Public License is available at -# http://www.r-project.org/Licenses/ - -### Jakson Alves de Aquino -### Sat, July 17, 2010 - - -.vim.list.args <- function(ff){ - knownGenerics <- c(names(.knownS3Generics), - tools:::.get_internal_S3_generics()) # from methods() - ff <- deparse(substitute(ff)) - keyf <- paste("^", ff, "$", sep="") - is.generic <- (length(grep(keyf, knownGenerics)) > 0) - if(is.generic){ - mm <- methods(ff) - l <- length(mm) - if(l > 0){ - for(i in 1:l){ - if(exists(mm[i])){ - cat(ff, "[method ", mm[i], "]:\n", sep="") - print(args(mm[i])) - cat("\n") - } - } - return(invisible(NULL)) - } - } - print(args(ff)) -} - - -.vim.plot <- function(x) -{ - xname <- deparse(substitute(x)) - if(length(grep("numeric", class(x))) > 0 || length(grep("integer", class(x))) > 0){ - oldpar <- par(no.readonly = TRUE) - par(mfrow = c(2, 1)) - hist(x, col = "lightgray", main = paste("Histogram of", xname), xlab = xname) - boxplot(x, main = paste("Boxplot of", xname), - col = "lightgray", horizontal = TRUE) - par(oldpar) - } else { - plot(x) - } -} - diff --git a/r-plugin/vimSweave.R b/r-plugin/vimSweave.R deleted file mode 100644 index b0bcb32..0000000 --- a/r-plugin/vimSweave.R +++ /dev/null @@ -1,13 +0,0 @@ - -.vim.Sweave <- function(rnowebfile, latexcmd = "pdflatex", bibtex = FALSE, ...) -{ - Sres <- Sweave(rnowebfile, ...) - if(exists('Sres')){ - system(paste(latexcmd, Sres)) - if(bibtex){ - system(paste("bibtex", sub("\\.tex$", ".aux", Sres))) - system(paste(latexcmd, Sres)) - system(paste(latexcmd, Sres)) - } - } -} diff --git a/r-plugin/vimbrowser.R b/r-plugin/vimbrowser.R deleted file mode 100644 index 8d5075e..0000000 --- a/r-plugin/vimbrowser.R +++ /dev/null @@ -1,69 +0,0 @@ - - -.vim.browser <- function(allnames = FALSE) -{ - vim.browserline <- function(x.name, x, curlist) - { - if(is.numeric(x)) x.class <- "numeric" - else if(is.factor(x)) x.class <- "factor" - else if(is.character(x)) x.class <- "character" - else if(is.function(x)) x.class <- "function" - else if(is.logical(x)) x.class <- "logical" - else if(is.data.frame(x) && !is.null(names(x)) && length(names(x)) > 0) x.class <- "data.frame" - else if(is.list(x) && !is.null(names(x)) && length(names(x)) > 0) x.class <- "list" - else x.class <- "other" - - cat("'", x.name, "': {'class': \"", x.class, '"', sep = "") - x.label <- attr(x, "label", exact = TRUE) - if(length(x.label) > 1) x.label <- x.label[[1]] - if(!is.null(x.label)){ - x.label <- gsub('"', '\\\\"', x.label) - cat(", 'label': \"", x.label, '"', sep = "") - } - if(is.list(x)){ - x.names <- names(x) - llen <- length(x) - idx <- grep("^$", x.names) - nnn <- 1:llen - x.names[idx] <- paste('[[', nnn[idx], ']]', sep = "") - curlist <- paste(curlist, x.name, sep = "-") - cat(", 'items': {", sep = "") - - # Don't include elements of lists with duplicated names - x.names.dup <- duplicated(x.names) - if(sum(x.names.dup) > 0) x.names <- x.names[!x.names.dup] - - newlistnames <- paste('"', paste(x.names, collapse = '", "'), '"', sep = "") - .vim.browser.order <<- paste(.vim.browser.order, "'", curlist, "': [", newlistnames, "], ", sep = "") - - len <- length(x.names) - if(len > 0){ - for(i in 1:len){ - vim.browserline(x.names[i], x[[i]], curlist) - } - } - cat("}") - } - cat("}, ") - } - - # Begin of .vim.browser() - objlist <- ls(".GlobalEnv", all.names = allnames) - .vim.browser.order <<- character() - sink(paste(Sys.getenv("VIMRPLUGIN_TMPDIR"), "/objbrowser", sep = "")) - cat("let b:workspace = {") - for(obj in objlist){ - vim.browserline(obj, get(obj), "") - } - cat("}\n") - .vim.browser.order <- sub(", $", "", .vim.browser.order) - cat("let b:list_order = {", .vim.browser.order, "}\n", sep = "") - liblist <- search() - liblist <- liblist[grep("package:", liblist)] - liblist <- sub("package:", "", liblist) - cat("let b:liblist = ['", paste(liblist, collapse = "', '"), "']\n", sep = "") - sink() - rm(.vim.browser.order, pos = ".GlobalEnv") - unlink(paste(Sys.getenv("VIMRPLUGIN_TMPDIR"), "/objbrowserlock", sep = "")) -} - diff --git a/r-plugin/vimhelp.R b/r-plugin/vimhelp.R deleted file mode 100644 index 6e2fcc8..0000000 --- a/r-plugin/vimhelp.R +++ /dev/null @@ -1,59 +0,0 @@ - -# Code based on all.R (src/library/utils) -.vim.help <- function(topic, w, classfor, package) -{ - if(!missing(classfor) & length(grep(topic, names(.knownS3Generics))) > 0){ - curwarn <- getOption("warn") - options(warn = -1) - try(classfor <- classfor, silent = TRUE) # classfor may be a function - try(.theclass <- class(classfor), silent = TRUE) - options(warn = curwarn) - if(exists(".theclass")){ - for(i in 1:length(.theclass)){ - newtopic <- paste(topic, ".", .theclass[i], sep = "") - if(length(utils:::index.search(newtopic, .find.package(NULL, NULL))) > 0){ - topic <- newtopic - break - } - } - } - } - if(version$major < "2" || (version$major == "2" && version$minor < "11.0")) - stop("The use of Vim as pager for R requires R >= 2.11.0\n Please, put in your vimrc:\n let vimrplugin_vimpager = \"no\"") - o <- paste(Sys.getenv("VIMRPLUGIN_TMPDIR"), "/Rdoc", sep = "") - f <- utils:::index.search(topic, .find.package(NULL, NULL)) - if(length(f) == 0){ - cat('No documentation for "', topic, '" in loaded packages and libraries.\n', sep = "") - return(invisible(NULL)) - } - if(length(f) > 1){ - if(missing(package)){ - f <- sub("/help/.*", "", f) - f <- sub(".*/", "", f) - sink(o) - cat("The topic \"", topic, "\" was found in ", length(f), " libraries.\n\n", sep = "") - cat("Please, send one of the lines below to R\nto get the desired documentation:\n\n") - for(i in 1:length(f)) - cat(f[i], "::", topic, "\n", sep = "") - sink() - unlink(paste(Sys.getenv("VIMRPLUGIN_TMPDIR"), "/Rdoclock", sep = "")) - return(invisible(NULL)) - f <- f[1] - } else { - f <- f[grep(paste("/", package, "/", sep = ""), f)] - if(length(f) == 0) - stop("length(f) == 0") - } - } - p <- basename(dirname(dirname(f))) - if(version$major > "2" || (version$major == "2" && version$minor >= "12.0")){ - tools::Rd2txt_options(width = w) - res <- tools::Rd2txt(utils:::.getHelpFile(f), out = o, package = p) - } else { - res <- tools::Rd2txt(utils:::.getHelpFile(f), width = w, out = o, package = p) - } - unlink(paste(Sys.getenv("VIMRPLUGIN_TMPDIR"), "/Rdoclock", sep = "")) - if(length(res) == 0) - stop("length(res) == 0") -} - diff --git a/r-plugin/vimprint.R b/r-plugin/vimprint.R deleted file mode 100644 index 5a34a9a..0000000 --- a/r-plugin/vimprint.R +++ /dev/null @@ -1,26 +0,0 @@ - -.vim.print <- function(object, classfor) -{ - if(!exists(object)) - stop("object '", object, "' not found") - if(!missing(classfor) & length(grep(object, names(.knownS3Generics))) > 0){ - curwarn <- getOption("warn") - options(warn = -1) - try(classfor <- classfor, silent = TRUE) # classfor may be a function - try(.theclass <- class(classfor), silent = TRUE) - options(warn = curwarn) - if(exists(".theclass")){ - for(cls in .theclass){ - if(exists(paste(object, ".", .theclass, sep = ""))){ - .newobj <- get(paste(object, ".", .theclass, sep = "")) - warning("Printing ", object, ".", .theclass, "\n", sep = "") - break - } - } - } - } - if(!exists(".newobj")) - .newobj <- get(object) - print(.newobj) -} - From 4110549318dbd06d2b60cc0b754219908b36855a Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 22 Dec 2011 23:54:03 -0300 Subject: [PATCH 0135/1050] The vimcom R package is required now. The Object Browser only runs if the vimcom package is installed and loaded in R. The R documentation also is shown on Vim only if the vimcom package is loaded. Python interface is required to enable these two features. --- Makefile | 12 +- doc/r-plugin.txt | 85 +++--- ftplugin/rbrowser.vim | 568 ++++++------------------------------- ftplugin/rnoweb.vim | 4 +- r-plugin/common_global.vim | 441 ++++++---------------------- r-plugin/vimcom.py | 19 +- 6 files changed, 219 insertions(+), 910 deletions(-) diff --git a/Makefile b/Makefile index 13d1993..675e8d0 100644 --- a/Makefile +++ b/Makefile @@ -22,7 +22,7 @@ PLUGINHOME=`pwd` -PLUGINVERSION=0.9.6 +PLUGINVERSION=0.9.8 DEBIANTIME=`date -R` PLUGINRELEASEDATE=`date +"%Y-%m-%d"` VIM2HTML=/usr/local/share/vim/vim73/doc/vim2html.pl @@ -50,7 +50,7 @@ zip: tar -cvzf /tmp/vimrplugintmpfile.tar.gz ftdetect/r.vim indent/r.vim \ indent/rnoweb.vim indent/rhelp.vim autoload/rcomplete.vim ftplugin/r*.vim \ syntax/rout.vim syntax/r.vim syntax/rhelp.vim syntax/rdoc.vim syntax/rbrowser.vim \ - doc/r-plugin.txt r-plugin/*.R r-plugin/functions.vim \ + doc/r-plugin.txt r-plugin/functions.vim r-plugin/vimcom.py \ r-plugin/global_r_plugin.vim r-plugin/omniList r-plugin/windows.py \ r-plugin/vimActivate.js r-plugin/tex_indent.vim r-plugin/r.snippets \ r-plugin/common_buffer.vim r-plugin/common_global.vim \ @@ -123,17 +123,11 @@ deb: - indent/r.vim\n\ - indent/rnoweb.vim\n\ - indent/rhelp.vim\n\ - - r-plugin/build_omniList.R\n\ - r-plugin/common_buffer.vim\n\ - r-plugin/common_global.vim\n\ - - r-plugin/etags2ctags.R\n\ + - r-plugin/vimcom.py\n\ - r-plugin/global_r_plugin.vim\n\ - - r-plugin/specialfuns.R\n\ - r-plugin/tex_indent.vim\n\ - - r-plugin/vimbrowser.R\n\ - - r-plugin/vimhelp.R\n\ - - r-plugin/vimprint.R\n\ - - r-plugin/vimSweave.R\n\ - syntax/r.vim\n\ - syntax/rdoc.vim\n\ - syntax/rout.vim\n\ diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 60023b5..f4e1e9d 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -5,7 +5,7 @@ Authors: Jakson A. Aquino Jose Claudio Faria -Version: 0.9.6 +Version: 0.9.8 For Vim version 7.3 1. Overview |r-plugin-overview| @@ -124,8 +124,10 @@ In addition to having R installed in your system, this plugin has the following dependencies: Depends:~ + Vim >= 7.3 with Python support. Tmux >= 1.3: http://tmux.sourceforge.net Screen plugin: http://www.vim.org/scripts/script.php?script_id=2711 + vimcom: http://www.lepem.ufc.br/jaa/vimcom Recommends:~ ncurses-term: http://invisible-island.net/ncurses @@ -476,8 +478,7 @@ The command :RUpdateObjList in addition to creating a list of function names to be highlighted also creates a file containing a list of objects for omni completion (|compl-omni|) including all objects currently in R's workspace, with the exception of the .GlobalEnv objects. These two lists are stored -permanently in the ~/.vim/r-plugin directory and one of them, "omniList", is -also used by the Object Browser to show the contents of libraries. +permanently in the ~/.vim/r-plugin directory. The command :RUpdateObjList waits 120 seconds to R finish building the list. If this time is not enough to your system, please, set a different value of @@ -493,33 +494,29 @@ and, then, build the "omniList". 4.4. The Object Browser~ You have to do ro to either start or updated the Object Browser. -The Object Browser has two views: .GlobalEnv and Libraries. If you either -press or double click (GVim only) on the first line of the Object -Browser it will toggle the view between the objects in .GlobalEnv and the -currently loaded libraries (but only libraries loaded when |:RUpdateObjList| -was run will be shown). - -In the .GlobalEnv view, if an object has the attribute "label", it will be -displayed in the Object Browser. The options |vimrplugin_open_df| and -|vimrplugin_open_list| control whether the elements of data.frames and lists -are shown. In the Object Browser window, while in Normal mode, you can either -press or double click (GVim only) over a data.frame or list to -show/hide its elements (not if viewing the content of loaded libraries). If -you are running (G)Vim in an UTF-8 locale, unicode line drawing characters -will be used to draw lines in the Object Browser. This is the case of most -Linux distributions. If you are using Windows, ascii characters will be used, -unless you have set the 'encoding' to utf-8 in your |vimrc| (on Windows, some -fonts that support Unicode are "Courier_New", "Lucida_Console", "Consolas", -and "Lucida_Sans_Typewriter"). +The updating is automatic only if the Object Browser is running in a separate +Tmux panel beside the R Console. The Object Browser has two views: .GlobalEnv +and Libraries. If you either press or double click (GVim or Vim with +'mouse' set to "a") on the first line of the Object Browser it will toggle the +view between the objects in .GlobalEnv and the currently loaded libraries (but +only libraries loaded when |:RUpdateObjList| was run will be shown). + +In the .GlobalEnv view, if an object has the attribute "label", it will also +be displayed. Please, see the R help for package vimcom for some options to +control the Object Browser behavior. In the Object Browser window, while in +Normal mode, you can either press or double click (GVim only) over a +data.frame or list to show/hide its elements (not if viewing the content of +loaded libraries). If you are running R in an environment where the string +UTF-8 is part of either LC_MESSAGES or LC_ALL variables, unicode line drawing +characters will be used to draw lines in the Object Browser. This is the case +of most Linux distributions. In the Libraries view, you can either double click or press over a -library to see its objects. The Object Browser goes down only one level in -lists. Thus, if a list has a sublist among its elements, the sublist elements -will not be shown. In the Object Browser, the libraries have the color defined -by the PreProc highlighting group, and the other objects have their colors -defined by the return value of some R functions. Each line in the table below -shows a highlighting group and the corresponding R function (if any) used to -classify the objects: +library to see its objects. In the Object Browser, the libraries have the +color defined by the PreProc highlighting group, and the other objects have +their colors defined by the return value of some R functions. Each line in the +table below shows a highlighting group and the corresponding R function (if +any) used to classify the objects: PreProc libraries Number is.numeric() @@ -826,8 +823,6 @@ duplicated to R on Mac OS X. |vimrplugin_screenvsplit| Split the window vertically (screen plugin) |vimrplugin_tmux| Choose between Tmux and GNU Screen |vimrplugin_applescript| Use osascript in Mac OS X. -|vimrplugin_open_df| Show data.frame elements in the Obj. Browser -|vimrplugin_open_list| Show list elements in the Object Browser |vimrplugin_allnames| Show names which begin with a dot |vimrplugin_listmethods| Do .vim.list.args() instead of args() |vimrplugin_specialplot| Do .vim.plot() instead of plot() @@ -887,9 +882,6 @@ put in your |vimrc|: 7.3. Object Browser options~ *vimrplugin_objbr_place* *vimrplugin_objbr_w* - *vimrplugin_open_df* - *vimrplugin_open_list* - *vimrplugin_allnames* By default, the object browser will be created with 40 columns. The minimum width of the Object Browser window is 9 columns. You can change the object browser's default width by setting the value of |vimrplugin_objbr_w| in your @@ -909,18 +901,6 @@ running. Valid values for the Object Browser placement are "script" or let vimrplugin_objbr_place = "script,right" let vimrplugin_objbr_place = "console,left" < -By default, the elements of data.frames are shown in the object browser, but -not the elements of other types of lists. You can put the following in your -|vimrc| to change this behavior: -> - let vimrplugin_open_df = 0 - let vimrplugin_open_list = 1 -< -By default, names of objects which begin with a . are omitted. If you prefer -to see them in the object browser, put in your |vimrc|: -> - let vimrplugin_allnames = 1 -< 7.4. Vim as pager for R help~ *vimrplugin_vimpager* @@ -1346,19 +1326,13 @@ directory after the installation: indent/r.vim indent/rhelp.vim indent/rnoweb.vim - r-plugin/build_omniList.R r-plugin/common_buffer.vim r-plugin/common_global.vim - r-plugin/etags2ctags.R r-plugin/functions.vim r-plugin/omniList - r-plugin/vimbrowser.R - r-plugin/vimhelp.R - r-plugin/vimprint.R - r-plugin/vimSweave.R r-plugin/r.snippets - r-plugin/specialfuns.R r-plugin/tex_indent.vim + r-plugin/vimcom.py r-plugin/vimActivate.js r-plugin/windows.py syntax/rbrowser.vim @@ -1827,6 +1801,13 @@ the R syntax highlighted. *r-plugin-news* 12. News~ +0.9.8 (2011-12-22) + + * Use the R package vimcom. The following options are now set on the vimcom R + package and no longer in the Vim-R-plugin: allnames, open_df, and + open_list. + + 0.9.6 (2011-12-13) * Fix path to R source() command on Windows. diff --git a/ftplugin/rbrowser.vim b/ftplugin/rbrowser.vim index 79f0736..9dd0cb6 100644 --- a/ftplugin/rbrowser.vim +++ b/ftplugin/rbrowser.vim @@ -16,7 +16,7 @@ " " Author: Jakson Alves de Aquino " -" Last Change: Wed Dec 21, 2011 04:49PM +" Last Change: Thu Dec 22, 2011 10:53PM "========================================================================== " Only do this when not yet done for this buffer @@ -51,39 +51,14 @@ if !exists("g:rplugin_hasbrowsermenu") let g:rplugin_hasbrowsermenu = 0 endif -" Current cursor position in the object browser and in the library browser -let g:rplugin_curbline = 1 -let g:rplugin_curbcol = 0 -let g:rplugin_curlline = 1 -let g:rplugin_curlcol = 0 - " Current view of the object browser: .GlobalEnv X loaded libraries let g:rplugin_curview = "GlobalEnv" -" The list of objects in R's workspace is a dictionary. Each key in the -" dictionary is a dictionary with at least the key 'class'. If the class is -" "list", it will have the key 'items' (which lists the elements of the list). -let b:workspace = {} - -" Dictionary storing flags indicating whether the elements of an R's list -" must be shown in the object browser. By default, "data.frame" objects are -" included in the dictionary with the flag 1, but other list objects are -" inserted in the dictionary with the flag 0. -if !exists("g:rplugin_opendict") - let g:rplugin_opendict = {} -endif - -" Dictionary storing the order of the elements in a list. This is necessary -" because Vim's dictionary stores the items in an "arbitrary" order. -let b:list_order = {} - -let b:liblist = [] - -function! UpdateGlobalEnv() - if g:rplugin_curview == "libraries" +function! UpdateOB(what) + if g:rplugin_curview != a:what return endif - if exists("g:rplugin_curbuf") && g:rplugin_curbuf != "Object_Browser" + if exists("g:rplugin_curbuf") && g:rplugin_curbuf != "Object_Browser" && !exists("b:myservername") let savesb = &switchbuf set switchbuf=useopen,usetab sil noautocmd sb Object_Browser @@ -101,402 +76,44 @@ function! UpdateGlobalEnv() let curcol = 1 endif sil normal! ggdG - call setline(1, ".GlobalEnv | Libraries") - exe "silent read " . $VIMRPLUGIN_TMPDIR . "/object_browser" - call cursor(curline, curcol) - set nomodifiable - if g:rplugin_switchedbuf - exe "sil noautocmd sb " . g:rplugin_curbuf - exe "set switchbuf=" . savesb - endif -endfunction - -function! UpdateLibraries() - if exists("g:rplugin_curbuf") && g:rplugin_curbuf != "Object_Browser" - let savesb = &switchbuf - set switchbuf=useopen,usetab - sil noautocmd sb Object_Browser - let g:rplugin_switchedbuf = 1 + if a:what == "GlobalEnv" + call setline(1, ".GlobalEnv | Libraries") + exe "silent read " . $VIMRPLUGIN_TMPDIR . "/object_browser" else - let g:rplugin_switchedbuf = 0 - endif - exe "silent source " . $VIMRPLUGIN_TMPDIR . "/liblist" - if g:rplugin_curview == "libraries" - call RBrowserShowLibs(0) + call setline(1, "Libraries | .GlobalEnv") + exe "silent read " . $VIMRPLUGIN_TMPDIR . "/liblist" endif + call cursor(curline, curcol) + set nomodifiable + redraw if g:rplugin_switchedbuf exe "sil noautocmd sb " . g:rplugin_curbuf exe "set switchbuf=" . savesb endif endfunction -function! RBrowserMakeLibDict() - let b:libdict = {} - let nobjs = len(g:rplugin_liblist) - let i = 0 - while i < nobjs - let obj = split(g:rplugin_liblist[i], ';') - let curlib = obj[3] - let haslib = 0 - for lib in b:liblist - if lib == obj[3] - let haslib = 1 - break - endif - endfor - if haslib - let b:libdict[obj[3]] = {'class': "library", 'items': {}} - while curlib == obj[3] - if obj[2] == "list" || obj[2] == "data.frame" - let b:libdict[obj[3]]['items'][obj[0]] = {'class': obj[2], 'items': {}} - let curdf = obj[0] - let lastdf = obj[0] - let lo_element = "-" . curlib . "-" . curdf - let b:list_order[lo_element] = [] - let g:rplugin_opendict[curdf] = 0 - let i += 1 - if i == nobjs - break - endif - let obj = split(g:rplugin_liblist[i], ';') - while stridx(obj[0], "$") > 0 - let [lastdf, lastcol] = split(obj[0], '\$') - let b:libdict[curlib]['items'][curdf]['items'][lastcol] = {'class': obj[2]} - call add(b:list_order[lo_element], lastcol) - - let i += 1 - if i == nobjs - break - endif - let obj = split(g:rplugin_liblist[i], ';') - endwhile - else - let b:libdict[obj[3]]['items'][obj[0]] = {'class': obj[2]} - let i += 1 - if i == nobjs - break - endif - endif - let obj = split(g:rplugin_liblist[i], ';') - endwhile - else - while curlib == obj[3] - let i += 1 - if i == nobjs - break - endif - let obj = split(g:rplugin_liblist[i], ';') - endwhile - endif - endwhile -endfunction - -function! RBrowserMakeLine(key, prefix, curlist) - exe "let curkey = g:rplugin_curdict['" . a:key . "']" - let cls = curkey['class'] - if has("conceal") - if cls == "list" || cls == "data.frame" - let line = a:prefix . '[#' . a:key . ' ' - elseif cls == "numeric" - let line = a:prefix . '{#' . a:key . ' ' - elseif cls == "character" - let line = a:prefix . '"#' . a:key . ' ' - elseif cls == "factor" - let line = a:prefix . "'#" . a:key . ' ' - elseif cls == "function" - let line = a:prefix . '(#' . a:key . ' ' - elseif cls == "logical" - let line = a:prefix . '%#' . a:key . ' ' - elseif cls == "library" - let line = a:prefix . '##' . a:key . ' ' - elseif cls == "flow-control" - let line = a:prefix . '!#' . a:key . ' ' - else - let line = a:prefix . '=#' . a:key . ' ' - endif - else - if cls == "list" || cls == "data.frame" - let line = a:prefix . '[' . a:key . ' ' - elseif cls == "numeric" - let line = a:prefix . '{' . a:key . ' ' - elseif cls == "character" - let line = a:prefix . '"' . a:key . ' ' - elseif cls == "factor" - let line = a:prefix . "'" . a:key . ' ' - elseif cls == "function" - let line = a:prefix . '(' . a:key . ' ' - elseif cls == "logical" - let line = a:prefix . '%' . a:key . ' ' - elseif cls == "library" - let line = a:prefix . '#' . a:key . ' ' - elseif cls == "flow-control" - let line = a:prefix . '!' . a:key . ' ' - else - let line = a:prefix . '=' . a:key . ' ' - endif - endif - - if has("conceal") && g:rplugin_curobjlevel == 0 - let line = " " . line - endif - - " If the object's label exists, then append it to the end of the line - let thekeys = keys(curkey) - for subkey in thekeys - if subkey == "label" - let line = line . curkey['label'] - endif - endfor - let lnr = line("$") + 1 - call setline(lnr, line) - - " If the object is a data.frame, show its columns - if cls == "data.frame" || cls == "list" || cls == "library" - let whattodo = "addkey" - for i in keys(g:rplugin_opendict) - if i == a:key - if g:rplugin_opendict[a:key] == 0 - return - else - let whattodo = "show elements" - break - endif - endif - endfor - if whattodo == "addkey" - if cls == "data.frame" || cls == "list" - echoerr "rbrowser.vim: unregistered data.frame or list!" - else - let g:rplugin_opendict[a:key] = 0 - endif - endif - if g:rplugin_opendict[a:key] == 0 - return - endif - - if &encoding == "utf-8" - let strL = " └─" - let strT = " ├─" - let strI = " │ " - else - let strL = " `-" - let strT = " |-" - let strI = " | " - endif - - if has("conceal") - let strL = strL . " " - let strT = strT . " " - let strI = strI . " " - let g:rplugin_curobjlevel += 1 - endif - - if a:prefix =~ strL - let newprefix = substitute(a:prefix, strL, " ", "") - else - let newprefix = substitute(a:prefix, strT, strI, "") - endif - let newprefix = newprefix . strT - let olddict = g:rplugin_curdict - let g:rplugin_curdict = curkey['items'] - let curlist = a:curlist . "-" . a:key - if cls == "library" - let thesubkeys = sort(keys(g:rplugin_curdict)) - else - let thesubkeys = b:list_order[curlist] - endif - let nkeys = len(thesubkeys) - let i = 0 - for key in thesubkeys - let i += 1 - if i < nkeys - call RBrowserMakeLine(key, newprefix, curlist) - else - let newprefix = substitute(newprefix, strT, strL, "") - call RBrowserMakeLine(key, newprefix, curlist) - endif - endfor - let g:rplugin_curdict = olddict - endif -endfunction - -function! RBrowserAddItemToList(key, curlist) - exe "let curkey = g:rplugin_curdict['" . a:key . "']" - let cls = curkey['class'] - - " If the object is a data.frame, show its columns - if cls == "data.frame" || cls == "list" - let whattodo = "addkey" - for i in keys(g:rplugin_opendict) - if i == a:key - let whattodo = "nothing" - break - endif - endfor - if whattodo == "addkey" - if cls == "data.frame" - let g:rplugin_opendict[a:key] = g:vimrplugin_open_df - else - if cls == "list" - let g:rplugin_opendict[a:key] = g:vimrplugin_open_list - else - let g:rplugin_opendict[a:key] = 0 - endif - endif - endif - - let olddict = g:rplugin_curdict - let g:rplugin_curdict = curkey['items'] - let curlist = a:curlist . "-" . a:key - let thesubkeys = b:list_order[curlist] - let nkeys = len(thesubkeys) - let i = 0 - for key in thesubkeys - let i += 1 - if i < nkeys - call RBrowserAddItemToList(key, curlist) - else - call RBrowserAddItemToList(key, curlist) - endif - endfor - let g:rplugin_curdict = olddict - endif -endfunction - -function! RBrowserFillCloseList() - let thekeys = sort(keys(b:workspace)) - for key in thekeys - let s:curlist = "" - let g:rplugin_curobjlevel = 0 - let g:rplugin_curdict = b:workspace - call RBrowserAddItemToList(key, "") - endfor -endfunction - -function! RBrowserShowGE(fromother) - if g:vimrplugin_vimcom - let g:rplugin_curview = "GlobalEnv" - call UpdateGlobalEnv() - return - endif - let g:rplugin_curview = "GlobalEnv" - if a:fromother == 0 - let g:rplugin_curbline = line(".") - let g:rplugin_curbcol = col(".") - endif - - setlocal modifiable - sil normal! ggdG - call setline(1, ".GlobalEnv | Libraries") - call setline(2, "") - let thekeys = sort(keys(b:workspace)) - for key in thekeys - let s:curlist = "" - let g:rplugin_curobjlevel = 0 - let g:rplugin_curdict = b:workspace - call RBrowserMakeLine(key, " ", "") - endfor - call cursor(g:rplugin_curbline, g:rplugin_curbcol) - setlocal nomodifiable -endfunction - -function! RBrowserShowLibs(fromother) - let g:rplugin_curview = "libraries" - if a:fromother == 0 - let g:rplugin_curlline = line(".") - let g:rplugin_curlcol = col(".") - endif - - call RBrowserMakeLibDict() - - setlocal modifiable - sil normal! ggdG - call setline(1, "Libraries | .GlobalEnv") - call setline(2, "") - - " Fill the object browser - let thekeys = sort(keys(b:libdict)) - for key in thekeys - let s:curlist = "" - let g:rplugin_curobjlevel = 0 - let g:rplugin_curdict = b:libdict - call RBrowserMakeLine(key, " ", "") - endfor - - " Warn about libraries not present when :RUpdateObjList was run - let hasmissing = 0 - let misslibs = [] - for lib in b:liblist - if lib != "setwidth" && search('#' . lib, "wn") == 0 - let hasmissing += 1 - call add(misslibs, lib) - endif - endfor - if hasmissing - call setline(line("$") + 1, "") - call setline(line("$") + 1, "Warning:") - call setline(line("$") + 1, "The following") - if hasmissing == 1 - call setline(line("$") + 1, "library is loaded") - call setline(line("$") + 1, "but is not in the") - else - call setline(line("$") + 1, "libraries are loaded") - call setline(line("$") + 1, "but are not in the") - endif - call setline(line("$") + 1, "omniList:") - call setline(line("$") + 1, "") - for lib in misslibs - call setline(line("$") + 1, " " . lib) - endfor - call setline(line("$") + 1, "") - call setline(line("$") + 1, "Please read the Vim-R-plugin") - call setline(line("$") + 1, "documentation:") - call setline(line("$") + 1, "") - call setline(line("$") + 1, " :h :RUpdateObjList") - call setline(line("$") + 1, "") - call setline(line("$") + 1, "to know how to show all loaded") - call setline(line("$") + 1, "libraries in the Object Browser.") - endif - - call cursor(g:rplugin_curlline, g:rplugin_curlcol) - setlocal nomodifiable -endfunction - -function! RBrowserFill(fromother) - if g:rplugin_curview == "libraries" - call RBrowserShowLibs(a:fromother) - else - call RBrowserShowGE(a:fromother) - endif -endfunction - function! RBrowserDoubleClick() " Toggle view: Objects in the workspace X List of libraries if line(".") == 1 if g:rplugin_curview == "libraries" - call RBrowserShowGE(1) + let g:rplugin_curview = "GlobalEnv" + call UpdateOB("GlobalEnv") else - call RBrowserShowLibs(1) + let g:rplugin_curview = "libraries" + call UpdateOB("libraries") endif return endif " Toggle state of list or data.frame: open X closed - if g:vimrplugin_vimcom && g:rplugin_curview == "GlobalEnv" - let key = RBrowserGetName(1) - exe 'python SendToR("' . "\005" . '-' . substitute(key, '\$', '-', "g") . '")' - call UpdateGlobalEnv() - return + let key = RBrowserGetName(1) + if g:rplugin_curview == "GlobalEnv" + exe 'Py SendToR("' . "\005" . '-' . substitute(key, '\$', '-', "g") . '")' + call UpdateOB("GlobalEnv") + else + exe 'Py SendToR("' . "\005" . substitute(key, '\$', '-', "g") . '")' + call UpdateOB("libraries") endif - - let key = RBrowserGetName(0) - for i in keys(g:rplugin_opendict) - if i == key - let g:rplugin_opendict[key] = !g:rplugin_opendict[key] - call RBrowserFill(0) - break - endif - endfor endfunction function! RBrowserOpenCloseLists(status) @@ -515,18 +132,11 @@ function! RBrowserOpenCloseLists(status) endif endif - if g:vimrplugin_vimcom - exe 'python SendToR("' . "\006" . a:status . '")' - if g:rplugin_curview == "GlobalEnv" - call UpdateGlobalEnv() - else - call UpdateLibraries() - endif + exe 'Py SendToR("' . "\006" . a:status . '")' + if g:rplugin_curview == "GlobalEnv" + call UpdateOB("GlobalEnv") else - for key in keys(g:rplugin_opendict) - let g:rplugin_opendict[key] = a:status - endfor - call RBrowserFill(0) + call UpdateOB("libraries") endif if !exists("b:myservername") @@ -548,15 +158,12 @@ function! RBrowserRightClick() endif let line = getline(".") + if line =~ "^ ##" + return + endif let isfunction = 0 - if has("conceal") - if line =~ "(#.*\t" - let isfunction = 1 - endif - else - if line =~ "(.*\t" - let isfunction = 1 - endif + if line =~ "(#.*\t" + let isfunction = 1 endif if g:rplugin_hasbrowsermenu == 1 @@ -580,29 +187,43 @@ function! RBrowserRightClick() let g:rplugin_hasbrowsermenu = 1 endfunction +function! RBGetPkgName() + let lnum = line(".") + while lnum > 0 + let line = getline(lnum) + if line =~ '.*##[0-9a-zA-Z\.]*\t' + let line = substitute(line, '.*##\(.*\)\t', '\1', "") + return line + endif + let lnum -= 1 + endwhile + return "" +endfunction + function! RBrowserFindParent(word, curline, curpos) let curline = a:curline let curpos = a:curpos while curline > 1 && curpos >= a:curpos let curline -= 1 let line = substitute(getline(curline), " .*", "", "") - if has("conceal") - let curpos = stridx(line, '[#') - else - let curpos = stridx(line, '[') - endif + let curpos = stridx(line, '[#') if curpos == -1 let curpos = a:curpos endif endwhile - if curline > 1 - if has("conceal") - let word = substitute(line, '.*[#', "", "") . '$' . a:word + if g:rplugin_curview == "GlobalEnv" + let spacelimit = 3 + else + if $LC_MESSAGES =~ "UTF-8" + let spacelimit = 10 else - let word = substitute(line, '.*[', "", "") . '$' . a:word + let spacelimit = 6 endif - if curpos != s:spacelimit + endif + if curline > 1 + let word = substitute(line, '.*[#', "", "") . '$' . a:word + if curpos != spacelimit let word = RBrowserFindParent(word, line("."), curpos) endif return word @@ -623,17 +244,12 @@ function! RBrowserGetName(complete) endif " Is the object a top level one (curpos == 2)? - if has("conceal") - let delim = ['{#', '[#', '(#', '"#', "'#", '%#', '=#'] - let word = substitute(line, '^\W*#\{-1,}\(.*\)\t.*', '\1', "") + if g:rplugin_curview == "libraries" + let delim = ['##', '{#', '[#', '(#', '"#', "'#", '%#', '=#'] else - let tabpos = stridx(getline("."), " ") - if curpos > tabpos - return - endif - let delim = ['{', '[', '(', '"', "'", '%', '='] - let word = expand("") + let delim = ['{#', '[#', '(#', '"#', "'#", '%#', '=#'] endif + let word = substitute(line, '^\W*#\{-1,}\(.*\)\t.*', '\1', "") if word =~ ' ' || word =~ '^[0-9]' let word = '`' . word . '`' @@ -653,23 +269,25 @@ function! RBrowserGetName(complete) return "" endif - let s:spacelimit = 2 - if has("conceal") - let s:spacelimit += 1 - endif - if g:rplugin_curview == "libraries" - if &encoding == "utf-8" - let s:spacelimit += 7 - else - let s:spacelimit += 3 - endif - endif - if curpos == s:spacelimit + if curpos == 3 " top level object - return word + if g:rplugin_curview == "libraries" + return "package:" . word + else + return word + endif else - if curpos > s:spacelimit + if g:rplugin_curview == "libraries" + if $LC_MESSAGES =~ "UTF-8" + if curpos == 10 + return word + endif + elseif curpos == 6 + return word + endif + endif + if curpos > 3 " Find the parent data.frame or list let word = RBrowserFindParent(word, line("."), curpos) " Unnamed objects of lists @@ -679,7 +297,7 @@ function! RBrowserGetName(complete) return word else " Wrong object name delimiter: should never happen. - let msg = "R-plugin Error: (curpos = " . curpos . ") < (spacelimit = " . s:spacelimit . ") " . word + let msg = "R-plugin Error: (curpos = " . curpos . ") " . word echoerr msg return "" endif @@ -696,19 +314,8 @@ function! MakeRBrowserMenu() call RBrowserMenu() endfunction -function! LeaveRBrowser() - if g:rplugin_curview == "libraries" - let g:rplugin_curlline = line(".") - let g:rplugin_curlcol = col(".") - else - let g:rplugin_curbline = line(".") - let g:rplugin_curbcol = col(".") - endif -endfunction - function! ObBrBufUnload() - py SendToR("\x08Stop Updating Info") - py StopOBServer() + Py StopOBServer() call delete($VIMRPLUGIN_TMPDIR . "/object_browser") call delete($VIMRPLUGIN_TMPDIR . "/liblist") if exists("b:myservername") @@ -720,17 +327,6 @@ function! SourceObjBrLines() exe "source " . $VIMRPLUGIN_TMPDIR . "/objbrowserInit" endfunction -function! OnOBBufEnter() - if g:vimrplugin_vimcom - return - endif - if exists("b:myservername") - call remote_expr(b:myservername, "RObjBrowser()") - else - call RObjBrowser() - endif -endfunction - nmap :call RBrowserDoubleClick() nmap <2-LeftMouse> :call RBrowserDoubleClick() nmap :call RBrowserRightClick() @@ -743,19 +339,13 @@ setlocal bufhidden=wipe if has("gui_running") call RControlMenu() call RBrowserMenu() - let s:thisbuffname = substitute(bufname("%"), '\.', '', "g") - let s:thisbuffname = substitute(s:thisbuffname, ' ', '', "g") - exe "augroup " . s:thisbuffname - au BufLeave call LeaveRBrowser() - exe "augroup END" - unlet s:thisbuffname endif call writefile([], $VIMRPLUGIN_TMPDIR . "/object_browser") call writefile([], $VIMRPLUGIN_TMPDIR . "/liblist") au BufUnload call ObBrBufUnload() -au BufEnter call OnOBBufEnter() + let &cpo = s:cpo_save unlet s:cpo_save diff --git a/ftplugin/rnoweb.vim b/ftplugin/rnoweb.vim index c40a295..cb3358e 100644 --- a/ftplugin/rnoweb.vim +++ b/ftplugin/rnoweb.vim @@ -17,7 +17,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Fri Nov 25, 2011 08:43PM +" Last Change: Thu Dec 22, 2011 08:59AM "========================================================================== " Only do this when not yet done for this buffer @@ -112,7 +112,7 @@ endfunction function! RMakePDF(bibtex) update call RSetWD() - let pdfcmd = "source('" . g:rplugin_home . "/r-plugin/vimSweave.R') ; .vim.Sweave('" . expand("%:t") . "'" + let pdfcmd = "vim.Sweave('" . expand("%:t") . "'" if g:vimrplugin_latexcmd != "pdflatex" let pdfcmd = pdfcmd . ", latexcmd = '" . g:vimrplugin_latexcmd . "'" diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 46b7c18..10aaf98 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -15,7 +15,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Wed Dec 21, 2011 04:20PM +" Last Change: Thu Dec 22, 2011 11:45PM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -495,7 +495,7 @@ function StartR(whatr) if has("win32") || has("win64") if g:vimrplugin_conqueplugin == 0 - exe s:py . " StartRPy()" + Py StartRPy() lcd - return else @@ -510,7 +510,7 @@ function StartR(whatr) endif if g:vimrplugin_screenplugin - if g:vimrplugin_vimcom == 0 + if $TERM =~ "screen" let rcmd = "VIMRPLUGIN_TMPDIR=" . $VIMRPLUGIN_TMPDIR . " " . rcmd endif if g:vimrplugin_tmux == 0 && g:vimrplugin_noscreenrc == 0 && exists("g:ScreenShellScreenInitArgs") @@ -699,7 +699,7 @@ function StartObjectBrowser() let objbrowserfile = $VIMRPLUGIN_TMPDIR . "/objbrowserInit" if g:vimrplugin_objbr_place =~ "console" && g:vimrplugin_conqueplugin == 0 - let obscmd = 'python RunOBServer()' + let obscmd = 'Py RunOBServer()' else let obscmd = ' ' endif @@ -719,11 +719,10 @@ function StartObjectBrowser() \ 'normal! ggdG', \ 'setlocal nomodified', \ 'call cursor(curline, curcol)', - \ 'exe "pyfile " . g:rplugin_home . "/r-plugin/vimcom.py"', - \ 'python SendToR("\003GlobalEnv")', - \ 'python SendToR("\004Libraries")', - \ 'call UpdateGlobalEnv()', - \ 'call UpdateLibraries()', + \ 'exe "PyFile " . g:rplugin_home . "/r-plugin/vimcom.py"', + \ 'Py SendToR("\003GlobalEnv")', + \ 'Py SendToR("\004Libraries")', + \ 'call UpdateOB("GlobalEnv")', \ obscmd, \ 'redraw'], objbrowserfile) @@ -778,20 +777,23 @@ function StartObjectBrowser() unlet g:tmp_objbrtitle unlet g:tmp_screensname unlet g:tmp_curbufname - exe "pyfile " . g:rplugin_home . "/r-plugin/vimcom.py" - python SendToR("\003GlobalEnv") - python SendToR("\004Libraries") - call UpdateGlobalEnv() - call UpdateLibraries() + exe "PyFile " . g:rplugin_home . "/r-plugin/vimcom.py" + Py SendToR("\003GlobalEnv") + Py SendToR("\004Libraries") + call UpdateOB("GlobalEnv") if g:vimrplugin_objbr_place =~ "console" && g:vimrplugin_conqueplugin == 0 - python RunOBServer() + Py RunOBServer() endif endif - endfunction " Open an Object Browser window function RObjBrowser() + if !has("python") && !has("python3") + call RWarningMsg("Python support is required to run the Object Browser.") + return + endif + " Only opens the Object Browser if R is running if g:vimrplugin_screenplugin && !exists("g:ScreenShellSend") && !exists("b:myservername") return @@ -806,215 +808,15 @@ function RObjBrowser() let g:rplugin_running_objbr = 1 - if g:vimrplugin_vimcom - call StartObjectBrowser() - python SendToR("\003GlobalEnv") - python SendToR("\004Libraries") - if exists("*UpdateGlobalEnv") - call UpdateGlobalEnv() - call UpdateLibraries() - endif - let g:rplugin_running_objbr = 0 - return - endif - - " R builds the Object Browser contents. - let lockfile = $VIMRPLUGIN_TMPDIR . "/objbrowser" . "lock" - call writefile(["Wait!"], lockfile) - if g:vimrplugin_allnames == 1 - call SendCmdToR('source("' . g:rplugin_home . '/r-plugin/vimbrowser.R") ; .vim.browser(TRUE)') - else - call SendCmdToR('source("' . g:rplugin_home . '/r-plugin/vimbrowser.R") ; .vim.browser()') - endif - sleep 50m - let i = 0 - while filereadable(lockfile) - let i = i + 1 - sleep 50m - if i == 40 - call delete(lockfile) - call RWarningMsg("No longer waiting for Object Browser to finish...") - if exists("g:rplugin_r_output") - echo g:rplugin_r_output - endif - sleep 2 - let g:rplugin_running_objbr = 0 - return - endif - endwhile - - let g:rplugin_origbuf = bufname("%") - - " Start the object browser in a new vim instance on a Tmux pane: - if g:vimrplugin_screenplugin && g:vimrplugin_objbr_place =~ "console" - let objbr = $VIMRPLUGIN_TMPDIR . "/objbrowser" - let i = 1 - while !filereadable(objbr) - sleep 100m - if i == 20 - let g:rplugin_running_objbr = 0 - return - endif - let i += 1 - endwhile - - if exists("b:myservername") - " This is the Object Browser - if remote_expr(b:myservername, "mode()") != "n" - call remote_send(b:myservername, "") - endif - call remote_expr(b:myservername, "RObjBrowser()") - let g:rplugin_running_objbr = 0 - return - endif - - " Start the Object Browser if it doesn't exist yet - let slist = serverlist() - if slist !~ b:objbr_server - if g:vimrplugin_objbr_place =~ "left" - " Get the R Console width: - let conw = system("tmux list-panes | cat") - let conw = substitute(conw, '.*\n1: \[\([0-9]*\)x.*', '\1', "") - let panewidth = conw - g:vimrplugin_objbr_w - " Just to be safe: If the above code doesn't work as expected - " and we get a spurious value: - if panewidth < 40 || panewidth > 180 - let panewidth = 80 - endif - else - let panewidth = g:vimrplugin_objbr_w - endif - let cmd = "tmux split-window -d -h -l " . panewidth . ' -t 1 "vim --servername ' . b:objbr_server . '"' - let rlog = system(cmd) - if v:shell_error - let rlog = substitute(rlog, '\n', ' ', 'g') - let rlog = substitute(rlog, '\r', ' ', 'g') - call RWarningMsg(rlog) - let g:rplugin_running_objbr = 0 - return 0 - endif - if g:vimrplugin_objbr_place =~ "left" - call system("tmux swap-pane -d -s 1 -t 2") - endif - endif - - let objbrowserfile = $VIMRPLUGIN_TMPDIR . "/objbrowserInit" - call writefile([ - \ 'let b:objbrtitle = "' . b:objbrtitle . '"', - \ 'let b:screensname = "' . b:screensname . '"', - \ 'let b:rscript_buffer = "' . bufname("%") . '"', - \ 'let b:myservername = "' . v:servername . '"', - \ 'set filetype=rbrowser', - \ 'setlocal modifiable', - \ 'set shortmess=atI', - \ 'set rulerformat=%3(%l%)', - \ 'set noruler', - \ 'let curline = line(".")', - \ 'let curcol = col(".")', - \ 'silent normal! ggdG', - \ 'source ' . objbr, - \ 'call delete("' . objbr . '")', - \ 'call RBrowserFillCloseList()', - \ 'call RBrowserFill(0)', - \ 'setlocal nomodified', - \ 'call cursor(curline, curcol)', - \ 'redraw'], objbrowserfile) - - " Wait while Vim starts - let idx = 0 - while idx < 20 - sleep 300m - let slist = serverlist() - if slist =~ b:objbr_server - break - endif - let idx = idx + 1 - endwhile - - call remote_send(b:objbr_server, ":source " . objbrowserfile . "") - call remote_send(b:objbr_server, ":echon") - let g:rplugin_running_objbr = 0 - return + call StartObjectBrowser() + Py SendToR("\003GlobalEnv") + Py SendToR("\004Libraries") + if exists("*UpdateOB") + call UpdateOB("GlobalEnv") + call UpdateOB("libraries") endif - - " Either load or reload the Object Browser - let savesb = &switchbuf - set switchbuf=useopen,usetab - if bufloaded(b:objbrtitle) - exe "sb " . b:objbrtitle - else - " Copy the values of some local variables that will be inherited - let g:tmp_objbrtitle = b:objbrtitle - let g:tmp_screensname = b:screensname - let g:tmp_curbufname = bufname("%") - - if g:vimrplugin_conqueplugin == 1 - " Copy the values of some local variables that will be inherited - let g:tmp_conqueshell = b:conqueshell - let g:tmp_conque_bufname = b:conque_bufname - - if g:vimrplugin_objbr_place =~ "console" - exe "sil sb " . b:conque_bufname - normal! G0 - endif - endif - - let l:sr = &splitright - if g:vimrplugin_objbr_place =~ "right" - set splitright - else - set nosplitright - endif - exe "vsplit " . b:objbrtitle - let &splitright = l:sr - exe "vertical resize " . g:vimrplugin_objbr_w - set filetype=rbrowser - - " Inheritance of some local variables - if g:vimrplugin_conqueplugin == 1 - let b:conqueshell = g:tmp_conqueshell - let b:conque_bufname = g:tmp_conque_bufname - unlet g:tmp_conqueshell - unlet g:tmp_conque_bufname - endif - let b:screensname = g:tmp_screensname - let b:objbrtitle = g:tmp_objbrtitle - let b:rscript_buffer = g:tmp_curbufname - unlet g:tmp_objbrtitle - unlet g:tmp_screensname - unlet g:tmp_curbufname - endif - - - let objbr = $VIMRPLUGIN_TMPDIR . "/objbrowser" - let i = 1 - while !filereadable(objbr) - sleep 100m - if i == 20 - exe "sb " . g:rplugin_origbuf - exe "set switchbuf=" . savesb - let g:rplugin_running_objbr = 0 - return - endif - let i += 1 - endwhile - setlocal modifiable - let curline = line(".") - let curcol = col(".") - normal! ggdG - exe "source " . objbr - if exists("b:libdict") - unlet b:libdict - endif - call RBrowserFillCloseList() - call RBrowserFill(0) - setlocal nomodified - call cursor(curline, curcol) - redraw - exe "sb " . g:rplugin_origbuf - exe "set switchbuf=" . savesb - call delete(objbr) let g:rplugin_running_objbr = 0 + return endfunction function RObjBrowserOCLists(status) @@ -1068,7 +870,7 @@ function SendCmdToR(cmd) for i in range(0, slen) let str = str . printf("\\x%02X", char2nr(cmd[i])) endfor - exe s:py . " SendToRPy(b'" . str . "')" + exe "Py" . " SendToRPy(b'" . str . "')" silent exe '!start WScript "' . g:rplugin_jspath . '" "' . expand("%") . '"' " call RestoreClipboardPy() return 1 @@ -1436,7 +1238,7 @@ function SendLineToR(godown) if getline(1) =~ '^The topic' let topic = substitute(line, '.*::', '', "") let package = substitute(line, '::.*', '', "") - call ShowRDoc(topic, package) + call ShowRDoc(topic, package, 1) return endif if search("^Examples:$", "bncW") == 0 @@ -1461,7 +1263,7 @@ endfunction " Clear the console screen function RClearConsole() if (has("win32") || has("win64")) && g:vimrplugin_conqueplugin == 0 - exe s:py . " RClearConsolePy()" + Py RClearConsolePy() silent exe '!start WScript "' . g:rplugin_jspath . '" "' . expand("%") . '"' else call SendCmdToR("\014") @@ -1534,11 +1336,7 @@ function BuildROmniList(env, what) endif let lockfile = rtf . ".locked" call writefile(["Wait!"], lockfile) - if g:vimrplugin_vimcom - let omnilistcmd = 'vim.bol("' . rtf . '"' - else - let omnilistcmd = 'source("' . g:rplugin_home . '/r-plugin/build_omniList.R") ; .vim.bol("' . rtf . '"' - endif + let omnilistcmd = 'vim.bol("' . rtf . '"' if a:env == "libraries" && a:what == "installed" let omnilistcmd = omnilistcmd . ', what = "installed"' endif @@ -1546,42 +1344,11 @@ function BuildROmniList(env, what) let omnilistcmd = omnilistcmd . ', allnames = TRUE' endif let omnilistcmd = omnilistcmd . ')' - if g:vimrplugin_vimcom && a:env =~ "GlobalEnv" - exe "python SendToR('" . omnilistcmd . "')" - else - let ok = SendCmdToR(omnilistcmd) - if ok == 0 - return - endif - - " Wait while R is writing the list of objects into the file - sleep 50m - let i = 0 - let s = 0 - while filereadable(lockfile) - let s = s + 1 - if s == 4 && a:env !~ "GlobalEnv" - let s = 0 - let i = i + 1 - let k = g:vimrplugin_buildwait - i - let themsg = "\rPlease, wait! [" . i . ":" . k . "]" - echon themsg - endif - sleep 250m - if i == g:vimrplugin_buildwait - call delete(lockfile) - call RWarningMsg("No longer waiting. See :h vimrplugin_buildwait for details.") - return - endif - endwhile - endif + exe "Py SendToR('" . omnilistcmd . "')" if a:env == "GlobalEnv" let g:rplugin_globalenvlines = readfile(g:rplugin_globalenvfname) endif - if g:vimrplugin_vimcom == 0 && i > 2 - echon "\rFinished in " . i . " seconds." - endif endfunction function RBuildSyntaxFile(what) @@ -1619,10 +1386,7 @@ function RBuildSyntaxFile(what) exe "runtime syntax/r.vim" exe "sb " . b:objbrtitle exe "set switchbuf=" . savesb - if g:rplugin_curview == "libraries" - unlet b:libdict - call RBrowserShowLibs(0) - endif + call UpdateOB("libraries") else unlet b:current_syntax exe "runtime syntax/r.vim" @@ -1739,7 +1503,12 @@ endfunction " Show R's help doc in Vim's buffer " (based on pydoc plugin) -function ShowRDoc(rkeyword, package) +function ShowRDoc(rkeyword, package, getclass) + if !has("python") && !has("python3") + call RWarningMsg("Python support is required to see R documentation on Vim.") + return + endif + if filewritable(g:rplugin_docfile) call delete(g:rplugin_docfile) endif @@ -1751,7 +1520,7 @@ function ShowRDoc(rkeyword, package) exe "sb " . b:rscript_buffer exe "set switchbuf=" . savesb else - if a:package == "" + if a:getclass let classfor = RGetClassFor(a:rkeyword) endif endif @@ -1774,51 +1543,27 @@ function ShowRDoc(rkeyword, package) call SetRTextWidth() - if g:vimrplugin_vimcom - let g:rplugin_lastrpl = "" - if classfor == "" - exe 'python SendToR("vim.help(' . "'" . a:rkeyword . "', " . g:rplugin_htw . 'L)")' - else - exe 'python SendToR("vim.help(' . "'" . a:rkeyword . "', " . g:rplugin_htw . "L, '" . classfor . "')". '")' - endif - if g:rplugin_lastrpl != "VIMHELP" - if g:rplugin_lastrpl =~ "^MULTILIB" - echo "The topic '" . a:rkeyword . "' was found in more than one library:" - let libs = split(g:rplugin_lastrpl) - for idx in range(1, len(libs) - 1) - echo idx . " : " . libs[idx] - endfor - let chn = input("Please, select one of them: ") - if chn > 0 && chn < len(libs) - exe 'python SendToR("vim.help(' . "'" . a:rkeyword . "', " . g:rplugin_htw . "L, package='" . libs[chn] . "')" . '")' - endif - else - call RWarningMsg(g:rplugin_lastrpl) - return - endif - endif + let g:rplugin_lastrpl = "" + if classfor == "" && a:package == "" + exe 'Py SendToR("vim.help(' . "'" . a:rkeyword . "', " . g:rplugin_htw . 'L)")' + elseif a:package != "" + exe 'Py SendToR("vim.help(' . "'" . a:rkeyword . "', " . g:rplugin_htw . "L, package='" . a:package . "')". '")' else - call writefile(['Wait...'], g:rplugin_docfile . "lock") - if classfor == "" - if a:package == "" - call SendCmdToR("source('" . g:rplugin_home . "/r-plugin/vimhelp.R') ; .vim.help('" . a:rkeyword . "', " . g:rplugin_htw . "L)") - else - call SendCmdToR("source('" . g:rplugin_home . "/r-plugin/vimhelp.R') ; .vim.help('" . a:rkeyword . "', " . g:rplugin_htw . "L, package = '" . a:package . "')") + exe 'Py SendToR("vim.help(' . "'" . a:rkeyword . "', " . g:rplugin_htw . "L, '" . classfor . "')". '")' + endif + if g:rplugin_lastrpl != "VIMHELP" + if g:rplugin_lastrpl =~ "^MULTILIB" + echo "The topic '" . a:rkeyword . "' was found in more than one library:" + let libs = split(g:rplugin_lastrpl) + for idx in range(1, len(libs) - 1) + echo idx . " : " . libs[idx] + endfor + let chn = input("Please, select one of them: ") + if chn > 0 && chn < len(libs) + exe 'Py SendToR("vim.help(' . "'" . a:rkeyword . "', " . g:rplugin_htw . "L, package='" . libs[chn] . "')" . '")' endif else - call SendCmdToR("source('" . g:rplugin_home . "/r-plugin/vimhelp.R') ; .vim.help('" . a:rkeyword . "', " . g:rplugin_htw . "L, " . classfor . ")") - endif - sleep 50m - - let i = 0 - while filereadable(g:rplugin_docfile . "lock") && i < 40 - sleep 50m - let i += 1 - endwhile - if i == 40 - echohl WarningMsg - echomsg "Waited too much time..." - echohl Normal + call RWarningMsg(g:rplugin_lastrpl) return endif endif @@ -1893,11 +1638,7 @@ function PrintRObject(rkeyword) if classfor == "" call SendCmdToR("print(" . a:rkeyword . ")") else - if g:vimrplugin_vimcom - call SendCmdToR('vim.print("' . a:rkeyword . '", ' . classfor . ")") - else - call SendCmdToR('source("' . g:rplugin_home . '/r-plugin/vimprint.R") ; .vim.print("' . a:rkeyword . '", ' . classfor . ")") - endif + call SendCmdToR('vim.print("' . a:rkeyword . '", ' . classfor . ")") endif endfunction @@ -1911,7 +1652,21 @@ function RAction(rcmd) if strlen(rkeyword) > 0 if a:rcmd == "help" if g:vimrplugin_vimpager != "no" - call ShowRDoc(rkeyword, "") + if (bufname("%") =~ "Object_Browser" || exists("b:myservername")) && g:rplugin_curview == "libraries" + let pkg = RBGetPkgName() + if exists("b:myservername") + call system("tmux select-pane -t 0") + call remote_expr(b:myservername, "ShowRDoc('" . rkeyword . "', '" . pkg . "', 0)") + if remote_expr(b:myservername, "mode()") != "n" + call remote_send(b:myservername, "") + endif + call remote_send(b:myservername, "") + else + call ShowRDoc(rkeyword, pkg, 0) + endif + return + endif + call ShowRDoc(rkeyword, "", 1) else call SendCmdToR("help(" . rkeyword . ")") endif @@ -1923,18 +1678,10 @@ function RAction(rcmd) endif let rfun = a:rcmd if a:rcmd == "args" && g:vimrplugin_listmethods == 1 - if g:vimrplugin_vimcom - let rfun = "vim.list.args" - else - let rfun = "source('" . g:rplugin_home . "/r-plugin/specialfuns.R') ; .vim.list.args" - endif + let rfun = "vim.list.args" endif if a:rcmd == "plot" && g:vimrplugin_specialplot == 1 - if g:vimrplugin_vimcom - let rfun = "vim.plot" - else - let rfun = "source('" . g:rplugin_home . "/r-plugin/specialfuns.R') ; .vim.plot" - endif + let rfun = "vim.plot" endif let raction = rfun . "(" . rkeyword . ")" let ok = SendCmdToR(raction) @@ -2591,7 +2338,6 @@ call RSetDefaultValue("g:vimrplugin_i386", 0) call RSetDefaultValue("g:vimrplugin_screenvsplit", 0) call RSetDefaultValue("g:vimrplugin_conquevsplit", 0) call RSetDefaultValue("g:vimrplugin_conqueplugin", 0) -call RSetDefaultValue("g:vimrplugin_vimcom", 0) call RSetDefaultValue("g:vimrplugin_listmethods", 0) call RSetDefaultValue("g:vimrplugin_specialplot", 0) call RSetDefaultValue("g:vimrplugin_nosingler", 0) @@ -2616,14 +2362,24 @@ call RSetDefaultValue("g:vimrplugin_objbr_place", "'script,right'") " call RSetDefaultValue("g:vimrplugin_objbr_place", "'console,right'") "endif -if has("python") - if g:vimrplugin_vimcom - exe "pyfile " . g:rplugin_home . "/r-plugin/vimcom.py" - endif + +" python has priority over python3, unless ConqueTerm_PyVersion == 3 +if has("python3") && exists("g:ConqueTerm_PyVersion") && g:ConqueTerm_PyVersion == 3 + command! -nargs=+ Py :py3 + command! -nargs=+ PyFile :py3file +elseif has("python") + command! -nargs=+ Py :py + command! -nargs=+ PyFile :pyfile +elseif has("python3") + command! -nargs=+ Py :py3 + command! -nargs=+ PyFile :py3file else - g:vimrplugin_vimcom = 0 + command! -nargs=+ Py : + command! -nargs=+ PyFile : endif +exe "PyFile " . g:rplugin_home . "/r-plugin/vimcom.py" + " ^K (\013) cleans from cursor to the right and ^U (\025) cleans from cursor " to the left. However, ^U causes a beep if there is nothing to clean. The " solution is to use ^A (\001) to move the cursor to the beginning of the line @@ -2762,21 +2518,8 @@ endif let g:rplugin_globalenvlines = [] if has("win32") || has("win64") - " python has priority over python3, unless ConqueTerm_PyVersion == 3 - if has("python") - let s:py = "py" - else - if has("python3") - let s:py = "py3" - else - let s:py = "" - endif - endif - if has("python3") && exists("g:ConqueTerm_PyVersion") && g:ConqueTerm_PyVersion == 3 - let s:py = "py3" - endif - if s:py == "" + if !has("python") && !has("python3") redir => s:vimversion silent version redir END @@ -2804,7 +2547,7 @@ if has("win32") || has("win64") finish endif let rplugin_pywin32 = 1 - exe s:py . "file " . substitute(g:rplugin_home, " ", '\ ', "g") . '\r-plugin\windows.py' + exe "PyFile " . substitute(g:rplugin_home, " ", '\ ', "g") . '\r-plugin\windows.py' if rplugin_pywin32 == 0 let g:rplugin_failed = 1 finish @@ -2815,7 +2558,7 @@ if has("win32") || has("win64") let $PATH = g:vimrplugin_r_path . ";" . $PATH let g:rplugin_Rgui = g:vimrplugin_r_path . "\\Rgui.exe" else - exe s:py . " GetRPathPy()" + Py GetRPathPy() if s:rinstallpath == "Not found" call RWarningMsgInp("Could not find R path in Windows Registry. Please, either install R or set the value of 'vimrplugin_r_path'.") let g:rplugin_failed = 1 diff --git a/r-plugin/vimcom.py b/r-plugin/vimcom.py index f0c35bc..61d3fc6 100644 --- a/r-plugin/vimcom.py +++ b/r-plugin/vimcom.py @@ -91,32 +91,32 @@ def OBServer(): try: data, addr = sock.recvfrom( 1024 ) # buffer size is 1024 bytes if data.find("G") >= 0: - vim.command("call UpdateGlobalEnv()") + vim.command("call UpdateOB('GlobalEnv')") else: if data.find("L") >= 0: - vim.command("call UpdateLibraries()") + vim.command("call UpdateOB('libraries')") else: if data.find("B") >= 0: - vim.command("call UpdateGlobalEnv()") - vim.command("call UpdateLibraries()") + vim.command("call UpdateOB('GlobalEnv')") + vim.command("call UpdateOB('libraries')") else: try: - sock.shutdown(socket.SHUT_RDWR) + sock.shutdown(socket.SHUT_RD) except: - vim.command("call RWarningMsg('OBS 001')") + pass sock.close() return except: OBPort = 0 vim.command("call RWarningMsg('OBS 002')") try: - sock.shutdown(socket.SHUT_RDWR) + sock.shutdown(socket.SHUT_RD) except: vim.command("call RWarningMsg('OBS 003')") sock.close() return try: - sock.shutdown(socket.SHUT_RDWR) + sock.shutdown(socket.SHUT_RD) except: pass sock.close() @@ -131,10 +131,11 @@ def RunOBServer(): def StopOBServer(): global sock global OBPort + SendToR("\x08Stop Updating Info") if OBPort == 0: return try: - sock.shutdown(socket.SHUT_RDWR) + sock.shutdown(socket.SHUT_RD) except: pass sock.close() From 15c0be996f71568191a88e8d47c879eca142f3b5 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sun, 1 Jan 2012 22:26:49 -0300 Subject: [PATCH 0136/1050] Escape double quotes when getting object. --- r-plugin/common_global.vim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 10aaf98..1295ed8 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -15,7 +15,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Thu Dec 22, 2011 11:45PM +" Last Change: Sun Jan 01, 2012 09:09PM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -1549,6 +1549,7 @@ function ShowRDoc(rkeyword, package, getclass) elseif a:package != "" exe 'Py SendToR("vim.help(' . "'" . a:rkeyword . "', " . g:rplugin_htw . "L, package='" . a:package . "')". '")' else + let classfor = substitute(classfor, '"', '\\"', "g") exe 'Py SendToR("vim.help(' . "'" . a:rkeyword . "', " . g:rplugin_htw . "L, '" . classfor . "')". '")' endif if g:rplugin_lastrpl != "VIMHELP" From 86d2ee9bc0952f9a3f98f6a246904899c785aef2 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Mon, 2 Jan 2012 17:55:49 -0300 Subject: [PATCH 0137/1050] Remake the R menu when tabnew a file. --- r-plugin/common_buffer.vim | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/r-plugin/common_buffer.vim b/r-plugin/common_buffer.vim index 7033418..97f5152 100644 --- a/r-plugin/common_buffer.vim +++ b/r-plugin/common_buffer.vim @@ -19,7 +19,7 @@ " " Based on previous work by Johannes Ranke " -" Last Change: Thu Dec 15, 2011 10:27PM +" Last Change: Mon Jan 02, 2012 05:50PM " " Please see doc/r-plugin.txt for usage details. "========================================================================== @@ -109,6 +109,9 @@ let b:objbr_server = "OB" . s:uniquename unlet s:uniquename let b:objbr_server = toupper(substitute(b:objbr_server, '\W', "", "g")) +if exists("g:rplugin_lastft") && g:rplugin_lastft != &filetype + call RBufEnter() +endif let g:rplugin_lastft = &filetype From 15b716a223c28145dab58b21de035eb5adb4ef2d Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Mon, 2 Jan 2012 20:22:12 -0300 Subject: [PATCH 0138/1050] Correctly set the value of environment variables. --- doc/r-plugin.txt | 34 +++++++++++++++++++++------------- r-plugin/common_buffer.vim | 4 ++-- r-plugin/common_global.vim | 9 +++++++-- 3 files changed, 30 insertions(+), 17 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index f4e1e9d..1d40477 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -72,7 +72,7 @@ to deal with. - Send code and commands to R (useful to run examples). - Jump to another R documentation. - Syntax highlighting of R documentation. - * Object Browser (.GlobalEnv and loaded packages; must be updated manually): + * Object Browser (.GlobalEnv and loaded packages): - Send commands with the object under cursor as argument. - Call R's help() with the object under cursor as argument. - Syntax highlighting of the Object Browser. @@ -1094,10 +1094,11 @@ If you want to use your own ~/.screenrc, put in your vimrc: *vimrplugin_tmux* The screen.vim plugin supports both GNU Screen and Tmux, but only Tmux allows you to split the terminal vertically (that is, to have the panels side by -side). Please read |screen-intro| and |screen-shell-vertical| for details. By -default, the Vim-R-plugin will tell the screen.vim plugin to split the -terminal horizontally. If you prefer to split it vertically put in your -|vimrc|: +side). Also, the automatic updating of the Object Browser is enabled only when +running R in a Tmux session. Please read |screen-intro| and +|screen-shell-vertical| for details. By default, the Vim-R-plugin will tell +the screen.vim plugin to split the terminal horizontally. If you prefer to +split it vertically put in your |vimrc|: > let vimrplugin_screenvsplit = 1 let g:ScreenImpl = 'Tmux' @@ -1206,10 +1207,11 @@ Emacs: *vimrplugin_ca_ck* When one types in the R Console the cursor goes to the beginning of the line and one types the characters to the right of the cursor are -deleted. Sending may be problematic if using either Tmux or GNU Screen -in some systems and may cause incomplete output when using the Conque Shell -plugin. The Vim-R-plugin will add to every command if you put in -your |vimrc|: +deleted. This is useful to avoid characters left on the R Console being mixed +with commands sent by Vim. However, sending may be problematic if using +either Tmux or GNU Screen in some systems and may cause incomplete output when +using the Conque Shell plugin. The Vim-R-plugin will add to every +command if you put in your |vimrc|: > let vimrplugin_ca_ck = 1 < @@ -1557,7 +1559,12 @@ put in your ~/.bashrc: > if [ "x" != "x$DISPLAY" ] then - export TERM=xterm-256color + if [ "screen" = "$TERM" ] + then + export TERM=screen-256color + else + export TERM=xterm-256color + fi fi < Finally, put in your |vimrc|: @@ -1736,8 +1743,9 @@ important Vim limitations are: files and trigger |CursorHold| events. These limitations will be solved only if someone with good knowledge of C -programming writes patches to Vim source code. Anyway, if you want to try the -Conque Shell, install it from +programming writes patches to Vim source code and the patches are accepted by +the Vim developer. Anyway, if you want to try the Conque Shell, install it +from http://www.vim.org/scripts/script.php?script_id=2771 @@ -1801,7 +1809,7 @@ the R syntax highlighted. *r-plugin-news* 12. News~ -0.9.8 (2011-12-22) +0.9.8 (2011-12-23) * Use the R package vimcom. The following options are now set on the vimcom R package and no longer in the Vim-R-plugin: allnames, open_df, and diff --git a/r-plugin/common_buffer.vim b/r-plugin/common_buffer.vim index 97f5152..578f077 100644 --- a/r-plugin/common_buffer.vim +++ b/r-plugin/common_buffer.vim @@ -19,7 +19,7 @@ " " Based on previous work by Johannes Ranke " -" Last Change: Mon Jan 02, 2012 05:50PM +" Last Change: Mon Jan 02, 2012 07:10PM " " Please see doc/r-plugin.txt for usage details. "========================================================================== @@ -109,7 +109,7 @@ let b:objbr_server = "OB" . s:uniquename unlet s:uniquename let b:objbr_server = toupper(substitute(b:objbr_server, '\W', "", "g")) -if exists("g:rplugin_lastft") && g:rplugin_lastft != &filetype +if has("gui_running") && exists("g:rplugin_lastft") && g:rplugin_lastft != &filetype call RBufEnter() endif diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 1295ed8..1b6c525 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -15,7 +15,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Sun Jan 01, 2012 09:09PM +" Last Change: Mon Jan 02, 2012 07:26PM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -511,7 +511,12 @@ function StartR(whatr) if g:vimrplugin_screenplugin if $TERM =~ "screen" - let rcmd = "VIMRPLUGIN_TMPDIR=" . $VIMRPLUGIN_TMPDIR . " " . rcmd + if g:vimrplugin_tmux + call system("tmux set-environment VIMRPLUGIN_TMPDIR " . $VIMRPLUGIN_TMPDIR) + call system("tmux set-environment VIMINSTANCEID " . $VIMINSTANCEID) + else + let rcmd = "VIMRPLUGIN_TMPDIR=" . $VIMRPLUGIN_TMPDIR . " " . rcmd + endif endif if g:vimrplugin_tmux == 0 && g:vimrplugin_noscreenrc == 0 && exists("g:ScreenShellScreenInitArgs") let g:ScreenShellScreenInitArgs = RWriteScreenRC() From df48cb3c540dcc0e6e2bfa3646db6b1b2d5cbab2 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Mon, 2 Jan 2012 21:04:51 -0300 Subject: [PATCH 0139/1050] Always start the Object Browser in a Tmux pane. --- doc/r-plugin.txt | 10 +++++----- r-plugin/common_global.vim | 31 ++++++++++++++++++++++--------- 2 files changed, 27 insertions(+), 14 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 1d40477..62b19b9 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -495,11 +495,11 @@ and, then, build the "omniList". You have to do ro to either start or updated the Object Browser. The updating is automatic only if the Object Browser is running in a separate -Tmux panel beside the R Console. The Object Browser has two views: .GlobalEnv -and Libraries. If you either press or double click (GVim or Vim with -'mouse' set to "a") on the first line of the Object Browser it will toggle the -view between the objects in .GlobalEnv and the currently loaded libraries (but -only libraries loaded when |:RUpdateObjList| was run will be shown). +Tmux panel. The Object Browser has two views: .GlobalEnv and Libraries. If you +either press or double click (GVim or Vim with 'mouse' set to "a") on +the first line of the Object Browser it will toggle the view between the +objects in .GlobalEnv and the currently loaded libraries (but only libraries +loaded when |:RUpdateObjList| was run will be shown). In the .GlobalEnv view, if an object has the attribute "label", it will also be displayed. Please, see the R help for package vimcom for some options to diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 1b6c525..5d4cf86 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -15,7 +15,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Mon Jan 02, 2012 07:26PM +" Last Change: Mon Jan 02, 2012 09:01PM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -649,7 +649,7 @@ function StartR(whatr) endfunction function StartObjectBrowser() - if g:vimrplugin_screenplugin && g:vimrplugin_objbr_place =~ "console" + if g:vimrplugin_screenplugin && g:vimrplugin_tmux if exists("b:myservername") " This is the Object Browser @@ -665,10 +665,15 @@ function StartObjectBrowser() let slist = serverlist() if slist !~ b:objbr_server if g:vimrplugin_objbr_place =~ "left" - " Get the R Console width: - let conw = system("tmux list-panes | cat") - let conw = substitute(conw, '.*\n1: \[\([0-9]*\)x.*', '\1', "") - let panewidth = conw - g:vimrplugin_objbr_w + let panw = system("tmux list-panes | cat") + if g:vimrplugin_objbr_place =~ "console" + " Get the R Console width: + let panw = substitute(panw, '.*\n1: \[\([0-9]*\)x.*', '\1', "") + else + " Get the Vim with + let panw = substitute(panw, '.*0: \[\([0-9]*\)x.*', '\1', "") + endif + let panewidth = panw - g:vimrplugin_objbr_w " Just to be safe: If the above code doesn't work as expected " and we get a spurious value: if panewidth < 40 || panewidth > 180 @@ -677,7 +682,11 @@ function StartObjectBrowser() else let panewidth = g:vimrplugin_objbr_w endif - let cmd = "tmux split-window -d -h -l " . panewidth . ' -t 1 "vim --servername ' . b:objbr_server . '"' + if g:vimrplugin_objbr_place =~ "console" + let cmd = "tmux split-window -d -h -l " . panewidth . ' -t 1 "vim --servername ' . b:objbr_server . '"' + else + let cmd = "tmux split-window -d -h -l " . panewidth . ' -t 0 "vim --servername ' . b:objbr_server . '"' + endif let rlog = system(cmd) if v:shell_error let rlog = substitute(rlog, '\n', ' ', 'g') @@ -687,7 +696,11 @@ function StartObjectBrowser() return 0 endif if g:vimrplugin_objbr_place =~ "left" - call system("tmux swap-pane -d -s 1 -t 2") + if g:vimrplugin_objbr_place =~ "console" + call system("tmux swap-pane -d -s 1 -t 2") + else + call system("tmux swap-pane -d -s 0 -t 1") + endif endif endif @@ -703,7 +716,7 @@ function StartObjectBrowser() endwhile let objbrowserfile = $VIMRPLUGIN_TMPDIR . "/objbrowserInit" - if g:vimrplugin_objbr_place =~ "console" && g:vimrplugin_conqueplugin == 0 + if g:vimrplugin_conqueplugin == 0 let obscmd = 'Py RunOBServer()' else let obscmd = ' ' From 40f1d81e6a1c34d7db0417da7354ed15a692cfaf Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 12 Jan 2012 23:57:46 -0300 Subject: [PATCH 0140/1050] Do not use Vim's +clientserver feature. Use a Python TCP/IP server to make the communication between two Vim instances (the editor and the object browser). --- doc/r-plugin.txt | 235 ++++++++++++++++--------------------- ftplugin/rbrowser.vim | 23 ++-- r-plugin/common_buffer.vim | 4 +- r-plugin/common_global.vim | 194 +++++++++++++++--------------- r-plugin/vimcom.py | 138 ++++++++++++++-------- 5 files changed, 301 insertions(+), 293 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 62b19b9..8621889 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -12,13 +12,12 @@ For Vim version 7.3 2. Main features |r-plugin-features| 3. Installation |r-plugin-installation| 4. Use |r-plugin-use| - 5. How the plugin works |r-plugin-functioning| - 6. Known bugs and workarounds |r-plugin-known-bugs| - 7. Options |r-plugin-options| - 8. Custom key bindings |r-plugin-key-bindings| - 9. Files |r-plugin-files| -10. FAQ and tips |r-plugin-tips| -11. News |r-plugin-news| + 5. Known bugs and workarounds |r-plugin-known-bugs| + 6. Options |r-plugin-options| + 7. Custom key bindings |r-plugin-key-bindings| + 8. Files |r-plugin-files| + 9. FAQ and tips |r-plugin-tips| +10. News |r-plugin-news| ============================================================================== @@ -491,7 +490,29 @@ The command :RUpdateObjListAll will tell R to load all installed packages and, then, build the "omniList". -4.4. The Object Browser~ +4.4. Omni completion~ + +Vim can automatically complete the names of R objects when CTRL-X CTRL-O is +pressed in insert mode (see |omni-completion| for details and 'completeopt' to +know how to customize the |omni-completion|). Omni completion shows in a pop +up menu the name of the object, its class and its environment (most +frequently, its package name). If the object is a function, its arguments are +shown in a separate window. + +If a data.frame is found, while building the list of objects, the columns in +the data.frame are added to the list. When you try to use omni completion to +complete the name of a data.frame, the columns are not shown. But when the +data.frame name is already complete, and you have inserted the '$' symbol, +omni completion will show the column names. + +Vim uses two files: one for the objects of .GlobalEnv and the other for all +other objects. The .GlobalEnv list is stored in the /tmp/r-plugin-yourlogin +directory and, thus, is deleted after each reboot. The other file is stored in +~/.vim/r-plugin and remains available until you manually rebuild it with the +command: |:RUpdateObjList|. + + +4.5. The Object Browser~ You have to do ro to either start or updated the Object Browser. The updating is automatic only if the Object Browser is running in a separate @@ -527,7 +548,7 @@ any) used to classify the objects: Function is.function() -4.5. Commenting and uncommenting lines~ +4.6. Commenting and uncommenting lines~ You can toggle the state of a line as either commented or uncommented by typing xx. @@ -544,7 +565,7 @@ selection of lines, the comments will be aligned according to the longest line. -4.6. Build a tags file to jump to function definitions~ +4.7. Build a tags file to jump to function definitions~ *:RBuildTags* Vim can jump to functions defined in other files if you press CTRL-] over the name of a function, but it needs a tags file to be able to find the function @@ -555,7 +576,7 @@ referencing source code located in other directories, including the entire R source code. -4.7. Tmux usage~ +4.8. Tmux usage~ *r-plugin-tmux* When running Vim in a terminal emulator (Linux/Unix only), the Vim-R-plugin will use the screen.vim plugin to restart Vim and start R in a Tmux session. @@ -622,7 +643,6 @@ A sample detachable session could be: unbind-key C-b bind-key C-a send-prefix set-window-option -g mode-keys vi - set -g status off set -g terminal-overrides 'xterm*:smcup@:rmcup@' set -g mode-mouse on set -g mouse-select-pane on @@ -646,7 +666,7 @@ A sample detachable session could be: tmux attach -4.8. GNU Screen usage~ +4.9. GNU Screen usage~ *r-plugin-screen* When running Vim in a terminal emulator (Linux/Unix only), the Vim-R-plugin will use the screen.vim plugin to restart Vim and start R in a Tmux session. @@ -673,58 +693,11 @@ useful: : Copy the selection to GNU Screen paste buffer. -============================================================================== - *r-plugin-functioning* -5. How the plugin works~ - -5.1. Omni completion~ - -Vim can automatically complete the names of R objects when CTRL-X CTRL-O is -pressed in insert mode (see |omni-completion| for details and 'completeopt' to -know how to customize the |omni-completion|). Omni completion shows in a pop -up menu the name of the object, its class and its environment (most -frequently, its package name). If the object is a function, its arguments are -shown in a separate window. - -If a data.frame is found, while building the list of objects, the columns in -the data.frame are added to the list. When you try to use omni completion to -complete the name of a data.frame, the columns are not shown. But when the -data.frame name is already complete, and you have inserted the '$' symbol, -omni completion will show the column names. - -Vim uses two files: one for the objects of .GlobalEnv and the other for all -other objects. The .GlobalEnv list is stored in the /tmp/r-plugin-yourlogin -directory and, thus, is deleted after each reboot. The other file is stored in -~/.vim/r-plugin and remains available until you manually rebuild it with the -command: |:RUpdateObjList|. - - -5.2. Communication through Tmux, without the screen plugin (Linux/Unix only)~ - -Vim and R run as independent processes. The main disadvantage is that we have -limited communication between the two applications: Vim can send strings to R -through Tmux and R can write files to be read by Vim. That's all. The main -advantage is that Vim's or the plugin's bugs will not affect R. - -If the screen.vim plugin is not installed or if you are using GVim, the -Vim-R-plugin uses Tmux to communicate with R. First, the plugin initiates a -new Tmux session and uses this to start a new R process. The plugin's menu -options, toolbar buttons and key bindings can then be used to communicate with -the newly started R process. The plugin sends commands to R through Tmux. By -default, all Vim buffers share the same R process, but it is also possible to -configure Vim so that each buffer runs its own instance of R in a separate -terminal emulator. In this case, the Tmux sessions have unique names. The -names are made using the user name and the seconds of localtime(). Hence, a -name clash is possible if a single user starts more than one Vim buffer at the -same second. To change the default behavior and force all Vim buffers to use -different R processes see |vimrplugin_single_r|. - - ============================================================================== *r-plugin-known-bugs* -6. Known bugs and workarounds~ +5. Known bugs and workarounds~ -6.1. R's source() issues~ +5.1. R's source() issues~ The R's source() function prints an extra new line between commands if the option echo = TRUE, and error messages and warning are printed only after the @@ -732,7 +705,7 @@ entire code is sourced, which makes it more difficult to find errors in the code sent to R. -6.2. R session is detached when GVim is closed (Linux/Unix only)~ +5.2. R session is detached when GVim is closed (Linux/Unix only)~ If you launch GVim through a custom keyboard shortcut, the problem may be solved if you add -f as parameter to GVim. The R session also used to be @@ -743,14 +716,14 @@ reattach to the R session, open a new terminal window and type: screen -r < -6.3. The clipboard's content is lost (Windows only)~ +5.3. The clipboard's content is lost (Windows only)~ On Windows, the plugin copies the command that will be sent to R into the clipboard. Thus, if you have anything in the clipboard it will be lost while using the plugin. -6.4. The buffer name must be in the window title (Windows only)~ +5.4. The buffer name must be in the window title (Windows only)~ On Windows the plugin tries to activate the "R Console" window, paste the command that is being sent to R, and, then, activate the GVim window. To @@ -759,14 +732,14 @@ edited be in the GVim window title. This is the default if you have not set the option 'titlestring'. -6.5. The menu may not reflect some of your custom key bindings~ +5.5. The menu may not reflect some of your custom key bindings~ If you have created a custom key binding for the Vim-R-plugin, the menu in GVim will not always reflect the correct key binding if it is not the same for Normal, Visual and Insert modes. -6.6. Syntactically correct code may be wrongly indented~ +5.6. Syntactically correct code may be wrongly indented~ If the Vim-R-plugin indents your code wrongly you may get the correct indentation by adding braces and line breaks to it. Example: @@ -789,7 +762,7 @@ indentation by adding braces and line breaks to it. Example: class(x) <- c(if(ordered) "ordered", "factor") < -6.7. Commands are sent twice on Mac OS X~ +5.7. Commands are sent twice on Mac OS X~ If you use the screen plugin with GNU Screen, individual lines may be sent duplicated to R on Mac OS X. @@ -797,7 +770,7 @@ duplicated to R on Mac OS X. ============================================================================== *r-plugin-options* -7. Options~ +6. Options~ |vimrplugin_term| External terminal to be used |vimrplugin_term_cmd| Complete command to open an external terminal @@ -834,7 +807,7 @@ duplicated to R on Mac OS X. |vimrplugin_ca_ck| Add ^A^K to the beginning of commands. -7.1. Terminal emulator (Linux/Unix only)~ +6.1. Terminal emulator (Linux/Unix only)~ *vimrplugin_term* The plugin uses the first terminal emulator that it finds in the following list: @@ -865,7 +838,7 @@ Please, look at the manual of your terminal emulator to know how to call it. The last argument must be the one which precedes the command to be executed. -7.2. Underscore and Rnoweb completion of code block~ +6.2. Underscore and Rnoweb completion of code block~ *vimrplugin_underscore* *vimrplugin_rnowebchunk* While editing R code, '_' is replaced with ' <- '. To disable this feature, @@ -879,7 +852,7 @@ put in your |vimrc|: let vimrplugin_rnowebchunk = 0 < -7.3. Object Browser options~ +6.3. Object Browser options~ *vimrplugin_objbr_place* *vimrplugin_objbr_w* By default, the object browser will be created with 40 columns. The minimum @@ -890,23 +863,20 @@ browser's default width by setting the value of |vimrplugin_objbr_w| in your let vimrplugin_objbr_w = 30 < The Object Browser will always be created by splitting the Vim script window -if you are running GVim or Vim in the Linux console (without the X server). -However, if running Vim in a terminal emulator under the X Server, the Object -Browser can be created in a independent Vim instance in a Tmux panel beside -the R Console. The Vim feature |+clientserver| is required to put the Object -Browser beside the R Console and this feature only works when the X server is -running. Valid values for the Object Browser placement are "script" or -"console" and "right" or "left". Examples: +if you are running GVim. However, if running Vim in a terminal emulator, the +Object Browser will be created in a independent Vim instance in a Tmux panel +beside the R Console. Valid values for the Object Browser placement are +"script" or "console" and "right" or "left". Examples: > let vimrplugin_objbr_place = "script,right" let vimrplugin_objbr_place = "console,left" < -7.4. Vim as pager for R help~ +6.4. Vim as pager for R help~ *vimrplugin_vimpager* *vimrplugin_editor_w* *vimrplugin_help_w* -7.4.1. Quick setup~ +6.4.1. Quick setup~ If you do not want to see R documentation in a Vim's buffer, put in your |vimrc|: @@ -919,7 +889,7 @@ the R console, put in your .Rprofile: options(pager = "vim -c 'set ft=rdoc' -") < -7.4.2. Details and other options:~ +6.4.2. Details and other options:~ The plugin key bindings will remain active in the documentation buffer, and, thus, you will be able to send commands to R as you do while editing an R @@ -949,10 +919,10 @@ values to some variables in your |vimrc|, as in the example: let vimrplugin_editor_h = 60 < -7.5. Number of R processes (Linux/Unix only)~ +6.5. Number of R processes (Linux/Unix only)~ *vimrplugin_nosingler* *vimrplugin_by_vim_instance* -7.5.1 Using (G)Vim without the screen.vim plugin~ +6.5.1 Using (G)Vim without the screen.vim plugin~ By default, all buffers of all (G)Vim instances send code to the same R process. If you prefer that each Vim buffer uses its own R process, put the following @@ -975,14 +945,14 @@ with the --servername argument. If you want to use more than nine GVim instances you will have to use the --servername argument because screen will not differentiate between names like "GVIM1" and "GVIM10". -7.5.2 Using the screen.vim plugin~ +6.5.2 Using the screen.vim plugin~ Both options are ignored when using Vim in a terminal emulator and using the screen.vim plugin. The plugin behaves as if the |vimrplugin_by_instance| was enabled. -7.6. Use 32 bit version of R (Windows and Mac OS X only)~ +6.6. Use 32 bit version of R (Windows and Mac OS X only)~ *vimrplugin_i386* If you are using a 64 bit Windows or a 64 bit Mac OS X, but prefer to run the 32 bit version of R, put in your |vimrc|: @@ -990,7 +960,7 @@ If you are using a 64 bit Windows or a 64 bit Mac OS X, but prefer to run the let vimrplugin_i386 = 1 < -7.7. R path~ +6.7. R path~ *vimrplugin_r_path* Vim will run the first R executable in the path. You can set an alternative R path in your |vimrc| as in the examples: @@ -1001,7 +971,7 @@ path in your |vimrc| as in the examples: On Windows, Vim will try to find the R install path in the Windows Registry. -7.8. Arguments to R~ +6.8. Arguments to R~ *vimrplugin_r_args* Set this option in your |vimrc| if you want to pass command line arguments to R at the startup. Example: @@ -1013,7 +983,7 @@ default value is "--sdi", but you may change it to "--mdi" if you do not like the SDI style of the graphical user interface. -7.9. Time necessary to build list of objects for omni completion~ +6.9. Time necessary to build list of objects for omni completion~ *vimrplugin_buildwait* If your system needs more than 120 seconds to build the list of objects for omni completion after you do the command |:RUpdateObjList|, then you should @@ -1022,7 +992,7 @@ set the value of |vimrplugin_buildwait| to a higher value. Example: let vimrplugin_buildwait = 240 > -7.10. More colorful syntax highlight of .Rout files~ +6.10. More colorful syntax highlight of .Rout files~ *vimrplugin_routmorecolors* By default, the R commands in .Rout files are highlighted with the color of comments, and only the output of commands has some of its elements highlighted @@ -1034,7 +1004,7 @@ scripts, put the following in your |vimrc|: let vimrplugin_routmorecolors = 1 < -7.11. How to automatically open the .Rout file~ +6.11. How to automatically open the .Rout file~ *vimrplugin_routnotab* After the command ao, Vim will save the current buffer if it has any pending changes, run "R CMD BATCH --no-restore --no-save" on the current @@ -1044,7 +1014,7 @@ file is open in a new split window, put in your |vimrc|: let vimrplugin_routnotab = 1 < -7.12. Indent commented lines~ +6.12. Indent commented lines~ *vimrplugin_indent_commented* You can type xx to comment out a line or selected lines. If the line already starts with a comment string, it will be removed. After adding @@ -1064,7 +1034,7 @@ table below (see |r-plugin-indenting|): 0 0 ### < -7.13. Sleep time (Windows only)~ +6.13. Sleep time (Windows only)~ *vimrplugin_sleeptime* The plugin gives to R a small amount of time to process the paste command. The default value is 0.2 second, but you should experiment different values. The @@ -1073,7 +1043,7 @@ example show how to adjust the value of sleeptime in your |vimrc|: let vimrplugin_sleeptime = 0.1 < -7.14. Tmux and Screen configuration (Linux/Unix only)~ +6.14. Tmux and Screen configuration (Linux/Unix only)~ *vimrplugin_noscreenrc* *vimrplugin_notmuxconf* GVim (or Vim running R in an external terminal emulator) runs Tmux with a @@ -1088,7 +1058,7 @@ If you want to use your own ~/.screenrc, put in your vimrc: let vimrplugin_noscreenrc = 1 < -7.15. Integration with screen.vim plugin (Linux/Unix only)~ +6.15. Integration with screen.vim plugin (Linux/Unix only)~ *vimrplugin_screenplugin* *vimrplugin_screenvsplit* *vimrplugin_tmux* @@ -1126,7 +1096,7 @@ with the Vim-R-plugin you will need to add the following to your |vimrc|: let vimrplugin_screenplugin = 0 < -7.17. Integration with AppleScript (OS X only)~ +6.16. Integration with AppleScript (OS X only)~ *vimrplugin_applescript* In Mac OS X, the plugin will try to send commands to R gui using AppleScript if running the GUI version of MacVim. If you prefer to have R running in an @@ -1136,7 +1106,7 @@ external terminal emulator, put in your |vimrc|: let vimrplugin_screenplugin = 0 < -7.18. Special R functions~ +6.17. Special R functions~ *vimrplugin_listmethods* *vimrplugin_specialplot* The R function args() lists the arguments of a function, but not the arguments @@ -1152,7 +1122,7 @@ after rg if you put the following line in your |vimrc|: let vimrplugin_specialplot = 1 < -7.19. maxdeparse~ +6.18. maxdeparse~ *vimrplugin_maxdeparse* You can set the argument maxdeparse to be passed to R's source() function. Example: @@ -1160,7 +1130,7 @@ Example: let vimrplugin_maxdeparse = 300 < -7.20. LaTeX command~ +6.19. LaTeX command~ *vimrplugin_latexcmd* *vimrplugin_sweaveargs* By default, Vim calls pdflatex to produce a pdf document from the .tex file @@ -1173,7 +1143,7 @@ If you want to pass arguments do the Sweave() function, set the value of the vimrplugin_sweaveargs variable. -7.21. Never unmake the R menu and tool bar buttons~ +6.20. Never unmake the R menu and tool bar buttons~ *vimrplugin_never_unmake_menu* Use this option if you want that the menu item R and the R related tool bar buttons are not deleted when you change from one buffer to another, for @@ -1185,7 +1155,7 @@ When this options is enabled all menu items are created regardless of the file type. -7.22. Map 'r'~ +6.21. Map 'r'~ *vimrplugin_map_r* If the variable |vimrplugin_map_r| exists, the plugin will map the letter 'r' to send lines to R when there are visually selected lines, for compatibility @@ -1203,7 +1173,7 @@ Emacs: set tabstop=8 < -7.23. Add ^A^K to the beginning of commands~ +6.22. Add ^A^K to the beginning of commands~ *vimrplugin_ca_ck* When one types in the R Console the cursor goes to the beginning of the line and one types the characters to the right of the cursor are @@ -1218,7 +1188,7 @@ command if you put in your |vimrc|: ============================================================================== *r-plugin-key-bindings* -8. Custom key bindings~ +7. Custom key bindings~ When creating custom key bindings for the Vim-R-plugin, it is necessary to create three maps for most functions because the way the function is called is @@ -1288,7 +1258,7 @@ and "levels" with the R function that you want to call. ============================================================================== *r-plugin-files* -9. Files~ +8. Files~ The following files are part of the plugin and should be in your ~/.vim directory after the installation: @@ -1341,18 +1311,17 @@ directory after the installation: syntax/rout.vim syntax/r.vim -8 directories, 39 files ============================================================================== *r-plugin-tips* -10. FAQ and tips~ +9. FAQ and tips~ -10.1. Is it possible to stop R from within Vim?~ +9.1. Is it possible to stop R from within Vim?~ Sorry, it is not possible. You have to press ^C into R's terminal emulator. -10.2. Html help and custom pager~ +9.2. Html help and custom pager~ If you prefer to see help pages in an html browser, put in your ~/.Rprofile: > @@ -1363,7 +1332,7 @@ and in your |vimrc| (see |vimrplugin_vimpager|): let vimrplugin_vimpager = "no" < -10.3. How do marked blocks work?~ +9.3. How do marked blocks work?~ *r-plugin-showmarks* Vim allows several marks (bookmarks). The most commonly used marks are the lowercase alphabet letters. If the cursor is between any two marks, the plugin @@ -1386,7 +1355,7 @@ add the following two lines to your |vimrc| to customize ShowMarks behavior: let showmarks_include = "abcdefghijklmnopqrstuvwxyz" < -10.4. Use snipMate~ +9.4. Use snipMate~ *r-plugin-snippets* You probably will want to use the snipMate plugin to insert snippets of code in your R script. The plugin may be downloaded from: @@ -1400,7 +1369,7 @@ you to get started. If you usually edit rnoweb files, you may also want to create an rnoweb.snippet by concatenating both tex.snippets and r.snippets. -10.5. Easier key bindings for most used commands~ +9.5. Easier key bindings for most used commands~ *r-plugin-bindings* The most used commands from Vim-R-plugin probably are "Send line" and "Send selection". You may find it a good idea to map them to the space bar in your @@ -1414,7 +1383,7 @@ You may also want to remap : http://stackoverflow.com/questions/2269005/how-can-i-change-the-keybinding-used-to-autocomplete-in-vim -10.6. Remap the ~ +9.6. Remap the ~ *r-plugin-localleader* People writing Rnoweb documents may find it better to use a comma or other key as the instead of the default backslash (see |maplocalleader|): @@ -1422,7 +1391,7 @@ as the instead of the default backslash (see |maplocalleader|): let maplocalleader = "," < -10.7. Use a tags file to jump to function definitions~ +9.7. Use a tags file to jump to function definitions~ *r-plugin-tagsfile* Vim can jump to a function definition if it finds a "tags" file with the information about the place where the function is defined. To generate the @@ -1458,7 +1427,7 @@ Example on how to test whether your setup is ok: 4. Press CTRL-] over "do_mapply" (Vim sould jump to "mapply.c"). -10.8. Indenting setup~ +9.8. Indenting setup~ *r-plugin-indenting* Note: In Normal mode, type |==| to indent the current line and gg=G to format the entire buffer (see |gg|, |=| and |G| for details). These are Vim commands; @@ -1509,7 +1478,7 @@ Notes: (1) Not all code indented by Emacs/ESS will be indented by the in indent/r.vim. That is why it is documented in this section. -10.9. Folding setup~ +9.9. Folding setup~ *r-plugin-folding* Vim has several methods of folding text (see |fold-methods| and |fold-commands|). To enable the syntax method of folding for R files, put in @@ -1534,7 +1503,7 @@ line where the statement immediately above started. Of course someone may develop a better algorithm in the future. -10.10. Automatically close parenthesis~ +9.10. Automatically close parenthesis~ Some people want Vim automatically inserting a closing parenthesis, bracket or brace when an open one has being typed. The page below explains how to achieve @@ -1543,7 +1512,7 @@ this goal: http://vim.wikia.com/wiki/Automatically_append_closing_characters -10.11. Automatic line breaks~ +9.11. Automatic line breaks~ By default, Vim breaks lines when you are typing if you reach the column defined by the 'textwidth' option. If you prefer that Vim does not break the R @@ -1552,7 +1521,7 @@ code automatically, breaking only comment lines, put in your |vimrc|: autocmd FileType r setlocal formatoptions=cq < -10.12. Vim with 256 colors in a terminal emulator (Linux/Unix only)~ +9.12. Vim with 256 colors in a terminal emulator (Linux/Unix only)~ If you want 256 colors support in Vim, install the package ncurses-term. Then put in your ~/.bashrc: @@ -1579,7 +1548,7 @@ download and copy them to ~/.vim/colors. You may use the command |:colorscheme| to try them all before setting your preference in your |vimrc|. -10.13. Run your Makefile from within R~ +9.13. Run your Makefile from within R~ Do you have many Rnoweb files included in a master tex or Rnoweb file and use a Makefile to build the pdf? You may consider it useful to put the following @@ -1588,7 +1557,7 @@ line in your |vimrc|: nmap sm :update:call SendCmdToR('system("make")') < -10.14. Group windows with compiz~ +9.14. Group windows with compiz~ If you are using Compiz, it may be easier to work with the plugin if the various related windows (editor, terminal, and graphics window) are grouped @@ -1597,7 +1566,7 @@ You may need CompizConfig Settings Manager installed to enable this feature (look at the "Window Management" section for "Group and Tab Windows"). -10.15. Why do I have to updated the Object Browser manually?~ +9.15. Why do I have to updated the Object Browser manually?~ It is because Vim and R run as separate processes and, thus, it is not possible to Vim to know whether R is busy or not. If R was running as part of @@ -1609,7 +1578,7 @@ the Vim-R-plugin did this, the use of Vim would be blocked until R finished its processing. -10.16. Edit your ~/.Rprofile~ +9.16. Edit your ~/.Rprofile~ You may want to edit your ~/.Rprofile. Two common options are the use of GVim as the text editor and the use of Vim as pager. Example for Linux with these @@ -1656,7 +1625,7 @@ An example for Windows: } < -10.17. Debugging R functions~ +9.17. Debugging R functions~ The Vim-R-Plugin does not have debugging facilities, but you may want to use the R package "debug": @@ -1676,12 +1645,12 @@ on top" or a similar option provided by your desktop manager. There is also the R package "edtdbg" which aims to integrate R debugging facilities with Vim. -10.18. Turn the R-plugin into a global plugin~ +9.18. Turn the R-plugin into a global plugin~ *r-plugin-global* The Vim-R-plugin is a file type plugin. If you want its functionality available for all file types, then do one of the following: -10.18.1. When using GVim~ +9.18.1. When using GVim~ Go to your ~/.vim/plugin directory and create a symbolic link to ~/.vim/r-plugin/global_r_plugin.vim. That is, type the following @@ -1697,7 +1666,7 @@ make a copy of the file to the ~/.vim/plugin directory and edit it. On Windows, you probably will have to make a copy of the file to the ~/vimfiles/plugin directory. -10.18.2. When using Vim + screen.vim plugin (either Tmux or GNU Screen)~ +9.18.2. When using Vim + screen.vim plugin (either Tmux or GNU Screen)~ Put in your |vimrc| (replace with the shortcut of your preference): > @@ -1713,17 +1682,15 @@ Consequently, the ftplugin/r.vim script must be sourced again by pressing for the second time. -10.19. Disable syntax highlight of R functions~ +9.19. Disable syntax highlight of R functions~ If you want to disable the syntax highlight of R functions edit the file ~/.vim/r-plugin/functions.vim and delete all lines, but do not delete the file. -============================================================================== +9.20. Integration with the Conque Shell plugin~ *r-plugin-conque* -11. Integration with the Conque Shell plugin~ - In addition to being integrated with the screen.vim plugin the Vim-R-plugin can also use the Conque Shell plugin, but the Conque Shell still has some important bugs and Vim has limitations that make the use of Conque Shell not @@ -1807,14 +1774,18 @@ the R syntax highlighted. ============================================================================== *r-plugin-news* -12. News~ +10. News~ -0.9.8 (2011-12-23) +0.9.8 (2012-01-12) * Use the R package vimcom. The following options are now set on the vimcom R package and no longer in the Vim-R-plugin: allnames, open_df, and open_list. + * Automatic update of the Object Browser when running R in a Tmux session. +0.9.7 (2012-01-03) + + * Minor bug fixes. 0.9.6 (2011-12-13) diff --git a/ftplugin/rbrowser.vim b/ftplugin/rbrowser.vim index 9dd0cb6..43218a9 100644 --- a/ftplugin/rbrowser.vim +++ b/ftplugin/rbrowser.vim @@ -16,7 +16,7 @@ " " Author: Jakson Alves de Aquino " -" Last Change: Thu Dec 22, 2011 10:53PM +" Last Change: Thu Jan 12, 2012 10:34AM "========================================================================== " Only do this when not yet done for this buffer @@ -58,7 +58,7 @@ function! UpdateOB(what) if g:rplugin_curview != a:what return endif - if exists("g:rplugin_curbuf") && g:rplugin_curbuf != "Object_Browser" && !exists("b:myservername") + if exists("g:rplugin_curbuf") && g:rplugin_curbuf != "Object_Browser" && g:rplugin_editor_port == 0 let savesb = &switchbuf set switchbuf=useopen,usetab sil noautocmd sb Object_Browser @@ -117,7 +117,7 @@ function! RBrowserDoubleClick() endfunction function! RBrowserOpenCloseLists(status) - if !exists("b:myservername") + if g:rplugin_editor_port == 0 if !buflisted("Object_Browser") call RWarningMsg('There is no "Object_Browser" buffer.') return @@ -139,7 +139,7 @@ function! RBrowserOpenCloseLists(status) call UpdateOB("libraries") endif - if !exists("b:myservername") + if g:rplugin_editor_port == 0 if switchedbuf exe "sil noautocmd sb " . g:rplugin_curbuf exe "set switchbuf=" . savesb @@ -215,7 +215,7 @@ function! RBrowserFindParent(word, curline, curpos) if g:rplugin_curview == "GlobalEnv" let spacelimit = 3 else - if $LC_MESSAGES =~ "UTF-8" + if s:isutf8 let spacelimit = 10 else let spacelimit = 6 @@ -279,7 +279,7 @@ function! RBrowserGetName(complete) endif else if g:rplugin_curview == "libraries" - if $LC_MESSAGES =~ "UTF-8" + if s:isutf8 if curpos == 10 return word endif @@ -315,10 +315,10 @@ function! MakeRBrowserMenu() endfunction function! ObBrBufUnload() - Py StopOBServer() + Py StopServer() call delete($VIMRPLUGIN_TMPDIR . "/object_browser") call delete($VIMRPLUGIN_TMPDIR . "/liblist") - if exists("b:myservername") + if g:rplugin_editor_port call system("tmux select-pane -t 0") endif endfunction @@ -346,6 +346,13 @@ call writefile([], $VIMRPLUGIN_TMPDIR . "/liblist") au BufUnload call ObBrBufUnload() +let s:envstring = tolower($LC_MESSAGES . $LC_ALL . $LANG) +if s:envstring =~ "utf-8" || s:envstring =~ "utf8" + let s:isutf8 = 1 +else + let s:isutf8 = 0 +endif +unlet s:envstring let &cpo = s:cpo_save unlet s:cpo_save diff --git a/r-plugin/common_buffer.vim b/r-plugin/common_buffer.vim index 578f077..3946c32 100644 --- a/r-plugin/common_buffer.vim +++ b/r-plugin/common_buffer.vim @@ -19,7 +19,7 @@ " " Based on previous work by Johannes Ranke " -" Last Change: Mon Jan 02, 2012 07:10PM +" Last Change: Wed Jan 11, 2012 11:31PM " " Please see doc/r-plugin.txt for usage details. "========================================================================== @@ -105,9 +105,7 @@ else let s:uniquename = b:screensname endif let $VIMINSTANCEID = $VIMRPLUGIN_TMPDIR . "/" . s:uniquename . "-port" -let b:objbr_server = "OB" . s:uniquename unlet s:uniquename -let b:objbr_server = toupper(substitute(b:objbr_server, '\W', "", "g")) if has("gui_running") && exists("g:rplugin_lastft") && g:rplugin_lastft != &filetype call RBufEnter() diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 5d4cf86..ad42dac 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -15,7 +15,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Mon Jan 02, 2012 09:01PM +" Last Change: Thu Jan 12, 2012 10:45PM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -651,19 +651,64 @@ endfunction function StartObjectBrowser() if g:vimrplugin_screenplugin && g:vimrplugin_tmux - if exists("b:myservername") + if g:rplugin_editor_port " This is the Object Browser - if remote_expr(b:myservername, "mode()") != "n" - call remote_send(b:myservername, "") - endif - call remote_expr(b:myservername, "RObjBrowser()") + Py VimClient("EXPR call RObjBrowser()") let g:rplugin_running_objbr = 0 return endif + if g:rplugin_myport == 0 + let g:rplugin_myport1 = 6005 + let g:rplugin_myport2 = 6100 + Py RunServer() + Py vim.command("let g:rplugin_myport = " + str(MyPort)) + endif + " Start the Object Browser if it doesn't exist yet - let slist = serverlist() - if slist !~ b:objbr_server + if g:rplugin_objbr_port == 0 + let objbrowserfile = $VIMRPLUGIN_TMPDIR . "/objbrowserInit" + call writefile([ + \ 'let b:objbrtitle = "' . b:objbrtitle . '"', + \ 'let b:screensname = "' . b:screensname . '"', + \ 'let b:rscript_buffer = "' . bufname("%") . '"', + \ 'set filetype=rbrowser', + \ 'let $VIMINSTANCEID="' . $VIMINSTANCEID . '"', + \ 'setlocal modifiable', + \ 'set shortmess=atI', + \ 'set rulerformat=%3(%l%)', + \ 'set noruler', + \ 'let curline = line(".")', + \ 'let curcol = col(".")', + \ 'normal! ggdG', + \ 'setlocal nomodified', + \ 'call cursor(curline, curcol)', + \ 'exe "PyFile " . g:rplugin_home . "/r-plugin/vimcom.py"', + \ 'Py SendToR("\003GlobalEnv")', + \ 'Py SendToR("\004Libraries")', + \ 'call UpdateOB("GlobalEnv")', + \ 'let g:rplugin_editor_port = ' . g:rplugin_myport , + \ 'Py OtherPort = ' . g:rplugin_myport , + \ 'let g:rplugin_myport1 = 5005', + \ 'let g:rplugin_myport2 = 5100', + \ 'sleep 250m', + \ 'function! RBrSendToR(cmd)', + \ 'let scmd = "tmux set-buffer '. "'" . '" . a:cmd . "\' . "'" . ' && tmux paste-buffer -t 2"', + \ ' let rlog = system(scmd)', + \ ' if v:shell_error', + \ ' let rlog = substitute(rlog, "\n", " ", "g")', + \ ' let rlog = substitute(rlog, "\r", " ", "g")', + \ ' call RWarningMsg(rlog)', + \ ' return 0', + \ ' endif', + \ 'endfunction', + \ 'Py RunServer()', + \ 'sleep 250m', + \ 'Py VimClient("EXPR let g:rplugin_objbr_port = " + str(MyPort))', + \ 'sleep 200m', + \ 'Py VimClient("EXPR Py OtherPort = " + str(MyPort))', + \ 'redraw'], objbrowserfile) + if g:vimrplugin_objbr_place =~ "left" let panw = system("tmux list-panes | cat") if g:vimrplugin_objbr_place =~ "console" @@ -683,10 +728,11 @@ function StartObjectBrowser() let panewidth = g:vimrplugin_objbr_w endif if g:vimrplugin_objbr_place =~ "console" - let cmd = "tmux split-window -d -h -l " . panewidth . ' -t 1 "vim --servername ' . b:objbr_server . '"' + let trgt = ' -t 1 ' else - let cmd = "tmux split-window -d -h -l " . panewidth . ' -t 0 "vim --servername ' . b:objbr_server . '"' + let trgt = ' -t 0 ' endif + let cmd = "tmux split-window -d -h -l " . panewidth . trgt . '"vim -c ' . "'source " . objbrowserfile . "'" . '"' let rlog = system(cmd) if v:shell_error let rlog = substitute(rlog, '\n', ' ', 'g') @@ -702,50 +748,14 @@ function StartObjectBrowser() call system("tmux swap-pane -d -s 0 -t 1") endif endif + let ii = 0 + echo "Please, wait..." + while g:rplugin_objbr_port == 0 && ii < 10 + sleep 200m + let ii = ii + 1 + endwhile + echon "\rObject Browser loaded." endif - - " Wait while Vim starts - let idx = 0 - while idx < 20 - sleep 300m - let slist = serverlist() - if slist =~ b:objbr_server - break - endif - let idx = idx + 1 - endwhile - - let objbrowserfile = $VIMRPLUGIN_TMPDIR . "/objbrowserInit" - if g:vimrplugin_conqueplugin == 0 - let obscmd = 'Py RunOBServer()' - else - let obscmd = ' ' - endif - call writefile([ - \ 'let b:objbrtitle = "' . b:objbrtitle . '"', - \ 'let b:screensname = "' . b:screensname . '"', - \ 'let b:rscript_buffer = "' . bufname("%") . '"', - \ 'let b:myservername = "' . v:servername . '"', - \ 'set filetype=rbrowser', - \ 'let $VIMINSTANCEID="' . $VIMINSTANCEID . '"', - \ 'setlocal modifiable', - \ 'set shortmess=atI', - \ 'set rulerformat=%3(%l%)', - \ 'set noruler', - \ 'let curline = line(".")', - \ 'let curcol = col(".")', - \ 'normal! ggdG', - \ 'setlocal nomodified', - \ 'call cursor(curline, curcol)', - \ 'exe "PyFile " . g:rplugin_home . "/r-plugin/vimcom.py"', - \ 'Py SendToR("\003GlobalEnv")', - \ 'Py SendToR("\004Libraries")', - \ 'call UpdateOB("GlobalEnv")', - \ obscmd, - \ 'redraw'], objbrowserfile) - - call remote_send(b:objbr_server, ":source " . objbrowserfile . "") - call remote_send(b:objbr_server, ":echon") return endif @@ -799,9 +809,6 @@ function StartObjectBrowser() Py SendToR("\003GlobalEnv") Py SendToR("\004Libraries") call UpdateOB("GlobalEnv") - if g:vimrplugin_objbr_place =~ "console" && g:vimrplugin_conqueplugin == 0 - Py RunOBServer() - endif endif endfunction @@ -813,7 +820,7 @@ function RObjBrowser() endif " Only opens the Object Browser if R is running - if g:vimrplugin_screenplugin && !exists("g:ScreenShellSend") && !exists("b:myservername") + if g:vimrplugin_screenplugin && !exists("g:ScreenShellSend") return endif if g:vimrplugin_conqueplugin && !exists("b:conque_bufname") @@ -840,9 +847,9 @@ endfunction function RObjBrowserOCLists(status) if exists("*RBrowserOpenCloseLists") call RBrowserOpenCloseLists(a:status) - elseif serverlist() =~ b:objbr_server - call remote_expr(b:objbr_server, "RBrowserOpenCloseLists(" . a:status . ")") - call remote_send(b:objbr_server, ":redraw:echon ' '") + elseif g:rplugin_objbr_port + exe 'Py VimClient("EXPR call RBrowserOpenCloseLists('. "'" . a:status . "')" . '")' + Py VimClient("EXPR silent :redraw:echon ' '") endif endfunction @@ -868,6 +875,7 @@ endfunction " Called by the Object Browser when running remotely: function RGetRemoteCmd(cmd) + call RWarningMsg(a:cmd) call SendCmdToR(a:cmd) echon endfunction @@ -895,18 +903,15 @@ function SendCmdToR(cmd) endif if g:vimrplugin_screenplugin - if !exists("g:ScreenShellSend") - if exists("b:myservername") - if remote_expr(b:myservername, "mode()") != "n" - call remote_send(b:myservername, "") - endif - call remote_expr(b:myservername, "RGetRemoteCmd('" . a:cmd . "')") - return 1 - endif + if !exists("g:ScreenShellSend") && !exists("*RBrSendToR") call RWarningMsg("Did you already start R?") return 0 endif - call g:ScreenShellSend(cmd) + if exists("g:ScreenShellSend") + call g:ScreenShellSend(cmd) + else + call RBrSendToR(cmd) + endif return 1 elseif g:vimrplugin_conqueplugin if !exists("b:conque_bufname") @@ -1309,9 +1314,14 @@ endfunction " Quit R function RQuit(how) - if serverlist() =~ b:objbr_server - call remote_send(b:objbr_server, ":q") - sleep 500m + if g:rplugin_objbr_port + Py VimClient("FINISH") + sleep 200m + Py OtherPort = 0 + endif + if g:rplugin_myport + Py StopServer() + sleep 200m endif if a:how == "save" @@ -1671,15 +1681,11 @@ function RAction(rcmd) if strlen(rkeyword) > 0 if a:rcmd == "help" if g:vimrplugin_vimpager != "no" - if (bufname("%") =~ "Object_Browser" || exists("b:myservername")) && g:rplugin_curview == "libraries" + if (bufname("%") =~ "Object_Browser" || g:rplugin_editor_port) && g:rplugin_curview == "libraries" let pkg = RBGetPkgName() - if exists("b:myservername") + if g:rplugin_editor_port call system("tmux select-pane -t 0") - call remote_expr(b:myservername, "ShowRDoc('" . rkeyword . "', '" . pkg . "', 0)") - if remote_expr(b:myservername, "mode()") != "n" - call remote_send(b:myservername, "") - endif - call remote_send(b:myservername, "") + exe 'Py VimClient("EXPR call ShowRDoc(' . "'" . rkeyword . "', '" . pkg . "', 0)" . '")' else call ShowRDoc(rkeyword, pkg, 0) endif @@ -2374,13 +2380,6 @@ call RSetDefaultValue("g:vimrplugin_vimpager", "'tab'") call RSetDefaultValue("g:vimrplugin_latexcmd", "'pdflatex'") call RSetDefaultValue("g:vimrplugin_objbr_place", "'script,right'") -" Old default value. -"if has("gui_running") || !has("clientserver") -" call RSetDefaultValue("g:vimrplugin_objbr_place", "'script,right'") -"else -" call RSetDefaultValue("g:vimrplugin_objbr_place", "'console,right'") -"endif - " python has priority over python3, unless ConqueTerm_PyVersion == 3 if has("python3") && exists("g:ConqueTerm_PyVersion") && g:ConqueTerm_PyVersion == 3 @@ -2519,20 +2518,6 @@ if g:vimrplugin_screenplugin endif endif -" To run the Object Browser beside R Console with Tmux, Vim must have the -" +clientserver feature and the X server must be running. -if g:vimrplugin_screenplugin && g:vimrplugin_objbr_place =~ "console" - if $DISPLAY == "" || g:vimrplugin_tmux == 0 - let g:vimrplugin_objbr_place = substitute(g:vimrplugin_objbr_place, "console", "script", "") - elseif !has("clientserver") - " Cannot use RWarningMsgInp because the message would be visible but - " Vim would wait for when R was started. - call RWarningMsg("Your Vim was not compiled with the 'clientserver' feature. You will not be able to start the Object Browser beside the R Console.") - sleep 1 - let g:vimrplugin_objbr_place = substitute(g:vimrplugin_objbr_place, "console", "script", "") - endif -endif - " Start with an empty list of objects in the workspace let g:rplugin_globalenvlines = [] @@ -2755,8 +2740,14 @@ if exists("g:vimrplugin_term_cmd") let g:rplugin_termcmd = g:vimrplugin_term_cmd endif +function FinalActions() + Py StopServer() + sleep 200m +endfunction + augroup RBufControl au BufEnter * let g:rplugin_curbuf = bufname("%") + au VimLeavePre * call FinalActions() augroup END if has("gui_running") @@ -2770,6 +2761,9 @@ let g:rplugin_firstbuffer = substitute(g:rplugin_firstbuffer, " ", "", "") let g:rplugin_running_objbr = 0 let g:rplugin_has_new_lib = 0 let g:rplugin_has_new_obj = 0 +let g:rplugin_objbr_port = 0 +let g:rplugin_myport = 0 +let g:rplugin_editor_port = 0 " Debugging code: if g:vimrplugin_screenplugin && g:vimrplugin_conqueplugin diff --git a/r-plugin/vimcom.py b/r-plugin/vimcom.py index 61d3fc6..7fcf457 100644 --- a/r-plugin/vimcom.py +++ b/r-plugin/vimcom.py @@ -3,15 +3,19 @@ import vim import threading import os -PORT = 0 -OBPort = 0 +import re +VimComPort = 0 +OtherPort = 0 +MyPort = 0 sock = None +th = None +FinishNow = False def DiscoverVimComPort(): - global PORT + global VimComPort HOST = "localhost" - PORT = 9998 + VimComPort = 9998 repl = "NOTHING" correct_repl = vim.eval("$VIMINSTANCEID") if correct_repl is None: @@ -20,30 +24,30 @@ def DiscoverVimComPort(): vim.command("call RWarningMsg('VIMINSTANCEID not found.')") return - while correct_repl.find(repl) < 0 and PORT < 10050: - PORT = PORT + 1 + while correct_repl.find(repl) < 0 and VimComPort < 10050: + VimComPort = VimComPort + 1 sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) sock.settimeout(0.1) try: - sock.connect((HOST, PORT)) + sock.connect((HOST, VimComPort)) sock.send("\002What port?") repl = sock.recv(1024) except: pass sock.close() - if PORT >= 10050: - PORT = 0 + if VimComPort >= 10050: + VimComPort = 0 vim.command("call RWarningMsg('VimCom Port not found.')") - return(PORT) + return(VimComPort) def SendToR(aString): HOST = "localhost" - global PORT - if PORT == 0: - PORT = DiscoverVimComPort() - if PORT == 0: + global VimComPort + if VimComPort == 0: + VimComPort = DiscoverVimComPort() + if VimComPort == 0: return received = None @@ -51,7 +55,7 @@ def SendToR(aString): sock.settimeout(3.0) try: - sock.connect((HOST, PORT)) + sock.connect((HOST, VimComPort)) sock.send(aString) received = sock.recv(1024) except: @@ -65,54 +69,64 @@ def SendToR(aString): vim.command("let g:rplugin_lastrpl = '" + received + "'") -def OBServer(): +def VimServer(): global sock - global OBPort - UDP_IP="127.0.0.1" - OBPort=5005 + global MyPort + global FinishNow + UDP_IP = "127.0.0.1" + MyPort = int(vim.eval("g:rplugin_myport1")) + PortLim = int(vim.eval("g:rplugin_myport2")) - while True and OBPort < 5100: + while True and MyPort < PortLim: try: - OBPort += 1 + MyPort += 1 sock = socket.socket( socket.AF_INET, socket.SOCK_DGRAM ) - sock.bind( (UDP_IP,OBPort) ) + sock.bind( (UDP_IP,MyPort) ) except: continue else: break if sock == None: - OBPort = 0 + MyPort = 0 return else: - SendToR("\007" + str(OBPort)) + vim.command("let g:rplugin_myport = " + str(MyPort)) + SendToR("\007" + str(MyPort)) - while True: + while FinishNow == False: try: data, addr = sock.recvfrom( 1024 ) # buffer size is 1024 bytes - if data.find("G") >= 0: - vim.command("call UpdateOB('GlobalEnv')") + if re.match("EXPR ", data): + vim.command("exe '" + re.sub("^EXPR ", "", data) + "'") else: - if data.find("L") >= 0: - vim.command("call UpdateOB('libraries')") + if re.match("^G", data): + vim.command("call UpdateOB('GlobalEnv')") else: - if data.find("B") >= 0: - vim.command("call UpdateOB('GlobalEnv')") + if re.match("^L", data): vim.command("call UpdateOB('libraries')") else: - try: - sock.shutdown(socket.SHUT_RD) - except: - pass - sock.close() - return + if re.match("^B", data): + vim.command("call UpdateOB('GlobalEnv')") + vim.command("call UpdateOB('libraries')") + else: + try: + sock.shutdown(socket.SHUT_RD) + except: + pass + try: + sock.close() + except: + pass + if re.match("^FINISH", data): + FinishNow = True + except: - OBPort = 0 - vim.command("call RWarningMsg('OBS 002')") + MyPort = 0 try: sock.shutdown(socket.SHUT_RD) except: - vim.command("call RWarningMsg('OBS 003')") + pass sock.close() return try: @@ -120,24 +134,48 @@ def OBServer(): except: pass sock.close() - sock = socket.socket( socket.AF_INET, socket.SOCK_DGRAM ) - sock.bind( (UDP_IP,OBPort) ) - + if FinishNow == False: + sock = socket.socket( socket.AF_INET, socket.SOCK_DGRAM ) + sock.bind( (UDP_IP,MyPort) ) -def RunOBServer(): - th = threading.Thread(target=OBServer) +def RunServer(): + global th + global FinishNow + FinishNow = False + th = threading.Thread(target=VimServer) th.start() -def StopOBServer(): +def StopServer(): global sock - global OBPort - SendToR("\x08Stop Updating Info") - if OBPort == 0: + global MyPort + global FinishNow + FinishNow = True + if VimComPort: + SendToR("\x08Stop Updating Info") + vim.command("let g:rplugin_myport = 0") + ft = vim.eval("&filetype") + if ft == "rbrowser": + VimClient("EXPR let g:rplugin_objbr_port = 0") + if MyPort == 0: return try: sock.shutdown(socket.SHUT_RD) except: pass + try: + sock.close() + except: + pass + try: + th.join(0.3) + except: + pass + MyPort = 0 + +def VimClient(msg): + if OtherPort == 0: + return + sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) + sock.sendto(msg, ("127.0.0.1", OtherPort)) sock.close() - OBPort = 0 From 3f1aa50c5f32d921f82dfc0619c3a6faf3513ea0 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Fri, 13 Jan 2012 07:24:09 -0300 Subject: [PATCH 0141/1050] Do not call MakeRBrowserMenu() before it exists. --- r-plugin/common_buffer.vim | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/r-plugin/common_buffer.vim b/r-plugin/common_buffer.vim index 3946c32..97463b4 100644 --- a/r-plugin/common_buffer.vim +++ b/r-plugin/common_buffer.vim @@ -19,7 +19,7 @@ " " Based on previous work by Johannes Ranke " -" Last Change: Wed Jan 11, 2012 11:31PM +" Last Change: Fri Jan 13, 2012 07:20AM " " Please see doc/r-plugin.txt for usage details. "========================================================================== @@ -107,9 +107,5 @@ endif let $VIMINSTANCEID = $VIMRPLUGIN_TMPDIR . "/" . s:uniquename . "-port" unlet s:uniquename -if has("gui_running") && exists("g:rplugin_lastft") && g:rplugin_lastft != &filetype - call RBufEnter() -endif - let g:rplugin_lastft = &filetype From 296fdebfd91b816b905d2e95f401e9d1665a5ce5 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Fri, 13 Jan 2012 22:05:59 -0300 Subject: [PATCH 0142/1050] Wait until Server is ready. Require Tmux >= 1.5. --- r-plugin/common_global.vim | 58 +++++++++++++++++++++++--------------- 1 file changed, 36 insertions(+), 22 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index ad42dac..2e748e6 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -15,7 +15,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Thu Jan 12, 2012 10:45PM +" Last Change: Fri Jan 13, 2012 10:01PM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -662,12 +662,23 @@ function StartObjectBrowser() let g:rplugin_myport1 = 6005 let g:rplugin_myport2 = 6100 Py RunServer() - Py vim.command("let g:rplugin_myport = " + str(MyPort)) + sleep 100m + let ii = 0 + while ii < 10 && g:rplugin_myport == 0 + Py vim.command("let g:rplugin_myport = " + str(MyPort)) + let ii = ii + 1 + sleep 100m + endwhile endif " Start the Object Browser if it doesn't exist yet if g:rplugin_objbr_port == 0 let objbrowserfile = $VIMRPLUGIN_TMPDIR . "/objbrowserInit" + if exists("g:ScreenShellSession") + let tmxs = " -S " . g:ScreenShellSession . " " + else + let tmxs = " " + endif call writefile([ \ 'let b:objbrtitle = "' . b:objbrtitle . '"', \ 'let b:screensname = "' . b:screensname . '"', @@ -693,7 +704,7 @@ function StartObjectBrowser() \ 'let g:rplugin_myport2 = 5100', \ 'sleep 250m', \ 'function! RBrSendToR(cmd)', - \ 'let scmd = "tmux set-buffer '. "'" . '" . a:cmd . "\' . "'" . ' && tmux paste-buffer -t 2"', + \ 'let scmd = "tmux set-buffer '. "'" . '" . a:cmd . "\' . "'" . ' && tmux' . tmxs . 'paste-buffer -t %1"', \ ' let rlog = system(scmd)', \ ' if v:shell_error', \ ' let rlog = substitute(rlog, "\n", " ", "g")', @@ -703,7 +714,13 @@ function StartObjectBrowser() \ ' endif', \ 'endfunction', \ 'Py RunServer()', - \ 'sleep 250m', + \ 'sleep 100m', + \ 'let ii = 0', + \ 'while ii < 10 && g:rplugin_myport == 0', + \ ' Py vim.command("let g:rplugin_myport = " + str(MyPort))', + \ ' let ii = ii + 1', + \ ' sleep 100m', + \ 'endwhile', \ 'Py VimClient("EXPR let g:rplugin_objbr_port = " + str(MyPort))', \ 'sleep 200m', \ 'Py VimClient("EXPR Py OtherPort = " + str(MyPort))', @@ -749,12 +766,14 @@ function StartObjectBrowser() endif endif let ii = 0 + echohl WarningMsg echo "Please, wait..." + echohl Normal while g:rplugin_objbr_port == 0 && ii < 10 sleep 200m let ii = ii + 1 endwhile - echon "\rObject Browser loaded." + echon "\r " endif return endif @@ -1318,6 +1337,7 @@ function RQuit(how) Py VimClient("FINISH") sleep 200m Py OtherPort = 0 + let g:rplugin_objbr_port = 0 endif if g:rplugin_myport Py StopServer() @@ -2485,13 +2505,10 @@ if g:vimrplugin_screenplugin \ 'bind-key C-a send-prefix', \ 'set-window-option -g mode-keys vi', \ 'set -g status off', - \ "set -g terminal-overrides 'xterm*:smcup@:rmcup@'"] - if s:tmuxversion >= "1.5" - let cnflines += [ - \ 'set -g mode-mouse on', - \ 'set -g mouse-select-pane on', - \ 'set -g mouse-resize-pane on'] - endif + \ "set -g terminal-overrides 'xterm*:smcup@:rmcup@'", + \ 'set -g mode-mouse on', + \ 'set -g mouse-select-pane on', + \ 'set -g mouse-resize-pane on'] call writefile(cnflines, tmxcnf) let g:ScreenShellTmuxInitArgs = g:ScreenShellTmuxInitArgs . " -f " . tmxcnf endif @@ -2502,21 +2519,18 @@ endif if g:vimrplugin_screenplugin " Future: Remove this Tmux version test on 2014 - if g:vimrplugin_tmux - if s:tmuxversion == "1.0" && g:ScreenVersion > "1.4" - call RWarningMsgInp("Tmux <= 1.3 requires Screen plugin <= 1.4. You should either upgrade Tmux or downgrade the Screen plugin.") - endif - if s:tmuxversion < "1.5" && g:ScreenVersion < "1.5" - call RWarningMsgInp("Vim-R-plugin requires Screen plugin >= 1.5") - let g:rplugin_failed = 1 - finish - endif - elseif g:ScreenVersion < "1.5" + if g:vimrplugin_tmux && s:tmuxversion < "1.5" + call RWarningMsgInp("Vim-R-plugin requires Tmux >= 1.5") + let g:rplugin_failed = 1 + finish + endif + if g:ScreenVersion < "1.5" call RWarningMsgInp("Vim-R-plugin requires Screen plugin >= 1.5") let g:rplugin_failed = 1 finish endif endif +unlet s:tmuxversion " Start with an empty list of objects in the workspace let g:rplugin_globalenvlines = [] From 4bc3135f9326f0ed8134572703c49ca2979994b7 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Mon, 16 Jan 2012 08:50:34 -0300 Subject: [PATCH 0143/1050] Test Tmux version when running GVim too. --- r-plugin/common_global.vim | 26 +++++++++++++------------- r-plugin/vimcom.py | 1 + 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 2e748e6..6ced2f2 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -15,7 +15,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Fri Jan 13, 2012 10:01PM +" Last Change: Mon Jan 16, 2012 08:45AM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -2489,11 +2489,6 @@ if g:vimrplugin_screenplugin " xterm-256color. See :h r-plugin-tips if g:vimrplugin_tmux let g:ScreenImpl = 'Tmux' - let s:tmuxversion = system("tmux -V") - let s:tmuxversion = substitute(s:tmuxversion, '.*tmux \([0-9]\.[0-9]\).*', '\1', '') - if strlen(s:tmuxversion) != 3 - let s:tmuxversion = "1.0" - endif if g:vimrplugin_notmuxconf == 0 if $DISPLAY != "" || $TERM =~ "xterm" let g:ScreenShellTmuxInitArgs = "-2" @@ -2517,20 +2512,25 @@ if g:vimrplugin_screenplugin endif endif +let s:tmuxversion = system("tmux -V") +let s:tmuxversion = substitute(s:tmuxversion, '.*tmux \([0-9]\.[0-9]\).*', '\1', '') +if strlen(s:tmuxversion) != 3 + let s:tmuxversion = "1.0" +endif +if g:vimrplugin_tmux && s:tmuxversion < "1.5" + call RWarningMsgInp("Vim-R-plugin requires Tmux >= 1.5") + let g:rplugin_failed = 1 + finish +endif +unlet s:tmuxversion + if g:vimrplugin_screenplugin - " Future: Remove this Tmux version test on 2014 - if g:vimrplugin_tmux && s:tmuxversion < "1.5" - call RWarningMsgInp("Vim-R-plugin requires Tmux >= 1.5") - let g:rplugin_failed = 1 - finish - endif if g:ScreenVersion < "1.5" call RWarningMsgInp("Vim-R-plugin requires Screen plugin >= 1.5") let g:rplugin_failed = 1 finish endif endif -unlet s:tmuxversion " Start with an empty list of objects in the workspace let g:rplugin_globalenvlines = [] diff --git a/r-plugin/vimcom.py b/r-plugin/vimcom.py index 7fcf457..9ce7cf7 100644 --- a/r-plugin/vimcom.py +++ b/r-plugin/vimcom.py @@ -120,6 +120,7 @@ def VimServer(): pass if re.match("^FINISH", data): FinishNow = True + MyPort = 0 except: MyPort = 0 From 57d6eb90a7e614d38052d613a04b25ef78f21cc4 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Tue, 14 Feb 2012 21:37:46 -0300 Subject: [PATCH 0144/1050] Delete unused code. --- ftplugin/rhelp.vim | 37 +------------------------------------ 1 file changed, 1 insertion(+), 36 deletions(-) diff --git a/ftplugin/rhelp.vim b/ftplugin/rhelp.vim index a4f3c7e..fd4f876 100644 --- a/ftplugin/rhelp.vim +++ b/ftplugin/rhelp.vim @@ -19,7 +19,7 @@ " " Based on previous work by Johannes Ranke " -" Last Change: Sun Nov 27, 2011 04:35PM +" Last Change: Mon Feb 13, 2012 08:39AM " " Please see doc/r-plugin.txt for usage details. "========================================================================== @@ -45,41 +45,6 @@ endif " defined after the global ones: runtime r-plugin/common_buffer.vim -" Run R CMD BATCH on current file and load the resulting .Rout in a split -" window -function! ShowRout() - let routfile = expand("%:r") . ".Rout" - if bufloaded(routfile) - exe "bunload " . routfile - call delete(routfile) - endif - - " if not silent, the user will have to type - silent update - if has("win32") || has("win64") - let rcmd = 'Rcmd.exe BATCH --no-restore --no-save "' . expand("%") . '" "' . routfile . '"' - else - let rcmd = g:rplugin_R . " CMD BATCH --no-restore --no-save '" . expand("%") . "' '" . routfile . "'" - endif - echo "Please wait for: " . rcmd - let rlog = system(rcmd) - if v:shell_error && rlog != "" - call RWarningMsg('Error: "' . rlog . '"') - sleep 1 - endif - - if filereadable(routfile) - if g:vimrplugin_routnotab == 1 - exe "split " . routfile - else - exe "tabnew " . routfile - endif - else - call RWarningMsg("The file '" . routfile . "' is not readable.") - endif -endfunction - - "========================================================================== " Key bindings and menu items From 77ce7180748bd6c7f02697595f8d05d67525c29a Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Tue, 14 Feb 2012 21:40:00 -0300 Subject: [PATCH 0145/1050] Make it easier to use the plugin as a general one. --- doc/r-plugin.txt | 35 +++------------ ftplugin/r.vim | 6 +-- r-plugin/common_global.vim | 85 +++++++++++++++++++++--------------- r-plugin/global_r_plugin.vim | 32 ++++++++++++-- 4 files changed, 88 insertions(+), 70 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 8621889..10d9fb0 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -1648,39 +1648,16 @@ facilities with Vim. 9.18. Turn the R-plugin into a global plugin~ *r-plugin-global* The Vim-R-plugin is a file type plugin. If you want its functionality -available for all file types, then do one of the following: - -9.18.1. When using GVim~ - -Go to your ~/.vim/plugin directory and create a symbolic link to -~/.vim/r-plugin/global_r_plugin.vim. That is, type the following -in a terminal emulator: +available for all file types, then go to your ~/.vim/plugin directory and +create a symbolic link to ~/.vim/r-plugin/global_r_plugin.vim. That is, type +the following in a terminal emulator: > cd ~/.vim/plugin/ ln -s ../r-plugin/global_r_plugin.vim < -Then, typing rf will activate the plugin and start an R session. -The rf shortcut is hardcoded in the global_r_plugin.vim script. -If you prefer to use another shortcut, instead of creating a symbolic link, -make a copy of the file to the ~/.vim/plugin directory and edit it. On -Windows, you probably will have to make a copy of the file to the +On Windows, you probably will have to make a copy of the file to the ~/vimfiles/plugin directory. -9.18.2. When using Vim + screen.vim plugin (either Tmux or GNU Screen)~ - -Put in your |vimrc| (replace with the shortcut of your preference): -> - nmap :runtime ftplugin/r.vim -< -Press rf to use R. That is, press before AND after -starting R with the shortcut rf (or any other key binding that -you have defined in your |vimrc| as the shortcut to start R). The first time -that is pressed, the plugin's functions and key bindings are made -available. However, when R is started, Vim is closed and restarted by the -screen.vim plugin, and the Vim-R-plugin functions and key bindings are lost. -Consequently, the ftplugin/r.vim script must be sourced again by pressing -for the second time. - 9.19. Disable syntax highlight of R functions~ @@ -1776,14 +1753,14 @@ the R syntax highlighted. *r-plugin-news* 10. News~ -0.9.8 (2012-01-12) +0.9.8 (2012-02-14) * Use the R package vimcom. The following options are now set on the vimcom R package and no longer in the Vim-R-plugin: allnames, open_df, and open_list. * Automatic update of the Object Browser when running R in a Tmux session. -0.9.7 (2012-01-03) +0.9.7 (2012-02-12) * Minor bug fixes. diff --git a/ftplugin/r.vim b/ftplugin/r.vim index 564f7cb..ba8b84b 100644 --- a/ftplugin/r.vim +++ b/ftplugin/r.vim @@ -19,7 +19,7 @@ " " Based on previous work by Johannes Ranke " -" Last Change: Tue Dec 20, 2011 11:38PM +" Last Change: Mon Feb 13, 2012 08:57AM " " Please see doc/r-plugin.txt for usage details. "========================================================================== @@ -44,7 +44,7 @@ if exists("g:rplugin_failed") finish endif -" Some buffer variables common to R, Rnoweb, Rhelp and rdoc file need be +" Some buffer variables common to R, Rnoweb, Rhelp and rdoc files need be " defined after the global ones: runtime r-plugin/common_buffer.vim @@ -62,7 +62,7 @@ function! ShowRout() if has("win32") | has("win64") let rcmd = 'Rcmd.exe BATCH --no-restore --no-save "' . expand("%") . '" "' . routfile . '"' else - let rcmd = g:rplugin_R . " CMD BATCH --no-restore --no-save '" . expand("%") . "' '" . routfile . "'" + let rcmd = b:rplugin_R . " CMD BATCH --no-restore --no-save '" . expand("%") . "' '" . routfile . "'" endif echo "Please wait for: " . rcmd let rlog = system(rcmd) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 6ced2f2..7988534 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -15,7 +15,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Mon Jan 16, 2012 08:45AM +" Last Change: Mon Feb 13, 2012 10:04AM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -461,18 +461,20 @@ function StartR(whatr) call writefile([], $VIMRPLUGIN_TMPDIR . "/object_browser") call writefile([], $VIMRPLUGIN_TMPDIR . "/liblist") + if !exists("b:rplugin_R") + call SetRPath() + endif + " Change to buffer's directory before starting R lcd %:p:h if a:whatr =~ "vanilla" - let g:rplugin_r_args = "--vanilla" + let b:rplugin_r_args = "--vanilla" else if a:whatr =~ "custom" call inputsave() - let g:rplugin_r_args = input('Enter parameters for R: ') + let b:rplugin_r_args = input('Enter parameters for R: ') call inputrestore() - else - let g:rplugin_r_args = g:vimrplugin_r_args endif endif @@ -482,8 +484,8 @@ function StartR(whatr) else let rcmd = "/Applications/R.app" endif - if g:rplugin_r_args != " " - let rcmd = rcmd . " " . g:rplugin_r_args + if b:rplugin_r_args != " " + let rcmd = rcmd . " " . b:rplugin_r_args endif let rlog = system("open " . rcmd) if v:shell_error @@ -499,14 +501,14 @@ function StartR(whatr) lcd - return else - let g:rplugin_R = "Rterm.exe" + let b:rplugin_R = "Rterm.exe" endif endif - if g:rplugin_r_args == " " - let rcmd = g:rplugin_R + if b:rplugin_r_args == " " + let rcmd = b:rplugin_R else - let rcmd = g:rplugin_R . " " . g:rplugin_r_args + let rcmd = b:rplugin_R . " " . b:rplugin_r_args endif if g:vimrplugin_screenplugin @@ -704,7 +706,7 @@ function StartObjectBrowser() \ 'let g:rplugin_myport2 = 5100', \ 'sleep 250m', \ 'function! RBrSendToR(cmd)', - \ 'let scmd = "tmux set-buffer '. "'" . '" . a:cmd . "\' . "'" . ' && tmux' . tmxs . 'paste-buffer -t %1"', + \ ' let scmd = "tmux set-buffer '. "'" . '" . a:cmd . "\' . "'" . ' && tmux' . tmxs . 'paste-buffer -t %1"', \ ' let rlog = system(scmd)', \ ' if v:shell_error', \ ' let rlog = substitute(rlog, "\n", " ", "g")', @@ -1344,13 +1346,18 @@ function RQuit(how) sleep 200m endif - if a:how == "save" - call SendCmdToR('quit(save = "yes")') - sleep 1 + if exists("b:quit_command") + call SendCmdToR(b:quit_command) else - call SendCmdToR('quit(save = "no")') - sleep 250m + if a:how == "save" + call SendCmdToR('quit(save = "yes")') + sleep 1 + else + call SendCmdToR('quit(save = "no")') + endif endif + sleep 250m + if g:vimrplugin_screenplugin && exists(':ScreenQuit') ScreenQuit elseif g:vimrplugin_conqueplugin @@ -1969,7 +1976,7 @@ function MakeRMenu() call RCreateMenuItem("nvi", 'Start/Close.Start\ R\ (custom)', 'RCustomStart', 'rc', ':call StartR("custom")') "------------------------------- menu R.Start/Close.-Sep1- - call RCreateMenuItem("nvi", 'Start/Close.Close\ R\ (no\ save)', 'RClose', 'rq', ":call SendCmdToR('quit(save = \"no\")')") + call RCreateMenuItem("nvi", 'Start/Close.Close\ R\ (no\ save)', 'RClose', 'rq', ":call RQuit('no')") "---------------------------------------------------------------------------- " Send @@ -2144,7 +2151,7 @@ function MakeRMenu() "---------------------------------------------------------------------------- " Buttons amenu ToolBar.RStart :call StartR("R") - amenu ToolBar.RClose :call SendCmdToR('quit(save = "no")') + amenu ToolBar.RClose :call RQuit('no') "--------------------------- if &filetype == "r" || g:vimrplugin_never_unmake_menu nmenu ToolBar.RSendFile :call SendFileToR("echo") @@ -2314,6 +2321,23 @@ function RBufEnter() endif endfunction +function SetRPath() + if exists("g:vimrplugin_r_path") + if isdirectory(g:vimrplugin_r_path) + let b:rplugin_R = g:vimrplugin_r_path . "/R" + else + let b:rplugin_R = g:vimrplugin_r_path + endif + else + let b:rplugin_R = "R" + endif + if !exists("g:vimrplugin_r_args") + let b:rplugin_r_args = " " + else + let b:rplugin_r_args = g:vimrplugin_r_args + endif +endfunction + command RUpdateObjList :call RBuildSyntaxFile("loaded") command RUpdateObjListAll :call RBuildSyntaxFile("installed") command RBuildTags :call SendCmdToR('rtags(ofile = "TAGS")') @@ -2572,9 +2596,9 @@ if has("win32") || has("win64") endif let g:rplugin_jspath = g:rplugin_home . "\\r-plugin\\vimActivate.js" if !exists("g:rplugin_rpathadded") - if exists("g:vimrplugin_r_path") + if exists("g:vimrplugin_r_path") && isdirectory(g:vimrplugin_r_path) let $PATH = g:vimrplugin_r_path . ";" . $PATH - let g:rplugin_Rgui = g:vimrplugin_r_path . "\\Rgui.exe" + let b:rplugin_Rgui = g:vimrplugin_r_path . "\\Rgui.exe" else Py GetRPathPy() if s:rinstallpath == "Not found" @@ -2588,20 +2612,22 @@ if has("win32") || has("win64") endif if g:vimrplugin_i386 let $PATH = s:rinstallpath . '\bin\i386;' . $PATH - let g:rplugin_Rgui = s:rinstallpath . '\bin\i386\Rgui.exe' + let b:rplugin_Rgui = s:rinstallpath . '\bin\i386\Rgui.exe' else let $PATH = s:rinstallpath . '\bin\x64;' . $PATH - let g:rplugin_Rgui = s:rinstallpath . '\bin\x64\Rgui.exe' + let b:rplugin_Rgui = s:rinstallpath . '\bin\x64\Rgui.exe' endif else let $PATH = s:rinstallpath . '\bin;' . $PATH - let g:rplugin_Rgui = s:rinstallpath . '\bin\Rgui.exe' + let b:rplugin_Rgui = s:rinstallpath . '\bin\Rgui.exe' endif unlet s:rinstallpath endif let g:rplugin_rpathadded = 1 endif - let g:rplugin_R = "Rgui.exe" + if !exists("b:rplugin_R") + let b:rplugin_R = "Rgui.exe" + endif let g:vimrplugin_term_cmd = "none" let g:vimrplugin_term = "none" let g:vimrplugin_noscreenrc = 1 @@ -2611,15 +2637,6 @@ if has("win32") || has("win64") if !exists("g:vimrplugin_sleeptime") let g:vimrplugin_sleeptime = 0.02 endif -else - if exists("g:vimrplugin_r_path") - let g:rplugin_R = g:vimrplugin_r_path . "/R" - else - let g:rplugin_R = "R" - endif - if !exists("g:vimrplugin_r_args") - let g:vimrplugin_r_args = " " - endif endif if g:vimrplugin_conqueplugin == 1 diff --git a/r-plugin/global_r_plugin.vim b/r-plugin/global_r_plugin.vim index 76ab6f9..a0fba2b 100644 --- a/r-plugin/global_r_plugin.vim +++ b/r-plugin/global_r_plugin.vim @@ -1,7 +1,31 @@ -function! RActivateThePlugin() - runtime ftplugin/r.vim - call StartR("R") +if !exists("g:ScreenVersion") + runtime plugin/screen.vim +endif + +runtime ftplugin/r.vim + +function SetExeCmd() + runtime r-plugin/common_buffer.vim + if &filetype == "python" + let b:rplugin_R = "python" + let b:rplugin_r_args = " " + let b:quit_command = "quit()" + elseif &filetype == "haskell" + let b:rplugin_R = "ghci" + let b:rplugin_r_args = " " + let b:quit_command = ":quit" + elseif &filetype == "ruby" + let b:rplugin_R = "irb" + let b:rplugin_r_args = " " + let b:quit_command = "quit" + elseif &filetype == "lisp" + let b:rplugin_R = "clisp" + let b:rplugin_r_args = " " + let b:quit_command = "(quit)" + endif endfunction -nmap rf :call RActivateThePlugin() +autocmd FileType * call SetExeCmd() +call SetExeCmd() + From 13804d0bf08b0d89466d1ae701962dc55c69714a Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 16 Feb 2012 12:20:56 -0300 Subject: [PATCH 0146/1050] Fix bugs introduced by the last commit. --- doc/r-plugin.txt | 2 +- ftplugin/rbrowser.vim | 7 +++++-- r-plugin/common_buffer.vim | 7 ++++++- r-plugin/common_global.vim | 4 +++- r-plugin/windows.py | 4 ++-- 5 files changed, 17 insertions(+), 7 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 10d9fb0..6d49524 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -1753,7 +1753,7 @@ the R syntax highlighted. *r-plugin-news* 10. News~ -0.9.8 (2012-02-14) +0.9.8 (2012-02-16) * Use the R package vimcom. The following options are now set on the vimcom R package and no longer in the Vim-R-plugin: allnames, open_df, and diff --git a/ftplugin/rbrowser.vim b/ftplugin/rbrowser.vim index 43218a9..b789888 100644 --- a/ftplugin/rbrowser.vim +++ b/ftplugin/rbrowser.vim @@ -16,7 +16,7 @@ " " Author: Jakson Alves de Aquino " -" Last Change: Thu Jan 12, 2012 10:34AM +" Last Change: Thu Feb 16, 2012 09:26AM "========================================================================== " Only do this when not yet done for this buffer @@ -58,7 +58,10 @@ function! UpdateOB(what) if g:rplugin_curview != a:what return endif - if exists("g:rplugin_curbuf") && g:rplugin_curbuf != "Object_Browser" && g:rplugin_editor_port == 0 + redir => s:bufl + silent buffers + redir END + if exists("g:rplugin_curbuf") && g:rplugin_curbuf != "Object_Browser" && g:rplugin_editor_port == 0 && s:bufl =~ "Object_Browser" let savesb = &switchbuf set switchbuf=useopen,usetab sil noautocmd sb Object_Browser diff --git a/r-plugin/common_buffer.vim b/r-plugin/common_buffer.vim index 97463b4..4615037 100644 --- a/r-plugin/common_buffer.vim +++ b/r-plugin/common_buffer.vim @@ -19,7 +19,7 @@ " " Based on previous work by Johannes Ranke " -" Last Change: Fri Jan 13, 2012 07:20AM +" Last Change: Thu Feb 16, 2012 09:48AM " " Please see doc/r-plugin.txt for usage details. "========================================================================== @@ -98,6 +98,11 @@ if g:vimrplugin_by_vim_instance == 1 unlet s:sname endif +if g:rplugin_firstbuffer == "" + " The file global_r_plugin.vim was copied to ~/.vim/plugin + let g:rplugin_firstbuffer = expand("%") + let g:rplugin_firstbuffer = substitute(g:rplugin_firstbuffer, " ", "", "") +endif if g:vimrplugin_screenplugin let s:uniquename = b:screensname . g:rplugin_firstbuffer diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 7988534..846a224 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -15,7 +15,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Mon Feb 13, 2012 10:04AM +" Last Change: Thu Feb 16, 2012 12:16PM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -2796,6 +2796,8 @@ let g:rplugin_objbr_port = 0 let g:rplugin_myport = 0 let g:rplugin_editor_port = 0 +call SetRPath() + " Debugging code: if g:vimrplugin_screenplugin && g:vimrplugin_conqueplugin echoerr "Error number 1" diff --git a/r-plugin/windows.py b/r-plugin/windows.py index 6afbd9d..37b1db1 100644 --- a/r-plugin/windows.py +++ b/r-plugin/windows.py @@ -82,9 +82,9 @@ def GetRPathPy(): vim.command("let s:rinstallpath = 'Not found'") def StartRPy(): - rpath = vim.eval("g:rplugin_Rgui") + rpath = vim.eval("b:rplugin_Rgui") rargs = ['"' + rpath + '"'] - r_args = vim.eval("g:rplugin_r_args") + r_args = vim.eval("b:rplugin_r_args") if r_args != " ": r_args = r_args.split(' ') i = 0 From 5c56da278bb7f00aaee378f6d9a13808c6fc921d Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 18 Feb 2012 18:35:42 -0300 Subject: [PATCH 0147/1050] Don't set 'comments' if called as global plugin. --- ftplugin/r.vim | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/ftplugin/r.vim b/ftplugin/r.vim index ba8b84b..302e711 100644 --- a/ftplugin/r.vim +++ b/ftplugin/r.vim @@ -19,7 +19,7 @@ " " Based on previous work by Johannes Ranke " -" Last Change: Mon Feb 13, 2012 08:57AM +" Last Change: Fri Feb 17, 2012 08:38AM " " Please see doc/r-plugin.txt for usage details. "========================================================================== @@ -35,8 +35,11 @@ let b:did_r_ftplugin = 1 let s:cpo_save = &cpo set cpo&vim -setlocal commentstring=#%s -setlocal comments=b:#,b:##,b:### +" Don't do this if called by ../r-plugin/global_r_plugin.vim +if &filetype == "r" + setlocal commentstring=#%s + setlocal comments=b:#,b:##,b:### +endif " Source scripts common to R, Rnoweb, Rhelp and rdoc files: runtime r-plugin/common_global.vim From 8ee2e24416c8beeb1ee24e6cf3a33fc090dcabb0 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 18 Feb 2012 18:37:50 -0300 Subject: [PATCH 0148/1050] VimCom is on CRAN now. --- doc/r-plugin.txt | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 6d49524..bbe0240 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -126,7 +126,7 @@ following dependencies: Vim >= 7.3 with Python support. Tmux >= 1.3: http://tmux.sourceforge.net Screen plugin: http://www.vim.org/scripts/script.php?script_id=2711 - vimcom: http://www.lepem.ufc.br/jaa/vimcom + vimcom: An R package. Recommends:~ ncurses-term: http://invisible-island.net/ncurses @@ -139,11 +139,12 @@ following dependencies: Unfortunately their installation instructions vary widely and are beyond the scope of this documentation. - The colorout package colorizes the R output and the setwidth package + The vimcom package creates a server on R to allow the communication with + Vim, the colorout package colorizes the R output and the setwidth package adjusts the value of options("width") whenever the terminal is resized. - Both can be installed from within R: + They can be installed from within R: > - install.packages(c("colorout", "setwidth")) + install.packages(c("vimcom", "colorout", "setwidth")) < The plugin will run R inside a Tmux session. If you are using Vim (not GVim), you may be interested in reading |r-plugin-tmux| section to learn a few useful From 7ff9b5b522a221fb5ab02f1068770a79ecbf6077 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 18 Feb 2012 19:30:13 -0300 Subject: [PATCH 0149/1050] Always use the correct R Tmux pane number. --- r-plugin/common_global.vim | 5 +++-- r-plugin/vimcom.py | 7 +++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 846a224..d904e33 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -15,7 +15,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Thu Feb 16, 2012 12:16PM +" Last Change: Sat Feb 18, 2012 07:18PM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -706,7 +706,7 @@ function StartObjectBrowser() \ 'let g:rplugin_myport2 = 5100', \ 'sleep 250m', \ 'function! RBrSendToR(cmd)', - \ ' let scmd = "tmux set-buffer '. "'" . '" . a:cmd . "\' . "'" . ' && tmux' . tmxs . 'paste-buffer -t %1"', + \ ' let scmd = "tmux set-buffer '. "'" . '" . a:cmd . "\' . "'" . ' && tmux' . tmxs . 'paste-buffer -t ' . g:rplugin_tmuxpane . '"', \ ' let rlog = system(scmd)', \ ' if v:shell_error', \ ' let rlog = substitute(rlog, "\n", " ", "g")', @@ -2795,6 +2795,7 @@ let g:rplugin_has_new_obj = 0 let g:rplugin_objbr_port = 0 let g:rplugin_myport = 0 let g:rplugin_editor_port = 0 +let g:rplugin_tmuxpane = '%1' call SetRPath() diff --git a/r-plugin/vimcom.py b/r-plugin/vimcom.py index 9ce7cf7..584fc55 100644 --- a/r-plugin/vimcom.py +++ b/r-plugin/vimcom.py @@ -11,7 +11,6 @@ th = None FinishNow = False - def DiscoverVimComPort(): global VimComPort HOST = "localhost" @@ -31,7 +30,11 @@ def DiscoverVimComPort(): try: sock.connect((HOST, VimComPort)) sock.send("\002What port?") - repl = sock.recv(1024) + xx = sock.recv(1024) + x = re.split("&", xx) + if len(x) == 2: + vim.command("let g:rplugin_tmuxpane = '" + x[1] + "'") + repl = x[0] except: pass sock.close() From 58fe698daa06e383d48eb8a79e377de0d3d314d2 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 18 Feb 2012 23:26:43 -0300 Subject: [PATCH 0150/1050] Create the Object Browser in the correct pane. --- r-plugin/common_global.vim | 45 ++++++++++++++++++++++++++++---------- r-plugin/vimcom.py | 2 +- 2 files changed, 35 insertions(+), 12 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index d904e33..0e80efe 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -15,7 +15,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Sat Feb 18, 2012 07:18PM +" Last Change: Sat Feb 18, 2012 11:19PM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -681,6 +681,25 @@ function StartObjectBrowser() else let tmxs = " " endif + + if !exists("g:rplugin_edpane") + let g:rplugin_edpane = $TMUX_PANE + if strlen(g:rplugin_edpane) == 0 + let g:rplugin_edpane = '%0' + endif + endif + + if !exists("g:rplugin_rpane") + Py SendToR("\002What port?") + let xx = g:rplugin_lastrpl + let xxx = split(xx, "&") + if len(xxx) == 2 + let g:rplugin_rpane = xxx[1] + else + let g:rplugin_rpane = '%1' + endif + endif + call writefile([ \ 'let b:objbrtitle = "' . b:objbrtitle . '"', \ 'let b:screensname = "' . b:screensname . '"', @@ -705,8 +724,9 @@ function StartObjectBrowser() \ 'let g:rplugin_myport1 = 5005', \ 'let g:rplugin_myport2 = 5100', \ 'sleep 250m', + \ 'call writefile([$TMUX_PANE], $VIMRPLUGIN_TMPDIR . "/objbrpane")', \ 'function! RBrSendToR(cmd)', - \ ' let scmd = "tmux set-buffer '. "'" . '" . a:cmd . "\' . "'" . ' && tmux' . tmxs . 'paste-buffer -t ' . g:rplugin_tmuxpane . '"', + \ ' let scmd = "tmux set-buffer '. "'" . '" . a:cmd . "\' . "'" . ' && tmux' . tmxs . 'paste-buffer -t ' . g:rplugin_rpane . '"', \ ' let rlog = system(scmd)', \ ' if v:shell_error', \ ' let rlog = substitute(rlog, "\n", " ", "g")', @@ -747,11 +767,10 @@ function StartObjectBrowser() let panewidth = g:vimrplugin_objbr_w endif if g:vimrplugin_objbr_place =~ "console" - let trgt = ' -t 1 ' + let cmd = "tmux split-window -d -h -l " . panewidth . " -t " . g:rplugin_rpane . ' "vim -c ' . "'source " . objbrowserfile . "'" . '"' else - let trgt = ' -t 0 ' + let cmd = "tmux split-window -d -h -l " . panewidth . " -t " . g:rplugin_edpane . ' "vim -c ' . "'source " . objbrowserfile . "'" . '"' endif - let cmd = "tmux split-window -d -h -l " . panewidth . trgt . '"vim -c ' . "'source " . objbrowserfile . "'" . '"' let rlog = system(cmd) if v:shell_error let rlog = substitute(rlog, '\n', ' ', 'g') @@ -760,11 +779,14 @@ function StartObjectBrowser() let g:rplugin_running_objbr = 0 return 0 endif + let xx = readfile($VIMRPLUGIN_TMPDIR . "/objbrpane") + let g:rplugin_obpane = xx[0] + if g:vimrplugin_objbr_place =~ "left" if g:vimrplugin_objbr_place =~ "console" - call system("tmux swap-pane -d -s 1 -t 2") + call system("tmux swap-pane -d -s " . g:rplugin_rpane . " -t " . g:rplugin_obpane) else - call system("tmux swap-pane -d -s 0 -t 1") + call system("tmux swap-pane -d -s " . g:rplugin_edpane . " -t " . g:rplugin_obpane) endif endif let ii = 0 @@ -1358,8 +1380,10 @@ function RQuit(how) endif sleep 250m - if g:vimrplugin_screenplugin && exists(':ScreenQuit') - ScreenQuit + if g:vimrplugin_screenplugin + if exists(':ScreenQuit') + ScreenQuit + endif elseif g:vimrplugin_conqueplugin sleep 200m exe "sil bdelete " . b:conque_bufname @@ -1711,7 +1735,7 @@ function RAction(rcmd) if (bufname("%") =~ "Object_Browser" || g:rplugin_editor_port) && g:rplugin_curview == "libraries" let pkg = RBGetPkgName() if g:rplugin_editor_port - call system("tmux select-pane -t 0") + call system("tmux select-pane -t " . g:rplugin_edpane) exe 'Py VimClient("EXPR call ShowRDoc(' . "'" . rkeyword . "', '" . pkg . "', 0)" . '")' else call ShowRDoc(rkeyword, pkg, 0) @@ -2795,7 +2819,6 @@ let g:rplugin_has_new_obj = 0 let g:rplugin_objbr_port = 0 let g:rplugin_myport = 0 let g:rplugin_editor_port = 0 -let g:rplugin_tmuxpane = '%1' call SetRPath() diff --git a/r-plugin/vimcom.py b/r-plugin/vimcom.py index 584fc55..2c6f7de 100644 --- a/r-plugin/vimcom.py +++ b/r-plugin/vimcom.py @@ -33,7 +33,7 @@ def DiscoverVimComPort(): xx = sock.recv(1024) x = re.split("&", xx) if len(x) == 2: - vim.command("let g:rplugin_tmuxpane = '" + x[1] + "'") + vim.command("let g:rplugin_rpane = '" + x[1] + "'") repl = x[0] except: pass From a714a32a910bc04194c22578981cdb9f366db01e Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Tue, 21 Feb 2012 00:19:08 -0300 Subject: [PATCH 0151/1050] Use the correct Tmux pane numbers. --- r-plugin/common_global.vim | 34 ++++++++++++++++++++-------------- r-plugin/vimcom.py | 6 +----- 2 files changed, 21 insertions(+), 19 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 0e80efe..9cef52c 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -15,7 +15,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Sat Feb 18, 2012 11:19PM +" Last Change: Mon Feb 20, 2012 11:49PM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -685,22 +685,21 @@ function StartObjectBrowser() if !exists("g:rplugin_edpane") let g:rplugin_edpane = $TMUX_PANE if strlen(g:rplugin_edpane) == 0 - let g:rplugin_edpane = '%0' + let g:rplugin_edpane = '0' endif endif - if !exists("g:rplugin_rpane") - Py SendToR("\002What port?") - let xx = g:rplugin_lastrpl - let xxx = split(xx, "&") - if len(xxx) == 2 - let g:rplugin_rpane = xxx[1] - else - let g:rplugin_rpane = '%1' - endif + let rcmd = 'writeLines(Sys.getenv("TMUX_PANE"), "' . $VIMRPLUGIN_TMPDIR . "/rpane" . '")' + exe "Py SendToR('" . rcmd . "')" + let xx = readfile($VIMRPLUGIN_TMPDIR . "/rpane") + let g:rplugin_rpane = xx[0] + if g:rplugin_rpane !~ "%[0-9]" + call RWarningMsg("R pane on Tmux undefined") + let g:rplugin_rpane = '1' endif call writefile([ + \ 'call writefile([$TMUX_PANE], $VIMRPLUGIN_TMPDIR . "/objbrpane")', \ 'let b:objbrtitle = "' . b:objbrtitle . '"', \ 'let b:screensname = "' . b:screensname . '"', \ 'let b:rscript_buffer = "' . bufname("%") . '"', @@ -724,7 +723,6 @@ function StartObjectBrowser() \ 'let g:rplugin_myport1 = 5005', \ 'let g:rplugin_myport2 = 5100', \ 'sleep 250m', - \ 'call writefile([$TMUX_PANE], $VIMRPLUGIN_TMPDIR . "/objbrpane")', \ 'function! RBrSendToR(cmd)', \ ' let scmd = "tmux set-buffer '. "'" . '" . a:cmd . "\' . "'" . ' && tmux' . tmxs . 'paste-buffer -t ' . g:rplugin_rpane . '"', \ ' let rlog = system(scmd)', @@ -771,6 +769,9 @@ function StartObjectBrowser() else let cmd = "tmux split-window -d -h -l " . panewidth . " -t " . g:rplugin_edpane . ' "vim -c ' . "'source " . objbrowserfile . "'" . '"' endif + + call delete($VIMRPLUGIN_TMPDIR . "/objbrpane") + let rlog = system(cmd) if v:shell_error let rlog = substitute(rlog, '\n', ' ', 'g') @@ -779,6 +780,12 @@ function StartObjectBrowser() let g:rplugin_running_objbr = 0 return 0 endif + + let ii = 0 + while !filereadable($VIMRPLUGIN_TMPDIR . "/objbrpane") + let ii = ii + 1 + sleep 50m + endwhile let xx = readfile($VIMRPLUGIN_TMPDIR . "/objbrpane") let g:rplugin_obpane = xx[0] @@ -1413,8 +1420,6 @@ function BuildROmniList(env, what) else let rtf = g:rplugin_omnifname endif - let lockfile = rtf . ".locked" - call writefile(["Wait!"], lockfile) let omnilistcmd = 'vim.bol("' . rtf . '"' if a:env == "libraries" && a:what == "installed" let omnilistcmd = omnilistcmd . ', what = "installed"' @@ -1428,6 +1433,7 @@ function BuildROmniList(env, what) if a:env == "GlobalEnv" let g:rplugin_globalenvlines = readfile(g:rplugin_globalenvfname) endif + echon endfunction function RBuildSyntaxFile(what) diff --git a/r-plugin/vimcom.py b/r-plugin/vimcom.py index 2c6f7de..7f7846c 100644 --- a/r-plugin/vimcom.py +++ b/r-plugin/vimcom.py @@ -30,11 +30,7 @@ def DiscoverVimComPort(): try: sock.connect((HOST, VimComPort)) sock.send("\002What port?") - xx = sock.recv(1024) - x = re.split("&", xx) - if len(x) == 2: - vim.command("let g:rplugin_rpane = '" + x[1] + "'") - repl = x[0] + repl = sock.recv(1024) except: pass sock.close() From b11335d07ed4d8174a43550f2f3a5688aae6f5f8 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Tue, 21 Feb 2012 17:46:54 -0300 Subject: [PATCH 0152/1050] Updated. --- doc/r-plugin.txt | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index bbe0240..0c6f6f8 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -145,6 +145,15 @@ following dependencies: They can be installed from within R: > install.packages(c("vimcom", "colorout", "setwidth")) +< + You certainly will want to put something like the following in your + ~/.Rprofile: +> + if(interactive()){ + library(colorout) + library(setwidth) + library(vimcom) + } < The plugin will run R inside a Tmux session. If you are using Vim (not GVim), you may be interested in reading |r-plugin-tmux| section to learn a few useful @@ -1588,6 +1597,7 @@ two options and some others: if(interactive()){ library(colorout) library(setwidth) + library(vimcom) if(nchar(Sys.getenv("DISPLAY")) > 1){ grDevices::X11.options(width = 4.5, height = 4, ypos = 0, xpos = 1000, pointsize = 10) @@ -1754,7 +1764,7 @@ the R syntax highlighted. *r-plugin-news* 10. News~ -0.9.8 (2012-02-16) +0.9.8 (2012-02-21) * Use the R package vimcom. The following options are now set on the vimcom R package and no longer in the Vim-R-plugin: allnames, open_df, and From 74423a495db79d65e6e4c7ace69fba73a463f591 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Tue, 21 Feb 2012 17:47:13 -0300 Subject: [PATCH 0153/1050] Kill object browser pane while quiting R. --- r-plugin/common_global.vim | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 9cef52c..df001f9 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -15,7 +15,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Mon Feb 20, 2012 11:49PM +" Last Change: Tue Feb 21, 2012 03:54PM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -1368,7 +1368,6 @@ function RQuit(how) Py VimClient("FINISH") sleep 200m Py OtherPort = 0 - let g:rplugin_objbr_port = 0 endif if g:rplugin_myport Py StopServer() @@ -1387,6 +1386,12 @@ function RQuit(how) endif sleep 250m + if g:rplugin_objbr_port + call system("tmux kill-pane -t " . g:rplugin_obpane) + let g:rplugin_objbr_port = 0 + sleep 250m + endif + if g:vimrplugin_screenplugin if exists(':ScreenQuit') ScreenQuit From 4a7b3afe77e1b527521aa82ca5604ae188de9a6d Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Tue, 21 Feb 2012 18:57:30 -0300 Subject: [PATCH 0154/1050] Avoid error in some circumstances. --- r-plugin/vimcom.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/r-plugin/vimcom.py b/r-plugin/vimcom.py index 7f7846c..4635cce 100644 --- a/r-plugin/vimcom.py +++ b/r-plugin/vimcom.py @@ -135,8 +135,11 @@ def VimServer(): pass sock.close() if FinishNow == False: - sock = socket.socket( socket.AF_INET, socket.SOCK_DGRAM ) - sock.bind( (UDP_IP,MyPort) ) + try: + sock = socket.socket( socket.AF_INET, socket.SOCK_DGRAM ) + sock.bind( (UDP_IP,MyPort) ) + except: + pass def RunServer(): global th From 19923730c2b3ee7fbd44c15ca5e46501273c5a91 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Wed, 22 Feb 2012 10:55:36 -0300 Subject: [PATCH 0155/1050] Wait 180 seconds or until vim.bol() finishes. --- doc/r-plugin.txt | 2 +- r-plugin/common_global.vim | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 0c6f6f8..951cd5e 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -995,7 +995,7 @@ the SDI style of the graphical user interface. 6.9. Time necessary to build list of objects for omni completion~ *vimrplugin_buildwait* -If your system needs more than 120 seconds to build the list of objects for +If your system needs more than 180 seconds to build the list of objects for omni completion after you do the command |:RUpdateObjList|, then you should set the value of |vimrplugin_buildwait| to a higher value. Example: > diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index df001f9..24186cb 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -15,7 +15,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Tue Feb 21, 2012 03:54PM +" Last Change: Wed Feb 22, 2012 10:48AM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -1433,7 +1433,20 @@ function BuildROmniList(env, what) let omnilistcmd = omnilistcmd . ', allnames = TRUE' endif let omnilistcmd = omnilistcmd . ')' + + call delete($VIMRPLUGIN_TMPDIR . "/vimbol_finished") + echohl WarningMsg + echo "Please, wait..." + echohl Normal exe "Py SendToR('" . omnilistcmd . "')" + sleep 2 + let ii = 0 + while !filereadable($VIMRPLUGIN_TMPDIR . "/vimbol_finished") && ii < g:vimrplugin_buildwait + let ii += 1 + sleep + endwhile + call SendCmdToR(' ') + echon "\r " if a:env == "GlobalEnv" let g:rplugin_globalenvlines = readfile(g:rplugin_globalenvfname) @@ -2451,7 +2464,7 @@ call RSetDefaultValue("g:vimrplugin_routnotab", 0) call RSetDefaultValue("g:vimrplugin_editor_w", 66) call RSetDefaultValue("g:vimrplugin_help_w", 46) call RSetDefaultValue("g:vimrplugin_objbr_w", 40) -call RSetDefaultValue("g:vimrplugin_buildwait", 120) +call RSetDefaultValue("g:vimrplugin_buildwait", 180) call RSetDefaultValue("g:vimrplugin_indent_commented", 1) call RSetDefaultValue("g:vimrplugin_by_vim_instance", 0) call RSetDefaultValue("g:vimrplugin_never_unmake_menu", 0) From 74d1a520312f700b6a3fc9f9cae31691174d9936 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Mon, 27 Feb 2012 10:25:41 -0300 Subject: [PATCH 0156/1050] Delete slashes from $VIMINSTANCEID. --- r-plugin/common_buffer.vim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/r-plugin/common_buffer.vim b/r-plugin/common_buffer.vim index 4615037..02178fa 100644 --- a/r-plugin/common_buffer.vim +++ b/r-plugin/common_buffer.vim @@ -19,7 +19,7 @@ " " Based on previous work by Johannes Ranke " -" Last Change: Thu Feb 16, 2012 09:48AM +" Last Change: Mon Feb 27, 2012 10:24AM " " Please see doc/r-plugin.txt for usage details. "========================================================================== @@ -109,6 +109,7 @@ if g:vimrplugin_screenplugin else let s:uniquename = b:screensname endif +let s:uniquename = substitute(s:uniquename, '/', '', 'g') let $VIMINSTANCEID = $VIMRPLUGIN_TMPDIR . "/" . s:uniquename . "-port" unlet s:uniquename From 69d020e7c9b64684c66ca1524e57d8db12e9ebc2 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Mon, 27 Feb 2012 10:33:25 -0300 Subject: [PATCH 0157/1050] Delete all non word character from buffer name. --- r-plugin/common_buffer.vim | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/r-plugin/common_buffer.vim b/r-plugin/common_buffer.vim index 02178fa..990e279 100644 --- a/r-plugin/common_buffer.vim +++ b/r-plugin/common_buffer.vim @@ -19,7 +19,7 @@ " " Based on previous work by Johannes Ranke " -" Last Change: Mon Feb 27, 2012 10:24AM +" Last Change: Mon Feb 27, 2012 10:32AM " " Please see doc/r-plugin.txt for usage details. "========================================================================== @@ -101,7 +101,6 @@ endif if g:rplugin_firstbuffer == "" " The file global_r_plugin.vim was copied to ~/.vim/plugin let g:rplugin_firstbuffer = expand("%") - let g:rplugin_firstbuffer = substitute(g:rplugin_firstbuffer, " ", "", "") endif if g:vimrplugin_screenplugin @@ -109,7 +108,7 @@ if g:vimrplugin_screenplugin else let s:uniquename = b:screensname endif -let s:uniquename = substitute(s:uniquename, '/', '', 'g') +let s:uniquename = substitute(s:uniquename, '\W', '', 'g') let $VIMINSTANCEID = $VIMRPLUGIN_TMPDIR . "/" . s:uniquename . "-port" unlet s:uniquename From f50e5e12aba059a62da6af4f2e411651690d91f5 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Mon, 27 Feb 2012 10:38:00 -0300 Subject: [PATCH 0158/1050] Use SendCmdToR to build the omni list. --- r-plugin/common_global.vim | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 24186cb..eba7072 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -15,7 +15,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Wed Feb 22, 2012 10:48AM +" Last Change: Mon Feb 27, 2012 10:37AM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -1438,14 +1438,13 @@ function BuildROmniList(env, what) echohl WarningMsg echo "Please, wait..." echohl Normal - exe "Py SendToR('" . omnilistcmd . "')" + call SendCmdToR(omnilistcmd) sleep 2 let ii = 0 while !filereadable($VIMRPLUGIN_TMPDIR . "/vimbol_finished") && ii < g:vimrplugin_buildwait let ii += 1 sleep endwhile - call SendCmdToR(' ') echon "\r " if a:env == "GlobalEnv" @@ -2836,7 +2835,6 @@ if has("gui_running") endif let g:rplugin_firstbuffer = expand("%") -let g:rplugin_firstbuffer = substitute(g:rplugin_firstbuffer, " ", "", "") let g:rplugin_running_objbr = 0 let g:rplugin_has_new_lib = 0 let g:rplugin_has_new_obj = 0 From 9f25d23053c91bb2df4486dea47f6d6763002758 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Mon, 27 Feb 2012 10:49:15 -0300 Subject: [PATCH 0159/1050] Treat @ like $. --- syntax/r.vim | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/syntax/r.vim b/syntax/r.vim index 8912ba1..865be21 100644 --- a/syntax/r.vim +++ b/syntax/r.vim @@ -3,7 +3,7 @@ " Maintainer: Jakson Aquino " Former Maintainers: Vaidotas Zemlys " Tom Payne -" Last Change: Sun Feb 20, 2011 12:06PM +" Last Change: Mon Feb 27, 2012 10:45AM " Filenames: *.R *.r *.Rhistory *.Rt " " NOTE: The highlighting of R functions is defined in the @@ -105,7 +105,7 @@ syn match rOperator '-' syn match rOperator '*' syn match rOperator '+' syn match rOperator '=' -syn match rOperator "[|!<>^~`/:@]" +syn match rOperator "[|!<>^~`/:]" syn match rOperator "%\{2}\|%\*%\|%\/%\|%in%\|%o%\|%x%" syn match rOpError '*\{3}' syn match rOpError '//' @@ -141,9 +141,11 @@ syn match rParenError "[\]}]" contained runtime r-plugin/functions.vim syn match rDollar display contained "\$" +syn match rDollar display contained "@" " List elements will not be highlighted as functions: syn match rLstElmt "\$[a-zA-Z0-9\\._]*" contains=rDollar +syn match rLstElmt "@[a-zA-Z0-9\\._]*" contains=rDollar " Functions that may add new objects syn keyword rPreProc library require attach detach source From c61af79ed1e38582bac1616e94d46cb0ddeb6124 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Mon, 27 Feb 2012 12:05:11 -0300 Subject: [PATCH 0160/1050] Wait until the file is written by R. --- r-plugin/common_global.vim | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index eba7072..52880af 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -15,7 +15,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Mon Feb 27, 2012 10:37AM +" Last Change: Mon Feb 27, 2012 12:03PM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -691,6 +691,11 @@ function StartObjectBrowser() let rcmd = 'writeLines(Sys.getenv("TMUX_PANE"), "' . $VIMRPLUGIN_TMPDIR . "/rpane" . '")' exe "Py SendToR('" . rcmd . "')" + let ii = 0 + while !filereadable($VIMRPLUGIN_TMPDIR . "/rpane") && ii < 20 + let ii = ii + 1 + sleep 50m + endwhile let xx = readfile($VIMRPLUGIN_TMPDIR . "/rpane") let g:rplugin_rpane = xx[0] if g:rplugin_rpane !~ "%[0-9]" @@ -782,7 +787,7 @@ function StartObjectBrowser() endif let ii = 0 - while !filereadable($VIMRPLUGIN_TMPDIR . "/objbrpane") + while !filereadable($VIMRPLUGIN_TMPDIR . "/objbrpane") && ii < 20 let ii = ii + 1 sleep 50m endwhile From 808e083bd4bd8195c4a23990e35895e69c61609a Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Mon, 27 Feb 2012 12:25:13 -0300 Subject: [PATCH 0161/1050] Warn if VimCom is not working. --- r-plugin/common_global.vim | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 52880af..2c234f9 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -15,7 +15,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Mon Feb 27, 2012 12:03PM +" Last Change: Mon Feb 27, 2012 12:24PM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -696,6 +696,10 @@ function StartObjectBrowser() let ii = ii + 1 sleep 50m endwhile + if ii == 20 + call RWarningMsg("Communication Vim-R through VimCom failed [rpane].") + return + endif let xx = readfile($VIMRPLUGIN_TMPDIR . "/rpane") let g:rplugin_rpane = xx[0] if g:rplugin_rpane !~ "%[0-9]" @@ -791,6 +795,10 @@ function StartObjectBrowser() let ii = ii + 1 sleep 50m endwhile + if ii == 20 + call RWarningMsg("Communication Vim-R through VimCom failed [objbrpane].") + return + endif let xx = readfile($VIMRPLUGIN_TMPDIR . "/objbrpane") let g:rplugin_obpane = xx[0] From e8724b990b09c6e1e998b30a20458a92d6211e1f Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Mon, 27 Feb 2012 12:46:47 -0300 Subject: [PATCH 0162/1050] Use full file path on $VIMINSTANCEID. --- r-plugin/common_buffer.vim | 4 ++-- r-plugin/common_global.vim | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/r-plugin/common_buffer.vim b/r-plugin/common_buffer.vim index 990e279..1f4cdd9 100644 --- a/r-plugin/common_buffer.vim +++ b/r-plugin/common_buffer.vim @@ -19,7 +19,7 @@ " " Based on previous work by Johannes Ranke " -" Last Change: Mon Feb 27, 2012 10:32AM +" Last Change: Mon Feb 27, 2012 12:45PM " " Please see doc/r-plugin.txt for usage details. "========================================================================== @@ -100,7 +100,7 @@ endif if g:rplugin_firstbuffer == "" " The file global_r_plugin.vim was copied to ~/.vim/plugin - let g:rplugin_firstbuffer = expand("%") + let g:rplugin_firstbuffer = expand("%:p") endif if g:vimrplugin_screenplugin diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 2c234f9..5d9aa18 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -15,7 +15,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Mon Feb 27, 2012 12:24PM +" Last Change: Mon Feb 27, 2012 12:45PM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -2847,7 +2847,7 @@ if has("gui_running") augroup END endif -let g:rplugin_firstbuffer = expand("%") +let g:rplugin_firstbuffer = expand("%:p") let g:rplugin_running_objbr = 0 let g:rplugin_has_new_lib = 0 let g:rplugin_has_new_obj = 0 From 38f22ca4a6bf6f80813b153503e8b4931d569db3 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Wed, 29 Feb 2012 23:07:57 -0300 Subject: [PATCH 0163/1050] Add :Rhelp command. --- doc/r-plugin.txt | 13 +++++++++++- r-plugin/common_global.vim | 42 ++++++++++++++++++++++++++++++++++++-- 2 files changed, 52 insertions(+), 3 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 951cd5e..ad1b52f 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -412,7 +412,7 @@ Object Browser ----------------------------------------------------------- Help (plugin) -Help (R) +Help (R) :Rhelp ----------------------------------------------------------- Please see |r-plugin-key-bindings| to learn how to customize the key bindings @@ -456,6 +456,16 @@ backward (see |popupmenu-completion|). Note: if using Vim in a terminal emulator, Tmux will capture the CTRL-A command. You have to do CTRL-A twice to pass a single CTRL-A to Vim. +To get help on an R topic, type in Vim (Normal mode): +> + :Rhelp topic +< +The command may be abbreviated to :Rh and you can both press to +trigger the autocompletion of R objects names or hit CTRL-D to list the +possible completions (see |cmdline-completion| for details on the various ways +of getting command-line completion). The list of objects used for +autocompletion is the same one built by |:RUpdateObjList|. + 4.2. Edition of rnoweb files~ @@ -1770,6 +1780,7 @@ the R syntax highlighted. package and no longer in the Vim-R-plugin: allnames, open_df, and open_list. * Automatic update of the Object Browser when running R in a Tmux session. + * New command :Rhelp (thanks for Nir Atias for suggesting the new feature). 0.9.7 (2012-02-12) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 5d9aa18..e326609 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -15,7 +15,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Mon Feb 27, 2012 12:45PM +" Last Change: Wed Feb 29, 2012 10:49PM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -1470,6 +1470,7 @@ function RBuildSyntaxFile(what) call BuildROmniList("libraries", a:what) sleep 1 let g:rplugin_liblist = readfile(g:rplugin_omnifname) + call BuildRHelpList() let res = [] let nf = 0 let funlist = "" @@ -1745,6 +1746,41 @@ function ShowRDoc(rkeyword, package, getclass) setlocal nomodifiable endfunction +function BuildRHelpList() + if !exists("s:list_of_objs") + let s:list_of_objs = [] + endif + for xx in g:rplugin_liblist + let xxx = split(xx, ";") + if xxx[0] !~ '\$' + call add(s:list_of_objs, xxx[0]) + endif + endfor +endfunction + +function RLisObjs(arglead, cmdline, curpos) + let lob = [] + let rkeyword = '^' . a:arglead + for xx in s:list_of_objs + if xx =~ rkeyword + call add(lob, xx) + endif + endfor + return lob +endfunction + +function RAskHelp(...) + if a:1 == "" + call SendCmdToR("help.start()") + return + endif + if g:vimrplugin_vimpager != "no" + call ShowRDoc(a:1, "", 0) + else + call SendCmdToR("help(" . a:1. ")") + endif +endfunction + function PrintRObject(rkeyword) if bufname("%") =~ "Object_Browser" let classfor = "" @@ -2203,7 +2239,7 @@ function MakeRMenu() amenu R.Help\ (plugin).FAQ\ and\ tips.Jump\ to\ function\ definitions :help r-plugin-tagsfile amenu R.Help\ (plugin).News :help r-plugin-news - amenu R.Help\ (R) :call SendCmdToR("help.start()") + amenu R.Help\ (R):Rhelp :call SendCmdToR("help.start()") let g:rplugin_hasmenu = 1 "---------------------------------------------------------------------------- @@ -2401,6 +2437,7 @@ endfunction command RUpdateObjList :call RBuildSyntaxFile("loaded") command RUpdateObjListAll :call RBuildSyntaxFile("installed") command RBuildTags :call SendCmdToR('rtags(ofile = "TAGS")') +command -nargs=? -complete=customlist,RLisObjs Rhelp :call RAskHelp() "========================================================================== " Global variables @@ -2754,6 +2791,7 @@ endif " Keeps the libraries object list in memory to avoid the need of reading the file " repeatedly: let g:rplugin_liblist = readfile(g:rplugin_omnifname) +call BuildRHelpList() " Control the menu 'R' and the tool bar buttons From a928a629fd220cd581439fea7c4120a78af491a8 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 1 Mar 2012 11:04:45 -0300 Subject: [PATCH 0164/1050] Accept strings surrounded by single quotes. --- r-plugin/common_global.vim | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index e326609..5bae2b7 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -15,7 +15,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Wed Feb 29, 2012 10:49PM +" Last Change: Thu Mar 01, 2012 11:03AM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -1614,6 +1614,10 @@ function RGetClassFor(rkeyword) let classfor = substitute(classfor, ' .*', '', "") endif endif + if classfor =~ "^'" && classfor =~ "'$" + let classfor = substitute(classfor, "^'", '"', "") + let classfor = substitute(classfor, "'$", '"', "") + endif return classfor endfunction From 04b432332a8cb07d7c22783b4b3ecc828f36ce7c Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Fri, 2 Mar 2012 10:40:10 -0300 Subject: [PATCH 0165/1050] Add code for use in the future. --- ftplugin/rbrowser.vim | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/ftplugin/rbrowser.vim b/ftplugin/rbrowser.vim index b789888..54799d9 100644 --- a/ftplugin/rbrowser.vim +++ b/ftplugin/rbrowser.vim @@ -16,7 +16,7 @@ " " Author: Jakson Alves de Aquino " -" Last Change: Thu Feb 16, 2012 09:26AM +" Last Change: Fri Mar 02, 2012 10:40AM "========================================================================== " Only do this when not yet done for this buffer @@ -39,7 +39,7 @@ runtime r-plugin/common_global.vim runtime r-plugin/common_buffer.vim setlocal noswapfile -set buftype=nofile +setlocal buftype=nofile setlocal nowrap if !exists("g:rplugin_hasmenu") @@ -357,6 +357,29 @@ else endif unlet s:envstring +function RBrowserUpdate() + if g:rplugin_whatupdate == "G" + call UpdateOB('GlobalEnv') + let g:rplugin_whatupdate = "N" + elseif g:rplugin_whatupdate == "L" + call UpdateOB('libraries') + let g:rplugin_whatupdate = "N" + elseif g:rplugin_whatupdate == "B" + call UpdateOB('GlobalEnv') + call UpdateOB('libraries') + let g:rplugin_whatupdate = "N" + endif +endfunction + +let g:rplugin_whatupdate = "N" +if g:vimrplugin_screenplugin + set updatetime=50 + " The function VimServer() in vimcom.py should only set the value of + " rplugin_whatupdate instead of calling UpdateOB(). However, the procedure + " would not work because CursorHold is not retriggered + "autocmd CursorHold call RBrowserUpdate() +endif + let &cpo = s:cpo_save unlet s:cpo_save From 99aac8695d25e778195c1fed5f94c5c9a03d38ef Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Fri, 2 Mar 2012 11:58:04 -0300 Subject: [PATCH 0166/1050] Delete duplicated redraw command. --- r-plugin/common_global.vim | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 5bae2b7..5a781c2 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -15,7 +15,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Thu Mar 01, 2012 11:03AM +" Last Change: Fri Mar 02, 2012 11:55AM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -912,7 +912,6 @@ function RObjBrowserOCLists(status) call RBrowserOpenCloseLists(a:status) elseif g:rplugin_objbr_port exe 'Py VimClient("EXPR call RBrowserOpenCloseLists('. "'" . a:status . "')" . '")' - Py VimClient("EXPR silent :redraw:echon ' '") endif endfunction From 8a97dd04d339034a41944c18dd04d4e8aa0c7a31 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Fri, 2 Mar 2012 14:09:10 -0300 Subject: [PATCH 0167/1050] Correctly open R doc from Object Browser. --- r-plugin/common_global.vim | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 5a781c2..3b0df0b 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -15,7 +15,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Fri Mar 02, 2012 11:55AM +" Last Change: Fri Mar 02, 2012 01:55PM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -728,6 +728,7 @@ function StartObjectBrowser() \ 'Py SendToR("\004Libraries")', \ 'call UpdateOB("GlobalEnv")', \ 'let g:rplugin_editor_port = ' . g:rplugin_myport , + \ 'let g:rplugin_edpane = "' . g:rplugin_edpane . '"', \ 'Py OtherPort = ' . g:rplugin_myport , \ 'let g:rplugin_myport1 = 5005', \ 'let g:rplugin_myport2 = 5100', @@ -1747,6 +1748,7 @@ function ShowRDoc(rkeyword, package, getclass) normal! ggdd setlocal nomodified setlocal nomodifiable + redraw endfunction function BuildRHelpList() @@ -1806,20 +1808,24 @@ function RAction(rcmd) endif if strlen(rkeyword) > 0 if a:rcmd == "help" - if g:vimrplugin_vimpager != "no" - if (bufname("%") =~ "Object_Browser" || g:rplugin_editor_port) && g:rplugin_curview == "libraries" - let pkg = RBGetPkgName() + if g:vimrplugin_vimpager == "no" + call SendCmdToR("help(" . rkeyword . ")") + else + if (bufname("%") =~ "Object_Browser" || g:rplugin_editor_port) + if g:rplugin_curview == "libraries" + let pkg = RBGetPkgName() + else + let pkg = "" + endif if g:rplugin_editor_port call system("tmux select-pane -t " . g:rplugin_edpane) - exe 'Py VimClient("EXPR call ShowRDoc(' . "'" . rkeyword . "', '" . pkg . "', 0)" . '")' + exe "Py VimClient('EXPR call ShowRDoc(" . '"' . rkeyword . '", "' . pkg . '", 0)' . "')" else call ShowRDoc(rkeyword, pkg, 0) endif return endif call ShowRDoc(rkeyword, "", 1) - else - call SendCmdToR("help(" . rkeyword . ")") endif return endif From aee69f15893d2d3b01e57c72e4e9312cab9830bf Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sun, 4 Mar 2012 20:01:33 -0300 Subject: [PATCH 0168/1050] Improve error handling when R fail to eval expr. --- r-plugin/common_global.vim | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 3b0df0b..fbf5f3a 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -15,7 +15,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Fri Mar 02, 2012 01:55PM +" Last Change: Sun Mar 04, 2012 08:01PM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -697,11 +697,14 @@ function StartObjectBrowser() sleep 50m endwhile if ii == 20 - call RWarningMsg("Communication Vim-R through VimCom failed [rpane].") - return + call RWarningMsg("R did not save its Tmux pane. The Object Browser may not work well.") + endif + if filereadable($VIMRPLUGIN_TMPDIR . "/rpane") + let xx = readfile($VIMRPLUGIN_TMPDIR . "/rpane") + let g:rplugin_rpane = xx[0] + else + let g:rplugin_rpane = '1' endif - let xx = readfile($VIMRPLUGIN_TMPDIR . "/rpane") - let g:rplugin_rpane = xx[0] if g:rplugin_rpane !~ "%[0-9]" call RWarningMsg("R pane on Tmux undefined") let g:rplugin_rpane = '1' @@ -1663,7 +1666,7 @@ function ShowRDoc(rkeyword, package, getclass) call SetRTextWidth() - let g:rplugin_lastrpl = "" + let g:rplugin_lastrpl = "R did not reply." if classfor == "" && a:package == "" exe 'Py SendToR("vim.help(' . "'" . a:rkeyword . "', " . g:rplugin_htw . 'L)")' elseif a:package != "" From c8a821d2de959d8e1498eb5be498ce674e84ca8e Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sun, 4 Mar 2012 23:19:40 -0300 Subject: [PATCH 0169/1050] Check if Object Browser exists before killing it. --- r-plugin/common_global.vim | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index fbf5f3a..b5c2c2e 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -15,7 +15,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Sun Mar 04, 2012 08:01PM +" Last Change: Sun Mar 04, 2012 11:14PM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -1403,7 +1403,12 @@ function RQuit(how) sleep 250m if g:rplugin_objbr_port - call system("tmux kill-pane -t " . g:rplugin_obpane) + " check if the pane still exists before trying to kill it because the + " user may have already closed the Object Browser manually. + let panw = system("tmux list-panes | cat") + if panw =~ g:rplugin_obpane + call system("tmux kill-pane -t " . g:rplugin_obpane) + endif let g:rplugin_objbr_port = 0 sleep 250m endif @@ -1821,8 +1826,8 @@ function RAction(rcmd) let pkg = "" endif if g:rplugin_editor_port - call system("tmux select-pane -t " . g:rplugin_edpane) exe "Py VimClient('EXPR call ShowRDoc(" . '"' . rkeyword . '", "' . pkg . '", 0)' . "')" + call system("tmux select-pane -t " . g:rplugin_edpane) else call ShowRDoc(rkeyword, pkg, 0) endif From bc12071c36030bc4a4ee097ba7b76e138fa84402 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Mon, 5 Mar 2012 08:48:43 -0300 Subject: [PATCH 0170/1050] Stop if the Tmux pane number is invalid. --- r-plugin/common_global.vim | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index b5c2c2e..15c8d04 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -15,7 +15,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Sun Mar 04, 2012 11:14PM +" Last Change: Mon Mar 05, 2012 08:46AM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -685,10 +685,12 @@ function StartObjectBrowser() if !exists("g:rplugin_edpane") let g:rplugin_edpane = $TMUX_PANE if strlen(g:rplugin_edpane) == 0 - let g:rplugin_edpane = '0' + echoer "Could not find the environment variable TMUX_PANE." + return endif endif + call delete($VIMRPLUGIN_TMPDIR . "/rpane") let rcmd = 'writeLines(Sys.getenv("TMUX_PANE"), "' . $VIMRPLUGIN_TMPDIR . "/rpane" . '")' exe "Py SendToR('" . rcmd . "')" let ii = 0 @@ -696,18 +698,16 @@ function StartObjectBrowser() let ii = ii + 1 sleep 50m endwhile - if ii == 20 - call RWarningMsg("R did not save its Tmux pane. The Object Browser may not work well.") - endif - if filereadable($VIMRPLUGIN_TMPDIR . "/rpane") - let xx = readfile($VIMRPLUGIN_TMPDIR . "/rpane") - let g:rplugin_rpane = xx[0] - else - let g:rplugin_rpane = '1' + if !filereadable($VIMRPLUGIN_TMPDIR . "/rpane") + echoer "The number of the R Tmux pane is unknown." + return endif + let xx = readfile($VIMRPLUGIN_TMPDIR . "/rpane") + let g:rplugin_rpane = xx[0] if g:rplugin_rpane !~ "%[0-9]" - call RWarningMsg("R pane on Tmux undefined") - let g:rplugin_rpane = '1' + echoer 'The number of the R Tmux pane is invalid: "' . g:rplugin_rpane . '"' + unlet g:rplugin_rpane + return endif call writefile([ @@ -799,12 +799,17 @@ function StartObjectBrowser() let ii = ii + 1 sleep 50m endwhile - if ii == 20 - call RWarningMsg("Communication Vim-R through VimCom failed [objbrpane].") + if !filereadable($VIMRPLUGIN_TMPDIR . "/objbrpane") + echoer "The Tmux pane number of the Object Browser is unknown." return endif let xx = readfile($VIMRPLUGIN_TMPDIR . "/objbrpane") let g:rplugin_obpane = xx[0] + if g:rplugin_obpane !~ "%[0-9]" + echoer 'The number of the Object Browser Tmux pane is invalid: "' . g:rplugin_obpane . '"' + unlet g:rplugin_obpane + return + endif if g:vimrplugin_objbr_place =~ "left" if g:vimrplugin_objbr_place =~ "console" @@ -1405,8 +1410,8 @@ function RQuit(how) if g:rplugin_objbr_port " check if the pane still exists before trying to kill it because the " user may have already closed the Object Browser manually. - let panw = system("tmux list-panes | cat") - if panw =~ g:rplugin_obpane + let plst = system("tmux list-panes | cat") + if plst =~ g:rplugin_obpane call system("tmux kill-pane -t " . g:rplugin_obpane) endif let g:rplugin_objbr_port = 0 From 113d5096f64b14a080ab51a79913f57c17ce4b1e Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Mon, 5 Mar 2012 19:39:21 -0300 Subject: [PATCH 0171/1050] Show error messages on server failure. --- r-plugin/vimcom.py | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/r-plugin/vimcom.py b/r-plugin/vimcom.py index 4635cce..7497bf8 100644 --- a/r-plugin/vimcom.py +++ b/r-plugin/vimcom.py @@ -97,7 +97,7 @@ def VimServer(): try: data, addr = sock.recvfrom( 1024 ) # buffer size is 1024 bytes if re.match("EXPR ", data): - vim.command("exe '" + re.sub("^EXPR ", "", data) + "'") + vim.command("silent exe '" + re.sub("^EXPR ", "", data) + "'") else: if re.match("^G", data): vim.command("call UpdateOB('GlobalEnv')") @@ -109,19 +109,16 @@ def VimServer(): vim.command("call UpdateOB('GlobalEnv')") vim.command("call UpdateOB('libraries')") else: - try: - sock.shutdown(socket.SHUT_RD) - except: - pass - try: - sock.close() - except: - pass if re.match("^FINISH", data): FinishNow = True MyPort = 0 + else: + if data != "": + vim.command("call RWarningMsg('Strange string received: " + '"' + data + '"' + "')") + vim.command("sleep 1") - except: + except Exception as errmsg: + vim.command("call RWarningMsg('Server failed to read data: " + str(errmsg) + "')") MyPort = 0 try: sock.shutdown(socket.SHUT_RD) @@ -138,7 +135,8 @@ def VimServer(): try: sock = socket.socket( socket.AF_INET, socket.SOCK_DGRAM ) sock.bind( (UDP_IP,MyPort) ) - except: + except Exception as errmsg: + vim.command("call RWarningMsg('Server reactivation failed: " + str(errmsg) + "')") pass def RunServer(): From 6340a4a7a3d328801b04046a8442474fbf8a92cf Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Wed, 7 Mar 2012 11:24:49 -0300 Subject: [PATCH 0172/1050] Object Browser calls help() on R Console. --- r-plugin/common_global.vim | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 15c8d04..9639f35 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -15,7 +15,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Mon Mar 05, 2012 08:46AM +" Last Change: Wed Mar 07, 2012 11:24AM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -732,6 +732,7 @@ function StartObjectBrowser() \ 'call UpdateOB("GlobalEnv")', \ 'let g:rplugin_editor_port = ' . g:rplugin_myport , \ 'let g:rplugin_edpane = "' . g:rplugin_edpane . '"', + \ 'let g:rplugin_rpane = "' . g:rplugin_rpane . '"', \ 'Py OtherPort = ' . g:rplugin_myport , \ 'let g:rplugin_myport1 = 5005', \ 'let g:rplugin_myport2 = 5100', @@ -1831,8 +1832,13 @@ function RAction(rcmd) let pkg = "" endif if g:rplugin_editor_port - exe "Py VimClient('EXPR call ShowRDoc(" . '"' . rkeyword . '", "' . pkg . '", 0)' . "')" - call system("tmux select-pane -t " . g:rplugin_edpane) + let hlog = system("tmux select-pane -t " . g:rplugin_rpane . " && tmux set-buffer 'help(" . '"' . rkeyword . '", ' . '"' . pkg . '")' . "\' && tmux paste-buffer -t " . g:rplugin_rpane) + if v:shell_error + let hlog = substitute(hlog, "\n", " ", "g") + let hlog = substitute(hlog, "\r", " ", "g") + call RWarningMsg(hlog) + return 0', + endif', else call ShowRDoc(rkeyword, pkg, 0) endif From 7fa3f757c5fc3a22add4ee3ee23b19d7ee3dfcfa Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 8 Mar 2012 08:31:43 -0300 Subject: [PATCH 0173/1050] Open/close lists in libraries. --- ftplugin/rbrowser.vim | 42 +++++----------------- r-plugin/common_global.vim | 72 +++++++++++++++++++++++--------------- 2 files changed, 51 insertions(+), 63 deletions(-) diff --git a/ftplugin/rbrowser.vim b/ftplugin/rbrowser.vim index 54799d9..b06d007 100644 --- a/ftplugin/rbrowser.vim +++ b/ftplugin/rbrowser.vim @@ -16,7 +16,7 @@ " " Author: Jakson Alves de Aquino " -" Last Change: Fri Mar 02, 2012 10:40AM +" Last Change: Thu Mar 08, 2012 08:19AM "========================================================================== " Only do this when not yet done for this buffer @@ -114,40 +114,14 @@ function! RBrowserDoubleClick() exe 'Py SendToR("' . "\005" . '-' . substitute(key, '\$', '-', "g") . '")' call UpdateOB("GlobalEnv") else - exe 'Py SendToR("' . "\005" . substitute(key, '\$', '-', "g") . '")' - call UpdateOB("libraries") - endif -endfunction - -function! RBrowserOpenCloseLists(status) - if g:rplugin_editor_port == 0 - if !buflisted("Object_Browser") - call RWarningMsg('There is no "Object_Browser" buffer.') - return + let key = substitute(key, '\$', '-', "g") + let key = substitute(key, '`', '', "g") + if key !~ "^package:" + let key = "package:" . RBGetPkgName() . '-' . key endif - - let switchedbuf = 0 - if g:rplugin_curbuf != "Object_Browser" - let savesb = &switchbuf - set switchbuf=useopen,usetab - sil noautocmd sb Object_Browser - let switchedbuf = 1 - endif - endif - - exe 'Py SendToR("' . "\006" . a:status . '")' - if g:rplugin_curview == "GlobalEnv" - call UpdateOB("GlobalEnv") - else + exe 'Py SendToR("' . "\005" . key . '")' call UpdateOB("libraries") endif - - if g:rplugin_editor_port == 0 - if switchedbuf - exe "sil noautocmd sb " . g:rplugin_curbuf - exe "set switchbuf=" . savesb - endif - endif endfunction function! RBrowserRightClick() @@ -322,7 +296,7 @@ function! ObBrBufUnload() call delete($VIMRPLUGIN_TMPDIR . "/object_browser") call delete($VIMRPLUGIN_TMPDIR . "/liblist") if g:rplugin_editor_port - call system("tmux select-pane -t 0") + call system("tmux select-pane -t " . g:rplugin_edpane) endif endfunction @@ -373,7 +347,7 @@ endfunction let g:rplugin_whatupdate = "N" if g:vimrplugin_screenplugin - set updatetime=50 + " set updatetime=50 " The function VimServer() in vimcom.py should only set the value of " rplugin_whatupdate instead of calling UpdateOB(). However, the procedure " would not work because CursorHold is not retriggered diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 9639f35..92ec54f 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -15,7 +15,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Wed Mar 07, 2012 11:24AM +" Last Change: Thu Mar 08, 2012 07:22AM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -691,8 +691,7 @@ function StartObjectBrowser() endif call delete($VIMRPLUGIN_TMPDIR . "/rpane") - let rcmd = 'writeLines(Sys.getenv("TMUX_PANE"), "' . $VIMRPLUGIN_TMPDIR . "/rpane" . '")' - exe "Py SendToR('" . rcmd . "')" + Py SendToR("\001Tmux pane") let ii = 0 while !filereadable($VIMRPLUGIN_TMPDIR . "/rpane") && ii < 20 let ii = ii + 1 @@ -712,6 +711,10 @@ function StartObjectBrowser() call writefile([ \ 'call writefile([$TMUX_PANE], $VIMRPLUGIN_TMPDIR . "/objbrpane")', + \ 'let b:this_is_ob = 1', + \ 'let g:rplugin_editor_port = ' . g:rplugin_myport , + \ 'let g:rplugin_edpane = "' . g:rplugin_edpane . '"', + \ 'let g:rplugin_rpane = "' . g:rplugin_rpane . '"', \ 'let b:objbrtitle = "' . b:objbrtitle . '"', \ 'let b:screensname = "' . b:screensname . '"', \ 'let b:rscript_buffer = "' . bufname("%") . '"', @@ -727,12 +730,6 @@ function StartObjectBrowser() \ 'setlocal nomodified', \ 'call cursor(curline, curcol)', \ 'exe "PyFile " . g:rplugin_home . "/r-plugin/vimcom.py"', - \ 'Py SendToR("\003GlobalEnv")', - \ 'Py SendToR("\004Libraries")', - \ 'call UpdateOB("GlobalEnv")', - \ 'let g:rplugin_editor_port = ' . g:rplugin_myport , - \ 'let g:rplugin_edpane = "' . g:rplugin_edpane . '"', - \ 'let g:rplugin_rpane = "' . g:rplugin_rpane . '"', \ 'Py OtherPort = ' . g:rplugin_myport , \ 'let g:rplugin_myport1 = 5005', \ 'let g:rplugin_myport2 = 5100', @@ -758,6 +755,7 @@ function StartObjectBrowser() \ 'Py VimClient("EXPR let g:rplugin_objbr_port = " + str(MyPort))', \ 'sleep 200m', \ 'Py VimClient("EXPR Py OtherPort = " + str(MyPort))', + \ 'call UpdateOB("GlobalEnv")', \ 'redraw'], objbrowserfile) if g:vimrplugin_objbr_place =~ "left" @@ -917,11 +915,34 @@ function RObjBrowser() return endfunction -function RObjBrowserOCLists(status) - if exists("*RBrowserOpenCloseLists") - call RBrowserOpenCloseLists(a:status) - elseif g:rplugin_objbr_port - exe 'Py VimClient("EXPR call RBrowserOpenCloseLists('. "'" . a:status . "')" . '")' +function RBrowserOpenCloseLists(status) + if g:vimrplugin_screenplugin && !exists("b:this_is_ob") + let stt = a:status + 2 + else + let stt = a:status + endif + + let switchedbuf = 0 + if buflisted("Object_Browser") && g:rplugin_curbuf != "Object_Browser" + let savesb = &switchbuf + set switchbuf=useopen,usetab + sil noautocmd sb Object_Browser + let switchedbuf = 1 + endif + + exe 'Py SendToR("' . "\006" . stt . '")' + + if exists("g:rplugin_curview") + if g:rplugin_curview == "GlobalEnv" + call UpdateOB("GlobalEnv") + else + call UpdateOB("libraries") + endif + endif + + if switchedbuf + exe "sil noautocmd sb " . g:rplugin_curbuf + exe "set switchbuf=" . savesb endif endfunction @@ -1825,20 +1846,18 @@ function RAction(rcmd) if g:vimrplugin_vimpager == "no" call SendCmdToR("help(" . rkeyword . ")") else - if (bufname("%") =~ "Object_Browser" || g:rplugin_editor_port) + if bufname("%") =~ "Object_Browser" || exists("*RBrSendToR") if g:rplugin_curview == "libraries" let pkg = RBGetPkgName() else let pkg = "" endif - if g:rplugin_editor_port - let hlog = system("tmux select-pane -t " . g:rplugin_rpane . " && tmux set-buffer 'help(" . '"' . rkeyword . '", ' . '"' . pkg . '")' . "\' && tmux paste-buffer -t " . g:rplugin_rpane) + if exists("*RBrSendToR") + call RBrSendToR('help("' . rkeyword . '", "' . pkg . '")') + let slog = system("tmux select-pane -t " . g:rplugin_rpane) if v:shell_error - let hlog = substitute(hlog, "\n", " ", "g") - let hlog = substitute(hlog, "\r", " ", "g") - call RWarningMsg(hlog) - return 0', - endif', + call RWarningMsg(slog) + endif else call ShowRDoc(rkeyword, pkg, 0) endif @@ -2034,13 +2053,8 @@ function RControlMaps() " Build list of objects for omni completion "------------------------------------- call RCreateMaps("nvi", 'RUpdateObjBrowser', 'ro', ':call RObjBrowser()') - if &filetype == "rbrowser" - call RCreateMaps("nvi", 'ROpenLists', 'r=', ':call RBrowserOpenCloseLists(1)') - call RCreateMaps("nvi", 'RCloseLists', 'r-', ':call RBrowserOpenCloseLists(0)') - else - call RCreateMaps("nvi", 'ROpenLists', 'r=', ':call RObjBrowserOCLists(1)') - call RCreateMaps("nvi", 'RCloseLists', 'r-', ':call RObjBrowserOCLists(0)') - endif + call RCreateMaps("nvi", 'ROpenLists', 'r=', ':call RBrowserOpenCloseLists(1)') + call RCreateMaps("nvi", 'RCloseLists', 'r-', ':call RBrowserOpenCloseLists(0)') endfunction From 2b974c425afb7712dd668400f7130fb4a37fc73e Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 8 Mar 2012 10:29:23 -0300 Subject: [PATCH 0174/1050] Always open R doc on Vim editor (may beep). --- r-plugin/common_global.vim | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 92ec54f..ed82afc 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -15,7 +15,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Thu Mar 08, 2012 07:22AM +" Last Change: Thu Mar 08, 2012 10:16AM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -1852,9 +1852,8 @@ function RAction(rcmd) else let pkg = "" endif - if exists("*RBrSendToR") - call RBrSendToR('help("' . rkeyword . '", "' . pkg . '")') - let slog = system("tmux select-pane -t " . g:rplugin_rpane) + if exists("b:this_is_ob") + let slog = system("tmux set-buffer '" . "\" . ':call ShowRDoc("' . rkeyword . '", "' . pkg . '", 0)' . "\' && tmux paste-buffer -t " . g:rplugin_edpane . " && tmux select-pane -t " . g:rplugin_edpane) if v:shell_error call RWarningMsg(slog) endif From 7ba2a867b58b435c79d78ca9c4562bc61bd212a0 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 8 Mar 2012 22:46:34 -0300 Subject: [PATCH 0175/1050] Send plot() and summary() in a single line. --- r-plugin/common_global.vim | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index ed82afc..a18ee63 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -15,7 +15,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Thu Mar 08, 2012 10:16AM +" Last Change: Thu Mar 08, 2012 10:36PM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -1877,11 +1877,18 @@ function RAction(rcmd) if a:rcmd == "plot" && g:vimrplugin_specialplot == 1 let rfun = "vim.plot" endif - let raction = rfun . "(" . rkeyword . ")" - let ok = SendCmdToR(raction) - if ok == 0 + if a:rcmd == "plotsumm" + if g:vimrplugin_specialplot == 1 + let raction = "vim.plot(" . rkeyword . ") ; summary(" . rkeyword . ")" + else + let raction = "plot(" . rkeyword . ") ; summary(" . rkeyword . ")" + endif + call SendCmdToR(raction) return endif + + let raction = rfun . "(" . rkeyword . ")" + call SendCmdToR(raction) endif endfunction @@ -2020,7 +2027,7 @@ function RControlMenu() menu R.Command.-Sep3- call RCreateMenuItem("nvi", 'Command.Summary\ (cur)', 'RSummary', 'rs', ':call RAction("summary")') call RCreateMenuItem("nvi", 'Command.Plot\ (cur)', 'RPlot', 'rg', ':call RAction("plot")') - call RCreateMenuItem("nvi", 'Command.Plot\ and\ summary\ (cur)', 'RSPlot', 'rb', ':call RAction("plot"):call RAction("summary")') + call RCreateMenuItem("nvi", 'Command.Plot\ and\ summary\ (cur)', 'RSPlot', 'rb', ':call RAction("plotsumm")') let g:rplugin_hasmenu = 1 endfunction @@ -2047,7 +2054,7 @@ function RControlMaps() "------------------------------------- call RCreateMaps("nvi", 'RSummary', 'rs', ':call RAction("summary")') call RCreateMaps("nvi", 'RPlot', 'rg', ':call RAction("plot")') - call RCreateMaps("nvi", 'RSPlot', 'rb', ':call RAction("plot"):call RAction("summary")') + call RCreateMaps("nvi", 'RSPlot', 'rb', ':call RAction("plotsumm")') " Build list of objects for omni completion "------------------------------------- From fe5067c9078938086372e3d63ddc471d7325b544 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Fri, 9 Mar 2012 12:33:46 -0300 Subject: [PATCH 0176/1050] Wait less if building omnilist for .Globalenv. --- r-plugin/common_global.vim | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index a18ee63..8a31641 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -15,7 +15,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Thu Mar 08, 2012 10:36PM +" Last Change: Fri Mar 09, 2012 12:26PM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -590,7 +590,7 @@ function StartR(whatr) unlet g:tmp_conque_bufname unlet g:tmp_objbrtitle - exe "setlocal syntax=rout" + setlocal syntax=rout exe "sil noautocmd sb " . g:rplugin_curbuf exe "set switchbuf=" . savesb if savewd @@ -1487,7 +1487,11 @@ function BuildROmniList(env, what) echo "Please, wait..." echohl Normal call SendCmdToR(omnilistcmd) - sleep 2 + if a:env =~ "GlobalEnv" + sleep 100m + else + sleep 2 + endif let ii = 0 while !filereadable($VIMRPLUGIN_TMPDIR . "/vimbol_finished") && ii < g:vimrplugin_buildwait let ii += 1 @@ -1540,7 +1544,7 @@ function RBuildSyntaxFile(what) call UpdateOB("libraries") else unlet b:current_syntax - exe "runtime syntax/r.vim" + runtime syntax/r.vim endif endfunction @@ -1879,9 +1883,9 @@ function RAction(rcmd) endif if a:rcmd == "plotsumm" if g:vimrplugin_specialplot == 1 - let raction = "vim.plot(" . rkeyword . ") ; summary(" . rkeyword . ")" + let raction = "vim.plot(" . rkeyword . "); summary(" . rkeyword . ")" else - let raction = "plot(" . rkeyword . ") ; summary(" . rkeyword . ")" + let raction = "plot(" . rkeyword . "); summary(" . rkeyword . ")" endif call SendCmdToR(raction) return @@ -2543,8 +2547,6 @@ let g:rplugin_globalenvfname = $VIMRPLUGIN_TMPDIR . "/GlobalEnvList" " Variables whose default value is fixed call RSetDefaultValue("g:vimrplugin_map_r", 0) -call RSetDefaultValue("g:vimrplugin_open_df", 1) -call RSetDefaultValue("g:vimrplugin_open_list", 0) call RSetDefaultValue("g:vimrplugin_allnames", 0) call RSetDefaultValue("g:vimrplugin_underscore", 1) call RSetDefaultValue("g:vimrplugin_rnowebchunk", 1) From 8244072772b19233413648ad9fe1e62b1b0a8602 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Fri, 9 Mar 2012 23:39:52 -0300 Subject: [PATCH 0177/1050] Remove RUpdateObjListAll menu entry. --- r-plugin/common_global.vim | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 8a31641..b555fac 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -15,7 +15,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Fri Mar 09, 2012 12:26PM +" Last Change: Fri Mar 09, 2012 11:36PM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -1498,6 +1498,10 @@ function BuildROmniList(env, what) sleep endwhile echon "\r " + if ii == g:vimrplugin_buildwait + call RWarningMsg("No longer waiting...") + return + endif if a:env == "GlobalEnv" let g:rplugin_globalenvlines = readfile(g:rplugin_globalenvfname) @@ -2237,8 +2241,6 @@ function MakeRMenu() "---------------------------------------------------------------------------- nmenu R.Syntax.Build\ omniList\ (loaded):RUpdateObjList :call RBuildSyntaxFile("loaded") imenu R.Syntax.Build\ omniList\ (loaded):RUpdateObjList :call RBuildSyntaxFile("loaded")a - nmenu R.Syntax.Build\ omniList\ (installed):RUpdateObjListAll :call RBuildSyntaxFile("installed") - imenu R.Syntax.Build\ omniList\ (installed):RUpdateObjListAll :call RBuildSyntaxFile("installed")a "---------------------------------------------------------------------------- " Help @@ -2563,7 +2565,7 @@ call RSetDefaultValue("g:vimrplugin_routnotab", 0) call RSetDefaultValue("g:vimrplugin_editor_w", 66) call RSetDefaultValue("g:vimrplugin_help_w", 46) call RSetDefaultValue("g:vimrplugin_objbr_w", 40) -call RSetDefaultValue("g:vimrplugin_buildwait", 180) +call RSetDefaultValue("g:vimrplugin_buildwait", 60) call RSetDefaultValue("g:vimrplugin_indent_commented", 1) call RSetDefaultValue("g:vimrplugin_by_vim_instance", 0) call RSetDefaultValue("g:vimrplugin_never_unmake_menu", 0) From f7120919d38f9004bd30c3f32ffd31c6a9b06f19 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Fri, 9 Mar 2012 23:40:22 -0300 Subject: [PATCH 0178/1050] Document known problems of RUpdateObjListAll. --- doc/r-plugin.txt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index ad1b52f..bdc5915 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -401,7 +401,6 @@ Edit Syntax . Build omniList (loaded packages) :RUpdateObjList - . Build omniList (installed packages) :RUpdateObjListAll ----------------------------------------------------------- Object Browser @@ -481,7 +480,6 @@ mode: 4.3. Omni completion and the highlighting of functions~ *:RUpdateObjList* - *:RUpdateObjListAll* The plugin adds some features to the default syntax highlight of R code. One such feature is the highlight of R functions. However, only functions that R loads by default are highlighted. To add functions of other libraries, you @@ -499,7 +497,7 @@ completion (|compl-omni|) including all objects currently in R's workspace, with the exception of the .GlobalEnv objects. These two lists are stored permanently in the ~/.vim/r-plugin directory. -The command :RUpdateObjList waits 120 seconds to R finish building the list. +The command :RUpdateObjList waits 60 seconds to R finish building the list. If this time is not enough to your system, please, set a different value of |vimrplugin_buildwait|. @@ -507,7 +505,9 @@ You should run :RUpdateObjList whenever you upgrade R since some functions are removed and new ones are added at each new R version. The command :RUpdateObjListAll will tell R to load all installed packages -and, then, build the "omniList". +and, then, build the "omniList". If you have too many installed packages, this +may cause problems: R may be unable to load all packages and Vim may be unable +to load the list of functions for syntax highlight. 4.4. Omni completion~ @@ -1005,7 +1005,7 @@ the SDI style of the graphical user interface. 6.9. Time necessary to build list of objects for omni completion~ *vimrplugin_buildwait* -If your system needs more than 180 seconds to build the list of objects for +If your system needs more than 60 seconds to build the list of objects for omni completion after you do the command |:RUpdateObjList|, then you should set the value of |vimrplugin_buildwait| to a higher value. Example: > @@ -1774,7 +1774,7 @@ the R syntax highlighted. *r-plugin-news* 10. News~ -0.9.8 (2012-02-21) +0.9.8 (2012-03-08) * Use the R package vimcom. The following options are now set on the vimcom R package and no longer in the Vim-R-plugin: allnames, open_df, and From b1452859d92b7435c9055a425f6570807045d256 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sun, 11 Mar 2012 16:13:25 -0300 Subject: [PATCH 0179/1050] New normal mode command to delete/detach: dd --- ftplugin/rbrowser.vim | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/ftplugin/rbrowser.vim b/ftplugin/rbrowser.vim index b06d007..d159aa3 100644 --- a/ftplugin/rbrowser.vim +++ b/ftplugin/rbrowser.vim @@ -16,7 +16,7 @@ " " Author: Jakson Alves de Aquino " -" Last Change: Thu Mar 08, 2012 08:19AM +" Last Change: Sun Mar 11, 2012 04:09PM "========================================================================== " Only do this when not yet done for this buffer @@ -304,6 +304,27 @@ function! SourceObjBrLines() exe "source " . $VIMRPLUGIN_TMPDIR . "/objbrowserInit" endfunction +function! OBDelete() + if line(".") < 3 + return + endif + let obj = RBrowserGetName(1) + if g:rplugin_curview == "GlobalEnv" + if obj =~ '\$' + let cmd = obj . ' <- NULL' + else + let cmd = 'rm(' . obj . ')' + endif + else + if obj =~ "^package:" + let cmd = 'detach("' . obj . '", unload = TRUE, character.only = TRUE)' + else + return + endif + endif + call RBrSendToR(cmd) +endfunction + nmap :call RBrowserDoubleClick() nmap <2-LeftMouse> :call RBrowserDoubleClick() nmap :call RBrowserRightClick() @@ -323,6 +344,10 @@ call writefile([], $VIMRPLUGIN_TMPDIR . "/liblist") au BufUnload call ObBrBufUnload() +if $TMUX_PANE =~ "" + nmap dd :call OBDelete() +endif + let s:envstring = tolower($LC_MESSAGES . $LC_ALL . $LANG) if s:envstring =~ "utf-8" || s:envstring =~ "utf8" let s:isutf8 = 1 @@ -345,6 +370,7 @@ function RBrowserUpdate() endif endfunction + let g:rplugin_whatupdate = "N" if g:vimrplugin_screenplugin " set updatetime=50 From ba505e2fd5e7a65fe4a0b06be19042251b1c9617 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sun, 11 Mar 2012 16:20:09 -0300 Subject: [PATCH 0180/1050] Remove the command :RUpdateObjListAll. --- doc/r-plugin.txt | 8 ++++---- r-plugin/common_global.vim | 3 +-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index bdc5915..b391ccd 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -504,10 +504,8 @@ If this time is not enough to your system, please, set a different value of You should run :RUpdateObjList whenever you upgrade R since some functions are removed and new ones are added at each new R version. -The command :RUpdateObjListAll will tell R to load all installed packages -and, then, build the "omniList". If you have too many installed packages, this -may cause problems: R may be unable to load all packages and Vim may be unable -to load the list of functions for syntax highlight. +Note: If you have too many loaded packages Vim may be unable to load the list +of functions for syntax highlight. 4.4. Omni completion~ @@ -1781,6 +1779,8 @@ the R syntax highlighted. open_list. * Automatic update of the Object Browser when running R in a Tmux session. * New command :Rhelp (thanks for Nir Atias for suggesting the new feature). + * Remove the command :RUpdateObjListAll because Vim may not load the + syntax file if it is too big. 0.9.7 (2012-02-12) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index b555fac..f547917 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -15,7 +15,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Fri Mar 09, 2012 11:36PM +" Last Change: Sun Mar 11, 2012 04:19PM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -2489,7 +2489,6 @@ function SetRPath() endfunction command RUpdateObjList :call RBuildSyntaxFile("loaded") -command RUpdateObjListAll :call RBuildSyntaxFile("installed") command RBuildTags :call SendCmdToR('rtags(ofile = "TAGS")') command -nargs=? -complete=customlist,RLisObjs Rhelp :call RAskHelp() From 199e293f2f6726db44c8907af23d832c3cc44ad4 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sun, 11 Mar 2012 16:32:13 -0300 Subject: [PATCH 0181/1050] Remember Object Browser width. --- r-plugin/vimcom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/r-plugin/vimcom.py b/r-plugin/vimcom.py index 7497bf8..5bca4af 100644 --- a/r-plugin/vimcom.py +++ b/r-plugin/vimcom.py @@ -156,7 +156,7 @@ def StopServer(): vim.command("let g:rplugin_myport = 0") ft = vim.eval("&filetype") if ft == "rbrowser": - VimClient("EXPR let g:rplugin_objbr_port = 0") + VimClient("EXPR let g:rplugin_objbr_port = 0 | let g:vimrplugin_objbr_w = " + vim.eval("&columns")) if MyPort == 0: return try: From 9a80e419a6a40bcc4d017aa8d7c2cf7591fb4fdc Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sun, 11 Mar 2012 23:33:34 -0300 Subject: [PATCH 0182/1050] Delete multiple objects. --- ftplugin/rbrowser.vim | 49 +++++++++++++++++++++++++++++++++++++------ 1 file changed, 43 insertions(+), 6 deletions(-) diff --git a/ftplugin/rbrowser.vim b/ftplugin/rbrowser.vim index d159aa3..e2643ab 100644 --- a/ftplugin/rbrowser.vim +++ b/ftplugin/rbrowser.vim @@ -16,7 +16,7 @@ " " Author: Jakson Alves de Aquino " -" Last Change: Sun Mar 11, 2012 04:09PM +" Last Change: Sun Mar 11, 2012 11:29PM "========================================================================== " Only do this when not yet done for this buffer @@ -54,7 +54,13 @@ endif " Current view of the object browser: .GlobalEnv X loaded libraries let g:rplugin_curview = "GlobalEnv" +let g:rplugin_ob_busy = 0 + function! UpdateOB(what) + if g:rplugin_ob_busy == 1 + return + endif + let g:rplugin_ob_busy = 1 if g:rplugin_curview != a:what return endif @@ -93,6 +99,7 @@ function! UpdateOB(what) exe "sil noautocmd sb " . g:rplugin_curbuf exe "set switchbuf=" . savesb endif + let g:rplugin_ob_busy = 0 endfunction function! RBrowserDoubleClick() @@ -304,9 +311,10 @@ function! SourceObjBrLines() exe "source " . $VIMRPLUGIN_TMPDIR . "/objbrowserInit" endfunction -function! OBDelete() +function! OBDelete(immediate) + let g:rplugin_ob_busy = 1 if line(".") < 3 - return + return "" endif let obj = RBrowserGetName(1) if g:rplugin_curview == "GlobalEnv" @@ -319,10 +327,38 @@ function! OBDelete() if obj =~ "^package:" let cmd = 'detach("' . obj . '", unload = TRUE, character.only = TRUE)' else - return + return "" endif endif + if a:immediate == 0 + return cmd + else + call RBrSendToR(cmd) + sleep 100m + let g:rplugin_ob_busy = 0 + call UpdateOB(g:rplugin_curview) + endif + return "" +endfunction + +function! OBMultiDelete() + let g:rplugin_ob_busy = 1 + let fline = line("'<") + let eline = line("'>") + let nl= 0 + let cmd = "" + for ii in range(fline, eline) + call setpos(".", [0, ii, 1, 0]) + let nl+= 1 + if nl > 1 + let cmd = cmd . "; " + endif + let cmd = cmd . OBDelete(0) + endfor call RBrSendToR(cmd) + sleep 150m + let g:rplugin_ob_busy = 0 + call UpdateOB(g:rplugin_curview) endfunction nmap :call RBrowserDoubleClick() @@ -344,8 +380,9 @@ call writefile([], $VIMRPLUGIN_TMPDIR . "/liblist") au BufUnload call ObBrBufUnload() -if $TMUX_PANE =~ "" - nmap dd :call OBDelete() +if $TMUX_PANE != "" + nmap d :call OBDelete(1) + vmap d :call OBMultiDelete() endif let s:envstring = tolower($LC_MESSAGES . $LC_ALL . $LANG) From d195190c2145d40e4e80fcc42bc4d6e0c38c5608 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Mon, 12 Mar 2012 00:29:22 -0300 Subject: [PATCH 0183/1050] Do not warn if server reactivation fail. --- r-plugin/vimcom.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/r-plugin/vimcom.py b/r-plugin/vimcom.py index 5bca4af..ede806d 100644 --- a/r-plugin/vimcom.py +++ b/r-plugin/vimcom.py @@ -135,8 +135,7 @@ def VimServer(): try: sock = socket.socket( socket.AF_INET, socket.SOCK_DGRAM ) sock.bind( (UDP_IP,MyPort) ) - except Exception as errmsg: - vim.command("call RWarningMsg('Server reactivation failed: " + str(errmsg) + "')") + except: pass def RunServer(): From f034b8768b76be431011c70ecebc8b7872e27bb9 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Mon, 12 Mar 2012 00:30:24 -0300 Subject: [PATCH 0184/1050] Minor bug fix. --- ftplugin/rbrowser.vim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ftplugin/rbrowser.vim b/ftplugin/rbrowser.vim index e2643ab..579040b 100644 --- a/ftplugin/rbrowser.vim +++ b/ftplugin/rbrowser.vim @@ -16,7 +16,7 @@ " " Author: Jakson Alves de Aquino " -" Last Change: Sun Mar 11, 2012 11:29PM +" Last Change: Sun Mar 11, 2012 11:58PM "========================================================================== " Only do this when not yet done for this buffer @@ -62,6 +62,7 @@ function! UpdateOB(what) endif let g:rplugin_ob_busy = 1 if g:rplugin_curview != a:what + let g:rplugin_ob_busy = 0 return endif redir => s:bufl From 9120d04342a62ec1ea0590bc2d0121db8f17f858 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Mon, 12 Mar 2012 00:31:08 -0300 Subject: [PATCH 0185/1050] Change the minimum width of the Object Browser. --- r-plugin/common_global.vim | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index f547917..fe09a6c 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -15,7 +15,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Sun Mar 11, 2012 04:19PM +" Last Change: Sun Mar 11, 2012 11:55PM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -2835,8 +2835,8 @@ if !filereadable(g:rplugin_omnifname) endif " Minimum width for the Object Browser -if g:vimrplugin_objbr_w < 9 - let g:vimrplugin_objbr_w = 9 +if g:vimrplugin_objbr_w < 10 + let g:vimrplugin_objbr_w = 10 endif " Keeps the libraries object list in memory to avoid the need of reading the file From 5f8aef8da92e5b87fd5bd5e342fd0d2b720087d8 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Mon, 12 Mar 2012 00:32:26 -0300 Subject: [PATCH 0186/1050] Update. --- doc/r-plugin.txt | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index b391ccd..613ba25 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -565,6 +565,10 @@ any) used to classify the objects: Type is.list() Function is.function() +When running in a terminal emulator under Tmux, the Object Browser will be +updated automatically. One limitation is that objects made available by the +command data() will not have their classes recognized in the GlobalEnv view. + 4.6. Commenting and uncommenting lines~ @@ -1094,9 +1098,13 @@ split it vertically put in your |vimrc|: By default, when running in a terminal emulator, the Vim-R-plugin uses the screen.vim plugin if it is installed and, by default, it will use Tmux instead of GNU Screen. Tmux was chosen as default because it may split the terminal -vertically and its regions are easier to resize. If both GNU Screen and Tmux -are installed but you prefer to use the GNU Screen application, put in your -|vimrc|: +vertically and its regions are easier to resize. If you want that the R +Console starts with a specific width, put in your |vimrc| your preferred value: +> + let g:ScreenShellWidth = 80 +< +If both GNU Screen and Tmux are installed but you prefer to use the GNU Screen +application, put in your |vimrc|: > let vimrplugin_tmux = 0 < @@ -1605,7 +1613,10 @@ two options and some others: if(interactive()){ library(colorout) library(setwidth) + options(vimcom.verbose = 1, vimcom.allnames = TRUE) library(vimcom) + if(Sys.getenv("TERM") != "linux" && Sys.getenv("TERM") != "") + setOutputColors256(verbose = FALSE) if(nchar(Sys.getenv("DISPLAY")) > 1){ grDevices::X11.options(width = 4.5, height = 4, ypos = 0, xpos = 1000, pointsize = 10) From 0ea17c01e41a67c2f1ef5b3bde16cacc8d189ee4 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Mon, 12 Mar 2012 08:57:04 -0300 Subject: [PATCH 0187/1050] Open unnamed list elements. --- ftplugin/rbrowser.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ftplugin/rbrowser.vim b/ftplugin/rbrowser.vim index 579040b..79889ee 100644 --- a/ftplugin/rbrowser.vim +++ b/ftplugin/rbrowser.vim @@ -16,7 +16,7 @@ " " Author: Jakson Alves de Aquino " -" Last Change: Sun Mar 11, 2012 11:58PM +" Last Change: Mon Mar 12, 2012 08:55AM "========================================================================== " Only do this when not yet done for this buffer @@ -277,7 +277,7 @@ function! RBrowserGetName(complete) let word = RBrowserFindParent(word, line("."), curpos) " Unnamed objects of lists if word =~ '\$\[\[[0-9]*\]\]' - let word = substitute(word, '\$\[\[\([0-9]*\)\]\]', '[[\1]]', "g") + let word = substitute(word, '\$\[\[\([0-9]*\)\]\]', '-[[\1]]', "g") endif return word else From 8c3269fff0099856af161d2bdf9c3f27fcea4937 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Mon, 12 Mar 2012 09:08:40 -0300 Subject: [PATCH 0188/1050] More stability on delete command. --- ftplugin/rbrowser.vim | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/ftplugin/rbrowser.vim b/ftplugin/rbrowser.vim index 79889ee..40c9994 100644 --- a/ftplugin/rbrowser.vim +++ b/ftplugin/rbrowser.vim @@ -16,7 +16,7 @@ " " Author: Jakson Alves de Aquino " -" Last Change: Mon Mar 12, 2012 08:55AM +" Last Change: Mon Mar 12, 2012 09:05AM "========================================================================== " Only do this when not yet done for this buffer @@ -55,11 +55,14 @@ endif let g:rplugin_curview = "GlobalEnv" let g:rplugin_ob_busy = 0 +let g:rplugin_need_up = 0 function! UpdateOB(what) if g:rplugin_ob_busy == 1 + let g:rplugin_need_up = 1 return endif + let g:rplugin_need_up = 0 let g:rplugin_ob_busy = 1 if g:rplugin_curview != a:what let g:rplugin_ob_busy = 0 @@ -337,7 +340,6 @@ function! OBDelete(immediate) call RBrSendToR(cmd) sleep 100m let g:rplugin_ob_busy = 0 - call UpdateOB(g:rplugin_curview) endif return "" endfunction @@ -359,7 +361,6 @@ function! OBMultiDelete() call RBrSendToR(cmd) sleep 150m let g:rplugin_ob_busy = 0 - call UpdateOB(g:rplugin_curview) endfunction nmap :call RBrowserDoubleClick() @@ -395,27 +396,14 @@ endif unlet s:envstring function RBrowserUpdate() - if g:rplugin_whatupdate == "G" - call UpdateOB('GlobalEnv') - let g:rplugin_whatupdate = "N" - elseif g:rplugin_whatupdate == "L" - call UpdateOB('libraries') - let g:rplugin_whatupdate = "N" - elseif g:rplugin_whatupdate == "B" - call UpdateOB('GlobalEnv') - call UpdateOB('libraries') - let g:rplugin_whatupdate = "N" + if g:rplugin_need_up + call UpdateOB(g:rplugin_curview) endif endfunction - -let g:rplugin_whatupdate = "N" if g:vimrplugin_screenplugin - " set updatetime=50 - " The function VimServer() in vimcom.py should only set the value of - " rplugin_whatupdate instead of calling UpdateOB(). However, the procedure - " would not work because CursorHold is not retriggered - "autocmd CursorHold call RBrowserUpdate() + set updatetime=100 + autocmd CursorHold call RBrowserUpdate() endif let &cpo = s:cpo_save From c0540cf0384a24e611841a63313a685c9f8fae32 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Mon, 12 Mar 2012 10:53:56 -0300 Subject: [PATCH 0189/1050] Try to make the Object Browser more stable. --- ftplugin/rbrowser.vim | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/ftplugin/rbrowser.vim b/ftplugin/rbrowser.vim index 40c9994..d829cf0 100644 --- a/ftplugin/rbrowser.vim +++ b/ftplugin/rbrowser.vim @@ -16,7 +16,7 @@ " " Author: Jakson Alves de Aquino " -" Last Change: Mon Mar 12, 2012 09:05AM +" Last Change: Mon Mar 12, 2012 10:52AM "========================================================================== " Only do this when not yet done for this buffer @@ -62,8 +62,8 @@ function! UpdateOB(what) let g:rplugin_need_up = 1 return endif - let g:rplugin_need_up = 0 let g:rplugin_ob_busy = 1 + let g:rplugin_need_up = 0 if g:rplugin_curview != a:what let g:rplugin_ob_busy = 0 return @@ -316,6 +316,9 @@ function! SourceObjBrLines() endfunction function! OBDelete(immediate) + if g:rplugin_ob_busy || g:rplugin_need_up + return "" + endif let g:rplugin_ob_busy = 1 if line(".") < 3 return "" @@ -334,17 +337,20 @@ function! OBDelete(immediate) return "" endif endif + if a:immediate == 0 return cmd - else - call RBrSendToR(cmd) - sleep 100m - let g:rplugin_ob_busy = 0 endif + + call RBrSendToR(cmd) + let g:rplugin_ob_busy = 0 return "" endfunction function! OBMultiDelete() + if g:rplugin_ob_busy || g:rplugin_need_up + return + endif let g:rplugin_ob_busy = 1 let fline = line("'<") let eline = line("'>") @@ -359,7 +365,6 @@ function! OBMultiDelete() let cmd = cmd . OBDelete(0) endfor call RBrSendToR(cmd) - sleep 150m let g:rplugin_ob_busy = 0 endfunction From 2eb8a1a330e7533a9015471b794b05dd8a0731bf Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Mon, 12 Mar 2012 10:55:02 -0300 Subject: [PATCH 0190/1050] Warn again on bind failure. --- r-plugin/vimcom.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/r-plugin/vimcom.py b/r-plugin/vimcom.py index ede806d..0d630fc 100644 --- a/r-plugin/vimcom.py +++ b/r-plugin/vimcom.py @@ -135,7 +135,8 @@ def VimServer(): try: sock = socket.socket( socket.AF_INET, socket.SOCK_DGRAM ) sock.bind( (UDP_IP,MyPort) ) - except: + except Exception as errmsg: + vim.command("call RWarningMsg('Server failed to bind: " + str(errmsg) + "')") pass def RunServer(): From 1040e9050d5f5dc640ed07be9d9d02a9716320fb Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Wed, 14 Mar 2012 11:27:40 -0300 Subject: [PATCH 0191/1050] Run the server again after bind failure. --- ftplugin/rbrowser.vim | 82 ++++++++++++++++++++++--------------------- r-plugin/vimcom.py | 1 + 2 files changed, 43 insertions(+), 40 deletions(-) diff --git a/ftplugin/rbrowser.vim b/ftplugin/rbrowser.vim index d829cf0..4e710b2 100644 --- a/ftplugin/rbrowser.vim +++ b/ftplugin/rbrowser.vim @@ -16,7 +16,7 @@ " " Author: Jakson Alves de Aquino " -" Last Change: Mon Mar 12, 2012 10:52AM +" Last Change: Wed Mar 14, 2012 11:20AM "========================================================================== " Only do this when not yet done for this buffer @@ -55,17 +55,12 @@ endif let g:rplugin_curview = "GlobalEnv" let g:rplugin_ob_busy = 0 -let g:rplugin_need_up = 0 function! UpdateOB(what) - if g:rplugin_ob_busy == 1 - let g:rplugin_need_up = 1 + if g:rplugin_curview != a:what return endif - let g:rplugin_ob_busy = 1 - let g:rplugin_need_up = 0 - if g:rplugin_curview != a:what - let g:rplugin_ob_busy = 0 + if g:rplugin_ob_busy return endif redir => s:bufl @@ -103,7 +98,6 @@ function! UpdateOB(what) exe "sil noautocmd sb " . g:rplugin_curbuf exe "set switchbuf=" . savesb endif - let g:rplugin_ob_busy = 0 endfunction function! RBrowserDoubleClick() @@ -315,14 +309,7 @@ function! SourceObjBrLines() exe "source " . $VIMRPLUGIN_TMPDIR . "/objbrowserInit" endfunction -function! OBDelete(immediate) - if g:rplugin_ob_busy || g:rplugin_need_up - return "" - endif - let g:rplugin_ob_busy = 1 - if line(".") < 3 - return "" - endif +function! OBGetDeleteCmd() let obj = RBrowserGetName(1) if g:rplugin_curview == "GlobalEnv" if obj =~ '\$' @@ -337,23 +324,34 @@ function! OBDelete(immediate) return "" endif endif + return cmd +endfunction - if a:immediate == 0 - return cmd - endif - - call RBrSendToR(cmd) +function! OBSendDeleteCmd(cmd) + let g:rplugin_ob_busy = 1 + call RBrSendToR(a:cmd) + sleep 250m let g:rplugin_ob_busy = 0 - return "" + call UpdateOB(g:rplugin_curview) +endfunction + +function! OBDelete() + if g:rplugin_ob_busy || line(".") < 3 + return + endif + let cmd = OBGetDeleteCmd() + call OBSendDeleteCmd(cmd) endfunction function! OBMultiDelete() - if g:rplugin_ob_busy || g:rplugin_need_up + if g:rplugin_ob_busy return endif - let g:rplugin_ob_busy = 1 let fline = line("'<") let eline = line("'>") + if fline < 3 + return + endif let nl= 0 let cmd = "" for ii in range(fline, eline) @@ -362,10 +360,12 @@ function! OBMultiDelete() if nl > 1 let cmd = cmd . "; " endif - let cmd = cmd . OBDelete(0) + let cmd = cmd . OBGetDeleteCmd() + if g:rplugin_curview == "GlobalEnv" + let cmd = substitute(cmd, "); rm(", ", ", "") + endif endfor - call RBrSendToR(cmd) - let g:rplugin_ob_busy = 0 + call OBSendDeleteCmd(cmd) endfunction nmap :call RBrowserDoubleClick() @@ -387,8 +387,21 @@ call writefile([], $VIMRPLUGIN_TMPDIR . "/liblist") au BufUnload call ObBrBufUnload() +function RKeepRunning() + if g:rplugin_myport == 0 + Py StopServer() + sleep 250m + Py RunServer() + endif +endfunction + +if g:vimrplugin_screenplugin + set updatetime=3200 + autocmd CursorHold call RKeepRunning() +endif + if $TMUX_PANE != "" - nmap d :call OBDelete(1) + nmap d :call OBDelete() vmap d :call OBMultiDelete() endif @@ -400,17 +413,6 @@ else endif unlet s:envstring -function RBrowserUpdate() - if g:rplugin_need_up - call UpdateOB(g:rplugin_curview) - endif -endfunction - -if g:vimrplugin_screenplugin - set updatetime=100 - autocmd CursorHold call RBrowserUpdate() -endif - let &cpo = s:cpo_save unlet s:cpo_save diff --git a/r-plugin/vimcom.py b/r-plugin/vimcom.py index 0d630fc..2c41561 100644 --- a/r-plugin/vimcom.py +++ b/r-plugin/vimcom.py @@ -136,6 +136,7 @@ def VimServer(): sock = socket.socket( socket.AF_INET, socket.SOCK_DGRAM ) sock.bind( (UDP_IP,MyPort) ) except Exception as errmsg: + vim.command("let g:rplugin_myport = 0") vim.command("call RWarningMsg('Server failed to bind: " + str(errmsg) + "')") pass From e819c493799fbae6ae11047c8d7db9f80c85b6f9 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Wed, 14 Mar 2012 20:36:50 -0300 Subject: [PATCH 0192/1050] Update. --- doc/r-plugin.txt | 48 +++++++++++++++++++++++++++++------------------- 1 file changed, 29 insertions(+), 19 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 613ba25..125c79c 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -567,7 +567,11 @@ any) used to classify the objects: When running in a terminal emulator under Tmux, the Object Browser will be updated automatically. One limitation is that objects made available by the -command data() will not have their classes recognized in the GlobalEnv view. +command data() may not have their classes recognized in the GlobalEnv view. +Also, when running under Tmux, the Normal mode command d deletes the object +on the cursor line or the element of a list or data.frame. If the Object +Browser is showing the libraries, the library currently on the cursor line is +detached. 4.6. Commenting and uncommenting lines~ @@ -727,25 +731,14 @@ entire code is sourced, which makes it more difficult to find errors in the code sent to R. -5.2. R session is detached when GVim is closed (Linux/Unix only)~ - -If you launch GVim through a custom keyboard shortcut, the problem may be -solved if you add -f as parameter to GVim. The R session also used to be -detached when GVim is closed if you launched GVim by the command line in a -terminal emulator, and, then, closed the terminal-emulator. In any case, to -reattach to the R session, open a new terminal window and type: -> - screen -r -< - -5.3. The clipboard's content is lost (Windows only)~ +5.2. The clipboard's content is lost (Windows only)~ On Windows, the plugin copies the command that will be sent to R into the clipboard. Thus, if you have anything in the clipboard it will be lost while using the plugin. -5.4. The buffer name must be in the window title (Windows only)~ +5.3. The buffer name must be in the window title (Windows only)~ On Windows the plugin tries to activate the "R Console" window, paste the command that is being sent to R, and, then, activate the GVim window. To @@ -754,14 +747,14 @@ edited be in the GVim window title. This is the default if you have not set the option 'titlestring'. -5.5. The menu may not reflect some of your custom key bindings~ +5.4. The menu may not reflect some of your custom key bindings~ If you have created a custom key binding for the Vim-R-plugin, the menu in GVim will not always reflect the correct key binding if it is not the same for Normal, Visual and Insert modes. -5.6. Syntactically correct code may be wrongly indented~ +5.5. Syntactically correct code may be wrongly indented~ If the Vim-R-plugin indents your code wrongly you may get the correct indentation by adding braces and line breaks to it. Example: @@ -784,12 +777,23 @@ indentation by adding braces and line breaks to it. Example: class(x) <- c(if(ordered) "ordered", "factor") < -5.7. Commands are sent twice on Mac OS X~ +5.6. Commands are sent twice on Mac OS X~ If you use the screen plugin with GNU Screen, individual lines may be sent duplicated to R on Mac OS X. +5.7. R session is detached when GVim is closed (Linux/Unix only)~ + +If you launch GVim through a custom keyboard shortcut, the problem may be +solved if you add -f as parameter to GVim. The R session also used to be +detached when GVim is closed if you launched GVim by the command line in a +terminal emulator, and, then, closed the terminal-emulator. In any case, to +reattach to the R session, open a new terminal window and type: +> + screen -r +< + ============================================================================== *r-plugin-options* 6. Options~ @@ -1718,13 +1722,17 @@ important Vim limitations are: These limitations will be solved only if someone with good knowledge of C programming writes patches to Vim source code and the patches are accepted by -the Vim developer. Anyway, if you want to try the Conque Shell, install it -from +the Vim developer. + +In addition to these two limitations, the automatic update of the Object +Browser only works when running Vim under Tmux. Anyway, if you want to try the +Conque Shell, install it from http://www.vim.org/scripts/script.php?script_id=2771 and put in your |vimrc|: > + let vimrplugin_applescript = 0 let vimrplugin_screenplugin = 0 let vimrplugin_conqueplugin = 1 < @@ -1792,6 +1800,8 @@ the R syntax highlighted. * New command :Rhelp (thanks for Nir Atias for suggesting the new feature). * Remove the command :RUpdateObjListAll because Vim may not load the syntax file if it is too big. + * New command in normal and visual modes when on the Object Browser: "d" + deletes objects and detach libraries. 0.9.7 (2012-02-12) From 01ac5f4cf56aee509e72de39d6097388a68317d9 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Wed, 14 Mar 2012 20:37:32 -0300 Subject: [PATCH 0193/1050] Only restart the VimServer() if under Tmux. --- ftplugin/rbrowser.vim | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/ftplugin/rbrowser.vim b/ftplugin/rbrowser.vim index 4e710b2..9fdbead 100644 --- a/ftplugin/rbrowser.vim +++ b/ftplugin/rbrowser.vim @@ -16,7 +16,7 @@ " " Author: Jakson Alves de Aquino " -" Last Change: Wed Mar 14, 2012 11:20AM +" Last Change: Wed Mar 14, 2012 08:18PM "========================================================================== " Only do this when not yet done for this buffer @@ -395,12 +395,9 @@ function RKeepRunning() endif endfunction -if g:vimrplugin_screenplugin +if $TMUX_PANE != "" set updatetime=3200 autocmd CursorHold call RKeepRunning() -endif - -if $TMUX_PANE != "" nmap d :call OBDelete() vmap d :call OBMultiDelete() endif From fe77fdcf2de15565467868a7c0b2544778966259 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 15 Mar 2012 09:26:34 -0300 Subject: [PATCH 0194/1050] Try to make the Object Browser more stable. --- doc/r-plugin.txt | 5 +++-- ftplugin/rbrowser.vim | 20 ++++++++++---------- r-plugin/common_global.vim | 4 ++-- r-plugin/vimcom.py | 2 +- 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 125c79c..fe1d668 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -571,7 +571,8 @@ command data() may not have their classes recognized in the GlobalEnv view. Also, when running under Tmux, the Normal mode command d deletes the object on the cursor line or the element of a list or data.frame. If the Object Browser is showing the libraries, the library currently on the cursor line is -detached. +detached. The Object Browser may stop to be updated automatically for a few +seconds if you press d many times quickly. 4.6. Commenting and uncommenting lines~ @@ -1791,7 +1792,7 @@ the R syntax highlighted. *r-plugin-news* 10. News~ -0.9.8 (2012-03-08) +0.9.8 (2012-03-15) * Use the R package vimcom. The following options are now set on the vimcom R package and no longer in the Vim-R-plugin: allnames, open_df, and diff --git a/ftplugin/rbrowser.vim b/ftplugin/rbrowser.vim index 9fdbead..bdbfa55 100644 --- a/ftplugin/rbrowser.vim +++ b/ftplugin/rbrowser.vim @@ -16,7 +16,7 @@ " " Author: Jakson Alves de Aquino " -" Last Change: Wed Mar 14, 2012 08:18PM +" Last Change: Thu Mar 15, 2012 09:14AM "========================================================================== " Only do this when not yet done for this buffer @@ -114,7 +114,7 @@ function! RBrowserDoubleClick() endif " Toggle state of list or data.frame: open X closed - let key = RBrowserGetName(1) + let key = RBrowserGetName(1, line(".")) if g:rplugin_curview == "GlobalEnv" exe 'Py SendToR("' . "\005" . '-' . substitute(key, '\$', '-', "g") . '")' call UpdateOB("GlobalEnv") @@ -134,7 +134,7 @@ function! RBrowserRightClick() return endif - let key = RBrowserGetName(1) + let key = RBrowserGetName(1, line(".")) if key == "" return endif @@ -217,10 +217,10 @@ function! RBrowserFindParent(word, curline, curpos) return "" endfunction -function! RBrowserGetName(complete) +function! RBrowserGetName(complete, lnum) let curpos = col(".") - let line = getline(".") + let line = getline(a:lnum) if line =~ "^$" return endif @@ -309,8 +309,8 @@ function! SourceObjBrLines() exe "source " . $VIMRPLUGIN_TMPDIR . "/objbrowserInit" endfunction -function! OBGetDeleteCmd() - let obj = RBrowserGetName(1) +function! OBGetDeleteCmd(lnum) + let obj = RBrowserGetName(1, a:lnum) if g:rplugin_curview == "GlobalEnv" if obj =~ '\$' let cmd = obj . ' <- NULL' @@ -339,7 +339,7 @@ function! OBDelete() if g:rplugin_ob_busy || line(".") < 3 return endif - let cmd = OBGetDeleteCmd() + let cmd = OBGetDeleteCmd(line(".")) call OBSendDeleteCmd(cmd) endfunction @@ -355,12 +355,11 @@ function! OBMultiDelete() let nl= 0 let cmd = "" for ii in range(fline, eline) - call setpos(".", [0, ii, 1, 0]) let nl+= 1 if nl > 1 let cmd = cmd . "; " endif - let cmd = cmd . OBGetDeleteCmd() + let cmd = cmd . OBGetDeleteCmd(ii) if g:rplugin_curview == "GlobalEnv" let cmd = substitute(cmd, "); rm(", ", ", "") endif @@ -392,6 +391,7 @@ function RKeepRunning() Py StopServer() sleep 250m Py RunServer() + echon endif endfunction diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index fe09a6c..8d6b8a0 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -15,7 +15,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Sun Mar 11, 2012 11:55PM +" Last Change: Thu Mar 15, 2012 09:16AM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -1845,7 +1845,7 @@ endfunction " Call R functions for the word under cursor function RAction(rcmd) if &filetype == "rbrowser" - let rkeyword = RBrowserGetName(1) + let rkeyword = RBrowserGetName(1, line(".")) else let rkeyword = RGetKeyWord() endif diff --git a/r-plugin/vimcom.py b/r-plugin/vimcom.py index 2c41561..86118f7 100644 --- a/r-plugin/vimcom.py +++ b/r-plugin/vimcom.py @@ -137,7 +137,7 @@ def VimServer(): sock.bind( (UDP_IP,MyPort) ) except Exception as errmsg: vim.command("let g:rplugin_myport = 0") - vim.command("call RWarningMsg('Server failed to bind: " + str(errmsg) + "')") + vim.command("call RWarningMsg('" + str(errmsg) + "')") pass def RunServer(): From ef3a1b70871e164d52f16301787535af10916fc3 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 15 Mar 2012 10:00:57 -0300 Subject: [PATCH 0195/1050] Do not try to delete if the server is not running. --- ftplugin/rbrowser.vim | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ftplugin/rbrowser.vim b/ftplugin/rbrowser.vim index bdbfa55..b88574c 100644 --- a/ftplugin/rbrowser.vim +++ b/ftplugin/rbrowser.vim @@ -16,7 +16,7 @@ " " Author: Jakson Alves de Aquino " -" Last Change: Thu Mar 15, 2012 09:14AM +" Last Change: Thu Mar 15, 2012 09:54AM "========================================================================== " Only do this when not yet done for this buffer @@ -336,7 +336,7 @@ function! OBSendDeleteCmd(cmd) endfunction function! OBDelete() - if g:rplugin_ob_busy || line(".") < 3 + if g:rplugin_ob_busy || line(".") < 3 || g:rplugin_myport == 0 return endif let cmd = OBGetDeleteCmd(line(".")) @@ -344,7 +344,7 @@ function! OBDelete() endfunction function! OBMultiDelete() - if g:rplugin_ob_busy + if g:rplugin_ob_busy || g:rplugin_myport == 0 return endif let fline = line("'<") From 7b32d70d24ddfaa9e297f4b3d91e9ec6c145b572 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 15 Mar 2012 23:03:01 -0300 Subject: [PATCH 0196/1050] The VimServer() do not call UpdateOB() if busy. --- ftplugin/rbrowser.vim | 4 ++-- r-plugin/common_global.vim | 3 ++- r-plugin/vimcom.py | 2 ++ 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/ftplugin/rbrowser.vim b/ftplugin/rbrowser.vim index b88574c..dbeff08 100644 --- a/ftplugin/rbrowser.vim +++ b/ftplugin/rbrowser.vim @@ -16,7 +16,7 @@ " " Author: Jakson Alves de Aquino " -" Last Change: Thu Mar 15, 2012 09:54AM +" Last Change: Thu Mar 15, 2012 10:48PM "========================================================================== " Only do this when not yet done for this buffer @@ -54,7 +54,6 @@ endif " Current view of the object browser: .GlobalEnv X loaded libraries let g:rplugin_curview = "GlobalEnv" -let g:rplugin_ob_busy = 0 function! UpdateOB(what) if g:rplugin_curview != a:what @@ -333,6 +332,7 @@ function! OBSendDeleteCmd(cmd) sleep 250m let g:rplugin_ob_busy = 0 call UpdateOB(g:rplugin_curview) + sleep 10m endfunction function! OBDelete() diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 8d6b8a0..e03e362 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -15,7 +15,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Thu Mar 15, 2012 09:16AM +" Last Change: Thu Mar 15, 2012 10:44PM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -2943,6 +2943,7 @@ let g:rplugin_has_new_obj = 0 let g:rplugin_objbr_port = 0 let g:rplugin_myport = 0 let g:rplugin_editor_port = 0 +let g:rplugin_ob_busy = 0 call SetRPath() diff --git a/r-plugin/vimcom.py b/r-plugin/vimcom.py index 86118f7..c87551a 100644 --- a/r-plugin/vimcom.py +++ b/r-plugin/vimcom.py @@ -96,6 +96,8 @@ def VimServer(): while FinishNow == False: try: data, addr = sock.recvfrom( 1024 ) # buffer size is 1024 bytes + if vim.eval("g:rplugin_ob_busy") == "1": + data = "" if re.match("EXPR ", data): vim.command("silent exe '" + re.sub("^EXPR ", "", data) + "'") else: From a21163e53c6a2e7fee74b6758940dc4f7d406377 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Mon, 19 Mar 2012 08:20:12 -0300 Subject: [PATCH 0197/1050] Warn if the server failed to start. --- r-plugin/vimcom.py | 1 + 1 file changed, 1 insertion(+) diff --git a/r-plugin/vimcom.py b/r-plugin/vimcom.py index c87551a..2594bad 100644 --- a/r-plugin/vimcom.py +++ b/r-plugin/vimcom.py @@ -88,6 +88,7 @@ def VimServer(): if sock == None: MyPort = 0 + vim.command("call RWarningMsg('Could not bind to any port.')") return else: vim.command("let g:rplugin_myport = " + str(MyPort)) From 48ec659ed391b1a1cf9552dd1200c90b1e1a1cb3 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Mon, 19 Mar 2012 23:47:23 -0300 Subject: [PATCH 0198/1050] Add vimcom as dependency on Windows. --- doc/r-plugin.txt | 56 ++++++++++++++++++++++++++++-------------------- 1 file changed, 33 insertions(+), 23 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index fe1d668..874206f 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -63,6 +63,7 @@ to deal with. - Send to R the Sweave and pdflatex commands. * Omni completion (auto-completion) for R objects (.GlobalEnv and installed packages). The list of installed packages must be updated manually. + * Auto-completion of function arguments. * Ability to see R's documentation in a Vim's buffer: - Automatic calculation of the best layout of the R documentation buffer (split the window either horizontally or vertically according to the @@ -172,14 +173,12 @@ show how the plugin will work on Linux in different conditions: Screen plugin (GNU Screen) vimrplugin_tmux = 0 or Tmux not found Tmux (external terminal) vimrplugin_screenplugin = 0 GNU Screen (external terminal) vimrplugin_screenplugin = 0 and no Tmux - Conque Shell idem and vimrplugin_conqueplugin = 1 GVim Condition~ ------------------------------ ------------------------------------- Tmux (external terminal) default on Linux GNU Screen (external terminal) vimrplugin_tmux = 0 or Tmux not found - Conque Shell idem and vimrplugin_conqueplugin = 1 Note: On Mac OS X the plugin will use AppleScript in both Vim and GVim unless @@ -221,6 +220,9 @@ to install external dependencies: find the file that matches exactly the version of Python that you installed. + * vimcom: An R package. You can install it with the R command + install.packages("vimcom"). + Create your |vimfiles| directory if you do not have it yet. Its path will be similar to one of the following: > @@ -278,8 +280,8 @@ section Indenting setup (|r-plugin-indenting|) of this document. 3.4.3 Hide unused buttons~ -Edit Vim's toolbar and remove the buttons that you never use. The plugin adds -some buttons to the toolbar, but you may not see them because gvim has too +Edit GVim's toolbar and remove the buttons that you never use. The plugin adds +some buttons to the toolbar, but you may not see them because GVim has too many buttons by default. Please see the page below to know how to hide buttons on the toolbar: @@ -572,7 +574,9 @@ Also, when running under Tmux, the Normal mode command d deletes the object on the cursor line or the element of a list or data.frame. If the Object Browser is showing the libraries, the library currently on the cursor line is detached. The Object Browser may stop to be updated automatically for a few -seconds if you press d many times quickly. +seconds if you press d many times quickly. Please, use a value greater than +250 to set the time in miliseconds that the Object Browser should wait for R +message that the object was already deleted (see |vimrplugin_ob_sleep|). 4.6. Commenting and uncommenting lines~ @@ -805,6 +809,7 @@ reattach to the R session, open a new terminal window and type: |vimrplugin_rnowebchunk| Convert '<' into '<<>>=\n@' in Rnoweb files |vimrplugin_objbr_place| Placement of Object Browser |vimrplugin_objbr_w| Initial width of Object Browser window +|vimrplugin_objbr_sleep| Time the Object Browser waits for R after "d" |vimrplugin_vimpager| Use Vim to see R documentation |vimrplugin_editor_w| Minimum width of R script buffer |vimrplugin_help_w| Desired width of R documentation buffer @@ -898,6 +903,14 @@ beside the R Console. Valid values for the Object Browser placement are let vimrplugin_objbr_place = "script,right" let vimrplugin_objbr_place = "console,left" < +When deleting an object from the Object Browser (possible if running Vim under +Tmux), the following option controls the time in miliseconds that the Object +Browser will wait for R to send the message updating the list of objects: +> + let vimrplugin_ob_sleep = 250m +< +You should increase this value if the "[Errno 98]" message appears frequently. + 6.4. Vim as pager for R help~ *vimrplugin_vimpager* @@ -1210,9 +1223,8 @@ When one types in the R Console the cursor goes to the beginning of the line and one types the characters to the right of the cursor are deleted. This is useful to avoid characters left on the R Console being mixed with commands sent by Vim. However, sending may be problematic if using -either Tmux or GNU Screen in some systems and may cause incomplete output when -using the Conque Shell plugin. The Vim-R-plugin will add to every -command if you put in your |vimrc|: +either Tmux or GNU Screen in some systems. The Vim-R-plugin will add + to every command if you put in your |vimrc|: > let vimrplugin_ca_ck = 1 < @@ -1278,6 +1290,8 @@ your cursor. Add the following to your |vimrc| to have an easy way to pass R the levels command: > map rk :call RAction("levels") + map t :call RAction("tail") + map h :call RAction("head") < Then if you type rk R will receive the command > @@ -1731,12 +1745,20 @@ Conque Shell, install it from http://www.vim.org/scripts/script.php?script_id=2771 -and put in your |vimrc|: +do not load the R package "colorout", and put in your |vimrc|: > + let vimrplugin_ca_ck = 0 let vimrplugin_applescript = 0 let vimrplugin_screenplugin = 0 let vimrplugin_conqueplugin = 1 < +You may also want to put the following Conque options in your |vimrc| (look at +the Conque Shell documentations for details): +> + let ConqueTerm_CWInsert = 1 + let ConqueTerm_Color = 0 + let ConqueTerm_ReadUnfocused = 1 +< By default, the window will be split horizontally. Put the following in your |vimrc| if you prefer to split the window vertically: > @@ -1761,18 +1783,6 @@ Then, you will be able to scroll the R Console buffer at any time by pressing th key in Normal mode. Of course, you should replace with your preferred key. -You may also want to put the following Conque options in your |vimrc| (look at -the Conque Shell documentations for details): -> - let ConqueTerm_CWInsert = 1 - let ConqueTerm_Color = 0 - let ConqueTerm_ReadUnfocused = 1 -< -Note: The use of |ConqueTerm_ReadUnfocused| will set the value of 'updatetime' -to 1000 milliseconds. -> - let vimrplugin_conquesleep = 1 -< With the Conque Shell, the option |vimrplugin_nosingler| is ignored, and, by default, the object browser window will be created at the right of the R Console window. @@ -1792,7 +1802,7 @@ the R syntax highlighted. *r-plugin-news* 10. News~ -0.9.8 (2012-03-15) +0.9.8 (2012-03-19) * Use the R package vimcom. The following options are now set on the vimcom R package and no longer in the Vim-R-plugin: allnames, open_df, and @@ -1802,7 +1812,7 @@ the R syntax highlighted. * Remove the command :RUpdateObjListAll because Vim may not load the syntax file if it is too big. * New command in normal and visual modes when on the Object Browser: "d" - deletes objects and detach libraries. + deletes objects and detach libraries. New option: vimrplugin_ob_sleep. 0.9.7 (2012-02-12) From d6b14c93c6543ff4cbb45a20b9169dbc639652de Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 24 Mar 2012 08:13:36 -0300 Subject: [PATCH 0199/1050] Close the Object Browser before quiting R on GVim. --- r-plugin/common_global.vim | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index e03e362..2abfd59 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -15,7 +15,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Thu Mar 15, 2012 10:44PM +" Last Change: Sat Mar 24, 2012 08:10AM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -1417,6 +1417,11 @@ function RQuit(how) sleep 200m endif + if bufloaded(b:objbrtitle) + exe "bunload! " . b:objbrtitle + sleep 150m + endif + if exists("b:quit_command") call SendCmdToR(b:quit_command) else @@ -1459,9 +1464,6 @@ function RQuit(how) endif endif - if bufloaded(b:objbrtitle) - exe "bunload! " . b:objbrtitle - endif endfunction " Tell R to create a list of objects file listing all currently available From de2078b3b33e2def1a8b86e94b44cfd5ea253432 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 24 Mar 2012 08:15:43 -0300 Subject: [PATCH 0200/1050] Add SendCmdToR key binding example. --- doc/r-plugin.txt | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 874206f..aaaf205 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -1289,9 +1289,9 @@ binding that would allow you to rapidly get the levels of the object under your cursor. Add the following to your |vimrc| to have an easy way to pass R the levels command: > - map rk :call RAction("levels") - map t :call RAction("tail") - map h :call RAction("head") + map rk :call RAction("levels") + map t :call RAction("tail") + map h :call RAction("head") < Then if you type rk R will receive the command > @@ -1300,6 +1300,11 @@ Then if you type rk R will receive the command You should replace rk with the key binding that you want to use and "levels" with the R function that you want to call. +If the command that you want to send does not require an R object as argument, +you can create a shortcut to it by following the example: +> + map s :call SendCmdToR("search()") +< ============================================================================== *r-plugin-files* @@ -1802,7 +1807,7 @@ the R syntax highlighted. *r-plugin-news* 10. News~ -0.9.8 (2012-03-19) +0.9.8 (2012-03-24) * Use the R package vimcom. The following options are now set on the vimcom R package and no longer in the Vim-R-plugin: allnames, open_df, and From c47f38da54eeb0b330556fbc910af75c5bde6278 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Wed, 28 Mar 2012 10:41:34 -0300 Subject: [PATCH 0201/1050] Add support to knitr package. --- doc/r-plugin.txt | 20 +++++++++++++++--- ftplugin/rnoweb.vim | 43 ++++++++++++++++++++++++++------------ r-plugin/common_global.vim | 5 ++++- 3 files changed, 51 insertions(+), 17 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index aaaf205..c132d57 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -221,8 +221,14 @@ to install external dependencies: installed. * vimcom: An R package. You can install it with the R command - install.packages("vimcom"). - + install.packages("vimcom"). The vimcom package creates a server on R to + allow the communication with Vim. You certainly will want to put + the following lines in your Rprofile (usually at ~/Documents/.Rprofile): +> + if(interactive()){ + library(vimcom) + } +< Create your |vimfiles| directory if you do not have it yet. Its path will be similar to one of the following: > @@ -381,6 +387,9 @@ Command . Sweave (cur file) \sw . Sweave and PDF (cur file) \sp . Sweave, BibTeX and PDF (cur file) \sb + . Knitr (cur file) \kn + . Knitr and PDF (cur file) \kp + . Knitr, BibTeX and PDF (cur file) \kb -------------------------------------------------------- . Build tags file (cur dir) :RBuildTags ----------------------------------------------------------- @@ -1177,6 +1186,7 @@ Example: 6.19. LaTeX command~ *vimrplugin_latexcmd* *vimrplugin_sweaveargs* + *vimrplugin_knitargs* By default, Vim calls pdflatex to produce a pdf document from the .tex file produced by the R Sweave command. You can use the option vimrplugin_latexcmd to change this behavior. Example: @@ -1186,6 +1196,9 @@ to change this behavior. Example: If you want to pass arguments do the Sweave() function, set the value of the vimrplugin_sweaveargs variable. +If you want to pass arguments do the knit() function, set the value of the +vimrplugin_knitargs variable. + 6.20. Never unmake the R menu and tool bar buttons~ *vimrplugin_never_unmake_menu* @@ -1807,7 +1820,7 @@ the R syntax highlighted. *r-plugin-news* 10. News~ -0.9.8 (2012-03-24) +0.9.8 (2012-03-28) * Use the R package vimcom. The following options are now set on the vimcom R package and no longer in the Vim-R-plugin: allnames, open_df, and @@ -1818,6 +1831,7 @@ the R syntax highlighted. syntax file if it is too big. * New command in normal and visual modes when on the Object Browser: "d" deletes objects and detach libraries. New option: vimrplugin_ob_sleep. + * Add support to knitr package. 0.9.7 (2012-02-12) diff --git a/ftplugin/rnoweb.vim b/ftplugin/rnoweb.vim index cb3358e..823062f 100644 --- a/ftplugin/rnoweb.vim +++ b/ftplugin/rnoweb.vim @@ -17,7 +17,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Thu Dec 22, 2011 08:59AM +" Last Change: Wed Mar 28, 2012 10:39AM "========================================================================== " Only do this when not yet done for this buffer @@ -109,11 +109,15 @@ function! RnwNextChunk() range endfunction " Sweave and compile the current buffer content -function! RMakePDF(bibtex) +function! RMakePDF(bibtex, knit) update call RSetWD() let pdfcmd = "vim.Sweave('" . expand("%:t") . "'" + if a:knit + let pdfcmd = pdfcmd . ', knit = TRUE' + endif + if g:vimrplugin_latexcmd != "pdflatex" let pdfcmd = pdfcmd . ", latexcmd = '" . g:vimrplugin_latexcmd . "'" endif @@ -122,8 +126,14 @@ function! RMakePDF(bibtex) let pdfcmd = pdfcmd . ", bibtex = TRUE" endif - if exists("g:vimrplugin_sweaveargs") - let pdfcmd = pdfcmd . ", " . g:vimrplugin_sweaveargs + if a:knit + if exists("g:vimrplugin_knitargs") + let pdfcmd = pdfcmd . ", " . g:vimrplugin_knitargs + endif + else + if exists("g:vimrplugin_sweaveargs") + let pdfcmd = pdfcmd . ", " . g:vimrplugin_sweaveargs + endif endif let pdfcmd = pdfcmd . ")" @@ -153,11 +163,15 @@ function! SendChunkToR(e, m) endfunction " Sweave the current buffer content -function! RSweave() +function! RSweave(knit) update let b:needsnewomnilist = 1 call RSetWD() - call SendCmdToR('Sweave("' . expand("%:t") . '")') + if a:knit + call SendCmdToR('require(knitr); knit("' . expand("%:t") . '")') + else + call SendCmdToR('Sweave("' . expand("%:t") . '")') + endif endfunction if g:vimrplugin_rnowebchunk == 1 @@ -175,14 +189,17 @@ call RControlMaps() call RCreateMaps("nvi", 'RSetwd', 'rd', ':call RSetWD()') " Only .Rnw files use these functions: -call RCreateMaps("nvi", 'RSweave', 'sw', ':call RSweave()') -call RCreateMaps("nvi", 'RMakePDF', 'sp', ':call RMakePDF("nobib")') -call RCreateMaps("nvi", 'RBibTeX', 'sb', ':call RMakePDF("bibtex")') +call RCreateMaps("nvi", 'RSweave', 'sw', ':call RSweave(0)') +call RCreateMaps("nvi", 'RMakePDF', 'sp', ':call RMakePDF("nobib", 0)') +call RCreateMaps("nvi", 'RBibTeX', 'sb', ':call RMakePDF("bibtex", 0)') +call RCreateMaps("nvi", 'RKnit', 'kn', ':call RSweave(1)') +call RCreateMaps("nvi", 'RMakePDFK', 'kp', ':call RMakePDF("nobib", 1)') +call RCreateMaps("nvi", 'RBibTeXK', 'kb', ':call RMakePDF("bibtex", 1)') call RCreateMaps("nvi", 'RIndent', 'si', ':call RnwToggleIndentSty()') -call RCreateMaps("ni", 'RSendChunk', 'cc', ':call SendChunkToR("silent", "stay")') -call RCreateMaps("ni", 'RESendChunk', 'ce', ':call SendChunkToR("echo", "stay")') -call RCreateMaps("ni", 'RDSendChunk', 'cd', ':call SendChunkToR("silent", "down")') -call RCreateMaps("ni", 'REDSendChunk', 'ca', ':call SendChunkToR("echo", "down")') +call RCreateMaps("ni", 'RSendChunk', 'cc', ':call SendChunkToR("silent", "stay")') +call RCreateMaps("ni", 'RESendChunk', 'ce', ':call SendChunkToR("echo", "stay")') +call RCreateMaps("ni", 'RDSendChunk', 'cd', ':call SendChunkToR("silent", "down")') +call RCreateMaps("ni", 'REDSendChunk', 'ca', ':call SendChunkToR("echo", "down")') nmap gn :call RnwNextChunk() nmap gN :call RnwPreviousChunk() diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 2abfd59..eba0c03 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -15,7 +15,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Sat Mar 24, 2012 08:10AM +" Last Change: Wed Mar 28, 2012 10:38AM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -2193,6 +2193,9 @@ function MakeRMenu() call RCreateMenuItem("nvi", 'Command.Sweave\ (cur\ file)', 'RSweave', 'sw', ':call RSweave()') call RCreateMenuItem("nvi", 'Command.Sweave\ and\ PDF\ (cur\ file)', 'RMakePDF', 'sp', ':call RMakePDF("nobib")') call RCreateMenuItem("nvi", 'Command.Sweave,\ BibTeX\ and\ PDF\ (cur\ file)', 'RMakePDF', 'sb', ':call RMakePDF("bibtex")') + call RCreateMenuItem("nvi", 'Command.Knitr\ (cur\ file)', 'RSweave', 'kn', ':call RSweave()') + call RCreateMenuItem("nvi", 'Command.Knitr\ and\ PDF\ (cur\ file)', 'RMakePDF', 'kp', ':call RMakePDF("nobib")') + call RCreateMenuItem("nvi", 'Command.Knitr,\ BibTeX\ and\ PDF\ (cur\ file)', 'RMakePDF', 'kb', ':call RMakePDF("bibtex")') endif "------------------------------- menu R.Command.-Sep3- From ca06db22f8f896c213e3ae65c8d2ad7af73e4b50 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Wed, 28 Mar 2012 12:53:23 -0300 Subject: [PATCH 0202/1050] Minor improvements in RCompleteArgs(). --- r-plugin/common_global.vim | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index eba0c03..9a1ff30 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -15,7 +15,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Wed Mar 28, 2012 10:38AM +" Last Change: Wed Mar 28, 2012 12:53PM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -137,7 +137,7 @@ function RCompleteArgs() let rkeyword = '^' . RGetKeyWord() . ';' call cursor(cpos[1], cpos[2]) for omniL in flines - if omniL =~ rkeyword + if omniL =~ rkeyword && omniL =~ ";function;function;" let tmp1 = split(omniL, ';') if len(tmp1) == 5 let info = tmp1[4] @@ -156,7 +156,7 @@ function RCompleteArgs() for id in range(len(argsL)) let newkey = '^' . argkey let tmp2 = split(substitute(argsL[id], "^ *", '', ""), "=") - if argkey == '' || tmp2[0] =~ newkey + if (argkey == '' || tmp2[0] =~ newkey) && tmp2[0] !~ "No arguments" if len(tmp2) == 2 let tmp2[0] = tmp2[0] . "= " let tmp3 = {'word': tmp2[0], 'menu': tmp2[1]} @@ -169,6 +169,9 @@ function RCompleteArgs() call add(args, tmp3) endif endfor + if argkey == '' && len(args) > 0 + call insert(args, {'word': ' ', 'menu': ''}) + endif call complete(idx2, args) return '' endif From fc2345051e9e5c2b24387ddce63227ee45a03e65 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Fri, 30 Mar 2012 11:58:23 -0300 Subject: [PATCH 0203/1050] Complete arguments even if not in omnilist. --- r-plugin/common_global.vim | 21 +++++++++++++++++++-- r-plugin/vimcom.py | 2 ++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 9a1ff30..6193be5 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -15,7 +15,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Wed Mar 28, 2012 12:53PM +" Last Change: Fri Mar 30, 2012 11:55AM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -134,7 +134,8 @@ function RCompleteArgs() endif if np == 0 call cursor(lnum, idx) - let rkeyword = '^' . RGetKeyWord() . ';' + let rkeyword0 = RGetKeyWord() + let rkeyword = '^' . rkeyword0 . ';' call cursor(cpos[1], cpos[2]) for omniL in flines if omniL =~ rkeyword && omniL =~ ";function;function;" @@ -176,6 +177,21 @@ function RCompleteArgs() return '' endif endfor + + " The function isn't in the omni list + exe 'Py SendToR("vimcom:::vim.args(' . "'" . rkeyword0 . "', '" . argkey . "')" . '")' + if g:rplugin_vimcomport > 0 && g:rplugin_lastrpl != "NOT_EXISTS" + let args = [] + let tmp = split(g:rplugin_lastrpl, '\t') + if(len(tmp) > 0) + for id in range(len(tmp)) + call add(args, {'word': tmp[id]}) + endfor + call complete(idx2, args) + endif + return '' + endif + break endif let idx -= 1 @@ -2951,6 +2967,7 @@ let g:rplugin_has_new_obj = 0 let g:rplugin_objbr_port = 0 let g:rplugin_myport = 0 let g:rplugin_editor_port = 0 +let g:rplugin_vimcomport = 0 let g:rplugin_ob_busy = 0 call SetRPath() diff --git a/r-plugin/vimcom.py b/r-plugin/vimcom.py index 2594bad..13d9df8 100644 --- a/r-plugin/vimcom.py +++ b/r-plugin/vimcom.py @@ -38,6 +38,8 @@ def DiscoverVimComPort(): if VimComPort >= 10050: VimComPort = 0 vim.command("call RWarningMsg('VimCom Port not found.')") + else: + vim.command("let g:rplugin_vimcomport = " + str(VimComPort)) return(VimComPort) From d471a540c9872fe784a35d01e3149493882af4e3 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Fri, 30 Mar 2012 12:13:28 -0300 Subject: [PATCH 0204/1050] Minor improvements. --- doc/r-plugin.txt | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index c132d57..30f1266 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -387,9 +387,9 @@ Command . Sweave (cur file) \sw . Sweave and PDF (cur file) \sp . Sweave, BibTeX and PDF (cur file) \sb - . Knitr (cur file) \kn - . Knitr and PDF (cur file) \kp - . Knitr, BibTeX and PDF (cur file) \kb + . Knit (cur file) \kn + . Knit and PDF (cur file) \kp + . Knit, BibTeX and PDF (cur file) \kb -------------------------------------------------------- . Build tags file (cur dir) :RBuildTags ----------------------------------------------------------- @@ -1282,6 +1282,9 @@ list of the names for custom key bindings: RESendMBlock RListSpace RCompleteArgs REDSendMBlock RMakePDF < +Note: The prefix RE means "echo"; RD, "cursor down"; RED, both "echo" and + "down". + The completion of function arguments only happens in Insert mode. To customize its keybind you should put in your |vimrc| something as in the example: > From ef76cfaf65627345670764a0a87d8dec53d1ea20 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Fri, 30 Mar 2012 17:31:46 -0300 Subject: [PATCH 0205/1050] Improvement in function arguments completion. --- r-plugin/common_global.vim | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 6193be5..03a7e51 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -15,7 +15,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Fri Mar 30, 2012 11:55AM +" Last Change: Fri Mar 30, 2012 05:29PM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -185,8 +185,13 @@ function RCompleteArgs() let tmp = split(g:rplugin_lastrpl, '\t') if(len(tmp) > 0) for id in range(len(tmp)) - call add(args, {'word': tmp[id]}) + let tmp2 = split(tmp[id], "=") + let tmp2[0] = tmp2[0] . "= " + call add(args, {'word': tmp2[0], 'menu': tmp2[1]}) endfor + if argkey == '' && len(args) > 0 + call insert(args, {'word': ' ', 'menu': ''}) + endif call complete(idx2, args) endif return '' From 1d553d2940d0d385520249d512814017293795da Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Fri, 30 Mar 2012 19:25:00 -0300 Subject: [PATCH 0206/1050] Fix minor bugs. --- r-plugin/common_global.vim | 12 ++++++++---- r-plugin/vimcom.py | 1 + 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 03a7e51..3a744e9 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -15,7 +15,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Fri Mar 30, 2012 05:29PM +" Last Change: Fri Mar 30, 2012 06:31PM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -180,14 +180,18 @@ function RCompleteArgs() " The function isn't in the omni list exe 'Py SendToR("vimcom:::vim.args(' . "'" . rkeyword0 . "', '" . argkey . "')" . '")' - if g:rplugin_vimcomport > 0 && g:rplugin_lastrpl != "NOT_EXISTS" + if g:rplugin_vimcomport > 0 && g:rplugin_lastrpl != "NOT_EXISTS" && g:rplugin_lastrpl != "NO_ARGS" let args = [] let tmp = split(g:rplugin_lastrpl, '\t') if(len(tmp) > 0) for id in range(len(tmp)) let tmp2 = split(tmp[id], "=") - let tmp2[0] = tmp2[0] . "= " - call add(args, {'word': tmp2[0], 'menu': tmp2[1]}) + if len(tmp2) > 1 + let tmp2[0] = tmp2[0] . "= " + call add(args, {'word': tmp2[0], 'menu': tmp2[1]}) + else + call add(args, {'word': tmp2[0], 'menu': ' '}) + endif endfor if argkey == '' && len(args) > 0 call insert(args, {'word': ' ', 'menu': ''}) diff --git a/r-plugin/vimcom.py b/r-plugin/vimcom.py index 13d9df8..b71300a 100644 --- a/r-plugin/vimcom.py +++ b/r-plugin/vimcom.py @@ -67,6 +67,7 @@ def SendToR(aString): if received is None: vim.command("let g:rplugin_lastrpl = 'NOANSWER'") else: + received = received.replace("'", "") vim.command("let g:rplugin_lastrpl = '" + received + "'") From 751524e35ad3d27c7dd4e48d2bb9e42d078e6b1c Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Fri, 30 Mar 2012 19:59:57 -0300 Subject: [PATCH 0207/1050] Correctly scape single quote. --- r-plugin/vimcom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/r-plugin/vimcom.py b/r-plugin/vimcom.py index b71300a..9ce3d20 100644 --- a/r-plugin/vimcom.py +++ b/r-plugin/vimcom.py @@ -67,7 +67,7 @@ def SendToR(aString): if received is None: vim.command("let g:rplugin_lastrpl = 'NOANSWER'") else: - received = received.replace("'", "") + received = received.replace("'", "' . \"'\" . '") vim.command("let g:rplugin_lastrpl = '" + received + "'") From 0c0f91f65f0404acde03f320ec36e9e3bd62c295 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Fri, 30 Mar 2012 23:36:15 -0300 Subject: [PATCH 0208/1050] Use 'Py SendToR' to run vim.bol for GlobalEnv. --- r-plugin/common_global.vim | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 3a744e9..8ffe78f 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -15,7 +15,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Fri Mar 30, 2012 06:31PM +" Last Change: Fri Mar 30, 2012 11:33PM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -1513,13 +1513,20 @@ function BuildROmniList(env, what) let omnilistcmd = omnilistcmd . ')' call delete($VIMRPLUGIN_TMPDIR . "/vimbol_finished") - echohl WarningMsg - echo "Please, wait..." - echohl Normal - call SendCmdToR(omnilistcmd) if a:env =~ "GlobalEnv" - sleep 100m + exe "Py SendToR('" . omnilistcmd . "')" + if g:rplugin_lastrpl == "R is busy." + call RWarningMsg("R is busy.") + let b:needsnewomnilist = 1 + sleep 800m + return + endif + sleep 20m else + echohl WarningMsg + echo "Please, wait..." + echohl Normal + call SendCmdToR(omnilistcmd) sleep 2 endif let ii = 0 From 42ab5944b1d61bfe09eae952d0003bbf41a74932 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 31 Mar 2012 13:01:11 -0300 Subject: [PATCH 0209/1050] New omni list file format and name. --- Makefile | 14 ++++----- autoload/rcomplete.vim | 21 ++++---------- doc/r-plugin.txt | 6 ++-- r-plugin/common_global.vim | 58 +++++++++++++++----------------------- 4 files changed, 40 insertions(+), 59 deletions(-) diff --git a/Makefile b/Makefile index 675e8d0..757da63 100644 --- a/Makefile +++ b/Makefile @@ -34,15 +34,15 @@ zip: mkdir -p vim-r-plugin-tmp/usr/share/vim/addons ) rm -f /tmp/vim-r-plugin-$(PLUGINVERSION).zip # To make the distribution version of the plugin the files - # functions.vim.vanilla and omniList.vanilla must exist. To generate these + # functions.vim.vanilla and omnils.vanilla must exist. To generate these # files, the Vim command :RUpdateObjList must be run with R vanilla running # (that is, R with only the default libraries loaded) and, then, the files - # functions.vim and omniList must be renamed. + # functions.vim and omnils must be renamed. ( cd r-plugin ;\ mv functions.vim functions.vim.current ;\ - mv omniList omniList.current ;\ + mv omnils omnils.current ;\ cp functions.vim.vanilla functions.vim ;\ - cp omniList.vanilla omniList ) + cp omnils.vanilla omnils ) # Update the version date in doc/r-plugin.txt header and in the news sed -i -e "s/^Version: [0-9].[0-9].[0-9]/Version: $(PLUGINVERSION)/" doc/r-plugin.txt sed -i -e "s/^$(PLUGINVERSION) (201[0-9]-[0-9][0-9]-[0-9][0-9])$$/$(PLUGINVERSION) ($(PLUGINRELEASEDATE))/" doc/r-plugin.txt @@ -51,7 +51,7 @@ zip: indent/rnoweb.vim indent/rhelp.vim autoload/rcomplete.vim ftplugin/r*.vim \ syntax/rout.vim syntax/r.vim syntax/rhelp.vim syntax/rdoc.vim syntax/rbrowser.vim \ doc/r-plugin.txt r-plugin/functions.vim r-plugin/vimcom.py \ - r-plugin/global_r_plugin.vim r-plugin/omniList r-plugin/windows.py \ + r-plugin/global_r_plugin.vim r-plugin/omnils r-plugin/windows.py \ r-plugin/vimActivate.js r-plugin/tex_indent.vim r-plugin/r.snippets \ r-plugin/common_buffer.vim r-plugin/common_global.vim \ bitmaps/ricon.xbm bitmaps/ricon.png \ @@ -66,10 +66,10 @@ zip: bitmaps/RListSpace.png bitmaps/RListSpace.bmp \ bitmaps/RClear.png bitmaps/RClear.bmp \ bitmaps/RClearAll.png bitmaps/RClearAll.bmp - # Rename the functions.vim and omniList files + # Rename the functions.vim and omnils files ( cd $(PLUGINHOME)/r-plugin ;\ mv functions.vim.current functions.vim ;\ - mv omniList.current omniList ) + mv omnils.current omnils ) # Unpack the tar.gz and create the zip file (cd /tmp ;\ tar -xvzf vimrplugintmpfile.tar.gz -C vim-r-plugin-tmp/usr/share/vim/addons > /dev/null ;\ diff --git a/autoload/rcomplete.vim b/autoload/rcomplete.vim index a115111..9a5a56b 100644 --- a/autoload/rcomplete.vim +++ b/autoload/rcomplete.vim @@ -1,7 +1,7 @@ " Vim completion script " Language: R " Maintainer: Jakson Alves de Aquino -" Last Change: Tue Jan 18, 2011 10:11AM +" Last Change: Sat Mar 31, 2012 12:42PM " fun! rcomplete#CompleteR(findstart, base) @@ -29,21 +29,12 @@ fun! rcomplete#CompleteR(findstart, base) if line =~ newbase " Skip cols of data frames unless the user is really looking for them. if a:base !~ '\$' && line =~ '\$' - continue + continue endif - let tmp1 = split(line, ';') - if len(tmp1) == 5 - let info = tmp1[4] - else - let tlen = len(tmp1) - let info = tmp1[4] - let i = 5 - while i < tlen - let info = info . ';' . tmp1[i] - let i += 1 - endwhile - endif - let info = substitute(info, "\t", "\n", "g") + let tmp1 = split(line, "\x06")" + let info = tmp1[4] + let info = substitute(info, "\t", ", ", "g") + let info = substitute(info, "\x07", " = ", "g") let tmp2 = {'word': tmp1[0], 'menu': tmp1[1] . ' ' . tmp1[3], 'info': info} call add(res, tmp2) endif diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 30f1266..c3414f6 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -411,7 +411,7 @@ Edit ----------------------------------------------------------- Syntax - . Build omniList (loaded packages) :RUpdateObjList + . Build omnils (loaded packages) :RUpdateObjList ----------------------------------------------------------- Object Browser @@ -1367,7 +1367,7 @@ directory after the installation: r-plugin/common_buffer.vim r-plugin/common_global.vim r-plugin/functions.vim - r-plugin/omniList + r-plugin/omnils r-plugin/r.snippets r-plugin/tex_indent.vim r-plugin/vimcom.py @@ -1854,6 +1854,8 @@ the R syntax highlighted. for the patch). * Use Tmux to start the Object Browser beside the R console if vimrplugin_objbr_place =~ "console". + * The file r-plugin/omniList was renamed to r-plugin/omnils because its + field separator changed. 111114 (2011-11-14) * Changed key binding for commenting/uncommenting code from \cc to \xx. diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 8ffe78f..af54ca5 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -15,7 +15,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Fri Mar 30, 2012 11:33PM +" Last Change: Sat Mar 31, 2012 12:54PM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -135,36 +135,24 @@ function RCompleteArgs() if np == 0 call cursor(lnum, idx) let rkeyword0 = RGetKeyWord() - let rkeyword = '^' . rkeyword0 . ';' + let rkeyword = '^' . rkeyword0 . "\x06" call cursor(cpos[1], cpos[2]) for omniL in flines - if omniL =~ rkeyword && omniL =~ ";function;function;" - let tmp1 = split(omniL, ';') - if len(tmp1) == 5 - let info = tmp1[4] - else - let tlen = len(tmp1) - let info = tmp1[4] - let i = 5 - while i < tlen - let info = info . ';' . tmp1[i] - let i += 1 - endwhile - endif - let info = substitute(info, "\t", '', "g") - let argsL = split(info, ",") + if omniL =~ rkeyword && omniL =~ "\x06function\x06function\x06" + let tmp1 = split(omniL, "\x06") + let info = tmp1[4] + let argsL = split(info, "\x09") let args = [] for id in range(len(argsL)) let newkey = '^' . argkey - let tmp2 = split(substitute(argsL[id], "^ *", '', ""), "=") + let tmp2 = split(argsL[id], "\x07") if (argkey == '' || tmp2[0] =~ newkey) && tmp2[0] !~ "No arguments" + if tmp2[0] != '...' + let tmp2[0] = tmp2[0] . " = " + endif if len(tmp2) == 2 - let tmp2[0] = tmp2[0] . "= " let tmp3 = {'word': tmp2[0], 'menu': tmp2[1]} else - if tmp2[0] != '...' - let tmp2[0] = tmp2[0] . " = " - endif let tmp3 = {'word': tmp2[0], 'menu': ''} endif call add(args, tmp3) @@ -182,15 +170,15 @@ function RCompleteArgs() exe 'Py SendToR("vimcom:::vim.args(' . "'" . rkeyword0 . "', '" . argkey . "')" . '")' if g:rplugin_vimcomport > 0 && g:rplugin_lastrpl != "NOT_EXISTS" && g:rplugin_lastrpl != "NO_ARGS" let args = [] - let tmp = split(g:rplugin_lastrpl, '\t') + let tmp = split(g:rplugin_lastrpl, "\x09") if(len(tmp) > 0) for id in range(len(tmp)) - let tmp2 = split(tmp[id], "=") + let tmp2 = split(tmp[id], "\x07") + let tmp3 = tmp2[0] . " = " if len(tmp2) > 1 - let tmp2[0] = tmp2[0] . "= " - call add(args, {'word': tmp2[0], 'menu': tmp2[1]}) + call add(args, {'word': tmp3, 'menu': tmp2[1]}) else - call add(args, {'word': tmp2[0], 'menu': ' '}) + call add(args, {'word': tmp3, 'menu': ' '}) endif endfor if argkey == '' && len(args) > 0 @@ -1555,7 +1543,7 @@ function RBuildSyntaxFile(what) let nf = 0 let funlist = "" for line in g:rplugin_liblist - let obj = split(line, ";") + let obj = split(line, "\x06", 1) if obj[2] == "function" if obj[0] !~ '[[:punct:]]' || (obj[0] =~ '\.[a-zA-Z]' && obj[0] !~ '[[:punct:]][[:punct:]]') let nf += 1 @@ -1836,7 +1824,7 @@ function BuildRHelpList() let s:list_of_objs = [] endif for xx in g:rplugin_liblist - let xxx = split(xx, ";") + let xxx = split(xx, "\x06") if xxx[0] !~ '\$' call add(s:list_of_objs, xxx[0]) endif @@ -2836,7 +2824,7 @@ if g:vimrplugin_conqueplugin == 1 endif " Are we in a Debian package? Is the plugin being running for the first time? -let g:rplugin_omnifname = g:rplugin_uservimfiles . "/r-plugin/omniList" +let g:rplugin_omnifname = g:rplugin_uservimfiles . "/r-plugin/omnils" if g:rplugin_home != g:rplugin_uservimfiles " Create r-plugin directory if it doesn't exist yet: if !isdirectory(g:rplugin_uservimfiles . "/r-plugin") @@ -2859,13 +2847,13 @@ if !filereadable(g:rplugin_uservimfiles . "/r-plugin/functions.vim") endif endif -" If there is no omniList, copy the default one +" If there is no omnils, copy the default one if !filereadable(g:rplugin_omnifname) - if filereadable("/usr/share/vim/addons/r-plugin/omniList") - let omnilines = readfile("/usr/share/vim/addons/r-plugin/omniList") + if filereadable("/usr/share/vim/addons/r-plugin/omnils") + let omnilines = readfile("/usr/share/vim/addons/r-plugin/omnils") else - if filereadable(g:rplugin_home . "/r-plugin/omniList") - let omnilines = readfile(g:rplugin_home . "/r-plugin/omniList") + if filereadable(g:rplugin_home . "/r-plugin/omnils") + let omnilines = readfile(g:rplugin_home . "/r-plugin/omnils") else let omnilines = [] endif From 7e4f2470ce55ab42e50d85e9ba4acd622f641c15 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 31 Mar 2012 13:01:44 -0300 Subject: [PATCH 0210/1050] Remove no longer necessary code. --- syntax/rbrowser.vim | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/syntax/rbrowser.vim b/syntax/rbrowser.vim index 8d5e53f..a65bfc2 100644 --- a/syntax/rbrowser.vim +++ b/syntax/rbrowser.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Object browser of Vim-R-plugin " Maintainer: Jakson Alves de Aquino (jalvesaq@gmail.com) -" Last Change: Mon Feb 21, 2011 06:44PM +" Last Change: Sat Mar 31, 2012 12:29PM if exists("b:current_syntax") finish @@ -37,13 +37,6 @@ syn match rbrowserEnv "^.GlobalEnv " syn match rbrowserEnv "^Libraries " syn match rbrowserLink " Libraries$" syn match rbrowserLink " .GlobalEnv$" -syn match rbrowserWarn "^Warning:" -syn match rbrowserWarn "^The following" -syn match rbrowserWarn "^library is loaded" -syn match rbrowserWarn "^but is not in the" -syn match rbrowserWarn "^libraries are loaded" -syn match rbrowserWarn "^but are not in the" -syn match rbrowserWarn "^omniList:" syn match rbrowserTreePart "├─" syn match rbrowserTreePart "└─" syn match rbrowserTreePart "│" From dfd3965778f81fc8839698a4fa0d69e7768a8376 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 31 Mar 2012 16:22:58 -0300 Subject: [PATCH 0211/1050] Always get five fields. --- autoload/rcomplete.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/autoload/rcomplete.vim b/autoload/rcomplete.vim index 9a5a56b..99b0b1e 100644 --- a/autoload/rcomplete.vim +++ b/autoload/rcomplete.vim @@ -1,7 +1,7 @@ " Vim completion script " Language: R " Maintainer: Jakson Alves de Aquino -" Last Change: Sat Mar 31, 2012 12:42PM +" Last Change: Sat Mar 31, 2012 04:04PM " fun! rcomplete#CompleteR(findstart, base) @@ -31,7 +31,7 @@ fun! rcomplete#CompleteR(findstart, base) if a:base !~ '\$' && line =~ '\$' continue endif - let tmp1 = split(line, "\x06")" + let tmp1 = split(line, "\x06", 1) let info = tmp1[4] let info = substitute(info, "\t", ", ", "g") let info = substitute(info, "\x07", " = ", "g") From 0470bf7bca37e542a2bfd6cd57975c2721723e27 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sun, 1 Apr 2012 09:30:46 -0300 Subject: [PATCH 0212/1050] Try to get arguments from R first. --- r-plugin/common_global.vim | 48 +++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index af54ca5..27527e5 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -15,7 +15,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Sat Mar 31, 2012 12:54PM +" Last Change: Sun Apr 01, 2012 09:29AM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -135,8 +135,31 @@ function RCompleteArgs() if np == 0 call cursor(lnum, idx) let rkeyword0 = RGetKeyWord() + let classfor = RGetClassFor(rkeyword0) let rkeyword = '^' . rkeyword0 . "\x06" call cursor(cpos[1], cpos[2]) + exe 'Py SendToR("vimcom:::vim.args(' . "'" . rkeyword0 . "', '" . argkey . "', classfor = " . classfor . ")" . '")' + if g:rplugin_vimcomport > 0 && g:rplugin_lastrpl != "NOT_EXISTS" && g:rplugin_lastrpl != "NO_ARGS" + let args = [] + let tmp = split(g:rplugin_lastrpl, "\x09") + if(len(tmp) > 0) + for id in range(len(tmp)) + let tmp2 = split(tmp[id], "\x07") + let tmp3 = tmp2[0] . " = " + if len(tmp2) > 1 + call add(args, {'word': tmp3, 'menu': tmp2[1]}) + else + call add(args, {'word': tmp3, 'menu': ' '}) + endif + endfor + if argkey == '' && len(args) > 0 + call insert(args, {'word': ' ', 'menu': ''}) + endif + call complete(idx2, args) + endif + return '' + endif + for omniL in flines if omniL =~ rkeyword && omniL =~ "\x06function\x06function\x06" let tmp1 = split(omniL, "\x06") @@ -166,29 +189,6 @@ function RCompleteArgs() endif endfor - " The function isn't in the omni list - exe 'Py SendToR("vimcom:::vim.args(' . "'" . rkeyword0 . "', '" . argkey . "')" . '")' - if g:rplugin_vimcomport > 0 && g:rplugin_lastrpl != "NOT_EXISTS" && g:rplugin_lastrpl != "NO_ARGS" - let args = [] - let tmp = split(g:rplugin_lastrpl, "\x09") - if(len(tmp) > 0) - for id in range(len(tmp)) - let tmp2 = split(tmp[id], "\x07") - let tmp3 = tmp2[0] . " = " - if len(tmp2) > 1 - call add(args, {'word': tmp3, 'menu': tmp2[1]}) - else - call add(args, {'word': tmp3, 'menu': ' '}) - endif - endfor - if argkey == '' && len(args) > 0 - call insert(args, {'word': ' ', 'menu': ''}) - endif - call complete(idx2, args) - endif - return '' - endif - break endif let idx -= 1 From a987077778992cc2eccbb33314f10b96fcda4c87 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sun, 1 Apr 2012 09:37:47 -0300 Subject: [PATCH 0213/1050] Use omnils if R is busy. --- r-plugin/common_global.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 27527e5..21f8328 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -15,7 +15,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Sun Apr 01, 2012 09:29AM +" Last Change: Sun Apr 01, 2012 09:36AM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -139,7 +139,7 @@ function RCompleteArgs() let rkeyword = '^' . rkeyword0 . "\x06" call cursor(cpos[1], cpos[2]) exe 'Py SendToR("vimcom:::vim.args(' . "'" . rkeyword0 . "', '" . argkey . "', classfor = " . classfor . ")" . '")' - if g:rplugin_vimcomport > 0 && g:rplugin_lastrpl != "NOT_EXISTS" && g:rplugin_lastrpl != "NO_ARGS" + if g:rplugin_vimcomport > 0 && g:rplugin_lastrpl != "NOT_EXISTS" && g:rplugin_lastrpl != "NO_ARGS" && g:rplugin_lastrpl != "R is busy." let args = [] let tmp = split(g:rplugin_lastrpl, "\x09") if(len(tmp) > 0) From ed3cc0299e17eee16e6687f608ec62d6493b159a Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sun, 1 Apr 2012 11:51:28 -0300 Subject: [PATCH 0214/1050] Add information about package and method. --- r-plugin/common_global.vim | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 21f8328..08a39f3 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -15,7 +15,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Sun Apr 01, 2012 09:36AM +" Last Change: Sun Apr 01, 2012 11:20AM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -141,7 +141,8 @@ function RCompleteArgs() exe 'Py SendToR("vimcom:::vim.args(' . "'" . rkeyword0 . "', '" . argkey . "', classfor = " . classfor . ")" . '")' if g:rplugin_vimcomport > 0 && g:rplugin_lastrpl != "NOT_EXISTS" && g:rplugin_lastrpl != "NO_ARGS" && g:rplugin_lastrpl != "R is busy." let args = [] - let tmp = split(g:rplugin_lastrpl, "\x09") + let tmp0 = split(g:rplugin_lastrpl, "\x04") + let tmp = split(tmp0[0], "\x09") if(len(tmp) > 0) for id in range(len(tmp)) let tmp2 = split(tmp[id], "\x07") @@ -152,8 +153,8 @@ function RCompleteArgs() call add(args, {'word': tmp3, 'menu': ' '}) endif endfor - if argkey == '' && len(args) > 0 - call insert(args, {'word': ' ', 'menu': ''}) + if len(args) > 0 && len(tmp0) > 1 + call add(args, {'word': ' ', 'menu': tmp0[1]}) endif call complete(idx2, args) endif @@ -1536,7 +1537,7 @@ endfunction function RBuildSyntaxFile(what) call BuildROmniList("libraries", a:what) - sleep 1 + sleep 100m let g:rplugin_liblist = readfile(g:rplugin_omnifname) call BuildRHelpList() let res = [] From 2d1ca58f4aa6691938d2e954e5755c21e845ba00 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sun, 1 Apr 2012 12:40:40 -0300 Subject: [PATCH 0215/1050] Don not add empty space. --- r-plugin/common_global.vim | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 08a39f3..c900e4f 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -15,7 +15,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Sun Apr 01, 2012 11:20AM +" Last Change: Sun Apr 01, 2012 12:36PM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -182,9 +182,6 @@ function RCompleteArgs() call add(args, tmp3) endif endfor - if argkey == '' && len(args) > 0 - call insert(args, {'word': ' ', 'menu': ''}) - endif call complete(idx2, args) return '' endif From fe4d6f6e67f139978ab6c0cf670b19d7b0989ed8 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sun, 1 Apr 2012 19:54:19 -0300 Subject: [PATCH 0216/1050] Require knitr (avoid vimcom dependency on knitr). --- ftplugin/rnoweb.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ftplugin/rnoweb.vim b/ftplugin/rnoweb.vim index 823062f..2d8df0b 100644 --- a/ftplugin/rnoweb.vim +++ b/ftplugin/rnoweb.vim @@ -17,7 +17,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Wed Mar 28, 2012 10:39AM +" Last Change: Sun Apr 01, 2012 07:37PM "========================================================================== " Only do this when not yet done for this buffer @@ -115,7 +115,7 @@ function! RMakePDF(bibtex, knit) let pdfcmd = "vim.Sweave('" . expand("%:t") . "'" if a:knit - let pdfcmd = pdfcmd . ', knit = TRUE' + let pdfcmd = "require(knitr); " . pdfcmd . ', knit = TRUE' endif if g:vimrplugin_latexcmd != "pdflatex" From e5fe6ee5a10b4a632c269211adecc96aebda14f4 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sun, 1 Apr 2012 23:13:29 -0300 Subject: [PATCH 0217/1050] Fix names of menu separators. --- r-plugin/common_global.vim | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index c900e4f..e116bae 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -15,7 +15,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Sun Apr 01, 2012 12:36PM +" Last Change: Sun Apr 01, 2012 11:12PM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -2204,22 +2204,23 @@ function MakeRMenu() "---------------------------------------------------------------------------- call RControlMenu() "------------------------------- - menu R.Command.-Sep1- + menu R.Command.-Sep4- if &filetype != "rdoc" call RCreateMenuItem("nvi", 'Command.Set\ working\ directory\ (cur\ file\ path)', 'RSetwd', 'rd', ':call RSetWD()') endif "------------------------------- if &filetype == "rnoweb" || g:vimrplugin_never_unmake_menu - menu R.Command.-Sep2- + menu R.Command.-Sep5- call RCreateMenuItem("nvi", 'Command.Sweave\ (cur\ file)', 'RSweave', 'sw', ':call RSweave()') call RCreateMenuItem("nvi", 'Command.Sweave\ and\ PDF\ (cur\ file)', 'RMakePDF', 'sp', ':call RMakePDF("nobib")') call RCreateMenuItem("nvi", 'Command.Sweave,\ BibTeX\ and\ PDF\ (cur\ file)', 'RMakePDF', 'sb', ':call RMakePDF("bibtex")') + menu R.Command.-Sep6- call RCreateMenuItem("nvi", 'Command.Knitr\ (cur\ file)', 'RSweave', 'kn', ':call RSweave()') call RCreateMenuItem("nvi", 'Command.Knitr\ and\ PDF\ (cur\ file)', 'RMakePDF', 'kp', ':call RMakePDF("nobib")') call RCreateMenuItem("nvi", 'Command.Knitr,\ BibTeX\ and\ PDF\ (cur\ file)', 'RMakePDF', 'kb', ':call RMakePDF("bibtex")') endif "------------------------------- - menu R.Command.-Sep3- + menu R.Command.-Sep7- if &filetype == "r" || &filetype == "rnoweb" || g:vimrplugin_never_unmake_menu nmenu R.Command.Build\ tags\ file\ (cur\ dir):RBuildTags :call SendCmdToR('rtags(ofile = "TAGS")') imenu R.Command.Build\ tags\ file\ (cur\ dir):RBuildTags :call SendCmdToR('rtags(ofile = "TAGS")')a @@ -2233,7 +2234,7 @@ function MakeRMenu() if &filetype == "r" || &filetype == "rnoweb" || &filetype == "rhelp" || g:vimrplugin_never_unmake_menu if g:vimrplugin_underscore == 1 imenu R.Edit.Insert\ \"\ <-\ \"_ :call ReplaceUnderS()a - imenu R.Edit.Complete\ function\ name^X^O + imenu R.Edit.Complete\ object\ name^X^O if hasmapto("RCompleteArgs", "i") let boundkey = RIMapCmd("RCompleteArgs") exe "imenu R.Edit.Complete\\ function\\ arguments" . boundkey . " " . boundkey From 4b501b748c1cde7dcaabf06ccfe37b4c0f626a95 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Mon, 2 Apr 2012 09:38:42 -0300 Subject: [PATCH 0218/1050] Comment about utils:::.win32consoleCompletion(). --- autoload/rcomplete.vim | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/autoload/rcomplete.vim b/autoload/rcomplete.vim index 99b0b1e..248a813 100644 --- a/autoload/rcomplete.vim +++ b/autoload/rcomplete.vim @@ -1,7 +1,7 @@ " Vim completion script " Language: R " Maintainer: Jakson Alves de Aquino -" Last Change: Sat Mar 31, 2012 04:04PM +" Last Change: Mon Apr 02, 2012 09:36AM " fun! rcomplete#CompleteR(findstart, base) @@ -21,6 +21,12 @@ fun! rcomplete#CompleteR(findstart, base) if strlen(a:base) == 0 return res endif + + " We could use R to get the completions based on the running evironment. + " However, we would miss information stored on the omnils file: class of + " object and its package. + " exe 'Py SendToR("utils:::.win32consoleCompletion(' . "'" . a:base . "', " . strlen(a:base) . ')$comps")' + let flines = g:rplugin_liblist + g:rplugin_globalenvlines " The char '$' at the end of 'a:base' is treated as end of line, and " the pattern is never found in 'line'. From b92543bd91762bac768746a240e10ae9ce61ccd2 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Mon, 2 Apr 2012 11:44:42 -0300 Subject: [PATCH 0219/1050] Replace Knitr with Knit. --- r-plugin/common_global.vim | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index e116bae..b317d65 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -15,7 +15,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Sun Apr 01, 2012 11:12PM +" Last Change: Mon Apr 02, 2012 11:44AM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -2215,9 +2215,9 @@ function MakeRMenu() call RCreateMenuItem("nvi", 'Command.Sweave\ and\ PDF\ (cur\ file)', 'RMakePDF', 'sp', ':call RMakePDF("nobib")') call RCreateMenuItem("nvi", 'Command.Sweave,\ BibTeX\ and\ PDF\ (cur\ file)', 'RMakePDF', 'sb', ':call RMakePDF("bibtex")') menu R.Command.-Sep6- - call RCreateMenuItem("nvi", 'Command.Knitr\ (cur\ file)', 'RSweave', 'kn', ':call RSweave()') - call RCreateMenuItem("nvi", 'Command.Knitr\ and\ PDF\ (cur\ file)', 'RMakePDF', 'kp', ':call RMakePDF("nobib")') - call RCreateMenuItem("nvi", 'Command.Knitr,\ BibTeX\ and\ PDF\ (cur\ file)', 'RMakePDF', 'kb', ':call RMakePDF("bibtex")') + call RCreateMenuItem("nvi", 'Command.Knit\ (cur\ file)', 'RSweave', 'kn', ':call RSweave()') + call RCreateMenuItem("nvi", 'Command.Knit\ and\ PDF\ (cur\ file)', 'RMakePDF', 'kp', ':call RMakePDF("nobib")') + call RCreateMenuItem("nvi", 'Command.Knit,\ BibTeX\ and\ PDF\ (cur\ file)', 'RMakePDF', 'kb', ':call RMakePDF("bibtex")') endif "------------------------------- menu R.Command.-Sep7- From 1db07de54d2f3d4304c0dad8f4c6e4881e4842ae Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 5 Apr 2012 20:43:38 -0300 Subject: [PATCH 0220/1050] Correctly delete unnamed list item. --- ftplugin/rbrowser.vim | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ftplugin/rbrowser.vim b/ftplugin/rbrowser.vim index dbeff08..e4e9a57 100644 --- a/ftplugin/rbrowser.vim +++ b/ftplugin/rbrowser.vim @@ -16,7 +16,7 @@ " " Author: Jakson Alves de Aquino " -" Last Change: Thu Mar 15, 2012 10:48PM +" Last Change: Thu Apr 05, 2012 08:42PM "========================================================================== " Only do this when not yet done for this buffer @@ -313,6 +313,9 @@ function! OBGetDeleteCmd(lnum) if g:rplugin_curview == "GlobalEnv" if obj =~ '\$' let cmd = obj . ' <- NULL' + elseif obj =~ '-\[\[[0-9]*\]\]' + let obj = substitute(obj, '-\(\[\[[0-9]*\]\]\)', '\1', '') + let cmd = obj . ' <- NULL' else let cmd = 'rm(' . obj . ')' endif From d3e4902d6f8d8a645a2113e99684b3155ab4f927 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 5 Apr 2012 20:45:30 -0300 Subject: [PATCH 0221/1050] Get correctly character objects. --- r-plugin/common_global.vim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index b317d65..7ae52c8 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -15,7 +15,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Mon Apr 02, 2012 11:44AM +" Last Change: Thu Apr 05, 2012 10:01AM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -136,6 +136,7 @@ function RCompleteArgs() call cursor(lnum, idx) let rkeyword0 = RGetKeyWord() let classfor = RGetClassFor(rkeyword0) + let classfor = substitute(classfor, '"', '\\"', "g") let rkeyword = '^' . rkeyword0 . "\x06" call cursor(cpos[1], cpos[2]) exe 'Py SendToR("vimcom:::vim.args(' . "'" . rkeyword0 . "', '" . argkey . "', classfor = " . classfor . ")" . '")' From 1c0c96dd70e8296ad0ec9a81e8cf52087adbdf50 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 5 Apr 2012 20:46:37 -0300 Subject: [PATCH 0222/1050] Update. --- doc/r-plugin.txt | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index c3414f6..e8004d8 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -396,7 +396,7 @@ Command Edit . Insert "<-" _ - . Complete function name ^X^O + . Complete object name ^X^O . Complete function arguments ^X^A -------------------------------------------------------- . Indent (line) == @@ -460,21 +460,28 @@ case: summary(x) summary(m) < -When completing function names (CTRL-X CTRL-O) and function arguments (CTRL-X +When completing object names (CTRL-X CTRL-O) and function arguments (CTRL-X CTRL-A) you have to press CTRL-N to go foward in the list and CTRL-P to go backward (see |popupmenu-completion|). Note: if using Vim in a terminal emulator, Tmux will capture the CTRL-A command. You have to do CTRL-A twice to pass a single CTRL-A to Vim. +If R is not running or if it is running but is busy the completion will be +based on information saved with the command |:RUpdateObjList|. Otherwise, the +pop up menu for completion of function arguments will include an additional +line with the name of the library where the function is (if the function name +can be found in more than one library) and the function method (if what is +being shown are the arguments of a method and not of the function itself). + To get help on an R topic, type in Vim (Normal mode): > :Rhelp topic < -The command may be abbreviated to :Rh and you can both press to +The command may be abbreviated to :Rh and you can either press to trigger the autocompletion of R objects names or hit CTRL-D to list the possible completions (see |cmdline-completion| for details on the various ways of getting command-line completion). The list of objects used for -autocompletion is the same one built by |:RUpdateObjList|. +completion is the same one built by |:RUpdateObjList|. 4.2. Edition of rnoweb files~ @@ -1823,7 +1830,7 @@ the R syntax highlighted. *r-plugin-news* 10. News~ -0.9.8 (2012-03-28) +0.9.8 (2012-04-05) * Use the R package vimcom. The following options are now set on the vimcom R package and no longer in the Vim-R-plugin: allnames, open_df, and From 75a8a106570c58c4b9aa4a7dbd11d49e790ae91f Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 5 Apr 2012 22:53:01 -0300 Subject: [PATCH 0223/1050] Do not add ' = ' if the argument is '...'. --- r-plugin/common_global.vim | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 7ae52c8..c83bb2e 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -15,7 +15,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Thu Apr 05, 2012 10:01AM +" Last Change: Thu Apr 05, 2012 10:49PM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -147,7 +147,11 @@ function RCompleteArgs() if(len(tmp) > 0) for id in range(len(tmp)) let tmp2 = split(tmp[id], "\x07") - let tmp3 = tmp2[0] . " = " + if tmp2[0] == '...' + let tmp3 = tmp2[0] + else + let tmp3 = tmp2[0] . " = " + endif if len(tmp2) > 1 call add(args, {'word': tmp3, 'menu': tmp2[1]}) else From cbebd7a15ec439a1c23e8393070b0d438f1806b8 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 5 Apr 2012 22:53:53 -0300 Subject: [PATCH 0224/1050] Avoid error when loading the object browser again. --- ftplugin/rbrowser.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ftplugin/rbrowser.vim b/ftplugin/rbrowser.vim index e4e9a57..267ad19 100644 --- a/ftplugin/rbrowser.vim +++ b/ftplugin/rbrowser.vim @@ -16,7 +16,7 @@ " " Author: Jakson Alves de Aquino " -" Last Change: Thu Apr 05, 2012 08:42PM +" Last Change: Thu Apr 05, 2012 10:51PM "========================================================================== " Only do this when not yet done for this buffer @@ -389,7 +389,7 @@ call writefile([], $VIMRPLUGIN_TMPDIR . "/liblist") au BufUnload call ObBrBufUnload() -function RKeepRunning() +function! RKeepRunning() if g:rplugin_myport == 0 Py StopServer() sleep 250m From 6c01e4daec55bdf2bf3669c7239cc5200cd9671f Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Fri, 6 Apr 2012 11:35:20 -0300 Subject: [PATCH 0225/1050] Usage instructions for the development version. --- README | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/README b/README index 3ac2717..4b569c9 100644 --- a/README +++ b/README @@ -1,8 +1,12 @@ -This is the development code of Vim-R-plugin +This is the development code of Vim-R-plugin. You should use it if you want +to contribute to its development (testing unreleased versions, fixing bugs, +writing code etc). You may want to adjust Vim's 'runtimepath' in your +~/.vimrc as in the example below: + +set runtimepath=~/Vim-R-plugin,~/.vim,$VIMRUNTIME,~/.vim/after Stable versions are released at http://www.vim.org/scripts/script.php?script_id=2628 Please, read the file doc/r-plugin.txt for usage details. - From aeeb0cf4ec1623016cbdcee4c52757b1e0138c94 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Fri, 6 Apr 2012 11:57:23 -0300 Subject: [PATCH 0226/1050] Update. --- doc/r-plugin.txt | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index e8004d8..737e9df 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -804,16 +804,15 @@ If you use the screen plugin with GNU Screen, individual lines may be sent duplicated to R on Mac OS X. -5.7. R session is detached when GVim is closed (Linux/Unix only)~ +5.7. [Errno 98] Address already in use~ + +When deleting objects using the "d" command in the Object Browser, the message +"[Errno 98] Address already in use" may appear. In this case, the Object +Browser will not work properly until you stop using it and wait for the time +set in 'updatetime' (four seconds, by default). Then, the Object Browser +should be normal again. The "d" command is available only when running R on +Tmux. -If you launch GVim through a custom keyboard shortcut, the problem may be -solved if you add -f as parameter to GVim. The R session also used to be -detached when GVim is closed if you launched GVim by the command line in a -terminal emulator, and, then, closed the terminal-emulator. In any case, to -reattach to the R session, open a new terminal window and type: -> - screen -r -< ============================================================================== *r-plugin-options* @@ -1830,7 +1829,7 @@ the R syntax highlighted. *r-plugin-news* 10. News~ -0.9.8 (2012-04-05) +0.9.8 (2012-04-06) * Use the R package vimcom. The following options are now set on the vimcom R package and no longer in the Vim-R-plugin: allnames, open_df, and From 8a565c2e3f3db058927fa3cfeaba83b99172f75e Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 7 Apr 2012 20:56:51 -0300 Subject: [PATCH 0227/1050] Do not send empty classfor object. --- r-plugin/common_global.vim | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index c83bb2e..f1c3b92 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -15,7 +15,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Thu Apr 05, 2012 10:49PM +" Last Change: Sat Apr 07, 2012 08:42PM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -139,8 +139,12 @@ function RCompleteArgs() let classfor = substitute(classfor, '"', '\\"', "g") let rkeyword = '^' . rkeyword0 . "\x06" call cursor(cpos[1], cpos[2]) - exe 'Py SendToR("vimcom:::vim.args(' . "'" . rkeyword0 . "', '" . argkey . "', classfor = " . classfor . ")" . '")' - if g:rplugin_vimcomport > 0 && g:rplugin_lastrpl != "NOT_EXISTS" && g:rplugin_lastrpl != "NO_ARGS" && g:rplugin_lastrpl != "R is busy." + if classfor == "" + exe 'Py SendToR("vimcom:::vim.args(' . "'" . rkeyword0 . "', '" . argkey . "')" . '")' + else + exe 'Py SendToR("vimcom:::vim.args(' . "'" . rkeyword0 . "', '" . argkey . "', classfor = " . classfor . ")" . '")' + endif + if g:rplugin_vimcomport > 0 && g:rplugin_lastrpl != "NOT_EXISTS" && g:rplugin_lastrpl != "NO_ARGS" && g:rplugin_lastrpl != "R is busy." && g:rplugin_lastrpl != "NOANSWER" let args = [] let tmp0 = split(g:rplugin_lastrpl, "\x04") let tmp = split(tmp0[0], "\x09") From 937aba62af25e25748002615b8b84cc5719e1c61 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 14 Apr 2012 14:16:36 -0300 Subject: [PATCH 0228/1050] Disable showmarks plugin if running under Tmux. --- ftplugin/rbrowser.vim | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ftplugin/rbrowser.vim b/ftplugin/rbrowser.vim index 267ad19..f9ae8d7 100644 --- a/ftplugin/rbrowser.vim +++ b/ftplugin/rbrowser.vim @@ -16,7 +16,7 @@ " " Author: Jakson Alves de Aquino " -" Last Change: Thu Apr 05, 2012 10:51PM +" Last Change: Sat Apr 14, 2012 02:14PM "========================================================================== " Only do this when not yet done for this buffer @@ -41,6 +41,9 @@ runtime r-plugin/common_buffer.vim setlocal noswapfile setlocal buftype=nofile setlocal nowrap +if g:vimrplugin_tmux && g:vimrplugin_screenplugin + let showmarks_enable = 0 +endif if !exists("g:rplugin_hasmenu") let g:rplugin_hasmenu = 0 From 4c112c258d1dba84a7c16009c3876b2d34508e9e Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 14 Apr 2012 14:58:07 -0300 Subject: [PATCH 0229/1050] Require specific version of vimcom package. --- r-plugin/vimcom.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/r-plugin/vimcom.py b/r-plugin/vimcom.py index 9ce3d20..7130d19 100644 --- a/r-plugin/vimcom.py +++ b/r-plugin/vimcom.py @@ -23,7 +23,7 @@ def DiscoverVimComPort(): vim.command("call RWarningMsg('VIMINSTANCEID not found.')") return - while correct_repl.find(repl) < 0 and VimComPort < 10050: + while repl.find(correct_repl) < 0 and VimComPort < 10050: VimComPort = VimComPort + 1 sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) sock.settimeout(0.1) @@ -40,6 +40,8 @@ def DiscoverVimComPort(): vim.command("call RWarningMsg('VimCom Port not found.')") else: vim.command("let g:rplugin_vimcomport = " + str(VimComPort)) + if repl.find("0.9-1 ") != 0: + vim.command("call RWarningMsg('This version of Vim-R-plugin requires vimcom 0.9-1.')") return(VimComPort) From a1d2d506bcb6d8219eb689558ea9740e5d301c8c Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sun, 15 Apr 2012 11:15:27 -0300 Subject: [PATCH 0230/1050] Send either left or right part of current line. --- doc/r-plugin.txt | 4 +++- r-plugin/common_global.vim | 24 +++++++++++++++++++++++- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 737e9df..f552da0 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -363,6 +363,8 @@ Send . Line \l . Line (and down) \d . Line (and new one) \q + . Left part of line (cur) \r + . Right part of line (cur) \r ----------------------------------------------------------- Command @@ -1829,7 +1831,7 @@ the R syntax highlighted. *r-plugin-news* 10. News~ -0.9.8 (2012-04-06) +0.9.8 (2012-04-14) * Use the R package vimcom. The following options are now set on the vimcom R package and no longer in the Vim-R-plugin: allnames, open_df, and diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index f1c3b92..8ceb4d9 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -15,7 +15,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Sat Apr 07, 2012 08:42PM +" Last Change: Sun Apr 15, 2012 11:10AM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -1399,6 +1399,20 @@ function SendLineToR(godown) endif endfunction +function RSendPartOfLine(direction, correctpos) + let lin = getline(".") + let idx = col(".") - 1 + if a:correctpos + call cursor(line("."), idx) + endif + if a:direction == "right" + let rcmd = strpart(lin, idx) + else + let rcmd = strpart(lin, 0, idx) + endif + call SendCmdToR(rcmd) +endfunction + " Clear the console screen function RClearConsole() if (has("win32") || has("win64")) && g:vimrplugin_conqueplugin == 0 @@ -2207,6 +2221,10 @@ function MakeRMenu() call RCreateMenuItem("ni0", 'Send.Line', 'RSendLine', 'l', ':call SendLineToR("stay")') call RCreateMenuItem("ni0", 'Send.Line\ (and\ down)', 'RDSendLine', 'd', ':call SendLineToR("down")') call RCreateMenuItem("i", 'Send.Line\ (and\ new\ one)', 'RSendLAndOpenNewOne', 'q', ':call SendLineToR("newline")') + call RCreateMenuItem("n", 'Send.Left\ part\ of\ line\ (cur)', 'RNLeftPart', 'r', ':call RSendPartOfLine("left", 0)') + call RCreateMenuItem("n", 'Send.Right\ part\ of\ line\ (cur)', 'RNRightPart', 'r', ':call RSendPartOfLine("right", 0)') + call RCreateMenuItem("i", 'Send.Left\ part\ of\ line\ (cur)', 'RILeftPart', 'r', 'l:call RSendPartOfLine("left", 1)') + call RCreateMenuItem("i", 'Send.Right\ part\ of\ line\ (cur)', 'RIRightPart', 'r', 'l:call RSendPartOfLine("right", 1)') "---------------------------------------------------------------------------- " Control @@ -2484,6 +2502,10 @@ function RCreateSendMaps() call RCreateMaps("ni0", 'RSendLine', 'l', ':call SendLineToR("stay")') call RCreateMaps('ni0', 'RDSendLine', 'd', ':call SendLineToR("down")') call RCreateMaps('i', 'RSendLAndOpenNewOne', 'q', ':call SendLineToR("newline")') + nmap r :call RSendPartOfLine("left", 0) + imap r l:call RSendPartOfLine("left", 0)i + nmap r :call RSendPartOfLine("right", 0) + imap r l:call RSendPartOfLine("right", 0)i " For compatibility with Johannes Ranke's plugin if g:vimrplugin_map_r == 1 From f11de6cbb108b65d17205c412a22c0a579eb5086 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sun, 15 Apr 2012 11:46:22 -0300 Subject: [PATCH 0231/1050] New command :RSourceDir. --- doc/r-plugin.txt | 3 +++ r-plugin/common_global.vim | 11 ++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index f552da0..0083a0d 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -485,6 +485,9 @@ possible completions (see |cmdline-completion| for details on the various ways of getting command-line completion). The list of objects used for completion is the same one built by |:RUpdateObjList|. +You can source all .R files in a directory with the Normal mode command +:RSourceDir, which accepts an optional argument (the directory to be sourced). + 4.2. Edition of rnoweb files~ diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 8ceb4d9..bb8a5f7 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -15,7 +15,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Sun Apr 15, 2012 11:10AM +" Last Change: Sun Apr 15, 2012 11:33AM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -1863,6 +1863,14 @@ function RLisObjs(arglead, cmdline, curpos) return lob endfunction +function RSourceDirectory(...) + if a:1 == "" + call SendCmdToR("vim.srcdir()") + else + call SendCmdToR("vim.srcdir('" . a:1 . "')") + endif +endfunction + function RAskHelp(...) if a:1 == "" call SendCmdToR("help.start()") @@ -2549,6 +2557,7 @@ endfunction command RUpdateObjList :call RBuildSyntaxFile("loaded") command RBuildTags :call SendCmdToR('rtags(ofile = "TAGS")') command -nargs=? -complete=customlist,RLisObjs Rhelp :call RAskHelp() +command -nargs=? -complete=dir RSourceDir :call RSourceDirectory() "========================================================================== " Global variables From d3dabaa6f0e0c06718edcd4493dd3dc3df6da5fc Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sun, 15 Apr 2012 23:29:35 -0300 Subject: [PATCH 0232/1050] Fix directory path on Windows. --- r-plugin/common_global.vim | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index bb8a5f7..6feff27 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -15,7 +15,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Sun Apr 15, 2012 11:33AM +" Last Change: Sun Apr 15, 2012 11:27PM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -1864,10 +1864,15 @@ function RLisObjs(arglead, cmdline, curpos) endfunction function RSourceDirectory(...) - if a:1 == "" + if has("win32") || has("win64") + let dir = substitute(a:1, '\\', '/', "g") + else + let dir = a:1 + endif + if dir == "" call SendCmdToR("vim.srcdir()") else - call SendCmdToR("vim.srcdir('" . a:1 . "')") + call SendCmdToR("vim.srcdir('" . dir . "')") endif endfunction From b15968e9aac0e74cc8fa39b9df0b60a82e3f9720 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Mon, 16 Apr 2012 00:20:41 -0300 Subject: [PATCH 0233/1050] Replace "Sweave" with "interlace". --- ftplugin/rnoweb.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ftplugin/rnoweb.vim b/ftplugin/rnoweb.vim index 2d8df0b..43b88aa 100644 --- a/ftplugin/rnoweb.vim +++ b/ftplugin/rnoweb.vim @@ -17,7 +17,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Sun Apr 01, 2012 07:37PM +" Last Change: Mon Apr 16, 2012 12:08AM "========================================================================== " Only do this when not yet done for this buffer @@ -112,7 +112,7 @@ endfunction function! RMakePDF(bibtex, knit) update call RSetWD() - let pdfcmd = "vim.Sweave('" . expand("%:t") . "'" + let pdfcmd = "vim.interlace('" . expand("%:t") . "'" if a:knit let pdfcmd = "require(knitr); " . pdfcmd . ', knit = TRUE' From 319dc0e2a1853ebb578d5ef41470a2c1a01b9cc0 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 19 Apr 2012 08:35:53 -0300 Subject: [PATCH 0234/1050] Add terminator to the list of known terminals. --- r-plugin/common_global.vim | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 6feff27..1450d8b 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -15,7 +15,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Sun Apr 15, 2012 11:27PM +" Last Change: Thu Apr 19, 2012 08:35AM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -674,7 +674,7 @@ function StartR(whatr) endfunction function StartObjectBrowser() - if g:vimrplugin_screenplugin && g:vimrplugin_tmux + if g:vimrplugin_tmux && (g:vimrplugin_screenplugin || g:vimrplugin_external_ob) if g:rplugin_editor_port " This is the Object Browser @@ -2935,7 +2935,7 @@ if has("win32") || has("win64") || vimrplugin_applescript " No external terminal emulator will be called, so any value is good let g:vimrplugin_term = "xterm" else - let s:terminals = ['gnome-terminal', 'konsole', 'xfce4-terminal', 'terminal', 'Eterm', 'rxvt', 'aterm', 'roxterm', 'xterm'] + let s:terminals = ['gnome-terminal', 'konsole', 'xfce4-terminal', 'terminal', 'Eterm', 'rxvt', 'aterm', 'roxterm', 'terminator', 'xterm'] if has('mac') let s:terminals = ['iTerm', 'Terminal.app'] + s:terminals endif @@ -2970,6 +2970,10 @@ if g:vimrplugin_term == "gnome-terminal" || g:vimrplugin_term == "xfce4-terminal let g:rplugin_termcmd = g:vimrplugin_term . " --working-directory='" . expand("%:p:h") . "' --title R -e" endif +if g:vimrplugin_term == "terminator" + let g:rplugin_termcmd = g:vimrplugin_term . " --working-directory='" . expand("%:p:h") . "' --title R -x" +endif + if g:vimrplugin_term == "konsole" let g:rplugin_termcmd = "konsole --workdir '" . expand("%:p:h") . "' --icon " . g:rplugin_home . "/bitmaps/ricon.png -e" endif From cfe96f77553cf8b6b3eade1cd08a48da3768d42b Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 19 Apr 2012 09:13:22 -0300 Subject: [PATCH 0235/1050] Possibility of starting OB in external terminal. --- r-plugin/common_global.vim | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 1450d8b..cc60c63 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -15,7 +15,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Thu Apr 19, 2012 08:35AM +" Last Change: Thu Apr 19, 2012 09:13AM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -708,8 +708,13 @@ function StartObjectBrowser() if !exists("g:rplugin_edpane") let g:rplugin_edpane = $TMUX_PANE if strlen(g:rplugin_edpane) == 0 - echoer "Could not find the environment variable TMUX_PANE." - return + if g:vimrplugin_external_ob + let g:rplugin_edpane = "none" + let g:vimrplugin_objbr_place = substitute(g:vimrplugin_objbr_place, "script", "console", "g") + else + echoer "Could not find the environment variable TMUX_PANE." + return + endif endif endif @@ -1920,9 +1925,11 @@ function RAction(rcmd) let pkg = "" endif if exists("b:this_is_ob") - let slog = system("tmux set-buffer '" . "\" . ':call ShowRDoc("' . rkeyword . '", "' . pkg . '", 0)' . "\' && tmux paste-buffer -t " . g:rplugin_edpane . " && tmux select-pane -t " . g:rplugin_edpane) - if v:shell_error - call RWarningMsg(slog) + if g:rplugin_edpane != "none" + let slog = system("tmux set-buffer '" . "\" . ':call ShowRDoc("' . rkeyword . '", "' . pkg . '", 0)' . "\' && tmux paste-buffer -t " . g:rplugin_edpane . " && tmux select-pane -t " . g:rplugin_edpane) + if v:shell_error + call RWarningMsg(slog) + endif endif else call ShowRDoc(rkeyword, pkg, 0) @@ -2636,6 +2643,7 @@ call RSetDefaultValue("g:vimrplugin_routnotab", 0) call RSetDefaultValue("g:vimrplugin_editor_w", 66) call RSetDefaultValue("g:vimrplugin_help_w", 46) call RSetDefaultValue("g:vimrplugin_objbr_w", 40) +call RSetDefaultValue("g:vimrplugin_external_ob", 0) call RSetDefaultValue("g:vimrplugin_buildwait", 60) call RSetDefaultValue("g:vimrplugin_indent_commented", 1) call RSetDefaultValue("g:vimrplugin_by_vim_instance", 0) From 6da16f54d0e3c7bb892421fde6de5940642ebe8b Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 19 Apr 2012 23:31:35 -0300 Subject: [PATCH 0236/1050] Possibility of starting OB in external terminal. --- doc/r-plugin.txt | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 0083a0d..e9856ab 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -596,7 +596,7 @@ on the cursor line or the element of a list or data.frame. If the Object Browser is showing the libraries, the library currently on the cursor line is detached. The Object Browser may stop to be updated automatically for a few seconds if you press d many times quickly. Please, use a value greater than -250 to set the time in miliseconds that the Object Browser should wait for R +250 to set the time in milliseconds that the Object Browser should wait for R message that the object was already deleted (see |vimrplugin_ob_sleep|). @@ -829,6 +829,7 @@ Tmux. |vimrplugin_rnowebchunk| Convert '<' into '<<>>=\n@' in Rnoweb files |vimrplugin_objbr_place| Placement of Object Browser |vimrplugin_objbr_w| Initial width of Object Browser window +|vimrplugin_external_ob| Run Object Browser on external terminal |vimrplugin_objbr_sleep| Time the Object Browser waits for R after "d" |vimrplugin_vimpager| Use Vim to see R documentation |vimrplugin_editor_w| Minimum width of R script buffer @@ -871,7 +872,8 @@ list: 6. rxvt, 7. aterm, 8. roxterm, - 9. xterm. + 9. terminator, + 10. xterm. If Vim does not select your favorite terminal emulator, you may define it in your |vimrc| by setting the variable vimrplugin_term, as shown below: @@ -884,6 +886,7 @@ with the way your terminal emulator is called by the plugin, you may define in your |vimrc| the variable vimrplugin_term_cmd, as in the examples below: > let vimrplugin_term_cmd = "gnome-terminal --title R -e" + let vimrplugin_term_cmd = "terminator --title R -x" let vimrplugin_term_cmd = "/Applications/Utilities/iTerm.app/Contents/MacOS/iTerm -t R" < Please, look at the manual of your terminal emulator to know how to call it. @@ -907,6 +910,7 @@ put in your |vimrc|: 6.3. Object Browser options~ *vimrplugin_objbr_place* *vimrplugin_objbr_w* + *vimrplugin_external_ob* By default, the object browser will be created with 40 columns. The minimum width of the Object Browser window is 9 columns. You can change the object browser's default width by setting the value of |vimrplugin_objbr_w| in your @@ -923,8 +927,13 @@ beside the R Console. Valid values for the Object Browser placement are let vimrplugin_objbr_place = "script,right" let vimrplugin_objbr_place = "console,left" < +If vimrplugin_external_ob = 1 and R is running in an external terminal +emulator and the communication with R is being established through Tmux, the +Object Browser will be placed besides the R Console in the external terminal +emulator. In this case, the command \rh will not work on the Object Browser. + When deleting an object from the Object Browser (possible if running Vim under -Tmux), the following option controls the time in miliseconds that the Object +Tmux), the following option controls the time in milliseconds that the Object Browser will wait for R to send the message updating the list of objects: > let vimrplugin_ob_sleep = 250m @@ -1665,7 +1674,8 @@ two options and some others: library(colorout) library(setwidth) options(vimcom.verbose = 1, vimcom.allnames = TRUE) - library(vimcom) + if(Sys.getenv("VIMRPLUGIN_TMPDIR") != "") + library(vimcom) if(Sys.getenv("TERM") != "linux" && Sys.getenv("TERM") != "") setOutputColors256(verbose = FALSE) if(nchar(Sys.getenv("DISPLAY")) > 1){ @@ -1834,7 +1844,7 @@ the R syntax highlighted. *r-plugin-news* 10. News~ -0.9.8 (2012-04-14) +0.9.8 (2012-04-19) * Use the R package vimcom. The following options are now set on the vimcom R package and no longer in the Vim-R-plugin: allnames, open_df, and @@ -1846,8 +1856,9 @@ the R syntax highlighted. * New command in normal and visual modes when on the Object Browser: "d" deletes objects and detach libraries. New option: vimrplugin_ob_sleep. * Add support to knitr package. + * New command :RSourceDir and new key bindings \r and \r. -0.9.7 (2012-02-12) +0.9.7 (2012-04-21) * Minor bug fixes. From 3fc13cf877923e6c367549cdb6a4bd6f29cfd7be Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 19 Apr 2012 23:31:52 -0300 Subject: [PATCH 0237/1050] Fix bugs when the OB is in external terminal. --- r-plugin/common_global.vim | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index cc60c63..04e5042 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -15,7 +15,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Thu Apr 19, 2012 09:13AM +" Last Change: Thu Apr 19, 2012 11:21PM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -634,6 +634,9 @@ function StartR(whatr) \ 'set-window-option -g mode-keys vi', \ 'set -g status off', \ "set -g terminal-overrides 'xterm*:smcup@:rmcup@'"] + if g:vimrplugin_external_ob + let cnflines = extend(cnflines, ['set -g mode-mouse on', 'set -g mouse-select-pane on', 'set -g mouse-resize-pane on']) + endif call writefile(cnflines, tmxcnf) let tmxcnf = "-f " . tmxcnf endif @@ -944,7 +947,7 @@ function RObjBrowser() endfunction function RBrowserOpenCloseLists(status) - if g:vimrplugin_screenplugin && !exists("b:this_is_ob") + if g:vimrplugin_external_ob || (g:vimrplugin_screenplugin && !exists("b:this_is_ob")) let stt = a:status + 2 else let stt = a:status @@ -1101,7 +1104,7 @@ function SendCmdToR(cmd) " Send the command to R running in an external terminal emulator let str = substitute(cmd, "'", "'\\\\''", "g") if g:vimrplugin_tmux - let scmd = "tmux set-buffer '" . str . "\' && tmux paste-buffer -t " . b:screensname + let scmd = "tmux set-buffer '" . str . "\' && tmux paste-buffer -t " . b:screensname . '.0' else let scmd = 'screen -S ' . b:screensname . " -X stuff '" . str . "\'" endif @@ -1925,7 +1928,9 @@ function RAction(rcmd) let pkg = "" endif if exists("b:this_is_ob") - if g:rplugin_edpane != "none" + if g:rplugin_edpane == "none" + call RWarningMsg("Cmd not available.") + else let slog = system("tmux set-buffer '" . "\" . ':call ShowRDoc("' . rkeyword . '", "' . pkg . '", 0)' . "\' && tmux paste-buffer -t " . g:rplugin_edpane . " && tmux select-pane -t " . g:rplugin_edpane) if v:shell_error call RWarningMsg(slog) From cb499ee9e1857a406dfa471c5870a8c7620b6a65 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sun, 29 Apr 2012 12:55:14 -0300 Subject: [PATCH 0238/1050] Use new vimcom function: vim.names(). --- r-plugin/common_global.vim | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 04e5042..23347f9 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -15,7 +15,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Thu Apr 19, 2012 11:21PM +" Last Change: Sun Apr 29, 2012 12:39PM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -2095,7 +2095,7 @@ function RControlMenu() "------------------------------- menu R.Command.-Sep1- call RCreateMenuItem("nvi", 'Command.Print\ (cur)', 'RObjectPr', 'rp', ':call RAction("print")') - call RCreateMenuItem("nvi", 'Command.Names\ (cur)', 'RObjectNames', 'rn', ':call RAction("names")') + call RCreateMenuItem("nvi", 'Command.Names\ (cur)', 'RObjectNames', 'rn', ':call RAction("vim.names")') call RCreateMenuItem("nvi", 'Command.Structure\ (cur)', 'RObjectStr', 'rt', ':call RAction("str")') "------------------------------- menu R.Command.-Sep2- @@ -2120,7 +2120,7 @@ function RControlMaps() " Print, names, structure "------------------------------------- call RCreateMaps("nvi", 'RObjectPr', 'rp', ':call RAction("print")') - call RCreateMaps("nvi", 'RObjectNames', 'rn', ':call RAction("names")') + call RCreateMaps("nvi", 'RObjectNames', 'rn', ':call RAction("vim.names")') call RCreateMaps("nvi", 'RObjectStr', 'rt', ':call RAction("str")') " Arguments, example, help @@ -2984,7 +2984,7 @@ if g:vimrplugin_term == "gnome-terminal" || g:vimrplugin_term == "xfce4-terminal endif if g:vimrplugin_term == "terminator" - let g:rplugin_termcmd = g:vimrplugin_term . " --working-directory='" . expand("%:p:h") . "' --title R -x" + let g:rplugin_termcmd = "terminator --working-directory='" . expand("%:p:h") . "' --title R -x" endif if g:vimrplugin_term == "konsole" @@ -2997,7 +2997,7 @@ endif if g:vimrplugin_term == "roxterm" " Cannot set icon: http://bugzilla.gnome.org/show_bug.cgi?id=126081 - let g:rplugin_termcmd = g:vimrplugin_term . " --directory='" . expand("%:p:h") . "' --title R -e" + let g:rplugin_termcmd = "roxterm --directory='" . expand("%:p:h") . "' --title R -e" endif if g:vimrplugin_term == "xterm" || g:vimrplugin_term == "uxterm" From 645f0e4a9c08adc5dcf9e2dc34a4c99c12562987 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Mon, 30 Apr 2012 12:53:54 -0300 Subject: [PATCH 0239/1050] Rudimentary support for S4 objects. --- doc/r-plugin.txt | 29 +++++++++++++++++++++-------- ftplugin/rbrowser.vim | 6 +++--- syntax/rbrowser.vim | 12 ++++++------ 3 files changed, 30 insertions(+), 17 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index e9856ab..223fe18 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -587,6 +587,7 @@ any) used to classify the objects: Boolean is.logical() Type is.list() Function is.function() + Statement isS4() When running in a terminal emulator under Tmux, the Object Browser will be updated automatically. One limitation is that objects made available by the @@ -749,7 +750,16 @@ useful: *r-plugin-known-bugs* 5. Known bugs and workarounds~ -5.1. R's source() issues~ +5.1. The Object Browser segfaults (Linux/Unix only)~ + +If the Vim instance running the Object Browser crashes you may want to close +all Vim instances and kill any Vim wandering around with the command (typed in +a terminal emulator): +> + killall -9 vim +< + +5.2. R's source() issues~ The R's source() function prints an extra new line between commands if the option echo = TRUE, and error messages and warning are printed only after the @@ -757,14 +767,14 @@ entire code is sourced, which makes it more difficult to find errors in the code sent to R. -5.2. The clipboard's content is lost (Windows only)~ +5.3. The clipboard's content is lost (Windows only)~ On Windows, the plugin copies the command that will be sent to R into the clipboard. Thus, if you have anything in the clipboard it will be lost while using the plugin. -5.3. The buffer name must be in the window title (Windows only)~ +5.4. The buffer name must be in the window title (Windows only)~ On Windows the plugin tries to activate the "R Console" window, paste the command that is being sent to R, and, then, activate the GVim window. To @@ -773,14 +783,14 @@ edited be in the GVim window title. This is the default if you have not set the option 'titlestring'. -5.4. The menu may not reflect some of your custom key bindings~ +5.5. The menu may not reflect some of your custom key bindings~ If you have created a custom key binding for the Vim-R-plugin, the menu in GVim will not always reflect the correct key binding if it is not the same for Normal, Visual and Insert modes. -5.5. Syntactically correct code may be wrongly indented~ +5.6. Syntactically correct code may be wrongly indented~ If the Vim-R-plugin indents your code wrongly you may get the correct indentation by adding braces and line breaks to it. Example: @@ -803,13 +813,13 @@ indentation by adding braces and line breaks to it. Example: class(x) <- c(if(ordered) "ordered", "factor") < -5.6. Commands are sent twice on Mac OS X~ +5.7. Commands are sent twice on Mac OS X~ If you use the screen plugin with GNU Screen, individual lines may be sent duplicated to R on Mac OS X. -5.7. [Errno 98] Address already in use~ +5.8. [Errno 98] Address already in use~ When deleting objects using the "d" command in the Object Browser, the message "[Errno 98] Address already in use" may appear. In this case, the Object @@ -1850,13 +1860,16 @@ the R syntax highlighted. package and no longer in the Vim-R-plugin: allnames, open_df, and open_list. * Automatic update of the Object Browser when running R in a Tmux session. + * New option, vimrplugin_external_ob, to open the Object Browser in a Tmux + pane in the external terminal running R. * New command :Rhelp (thanks for Nir Atias for suggesting the new feature). * Remove the command :RUpdateObjListAll because Vim may not load the syntax file if it is too big. * New command in normal and visual modes when on the Object Browser: "d" deletes objects and detach libraries. New option: vimrplugin_ob_sleep. * Add support to knitr package. - * New command :RSourceDir and new key bindings \r and \r. + * New command :RSourceDir. + * New key bindings \r and \r. 0.9.7 (2012-04-21) diff --git a/ftplugin/rbrowser.vim b/ftplugin/rbrowser.vim index f9ae8d7..d0f2f17 100644 --- a/ftplugin/rbrowser.vim +++ b/ftplugin/rbrowser.vim @@ -16,7 +16,7 @@ " " Author: Jakson Alves de Aquino " -" Last Change: Sat Apr 14, 2012 02:14PM +" Last Change: Mon Apr 30, 2012 12:39PM "========================================================================== " Only do this when not yet done for this buffer @@ -229,9 +229,9 @@ function! RBrowserGetName(complete, lnum) " Is the object a top level one (curpos == 2)? if g:rplugin_curview == "libraries" - let delim = ['##', '{#', '[#', '(#', '"#', "'#", '%#', '=#'] + let delim = ['##', '{#', '[#', '(#', '"#', "'#", '%#', '<#', '=#'] else - let delim = ['{#', '[#', '(#', '"#', "'#", '%#', '=#'] + let delim = ['{#', '[#', '(#', '"#', "'#", '%#', '<#', '=#'] endif let word = substitute(line, '^\W*#\{-1,}\(.*\)\t.*', '\1', "") diff --git a/syntax/rbrowser.vim b/syntax/rbrowser.vim index a65bfc2..09a7021 100644 --- a/syntax/rbrowser.vim +++ b/syntax/rbrowser.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Object browser of Vim-R-plugin " Maintainer: Jakson Alves de Aquino (jalvesaq@gmail.com) -" Last Change: Sat Mar 31, 2012 12:29PM +" Last Change: Mon Apr 30, 2012 12:41PM if exists("b:current_syntax") finish @@ -20,7 +20,7 @@ if has("conceal") syn match rbrowserList "\[#.*\t" contains=rbrowserDelim,rbrowserTab syn match rbrowserLogical "%#.*\t" contains=rbrowserDelim,rbrowserTab syn match rbrowserLibrary "##.*\t" contains=rbrowserDelim,rbrowserTab - syn match rbrowserRepeat "!#.*\t" contains=rbrowserDelim,rbrowserTab + syn match rbrowserS4 "<#.*\t" contains=rbrowserDelim,rbrowserTab syn match rbrowserUnknown "=#.*\t" contains=rbrowserDelim,rbrowserTab else syn match rbrowserNumeric "{.*\t" contains=rbrowserDelim,rbrowserTab @@ -30,7 +30,7 @@ else syn match rbrowserList "\[.*\t" contains=rbrowserDelim,rbrowserTab syn match rbrowserLogical "%.*\t" contains=rbrowserDelim,rbrowserTab syn match rbrowserLibrary "#.*\t" contains=rbrowserDelim,rbrowserTab - syn match rbrowserRepeat "!.*\t" contains=rbrowserDelim,rbrowserTab + syn match rbrowserS4 "<.*\t" contains=rbrowserDelim,rbrowserTab syn match rbrowserUnknown "=.*\t" contains=rbrowserDelim,rbrowserTab endif syn match rbrowserEnv "^.GlobalEnv " @@ -48,9 +48,9 @@ endif syn match rbrowserTab contained "\t" if has("conceal") - syn match rbrowserDelim contained /'#\|"#\|(#\|\[#\|{#\|%#\|##\|!#\|=#/ conceal + syn match rbrowserDelim contained /'#\|"#\|(#\|\[#\|{#\|%#\|##\|<#\|=#/ conceal else - syn match rbrowserDelim contained /'\|"\|(\|\[\|{\|%\|#\|!\|=/ + syn match rbrowserDelim contained /'\|"\|(\|\[\|{\|%\|#\|<\|=/ endif hi def link rbrowserEnv Statement @@ -62,7 +62,7 @@ hi def link rbrowserLibrary PreProc hi def link rbrowserLink Comment hi def link rbrowserLogical Boolean hi def link rbrowserFunction Function -hi def link rbrowserRepeat Repeat +hi def link rbrowserS4 Statement hi def link rbrowserUnknown Normal hi def link rbrowserWarn WarningMsg hi def link rbrowserTreePart Comment From 1da7ea93d56b06faca77eaf7202d5ac51b8c63c6 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Tue, 1 May 2012 13:29:58 -0300 Subject: [PATCH 0240/1050] Send only selected parts of lines. --- r-plugin/common_global.vim | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 23347f9..4db78ce 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -15,7 +15,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Sun Apr 29, 2012 12:39PM +" Last Change: Tue May 01, 2012 01:25PM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -1302,6 +1302,11 @@ function SendSelectionToR(e, m) return endif let lines = getline("'<", "'>") + let i = col("'<") - 1 + let j = col("'>") + let lines[0] = strpart(lines[0], i) + let llen = len(lines) - 1 + let lines[llen] = strpart(lines[llen], 0, j) let ok = RSourceLines(lines, a:e) if ok == 0 return From 1152673c2bb9db49a8323abc0be2e6f6e34b66af Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Tue, 1 May 2012 13:30:59 -0300 Subject: [PATCH 0241/1050] Vicom version now is 0.9-2. --- r-plugin/vimcom.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/r-plugin/vimcom.py b/r-plugin/vimcom.py index 7130d19..41efaef 100644 --- a/r-plugin/vimcom.py +++ b/r-plugin/vimcom.py @@ -40,8 +40,8 @@ def DiscoverVimComPort(): vim.command("call RWarningMsg('VimCom Port not found.')") else: vim.command("let g:rplugin_vimcomport = " + str(VimComPort)) - if repl.find("0.9-1 ") != 0: - vim.command("call RWarningMsg('This version of Vim-R-plugin requires vimcom 0.9-1.')") + if repl.find("0.9-2 ") != 0: + vim.command("call RWarningMsg('This version of Vim-R-plugin requires vimcom 0.9-2.')") return(VimComPort) From 055da60bd59361bbd0c7f0223f5c6e9d411745ab Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Wed, 2 May 2012 10:17:50 -0300 Subject: [PATCH 0242/1050] Correctly send visually selected blocks. --- r-plugin/common_global.vim | 40 ++++++++++++++++++++++++++++++++------ 1 file changed, 34 insertions(+), 6 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 4db78ce..e1e3ee3 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -15,7 +15,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Tue May 01, 2012 01:25PM +" Last Change: Wed May 02, 2012 10:10AM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -1290,6 +1290,7 @@ function SendSelectionToR(e, m) endif let b:needsnewomnilist = 1 + if line("'<") == line("'>") let i = col("'<") - 1 let j = col("'>") - i @@ -1301,16 +1302,43 @@ function SendSelectionToR(e, m) endif return endif + let lines = getline("'<", "'>") - let i = col("'<") - 1 - let j = col("'>") - let lines[0] = strpart(lines[0], i) - let llen = len(lines) - 1 - let lines[llen] = strpart(lines[llen], 0, j) + + if visualmode() == "\" + let lj = line("'<") + let cj = col("'<") + let lk = line("'>") + let ck = col("'>") + if cj > ck + let bb = ck - 1 + let ee = cj - ck + 1 + else + let bb = cj - 1 + let ee = ck - cj + 1 + endif + if cj > len(getline(lj)) || ck > len(getline(lk)) + for idx in range(0, len(lines) - 1) + let lines[idx] = strpart(lines[idx], bb) + endfor + else + for idx in range(0, len(lines) - 1) + let lines[idx] = strpart(lines[idx], bb, ee) + endfor + endif + else + let i = col("'<") - 1 + let j = col("'>") + let lines[0] = strpart(lines[0], i) + let llen = len(lines) - 1 + let lines[llen] = strpart(lines[llen], 0, j) + endif + let ok = RSourceLines(lines, a:e) if ok == 0 return endif + if a:m == "down" call GoDown() else From c97ac0e647c215d88d75721906a79db8f0cc9cc4 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Fri, 4 May 2012 21:18:17 -0300 Subject: [PATCH 0243/1050] Version 0.9.7. --- Makefile | 2 +- doc/r-plugin.txt | 30 ++++++++++++++---------------- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/Makefile b/Makefile index 757da63..7932c37 100644 --- a/Makefile +++ b/Makefile @@ -22,7 +22,7 @@ PLUGINHOME=`pwd` -PLUGINVERSION=0.9.8 +PLUGINVERSION=0.9.7 DEBIANTIME=`date -R` PLUGINRELEASEDATE=`date +"%Y-%m-%d"` VIM2HTML=/usr/local/share/vim/vim73/doc/vim2html.pl diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 223fe18..127b0a6 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -5,7 +5,7 @@ Authors: Jakson A. Aquino Jose Claudio Faria -Version: 0.9.8 +Version: 0.9.7 For Vim version 7.3 1. Overview |r-plugin-overview| @@ -125,9 +125,9 @@ following dependencies: Depends:~ Vim >= 7.3 with Python support. - Tmux >= 1.3: http://tmux.sourceforge.net - Screen plugin: http://www.vim.org/scripts/script.php?script_id=2711 - vimcom: An R package. + Tmux >= 1.5: http://tmux.sourceforge.net + Screen plugin: http://www.vim.org/scripts/script.php?script_id=2711 + vimcom >= 0.9-2: An R package. Recommends:~ ncurses-term: http://invisible-island.net/ncurses @@ -220,7 +220,7 @@ to install external dependencies: find the file that matches exactly the version of Python that you installed. - * vimcom: An R package. You can install it with the R command + * vimcom >= 0.9-2: An R package. You can install it with the R command install.packages("vimcom"). The vimcom package creates a server on R to allow the communication with Vim. You certainly will want to put the following lines in your Rprofile (usually at ~/Documents/.Rprofile): @@ -1854,26 +1854,24 @@ the R syntax highlighted. *r-plugin-news* 10. News~ -0.9.8 (2012-04-19) +0.9.7 (2012-05-04) - * Use the R package vimcom. The following options are now set on the vimcom R - package and no longer in the Vim-R-plugin: allnames, open_df, and - open_list. - * Automatic update of the Object Browser when running R in a Tmux session. + * Use the R package vimcom: + - Automatic update of the Object Browser when running R in a Tmux + session. + - The following options are now set on the vimcom R package and no longer + in the Vim-R-plugin: allnames, open_df, and open_list. + - New command in normal and visual modes when on the Object Browser: "d" + deletes objects and detach libraries. New option: vimrplugin_ob_sleep. * New option, vimrplugin_external_ob, to open the Object Browser in a Tmux pane in the external terminal running R. * New command :Rhelp (thanks for Nir Atias for suggesting the new feature). * Remove the command :RUpdateObjListAll because Vim may not load the syntax file if it is too big. - * New command in normal and visual modes when on the Object Browser: "d" - deletes objects and detach libraries. New option: vimrplugin_ob_sleep. * Add support to knitr package. * New command :RSourceDir. * New key bindings \r and \r. - -0.9.7 (2012-04-21) - - * Minor bug fixes. + * Correctly send selected blocks. 0.9.6 (2011-12-13) From f6bb7cf53176747e593a902925fa452f00d40e32 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sun, 6 May 2012 09:59:31 -0300 Subject: [PATCH 0244/1050] Starting the development of version 0.9.8. --- Makefile | 2 +- doc/r-plugin.txt | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 7932c37..757da63 100644 --- a/Makefile +++ b/Makefile @@ -22,7 +22,7 @@ PLUGINHOME=`pwd` -PLUGINVERSION=0.9.7 +PLUGINVERSION=0.9.8 DEBIANTIME=`date -R` PLUGINRELEASEDATE=`date +"%Y-%m-%d"` VIM2HTML=/usr/local/share/vim/vim73/doc/vim2html.pl diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 127b0a6..6165e44 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -5,7 +5,7 @@ Authors: Jakson A. Aquino Jose Claudio Faria -Version: 0.9.7 +Version: 0.9.8 For Vim version 7.3 1. Overview |r-plugin-overview| @@ -1854,6 +1854,10 @@ the R syntax highlighted. *r-plugin-news* 10. News~ +0.9.8 (2012-05-00) + + * Nothing yet. + 0.9.7 (2012-05-04) * Use the R package vimcom: From c75833c31e320f6d7f73baa94b9ba35d33144181 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sun, 6 May 2012 10:00:22 -0300 Subject: [PATCH 0245/1050] Cannot start R in an external terminal from Tmux. --- r-plugin/common_global.vim | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index e1e3ee3..37221e4 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -15,7 +15,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Wed May 02, 2012 10:10AM +" Last Change: Sun May 06, 2012 09:57AM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -623,6 +623,11 @@ function StartR(whatr) endif else if g:vimrplugin_tmux + if $TMUX_PANE != "" + call RWarningMsg("Cannot start R in an external terminal when running Vim in a Tmux session.") + lcd - + return + endif if g:vimrplugin_notmuxconf let tmxcnf = " " else From baac3db3fcf3ecaf7c19d67fd4ea7f4fc4ba414a Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sun, 6 May 2012 22:55:13 -0300 Subject: [PATCH 0246/1050] Start external terminal even if inside Tmux. --- r-plugin/common_global.vim | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 37221e4..49c0359 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -15,7 +15,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Sun May 06, 2012 09:57AM +" Last Change: Sun May 06, 2012 10:54PM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -535,6 +535,7 @@ function StartR(whatr) endif if g:vimrplugin_screenplugin + let tmuxenv = "" if $TERM =~ "screen" if g:vimrplugin_tmux call system("tmux set-environment VIMRPLUGIN_TMPDIR " . $VIMRPLUGIN_TMPDIR) @@ -623,11 +624,13 @@ function StartR(whatr) endif else if g:vimrplugin_tmux - if $TMUX_PANE != "" - call RWarningMsg("Cannot start R in an external terminal when running Vim in a Tmux session.") - lcd - - return + + " Start the terminal emulator even if inside a Tmux session + if $TMUX != "" + let tmuxenv = $TMUX + let $TMUX = "" endif + if g:vimrplugin_notmuxconf let tmxcnf = " " else @@ -674,6 +677,9 @@ function StartR(whatr) lcd - return endif + if tmuxenv != "" + let $TMUX = tmuxenv + endif endif " Go back to original directory: From 845fb9fa0872948ea5fb388d704a94ff71f319aa Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sun, 6 May 2012 23:34:17 -0300 Subject: [PATCH 0247/1050] Minor bug fix. --- r-plugin/common_global.vim | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 49c0359..d7c97bd 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -15,7 +15,7 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Sun May 06, 2012 10:54PM +" Last Change: Sun May 06, 2012 11:32PM " " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, @@ -535,7 +535,6 @@ function StartR(whatr) endif if g:vimrplugin_screenplugin - let tmuxenv = "" if $TERM =~ "screen" if g:vimrplugin_tmux call system("tmux set-environment VIMRPLUGIN_TMPDIR " . $VIMRPLUGIN_TMPDIR) @@ -671,13 +670,14 @@ function StartR(whatr) let opencmd = printf("%s screen %s -d -RR -S %s %s &", g:rplugin_termcmd, scrrc, b:screensname, rcmd) endif endif + let rlog = system(opencmd) if v:shell_error call RWarningMsg(rlog) lcd - return endif - if tmuxenv != "" + if exists("tmuxenv") let $TMUX = tmuxenv endif endif From eca847f0d966724cd41b1c22b7f665ba4c89148f Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Mon, 7 May 2012 15:51:44 -0300 Subject: [PATCH 0248/1050] Export environment variable for external terminal. --- r-plugin/common_global.vim | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index d7c97bd..37dd40f 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -15,8 +15,6 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Sun May 06, 2012 11:32PM -" " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, " rnoweb, rhelp, rdoc, and rbrowser files @@ -628,6 +626,9 @@ function StartR(whatr) if $TMUX != "" let tmuxenv = $TMUX let $TMUX = "" + call system('export VIMRPLUGIN_TMPDIR=' . $VIMRPLUGIN_TMPDIR) + call system('export VIMINSTANCEID=' . $VIMINSTANCEID) + call system('tmux set-option -ga update-environment " VIMRPLUGIN_TMPDIR VIMINSTANCEID"') endif if g:vimrplugin_notmuxconf From 69f68727091eba818d5100e2d52c3bbc981a395f Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Tue, 8 May 2012 08:52:10 -0300 Subject: [PATCH 0249/1050] Require version 0.9-3 of vimcom. --- r-plugin/vimcom.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/r-plugin/vimcom.py b/r-plugin/vimcom.py index 41efaef..9ada8c8 100644 --- a/r-plugin/vimcom.py +++ b/r-plugin/vimcom.py @@ -40,8 +40,8 @@ def DiscoverVimComPort(): vim.command("call RWarningMsg('VimCom Port not found.')") else: vim.command("let g:rplugin_vimcomport = " + str(VimComPort)) - if repl.find("0.9-2 ") != 0: - vim.command("call RWarningMsg('This version of Vim-R-plugin requires vimcom 0.9-2.')") + if repl.find("0.9-3 ") != 0: + vim.command("call RWarningMsg('This version of Vim-R-plugin requires vimcom 0.9-3.')") return(VimComPort) From 7bebb55e251669499faa11fb2d99be282a65bb92 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Tue, 8 May 2012 08:55:10 -0300 Subject: [PATCH 0250/1050] Export $TMUX_PANE. --- r-plugin/common_global.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 37dd40f..fb7c97c 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -628,7 +628,7 @@ function StartR(whatr) let $TMUX = "" call system('export VIMRPLUGIN_TMPDIR=' . $VIMRPLUGIN_TMPDIR) call system('export VIMINSTANCEID=' . $VIMINSTANCEID) - call system('tmux set-option -ga update-environment " VIMRPLUGIN_TMPDIR VIMINSTANCEID"') + call system('tmux set-option -ga update-environment " TMUX_PANE VIMRPLUGIN_TMPDIR VIMINSTANCEID"') endif if g:vimrplugin_notmuxconf From 5795ea4c4b4417f44189c58864ec44665f709acb Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Tue, 8 May 2012 08:55:46 -0300 Subject: [PATCH 0251/1050] Known Bug: VimCom port not found on OpenBSD. --- doc/r-plugin.txt | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 6165e44..08e2184 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -127,7 +127,7 @@ following dependencies: Vim >= 7.3 with Python support. Tmux >= 1.5: http://tmux.sourceforge.net Screen plugin: http://www.vim.org/scripts/script.php?script_id=2711 - vimcom >= 0.9-2: An R package. + vimcom >= 0.9-3: An R package. Recommends:~ ncurses-term: http://invisible-island.net/ncurses @@ -220,7 +220,7 @@ to install external dependencies: find the file that matches exactly the version of Python that you installed. - * vimcom >= 0.9-2: An R package. You can install it with the R command + * vimcom >= 0.9-3: An R package. You can install it with the R command install.packages("vimcom"). The vimcom package creates a server on R to allow the communication with Vim. You certainly will want to put the following lines in your Rprofile (usually at ~/Documents/.Rprofile): @@ -829,6 +829,13 @@ should be normal again. The "d" command is available only when running R on Tmux. +5.9. "VimCom port not found" on OpenBSD~ + +When the loopback interface has both IPv4 and IPv6 addresses vimcom loads ok +but apparently does not listen on the IPv4 address (127.0.0.1), only on the +IPv6 one (fe80::1). + + ============================================================================== *r-plugin-options* 6. Options~ From 103ca0a9568a6b244c992e56b1bc3ce9523c2c3e Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Tue, 8 May 2012 10:46:51 -0300 Subject: [PATCH 0252/1050] No \rh if R and OB are in external terminal. --- r-plugin/common_global.vim | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index fb7c97c..6236362 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -721,7 +721,11 @@ function StartObjectBrowser() endif if !exists("g:rplugin_edpane") - let g:rplugin_edpane = $TMUX_PANE + if g:vimrplugin_screenplugin == 0 + let g:rplugin_edpane = "none" + else + let g:rplugin_edpane = $TMUX_PANE + endif if strlen(g:rplugin_edpane) == 0 if g:vimrplugin_external_ob let g:rplugin_edpane = "none" From 6b5b2c8d71d3280b0bec9806b121964444c10873 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Tue, 8 May 2012 22:49:09 -0300 Subject: [PATCH 0253/1050] Delete "Last Change" line. --- autoload/rcomplete.vim | 1 - ftplugin/r.vim | 2 -- ftplugin/rbrowser.vim | 1 - ftplugin/rdoc.vim | 2 -- ftplugin/rhelp.vim | 2 -- ftplugin/rnoweb.vim | 1 - r-plugin/common_buffer.vim | 2 -- syntax/rbrowser.vim | 1 - syntax/rdoc.vim | 1 - 9 files changed, 13 deletions(-) diff --git a/autoload/rcomplete.vim b/autoload/rcomplete.vim index 248a813..959e658 100644 --- a/autoload/rcomplete.vim +++ b/autoload/rcomplete.vim @@ -1,7 +1,6 @@ " Vim completion script " Language: R " Maintainer: Jakson Alves de Aquino -" Last Change: Mon Apr 02, 2012 09:36AM " fun! rcomplete#CompleteR(findstart, base) diff --git a/ftplugin/r.vim b/ftplugin/r.vim index 302e711..553b0a3 100644 --- a/ftplugin/r.vim +++ b/ftplugin/r.vim @@ -19,8 +19,6 @@ " " Based on previous work by Johannes Ranke " -" Last Change: Fri Feb 17, 2012 08:38AM -" " Please see doc/r-plugin.txt for usage details. "========================================================================== diff --git a/ftplugin/rbrowser.vim b/ftplugin/rbrowser.vim index d0f2f17..a267526 100644 --- a/ftplugin/rbrowser.vim +++ b/ftplugin/rbrowser.vim @@ -16,7 +16,6 @@ " " Author: Jakson Alves de Aquino " -" Last Change: Mon Apr 30, 2012 12:39PM "========================================================================== " Only do this when not yet done for this buffer diff --git a/ftplugin/rdoc.vim b/ftplugin/rdoc.vim index 9f9917d..4e465d0 100644 --- a/ftplugin/rdoc.vim +++ b/ftplugin/rdoc.vim @@ -19,8 +19,6 @@ " " Based on previous work by Johannes Ranke " -" Last Change: Fri Nov 25, 2011 08:52PM -" " Please see doc/r-plugin.txt for usage details. "========================================================================== diff --git a/ftplugin/rhelp.vim b/ftplugin/rhelp.vim index fd4f876..0959f2e 100644 --- a/ftplugin/rhelp.vim +++ b/ftplugin/rhelp.vim @@ -19,8 +19,6 @@ " " Based on previous work by Johannes Ranke " -" Last Change: Mon Feb 13, 2012 08:39AM -" " Please see doc/r-plugin.txt for usage details. "========================================================================== diff --git a/ftplugin/rnoweb.vim b/ftplugin/rnoweb.vim index 43b88aa..eb91daf 100644 --- a/ftplugin/rnoweb.vim +++ b/ftplugin/rnoweb.vim @@ -17,7 +17,6 @@ " Authors: Jakson Alves de Aquino " Jose Claudio Faria " -" Last Change: Mon Apr 16, 2012 12:08AM "========================================================================== " Only do this when not yet done for this buffer diff --git a/r-plugin/common_buffer.vim b/r-plugin/common_buffer.vim index 1f4cdd9..ca4006e 100644 --- a/r-plugin/common_buffer.vim +++ b/r-plugin/common_buffer.vim @@ -19,8 +19,6 @@ " " Based on previous work by Johannes Ranke " -" Last Change: Mon Feb 27, 2012 12:45PM -" " Please see doc/r-plugin.txt for usage details. "========================================================================== diff --git a/syntax/rbrowser.vim b/syntax/rbrowser.vim index 09a7021..e6e62e7 100644 --- a/syntax/rbrowser.vim +++ b/syntax/rbrowser.vim @@ -1,7 +1,6 @@ " Vim syntax file " Language: Object browser of Vim-R-plugin " Maintainer: Jakson Alves de Aquino (jalvesaq@gmail.com) -" Last Change: Mon Apr 30, 2012 12:41PM if exists("b:current_syntax") finish diff --git a/syntax/rdoc.vim b/syntax/rdoc.vim index 02100cf..16667d8 100644 --- a/syntax/rdoc.vim +++ b/syntax/rdoc.vim @@ -1,7 +1,6 @@ " Vim syntax file " Language: Test version of R documentation " Maintainer: Jakson A. Aquino -" Last Change: Sun Nov 20, 2011 06:36PM if exists("b:current_syntax") finish From 43491e914493308dfac9a106c3ac4171b0442c0e Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Wed, 9 May 2012 09:26:23 -0300 Subject: [PATCH 0254/1050] Check value of vimrplugin_objbr_place. --- r-plugin/common_global.vim | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 6236362..cd55bd3 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -628,7 +628,7 @@ function StartR(whatr) let $TMUX = "" call system('export VIMRPLUGIN_TMPDIR=' . $VIMRPLUGIN_TMPDIR) call system('export VIMINSTANCEID=' . $VIMINSTANCEID) - call system('tmux set-option -ga update-environment " TMUX_PANE VIMRPLUGIN_TMPDIR VIMINSTANCEID"') + call system('tmux set-option -ga update-environment " TMUX_PANE VIMRPLUGIN_TMPDIR VIMINSTANCEID"') endif if g:vimrplugin_notmuxconf @@ -2706,6 +2706,27 @@ call RSetDefaultValue("g:vimrplugin_vimpager", "'tab'") call RSetDefaultValue("g:vimrplugin_latexcmd", "'pdflatex'") call RSetDefaultValue("g:vimrplugin_objbr_place", "'script,right'") +" Look for invalid options +let objbrplace = split(g:vimrplugin_objbr_place, ",") +let obpllen = len(objbrplace) - 1 +if obpllen > 1 + call RWarningMsgInp("Too many options for vimrplugin_objbr_place.") + let g:rplugin_failed = 1 + finish +endif +for idx in range(0, obpllen) + if objbrplace[idx] != "console" && objbrplace[idx] != "script" && objbrplace[idx] != "left" && objbrplace[idx] != "right" + call RWarningMsgInp("Invalid option for vimrplugin_objbr_place: " . objbrplace[idx]) + let g:rplugin_failed = 1 + finish + endif +endfor +unlet objbrplace +unlet obpllen + +if g:vimrplugin_external_ob == 1 + let g:vimrplugin_objbr_place = substitute(g:vimrplugin_objbr_place, "script", "console", "") +endif " python has priority over python3, unless ConqueTerm_PyVersion == 3 if has("python3") && exists("g:ConqueTerm_PyVersion") && g:ConqueTerm_PyVersion == 3 From f273fb3de4d606f39d08c66b135bbda9f68f168f Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Wed, 9 May 2012 10:24:42 -0300 Subject: [PATCH 0255/1050] New option: vimrplugin_openpdf. --- doc/r-plugin.txt | 19 ++++++++++++++++++- ftplugin/rnoweb.vim | 4 ++++ r-plugin/common_global.vim | 1 + 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 08e2184..3937e5a 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -875,6 +875,7 @@ IPv6 one (fe80::1). |vimrplugin_never_unmake_menu| Do not unmake the menu when switching buffers |vimrplugin_map_r| Use 'r' to send lines and selected text |vimrplugin_ca_ck| Add ^A^K to the beginning of commands. +|vimrplugin_openpdf| Open PDF after processing rnoweb file. 6.1. Terminal emulator (Linux/Unix only)~ @@ -939,7 +940,7 @@ The Object Browser will always be created by splitting the Vim script window if you are running GVim. However, if running Vim in a terminal emulator, the Object Browser will be created in a independent Vim instance in a Tmux panel beside the R Console. Valid values for the Object Browser placement are -"script" or "console" and "right" or "left". Examples: +"script" or "console" and "right" or "left" separated by a comma. Examples: > let vimrplugin_objbr_place = "script,right" let vimrplugin_objbr_place = "console,left" @@ -1279,6 +1280,22 @@ either Tmux or GNU Screen in some systems. The Vim-R-plugin will add let vimrplugin_ca_ck = 1 < +6.23. Open PDF after processing rnoweb file~ + +The plugin will try to open the PDF file generated by either Sweave() or +knit() followed by pdflatex. If you prefer that the PDF is not opened +automatically, put in your |vimrc|: +> + let vimrplugin_openpdf = 0 +< +If you use Linux or other Unix and eventually use the system console (without +the X server) you may want to put in your |vimrc|: +> + if $DISPLAY == "" + let vimrplugin_openpdf = 0 + endif +< + ============================================================================== *r-plugin-key-bindings* 7. Custom key bindings~ diff --git a/ftplugin/rnoweb.vim b/ftplugin/rnoweb.vim index eb91daf..82b998d 100644 --- a/ftplugin/rnoweb.vim +++ b/ftplugin/rnoweb.vim @@ -125,6 +125,10 @@ function! RMakePDF(bibtex, knit) let pdfcmd = pdfcmd . ", bibtex = TRUE" endif + if g:vimrplugin_openpdf == 0 + let pdfcmd = pdfcmd . ", view = FALSE" + endif + if a:knit if exists("g:vimrplugin_knitargs") let pdfcmd = pdfcmd . ", " . g:vimrplugin_knitargs diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index cd55bd3..56c99eb 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -2684,6 +2684,7 @@ call RSetDefaultValue("g:vimrplugin_map_r", 0) call RSetDefaultValue("g:vimrplugin_allnames", 0) call RSetDefaultValue("g:vimrplugin_underscore", 1) call RSetDefaultValue("g:vimrplugin_rnowebchunk", 1) +call RSetDefaultValue("g:vimrplugin_openpdf", 1) call RSetDefaultValue("g:vimrplugin_i386", 0) call RSetDefaultValue("g:vimrplugin_screenvsplit", 0) call RSetDefaultValue("g:vimrplugin_conquevsplit", 0) From 2d2e75d31164b633f67bbcb966b4f9eef3b41394 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 10 May 2012 09:50:21 -0300 Subject: [PATCH 0256/1050] On Windows, use texi2pdf() to generate the pdf. --- doc/r-plugin.txt | 19 ++++++++++++------- ftplugin/rnoweb.vim | 4 ++++ r-plugin/common_global.vim | 20 ++++++++++++++------ 3 files changed, 30 insertions(+), 13 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 3937e5a..f10c532 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -388,10 +388,12 @@ Command -------------------------------------------------------- . Sweave (cur file) \sw . Sweave and PDF (cur file) \sp - . Sweave, BibTeX and PDF (cur file) \sb + . Sweave and PDF (cur file, verbose) (Windows) \sv + . Sweave, BibTeX and PDF (cur file) (Linux/Unix) \sb . Knit (cur file) \kn . Knit and PDF (cur file) \kp - . Knit, BibTeX and PDF (cur file) \kb + . Knit and PDF (cur file, verbose) (Windows) \kv + . Knit, BibTeX and PDF (cur file) (Linux/Unix) \kb -------------------------------------------------------- . Build tags file (cur dir) :RBuildTags ----------------------------------------------------------- @@ -1225,9 +1227,10 @@ Example: *vimrplugin_latexcmd* *vimrplugin_sweaveargs* *vimrplugin_knitargs* -By default, Vim calls pdflatex to produce a pdf document from the .tex file -produced by the R Sweave command. You can use the option vimrplugin_latexcmd -to change this behavior. Example: +On Windows, the plugin calls tools::texi2pdf() to build the pdf from the +generated .tex file. On Linux/Unix, by default, Vim calls pdflatex to produce +a pdf document from the .tex file produced by the R Sweave command. You can +use the option vimrplugin_latexcmd to change this behavior. Example: > let vimrplugin_latexcmd = "latex" < @@ -1878,9 +1881,11 @@ the R syntax highlighted. *r-plugin-news* 10. News~ -0.9.8 (2012-05-00) +0.9.8 (2012-05-10) - * Nothing yet. + * Open PDF after processing rnoweb file (thanks to Tomaz Ficko for suggesting + the feature). This behavior is controlled by the new option + vimrplugin_openpdf. 0.9.7 (2012-05-04) diff --git a/ftplugin/rnoweb.vim b/ftplugin/rnoweb.vim index 82b998d..ca50060 100644 --- a/ftplugin/rnoweb.vim +++ b/ftplugin/rnoweb.vim @@ -125,6 +125,10 @@ function! RMakePDF(bibtex, knit) let pdfcmd = pdfcmd . ", bibtex = TRUE" endif + if a:bibtex == "verbose" + let pdfcmd = pdfcmd . ", quiet = FALSE" + endif + if g:vimrplugin_openpdf == 0 let pdfcmd = pdfcmd . ", view = FALSE" endif diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 56c99eb..9915a31 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -2312,13 +2312,21 @@ function MakeRMenu() "------------------------------- if &filetype == "rnoweb" || g:vimrplugin_never_unmake_menu menu R.Command.-Sep5- - call RCreateMenuItem("nvi", 'Command.Sweave\ (cur\ file)', 'RSweave', 'sw', ':call RSweave()') - call RCreateMenuItem("nvi", 'Command.Sweave\ and\ PDF\ (cur\ file)', 'RMakePDF', 'sp', ':call RMakePDF("nobib")') - call RCreateMenuItem("nvi", 'Command.Sweave,\ BibTeX\ and\ PDF\ (cur\ file)', 'RMakePDF', 'sb', ':call RMakePDF("bibtex")') + call RCreateMenuItem("nvi", 'Command.Sweave\ (cur\ file)', 'RSweave', 'sw', ':call RSweave(0)') + call RCreateMenuItem("nvi", 'Command.Sweave\ and\ PDF\ (cur\ file)', 'RMakePDF', 'sp', ':call RMakePDF("nobib", 0)') + if has("win32") || has("win64") + call RCreateMenuItem("nvi", 'Command.Sweave\ and\ PDF\ (cur\ file,\ verbose)', 'RMakePDF', 'sv', ':call RMakePDF("verbose", 0)') + else + call RCreateMenuItem("nvi", 'Command.Sweave,\ BibTeX\ and\ PDF\ (cur\ file)', 'RMakePDF', 'sb', ':call RMakePDF("bibtex", 0)') + endif menu R.Command.-Sep6- - call RCreateMenuItem("nvi", 'Command.Knit\ (cur\ file)', 'RSweave', 'kn', ':call RSweave()') - call RCreateMenuItem("nvi", 'Command.Knit\ and\ PDF\ (cur\ file)', 'RMakePDF', 'kp', ':call RMakePDF("nobib")') - call RCreateMenuItem("nvi", 'Command.Knit,\ BibTeX\ and\ PDF\ (cur\ file)', 'RMakePDF', 'kb', ':call RMakePDF("bibtex")') + call RCreateMenuItem("nvi", 'Command.Knit\ (cur\ file)', 'RSweave', 'kn', ':call RSweave(1)') + call RCreateMenuItem("nvi", 'Command.Knit\ and\ PDF\ (cur\ file)', 'RMakePDF', 'kp', ':call RMakePDF("nobib", 1)') + if has("win32") || has("win64") + call RCreateMenuItem("nvi", 'Command.Knit\ and\ PDF\ (cur\ file,\ verbose)', 'RMakePDF', 'kv', ':call RMakePDF("verbose", 1)') + else + call RCreateMenuItem("nvi", 'Command.Knit,\ BibTeX\ and\ PDF\ (cur\ file)', 'RMakePDF', 'kb', ':call RMakePDF("bibtex", 1)') + endif endif "------------------------------- menu R.Command.-Sep7- From de002a8b10069132e0f81fbb5aa4dc63e384bbf6 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 10 May 2012 22:36:58 -0300 Subject: [PATCH 0257/1050] New key binding \op opens pdf manually. --- doc/r-plugin.txt | 20 +++++++++++--------- ftplugin/rnoweb.vim | 5 +++++ r-plugin/common_global.vim | 4 +++- 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index f10c532..dc46269 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -390,11 +390,14 @@ Command . Sweave and PDF (cur file) \sp . Sweave and PDF (cur file, verbose) (Windows) \sv . Sweave, BibTeX and PDF (cur file) (Linux/Unix) \sb + -------------------------------------------------------- . Knit (cur file) \kn . Knit and PDF (cur file) \kp . Knit and PDF (cur file, verbose) (Windows) \kv . Knit, BibTeX and PDF (cur file) (Linux/Unix) \kb -------------------------------------------------------- + . Open PDF (cur file) \op + -------------------------------------------------------- . Build tags file (cur dir) :RBuildTags ----------------------------------------------------------- @@ -1285,17 +1288,16 @@ either Tmux or GNU Screen in some systems. The Vim-R-plugin will add 6.23. Open PDF after processing rnoweb file~ -The plugin will try to open the PDF file generated by either Sweave() or -knit() followed by pdflatex. If you prefer that the PDF is not opened -automatically, put in your |vimrc|: +The plugin will try to open automatically the PDF file generated by pdflatex, +after either Sweave() or knit(), if you put in your |vimrc|: > - let vimrplugin_openpdf = 0 + let vimrplugin_openpdf = 1 < If you use Linux or other Unix and eventually use the system console (without the X server) you may want to put in your |vimrc|: > - if $DISPLAY == "" - let vimrplugin_openpdf = 0 + if $DISPLAY != "" + let vimrplugin_openpdf = 1 endif < @@ -1883,9 +1885,9 @@ the R syntax highlighted. 0.9.8 (2012-05-10) - * Open PDF after processing rnoweb file (thanks to Tomaz Ficko for suggesting - the feature). This behavior is controlled by the new option - vimrplugin_openpdf. + * Open PDF automatically after processing rnoweb file if + vimrplugin_openpdf = 1 (thanks to Tomaz Ficko for suggesting the feature). + Open it manually with \op. 0.9.7 (2012-05-04) diff --git a/ftplugin/rnoweb.vim b/ftplugin/rnoweb.vim index ca50060..f09309f 100644 --- a/ftplugin/rnoweb.vim +++ b/ftplugin/rnoweb.vim @@ -181,6 +181,10 @@ function! RSweave(knit) endif endfunction +function! ROpenPDF() + call SendCmdToR('vim.openpdf("' . expand("%:t:r") . ".pdf" . '")') +endfunction + if g:vimrplugin_rnowebchunk == 1 " Write code chunk in rnoweb files imap < :call RWriteChunk()a @@ -202,6 +206,7 @@ call RCreateMaps("nvi", 'RBibTeX', 'sb', ':call RMakePDF("bibtex", 0) call RCreateMaps("nvi", 'RKnit', 'kn', ':call RSweave(1)') call RCreateMaps("nvi", 'RMakePDFK', 'kp', ':call RMakePDF("nobib", 1)') call RCreateMaps("nvi", 'RBibTeXK', 'kb', ':call RMakePDF("bibtex", 1)') +call RCreateMaps("nvi", 'ROpenPDF', 'op', ':call ROpenPDF()') call RCreateMaps("nvi", 'RIndent', 'si', ':call RnwToggleIndentSty()') call RCreateMaps("ni", 'RSendChunk', 'cc', ':call SendChunkToR("silent", "stay")') call RCreateMaps("ni", 'RESendChunk', 'ce', ':call SendChunkToR("echo", "stay")') diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 9915a31..4262e5e 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -2327,6 +2327,8 @@ function MakeRMenu() else call RCreateMenuItem("nvi", 'Command.Knit,\ BibTeX\ and\ PDF\ (cur\ file)', 'RMakePDF', 'kb', ':call RMakePDF("bibtex", 1)') endif + menu R.Command.-Sep61- + call RCreateMenuItem("nvi", 'Command.Open\ PDF\ (cur\ file)', 'ROpenPDF', 'op', ':call ROpenPDF()') endif "------------------------------- menu R.Command.-Sep7- @@ -2692,7 +2694,7 @@ call RSetDefaultValue("g:vimrplugin_map_r", 0) call RSetDefaultValue("g:vimrplugin_allnames", 0) call RSetDefaultValue("g:vimrplugin_underscore", 1) call RSetDefaultValue("g:vimrplugin_rnowebchunk", 1) -call RSetDefaultValue("g:vimrplugin_openpdf", 1) +call RSetDefaultValue("g:vimrplugin_openpdf", 0) call RSetDefaultValue("g:vimrplugin_i386", 0) call RSetDefaultValue("g:vimrplugin_screenvsplit", 0) call RSetDefaultValue("g:vimrplugin_conquevsplit", 0) From d1a077d4535699efef6dbdfb3948bbee3161b4bf Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 10 May 2012 22:47:17 -0300 Subject: [PATCH 0258/1050] Add note on possible problem of openpdf option. --- doc/r-plugin.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index dc46269..2205f37 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -1300,6 +1300,10 @@ the X server) you may want to put in your |vimrc|: let vimrplugin_openpdf = 1 endif < +Note: If the pdf is already open, some pdf readers will automatically update +the pdf; others will lock the pdf file and prevent R from successfully +compiling it again. + ============================================================================== *r-plugin-key-bindings* From c1181abd52a10e3899539e241aaefc23a5f7cb01 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 12 May 2012 19:22:32 -0300 Subject: [PATCH 0259/1050] Replace ' with " to avoid error in RWarningMsg. --- r-plugin/vimcom.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/r-plugin/vimcom.py b/r-plugin/vimcom.py index 9ada8c8..aa77688 100644 --- a/r-plugin/vimcom.py +++ b/r-plugin/vimcom.py @@ -126,7 +126,9 @@ def VimServer(): vim.command("sleep 1") except Exception as errmsg: - vim.command("call RWarningMsg('Server failed to read data: " + str(errmsg) + "')") + errstr = str(errmsg) + errstr = errstr.replace("'", '"') + vim.command("call RWarningMsg('Server failed to read data: " + errstr + "')") MyPort = 0 try: sock.shutdown(socket.SHUT_RD) @@ -144,8 +146,10 @@ def VimServer(): sock = socket.socket( socket.AF_INET, socket.SOCK_DGRAM ) sock.bind( (UDP_IP,MyPort) ) except Exception as errmsg: + errstr = str(errmsg) + errstr = errstr.replace("'", '"') vim.command("let g:rplugin_myport = 0") - vim.command("call RWarningMsg('" + str(errmsg) + "')") + vim.command("call RWarningMsg('" + errstr + "')") pass def RunServer(): From d3a195b7d275b6e1703bf920d3d789c17a1271de Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 12 May 2012 19:25:15 -0300 Subject: [PATCH 0260/1050] Add function OpenPDF(). --- r-plugin/windows.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/r-plugin/windows.py b/r-plugin/windows.py index 37b1db1..4aadb7f 100644 --- a/r-plugin/windows.py +++ b/r-plugin/windows.py @@ -120,4 +120,13 @@ def StartRPy(): else: vim.command("echoerr 'File ' . g:rplugin_Rgui . ' not found.'") +def OpenPDF(fn): + try: + os.startfile(fn) + except Exception as errmsg: + errstr = str(errmsg) + errstr = errstr.replace("'", '"') + vim.command("call RWarningMsg('" + errstr + "')") + pass + # vim: sw=4 tabstop=4 expandtab From b0897c900aa45bf8e881776b2a26752a7bfad679 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 12 May 2012 19:45:13 -0300 Subject: [PATCH 0261/1050] Vim opens the pdf if the user press \op. --- doc/r-plugin.txt | 12 +++++++++--- ftplugin/rnoweb.vim | 41 ++++++++++++++++++++++++++++++++++++++++- 2 files changed, 49 insertions(+), 4 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 2205f37..1b5666e 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -1287,8 +1287,8 @@ either Tmux or GNU Screen in some systems. The Vim-R-plugin will add < 6.23. Open PDF after processing rnoweb file~ - -The plugin will try to open automatically the PDF file generated by pdflatex, + *vimrplugin_openpdf* +The plugin will try to open automatically the pdf file generated by pdflatex, after either Sweave() or knit(), if you put in your |vimrc|: > let vimrplugin_openpdf = 1 @@ -1304,6 +1304,12 @@ Note: If the pdf is already open, some pdf readers will automatically update the pdf; others will lock the pdf file and prevent R from successfully compiling it again. +The application used to open the pdf may not be the same when the pdf is open +by R (when vimrplugin_openpdf = 1) and when you open it manually with \op key +binding. If you are using Linux/Unix, you can change the pdf reader by setting +the value of the environment variable $R_PDFVIEWER. This will affect both Vim +and R. + ============================================================================== *r-plugin-key-bindings* @@ -1887,7 +1893,7 @@ the R syntax highlighted. *r-plugin-news* 10. News~ -0.9.8 (2012-05-10) +0.9.8 (2012-05-12) * Open PDF automatically after processing rnoweb file if vimrplugin_openpdf = 1 (thanks to Tomaz Ficko for suggesting the feature). diff --git a/ftplugin/rnoweb.vim b/ftplugin/rnoweb.vim index f09309f..fbcf0ed 100644 --- a/ftplugin/rnoweb.vim +++ b/ftplugin/rnoweb.vim @@ -182,7 +182,46 @@ function! RSweave(knit) endfunction function! ROpenPDF() - call SendCmdToR('vim.openpdf("' . expand("%:t:r") . ".pdf" . '")') + if has("win32") || has("win64") + exe 'Py OpenPDF("' . expand("%:t:r") . '.pdf")' + return + endif + + if !exists("g:rplugin_pdfviewer") + let g:rplugin_pdfviewer = "none" + if has("gui_macvim") || has("gui_mac") || has("mac") || has("macunix") + if $R_PDFVIEWER == "" + let pdfvl = ["open"] + else + let pdfvl = [$R_PDFVIEWER, "open"] + endif + else + if $R_PDFVIEWER == "" + let pdfvl = ["xdg-open"] + else + let pdfvl = [$R_PDFVIEWER, "xdg-open"] + endif + endif + " List from R configure script: + let pdfvl += ["evince", "okular", "xpdf", "gv", "gnome-gv", "ggv", "kpdf", "gpdf", "kghostview,", "acroread", "acroread4"] + for prog in pdfvl + if executable(prog) + let g:rplugin_pdfviewer = prog + break + endif + endfor + endif + + if g:rplugin_pdfviewer == "none" + call SendCmdToR('vim.openpdf("' . expand("%:t:r") . ".pdf" . '")') + else + let openlog = system(g:rplugin_pdfviewer . " '" . expand("%:t:r") . ".pdf" . "'") + if v:shell_error + let rlog = substitute(openlog, "\n", " ", "g") + let rlog = substitute(openlog, "\r", " ", "g") + call RWarningMsg(openlog) + endif + endif endfunction if g:vimrplugin_rnowebchunk == 1 From 6b0c5d63f538b9fa4d2de8adab079e3bf5ad33e0 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 12 May 2012 22:08:40 -0300 Subject: [PATCH 0262/1050] Add openpdf_quietly and remove knitargs. --- doc/r-plugin.txt | 15 +++++++++++---- ftplugin/rnoweb.vim | 20 +++++++++++--------- r-plugin/common_global.vim | 1 + 3 files changed, 23 insertions(+), 13 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 1b5666e..64ccc68 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -881,6 +881,7 @@ IPv6 one (fe80::1). |vimrplugin_map_r| Use 'r' to send lines and selected text |vimrplugin_ca_ck| Add ^A^K to the beginning of commands. |vimrplugin_openpdf| Open PDF after processing rnoweb file. +|vimrplugin_openpdf_quietly| Open PDF quietly. 6.1. Terminal emulator (Linux/Unix only)~ @@ -1229,7 +1230,6 @@ Example: 6.19. LaTeX command~ *vimrplugin_latexcmd* *vimrplugin_sweaveargs* - *vimrplugin_knitargs* On Windows, the plugin calls tools::texi2pdf() to build the pdf from the generated .tex file. On Linux/Unix, by default, Vim calls pdflatex to produce a pdf document from the .tex file produced by the R Sweave command. You can @@ -1240,9 +1240,6 @@ use the option vimrplugin_latexcmd to change this behavior. Example: If you want to pass arguments do the Sweave() function, set the value of the vimrplugin_sweaveargs variable. -If you want to pass arguments do the knit() function, set the value of the -vimrplugin_knitargs variable. - 6.20. Never unmake the R menu and tool bar buttons~ *vimrplugin_never_unmake_menu* @@ -1288,6 +1285,7 @@ either Tmux or GNU Screen in some systems. The Vim-R-plugin will add 6.23. Open PDF after processing rnoweb file~ *vimrplugin_openpdf* + *vimrplugin_openpdf_quietly* The plugin will try to open automatically the pdf file generated by pdflatex, after either Sweave() or knit(), if you put in your |vimrc|: > @@ -1310,6 +1308,13 @@ binding. If you are using Linux/Unix, you can change the pdf reader by setting the value of the environment variable $R_PDFVIEWER. This will affect both Vim and R. +On Linux/Unix, when vimrplugin_openpdf = 1, the application used to open the +pdf may be quite verbose, printing many lines of useless diagnostic messages +in the R Console. Put the following in you |vimrc| to inhibit these messages +(and all useful error messages): +> + let vimrplugin_openpdf_quietly = 1 +< ============================================================================== *r-plugin-key-bindings* @@ -1897,7 +1902,9 @@ the R syntax highlighted. * Open PDF automatically after processing rnoweb file if vimrplugin_openpdf = 1 (thanks to Tomaz Ficko for suggesting the feature). + Open it quietly if vimrplugin_openpdf_quietly = 1. Open it manually with \op. + * Remove option vimrplugin_knitargs. 0.9.7 (2012-05-04) diff --git a/ftplugin/rnoweb.vim b/ftplugin/rnoweb.vim index fbcf0ed..e8209b9 100644 --- a/ftplugin/rnoweb.vim +++ b/ftplugin/rnoweb.vim @@ -133,14 +133,12 @@ function! RMakePDF(bibtex, knit) let pdfcmd = pdfcmd . ", view = FALSE" endif - if a:knit - if exists("g:vimrplugin_knitargs") - let pdfcmd = pdfcmd . ", " . g:vimrplugin_knitargs - endif - else - if exists("g:vimrplugin_sweaveargs") - let pdfcmd = pdfcmd . ", " . g:vimrplugin_sweaveargs - endif + if g:vimrplugin_openpdf_quietly + let pdfcmd = pdfcmd . ", pdfquiet = TRUE" + endif + + if a:knit == 0 && exists("g:vimrplugin_sweaveargs") + let pdfcmd = pdfcmd . ", " . g:vimrplugin_sweaveargs endif let pdfcmd = pdfcmd . ")" @@ -213,7 +211,11 @@ function! ROpenPDF() endif if g:rplugin_pdfviewer == "none" - call SendCmdToR('vim.openpdf("' . expand("%:t:r") . ".pdf" . '")') + if g:vimrplugin_openpdf_quietly + call SendCmdToR('vim.openpdf("' . expand("%:t:r") . ".pdf" . '", TRUE)') + else + call SendCmdToR('vim.openpdf("' . expand("%:t:r") . ".pdf" . '")') + endif else let openlog = system(g:rplugin_pdfviewer . " '" . expand("%:t:r") . ".pdf" . "'") if v:shell_error diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 4262e5e..b91a333 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -2695,6 +2695,7 @@ call RSetDefaultValue("g:vimrplugin_allnames", 0) call RSetDefaultValue("g:vimrplugin_underscore", 1) call RSetDefaultValue("g:vimrplugin_rnowebchunk", 1) call RSetDefaultValue("g:vimrplugin_openpdf", 0) +call RSetDefaultValue("g:vimrplugin_openpdf_quietly", 0) call RSetDefaultValue("g:vimrplugin_i386", 0) call RSetDefaultValue("g:vimrplugin_screenvsplit", 0) call RSetDefaultValue("g:vimrplugin_conquevsplit", 0) From 6817378701894ff69704fa7d2be99940328ce80a Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sun, 20 May 2012 21:20:33 -0300 Subject: [PATCH 0263/1050] Unused code: win32consoleCompletion. --- autoload/rcomplete.vim | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/autoload/rcomplete.vim b/autoload/rcomplete.vim index 959e658..8debe94 100644 --- a/autoload/rcomplete.vim +++ b/autoload/rcomplete.vim @@ -21,11 +21,6 @@ fun! rcomplete#CompleteR(findstart, base) return res endif - " We could use R to get the completions based on the running evironment. - " However, we would miss information stored on the omnils file: class of - " object and its package. - " exe 'Py SendToR("utils:::.win32consoleCompletion(' . "'" . a:base . "', " . strlen(a:base) . ')$comps")' - let flines = g:rplugin_liblist + g:rplugin_globalenvlines " The char '$' at the end of 'a:base' is treated as end of line, and " the pattern is never found in 'line'. @@ -44,6 +39,17 @@ fun! rcomplete#CompleteR(findstart, base) call add(res, tmp2) endif endfor + + " When we use R to get the completions based on the running evironment we + " miss information stored on the omnils file: class of object and its + " package. + " if len(g:rplugin_liblist) == 0 && len(res) == 0 + " exe 'Py SendToR("utils:::.win32consoleCompletion(' . "'" . a:base . "', " . strlen(a:base) . ')$comps")' + " if strlen(g:rplugin_lastrpl) > 0 + " let res = split(g:rplugin_lastrpl) + " endif + " endif + return res endif endfun From c7c3154d3b252c7edc7017b45a9d83f8db11dbc3 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sun, 24 Jun 2012 00:17:48 -0300 Subject: [PATCH 0264/1050] Correctly highlight %anything%. --- syntax/r.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/syntax/r.vim b/syntax/r.vim index 865be21..ed9ec39 100644 --- a/syntax/r.vim +++ b/syntax/r.vim @@ -3,7 +3,7 @@ " Maintainer: Jakson Aquino " Former Maintainers: Vaidotas Zemlys " Tom Payne -" Last Change: Mon Feb 27, 2012 10:45AM +" Last Change: Sun Jun 24, 2012 12:14AM " Filenames: *.R *.r *.Rhistory *.Rt " " NOTE: The highlighting of R functions is defined in the @@ -106,7 +106,7 @@ syn match rOperator '*' syn match rOperator '+' syn match rOperator '=' syn match rOperator "[|!<>^~`/:]" -syn match rOperator "%\{2}\|%\*%\|%\/%\|%in%\|%o%\|%x%" +syn match rOperator "%\{2}\|%\S*%" syn match rOpError '*\{3}' syn match rOpError '//' syn match rOpError '&&&' From aa54449c7d4757b719c3f17653f8e3af357b62f7 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Wed, 27 Jun 2012 09:01:02 -0300 Subject: [PATCH 0265/1050] Minor corrections. --- doc/r-plugin.txt | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 64ccc68..441423a 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -147,8 +147,8 @@ following dependencies: > install.packages(c("vimcom", "colorout", "setwidth")) < - You certainly will want to put something like the following in your - ~/.Rprofile: + You certainly will want to put something like the following at the end of + your ~/.Rprofile: > if(interactive()){ library(colorout) @@ -222,8 +222,9 @@ to install external dependencies: * vimcom >= 0.9-3: An R package. You can install it with the R command install.packages("vimcom"). The vimcom package creates a server on R to - allow the communication with Vim. You certainly will want to put - the following lines in your Rprofile (usually at ~/Documents/.Rprofile): + allow the communication with Vim. You certainly will want to put the + following lines at the end of your Rprofile (usually at + ~/Documents/.Rprofile): > if(interactive()){ library(vimcom) @@ -565,8 +566,7 @@ The updating is automatic only if the Object Browser is running in a separate Tmux panel. The Object Browser has two views: .GlobalEnv and Libraries. If you either press or double click (GVim or Vim with 'mouse' set to "a") on the first line of the Object Browser it will toggle the view between the -objects in .GlobalEnv and the currently loaded libraries (but only libraries -loaded when |:RUpdateObjList| was run will be shown). +objects in .GlobalEnv and the currently loaded libraries. In the .GlobalEnv view, if an object has the attribute "label", it will also be displayed. Please, see the R help for package vimcom for some options to @@ -597,9 +597,10 @@ any) used to classify the objects: When running in a terminal emulator under Tmux, the Object Browser will be updated automatically. One limitation is that objects made available by the command data() may not have their classes recognized in the GlobalEnv view. -Also, when running under Tmux, the Normal mode command d deletes the object -on the cursor line or the element of a list or data.frame. If the Object -Browser is showing the libraries, the library currently on the cursor line is + +When running under Tmux, the Normal mode command d deletes the object on the +cursor line or the element of a list or data.frame. If the Object Browser is +showing the libraries, the library currently under the cursor line is detached. The Object Browser may stop to be updated automatically for a few seconds if you press d many times quickly. Please, use a value greater than 250 to set the time in milliseconds that the Object Browser should wait for R @@ -954,7 +955,8 @@ beside the R Console. Valid values for the Object Browser placement are If vimrplugin_external_ob = 1 and R is running in an external terminal emulator and the communication with R is being established through Tmux, the Object Browser will be placed besides the R Console in the external terminal -emulator. In this case, the command \rh will not work on the Object Browser. +emulator. In this case, the command rh will not work on the +Object Browser. When deleting an object from the Object Browser (possible if running Vim under Tmux), the following option controls the time in milliseconds that the Object @@ -1303,10 +1305,10 @@ the pdf; others will lock the pdf file and prevent R from successfully compiling it again. The application used to open the pdf may not be the same when the pdf is open -by R (when vimrplugin_openpdf = 1) and when you open it manually with \op key -binding. If you are using Linux/Unix, you can change the pdf reader by setting -the value of the environment variable $R_PDFVIEWER. This will affect both Vim -and R. +by R (when vimrplugin_openpdf = 1) and when you open it manually with +op key binding. If you are using Linux/Unix, you can change the +pdf reader by setting the value of the environment variable $R_PDFVIEWER. This +will affect both Vim and R. On Linux/Unix, when vimrplugin_openpdf = 1, the application used to open the pdf may be quite verbose, printing many lines of useless diagnostic messages @@ -1898,7 +1900,7 @@ the R syntax highlighted. *r-plugin-news* 10. News~ -0.9.8 (2012-05-12) +0.9.8 (2012-06-27) * Open PDF automatically after processing rnoweb file if vimrplugin_openpdf = 1 (thanks to Tomaz Ficko for suggesting the feature). From 7cc75c09993ec63edee730960b324ee1d8728f6c Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 30 Jun 2012 20:17:12 -0300 Subject: [PATCH 0266/1050] Choose last R if there are multiple ones. --- r-plugin/windows.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/r-plugin/windows.py b/r-plugin/windows.py index 4aadb7f..9f7cb64 100644 --- a/r-plugin/windows.py +++ b/r-plugin/windows.py @@ -68,9 +68,15 @@ def GetRPathPy(): kHandle = None try: kHandle = win32api.RegOpenKeyEx(win32con.HKEY_LOCAL_MACHINE, keyName, 0, win32con.KEY_READ) + rVersion, reserved, kclass, lastwrite = win32api.RegEnumKeyEx(kHandle)[-1] + keyName = keyName + "\\" + rVersion + kHandle = win32api.RegOpenKeyEx(win32con.HKEY_LOCAL_MACHINE, keyName, 0, win32con.KEY_READ) except: try: kHandle = win32api.RegOpenKeyEx(win32con.HKEY_CURRENT_USER, keyName, 0, win32con.KEY_READ) + rVersion, reserved, kclass, lastwrite = win32api.RegEnumKeyEx(kHandle)[-1] + keyName = keyName + "\\" + rVersion + kHandle = win32api.RegOpenKeyEx(win32con.HKEY_CURRENT_USER, keyName, 0, win32con.KEY_READ) except: vim.command("let s:rinstallpath = 'Not found'") if kHandle: From a2bb9842d27db728bb9442bf7bc365c439f3440c Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 30 Jun 2012 20:50:16 -0300 Subject: [PATCH 0267/1050] New tip for knitr users. --- doc/r-plugin.txt | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 441423a..38735b5 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -1813,7 +1813,16 @@ If you want to disable the syntax highlight of R functions edit the file file. -9.20. Integration with the Conque Shell plugin~ +9.20. Tips for knitr users~ + *knitr* +If you are using knitr with option cache=TRUE, you may want from time to time +to delete all objects in R workspace and all files in the cache directory. If +you want to use kr in Normal mode for this, put in your |vimrc|: +> + nmap kr :call SendCmdToR('rm(list=ls(all.names=TRUE)); unlink("cache/*")') +< + +9.21. Integration with the Conque Shell plugin~ *r-plugin-conque* In addition to being integrated with the screen.vim plugin the Vim-R-plugin can also use the Conque Shell plugin, but the Conque Shell still has some @@ -1900,13 +1909,15 @@ the R syntax highlighted. *r-plugin-news* 10. News~ -0.9.8 (2012-06-27) +0.9.8 (2012-06-29) * Open PDF automatically after processing rnoweb file if vimrplugin_openpdf = 1 (thanks to Tomaz Ficko for suggesting the feature). Open it quietly if vimrplugin_openpdf_quietly = 1. Open it manually with \op. * Remove option vimrplugin_knitargs. + * Start last R if there is more than one installed on Windows (thanks to Alex + Zvoleff for reporting the bug and writing the patch). 0.9.7 (2012-05-04) From f1d6603ed648e04f57dba19bba109e99e92b4214 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sun, 1 Jul 2012 08:44:58 -0300 Subject: [PATCH 0268/1050] Don't put single quotes around classfor element. --- r-plugin/common_global.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index b91a333..1122f71 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -1816,7 +1816,7 @@ function ShowRDoc(rkeyword, package, getclass) exe 'Py SendToR("vim.help(' . "'" . a:rkeyword . "', " . g:rplugin_htw . "L, package='" . a:package . "')". '")' else let classfor = substitute(classfor, '"', '\\"', "g") - exe 'Py SendToR("vim.help(' . "'" . a:rkeyword . "', " . g:rplugin_htw . "L, '" . classfor . "')". '")' + exe 'Py SendToR("vim.help(' . "'" . a:rkeyword . "', " . g:rplugin_htw . "L, " . classfor . ")". '")' endif if g:rplugin_lastrpl != "VIMHELP" if g:rplugin_lastrpl =~ "^MULTILIB" From 0dfe2d0b160598dab49e0fd64ee8ebdec0245858 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Mon, 2 Jul 2012 07:23:14 -0300 Subject: [PATCH 0269/1050] Add support to Roxygen comments. --- ftplugin/r.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ftplugin/r.vim b/ftplugin/r.vim index 553b0a3..d9a07f2 100644 --- a/ftplugin/r.vim +++ b/ftplugin/r.vim @@ -36,7 +36,7 @@ set cpo&vim " Don't do this if called by ../r-plugin/global_r_plugin.vim if &filetype == "r" setlocal commentstring=#%s - setlocal comments=b:#,b:##,b:### + setlocal comments=b:#,b:##,b:###,b:#' endif " Source scripts common to R, Rnoweb, Rhelp and rdoc files: From 66ffb68ec8e05dafa8343a4f14f760e5decfd6b6 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Mon, 2 Jul 2012 07:33:00 -0300 Subject: [PATCH 0270/1050] Add tip about 'formatoptions'. --- doc/r-plugin.txt | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 38735b5..4253606 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -523,8 +523,8 @@ should do the following: The command :RUpdateObjList in addition to creating a list of function names to be highlighted also creates a file containing a list of objects for omni completion (|compl-omni|) including all objects currently in R's workspace, -with the exception of the .GlobalEnv objects. These two lists are stored -permanently in the ~/.vim/r-plugin directory. +except the .GlobalEnv objects. These two lists are stored permanently in the +~/.vim/r-plugin directory. The command :RUpdateObjList waits 60 seconds to R finish building the list. If this time is not enough to your system, please, set a different value of @@ -623,6 +623,14 @@ after the last character in the line. If you are running ; over a selection of lines, the comments will be aligned according to the longest line. +While typing comments the leader comment string is automatically added to new +lines when you reach 'textwidth' but not when you press . Please, read +the Vim help about 'formatoptions' and |fo-table|. For example, you can add the +following line to your |vimrc| if you want the comment string being added +after : +> + autocmd FileType r setlocal formatoptions-=t formatoptions+=croql +< 4.7. Build a tags file to jump to function definitions~ *:RBuildTags* From c4587fc421fead98d984c3e82edac25cfd3934d8 Mon Sep 17 00:00:00 2001 From: Alex Zvoleff Date: Mon, 2 Jul 2012 16:35:34 -0700 Subject: [PATCH 0271/1050] Integrate reStructuredText processing with knitr. Add rrst syntax and ftplugin files and update common_global.vim for rrst processing. Also update name of vim.interlace function in rnoweb.vim due to rrst-related vimcom changes. --- ftplugin/rnoweb.vim | 2 +- ftplugin/rrst.vim | 173 +++++++++++++++++++++++++++++++++++++ r-plugin/common_global.vim | 56 +++++++++++- syntax/rrst.vim | 37 ++++++++ 4 files changed, 264 insertions(+), 4 deletions(-) create mode 100644 ftplugin/rrst.vim create mode 100644 syntax/rrst.vim diff --git a/ftplugin/rnoweb.vim b/ftplugin/rnoweb.vim index e8209b9..1cca2a4 100644 --- a/ftplugin/rnoweb.vim +++ b/ftplugin/rnoweb.vim @@ -111,7 +111,7 @@ endfunction function! RMakePDF(bibtex, knit) update call RSetWD() - let pdfcmd = "vim.interlace('" . expand("%:t") . "'" + let pdfcmd = "vim.interlace.rnoweb('" . expand("%:t") . "'" if a:knit let pdfcmd = "require(knitr); " . pdfcmd . ', knit = TRUE' diff --git a/ftplugin/rrst.vim b/ftplugin/rrst.vim new file mode 100644 index 0000000..4f52847 --- /dev/null +++ b/ftplugin/rrst.vim @@ -0,0 +1,173 @@ +" This program is free software; you can redistribute it and/or modify +" it under the terms of the GNU General Public License as published by +" the Free Software Foundation; either version 2 of the License, or +" (at your option) any later version. +" +" This program is distributed in the hope that it will be useful, +" but WITHOUT ANY WARRANTY; without even the implied warranty of +" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +" GNU General Public License for more details. +" +" A copy of the GNU General Public License is available at +" http://www.r-project.org/Licenses/ + +"========================================================================== +" ftplugin for Rrst files +" +" Authors: Jakson Alves de Aquino +" Jose Claudio Faria +" Alex Zvoleff +" +" Last Change: July 2, 2012 2:30PM +"========================================================================== + +" Only do this when not yet done for this buffer +if exists("b:did_rrst_ftplugin") || exists("disable_r_ftplugin") + finish +endif + +" Don't load another plugin for this buffer +let b:did_rrst_ftplugin = 1 + +let s:cpo_save = &cpo +set cpo&vim + +" Source scripts common to R, Rrst, Rnoweb, Rhelp and Rdoc: +runtime r-plugin/common_global.vim +if exists("g:rplugin_failed") + finish +endif + +" Some buffer variables common to R, Rrst, Rnoweb, Rhelp and Rdoc need to be +" defined after the global ones: +runtime r-plugin/common_buffer.vim + +function! RrstIsInRCode() + let curline = line(".") + let chunkline = search("^\\.\\. {r", "bncW") + call cursor(chunkline) + let docline = search("^\\.\\. \\.\\.", "bncW") + call cursor(curline) + if chunkline > docline + return 1 + else + return 0 + endif +endfunction + +function! RrstPreviousChunk() range + let rg = range(a:firstline, a:lastline) + let chunk = len(rg) + for var in range(1, chunk) + let curline = line(".") + if RrstIsInRCode() + let i = search("^\\.\\. {r", "bnW") + if i != 0 + call cursor(i-1, 1) + endif + endif + let i = search("^\\.\\. {r", "bnW") + if i == 0 + call cursor(curline, 1) + call RWarningMsg("There is no previous R code chunk to go.") + return + else + call cursor(i+1, 1) + endif + endfor + return +endfunction + +function! RrstNextChunk() range + let rg = range(a:firstline, a:lastline) + let chunk = len(rg) + for var in range(1, chunk) + let i = search("^\\.\\. {r", "nW") + if i == 0 + call RWarningMsg("There is no next R code chunk to go.") + return + else + call cursor(i+1, 1) + endif + endfor + return +endfunction + +function! RMakePDF() + update + call RSetWD() + let pdfcmd = "vim.interlace.rrst('" . expand("%:t") . "'" + let pdfcmd = "require(knitr);" . pdfcmd + if exists("g:vimrplugin_rrstcompiler") + let pdfcmd = pdfcmd . ", compiler='" . g:vimrplugin_rrstcompiler . "'" + endif + if exists("g:vimrplugin_knitargs") + let pdfcmd = pdfcmd . ", " . g:vimrplugin_knitargs + endif + if exists("g:vimrplugin_rst2pdfpath") + pdfcmd = pdfcmd . ", rst2pdfpath='" . g:vimrplugin_rst2pdf_path . "'" + endif + if exists("g:vimrplugin_rst2pdfargs") + let pdfcmd = pdfcmd . ", " . g:vimrplugin_rst2pdfargs + endif + let pdfcmd = pdfcmd . ")" + let b:needsnewomnilist = 1 + let ok = SendCmdToR(pdfcmd) + if ok == 0 + return + endif +endfunction + +" Send Rrst chunk to R +function! SendChunkToR(e, m) + if RrstIsInRCode() == 0 + call RWarningMsg("Not inside an R code chunk.") + return + endif + let chunkline = search("^\\.\\. {r", "bncW") + 1 + let docline = search("^\\.\\. \\.\\.", "ncW") - 1 + let lines = getline(chunkline, docline) + let ok = RSourceLines(lines, a:e) + if ok == 0 + return + endif + if a:m == "down" + call RrstNextChunk() + endif +endfunction + +" knit the current buffer content +function! RKnit() + update + let b:needsnewomnilist = 1 + call RSetWD() + call SendCmdToR('require(knitr); knit("' . expand("%:t") . '")') +endfunction + +"========================================================================== +" Key bindings and menu items + +call RCreateStartMaps() +call RCreateEditMaps() +call RCreateSendMaps() +call RControlMaps() +call RCreateMaps("nvi", 'RSetwd', 'rd', ':call RSetWD()') + +" Only .Rrst files use these functions: +call RCreateMaps("nvi", 'RKnit', 'kn', ':call RKnit()') +call RCreateMaps("nvi", 'RMakePDFK', 'kp', ':call RMakePDF()') +call RCreateMaps("nvi", 'RIndent', 'si', ':call RrstToggleIndentSty()') +call RCreateMaps("ni", 'RSendChunk', 'cc', ':call SendChunkToR("silent", "stay")') +call RCreateMaps("ni", 'RESendChunk', 'ce', ':call SendChunkToR("echo", "stay")') +call RCreateMaps("ni", 'RDSendChunk', 'cd', ':call SendChunkToR("silent", "down")') +call RCreateMaps("ni", 'REDSendChunk', 'ca', ':call SendChunkToR("echo", "down")') +nmap gn :call RrstNextChunk() +nmap gN :call RrstPreviousChunk() + +" Menu R +if has("gui_running") + call MakeRMenu() +endif + +let &cpo = s:cpo_save +unlet s:cpo_save diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 1122f71..d44399b 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -250,6 +250,9 @@ function RComment(mode) if &filetype == "rnoweb" && RnwIsInRCode() == 0 let isRcode = 0 endif + if &filetype == "rrst" && RrstIsInRCode() == 0 + let isRcode = 0 + endif if &filetype == "rhelp" let lastsection = search('^\\[a-z]*{', "bncW") let secname = getline(lastsection) @@ -1160,7 +1163,11 @@ endfunction " Send sources to R function RSourceLines(lines, e) - call writefile(a:lines, b:rsource) + let lines = a:lines + if &filetype == "rrst" + let lines = map(copy(lines), 'substitute(v:val, "^\\.\\. \\?", "", "")') + endif + call writefile(lines, b:rsource) if a:e == "echo" if exists("g:vimrplugin_maxdeparse") let rcmd = 'source("' . b:rsource . '", echo=TRUE, max.deparse=' . g:vimrplugin_maxdeparse . ')' @@ -1196,6 +1203,10 @@ function SendMBlockToR(e, m) call RWarningMsg('Not in the "Examples" section.') return endif + if &filetype == "rrst" && RrstIsInRCode() == 0 + call RWarningMsg("Not inside an R code chunk.") + return + endif let b:needsnewomnilist = 1 let curline = line(".") @@ -1243,6 +1254,10 @@ function SendFunctionToR(e, m) call RWarningMsg('Not in the "Examples" section.') return endif + if &filetype == "rrst" && RrstIsInRCode() == 0 + call RWarningMsg("Not inside an R code chunk.") + return + endif let b:needsnewomnilist = 1 let line = SanitizeRLine(getline(".")) @@ -1304,6 +1319,10 @@ function SendSelectionToR(e, m) call RWarningMsg('Not in the "Examples" section.') return endif + if &filetype == "rrst" && RrstIsInRCode() == 0 + call RWarningMsg("Not inside an R code chunk.") + return + endif let b:needsnewomnilist = 1 @@ -1372,6 +1391,10 @@ function SendParagraphToR(e, m) call RWarningMsg('Not in the "Examples" section.') return endif + if &filetype == "rrst" && RrstIsInRCode() == 0 + call RWarningMsg("Not inside an R code chunk.") + return + endif let b:needsnewomnilist = 1 let i = line(".") @@ -1443,6 +1466,14 @@ function SendLineToR(godown) endif endif + if &filetype == "rrst" + let line = substitute(line, "^\\.\\. \\?", "", "") + if RrstIsInRCode() == 0 + call RWarningMsg("Not inside an R code chunk.") + return + endif + endif + let b:needsnewomnilist = 1 let ok = SendCmdToR(line) if ok @@ -2273,6 +2304,14 @@ function MakeRMenu() call RCreateMenuItem("ni", 'Send.Chunk\ (cur,\ echo\ and\ down)', 'REDSendChunk', 'ca', ':call SendChunkToR("echo", "down")') endif "------------------------------- + if &filetype == "rrst" || g:vimrplugin_never_unmake_menu + menu R.Send.-Sep2- + call RCreateMenuItem("ni", 'Send.Chunk\ (cur)', 'RSendChunk', 'cc', ':call SendChunkToR("silent", "stay")') + call RCreateMenuItem("ni", 'Send.Chunk\ (cur,\ echo)', 'RESendChunk', 'ce', ':call SendChunkToR("echo", "stay")') + call RCreateMenuItem("ni", 'Send.Chunk\ (cur,\ down)', 'RDSendChunk', 'cd', ':call SendChunkToR("silent", "down")') + call RCreateMenuItem("ni", 'Send.Chunk\ (cur,\ echo\ and\ down)', 'REDSendChunk', 'ca', ':call SendChunkToR("echo", "down")') + endif + "------------------------------- menu R.Send.-Sep3- call RCreateMenuItem("ni", 'Send.Function\ (cur)', 'RSendFunction', 'ff', ':call SendFunctionToR("silent", "stay")') call RCreateMenuItem("ni", 'Send.Function\ (cur,\ echo)', 'RESendFunction', 'fe', ':call SendFunctionToR("echo", "stay")') @@ -2331,6 +2370,12 @@ function MakeRMenu() call RCreateMenuItem("nvi", 'Command.Open\ PDF\ (cur\ file)', 'ROpenPDF', 'op', ':call ROpenPDF()') endif "------------------------------- + if &filetype == "rrst" || g:vimrplugin_never_unmake_menu + menu R.Command.-Sep5- + call RCreateMenuItem("nvi", 'Command.Knit\ (cur\ file)', 'RKnit', 'kn', ':call RSweave()') + call RCreateMenuItem("nvi", 'Command.Knit\ and\ PDF\ (cur\ file)', 'RMakePDF', 'kp', ':call RMakePDF("nobib")') + endif + "------------------------------- menu R.Command.-Sep7- if &filetype == "r" || &filetype == "rnoweb" || g:vimrplugin_never_unmake_menu nmenu R.Command.Build\ tags\ file\ (cur\ dir):RBuildTags :call SendCmdToR('rtags(ofile = "TAGS")') @@ -2342,7 +2387,7 @@ function MakeRMenu() "---------------------------------------------------------------------------- " Edit "---------------------------------------------------------------------------- - if &filetype == "r" || &filetype == "rnoweb" || &filetype == "rhelp" || g:vimrplugin_never_unmake_menu + if &filetype == "r" || &filetype == "rnoweb" || &filetype == "rrst" || &filetype == "rhelp" || g:vimrplugin_never_unmake_menu if g:vimrplugin_underscore == 1 imenu R.Edit.Insert\ \"\ <-\ \"_ :call ReplaceUnderS()a imenu R.Edit.Complete\ object\ name^X^O @@ -2367,6 +2412,11 @@ function MakeRMenu() nmenu R.Edit.Go\ (next\ R\ chunk)gn :call RnwNextChunk() nmenu R.Edit.Go\ (previous\ R\ chunk)gN :call RnwPreviousChunk() endif + if &filetype == "rrst" || g:vimrplugin_never_unmake_menu + menu R.Edit.-Sep73- + nmenu R.Edit.Go\ (next\ R\ chunk)gn :call RrstNextChunk() + nmenu R.Edit.Go\ (previous\ R\ chunk)gN :call RrstPreviousChunk() + endif endif "---------------------------------------------------------------------------- @@ -2600,7 +2650,7 @@ endfunction function RBufEnter() if &filetype != g:rplugin_lastft call UnMakeRMenu() - if &filetype == "r" || &filetype == "rnoweb" || &filetype == "rdoc" || &filetype == "rbrowser" || &filetype == "rhelp" + if &filetype == "r" || &filetype == "rnoweb" || &filetype == "rrst" || &filetype == "rdoc" || &filetype == "rbrowser" || &filetype == "rhelp" if &filetype == "rbrowser" call MakeRBrowserMenu() else diff --git a/syntax/rrst.vim b/syntax/rrst.vim new file mode 100644 index 0000000..4886cba --- /dev/null +++ b/syntax/rrst.vim @@ -0,0 +1,37 @@ +" reStructured Text with R statements +" Language: reST with R code chunks +" Maintainer: Alex Zvoleff, azvoleff@mail.sdsu.edu +" Last Change: 2012 Jun 12 + +" for portability +if version < 600 + syntax clear +elseif exists("b:current_syntax") + finish +endif + +" load all of the rst info +runtime syntax/rst.vim +unlet b:current_syntax + +" highlight the ".." symbols used in R rst files +syntax match rstrTwodots "^\.\.\_s" contained +hi def link rstrTwodots rstDirective +syntax match rstrEndblock "^\.\. \.\.$" contained +hi def link rstrEndblock rstDirective +"TODO: fix the next line - the \zs isn't working +syntax match rstrBlockname "^\.\. {r \zs[a-zA-Z0-9_-]*" contained +hi def link rstrBlockname Special + +" load all of the r syntax highlighting rules into @R +syntax include @R syntax/r.vim +syntax region rstr start="^\.\. {r .*}$" end="^\.\. \.\.$" contains=@R, rstrBlockname, rstrEndblock, rstrTwodots keepend transparent fold + +" also match and syntax highlight in-line R code +syntax match rstrInlineStart ":r:" +hi def link rstrInlineStart rstDirective +syntax match rstrInlineAccent "`" contained +hi def link rstrInlineAccent String +syntax region rstrInline start=":r:[ ]*`" skip=/\\\\\|\\`/ end="`" contains=@R, rstrInlineStart, rstrInlineAccent keepend + +let b:current_syntax = "rrst" From f99df765a44944405caa3a98d726a1fe04e40793 Mon Sep 17 00:00:00 2001 From: Alex Zvoleff Date: Mon, 2 Jul 2012 16:55:22 -0700 Subject: [PATCH 0272/1050] Make rplugin_Rgui global to avoid "invalid expression" error in windows.py If rplugin_Rgui is local to the buffer, there is a bug created when multiple buffers are openened in R on windows. When you try to start an R terminal from any buffer other than the first that was opened, an error is thrown ("vim.error: invalid expression) from line 91 of windows.py, as the rplugin_Rgui variable is not defined. --- r-plugin/common_global.vim | 8 ++++---- r-plugin/windows.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index d44399b..a420353 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -2963,7 +2963,7 @@ if has("win32") || has("win64") if !exists("g:rplugin_rpathadded") if exists("g:vimrplugin_r_path") && isdirectory(g:vimrplugin_r_path) let $PATH = g:vimrplugin_r_path . ";" . $PATH - let b:rplugin_Rgui = g:vimrplugin_r_path . "\\Rgui.exe" + let g:rplugin_Rgui = g:vimrplugin_r_path . "\\Rgui.exe" else Py GetRPathPy() if s:rinstallpath == "Not found" @@ -2977,14 +2977,14 @@ if has("win32") || has("win64") endif if g:vimrplugin_i386 let $PATH = s:rinstallpath . '\bin\i386;' . $PATH - let b:rplugin_Rgui = s:rinstallpath . '\bin\i386\Rgui.exe' + let g:rplugin_Rgui = s:rinstallpath . '\bin\i386\Rgui.exe' else let $PATH = s:rinstallpath . '\bin\x64;' . $PATH - let b:rplugin_Rgui = s:rinstallpath . '\bin\x64\Rgui.exe' + let g:rplugin_Rgui = s:rinstallpath . '\bin\x64\Rgui.exe' endif else let $PATH = s:rinstallpath . '\bin;' . $PATH - let b:rplugin_Rgui = s:rinstallpath . '\bin\Rgui.exe' + let g:rplugin_Rgui = s:rinstallpath . '\bin\Rgui.exe' endif unlet s:rinstallpath endif diff --git a/r-plugin/windows.py b/r-plugin/windows.py index 9f7cb64..891a250 100644 --- a/r-plugin/windows.py +++ b/r-plugin/windows.py @@ -88,7 +88,7 @@ def GetRPathPy(): vim.command("let s:rinstallpath = 'Not found'") def StartRPy(): - rpath = vim.eval("b:rplugin_Rgui") + rpath = vim.eval("g:rplugin_Rgui") rargs = ['"' + rpath + '"'] r_args = vim.eval("b:rplugin_r_args") if r_args != " ": From c1bb009923031607e3ca28e6500d9de0512a423b Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 5 Jul 2012 08:01:05 -0300 Subject: [PATCH 0273/1050] Recognize Rrst file type. --- ftdetect/r.vim | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ftdetect/r.vim b/ftdetect/r.vim index 9530e39..fed4cb5 100644 --- a/ftdetect/r.vim +++ b/ftdetect/r.vim @@ -14,3 +14,6 @@ autocmd BufNewFile,BufRead *.Rout set ft=rout autocmd BufNewFile,BufRead *.Rout.save set ft=rout autocmd BufNewFile,BufRead *.Rout.fail set ft=rout +autocmd BufNewFile,BufRead *.Rrst set ft=rrst +autocmd BufNewFile,BufRead *.rrst set ft=rrst + From 535463a0160648f16e963effa6825da7897d6a03 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Fri, 6 Jul 2012 09:19:11 -0300 Subject: [PATCH 0274/1050] Recognize Roxygen keywords. --- syntax/r.vim | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/syntax/r.vim b/syntax/r.vim index ed9ec39..2b04a33 100644 --- a/syntax/r.vim +++ b/syntax/r.vim @@ -3,7 +3,7 @@ " Maintainer: Jakson Aquino " Former Maintainers: Vaidotas Zemlys " Tom Payne -" Last Change: Sun Jun 24, 2012 12:14AM +" Last Change: Fri Jul 06, 2012 09:15AM " Filenames: *.R *.r *.Rhistory *.Rt " " NOTE: The highlighting of R functions is defined in the @@ -30,7 +30,15 @@ endif syn case match " Comment -syn match rComment contains=@Spell "\#.*" +syn match rComment contains=@Spell "#.*" + +" Roxygen +syn match rOKeyword contained "@\(param\|return\|name\|rdname\|examples\|include\)" +syn match rOKeyword contained "@\(S3method\|TODO\|aliases\|alias\|assignee\|author\|callGraphDepth\|callGraph\)" +syn match rOKeyword contained "@\(callGraphPrimitives\|concept\|exportClass\|exportMethod\|exportPattern\|export\|formals\)" +syn match rOKeyword contained "@\(format\|importClassesFrom\|importFrom\|importMethodsFrom\|import\|keywords\)" +syn match rOKeyword contained "@\(method\|nord\|note\|references\|seealso\|setClass\|slot\|source\|title\|usage\)" +syn match rOComment contains=@Spell,rOKeyword "#'.*" if &filetype == "rhelp" " string enclosed in double quotes @@ -172,6 +180,7 @@ hi def link rArrow Statement hi def link rBoolean Boolean hi def link rBraceError Error hi def link rComment Comment +hi def link rOComment Comment hi def link rComplex Number hi def link rConditional Conditional hi def link rConstant Constant @@ -198,6 +207,7 @@ hi def link rStatement Statement hi def link rString String hi def link rStrError Error hi def link rType Type +hi def link rOKeyword Title let b:current_syntax="r" From b735951f3a64e1059112b180602041c13ec74ce0 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Fri, 6 Jul 2012 12:34:14 -0300 Subject: [PATCH 0275/1050] Update. --- syntax/rout.vim | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/syntax/rout.vim b/syntax/rout.vim index 578a5bd..d88e9cb 100644 --- a/syntax/rout.vim +++ b/syntax/rout.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: R output Files " Maintainer: Jakson Aquino -" Last Change: Sun May 22, 2011 08:43AM +" Last Change: Fri Jul 06, 2012 12:33PM " " Version Clears: {{{1 @@ -79,7 +79,6 @@ if v:lang =~ "^de" endif if v:lang =~ "^es" - syn match routError "^Error.*" syn match routWarn "^Aviso.*" endif @@ -98,6 +97,12 @@ if v:lang =~ "^nn" syn match routWarn "^Ã…tvaring.*" endif +if v:lang =~ "^pl" + syn match routError "^BÅÄ„D.*" + syn match routError "^Błąd.*" + syn match routWarn "^Ostrzeżenie.*" +endif + if v:lang =~ "^pt_BR" syn match routError "^Erro.*" syn match routWarn "^Aviso.*" @@ -108,6 +113,11 @@ if v:lang =~ "^ru" syn match routWarn "^Предупреждение.*" endif +if v:lang =~ "^tr" + syn match routError "^Hata.*" + syn match routWarn "^Uyarı.*" +endif + " LaTeX errors if syn_rout_latex == 1 syn match routWarn "^No file .*" From 51c6500159d7ccd0cc9b490635ae2e92abcb7eec Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Wed, 11 Jul 2012 07:43:58 -0300 Subject: [PATCH 0276/1050] Add support to rmd file type. --- doc/r-plugin.txt | 13 ++- ftdetect/r.vim | 2 + ftplugin/rmd.vim | 175 +++++++++++++++++++++++++++++++ r-plugin/common_global.vim | 34 ++++++ r-plugin/rmd.snippets | 205 +++++++++++++++++++++++++++++++++++++ syntax/r.vim | 12 ++- syntax/rmd.vim | 35 +++++++ 7 files changed, 468 insertions(+), 8 deletions(-) create mode 100644 ftplugin/rmd.vim create mode 100644 r-plugin/rmd.snippets create mode 100644 syntax/rmd.vim diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 4253606..2c53af6 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -1513,10 +1513,11 @@ in your R script. The plugin may be downloaded from: http://www.vim.org/scripts/script.php?script_id=2540 The snipMate plugin does not come with snippets for R, but you can copy the -r.snippets that ships with the Vim-R-plugin (look at the r-plugin directory) -to the snippets directory. The file has only a few snippets, but it will help -you to get started. If you usually edit rnoweb files, you may also want to -create an rnoweb.snippet by concatenating both tex.snippets and r.snippets. +files r.snippets and rmd.snippets that ship with the Vim-R-plugin (look at the +r-plugin directory) to the snippets directory. The files have only a few +snippets, but they will help you to get started. If you usually edit rnoweb +files, you may also want to create an rnoweb.snippet by concatenating both +tex.snippets and r.snippets. 9.5. Easier key bindings for most used commands~ @@ -1917,7 +1918,7 @@ the R syntax highlighted. *r-plugin-news* 10. News~ -0.9.8 (2012-06-29) +0.9.8 (2012-07-11) * Open PDF automatically after processing rnoweb file if vimrplugin_openpdf = 1 (thanks to Tomaz Ficko for suggesting the feature). @@ -1926,6 +1927,8 @@ the R syntax highlighted. * Remove option vimrplugin_knitargs. * Start last R if there is more than one installed on Windows (thanks to Alex Zvoleff for reporting the bug and writing the patch). + * Alex Zvoleff added support to Rrst file type. + * michelk added support to rmd file type. 0.9.7 (2012-05-04) diff --git a/ftdetect/r.vim b/ftdetect/r.vim index fed4cb5..370fb96 100644 --- a/ftdetect/r.vim +++ b/ftdetect/r.vim @@ -17,3 +17,5 @@ autocmd BufNewFile,BufRead *.Rout.fail set ft=rout autocmd BufNewFile,BufRead *.Rrst set ft=rrst autocmd BufNewFile,BufRead *.rrst set ft=rrst +autocmd BufNewFile,BufRead *.Rmd set ft=rmd +autocmd BufNewFile,BufRead *.rmd set ft=rmd diff --git a/ftplugin/rmd.vim b/ftplugin/rmd.vim new file mode 100644 index 0000000..e570c7f --- /dev/null +++ b/ftplugin/rmd.vim @@ -0,0 +1,175 @@ +" This program is free software; you can redistribute it and/or modify +" it under the terms of the GNU General Public License as published by +" the Free Software Foundation; either version 2 of the License, or +" (at your option) any later version. +" +" This program is distributed in the hope that it will be useful, +" but WITHOUT ANY WARRANTY; without even the implied warranty of +" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +" GNU General Public License for more details. +" +" A copy of the GNU General Public License is available at +" http://www.r-project.org/Licenses/ + +"========================================================================== +" ftplugin for Rmd files +" +" Authors: Jakson Alves de Aquino +" Jose Claudio Faria +" Alex Zvoleff (adjusting for rmd by Michel Kuhlmann) +" +"========================================================================== + +" Only do this when not yet done for this buffer +if exists("b:did_rmd_ftplugin") || exists("disable_r_ftplugin") + finish +endif + +" Don't load another plugin for this buffer +let b:did_rmd_ftplugin = 1 + +let s:cpo_save = &cpo +set cpo&vim + +" Enables pandoc if it is installed +runtime ftplugin/pandoc.vim + +" Source scripts common to R, Rrst, Rnoweb, Rhelp and Rdoc: +runtime r-plugin/common_global.vim +if exists("g:rplugin_failed") + finish +endif + +" Some buffer variables common to R, Rmd, Rrst, Rnoweb, Rhelp and Rdoc need to +" be defined after the global ones: +runtime r-plugin/common_buffer.vim + +function! RmdIsInRCode() + let curline = line(".") + let chunkline = search("^```[ ]*{r", "bncW") + call cursor(chunkline) + let docline = search("^```", "bncW") + call cursor(curline) + if chunkline > docline + return 1 + else + return 0 + endif +endfunction + +function! RmdPreviousChunk() range + let rg = range(a:firstline, a:lastline) + let chunk = len(rg) + for var in range(1, chunk) + let curline = line(".") + if RmdIsInRCode() + let i = search("^``` [ ]*{r", "bnW") + if i != 0 + call cursor(i-1, 1) + endif + endif + let i = search("^```[ ]*{r", "bnW") + if i == 0 + call cursor(curline, 1) + call RWarningMsg("There is no previous R code chunk to go.") + return + else + call cursor(i+1, 1) + endif + endfor + return +endfunction + +function! RmdNextChunk() range + let rg = range(a:firstline, a:lastline) + let chunk = len(rg) + for var in range(1, chunk) + let i = search("^```[ ]*{r", "nW") + if i == 0 + call RWarningMsg("There is no next R code chunk to go.") + return + else + call cursor(i+1, 1) + endif + endfor + return +endfunction + +function! RMakePDF() + update + call RSetWD() + let pdfcmd = "vim.interlace.rmd('" . expand("%:t") . "'" + let pdfcmd = "require(knitr);" . pdfcmd + if exists("g:vimrplugin_rmdcompiler") + let pdfcmd = pdfcmd . ", compiler='" . g:vimrplugin_rmdcompiler . "'" + endif + if exists("g:vimrplugin_knitargs") + let pdfcmd = pdfcmd . ", " . g:vimrplugin_knitargs + endif + if exists("g:vimrplugin_rmd2pdfpath") + pdfcmd = pdfcmd . ", rmd2pdfpath='" . g:vimrplugin_rmd2pdf_path . "'" + endif + if exists("g:vimrplugin_rmd2pdfargs") + let pdfcmd = pdfcmd . ", " . g:vimrplugin_rmd2pdfargs + endif + let pdfcmd = pdfcmd . ")" + let b:needsnewomnilist = 1 + let ok = SendCmdToR(pdfcmd) + if ok == 0 + return + endif +endfunction + +" Send Rmd chunk to R +function! SendChunkToR(e, m) + if RmdIsInRCode() == 0 + call RWarningMsg("Not inside an R code chunk.") + return + endif + let chunkline = search("^```[ ]*{r", "bncW") + 1 + let docline = search("^```", "ncW") - 1 + let lines = getline(chunkline, docline) + let ok = RSourceLines(lines, a:e) + if ok == 0 + return + endif + if a:m == "down" + call RmdNextChunk() + endif +endfunction + +" knit the current buffer content +function! RKnit() + update + let b:needsnewomnilist = 1 + call RSetWD() + call SendCmdToR('require(knitr); knit("' . expand("%:t") . '")') +endfunction + +"========================================================================== +" Key bindings and menu items + +call RCreateStartMaps() +call RCreateEditMaps() +call RCreateSendMaps() +call RControlMaps() +call RCreateMaps("nvi", 'RSetwd', 'rd', ':call RSetWD()') + +" Only .Rmd files use these functions: +call RCreateMaps("nvi", 'RKnit', 'kn', ':call RKnit()') +call RCreateMaps("nvi", 'RMakePDFK', 'kp', ':call RMakePDF()') +call RCreateMaps("nvi", 'RIndent', 'si', ':call RmdToggleIndentSty()') +call RCreateMaps("ni", 'RSendChunk', 'cc', ':call SendChunkToR("silent", "stay")') +call RCreateMaps("ni", 'RESendChunk', 'ce', ':call SendChunkToR("echo", "stay")') +call RCreateMaps("ni", 'RDSendChunk', 'cd', ':call SendChunkToR("silent", "down")') +call RCreateMaps("ni", 'REDSendChunk', 'ca', ':call SendChunkToR("echo", "down")') +nmap gn :call RmdNextChunk() +nmap gN :call RmdPreviousChunk() + +" Menu R +if has("gui_running") + call MakeRMenu() +endif + +let &cpo = s:cpo_save +unlet s:cpo_save diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index a420353..69d65d4 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -253,6 +253,9 @@ function RComment(mode) if &filetype == "rrst" && RrstIsInRCode() == 0 let isRcode = 0 endif + if &filetype == "rmd" && RmdIsInRCode() == 0 + let isRcode = 0 + endif if &filetype == "rhelp" let lastsection = search('^\\[a-z]*{', "bncW") let secname = getline(lastsection) @@ -1167,6 +1170,9 @@ function RSourceLines(lines, e) if &filetype == "rrst" let lines = map(copy(lines), 'substitute(v:val, "^\\.\\. \\?", "", "")') endif + if &filetype == "rmd" + let lines = map(copy(lines), 'substitute(v:val, "^\\`\\`\\?", "", "")') + endif call writefile(lines, b:rsource) if a:e == "echo" if exists("g:vimrplugin_maxdeparse") @@ -1207,6 +1213,10 @@ function SendMBlockToR(e, m) call RWarningMsg("Not inside an R code chunk.") return endif + if &filetype == "rmd" && RmdIsInRCode() == 0 + call RWarningMsg("Not inside an R code chunk.") + return + endif let b:needsnewomnilist = 1 let curline = line(".") @@ -1258,6 +1268,10 @@ function SendFunctionToR(e, m) call RWarningMsg("Not inside an R code chunk.") return endif + if &filetype == "rmd" && RmdIsInRCode() == 0 + call RWarningMsg("Not inside an R code chunk.") + return + endif let b:needsnewomnilist = 1 let line = SanitizeRLine(getline(".")) @@ -1323,6 +1337,10 @@ function SendSelectionToR(e, m) call RWarningMsg("Not inside an R code chunk.") return endif + if &filetype == "rmd" && RmdIsInRCode() == 0 + call RWarningMsg("Not inside an R code chunk.") + return + endif let b:needsnewomnilist = 1 @@ -1395,6 +1413,10 @@ function SendParagraphToR(e, m) call RWarningMsg("Not inside an R code chunk.") return endif + if &filetype == "rmd" && RmdIsInRCode() == 0 + call RWarningMsg("Not inside an R code chunk.") + return + endif let b:needsnewomnilist = 1 let i = line(".") @@ -1473,6 +1495,13 @@ function SendLineToR(godown) return endif endif + if &filetype == "rmd" + let line = substitute(line, "^\\`\\`\\?", "", "") + if RmdIsInRCode() == 0 + call RWarningMsg("Not inside an R code chunk.") + return + endif + endif let b:needsnewomnilist = 1 let ok = SendCmdToR(line) @@ -2417,6 +2446,11 @@ function MakeRMenu() nmenu R.Edit.Go\ (next\ R\ chunk)gn :call RrstNextChunk() nmenu R.Edit.Go\ (previous\ R\ chunk)gN :call RrstPreviousChunk() endif + if &filetype == "rmd" || g:vimrplugin_never_unmake_menu + menu R.Edit.-Sep73- + nmenu R.Edit.Go\ (next\ R\ chunk)gn :call RmdNextChunk() + nmenu R.Edit.Go\ (previous\ R\ chunk)gN :call RmdPreviousChunk() + endif endif "---------------------------------------------------------------------------- diff --git a/r-plugin/rmd.snippets b/r-plugin/rmd.snippets new file mode 100644 index 0000000..577d7e4 --- /dev/null +++ b/r-plugin/rmd.snippets @@ -0,0 +1,205 @@ +# +# Snipmate Snippets for Pandoc Markdown +# +# Many snippets have starred versions, i.e., versions +# that end with an asterisk (`*`). These snippets use +# vim's `"*` register---i.e., the contents of the +# system clipboard---to insert text. + +# Insert Title Block +snippet %% + % ${1:`Filename('', 'title')`} + % ${2:`g:snips_author`} + % ${3:`strftime("%d %B %Y")`} + + ${4} +snippet %%* + % ${1:`Filename('', @*)`} + % ${2:`g:snips_author`} + % ${3:`strftime("%d %b %Y")`} + + ${4} + +# Insert Definition List +snippet :: + ${1:term} + ~ ${2:definition} + +# Underline with `=`s or `-`s +snippet === + `repeat('=', strlen(getline(line(".") - 1)))` + + ${1} +snippet --- + `repeat('-', strlen(getline(line(".") - 1)))` + + ${1} + +# Links and their kin +# ------------------- +# +# (These don't play very well with delimitMate) +# + +snippet [ + [${1:link}](http://${2:url} "${3:title}")${4} +snippet [* + [${1:link}](${2:`@*`} "${3:title}")${4} + +snippet [: + [${1:id}]: http://${2:url} "${3:title}" +snippet [:* + [${1:id}]: ${2:`@*`} "${3:title}" + +snippet [@ + [${1:link}](mailto:${2:email})${3} +snippet [@* + [${1:link}](mailto:${2:`@*`})${3} + +snippet [:@ + [${1:id}]: mailto:${2:email} "${3:title}" +snippet [:@* + [${1:id}]: mailto:${2:`@*`} "${3:title}" + +snippet ![ + ![${1:alt}](${2:url} "${3:title}")${4} +snippet ![* + ![${1:alt}](${2:`@*`} "${3:title}")${4} + +snippet ![: + ![${1:id}]: ${2:url} "${3:title}" +snippet ![:* + ![${1:id}]: ${2:`@*`} "${3:title}" + +snippet [^: + [^${1:id}]: ${2:note} +snippet [^:* + [^${1:id}]: ${2:`@*`} + +# + +# library() +snippet req + require(${1:}, quietly = TRUE) +# If Condition +snippet if + if ( ${1:condition} ) + { + ${2:} + } +snippet el + else + { + ${1:} + } + +# Function +snippet fun + ${1:funname} <- # ${2:} + function + ( + ${3:} + ) + { + ${4:} + } +# repeat +snippet re + repeat{ + ${2:} + if(${1:condition}) break + } + +# matrix +snippet ma + matrix(NA, nrow = ${1:}, ncol = ${2:}) + +# data frame +snippet df + data.frame(${1:}, header = TRUE) + +snippet cmdarg + args <- commandArgs(TRUE) + if (length(args) == 0) + stop("Please give ${1:}!") + if (!all(file.exists(args))) + stop("Couln't find input files!") + +snippet getopt + require('getopt', quietly = TRUE) + opt_spec <- matrix(c( + 'help', 'h', 0, "logical", "Getting help", + 'file', 'f', 1, "character","File to process" + ), ncol = 5, byrow = TRUE) + opt <- getopt(spec = opt_spec) + if ( !is.null(opt$help) || is.null(commandArgs()) ) { + cat(getopt(spec = opt_spec, usage = TRUE, command = "yourCmd")) + q(status=0) + } + # some inital value + if ( is.null(opt$???) ) { opt$??? <- ??? } + +snippet optparse + require("optparse", quietly = TRUE) + option_list <- + list(make_option(c("-n", "--add_numbers"), action="store_true", default=FALSE, + help="Print line number at the beginning of each line [default]") + ) + parser <- OptionParser(usage = "%prog [options] file", option_list=option_list) + arguments <- parse_args(parser, positional_arguments = TRUE) + opt <- arguments$options + + if(length(arguments$args) != 1) { + cat("Incorrect number of required positional arguments\n\n") + print_help(parser) + stop() + } else { + file <- arguments$args + } + + if( file.access(file) == -1) { + stop(sprintf("Specified file ( %s ) does not exist", file)) + } else { + file_text <- readLines(file) + } + +snippet #! + #!/usr/bin/env Rscript + +snippet debug + # Development & Debugging, don't forget to uncomment afterwards! + #-------------------------------------------------------------------------------- + #setwd("~/Projekte/${1:}") + #opt <- list(${2:} + # ) + #-------------------------------------------------------------------------------- + + +# Took from pandoc-plugin <<<< +# Underline with `=`s or `-`s +snippet #=== + #`repeat('=', strlen(getline(line(".") - 1)))` + ${1} +snippet #--- + #`repeat('-', strlen(getline(line(".") - 1)))` + ${1} + +# >>>> + +snippet r + \`\`\`{r ${1:chung_tag}, echo = FALSE ${2:options}} + ${3:} + \`\`\` +snippet ri + \`{r ${1:}}\` + +snippet copt + \`\`\` {r setup, echo = FALSE} + opts_chunk$set(fig.path='../figures/${1:}', cache.path='../cache/-' + , fig.align='center', fig.show='hold', par=TRUE) + #opts_knit$set(upload.fun = imgur_upload) # upload images + \`\`\` + + +# End of File =================================================================== +# vim: set noexpandtab: diff --git a/syntax/r.vim b/syntax/r.vim index 2b04a33..afbd96c 100644 --- a/syntax/r.vim +++ b/syntax/r.vim @@ -3,7 +3,7 @@ " Maintainer: Jakson Aquino " Former Maintainers: Vaidotas Zemlys " Tom Payne -" Last Change: Fri Jul 06, 2012 09:15AM +" Last Change: Wed Jul 11, 2012 07:31AM " Filenames: *.R *.r *.Rhistory *.Rt " " NOTE: The highlighting of R functions is defined in the @@ -113,7 +113,11 @@ syn match rOperator '-' syn match rOperator '*' syn match rOperator '+' syn match rOperator '=' -syn match rOperator "[|!<>^~`/:]" +if &filetype == "rmd" + syn match rOperator "[|!<>^~/:]" +else + syn match rOperator "[|!<>^~`/:]" +endif syn match rOperator "%\{2}\|%\S*%" syn match rOpError '*\{3}' syn match rOpError '//' @@ -167,7 +171,9 @@ endif syn keyword rType array category character complex double function integer list logical matrix numeric vector data.frame " Name of object with spaces -syn region rNameWSpace start="`" end="`" +if &filetype != "rmd" + syn region rNameWSpace start="`" end="`" +endif if &filetype == "rhelp" syn match rhPreProc "^#ifdef.*" diff --git a/syntax/rmd.vim b/syntax/rmd.vim new file mode 100644 index 0000000..e24ce18 --- /dev/null +++ b/syntax/rmd.vim @@ -0,0 +1,35 @@ +" markdown Text with R statements +" Language: markdown with R code chunks +" Last Change: Wednesday, 2012-07-11 + +" for portability +if version < 600 + syntax clear +elseif exists("b:current_syntax") + finish +endif + +" load all of pandoc info +runtime syntax/pandoc.vim +unlet b:current_syntax + +syntax match rmdPattern "^```\_s" contained +hi def link rmdPattern Keyword +syntax match rmdrEndblock "^```[ ]*$" contained +hi def link rmdrEndblock Keyword +syntax match rmdrBlockname "^```[ ]*{r *}" contained +hi def link rmdrBlockname Special + +" load all of the r syntax highlighting rules into @R +syntax include @R syntax/r.vim +syntax region rmdr start="^```[ ]*{r .*}$" end="^```$" contains=@R, rmdrBlockname, rmdrEndblock, rmdPattern keepend transparent fold + +" TODO: Code below doesn't work +" also match and syntax highlight in-line R code +syntax match rmdrInlineStart "`r " +hi def link rmdrInlineStart Keyword +syntax match rmdrInlineAccent "`" contained +hi def link rmdrInlineAccent String +syntax region rmdrInline start="`r[ ]" end="`" contains=@R, rmdrInlineStart, rmdrInlineAccent keepend + +let b:current_syntax = "rmd" From 92461e2531b71653454a92c4df114a6566d4f33a Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Wed, 11 Jul 2012 07:53:28 -0300 Subject: [PATCH 0277/1050] Only unlet b:current_syntax if it exists. --- syntax/rmd.vim | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/syntax/rmd.vim b/syntax/rmd.vim index e24ce18..4ac5906 100644 --- a/syntax/rmd.vim +++ b/syntax/rmd.vim @@ -1,6 +1,6 @@ " markdown Text with R statements " Language: markdown with R code chunks -" Last Change: Wednesday, 2012-07-11 +" Last Change: Wed Jul 11, 2012 07:53AM " for portability if version < 600 @@ -11,7 +11,9 @@ endif " load all of pandoc info runtime syntax/pandoc.vim -unlet b:current_syntax +if exists("b:current_syntax") + unlet b:current_syntax +endif syntax match rmdPattern "^```\_s" contained hi def link rmdPattern Keyword From a4eda0520a700fcb976a7c0f2900d85a656b3a7a Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Wed, 11 Jul 2012 12:24:20 -0300 Subject: [PATCH 0278/1050] Some improvements. --- syntax/rmd.vim | 58 +++++++++++++++++++++++++++++++++++++------------- 1 file changed, 43 insertions(+), 15 deletions(-) diff --git a/syntax/rmd.vim b/syntax/rmd.vim index 4ac5906..5a91937 100644 --- a/syntax/rmd.vim +++ b/syntax/rmd.vim @@ -1,6 +1,6 @@ " markdown Text with R statements " Language: markdown with R code chunks -" Last Change: Wed Jul 11, 2012 07:53AM +" Last Change: Wed Jul 11, 2012 12:16PM " for portability if version < 600 @@ -12,26 +12,54 @@ endif " load all of pandoc info runtime syntax/pandoc.vim if exists("b:current_syntax") + let rmdIsPandoc = 1 unlet b:current_syntax +else + let rmdIsPandoc = 0 + runtime syntax/markdown.vim + if exists("b:current_syntax") + unlet b:current_syntax + endif endif -syntax match rmdPattern "^```\_s" contained -hi def link rmdPattern Keyword -syntax match rmdrEndblock "^```[ ]*$" contained -hi def link rmdrEndblock Keyword -syntax match rmdrBlockname "^```[ ]*{r *}" contained -hi def link rmdrBlockname Special - " load all of the r syntax highlighting rules into @R syntax include @R syntax/r.vim -syntax region rmdr start="^```[ ]*{r .*}$" end="^```$" contains=@R, rmdrBlockname, rmdrEndblock, rmdPattern keepend transparent fold +if exists("b:current_syntax") + unlet b:current_syntax +endif +syntax match rmdChunkDelim "^```{r" contained +syntax match rmdChunkDelim "}$" contained +syntax match rmdChunkDelim "^```$" contained +syntax region rmdChunk start="^``` *{r.*}$" end="^```$" contains=@R,rmdChunkDelim keepend transparent fold -" TODO: Code below doesn't work " also match and syntax highlight in-line R code -syntax match rmdrInlineStart "`r " -hi def link rmdrInlineStart Keyword -syntax match rmdrInlineAccent "`" contained -hi def link rmdrInlineAccent String -syntax region rmdrInline start="`r[ ]" end="`" contains=@R, rmdrInlineStart, rmdrInlineAccent keepend +syntax match rmdEndInline "`" contained +syntax match rmdBeginInline "`r " contained +syntax region rmdrInline start="`r " end="`" contains=@R,rmdBeginInline,rmdEndInline keepend transparent + + +if rmdIsPandoc == 0 + " LaTeX + syntax include @LaTeX syntax/tex.vim + if exists("b:current_syntax") + unlet b:current_syntax + endif + " Inline + syntax match rmdLaTeXInlDelim "\$" + syntax match rmdLaTeXInlDelim "\\\$" + syn region texMathZoneX matchgroup=Delimiter start="\$" skip="\\\\\|\\\$" matchgroup=Delimiter end="\$" end="%stopzone\>" contains=@texMathZoneGroup + " Region + syntax match rmdLaTeXRegDelim "\$\$" contained + syntax match rmdLaTeXRegDelim "\$\$latex$" contained + syntax region rmdLaTeXRegion start="^\$\$" skip="\\\$" end="^\$\$" contains=@LaTeX,rmdLaTeXSt,rmdLaTeXRegDelim keepend + hi def link rmdLaTeXSt Statement + hi def link rmdLaTeXInlDelim Special + hi def link rmdLaTeXRegDelim Special +endif + +hi def link rmdChunkDelim Special +hi def link rmdrBlockname Special +hi def link rmdBeginInline Special +hi def link rmdEndInline Special let b:current_syntax = "rmd" From 588c0f870739641ecc51ee7960c6435fa4289b33 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Wed, 11 Jul 2012 13:59:52 -0300 Subject: [PATCH 0279/1050] Do not highlight ` if file type is rmd or rrst. --- syntax/r.vim | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/syntax/r.vim b/syntax/r.vim index afbd96c..7922563 100644 --- a/syntax/r.vim +++ b/syntax/r.vim @@ -3,7 +3,7 @@ " Maintainer: Jakson Aquino " Former Maintainers: Vaidotas Zemlys " Tom Payne -" Last Change: Wed Jul 11, 2012 07:31AM +" Last Change: Wed Jul 11, 2012 01:28PM " Filenames: *.R *.r *.Rhistory *.Rt " " NOTE: The highlighting of R functions is defined in the @@ -113,7 +113,7 @@ syn match rOperator '-' syn match rOperator '*' syn match rOperator '+' syn match rOperator '=' -if &filetype == "rmd" +if &filetype != "rmd" && &filetype != "rrst" syn match rOperator "[|!<>^~/:]" else syn match rOperator "[|!<>^~`/:]" @@ -171,7 +171,7 @@ endif syn keyword rType array category character complex double function integer list logical matrix numeric vector data.frame " Name of object with spaces -if &filetype != "rmd" +if &filetype != "rmd" && &filetype != "rrst" syn region rNameWSpace start="`" end="`" endif From 1dc9f1cd173026fdb6cce904a673971b9fba8823 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Wed, 11 Jul 2012 14:01:25 -0300 Subject: [PATCH 0280/1050] Make the syntax highlight more similar to rnoweb. --- syntax/rrst.vim | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/syntax/rrst.vim b/syntax/rrst.vim index 4886cba..de479dc 100644 --- a/syntax/rrst.vim +++ b/syntax/rrst.vim @@ -1,7 +1,7 @@ " reStructured Text with R statements " Language: reST with R code chunks " Maintainer: Alex Zvoleff, azvoleff@mail.sdsu.edu -" Last Change: 2012 Jun 12 +" Last Change: Wed Jul 11, 2012 01:46PM " for portability if version < 600 @@ -14,24 +14,21 @@ endif runtime syntax/rst.vim unlet b:current_syntax -" highlight the ".." symbols used in R rst files -syntax match rstrTwodots "^\.\.\_s" contained -hi def link rstrTwodots rstDirective -syntax match rstrEndblock "^\.\. \.\.$" contained -hi def link rstrEndblock rstDirective -"TODO: fix the next line - the \zs isn't working -syntax match rstrBlockname "^\.\. {r \zs[a-zA-Z0-9_-]*" contained -hi def link rstrBlockname Special - " load all of the r syntax highlighting rules into @R syntax include @R syntax/r.vim -syntax region rstr start="^\.\. {r .*}$" end="^\.\. \.\.$" contains=@R, rstrBlockname, rstrEndblock, rstrTwodots keepend transparent fold -" also match and syntax highlight in-line R code -syntax match rstrInlineStart ":r:" -hi def link rstrInlineStart rstDirective -syntax match rstrInlineAccent "`" contained -hi def link rstrInlineAccent String -syntax region rstrInline start=":r:[ ]*`" skip=/\\\\\|\\`/ end="`" contains=@R, rstrInlineStart, rstrInlineAccent keepend +" highlight R chunks +syntax match rrstChunkDelim "^\.\. {r" contained +syntax match rrstChunkDelim "}$" contained +syntax match rrstChunkDelim "^\.\. \.\.$" contained +syntax region rrstChunk start="^\.\. {r.*}$" end="^\.\. \.\.$" contains=@R,rrstChunkDelim keepend transparent fold + +" also highlight in-line R code +syntax match rrstInlineDelim "`" contained +syntax match rrstInlineDelim ":r:" contained +syntax region rrstInline start=":r: *`" skip=/\\\\\|\\`/ end="`" contains=@R,rrstInlineDelim keepend + +hi def link rrstChunkDelim Special +hi def link rrstInlineDelim Special let b:current_syntax = "rrst" From 118ee1265d8a6cca78db44985aca75ebee99fe5d Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Wed, 11 Jul 2012 17:08:37 -0300 Subject: [PATCH 0281/1050] Autocompletion of knitr chunk options. --- doc/r-plugin.txt | 6 +++++- r-plugin/common_global.vim | 29 +++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 2c53af6..b634c82 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -472,7 +472,9 @@ When completing object names (CTRL-X CTRL-O) and function arguments (CTRL-X CTRL-A) you have to press CTRL-N to go foward in the list and CTRL-P to go backward (see |popupmenu-completion|). Note: if using Vim in a terminal emulator, Tmux will capture the CTRL-A command. You have to do CTRL-A twice to -pass a single CTRL-A to Vim. +pass a single CTRL-A to Vim. For rnoweb, rmd and rrst file types, CTRL-X +CTRL-A can also be used to complete knitr chunk options if the cursor is +inside the chunk header. If R is not running or if it is running but is busy the completion will be based on information saved with the command |:RUpdateObjList|. Otherwise, the @@ -1929,6 +1931,8 @@ the R syntax highlighted. Zvoleff for reporting the bug and writing the patch). * Alex Zvoleff added support to Rrst file type. * michelk added support to rmd file type. + * For rnoweb, rmd and rrst file types, CTRL-X CTRL-A completes knitr chunk + options if the cursor is inside the chunk header. 0.9.7 (2012-05-04) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 69d65d4..5671d56 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -104,6 +104,30 @@ function ReplaceUnderS() endif endfunction +function! CompleteChunkOptions(base) + let rr = [] + if strlen(a:base) == 0 + return rr + endif + let newbase = '^' . substitute(a:base, "\\$$", "", "") + let ktopt = ["aniopts=;'controls.loop'", "autodep=;FALSE", "background=;'#F7F7F7'", "cache.path=;'cache/'", + \ "cache=;FALSE", "child=; ", "comment=;'##'", "dependson=;NULL", "dev.args=; ", "dev=; ", "dpi=;100", + \ "dpi=;72", "engine=; ", "error=;TRUE", "eval=;TRUE", "external=;TRUE", "fig.align=; ", + \ "fig.caption=; ", "fig.ext=; ", "fig.height=;7", "fig.keep=;'high|none|all|first|last'", + \ "fig.lp=;'fig:'", "fig.path=; ", "fig.pos=; ", "fig.scap=; ", "fig.show=;'asis|hold|animate'", + \ "fig.width=;7", "highlight=;TRUE", "include=;TRUE", "interval=;1", "out.extra=; ", "out.height=; ", + \ "out.width=; ", "prompt=;FALSE", "ref.label=; ", "resize.height=; ", "resize.width=; ", + \ "results=;'markup|asis|hide'", "sanitize=;FALSE", "size=;'normalsize'", "split=;FALSE", "tidy=;TRUE", "warning=;TRUE"] + for kopt in ktopt + if kopt =~ newbase + let tmp1 = split(kopt, ";") + let tmp2 = {'word': tmp1[0], 'menu': tmp1[1]} + call add(rr, tmp2) + endif + endfor + return rr +endfunction + function RCompleteArgs() let lnum = line(".") let line = getline(".") @@ -118,6 +142,11 @@ function RCompleteArgs() let argkey = RGetKeyWord() let idx2 = cpos[2] - strlen(argkey) endif + if (&filetype == "rnoweb" && line =~ "^<<.*>>=$") || (&filetype == "rmd" && line =~ "^``` *{r.*}$") || (&filetype == "rrst" && line =~ "^.. {r.*}$") + call cursor(cpos[1], cpos[2]) + call complete(idx2, CompleteChunkOptions(argkey)) + return '' + endif if b:needsnewomnilist == 1 call BuildROmniList("GlobalEnv", "none") endif From cf8402db97e6bb97d9bb0b3e74fa21171121e0ed Mon Sep 17 00:00:00 2001 From: Michel Kuhlmann Date: Fri, 13 Jul 2012 09:11:10 +0200 Subject: [PATCH 0282/1050] rmd: Added support for pdf --- doc/r-plugin.txt | 7 +++++++ ftplugin/rmd.vim | 11 ++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index b634c82..504099a 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -394,6 +394,7 @@ Command -------------------------------------------------------- . Knit (cur file) \kn . Knit and PDF (cur file) \kp + . Knit and Beamer PDF (cur file) (Only Rmd) \ks . Knit and PDF (cur file, verbose) (Windows) \kv . Knit, BibTeX and PDF (cur file) (Linux/Unix) \kb -------------------------------------------------------- @@ -1832,6 +1833,12 @@ you want to use kr in Normal mode for this, put in your |vimrc|: > nmap kr :call SendCmdToR('rm(list=ls(all.names=TRUE)); unlink("cache/*")') < +When generating pdfs out of Rmd-files, you can send options to pandoc. State +them in your vimrc. For example + + let vimrplugin_pandoc_args = "--toc -V lang=german" + +will produce a german document with a table of contents. 9.21. Integration with the Conque Shell plugin~ *r-plugin-conque* diff --git a/ftplugin/rmd.vim b/ftplugin/rmd.vim index e570c7f..aad5994 100644 --- a/ftplugin/rmd.vim +++ b/ftplugin/rmd.vim @@ -95,11 +95,11 @@ function! RmdNextChunk() range return endfunction -function! RMakePDF() +function! RMakePDF(t) update call RSetWD() let pdfcmd = "vim.interlace.rmd('" . expand("%:t") . "'" - let pdfcmd = "require(knitr);" . pdfcmd + let pdfcmd = "require(knitr);" . pdfcmd . ", pdfout = '" . a:t . "'" if exists("g:vimrplugin_rmdcompiler") let pdfcmd = pdfcmd . ", compiler='" . g:vimrplugin_rmdcompiler . "'" endif @@ -109,8 +109,8 @@ function! RMakePDF() if exists("g:vimrplugin_rmd2pdfpath") pdfcmd = pdfcmd . ", rmd2pdfpath='" . g:vimrplugin_rmd2pdf_path . "'" endif - if exists("g:vimrplugin_rmd2pdfargs") - let pdfcmd = pdfcmd . ", " . g:vimrplugin_rmd2pdfargs + if exists("g:vimrplugin_pandoc_args") + let pdfcmd = pdfcmd . ", pandoc_args = '" . g:vimrplugin_pandoc_args . "'" endif let pdfcmd = pdfcmd . ")" let b:needsnewomnilist = 1 @@ -157,7 +157,8 @@ call RCreateMaps("nvi", 'RSetwd', 'rd', ':call RSetWD()') " Only .Rmd files use these functions: call RCreateMaps("nvi", 'RKnit', 'kn', ':call RKnit()') -call RCreateMaps("nvi", 'RMakePDFK', 'kp', ':call RMakePDF()') +call RCreateMaps("nvi", 'RMakePDFK', 'kp', ':call RMakePDF("latex")') +call RCreateMaps("nvi", 'RMakePDFK', 'ks', ':call RMakePDF("beamer")') call RCreateMaps("nvi", 'RIndent', 'si', ':call RmdToggleIndentSty()') call RCreateMaps("ni", 'RSendChunk', 'cc', ':call SendChunkToR("silent", "stay")') call RCreateMaps("ni", 'RESendChunk', 'ce', ':call SendChunkToR("echo", "stay")') From 5da8dc1380d39c59409bae9ef0b50ee2cdd1efac Mon Sep 17 00:00:00 2001 From: Michel Kuhlmann Date: Tue, 17 Jul 2012 08:43:54 +0200 Subject: [PATCH 0283/1050] set knitr::spin to ks for r-filetype --- doc/r-plugin.txt | 1 + ftplugin/r.vim | 11 +++++++++++ ftplugin/rmd.vim | 2 +- syntax/r.vim | 1 + 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 504099a..2631ad3 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -393,6 +393,7 @@ Command . Sweave, BibTeX and PDF (cur file) (Linux/Unix) \sb -------------------------------------------------------- . Knit (cur file) \kn + . Spin (cur file) \ks . Knit and PDF (cur file) \kp . Knit and Beamer PDF (cur file) (Only Rmd) \ks . Knit and PDF (cur file, verbose) (Windows) \kv diff --git a/ftplugin/r.vim b/ftplugin/r.vim index d9a07f2..0ef788f 100644 --- a/ftplugin/r.vim +++ b/ftplugin/r.vim @@ -83,6 +83,13 @@ function! ShowRout() endif endfunction +" Sweave the current buffer content +function! RSpin() + update + let b:needsnewomnilist = 1 + call RSetWD() + call SendCmdToR('require(knitr); spin("' . expand("%:t") . '")') +endfunction "========================================================================== " Key bindings and menu items @@ -95,6 +102,10 @@ call RCreateMaps("ni", 'RSendFile', 'aa', ':call SendFileToR("silent") call RCreateMaps("ni", 'RESendFile', 'ae', ':call SendFileToR("echo")') call RCreateMaps("ni", 'RShowRout', 'ao', ':call ShowRout()') +" Knitr::spin +" ------------------------------------- +call RCreateMaps("ni", 'RSpinFile', 'ks', ':call RSpin()') + call RCreateSendMaps() call RControlMaps() call RCreateMaps("nvi", 'RSetwd', 'rd', ':call RSetWD()') diff --git a/ftplugin/rmd.vim b/ftplugin/rmd.vim index aad5994..1bf08a3 100644 --- a/ftplugin/rmd.vim +++ b/ftplugin/rmd.vim @@ -158,7 +158,7 @@ call RCreateMaps("nvi", 'RSetwd', 'rd', ':call RSetWD()') " Only .Rmd files use these functions: call RCreateMaps("nvi", 'RKnit', 'kn', ':call RKnit()') call RCreateMaps("nvi", 'RMakePDFK', 'kp', ':call RMakePDF("latex")') -call RCreateMaps("nvi", 'RMakePDFK', 'ks', ':call RMakePDF("beamer")') +call RCreateMaps("nvi", 'RMakePDFK', 'kl', ':call RMakePDF("beamer")') call RCreateMaps("nvi", 'RIndent', 'si', ':call RmdToggleIndentSty()') call RCreateMaps("ni", 'RSendChunk', 'cc', ':call SendChunkToR("silent", "stay")') call RCreateMaps("ni", 'RESendChunk', 'ce', ':call SendChunkToR("echo", "stay")') diff --git a/syntax/r.vim b/syntax/r.vim index 7922563..8ff2240 100644 --- a/syntax/r.vim +++ b/syntax/r.vim @@ -40,6 +40,7 @@ syn match rOKeyword contained "@\(format\|importClassesFrom\|importFrom\|importM syn match rOKeyword contained "@\(method\|nord\|note\|references\|seealso\|setClass\|slot\|source\|title\|usage\)" syn match rOComment contains=@Spell,rOKeyword "#'.*" + if &filetype == "rhelp" " string enclosed in double quotes syn region rString contains=rSpecial,@Spell start=/"/ skip=/\\\\\|\\"/ end=/"/ From 484bb86d2caf24612cba46c73bec32f3a92dadcf Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Tue, 17 Jul 2012 08:33:29 -0300 Subject: [PATCH 0284/1050] Complete knitr options if line begins with #+. --- r-plugin/common_global.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 5671d56..c195e8b 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -142,7 +142,7 @@ function RCompleteArgs() let argkey = RGetKeyWord() let idx2 = cpos[2] - strlen(argkey) endif - if (&filetype == "rnoweb" && line =~ "^<<.*>>=$") || (&filetype == "rmd" && line =~ "^``` *{r.*}$") || (&filetype == "rrst" && line =~ "^.. {r.*}$") + if (&filetype == "rnoweb" && line =~ "^<<.*>>=$") || (&filetype == "rmd" && line =~ "^``` *{r.*}$") || (&filetype == "rrst" && line =~ "^.. {r.*}$") || (&filetype == "r" && line =~ "^#\+") call cursor(cpos[1], cpos[2]) call complete(idx2, CompleteChunkOptions(argkey)) return '' From 5368be4e026d540cf28fa2c3220c6fb46db6e24b Mon Sep 17 00:00:00 2001 From: genrich <9enrich@gmail.com> Date: Wed, 25 Jul 2012 15:13:24 +0300 Subject: [PATCH 0285/1050] RmdIsInRCode fix I was not able to send line to R (\l) from Rmd. Looks like the problem is in RmdIsInRCode. Please consider the following fix. Thanks. --- ftplugin/rmd.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ftplugin/rmd.vim b/ftplugin/rmd.vim index 1bf08a3..60cb979 100644 --- a/ftplugin/rmd.vim +++ b/ftplugin/rmd.vim @@ -48,9 +48,9 @@ function! RmdIsInRCode() let curline = line(".") let chunkline = search("^```[ ]*{r", "bncW") call cursor(chunkline) - let docline = search("^```", "bncW") + let docline = search("^```$", "ncW") call cursor(curline) - if chunkline > docline + if 0 < chunkline && chunkline < curline && curline < docline return 1 else return 0 From 38303555a42a361dd0b0d8257e32b1ac0e9109b2 Mon Sep 17 00:00:00 2001 From: "Charles R. Hogg III" Date: Thu, 2 Aug 2012 10:04:55 -0400 Subject: [PATCH 0286/1050] Add option to disable insert-mode commands Insert-mode commands can be extremely annoying when writing R documentation and/or Sweave files. Example: when I'm in insert mode, I can't type '\dQuote'; the cursor jumps as soon as I type '\d'. Solution: add the g:vimrplugin_insert_mode_cmds option, which defaults to 1 (compatibility with earlier versions) and can be set to 0 to disable insert mode commands. --- doc/r-plugin.txt | 16 +++++++++++++++- r-plugin/common_global.vim | 3 ++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 2631ad3..1f31eeb 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -895,6 +895,7 @@ IPv6 one (fe80::1). |vimrplugin_ca_ck| Add ^A^K to the beginning of commands. |vimrplugin_openpdf| Open PDF after processing rnoweb file. |vimrplugin_openpdf_quietly| Open PDF quietly. +|vimrplugin_insert_mode_cmds| Allow R commands in insert mode. 6.1. Terminal emulator (Linux/Unix only)~ @@ -1324,11 +1325,24 @@ will affect both Vim and R. On Linux/Unix, when vimrplugin_openpdf = 1, the application used to open the pdf may be quite verbose, printing many lines of useless diagnostic messages -in the R Console. Put the following in you |vimrc| to inhibit these messages +in the R Console. Put the following in your |vimrc| to inhibit these messages (and all useful error messages): > let vimrplugin_openpdf_quietly = 1 < +6.24. Allow R commands in insert mode~ + *Vimrplugin_insert_mode_cmds* +Vim-R commands are designed to work in insert mode as well as normal mode. +However, depending on your , this can make it very difficult to +write R packages or Sweave files. For example, if is set to the +'\' character, typing '\dQuote' in a .Rd file tries to send the command! + +The option vimrplugin_insert_mode_cmds disables commands in insert mode. To +use it, add the following in your |vimrc|: +> + let g:vimrplugin_insert_mode_cmds = 0 +< +The default value is 1, for consistency with earlier versions. ============================================================================== *r-plugin-key-bindings* diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index c195e8b..c612dc4 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -2312,7 +2312,7 @@ function RCreateMaps(type, plug, combo, target) exec 'vnoremap ' . a:combo . ' ' . tg endif endif - if a:type =~ "i" + if g:vimrplugin_insert_mode_cmds == 1 && a:type =~ "i" if hasmapto(a:plug, "i") exec 'inoremap ' . a:plug . ' ' . tg . il else @@ -2830,6 +2830,7 @@ call RSetDefaultValue("g:vimrplugin_never_unmake_menu", 0) call RSetDefaultValue("g:vimrplugin_vimpager", "'tab'") call RSetDefaultValue("g:vimrplugin_latexcmd", "'pdflatex'") call RSetDefaultValue("g:vimrplugin_objbr_place", "'script,right'") +call RSetDefaultValue("g:vimrplugin_insert_mode_cmds", 1) " Look for invalid options let objbrplace = split(g:vimrplugin_objbr_place, ",") From 4d4803a17c6d7ed34d3826913ba0e4f284daefd3 Mon Sep 17 00:00:00 2001 From: Jakson Date: Thu, 2 Aug 2012 12:01:10 -0300 Subject: [PATCH 0287/1050] Fix terminal application name on Mac OS X. --- doc/r-plugin.txt | 1 + r-plugin/common_global.vim | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 2631ad3..23fad3c 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -916,6 +916,7 @@ If Vim does not select your favorite terminal emulator, you may define it in your |vimrc| by setting the variable vimrplugin_term, as shown below: > let vimrplugin_term = "xterm" + let vimrplugin_term = "/Applications/Utilities/Terminal.app/Contents/MacOS/Terminal" < *vimrplugin_term_cmd* If your terminal emulator is not listed above, or if you are not satisfied diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index c195e8b..05f9739 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -3145,7 +3145,7 @@ if has("win32") || has("win64") || vimrplugin_applescript else let s:terminals = ['gnome-terminal', 'konsole', 'xfce4-terminal', 'terminal', 'Eterm', 'rxvt', 'aterm', 'roxterm', 'terminator', 'xterm'] if has('mac') - let s:terminals = ['iTerm', 'Terminal.app'] + s:terminals + let s:terminals = ['iTerm', 'Terminal', 'Terminal.app'] + s:terminals endif if exists("g:vimrplugin_term") if !executable(g:vimrplugin_term) From c79807219470a92c3dec709d1aa726c9103688aa Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 11 Aug 2012 18:46:00 -0300 Subject: [PATCH 0288/1050] Update information about colorout package. --- doc/r-plugin.txt | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 6534494..f837181 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -143,9 +143,11 @@ following dependencies: The vimcom package creates a server on R to allow the communication with Vim, the colorout package colorizes the R output and the setwidth package adjusts the value of options("width") whenever the terminal is resized. - They can be installed from within R: + They can be installed from within R. The colorout package is available at + http://www.lepem.ufc.br/jaa/colorout.html while setwidth and vimcom can be + installed as usual: > - install.packages(c("vimcom", "colorout", "setwidth")) + install.packages(c("vimcom", "setwidth")) < You certainly will want to put something like the following at the end of your ~/.Rprofile: @@ -395,7 +397,7 @@ Command . Knit (cur file) \kn . Spin (cur file) \ks . Knit and PDF (cur file) \kp - . Knit and Beamer PDF (cur file) (Only Rmd) \ks + . Knit and Beamer PDF (cur file) (Only Rmd) \kl . Knit and PDF (cur file, verbose) (Windows) \kv . Knit, BibTeX and PDF (cur file) (Linux/Unix) \kb -------------------------------------------------------- @@ -768,6 +770,12 @@ useful: *r-plugin-known-bugs* 5. Known bugs and workarounds~ +The bugs that are known to exist but that will not be fixed are listed in this +section. Some of them can not be fixed because they depend on either R or Vim +missing features; others would be very time consuming to fix without breaking +anything. + + 5.1. The Object Browser segfaults (Linux/Unix only)~ If the Vim instance running the Object Browser crashes you may want to close @@ -1464,6 +1472,8 @@ directory after the installation: ftplugin/rnoweb.vim ftplugin/r.vim ftplugin/rbrowser.vim + ftplugin/rmd.vim + ftplugin/rrst.vim indent/r.vim indent/rhelp.vim indent/rnoweb.vim From a8bddb3d4a06315b0f2db810403aa18de0b64115 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 11 Aug 2012 18:47:15 -0300 Subject: [PATCH 0289/1050] Add ftplugin/rmd.vim and ftplugin/rrst.vim. --- Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Makefile b/Makefile index 757da63..28aa121 100644 --- a/Makefile +++ b/Makefile @@ -120,6 +120,8 @@ deb: - ftplugin/rdoc.vim\n\ - ftplugin/rhelp.vim\n\ - ftplugin/rnoweb.vim\n\ + - ftplugin/rmd.vim\n\ + - ftplugin/rrst.vim\n\ - indent/r.vim\n\ - indent/rnoweb.vim\n\ - indent/rhelp.vim\n\ From 3e4e04259e356b5cdd7056feb4ffa012483c8f7b Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 30 Aug 2012 19:11:15 -0300 Subject: [PATCH 0290/1050] Recognize '@' as keyword character. --- r-plugin/common_global.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index f997c54..ccfa421 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -1186,7 +1186,7 @@ function RGetKeyWord() let i -= 1 endwhile let save_keyword = &iskeyword - setlocal iskeyword=@,48-57,_,.,$ + setlocal iskeyword=@,48-57,_,.,$,@-@ let rkeyword = expand("") exe "setlocal iskeyword=" . save_keyword call setpos(".", save_cursor) From f1d33fe9de7e9a19b431b50c9bae0f64aced5255 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Tue, 4 Sep 2012 19:01:54 -0300 Subject: [PATCH 0291/1050] Ensure that source() is from base package. --- r-plugin/common_global.vim | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index ccfa421..d166c01 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -1205,12 +1205,12 @@ function RSourceLines(lines, e) call writefile(lines, b:rsource) if a:e == "echo" if exists("g:vimrplugin_maxdeparse") - let rcmd = 'source("' . b:rsource . '", echo=TRUE, max.deparse=' . g:vimrplugin_maxdeparse . ')' + let rcmd = 'base::source("' . b:rsource . '", echo=TRUE, max.deparse=' . g:vimrplugin_maxdeparse . ')' else - let rcmd = 'source("' . b:rsource . '", echo=TRUE)' + let rcmd = 'base::source("' . b:rsource . '", echo=TRUE)' endif else - let rcmd = 'source("' . b:rsource . '")' + let rcmd = 'base::source("' . b:rsource . '")' endif let ok = SendCmdToR(rcmd) return ok @@ -2905,8 +2905,8 @@ endif if has("win32") || has("win64") call RSetDefaultValue("g:vimrplugin_conquesleep", 200) - let vimrplugin_screenplugin = 0 - let vimrplugin_tmux = 0 + let g:vimrplugin_screenplugin = 0 + let g:vimrplugin_tmux = 0 else call RSetDefaultValue("g:vimrplugin_conquesleep", 100) endif From 7889330240c49c4f187512847963c2f5baa164b1 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Tue, 4 Sep 2012 19:04:38 -0300 Subject: [PATCH 0292/1050] More information about vimcom package. --- doc/r-plugin.txt | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index f837181..c732f23 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -129,7 +129,7 @@ following dependencies: Screen plugin: http://www.vim.org/scripts/script.php?script_id=2711 vimcom >= 0.9-3: An R package. - Recommends:~ + Suggests:~ ncurses-term: http://invisible-island.net/ncurses colorout: An R package. setwidth: An R package. @@ -141,7 +141,14 @@ following dependencies: the scope of this documentation. The vimcom package creates a server on R to allow the communication with - Vim, the colorout package colorizes the R output and the setwidth package + Vim. The package is not used to send commands from Vim to R, but it is + necessary to open R documentation in Vim's buffer, run the Object Browser, + run either Sweave() or knit() on the document being edited. It also has + some functions called by Vim such as vim.plot(), vim.print(), and + vim.bol(). This last one is required to build the data base used in + omnicompletion. + + The colorout package colorizes the R output and the setwidth package adjusts the value of options("width") whenever the terminal is resized. They can be installed from within R. The colorout package is available at http://www.lepem.ufc.br/jaa/colorout.html while setwidth and vimcom can be From 426301a1e691cad00d594d073e030575995a6cda Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sun, 9 Sep 2012 15:11:18 -0300 Subject: [PATCH 0293/1050] New option: vimrplugin_only_in_tmux. --- doc/r-plugin.txt | 27 ++++++++++++++++++++++++++- r-plugin/common_global.vim | 8 ++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index c732f23..f2403f1 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -745,6 +745,9 @@ A sample detachable session could be: Tmux session: tmux attach +See |vimrplugin_only_in_tmux| if you always prefer starting Tmux before +starting Vim, but sometimes forget to start Tmux. + 4.9. GNU Screen usage~ *r-plugin-screen* @@ -1186,6 +1189,7 @@ If you want to use your own ~/.screenrc, put in your vimrc: *vimrplugin_screenplugin* *vimrplugin_screenvsplit* *vimrplugin_tmux* + *vimrplugin_only_in_tmux* The screen.vim plugin supports both GNU Screen and Tmux, but only Tmux allows you to split the terminal vertically (that is, to have the panels side by side). Also, the automatic updating of the Object Browser is enabled only when @@ -1218,6 +1222,15 @@ at the same time is especially useful for users who may prefer to use Vim and R in a terminal emulator, rather than using the graphical interface provided by GVim. +If you prefer to use the plugin in a terminal emulator in a Tmux session, you +may prefer to start Tmux before Vim (see |r-plugin-tmux|). In this case, you +may want to set the value of |vimrplugin_only_in_tmux| as below: +> + let vimrplugin_only_in_tmux = 1 +< +With the above option, the Vim-R-plugin will not start R if not running in a +Tmux session, and it will warn you about that. + If you have the screen.vim plugin installed but prefer do not integrate it with the Vim-R-plugin you will need to add the following to your |vimrc|: > @@ -1873,7 +1886,19 @@ them in your vimrc. For example will produce a german document with a table of contents. -9.21. Integration with the Conque Shell plugin~ +9.21. Start Tmux and Vim at once~ + +If you always prefer to run Tmux before running Vim you may want to put in +your ~/.bashrc: +> + function tvim(){ tmux new-session "vim $@" ; } +< +Then you will be able to start Vim inside a Tmux session by typing: +> + tvim filename.R +< + +9.22. Integration with the Conque Shell plugin~ *r-plugin-conque* In addition to being integrated with the screen.vim plugin the Vim-R-plugin can also use the Conque Shell plugin, but the Conque Shell still has some diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index d166c01..ad7a7ae 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -568,6 +568,13 @@ function StartR(whatr) endif if g:vimrplugin_screenplugin + if g:vimrplugin_only_in_tmux && g:vimrplugin_tmux + if $TMUX_PANE == "" + call RWarningMsg("Not inside Tmux.") + return + endif + endif + if $TERM =~ "screen" if g:vimrplugin_tmux call system("tmux set-environment VIMRPLUGIN_TMPDIR " . $VIMRPLUGIN_TMPDIR) @@ -2818,6 +2825,7 @@ call RSetDefaultValue("g:vimrplugin_specialplot", 0) call RSetDefaultValue("g:vimrplugin_nosingler", 0) call RSetDefaultValue("g:vimrplugin_noscreenrc", 0) call RSetDefaultValue("g:vimrplugin_notmuxconf", 0) +call RSetDefaultValue("g:vimrplugin_only_in_tmux", 0) call RSetDefaultValue("g:vimrplugin_routnotab", 0) call RSetDefaultValue("g:vimrplugin_editor_w", 66) call RSetDefaultValue("g:vimrplugin_help_w", 46) From 32e33ee16eb932c04b532d0932fec27ff27513a4 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Tue, 11 Sep 2012 16:57:45 -0300 Subject: [PATCH 0294/1050] Don't require knitr: vimcom already requires it. --- ftplugin/rmd.vim | 2 +- ftplugin/rnoweb.vim | 2 +- ftplugin/rrst.vim | 3 +-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/ftplugin/rmd.vim b/ftplugin/rmd.vim index 60cb979..3b23a2b 100644 --- a/ftplugin/rmd.vim +++ b/ftplugin/rmd.vim @@ -99,7 +99,7 @@ function! RMakePDF(t) update call RSetWD() let pdfcmd = "vim.interlace.rmd('" . expand("%:t") . "'" - let pdfcmd = "require(knitr);" . pdfcmd . ", pdfout = '" . a:t . "'" + let pdfcmd = pdfcmd . ", pdfout = '" . a:t . "'" if exists("g:vimrplugin_rmdcompiler") let pdfcmd = pdfcmd . ", compiler='" . g:vimrplugin_rmdcompiler . "'" endif diff --git a/ftplugin/rnoweb.vim b/ftplugin/rnoweb.vim index 1cca2a4..69206a9 100644 --- a/ftplugin/rnoweb.vim +++ b/ftplugin/rnoweb.vim @@ -114,7 +114,7 @@ function! RMakePDF(bibtex, knit) let pdfcmd = "vim.interlace.rnoweb('" . expand("%:t") . "'" if a:knit - let pdfcmd = "require(knitr); " . pdfcmd . ', knit = TRUE' + let pdfcmd = pdfcmd . ', knit = TRUE' endif if g:vimrplugin_latexcmd != "pdflatex" diff --git a/ftplugin/rrst.vim b/ftplugin/rrst.vim index 4f52847..d06be83 100644 --- a/ftplugin/rrst.vim +++ b/ftplugin/rrst.vim @@ -18,7 +18,7 @@ " Jose Claudio Faria " Alex Zvoleff " -" Last Change: July 2, 2012 2:30PM +" Last Change: Tue Sep 11, 2012 04:57PM "========================================================================== " Only do this when not yet done for this buffer @@ -97,7 +97,6 @@ function! RMakePDF() update call RSetWD() let pdfcmd = "vim.interlace.rrst('" . expand("%:t") . "'" - let pdfcmd = "require(knitr);" . pdfcmd if exists("g:vimrplugin_rrstcompiler") let pdfcmd = pdfcmd . ", compiler='" . g:vimrplugin_rrstcompiler . "'" endif From f89f136f72b485d97c308feb7b9b9ab041ff647b Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sun, 16 Sep 2012 07:08:30 -0300 Subject: [PATCH 0295/1050] Set filetype instead of just reading syntax/r.vim. --- r-plugin/common_global.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index ad7a7ae..e05e753 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -1747,7 +1747,7 @@ function RBuildSyntaxFile(what) call UpdateOB("libraries") else unlet b:current_syntax - runtime syntax/r.vim + exe "set filetype=" . &filetype endif endfunction From b12418698c39be2e16aa1a60416d1eb9cafbd3dc Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Mon, 17 Sep 2012 21:08:38 -0300 Subject: [PATCH 0296/1050] Do omnicompletion even if vimcom isn't installed. --- r-plugin/common_global.vim | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index e05e753..09d0f97 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -1677,6 +1677,11 @@ function BuildROmniList(env, what) call delete($VIMRPLUGIN_TMPDIR . "/vimbol_finished") if a:env =~ "GlobalEnv" exe "Py SendToR('" . omnilistcmd . "')" + if g:rplugin_vimcomport == 0 + sleep 500m + let b:needsnewomnilist = 1 + return + endif if g:rplugin_lastrpl == "R is busy." call RWarningMsg("R is busy.") let b:needsnewomnilist = 1 @@ -3237,6 +3242,7 @@ let g:rplugin_objbr_port = 0 let g:rplugin_myport = 0 let g:rplugin_editor_port = 0 let g:rplugin_vimcomport = 0 +let g:rplugin_lastrpl = "" let g:rplugin_ob_busy = 0 call SetRPath() From 9104cace66c62f0b2990e1162790a401740a4f61 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Wed, 19 Sep 2012 23:33:13 -0300 Subject: [PATCH 0297/1050] Update knitr chunk options. --- r-plugin/common_global.vim | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 09d0f97..9dab74e 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -110,14 +110,19 @@ function! CompleteChunkOptions(base) return rr endif let newbase = '^' . substitute(a:base, "\\$$", "", "") - let ktopt = ["aniopts=;'controls.loop'", "autodep=;FALSE", "background=;'#F7F7F7'", "cache.path=;'cache/'", - \ "cache=;FALSE", "child=; ", "comment=;'##'", "dependson=;NULL", "dev.args=; ", "dev=; ", "dpi=;100", - \ "dpi=;72", "engine=; ", "error=;TRUE", "eval=;TRUE", "external=;TRUE", "fig.align=; ", - \ "fig.caption=; ", "fig.ext=; ", "fig.height=;7", "fig.keep=;'high|none|all|first|last'", - \ "fig.lp=;'fig:'", "fig.path=; ", "fig.pos=; ", "fig.scap=; ", "fig.show=;'asis|hold|animate'", - \ "fig.width=;7", "highlight=;TRUE", "include=;TRUE", "interval=;1", "out.extra=; ", "out.height=; ", - \ "out.width=; ", "prompt=;FALSE", "ref.label=; ", "resize.height=; ", "resize.width=; ", - \ "results=;'markup|asis|hide'", "sanitize=;FALSE", "size=;'normalsize'", "split=;FALSE", "tidy=;TRUE", "warning=;TRUE"] + let ktopt = ["eval=;TRUE", "echo=;TRUE", "results=;'markup|asis|hide'", + \ "warning=;TRUE", "error=;TRUE", "message=;TRUE", "split=;FALSE", + \ "include=;TRUE", "tidy=;TRUE", "prompt=;FALSE", "comment=;'##'", + \ "highlight=;TRUE", "size=;'normalsize'", "background=;'#F7F7F7'", + \ "cache=;FALSE", "cache.path=;'cache/'", "dependson=;''", "autodep=;FALSE", + \ "fig.path=; ", "fig.keep=;'high|none|all|first|last'", + \ "fig.show=;'asis|hold|animate'", "dev=; ", "dev.args=; ", "fig.ext=; ", + \ "dpi=;72", "fig.width=;7", "fig.height=;7", "out.width=;'7in'", + \ "out.height='7in'", "out.extra=; ", "resize.width=; ", "resize.height=; ", + \ "fig.align=; ", "fig.env=;'figure'", "fig.cap=;''", "fig.scap=;''", + \ "fig.lp=;'fig:'", "fig.pos=;''", "external=;TRUE", "sanitize=;FALSE", + \ "interval=;1", "aniopts=;'controls.loop'", "ref.label=; ", "child=; ", + \ "engine=; ", "opts.label=''"] for kopt in ktopt if kopt =~ newbase let tmp1 = split(kopt, ";") From dcd219526c8bcb2eab7abc49b4b37e7a26ad35a4 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 22 Sep 2012 13:39:34 -0300 Subject: [PATCH 0298/1050] Improve support to Markdown file type. + Improve syntax highlight. + Improve indentation of list items. + Build and open html file. + Build odt file. + GVim menu items for html and odt. --- doc/r-plugin.txt | 11 +++++++ ftplugin/rmd.vim | 60 ++++++++++++++++++++++++++++++++------ r-plugin/common_global.vim | 44 +++++++++++++++++++--------- syntax/rmd.vim | 8 ++--- 4 files changed, 96 insertions(+), 27 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index f2403f1..dfd2c8c 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -913,6 +913,7 @@ IPv6 one (fe80::1). |vimrplugin_ca_ck| Add ^A^K to the beginning of commands. |vimrplugin_openpdf| Open PDF after processing rnoweb file. |vimrplugin_openpdf_quietly| Open PDF quietly. +|vimrplugin_openhtml| Open PDF quietly. |vimrplugin_insert_mode_cmds| Allow R commands in insert mode. @@ -1330,6 +1331,7 @@ either Tmux or GNU Screen in some systems. The Vim-R-plugin will add 6.23. Open PDF after processing rnoweb file~ *vimrplugin_openpdf* *vimrplugin_openpdf_quietly* + *vimrplugin_openhtml* The plugin will try to open automatically the pdf file generated by pdflatex, after either Sweave() or knit(), if you put in your |vimrc|: > @@ -1359,6 +1361,13 @@ in the R Console. Put the following in your |vimrc| to inhibit these messages > let vimrplugin_openpdf_quietly = 1 < +If editing an Rmd file, you can produce the html result with kh. +The html file will be automatically opened if you put the following in your +|vimrc|: +> + let vimrplugin_openhtml = 1 +< + 6.24. Allow R commands in insert mode~ *Vimrplugin_insert_mode_cmds* Vim-R commands are designed to work in insert mode as well as normal mode. @@ -1991,6 +2000,8 @@ the R syntax highlighted. vimrplugin_openpdf = 1 (thanks to Tomaz Ficko for suggesting the feature). Open it quietly if vimrplugin_openpdf_quietly = 1. Open it manually with \op. + * Open HTML automatically after processing rmd file if + vimrplugin_openhtml = 1. * Remove option vimrplugin_knitargs. * Start last R if there is more than one installed on Windows (thanks to Alex Zvoleff for reporting the bug and writing the patch). diff --git a/ftplugin/rmd.vim b/ftplugin/rmd.vim index 3b23a2b..19ae83a 100644 --- a/ftplugin/rmd.vim +++ b/ftplugin/rmd.vim @@ -21,13 +21,20 @@ "========================================================================== " Only do this when not yet done for this buffer -if exists("b:did_rmd_ftplugin") || exists("disable_r_ftplugin") +if exists("b:did_rmd_ftplugin") || exists("disable_r_ftplugin") || exists("b:did_ftplugin") finish endif " Don't load another plugin for this buffer let b:did_rmd_ftplugin = 1 +runtime! ftplugin/html.vim ftplugin/html_*.vim ftplugin/html/*.vim +unlet! b:did_ftplugin + +setlocal comments=fb:*,fb:-,fb:+,n:> commentstring=>\ %s +setlocal formatoptions+=tcqln +setlocal formatlistpat=^\\s*\\d\\+\\.\\s\\+\\\|^\\s*[-*+]\\s\\+ + let s:cpo_save = &cpo set cpo&vim @@ -63,7 +70,7 @@ function! RmdPreviousChunk() range for var in range(1, chunk) let curline = line(".") if RmdIsInRCode() - let i = search("^``` [ ]*{r", "bnW") + let i = search("^```[ ]*{r", "bnW") if i != 0 call cursor(i-1, 1) endif @@ -95,9 +102,37 @@ function! RmdNextChunk() range return endfunction -function! RMakePDF(t) +function! RMakeHTML(t) + call RSetWD() update + let rcmd = 'require(knitr); knit2html("' . expand("%:t") . '", options = "")' + if a:t == "odt" + if g:rplugin_has_soffice == 0 + if executable("soffice") + let g:rplugin_has_soffice = 1 + else + call RWarningMsg("Is Libre Office installed? Cannot convert into ODT: 'soffice' not found.") + endif + endif + let rcmd = rcmd . '; system("soffice --invisible --convert-to odt ' . expand("%:r:t") . '.html")' + endif + if g:vimrplugin_openhtml && a:t == "html" + let rcmd = rcmd . '; browseURL("' . expand("%:r:t") . '.html")' + endif + call SendCmdToR(rcmd) +endfunction + +function! RMakePDF(t) + if g:rplugin_has_pandoc == 0 + if executable("pandoc") + let g:rplugin_has_pandoc = 1 + else + call RWarningMsg("Cannot convert into PDF: 'pandoc' not found.") + return + endif + endif call RSetWD() + update let pdfcmd = "vim.interlace.rmd('" . expand("%:t") . "'" let pdfcmd = pdfcmd . ", pdfout = '" . a:t . "'" if exists("g:vimrplugin_rmdcompiler") @@ -113,11 +148,7 @@ function! RMakePDF(t) let pdfcmd = pdfcmd . ", pandoc_args = '" . g:vimrplugin_pandoc_args . "'" endif let pdfcmd = pdfcmd . ")" - let b:needsnewomnilist = 1 - let ok = SendCmdToR(pdfcmd) - if ok == 0 - return - endif + call SendCmdToR(pdfcmd) endfunction " Send Rmd chunk to R @@ -159,7 +190,8 @@ call RCreateMaps("nvi", 'RSetwd', 'rd', ':call RSetWD()') call RCreateMaps("nvi", 'RKnit', 'kn', ':call RKnit()') call RCreateMaps("nvi", 'RMakePDFK', 'kp', ':call RMakePDF("latex")') call RCreateMaps("nvi", 'RMakePDFK', 'kl', ':call RMakePDF("beamer")') -call RCreateMaps("nvi", 'RIndent', 'si', ':call RmdToggleIndentSty()') +call RCreateMaps("nvi", 'RMakeHTML', 'kh', ':call RMakeHTML("html")') +call RCreateMaps("nvi", 'RMakeODT', 'ko', ':call RMakeHTML("odt")') call RCreateMaps("ni", 'RSendChunk', 'cc', ':call SendChunkToR("silent", "stay")') call RCreateMaps("ni", 'RESendChunk', 'ce', ':call SendChunkToR("echo", "stay")') call RCreateMaps("ni", 'RDSendChunk', 'cd', ':call SendChunkToR("silent", "down")') @@ -172,5 +204,15 @@ if has("gui_running") call MakeRMenu() endif +let g:rplugin_has_pandoc = 0 +let g:rplugin_has_soffice = 0 + let &cpo = s:cpo_save unlet s:cpo_save + +if exists('b:undo_ftplugin') + let b:undo_ftplugin .= "|setl cms< com< fo< flp<" +else + let b:undo_ftplugin = "setl cms< com< fo< flp<" +endif + diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 9dab74e..8671ac9 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -119,7 +119,7 @@ function! CompleteChunkOptions(base) \ "fig.show=;'asis|hold|animate'", "dev=; ", "dev.args=; ", "fig.ext=; ", \ "dpi=;72", "fig.width=;7", "fig.height=;7", "out.width=;'7in'", \ "out.height='7in'", "out.extra=; ", "resize.width=; ", "resize.height=; ", - \ "fig.align=; ", "fig.env=;'figure'", "fig.cap=;''", "fig.scap=;''", + \ "fig.align=;'left|right|center'", "fig.env=;'figure'", "fig.cap=;''", "fig.scap=;''", \ "fig.lp=;'fig:'", "fig.pos=;''", "external=;TRUE", "sanitize=;FALSE", \ "interval=;1", "aniopts=;'controls.loop'", "ref.label=; ", "child=; ", \ "engine=; ", "opts.label=''"] @@ -462,6 +462,12 @@ function GoDown() call RnwNextChunk() return endif + elseif &filetype == "rmd" + let curline = getline(".") + if curline =~ '^```$' + call RmdNextChunk() + return + endif endif let i = line(".") + 1 @@ -1537,6 +1543,12 @@ function SendLineToR(godown) endif endif if &filetype == "rmd" + if line =~ "^```$" + if a:godown =~ "down" + call GoDown() + endif + return + endif let line = substitute(line, "^\\`\\`\\?", "", "") if RmdIsInRCode() == 0 call RWarningMsg("Not inside an R code chunk.") @@ -1583,7 +1595,7 @@ endfunction " Remove all objects function RClearAll() - let ok = SendCmdToR("rm(list=ls())") + call SendCmdToR("rm(list=ls())") sleep 500m call RClearConsole() endfunction @@ -1594,10 +1606,7 @@ function RSetWD() if has("win32") || has("win64") let wdcmd = substitute(wdcmd, "\\", "/", "g") endif - let ok = SendCmdToR(wdcmd) - if ok == 0 - return - endif + call SendCmdToR(wdcmd) endfunction " Quit R @@ -2424,14 +2433,16 @@ function MakeRMenu() call RCreateMenuItem("nvi", 'Command.Set\ working\ directory\ (cur\ file\ path)', 'RSetwd', 'rd', ':call RSetWD()') endif "------------------------------- - if &filetype == "rnoweb" || g:vimrplugin_never_unmake_menu - menu R.Command.-Sep5- - call RCreateMenuItem("nvi", 'Command.Sweave\ (cur\ file)', 'RSweave', 'sw', ':call RSweave(0)') - call RCreateMenuItem("nvi", 'Command.Sweave\ and\ PDF\ (cur\ file)', 'RMakePDF', 'sp', ':call RMakePDF("nobib", 0)') - if has("win32") || has("win64") - call RCreateMenuItem("nvi", 'Command.Sweave\ and\ PDF\ (cur\ file,\ verbose)', 'RMakePDF', 'sv', ':call RMakePDF("verbose", 0)') - else - call RCreateMenuItem("nvi", 'Command.Sweave,\ BibTeX\ and\ PDF\ (cur\ file)', 'RMakePDF', 'sb', ':call RMakePDF("bibtex", 0)') + if &filetype == "rnoweb" || &filetype == "rmd" || &filetype == "rrst" || g:vimrplugin_never_unmake_menu + if &filetype == "rnoweb" || g:vimrplugin_never_unmake_menu + menu R.Command.-Sep5- + call RCreateMenuItem("nvi", 'Command.Sweave\ (cur\ file)', 'RSweave', 'sw', ':call RSweave(0)') + call RCreateMenuItem("nvi", 'Command.Sweave\ and\ PDF\ (cur\ file)', 'RMakePDF', 'sp', ':call RMakePDF("nobib", 0)') + if has("win32") || has("win64") + call RCreateMenuItem("nvi", 'Command.Sweave\ and\ PDF\ (cur\ file,\ verbose)', 'RMakePDF', 'sv', ':call RMakePDF("verbose", 0)') + else + call RCreateMenuItem("nvi", 'Command.Sweave,\ BibTeX\ and\ PDF\ (cur\ file)', 'RMakePDF', 'sb', ':call RMakePDF("bibtex", 0)') + endif endif menu R.Command.-Sep6- call RCreateMenuItem("nvi", 'Command.Knit\ (cur\ file)', 'RSweave', 'kn', ':call RSweave(1)') @@ -2441,6 +2452,10 @@ function MakeRMenu() else call RCreateMenuItem("nvi", 'Command.Knit,\ BibTeX\ and\ PDF\ (cur\ file)', 'RMakePDF', 'kb', ':call RMakePDF("bibtex", 1)') endif + if &filetype == "rmd" || g:vimrplugin_never_unmake_menu + call RCreateMenuItem("nvi", 'Command.Knit\ and\ HTML\ (cur\ file)', 'RMakeHTML', 'kh', ':call RMakeHTML("html")') + call RCreateMenuItem("nvi", 'Command.Knit\ and\ ODT\ (cur\ file)', 'RMakeODT', 'ko', ':call RMakeHTML("odt")') + endif menu R.Command.-Sep61- call RCreateMenuItem("nvi", 'Command.Open\ PDF\ (cur\ file)', 'ROpenPDF', 'op', ':call ROpenPDF()') endif @@ -2826,6 +2841,7 @@ call RSetDefaultValue("g:vimrplugin_underscore", 1) call RSetDefaultValue("g:vimrplugin_rnowebchunk", 1) call RSetDefaultValue("g:vimrplugin_openpdf", 0) call RSetDefaultValue("g:vimrplugin_openpdf_quietly", 0) +call RSetDefaultValue("g:vimrplugin_openhtml", 0) call RSetDefaultValue("g:vimrplugin_i386", 0) call RSetDefaultValue("g:vimrplugin_screenvsplit", 0) call RSetDefaultValue("g:vimrplugin_conquevsplit", 0) diff --git a/syntax/rmd.vim b/syntax/rmd.vim index 5a91937..2f29261 100644 --- a/syntax/rmd.vim +++ b/syntax/rmd.vim @@ -1,6 +1,6 @@ " markdown Text with R statements " Language: markdown with R code chunks -" Last Change: Wed Jul 11, 2012 12:16PM +" Last Change: Sat Sep 22, 2012 01:28PM " for portability if version < 600 @@ -27,8 +27,7 @@ syntax include @R syntax/r.vim if exists("b:current_syntax") unlet b:current_syntax endif -syntax match rmdChunkDelim "^```{r" contained -syntax match rmdChunkDelim "}$" contained +syntax match rmdChunkDelim "^```{r .*}$" contained syntax match rmdChunkDelim "^```$" contained syntax region rmdChunk start="^``` *{r.*}$" end="^```$" contains=@R,rmdChunkDelim keepend transparent fold @@ -39,6 +38,7 @@ syntax region rmdrInline start="`r " end="`" contains=@R,rmdBeginInline,rmdEndI if rmdIsPandoc == 0 + syn match rmdBlockQuote /^\s*>.*\n\(.*\n\@ Date: Sat, 22 Sep 2012 14:49:33 -0300 Subject: [PATCH 0299/1050] Add "." to iskeyword. --- ftplugin/rmd.vim | 1 + 1 file changed, 1 insertion(+) diff --git a/ftplugin/rmd.vim b/ftplugin/rmd.vim index 19ae83a..68a58d9 100644 --- a/ftplugin/rmd.vim +++ b/ftplugin/rmd.vim @@ -34,6 +34,7 @@ unlet! b:did_ftplugin setlocal comments=fb:*,fb:-,fb:+,n:> commentstring=>\ %s setlocal formatoptions+=tcqln setlocal formatlistpat=^\\s*\\d\\+\\.\\s\\+\\\|^\\s*[-*+]\\s\\+ +setlocal iskeyword=@,48-57,_,. let s:cpo_save = &cpo set cpo&vim From b767c5cf218d77f2765638ab9c6c34a8b177fb62 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sun, 23 Sep 2012 09:56:22 -0300 Subject: [PATCH 0300/1050] New option: vimrplugin_rmhidden. --- doc/r-plugin.txt | 20 ++++++++++++++++++-- r-plugin/common_global.vim | 7 ++++++- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index dfd2c8c..16ec438 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -902,7 +902,6 @@ IPv6 one (fe80::1). |vimrplugin_screenvsplit| Split the window vertically (screen plugin) |vimrplugin_tmux| Choose between Tmux and GNU Screen |vimrplugin_applescript| Use osascript in Mac OS X. -|vimrplugin_allnames| Show names which begin with a dot |vimrplugin_listmethods| Do .vim.list.args() instead of args() |vimrplugin_specialplot| Do .vim.plot() instead of plot() |vimrplugin_maxdeparse| Argument to R args() function @@ -915,6 +914,8 @@ IPv6 one (fe80::1). |vimrplugin_openpdf_quietly| Open PDF quietly. |vimrplugin_openhtml| Open PDF quietly. |vimrplugin_insert_mode_cmds| Allow R commands in insert mode. +|vimrplugin_allnames| Show names which begin with a dot +|vimrplugin_rmhidden| Remove hidden objects from R workspace. 6.1. Terminal emulator (Linux/Unix only)~ @@ -1382,6 +1383,20 @@ use it, add the following in your |vimrc|: < The default value is 1, for consistency with earlier versions. +6.25. Show/remove hidden objects~ + *vimrplugin_allnames* + *vimrplugin_rmhidden* +Hidden objects are not included in the list of objects for omni completion. If +you prefer to include them, put in your |vimrc|: +> + let g:vimrplugin_allnames = 1 +< +Hidden objects are removed from R workspace when you do rm. If +you prefer to remove only visible objects, put in your |vimrc|: +> + let g:vimrplugin_rmhidden = 0 +< + ============================================================================== *r-plugin-key-bindings* 7. Custom key bindings~ @@ -1994,7 +2009,7 @@ the R syntax highlighted. *r-plugin-news* 10. News~ -0.9.8 (2012-07-11) +0.9.8 (2012-09-23) * Open PDF automatically after processing rnoweb file if vimrplugin_openpdf = 1 (thanks to Tomaz Ficko for suggesting the feature). @@ -2009,6 +2024,7 @@ the R syntax highlighted. * michelk added support to rmd file type. * For rnoweb, rmd and rrst file types, CTRL-X CTRL-A completes knitr chunk options if the cursor is inside the chunk header. + * New option: vimrplugin_rmhidden. 0.9.7 (2012-05-04) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 8671ac9..7735473 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -1595,7 +1595,11 @@ endfunction " Remove all objects function RClearAll() - call SendCmdToR("rm(list=ls())") + if g:vimrplugin_rmhidden + call SendCmdToR("rm(list=ls(all.names = TRUE))") + else + call SendCmdToR("rm(list=ls())") + endif sleep 500m call RClearConsole() endfunction @@ -2837,6 +2841,7 @@ let g:rplugin_globalenvfname = $VIMRPLUGIN_TMPDIR . "/GlobalEnvList" " Variables whose default value is fixed call RSetDefaultValue("g:vimrplugin_map_r", 0) call RSetDefaultValue("g:vimrplugin_allnames", 0) +call RSetDefaultValue("g:vimrplugin_rmhidden", 1) call RSetDefaultValue("g:vimrplugin_underscore", 1) call RSetDefaultValue("g:vimrplugin_rnowebchunk", 1) call RSetDefaultValue("g:vimrplugin_openpdf", 0) From f96f28bbbecafeb69c012fa83ad24d145934ef44 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sun, 23 Sep 2012 20:13:38 -0300 Subject: [PATCH 0301/1050] Avoid "No menu RSendFile" error. --- r-plugin/common_global.vim | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 7735473..f1b5ffb 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -2593,6 +2593,7 @@ function MakeRMenu() if &filetype == "r" || g:vimrplugin_never_unmake_menu nmenu ToolBar.RSendFile :call SendFileToR("echo") imenu ToolBar.RSendFile :call SendFileToR("echo") + let g:rplugin_hasRSFbutton = 1 endif nmenu ToolBar.RSendBlock :call SendMBlockToR("echo", "down") imenu ToolBar.RSendBlock :call SendMBlockToR("echo", "down") @@ -2643,8 +2644,9 @@ function UnMakeRMenu() aunmenu ToolBar.RSendParagraph aunmenu ToolBar.RSendFunction aunmenu ToolBar.RSendBlock - if g:rplugin_lastft == "r" + if g:rplugin_hasRSFbutton aunmenu ToolBar.RSendFile + let g:rplugin_hasRSFbutton = 0 endif aunmenu ToolBar.RClose aunmenu ToolBar.RStart @@ -3270,6 +3272,7 @@ let g:rplugin_editor_port = 0 let g:rplugin_vimcomport = 0 let g:rplugin_lastrpl = "" let g:rplugin_ob_busy = 0 +let g:rplugin_hasRSFbutton = 0 call SetRPath() From 61f026789bb791b838fcc6d06e0c6b3920852386 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sun, 23 Sep 2012 20:20:12 -0300 Subject: [PATCH 0302/1050] New indent scripts for rmd and rrst. --- doc/r-plugin.txt | 4 ++++ ftplugin/rrst.vim | 7 ++++++- indent/rmd.vim | 48 +++++++++++++++++++++++++++++++++++++++++++++++ indent/rrst.vim | 48 +++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 106 insertions(+), 1 deletion(-) create mode 100644 indent/rmd.vim create mode 100644 indent/rrst.vim diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 16ec438..9da0ba7 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -1521,6 +1521,8 @@ directory after the installation: indent/r.vim indent/rhelp.vim indent/rnoweb.vim + indent/rmd.vim + indent/rrst.vim r-plugin/common_buffer.vim r-plugin/common_global.vim r-plugin/functions.vim @@ -1533,6 +1535,8 @@ directory after the installation: syntax/rbrowser.vim syntax/rout.vim syntax/r.vim + syntax/rmd.vim + syntax/rrst.vim ============================================================================== diff --git a/ftplugin/rrst.vim b/ftplugin/rrst.vim index d06be83..bf1d206 100644 --- a/ftplugin/rrst.vim +++ b/ftplugin/rrst.vim @@ -18,7 +18,7 @@ " Jose Claudio Faria " Alex Zvoleff " -" Last Change: Tue Sep 11, 2012 04:57PM +" Last Change: Sun Sep 23, 2012 07:39PM "========================================================================== " Only do this when not yet done for this buffer @@ -38,6 +38,11 @@ if exists("g:rplugin_failed") finish endif +setlocal comments=fb:*,fb:-,fb:+,n:> commentstring=>\ %s +setlocal formatoptions+=tcqln +setlocal formatlistpat=^\\s*\\d\\+\\.\\s\\+\\\|^\\s*[-*+]\\s\\+ +setlocal iskeyword=@,48-57,_,. + " Some buffer variables common to R, Rrst, Rnoweb, Rhelp and Rdoc need to be " defined after the global ones: runtime r-plugin/common_buffer.vim diff --git a/indent/rmd.vim b/indent/rmd.vim new file mode 100644 index 0000000..307655e --- /dev/null +++ b/indent/rmd.vim @@ -0,0 +1,48 @@ +" Vim indent file +" Language: Rmd +" Author: Jakson Alves de Aquino +" URL: http://www.vim.org/scripts/script.php?script_id=2628 +" Last Change: Sun Sep 23, 2012 08:04PM + + +" Only load this indent file when no other was loaded. +if exists("b:did_rmd_indent") + finish +endif +let b:did_rmd_indent = 1 + + + +runtime indent/r.vim + +setlocal indentkeys=0{,0},:,!^F,o,O,e +setlocal indentexpr=GetRmdIndent() + +if exists("*GetRmdIndent") + finish +endif + +function GetMdIndent() + let pline = getline(v:lnum - 1) + let cline = getline(v:lnum) + if prevnonblank(v:lnum - 1) < v:lnum - 1 || cline =~ '^\s*[-\+\*]\s' || cline =~ '^\s*\d\+\.\s\+' + return indent(v:lnum) + elseif pline =~ '^\s*[-\+\*]\s' + return indent(v:lnum - 1) + 2 + elseif pline =~ '^\s*\d\+\.\s\+' + return indent(v:lnum - 1) + 3 + endif + return indent(prevnonblank(v:lnum - 1)) +endfunction + +function GetRmdIndent() + if getline(".") =~ '^```{r .*}$' + return 0 + endif + if search('^```{r', "bncW") > search('^```$', "bncW") + return GetRIndent() + else + return GetMdIndent() + endif +endfunction + diff --git a/indent/rrst.vim b/indent/rrst.vim new file mode 100644 index 0000000..5912a5f --- /dev/null +++ b/indent/rrst.vim @@ -0,0 +1,48 @@ +" Vim indent file +" Language: Rrst +" Author: Jakson Alves de Aquino +" URL: http://www.vim.org/scripts/script.php?script_id=2628 +" Last Change: Sun Sep 23, 2012 08:18PM + + +" Only load this indent file when no other was loaded. +if exists("b:did_rrst_indent") + finish +endif +let b:did_rrst_indent = 1 + + + +runtime indent/r.vim + +setlocal indentkeys=0{,0},:,!^F,o,O,e +setlocal indentexpr=GetRrstIndent() + +if exists("*GetRrstIndent") + finish +endif + +function GetRstIndent() + let pline = getline(v:lnum - 1) + let cline = getline(v:lnum) + if prevnonblank(v:lnum - 1) < v:lnum - 1 || cline =~ '^\s*[-\+\*]\s' || cline =~ '^\s*\d\+\.\s\+' + return indent(v:lnum) + elseif pline =~ '^\s*[-\+\*]\s' + return indent(v:lnum - 1) + 2 + elseif pline =~ '^\s*\d\+\.\s\+' + return indent(v:lnum - 1) + 3 + endif + return indent(prevnonblank(v:lnum - 1)) +endfunction + +function GetRrstIndent() + if getline(".") =~ '^\.\. {r .*}$' + return 0 + endif + if search('^\.\. {r', "bncW") > search('^\.\. \.\.$', "bncW") + return GetRIndent() + else + return GetRstIndent() + endif +endfunction + From d15c886fa54908c9423f6caefc430e067d94cc4d Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sun, 23 Sep 2012 20:39:29 -0300 Subject: [PATCH 0303/1050] Add syntax and indent scripts for rmd and rrst. --- Makefile | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 28aa121..2886be9 100644 --- a/Makefile +++ b/Makefile @@ -47,9 +47,10 @@ zip: sed -i -e "s/^Version: [0-9].[0-9].[0-9]/Version: $(PLUGINVERSION)/" doc/r-plugin.txt sed -i -e "s/^$(PLUGINVERSION) (201[0-9]-[0-9][0-9]-[0-9][0-9])$$/$(PLUGINVERSION) ($(PLUGINRELEASEDATE))/" doc/r-plugin.txt # Create a tar.gz file - tar -cvzf /tmp/vimrplugintmpfile.tar.gz ftdetect/r.vim indent/r.vim \ - indent/rnoweb.vim indent/rhelp.vim autoload/rcomplete.vim ftplugin/r*.vim \ - syntax/rout.vim syntax/r.vim syntax/rhelp.vim syntax/rdoc.vim syntax/rbrowser.vim \ + tar -cvzf /tmp/vimrplugintmpfile.tar.gz ftdetect/r.vim indent/r.vim indent/rmd.vim \ + indent/rrst.vim indent/rnoweb.vim indent/rhelp.vim autoload/rcomplete.vim ftplugin/r*.vim \ + syntax/rout.vim syntax/r.vim syntax/rhelp.vim syntax/rmd.vim \ + syntax/rrst.vim syntax/rdoc.vim syntax/rbrowser.vim \ doc/r-plugin.txt r-plugin/functions.vim r-plugin/vimcom.py \ r-plugin/global_r_plugin.vim r-plugin/omnils r-plugin/windows.py \ r-plugin/vimActivate.js r-plugin/tex_indent.vim r-plugin/r.snippets \ @@ -125,6 +126,8 @@ deb: - indent/r.vim\n\ - indent/rnoweb.vim\n\ - indent/rhelp.vim\n\ + - indent/rmd.vim\n\ + - indent/rrst.vim\n\ - r-plugin/common_buffer.vim\n\ - r-plugin/common_global.vim\n\ - r-plugin/vimcom.py\n\ @@ -133,6 +136,8 @@ deb: - syntax/r.vim\n\ - syntax/rdoc.vim\n\ - syntax/rout.vim\n\ + - syntax/rmd.vim\n\ + - syntax/rrst.vim\n\ - syntax/rhelp.vim\n\ - syntax/rbrowser.vim\n\ " > /tmp/vim-r-plugin-tmp/usr/share/vim/registry/vim-r-plugin.yaml From d6ac319d650da7821d00320b7044f475abfa3fd4 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Mon, 24 Sep 2012 09:32:52 -0300 Subject: [PATCH 0304/1050] Don't highlight chunk header as R code. --- syntax/rrst.vim | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/syntax/rrst.vim b/syntax/rrst.vim index de479dc..21d6c6e 100644 --- a/syntax/rrst.vim +++ b/syntax/rrst.vim @@ -1,7 +1,7 @@ " reStructured Text with R statements " Language: reST with R code chunks " Maintainer: Alex Zvoleff, azvoleff@mail.sdsu.edu -" Last Change: Wed Jul 11, 2012 01:46PM +" Last Change: Mon Sep 24, 2012 09:05AM " for portability if version < 600 @@ -18,8 +18,7 @@ unlet b:current_syntax syntax include @R syntax/r.vim " highlight R chunks -syntax match rrstChunkDelim "^\.\. {r" contained -syntax match rrstChunkDelim "}$" contained +syntax match rrstChunkDelim "^\.\. {r .*}$" contained syntax match rrstChunkDelim "^\.\. \.\.$" contained syntax region rrstChunk start="^\.\. {r.*}$" end="^\.\. \.\.$" contains=@R,rrstChunkDelim keepend transparent fold From 1a7c4551c0ece76d742b0d83460a3cd2a09f1c77 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Mon, 24 Sep 2012 09:34:31 -0300 Subject: [PATCH 0305/1050] Generate HTML and ODT from Rrst. --- doc/r-plugin.txt | 13 +++++++-- ftplugin/rrst.vim | 67 ++++++++++++++++++++++++++++++++++++----------- 2 files changed, 62 insertions(+), 18 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 9da0ba7..5b75c1a 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -913,6 +913,7 @@ IPv6 one (fe80::1). |vimrplugin_openpdf| Open PDF after processing rnoweb file. |vimrplugin_openpdf_quietly| Open PDF quietly. |vimrplugin_openhtml| Open PDF quietly. +|vimrplugin_strict_rst| Code style for generated rst files. |vimrplugin_insert_mode_cmds| Allow R commands in insert mode. |vimrplugin_allnames| Show names which begin with a dot |vimrplugin_rmhidden| Remove hidden objects from R workspace. @@ -1333,6 +1334,7 @@ either Tmux or GNU Screen in some systems. The Vim-R-plugin will add *vimrplugin_openpdf* *vimrplugin_openpdf_quietly* *vimrplugin_openhtml* + *vimrplugin_strict_rst* The plugin will try to open automatically the pdf file generated by pdflatex, after either Sweave() or knit(), if you put in your |vimrc|: > @@ -1368,6 +1370,12 @@ The html file will be automatically opened if you put the following in your > let vimrplugin_openhtml = 1 < +By default, the Vim-R-plugin sends the command render_rst(strict=TRUE) to R +before using R's knit() function to convert an Rrst file into an rst one. If +you prefer the non strict rst code, put the following in your |vimrc|: +> + let vimrplugin_strict_rst = 0 +< 6.24. Allow R commands in insert mode~ *Vimrplugin_insert_mode_cmds* @@ -2019,8 +2027,9 @@ the R syntax highlighted. vimrplugin_openpdf = 1 (thanks to Tomaz Ficko for suggesting the feature). Open it quietly if vimrplugin_openpdf_quietly = 1. Open it manually with \op. - * Open HTML automatically after processing rmd file if - vimrplugin_openhtml = 1. + * Open HTML automatically after processing either rmd or rsst file if + vimrplugin_openhtml = 1. Generate strict rst code if + vimrplugin_strict_rst = 1. * Remove option vimrplugin_knitargs. * Start last R if there is more than one installed on Windows (thanks to Alex Zvoleff for reporting the bug and writing the patch). diff --git a/ftplugin/rrst.vim b/ftplugin/rrst.vim index bf1d206..2e827a6 100644 --- a/ftplugin/rrst.vim +++ b/ftplugin/rrst.vim @@ -18,7 +18,7 @@ " Jose Claudio Faria " Alex Zvoleff " -" Last Change: Sun Sep 23, 2012 07:39PM +" Last Change: Mon Sep 24, 2012 08:43AM "========================================================================== " Only do this when not yet done for this buffer @@ -98,9 +98,48 @@ function! RrstNextChunk() range return endfunction -function! RMakePDF() +function! RMakeHTMLrrst(t) + call RSetWD() + update + if g:rplugin_has_rst2pdf == 0 + if executable("rst2pdf") + let g:rplugin_has_rst2pdf = 1 + else + call RWarningMsg("Is 'rst2pdf' application installed? Cannot convert into HTML/ODT: 'rst2pdf' executable not found.") + return + endif + endif + + let rcmd = 'require(knitr)' + if g:vimrplugin_strict_rst + let rcmd = rcmd . '; render_rst(strict=TRUE)' + endif + let rcmd = rcmd . '; knit("' . expand("%:t") . '")' + + if a:t == "odt" + let rcmd = rcmd . '; system("rst2odt ' . expand("%:r:t") . ".rst " . expand("%:r:t") . '.odt")' + else + let rcmd = rcmd . '; system("rst2html ' . expand("%:r:t") . ".rst " . expand("%:r:t") . '.html")' + endif + + if g:vimrplugin_openhtml && a:t == "html" + let rcmd = rcmd . '; browseURL("' . expand("%:r:t") . '.html")' + endif + call SendCmdToR(rcmd) +endfunction + +function! RMakePDFrrst() update call RSetWD() + if g:rplugin_has_rst2pdf == 0 + if executable("rst2pdf") + let g:rplugin_has_rst2pdf = 1 + else + call RWarningMsg("Is 'rst2pdf' application installed? Cannot convert into PDF: 'rst2pdf' executable not found.") + return + endif + endif + let pdfcmd = "vim.interlace.rrst('" . expand("%:t") . "'" if exists("g:vimrplugin_rrstcompiler") let pdfcmd = pdfcmd . ", compiler='" . g:vimrplugin_rrstcompiler . "'" @@ -123,7 +162,7 @@ function! RMakePDF() endfunction " Send Rrst chunk to R -function! SendChunkToR(e, m) +function! SendRrstChunkToR(e, m) if RrstIsInRCode() == 0 call RWarningMsg("Not inside an R code chunk.") return @@ -140,14 +179,6 @@ function! SendChunkToR(e, m) endif endfunction -" knit the current buffer content -function! RKnit() - update - let b:needsnewomnilist = 1 - call RSetWD() - call SendCmdToR('require(knitr); knit("' . expand("%:t") . '")') -endfunction - "========================================================================== " Key bindings and menu items @@ -159,12 +190,14 @@ call RCreateMaps("nvi", 'RSetwd', 'rd', ':call RSetWD()') " Only .Rrst files use these functions: call RCreateMaps("nvi", 'RKnit', 'kn', ':call RKnit()') -call RCreateMaps("nvi", 'RMakePDFK', 'kp', ':call RMakePDF()') +call RCreateMaps("nvi", 'RMakePDFK', 'kp', ':call RMakePDFrrst()') +call RCreateMaps("nvi", 'RMakeHTML', 'kh', ':call RMakeHTMLrrst("html")') +call RCreateMaps("nvi", 'RMakeODT', 'ko', ':call RMakeHTMLrrst("odt")') call RCreateMaps("nvi", 'RIndent', 'si', ':call RrstToggleIndentSty()') -call RCreateMaps("ni", 'RSendChunk', 'cc', ':call SendChunkToR("silent", "stay")') -call RCreateMaps("ni", 'RESendChunk', 'ce', ':call SendChunkToR("echo", "stay")') -call RCreateMaps("ni", 'RDSendChunk', 'cd', ':call SendChunkToR("silent", "down")') -call RCreateMaps("ni", 'REDSendChunk', 'ca', ':call SendChunkToR("echo", "down")') +call RCreateMaps("ni", 'RSendChunk', 'cc', ':call SendRrstChunkToR("silent", "stay")') +call RCreateMaps("ni", 'RESendChunk', 'ce', ':call SendRrstChunkToR("echo", "stay")') +call RCreateMaps("ni", 'RDSendChunk', 'cd', ':call SendRrstChunkToR("silent", "down")') +call RCreateMaps("ni", 'REDSendChunk', 'ca', ':call SendRrstChunkToR("echo", "down")') nmap gn :call RrstNextChunk() nmap gN :call RrstPreviousChunk() @@ -173,5 +206,7 @@ if has("gui_running") call MakeRMenu() endif +let g:rplugin_has_rst2pdf = 0 + let &cpo = s:cpo_save unlet s:cpo_save From 35896176056f77418c2f30a637ff30f4fe5e3c6d Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Mon, 24 Sep 2012 09:35:23 -0300 Subject: [PATCH 0306/1050] Avoid name clash. --- ftplugin/rmd.vim | 30 +++++++++++------------------- ftplugin/rnoweb.vim | 12 ++++-------- r-plugin/common_global.vim | 15 ++++++++++++--- 3 files changed, 27 insertions(+), 30 deletions(-) diff --git a/ftplugin/rmd.vim b/ftplugin/rmd.vim index 68a58d9..b46d762 100644 --- a/ftplugin/rmd.vim +++ b/ftplugin/rmd.vim @@ -103,7 +103,7 @@ function! RmdNextChunk() range return endfunction -function! RMakeHTML(t) +function! RMakeHTMLrmd(t) call RSetWD() update let rcmd = 'require(knitr); knit2html("' . expand("%:t") . '", options = "")' @@ -123,7 +123,7 @@ function! RMakeHTML(t) call SendCmdToR(rcmd) endfunction -function! RMakePDF(t) +function! RMakePDFrmd(t) if g:rplugin_has_pandoc == 0 if executable("pandoc") let g:rplugin_has_pandoc = 1 @@ -153,7 +153,7 @@ function! RMakePDF(t) endfunction " Send Rmd chunk to R -function! SendChunkToR(e, m) +function! SendRmdChunkToR(e, m) if RmdIsInRCode() == 0 call RWarningMsg("Not inside an R code chunk.") return @@ -170,14 +170,6 @@ function! SendChunkToR(e, m) endif endfunction -" knit the current buffer content -function! RKnit() - update - let b:needsnewomnilist = 1 - call RSetWD() - call SendCmdToR('require(knitr); knit("' . expand("%:t") . '")') -endfunction - "========================================================================== " Key bindings and menu items @@ -189,14 +181,14 @@ call RCreateMaps("nvi", 'RSetwd', 'rd', ':call RSetWD()') " Only .Rmd files use these functions: call RCreateMaps("nvi", 'RKnit', 'kn', ':call RKnit()') -call RCreateMaps("nvi", 'RMakePDFK', 'kp', ':call RMakePDF("latex")') -call RCreateMaps("nvi", 'RMakePDFK', 'kl', ':call RMakePDF("beamer")') -call RCreateMaps("nvi", 'RMakeHTML', 'kh', ':call RMakeHTML("html")') -call RCreateMaps("nvi", 'RMakeODT', 'ko', ':call RMakeHTML("odt")') -call RCreateMaps("ni", 'RSendChunk', 'cc', ':call SendChunkToR("silent", "stay")') -call RCreateMaps("ni", 'RESendChunk', 'ce', ':call SendChunkToR("echo", "stay")') -call RCreateMaps("ni", 'RDSendChunk', 'cd', ':call SendChunkToR("silent", "down")') -call RCreateMaps("ni", 'REDSendChunk', 'ca', ':call SendChunkToR("echo", "down")') +call RCreateMaps("nvi", 'RMakePDFK', 'kp', ':call RMakePDFrmd("latex")') +call RCreateMaps("nvi", 'RMakePDFK', 'kl', ':call RMakePDFrmd("beamer")') +call RCreateMaps("nvi", 'RMakeHTML', 'kh', ':call RMakeHTMLrmd("html")') +call RCreateMaps("nvi", 'RMakeODT', 'ko', ':call RMakeHTMLrmd("odt")') +call RCreateMaps("ni", 'RSendChunk', 'cc', ':call SendRmdChunkToR("silent", "stay")') +call RCreateMaps("ni", 'RESendChunk', 'ce', ':call SendRmdChunkToR("echo", "stay")') +call RCreateMaps("ni", 'RDSendChunk', 'cd', ':call SendRmdChunkToR("silent", "down")') +call RCreateMaps("ni", 'REDSendChunk', 'ca', ':call SendRmdChunkToR("echo", "down")') nmap gn :call RmdNextChunk() nmap gN :call RmdPreviousChunk() diff --git a/ftplugin/rnoweb.vim b/ftplugin/rnoweb.vim index 69206a9..705eb35 100644 --- a/ftplugin/rnoweb.vim +++ b/ftplugin/rnoweb.vim @@ -168,15 +168,11 @@ function! SendChunkToR(e, m) endfunction " Sweave the current buffer content -function! RSweave(knit) +function! RSweave() update let b:needsnewomnilist = 1 call RSetWD() - if a:knit - call SendCmdToR('require(knitr); knit("' . expand("%:t") . '")') - else - call SendCmdToR('Sweave("' . expand("%:t") . '")') - endif + call SendCmdToR('Sweave("' . expand("%:t") . '")') endfunction function! ROpenPDF() @@ -241,10 +237,10 @@ call RControlMaps() call RCreateMaps("nvi", 'RSetwd', 'rd', ':call RSetWD()') " Only .Rnw files use these functions: -call RCreateMaps("nvi", 'RSweave', 'sw', ':call RSweave(0)') +call RCreateMaps("nvi", 'RSweave', 'sw', ':call RSweave()') call RCreateMaps("nvi", 'RMakePDF', 'sp', ':call RMakePDF("nobib", 0)') call RCreateMaps("nvi", 'RBibTeX', 'sb', ':call RMakePDF("bibtex", 0)') -call RCreateMaps("nvi", 'RKnit', 'kn', ':call RSweave(1)') +call RCreateMaps("nvi", 'RKnit', 'kn', ':call RKnit()') call RCreateMaps("nvi", 'RMakePDFK', 'kp', ':call RMakePDF("nobib", 1)') call RCreateMaps("nvi", 'RBibTeXK', 'kb', ':call RMakePDF("bibtex", 1)') call RCreateMaps("nvi", 'ROpenPDF', 'op', ':call ROpenPDF()') diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index f1b5ffb..0f17405 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -1674,6 +1674,14 @@ function RQuit(how) endfunction +" knit the current buffer content +function! RKnit() + update + let b:needsnewomnilist = 1 + call RSetWD() + call SendCmdToR('require(knitr); knit("' . expand("%:t") . '")') +endfunction + " Tell R to create a list of objects file listing all currently available " objects in its environment. The file is necessary for omni completion. function BuildROmniList(env, what) @@ -2440,7 +2448,7 @@ function MakeRMenu() if &filetype == "rnoweb" || &filetype == "rmd" || &filetype == "rrst" || g:vimrplugin_never_unmake_menu if &filetype == "rnoweb" || g:vimrplugin_never_unmake_menu menu R.Command.-Sep5- - call RCreateMenuItem("nvi", 'Command.Sweave\ (cur\ file)', 'RSweave', 'sw', ':call RSweave(0)') + call RCreateMenuItem("nvi", 'Command.Sweave\ (cur\ file)', 'RSweave', 'sw', ':call RSweave()') call RCreateMenuItem("nvi", 'Command.Sweave\ and\ PDF\ (cur\ file)', 'RMakePDF', 'sp', ':call RMakePDF("nobib", 0)') if has("win32") || has("win64") call RCreateMenuItem("nvi", 'Command.Sweave\ and\ PDF\ (cur\ file,\ verbose)', 'RMakePDF', 'sv', ':call RMakePDF("verbose", 0)') @@ -2449,7 +2457,7 @@ function MakeRMenu() endif endif menu R.Command.-Sep6- - call RCreateMenuItem("nvi", 'Command.Knit\ (cur\ file)', 'RSweave', 'kn', ':call RSweave(1)') + call RCreateMenuItem("nvi", 'Command.Knit\ (cur\ file)', 'RKnit', 'kn', ':call RKnit()') call RCreateMenuItem("nvi", 'Command.Knit\ and\ PDF\ (cur\ file)', 'RMakePDF', 'kp', ':call RMakePDF("nobib", 1)') if has("win32") || has("win64") call RCreateMenuItem("nvi", 'Command.Knit\ and\ PDF\ (cur\ file,\ verbose)', 'RMakePDF', 'kv', ':call RMakePDF("verbose", 1)') @@ -2466,7 +2474,7 @@ function MakeRMenu() "------------------------------- if &filetype == "rrst" || g:vimrplugin_never_unmake_menu menu R.Command.-Sep5- - call RCreateMenuItem("nvi", 'Command.Knit\ (cur\ file)', 'RKnit', 'kn', ':call RSweave()') + call RCreateMenuItem("nvi", 'Command.Knit\ (cur\ file)', 'RKnit', 'kn', ':call RKnit()') call RCreateMenuItem("nvi", 'Command.Knit\ and\ PDF\ (cur\ file)', 'RMakePDF', 'kp', ':call RMakePDF("nobib")') endif "------------------------------- @@ -2846,6 +2854,7 @@ call RSetDefaultValue("g:vimrplugin_allnames", 0) call RSetDefaultValue("g:vimrplugin_rmhidden", 1) call RSetDefaultValue("g:vimrplugin_underscore", 1) call RSetDefaultValue("g:vimrplugin_rnowebchunk", 1) +call RSetDefaultValue("g:vimrplugin_strict_rst", 1) call RSetDefaultValue("g:vimrplugin_openpdf", 0) call RSetDefaultValue("g:vimrplugin_openpdf_quietly", 0) call RSetDefaultValue("g:vimrplugin_openhtml", 0) From 9634f3ea4158390cce60ee653726b437822022d5 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 27 Sep 2012 19:17:11 -0300 Subject: [PATCH 0307/1050] Check whether /Applications/R[64].app exist. --- r-plugin/common_global.vim | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 0f17405..ce64880 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -2929,7 +2929,15 @@ exe "PyFile " . g:rplugin_home . "/r-plugin/vimcom.py" call RSetDefaultValue("g:vimrplugin_ca_ck", 0) if has("gui_macvim") || has("gui_mac") || has("mac") || has("macunix") - call RSetDefaultValue("g:vimrplugin_applescript", 1) + let g:rplugin_r64app = 0 + if isdirectory("/Applications/R64.app") + call RSetDefaultValue("g:vimrplugin_applescript", 1) + let g:rplugin_r64app = 1 + elseif isdirectory("/Applications/R.app") + call RSetDefaultValue("g:vimrplugin_applescript", 1) + else + call RSetDefaultValue("g:vimrplugin_applescript", 0) + endif else call RSetDefaultValue("g:vimrplugin_applescript", 0) endif @@ -2941,11 +2949,6 @@ else let g:vimrplugin_screenplugin = 0 let g:vimrplugin_conqueplugin = 0 let g:vimrplugin_tmux = 0 - if isdirectory("/Applications/R64.app") - let g:rplugin_r64app = 1 - else - let g:rplugin_r64app = 0 - endif endif " The screen.vim plugin only works on terminal emulators From 501985368ad84899c40d86fa7c9087ead71f6fcc Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 27 Sep 2012 20:40:14 -0300 Subject: [PATCH 0308/1050] Improve documentation of vimrplugin_applescript. --- doc/r-plugin.txt | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 5b75c1a..6c1407d 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -1095,8 +1095,8 @@ If you are using a 64 bit Windows or a 64 bit Mac OS X, but prefer to run the Vim will run the first R executable in the path. You can set an alternative R path in your |vimrc| as in the examples: > - let vimrplugin_r_path = "/path/2/my/preferred/R/version/bin" - let vimrplugin_r_path = "C:\\Program Files\\R\\R-2.12.0\\i386\\bin" + let vimrplugin_r_path = "/path/to/my/preferred/R/version/bin" + let vimrplugin_r_path = "C:\\Program Files\\R\\R-2.15.1\\bin\\i386" > On Windows, Vim will try to find the R install path in the Windows Registry. @@ -1242,9 +1242,14 @@ with the Vim-R-plugin you will need to add the following to your |vimrc|: 6.16. Integration with AppleScript (OS X only)~ *vimrplugin_applescript* -In Mac OS X, the plugin will try to send commands to R gui using AppleScript -if running the GUI version of MacVim. If you prefer to have R running in an -external terminal emulator, put in your |vimrc|: +In Mac OS X, the plugin will try to send commands to R gui using AppleScript. +If you prefer to run R and Vim in the same terminal emulator split in two +regions (Vim and R), put in your |vimrc|: +> + let vimrplugin_applescript = 0 +< +If you prefer to have R running in an external terminal emulator, put in your +|vimrc|: > let vimrplugin_applescript = 0 let vimrplugin_screenplugin = 0 From 1ad8412190f6ea885606d387b72b19f11816248c Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sun, 30 Sep 2012 10:19:48 -0300 Subject: [PATCH 0309/1050] Use full file name path to open the pdf. --- ftplugin/rnoweb.vim | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ftplugin/rnoweb.vim b/ftplugin/rnoweb.vim index 705eb35..d6e6f19 100644 --- a/ftplugin/rnoweb.vim +++ b/ftplugin/rnoweb.vim @@ -208,12 +208,12 @@ function! ROpenPDF() if g:rplugin_pdfviewer == "none" if g:vimrplugin_openpdf_quietly - call SendCmdToR('vim.openpdf("' . expand("%:t:r") . ".pdf" . '", TRUE)') + call SendCmdToR('vim.openpdf("' . expand("%:p:r") . ".pdf" . '", TRUE)') else - call SendCmdToR('vim.openpdf("' . expand("%:t:r") . ".pdf" . '")') + call SendCmdToR('vim.openpdf("' . expand("%:p:r") . ".pdf" . '")') endif else - let openlog = system(g:rplugin_pdfviewer . " '" . expand("%:t:r") . ".pdf" . "'") + let openlog = system(g:rplugin_pdfviewer . " '" . expand("%:p:r") . ".pdf" . "'") if v:shell_error let rlog = substitute(openlog, "\n", " ", "g") let rlog = substitute(openlog, "\r", " ", "g") From 58f04994a381d058cece2fd33dbcf774b9fbc7a9 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sun, 30 Sep 2012 23:20:27 -0300 Subject: [PATCH 0310/1050] Complete knitr options even if 'base' is empty. --- r-plugin/common_global.vim | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index ce64880..f3bef61 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -107,9 +107,10 @@ endfunction function! CompleteChunkOptions(base) let rr = [] if strlen(a:base) == 0 - return rr + let newbase = '.' + else + let newbase = '^' . substitute(a:base, "\\$$", "", "") endif - let newbase = '^' . substitute(a:base, "\\$$", "", "") let ktopt = ["eval=;TRUE", "echo=;TRUE", "results=;'markup|asis|hide'", \ "warning=;TRUE", "error=;TRUE", "message=;TRUE", "split=;FALSE", \ "include=;TRUE", "tidy=;TRUE", "prompt=;FALSE", "comment=;'##'", @@ -118,11 +119,11 @@ function! CompleteChunkOptions(base) \ "fig.path=; ", "fig.keep=;'high|none|all|first|last'", \ "fig.show=;'asis|hold|animate'", "dev=; ", "dev.args=; ", "fig.ext=; ", \ "dpi=;72", "fig.width=;7", "fig.height=;7", "out.width=;'7in'", - \ "out.height='7in'", "out.extra=; ", "resize.width=; ", "resize.height=; ", + \ "out.height=;'7in'", "out.extra=; ", "resize.width=; ", "resize.height=; ", \ "fig.align=;'left|right|center'", "fig.env=;'figure'", "fig.cap=;''", "fig.scap=;''", \ "fig.lp=;'fig:'", "fig.pos=;''", "external=;TRUE", "sanitize=;FALSE", \ "interval=;1", "aniopts=;'controls.loop'", "ref.label=; ", "child=; ", - \ "engine=; ", "opts.label=''"] + \ "engine=; ", "opts.label=;''"] for kopt in ktopt if kopt =~ newbase let tmp1 = split(kopt, ";") From 60340ba69c54301f51cb8db4af7a5f3726ce8e4b Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Mon, 1 Oct 2012 15:37:15 -0300 Subject: [PATCH 0311/1050] Correctly highlight unlabeled chunk header. --- syntax/rmd.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/syntax/rmd.vim b/syntax/rmd.vim index 2f29261..f2e34f2 100644 --- a/syntax/rmd.vim +++ b/syntax/rmd.vim @@ -1,6 +1,6 @@ " markdown Text with R statements " Language: markdown with R code chunks -" Last Change: Sat Sep 22, 2012 01:28PM +" Last Change: Mon Oct 01, 2012 03:34PM " for portability if version < 600 @@ -27,7 +27,7 @@ syntax include @R syntax/r.vim if exists("b:current_syntax") unlet b:current_syntax endif -syntax match rmdChunkDelim "^```{r .*}$" contained +syntax match rmdChunkDelim "^```{r.*}$" contained syntax match rmdChunkDelim "^```$" contained syntax region rmdChunk start="^``` *{r.*}$" end="^```$" contains=@R,rmdChunkDelim keepend transparent fold From 4156459430f5b1e5d56ff3b9c1199b208afb0f59 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Mon, 1 Oct 2012 15:38:46 -0300 Subject: [PATCH 0312/1050] Complete chunk arguments even in unlabeled chunks. --- r-plugin/common_global.vim | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index f3bef61..a30a18f 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -104,12 +104,21 @@ function ReplaceUnderS() endif endfunction -function! CompleteChunkOptions(base) +function! CompleteChunkOptions() + let cline = getline(".") + let cpos = getpos(".") + let idx1 = cpos[2] - 2 + let idx2 = cpos[2] - 1 + while cline[idx1] =~ '\w' + let idx1 -= 1 + endwhile + let idx1 += 1 + let base = strpart(cline, idx1, idx2 - idx1) let rr = [] - if strlen(a:base) == 0 + if strlen(base) == 0 let newbase = '.' else - let newbase = '^' . substitute(a:base, "\\$$", "", "") + let newbase = '^' . substitute(base, "\\$$", "", "") endif let ktopt = ["eval=;TRUE", "echo=;TRUE", "results=;'markup|asis|hide'", \ "warning=;TRUE", "error=;TRUE", "message=;TRUE", "split=;FALSE", @@ -131,12 +140,16 @@ function! CompleteChunkOptions(base) call add(rr, tmp2) endif endfor - return rr + call complete(idx1 + 1, rr) endfunction function RCompleteArgs() - let lnum = line(".") let line = getline(".") + if (&filetype == "rnoweb" && line =~ "^<<.*>>=$") || (&filetype == "rmd" && line =~ "^``` *{r.*}$") || (&filetype == "rrst" && line =~ "^.. {r.*}$") || (&filetype == "r" && line =~ "^#\+") + call CompleteChunkOptions() + return '' + endif + let lnum = line(".") let cpos = getpos(".") let idx = cpos[2] - 2 let idx2 = cpos[2] - 2 @@ -148,11 +161,6 @@ function RCompleteArgs() let argkey = RGetKeyWord() let idx2 = cpos[2] - strlen(argkey) endif - if (&filetype == "rnoweb" && line =~ "^<<.*>>=$") || (&filetype == "rmd" && line =~ "^``` *{r.*}$") || (&filetype == "rrst" && line =~ "^.. {r.*}$") || (&filetype == "r" && line =~ "^#\+") - call cursor(cpos[1], cpos[2]) - call complete(idx2, CompleteChunkOptions(argkey)) - return '' - endif if b:needsnewomnilist == 1 call BuildROmniList("GlobalEnv", "none") endif From c61d9bc6bce58a7b31590a0e761655504688e6d1 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Mon, 1 Oct 2012 18:21:39 -0300 Subject: [PATCH 0313/1050] Sort knitr options alphabetically. --- r-plugin/common_global.vim | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index a30a18f..1f0f00e 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -120,19 +120,19 @@ function! CompleteChunkOptions() else let newbase = '^' . substitute(base, "\\$$", "", "") endif - let ktopt = ["eval=;TRUE", "echo=;TRUE", "results=;'markup|asis|hide'", - \ "warning=;TRUE", "error=;TRUE", "message=;TRUE", "split=;FALSE", - \ "include=;TRUE", "tidy=;TRUE", "prompt=;FALSE", "comment=;'##'", - \ "highlight=;TRUE", "size=;'normalsize'", "background=;'#F7F7F7'", - \ "cache=;FALSE", "cache.path=;'cache/'", "dependson=;''", "autodep=;FALSE", - \ "fig.path=; ", "fig.keep=;'high|none|all|first|last'", - \ "fig.show=;'asis|hold|animate'", "dev=; ", "dev.args=; ", "fig.ext=; ", - \ "dpi=;72", "fig.width=;7", "fig.height=;7", "out.width=;'7in'", - \ "out.height=;'7in'", "out.extra=; ", "resize.width=; ", "resize.height=; ", - \ "fig.align=;'left|right|center'", "fig.env=;'figure'", "fig.cap=;''", "fig.scap=;''", - \ "fig.lp=;'fig:'", "fig.pos=;''", "external=;TRUE", "sanitize=;FALSE", - \ "interval=;1", "aniopts=;'controls.loop'", "ref.label=; ", "child=; ", - \ "engine=; ", "opts.label=;''"] + let ktopt = ["aniopts=;'controls.loop'", "autodep=;FALSE", "background=;'#F7F7F7'", + \ "cache.path=;'cache/'", "cache=;FALSE", "child=; ", "comment=;'##'", + \ "dependson=;''", "dev.args=; ", "dev=; ", "dpi=;72", "echo=;TRUE", + \ "engine=; ", "error=;TRUE", "eval=;TRUE", "external=;TRUE", + \ "fig.align=;'left|right|center'", "fig.cap=;''", "fig.env=;'figure'", + \ "fig.ext=; ", "fig.height=;7", "fig.keep=;'high|none|all|first|last'", + \ "fig.lp=;'fig:'", "fig.path=; ", "fig.pos=;''", "fig.scap=;''", + \ "fig.show=;'asis|hold|animate'", "fig.width=;7", "highlight=;TRUE", + \ "include=;TRUE", "interval=;1", "message=;TRUE", "opts.label=;''", + \ "out.extra=; ", "out.height=;'7in'", "out.width=;'7in'", + \ "prompt=;FALSE", "ref.label=; ", "resize.height=; ", + \ "resize.width=; ", "results=;'markup|asis|hide'", "sanitize=;FALSE", + \ "size=;'normalsize'", "split=;FALSE", "tidy=;TRUE", "warning=;TRUE"] for kopt in ktopt if kopt =~ newbase let tmp1 = split(kopt, ";") From 595d371aa71d08e63d3a8b27a7d3173e911175c1 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Mon, 1 Oct 2012 22:00:28 -0300 Subject: [PATCH 0314/1050] Need new omnilist after evaluating R code. --- ftplugin/rmd.vim | 2 ++ ftplugin/rnoweb.vim | 1 + ftplugin/rrst.vim | 3 ++- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ftplugin/rmd.vim b/ftplugin/rmd.vim index b46d762..5307b01 100644 --- a/ftplugin/rmd.vim +++ b/ftplugin/rmd.vim @@ -149,6 +149,7 @@ function! RMakePDFrmd(t) let pdfcmd = pdfcmd . ", pandoc_args = '" . g:vimrplugin_pandoc_args . "'" endif let pdfcmd = pdfcmd . ")" + let b:needsnewomnilist = 1 call SendCmdToR(pdfcmd) endfunction @@ -161,6 +162,7 @@ function! SendRmdChunkToR(e, m) let chunkline = search("^```[ ]*{r", "bncW") + 1 let docline = search("^```", "ncW") - 1 let lines = getline(chunkline, docline) + let b:needsnewomnilist = 1 let ok = RSourceLines(lines, a:e) if ok == 0 return diff --git a/ftplugin/rnoweb.vim b/ftplugin/rnoweb.vim index d6e6f19..87cb0af 100644 --- a/ftplugin/rnoweb.vim +++ b/ftplugin/rnoweb.vim @@ -158,6 +158,7 @@ function! SendChunkToR(e, m) let chunkline = search("^<<", "bncW") + 1 let docline = search("^@", "ncW") - 1 let lines = getline(chunkline, docline) + let b:needsnewomnilist = 1 let ok = RSourceLines(lines, a:e) if ok == 0 return diff --git a/ftplugin/rrst.vim b/ftplugin/rrst.vim index 2e827a6..58ea950 100644 --- a/ftplugin/rrst.vim +++ b/ftplugin/rrst.vim @@ -18,7 +18,6 @@ " Jose Claudio Faria " Alex Zvoleff " -" Last Change: Mon Sep 24, 2012 08:43AM "========================================================================== " Only do this when not yet done for this buffer @@ -125,6 +124,7 @@ function! RMakeHTMLrrst(t) if g:vimrplugin_openhtml && a:t == "html" let rcmd = rcmd . '; browseURL("' . expand("%:r:t") . '.html")' endif + let b:needsnewomnilist = 1 call SendCmdToR(rcmd) endfunction @@ -170,6 +170,7 @@ function! SendRrstChunkToR(e, m) let chunkline = search("^\\.\\. {r", "bncW") + 1 let docline = search("^\\.\\. \\.\\.", "ncW") - 1 let lines = getline(chunkline, docline) + let b:needsnewomnilist = 1 let ok = RSourceLines(lines, a:e) if ok == 0 return From 7eaf0d11b1f4ede904c874f9340b89a95170cb10 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Mon, 1 Oct 2012 22:01:10 -0300 Subject: [PATCH 0315/1050] Update comments. --- ftplugin/r.vim | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ftplugin/r.vim b/ftplugin/r.vim index 0ef788f..fc27a94 100644 --- a/ftplugin/r.vim +++ b/ftplugin/r.vim @@ -33,20 +33,20 @@ let b:did_r_ftplugin = 1 let s:cpo_save = &cpo set cpo&vim -" Don't do this if called by ../r-plugin/global_r_plugin.vim +" Don't do this if called by ../r-plugin/common_global.vim if &filetype == "r" setlocal commentstring=#%s setlocal comments=b:#,b:##,b:###,b:#' endif -" Source scripts common to R, Rnoweb, Rhelp and rdoc files: +" Source scripts common to R, Rnoweb, Rhelp, Rmd, Rrst and rdoc files: runtime r-plugin/common_global.vim if exists("g:rplugin_failed") finish endif -" Some buffer variables common to R, Rnoweb, Rhelp and rdoc files need be -" defined after the global ones: +" Some buffer variables common to R, Rnoweb, Rhelp, Rmd, Rrst and rdoc files +" need be defined after the global ones: runtime r-plugin/common_buffer.vim " Run R CMD BATCH on current file and load the resulting .Rout in a split @@ -83,7 +83,7 @@ function! ShowRout() endif endfunction -" Sweave the current buffer content +" Convert R script into Rmd and, then, into md. function! RSpin() update let b:needsnewomnilist = 1 From ebf4377aa0206722ddc2262cfb16994202ce7dcd Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 4 Oct 2012 08:20:59 -0300 Subject: [PATCH 0316/1050] Note about vimcom on github. --- README | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README b/README index 4b569c9..cf28b93 100644 --- a/README +++ b/README @@ -10,3 +10,7 @@ http://www.vim.org/scripts/script.php?script_id=2628 Please, read the file doc/r-plugin.txt for usage details. +If you decide to use this version, you will also need the development version +of vimcom: + +https://github.com/jalvesaq/VimCom From 180362364574e8dc22b6a7392200cfe6b337129e Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 4 Oct 2012 16:25:06 -0300 Subject: [PATCH 0317/1050] New command: RAddLibToList. --- Makefile | 31 ++++++++++--------- doc/r-plugin.txt | 47 +++++++++++++++++++---------- r-plugin/common_global.vim | 61 ++++++++++++++++++++------------------ 3 files changed, 78 insertions(+), 61 deletions(-) diff --git a/Makefile b/Makefile index 2886be9..0b630ba 100644 --- a/Makefile +++ b/Makefile @@ -17,6 +17,13 @@ # This script builds both the zip and the deb files of # # released versions of the plugin. The files are # # created at the /tmp directory. # +# # +# To make the distribution version of the plugin the # +# file functions.vim.vanilla must exist. Run the Vim # +# command :RUpdateObjList with R vanilla running (that # +# is, R with only the default libraries loaded) and, # +# then, the file functions.vim be renamed to # +# functions.vim.vanilla. # ########################################################### @@ -33,16 +40,6 @@ zip: rm -rf vim-r-plugin-tmp/usr/share/vim/addons ;\ mkdir -p vim-r-plugin-tmp/usr/share/vim/addons ) rm -f /tmp/vim-r-plugin-$(PLUGINVERSION).zip - # To make the distribution version of the plugin the files - # functions.vim.vanilla and omnils.vanilla must exist. To generate these - # files, the Vim command :RUpdateObjList must be run with R vanilla running - # (that is, R with only the default libraries loaded) and, then, the files - # functions.vim and omnils must be renamed. - ( cd r-plugin ;\ - mv functions.vim functions.vim.current ;\ - mv omnils omnils.current ;\ - cp functions.vim.vanilla functions.vim ;\ - cp omnils.vanilla omnils ) # Update the version date in doc/r-plugin.txt header and in the news sed -i -e "s/^Version: [0-9].[0-9].[0-9]/Version: $(PLUGINVERSION)/" doc/r-plugin.txt sed -i -e "s/^$(PLUGINVERSION) (201[0-9]-[0-9][0-9]-[0-9][0-9])$$/$(PLUGINVERSION) ($(PLUGINRELEASEDATE))/" doc/r-plugin.txt @@ -51,8 +48,13 @@ zip: indent/rrst.vim indent/rnoweb.vim indent/rhelp.vim autoload/rcomplete.vim ftplugin/r*.vim \ syntax/rout.vim syntax/r.vim syntax/rhelp.vim syntax/rmd.vim \ syntax/rrst.vim syntax/rdoc.vim syntax/rbrowser.vim \ - doc/r-plugin.txt r-plugin/functions.vim r-plugin/vimcom.py \ - r-plugin/global_r_plugin.vim r-plugin/omnils r-plugin/windows.py \ + doc/r-plugin.txt r-plugin/functions.vim.vanilla r-plugin/vimcom.py \ + r-plugin/global_r_plugin.vim r-plugin/windows.py \ + r-plugin/objlist/omnils_base r-plugin/objlist/omnils_colorout \ + r-plugin/objlist/omnils_datasets r-plugin/objlist/omnils_graphics \ + r-plugin/objlist/omnils_grDevices r-plugin/objlist/omnils_methods \ + r-plugin/objlist/omnils_setwidth r-plugin/objlist/omnils_stats \ + r-plugin/objlist/omnils_utils r-plugin/objlist/omnils_vimcom \ r-plugin/vimActivate.js r-plugin/tex_indent.vim r-plugin/r.snippets \ r-plugin/common_buffer.vim r-plugin/common_global.vim \ bitmaps/ricon.xbm bitmaps/ricon.png \ @@ -67,16 +69,13 @@ zip: bitmaps/RListSpace.png bitmaps/RListSpace.bmp \ bitmaps/RClear.png bitmaps/RClear.bmp \ bitmaps/RClearAll.png bitmaps/RClearAll.bmp - # Rename the functions.vim and omnils files - ( cd $(PLUGINHOME)/r-plugin ;\ - mv functions.vim.current functions.vim ;\ - mv omnils.current omnils ) # Unpack the tar.gz and create the zip file (cd /tmp ;\ tar -xvzf vimrplugintmpfile.tar.gz -C vim-r-plugin-tmp/usr/share/vim/addons > /dev/null ;\ rm vimrplugintmpfile.tar.gz ) (cd /tmp/vim-r-plugin-tmp/usr/share/vim/addons ;\ chmod +w r-plugin/tex_indent.vim ;\ + mv r-plugin/functions.vim.vanilla r-plugin/functions.vim;\ rm -f /tmp/vim-r-plugin-$(PLUGINVERSION).zip ;\ zip -r /tmp/vim-r-plugin-$(PLUGINVERSION).zip . ) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 6c1407d..cd571e3 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -36,7 +36,7 @@ The latest stable version of this plugin is available at: http://www.vim.org/scripts/script.php?script_id=2628 Feedback is welcomed. Please submit bug reports and feature requests to the -developers, we are very interested in what you like and what you would like to +developers; we are very interested in what you like and what you would like to see in future releases. Do not like a feature? Tell us and we may add an option to disable it. Cryptic error message are bugs... Please report them. The plugin should emit useful warnings if you do things it was not programmed @@ -53,8 +53,8 @@ to deal with. - Special highlighting for R output (.Rout files). - Spell check only strings and comments. - Fold code when foldmethod=syntax. - * Syntax highlighting for RHelp syntax. - * Smart indentation for R, RHelp and Rnoweb syntax. + * Syntax highlighting for RHelp, RMarkdown and RreStructuredText. + * Smart indentation for R, RHelp, Rnoweb, RMarkdown and RreStructuredText. * Integrated communication with R: - Start/Close R. - Send lines, selection, paragraphs, functions, blocks, entire file. @@ -64,6 +64,7 @@ to deal with. * Omni completion (auto-completion) for R objects (.GlobalEnv and installed packages). The list of installed packages must be updated manually. * Auto-completion of function arguments. + * Auto-completion of knitr chunk options. * Ability to see R's documentation in a Vim's buffer: - Automatic calculation of the best layout of the R documentation buffer (split the window either horizontally or vertically according to the @@ -78,6 +79,7 @@ to deal with. - Syntax highlighting of the Object Browser. * Most of the plugin's behavior is customizable. +For screenshots see: http://www.lepem.ufc.br/jaa/vim-r-plugin.html ============================================================================== *r-plugin-installation* @@ -546,8 +548,19 @@ If this time is not enough to your system, please, set a different value of You should run :RUpdateObjList whenever you upgrade R since some functions are removed and new ones are added at each new R version. +If have already run :RUpdateObjList and now want to add the objects of +specific libraries to both the list of objects for omnicompletion and the list +of functions for syntax highlight you can use the Vim command :RAddLibToList. +Example: +> + :RAddLibToList foreign Matrix +< Note: If you have too many loaded packages Vim may be unable to load the list -of functions for syntax highlight. +of functions for syntax highlight. If you want to remove the objects of +specific libraries, please, delete the corresponding files from +~/.vim/r-plugin/objlist/ directory (the directory may be at a different +location if you are using a plugin management system like vim-addons or +pathogen). 4.4. Omni completion~ @@ -565,11 +578,11 @@ complete the name of a data.frame, the columns are not shown. But when the data.frame name is already complete, and you have inserted the '$' symbol, omni completion will show the column names. -Vim uses two files: one for the objects of .GlobalEnv and the other for all -other objects. The .GlobalEnv list is stored in the /tmp/r-plugin-yourlogin -directory and, thus, is deleted after each reboot. The other file is stored in -~/.vim/r-plugin and remains available until you manually rebuild it with the -command: |:RUpdateObjList|. +Vim uses one for the objects of .GlobalEnv and a list of files for all other +objects. The .GlobalEnv list is stored in the /tmp/r-plugin-yourlogin +directory and, thus, is deleted after each reboot. The other files are stored +in ~/.vim/r-plugin/objlist/ and remain available until you manually delete +them. 4.5. The Object Browser~ @@ -1060,7 +1073,7 @@ option in your |vimrc|: > let vimrplugin_nosingler = 1 < -If you prefer that each Vim instance calls its own R process and all of the +If you prefer that each Vim instance calls its own R process and all the instance's buffers send code to this R process while other Vim instances send code to other R processes then put the following in your |vimrc|: > @@ -1539,7 +1552,7 @@ directory after the installation: r-plugin/common_buffer.vim r-plugin/common_global.vim r-plugin/functions.vim - r-plugin/omnils + r-plugin/objlist/ r-plugin/r.snippets r-plugin/tex_indent.vim r-plugin/vimcom.py @@ -2026,23 +2039,25 @@ the R syntax highlighted. *r-plugin-news* 10. News~ -0.9.8 (2012-09-23) +0.9.8 (2012-10-04) - * Open PDF automatically after processing rnoweb file if + * Open PDF automatically after processing Rnoweb file if vimrplugin_openpdf = 1 (thanks to Tomaz Ficko for suggesting the feature). Open it quietly if vimrplugin_openpdf_quietly = 1. Open it manually with \op. - * Open HTML automatically after processing either rmd or rsst file if + * Open HTML automatically after processing either Rmd or Rrst file if vimrplugin_openhtml = 1. Generate strict rst code if vimrplugin_strict_rst = 1. * Remove option vimrplugin_knitargs. * Start last R if there is more than one installed on Windows (thanks to Alex Zvoleff for reporting the bug and writing the patch). * Alex Zvoleff added support to Rrst file type. - * michelk added support to rmd file type. - * For rnoweb, rmd and rrst file types, CTRL-X CTRL-A completes knitr chunk + * michelk added support to Rmd file type. + * For Rnoweb, Rmd and Rrst file types, CTRL-X CTRL-A completes knitr chunk options if the cursor is inside the chunk header. * New option: vimrplugin_rmhidden. + * New command :RAddLibToList to add the objects of specific libraries to + omnicompletion. 0.9.7 (2012-05-04) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 1f0f00e..6d44ee0 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -162,7 +162,7 @@ function RCompleteArgs() let idx2 = cpos[2] - strlen(argkey) endif if b:needsnewomnilist == 1 - call BuildROmniList("GlobalEnv", "none") + call BuildROmniList("GlobalEnv", "") endif let flines = g:rplugin_globalenvlines + g:rplugin_liblist let np = 1 @@ -1693,16 +1693,16 @@ endfunction " Tell R to create a list of objects file listing all currently available " objects in its environment. The file is necessary for omni completion. -function BuildROmniList(env, what) +function BuildROmniList(env, packlist) if a:env =~ "GlobalEnv" let rtf = g:rplugin_globalenvfname let b:needsnewomnilist = 0 else - let rtf = g:rplugin_omnifname + let rtf = g:rplugin_omnidname endif let omnilistcmd = 'vim.bol("' . rtf . '"' - if a:env == "libraries" && a:what == "installed" - let omnilistcmd = omnilistcmd . ', what = "installed"' + if a:packlist != "" + let omnilistcmd = omnilistcmd . ", packlist=" . a:packlist endif if g:vimrplugin_allnames == 1 let omnilistcmd = omnilistcmd . ', allnames = TRUE' @@ -1748,10 +1748,27 @@ function BuildROmniList(env, what) echon endfunction -function RBuildSyntaxFile(what) - call BuildROmniList("libraries", a:what) +function RFillLibList() + let g:rplugin_liblist = [] + if isdirectory(g:rplugin_uservimfiles . "/r-plugin/objlist") + let dirls = split(glob(g:rplugin_uservimfiles . "/r-plugin/objlist/omnils_*"), "\n") + for omf in dirls + let g:rplugin_liblist = g:rplugin_liblist + readfile(omf) + endfor + else + call RWarningMsg('"'. g:rplugin_uservimfiles . "r-plugin/objlist" . '" is not a directory.') + endif +endfunction + +function RBuildSyntaxFile(...) + if a:0 == 0 + let packls = "" + else + let packls = 'c("' . join(split(a:1), '", "') . '")' + endif + call BuildROmniList("libraries", packls) sleep 100m - let g:rplugin_liblist = readfile(g:rplugin_omnifname) + call RFillLibList() call BuildRHelpList() let res = [] let nf = 0 @@ -2543,8 +2560,8 @@ function MakeRMenu() "---------------------------------------------------------------------------- " Syntax "---------------------------------------------------------------------------- - nmenu R.Syntax.Build\ omniList\ (loaded):RUpdateObjList :call RBuildSyntaxFile("loaded") - imenu R.Syntax.Build\ omniList\ (loaded):RUpdateObjList :call RBuildSyntaxFile("loaded")a + nmenu R.Syntax.Build\ omniList\ (loaded):RUpdateObjList :call RBuildSyntaxFile() + imenu R.Syntax.Build\ omniList\ (loaded):RUpdateObjList :call RBuildSyntaxFile()a "---------------------------------------------------------------------------- " Help @@ -2798,7 +2815,8 @@ function SetRPath() endif endfunction -command RUpdateObjList :call RBuildSyntaxFile("loaded") +command RUpdateObjList :call RBuildSyntaxFile() +command -nargs=+ RAddLibToList :call RBuildSyntaxFile() command RBuildTags :call SendCmdToR('rtags(ofile = "TAGS")') command -nargs=? -complete=customlist,RLisObjs Rhelp :call RAskHelp() command -nargs=? -complete=dir RSourceDir :call RSourceDirectory() @@ -3138,8 +3156,8 @@ if g:vimrplugin_conqueplugin == 1 endif endif -" Are we in a Debian package? Is the plugin being running for the first time? -let g:rplugin_omnifname = g:rplugin_uservimfiles . "/r-plugin/omnils" +" Are we in a Debian package? Is the plugin running for the first time? +let g:rplugin_omnidname = g:rplugin_uservimfiles . "/r-plugin/objlist/" if g:rplugin_home != g:rplugin_uservimfiles " Create r-plugin directory if it doesn't exist yet: if !isdirectory(g:rplugin_uservimfiles . "/r-plugin") @@ -3162,21 +3180,6 @@ if !filereadable(g:rplugin_uservimfiles . "/r-plugin/functions.vim") endif endif -" If there is no omnils, copy the default one -if !filereadable(g:rplugin_omnifname) - if filereadable("/usr/share/vim/addons/r-plugin/omnils") - let omnilines = readfile("/usr/share/vim/addons/r-plugin/omnils") - else - if filereadable(g:rplugin_home . "/r-plugin/omnils") - let omnilines = readfile(g:rplugin_home . "/r-plugin/omnils") - else - let omnilines = [] - endif - endif - call writefile(omnilines, g:rplugin_omnifname) - unlet omnilines -endif - " Minimum width for the Object Browser if g:vimrplugin_objbr_w < 10 let g:vimrplugin_objbr_w = 10 @@ -3184,7 +3187,7 @@ endif " Keeps the libraries object list in memory to avoid the need of reading the file " repeatedly: -let g:rplugin_liblist = readfile(g:rplugin_omnifname) +call RFillLibList() call BuildRHelpList() From 1910ae7470cd3a5fa49c4d3cc03733d312f49f56 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 4 Oct 2012 16:59:48 -0300 Subject: [PATCH 0318/1050] Add README file for objlist directory. --- r-plugin/objlist/README | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 r-plugin/objlist/README diff --git a/r-plugin/objlist/README b/r-plugin/objlist/README new file mode 100644 index 0000000..b987a68 --- /dev/null +++ b/r-plugin/objlist/README @@ -0,0 +1,6 @@ +The omnils_* files in this directory are generated by Vim-R-plugin +and are used for omni completion. Please, read :h RUpdateObjList +fort details. + +You should manually delete files corresponding to libraries that +you no longer use. From 0e2930be0b77953a746ee33e60d014c239678dc9 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Fri, 5 Oct 2012 18:26:51 -0300 Subject: [PATCH 0319/1050] Warn if list of objects is empty. --- autoload/rcomplete.vim | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/autoload/rcomplete.vim b/autoload/rcomplete.vim index 8debe94..9af32de 100644 --- a/autoload/rcomplete.vim +++ b/autoload/rcomplete.vim @@ -21,6 +21,10 @@ fun! rcomplete#CompleteR(findstart, base) return res endif + if len(g:rplugin_liblist) == 0 + call add(res, {'word': a:base, 'menu': "(List is empty. Run :RUpdateObjList)"}) + endif + let flines = g:rplugin_liblist + g:rplugin_globalenvlines " The char '$' at the end of 'a:base' is treated as end of line, and " the pattern is never found in 'line'. From 5302cad97862a0bf3a26279b0147a272d818a3d0 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Fri, 5 Oct 2012 21:28:13 -0300 Subject: [PATCH 0320/1050] Look for soffice.exe on Windows. --- ftplugin/rmd.vim | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/ftplugin/rmd.vim b/ftplugin/rmd.vim index 5307b01..667670a 100644 --- a/ftplugin/rmd.vim +++ b/ftplugin/rmd.vim @@ -109,13 +109,18 @@ function! RMakeHTMLrmd(t) let rcmd = 'require(knitr); knit2html("' . expand("%:t") . '", options = "")' if a:t == "odt" if g:rplugin_has_soffice == 0 - if executable("soffice") + if has("win32") || has("win64") + let soffbin = "soffice.exe" + else + let soffbin = "soffice" + endif + if executable(soffbin) let g:rplugin_has_soffice = 1 else - call RWarningMsg("Is Libre Office installed? Cannot convert into ODT: 'soffice' not found.") + call RWarningMsg("Is Libre Office installed? Cannot convert into ODT: '" . soffbin . "' not found.") endif endif - let rcmd = rcmd . '; system("soffice --invisible --convert-to odt ' . expand("%:r:t") . '.html")' + let rcmd = rcmd . '; system("' . soffbin . ' --invisible --convert-to odt ' . expand("%:r:t") . '.html")' endif if g:vimrplugin_openhtml && a:t == "html" let rcmd = rcmd . '; browseURL("' . expand("%:r:t") . '.html")' From a0612ce538b5d696634d6f65ea1cf05fdb2cb4a7 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Fri, 5 Oct 2012 21:50:37 -0300 Subject: [PATCH 0321/1050] Add r-plugin/objlist/README. --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 0b630ba..980c83c 100644 --- a/Makefile +++ b/Makefile @@ -53,8 +53,8 @@ zip: r-plugin/objlist/omnils_base r-plugin/objlist/omnils_colorout \ r-plugin/objlist/omnils_datasets r-plugin/objlist/omnils_graphics \ r-plugin/objlist/omnils_grDevices r-plugin/objlist/omnils_methods \ - r-plugin/objlist/omnils_setwidth r-plugin/objlist/omnils_stats \ - r-plugin/objlist/omnils_utils r-plugin/objlist/omnils_vimcom \ + r-plugin/objlist/omnils_stats r-plugin/objlist/omnils_utils \ + r-plugin/objlist/omnils_vimcom r-plugin/objlist/README \ r-plugin/vimActivate.js r-plugin/tex_indent.vim r-plugin/r.snippets \ r-plugin/common_buffer.vim r-plugin/common_global.vim \ bitmaps/ricon.xbm bitmaps/ricon.png \ From 778af66b6284590fe6fde54cdd27a5742e444055 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 6 Oct 2012 20:26:33 -0300 Subject: [PATCH 0322/1050] Get correct key if cursor in the middle of string. --- r-plugin/common_global.vim | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 6d44ee0..16ccc24 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -109,7 +109,7 @@ function! CompleteChunkOptions() let cpos = getpos(".") let idx1 = cpos[2] - 2 let idx2 = cpos[2] - 1 - while cline[idx1] =~ '\w' + while cline[idx1] =~ '\w' || cline[idx1] == '.' || cline[idx1] == '_' let idx1 -= 1 endwhile let idx1 += 1 @@ -158,7 +158,12 @@ function RCompleteArgs() let idx2 = cpos[2] let argkey = '' else - let argkey = RGetKeyWord() + let idx1 = idx2 + while line[idx1] =~ '\w' || line[idx1] == '.' || line[idx1] == '_' + let idx1 -= 1 + endwhile + let idx1 += 1 + let argkey = strpart(line, idx1, idx2 - idx1 + 1) let idx2 = cpos[2] - strlen(argkey) endif if b:needsnewomnilist == 1 @@ -1755,8 +1760,6 @@ function RFillLibList() for omf in dirls let g:rplugin_liblist = g:rplugin_liblist + readfile(omf) endfor - else - call RWarningMsg('"'. g:rplugin_uservimfiles . "r-plugin/objlist" . '" is not a directory.') endif endfunction From 5a3a64e4559e31c589354e1c72a483c55c4b4038 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 6 Oct 2012 20:29:10 -0300 Subject: [PATCH 0323/1050] Use square brackets instead of parentheses. --- autoload/rcomplete.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autoload/rcomplete.vim b/autoload/rcomplete.vim index 9af32de..66f3172 100644 --- a/autoload/rcomplete.vim +++ b/autoload/rcomplete.vim @@ -22,7 +22,7 @@ fun! rcomplete#CompleteR(findstart, base) endif if len(g:rplugin_liblist) == 0 - call add(res, {'word': a:base, 'menu': "(List is empty. Run :RUpdateObjList)"}) + call add(res, {'word': a:base, 'menu': " [ List is empty. Run :RUpdateObjList ]"}) endif let flines = g:rplugin_liblist + g:rplugin_globalenvlines From 9470f754ee120723528f07f7bcf1c9dc59702d53 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 6 Oct 2012 21:37:24 -0300 Subject: [PATCH 0324/1050] Don't return 'INVALID' as function argument. --- r-plugin/common_global.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 16ccc24..89b375b 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -190,7 +190,7 @@ function RCompleteArgs() else exe 'Py SendToR("vimcom:::vim.args(' . "'" . rkeyword0 . "', '" . argkey . "', classfor = " . classfor . ")" . '")' endif - if g:rplugin_vimcomport > 0 && g:rplugin_lastrpl != "NOT_EXISTS" && g:rplugin_lastrpl != "NO_ARGS" && g:rplugin_lastrpl != "R is busy." && g:rplugin_lastrpl != "NOANSWER" + if g:rplugin_vimcomport > 0 && g:rplugin_lastrpl != "NOT_EXISTS" && g:rplugin_lastrpl != "NO_ARGS" && g:rplugin_lastrpl != "R is busy." && g:rplugin_lastrpl != "NOANSWER" && g:rplugin_lastrpl != "INVALID" let args = [] let tmp0 = split(g:rplugin_lastrpl, "\x04") let tmp = split(tmp0[0], "\x09") From 15c19c25f984d5f3249512418b85aa96a81b96fd Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 6 Oct 2012 22:50:50 -0300 Subject: [PATCH 0325/1050] Don't send backslash as part of "classfor" object. --- r-plugin/common_global.vim | 2 ++ 1 file changed, 2 insertions(+) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 89b375b..c4c95bd 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -182,6 +182,7 @@ function RCompleteArgs() call cursor(lnum, idx) let rkeyword0 = RGetKeyWord() let classfor = RGetClassFor(rkeyword0) + let classfor = substitute(classfor, '\\', "", "g") let classfor = substitute(classfor, '"', '\\"', "g") let rkeyword = '^' . rkeyword0 . "\x06" call cursor(cpos[1], cpos[2]) @@ -1971,6 +1972,7 @@ function ShowRDoc(rkeyword, package, getclass) elseif a:package != "" exe 'Py SendToR("vim.help(' . "'" . a:rkeyword . "', " . g:rplugin_htw . "L, package='" . a:package . "')". '")' else + let classfor = substitute(classfor, '\\', "", "g") let classfor = substitute(classfor, '"', '\\"', "g") exe 'Py SendToR("vim.help(' . "'" . a:rkeyword . "', " . g:rplugin_htw . "L, " . classfor . ")". '")' endif From 127452acd133424d309bf2f0ef467d86119c6326 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 6 Oct 2012 23:25:24 -0300 Subject: [PATCH 0326/1050] Don't try to complete if arguments list is empty. --- r-plugin/common_global.vim | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index c4c95bd..5b37bcb 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -191,8 +191,11 @@ function RCompleteArgs() else exe 'Py SendToR("vimcom:::vim.args(' . "'" . rkeyword0 . "', '" . argkey . "', classfor = " . classfor . ")" . '")' endif - if g:rplugin_vimcomport > 0 && g:rplugin_lastrpl != "NOT_EXISTS" && g:rplugin_lastrpl != "NO_ARGS" && g:rplugin_lastrpl != "R is busy." && g:rplugin_lastrpl != "NOANSWER" && g:rplugin_lastrpl != "INVALID" + if g:rplugin_vimcomport > 0 && g:rplugin_lastrpl != "NOT_EXISTS" && g:rplugin_lastrpl != "NO_ARGS" && g:rplugin_lastrpl != "R is busy." && g:rplugin_lastrpl != "NOANSWER" && g:rplugin_lastrpl != "INVALID" && g:rplugin_lastrpl != "" let args = [] + if g:rplugin_lastrpl[0] == "\x04" && len(split(g:rplugin_lastrpl, "\x04")) == 1 + return '' + endif let tmp0 = split(g:rplugin_lastrpl, "\x04") let tmp = split(tmp0[0], "\x09") if(len(tmp) > 0) @@ -220,6 +223,9 @@ function RCompleteArgs() for omniL in flines if omniL =~ rkeyword && omniL =~ "\x06function\x06function\x06" let tmp1 = split(omniL, "\x06") + if len(tmp1) < 5 + return '' + endif let info = tmp1[4] let argsL = split(info, "\x09") let args = [] From 987db15814cec551d6a879b71d123db853a404ec Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sun, 7 Oct 2012 22:11:00 -0300 Subject: [PATCH 0327/1050] Don't add %string% to list of functions. --- r-plugin/common_global.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 5b37bcb..a717d79 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -1785,7 +1785,7 @@ function RBuildSyntaxFile(...) let funlist = "" for line in g:rplugin_liblist let obj = split(line, "\x06", 1) - if obj[2] == "function" + if obj[2] == "function" && obj[0] !~ '%' if obj[0] !~ '[[:punct:]]' || (obj[0] =~ '\.[a-zA-Z]' && obj[0] !~ '[[:punct:]][[:punct:]]') let nf += 1 let funlist = funlist . " " . obj[0] From 5e6225ffcf82326b176d0bbe3c4900e1f32a49a0 Mon Sep 17 00:00:00 2001 From: NagatoPain Date: Wed, 10 Oct 2012 11:03:06 +0800 Subject: [PATCH 0328/1050] improve regex match pattern and match function --- autoload/rcomplete.vim | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/autoload/rcomplete.vim b/autoload/rcomplete.vim index 66f3172..1a203c0 100644 --- a/autoload/rcomplete.vim +++ b/autoload/rcomplete.vim @@ -5,13 +5,7 @@ fun! rcomplete#CompleteR(findstart, base) if a:findstart - " locate the start of the word - let line = getline('.') - let start = col('.') - 1 - while start > 0 && (line[start - 1] =~ '\a' || line[start - 1] =~ '\.' || line[start - 1] =~ '\$' || line[start - 1] =~ '\d') - let start -= 1 - endwhile - return start + return match(getline('.'), '[[:alnum:].\\]\+$') else if b:needsnewomnilist == 1 call BuildROmniList("GlobalEnv", "none") From 0f31ae1d275b2182e429c5d3c53757b733283760 Mon Sep 17 00:00:00 2001 From: NagatoPain Date: Wed, 10 Oct 2012 12:35:03 +0800 Subject: [PATCH 0329/1050] improve match pattern again --- autoload/rcomplete.vim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/autoload/rcomplete.vim b/autoload/rcomplete.vim index 1a203c0..0469121 100644 --- a/autoload/rcomplete.vim +++ b/autoload/rcomplete.vim @@ -5,7 +5,8 @@ fun! rcomplete#CompleteR(findstart, base) if a:findstart - return match(getline('.'), '[[:alnum:].\\]\+$') + return match(getline('.')[: (col('.') - 1)], '[[:alnum:].\\]\+$') + " return match(getline('.')[: (col('.') - 1)], '[^[:alnum:].$][[:alnum:].$]*$') else if b:needsnewomnilist == 1 call BuildROmniList("GlobalEnv", "none") From cd54556041bd3b75b6eb16c8c3ddf11a3e5b1da3 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Wed, 10 Oct 2012 07:09:01 -0300 Subject: [PATCH 0330/1050] Get correct start of 'base' string. --- autoload/rcomplete.vim | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/autoload/rcomplete.vim b/autoload/rcomplete.vim index 0469121..da443d6 100644 --- a/autoload/rcomplete.vim +++ b/autoload/rcomplete.vim @@ -5,8 +5,7 @@ fun! rcomplete#CompleteR(findstart, base) if a:findstart - return match(getline('.')[: (col('.') - 1)], '[[:alnum:].\\]\+$') - " return match(getline('.')[: (col('.') - 1)], '[^[:alnum:].$][[:alnum:].$]*$') + return match(getline('.')[: (col('.') - 2)], '[[:alnum:].\\]\+$') else if b:needsnewomnilist == 1 call BuildROmniList("GlobalEnv", "none") From 392bb36a3a5b8f3248be4d909cc5632d72343f3d Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Wed, 10 Oct 2012 08:04:05 -0300 Subject: [PATCH 0331/1050] Begin integration with LaTeX-Box plugin. --- autoload/rcomplete.vim | 4 ++++ ftplugin/rnoweb.vim | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/autoload/rcomplete.vim b/autoload/rcomplete.vim index da443d6..f7ebbdc 100644 --- a/autoload/rcomplete.vim +++ b/autoload/rcomplete.vim @@ -4,6 +4,10 @@ " fun! rcomplete#CompleteR(findstart, base) + if &filetype == "rnoweb" && RnwIsInRCode() == 0 && exists("*LatexBox_Complete") + let texbegin = LatexBox_Complete(a:findstart, a:base) + return texbegin + endif if a:findstart return match(getline('.')[: (col('.') - 2)], '[[:alnum:].\\]\+$') else diff --git a/ftplugin/rnoweb.vim b/ftplugin/rnoweb.vim index 87cb0af..b3d1ebb 100644 --- a/ftplugin/rnoweb.vim +++ b/ftplugin/rnoweb.vim @@ -30,8 +30,10 @@ let b:did_rnoweb_ftplugin = 1 let s:cpo_save = &cpo set cpo&vim -" Enables Vim-Latex-Suite if it is installed +" Enables Vim-Latex-Suite, LaTeX-Box if installed runtime ftplugin/tex_latexSuite.vim +runtime ftplugin/tex_LatexBox.vim +let b:main_tex_file = expand("%:p:r") . ".tex" " Enable syntax highlight of LaTeX errors in R Console (if using Conque " Shell) From daf3d6cb8a65df46cad80a0285994c77b2d71ce9 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Wed, 10 Oct 2012 09:07:52 -0300 Subject: [PATCH 0332/1050] Update. --- doc/r-plugin.txt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index cd571e3..42839f7 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -310,7 +310,9 @@ on the toolbar: You may be interested in installing additional general plugins to get functionality not provided by this file type plugin. ShowMarks and snipMate -are particularly interesting. Please read |r-plugin-tips| for details. +are particularly interesting. If you edit Rnoweb files, you may want to try +LaTeX-Box for omnicompletion of LaTeX code (the .tex file must already have +been compiled). Please read |r-plugin-tips| for details. ============================================================================== @@ -524,6 +526,7 @@ mode: 4.3. Omni completion and the highlighting of functions~ *:RUpdateObjList* + *:RAddLibToList* The plugin adds some features to the default syntax highlight of R code. One such feature is the highlight of R functions. However, only functions that R loads by default are highlighted. To add functions of other libraries, you @@ -2039,7 +2042,7 @@ the R syntax highlighted. *r-plugin-news* 10. News~ -0.9.8 (2012-10-04) +0.9.8 (2012-10-07) * Open PDF automatically after processing Rnoweb file if vimrplugin_openpdf = 1 (thanks to Tomaz Ficko for suggesting the feature). @@ -2056,8 +2059,10 @@ the R syntax highlighted. * For Rnoweb, Rmd and Rrst file types, CTRL-X CTRL-A completes knitr chunk options if the cursor is inside the chunk header. * New option: vimrplugin_rmhidden. + * New option: vimrplugin_insert_mode_cmds (thanks to Charles R. Hogg III). * New command :RAddLibToList to add the objects of specific libraries to omnicompletion. + * Thanks to genrich and NagatoPain for other bug fixes and code improvements. 0.9.7 (2012-05-04) From d0e7270f04dc6fddc7d2fbc5ebfe5314694ec695 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Wed, 10 Oct 2012 11:52:01 -0300 Subject: [PATCH 0333/1050] Do omnicompletion even if there is no .tex file. --- ftplugin/rnoweb.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ftplugin/rnoweb.vim b/ftplugin/rnoweb.vim index b3d1ebb..bebab02 100644 --- a/ftplugin/rnoweb.vim +++ b/ftplugin/rnoweb.vim @@ -33,7 +33,7 @@ set cpo&vim " Enables Vim-Latex-Suite, LaTeX-Box if installed runtime ftplugin/tex_latexSuite.vim runtime ftplugin/tex_LatexBox.vim -let b:main_tex_file = expand("%:p:r") . ".tex" +let b:main_tex_file = expand("%:p") " Enable syntax highlight of LaTeX errors in R Console (if using Conque " Shell) From c303607f82f994988302c7d7ef4ca564c8e8fd9c Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 11 Oct 2012 10:13:27 -0300 Subject: [PATCH 0334/1050] New option: vimrplugin_assign_map. The option vimrplugin_underscore was renamed to vimrplugin_assign. --- doc/r-plugin.txt | 28 ++++++++++++++++++++-------- r-plugin/common_global.vim | 35 +++++++++++++++++++++-------------- 2 files changed, 41 insertions(+), 22 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 42839f7..d99bf03 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -310,9 +310,9 @@ on the toolbar: You may be interested in installing additional general plugins to get functionality not provided by this file type plugin. ShowMarks and snipMate -are particularly interesting. If you edit Rnoweb files, you may want to try -LaTeX-Box for omnicompletion of LaTeX code (the .tex file must already have -been compiled). Please read |r-plugin-tips| for details. +are particularly interesting. Please read |r-plugin-tips| for details. If you +edit Rnoweb files, you may want to try LaTeX-Box for omnicompletion of LaTeX +code. ============================================================================== @@ -465,7 +465,7 @@ syntax highlighting is off (see |:syn-on| and |:syn-off|). If necessary, it is possible to insert an actual underscore into your file by typing a second underscore. This behavior is similar to the EMACS ESS mode some users may be familiar with and is enabled by default. You have to change the value of -|vimrplugin_underscore| to disable underscore replacement. +|vimrplugin_assign| to disable underscore replacement. When you press rh, the plugin shows the help for the function under the cursor. The plugin also checks the class of the object passed as @@ -894,7 +894,8 @@ IPv6 one (fe80::1). |vimrplugin_term| External terminal to be used |vimrplugin_term_cmd| Complete command to open an external terminal -|vimrplugin_underscore| Convert '_' into ' <- ' +|vimrplugin_assign| Convert '_' into ' <- ' +|vimrplugin_assign_map| Choose what to convert into ' <- ' |vimrplugin_rnowebchunk| Convert '<' into '<<>>=\n@' in Rnoweb files |vimrplugin_objbr_place| Placement of Object Browser |vimrplugin_objbr_w| Initial width of Object Browser window @@ -969,14 +970,23 @@ Please, look at the manual of your terminal emulator to know how to call it. The last argument must be the one which precedes the command to be executed. -6.2. Underscore and Rnoweb completion of code block~ - *vimrplugin_underscore* +6.2. Assignment operator and Rnoweb completion of code block~ + *vimrplugin_assign* + *vimrplugin_assign_map* *vimrplugin_rnowebchunk* While editing R code, '_' is replaced with ' <- '. To disable this feature, put in your |vimrc|: > - let vimrplugin_underscore = 0 + let vimrplugin_assign = 0 < +If want to bind other keys to be replaced by ' <- ', set the value of +|vimrplugin_assign_map| in your |vimrc|, as in the example below which +emulates RStudio behavior (may only works on GVim): +> + let vimrplugin_assign_map = "" +< +Note: You can't map , as StatET does. + In Rnoweb files, a '<' is replaced with '<<>>=\n@'. To disable this feature, put in your |vimrc|: > @@ -2063,6 +2073,8 @@ the R syntax highlighted. * New command :RAddLibToList to add the objects of specific libraries to omnicompletion. * Thanks to genrich and NagatoPain for other bug fixes and code improvements. + * New option: vimrplugin_assign_map. The option vimrplugin_underscore was + renamed to vimrplugin_assign 0.9.7 (2012-05-04) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index a717d79..a3f1655 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -77,7 +77,7 @@ function ReplaceUnderS() else let j = col(".") let s = getline(".") - if j > 3 && s[j-3] == "<" && s[j-2] == "-" && s[j-1] == " " + if g:vimrplugin_assign_map == "_" && j > 3 && s[j-3] == "<" && s[j-2] == "-" && s[j-1] == " " exe "normal! 3h3xr_" return endif @@ -2527,15 +2527,15 @@ function MakeRMenu() " Edit "---------------------------------------------------------------------------- if &filetype == "r" || &filetype == "rnoweb" || &filetype == "rrst" || &filetype == "rhelp" || g:vimrplugin_never_unmake_menu - if g:vimrplugin_underscore == 1 - imenu R.Edit.Insert\ \"\ <-\ \"_ :call ReplaceUnderS()a - imenu R.Edit.Complete\ object\ name^X^O - if hasmapto("RCompleteArgs", "i") - let boundkey = RIMapCmd("RCompleteArgs") - exe "imenu R.Edit.Complete\\ function\\ arguments" . boundkey . " " . boundkey - else - imenu R.Edit.Complete\ function\ arguments^X^A - endif + if g:vimrplugin_assign == 1 + silent exe 'imenu R.Edit.Insert\ \"\ <-\ \"' . g:vimrplugin_assign_map . ' :call ReplaceUnderS()a' + endif + imenu R.Edit.Complete\ object\ name^X^O + if hasmapto("RCompleteArgs", "i") + let boundkey = RIMapCmd("RCompleteArgs") + exe "imenu R.Edit.Complete\\ function\\ arguments" . boundkey . " " . boundkey + else + imenu R.Edit.Complete\ function\ arguments^X^A endif menu R.Edit.-Sep71- nmenu R.Edit.Indent\ (line)== == @@ -2585,7 +2585,7 @@ function MakeRMenu() amenu R.Help\ (plugin).How\ the\ plugin\ works :help r-plugin-functioning amenu R.Help\ (plugin).Known\ bugs\ and\ workarounds :help r-plugin-known-bugs - amenu R.Help\ (plugin).Options.Underscore\ and\ Rnoweb\ code :help vimrplugin_underscore + amenu R.Help\ (plugin).Options.Assignment\ operator\ and\ Rnoweb\ code :help vimrplugin_assign amenu R.Help\ (plugin).Options.Object\ Browser :help vimrplugin_objbr_place amenu R.Help\ (plugin).Options.Vim\ as\ pager\ for\ R\ help :help vimrplugin_vimpager if !has("gui_win32") @@ -2738,8 +2738,8 @@ function RCreateEditMaps() call RCreateMaps("ni", 'RRightComment', ';', ':call MovePosRCodeComment("normal")') call RCreateMaps("v", 'RRightComment', ';', ':call MovePosRCodeComment("selection")') " Replace 'underline' with '<-' - if g:vimrplugin_underscore == 1 - imap _ :call ReplaceUnderS()a + if g:vimrplugin_assign == 1 + silent exe 'imap ' . g:vimrplugin_assign_map . ' :call ReplaceUnderS()a' endif if hasmapto("RCompleteArgs", "i") imap RCompleteArgs =RCompleteArgs() @@ -2886,11 +2886,17 @@ endif let g:rplugin_docfile = $VIMRPLUGIN_TMPDIR . "/Rdoc" let g:rplugin_globalenvfname = $VIMRPLUGIN_TMPDIR . "/GlobalEnvList" +" Old name of vimrplugin_assign option +if exists("g:vimrplugin_underscore") + let g:vimrplugin_assign = g:vimrplugin_underscore +endif + " Variables whose default value is fixed call RSetDefaultValue("g:vimrplugin_map_r", 0) call RSetDefaultValue("g:vimrplugin_allnames", 0) call RSetDefaultValue("g:vimrplugin_rmhidden", 1) -call RSetDefaultValue("g:vimrplugin_underscore", 1) +call RSetDefaultValue("g:vimrplugin_assign", 1) +call RSetDefaultValue("g:vimrplugin_assign_map", "'_'") call RSetDefaultValue("g:vimrplugin_rnowebchunk", 1) call RSetDefaultValue("g:vimrplugin_strict_rst", 1) call RSetDefaultValue("g:vimrplugin_openpdf", 0) @@ -2920,6 +2926,7 @@ call RSetDefaultValue("g:vimrplugin_latexcmd", "'pdflatex'") call RSetDefaultValue("g:vimrplugin_objbr_place", "'script,right'") call RSetDefaultValue("g:vimrplugin_insert_mode_cmds", 1) + " Look for invalid options let objbrplace = split(g:vimrplugin_objbr_place, ",") let obpllen = len(objbrplace) - 1 From e524d4bd6d037d4f39e56fb8b8a221a37abe0af7 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 11 Oct 2012 13:18:23 -0300 Subject: [PATCH 0335/1050] Update names for custom key bindings. --- doc/r-plugin.txt | 105 +++++++++++++++++++++++++++++++++++++---------- 1 file changed, 83 insertions(+), 22 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index d99bf03..915e153 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -1456,28 +1456,89 @@ The above example shows how to change key binding used to start R from Only the custom key bindings for Normal mode are shown in Vim's menu, but you can type |:map| to see the complete list of current mappings, and below is the -list of the names for custom key bindings: -> - RBibTeX RSendChunk RObjectNames - RClearAll RDSendChunk RObjectPr - RClearConsole RESendChunk RObjectStr - RClose REDSendChunk RPlot - RCommentLine RSendParagraph RSPlot - RCustomStart RDSendParagraph RSaveClose - RSendFunction RESendParagraph RSetwd - RDSendFunction REDSendParagraph RShowArgs - RESendFunction RSendSelection RShowEx - REDSendFunction RDSendSelection RShowRout - RSendLine RESendSelection RStart - RDSendLine REDSendSelection RSummary - RSendLAndOpenNewOne RSendFile RSweave - RSendMBlock RESendFile RUpdateObjBrowser - RDSendMBlock RHelp RVanillaStart - RESendMBlock RListSpace RCompleteArgs - REDSendMBlock RMakePDF -< -Note: The prefix RE means "echo"; RD, "cursor down"; RED, both "echo" and - "down". +list of the names for custom key bindings (the prefix RE means "echo"; +RD, "cursor down"; RED, both "echo" and "down"): + + Star/Close R~ + RStart + RVanillaStart + RCustomStart + RClose + RSaveClose + + Clear R console~ + RClearAll + RClearConsole + + Edit R code~ + RCommentLine + RRightComment + RCompleteArgs + RIndent + + Send line or part of it to R~ + RSendLine + RDSendLine + RSendLAndOpenNewOne + RNLeftPart + RNRightPart + RILeftPart + RIRightPart + + Send code to R console~ + RSendSelection + RESendSelection + RDSendSelection + REDSendSelection + RSendMBlock + RESendMBlock + RDSendMBlock + REDSendMBlock + RSendParagraph + RESendParagraph + RDSendParagraph + REDSendParagraph + RSendFunction + RESendFunction + RDSendFunction + REDSendFunction + RSendFile + RESendFile + + Send command to R~ + RHelp + RPlot + RSPlot + RShowArgs + RShowEx + RShowRout + RObjectNames + RObjectPr + RObjectStr + RSetwd + RSummary + RListSpace + + Support to Rnoweb, Rmd, Rrst~ + RSendChunk + RDSendChunk + RESendChunk + REDSendChunk + RBibTeX + RBibTeXK + RSweave + RKnit + RMakeHTML + RMakeODT + RMakePDF + RMakePDFK + ROpenPDF + RSpinFile + + Object browser~ + RUpdateObjBrowser + ROpenLists + RCloseLists The completion of function arguments only happens in Insert mode. To customize its keybind you should put in your |vimrc| something as in the example: From 001c265dbd1f9a7e5ffcd4d919b3dedb1862e336 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 11 Oct 2012 22:49:44 -0300 Subject: [PATCH 0336/1050] Add option to highlight R code in chunk header. --- syntax/rmd.vim | 10 ++++++++-- syntax/rrst.vim | 10 ++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/syntax/rmd.vim b/syntax/rmd.vim index f2e34f2..2d1d550 100644 --- a/syntax/rmd.vim +++ b/syntax/rmd.vim @@ -1,6 +1,6 @@ " markdown Text with R statements " Language: markdown with R code chunks -" Last Change: Mon Oct 01, 2012 03:34PM +" Last Change: Thu Oct 11, 2012 10:44PM " for portability if version < 600 @@ -27,7 +27,13 @@ syntax include @R syntax/r.vim if exists("b:current_syntax") unlet b:current_syntax endif -syntax match rmdChunkDelim "^```{r.*}$" contained +if exists("g:rmd_syn_hl_chunk") + " highlight R code inside chunk header + syntax match rmdChunkDelim "^```{r" contained + syntax match rmdChunkDelim "}$" contained +else + syntax match rmdChunkDelim "^```{r.*}$" contained +endif syntax match rmdChunkDelim "^```$" contained syntax region rmdChunk start="^``` *{r.*}$" end="^```$" contains=@R,rmdChunkDelim keepend transparent fold diff --git a/syntax/rrst.vim b/syntax/rrst.vim index 21d6c6e..ff841f7 100644 --- a/syntax/rrst.vim +++ b/syntax/rrst.vim @@ -1,7 +1,7 @@ " reStructured Text with R statements " Language: reST with R code chunks " Maintainer: Alex Zvoleff, azvoleff@mail.sdsu.edu -" Last Change: Mon Sep 24, 2012 09:05AM +" Last Change: Thu Oct 11, 2012 10:42PM " for portability if version < 600 @@ -18,7 +18,13 @@ unlet b:current_syntax syntax include @R syntax/r.vim " highlight R chunks -syntax match rrstChunkDelim "^\.\. {r .*}$" contained +if exists("g:rrst_syn_hl_chunk") + " highlight R code inside chunk header + syntax match rrstChunkDelim "^\.\. {r" contained + syntax match rrstChunkDelim "}$" contained +else + syntax match rrstChunkDelim "^\.\. {r .*}$" contained +endif syntax match rrstChunkDelim "^\.\. \.\.$" contained syntax region rrstChunk start="^\.\. {r.*}$" end="^\.\. \.\.$" contains=@R,rrstChunkDelim keepend transparent fold From 7127f1926b7883a68bc39dd3a7b46e30b36f63c3 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 11 Oct 2012 22:54:46 -0300 Subject: [PATCH 0337/1050] Don't carry indent down to closing line of chunk. Thanks to Alex Zvoleff for finding and fixing the bug. --- indent/rmd.vim | 4 ++-- indent/rrst.vim | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/indent/rmd.vim b/indent/rmd.vim index 307655e..a86ba1c 100644 --- a/indent/rmd.vim +++ b/indent/rmd.vim @@ -2,7 +2,7 @@ " Language: Rmd " Author: Jakson Alves de Aquino " URL: http://www.vim.org/scripts/script.php?script_id=2628 -" Last Change: Sun Sep 23, 2012 08:04PM +" Last Change: Thu Oct 11, 2012 10:54PM " Only load this indent file when no other was loaded. @@ -36,7 +36,7 @@ function GetMdIndent() endfunction function GetRmdIndent() - if getline(".") =~ '^```{r .*}$' + if getline(".") =~ '^```{r .*}$' || getline(".") =~ '^```$' return 0 endif if search('^```{r', "bncW") > search('^```$', "bncW") diff --git a/indent/rrst.vim b/indent/rrst.vim index 5912a5f..12c4e62 100644 --- a/indent/rrst.vim +++ b/indent/rrst.vim @@ -2,7 +2,7 @@ " Language: Rrst " Author: Jakson Alves de Aquino " URL: http://www.vim.org/scripts/script.php?script_id=2628 -" Last Change: Sun Sep 23, 2012 08:18PM +" Last Change: Thu Oct 11, 2012 10:52PM " Only load this indent file when no other was loaded. @@ -36,7 +36,7 @@ function GetRstIndent() endfunction function GetRrstIndent() - if getline(".") =~ '^\.\. {r .*}$' + if getline(".") =~ '^\.\. {r .*}$' || getline(".") =~ '^\.\. \.\.$' return 0 endif if search('^\.\. {r', "bncW") > search('^\.\. \.\.$', "bncW") From b48b60598169c67c26f3353c73662c756aeb6db9 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 13 Oct 2012 07:38:49 -0300 Subject: [PATCH 0338/1050] Document chunk highlighting options. --- doc/r-plugin.txt | 37 ++++++++++++++++++++++++------------- syntax/rmd.vim | 6 +++++- syntax/rrst.vim | 6 +++++- 3 files changed, 34 insertions(+), 15 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 915e153..0293920 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -1831,7 +1831,18 @@ line where the statement immediately above started. Of course someone may develop a better algorithm in the future. -9.10. Automatically close parenthesis~ +9.10. Highlight chunk header as R code~ + +By default, Vim will highlight chunk headers of RMarkdown and +RreStructuredText with a single color. When the code is processed by knitr, +chunk headers should contain valid R code and, thus, you may want to highlight +them as such. You can do this by putting in your |vimrc|: +> + let rrst_syn_hl_chunk = 1 + let rmd_syn_hl_chunk = 1 +< + +9.11. Automatically close parenthesis~ Some people want Vim automatically inserting a closing parenthesis, bracket or brace when an open one has being typed. The page below explains how to achieve @@ -1840,7 +1851,7 @@ this goal: http://vim.wikia.com/wiki/Automatically_append_closing_characters -9.11. Automatic line breaks~ +9.12. Automatic line breaks~ By default, Vim breaks lines when you are typing if you reach the column defined by the 'textwidth' option. If you prefer that Vim does not break the R @@ -1849,7 +1860,7 @@ code automatically, breaking only comment lines, put in your |vimrc|: autocmd FileType r setlocal formatoptions=cq < -9.12. Vim with 256 colors in a terminal emulator (Linux/Unix only)~ +9.13. Vim with 256 colors in a terminal emulator (Linux/Unix only)~ If you want 256 colors support in Vim, install the package ncurses-term. Then put in your ~/.bashrc: @@ -1876,7 +1887,7 @@ download and copy them to ~/.vim/colors. You may use the command |:colorscheme| to try them all before setting your preference in your |vimrc|. -9.13. Run your Makefile from within R~ +9.14. Run your Makefile from within R~ Do you have many Rnoweb files included in a master tex or Rnoweb file and use a Makefile to build the pdf? You may consider it useful to put the following @@ -1885,7 +1896,7 @@ line in your |vimrc|: nmap sm :update:call SendCmdToR('system("make")') < -9.14. Group windows with compiz~ +9.15. Group windows with compiz~ If you are using Compiz, it may be easier to work with the plugin if the various related windows (editor, terminal, and graphics window) are grouped @@ -1894,7 +1905,7 @@ You may need CompizConfig Settings Manager installed to enable this feature (look at the "Window Management" section for "Group and Tab Windows"). -9.15. Why do I have to updated the Object Browser manually?~ +9.16. Why do I have to updated the Object Browser manually?~ It is because Vim and R run as separate processes and, thus, it is not possible to Vim to know whether R is busy or not. If R was running as part of @@ -1906,7 +1917,7 @@ the Vim-R-plugin did this, the use of Vim would be blocked until R finished its processing. -9.16. Edit your ~/.Rprofile~ +9.17. Edit your ~/.Rprofile~ You may want to edit your ~/.Rprofile. Two common options are the use of GVim as the text editor and the use of Vim as pager. Example for Linux with these @@ -1958,7 +1969,7 @@ An example for Windows: } < -9.17. Debugging R functions~ +9.18. Debugging R functions~ The Vim-R-Plugin does not have debugging facilities, but you may want to use the R package "debug": @@ -1978,7 +1989,7 @@ on top" or a similar option provided by your desktop manager. There is also the R package "edtdbg" which aims to integrate R debugging facilities with Vim. -9.18. Turn the R-plugin into a global plugin~ +9.19. Turn the R-plugin into a global plugin~ *r-plugin-global* The Vim-R-plugin is a file type plugin. If you want its functionality available for all file types, then go to your ~/.vim/plugin directory and @@ -1992,14 +2003,14 @@ On Windows, you probably will have to make a copy of the file to the ~/vimfiles/plugin directory. -9.19. Disable syntax highlight of R functions~ +9.20. Disable syntax highlight of R functions~ If you want to disable the syntax highlight of R functions edit the file ~/.vim/r-plugin/functions.vim and delete all lines, but do not delete the file. -9.20. Tips for knitr users~ +9.21. Tips for knitr users~ *knitr* If you are using knitr with option cache=TRUE, you may want from time to time to delete all objects in R workspace and all files in the cache directory. If @@ -2014,7 +2025,7 @@ them in your vimrc. For example will produce a german document with a table of contents. -9.21. Start Tmux and Vim at once~ +9.22. Start Tmux and Vim at once~ If you always prefer to run Tmux before running Vim you may want to put in your ~/.bashrc: @@ -2026,7 +2037,7 @@ Then you will be able to start Vim inside a Tmux session by typing: tvim filename.R < -9.22. Integration with the Conque Shell plugin~ +9.23. Integration with the Conque Shell plugin~ *r-plugin-conque* In addition to being integrated with the screen.vim plugin the Vim-R-plugin can also use the Conque Shell plugin, but the Conque Shell still has some diff --git a/syntax/rmd.vim b/syntax/rmd.vim index 2d1d550..92d661c 100644 --- a/syntax/rmd.vim +++ b/syntax/rmd.vim @@ -1,6 +1,10 @@ " markdown Text with R statements " Language: markdown with R code chunks -" Last Change: Thu Oct 11, 2012 10:44PM +" Last Change: Sat Oct 13, 2012 07:29AM +" +" CONFIGURATION: +" To highlight chunk headers as R code, put in your vimrc: +" let rmd_syn_hl_chunk = 1 " for portability if version < 600 diff --git a/syntax/rrst.vim b/syntax/rrst.vim index ff841f7..7ba6a50 100644 --- a/syntax/rrst.vim +++ b/syntax/rrst.vim @@ -1,7 +1,11 @@ " reStructured Text with R statements " Language: reST with R code chunks " Maintainer: Alex Zvoleff, azvoleff@mail.sdsu.edu -" Last Change: Thu Oct 11, 2012 10:42PM +" Last Change: Sat Oct 13, 2012 07:28AM +" +" CONFIGURATION: +" To highlight chunk headers as R code, put in your vimrc: +" let rrst_syn_hl_chunk = 1 " for portability if version < 600 From 6ccba0fb65125ebf1ed6f57b240705e1a8ca5340 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 13 Oct 2012 08:55:15 -0300 Subject: [PATCH 0339/1050] Warn if vimcom version is wrong. --- autoload/rcomplete.vim | 2 +- ftplugin/rmd.vim | 6 ++++++ ftplugin/rnoweb.vim | 6 ++++++ ftplugin/rrst.vim | 6 ++++++ r-plugin/common_global.vim | 6 ++++++ 5 files changed, 25 insertions(+), 1 deletion(-) diff --git a/autoload/rcomplete.vim b/autoload/rcomplete.vim index f7ebbdc..d9c9476 100644 --- a/autoload/rcomplete.vim +++ b/autoload/rcomplete.vim @@ -12,7 +12,7 @@ fun! rcomplete#CompleteR(findstart, base) return match(getline('.')[: (col('.') - 2)], '[[:alnum:].\\]\+$') else if b:needsnewomnilist == 1 - call BuildROmniList("GlobalEnv", "none") + call BuildROmniList("GlobalEnv", "") endif let res = [] if strlen(a:base) == 0 diff --git a/ftplugin/rmd.vim b/ftplugin/rmd.vim index 667670a..f1eb594 100644 --- a/ftplugin/rmd.vim +++ b/ftplugin/rmd.vim @@ -129,6 +129,12 @@ function! RMakeHTMLrmd(t) endfunction function! RMakePDFrmd(t) + if g:rplugin_vimcomport == 0 + exe "Py DiscoverVimComPort()" + if g:rplugin_vimcomport == 0 + return + endif + endif if g:rplugin_has_pandoc == 0 if executable("pandoc") let g:rplugin_has_pandoc = 1 diff --git a/ftplugin/rnoweb.vim b/ftplugin/rnoweb.vim index bebab02..8b167e0 100644 --- a/ftplugin/rnoweb.vim +++ b/ftplugin/rnoweb.vim @@ -111,6 +111,12 @@ endfunction " Sweave and compile the current buffer content function! RMakePDF(bibtex, knit) + if g:rplugin_vimcomport == 0 + exe "Py DiscoverVimComPort()" + if g:rplugin_vimcomport == 0 + return + endif + endif update call RSetWD() let pdfcmd = "vim.interlace.rnoweb('" . expand("%:t") . "'" diff --git a/ftplugin/rrst.vim b/ftplugin/rrst.vim index 58ea950..7b7d0c0 100644 --- a/ftplugin/rrst.vim +++ b/ftplugin/rrst.vim @@ -129,6 +129,12 @@ function! RMakeHTMLrrst(t) endfunction function! RMakePDFrrst() + if g:rplugin_vimcomport == 0 + exe "Py DiscoverVimComPort()" + if g:rplugin_vimcomport == 0 + return + endif + endif update call RSetWD() if g:rplugin_has_rst2pdf == 0 diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index a3f1655..540e48f 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -1771,6 +1771,12 @@ function RFillLibList() endfunction function RBuildSyntaxFile(...) + if g:rplugin_vimcomport == 0 + exe "Py DiscoverVimComPort()" + if g:rplugin_vimcomport == 0 + return + endif + endif if a:0 == 0 let packls = "" else From ea770a83815593684ee646313e8c33bb51ae7f29 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 13 Oct 2012 11:31:58 -0300 Subject: [PATCH 0340/1050] Version 0.9.8. --- doc/r-plugin.txt | 23 +++++++++++------------ ftplugin/r.vim | 2 +- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 0293920..9efeff3 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -129,11 +129,11 @@ following dependencies: Vim >= 7.3 with Python support. Tmux >= 1.5: http://tmux.sourceforge.net Screen plugin: http://www.vim.org/scripts/script.php?script_id=2711 - vimcom >= 0.9-3: An R package. + vimcom = 0.9-3: http://www.lepem.ufc.br/jaa/vimcom.html Suggests:~ ncurses-term: http://invisible-island.net/ncurses - colorout: An R package. + colorout: http://www.lepem.ufc.br/jaa/colorout.html setwidth: An R package. Note: Tmux and ncurses-term are already packaged for most GNU/Linux @@ -152,11 +152,11 @@ following dependencies: The colorout package colorizes the R output and the setwidth package adjusts the value of options("width") whenever the terminal is resized. - They can be installed from within R. The colorout package is available at - http://www.lepem.ufc.br/jaa/colorout.html while setwidth and vimcom can be - installed as usual: + They can be installed from within R. + + The setwidth package can be installed as usual: > - install.packages(c("vimcom", "setwidth")) + install.packages("setwidth") < You certainly will want to put something like the following at the end of your ~/.Rprofile: @@ -231,11 +231,10 @@ to install external dependencies: find the file that matches exactly the version of Python that you installed. - * vimcom >= 0.9-3: An R package. You can install it with the R command - install.packages("vimcom"). The vimcom package creates a server on R to - allow the communication with Vim. You certainly will want to put the - following lines at the end of your Rprofile (usually at - ~/Documents/.Rprofile): + * vimcom = 0.9-3: http://www.lepem.ufc.br/jaa/vimcom.html + The vimcom package creates a server on R to allow the communication with + Vim. You certainly will want to put the following lines at the end of + your Rprofile (usually at ~/Documents/.Rprofile): > if(interactive()){ library(vimcom) @@ -2124,7 +2123,7 @@ the R syntax highlighted. *r-plugin-news* 10. News~ -0.9.8 (2012-10-07) +0.9.8 (2012-10-13) * Open PDF automatically after processing Rnoweb file if vimrplugin_openpdf = 1 (thanks to Tomaz Ficko for suggesting the feature). diff --git a/ftplugin/r.vim b/ftplugin/r.vim index fc27a94..14fdde9 100644 --- a/ftplugin/r.vim +++ b/ftplugin/r.vim @@ -83,7 +83,7 @@ function! ShowRout() endif endfunction -" Convert R script into Rmd and, then, into md. +" Convert R script into Rmd, md and, then, html. function! RSpin() update let b:needsnewomnilist = 1 From 8535a148005e5cdd8bb6b4b82894eae4eed64d8e Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 18 Oct 2012 19:10:38 -0300 Subject: [PATCH 0341/1050] Don't look for terminal emulator if unnecessary. --- r-plugin/common_global.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 540e48f..f3f98fd 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -3229,7 +3229,7 @@ let s:all_marks = "abcdefghijklmnopqrstuvwxyz" call writefile([], g:rplugin_globalenvfname) " Choose a terminal (code adapted from screen.vim) -if has("win32") || has("win64") || vimrplugin_applescript +if has("win32") || has("win64") || g:vimrplugin_applescript || $DISPLAY == "" || g:vimrplugin_screenplugin " No external terminal emulator will be called, so any value is good let g:vimrplugin_term = "xterm" else From d924e510293797592b75192e0f45511158796a9b Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 27 Oct 2012 09:55:58 -0300 Subject: [PATCH 0342/1050] Go back to while loop. The match() function certainly is quicker but I couldn't make it match the dollar symbol, '$'. --- autoload/rcomplete.vim | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/autoload/rcomplete.vim b/autoload/rcomplete.vim index d9c9476..46c3da9 100644 --- a/autoload/rcomplete.vim +++ b/autoload/rcomplete.vim @@ -9,7 +9,12 @@ fun! rcomplete#CompleteR(findstart, base) return texbegin endif if a:findstart - return match(getline('.')[: (col('.') - 2)], '[[:alnum:].\\]\+$') + let line = getline('.') + let start = col('.') - 1 + while start > 0 && (line[start - 1] =~ '\w' || line[start - 1] =~ '\.' || line[start - 1] =~ '\$') + let start -= 1 + endwhile + return start else if b:needsnewomnilist == 1 call BuildROmniList("GlobalEnv", "") From 7a3ccea3d0cfd5c48c15f7ef88bd78e5386e9064 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Tue, 6 Nov 2012 11:17:01 -0300 Subject: [PATCH 0343/1050] Rudimentary integration with vimshell plugin. To try vimshell, install it and put in your vimrc: let vimrplugin_vimshell = 1 --- r-plugin/common_global.vim | 86 +++++++++++++++++++++++++------------- 1 file changed, 57 insertions(+), 29 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index f3f98fd..26ee734 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -584,12 +584,12 @@ function StartR(whatr) endif if has("win32") || has("win64") - if g:vimrplugin_conqueplugin == 0 + if g:vimrplugin_conqueplugin || g:vimrplugin_vimshell + let b:rplugin_R = "Rterm.exe" + else Py StartRPy() lcd - return - else - let b:rplugin_R = "Rterm.exe" endif endif @@ -628,6 +628,14 @@ function StartR(whatr) else exec 'ScreenShell ' . rcmd endif + elseif g:vimrplugin_vimshell + if has("win32") || has("win64") + exe "VimShellInteractive " . rcmd . " --ess" + else + exe "VimShellInteractive " . rcmd + endif + lcd - + return elseif g:vimrplugin_conqueplugin if exists("b:conque_bufname") if bufloaded(substitute(b:conque_bufname, "\\", "", "g")) @@ -1105,14 +1113,18 @@ function SendCmdToR(cmd) if (has("win32") || has("win64")) && g:vimrplugin_conqueplugin == 0 let cmd = cmd . "\n" - let slen = len(cmd) - let str = "" - for i in range(0, slen) - let str = str . printf("\\x%02X", char2nr(cmd[i])) - endfor - exe "Py" . " SendToRPy(b'" . str . "')" - silent exe '!start WScript "' . g:rplugin_jspath . '" "' . expand("%") . '"' - " call RestoreClipboardPy() + if g:vimrplugin_vimshell + exe "VimShellSendString " . cmd + else + let slen = len(cmd) + let str = "" + for i in range(0, slen) + let str = str . printf("\\x%02X", char2nr(cmd[i])) + endfor + exe "Py" . " SendToRPy(b'" . str . "')" + silent exe '!start WScript "' . g:rplugin_jspath . '" "' . expand("%") . '"' + " call RestoreClipboardPy() + endif return 1 endif @@ -1175,6 +1187,11 @@ function SendCmdToR(cmd) return 1 endif + if g:vimrplugin_vimshell + call vimshell#interactive#send(cmd) + return 1 + endif + if g:vimrplugin_applescript && g:vimrplugin_screenplugin == 0 && g:vimrplugin_conqueplugin == 0 if g:rplugin_r64app && g:vimrplugin_i386 == 0 let rcmd = "R64" @@ -2912,6 +2929,7 @@ call RSetDefaultValue("g:vimrplugin_i386", 0) call RSetDefaultValue("g:vimrplugin_screenvsplit", 0) call RSetDefaultValue("g:vimrplugin_conquevsplit", 0) call RSetDefaultValue("g:vimrplugin_conqueplugin", 0) +call RSetDefaultValue("g:vimrplugin_vimshell", 0) call RSetDefaultValue("g:vimrplugin_listmethods", 0) call RSetDefaultValue("g:vimrplugin_specialplot", 0) call RSetDefaultValue("g:vimrplugin_nosingler", 0) @@ -2932,6 +2950,14 @@ call RSetDefaultValue("g:vimrplugin_latexcmd", "'pdflatex'") call RSetDefaultValue("g:vimrplugin_objbr_place", "'script,right'") call RSetDefaultValue("g:vimrplugin_insert_mode_cmds", 1) +if g:vimrplugin_vimshell + if !exists("g:vimshell_environment_term") + let g:vimrplugin_vimshell = 0 + endif + let g:vimrplugin_screenplugin = 0 + let g:vimrplugin_conqueplugin = 0 + let g:vimrplugin_applescript = 0 +endif " Look for invalid options let objbrplace = split(g:vimrplugin_objbr_place, ",") @@ -3094,7 +3120,7 @@ let g:rplugin_globalenvlines = [] if has("win32") || has("win64") - if !has("python") && !has("python3") + if !has("python") && !has("python3") && g:vimrplugin_vimshell == 0 redir => s:vimversion silent version redir END @@ -3134,27 +3160,29 @@ if has("win32") || has("win64") let g:rplugin_Rgui = g:vimrplugin_r_path . "\\Rgui.exe" else Py GetRPathPy() - if s:rinstallpath == "Not found" - call RWarningMsgInp("Could not find R path in Windows Registry. Please, either install R or set the value of 'vimrplugin_r_path'.") - let g:rplugin_failed = 1 - finish - endif - if isdirectory(s:rinstallpath . '\bin\i386') - if !isdirectory(s:rinstallpath . '\bin\x64') - let g:vimrplugin_i386 = 1 + if exists("s:rinstallpath") + if s:rinstallpath == "Not found" + call RWarningMsgInp("Could not find R path in Windows Registry. Please, either install R or set the value of 'vimrplugin_r_path'.") + let g:rplugin_failed = 1 + finish endif - if g:vimrplugin_i386 - let $PATH = s:rinstallpath . '\bin\i386;' . $PATH - let g:rplugin_Rgui = s:rinstallpath . '\bin\i386\Rgui.exe' + if isdirectory(s:rinstallpath . '\bin\i386') + if !isdirectory(s:rinstallpath . '\bin\x64') + let g:vimrplugin_i386 = 1 + endif + if g:vimrplugin_i386 + let $PATH = s:rinstallpath . '\bin\i386;' . $PATH + let g:rplugin_Rgui = s:rinstallpath . '\bin\i386\Rgui.exe' + else + let $PATH = s:rinstallpath . '\bin\x64;' . $PATH + let g:rplugin_Rgui = s:rinstallpath . '\bin\x64\Rgui.exe' + endif else - let $PATH = s:rinstallpath . '\bin\x64;' . $PATH - let g:rplugin_Rgui = s:rinstallpath . '\bin\x64\Rgui.exe' + let $PATH = s:rinstallpath . '\bin;' . $PATH + let g:rplugin_Rgui = s:rinstallpath . '\bin\Rgui.exe' endif - else - let $PATH = s:rinstallpath . '\bin;' . $PATH - let g:rplugin_Rgui = s:rinstallpath . '\bin\Rgui.exe' + unlet s:rinstallpath endif - unlet s:rinstallpath endif let g:rplugin_rpathadded = 1 endif From 3c29b52b5463bdf0c5aabc6067ea4d261b482976 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Tue, 6 Nov 2012 23:21:21 -0300 Subject: [PATCH 0344/1050] Increase version number to 0.9.9. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 980c83c..ed55310 100644 --- a/Makefile +++ b/Makefile @@ -29,7 +29,7 @@ PLUGINHOME=`pwd` -PLUGINVERSION=0.9.8 +PLUGINVERSION=0.9.9 DEBIANTIME=`date -R` PLUGINRELEASEDATE=`date +"%Y-%m-%d"` VIM2HTML=/usr/local/share/vim/vim73/doc/vim2html.pl From 8932db2b376bf981b20e0dd85f5a15ca15b558bf Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Tue, 6 Nov 2012 23:22:33 -0300 Subject: [PATCH 0345/1050] New command: :Rinsert. --- doc/r-plugin.txt | 15 ++++++++++++++- r-plugin/common_global.vim | 6 ++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 9efeff3..b768be4 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -5,7 +5,7 @@ Authors: Jakson A. Aquino Jose Claudio Faria -Version: 0.9.8 +Version: 0.9.9 For Vim version 7.3 1. Overview |r-plugin-overview| @@ -420,6 +420,7 @@ Edit . Insert "<-" _ . Complete object name ^X^O . Complete function arguments ^X^A + . Insert output of R command :Rinsert -------------------------------------------------------- . Indent (line) == . Indent (selected lines) = @@ -510,6 +511,14 @@ completion is the same one built by |:RUpdateObjList|. You can source all .R files in a directory with the Normal mode command :RSourceDir, which accepts an optional argument (the directory to be sourced). +The command :Rinsert inserts one or more lines with the output of the +R command sent to R. By using this command we can avoid the need of copying +and pasting the output R from its console to Vim. For example, to insert the +output of "dput(levels(var))", where "var" is a factor vector, we could do in +Vim: +> + :Rinsert dput(levels(var)) +< 4.2. Edition of rnoweb files~ @@ -2123,6 +2132,10 @@ the R syntax highlighted. *r-plugin-news* 10. News~ +0.9.9 (2012-11-06) + + * New command: :Rinsert. + 0.9.8 (2012-10-13) * Open PDF automatically after processing Rnoweb file if diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 26ee734..6e78fa8 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -1102,6 +1102,11 @@ function RGetRemoteCmd(cmd) echon endfunction +function RInsert(cmd) + exe "Py SendToR('paste(capture.output(" . a:cmd . "), collapse = \"\\\\n\")')" + call append(".", split(g:rplugin_lastrpl, "\n")) +endfunction + " Function to send commands " return 0 on failure and 1 on success function SendCmdToR(cmd) @@ -2851,6 +2856,7 @@ endfunction command RUpdateObjList :call RBuildSyntaxFile() command -nargs=+ RAddLibToList :call RBuildSyntaxFile() +command -nargs=1 Rinsert :call RInsert() command RBuildTags :call SendCmdToR('rtags(ofile = "TAGS")') command -nargs=? -complete=customlist,RLisObjs Rhelp :call RAskHelp() command -nargs=? -complete=dir RSourceDir :call RSourceDirectory() From 721be6660f5d3b06b473be72384fe011bf7b57f4 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Tue, 6 Nov 2012 23:36:11 -0300 Subject: [PATCH 0346/1050] Increase buffer size. --- r-plugin/vimcom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/r-plugin/vimcom.py b/r-plugin/vimcom.py index aa77688..c3b3d9d 100644 --- a/r-plugin/vimcom.py +++ b/r-plugin/vimcom.py @@ -60,7 +60,7 @@ def SendToR(aString): try: sock.connect((HOST, VimComPort)) sock.send(aString) - received = sock.recv(1024) + received = sock.recv(5012) except: pass finally: From c66172aefdce4790362db826d9ea32829e792bcf Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Wed, 7 Nov 2012 07:06:38 -0300 Subject: [PATCH 0347/1050] Don't insert error messages. --- r-plugin/common_global.vim | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 6e78fa8..adbe489 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -1104,7 +1104,11 @@ endfunction function RInsert(cmd) exe "Py SendToR('paste(capture.output(" . a:cmd . "), collapse = \"\\\\n\")')" - call append(".", split(g:rplugin_lastrpl, "\n")) + if g:rplugin_lastrpl == "R is busy." || g:rplugin_lastrpl == "UNKNOWN" || g:rplugin_lastrpl =~ "^Error" || g:rplugin_lastrpl == "INVALID" || g:rplugin_lastrpl == "ERROR" || g:rplugin_lastrpl == "EMPTY" || g:rplugin_lastrpl == "RTYPE" + call RWarningMsg(g:rplugin_lastrpl) + else + call append(".", split(g:rplugin_lastrpl, "\n")) + endif endfunction " Function to send commands From 3d847cd13cd8356293d1503ca8a96ce70cf36a45 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Wed, 7 Nov 2012 12:24:28 -0300 Subject: [PATCH 0348/1050] New command :Rformat. --- doc/r-plugin.txt | 15 ++++++++++++--- r-plugin/common_global.vim | 37 ++++++++++++++++++++++++++++++++++++- r-plugin/vimcom.py | 3 ++- 3 files changed, 50 insertions(+), 5 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index b768be4..f4b7a46 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -280,6 +280,8 @@ you may prefer to install the Debian package available at: http://www.lepem.ufc.br/jaa/vim-r-plugin.html +Did you see the message "VimCom port not found"? This means that R is not +running, the vimcom package is not installed, or R was not started by Vim. 3.4. General instructions II (optional steps)~ @@ -420,7 +422,6 @@ Edit . Insert "<-" _ . Complete object name ^X^O . Complete function arguments ^X^A - . Insert output of R command :Rinsert -------------------------------------------------------- . Indent (line) == . Indent (selected lines) = @@ -519,6 +520,14 @@ Vim: > :Rinsert dput(levels(var)) < +The output inserted by :Rinsert is limited to 5012 characters. + +The command :Rformat call the function tidy.source() of formatR package to +format either the entire buffer or the selected lines. The value of the +"width.cutoff" argument is set to the buffer's 'textwidth' if it is not +outside the range 20-180. Se R help on "tidy.source" for details on how to +control the function behavior. + 4.2. Edition of rnoweb files~ @@ -2132,9 +2141,9 @@ the R syntax highlighted. *r-plugin-news* 10. News~ -0.9.9 (2012-11-06) +0.9.9 (2012-11-07) - * New command: :Rinsert. + * New commands: :Rinsert and :Rformat. 0.9.8 (2012-10-13) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index adbe489..26f9d56 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -1102,7 +1102,41 @@ function RGetRemoteCmd(cmd) echon endfunction +function RFormatCode() range + if g:rplugin_vimcomport == 0 + exe "Py DiscoverVimComPort()" + if g:rplugin_vimcomport == 0 + return + endif + endif + let lns = getline(a:firstline, a:lastline) + call writefile(lns, $VIMRPLUGIN_TMPDIR . "/unformatted_code") + let wco = &textwidth + if wco == 0 + let wco = 78 + elseif wco < 20 + let wco = 20 + elseif wco > 180 + let wco = 180 + endif + exe "Py SendToR('formatR::tidy.source(\"" . $VIMRPLUGIN_TMPDIR . "/unformatted_code" . "\", file = \"" . $VIMRPLUGIN_TMPDIR . "/formatted_code\", width.cutoff = " . wco . ")')" + if g:rplugin_lastrpl == "R is busy." || g:rplugin_lastrpl == "UNKNOWN" || g:rplugin_lastrpl =~ "^Error" || g:rplugin_lastrpl == "INVALID" || g:rplugin_lastrpl == "ERROR" || g:rplugin_lastrpl == "EMPTY" + call RWarningMsg(g:rplugin_lastrpl) + return + endif + let lns = readfile($VIMRPLUGIN_TMPDIR . "/formatted_code") + silent exe a:firstline . "," . a:lastline . "delete" + call append(a:firstline - 1, lns) + echo (a:lastline - a:firstline + 1) . " lines formatted." +endfunction + function RInsert(cmd) + if g:rplugin_vimcomport == 0 + exe "Py DiscoverVimComPort()" + if g:rplugin_vimcomport == 0 + return + endif + endif exe "Py SendToR('paste(capture.output(" . a:cmd . "), collapse = \"\\\\n\")')" if g:rplugin_lastrpl == "R is busy." || g:rplugin_lastrpl == "UNKNOWN" || g:rplugin_lastrpl =~ "^Error" || g:rplugin_lastrpl == "INVALID" || g:rplugin_lastrpl == "ERROR" || g:rplugin_lastrpl == "EMPTY" || g:rplugin_lastrpl == "RTYPE" call RWarningMsg(g:rplugin_lastrpl) @@ -2860,7 +2894,8 @@ endfunction command RUpdateObjList :call RBuildSyntaxFile() command -nargs=+ RAddLibToList :call RBuildSyntaxFile() -command -nargs=1 Rinsert :call RInsert() +command -nargs=1 -complete=customlist,RLisObjs Rinsert :call RInsert() +command -range=% Rformat ,:call RFormatCode() command RBuildTags :call SendCmdToR('rtags(ofile = "TAGS")') command -nargs=? -complete=customlist,RLisObjs Rhelp :call RAskHelp() command -nargs=? -complete=dir RSourceDir :call RSourceDirectory() diff --git a/r-plugin/vimcom.py b/r-plugin/vimcom.py index c3b3d9d..a81f9c6 100644 --- a/r-plugin/vimcom.py +++ b/r-plugin/vimcom.py @@ -37,7 +37,8 @@ def DiscoverVimComPort(): if VimComPort >= 10050: VimComPort = 0 - vim.command("call RWarningMsg('VimCom Port not found.')") + vim.command("let g:rplugin_vimcomport = 0") + vim.command("call RWarningMsg('VimCom port not found.')") else: vim.command("let g:rplugin_vimcomport = " + str(VimComPort)) if repl.find("0.9-3 ") != 0: From 028b4977acf380338df43b68a8384897c3ed4ee2 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 8 Nov 2012 18:11:51 -0300 Subject: [PATCH 0349/1050] Minor improvements and bug fixes. --- doc/r-plugin.txt | 5 +++-- ftplugin/rbrowser.vim | 4 ++++ r-plugin/common_global.vim | 21 +++++++++++++++------ r-plugin/vimcom.py | 36 +++++++++++++++++++++--------------- 4 files changed, 43 insertions(+), 23 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index f4b7a46..612cfc2 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -612,7 +612,8 @@ The updating is automatic only if the Object Browser is running in a separate Tmux panel. The Object Browser has two views: .GlobalEnv and Libraries. If you either press or double click (GVim or Vim with 'mouse' set to "a") on the first line of the Object Browser it will toggle the view between the -objects in .GlobalEnv and the currently loaded libraries. +objects in .GlobalEnv and the currently loaded libraries. The Object Browser +requires the |+conceal| feature, otherwise list items will be misaligned. In the .GlobalEnv view, if an object has the attribute "label", it will also be displayed. Please, see the R help for package vimcom for some options to @@ -2141,7 +2142,7 @@ the R syntax highlighted. *r-plugin-news* 10. News~ -0.9.9 (2012-11-07) +0.9.9 (2012-11-08) * New commands: :Rinsert and :Rformat. diff --git a/ftplugin/rbrowser.vim b/ftplugin/rbrowser.vim index a267526..b78f7a9 100644 --- a/ftplugin/rbrowser.vim +++ b/ftplugin/rbrowser.vim @@ -393,6 +393,7 @@ au BufUnload call ObBrBufUnload() function! RKeepRunning() if g:rplugin_myport == 0 + call add(g:rplugin_errlist, "RKeepRunning in action.") Py StopServer() sleep 250m Py RunServer() @@ -405,6 +406,9 @@ if $TMUX_PANE != "" autocmd CursorHold call RKeepRunning() nmap d :call OBDelete() vmap d :call OBMultiDelete() + " Don't load problematic plugins + let loaded_nerd_tree = 1 + let loaded_showmarks = 1 endif let s:envstring = tolower($LC_MESSAGES . $LC_ALL . $LANG) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 26f9d56..d1fb12e 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -820,6 +820,8 @@ function StartObjectBrowser() endif call delete($VIMRPLUGIN_TMPDIR . "/rpane") + call delete($VIMRPLUGIN_TMPDIR . "/object_browser") + Py SendToR("\001Tmux pane") let ii = 0 while !filereadable($VIMRPLUGIN_TMPDIR . "/rpane") && ii < 20 @@ -862,7 +864,6 @@ function StartObjectBrowser() \ 'Py OtherPort = ' . g:rplugin_myport , \ 'let g:rplugin_myport1 = 5005', \ 'let g:rplugin_myport2 = 5100', - \ 'sleep 250m', \ 'function! RBrSendToR(cmd)', \ ' let scmd = "tmux set-buffer '. "'" . '" . a:cmd . "\' . "'" . ' && tmux' . tmxs . 'paste-buffer -t ' . g:rplugin_rpane . '"', \ ' let rlog = system(scmd)', @@ -873,18 +874,25 @@ function StartObjectBrowser() \ ' return 0', \ ' endif', \ 'endfunction', + \ 'sleep 250m', \ 'Py RunServer()', - \ 'sleep 100m', + \ 'sleep 50m', \ 'let ii = 0', \ 'while ii < 10 && g:rplugin_myport == 0', \ ' Py vim.command("let g:rplugin_myport = " + str(MyPort))', \ ' let ii = ii + 1', \ ' sleep 100m', \ 'endwhile', - \ 'Py VimClient("EXPR let g:rplugin_objbr_port = " + str(MyPort))', - \ 'sleep 200m', - \ 'Py VimClient("EXPR Py OtherPort = " + str(MyPort))', - \ 'call UpdateOB("GlobalEnv")', + \ 'sleep 50m', + \ 'let jj = 0', + \ 'while !filereadable("'. $VIMRPLUGIN_TMPDIR . '/object_browser"' . ') && jj < 40', + \ ' let jj = jj + 1', + \ ' sleep 50m', + \ 'endwhile', + \ 'Py VimClient("EXPR let g:rplugin_objbr_port = " + str(MyPort) + " | Py OtherPort = " + str(MyPort))', + \ 'sleep 50m', + \ 'call setline(1, ".GlobalEnv | Libraries")', + \ 'exe "silent read ' . $VIMRPLUGIN_TMPDIR . '/object_browser"', \ 'redraw'], objbrowserfile) if g:vimrplugin_objbr_place =~ "left" @@ -3394,6 +3402,7 @@ let g:rplugin_vimcomport = 0 let g:rplugin_lastrpl = "" let g:rplugin_ob_busy = 0 let g:rplugin_hasRSFbutton = 0 +let g:rplugin_errlist = [] call SetRPath() diff --git a/r-plugin/vimcom.py b/r-plugin/vimcom.py index a81f9c6..6880a58 100644 --- a/r-plugin/vimcom.py +++ b/r-plugin/vimcom.py @@ -7,7 +7,7 @@ VimComPort = 0 OtherPort = 0 MyPort = 0 -sock = None +srvrsckt = None th = None FinishNow = False @@ -75,7 +75,7 @@ def SendToR(aString): def VimServer(): - global sock + global srvrsckt global MyPort global FinishNow UDP_IP = "127.0.0.1" @@ -85,14 +85,14 @@ def VimServer(): while True and MyPort < PortLim: try: MyPort += 1 - sock = socket.socket( socket.AF_INET, socket.SOCK_DGRAM ) - sock.bind( (UDP_IP,MyPort) ) + srvrsckt = socket.socket( socket.AF_INET, socket.SOCK_DGRAM ) + srvrsckt.bind( (UDP_IP, MyPort) ) except: continue else: break - if sock == None: + if srvrsckt == None: MyPort = 0 vim.command("call RWarningMsg('Could not bind to any port.')") return @@ -102,7 +102,7 @@ def VimServer(): while FinishNow == False: try: - data, addr = sock.recvfrom( 1024 ) # buffer size is 1024 bytes + data, addr = srvrsckt.recvfrom( 1024 ) # buffer size is 1024 bytes if vim.eval("g:rplugin_ob_busy") == "1": data = "" if re.match("EXPR ", data): @@ -132,20 +132,22 @@ def VimServer(): vim.command("call RWarningMsg('Server failed to read data: " + errstr + "')") MyPort = 0 try: - sock.shutdown(socket.SHUT_RD) + srvrsckt.shutdown(socket.SHUT_RD) except: + vim.command("call add(g:rplugin_errlist, 'Failed to shutdown 1.')") pass - sock.close() + srvrsckt.close() return try: - sock.shutdown(socket.SHUT_RD) + srvrsckt.shutdown(socket.SHUT_RD) except: + vim.command("call add(g:rplugin_errlist, 'Failed to shutdown 2.')") pass - sock.close() + srvrsckt.close() if FinishNow == False: try: - sock = socket.socket( socket.AF_INET, socket.SOCK_DGRAM ) - sock.bind( (UDP_IP,MyPort) ) + srvrsckt = socket.socket( socket.AF_INET, socket.SOCK_DGRAM ) + srvrsckt.bind( (UDP_IP, MyPort) ) except Exception as errmsg: errstr = str(errmsg) errstr = errstr.replace("'", '"') @@ -161,9 +163,10 @@ def RunServer(): th.start() def StopServer(): - global sock + global srvrsckt global MyPort global FinishNow + global th FinishNow = True if VimComPort: SendToR("\x08Stop Updating Info") @@ -174,16 +177,19 @@ def StopServer(): if MyPort == 0: return try: - sock.shutdown(socket.SHUT_RD) + srvrsckt.shutdown(socket.SHUT_RD) except: + vim.command("call add(g:rplugin_errlist, 'Failed to shutdown 3.')") pass try: - sock.close() + srvrsckt.close() except: + vim.command("call add(g:rplugin_errlist, 'Failed to close socket.')") pass try: th.join(0.3) except: + vim.command("call add(g:rplugin_errlist, 'Failed to join.')") pass MyPort = 0 From 547fa921ba39dce4963fa07196f69f99df790e0b Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Wed, 14 Nov 2012 14:49:58 -0300 Subject: [PATCH 0350/1050] Delete no longer necessary file. --- r-plugin/vimActivate.js | 4 ---- 1 file changed, 4 deletions(-) delete mode 100644 r-plugin/vimActivate.js diff --git a/r-plugin/vimActivate.js b/r-plugin/vimActivate.js deleted file mode 100644 index 22a773f..0000000 --- a/r-plugin/vimActivate.js +++ /dev/null @@ -1,4 +0,0 @@ -var arg = WScript.Arguments.Item(0); -var WshShell = WScript.CreateObject("WScript.Shell"); -WshShell.AppActivate(arg); - From d77f683deb29762757e1a6c51a6b10ff0930eeb2 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Wed, 14 Nov 2012 23:51:50 -0300 Subject: [PATCH 0351/1050] Automatically update the Object Browser in GVim. --- Makefile | 4 +- autoload/rcomplete.vim | 10 - doc/r-plugin.txt | 101 +++---- ftplugin/rbrowser.vim | 79 ++--- r-plugin/common_buffer.vim | 1 + r-plugin/common_global.vim | 570 +++++++++++++++++++------------------ r-plugin/vimcom.py | 139 +-------- r-plugin/windows.py | 99 ++++--- 8 files changed, 427 insertions(+), 576 deletions(-) diff --git a/Makefile b/Makefile index ed55310..2638d39 100644 --- a/Makefile +++ b/Makefile @@ -55,7 +55,7 @@ zip: r-plugin/objlist/omnils_grDevices r-plugin/objlist/omnils_methods \ r-plugin/objlist/omnils_stats r-plugin/objlist/omnils_utils \ r-plugin/objlist/omnils_vimcom r-plugin/objlist/README \ - r-plugin/vimActivate.js r-plugin/tex_indent.vim r-plugin/r.snippets \ + r-plugin/tex_indent.vim r-plugin/r.snippets \ r-plugin/common_buffer.vim r-plugin/common_global.vim \ bitmaps/ricon.xbm bitmaps/ricon.png \ bitmaps/RStart.png bitmaps/RStart.bmp \ @@ -166,7 +166,7 @@ deb: unzip /tmp/vim-r-plugin-$(PLUGINVERSION).zip -d /tmp/vim-r-plugin-tmp/usr/share/vim/addons # Delete the files unnecessary in a Debian system (cd /tmp/vim-r-plugin-tmp/usr/share/vim/addons ;\ - rm bitmaps/*.bmp r-plugin/windows.py r-plugin/vimActivate.js ) + rm bitmaps/*.bmp r-plugin/windows.py ) # Add a comment to r-plugin.txt (cd /tmp/vim-r-plugin-tmp/usr/share/vim/addons ;\ sed -e 's/3.2.1. Unix (Linux, OS X, etc.)./3.2.1. Unix (Linux, OS X, etc.)~\n\nNote: If the plugin was installed from the Debian package, then the\ninstallation is finished and you should now read sections 3.3 and 3.4./' -i doc/r-plugin.txt ) diff --git a/autoload/rcomplete.vim b/autoload/rcomplete.vim index 46c3da9..2ec3214 100644 --- a/autoload/rcomplete.vim +++ b/autoload/rcomplete.vim @@ -47,16 +47,6 @@ fun! rcomplete#CompleteR(findstart, base) endif endfor - " When we use R to get the completions based on the running evironment we - " miss information stored on the omnils file: class of object and its - " package. - " if len(g:rplugin_liblist) == 0 && len(res) == 0 - " exe 'Py SendToR("utils:::.win32consoleCompletion(' . "'" . a:base . "', " . strlen(a:base) . ')$comps")' - " if strlen(g:rplugin_lastrpl) > 0 - " let res = split(g:rplugin_lastrpl) - " endif - " endif - return res endif endfun diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 612cfc2..c0bcddb 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -181,15 +181,16 @@ show how the plugin will work on Linux in different conditions: Vim Condition~ ------------------------------ ------------------------------------- Screen plugin (Tmux) default on Linux - Screen plugin (GNU Screen) vimrplugin_tmux = 0 or Tmux not found + Screen plugin (GNU Screen) vimrplugin_tmux = 0 Tmux (external terminal) vimrplugin_screenplugin = 0 - GNU Screen (external terminal) vimrplugin_screenplugin = 0 and no Tmux + GNU Screen (external terminal) vimrplugin_screenplugin = 0 and + vimrplugin_tmux = 0 GVim Condition~ ------------------------------ ------------------------------------- Tmux (external terminal) default on Linux - GNU Screen (external terminal) vimrplugin_tmux = 0 or Tmux not found + GNU Screen (external terminal) vimrplugin_tmux = 0 Note: On Mac OS X the plugin will use AppleScript in both Vim and GVim unless @@ -613,7 +614,8 @@ Tmux panel. The Object Browser has two views: .GlobalEnv and Libraries. If you either press or double click (GVim or Vim with 'mouse' set to "a") on the first line of the Object Browser it will toggle the view between the objects in .GlobalEnv and the currently loaded libraries. The Object Browser -requires the |+conceal| feature, otherwise list items will be misaligned. +requires the |+clientserver| feature to be automatically updated and the +|+conceal| feature to correctly align list items. In the .GlobalEnv view, if an object has the attribute "label", it will also be displayed. Please, see the R help for package vimcom for some options to @@ -641,17 +643,12 @@ any) used to classify the objects: Function is.function() Statement isS4() -When running in a terminal emulator under Tmux, the Object Browser will be -updated automatically. One limitation is that objects made available by the -command data() may not have their classes recognized in the GlobalEnv view. +One limitation is that objects made available by the command data() may not +have their classes recognized in the GlobalEnv view. -When running under Tmux, the Normal mode command d deletes the object on the -cursor line or the element of a list or data.frame. If the Object Browser is -showing the libraries, the library currently under the cursor line is -detached. The Object Browser may stop to be updated automatically for a few -seconds if you press d many times quickly. Please, use a value greater than -250 to set the time in milliseconds that the Object Browser should wait for R -message that the object was already deleted (see |vimrplugin_ob_sleep|). +The Normal mode command d deletes the object on the cursor line or the +element of a list or data.frame. If the Object Browser is showing the +libraries, the library currently under the cursor line is detached. 4.6. Commenting and uncommenting lines~ @@ -820,7 +817,7 @@ missing features; others would be very time consuming to fix without breaking anything. -5.1. The Object Browser segfaults (Linux/Unix only)~ +5.1. The Object Browser segfaults~ If the Vim instance running the Object Browser crashes you may want to close all Vim instances and kill any Vim wandering around with the command (typed in @@ -844,23 +841,14 @@ clipboard. Thus, if you have anything in the clipboard it will be lost while using the plugin. -5.4. The buffer name must be in the window title (Windows only)~ - -On Windows the plugin tries to activate the "R Console" window, paste the -command that is being sent to R, and, then, activate the GVim window. To -activate the GVim window the plugin requires that the name of the file being -edited be in the GVim window title. This is the default if you have not set -the option 'titlestring'. - - -5.5. The menu may not reflect some of your custom key bindings~ +5.4. The menu may not reflect some of your custom key bindings~ If you have created a custom key binding for the Vim-R-plugin, the menu in GVim will not always reflect the correct key binding if it is not the same for Normal, Visual and Insert modes. -5.6. Syntactically correct code may be wrongly indented~ +5.5. Syntactically correct code may be wrongly indented~ If the Vim-R-plugin indents your code wrongly you may get the correct indentation by adding braces and line breaks to it. Example: @@ -883,23 +871,13 @@ indentation by adding braces and line breaks to it. Example: class(x) <- c(if(ordered) "ordered", "factor") < -5.7. Commands are sent twice on Mac OS X~ +5.6. Commands are sent twice on Mac OS X~ If you use the screen plugin with GNU Screen, individual lines may be sent duplicated to R on Mac OS X. -5.8. [Errno 98] Address already in use~ - -When deleting objects using the "d" command in the Object Browser, the message -"[Errno 98] Address already in use" may appear. In this case, the Object -Browser will not work properly until you stop using it and wait for the time -set in 'updatetime' (four seconds, by default). Then, the Object Browser -should be normal again. The "d" command is available only when running R on -Tmux. - - -5.9. "VimCom port not found" on OpenBSD~ +5.7. "VimCom port not found" on OpenBSD~ When the loopback interface has both IPv4 and IPv6 addresses vimcom loads ok but apparently does not listen on the IPv4 address (127.0.0.1), only on the @@ -918,7 +896,6 @@ IPv6 one (fe80::1). |vimrplugin_objbr_place| Placement of Object Browser |vimrplugin_objbr_w| Initial width of Object Browser window |vimrplugin_external_ob| Run Object Browser on external terminal -|vimrplugin_objbr_sleep| Time the Object Browser waits for R after "d" |vimrplugin_vimpager| Use Vim to see R documentation |vimrplugin_editor_w| Minimum width of R script buffer |vimrplugin_help_w| Desired width of R documentation buffer @@ -1037,14 +1014,6 @@ Object Browser will be placed besides the R Console in the external terminal emulator. In this case, the command rh will not work on the Object Browser. -When deleting an object from the Object Browser (possible if running Vim under -Tmux), the following option controls the time in milliseconds that the Object -Browser will wait for R to send the message updating the list of objects: -> - let vimrplugin_ob_sleep = 250m -< -You should increase this value if the "[Errno 98]" message appears frequently. - 6.4. Vim as pager for R help~ *vimrplugin_vimpager* @@ -1239,11 +1208,10 @@ If you want to use your own ~/.screenrc, put in your vimrc: *vimrplugin_only_in_tmux* The screen.vim plugin supports both GNU Screen and Tmux, but only Tmux allows you to split the terminal vertically (that is, to have the panels side by -side). Also, the automatic updating of the Object Browser is enabled only when -running R in a Tmux session. Please read |screen-intro| and -|screen-shell-vertical| for details. By default, the Vim-R-plugin will tell -the screen.vim plugin to split the terminal horizontally. If you prefer to -split it vertically put in your |vimrc|: +side). Please read |screen-intro| and |screen-shell-vertical| for details. By +default, the Vim-R-plugin will tell the screen.vim plugin to split the +terminal horizontally. If you prefer to split it vertically put in your +|vimrc|: > let vimrplugin_screenvsplit = 1 let g:ScreenImpl = 'Tmux' @@ -1923,18 +1891,6 @@ You may need CompizConfig Settings Manager installed to enable this feature (look at the "Window Management" section for "Group and Tab Windows"). -9.16. Why do I have to updated the Object Browser manually?~ - -It is because Vim and R run as separate processes and, thus, it is not -possible to Vim to know whether R is busy or not. If R was running as part of -the text editor, as happens with RStudio, JGR, RKward, and others, which are -linked to libR.so, it would be possible to wait for R to finish processing a -command before sending to it a command to rebuild the list of objects for the -Object Browser. This command should be sent after each line sent to R. But if -the Vim-R-plugin did this, the use of Vim would be blocked until R finished -its processing. - - 9.17. Edit your ~/.Rprofile~ You may want to edit your ~/.Rprofile. Two common options are the use of GVim @@ -2080,8 +2036,8 @@ programming writes patches to Vim source code and the patches are accepted by the Vim developer. In addition to these two limitations, the automatic update of the Object -Browser only works when running Vim under Tmux. Anyway, if you want to try the -Conque Shell, install it from +Browser is disabled when Conque Shell is active because the cursor placement +becomes unstable. Anyway, if you want to try the Conque Shell, install it from http://www.vim.org/scripts/script.php?script_id=2771 @@ -2137,14 +2093,25 @@ we were typing commands directly in the Console it would be beneficial to have the R syntax highlighted. +9.24. Integration with vimshell~ + +Vimshell is still under development, but if you want to integrate it with the +Vim-R-plugin, put in your |vimrc|: +> + let vimrplugin_screenplugin = 0 + let vimrplugin_ca_ck = 0 + let vimrplugin_applescript = 0 + let vimrplugin_vimshell = 1 +< ============================================================================== *r-plugin-news* 10. News~ -0.9.9 (2012-11-08) +0.9.9 (2012-11-14) * New commands: :Rinsert and :Rformat. + * Automatically update the Object Browser in GVim. 0.9.8 (2012-10-13) diff --git a/ftplugin/rbrowser.vim b/ftplugin/rbrowser.vim index b78f7a9..30a2546 100644 --- a/ftplugin/rbrowser.vim +++ b/ftplugin/rbrowser.vim @@ -58,24 +58,35 @@ let g:rplugin_curview = "GlobalEnv" function! UpdateOB(what) - if g:rplugin_curview != a:what + if a:what == "both" + let wht = g:rplugin_curview + else + let wht = a:what + endif + if g:rplugin_curview != wht return endif if g:rplugin_ob_busy return endif - redir => s:bufl - silent buffers - redir END - if exists("g:rplugin_curbuf") && g:rplugin_curbuf != "Object_Browser" && g:rplugin_editor_port == 0 && s:bufl =~ "Object_Browser" - let savesb = &switchbuf - set switchbuf=useopen,usetab - sil noautocmd sb Object_Browser - let g:rplugin_switchedbuf = 1 - else - let g:rplugin_switchedbuf = 0 + + let g:rplugin_switchedbuf = 0 + if $TMUX_PANE == "" + redir => s:bufl + silent buffers + redir END + if s:bufl !~ "Object_Browser" + return + endif + if exists("g:rplugin_curbuf") && g:rplugin_curbuf != "Object_Browser" + let savesb = &switchbuf + set switchbuf=useopen,usetab + sil noautocmd sb Object_Browser + let g:rplugin_switchedbuf = 1 + endif endif - set modifiable + + setlocal modifiable let curline = line(".") let curcol = col(".") if !exists("curline") @@ -85,7 +96,7 @@ function! UpdateOB(what) let curcol = 1 endif sil normal! ggdG - if a:what == "GlobalEnv" + if wht == "GlobalEnv" call setline(1, ".GlobalEnv | Libraries") exe "silent read " . $VIMRPLUGIN_TMPDIR . "/object_browser" else @@ -93,7 +104,7 @@ function! UpdateOB(what) exe "silent read " . $VIMRPLUGIN_TMPDIR . "/liblist" endif call cursor(curline, curcol) - set nomodifiable + setlocal nomodifiable redraw if g:rplugin_switchedbuf exe "sil noautocmd sb " . g:rplugin_curbuf @@ -117,7 +128,7 @@ function! RBrowserDoubleClick() " Toggle state of list or data.frame: open X closed let key = RBrowserGetName(1, line(".")) if g:rplugin_curview == "GlobalEnv" - exe 'Py SendToR("' . "\005" . '-' . substitute(key, '\$', '-', "g") . '")' + exe 'Py SendToVimCom("' . "\005" . '-' . substitute(key, '\$', '-', "g") . '")' call UpdateOB("GlobalEnv") else let key = substitute(key, '\$', '-', "g") @@ -125,7 +136,7 @@ function! RBrowserDoubleClick() if key !~ "^package:" let key = "package:" . RBGetPkgName() . '-' . key endif - exe 'Py SendToR("' . "\005" . key . '")' + exe 'Py SendToVimCom("' . "\005" . key . '")' call UpdateOB("libraries") endif endfunction @@ -298,10 +309,9 @@ function! MakeRBrowserMenu() endfunction function! ObBrBufUnload() - Py StopServer() call delete($VIMRPLUGIN_TMPDIR . "/object_browser") call delete($VIMRPLUGIN_TMPDIR . "/liblist") - if g:rplugin_editor_port + if exists("g:rplugin_editor_sname") call system("tmux select-pane -t " . g:rplugin_edpane) endif endfunction @@ -333,7 +343,11 @@ endfunction function! OBSendDeleteCmd(cmd) let g:rplugin_ob_busy = 1 - call RBrSendToR(a:cmd) + if exists("*RBrSendToR") + call RBrSendToR(a:cmd) + else + call SendCmdToR(a:cmd) + endif sleep 250m let g:rplugin_ob_busy = 0 call UpdateOB(g:rplugin_curview) @@ -341,7 +355,7 @@ function! OBSendDeleteCmd(cmd) endfunction function! OBDelete() - if g:rplugin_ob_busy || line(".") < 3 || g:rplugin_myport == 0 + if g:rplugin_ob_busy || line(".") < 3 return endif let cmd = OBGetDeleteCmd(line(".")) @@ -349,7 +363,7 @@ function! OBDelete() endfunction function! OBMultiDelete() - if g:rplugin_ob_busy || g:rplugin_myport == 0 + if g:rplugin_ob_busy return endif let fline = line("'<") @@ -389,28 +403,19 @@ endif call writefile([], $VIMRPLUGIN_TMPDIR . "/object_browser") call writefile([], $VIMRPLUGIN_TMPDIR . "/liblist") -au BufUnload call ObBrBufUnload() -function! RKeepRunning() - if g:rplugin_myport == 0 - call add(g:rplugin_errlist, "RKeepRunning in action.") - Py StopServer() - sleep 250m - Py RunServer() - echon - endif -endfunction - -if $TMUX_PANE != "" - set updatetime=3200 - autocmd CursorHold call RKeepRunning() - nmap d :call OBDelete() - vmap d :call OBMultiDelete() +if $TMUX_PANE == "" + au BufUnload exe 'Py SendToVimCom("\x08Stop updating info.")' +else + au BufUnload call ObBrBufUnload() " Don't load problematic plugins let loaded_nerd_tree = 1 let loaded_showmarks = 1 endif +nmap d :call OBDelete() +vmap d :call OBMultiDelete() + let s:envstring = tolower($LC_MESSAGES . $LC_ALL . $LANG) if s:envstring =~ "utf-8" || s:envstring =~ "utf8" let s:isutf8 = 1 diff --git a/r-plugin/common_buffer.vim b/r-plugin/common_buffer.vim index ca4006e..5888b09 100644 --- a/r-plugin/common_buffer.vim +++ b/r-plugin/common_buffer.vim @@ -108,6 +108,7 @@ else endif let s:uniquename = substitute(s:uniquename, '\W', '', 'g') let $VIMINSTANCEID = $VIMRPLUGIN_TMPDIR . "/" . s:uniquename . "-port" +let g:rplugin_obsname = toupper(substitute(substitute(expand("%:r"), '\W', '', 'g'), "_", "", "g")) unlet s:uniquename let g:rplugin_lastft = &filetype diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index d1fb12e..41b1425 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -187,9 +187,9 @@ function RCompleteArgs() let rkeyword = '^' . rkeyword0 . "\x06" call cursor(cpos[1], cpos[2]) if classfor == "" - exe 'Py SendToR("vimcom:::vim.args(' . "'" . rkeyword0 . "', '" . argkey . "')" . '")' + exe 'Py SendToVimCom("vimcom:::vim.args(' . "'" . rkeyword0 . "', '" . argkey . "')" . '")' else - exe 'Py SendToR("vimcom:::vim.args(' . "'" . rkeyword0 . "', '" . argkey . "', classfor = " . classfor . ")" . '")' + exe 'Py SendToVimCom("vimcom:::vim.args(' . "'" . rkeyword0 . "', '" . argkey . "', classfor = " . classfor . ")" . '")' endif if g:rplugin_vimcomport > 0 && g:rplugin_lastrpl != "NOT_EXISTS" && g:rplugin_lastrpl != "NO_ARGS" && g:rplugin_lastrpl != "R is busy." && g:rplugin_lastrpl != "NOANSWER" && g:rplugin_lastrpl != "INVALID" && g:rplugin_lastrpl != "" let args = [] @@ -730,7 +730,14 @@ function StartR(whatr) call writefile(cnflines, tmxcnf) let tmxcnf = "-f " . tmxcnf endif - call system("tmux has-session -t" . b:screensname) + if $DISPLAY == "" + if !(has("win32") || has("win64")) + call RWarningMsg("The X Window system is required to run R in an external terminal.") + lcd - + return + endif + endif + call system("tmux has-session -t " . b:screensname) if v:shell_error if g:rplugin_termcmd =~ "gnome-terminal" || g:rplugin_termcmd =~ "xfce4-terminal" || g:rplugin_termcmd =~ "terminal" || g:rplugin_termcmd =~ "iterm" let opencmd = printf("%s 'tmux -2 %s new-session -s %s \"%s\"' &", g:rplugin_termcmd, tmxcnf, b:screensname, rcmd) @@ -773,200 +780,187 @@ endfunction function StartObjectBrowser() if g:vimrplugin_tmux && (g:vimrplugin_screenplugin || g:vimrplugin_external_ob) - if g:rplugin_editor_port + if exists("b:this_is_ob") " This is the Object Browser - Py VimClient("EXPR call RObjBrowser()") let g:rplugin_running_objbr = 0 return endif - if g:rplugin_myport == 0 - let g:rplugin_myport1 = 6005 - let g:rplugin_myport2 = 6100 - Py RunServer() - sleep 100m - let ii = 0 - while ii < 10 && g:rplugin_myport == 0 - Py vim.command("let g:rplugin_myport = " + str(MyPort)) - let ii = ii + 1 - sleep 100m - endwhile + " Don't start the Object Browser if it already exists + if exists("g:rplugin_obpane") + let plst = system("tmux list-panes | cat") + if plst =~ g:rplugin_obpane + return + endif + unlet g:rplugin_obpane endif + sleep 250m - " Start the Object Browser if it doesn't exist yet - if g:rplugin_objbr_port == 0 - let objbrowserfile = $VIMRPLUGIN_TMPDIR . "/objbrowserInit" - if exists("g:ScreenShellSession") - let tmxs = " -S " . g:ScreenShellSession . " " + let objbrowserfile = $VIMRPLUGIN_TMPDIR . "/objbrowserInit" + if exists("g:ScreenShellSession") + let tmxs = " -S " . g:ScreenShellSession . " " + else + let tmxs = " " + endif + + if !exists("g:rplugin_edpane") + if g:vimrplugin_screenplugin == 0 + let g:rplugin_edpane = "none" else - let tmxs = " " + let g:rplugin_edpane = $TMUX_PANE endif - - if !exists("g:rplugin_edpane") - if g:vimrplugin_screenplugin == 0 + if strlen(g:rplugin_edpane) == 0 + if g:vimrplugin_external_ob let g:rplugin_edpane = "none" + let g:vimrplugin_objbr_place = substitute(g:vimrplugin_objbr_place, "script", "console", "g") else - let g:rplugin_edpane = $TMUX_PANE - endif - if strlen(g:rplugin_edpane) == 0 - if g:vimrplugin_external_ob - let g:rplugin_edpane = "none" - let g:vimrplugin_objbr_place = substitute(g:vimrplugin_objbr_place, "script", "console", "g") - else - echoer "Could not find the environment variable TMUX_PANE." - return - endif + echoer "Could not find the environment variable TMUX_PANE." + return endif endif + endif - call delete($VIMRPLUGIN_TMPDIR . "/rpane") - call delete($VIMRPLUGIN_TMPDIR . "/object_browser") + call delete($VIMRPLUGIN_TMPDIR . "/rpane") + call delete($VIMRPLUGIN_TMPDIR . "/object_browser") - Py SendToR("\001Tmux pane") - let ii = 0 - while !filereadable($VIMRPLUGIN_TMPDIR . "/rpane") && ii < 20 - let ii = ii + 1 - sleep 50m - endwhile - if !filereadable($VIMRPLUGIN_TMPDIR . "/rpane") - echoer "The number of the R Tmux pane is unknown." - return - endif - let xx = readfile($VIMRPLUGIN_TMPDIR . "/rpane") - let g:rplugin_rpane = xx[0] - if g:rplugin_rpane !~ "%[0-9]" - echoer 'The number of the R Tmux pane is invalid: "' . g:rplugin_rpane . '"' - unlet g:rplugin_rpane - return - endif + Py SendToVimCom("\001Tmux pane") + let ii = 0 + while !filereadable($VIMRPLUGIN_TMPDIR . "/rpane") && ii < 20 + let ii = ii + 1 + sleep 50m + endwhile + if !filereadable($VIMRPLUGIN_TMPDIR . "/rpane") + echoer "The number of the R Tmux pane is unknown." + return + endif + let xx = readfile($VIMRPLUGIN_TMPDIR . "/rpane") + let g:rplugin_rpane = xx[0] + if g:rplugin_rpane !~ "%[0-9]" + echoer 'The number of the R Tmux pane is invalid: "' . g:rplugin_rpane . '"' + unlet g:rplugin_rpane + return + endif - call writefile([ - \ 'call writefile([$TMUX_PANE], $VIMRPLUGIN_TMPDIR . "/objbrpane")', - \ 'let b:this_is_ob = 1', - \ 'let g:rplugin_editor_port = ' . g:rplugin_myport , - \ 'let g:rplugin_edpane = "' . g:rplugin_edpane . '"', - \ 'let g:rplugin_rpane = "' . g:rplugin_rpane . '"', - \ 'let b:objbrtitle = "' . b:objbrtitle . '"', - \ 'let b:screensname = "' . b:screensname . '"', - \ 'let b:rscript_buffer = "' . bufname("%") . '"', - \ 'set filetype=rbrowser', - \ 'let $VIMINSTANCEID="' . $VIMINSTANCEID . '"', - \ 'setlocal modifiable', - \ 'set shortmess=atI', - \ 'set rulerformat=%3(%l%)', - \ 'set noruler', - \ 'let curline = line(".")', - \ 'let curcol = col(".")', - \ 'normal! ggdG', - \ 'setlocal nomodified', - \ 'call cursor(curline, curcol)', - \ 'exe "PyFile " . g:rplugin_home . "/r-plugin/vimcom.py"', - \ 'Py OtherPort = ' . g:rplugin_myport , - \ 'let g:rplugin_myport1 = 5005', - \ 'let g:rplugin_myport2 = 5100', - \ 'function! RBrSendToR(cmd)', - \ ' let scmd = "tmux set-buffer '. "'" . '" . a:cmd . "\' . "'" . ' && tmux' . tmxs . 'paste-buffer -t ' . g:rplugin_rpane . '"', - \ ' let rlog = system(scmd)', - \ ' if v:shell_error', - \ ' let rlog = substitute(rlog, "\n", " ", "g")', - \ ' let rlog = substitute(rlog, "\r", " ", "g")', - \ ' call RWarningMsg(rlog)', - \ ' return 0', - \ ' endif', - \ 'endfunction', - \ 'sleep 250m', - \ 'Py RunServer()', - \ 'sleep 50m', - \ 'let ii = 0', - \ 'while ii < 10 && g:rplugin_myport == 0', - \ ' Py vim.command("let g:rplugin_myport = " + str(MyPort))', - \ ' let ii = ii + 1', - \ ' sleep 100m', - \ 'endwhile', - \ 'sleep 50m', - \ 'let jj = 0', - \ 'while !filereadable("'. $VIMRPLUGIN_TMPDIR . '/object_browser"' . ') && jj < 40', - \ ' let jj = jj + 1', - \ ' sleep 50m', - \ 'endwhile', - \ 'Py VimClient("EXPR let g:rplugin_objbr_port = " + str(MyPort) + " | Py OtherPort = " + str(MyPort))', - \ 'sleep 50m', - \ 'call setline(1, ".GlobalEnv | Libraries")', - \ 'exe "silent read ' . $VIMRPLUGIN_TMPDIR . '/object_browser"', - \ 'redraw'], objbrowserfile) - - if g:vimrplugin_objbr_place =~ "left" - let panw = system("tmux list-panes | cat") - if g:vimrplugin_objbr_place =~ "console" - " Get the R Console width: - let panw = substitute(panw, '.*\n1: \[\([0-9]*\)x.*', '\1', "") - else - " Get the Vim with - let panw = substitute(panw, '.*0: \[\([0-9]*\)x.*', '\1', "") - endif - let panewidth = panw - g:vimrplugin_objbr_w - " Just to be safe: If the above code doesn't work as expected - " and we get a spurious value: - if panewidth < 40 || panewidth > 180 - let panewidth = 80 - endif - else - let panewidth = g:vimrplugin_objbr_w - endif + exe 'Py SendToVimCom("\007' . g:rplugin_obsname . '")' + + if v:servername == "" + let myservername = '""' + else + let myservername = v:servername + endif + + call writefile([ + \ 'call writefile([$TMUX_PANE], $VIMRPLUGIN_TMPDIR . "/objbrpane")', + \ 'let b:this_is_ob = 1', + \ 'let g:rplugin_editor_sname = ' . myservername, + \ 'let g:rplugin_edpane = "' . g:rplugin_edpane . '"', + \ 'let g:rplugin_rpane = "' . g:rplugin_rpane . '"', + \ 'let b:objbrtitle = "' . b:objbrtitle . '"', + \ 'let b:screensname = "' . b:screensname . '"', + \ 'let b:rscript_buffer = "' . bufname("%") . '"', + \ 'set filetype=rbrowser', + \ 'let $VIMINSTANCEID="' . $VIMINSTANCEID . '"', + \ 'setlocal modifiable', + \ 'set shortmess=atI', + \ 'set rulerformat=%3(%l%)', + \ 'set noruler', + \ 'let curline = line(".")', + \ 'let curcol = col(".")', + \ 'normal! ggdG', + \ 'setlocal nomodified', + \ 'call cursor(curline, curcol)', + \ 'exe "PyFile " . g:rplugin_home . "/r-plugin/vimcom.py"', + \ 'function! RBrSendToR(cmd)', + \ ' let scmd = "tmux set-buffer '. "'" . '" . a:cmd . "\' . "'" . ' && tmux' . tmxs . 'paste-buffer -t ' . g:rplugin_rpane . '"', + \ ' let rlog = system(scmd)', + \ ' if v:shell_error', + \ ' let rlog = substitute(rlog, "\n", " ", "g")', + \ ' let rlog = substitute(rlog, "\r", " ", "g")', + \ ' call RWarningMsg(rlog)', + \ ' return 0', + \ ' endif', + \ 'endfunction', + \ 'sleep 250m', + \ 'while !filereadable("'. $VIMRPLUGIN_TMPDIR . '/object_browser"' . ') && jj < 40', + \ ' let jj = jj + 1', + \ ' sleep 50m', + \ 'endwhile', + \ 'call setline(1, ".GlobalEnv | Libraries")', + \ 'exe "silent read ' . $VIMRPLUGIN_TMPDIR . '/object_browser"', + \ 'redraw'], objbrowserfile) + + if g:vimrplugin_objbr_place =~ "left" + let panw = system("tmux list-panes | cat") if g:vimrplugin_objbr_place =~ "console" - let cmd = "tmux split-window -d -h -l " . panewidth . " -t " . g:rplugin_rpane . ' "vim -c ' . "'source " . objbrowserfile . "'" . '"' + " Get the R Console width: + let panw = substitute(panw, '.*\n1: \[\([0-9]*\)x.*', '\1', "") else - let cmd = "tmux split-window -d -h -l " . panewidth . " -t " . g:rplugin_edpane . ' "vim -c ' . "'source " . objbrowserfile . "'" . '"' + " Get the Vim with + let panw = substitute(panw, '.*0: \[\([0-9]*\)x.*', '\1', "") + endif + let panewidth = panw - g:vimrplugin_objbr_w + " Just to be safe: If the above code doesn't work as expected + " and we get a spurious value: + if panewidth < 40 || panewidth > 180 + let panewidth = 80 endif + else + let panewidth = g:vimrplugin_objbr_w + endif + if g:vimrplugin_objbr_place =~ "console" + let obpane = g:rplugin_rpane + else + let obpane = g:rplugin_edpane + endif + let cmd = "tmux split-window -d -h -l " . panewidth . " -t " . obpane . ' "vim --servername ' . g:rplugin_obsname. ' -c ' . "'source " . objbrowserfile . "'" . '"' - call delete($VIMRPLUGIN_TMPDIR . "/objbrpane") + call delete($VIMRPLUGIN_TMPDIR . "/objbrpane") - let rlog = system(cmd) - if v:shell_error - let rlog = substitute(rlog, '\n', ' ', 'g') - let rlog = substitute(rlog, '\r', ' ', 'g') - call RWarningMsg(rlog) - let g:rplugin_running_objbr = 0 - return 0 - endif + let rlog = system(cmd) + if v:shell_error + let rlog = substitute(rlog, '\n', ' ', 'g') + let rlog = substitute(rlog, '\r', ' ', 'g') + call RWarningMsg(rlog) + let g:rplugin_running_objbr = 0 + return 0 + endif - let ii = 0 - while !filereadable($VIMRPLUGIN_TMPDIR . "/objbrpane") && ii < 20 - let ii = ii + 1 - sleep 50m - endwhile - if !filereadable($VIMRPLUGIN_TMPDIR . "/objbrpane") - echoer "The Tmux pane number of the Object Browser is unknown." - return - endif - let xx = readfile($VIMRPLUGIN_TMPDIR . "/objbrpane") - let g:rplugin_obpane = xx[0] - if g:rplugin_obpane !~ "%[0-9]" - echoer 'The number of the Object Browser Tmux pane is invalid: "' . g:rplugin_obpane . '"' - unlet g:rplugin_obpane - return - endif + let ii = 0 + while !filereadable($VIMRPLUGIN_TMPDIR . "/objbrpane") && ii < 20 + let ii = ii + 1 + sleep 50m + endwhile + if !filereadable($VIMRPLUGIN_TMPDIR . "/objbrpane") + echoer "The Tmux pane number of the Object Browser is unknown." + return + endif + let xx = readfile($VIMRPLUGIN_TMPDIR . "/objbrpane") + let g:rplugin_obpane = xx[0] + if g:rplugin_obpane !~ "%[0-9]" + echoer 'The number of the Object Browser Tmux pane is invalid: "' . g:rplugin_obpane . '"' + unlet g:rplugin_obpane + return + endif - if g:vimrplugin_objbr_place =~ "left" - if g:vimrplugin_objbr_place =~ "console" - call system("tmux swap-pane -d -s " . g:rplugin_rpane . " -t " . g:rplugin_obpane) - else - call system("tmux swap-pane -d -s " . g:rplugin_edpane . " -t " . g:rplugin_obpane) - endif + if g:vimrplugin_objbr_place =~ "left" + if g:vimrplugin_objbr_place =~ "console" + call system("tmux swap-pane -d -s " . g:rplugin_rpane . " -t " . g:rplugin_obpane) + else + call system("tmux swap-pane -d -s " . g:rplugin_edpane . " -t " . g:rplugin_obpane) endif - let ii = 0 - echohl WarningMsg - echo "Please, wait..." - echohl Normal - while g:rplugin_objbr_port == 0 && ii < 10 - sleep 200m - let ii = ii + 1 - endwhile - echon "\r " endif + let ii = 0 + echohl WarningMsg + echo "Please, wait..." + echohl Normal + echon "\r " return endif + if v:servername != "" && g:vimrplugin_conqueplugin == 0 + exe 'Py SendToVimCom("\007' . v:servername . '")' + endif + " Either load or reload the Object Browser let savesb = &switchbuf set switchbuf=useopen,usetab @@ -1014,14 +1008,20 @@ function StartObjectBrowser() unlet g:tmp_screensname unlet g:tmp_curbufname exe "PyFile " . g:rplugin_home . "/r-plugin/vimcom.py" - Py SendToR("\003GlobalEnv") - Py SendToR("\004Libraries") + Py SendToVimCom("\003GlobalEnv") + Py SendToVimCom("\004Libraries") call UpdateOB("GlobalEnv") endif endfunction " Open an Object Browser window function RObjBrowser() + if $DISPLAY == "" + if !(has("win32") || has("win64")) + call RWarningMsg("The X Window system is required to run the Objetc Browser.") + return + endif + endif if !has("python") && !has("python3") call RWarningMsg("Python support is required to run the Object Browser.") return @@ -1042,8 +1042,8 @@ function RObjBrowser() let g:rplugin_running_objbr = 1 call StartObjectBrowser() - Py SendToR("\003GlobalEnv") - Py SendToR("\004Libraries") + Py SendToVimCom("\003GlobalEnv") + Py SendToVimCom("\004Libraries") if exists("*UpdateOB") call UpdateOB("GlobalEnv") call UpdateOB("libraries") @@ -1067,7 +1067,7 @@ function RBrowserOpenCloseLists(status) let switchedbuf = 1 endif - exe 'Py SendToR("' . "\006" . stt . '")' + exe 'Py SendToVimCom("' . "\006" . stt . '")' if exists("g:rplugin_curview") if g:rplugin_curview == "GlobalEnv" @@ -1127,7 +1127,7 @@ function RFormatCode() range elseif wco > 180 let wco = 180 endif - exe "Py SendToR('formatR::tidy.source(\"" . $VIMRPLUGIN_TMPDIR . "/unformatted_code" . "\", file = \"" . $VIMRPLUGIN_TMPDIR . "/formatted_code\", width.cutoff = " . wco . ")')" + exe "Py SendToVimCom('formatR::tidy.source(\"" . $VIMRPLUGIN_TMPDIR . "/unformatted_code" . "\", file = \"" . $VIMRPLUGIN_TMPDIR . "/formatted_code\", width.cutoff = " . wco . ")')" if g:rplugin_lastrpl == "R is busy." || g:rplugin_lastrpl == "UNKNOWN" || g:rplugin_lastrpl =~ "^Error" || g:rplugin_lastrpl == "INVALID" || g:rplugin_lastrpl == "ERROR" || g:rplugin_lastrpl == "EMPTY" call RWarningMsg(g:rplugin_lastrpl) return @@ -1145,7 +1145,7 @@ function RInsert(cmd) return endif endif - exe "Py SendToR('paste(capture.output(" . a:cmd . "), collapse = \"\\\\n\")')" + exe "Py SendToVimCom('paste(capture.output(" . a:cmd . "), collapse = \"\\\\n\")')" if g:rplugin_lastrpl == "R is busy." || g:rplugin_lastrpl == "UNKNOWN" || g:rplugin_lastrpl =~ "^Error" || g:rplugin_lastrpl == "INVALID" || g:rplugin_lastrpl == "ERROR" || g:rplugin_lastrpl == "EMPTY" || g:rplugin_lastrpl == "RTYPE" call RWarningMsg(g:rplugin_lastrpl) else @@ -1172,9 +1172,9 @@ function SendCmdToR(cmd) for i in range(0, slen) let str = str . printf("\\x%02X", char2nr(cmd[i])) endfor - exe "Py" . " SendToRPy(b'" . str . "')" - silent exe '!start WScript "' . g:rplugin_jspath . '" "' . expand("%") . '"' - " call RestoreClipboardPy() + " Py VimSaveClipBoard() + exe "Py" . " SendToRConsole(b'" . str . "')" + " Py VimRestoreClipboard() endif return 1 endif @@ -1674,9 +1674,8 @@ endfunction " Clear the console screen function RClearConsole() - if (has("win32") || has("win64")) && g:vimrplugin_conqueplugin == 0 + if (has("win32") || has("win64")) && g:vimrplugin_conqueplugin == 0 && g:vimrplugin_vimshell == 0 Py RClearConsolePy() - silent exe '!start WScript "' . g:rplugin_jspath . '" "' . expand("%") . '"' else call SendCmdToR("\014") endif @@ -1704,16 +1703,6 @@ endfunction " Quit R function RQuit(how) - if g:rplugin_objbr_port - Py VimClient("FINISH") - sleep 200m - Py OtherPort = 0 - endif - if g:rplugin_myport - Py StopServer() - sleep 200m - endif - if bufloaded(b:objbrtitle) exe "bunload! " . b:objbrtitle sleep 150m @@ -1731,14 +1720,14 @@ function RQuit(how) endif sleep 250m - if g:rplugin_objbr_port - " check if the pane still exists before trying to kill it because the - " user may have already closed the Object Browser manually. + " check if the pane still exists before trying to kill it because the + " user may have already closed the Object Browser manually. + if exists("g:rplugin_obpane") let plst = system("tmux list-panes | cat") if plst =~ g:rplugin_obpane call system("tmux kill-pane -t " . g:rplugin_obpane) + unlet g:rplugin_obpane endif - let g:rplugin_objbr_port = 0 sleep 250m endif @@ -1791,7 +1780,7 @@ function BuildROmniList(env, packlist) call delete($VIMRPLUGIN_TMPDIR . "/vimbol_finished") if a:env =~ "GlobalEnv" - exe "Py SendToR('" . omnilistcmd . "')" + exe "Py SendToVimCom('" . omnilistcmd . "')" if g:rplugin_vimcomport == 0 sleep 500m let b:needsnewomnilist = 1 @@ -2048,13 +2037,13 @@ function ShowRDoc(rkeyword, package, getclass) let g:rplugin_lastrpl = "R did not reply." if classfor == "" && a:package == "" - exe 'Py SendToR("vim.help(' . "'" . a:rkeyword . "', " . g:rplugin_htw . 'L)")' + exe 'Py SendToVimCom("vim.help(' . "'" . a:rkeyword . "', " . g:rplugin_htw . 'L)")' elseif a:package != "" - exe 'Py SendToR("vim.help(' . "'" . a:rkeyword . "', " . g:rplugin_htw . "L, package='" . a:package . "')". '")' + exe 'Py SendToVimCom("vim.help(' . "'" . a:rkeyword . "', " . g:rplugin_htw . "L, package='" . a:package . "')". '")' else let classfor = substitute(classfor, '\\', "", "g") let classfor = substitute(classfor, '"', '\\"', "g") - exe 'Py SendToR("vim.help(' . "'" . a:rkeyword . "', " . g:rplugin_htw . "L, " . classfor . ")". '")' + exe 'Py SendToVimCom("vim.help(' . "'" . a:rkeyword . "', " . g:rplugin_htw . "L, " . classfor . ")". '")' endif if g:rplugin_lastrpl != "VIMHELP" if g:rplugin_lastrpl =~ "^MULTILIB" @@ -2065,7 +2054,7 @@ function ShowRDoc(rkeyword, package, getclass) endfor let chn = input("Please, select one of them: ") if chn > 0 && chn < len(libs) - exe 'Py SendToR("vim.help(' . "'" . a:rkeyword . "', " . g:rplugin_htw . "L, package='" . libs[chn] . "')" . '")' + exe 'Py SendToVimCom("vim.help(' . "'" . a:rkeyword . "', " . g:rplugin_htw . "L, package='" . libs[chn] . "')" . '")' endif else call RWarningMsg(g:rplugin_lastrpl) @@ -2780,7 +2769,7 @@ function SpaceForRGrDevice() let l:sr = &splitright set splitright 37vsplit Space_for_Graphics - set nomodifiable + setlocal nomodifiable setlocal noswapfile set buftype=nofile set nowrap @@ -3003,15 +2992,6 @@ call RSetDefaultValue("g:vimrplugin_latexcmd", "'pdflatex'") call RSetDefaultValue("g:vimrplugin_objbr_place", "'script,right'") call RSetDefaultValue("g:vimrplugin_insert_mode_cmds", 1) -if g:vimrplugin_vimshell - if !exists("g:vimshell_environment_term") - let g:vimrplugin_vimshell = 0 - endif - let g:vimrplugin_screenplugin = 0 - let g:vimrplugin_conqueplugin = 0 - let g:vimrplugin_applescript = 0 -endif - " Look for invalid options let objbrplace = split(g:vimrplugin_objbr_place, ",") let obpllen = len(objbrplace) - 1 @@ -3058,6 +3038,19 @@ exe "PyFile " . g:rplugin_home . "/r-plugin/vimcom.py" " circumstances. call RSetDefaultValue("g:vimrplugin_ca_ck", 0) +" ======================================================================== +" Set default mean of communication with R + +if has('gui_running') + let g:vimrplugin_screenplugin = 0 +endif + +if has("win32") || has("win64") + let g:vimrplugin_screenplugin = 0 + let g:vimrplugin_applescript = 0 + let g:vimrplugin_tmux = 0 +endif + if has("gui_macvim") || has("gui_mac") || has("mac") || has("macunix") let g:rplugin_r64app = 0 if isdirectory("/Applications/R64.app") @@ -3072,102 +3065,129 @@ else call RSetDefaultValue("g:vimrplugin_applescript", 0) endif -if g:vimrplugin_applescript == 0 +if g:vimrplugin_applescript + let g:vimrplugin_vimshell = 0 + let g:vimrplugin_screenplugin = 0 + let g:vimrplugin_conqueplugin = 0 + let g:vimrplugin_tmux = 0 +else call RSetDefaultValue("g:vimrplugin_screenplugin", 1) call RSetDefaultValue("g:vimrplugin_tmux", 1) -else +endif + +if g:vimrplugin_screenplugin + let g:vimrplugin_vimshell = 0 + let g:vimrplugin_conqueplugin = 0 + let g:vimrplugin_applescript = 0 +endif + +if g:vimrplugin_vimshell + if !exists("g:vimshell_environment_term") + let g:vimrplugin_vimshell = 0 + endif let g:vimrplugin_screenplugin = 0 let g:vimrplugin_conqueplugin = 0 + let g:vimrplugin_applescript = 0 let g:vimrplugin_tmux = 0 endif -" The screen.vim plugin only works on terminal emulators -if has('gui_running') +if g:vimrplugin_conqueplugin let g:vimrplugin_screenplugin = 0 + let g:vimrplugin_vimshell = 0 + let g:vimrplugin_applescript = 0 + let g:vimrplugin_tmux = 0 endif +" ======================================================================== + if has("win32") || has("win64") call RSetDefaultValue("g:vimrplugin_conquesleep", 200) - let g:vimrplugin_screenplugin = 0 - let g:vimrplugin_tmux = 0 else call RSetDefaultValue("g:vimrplugin_conquesleep", 100) endif -if g:vimrplugin_applescript == 0 && !(has("win32") || has("win64")) - let s:hastmux = executable('tmux') - let s:hasscreen = executable('screen') - if s:hastmux == 0 && s:hasscreen == 0 && g:vimrplugin_conqueplugin == 0 - call RWarningMsgInp("Please, install the 'Tmux' application to enable the Vim-R-plugin.") +" Check whether vim's screen plugin is OK +if g:vimrplugin_screenplugin + if !exists("g:ScreenVersion") + call RWarningMsgInp("Please, either install the screen plugin (http://www.vim.org/scripts/script.php?script_id=2711) (recommended) or put 'let vimrplugin_screenplugin = 0' in your vimrc.") let g:rplugin_failed = 1 finish endif - if s:hastmux == 0 && s:hasscreen == 1 - let g:vimrplugin_tmux = 0 - endif - if g:vimrplugin_tmux == 0 && s:hasscreen == 0 && g:vimrplugin_conqueplugin == 0 - call RWarningMsgInp("The value of vimrplugin_tmux = 0 but the GNU Screen application was not found.") + if g:ScreenVersion < "1.5" + call RWarningMsgInp("Vim-R-plugin requires Screen plugin >= 1.5") let g:rplugin_failed = 1 finish endif endif +" Check whether Tmux is OK +if g:vimrplugin_tmux + let s:hastmux = executable('tmux') + if s:hastmux == 0 + call RWarningMsgInp("Please, install the 'Tmux' application to enable the Vim-R-plugin.") + let g:rplugin_failed = 1 + finish + endif + unlet s:hastmux -if g:vimrplugin_screenplugin - let g:vimrplugin_conqueplugin = 0 - if !exists("g:ScreenVersion") - call RWarningMsgInp("Please, either install the screen plugin (http://www.vim.org/scripts/script.php?script_id=2711) (recommended) or put 'let vimrplugin_screenplugin = 0' in your vimrc.") + let s:tmuxversion = system("tmux -V") + let s:tmuxversion = substitute(s:tmuxversion, '.*tmux \([0-9]\.[0-9]\).*', '\1', '') + if strlen(s:tmuxversion) != 3 + let s:tmuxversion = "1.0" + endif + if g:vimrplugin_tmux && s:tmuxversion < "1.5" + call RWarningMsgInp("Vim-R-plugin requires Tmux >= 1.5") let g:rplugin_failed = 1 finish endif + unlet s:tmuxversion + + let g:ScreenImpl = 'Tmux' " To get 256 colors you have to set the $TERM environment variable to " xterm-256color. See :h r-plugin-tips - if g:vimrplugin_tmux - let g:ScreenImpl = 'Tmux' - if g:vimrplugin_notmuxconf == 0 - if $DISPLAY != "" || $TERM =~ "xterm" - let g:ScreenShellTmuxInitArgs = "-2" - endif - let tmxcnf = $VIMRPLUGIN_TMPDIR . "/tmux.conf" - let cnflines = [ - \ 'set-option -g prefix C-a', - \ 'unbind-key C-b', - \ 'bind-key C-a send-prefix', - \ 'set-window-option -g mode-keys vi', - \ 'set -g status off', - \ "set -g terminal-overrides 'xterm*:smcup@:rmcup@'", - \ 'set -g mode-mouse on', - \ 'set -g mouse-select-pane on', - \ 'set -g mouse-resize-pane on'] - call writefile(cnflines, tmxcnf) - let g:ScreenShellTmuxInitArgs = g:ScreenShellTmuxInitArgs . " -f " . tmxcnf + if g:vimrplugin_notmuxconf == 0 + if $DISPLAY != "" || $TERM =~ "xterm" + let g:ScreenShellTmuxInitArgs = "-2" endif - else - let g:ScreenImpl = 'GnuScreen' + let tmxcnf = $VIMRPLUGIN_TMPDIR . "/tmux.conf" + let cnflines = [ + \ 'set-option -g prefix C-a', + \ 'unbind-key C-b', + \ 'bind-key C-a send-prefix', + \ 'set-window-option -g mode-keys vi', + \ 'set -g status off', + \ "set -g terminal-overrides 'xterm*:smcup@:rmcup@'", + \ 'set -g mode-mouse on', + \ 'set -g mouse-select-pane on', + \ 'set -g mouse-resize-pane on'] + call writefile(cnflines, tmxcnf) + let g:ScreenShellTmuxInitArgs = g:ScreenShellTmuxInitArgs . " -f " . tmxcnf endif endif -let s:tmuxversion = system("tmux -V") -let s:tmuxversion = substitute(s:tmuxversion, '.*tmux \([0-9]\.[0-9]\).*', '\1', '') -if strlen(s:tmuxversion) != 3 - let s:tmuxversion = "1.0" -endif -if g:vimrplugin_tmux && s:tmuxversion < "1.5" - call RWarningMsgInp("Vim-R-plugin requires Tmux >= 1.5") - let g:rplugin_failed = 1 - finish +" Check whether GNU Screen is OK +if g:vimrplugin_screenplugin && g:vimrplugin_tmux == 0 + let g:ScreenImpl = 'GnuScreen' + let s:hasscreen = executable('screen') + if s:hasscreen == 0 + call RWarningMsgInp("The value of vimrplugin_tmux = 0 but the GNU Screen application was not found.") + let g:rplugin_failed = 1 + finish + endif + unlet s:hasscreen endif -unlet s:tmuxversion -if g:vimrplugin_screenplugin - if g:ScreenVersion < "1.5" - call RWarningMsgInp("Vim-R-plugin requires Screen plugin >= 1.5") - let g:rplugin_failed = 1 +"Check whether Conque Shell is OK +if g:vimrplugin_conqueplugin == 1 + if !exists("g:ConqueTerm_Version") || (exists("g:ConqueTerm_Version") && g:ConqueTerm_Version < 230) + let g:vimrplugin_conqueplugin = 0 + call RWarningMsgInp("You are using Conque Shell plugin " . g:ConqueTerm_Version . ". Vim-R-plugin requires Conque Shell >= 2.3") finish endif endif + " Start with an empty list of objects in the workspace let g:rplugin_globalenvlines = [] @@ -3206,13 +3226,12 @@ if has("win32") || has("win64") let g:rplugin_failed = 1 finish endif - let g:rplugin_jspath = g:rplugin_home . "\\r-plugin\\vimActivate.js" if !exists("g:rplugin_rpathadded") if exists("g:vimrplugin_r_path") && isdirectory(g:vimrplugin_r_path) let $PATH = g:vimrplugin_r_path . ";" . $PATH let g:rplugin_Rgui = g:vimrplugin_r_path . "\\Rgui.exe" else - Py GetRPathPy() + Py GetRPath() if exists("s:rinstallpath") if s:rinstallpath == "Not found" call RWarningMsgInp("Could not find R path in Windows Registry. Please, either install R or set the value of 'vimrplugin_r_path'.") @@ -3253,14 +3272,6 @@ if has("win32") || has("win64") endif endif -if g:vimrplugin_conqueplugin == 1 - if !exists("g:ConqueTerm_Version") || (exists("g:ConqueTerm_Version") && g:ConqueTerm_Version < 230) - let g:vimrplugin_conqueplugin = 0 - call RWarningMsgInp("You are using Conque Shell plugin " . g:ConqueTerm_Version . ". Vim-R-plugin requires Conque Shell >= 2.3") - finish - endif -endif - " Are we in a Debian package? Is the plugin running for the first time? let g:rplugin_omnidname = g:rplugin_uservimfiles . "/r-plugin/objlist/" if g:rplugin_home != g:rplugin_uservimfiles @@ -3375,14 +3386,8 @@ if exists("g:vimrplugin_term_cmd") let g:rplugin_termcmd = g:vimrplugin_term_cmd endif -function FinalActions() - Py StopServer() - sleep 200m -endfunction - augroup RBufControl au BufEnter * let g:rplugin_curbuf = bufname("%") - au VimLeavePre * call FinalActions() augroup END if has("gui_running") @@ -3395,9 +3400,6 @@ let g:rplugin_firstbuffer = expand("%:p") let g:rplugin_running_objbr = 0 let g:rplugin_has_new_lib = 0 let g:rplugin_has_new_obj = 0 -let g:rplugin_objbr_port = 0 -let g:rplugin_myport = 0 -let g:rplugin_editor_port = 0 let g:rplugin_vimcomport = 0 let g:rplugin_lastrpl = "" let g:rplugin_ob_busy = 0 diff --git a/r-plugin/vimcom.py b/r-plugin/vimcom.py index 6880a58..7a41f1d 100644 --- a/r-plugin/vimcom.py +++ b/r-plugin/vimcom.py @@ -1,15 +1,9 @@ import socket import vim -import threading import os import re VimComPort = 0 -OtherPort = 0 -MyPort = 0 -srvrsckt = None -th = None -FinishNow = False def DiscoverVimComPort(): global VimComPort @@ -41,12 +35,13 @@ def DiscoverVimComPort(): vim.command("call RWarningMsg('VimCom port not found.')") else: vim.command("let g:rplugin_vimcomport = " + str(VimComPort)) - if repl.find("0.9-3 ") != 0: - vim.command("call RWarningMsg('This version of Vim-R-plugin requires vimcom 0.9-3.')") + if repl.find("0.9-4") != 0: + vim.command("call RWarningMsg('This version of Vim-R-plugin requires vimcom 0.9-4.')") + vim.command("sleep 1") return(VimComPort) -def SendToR(aString): +def SendToVimCom(aString): HOST = "localhost" global VimComPort if VimComPort == 0: @@ -74,129 +69,3 @@ def SendToR(aString): vim.command("let g:rplugin_lastrpl = '" + received + "'") -def VimServer(): - global srvrsckt - global MyPort - global FinishNow - UDP_IP = "127.0.0.1" - MyPort = int(vim.eval("g:rplugin_myport1")) - PortLim = int(vim.eval("g:rplugin_myport2")) - - while True and MyPort < PortLim: - try: - MyPort += 1 - srvrsckt = socket.socket( socket.AF_INET, socket.SOCK_DGRAM ) - srvrsckt.bind( (UDP_IP, MyPort) ) - except: - continue - else: - break - - if srvrsckt == None: - MyPort = 0 - vim.command("call RWarningMsg('Could not bind to any port.')") - return - else: - vim.command("let g:rplugin_myport = " + str(MyPort)) - SendToR("\007" + str(MyPort)) - - while FinishNow == False: - try: - data, addr = srvrsckt.recvfrom( 1024 ) # buffer size is 1024 bytes - if vim.eval("g:rplugin_ob_busy") == "1": - data = "" - if re.match("EXPR ", data): - vim.command("silent exe '" + re.sub("^EXPR ", "", data) + "'") - else: - if re.match("^G", data): - vim.command("call UpdateOB('GlobalEnv')") - else: - if re.match("^L", data): - vim.command("call UpdateOB('libraries')") - else: - if re.match("^B", data): - vim.command("call UpdateOB('GlobalEnv')") - vim.command("call UpdateOB('libraries')") - else: - if re.match("^FINISH", data): - FinishNow = True - MyPort = 0 - else: - if data != "": - vim.command("call RWarningMsg('Strange string received: " + '"' + data + '"' + "')") - vim.command("sleep 1") - - except Exception as errmsg: - errstr = str(errmsg) - errstr = errstr.replace("'", '"') - vim.command("call RWarningMsg('Server failed to read data: " + errstr + "')") - MyPort = 0 - try: - srvrsckt.shutdown(socket.SHUT_RD) - except: - vim.command("call add(g:rplugin_errlist, 'Failed to shutdown 1.')") - pass - srvrsckt.close() - return - try: - srvrsckt.shutdown(socket.SHUT_RD) - except: - vim.command("call add(g:rplugin_errlist, 'Failed to shutdown 2.')") - pass - srvrsckt.close() - if FinishNow == False: - try: - srvrsckt = socket.socket( socket.AF_INET, socket.SOCK_DGRAM ) - srvrsckt.bind( (UDP_IP, MyPort) ) - except Exception as errmsg: - errstr = str(errmsg) - errstr = errstr.replace("'", '"') - vim.command("let g:rplugin_myport = 0") - vim.command("call RWarningMsg('" + errstr + "')") - pass - -def RunServer(): - global th - global FinishNow - FinishNow = False - th = threading.Thread(target=VimServer) - th.start() - -def StopServer(): - global srvrsckt - global MyPort - global FinishNow - global th - FinishNow = True - if VimComPort: - SendToR("\x08Stop Updating Info") - vim.command("let g:rplugin_myport = 0") - ft = vim.eval("&filetype") - if ft == "rbrowser": - VimClient("EXPR let g:rplugin_objbr_port = 0 | let g:vimrplugin_objbr_w = " + vim.eval("&columns")) - if MyPort == 0: - return - try: - srvrsckt.shutdown(socket.SHUT_RD) - except: - vim.command("call add(g:rplugin_errlist, 'Failed to shutdown 3.')") - pass - try: - srvrsckt.close() - except: - vim.command("call add(g:rplugin_errlist, 'Failed to close socket.')") - pass - try: - th.join(0.3) - except: - vim.command("call add(g:rplugin_errlist, 'Failed to join.')") - pass - MyPort = 0 - -def VimClient(msg): - if OtherPort == 0: - return - sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) - sock.sendto(msg, ("127.0.0.1", OtherPort)) - sock.close() - diff --git a/r-plugin/windows.py b/r-plugin/windows.py index 891a250..9d49b89 100644 --- a/r-plugin/windows.py +++ b/r-plugin/windows.py @@ -3,12 +3,15 @@ import string import time import vim +RConsole = 0 +cdata = None try: import win32api - import win32clipboard as w + import win32clipboard import win32com.client import win32con + import win32gui except ImportError: import platform myPyVersion = platform.python_version() @@ -16,54 +19,68 @@ vim.command("call RWarningMsgInp('Please install PyWin32. The Python version being used is: " + myPyVersion + " (" + myArch[0] + ")')") vim.command("let rplugin_pywin32 = 0") - -def SendToRPy(aString): - # backup the clipboard content (if text) - w.OpenClipboard(0) - if w.IsClipboardFormatAvailable(w.CF_TEXT): - cdata = w.GetClipboardData() +def RaiseRConsole(): + global RConsole + if RConsole == 0: + RConsole = win32gui.FindWindow(None, "R Console") + if RConsole == 0: + RConsole = win32gui.FindWindow(None, "R Console (64-bit)") + if RConsole == 0: + RConsole = win32gui.FindWindow(None, "R Console (32-bit)") + if RConsole == 0: + vim.command("call RWarningMsg('Could not find R Console.')") + return False + win32gui.SetForegroundWindow(RConsole) + +def VimSaveClipBoard(): + global cdata + win32clipboard.OpenClipboard(0) + if win32clipboard.IsClipboardFormatAvailable(win32clipboard.CF_TEXT): + cdata = win32clipboard.GetClipboardData() else: cdata = None - w.CloseClipboard() + win32clipboard.CloseClipboard() +def SendToRConsole(aString): + SendToVimCom("\x09" + win32gui.GetWindowText(win32gui.GetForegroundWindow())) finalString = aString.decode("latin-1") - + win32clipboard.OpenClipboard(0) + win32clipboard.EmptyClipboard() + win32clipboard.SetClipboardText(finalString) + win32clipboard.CloseClipboard() sleepTime = float(vim.eval("g:vimrplugin_sleeptime")) - w.OpenClipboard(0) - w.EmptyClipboard() - w.SetClipboardText(finalString) - w.CloseClipboard() - - shell = win32com.client.Dispatch("WScript.Shell") - ok = shell.AppActivate("R Console") - if ok: - time.sleep(sleepTime) - shell.SendKeys("^v") - time.sleep(sleepTime) - else: - vim.command("call RWarningMsg('Is R running?')") - time.sleep(1) - -def RestoreClipboardPy(): + RaiseRConsole() + time.sleep(sleepTime) + win32api.keybd_event(win32con.VK_CONTROL, 0, 0, 0) + win32api.keybd_event(ord('V'), 0, win32con.KEYEVENTF_EXTENDEDKEY | 0, 0) + time.sleep(0.05) + win32api.keybd_event(ord('V'), 0, win32con.KEYEVENTF_EXTENDEDKEY | win32con.KEYEVENTF_KEYUP, 0) + win32api.keybd_event(win32con.VK_CONTROL, 0, win32con.KEYEVENTF_KEYUP, 0) + time.sleep(0.05) + SendToVimCom("\x0ARaise GVim window.") + +def VimRestoreClipboard(): + global cdata if cdata: - w.OpenClipboard(0) - w.EmptyClipboard() - w.SetClipboardText(cdata) - w.CloseClipboard() + win32clipboard.OpenClipboard(0) + win32clipboard.EmptyClipboard() + win32clipboard.SetClipboardText(cdata) + win32clipboard.CloseClipboard() def RClearConsolePy(): - + SendToVimCom("\x09" + win32gui.GetWindowText(win32gui.GetForegroundWindow())) sleepTime = string.atof(vim.eval("g:vimrplugin_sleeptime")) - shell = win32com.client.Dispatch("WScript.Shell") - ok = shell.AppActivate("R Console") - if ok: - shell.SendKeys("^l") - time.sleep(sleepTime) - else: - vim.command("call RWarningMsg('Is R running?')") - time.sleep(1) - -def GetRPathPy(): + RaiseRConsole() + time.sleep(sleepTime) + win32api.keybd_event(win32con.VK_CONTROL, 0, 0, 0) + win32api.keybd_event(ord('L'), 0, win32con.KEYEVENTF_EXTENDEDKEY | 0, 0) + time.sleep(0.05) + win32api.keybd_event(ord('L'), 0, win32con.KEYEVENTF_EXTENDEDKEY | win32con.KEYEVENTF_KEYUP, 0) + win32api.keybd_event(win32con.VK_CONTROL, 0, win32con.KEYEVENTF_KEYUP, 0) + time.sleep(0.05) + SendToVimCom("\x0ARaise GVim window.") + +def GetRPath(): keyName = "SOFTWARE\\R-core\\R" kHandle = None try: @@ -135,4 +152,4 @@ def OpenPDF(fn): vim.command("call RWarningMsg('" + errstr + "')") pass -# vim: sw=4 tabstop=4 expandtab + From 13a35448b70c802111ccb5436ae192237fc3cef3 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 15 Nov 2012 10:18:42 -0300 Subject: [PATCH 0352/1050] Start the Object Browser even in Linux Console. --- r-plugin/common_global.vim | 60 ++++++++++++++++++++------------------ 1 file changed, 31 insertions(+), 29 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 41b1425..3c89fb4 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -820,9 +820,6 @@ function StartObjectBrowser() endif endif - call delete($VIMRPLUGIN_TMPDIR . "/rpane") - call delete($VIMRPLUGIN_TMPDIR . "/object_browser") - Py SendToVimCom("\001Tmux pane") let ii = 0 while !filereadable($VIMRPLUGIN_TMPDIR . "/rpane") && ii < 20 @@ -841,7 +838,6 @@ function StartObjectBrowser() return endif - exe 'Py SendToVimCom("\007' . g:rplugin_obsname . '")' if v:servername == "" let myservername = '""' @@ -880,11 +876,9 @@ function StartObjectBrowser() \ ' return 0', \ ' endif', \ 'endfunction', - \ 'sleep 250m', - \ 'while !filereadable("'. $VIMRPLUGIN_TMPDIR . '/object_browser"' . ') && jj < 40', - \ ' let jj = jj + 1', - \ ' sleep 50m', - \ 'endwhile', + \ 'Py SendToVimCom("\003GlobalEnv")', + \ 'Py SendToVimCom("\004Libraries")', + \ "exe 'Py SendToVimCom(\"\007' . v:servername . '\")'", \ 'call setline(1, ".GlobalEnv | Libraries")', \ 'exe "silent read ' . $VIMRPLUGIN_TMPDIR . '/object_browser"', \ 'redraw'], objbrowserfile) @@ -949,16 +943,25 @@ function StartObjectBrowser() call system("tmux swap-pane -d -s " . g:rplugin_edpane . " -t " . g:rplugin_obpane) endif endif - let ii = 0 - echohl WarningMsg - echo "Please, wait..." - echohl Normal - echon "\r " + if $DISPLAY == "" + call RWarningMsg("The X Window system is required to automatically update the Objetc Browser.") + endif return endif - if v:servername != "" && g:vimrplugin_conqueplugin == 0 - exe 'Py SendToVimCom("\007' . v:servername . '")' + let wmsg = "" + if g:vimrplugin_conqueplugin + let wmsg = "The Object Browser is not automatically updated under Conque Shell." + else + if v:servername == "" + if $DISPLAY == "" && !(has("win32") || has("win64")) + let wmsg = "The X Window system is required to automatically update the Objetc Browser." + else + let wmsg ="The Object Browser will not be automatically updated because Vim's client/server was not started." + endif + else + exe 'Py SendToVimCom("\007' . v:servername . '")' + endif endif " Either load or reload the Object Browser @@ -966,6 +969,7 @@ function StartObjectBrowser() set switchbuf=useopen,usetab if bufloaded(b:objbrtitle) exe "sb " . b:objbrtitle + let wmsg = "" else " Copy the values of some local variables that will be inherited let g:tmp_objbrtitle = b:objbrtitle @@ -1012,23 +1016,20 @@ function StartObjectBrowser() Py SendToVimCom("\004Libraries") call UpdateOB("GlobalEnv") endif + if wmsg != "" + call RWarningMsg(wmsg) + endif endfunction " Open an Object Browser window function RObjBrowser() - if $DISPLAY == "" - if !(has("win32") || has("win64")) - call RWarningMsg("The X Window system is required to run the Objetc Browser.") - return - endif - endif if !has("python") && !has("python3") call RWarningMsg("Python support is required to run the Object Browser.") return endif " Only opens the Object Browser if R is running - if g:vimrplugin_screenplugin && !exists("g:ScreenShellSend") + if g:vimrplugin_screenplugin && !exists("g:ScreenShellSend") && !exists("b:this_is_ob") return endif if g:vimrplugin_conqueplugin && !exists("b:conque_bufname") @@ -1041,12 +1042,13 @@ function RObjBrowser() let g:rplugin_running_objbr = 1 - call StartObjectBrowser() - Py SendToVimCom("\003GlobalEnv") - Py SendToVimCom("\004Libraries") + if !exists("b:this_is_ob") + call StartObjectBrowser() + endif if exists("*UpdateOB") - call UpdateOB("GlobalEnv") - call UpdateOB("libraries") + Py SendToVimCom("\003GlobalEnv") + Py SendToVimCom("\004Libraries") + call UpdateOB("both") endif let g:rplugin_running_objbr = 0 return @@ -3062,7 +3064,7 @@ if has("gui_macvim") || has("gui_mac") || has("mac") || has("macunix") call RSetDefaultValue("g:vimrplugin_applescript", 0) endif else - call RSetDefaultValue("g:vimrplugin_applescript", 0) + let g:vimrplugin_applescript = 0 endif if g:vimrplugin_applescript From efbdad7c163ecf7c208b01c090e32d2a9ef4614d Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 15 Nov 2012 12:58:24 -0300 Subject: [PATCH 0353/1050] Quote variable value. --- r-plugin/common_global.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 3c89fb4..805072e 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -842,7 +842,7 @@ function StartObjectBrowser() if v:servername == "" let myservername = '""' else - let myservername = v:servername + let myservername = '"' . v:servername . '"' endif call writefile([ From 73ff174c3baf838792a19fb62b938cdaeb5c5dd2 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 15 Nov 2012 19:12:20 -0300 Subject: [PATCH 0354/1050] Avoid freezing cross messages between Vim and R. --- doc/r-plugin.txt | 52 ++++++++++++++++++-------------------- ftplugin/rbrowser.vim | 23 ++++++++--------- r-plugin/common_buffer.vim | 3 +++ r-plugin/common_global.vim | 36 +++++++++++--------------- 4 files changed, 53 insertions(+), 61 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index c0bcddb..5f213ac 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -817,16 +817,7 @@ missing features; others would be very time consuming to fix without breaking anything. -5.1. The Object Browser segfaults~ - -If the Vim instance running the Object Browser crashes you may want to close -all Vim instances and kill any Vim wandering around with the command (typed in -a terminal emulator): -> - killall -9 vim -< - -5.2. R's source() issues~ +5.1. R's source() issues~ The R's source() function prints an extra new line between commands if the option echo = TRUE, and error messages and warning are printed only after the @@ -834,26 +825,27 @@ entire code is sourced, which makes it more difficult to find errors in the code sent to R. -5.3. The clipboard's content is lost (Windows only)~ +5.2. The clipboard's content is lost (Windows only)~ On Windows, the plugin copies the command that will be sent to R into the clipboard. Thus, if you have anything in the clipboard it will be lost while using the plugin. -5.4. The menu may not reflect some of your custom key bindings~ +5.3. The menu may not reflect some of your custom key bindings~ If you have created a custom key binding for the Vim-R-plugin, the menu in GVim will not always reflect the correct key binding if it is not the same for Normal, Visual and Insert modes. -5.5. Syntactically correct code may be wrongly indented~ +5.4. Syntactically correct code may be wrongly indented~ If the Vim-R-plugin indents your code wrongly you may get the correct -indentation by adding braces and line breaks to it. Example: +indentation by adding braces and line breaks to it. For example, try to +indent the code below: > - # This code will be wrongly indented + # This code will be wrongly indented: levels(x) <- ## nl == nL or 1 if (nl == nL) as.character(labels) @@ -861,7 +853,7 @@ indentation by adding braces and line breaks to it. Example: class(x) <- c(if(ordered) "ordered", "factor") - # But this one will be correctly indented + # But this one will be correctly indented: levels(x) <- ## nl == nL or 1 if (nl == nL) @@ -871,13 +863,13 @@ indentation by adding braces and line breaks to it. Example: class(x) <- c(if(ordered) "ordered", "factor") < -5.6. Commands are sent twice on Mac OS X~ +5.5. Commands are sent twice on Mac OS X~ If you use the screen plugin with GNU Screen, individual lines may be sent duplicated to R on Mac OS X. -5.7. "VimCom port not found" on OpenBSD~ +5.6. "VimCom port not found" on OpenBSD~ When the loopback interface has both IPv4 and IPv6 addresses vimcom loads ok but apparently does not listen on the IPv4 address (127.0.0.1), only on the @@ -1891,7 +1883,7 @@ You may need CompizConfig Settings Manager installed to enable this feature (look at the "Window Management" section for "Group and Tab Windows"). -9.17. Edit your ~/.Rprofile~ +9.16. Edit your ~/.Rprofile~ You may want to edit your ~/.Rprofile. Two common options are the use of GVim as the text editor and the use of Vim as pager. Example for Linux with these @@ -1943,7 +1935,7 @@ An example for Windows: } < -9.18. Debugging R functions~ +9.17. Debugging R functions~ The Vim-R-Plugin does not have debugging facilities, but you may want to use the R package "debug": @@ -1963,7 +1955,7 @@ on top" or a similar option provided by your desktop manager. There is also the R package "edtdbg" which aims to integrate R debugging facilities with Vim. -9.19. Turn the R-plugin into a global plugin~ +9.18. Turn the R-plugin into a global plugin~ *r-plugin-global* The Vim-R-plugin is a file type plugin. If you want its functionality available for all file types, then go to your ~/.vim/plugin directory and @@ -1977,14 +1969,14 @@ On Windows, you probably will have to make a copy of the file to the ~/vimfiles/plugin directory. -9.20. Disable syntax highlight of R functions~ +9.19. Disable syntax highlight of R functions~ If you want to disable the syntax highlight of R functions edit the file ~/.vim/r-plugin/functions.vim and delete all lines, but do not delete the file. -9.21. Tips for knitr users~ +9.20. Tips for knitr users~ *knitr* If you are using knitr with option cache=TRUE, you may want from time to time to delete all objects in R workspace and all files in the cache directory. If @@ -1999,7 +1991,7 @@ them in your vimrc. For example will produce a german document with a table of contents. -9.22. Start Tmux and Vim at once~ +9.21. Start Tmux and Vim at once~ If you always prefer to run Tmux before running Vim you may want to put in your ~/.bashrc: @@ -2011,7 +2003,7 @@ Then you will be able to start Vim inside a Tmux session by typing: tvim filename.R < -9.23. Integration with the Conque Shell plugin~ +9.22. Integration with the Conque Shell plugin~ *r-plugin-conque* In addition to being integrated with the screen.vim plugin the Vim-R-plugin can also use the Conque Shell plugin, but the Conque Shell still has some @@ -2093,8 +2085,8 @@ we were typing commands directly in the Console it would be beneficial to have the R syntax highlighted. -9.24. Integration with vimshell~ - +9.23. Integration with vimshell~ + *r-plugin-vimshell* Vimshell is still under development, but if you want to integrate it with the Vim-R-plugin, put in your |vimrc|: > @@ -2103,6 +2095,12 @@ Vim-R-plugin, put in your |vimrc|: let vimrplugin_applescript = 0 let vimrplugin_vimshell = 1 < +If you want the automatic updating of the Object Browser even if running Vim +in a terminal emulator, you have to start Vim with the |--servername| +argument. Example: +> + vim --servername OBJBR file.R +< ============================================================================== *r-plugin-news* diff --git a/ftplugin/rbrowser.vim b/ftplugin/rbrowser.vim index 30a2546..8c8ab2a 100644 --- a/ftplugin/rbrowser.vim +++ b/ftplugin/rbrowser.vim @@ -66,9 +66,6 @@ function! UpdateOB(what) if g:rplugin_curview != wht return endif - if g:rplugin_ob_busy - return - endif let g:rplugin_switchedbuf = 0 if $TMUX_PANE == "" @@ -342,20 +339,23 @@ function! OBGetDeleteCmd(lnum) endfunction function! OBSendDeleteCmd(cmd) - let g:rplugin_ob_busy = 1 + Py SendToVimCom("\x08Stop updating info.") if exists("*RBrSendToR") call RBrSendToR(a:cmd) else call SendCmdToR(a:cmd) endif - sleep 250m - let g:rplugin_ob_busy = 0 - call UpdateOB(g:rplugin_curview) - sleep 10m + if g:rplugin_curview == "GlobalEnv" + Py SendToVimCom("\003GlobalEnv") + else + Py SendToVimCom("\004Libraries") + endif + call UpdateOB("both") + exe 'Py SendToVimCom("\x07' . v:servername . '")' endfunction function! OBDelete() - if g:rplugin_ob_busy || line(".") < 3 + if line(".") < 3 return endif let cmd = OBGetDeleteCmd(line(".")) @@ -363,9 +363,6 @@ function! OBDelete() endfunction function! OBMultiDelete() - if g:rplugin_ob_busy - return - endif let fline = line("'<") let eline = line("'>") if fline < 3 @@ -405,7 +402,7 @@ call writefile([], $VIMRPLUGIN_TMPDIR . "/liblist") if $TMUX_PANE == "" - au BufUnload exe 'Py SendToVimCom("\x08Stop updating info.")' + au BufUnload Py SendToVimCom("\x08Stop updating info.") else au BufUnload call ObBrBufUnload() " Don't load problematic plugins diff --git a/r-plugin/common_buffer.vim b/r-plugin/common_buffer.vim index 5888b09..beb7b7e 100644 --- a/r-plugin/common_buffer.vim +++ b/r-plugin/common_buffer.vim @@ -33,6 +33,9 @@ endif " not created yet or is outdated. let b:needsnewomnilist = 0 +" This isn't the Object Browser running externally +let b:rplugin_extern_ob = 0 + " Set the name of the Object Browser caption if not set yet let s:tnr = tabpagenr() if !exists("b:objbrtitle") diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 805072e..74e8ebd 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -780,7 +780,7 @@ endfunction function StartObjectBrowser() if g:vimrplugin_tmux && (g:vimrplugin_screenplugin || g:vimrplugin_external_ob) - if exists("b:this_is_ob") + if b:rplugin_extern_ob " This is the Object Browser let g:rplugin_running_objbr = 0 return @@ -847,7 +847,6 @@ function StartObjectBrowser() call writefile([ \ 'call writefile([$TMUX_PANE], $VIMRPLUGIN_TMPDIR . "/objbrpane")', - \ 'let b:this_is_ob = 1', \ 'let g:rplugin_editor_sname = ' . myservername, \ 'let g:rplugin_edpane = "' . g:rplugin_edpane . '"', \ 'let g:rplugin_rpane = "' . g:rplugin_rpane . '"', @@ -856,6 +855,7 @@ function StartObjectBrowser() \ 'let b:rscript_buffer = "' . bufname("%") . '"', \ 'set filetype=rbrowser', \ 'let $VIMINSTANCEID="' . $VIMINSTANCEID . '"', + \ 'let b:rplugin_extern_ob = 1', \ 'setlocal modifiable', \ 'set shortmess=atI', \ 'set rulerformat=%3(%l%)', @@ -878,7 +878,7 @@ function StartObjectBrowser() \ 'endfunction', \ 'Py SendToVimCom("\003GlobalEnv")', \ 'Py SendToVimCom("\004Libraries")', - \ "exe 'Py SendToVimCom(\"\007' . v:servername . '\")'", + \ "exe 'Py SendToVimCom(\"\\x07' . v:servername . '\")'", \ 'call setline(1, ".GlobalEnv | Libraries")', \ 'exe "silent read ' . $VIMRPLUGIN_TMPDIR . '/object_browser"', \ 'redraw'], objbrowserfile) @@ -1029,7 +1029,7 @@ function RObjBrowser() endif " Only opens the Object Browser if R is running - if g:vimrplugin_screenplugin && !exists("g:ScreenShellSend") && !exists("b:this_is_ob") + if g:vimrplugin_screenplugin && !exists("g:ScreenShellSend") && !b:rplugin_extern_ob return endif if g:vimrplugin_conqueplugin && !exists("b:conque_bufname") @@ -1042,7 +1042,7 @@ function RObjBrowser() let g:rplugin_running_objbr = 1 - if !exists("b:this_is_ob") + if !b:rplugin_extern_ob call StartObjectBrowser() endif if exists("*UpdateOB") @@ -1055,10 +1055,12 @@ function RObjBrowser() endfunction function RBrowserOpenCloseLists(status) - if g:vimrplugin_external_ob || (g:vimrplugin_screenplugin && !exists("b:this_is_ob")) - let stt = a:status + 2 - else + " Avoid possibly freezing cross messages between Vim and R + if exists("g:rplugin_curview") && v:servername != "" + Py SendToVimCom("\x08Stop updating info.") let stt = a:status + else + let stt = a:status + 2 endif let switchedbuf = 0 @@ -1072,17 +1074,16 @@ function RBrowserOpenCloseLists(status) exe 'Py SendToVimCom("' . "\006" . stt . '")' if exists("g:rplugin_curview") - if g:rplugin_curview == "GlobalEnv" - call UpdateOB("GlobalEnv") - else - call UpdateOB("libraries") - endif + call UpdateOB("both") endif if switchedbuf exe "sil noautocmd sb " . g:rplugin_curbuf exe "set switchbuf=" . savesb endif + if exists("g:rplugin_curview") && v:servername != "" + exe 'Py SendToVimCom("\007' . v:servername . '")' + endif endfunction " Scroll conque term buffer (called by CursorHold event) @@ -1105,13 +1106,6 @@ function RScrollTerm() exe "set switchbuf=" . savesb endfunction -" Called by the Object Browser when running remotely: -function RGetRemoteCmd(cmd) - call RWarningMsg(a:cmd) - call SendCmdToR(a:cmd) - echon -endfunction - function RFormatCode() range if g:rplugin_vimcomport == 0 exe "Py DiscoverVimComPort()" @@ -2205,7 +2199,7 @@ function RAction(rcmd) else let pkg = "" endif - if exists("b:this_is_ob") + if b:rplugin_extern_ob if g:rplugin_edpane == "none" call RWarningMsg("Cmd not available.") else From 2ba26df09a002ca7bf1b3afca9683ae8f4ad519b Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Fri, 16 Nov 2012 16:04:23 -0300 Subject: [PATCH 0355/1050] Fix minor bugs. --- ftplugin/rbrowser.vim | 4 +- r-plugin/common_buffer.vim | 8 ++- r-plugin/common_global.vim | 134 +++++++++++++++++++++---------------- 3 files changed, 86 insertions(+), 60 deletions(-) diff --git a/ftplugin/rbrowser.vim b/ftplugin/rbrowser.vim index 8c8ab2a..3e45756 100644 --- a/ftplugin/rbrowser.vim +++ b/ftplugin/rbrowser.vim @@ -351,7 +351,9 @@ function! OBSendDeleteCmd(cmd) Py SendToVimCom("\004Libraries") endif call UpdateOB("both") - exe 'Py SendToVimCom("\x07' . v:servername . '")' + if v:servername != "" + exe 'Py SendToVimCom("\x07' . v:servername . '")' + endif endfunction function! OBDelete() diff --git a/r-plugin/common_buffer.vim b/r-plugin/common_buffer.vim index beb7b7e..fd8e4d5 100644 --- a/r-plugin/common_buffer.vim +++ b/r-plugin/common_buffer.vim @@ -99,7 +99,7 @@ if g:vimrplugin_by_vim_instance == 1 unlet s:sname endif -if g:rplugin_firstbuffer == "" +if exists("g:rplugin_firstbuffer") && g:rplugin_firstbuffer == "" " The file global_r_plugin.vim was copied to ~/.vim/plugin let g:rplugin_firstbuffer = expand("%:p") endif @@ -111,7 +111,11 @@ else endif let s:uniquename = substitute(s:uniquename, '\W', '', 'g') let $VIMINSTANCEID = $VIMRPLUGIN_TMPDIR . "/" . s:uniquename . "-port" -let g:rplugin_obsname = toupper(substitute(substitute(expand("%:r"), '\W', '', 'g'), "_", "", "g")) +if has("clientserver") + let g:rplugin_obsname_arg = "--servername " . toupper(substitute(substitute(expand("%:r"), '\W', '', 'g'), "_", "", "g")) +else + let g:rplugin_obsname_arg = " " +endif unlet s:uniquename let g:rplugin_lastft = &filetype diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 74e8ebd..d168649 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -566,7 +566,7 @@ function StartR(whatr) endif endif - if g:vimrplugin_applescript && g:vimrplugin_screenplugin == 0 && g:vimrplugin_conqueplugin == 0 + if g:vimrplugin_applescript if g:rplugin_r64app && g:vimrplugin_i386 == 0 let rcmd = "/Applications/R64.app" else @@ -600,11 +600,9 @@ function StartR(whatr) endif if g:vimrplugin_screenplugin - if g:vimrplugin_only_in_tmux && g:vimrplugin_tmux - if $TMUX_PANE == "" - call RWarningMsg("Not inside Tmux.") - return - endif + if g:vimrplugin_only_in_tmux && g:vimrplugin_tmux && $TMUX_PANE == "" + call RWarningMsg("Not inside Tmux.") + return endif if $TERM =~ "screen" @@ -703,13 +701,12 @@ function StartR(whatr) endif else if g:vimrplugin_tmux - + call system('export VIMRPLUGIN_TMPDIR=' . $VIMRPLUGIN_TMPDIR) + call system('export VIMINSTANCEID=' . $VIMINSTANCEID) " Start the terminal emulator even if inside a Tmux session if $TMUX != "" let tmuxenv = $TMUX let $TMUX = "" - call system('export VIMRPLUGIN_TMPDIR=' . $VIMRPLUGIN_TMPDIR) - call system('export VIMINSTANCEID=' . $VIMINSTANCEID) call system('tmux set-option -ga update-environment " TMUX_PANE VIMRPLUGIN_TMPDIR VIMINSTANCEID"') endif @@ -731,14 +728,13 @@ function StartR(whatr) let tmxcnf = "-f " . tmxcnf endif if $DISPLAY == "" - if !(has("win32") || has("win64")) - call RWarningMsg("The X Window system is required to run R in an external terminal.") - lcd - - return - endif + call RWarningMsg("The X Window system is required to run R in an external terminal.") + lcd - + return endif call system("tmux has-session -t " . b:screensname) if v:shell_error + let rcmd = "VIMRPLUGIN_TMPDIR=" . $VIMRPLUGIN_TMPDIR . " VIMINSTANCEID=" . $VIMINSTANCEID . " " . rcmd if g:rplugin_termcmd =~ "gnome-terminal" || g:rplugin_termcmd =~ "xfce4-terminal" || g:rplugin_termcmd =~ "terminal" || g:rplugin_termcmd =~ "iterm" let opencmd = printf("%s 'tmux -2 %s new-session -s %s \"%s\"' &", g:rplugin_termcmd, tmxcnf, b:screensname, rcmd) else @@ -752,6 +748,16 @@ function StartR(whatr) endif endif else + if $DISPLAY == "" + call RWarningMsg("The X Window system is required to run R in an external terminal.") + lcd - + return + endif + if !executable("screen") + call RWarningMsgInp("The value of vimrplugin_tmux = 0 but the GNU Screen application was not found.") + lcd - + return + endif let scrrc = RWriteScreenRC() " Some terminals want quotes (see screen.vim) if g:rplugin_termcmd =~ "gnome-terminal" || g:rplugin_termcmd =~ "xfce4-terminal" || g:rplugin_termcmd =~ "terminal" || g:rplugin_termcmd =~ "iterm" @@ -878,7 +884,9 @@ function StartObjectBrowser() \ 'endfunction', \ 'Py SendToVimCom("\003GlobalEnv")', \ 'Py SendToVimCom("\004Libraries")', - \ "exe 'Py SendToVimCom(\"\\x07' . v:servername . '\")'", + \ 'if v:servername != ""', + \ " exe 'Py SendToVimCom(\"\\x07' . v:servername . '\")'", + \ 'endif', \ 'call setline(1, ".GlobalEnv | Libraries")', \ 'exe "silent read ' . $VIMRPLUGIN_TMPDIR . '/object_browser"', \ 'redraw'], objbrowserfile) @@ -906,7 +914,7 @@ function StartObjectBrowser() else let obpane = g:rplugin_edpane endif - let cmd = "tmux split-window -d -h -l " . panewidth . " -t " . obpane . ' "vim --servername ' . g:rplugin_obsname. ' -c ' . "'source " . objbrowserfile . "'" . '"' + let cmd = "tmux split-window -d -h -l " . panewidth . " -t " . obpane . ' "vim ' . g:rplugin_obsname_arg . ' -c ' . "'source " . objbrowserfile . "'" . '"' call delete($VIMRPLUGIN_TMPDIR . "/objbrpane") @@ -943,8 +951,12 @@ function StartObjectBrowser() call system("tmux swap-pane -d -s " . g:rplugin_edpane . " -t " . g:rplugin_obpane) endif endif - if $DISPLAY == "" - call RWarningMsg("The X Window system is required to automatically update the Objetc Browser.") + if !has("clientserver") + call RWarningMsg("The +clientserver feature is required to automatically update the Object Browser.") + else + if $DISPLAY == "" + call RWarningMsg("The X Window system is required to automatically update the Object Browser.") + endif endif return endif @@ -954,10 +966,14 @@ function StartObjectBrowser() let wmsg = "The Object Browser is not automatically updated under Conque Shell." else if v:servername == "" - if $DISPLAY == "" && !(has("win32") || has("win64")) - let wmsg = "The X Window system is required to automatically update the Objetc Browser." + if !has("clientserver") + let wmsg = "The +clientserver feature is required to automatically update the Object Browser." else - let wmsg ="The Object Browser will not be automatically updated because Vim's client/server was not started." + if $DISPLAY == "" && !(has("win32") || has("win64")) + let wmsg = "The X Window system is required to automatically update the Object Browser." + else + let wmsg ="The Object Browser will not be automatically updated because Vim's client/server was not started." + endif endif else exe 'Py SendToVimCom("\007' . v:servername . '")' @@ -1239,7 +1255,7 @@ function SendCmdToR(cmd) return 1 endif - if g:vimrplugin_applescript && g:vimrplugin_screenplugin == 0 && g:vimrplugin_conqueplugin == 0 + if g:vimrplugin_applescript if g:rplugin_r64app && g:vimrplugin_i386 == 0 let rcmd = "R64" else @@ -2967,6 +2983,9 @@ call RSetDefaultValue("g:vimrplugin_i386", 0) call RSetDefaultValue("g:vimrplugin_screenvsplit", 0) call RSetDefaultValue("g:vimrplugin_conquevsplit", 0) call RSetDefaultValue("g:vimrplugin_conqueplugin", 0) +call RSetDefaultValue("g:vimrplugin_screenplugin", 1) +call RSetDefaultValue("g:vimrplugin_vimshell", 0) +call RSetDefaultValue("g:vimrplugin_tmux", 1) call RSetDefaultValue("g:vimrplugin_vimshell", 0) call RSetDefaultValue("g:vimrplugin_listmethods", 0) call RSetDefaultValue("g:vimrplugin_specialplot", 0) @@ -3006,10 +3025,6 @@ endfor unlet objbrplace unlet obpllen -if g:vimrplugin_external_ob == 1 - let g:vimrplugin_objbr_place = substitute(g:vimrplugin_objbr_place, "script", "console", "") -endif - " python has priority over python3, unless ConqueTerm_PyVersion == 3 if has("python3") && exists("g:ConqueTerm_PyVersion") && g:ConqueTerm_PyVersion == 3 command! -nargs=+ Py :py3 @@ -3066,9 +3081,7 @@ if g:vimrplugin_applescript let g:vimrplugin_screenplugin = 0 let g:vimrplugin_conqueplugin = 0 let g:vimrplugin_tmux = 0 -else - call RSetDefaultValue("g:vimrplugin_screenplugin", 1) - call RSetDefaultValue("g:vimrplugin_tmux", 1) + let g:vimrplugin_only_in_tmux = 0 endif if g:vimrplugin_screenplugin @@ -3078,13 +3091,11 @@ if g:vimrplugin_screenplugin endif if g:vimrplugin_vimshell - if !exists("g:vimshell_environment_term") - let g:vimrplugin_vimshell = 0 - endif let g:vimrplugin_screenplugin = 0 let g:vimrplugin_conqueplugin = 0 let g:vimrplugin_applescript = 0 let g:vimrplugin_tmux = 0 + let g:vimrplugin_only_in_tmux = 0 endif if g:vimrplugin_conqueplugin @@ -3092,10 +3103,20 @@ if g:vimrplugin_conqueplugin let g:vimrplugin_vimshell = 0 let g:vimrplugin_applescript = 0 let g:vimrplugin_tmux = 0 + let g:vimrplugin_only_in_tmux = 0 endif " ======================================================================== +if !g:vimrplugin_tmux + let g:vimrplugin_external_ob = 0 +endif + +if g:vimrplugin_external_ob == 1 + let g:vimrplugin_objbr_place = substitute(g:vimrplugin_objbr_place, "script", "console", "") +endif + + if has("win32") || has("win64") call RSetDefaultValue("g:vimrplugin_conquesleep", 200) else @@ -3118,13 +3139,14 @@ endif " Check whether Tmux is OK if g:vimrplugin_tmux - let s:hastmux = executable('tmux') - if s:hastmux == 0 + if !exists("g:ScreenShellTmuxInitArgs") + let g:ScreenShellTmuxInitArgs = " " + endif + if !executable('tmux') call RWarningMsgInp("Please, install the 'Tmux' application to enable the Vim-R-plugin.") let g:rplugin_failed = 1 finish endif - unlet s:hastmux let s:tmuxversion = system("tmux -V") let s:tmuxversion = substitute(s:tmuxversion, '.*tmux \([0-9]\.[0-9]\).*', '\1', '') @@ -3144,7 +3166,7 @@ if g:vimrplugin_tmux " xterm-256color. See :h r-plugin-tips if g:vimrplugin_notmuxconf == 0 if $DISPLAY != "" || $TERM =~ "xterm" - let g:ScreenShellTmuxInitArgs = "-2" + let g:ScreenShellTmuxInitArgs .= "-2" endif let tmxcnf = $VIMRPLUGIN_TMPDIR . "/tmux.conf" let cnflines = [ @@ -3158,27 +3180,39 @@ if g:vimrplugin_tmux \ 'set -g mouse-select-pane on', \ 'set -g mouse-resize-pane on'] call writefile(cnflines, tmxcnf) - let g:ScreenShellTmuxInitArgs = g:ScreenShellTmuxInitArgs . " -f " . tmxcnf + let g:ScreenShellTmuxInitArgs .= " -f " . tmxcnf endif endif " Check whether GNU Screen is OK -if g:vimrplugin_screenplugin && g:vimrplugin_tmux == 0 +if g:vimrplugin_screenplugin && !g:vimrplugin_tmux let g:ScreenImpl = 'GnuScreen' - let s:hasscreen = executable('screen') - if s:hasscreen == 0 + if !executable('screen') call RWarningMsgInp("The value of vimrplugin_tmux = 0 but the GNU Screen application was not found.") let g:rplugin_failed = 1 finish endif - unlet s:hasscreen +endif + +"Check whether Vim Shell is OK +if g:vimrplugin_vimshell + if !exists("g:vimshell_environment_term") + call RWarningMsgInp("Vim-R-plugin: You are trying to use Vim Shell plugin which is not installed.") + let g:rplugin_failed = 1 + finish + endif endif "Check whether Conque Shell is OK if g:vimrplugin_conqueplugin == 1 - if !exists("g:ConqueTerm_Version") || (exists("g:ConqueTerm_Version") && g:ConqueTerm_Version < 230) - let g:vimrplugin_conqueplugin = 0 + if !exists("g:ConqueTerm_Version") + call RWarningMsgInp("Vim-R-plugin: You are trying to use Conque Shell plugin which is either too old or not installed.") + let g:rplugin_failed = 1 + finish + endif + if exists("g:ConqueTerm_Version") && g:ConqueTerm_Version < 230 call RWarningMsgInp("You are using Conque Shell plugin " . g:ConqueTerm_Version . ". Vim-R-plugin requires Conque Shell >= 2.3") + let g:rplugin_failed = 1 finish endif endif @@ -3404,17 +3438,3 @@ let g:rplugin_errlist = [] call SetRPath() -" Debugging code: -if g:vimrplugin_screenplugin && g:vimrplugin_conqueplugin - echoerr "Error number 1" -endif -if g:vimrplugin_screenplugin && g:vimrplugin_applescript - echoerr "Error number 2" -endif -if g:vimrplugin_conqueplugin && g:vimrplugin_applescript - echoerr "Error number 3" -endif -if g:vimrplugin_screenplugin && has("gui_running") - echoerr "Error number 4" -endif - From 536912c27945ca76e599cd0c9fc630e97253af1a Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 17 Nov 2012 08:27:07 -0300 Subject: [PATCH 0356/1050] Update. --- doc/r-plugin.txt | 50 +++++++++++++++++++++--------------------------- 1 file changed, 22 insertions(+), 28 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 5f213ac..a5a6df0 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -35,12 +35,12 @@ The latest stable version of this plugin is available at: http://www.vim.org/scripts/script.php?script_id=2628 -Feedback is welcomed. Please submit bug reports and feature requests to the -developers; we are very interested in what you like and what you would like to -see in future releases. Do not like a feature? Tell us and we may add an -option to disable it. Cryptic error message are bugs... Please report them. -The plugin should emit useful warnings if you do things it was not programmed -to deal with. +Feedback is welcomed. Please submit bug reports to the developers. Do not like +a feature? Tell us and we may add an option to disable it. The plugin should +emit useful warnings if you do things it was not programmed to deal with. +Cryptic error message are bugs... Please report them at: + + https://github.com/jcfaria/Vim-R-plugin/issues ============================================================================== @@ -184,7 +184,7 @@ show how the plugin will work on Linux in different conditions: Screen plugin (GNU Screen) vimrplugin_tmux = 0 Tmux (external terminal) vimrplugin_screenplugin = 0 GNU Screen (external terminal) vimrplugin_screenplugin = 0 and - vimrplugin_tmux = 0 + vimrplugin_tmux = 0 GVim Condition~ @@ -1182,7 +1182,7 @@ example show how to adjust the value of sleeptime in your |vimrc|: *vimrplugin_noscreenrc* *vimrplugin_notmuxconf* GVim (or Vim running R in an external terminal emulator) runs Tmux with a -specially built configuration file. It also overwrite the value of +specially built configuration file. It also appends some arguments to |g:ScreenShellTmuxInitArgs|. If you want to use your own ~/.tmux.conf and |g:ScreenShellTmuxInitArgs|, put in your |vimrc|: > @@ -1221,17 +1221,10 @@ application, put in your |vimrc|: > let vimrplugin_tmux = 0 < -If Tmux is not installed, the Vim-R-plugin will use GNU Screen. - Start Vim and do the command rf. The screen.vim plugin will split -the terminal in two regions and will run R in one of them. Using both plugins -at the same time is especially useful for users who may prefer to use Vim and -R in a terminal emulator, rather than using the graphical interface provided -by GVim. - -If you prefer to use the plugin in a terminal emulator in a Tmux session, you -may prefer to start Tmux before Vim (see |r-plugin-tmux|). In this case, you -may want to set the value of |vimrplugin_only_in_tmux| as below: +the terminal in two regions and will run R in one of them. If you always +prefer to start Tmux before Vim (see |r-plugin-tmux|) you may want to set the +value of |vimrplugin_only_in_tmux| as below: > let vimrplugin_only_in_tmux = 1 < @@ -1623,7 +1616,8 @@ directory after the installation: 9.1. Is it possible to stop R from within Vim?~ -Sorry, it is not possible. You have to press ^C into R's terminal emulator. +Sorry, it is not possible. The plugin can only send the quit() command. If you +want to stop R, you have to press ^C into R's terminal emulator. 9.2. Html help and custom pager~ @@ -1639,14 +1633,14 @@ and in your |vimrc| (see |vimrplugin_vimpager|): 9.3. How do marked blocks work?~ *r-plugin-showmarks* -Vim allows several marks (bookmarks). The most commonly used marks are the -lowercase alphabet letters. If the cursor is between any two marks, the plugin -will send the lines between them to R. If the cursor is above the first mark, -the plugin will send from the beginning of the file to the mark. If the cursor -is below the last mark, the plugin will send from the mark to the end of the -file. The mark above the cursor is included and the mark below is excluded -from the block to be sent to R. To create a mark, press m in Normal -mode. +Vim allows you to put several marks (bookmarks) in buffers. The most commonly +used marks are the lowercase alphabet letters. If the cursor is between any +two marks, the plugin will send the lines between them to R. If the cursor is +above the first mark, the plugin will send from the beginning of the file to +the mark. If the cursor is below the last mark, the plugin will send from the +mark to the end of the file. The mark above the cursor is included and the +mark below is excluded from the block to be sent to R. To create a mark, press +m in Normal mode. We recommended the use of ShowMarks plugin which show what lines have marks defined. The plugin is available at: @@ -2106,7 +2100,7 @@ argument. Example: *r-plugin-news* 10. News~ -0.9.9 (2012-11-14) +0.9.9 (2012-11-17) * New commands: :Rinsert and :Rformat. * Automatically update the Object Browser in GVim. From c77a7a60b4490ab2af7da662e2d1ec8b7a826941 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 17 Nov 2012 21:09:47 -0300 Subject: [PATCH 0357/1050] Set the value of r_is_busy in vimcom. --- ftplugin/rbrowser.vim | 12 ++++++++++-- r-plugin/common_global.vim | 30 ++++++++++++++++++++---------- 2 files changed, 30 insertions(+), 12 deletions(-) diff --git a/ftplugin/rbrowser.vim b/ftplugin/rbrowser.vim index 3e45756..8a1de6e 100644 --- a/ftplugin/rbrowser.vim +++ b/ftplugin/rbrowser.vim @@ -126,7 +126,11 @@ function! RBrowserDoubleClick() let key = RBrowserGetName(1, line(".")) if g:rplugin_curview == "GlobalEnv" exe 'Py SendToVimCom("' . "\005" . '-' . substitute(key, '\$', '-', "g") . '")' - call UpdateOB("GlobalEnv") + if g:rplugin_lastrpl == "R is busy." + call RWarningMsg("R is busy.") + else + call UpdateOB("GlobalEnv") + endif else let key = substitute(key, '\$', '-', "g") let key = substitute(key, '`', '', "g") @@ -134,7 +138,11 @@ function! RBrowserDoubleClick() let key = "package:" . RBGetPkgName() . '-' . key endif exe 'Py SendToVimCom("' . "\005" . key . '")' - call UpdateOB("libraries") + if g:rplugin_lastrpl == "R is busy." + call RWarningMsg("R is busy.") + else + call UpdateOB("libraries") + endif endif endfunction diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index d168649..b3c16b9 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -1009,10 +1009,10 @@ function StartObjectBrowser() else set nosplitright endif - exe "vsplit " . b:objbrtitle + sil exe "vsplit " . b:objbrtitle let &splitright = l:sr - exe "vertical resize " . g:vimrplugin_objbr_w - set filetype=rbrowser + sil exe "vertical resize " . g:vimrplugin_objbr_w + sil set filetype=rbrowser " Inheritance of some local variables if g:vimrplugin_conqueplugin == 1 @@ -1089,7 +1089,9 @@ function RBrowserOpenCloseLists(status) exe 'Py SendToVimCom("' . "\006" . stt . '")' - if exists("g:rplugin_curview") + if g:rplugin_lastrpl == "R is busy." + call RWarningMsg("R is busy.") + elseif exists("g:rplugin_curview") call UpdateOB("both") endif @@ -1168,6 +1170,7 @@ endfunction " Function to send commands " return 0 on failure and 1 on success function SendCmdToR(cmd) + Py SendToVimCom("\x09Set R as busy.") if g:vimrplugin_ca_ck let cmd = "\001" . "\013" . a:cmd else @@ -1184,9 +1187,7 @@ function SendCmdToR(cmd) for i in range(0, slen) let str = str . printf("\\x%02X", char2nr(cmd[i])) endfor - " Py VimSaveClipBoard() exe "Py" . " SendToRConsole(b'" . str . "')" - " Py VimRestoreClipboard() endif return 1 endif @@ -1721,15 +1722,24 @@ function RQuit(how) endif if exists("b:quit_command") - call SendCmdToR(b:quit_command) + let qcmd = b:quit_command else if a:how == "save" - call SendCmdToR('quit(save = "yes")') - sleep 1 + let qcmd = 'quit(save = "yes")' else - call SendCmdToR('quit(save = "no")') + let qcmd = 'quit(save = "no")' endif endif + + if has("win32") || has("win64") + exe "Py SendQuitMsg('" . qcmd . "')" + else + call SendCmdToR(qcmd) + if a:how == "save" + sleep 1 + endif + endif + sleep 250m " check if the pane still exists before trying to kill it because the From 92ca9e3f782a24f9fd993934f89e9118c6eacb0b Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 17 Nov 2012 21:10:40 -0300 Subject: [PATCH 0358/1050] Don't raise R Console window to send ^V to it. --- r-plugin/windows.py | 117 ++++++++++++++++++++++++++------------------ 1 file changed, 70 insertions(+), 47 deletions(-) diff --git a/r-plugin/windows.py b/r-plugin/windows.py index 9d49b89..94b1fe6 100644 --- a/r-plugin/windows.py +++ b/r-plugin/windows.py @@ -4,7 +4,6 @@ import time import vim RConsole = 0 -cdata = None try: import win32api @@ -19,66 +18,90 @@ vim.command("call RWarningMsgInp('Please install PyWin32. The Python version being used is: " + myPyVersion + " (" + myArch[0] + ")')") vim.command("let rplugin_pywin32 = 0") -def RaiseRConsole(): +def FindRConsole(): global RConsole + RConsole = win32gui.FindWindow(None, "R Console") if RConsole == 0: - RConsole = win32gui.FindWindow(None, "R Console") + RConsole = win32gui.FindWindow(None, "R Console (64-bit)") if RConsole == 0: - RConsole = win32gui.FindWindow(None, "R Console (64-bit)") + RConsole = win32gui.FindWindow(None, "R Console (32-bit)") if RConsole == 0: - RConsole = win32gui.FindWindow(None, "R Console (32-bit)") - if RConsole == 0: - vim.command("call RWarningMsg('Could not find R Console.')") - return False - win32gui.SetForegroundWindow(RConsole) - -def VimSaveClipBoard(): - global cdata + vim.command("call RWarningMsg('Could not find R Console.')") + +def SendToRConsole(aString): + global RConsole + SendToVimCom("\x09Set R as busy.") + finalString = aString.decode("latin-1") + "\n" win32clipboard.OpenClipboard(0) - if win32clipboard.IsClipboardFormatAvailable(win32clipboard.CF_TEXT): - cdata = win32clipboard.GetClipboardData() - else: - cdata = None + win32clipboard.EmptyClipboard() + win32clipboard.SetClipboardText(finalString) win32clipboard.CloseClipboard() + if RConsole == 0: + FindRConsole() + if RConsole: + win32api.keybd_event(0x11, 0, 0, 0) + try: + win32api.PostMessage(RConsole, 0x100, 0x56, 0x002F0001) + except: + vim.command("call RWarningMsg('R Console window not found [1].')") + RConsole = 0 + pass + if RConsole: + time.sleep(0.05) + try: + win32api.PostMessage(RConsole, 0x101, 0x56, 0xC02F0001) + except: + vim.command("call RWarningMsg('R Console window not found [2].')") + pass + win32api.keybd_event(0x11, 0, 2, 0) -def SendToRConsole(aString): - SendToVimCom("\x09" + win32gui.GetWindowText(win32gui.GetForegroundWindow())) - finalString = aString.decode("latin-1") +def RClearConsolePy(): + global RConsole + SendToVimCom("\x09Set R as busy.") + if RConsole == 0: + FindRConsole() + if RConsole: + win32api.keybd_event(0x11, 0, 0, 0) + try: + win32api.PostMessage(RConsole, 0x100, 0x4C, 0x002F0001) + except: + vim.command("call RWarningMsg('R Console window not found [1].')") + RConsole = 0 + pass + if RConsole: + time.sleep(0.05) + try: + win32api.PostMessage(RConsole, 0x101, 0x4C, 0xC02F0001) + except: + vim.command("call RWarningMsg('R Console window not found [2].')") + pass + win32api.keybd_event(0x11, 0, 2, 0) + +def RaiseRConsole(): + global RConsole + FindRConsole() + if RConsole: + win32gui.SetForegroundWindow(RConsole) + +def SendQuitMsg(aString): + SendToVimCom("\x09Set R as busy.") + finalString = aString.decode("latin-1") + "\n" win32clipboard.OpenClipboard(0) win32clipboard.EmptyClipboard() win32clipboard.SetClipboardText(finalString) win32clipboard.CloseClipboard() sleepTime = float(vim.eval("g:vimrplugin_sleeptime")) RaiseRConsole() - time.sleep(sleepTime) - win32api.keybd_event(win32con.VK_CONTROL, 0, 0, 0) - win32api.keybd_event(ord('V'), 0, win32con.KEYEVENTF_EXTENDEDKEY | 0, 0) - time.sleep(0.05) - win32api.keybd_event(ord('V'), 0, win32con.KEYEVENTF_EXTENDEDKEY | win32con.KEYEVENTF_KEYUP, 0) - win32api.keybd_event(win32con.VK_CONTROL, 0, win32con.KEYEVENTF_KEYUP, 0) - time.sleep(0.05) - SendToVimCom("\x0ARaise GVim window.") - -def VimRestoreClipboard(): - global cdata - if cdata: - win32clipboard.OpenClipboard(0) - win32clipboard.EmptyClipboard() - win32clipboard.SetClipboardText(cdata) - win32clipboard.CloseClipboard() + if RConsole: + time.sleep(sleepTime) + win32api.keybd_event(win32con.VK_CONTROL, 0, 0, 0) + win32api.keybd_event(ord('V'), 0, win32con.KEYEVENTF_EXTENDEDKEY | 0, 0) + time.sleep(0.05) + win32api.keybd_event(ord('V'), 0, win32con.KEYEVENTF_EXTENDEDKEY | win32con.KEYEVENTF_KEYUP, 0) + win32api.keybd_event(win32con.VK_CONTROL, 0, win32con.KEYEVENTF_KEYUP, 0) + time.sleep(0.05) + -def RClearConsolePy(): - SendToVimCom("\x09" + win32gui.GetWindowText(win32gui.GetForegroundWindow())) - sleepTime = string.atof(vim.eval("g:vimrplugin_sleeptime")) - RaiseRConsole() - time.sleep(sleepTime) - win32api.keybd_event(win32con.VK_CONTROL, 0, 0, 0) - win32api.keybd_event(ord('L'), 0, win32con.KEYEVENTF_EXTENDEDKEY | 0, 0) - time.sleep(0.05) - win32api.keybd_event(ord('L'), 0, win32con.KEYEVENTF_EXTENDEDKEY | win32con.KEYEVENTF_KEYUP, 0) - win32api.keybd_event(win32con.VK_CONTROL, 0, win32con.KEYEVENTF_KEYUP, 0) - time.sleep(0.05) - SendToVimCom("\x0ARaise GVim window.") def GetRPath(): keyName = "SOFTWARE\\R-core\\R" From 4abc32bce95db0c90963497416826f715cdef077 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 17 Nov 2012 21:14:57 -0300 Subject: [PATCH 0359/1050] Update. --- doc/r-plugin.txt | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index a5a6df0..37f4ee7 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -1868,16 +1868,7 @@ line in your |vimrc|: nmap sm :update:call SendCmdToR('system("make")') < -9.15. Group windows with compiz~ - -If you are using Compiz, it may be easier to work with the plugin if the -various related windows (editor, terminal, and graphics window) are grouped -because they will be raised together when one of them receives the focus. -You may need CompizConfig Settings Manager installed to enable this feature -(look at the "Window Management" section for "Group and Tab Windows"). - - -9.16. Edit your ~/.Rprofile~ +9.15. Edit your ~/.Rprofile~ You may want to edit your ~/.Rprofile. Two common options are the use of GVim as the text editor and the use of Vim as pager. Example for Linux with these @@ -1929,7 +1920,7 @@ An example for Windows: } < -9.17. Debugging R functions~ +9.16. Debugging R functions~ The Vim-R-Plugin does not have debugging facilities, but you may want to use the R package "debug": @@ -1949,7 +1940,7 @@ on top" or a similar option provided by your desktop manager. There is also the R package "edtdbg" which aims to integrate R debugging facilities with Vim. -9.18. Turn the R-plugin into a global plugin~ +9.17. Turn the R-plugin into a global plugin~ *r-plugin-global* The Vim-R-plugin is a file type plugin. If you want its functionality available for all file types, then go to your ~/.vim/plugin directory and @@ -1963,14 +1954,14 @@ On Windows, you probably will have to make a copy of the file to the ~/vimfiles/plugin directory. -9.19. Disable syntax highlight of R functions~ +9.18. Disable syntax highlight of R functions~ If you want to disable the syntax highlight of R functions edit the file ~/.vim/r-plugin/functions.vim and delete all lines, but do not delete the file. -9.20. Tips for knitr users~ +9.19. Tips for knitr users~ *knitr* If you are using knitr with option cache=TRUE, you may want from time to time to delete all objects in R workspace and all files in the cache directory. If @@ -1985,7 +1976,7 @@ them in your vimrc. For example will produce a german document with a table of contents. -9.21. Start Tmux and Vim at once~ +9.20. Start Tmux and Vim at once~ If you always prefer to run Tmux before running Vim you may want to put in your ~/.bashrc: @@ -1997,7 +1988,7 @@ Then you will be able to start Vim inside a Tmux session by typing: tvim filename.R < -9.22. Integration with the Conque Shell plugin~ +9.21. Integration with the Conque Shell plugin~ *r-plugin-conque* In addition to being integrated with the screen.vim plugin the Vim-R-plugin can also use the Conque Shell plugin, but the Conque Shell still has some @@ -2079,7 +2070,7 @@ we were typing commands directly in the Console it would be beneficial to have the R syntax highlighted. -9.23. Integration with vimshell~ +9.22. Integration with vimshell~ *r-plugin-vimshell* Vimshell is still under development, but if you want to integrate it with the Vim-R-plugin, put in your |vimrc|: @@ -2104,6 +2095,7 @@ argument. Example: * New commands: :Rinsert and :Rformat. * Automatically update the Object Browser in GVim. + * On MS Windows, don't raise the R Console before sending CTRL-V to it. 0.9.8 (2012-10-13) From a612e0fb692dfe0c517279921f879fc8a7081f87 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sun, 18 Nov 2012 09:45:51 -0300 Subject: [PATCH 0360/1050] Warn only once if VimCom port wasn't found. --- r-plugin/vimcom.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/r-plugin/vimcom.py b/r-plugin/vimcom.py index 7a41f1d..3b20519 100644 --- a/r-plugin/vimcom.py +++ b/r-plugin/vimcom.py @@ -4,8 +4,10 @@ import os import re VimComPort = 0 +PortWarn = False def DiscoverVimComPort(): + global PortWarn global VimComPort HOST = "localhost" VimComPort = 9998 @@ -32,9 +34,12 @@ def DiscoverVimComPort(): if VimComPort >= 10050: VimComPort = 0 vim.command("let g:rplugin_vimcomport = 0") - vim.command("call RWarningMsg('VimCom port not found.')") + if not PortWarn: + vim.command("call RWarningMsg('VimCom port not found.')") + PortWarn = True else: vim.command("let g:rplugin_vimcomport = " + str(VimComPort)) + PortWarn = False if repl.find("0.9-4") != 0: vim.command("call RWarningMsg('This version of Vim-R-plugin requires vimcom 0.9-4.')") vim.command("sleep 1") From f91b6a0150f2ec4532523385b6843069ca0a16eb Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 22 Nov 2012 14:54:14 -0300 Subject: [PATCH 0361/1050] Don't update the Object Browser during RAction(). --- r-plugin/common_global.vim | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index b3c16b9..c47d050 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -2208,7 +2208,7 @@ function PrintRObject(rkeyword) endfunction " Call R functions for the word under cursor -function RAction(rcmd) +function RRealAction(rcmd) if &filetype == "rbrowser" let rkeyword = RBrowserGetName(1, line(".")) else @@ -2269,6 +2269,14 @@ function RAction(rcmd) endif endfunction +function RAction(rcmd) + Py SendToVimCom("\x08Stop updating info.") + call RRealAction(a:rcmd) + if v:servername != "" + exe 'Py SendToVimCom("\x07' . v:servername . '")' + endif +endfunction + if exists('g:maplocalleader') let s:tll = '' . g:maplocalleader else From b683760b257f9942b49971ad830daba2691c930a Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 22 Nov 2012 14:55:37 -0300 Subject: [PATCH 0362/1050] Really warn only once if VimCom port wasn't found. --- r-plugin/vimcom.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/r-plugin/vimcom.py b/r-plugin/vimcom.py index 3b20519..5a531db 100644 --- a/r-plugin/vimcom.py +++ b/r-plugin/vimcom.py @@ -69,6 +69,8 @@ def SendToVimCom(aString): if received is None: vim.command("let g:rplugin_lastrpl = 'NOANSWER'") + VimComPort = 0 + DiscoverVimComPort() else: received = received.replace("'", "' . \"'\" . '") vim.command("let g:rplugin_lastrpl = '" + received + "'") From 789cea0c1fa81021b33df9714ed75ebea3474c41 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 22 Nov 2012 21:32:48 -0300 Subject: [PATCH 0363/1050] More debugging info. --- ftplugin/rbrowser.vim | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/ftplugin/rbrowser.vim b/ftplugin/rbrowser.vim index 8a1de6e..927756c 100644 --- a/ftplugin/rbrowser.vim +++ b/ftplugin/rbrowser.vim @@ -64,7 +64,7 @@ function! UpdateOB(what) let wht = a:what endif if g:rplugin_curview != wht - return + return "curview != what" endif let g:rplugin_switchedbuf = 0 @@ -73,7 +73,7 @@ function! UpdateOB(what) silent buffers redir END if s:bufl !~ "Object_Browser" - return + return "Object_Browser not listed" endif if exists("g:rplugin_curbuf") && g:rplugin_curbuf != "Object_Browser" let savesb = &switchbuf @@ -107,6 +107,7 @@ function! UpdateOB(what) exe "sil noautocmd sb " . g:rplugin_curbuf exe "set switchbuf=" . savesb endif + return "End of UpdateOB()" endfunction function! RBrowserDoubleClick() @@ -314,8 +315,6 @@ function! MakeRBrowserMenu() endfunction function! ObBrBufUnload() - call delete($VIMRPLUGIN_TMPDIR . "/object_browser") - call delete($VIMRPLUGIN_TMPDIR . "/liblist") if exists("g:rplugin_editor_sname") call system("tmux select-pane -t " . g:rplugin_edpane) endif @@ -347,20 +346,20 @@ function! OBGetDeleteCmd(lnum) endfunction function! OBSendDeleteCmd(cmd) - Py SendToVimCom("\x08Stop updating info.") + Py SendToVimCom("\x08Stop updating info. [OBSendDeleteCmd]") if exists("*RBrSendToR") call RBrSendToR(a:cmd) else call SendCmdToR(a:cmd) endif if g:rplugin_curview == "GlobalEnv" - Py SendToVimCom("\003GlobalEnv") + Py SendToVimCom("\003GlobalEnv [OBSendDeleteCmd]") else - Py SendToVimCom("\004Libraries") + Py SendToVimCom("\004Libraries [OBSendDeleteCmd]") endif call UpdateOB("both") if v:servername != "" - exe 'Py SendToVimCom("\x07' . v:servername . '")' + exe 'Py SendToVimCom("\x07' . v:servername . ' [OBSendDeleteCmd]")' endif endfunction @@ -407,10 +406,6 @@ if has("gui_running") call RBrowserMenu() endif -call writefile([], $VIMRPLUGIN_TMPDIR . "/object_browser") -call writefile([], $VIMRPLUGIN_TMPDIR . "/liblist") - - if $TMUX_PANE == "" au BufUnload Py SendToVimCom("\x08Stop updating info.") else From 5aa044531d16687c7af88a60f4a6b5ee5eefc223 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 22 Nov 2012 21:33:35 -0300 Subject: [PATCH 0364/1050] Delete Object Browser content while quiting. --- r-plugin/common_global.vim | 2 ++ 1 file changed, 2 insertions(+) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index c47d050..9c222e4 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -1772,6 +1772,8 @@ function RQuit(how) endif endif + call delete($VIMRPLUGIN_TMPDIR . "/object_browser") + call delete($VIMRPLUGIN_TMPDIR . "/liblist") endfunction " knit the current buffer content From 2d821dfa741857f7a94ff12e9842249723b7426e Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 22 Nov 2012 22:54:57 -0300 Subject: [PATCH 0365/1050] Fix problems caused by some plugins. --- ftplugin/rbrowser.vim | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/ftplugin/rbrowser.vim b/ftplugin/rbrowser.vim index 927756c..1c365b2 100644 --- a/ftplugin/rbrowser.vim +++ b/ftplugin/rbrowser.vim @@ -410,9 +410,13 @@ if $TMUX_PANE == "" au BufUnload Py SendToVimCom("\x08Stop updating info.") else au BufUnload call ObBrBufUnload() - " Don't load problematic plugins - let loaded_nerd_tree = 1 - let loaded_showmarks = 1 + " Fix problems caused by some plugins + if exists("g:loaded_surround") + nunmap ds + endif + if exists("g:loaded_showmarks ") + autocmd! ShowMarks + endif endif nmap d :call OBDelete() From 70e527a81eb348e0467bf9fb5f7fc3da0533bea8 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 22 Nov 2012 22:57:44 -0300 Subject: [PATCH 0366/1050] More debugging info. --- r-plugin/common_global.vim | 20 ++++++++++---------- r-plugin/windows.py | 6 +++--- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 9c222e4..e3457f0 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -882,8 +882,8 @@ function StartObjectBrowser() \ ' return 0', \ ' endif', \ 'endfunction', - \ 'Py SendToVimCom("\003GlobalEnv")', - \ 'Py SendToVimCom("\004Libraries")', + \ 'Py SendToVimCom("\003GlobalEnv [OB init]")', + \ 'Py SendToVimCom("\004Libraries [OB init]")', \ 'if v:servername != ""', \ " exe 'Py SendToVimCom(\"\\x07' . v:servername . '\")'", \ 'endif', @@ -914,7 +914,7 @@ function StartObjectBrowser() else let obpane = g:rplugin_edpane endif - let cmd = "tmux split-window -d -h -l " . panewidth . " -t " . obpane . ' "vim ' . g:rplugin_obsname_arg . ' -c ' . "'source " . objbrowserfile . "'" . '"' + let cmd = "tmux split-window -d -h -l " . panewidth . " -t " . obpane . ' "vim ' . g:rplugin_obsname_arg . " -c 'source " . objbrowserfile . "'" . '"' call delete($VIMRPLUGIN_TMPDIR . "/objbrpane") @@ -1028,8 +1028,8 @@ function StartObjectBrowser() unlet g:tmp_screensname unlet g:tmp_curbufname exe "PyFile " . g:rplugin_home . "/r-plugin/vimcom.py" - Py SendToVimCom("\003GlobalEnv") - Py SendToVimCom("\004Libraries") + Py SendToVimCom("\003GlobalEnv [startobjectbrowser()]") + Py SendToVimCom("\004Libraries [startobjectbrowser()]") call UpdateOB("GlobalEnv") endif if wmsg != "" @@ -1062,8 +1062,8 @@ function RObjBrowser() call StartObjectBrowser() endif if exists("*UpdateOB") - Py SendToVimCom("\003GlobalEnv") - Py SendToVimCom("\004Libraries") + Py SendToVimCom("\003GlobalEnv [RObjBrowser()]") + Py SendToVimCom("\004Libraries [RObjBrowser()]") call UpdateOB("both") endif let g:rplugin_running_objbr = 0 @@ -1073,7 +1073,7 @@ endfunction function RBrowserOpenCloseLists(status) " Avoid possibly freezing cross messages between Vim and R if exists("g:rplugin_curview") && v:servername != "" - Py SendToVimCom("\x08Stop updating info.") + Py SendToVimCom("\x08Stop updating info [RBrowserOpenCloseLists()]") let stt = a:status else let stt = a:status + 2 @@ -1170,7 +1170,7 @@ endfunction " Function to send commands " return 0 on failure and 1 on success function SendCmdToR(cmd) - Py SendToVimCom("\x09Set R as busy.") + Py SendToVimCom("\x09Set R as busy [SendCmdToR()]") if g:vimrplugin_ca_ck let cmd = "\001" . "\013" . a:cmd else @@ -2272,7 +2272,7 @@ function RRealAction(rcmd) endfunction function RAction(rcmd) - Py SendToVimCom("\x08Stop updating info.") + Py SendToVimCom("\x08Stop updating info [RAction()]") call RRealAction(a:rcmd) if v:servername != "" exe 'Py SendToVimCom("\x07' . v:servername . '")' diff --git a/r-plugin/windows.py b/r-plugin/windows.py index 94b1fe6..c2a4c74 100644 --- a/r-plugin/windows.py +++ b/r-plugin/windows.py @@ -30,7 +30,7 @@ def FindRConsole(): def SendToRConsole(aString): global RConsole - SendToVimCom("\x09Set R as busy.") + SendToVimCom("\x09Set R as busy [SendToRConsole()]") finalString = aString.decode("latin-1") + "\n" win32clipboard.OpenClipboard(0) win32clipboard.EmptyClipboard() @@ -57,7 +57,7 @@ def SendToRConsole(aString): def RClearConsolePy(): global RConsole - SendToVimCom("\x09Set R as busy.") + SendToVimCom("\x09Set R as busy [RClearConsolePy()]") if RConsole == 0: FindRConsole() if RConsole: @@ -84,7 +84,7 @@ def RaiseRConsole(): win32gui.SetForegroundWindow(RConsole) def SendQuitMsg(aString): - SendToVimCom("\x09Set R as busy.") + SendToVimCom("\x09Set R as busy [SendQuitMsg()]") finalString = aString.decode("latin-1") + "\n" win32clipboard.OpenClipboard(0) win32clipboard.EmptyClipboard() From ff04ab46873bde543ca05d22175b8b4c41f94f09 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Tue, 27 Nov 2012 09:43:44 -0300 Subject: [PATCH 0367/1050] Improve SendFunctionToR() function. --- r-plugin/common_global.vim | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index e3457f0..59caa17 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -1423,6 +1423,8 @@ function SendFunctionToR(e, m) endif let b:needsnewomnilist = 1 + let startline = line(".") + let save_cursor = getpos(".") let line = SanitizeRLine(getline(".")) let i = line(".") while i > 0 && line !~ "function" @@ -1430,6 +1432,7 @@ function SendFunctionToR(e, m) let line = SanitizeRLine(getline(i)) endwhile if i == 0 + call RWarningMsg("Begin of function not found.") return endif let functionline = i @@ -1438,6 +1441,7 @@ function SendFunctionToR(e, m) let line = SanitizeRLine(getline(i)) endwhile if i == 0 + call RWarningMsg("The function assign operator <- was not found.") return endif let firstline = i @@ -1449,6 +1453,7 @@ function SendFunctionToR(e, m) let line = SanitizeRLine(getline(i)) endwhile if i == tt + call RWarningMsg("The function opening brace was not found.") return endif let nb = CountBraces(line) @@ -1458,9 +1463,18 @@ function SendFunctionToR(e, m) let nb += CountBraces(line) endwhile if nb != 0 + call RWarningMsg("The function closing brace was not found.") return endif let lastline = i + + if startline > lastline + call setpos(".", [0, firstline - 1, 1]) + call SendFunctionToR(a:e, a:m) + call setpos(".", save_cursor) + return + endif + let lines = getline(firstline, lastline) let ok = RSourceLines(lines, a:e) if ok == 0 From c969825a42666ce255ecf529298b59ad434348ea Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Wed, 28 Nov 2012 10:29:29 -0300 Subject: [PATCH 0368/1050] Don't set the editor buffer is nomodifiable. --- ftplugin/rbrowser.vim | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ftplugin/rbrowser.vim b/ftplugin/rbrowser.vim index 1c365b2..74940a7 100644 --- a/ftplugin/rbrowser.vim +++ b/ftplugin/rbrowser.vim @@ -101,7 +101,9 @@ function! UpdateOB(what) exe "silent read " . $VIMRPLUGIN_TMPDIR . "/liblist" endif call cursor(curline, curcol) - setlocal nomodifiable + if bufname("%") =~ "Object_Browser" || b:rplugin_extern_ob + setlocal nomodifiable + endif redraw if g:rplugin_switchedbuf exe "sil noautocmd sb " . g:rplugin_curbuf From 2ade53e31cc8754358208584a1e9f0e1bfd7edf2 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Wed, 28 Nov 2012 10:31:22 -0300 Subject: [PATCH 0369/1050] Warn if R executable wasn't found. --- r-plugin/common_global.vim | 3 +++ 1 file changed, 3 insertions(+) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 59caa17..b12c55f 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -2928,6 +2928,9 @@ function SetRPath() else let b:rplugin_R = "R" endif + if !executable(b:rplugin_R) + call RWarningMsg("R executable not found: '" . b:rplugin_R . "'") + endif if !exists("g:vimrplugin_r_args") let b:rplugin_r_args = " " else From a2a7ca1c6d67bc5a39b32e40bd70ef0c1632fcc3 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 29 Nov 2012 13:19:13 -0300 Subject: [PATCH 0370/1050] Update version of vimcom. --- r-plugin/vimcom.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/r-plugin/vimcom.py b/r-plugin/vimcom.py index 5a531db..4b34454 100644 --- a/r-plugin/vimcom.py +++ b/r-plugin/vimcom.py @@ -40,8 +40,8 @@ def DiscoverVimComPort(): else: vim.command("let g:rplugin_vimcomport = " + str(VimComPort)) PortWarn = False - if repl.find("0.9-4") != 0: - vim.command("call RWarningMsg('This version of Vim-R-plugin requires vimcom 0.9-4.')") + if repl.find("0.9-5") != 0: + vim.command("call RWarningMsg('This version of Vim-R-plugin requires vimcom 0.9-5.')") vim.command("sleep 1") return(VimComPort) From f2289220059bb40af7cf201bc54e9fcb018d3140 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 29 Nov 2012 19:47:22 -0300 Subject: [PATCH 0371/1050] Escape empty space in g:rplugin_home. --- r-plugin/common_global.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index b12c55f..a6b9e8c 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -1027,7 +1027,7 @@ function StartObjectBrowser() unlet g:tmp_objbrtitle unlet g:tmp_screensname unlet g:tmp_curbufname - exe "PyFile " . g:rplugin_home . "/r-plugin/vimcom.py" + exe "PyFile " . substitute(g:rplugin_home, " ", '\ ', "g") . "/r-plugin/vimcom.py" Py SendToVimCom("\003GlobalEnv [startobjectbrowser()]") Py SendToVimCom("\004Libraries [startobjectbrowser()]") call UpdateOB("GlobalEnv") @@ -3077,7 +3077,7 @@ else command! -nargs=+ PyFile : endif -exe "PyFile " . g:rplugin_home . "/r-plugin/vimcom.py" +exe "PyFile " . substitute(g:rplugin_home, " ", '\ ', "g") . "/r-plugin/vimcom.py" " ^K (\013) cleans from cursor to the right and ^U (\025) cleans from cursor " to the left. However, ^U causes a beep if there is nothing to clean. The From 048458df132dc6e598a9abda828ef54e88143564 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 29 Nov 2012 20:02:11 -0300 Subject: [PATCH 0372/1050] Escape empty space in g:rplugin_home. --- r-plugin/common_global.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index a6b9e8c..991c835 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -871,7 +871,7 @@ function StartObjectBrowser() \ 'normal! ggdG', \ 'setlocal nomodified', \ 'call cursor(curline, curcol)', - \ 'exe "PyFile " . g:rplugin_home . "/r-plugin/vimcom.py"', + \ 'exe "PyFile " . substitute(g:rplugin_home, " ", '. "'\\ '" . ', "g") . "/r-plugin/vimcom.py"', \ 'function! RBrSendToR(cmd)', \ ' let scmd = "tmux set-buffer '. "'" . '" . a:cmd . "\' . "'" . ' && tmux' . tmxs . 'paste-buffer -t ' . g:rplugin_rpane . '"', \ ' let rlog = system(scmd)', From 5bcd5c5ef06186efac3cb3d48970fec3be6c372a Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Fri, 30 Nov 2012 06:27:53 -0300 Subject: [PATCH 0373/1050] Really escape empty space in g:rplugin_home. --- r-plugin/common_global.vim | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 991c835..d847f30 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -871,7 +871,7 @@ function StartObjectBrowser() \ 'normal! ggdG', \ 'setlocal nomodified', \ 'call cursor(curline, curcol)', - \ 'exe "PyFile " . substitute(g:rplugin_home, " ", '. "'\\ '" . ', "g") . "/r-plugin/vimcom.py"', + \ 'exe "PyFile " . substitute(g:rplugin_home, " ", '. "'\\\\ '" . ', "g") . "/r-plugin/vimcom.py"', \ 'function! RBrSendToR(cmd)', \ ' let scmd = "tmux set-buffer '. "'" . '" . a:cmd . "\' . "'" . ' && tmux' . tmxs . 'paste-buffer -t ' . g:rplugin_rpane . '"', \ ' let rlog = system(scmd)', @@ -1027,7 +1027,7 @@ function StartObjectBrowser() unlet g:tmp_objbrtitle unlet g:tmp_screensname unlet g:tmp_curbufname - exe "PyFile " . substitute(g:rplugin_home, " ", '\ ', "g") . "/r-plugin/vimcom.py" + exe "PyFile " . substitute(g:rplugin_home, " ", '\\ ', "g") . "/r-plugin/vimcom.py" Py SendToVimCom("\003GlobalEnv [startobjectbrowser()]") Py SendToVimCom("\004Libraries [startobjectbrowser()]") call UpdateOB("GlobalEnv") @@ -3077,7 +3077,7 @@ else command! -nargs=+ PyFile : endif -exe "PyFile " . substitute(g:rplugin_home, " ", '\ ', "g") . "/r-plugin/vimcom.py" +exe "PyFile " . substitute(g:rplugin_home, " ", '\\ ', "g") . "/r-plugin/vimcom.py" " ^K (\013) cleans from cursor to the right and ^U (\025) cleans from cursor " to the left. However, ^U causes a beep if there is nothing to clean. The @@ -3288,7 +3288,7 @@ if has("win32") || has("win64") finish endif let rplugin_pywin32 = 1 - exe "PyFile " . substitute(g:rplugin_home, " ", '\ ', "g") . '\r-plugin\windows.py' + exe "PyFile " . substitute(g:rplugin_home, " ", '\\ ', "g") . '\r-plugin\windows.py' if rplugin_pywin32 == 0 let g:rplugin_failed = 1 finish From 89b28819db78a6e6d01a44186d5fdf43c4a0b83e Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Fri, 30 Nov 2012 06:42:58 -0300 Subject: [PATCH 0374/1050] Update. --- doc/r-plugin.txt | 59 +++++++++++++++++++++++++++++++++++++----------- 1 file changed, 46 insertions(+), 13 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 37f4ee7..b1b983e 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -42,6 +42,9 @@ Cryptic error message are bugs... Please report them at: https://github.com/jcfaria/Vim-R-plugin/issues +We do not plan to take the initiative of writing code for new features, but +patches and git pull requests are welcome. + ============================================================================== *r-plugin-features* @@ -129,7 +132,7 @@ following dependencies: Vim >= 7.3 with Python support. Tmux >= 1.5: http://tmux.sourceforge.net Screen plugin: http://www.vim.org/scripts/script.php?script_id=2711 - vimcom = 0.9-3: http://www.lepem.ufc.br/jaa/vimcom.html + vimcom = 0.9-5: http://www.lepem.ufc.br/jaa/vimcom.html Suggests:~ ncurses-term: http://invisible-island.net/ncurses @@ -143,13 +146,17 @@ following dependencies: the scope of this documentation. The vimcom package creates a server on R to allow the communication with - Vim. The package is not used to send commands from Vim to R, but it is - necessary to open R documentation in Vim's buffer, run the Object Browser, - run either Sweave() or knit() on the document being edited. It also has - some functions called by Vim such as vim.plot(), vim.print(), and + Vim. The package is not used to send commands from Vim to R Console, but it + is necessary to open R documentation in Vim's buffer, run the Object + Browser, run either Sweave() or knit() on the document being edited. It + also has some functions called by Vim such as vim.plot(), vim.print(), and vim.bol(). This last one is required to build the data base used in - omnicompletion. - + omnicompletion. Before installing vimcom from source, you have to install + the X server development headers. On Debian/Ubuntu systems you can install + them with the following command in a terminal emulator: +> + sudo apt-get install libx11-dev libxt-dev +< The colorout package colorizes the R output and the setwidth package adjusts the value of options("width") whenever the terminal is resized. They can be installed from within R. @@ -232,7 +239,7 @@ to install external dependencies: find the file that matches exactly the version of Python that you installed. - * vimcom = 0.9-3: http://www.lepem.ufc.br/jaa/vimcom.html + * vimcom = 0.9-5: http://www.lepem.ufc.br/jaa/vimcom.html The vimcom package creates a server on R to allow the communication with Vim. You certainly will want to put the following lines at the end of your Rprofile (usually at ~/Documents/.Rprofile): @@ -453,6 +460,14 @@ Help (R) :Rhelp Please see |r-plugin-key-bindings| to learn how to customize the key bindings without editing the plugin directly. +The plugin commands that send code to R Console are the most commonly used. If +the code to be sent to R has a single line it is sent directly to R Console, +but if it has more than one line (a selection of lines, a block of lines +between two marks, a paragraph etc) the lines are written to a file and the +plugin sends to R the command to source the file. For example, when sending a +selection of lines, you should do either se or sa +instead of ss to see what lines are being sourced. + After the command ao, Vim will save the current buffer if it has any pending changes, run "R CMD BATCH --no-restore --no-save" on the current file and show the resulting .Rout file in a new tab. Please see @@ -617,6 +632,11 @@ objects in .GlobalEnv and the currently loaded libraries. The Object Browser requires the |+clientserver| feature to be automatically updated and the |+conceal| feature to correctly align list items. +Note: On Linux you may find binaries without the |clientserver| feature if you +install packages such as vim-nox on Debian/Ubuntu or vim-enhanced on +Fedora/Red Hat. If you want to use Vim in a terminal emulator in Fedora/Red +Hat, you may want to create a symbolic link to "gvim" named "vim". + In the .GlobalEnv view, if an object has the attribute "label", it will also be displayed. Please, see the R help for package vimcom for some options to control the Object Browser behavior. In the Object Browser window, while in @@ -863,13 +883,27 @@ indent the code below: class(x) <- c(if(ordered) "ordered", "factor") < -5.5. Commands are sent twice on Mac OS X~ +5.5. Wrong message that "R is busy"~ + +When code is sent from Vim to R Console, the vimcom library sets the value of +the internal variable "r_is_busy" to 1. The value is set back to 0 when any +code is successfully evaluated. If you send invalid code to R, there will be +no successful evaluation of code and, thus, the value of "r_is_busy" will +remain set to 1. Then, if you try to update the object browser, see the R +documentation for any function, or do other tasks that require the hidden +evaluation of code by R, the vimcom library will refuse to do the tasks to +avoid any risk of corrupting R's memory. It will tell Vim that "R is busy" and +Vim will display this message. Everything should work as expected again after +any valid code being executed in R Console. + + +5.6. Commands are sent twice on Mac OS X~ If you use the screen plugin with GNU Screen, individual lines may be sent duplicated to R on Mac OS X. -5.6. "VimCom port not found" on OpenBSD~ +5.7. "VimCom port not found" on OpenBSD~ When the loopback interface has both IPv4 and IPv6 addresses vimcom loads ok but apparently does not listen on the IPv4 address (127.0.0.1), only on the @@ -1004,7 +1038,7 @@ If vimrplugin_external_ob = 1 and R is running in an external terminal emulator and the communication with R is being established through Tmux, the Object Browser will be placed besides the R Console in the external terminal emulator. In this case, the command rh will not work on the -Object Browser. +Object Browser (you will see the message "Cmd not available"). 6.4. Vim as pager for R help~ @@ -1601,7 +1635,6 @@ directory after the installation: r-plugin/r.snippets r-plugin/tex_indent.vim r-plugin/vimcom.py - r-plugin/vimActivate.js r-plugin/windows.py syntax/rbrowser.vim syntax/rout.vim @@ -2091,7 +2124,7 @@ argument. Example: *r-plugin-news* 10. News~ -0.9.9 (2012-11-17) +0.9.9 (2012-11-30) * New commands: :Rinsert and :Rformat. * Automatically update the Object Browser in GVim. From 6b199355b49415397c6aa91feaf4dcf48e105d53 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Fri, 30 Nov 2012 22:40:47 -0300 Subject: [PATCH 0375/1050] Allow empty spaces in directories at sometimes. --- ftplugin/rbrowser.vim | 6 +++--- r-plugin/common_buffer.vim | 2 ++ r-plugin/common_global.vim | 31 +++++++++++++++++++------------ 3 files changed, 24 insertions(+), 15 deletions(-) diff --git a/ftplugin/rbrowser.vim b/ftplugin/rbrowser.vim index 74940a7..034396b 100644 --- a/ftplugin/rbrowser.vim +++ b/ftplugin/rbrowser.vim @@ -95,10 +95,10 @@ function! UpdateOB(what) sil normal! ggdG if wht == "GlobalEnv" call setline(1, ".GlobalEnv | Libraries") - exe "silent read " . $VIMRPLUGIN_TMPDIR . "/object_browser" + exe "silent read " . g:rplugin_esc_tmpdir . "/object_browser" else call setline(1, "Libraries | .GlobalEnv") - exe "silent read " . $VIMRPLUGIN_TMPDIR . "/liblist" + exe "silent read " . g:rplugin_esc_tmpdir . "/liblist" endif call cursor(curline, curcol) if bufname("%") =~ "Object_Browser" || b:rplugin_extern_ob @@ -323,7 +323,7 @@ function! ObBrBufUnload() endfunction function! SourceObjBrLines() - exe "source " . $VIMRPLUGIN_TMPDIR . "/objbrowserInit" + exe "source " . g:rplugin_esc_tmpdir . "/objbrowserInit" endfunction function! OBGetDeleteCmd(lnum) diff --git a/r-plugin/common_buffer.vim b/r-plugin/common_buffer.vim index fd8e4d5..27fac3d 100644 --- a/r-plugin/common_buffer.vim +++ b/r-plugin/common_buffer.vim @@ -111,6 +111,8 @@ else endif let s:uniquename = substitute(s:uniquename, '\W', '', 'g') let $VIMINSTANCEID = $VIMRPLUGIN_TMPDIR . "/" . s:uniquename . "-port" +let $VIMINSTANCEID = substitute($VIMINSTANCEID, ' ', '', 'g') + if has("clientserver") let g:rplugin_obsname_arg = "--servername " . toupper(substitute(substitute(expand("%:r"), '\W', '', 'g'), "_", "", "g")) else diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index d847f30..ba8a966 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -553,6 +553,8 @@ function StartR(whatr) call SetRPath() endif + let vimenv = 'VIMRPLUGIN_TMPDIR="' . $VIMRPLUGIN_TMPDIR . '" VIMINSTANCEID=' . $VIMINSTANCEID . " " + " Change to buffer's directory before starting R lcd %:p:h @@ -599,6 +601,11 @@ function StartR(whatr) let rcmd = b:rplugin_R . " " . b:rplugin_r_args endif + if $VIMRPLUGIN_TMPDIR =~ ' ' + call RWarningMsg('Empty spaces are not allowed in temporary directory path: "' . $VIMRPLUGIN_TMPDIR . '"') + return + endif + if g:vimrplugin_screenplugin if g:vimrplugin_only_in_tmux && g:vimrplugin_tmux && $TMUX_PANE == "" call RWarningMsg("Not inside Tmux.") @@ -607,10 +614,10 @@ function StartR(whatr) if $TERM =~ "screen" if g:vimrplugin_tmux - call system("tmux set-environment VIMRPLUGIN_TMPDIR " . $VIMRPLUGIN_TMPDIR) - call system("tmux set-environment VIMINSTANCEID " . $VIMINSTANCEID) + call system("tmux set-environment -g VIMRPLUGIN_TMPDIR " . g:rplugin_esc_tmpdir) + call system("tmux set-environment -g VIMINSTANCEID " . $VIMINSTANCEID) else - let rcmd = "VIMRPLUGIN_TMPDIR=" . $VIMRPLUGIN_TMPDIR . " " . rcmd + let rcmd = vimenv . rcmd endif endif if g:vimrplugin_tmux == 0 && g:vimrplugin_noscreenrc == 0 && exists("g:ScreenShellScreenInitArgs") @@ -734,11 +741,10 @@ function StartR(whatr) endif call system("tmux has-session -t " . b:screensname) if v:shell_error - let rcmd = "VIMRPLUGIN_TMPDIR=" . $VIMRPLUGIN_TMPDIR . " VIMINSTANCEID=" . $VIMINSTANCEID . " " . rcmd if g:rplugin_termcmd =~ "gnome-terminal" || g:rplugin_termcmd =~ "xfce4-terminal" || g:rplugin_termcmd =~ "terminal" || g:rplugin_termcmd =~ "iterm" - let opencmd = printf("%s 'tmux -2 %s new-session -s %s \"%s\"' &", g:rplugin_termcmd, tmxcnf, b:screensname, rcmd) + let opencmd = printf("%s %s 'tmux -2 %s new-session -s %s \"%s\"' &", vimenv, g:rplugin_termcmd, tmxcnf, b:screensname, rcmd) else - let opencmd = printf("%s tmux -2 %s new-session -s %s \"%s\" &", g:rplugin_termcmd, tmxcnf, b:screensname, rcmd) + let opencmd = printf("%s %s tmux -2 %s new-session -s %s \"%s\" &", vimenv, g:rplugin_termcmd, tmxcnf, b:screensname, rcmd) endif else if g:rplugin_termcmd =~ "gnome-terminal" || g:rplugin_termcmd =~ "xfce4-terminal" || g:rplugin_termcmd =~ "terminal" || g:rplugin_termcmd =~ "iterm" @@ -761,9 +767,9 @@ function StartR(whatr) let scrrc = RWriteScreenRC() " Some terminals want quotes (see screen.vim) if g:rplugin_termcmd =~ "gnome-terminal" || g:rplugin_termcmd =~ "xfce4-terminal" || g:rplugin_termcmd =~ "terminal" || g:rplugin_termcmd =~ "iterm" - let opencmd = printf("%s 'screen %s -d -RR -S %s %s' &", g:rplugin_termcmd, scrrc, b:screensname, rcmd) + let opencmd = printf("%s %s 'screen %s -d -RR -S %s %s' &", vimenv, g:rplugin_termcmd, scrrc, b:screensname, rcmd) else - let opencmd = printf("%s screen %s -d -RR -S %s %s &", g:rplugin_termcmd, scrrc, b:screensname, rcmd) + let opencmd = printf("%s %s screen %s -d -RR -S %s %s &", vimenv, g:rplugin_termcmd, scrrc, b:screensname, rcmd) endif endif @@ -888,7 +894,7 @@ function StartObjectBrowser() \ " exe 'Py SendToVimCom(\"\\x07' . v:servername . '\")'", \ 'endif', \ 'call setline(1, ".GlobalEnv | Libraries")', - \ 'exe "silent read ' . $VIMRPLUGIN_TMPDIR . '/object_browser"', + \ 'exe "silent read ' . substitute($VIMRPLUGIN_TMPDIR, ' ', '\\\\ ', 'g') . '/object_browser"', \ 'redraw'], objbrowserfile) if g:vimrplugin_objbr_place =~ "left" @@ -914,7 +920,7 @@ function StartObjectBrowser() else let obpane = g:rplugin_edpane endif - let cmd = "tmux split-window -d -h -l " . panewidth . " -t " . obpane . ' "vim ' . g:rplugin_obsname_arg . " -c 'source " . objbrowserfile . "'" . '"' + let cmd = "tmux split-window -d -h -l " . panewidth . " -t " . obpane . ' "vim ' . g:rplugin_obsname_arg . " -c 'source " . substitute(objbrowserfile, ' ', '\\ ', 'g') . "'" . '"' call delete($VIMRPLUGIN_TMPDIR . "/objbrpane") @@ -2154,7 +2160,7 @@ function ShowRDoc(rkeyword, package, getclass) endif normal! ggdG - exe "read " . g:rplugin_docfile + exe "read " . substitute(g:rplugin_docfile, ' ', '\\ ', 'g') set filetype=rdoc normal! ggdd setlocal nomodified @@ -2990,8 +2996,9 @@ endif if isdirectory("/tmp") let $VIMRPLUGIN_TMPDIR = "/tmp/r-plugin-" . g:rplugin_userlogin else - let $VIMRPLUGIN_TMPDIR = g:rplugin_uservimfiles . "/r-plugin" + let $VIMRPLUGIN_TMPDIR = g:rplugin_uservimfiles . "/r-plugin/tmp" endif +let g:rplugin_esc_tmpdir = substitute($VIMRPLUGIN_TMPDIR, ' ', '\\ ', 'g') if !isdirectory($VIMRPLUGIN_TMPDIR) call mkdir($VIMRPLUGIN_TMPDIR, "p", 0700) From a30f6bebd437ecb6a2fd2232f2e2216b9a9a9f85 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sun, 2 Dec 2012 13:23:21 -0300 Subject: [PATCH 0376/1050] =?UTF-8?q?Search=20both=20IPv4=20and=20IPv6=20(?= =?UTF-8?q?thanks=20to=20Z=C3=A9=20Loff).?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- r-plugin/vimcom.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/r-plugin/vimcom.py b/r-plugin/vimcom.py index 4b34454..1e5ae95 100644 --- a/r-plugin/vimcom.py +++ b/r-plugin/vimcom.py @@ -21,8 +21,14 @@ def DiscoverVimComPort(): while repl.find(correct_repl) < 0 and VimComPort < 10050: VimComPort = VimComPort + 1 - sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) - sock.settimeout(0.1) + for res in socket.getaddrinfo(HOST, VimComPort, socket.AF_UNSPEC, socket.SOCK_DGRAM): + af, socktype, proto, canonname, sa = res + try: + sock = socket.socket(af, socktype, proto) + sock.settimeout(0.1) + except socket.error: + sock = None + continue try: sock.connect((HOST, VimComPort)) sock.send("\002What port?") From 1f98110f0213179ba92c7f105c4ae970d49fccca Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Mon, 3 Dec 2012 12:59:37 -0300 Subject: [PATCH 0377/1050] Allow empty spaces in plugin-home and tmp paths. --- doc/r-plugin.txt | 15 +++- r-plugin/common_global.vim | 151 ++++++++++++++++++------------------- 2 files changed, 86 insertions(+), 80 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index b1b983e..0fc37ad 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -155,7 +155,11 @@ following dependencies: the X server development headers. On Debian/Ubuntu systems you can install them with the following command in a terminal emulator: > - sudo apt-get install libx11-dev libxt-dev + sudo apt-get install libx11-dev +< + On Fedora/Red Hat, the command is: +> + sudo yum install libX11-devel < The colorout package colorizes the R output and the setwidth package adjusts the value of options("width") whenever the terminal is resized. @@ -1226,6 +1230,11 @@ If you want to use your own ~/.screenrc, put in your vimrc: > let vimrplugin_noscreenrc = 1 < +If you opted for using your own configuration file, the plugin will write a +minimum configuration which will set the value of two environment variables +required for the communication with R and source your own configuration file +(either ~/.tmux.conf or ~/.screenrc). + 6.15. Integration with screen.vim plugin (Linux/Unix only)~ *vimrplugin_screenplugin* @@ -2124,11 +2133,13 @@ argument. Example: *r-plugin-news* 10. News~ -0.9.9 (2012-11-30) +0.9.9 (2012-12-03) * New commands: :Rinsert and :Rformat. * Automatically update the Object Browser in GVim. * On MS Windows, don't raise the R Console before sending CTRL-V to it. + * Search for vimcom in both IPv4 and IPv6 ports (thanks to Zé Loff for + writing the patch). 0.9.8 (2012-10-13) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index ba8a966..76c7f47 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -505,43 +505,47 @@ function GoDown() endfunction function RWriteScreenRC() - if g:vimrplugin_noscreenrc - return " " - endif - let scrcnf = $VIMRPLUGIN_TMPDIR . "/" . b:screensname . ".screenrc" - if g:vimrplugin_screenplugin + if g:vimrplugin_noscreenrc let cnflines = [ - \ 'msgwait 0', - \ 'vbell off', - \ 'startup_message off', - \ 'bind a resize +1', - \ 'bind z resize -1', - \ "termcapinfo xterm* 'ti@:te@'"] - if $DISPLAY != "" || $TERM =~ "xterm" - let cnflines = cnflines + [ - \ "terminfo rxvt-unicode 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm'", - \ 'term screen-256color'] - endif + \ 'setenv VIMRPLUGIN_TMPDIR "' . $VIMRPLUGIN_TMPDIR . '"', + \ 'setenv VIMINSTANCEID ' . $VIMINSTANCEID , + \ 'source ~/.screenrc'] else - if g:vimrplugin_nosingler == 1 - let scrtitle = 'hardstatus string "' . expand("%:t") . '"' + if g:vimrplugin_screenplugin + let cnflines = [ + \ 'msgwait 0', + \ 'vbell off', + \ 'setenv VIMRPLUGIN_TMPDIR "' . $VIMRPLUGIN_TMPDIR . '"', + \ 'setenv VIMINSTANCEID ' . $VIMINSTANCEID , + \ 'startup_message off', + \ 'bind a resize +1', + \ 'bind z resize -1', + \ "termcapinfo xterm* 'ti@:te@'"] + if $DISPLAY != "" || $TERM =~ "xterm" + let cnflines = cnflines + [ + \ "terminfo rxvt-unicode 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm'", + \ 'term screen-256color'] + endif else - let scrtitle = "hardstatus string R" - endif + if g:vimrplugin_nosingler == 1 + let scrtitle = 'hardstatus string "' . expand("%:t") . '"' + else + let scrtitle = "hardstatus string R" + endif - let cnflines = ["msgwait 1", - \ "hardstatus lastline", - \ scrtitle, - \ "caption splitonly", - \ 'caption string "Vim-R-plugin"', - \ "termcapinfo xterm* 'ti@:te@'", - \ 'vbell off'] + let cnflines = ["msgwait 1", + \ "hardstatus lastline", + \ scrtitle, + \ "caption splitonly", + \ 'caption string "Vim-R-plugin"', + \ "termcapinfo xterm* 'ti@:te@'", + \ 'vbell off'] + endif endif - call writefile(cnflines, scrcnf) - return " -c " . scrcnf + return ' -c "' . scrcnf . '"' endfunction " Start R @@ -553,8 +557,6 @@ function StartR(whatr) call SetRPath() endif - let vimenv = 'VIMRPLUGIN_TMPDIR="' . $VIMRPLUGIN_TMPDIR . '" VIMINSTANCEID=' . $VIMINSTANCEID . " " - " Change to buffer's directory before starting R lcd %:p:h @@ -601,9 +603,28 @@ function StartR(whatr) let rcmd = b:rplugin_R . " " . b:rplugin_r_args endif - if $VIMRPLUGIN_TMPDIR =~ ' ' - call RWarningMsg('Empty spaces are not allowed in temporary directory path: "' . $VIMRPLUGIN_TMPDIR . '"') - return + " Create a custom tmux.conf + if g:vimrplugin_tmux + if g:vimrplugin_notmuxconf + let cnflines = [ + \ 'set-environment -g VIMRPLUGIN_TMPDIR ' . g:rplugin_esc_tmpdir, + \ 'set-environment -g VIMINSTANCEID ' . $VIMINSTANCEID, + \ 'source-file ~/.tmux.conf' ] + else + let cnflines = [ + \ 'set-option -g prefix C-a', + \ 'unbind-key C-b', + \ 'bind-key C-a send-prefix', + \ 'set-window-option -g mode-keys vi', + \ 'set -g status off', + \ "set -g terminal-overrides 'xterm*:smcup@:rmcup@'", + \ 'set-environment -g VIMRPLUGIN_TMPDIR "' . $VIMRPLUGIN_TMPDIR . '"', + \ 'set-environment -g VIMINSTANCEID "' . $VIMINSTANCEID . '"'] + if g:vimrplugin_external_ob + let cnflines = extend(cnflines, ['set -g mode-mouse on', 'set -g mouse-select-pane on', 'set -g mouse-resize-pane on']) + endif + endif + call writefile(cnflines, s:tmxcnf) endif if g:vimrplugin_screenplugin @@ -617,7 +638,7 @@ function StartR(whatr) call system("tmux set-environment -g VIMRPLUGIN_TMPDIR " . g:rplugin_esc_tmpdir) call system("tmux set-environment -g VIMINSTANCEID " . $VIMINSTANCEID) else - let rcmd = vimenv . rcmd + let rcmd = 'VIMRPLUGIN_TMPDIR="' . $VIMRPLUGIN_TMPDIR . '" VIMINSTANCEID=' . $VIMINSTANCEID . " " . rcmd endif endif if g:vimrplugin_tmux == 0 && g:vimrplugin_noscreenrc == 0 && exists("g:ScreenShellScreenInitArgs") @@ -707,6 +728,13 @@ function StartR(whatr) set noautochdir endif else + " External terminal emulator + if $DISPLAY == "" + call RWarningMsg("The X Window system is required to run R in an external terminal.") + lcd - + return + endif + if g:vimrplugin_tmux call system('export VIMRPLUGIN_TMPDIR=' . $VIMRPLUGIN_TMPDIR) call system('export VIMINSTANCEID=' . $VIMINSTANCEID) @@ -716,24 +744,7 @@ function StartR(whatr) let $TMUX = "" call system('tmux set-option -ga update-environment " TMUX_PANE VIMRPLUGIN_TMPDIR VIMINSTANCEID"') endif - - if g:vimrplugin_notmuxconf - let tmxcnf = " " - else - let tmxcnf = $VIMRPLUGIN_TMPDIR . "/tmux.conf" - let cnflines = [ - \ 'set-option -g prefix C-a', - \ 'unbind-key C-b', - \ 'bind-key C-a send-prefix', - \ 'set-window-option -g mode-keys vi', - \ 'set -g status off', - \ "set -g terminal-overrides 'xterm*:smcup@:rmcup@'"] - if g:vimrplugin_external_ob - let cnflines = extend(cnflines, ['set -g mode-mouse on', 'set -g mouse-select-pane on', 'set -g mouse-resize-pane on']) - endif - call writefile(cnflines, tmxcnf) - let tmxcnf = "-f " . tmxcnf - endif + let tmuxcnf = '-f "' . s:tmxcnf . '"' if $DISPLAY == "" call RWarningMsg("The X Window system is required to run R in an external terminal.") lcd - @@ -742,23 +753,18 @@ function StartR(whatr) call system("tmux has-session -t " . b:screensname) if v:shell_error if g:rplugin_termcmd =~ "gnome-terminal" || g:rplugin_termcmd =~ "xfce4-terminal" || g:rplugin_termcmd =~ "terminal" || g:rplugin_termcmd =~ "iterm" - let opencmd = printf("%s %s 'tmux -2 %s new-session -s %s \"%s\"' &", vimenv, g:rplugin_termcmd, tmxcnf, b:screensname, rcmd) + let opencmd = printf("%s 'tmux -2 %s new-session -s %s \"%s\"' &", g:rplugin_termcmd, tmuxcnf, b:screensname, rcmd) else - let opencmd = printf("%s %s tmux -2 %s new-session -s %s \"%s\" &", vimenv, g:rplugin_termcmd, tmxcnf, b:screensname, rcmd) + let opencmd = printf("%s tmux -2 %s new-session -s %s \"%s\" &", g:rplugin_termcmd, tmuxcnf, b:screensname, rcmd) endif else if g:rplugin_termcmd =~ "gnome-terminal" || g:rplugin_termcmd =~ "xfce4-terminal" || g:rplugin_termcmd =~ "terminal" || g:rplugin_termcmd =~ "iterm" - let opencmd = printf("%s 'tmux -2 %s attach-session -d -t %s' &", g:rplugin_termcmd, tmxcnf, b:screensname) + let opencmd = printf("%s 'tmux -2 %s attach-session -d -t %s' &", g:rplugin_termcmd, tmuxcnf, b:screensname) else - let opencmd = printf("%s tmux -2 %s attach-session -d -t %s &", g:rplugin_termcmd, tmxcnf, b:screensname) + let opencmd = printf("%s tmux -2 %s attach-session -d -t %s &", g:rplugin_termcmd, tmuxcnf, b:screensname) endif endif else - if $DISPLAY == "" - call RWarningMsg("The X Window system is required to run R in an external terminal.") - lcd - - return - endif if !executable("screen") call RWarningMsgInp("The value of vimrplugin_tmux = 0 but the GNU Screen application was not found.") lcd - @@ -767,9 +773,9 @@ function StartR(whatr) let scrrc = RWriteScreenRC() " Some terminals want quotes (see screen.vim) if g:rplugin_termcmd =~ "gnome-terminal" || g:rplugin_termcmd =~ "xfce4-terminal" || g:rplugin_termcmd =~ "terminal" || g:rplugin_termcmd =~ "iterm" - let opencmd = printf("%s %s 'screen %s -d -RR -S %s %s' &", vimenv, g:rplugin_termcmd, scrrc, b:screensname, rcmd) + let opencmd = printf("%s 'screen %s -d -RR -S %s %s' &", g:rplugin_termcmd, scrrc, b:screensname, rcmd) else - let opencmd = printf("%s %s screen %s -d -RR -S %s %s &", vimenv, g:rplugin_termcmd, scrrc, b:screensname, rcmd) + let opencmd = printf("%s screen %s -d -RR -S %s %s &", g:rplugin_termcmd, scrrc, b:screensname, rcmd) endif endif @@ -2935,7 +2941,7 @@ function SetRPath() let b:rplugin_R = "R" endif if !executable(b:rplugin_R) - call RWarningMsg("R executable not found: '" . b:rplugin_R . "'") + call RWarningMsgInp("R executable not found: '" . b:rplugin_R . "'") endif if !exists("g:vimrplugin_r_args") let b:rplugin_r_args = " " @@ -3208,24 +3214,13 @@ if g:vimrplugin_tmux " To get 256 colors you have to set the $TERM environment variable to " xterm-256color. See :h r-plugin-tips + let s:tmxcnf = $VIMRPLUGIN_TMPDIR . "/tmux.conf" if g:vimrplugin_notmuxconf == 0 if $DISPLAY != "" || $TERM =~ "xterm" let g:ScreenShellTmuxInitArgs .= "-2" endif - let tmxcnf = $VIMRPLUGIN_TMPDIR . "/tmux.conf" - let cnflines = [ - \ 'set-option -g prefix C-a', - \ 'unbind-key C-b', - \ 'bind-key C-a send-prefix', - \ 'set-window-option -g mode-keys vi', - \ 'set -g status off', - \ "set -g terminal-overrides 'xterm*:smcup@:rmcup@'", - \ 'set -g mode-mouse on', - \ 'set -g mouse-select-pane on', - \ 'set -g mouse-resize-pane on'] - call writefile(cnflines, tmxcnf) - let g:ScreenShellTmuxInitArgs .= " -f " . tmxcnf endif + let g:ScreenShellTmuxInitArgs .= ' -f "' . s:tmxcnf . '"' endif " Check whether GNU Screen is OK From b08c2f6a3064e6fd7131cceca6843051298f4b9e Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Mon, 3 Dec 2012 21:19:31 -0300 Subject: [PATCH 0378/1050] =?UTF-8?q?Improve=20IPv4=20+=20IPv6=20support?= =?UTF-8?q?=20(thanks=20to=20Z=C3=A9=20Loff).?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- r-plugin/vimcom.py | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/r-plugin/vimcom.py b/r-plugin/vimcom.py index 1e5ae95..f9d2a37 100644 --- a/r-plugin/vimcom.py +++ b/r-plugin/vimcom.py @@ -5,10 +5,12 @@ import re VimComPort = 0 PortWarn = False +VimComFamily = None def DiscoverVimComPort(): global PortWarn global VimComPort + global VimComFamily HOST = "localhost" VimComPort = 9998 repl = "NOTHING" @@ -21,21 +23,21 @@ def DiscoverVimComPort(): while repl.find(correct_repl) < 0 and VimComPort < 10050: VimComPort = VimComPort + 1 - for res in socket.getaddrinfo(HOST, VimComPort, socket.AF_UNSPEC, socket.SOCK_DGRAM): - af, socktype, proto, canonname, sa = res - try: - sock = socket.socket(af, socktype, proto) - sock.settimeout(0.1) - except socket.error: - sock = None - continue - try: - sock.connect((HOST, VimComPort)) - sock.send("\002What port?") - repl = sock.recv(1024) - except: - pass - sock.close() + for res in socket.getaddrinfo(HOST, VimComPort, socket.AF_UNSPEC, socket.SOCK_DGRAM): + af, socktype, proto, canonname, sa = res + try: + sock = socket.socket(af, socktype, proto) + sock.settimeout(0.1) + sock.connect(sa) + sock.send("\002What port?") + repl = sock.recv(1024) + sock.close() + if repl.find(correct_repl): + VimComFamily = af + break + except: + sock = None + continue if VimComPort >= 10050: VimComPort = 0 @@ -55,13 +57,14 @@ def DiscoverVimComPort(): def SendToVimCom(aString): HOST = "localhost" global VimComPort + global VimComFamily if VimComPort == 0: VimComPort = DiscoverVimComPort() if VimComPort == 0: return received = None - sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) + sock = socket.socket(VimComFamily, socket.SOCK_DGRAM) sock.settimeout(3.0) try: From dcfeb52f79c83a48840f01625741810aba6bd278 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Mon, 3 Dec 2012 21:31:12 -0300 Subject: [PATCH 0379/1050] Version 0.9.9. --- doc/r-plugin.txt | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 0fc37ad..99549c4 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -132,7 +132,7 @@ following dependencies: Vim >= 7.3 with Python support. Tmux >= 1.5: http://tmux.sourceforge.net Screen plugin: http://www.vim.org/scripts/script.php?script_id=2711 - vimcom = 0.9-5: http://www.lepem.ufc.br/jaa/vimcom.html + vimcom = 0.9-5: An R package. Suggests:~ ncurses-term: http://invisible-island.net/ncurses @@ -160,6 +160,10 @@ following dependencies: On Fedora/Red Hat, the command is: > sudo yum install libX11-devel +< + Finally, do in R: +> + install.packages("vimcom") < The colorout package colorizes the R output and the setwidth package adjusts the value of options("width") whenever the terminal is resized. @@ -243,10 +247,11 @@ to install external dependencies: find the file that matches exactly the version of Python that you installed. - * vimcom = 0.9-5: http://www.lepem.ufc.br/jaa/vimcom.html - The vimcom package creates a server on R to allow the communication with - Vim. You certainly will want to put the following lines at the end of - your Rprofile (usually at ~/Documents/.Rprofile): + * vimcom = 0.9-5: An R package, available on CRAN and installable with the + install.packages() command. The vimcom package creates a server on R to + allow the communication with Vim. You certainly will want to put the + following lines at the end of your Rprofile (usually at + ~/Documents/.Rprofile): > if(interactive()){ library(vimcom) From 542d9d6203b8c11663975e97e1fcba1cda45b1bb Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 6 Dec 2012 07:58:26 -0300 Subject: [PATCH 0380/1050] Add lxterminal to the list of terminal emulators. --- r-plugin/common_global.vim | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 76c7f47..6a81d2e 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -3394,7 +3394,7 @@ if has("win32") || has("win64") || g:vimrplugin_applescript || $DISPLAY == "" || " No external terminal emulator will be called, so any value is good let g:vimrplugin_term = "xterm" else - let s:terminals = ['gnome-terminal', 'konsole', 'xfce4-terminal', 'terminal', 'Eterm', 'rxvt', 'aterm', 'roxterm', 'terminator', 'xterm'] + let s:terminals = ['gnome-terminal', 'konsole', 'xfce4-terminal', 'terminal', 'Eterm', 'rxvt', 'aterm', 'roxterm', 'terminator', 'lxterminal', 'xterm'] if has('mac') let s:terminals = ['iTerm', 'Terminal', 'Terminal.app'] + s:terminals endif @@ -3424,8 +3424,8 @@ endif let g:rplugin_termcmd = g:vimrplugin_term . " -e" -if g:vimrplugin_term == "gnome-terminal" || g:vimrplugin_term == "xfce4-terminal" || g:vimrplugin_term == "terminal" - " Cannot set icon: http://bugzilla.gnome.org/show_bug.cgi?id=126081 +if g:vimrplugin_term == "gnome-terminal" || g:vimrplugin_term == "xfce4-terminal" || g:vimrplugin_term == "terminal" || g:vimrplugin_term == "lxterminal" + " Cannot set gnome-terminal icon: http://bugzilla.gnome.org/show_bug.cgi?id=126081 let g:rplugin_termcmd = g:vimrplugin_term . " --working-directory='" . expand("%:p:h") . "' --title R -e" endif From 7bb147231eb4f4d4b960c16bc01deebe1a2d4b97 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Tue, 11 Dec 2012 06:58:08 -0300 Subject: [PATCH 0381/1050] Enable mouse again on Tmux. --- r-plugin/common_global.vim | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 6a81d2e..4e60bce 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -620,7 +620,7 @@ function StartR(whatr) \ "set -g terminal-overrides 'xterm*:smcup@:rmcup@'", \ 'set-environment -g VIMRPLUGIN_TMPDIR "' . $VIMRPLUGIN_TMPDIR . '"', \ 'set-environment -g VIMINSTANCEID "' . $VIMINSTANCEID . '"'] - if g:vimrplugin_external_ob + if g:vimrplugin_external_ob || !has("gui_running") let cnflines = extend(cnflines, ['set -g mode-mouse on', 'set -g mouse-select-pane on', 'set -g mouse-resize-pane on']) endif endif @@ -2703,7 +2703,6 @@ function MakeRMenu() amenu R.Help\ (plugin).Main\ features :help r-plugin-features amenu R.Help\ (plugin).Installation :help r-plugin-installation amenu R.Help\ (plugin).Use :help r-plugin-use - amenu R.Help\ (plugin).How\ the\ plugin\ works :help r-plugin-functioning amenu R.Help\ (plugin).Known\ bugs\ and\ workarounds :help r-plugin-known-bugs amenu R.Help\ (plugin).Options.Assignment\ operator\ and\ Rnoweb\ code :help vimrplugin_assign From 49acf173aee04cac98b5d6f54952c60b2d4f993f Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Tue, 11 Dec 2012 12:53:08 -0300 Subject: [PATCH 0382/1050] Version 0.9.9.1. --- Makefile | 4 ++-- doc/r-plugin.txt | 27 +++++++++++++-------------- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/Makefile b/Makefile index 2638d39..114b9d8 100644 --- a/Makefile +++ b/Makefile @@ -29,7 +29,7 @@ PLUGINHOME=`pwd` -PLUGINVERSION=0.9.9 +PLUGINVERSION=0.9.9.1 DEBIANTIME=`date -R` PLUGINRELEASEDATE=`date +"%Y-%m-%d"` VIM2HTML=/usr/local/share/vim/vim73/doc/vim2html.pl @@ -41,7 +41,7 @@ zip: mkdir -p vim-r-plugin-tmp/usr/share/vim/addons ) rm -f /tmp/vim-r-plugin-$(PLUGINVERSION).zip # Update the version date in doc/r-plugin.txt header and in the news - sed -i -e "s/^Version: [0-9].[0-9].[0-9]/Version: $(PLUGINVERSION)/" doc/r-plugin.txt + sed -i -e "s/^Version: [0-9].[0-9].[0-9].[0-9]/Version: $(PLUGINVERSION)/" doc/r-plugin.txt sed -i -e "s/^$(PLUGINVERSION) (201[0-9]-[0-9][0-9]-[0-9][0-9])$$/$(PLUGINVERSION) ($(PLUGINRELEASEDATE))/" doc/r-plugin.txt # Create a tar.gz file tar -cvzf /tmp/vimrplugintmpfile.tar.gz ftdetect/r.vim indent/r.vim indent/rmd.vim \ diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 99549c4..6d0b1ee 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -5,7 +5,7 @@ Authors: Jakson A. Aquino Jose Claudio Faria -Version: 0.9.9 +Version: 0.9.9.1 For Vim version 7.3 1. Overview |r-plugin-overview| @@ -851,7 +851,9 @@ anything. The R's source() function prints an extra new line between commands if the option echo = TRUE, and error messages and warning are printed only after the entire code is sourced, which makes it more difficult to find errors in the -code sent to R. +code sent to R. Details: + + https://stat.ethz.ch/pipermail/r-devel/2012-December/065352.html 5.2. The clipboard's content is lost (Windows only)~ @@ -903,7 +905,7 @@ documentation for any function, or do other tasks that require the hidden evaluation of code by R, the vimcom library will refuse to do the tasks to avoid any risk of corrupting R's memory. It will tell Vim that "R is busy" and Vim will display this message. Everything should work as expected again after -any valid code being executed in R Console. +any valid code is executed in R Console. 5.6. Commands are sent twice on Mac OS X~ @@ -912,13 +914,6 @@ If you use the screen plugin with GNU Screen, individual lines may be sent duplicated to R on Mac OS X. -5.7. "VimCom port not found" on OpenBSD~ - -When the loopback interface has both IPv4 and IPv6 addresses vimcom loads ok -but apparently does not listen on the IPv4 address (127.0.0.1), only on the -IPv6 one (fe80::1). - - ============================================================================== *r-plugin-options* 6. Options~ @@ -2046,10 +2041,10 @@ frequently when there are non ascii characters in the output. The two most important Vim limitations are: - We cannot scroll the windows of a buffer that is not being edited and, - thus, we have to go to the R buffer to scroll it. This is a problem if we - are running an R command that slowly generates a lot of output because the - shell buffer does not scroll when there is new output but it is not the - currently active buffer. + thus, we have to go to the R Console buffer to scroll it. This is a + problem if we are running an R command that slowly generates a lot of + output because the shell buffer does not scroll when there is new output + but it is not the currently active buffer. - Vim does not have a timer which would make the Conque Shell more efficient. Vim uses the same variable, 'updatetime', to do both save swap @@ -2138,6 +2133,10 @@ argument. Example: *r-plugin-news* 10. News~ +0.9.9.1 (2012-12-11) + + * Enable mouse on Tmux again. + 0.9.9 (2012-12-03) * New commands: :Rinsert and :Rformat. From aabf6f307a0ebd199d9e7664654b2364da086b83 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Fri, 14 Dec 2012 13:48:04 -0300 Subject: [PATCH 0383/1050] Forget RConsole handle when closing R. --- r-plugin/windows.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/r-plugin/windows.py b/r-plugin/windows.py index c2a4c74..12aae8f 100644 --- a/r-plugin/windows.py +++ b/r-plugin/windows.py @@ -84,6 +84,7 @@ def RaiseRConsole(): win32gui.SetForegroundWindow(RConsole) def SendQuitMsg(aString): + global RConsole SendToVimCom("\x09Set R as busy [SendQuitMsg()]") finalString = aString.decode("latin-1") + "\n" win32clipboard.OpenClipboard(0) @@ -100,6 +101,7 @@ def SendQuitMsg(aString): win32api.keybd_event(ord('V'), 0, win32con.KEYEVENTF_EXTENDEDKEY | win32con.KEYEVENTF_KEYUP, 0) win32api.keybd_event(win32con.VK_CONTROL, 0, win32con.KEYEVENTF_KEYUP, 0) time.sleep(0.05) + RConsole = 0 From 975573d42ab2f6850e9bd8563ba0124a73b93502 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 15 Dec 2012 19:39:36 -0300 Subject: [PATCH 0384/1050] Change the default value of vimrplugin_rmhidden. --- Makefile | 2 +- doc/r-plugin.txt | 7 ++++++- r-plugin/common_global.vim | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 114b9d8..a4ea5ac 100644 --- a/Makefile +++ b/Makefile @@ -29,7 +29,7 @@ PLUGINHOME=`pwd` -PLUGINVERSION=0.9.9.1 +PLUGINVERSION=0.9.9.2 DEBIANTIME=`date -R` PLUGINRELEASEDATE=`date +"%Y-%m-%d"` VIM2HTML=/usr/local/share/vim/vim73/doc/vim2html.pl diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 6d0b1ee..38e4b3b 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -209,7 +209,8 @@ show how the plugin will work on Linux in different conditions: Note: On Mac OS X the plugin will use AppleScript in both Vim and GVim unless -vimrplugin_applescript = 0. +vimrplugin_applescript = 0. Some user have reported more luck with iTerm than +with the default Mac OS X terminal emulator. 3.2.2. Windows~ @@ -2133,6 +2134,10 @@ argument. Example: *r-plugin-news* 10. News~ +0.9.9.2 (2012-12-11) + + * Change the default value of vimrplugin_rmhidden to 0. + 0.9.9.1 (2012-12-11) * Enable mouse on Tmux again. diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 4e60bce..8cc5b4b 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -3020,7 +3020,7 @@ endif " Variables whose default value is fixed call RSetDefaultValue("g:vimrplugin_map_r", 0) call RSetDefaultValue("g:vimrplugin_allnames", 0) -call RSetDefaultValue("g:vimrplugin_rmhidden", 1) +call RSetDefaultValue("g:vimrplugin_rmhidden", 0) call RSetDefaultValue("g:vimrplugin_assign", 1) call RSetDefaultValue("g:vimrplugin_assign_map", "'_'") call RSetDefaultValue("g:vimrplugin_rnowebchunk", 1) From 7a6d2f31d1dbde53c495a6f6fcf71eabe4728268 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Tue, 25 Dec 2012 09:42:09 -0300 Subject: [PATCH 0385/1050] Fix incompatibility with tcltk package on Linux. --- ftplugin/rbrowser.vim | 4 - r-plugin/common_global.vim | 160 +++++++++++++++++++++++-------------- r-plugin/vimcom.py | 4 +- 3 files changed, 104 insertions(+), 64 deletions(-) diff --git a/ftplugin/rbrowser.vim b/ftplugin/rbrowser.vim index 034396b..c7096a6 100644 --- a/ftplugin/rbrowser.vim +++ b/ftplugin/rbrowser.vim @@ -131,8 +131,6 @@ function! RBrowserDoubleClick() exe 'Py SendToVimCom("' . "\005" . '-' . substitute(key, '\$', '-', "g") . '")' if g:rplugin_lastrpl == "R is busy." call RWarningMsg("R is busy.") - else - call UpdateOB("GlobalEnv") endif else let key = substitute(key, '\$', '-', "g") @@ -143,8 +141,6 @@ function! RBrowserDoubleClick() exe 'Py SendToVimCom("' . "\005" . key . '")' if g:rplugin_lastrpl == "R is busy." call RWarningMsg("R is busy.") - else - call UpdateOB("libraries") endif endif endfunction diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 8cc5b4b..bad67e5 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -104,6 +104,31 @@ function ReplaceUnderS() endif endfunction +function! ReadEvalReply() + let reply = "No reply" + let haswaitwarn = 0 + let ii = 0 + while ii < 20 + sleep 100m + if filereadable($VIMRPLUGIN_TMPDIR . "/eval_reply") + let tmp = readfile($VIMRPLUGIN_TMPDIR . "/eval_reply") + if len(tmp) > 0 + let reply = tmp[0] + break + endif + endif + let ii += 1 + if ii == 2 + call RWarningMsg("Waiting for reply") + let haswaitwarn = 1 + endif + endwhile + if haswaitwarn + echon "\r " + endif + return reply +endfunction + function! CompleteChunkOptions() let cline = getline(".") let cpos = getpos(".") @@ -186,70 +211,73 @@ function RCompleteArgs() let classfor = substitute(classfor, '"', '\\"', "g") let rkeyword = '^' . rkeyword0 . "\x06" call cursor(cpos[1], cpos[2]) + call delete($VIMRPLUGIN_TMPDIR . "/eval_reply") if classfor == "" exe 'Py SendToVimCom("vimcom:::vim.args(' . "'" . rkeyword0 . "', '" . argkey . "')" . '")' else exe 'Py SendToVimCom("vimcom:::vim.args(' . "'" . rkeyword0 . "', '" . argkey . "', classfor = " . classfor . ")" . '")' endif - if g:rplugin_vimcomport > 0 && g:rplugin_lastrpl != "NOT_EXISTS" && g:rplugin_lastrpl != "NO_ARGS" && g:rplugin_lastrpl != "R is busy." && g:rplugin_lastrpl != "NOANSWER" && g:rplugin_lastrpl != "INVALID" && g:rplugin_lastrpl != "" - let args = [] - if g:rplugin_lastrpl[0] == "\x04" && len(split(g:rplugin_lastrpl, "\x04")) == 1 - return '' - endif - let tmp0 = split(g:rplugin_lastrpl, "\x04") - let tmp = split(tmp0[0], "\x09") - if(len(tmp) > 0) - for id in range(len(tmp)) - let tmp2 = split(tmp[id], "\x07") - if tmp2[0] == '...' - let tmp3 = tmp2[0] - else - let tmp3 = tmp2[0] . " = " - endif - if len(tmp2) > 1 - call add(args, {'word': tmp3, 'menu': tmp2[1]}) - else - call add(args, {'word': tmp3, 'menu': ' '}) - endif - endfor - if len(args) > 0 && len(tmp0) > 1 - call add(args, {'word': ' ', 'menu': tmp0[1]}) - endif - call complete(idx2, args) - endif - return '' - endif - - for omniL in flines - if omniL =~ rkeyword && omniL =~ "\x06function\x06function\x06" - let tmp1 = split(omniL, "\x06") - if len(tmp1) < 5 + if g:rplugin_vimcomport > 0 + let g:rplugin_lastrpl = ReadEvalReply() + if g:rplugin_lastrpl != "NOT_EXISTS" && g:rplugin_lastrpl != "NO_ARGS" && g:rplugin_lastrpl != "R is busy." && g:rplugin_lastrpl != "NOANSWER" && g:rplugin_lastrpl != "INVALID" && g:rplugin_lastrpl != "" && g:rplugin_lastrpl != "No reply" + let args = [] + if g:rplugin_lastrpl[0] == "\x04" && len(split(g:rplugin_lastrpl, "\x04")) == 1 return '' endif - let info = tmp1[4] - let argsL = split(info, "\x09") - let args = [] - for id in range(len(argsL)) - let newkey = '^' . argkey - let tmp2 = split(argsL[id], "\x07") - if (argkey == '' || tmp2[0] =~ newkey) && tmp2[0] !~ "No arguments" - if tmp2[0] != '...' - let tmp2[0] = tmp2[0] . " = " + let tmp0 = split(g:rplugin_lastrpl, "\x04") + let tmp = split(tmp0[0], "\x09") + if(len(tmp) > 0) + for id in range(len(tmp)) + let tmp2 = split(tmp[id], "\x07") + if tmp2[0] == '...' + let tmp3 = tmp2[0] + else + let tmp3 = tmp2[0] . " = " endif - if len(tmp2) == 2 - let tmp3 = {'word': tmp2[0], 'menu': tmp2[1]} + if len(tmp2) > 1 + call add(args, {'word': tmp3, 'menu': tmp2[1]}) else - let tmp3 = {'word': tmp2[0], 'menu': ''} + call add(args, {'word': tmp3, 'menu': ' '}) endif - call add(args, tmp3) + endfor + if len(args) > 0 && len(tmp0) > 1 + call add(args, {'word': ' ', 'menu': tmp0[1]}) endif - endfor - call complete(idx2, args) + call complete(idx2, args) + endif return '' endif - endfor - break + for omniL in flines + if omniL =~ rkeyword && omniL =~ "\x06function\x06function\x06" + let tmp1 = split(omniL, "\x06") + if len(tmp1) < 5 + return '' + endif + let info = tmp1[4] + let argsL = split(info, "\x09") + let args = [] + for id in range(len(argsL)) + let newkey = '^' . argkey + let tmp2 = split(argsL[id], "\x07") + if (argkey == '' || tmp2[0] =~ newkey) && tmp2[0] !~ "No arguments" + if tmp2[0] != '...' + let tmp2[0] = tmp2[0] . " = " + endif + if len(tmp2) == 2 + let tmp3 = {'word': tmp2[0], 'menu': tmp2[1]} + else + let tmp3 = {'word': tmp2[0], 'menu': ''} + endif + call add(args, tmp3) + endif + endfor + call complete(idx2, args) + return '' + endif + endfor + break + endif endif let idx -= 1 if idx <= 0 @@ -1153,8 +1181,10 @@ function RFormatCode() range elseif wco > 180 let wco = 180 endif + call delete($VIMRPLUGIN_TMPDIR . "/eval_reply") exe "Py SendToVimCom('formatR::tidy.source(\"" . $VIMRPLUGIN_TMPDIR . "/unformatted_code" . "\", file = \"" . $VIMRPLUGIN_TMPDIR . "/formatted_code\", width.cutoff = " . wco . ")')" - if g:rplugin_lastrpl == "R is busy." || g:rplugin_lastrpl == "UNKNOWN" || g:rplugin_lastrpl =~ "^Error" || g:rplugin_lastrpl == "INVALID" || g:rplugin_lastrpl == "ERROR" || g:rplugin_lastrpl == "EMPTY" + let g:rplugin_lastrpl = ReadEvalReply() + if g:rplugin_lastrpl == "R is busy." || g:rplugin_lastrpl == "UNKNOWN" || g:rplugin_lastrpl =~ "^Error" || g:rplugin_lastrpl == "INVALID" || g:rplugin_lastrpl == "ERROR" || g:rplugin_lastrpl == "EMPTY" || g:rplugin_lastrpl == "No reply" call RWarningMsg(g:rplugin_lastrpl) return endif @@ -1171,11 +1201,14 @@ function RInsert(cmd) return endif endif - exe "Py SendToVimCom('paste(capture.output(" . a:cmd . "), collapse = \"\\\\n\")')" - if g:rplugin_lastrpl == "R is busy." || g:rplugin_lastrpl == "UNKNOWN" || g:rplugin_lastrpl =~ "^Error" || g:rplugin_lastrpl == "INVALID" || g:rplugin_lastrpl == "ERROR" || g:rplugin_lastrpl == "EMPTY" || g:rplugin_lastrpl == "RTYPE" + call delete($VIMRPLUGIN_TMPDIR . "/eval_reply") + call delete($VIMRPLUGIN_TMPDIR . "/Rinsert") + exe "Py SendToVimCom('capture.output(" . a:cmd . ', file = "' . $VIMRPLUGIN_TMPDIR . "/Rinsert" . '")' . "')" + let g:rplugin_lastrpl = ReadEvalReply() + if g:rplugin_lastrpl == "R is busy." || g:rplugin_lastrpl == "UNKNOWN" || g:rplugin_lastrpl =~ "^Error" || g:rplugin_lastrpl == "INVALID" || g:rplugin_lastrpl == "ERROR" || g:rplugin_lastrpl == "EMPTY" || g:rplugin_lastrpl == "No reply" call RWarningMsg(g:rplugin_lastrpl) else - call append(".", split(g:rplugin_lastrpl, "\n")) + silent exe "read " . g:rplugin_esc_tmpdir . "/Rinsert" endif endfunction @@ -1830,14 +1863,16 @@ function BuildROmniList(env, packlist) call delete($VIMRPLUGIN_TMPDIR . "/vimbol_finished") if a:env =~ "GlobalEnv" + call delete($VIMRPLUGIN_TMPDIR . "/eval_reply") exe "Py SendToVimCom('" . omnilistcmd . "')" if g:rplugin_vimcomport == 0 sleep 500m let b:needsnewomnilist = 1 return endif - if g:rplugin_lastrpl == "R is busy." - call RWarningMsg("R is busy.") + let g:rplugin_lastrpl = ReadEvalReply() + if g:rplugin_lastrpl == "R is busy." || g:rplugin_lastrpl == "No reply" + call RWarningMsg(g:rplugin_lastrpl) let b:needsnewomnilist = 1 sleep 800m return @@ -2086,6 +2121,7 @@ function ShowRDoc(rkeyword, package, getclass) call SetRTextWidth() let g:rplugin_lastrpl = "R did not reply." + call delete($VIMRPLUGIN_TMPDIR . "/eval_reply") if classfor == "" && a:package == "" exe 'Py SendToVimCom("vim.help(' . "'" . a:rkeyword . "', " . g:rplugin_htw . 'L)")' elseif a:package != "" @@ -2095,6 +2131,7 @@ function ShowRDoc(rkeyword, package, getclass) let classfor = substitute(classfor, '"', '\\"', "g") exe 'Py SendToVimCom("vim.help(' . "'" . a:rkeyword . "', " . g:rplugin_htw . "L, " . classfor . ")". '")' endif + let g:rplugin_lastrpl = ReadEvalReply() if g:rplugin_lastrpl != "VIMHELP" if g:rplugin_lastrpl =~ "^MULTILIB" echo "The topic '" . a:rkeyword . "' was found in more than one library:" @@ -2104,7 +2141,9 @@ function ShowRDoc(rkeyword, package, getclass) endfor let chn = input("Please, select one of them: ") if chn > 0 && chn < len(libs) + call delete($VIMRPLUGIN_TMPDIR . "/eval_reply") exe 'Py SendToVimCom("vim.help(' . "'" . a:rkeyword . "', " . g:rplugin_htw . "L, package='" . libs[chn] . "')" . '")' + let g:rplugin_lastrpl = ReadEvalReply() endif else call RWarningMsg(g:rplugin_lastrpl) @@ -2298,9 +2337,11 @@ function RRealAction(rcmd) endfunction function RAction(rcmd) - Py SendToVimCom("\x08Stop updating info [RAction()]") + if !g:vimrplugin_external_ob + Py SendToVimCom("\x08Stop updating info [RAction()]") + endif call RRealAction(a:rcmd) - if v:servername != "" + if !g:vimrplugin_external_ob && v:servername != "" exe 'Py SendToVimCom("\x07' . v:servername . '")' endif endfunction @@ -3165,6 +3206,9 @@ if g:vimrplugin_external_ob == 1 let g:vimrplugin_objbr_place = substitute(g:vimrplugin_objbr_place, "script", "console", "") endif +if g:vimrplugin_tmux && g:vimrplugin_objbr_place =~ "console" + let g:vimrplugin_external_ob = 1 +endif if has("win32") || has("win64") call RSetDefaultValue("g:vimrplugin_conquesleep", 200) diff --git a/r-plugin/vimcom.py b/r-plugin/vimcom.py index f9d2a37..824a9f1 100644 --- a/r-plugin/vimcom.py +++ b/r-plugin/vimcom.py @@ -48,8 +48,8 @@ def DiscoverVimComPort(): else: vim.command("let g:rplugin_vimcomport = " + str(VimComPort)) PortWarn = False - if repl.find("0.9-5") != 0: - vim.command("call RWarningMsg('This version of Vim-R-plugin requires vimcom 0.9-5.')") + if repl.find("0.9-6") != 0: + vim.command("call RWarningMsg('This version of Vim-R-plugin requires vimcom 0.9-6.')") vim.command("sleep 1") return(VimComPort) From 358f75bf0f51e011cab2400f66799aeec7dabea0 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 27 Dec 2012 07:47:40 -0300 Subject: [PATCH 0386/1050] Update. --- doc/r-plugin.txt | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 38e4b3b..c05cdea 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -5,7 +5,7 @@ Authors: Jakson A. Aquino Jose Claudio Faria -Version: 0.9.9.1 +Version: 0.9.9.2 For Vim version 7.3 1. Overview |r-plugin-overview| @@ -132,7 +132,7 @@ following dependencies: Vim >= 7.3 with Python support. Tmux >= 1.5: http://tmux.sourceforge.net Screen plugin: http://www.vim.org/scripts/script.php?script_id=2711 - vimcom = 0.9-5: An R package. + vimcom = 0.9-6: An R package. Suggests:~ ncurses-term: http://invisible-island.net/ncurses @@ -248,7 +248,7 @@ to install external dependencies: find the file that matches exactly the version of Python that you installed. - * vimcom = 0.9-5: An R package, available on CRAN and installable with the + * vimcom = 0.9-6: An R package, available on CRAN and installable with the install.packages() command. The vimcom package creates a server on R to allow the communication with Vim. You certainly will want to put the following lines at the end of your Rprofile (usually at @@ -809,6 +809,12 @@ A sample detachable session could be: See |vimrplugin_only_in_tmux| if you always prefer starting Tmux before starting Vim, but sometimes forget to start Tmux. +Note: The screen.vim plugin relies on the TERM environment variable starting +with the string "screen" to decide whether to start a new Tmux session or to +split the current one.  If you set the environment variable in your tmux.conf +to something different, the screen.vim plugin will not know that it is already +inside Tmux. See |screen-bootstrap| for details. + 4.9. GNU Screen usage~ *r-plugin-screen* @@ -2134,7 +2140,7 @@ argument. Example: *r-plugin-news* 10. News~ -0.9.9.2 (2012-12-11) +0.9.9.2 (2012-12-25) * Change the default value of vimrplugin_rmhidden to 0. From 6398ac14c3278de4039ad116836b8d50083e4c52 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 27 Dec 2012 14:05:36 -0300 Subject: [PATCH 0387/1050] Set R as busy on Windows only. --- doc/r-plugin.txt | 24 ++++++++++++------------ r-plugin/common_global.vim | 6 ++++-- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index c05cdea..dfe0662 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -901,18 +901,18 @@ indent the code below: class(x) <- c(if(ordered) "ordered", "factor") < -5.5. Wrong message that "R is busy"~ +5.5. Wrong message that "R is busy" (Windows only)~ -When code is sent from Vim to R Console, the vimcom library sets the value of -the internal variable "r_is_busy" to 1. The value is set back to 0 when any -code is successfully evaluated. If you send invalid code to R, there will be -no successful evaluation of code and, thus, the value of "r_is_busy" will -remain set to 1. Then, if you try to update the object browser, see the R -documentation for any function, or do other tasks that require the hidden -evaluation of code by R, the vimcom library will refuse to do the tasks to -avoid any risk of corrupting R's memory. It will tell Vim that "R is busy" and -Vim will display this message. Everything should work as expected again after -any valid code is executed in R Console. +On Windows, when code is sent from Vim to R Console, the vimcom library sets +the value of the internal variable "r_is_busy" to 1. The value is set back to +0 when any code is successfully evaluated. If you send invalid code to R, +there will be no successful evaluation of code and, thus, the value of +"r_is_busy" will remain set to 1. Then, if you try to update the object +browser, see the R documentation for any function, or do other tasks that +require the hidden evaluation of code by R, the vimcom library will refuse to +do the tasks to avoid any risk of corrupting R's memory. It will tell Vim that +"R is busy" and Vim will display this message. Everything should work as +expected again after any valid code is executed in R Console. 5.6. Commands are sent twice on Mac OS X~ @@ -2140,7 +2140,7 @@ argument. Example: *r-plugin-news* 10. News~ -0.9.9.2 (2012-12-25) +0.9.9.2 (2012-12-27) * Change the default value of vimrplugin_rmhidden to 0. diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index bad67e5..ade35d7 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -119,12 +119,15 @@ function! ReadEvalReply() endif let ii += 1 if ii == 2 - call RWarningMsg("Waiting for reply") + echohl WarningMsg + echon "\rWaiting for reply" + echohl Normal let haswaitwarn = 1 endif endwhile if haswaitwarn echon "\r " + redraw endif return reply endfunction @@ -1215,7 +1218,6 @@ endfunction " Function to send commands " return 0 on failure and 1 on success function SendCmdToR(cmd) - Py SendToVimCom("\x09Set R as busy [SendCmdToR()]") if g:vimrplugin_ca_ck let cmd = "\001" . "\013" . a:cmd else From d004f71a3af1712b0a370a77fa73d79b12fdadb4 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Fri, 28 Dec 2012 15:32:52 -0300 Subject: [PATCH 0388/1050] New option for Windows: vimrplugin_Rterm. --- doc/r-plugin.txt | 22 ++++++++++- r-plugin/common_global.vim | 11 ++++++ r-plugin/windows.py | 78 ++++++++++++++++++++++++++++---------- 3 files changed, 89 insertions(+), 22 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index dfe0662..4ec6846 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -927,6 +927,7 @@ duplicated to R on Mac OS X. |vimrplugin_term| External terminal to be used |vimrplugin_term_cmd| Complete command to open an external terminal +|vimrplugin_Rterm| On Windows, use Rterm.exe |vimrplugin_assign| Convert '_' into ' <- ' |vimrplugin_assign_map| Choose what to convert into ' <- ' |vimrplugin_rnowebchunk| Convert '<' into '<<>>=\n@' in Rnoweb files @@ -1002,6 +1003,22 @@ Please, look at the manual of your terminal emulator to know how to call it. The last argument must be the one which precedes the command to be executed. +6.2. Use Rterm.exe on Windows~ + *r-plugin-Rterm.exe* +If you rather prefer to use Rterm.exe than Rgui.exe, you have to set the +"Quick Edit Mode" on either the Windows 7 PowerShell or the Windows XP Command +Prompt and put in your |vimrc|: +> + let vimrplugin_Rterm = 1 +< +Technical details: The plugin copies the code to be sent to R to the Windows +clipboard and, then, sends the key strokes "Ctrl+V" to R Console window. +However, neither the Windows 7 PowerShell nor the Windows XP Command Prompt +has a keyboard shortcut to "paste". The solution is to set the "Quick Edit +Mode" on either PowerShell or Command Prompt and to send a "Right click" to +it. + + 6.2. Assignment operator and Rnoweb completion of code block~ *vimrplugin_assign* *vimrplugin_assign_map* @@ -2140,9 +2157,12 @@ argument. Example: *r-plugin-news* 10. News~ -0.9.9.2 (2012-12-27) +0.9.9.2 (2012-12-28) + * Update vimcom version requirement to 0.9-6 (fix incompatibility with tcltk + package on Unix). * Change the default value of vimrplugin_rmhidden to 0. + * New options for Windows: vimrplugin_Rterm and vimrplugin_R_window_title. 0.9.9.1 (2012-12-11) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index ade35d7..ec85f64 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -3072,6 +3072,7 @@ call RSetDefaultValue("g:vimrplugin_openpdf", 0) call RSetDefaultValue("g:vimrplugin_openpdf_quietly", 0) call RSetDefaultValue("g:vimrplugin_openhtml", 0) call RSetDefaultValue("g:vimrplugin_i386", 0) +call RSetDefaultValue("g:vimrplugin_Rterm", 0) call RSetDefaultValue("g:vimrplugin_screenvsplit", 0) call RSetDefaultValue("g:vimrplugin_conquevsplit", 0) call RSetDefaultValue("g:vimrplugin_conqueplugin", 0) @@ -3384,6 +3385,16 @@ if has("win32") || has("win64") if !exists("g:vimrplugin_sleeptime") let g:vimrplugin_sleeptime = 0.02 endif + if g:vimrplugin_Rterm + let g:rplugin_Rgui = substitute(g:rplugin_Rgui, "Rgui", "Rterm", "") + endif + if !exists("g:vimrplugin_R_window_title") + if g:vimrplugin_Rterm + let g:vimrplugin_R_window_title = "Rterm" + else + let g:vimrplugin_R_window_title = "R Console" + endif + endif endif " Are we in a Debian package? Is the plugin running for the first time? diff --git a/r-plugin/windows.py b/r-plugin/windows.py index 12aae8f..a0b0d0b 100644 --- a/r-plugin/windows.py +++ b/r-plugin/windows.py @@ -4,6 +4,7 @@ import time import vim RConsole = 0 +Rterm = False try: import win32api @@ -18,18 +19,52 @@ vim.command("call RWarningMsgInp('Please install PyWin32. The Python version being used is: " + myPyVersion + " (" + myArch[0] + ")')") vim.command("let rplugin_pywin32 = 0") +def RightClick(): + global RConsole + myHandle = win32gui.GetForegroundWindow() + RaiseRConsole() + time.sleep(0.05) + #lParam = (y << 16) | x + lParam = (100 << 16) | 100 + win32gui.SendMessage(RConsole, win32con.WM_RBUTTONDOWN, 0, lParam) + win32gui.SendMessage(RConsole, win32con.WM_RBUTTONUP, 0, lParam) + time.sleep(0.05) + try: + win32gui.SetForegroundWindow(myHandle) + except: + vim.command("call RWarningMsg('Could not put itself on foreground.')") + +def CntrlV(): + win32api.keybd_event(0x11, 0, 0, 0) + try: + win32api.PostMessage(RConsole, 0x100, 0x56, 0x002F0001) + except: + vim.command("call RWarningMsg('R Console window not found [1].')") + RConsole = 0 + pass + if RConsole: + time.sleep(0.05) + try: + win32api.PostMessage(RConsole, 0x101, 0x56, 0xC02F0001) + except: + vim.command("call RWarningMsg('R Console window not found [2].')") + pass + win32api.keybd_event(0x11, 0, 2, 0) + def FindRConsole(): global RConsole - RConsole = win32gui.FindWindow(None, "R Console") + Rtitle = vim.eval("g:vimrplugin_R_window_title") + RConsole = win32gui.FindWindow(None, Rtitle) if RConsole == 0: - RConsole = win32gui.FindWindow(None, "R Console (64-bit)") + RConsole = win32gui.FindWindow(None, Rtitle + " (64-bit)") if RConsole == 0: - RConsole = win32gui.FindWindow(None, "R Console (32-bit)") + RConsole = win32gui.FindWindow(None, Rtitle + " (32-bit)") if RConsole == 0: vim.command("call RWarningMsg('Could not find R Console.')") def SendToRConsole(aString): global RConsole + global Rterm SendToVimCom("\x09Set R as busy [SendToRConsole()]") finalString = aString.decode("latin-1") + "\n" win32clipboard.OpenClipboard(0) @@ -39,25 +74,16 @@ def SendToRConsole(aString): if RConsole == 0: FindRConsole() if RConsole: - win32api.keybd_event(0x11, 0, 0, 0) - try: - win32api.PostMessage(RConsole, 0x100, 0x56, 0x002F0001) - except: - vim.command("call RWarningMsg('R Console window not found [1].')") - RConsole = 0 - pass - if RConsole: - time.sleep(0.05) - try: - win32api.PostMessage(RConsole, 0x101, 0x56, 0xC02F0001) - except: - vim.command("call RWarningMsg('R Console window not found [2].')") - pass - win32api.keybd_event(0x11, 0, 2, 0) + if Rterm: + RightClick() + else: + CntrlV() def RClearConsolePy(): global RConsole - SendToVimCom("\x09Set R as busy [RClearConsolePy()]") + global Rterm + if Rterm: + return if RConsole == 0: FindRConsole() if RConsole: @@ -82,9 +108,11 @@ def RaiseRConsole(): FindRConsole() if RConsole: win32gui.SetForegroundWindow(RConsole) + time.sleep(0.1) def SendQuitMsg(aString): global RConsole + global Rterm SendToVimCom("\x09Set R as busy [SendQuitMsg()]") finalString = aString.decode("latin-1") + "\n" win32clipboard.OpenClipboard(0) @@ -93,7 +121,7 @@ def SendQuitMsg(aString): win32clipboard.CloseClipboard() sleepTime = float(vim.eval("g:vimrplugin_sleeptime")) RaiseRConsole() - if RConsole: + if RConsole and not Rterm: time.sleep(sleepTime) win32api.keybd_event(win32con.VK_CONTROL, 0, 0, 0) win32api.keybd_event(ord('V'), 0, win32con.KEYEVENTF_EXTENDEDKEY | 0, 0) @@ -101,7 +129,10 @@ def SendQuitMsg(aString): win32api.keybd_event(ord('V'), 0, win32con.KEYEVENTF_EXTENDEDKEY | win32con.KEYEVENTF_KEYUP, 0) win32api.keybd_event(win32con.VK_CONTROL, 0, win32con.KEYEVENTF_KEYUP, 0) time.sleep(0.05) - RConsole = 0 + RConsole = 0 + if RConsole and Rterm: + RightClick() + RConsole = 0 @@ -130,6 +161,11 @@ def GetRPath(): vim.command("let s:rinstallpath = 'Not found'") def StartRPy(): + global Rterm + if vim.eval("g:vimrplugin_Rterm") == "1": + Rterm = True + else: + Rterm = False rpath = vim.eval("g:rplugin_Rgui") rargs = ['"' + rpath + '"'] r_args = vim.eval("b:rplugin_r_args") From 7b4bad7cb765e62029d0e97c9858c783b9d9ff9d Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Fri, 28 Dec 2012 18:03:35 -0300 Subject: [PATCH 0389/1050] Update subsection numbers. --- doc/r-plugin.txt | 56 ++++++++++++++++++++++++------------------------ 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 4ec6846..6fa5a20 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -1019,7 +1019,7 @@ Mode" on either PowerShell or Command Prompt and to send a "Right click" to it. -6.2. Assignment operator and Rnoweb completion of code block~ +6.3. Assignment operator and Rnoweb completion of code block~ *vimrplugin_assign* *vimrplugin_assign_map* *vimrplugin_rnowebchunk* @@ -1042,7 +1042,7 @@ put in your |vimrc|: let vimrplugin_rnowebchunk = 0 < -6.3. Object Browser options~ +6.4. Object Browser options~ *vimrplugin_objbr_place* *vimrplugin_objbr_w* *vimrplugin_external_ob* @@ -1069,11 +1069,11 @@ emulator. In this case, the command rh will not work on the Object Browser (you will see the message "Cmd not available"). -6.4. Vim as pager for R help~ +6.5. Vim as pager for R help~ *vimrplugin_vimpager* *vimrplugin_editor_w* *vimrplugin_help_w* -6.4.1. Quick setup~ +6.5.1. Quick setup~ If you do not want to see R documentation in a Vim's buffer, put in your |vimrc|: @@ -1086,7 +1086,7 @@ the R console, put in your .Rprofile: options(pager = "vim -c 'set ft=rdoc' -") < -6.4.2. Details and other options:~ +6.5.2. Details and other options:~ The plugin key bindings will remain active in the documentation buffer, and, thus, you will be able to send commands to R as you do while editing an R @@ -1116,10 +1116,10 @@ values to some variables in your |vimrc|, as in the example: let vimrplugin_editor_h = 60 < -6.5. Number of R processes (Linux/Unix only)~ +6.6. Number of R processes (Linux/Unix only)~ *vimrplugin_nosingler* *vimrplugin_by_vim_instance* -6.5.1 Using (G)Vim without the screen.vim plugin~ +6.6.1 Using (G)Vim without the screen.vim plugin~ By default, all buffers of all (G)Vim instances send code to the same R process. If you prefer that each Vim buffer uses its own R process, put the following @@ -1142,14 +1142,14 @@ with the --servername argument. If you want to use more than nine GVim instances you will have to use the --servername argument because screen will not differentiate between names like "GVIM1" and "GVIM10". -6.5.2 Using the screen.vim plugin~ +6.6.2 Using the screen.vim plugin~ Both options are ignored when using Vim in a terminal emulator and using the screen.vim plugin. The plugin behaves as if the |vimrplugin_by_instance| was enabled. -6.6. Use 32 bit version of R (Windows and Mac OS X only)~ +6.7. Use 32 bit version of R (Windows and Mac OS X only)~ *vimrplugin_i386* If you are using a 64 bit Windows or a 64 bit Mac OS X, but prefer to run the 32 bit version of R, put in your |vimrc|: @@ -1157,7 +1157,7 @@ If you are using a 64 bit Windows or a 64 bit Mac OS X, but prefer to run the let vimrplugin_i386 = 1 < -6.7. R path~ +6.8. R path~ *vimrplugin_r_path* Vim will run the first R executable in the path. You can set an alternative R path in your |vimrc| as in the examples: @@ -1168,7 +1168,7 @@ path in your |vimrc| as in the examples: On Windows, Vim will try to find the R install path in the Windows Registry. -6.8. Arguments to R~ +6.9. Arguments to R~ *vimrplugin_r_args* Set this option in your |vimrc| if you want to pass command line arguments to R at the startup. Example: @@ -1180,7 +1180,7 @@ default value is "--sdi", but you may change it to "--mdi" if you do not like the SDI style of the graphical user interface. -6.9. Time necessary to build list of objects for omni completion~ +6.10. Time necessary to build list of objects for omni completion~ *vimrplugin_buildwait* If your system needs more than 60 seconds to build the list of objects for omni completion after you do the command |:RUpdateObjList|, then you should @@ -1189,7 +1189,7 @@ set the value of |vimrplugin_buildwait| to a higher value. Example: let vimrplugin_buildwait = 240 > -6.10. More colorful syntax highlight of .Rout files~ +6.11. More colorful syntax highlight of .Rout files~ *vimrplugin_routmorecolors* By default, the R commands in .Rout files are highlighted with the color of comments, and only the output of commands has some of its elements highlighted @@ -1201,7 +1201,7 @@ scripts, put the following in your |vimrc|: let vimrplugin_routmorecolors = 1 < -6.11. How to automatically open the .Rout file~ +6.12. How to automatically open the .Rout file~ *vimrplugin_routnotab* After the command ao, Vim will save the current buffer if it has any pending changes, run "R CMD BATCH --no-restore --no-save" on the current @@ -1211,7 +1211,7 @@ file is open in a new split window, put in your |vimrc|: let vimrplugin_routnotab = 1 < -6.12. Indent commented lines~ +6.13. Indent commented lines~ *vimrplugin_indent_commented* You can type xx to comment out a line or selected lines. If the line already starts with a comment string, it will be removed. After adding @@ -1231,7 +1231,7 @@ table below (see |r-plugin-indenting|): 0 0 ### < -6.13. Sleep time (Windows only)~ +6.14. Sleep time (Windows only)~ *vimrplugin_sleeptime* The plugin gives to R a small amount of time to process the paste command. The default value is 0.2 second, but you should experiment different values. The @@ -1240,7 +1240,7 @@ example show how to adjust the value of sleeptime in your |vimrc|: let vimrplugin_sleeptime = 0.1 < -6.14. Tmux and Screen configuration (Linux/Unix only)~ +6.15. Tmux and Screen configuration (Linux/Unix only)~ *vimrplugin_noscreenrc* *vimrplugin_notmuxconf* GVim (or Vim running R in an external terminal emulator) runs Tmux with a @@ -1260,7 +1260,7 @@ required for the communication with R and source your own configuration file (either ~/.tmux.conf or ~/.screenrc). -6.15. Integration with screen.vim plugin (Linux/Unix only)~ +6.16. Integration with screen.vim plugin (Linux/Unix only)~ *vimrplugin_screenplugin* *vimrplugin_screenvsplit* *vimrplugin_tmux* @@ -1304,7 +1304,7 @@ with the Vim-R-plugin you will need to add the following to your |vimrc|: let vimrplugin_screenplugin = 0 < -6.16. Integration with AppleScript (OS X only)~ +6.17. Integration with AppleScript (OS X only)~ *vimrplugin_applescript* In Mac OS X, the plugin will try to send commands to R gui using AppleScript. If you prefer to run R and Vim in the same terminal emulator split in two @@ -1319,7 +1319,7 @@ If you prefer to have R running in an external terminal emulator, put in your let vimrplugin_screenplugin = 0 < -6.17. Special R functions~ +6.18. Special R functions~ *vimrplugin_listmethods* *vimrplugin_specialplot* The R function args() lists the arguments of a function, but not the arguments @@ -1335,7 +1335,7 @@ after rg if you put the following line in your |vimrc|: let vimrplugin_specialplot = 1 < -6.18. maxdeparse~ +6.19. maxdeparse~ *vimrplugin_maxdeparse* You can set the argument maxdeparse to be passed to R's source() function. Example: @@ -1343,7 +1343,7 @@ Example: let vimrplugin_maxdeparse = 300 < -6.19. LaTeX command~ +6.20. LaTeX command~ *vimrplugin_latexcmd* *vimrplugin_sweaveargs* On Windows, the plugin calls tools::texi2pdf() to build the pdf from the @@ -1357,7 +1357,7 @@ If you want to pass arguments do the Sweave() function, set the value of the vimrplugin_sweaveargs variable. -6.20. Never unmake the R menu and tool bar buttons~ +6.21. Never unmake the R menu and tool bar buttons~ *vimrplugin_never_unmake_menu* Use this option if you want that the menu item R and the R related tool bar buttons are not deleted when you change from one buffer to another, for @@ -1369,7 +1369,7 @@ When this options is enabled all menu items are created regardless of the file type. -6.21. Map 'r'~ +6.22. Map 'r'~ *vimrplugin_map_r* If the variable |vimrplugin_map_r| exists, the plugin will map the letter 'r' to send lines to R when there are visually selected lines, for compatibility @@ -1387,7 +1387,7 @@ Emacs: set tabstop=8 < -6.22. Add ^A^K to the beginning of commands~ +6.23. Add ^A^K to the beginning of commands~ *vimrplugin_ca_ck* When one types in the R Console the cursor goes to the beginning of the line and one types the characters to the right of the cursor are @@ -1399,7 +1399,7 @@ either Tmux or GNU Screen in some systems. The Vim-R-plugin will add let vimrplugin_ca_ck = 1 < -6.23. Open PDF after processing rnoweb file~ +6.24. Open PDF after processing rnoweb file~ *vimrplugin_openpdf* *vimrplugin_openpdf_quietly* *vimrplugin_openhtml* @@ -1446,7 +1446,7 @@ you prefer the non strict rst code, put the following in your |vimrc|: let vimrplugin_strict_rst = 0 < -6.24. Allow R commands in insert mode~ +6.25. Allow R commands in insert mode~ *Vimrplugin_insert_mode_cmds* Vim-R commands are designed to work in insert mode as well as normal mode. However, depending on your , this can make it very difficult to @@ -1460,7 +1460,7 @@ use it, add the following in your |vimrc|: < The default value is 1, for consistency with earlier versions. -6.25. Show/remove hidden objects~ +6.26. Show/remove hidden objects~ *vimrplugin_allnames* *vimrplugin_rmhidden* Hidden objects are not included in the list of objects for omni completion. If From c9f6c9ddf88fa2419237b84cd6524bad7237123b Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 29 Dec 2012 14:08:45 -0300 Subject: [PATCH 0390/1050] Minor bug fix. --- r-plugin/windows.py | 1 + 1 file changed, 1 insertion(+) diff --git a/r-plugin/windows.py b/r-plugin/windows.py index a0b0d0b..f7bd750 100644 --- a/r-plugin/windows.py +++ b/r-plugin/windows.py @@ -35,6 +35,7 @@ def RightClick(): vim.command("call RWarningMsg('Could not put itself on foreground.')") def CntrlV(): + global RConsole win32api.keybd_event(0x11, 0, 0, 0) try: win32api.PostMessage(RConsole, 0x100, 0x56, 0x002F0001) From 5fabc6ae4ed9e2dacb2d5e3bca300c78eddd00d1 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Tue, 8 Jan 2013 10:04:27 -0300 Subject: [PATCH 0391/1050] Simple comment/uncomment of lines. --- r-plugin/common_global.vim | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index ec85f64..0ebe6ff 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -297,6 +297,17 @@ function RCompleteArgs() return '' endfunction +function RSimpleCommentLine() + call setline(line("."), "#" . getline(".")) +endfunction + +function RSimpleUncommentLine() + call setline(line("."), substitute(getline("."), "^#", "", "")) +endfunction + +noremap xc :call RSimpleCommentLine() +noremap xu :call RSimpleUncommentLine() + function RCommentLine(lnum, ind, cmt) let line = getline(a:lnum) call cursor(a:lnum, 0) From ee4aa7a4195ee71dd0a3bcd2bd8afa23ccc8cd3b Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Tue, 8 Jan 2013 12:08:58 -0300 Subject: [PATCH 0392/1050] New simpler un/comment commands: \xc and \xu. --- doc/r-plugin.txt | 11 +++- r-plugin/common_global.vim | 113 +++++++++++++++++++++++++------------ 2 files changed, 85 insertions(+), 39 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 6fa5a20..56912ca 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -683,6 +683,10 @@ libraries, the library currently under the cursor line is detached. 4.6. Commenting and uncommenting lines~ +You can add the comment character to the beginning of a line by typing +xc and remove it with xu. For more sophisticated +ways of commenting and uncommenting, see below. + You can toggle the state of a line as either commented or uncommented by typing xx. @@ -1509,7 +1513,9 @@ RD, "cursor down"; RED, both "echo" and "down"): RClearConsole Edit R code~ - RCommentLine + RSimpleComment + RSimpleUnComment + RToggleComment RRightComment RCompleteArgs RIndent @@ -2162,7 +2168,8 @@ argument. Example: * Update vimcom version requirement to 0.9-6 (fix incompatibility with tcltk package on Unix). * Change the default value of vimrplugin_rmhidden to 0. - * New options for Windows: vimrplugin_Rterm and vimrplugin_R_window_title. + * New option for Windows: vimrplugin_Rterm. + * New simpler un/comment commands: xc and xu. 0.9.9.1 (2012-12-11) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 0ebe6ff..e66f2c8 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -297,16 +297,72 @@ function RCompleteArgs() return '' endfunction -function RSimpleCommentLine() - call setline(line("."), "#" . getline(".")) +function IsRCode(lnum) + let save_cursor = getpos(".") + call cursor(a:lnum, 0) + let isRcode = 1 + if &filetype == "rnoweb" && RnwIsInRCode() == 0 + let isRcode = 0 + endif + if &filetype == "rrst" && RrstIsInRCode() == 0 + let isRcode = 0 + endif + if &filetype == "rmd" && RmdIsInRCode() == 0 + let isRcode = 0 + endif + if &filetype == "rhelp" + let lastsection = search('^\\[a-z]*{', "bncW") + let secname = getline(lastsection) + if secname =~ '^\\usage{' || secname =~ '^\\examples{' || secname =~ '^\\dontshow{' || secname =~ '^\\dontrun{' || secname =~ '^\\donttest{' || secname =~ '^\\testonly{' + let isRcode = 1 + else + let isRcode = 0 + endif + endif + call setpos(".", save_cursor) + let g:risrcode = isRcode + return isRcode +endfunction + +function RGetFL(mode) + if a:mode == "normal" + let fline = line(".") + let lline = line(".") + else + let fline = line("'<") + let lline = line("'>") + endif + if fline > lline + let tmp = lline + let lline = fline + let fline = tmp + endif + return [fline, lline] endfunction -function RSimpleUncommentLine() - call setline(line("."), substitute(getline("."), "^#", "", "")) +function RSimpleCommentLine(mode) + let [fline, lline] = RGetFL(a:mode) + if IsRCode(fline) + let cstr = "#" + else + let cstr = "%" + endif + for ii in range(fline, lline) + call setline(ii, cstr . getline(ii)) + endfor endfunction -noremap xc :call RSimpleCommentLine() -noremap xu :call RSimpleUncommentLine() +function RSimpleUncommentLine(mode) + let [fline, lline] = RGetFL(a:mode) + if IsRCode(fline) + let cstr = "#" + else + let cstr = "%" + endif + for ii in range(fline, lline) + call setline(ii, substitute(getline(ii), "^" . cstr, "", "")) + endfor +endfunction function RCommentLine(lnum, ind, cmt) let line = getline(a:lnum) @@ -333,35 +389,10 @@ endfunction function RComment(mode) let cpos = getpos(".") - if a:mode == "selection" - let fline = line("'<") - let lline = line("'>") - else - let fline = line(".") - let lline = fline - endif + let [fline, lline] = RGetFL(a:mode) " What comment string to use? - call cursor(fline, 0) - let isRcode = 1 - if &filetype == "rnoweb" && RnwIsInRCode() == 0 - let isRcode = 0 - endif - if &filetype == "rrst" && RrstIsInRCode() == 0 - let isRcode = 0 - endif - if &filetype == "rmd" && RmdIsInRCode() == 0 - let isRcode = 0 - endif - if &filetype == "rhelp" - let lastsection = search('^\\[a-z]*{', "bncW") - let secname = getline(lastsection) - if secname =~ '^\\usage{' || secname =~ '^\\examples{' || secname =~ '^\\dontshow{' || secname =~ '^\\dontrun{' || secname =~ '^\\donttest{' || secname =~ '^\\testonly{' - let isRcode = 1 - else - let isRcode = 0 - endif - endif + let isRcode = IsRCode(fline) if isRcode == 0 let cmt = '%' else @@ -2717,8 +2748,12 @@ function MakeRMenu() vmenu R.Edit.Indent\ (selected\ lines)= = nmenu R.Edit.Indent\ (whole\ buffer)gg=G gg=G menu R.Edit.-Sep72- - call RCreateMenuItem("ni", 'Edit.Comment/Uncomment\ (line/sel)', 'RCommentLine', 'xx', ':call RComment("normal")') - call RCreateMenuItem("v", 'Edit.Comment/Uncomment\ (line/sel)', 'RCommentLine', 'xx', ':call RComment("selection")') + call RCreateMenuItem("ni", 'Edit.Comment\ (line/sel)', 'RToggleComment', 'xc', ':call RComment("normal")') + call RCreateMenuItem("v", 'Edit.Comment\ (line/sel)', 'RToggleComment', 'xc', ':call RComment("selection")') + call RCreateMenuItem("ni", 'Edit.Uncomment\ (line/sel)', 'RToggleComment', 'xu', ':call RComment("normal")') + call RCreateMenuItem("v", 'Edit.Uncomment\ (line/sel)', 'RToggleComment', 'xu', ':call RComment("selection")') + call RCreateMenuItem("ni", 'Edit.Toggle\ comment\ (line/sel)', 'RToggleComment', 'xx', ':call RComment("normal")') + call RCreateMenuItem("v", 'Edit.Toggle\ comment\ (line/sel)', 'RToggleComment', 'xx', ':call RComment("selection")') call RCreateMenuItem("ni", 'Edit.Add/Align\ right\ comment\ (line,\ sel)', 'RRightComment', ';', ':call MovePosRCodeComment("normal")') call RCreateMenuItem("v", 'Edit.Add/Align\ right\ comment\ (line,\ sel)', 'RRightComment', ';', ':call MovePosRCodeComment("selection")') if &filetype == "rnoweb" || g:vimrplugin_never_unmake_menu @@ -2907,8 +2942,12 @@ endfunction function RCreateEditMaps() " Edit "------------------------------------- - call RCreateMaps("ni", 'RCommentLine', 'xx', ':call RComment("normal")') - call RCreateMaps("v", 'RCommentLine', 'xx', ':call RComment("selection")') + call RCreateMaps("ni", 'RToggleComment', 'xx', ':call RComment("normal")') + call RCreateMaps("v", 'RToggleComment', 'xx', ':call RComment("selection")') + call RCreateMaps("ni", 'RSimpleComment', 'xc', ':call RSimpleCommentLine("normal")') + call RCreateMaps("v", 'RSimpleComment', 'xc', ':call RSimpleCommentLine("selection")') + call RCreateMaps("ni", 'RSimpleUnComment', 'xu', ':call RSimpleUncommentLine("normal")') + call RCreateMaps("v", 'RSimpleUnComment', 'xu', ':call RSimpleUncommentLine("selection")') call RCreateMaps("ni", 'RRightComment', ';', ':call MovePosRCodeComment("normal")') call RCreateMaps("v", 'RRightComment', ';', ':call MovePosRCodeComment("selection")') " Replace 'underline' with '<-' From 29420edc84d2f8a8f70089ff9a8bda19457d86cb Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Tue, 8 Jan 2013 12:10:38 -0300 Subject: [PATCH 0393/1050] Delete unnecessary empty lines. --- r-plugin/windows.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/r-plugin/windows.py b/r-plugin/windows.py index f7bd750..1b33731 100644 --- a/r-plugin/windows.py +++ b/r-plugin/windows.py @@ -135,8 +135,6 @@ def SendQuitMsg(aString): RightClick() RConsole = 0 - - def GetRPath(): keyName = "SOFTWARE\\R-core\\R" kHandle = None From 1307298f1c004691c06483cf4ca9e3bf36d2f4e9 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Wed, 9 Jan 2013 09:17:04 -0300 Subject: [PATCH 0394/1050] Update Edit menu. --- doc/r-plugin.txt | 4 +++- r-plugin/common_global.vim | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 56912ca..0043ebd 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -445,7 +445,9 @@ Edit . Indent (selected lines) = . Indent (whole buffer) gg=G -------------------------------------------------------- - . Comment/Uncomment (line, sel) \xx + . Toggle comment (line, sel) \xx + . Comment (line, sel) \xc + . Uncomment (line, sel) \xu . Add/Align right comment (line, sel) \; -------------------------------------------------------- . Go (next R chunk) gn diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index e66f2c8..bfbc871 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -2748,12 +2748,12 @@ function MakeRMenu() vmenu R.Edit.Indent\ (selected\ lines)= = nmenu R.Edit.Indent\ (whole\ buffer)gg=G gg=G menu R.Edit.-Sep72- + call RCreateMenuItem("ni", 'Edit.Toggle\ comment\ (line/sel)', 'RToggleComment', 'xx', ':call RComment("normal")') + call RCreateMenuItem("v", 'Edit.Toggle\ comment\ (line/sel)', 'RToggleComment', 'xx', ':call RComment("selection")') call RCreateMenuItem("ni", 'Edit.Comment\ (line/sel)', 'RToggleComment', 'xc', ':call RComment("normal")') call RCreateMenuItem("v", 'Edit.Comment\ (line/sel)', 'RToggleComment', 'xc', ':call RComment("selection")') call RCreateMenuItem("ni", 'Edit.Uncomment\ (line/sel)', 'RToggleComment', 'xu', ':call RComment("normal")') call RCreateMenuItem("v", 'Edit.Uncomment\ (line/sel)', 'RToggleComment', 'xu', ':call RComment("selection")') - call RCreateMenuItem("ni", 'Edit.Toggle\ comment\ (line/sel)', 'RToggleComment', 'xx', ':call RComment("normal")') - call RCreateMenuItem("v", 'Edit.Toggle\ comment\ (line/sel)', 'RToggleComment', 'xx', ':call RComment("selection")') call RCreateMenuItem("ni", 'Edit.Add/Align\ right\ comment\ (line,\ sel)', 'RRightComment', ';', ':call MovePosRCodeComment("normal")') call RCreateMenuItem("v", 'Edit.Add/Align\ right\ comment\ (line,\ sel)', 'RRightComment', ';', ':call MovePosRCodeComment("selection")') if &filetype == "rnoweb" || g:vimrplugin_never_unmake_menu From ec5691fd62c8459eaecd58539bc9bd647bdc0e60 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 12 Jan 2013 13:53:46 -0300 Subject: [PATCH 0395/1050] Remove options nosingler and by_vim_instance. --- doc/r-plugin.txt | 89 +++++++++++--------------------------- r-plugin/common_buffer.vim | 41 +----------------- r-plugin/common_global.vim | 83 ++++++++++++++++++----------------- 3 files changed, 68 insertions(+), 145 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 0043ebd..1f1f191 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -943,8 +943,6 @@ duplicated to R on Mac OS X. |vimrplugin_vimpager| Use Vim to see R documentation |vimrplugin_editor_w| Minimum width of R script buffer |vimrplugin_help_w| Desired width of R documentation buffer -|vimrplugin_nosingler| A single R process for all Vim instances -|vimrplugin_by_vim_instance| Each Vim instance runs its own R |vimrplugin_i386| Use 32 bit version of R |vimrplugin_r_path| Directory where R is |vimrplugin_r_args| Arguments to pass to R @@ -1011,9 +1009,10 @@ The last argument must be the one which precedes the command to be executed. 6.2. Use Rterm.exe on Windows~ *r-plugin-Rterm.exe* -If you rather prefer to use Rterm.exe than Rgui.exe, you have to set the -"Quick Edit Mode" on either the Windows 7 PowerShell or the Windows XP Command -Prompt and put in your |vimrc|: +If you rather prefer to use Rterm.exe than Rgui.exe, you have to set both the +"Quick Edit Mode" and the "Insert mode" on either the Windows 7 PowerShell or +the Windows XP Command Prompt (click on the title bar and choose +"properties"). Then, you should put in your |vimrc|: > let vimrplugin_Rterm = 1 < @@ -1122,40 +1121,7 @@ values to some variables in your |vimrc|, as in the example: let vimrplugin_editor_h = 60 < -6.6. Number of R processes (Linux/Unix only)~ - *vimrplugin_nosingler* - *vimrplugin_by_vim_instance* -6.6.1 Using (G)Vim without the screen.vim plugin~ - -By default, all buffers of all (G)Vim instances send code to the same R process. -If you prefer that each Vim buffer uses its own R process, put the following -option in your |vimrc|: -> - let vimrplugin_nosingler = 1 -< -If you prefer that each Vim instance calls its own R process and all the -instance's buffers send code to this R process while other Vim instances send -code to other R processes then put the following in your |vimrc|: -> - let vimrplugin_by_vim_instance = 1 -> -The |vimrplugin_by_vim_instance| option requires that Vim is acting as a -command server because the variable |v:servername| is used to make the name of -the Tmux session which will run R. By default, GVim runs as server, but Vim -does not. Hence, if you are using Vim you have either to start Vim with the -argument --servername or use the screen.vim plugin which tries to restart Vim -with the --servername argument. If you want to use more than nine GVim -instances you will have to use the --servername argument because screen will -not differentiate between names like "GVIM1" and "GVIM10". - -6.6.2 Using the screen.vim plugin~ - -Both options are ignored when using Vim in a terminal emulator and using the -screen.vim plugin. The plugin behaves as if the |vimrplugin_by_instance| was -enabled. - - -6.7. Use 32 bit version of R (Windows and Mac OS X only)~ +6.6. Use 32 bit version of R (Windows and Mac OS X only)~ *vimrplugin_i386* If you are using a 64 bit Windows or a 64 bit Mac OS X, but prefer to run the 32 bit version of R, put in your |vimrc|: @@ -1163,7 +1129,7 @@ If you are using a 64 bit Windows or a 64 bit Mac OS X, but prefer to run the let vimrplugin_i386 = 1 < -6.8. R path~ +6.7. R path~ *vimrplugin_r_path* Vim will run the first R executable in the path. You can set an alternative R path in your |vimrc| as in the examples: @@ -1174,7 +1140,7 @@ path in your |vimrc| as in the examples: On Windows, Vim will try to find the R install path in the Windows Registry. -6.9. Arguments to R~ +6.8. Arguments to R~ *vimrplugin_r_args* Set this option in your |vimrc| if you want to pass command line arguments to R at the startup. Example: @@ -1186,7 +1152,7 @@ default value is "--sdi", but you may change it to "--mdi" if you do not like the SDI style of the graphical user interface. -6.10. Time necessary to build list of objects for omni completion~ +6.9. Time necessary to build list of objects for omni completion~ *vimrplugin_buildwait* If your system needs more than 60 seconds to build the list of objects for omni completion after you do the command |:RUpdateObjList|, then you should @@ -1195,7 +1161,7 @@ set the value of |vimrplugin_buildwait| to a higher value. Example: let vimrplugin_buildwait = 240 > -6.11. More colorful syntax highlight of .Rout files~ +6.10. More colorful syntax highlight of .Rout files~ *vimrplugin_routmorecolors* By default, the R commands in .Rout files are highlighted with the color of comments, and only the output of commands has some of its elements highlighted @@ -1207,7 +1173,7 @@ scripts, put the following in your |vimrc|: let vimrplugin_routmorecolors = 1 < -6.12. How to automatically open the .Rout file~ +6.11. How to automatically open the .Rout file~ *vimrplugin_routnotab* After the command ao, Vim will save the current buffer if it has any pending changes, run "R CMD BATCH --no-restore --no-save" on the current @@ -1217,7 +1183,7 @@ file is open in a new split window, put in your |vimrc|: let vimrplugin_routnotab = 1 < -6.13. Indent commented lines~ +6.12. Indent commented lines~ *vimrplugin_indent_commented* You can type xx to comment out a line or selected lines. If the line already starts with a comment string, it will be removed. After adding @@ -1237,7 +1203,7 @@ table below (see |r-plugin-indenting|): 0 0 ### < -6.14. Sleep time (Windows only)~ +6.13. Sleep time (Windows only)~ *vimrplugin_sleeptime* The plugin gives to R a small amount of time to process the paste command. The default value is 0.2 second, but you should experiment different values. The @@ -1246,7 +1212,7 @@ example show how to adjust the value of sleeptime in your |vimrc|: let vimrplugin_sleeptime = 0.1 < -6.15. Tmux and Screen configuration (Linux/Unix only)~ +6.14. Tmux and Screen configuration (Linux/Unix only)~ *vimrplugin_noscreenrc* *vimrplugin_notmuxconf* GVim (or Vim running R in an external terminal emulator) runs Tmux with a @@ -1266,7 +1232,7 @@ required for the communication with R and source your own configuration file (either ~/.tmux.conf or ~/.screenrc). -6.16. Integration with screen.vim plugin (Linux/Unix only)~ +6.15. Integration with screen.vim plugin (Linux/Unix only)~ *vimrplugin_screenplugin* *vimrplugin_screenvsplit* *vimrplugin_tmux* @@ -1310,7 +1276,7 @@ with the Vim-R-plugin you will need to add the following to your |vimrc|: let vimrplugin_screenplugin = 0 < -6.17. Integration with AppleScript (OS X only)~ +6.16. Integration with AppleScript (OS X only)~ *vimrplugin_applescript* In Mac OS X, the plugin will try to send commands to R gui using AppleScript. If you prefer to run R and Vim in the same terminal emulator split in two @@ -1325,7 +1291,7 @@ If you prefer to have R running in an external terminal emulator, put in your let vimrplugin_screenplugin = 0 < -6.18. Special R functions~ +6.17. Special R functions~ *vimrplugin_listmethods* *vimrplugin_specialplot* The R function args() lists the arguments of a function, but not the arguments @@ -1341,7 +1307,7 @@ after rg if you put the following line in your |vimrc|: let vimrplugin_specialplot = 1 < -6.19. maxdeparse~ +6.18. maxdeparse~ *vimrplugin_maxdeparse* You can set the argument maxdeparse to be passed to R's source() function. Example: @@ -1349,7 +1315,7 @@ Example: let vimrplugin_maxdeparse = 300 < -6.20. LaTeX command~ +6.19. LaTeX command~ *vimrplugin_latexcmd* *vimrplugin_sweaveargs* On Windows, the plugin calls tools::texi2pdf() to build the pdf from the @@ -1363,7 +1329,7 @@ If you want to pass arguments do the Sweave() function, set the value of the vimrplugin_sweaveargs variable. -6.21. Never unmake the R menu and tool bar buttons~ +6.20. Never unmake the R menu and tool bar buttons~ *vimrplugin_never_unmake_menu* Use this option if you want that the menu item R and the R related tool bar buttons are not deleted when you change from one buffer to another, for @@ -1375,7 +1341,7 @@ When this options is enabled all menu items are created regardless of the file type. -6.22. Map 'r'~ +6.21. Map 'r'~ *vimrplugin_map_r* If the variable |vimrplugin_map_r| exists, the plugin will map the letter 'r' to send lines to R when there are visually selected lines, for compatibility @@ -1393,7 +1359,7 @@ Emacs: set tabstop=8 < -6.23. Add ^A^K to the beginning of commands~ +6.22. Add ^A^K to the beginning of commands~ *vimrplugin_ca_ck* When one types in the R Console the cursor goes to the beginning of the line and one types the characters to the right of the cursor are @@ -1405,7 +1371,7 @@ either Tmux or GNU Screen in some systems. The Vim-R-plugin will add let vimrplugin_ca_ck = 1 < -6.24. Open PDF after processing rnoweb file~ +6.23. Open PDF after processing rnoweb file~ *vimrplugin_openpdf* *vimrplugin_openpdf_quietly* *vimrplugin_openhtml* @@ -1452,7 +1418,7 @@ you prefer the non strict rst code, put the following in your |vimrc|: let vimrplugin_strict_rst = 0 < -6.25. Allow R commands in insert mode~ +6.24. Allow R commands in insert mode~ *Vimrplugin_insert_mode_cmds* Vim-R commands are designed to work in insert mode as well as normal mode. However, depending on your , this can make it very difficult to @@ -1466,7 +1432,7 @@ use it, add the following in your |vimrc|: < The default value is 1, for consistency with earlier versions. -6.26. Show/remove hidden objects~ +6.25. Show/remove hidden objects~ *vimrplugin_allnames* *vimrplugin_rmhidden* Hidden objects are not included in the list of objects for omni completion. If @@ -2130,10 +2096,6 @@ Then, you will be able to scroll the R Console buffer at any time by pressing th key in Normal mode. Of course, you should replace with your preferred key. -With the Conque Shell, the option |vimrplugin_nosingler| is ignored, and, by -default, the object browser window will be created at the right of the R -Console window. - The same highlighting scheme used for .Rout files is applied to the R Console when using the Conque Shell plugin to run R inside a Vim's buffer. For one hand, we do not need to highlight R commands in the Console if they were sent @@ -2165,13 +2127,14 @@ argument. Example: *r-plugin-news* 10. News~ -0.9.9.2 (2012-12-28) +0.9.9.2 (2013-01-12) * Update vimcom version requirement to 0.9-6 (fix incompatibility with tcltk package on Unix). * Change the default value of vimrplugin_rmhidden to 0. * New option for Windows: vimrplugin_Rterm. * New simpler un/comment commands: xc and xu. + * Remove options vimrplugin_nosingler and vimrplugin_by_vim_instance. 0.9.9.1 (2012-12-11) diff --git a/r-plugin/common_buffer.vim b/r-plugin/common_buffer.vim index 27fac3d..fae9fd1 100644 --- a/r-plugin/common_buffer.vim +++ b/r-plugin/common_buffer.vim @@ -49,7 +49,7 @@ endif " Initialize some local variables if Conque shell was already started -if (g:vimrplugin_by_vim_instance || g:vimrplugin_nosingler == 0) && exists("g:rplugin_objbrtitle") +if exists("g:rplugin_objbrtitle") if g:vimrplugin_conqueplugin let b:conqueshell = g:rplugin_conqueshell let b:conque_bufname = g:rplugin_conque_bufname @@ -76,49 +76,10 @@ unlet b:bname " Special screenrc file let b:scrfile = " " -if g:vimrplugin_nosingler == 1 - " Make a random name for the screen session - let b:screensname = "vimrplugin-" . g:rplugin_userlogin . "-" . localtime() -else - " Make a unique name for the screen session - let b:screensname = "vimrplugin-" . g:rplugin_userlogin -endif - -" Make a unique name for the screen process for each Vim instance: -if g:vimrplugin_by_vim_instance == 1 - let s:sname = substitute(v:servername, " ", "-", "g") - if s:sname == "" && g:vimrplugin_conqueplugin == 0 - call RWarningMsg("The option vimrplugin_by_vim_instance requires a servername. Please read the documentation.") - let g:vimrplugin_by_vim_instance = 0 - sleep 2 - else - " For screen GVIM and GVIM1 are the same string. - let s:sname = substitute(s:sname, "GVIM$", "GVIM0", "g") - let b:screensname = "vimrplugin-" . g:rplugin_userlogin . "-" . s:sname - endif - unlet s:sname -endif - if exists("g:rplugin_firstbuffer") && g:rplugin_firstbuffer == "" " The file global_r_plugin.vim was copied to ~/.vim/plugin let g:rplugin_firstbuffer = expand("%:p") endif -if g:vimrplugin_screenplugin - let s:uniquename = b:screensname . g:rplugin_firstbuffer -else - let s:uniquename = b:screensname -endif -let s:uniquename = substitute(s:uniquename, '\W', '', 'g') -let $VIMINSTANCEID = $VIMRPLUGIN_TMPDIR . "/" . s:uniquename . "-port" -let $VIMINSTANCEID = substitute($VIMINSTANCEID, ' ', '', 'g') - -if has("clientserver") - let g:rplugin_obsname_arg = "--servername " . toupper(substitute(substitute(expand("%:r"), '\W', '', 'g'), "_", "", "g")) -else - let g:rplugin_obsname_arg = " " -endif -unlet s:uniquename - let g:rplugin_lastft = &filetype diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index bfbc871..33fcfab 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -578,7 +578,7 @@ function GoDown() endfunction function RWriteScreenRC() - let scrcnf = $VIMRPLUGIN_TMPDIR . "/" . b:screensname . ".screenrc" + let scrcnf = $VIMRPLUGIN_TMPDIR . "/" . g:rplugin_screensname . ".screenrc" if g:vimrplugin_noscreenrc let cnflines = [ @@ -602,11 +602,7 @@ function RWriteScreenRC() \ 'term screen-256color'] endif else - if g:vimrplugin_nosingler == 1 - let scrtitle = 'hardstatus string "' . expand("%:t") . '"' - else - let scrtitle = "hardstatus string R" - endif + let scrtitle = 'hardstatus string "' . expand("%:t") . '"' let cnflines = ["msgwait 1", \ "hardstatus lastline", @@ -681,7 +677,7 @@ function StartR(whatr) if g:vimrplugin_notmuxconf let cnflines = [ \ 'set-environment -g VIMRPLUGIN_TMPDIR ' . g:rplugin_esc_tmpdir, - \ 'set-environment -g VIMINSTANCEID ' . $VIMINSTANCEID, + \ 'set-environment VIMINSTANCEID ' . $VIMINSTANCEID, \ 'source-file ~/.tmux.conf' ] else let cnflines = [ @@ -692,7 +688,7 @@ function StartR(whatr) \ 'set -g status off', \ "set -g terminal-overrides 'xterm*:smcup@:rmcup@'", \ 'set-environment -g VIMRPLUGIN_TMPDIR "' . $VIMRPLUGIN_TMPDIR . '"', - \ 'set-environment -g VIMINSTANCEID "' . $VIMINSTANCEID . '"'] + \ 'set-environment VIMINSTANCEID "' . $VIMINSTANCEID . '"'] if g:vimrplugin_external_ob || !has("gui_running") let cnflines = extend(cnflines, ['set -g mode-mouse on', 'set -g mouse-select-pane on', 'set -g mouse-resize-pane on']) endif @@ -709,7 +705,7 @@ function StartR(whatr) if $TERM =~ "screen" if g:vimrplugin_tmux call system("tmux set-environment -g VIMRPLUGIN_TMPDIR " . g:rplugin_esc_tmpdir) - call system("tmux set-environment -g VIMINSTANCEID " . $VIMINSTANCEID) + call system("tmux set-environment VIMINSTANCEID " . $VIMINSTANCEID) else let rcmd = 'VIMRPLUGIN_TMPDIR="' . $VIMRPLUGIN_TMPDIR . '" VIMINSTANCEID=' . $VIMINSTANCEID . " " . rcmd endif @@ -744,7 +740,7 @@ function StartR(whatr) endif endif - if g:vimrplugin_by_vim_instance == 1 && exists("g:ConqueTerm_BufName") && bufloaded(substitute(g:ConqueTerm_BufName, "\\", "", "g")) + if exists("g:ConqueTerm_BufName") && bufloaded(substitute(g:ConqueTerm_BufName, "\\", "", "g")) call RWarningMsg("This Vim instance already has a Conque Shell.") lcd - return @@ -782,11 +778,9 @@ function StartR(whatr) let b:conque_bufname = g:tmp_conque_bufname let b:objbrtitle = g:tmp_objbrtitle - if g:vimrplugin_by_vim_instance == 1 - let g:rplugin_conqueshell = b:conqueshell - let g:rplugin_conque_bufname = b:conque_bufname - let g:rplugin_objbrtitle = b:objbrtitle - endif + let g:rplugin_conqueshell = b:conqueshell + let g:rplugin_conque_bufname = b:conque_bufname + let g:rplugin_objbrtitle = b:objbrtitle unlet g:tmp_conqueshell unlet g:tmp_conque_bufname @@ -809,6 +803,7 @@ function StartR(whatr) endif if g:vimrplugin_tmux + let rcmd = "VIMINSTANCEID=" . $VIMINSTANCEID . " " . rcmd call system('export VIMRPLUGIN_TMPDIR=' . $VIMRPLUGIN_TMPDIR) call system('export VIMINSTANCEID=' . $VIMINSTANCEID) " Start the terminal emulator even if inside a Tmux session @@ -823,18 +818,18 @@ function StartR(whatr) lcd - return endif - call system("tmux has-session -t " . b:screensname) + call system("tmux has-session -t " . g:rplugin_screensname) if v:shell_error if g:rplugin_termcmd =~ "gnome-terminal" || g:rplugin_termcmd =~ "xfce4-terminal" || g:rplugin_termcmd =~ "terminal" || g:rplugin_termcmd =~ "iterm" - let opencmd = printf("%s 'tmux -2 %s new-session -s %s \"%s\"' &", g:rplugin_termcmd, tmuxcnf, b:screensname, rcmd) + let opencmd = printf("%s 'tmux -2 %s new-session -s %s \"%s\"' &", g:rplugin_termcmd, tmuxcnf, g:rplugin_screensname, rcmd) else - let opencmd = printf("%s tmux -2 %s new-session -s %s \"%s\" &", g:rplugin_termcmd, tmuxcnf, b:screensname, rcmd) + let opencmd = printf("%s tmux -2 %s new-session -s %s \"%s\" &", g:rplugin_termcmd, tmuxcnf, g:rplugin_screensname, rcmd) endif else if g:rplugin_termcmd =~ "gnome-terminal" || g:rplugin_termcmd =~ "xfce4-terminal" || g:rplugin_termcmd =~ "terminal" || g:rplugin_termcmd =~ "iterm" - let opencmd = printf("%s 'tmux -2 %s attach-session -d -t %s' &", g:rplugin_termcmd, tmuxcnf, b:screensname) + let opencmd = printf("%s 'tmux -2 %s attach-session -d -t %s' &", g:rplugin_termcmd, tmuxcnf, g:rplugin_screensname) else - let opencmd = printf("%s tmux -2 %s attach-session -d -t %s &", g:rplugin_termcmd, tmuxcnf, b:screensname) + let opencmd = printf("%s tmux -2 %s attach-session -d -t %s &", g:rplugin_termcmd, tmuxcnf, g:rplugin_screensname) endif endif else @@ -846,9 +841,9 @@ function StartR(whatr) let scrrc = RWriteScreenRC() " Some terminals want quotes (see screen.vim) if g:rplugin_termcmd =~ "gnome-terminal" || g:rplugin_termcmd =~ "xfce4-terminal" || g:rplugin_termcmd =~ "terminal" || g:rplugin_termcmd =~ "iterm" - let opencmd = printf("%s 'screen %s -d -RR -S %s %s' &", g:rplugin_termcmd, scrrc, b:screensname, rcmd) + let opencmd = printf("%s 'screen %s -d -RR -S %s %s' &", g:rplugin_termcmd, scrrc, g:rplugin_screensname, rcmd) else - let opencmd = printf("%s screen %s -d -RR -S %s %s &", g:rplugin_termcmd, scrrc, b:screensname, rcmd) + let opencmd = printf("%s screen %s -d -RR -S %s %s &", g:rplugin_termcmd, scrrc, g:rplugin_screensname, rcmd) endif endif @@ -942,7 +937,7 @@ function StartObjectBrowser() \ 'let g:rplugin_edpane = "' . g:rplugin_edpane . '"', \ 'let g:rplugin_rpane = "' . g:rplugin_rpane . '"', \ 'let b:objbrtitle = "' . b:objbrtitle . '"', - \ 'let b:screensname = "' . b:screensname . '"', + \ 'let g:rplugin_screensname = "' . g:rplugin_screensname . '"', \ 'let b:rscript_buffer = "' . bufname("%") . '"', \ 'set filetype=rbrowser', \ 'let $VIMINSTANCEID="' . $VIMINSTANCEID . '"', @@ -1074,7 +1069,7 @@ function StartObjectBrowser() else " Copy the values of some local variables that will be inherited let g:tmp_objbrtitle = b:objbrtitle - let g:tmp_screensname = b:screensname + let g:tmp_screensname = g:rplugin_screensname let g:tmp_curbufname = bufname("%") if g:vimrplugin_conqueplugin == 1 @@ -1106,7 +1101,7 @@ function StartObjectBrowser() unlet g:tmp_conqueshell unlet g:tmp_conque_bufname endif - let b:screensname = g:tmp_screensname + let g:rplugin_screensname = g:tmp_screensname let b:objbrtitle = g:tmp_objbrtitle let b:rscript_buffer = g:tmp_curbufname unlet g:tmp_objbrtitle @@ -1294,17 +1289,12 @@ function SendCmdToR(cmd) return 1 elseif g:vimrplugin_conqueplugin if !exists("b:conque_bufname") - if g:vimrplugin_by_vim_instance - if exists("g:rplugin_conqueshell") - let b:conqueshell = g:rplugin_conqueshell - let b:conque_bufname = g:rplugin_conque_bufname - let b:objbrtitle = g:rplugin_objbrtitle - else - call RWarningMsg("This buffer does not have a Conque Shell yet.") - return 0 - endif + if exists("g:rplugin_conqueshell") + let b:conqueshell = g:rplugin_conqueshell + let b:conque_bufname = g:rplugin_conque_bufname + let b:objbrtitle = g:rplugin_objbrtitle else - call RWarningMsg("Did you already start R?") + call RWarningMsg("This buffer does not have a Conque Shell yet.") return 0 endif endif @@ -1364,9 +1354,9 @@ function SendCmdToR(cmd) " Send the command to R running in an external terminal emulator let str = substitute(cmd, "'", "'\\\\''", "g") if g:vimrplugin_tmux - let scmd = "tmux set-buffer '" . str . "\' && tmux paste-buffer -t " . b:screensname . '.0' + let scmd = "tmux set-buffer '" . str . "\' && tmux paste-buffer -t " . g:rplugin_screensname . '.0' else - let scmd = 'screen -S ' . b:screensname . " -X stuff '" . str . "\'" + let scmd = 'screen -S ' . g:rplugin_screensname . " -X stuff '" . str . "\'" endif let rlog = system(scmd) if v:shell_error @@ -2196,7 +2186,7 @@ function ShowRDoc(rkeyword, package, getclass) endif " Local variables that must be inherited by the rdoc buffer - let g:tmp_screensname = b:screensname + let g:tmp_screensname = g:rplugin_screensname let g:tmp_objbrtitle = b:objbrtitle if g:vimrplugin_conqueplugin == 1 let g:tmp_conqueshell = b:conqueshell @@ -2239,7 +2229,7 @@ function ShowRDoc(rkeyword, package, getclass) " Inheritance of local variables from the script buffer let b:objbrtitle = g:tmp_objbrtitle - let b:screensname = g:tmp_screensname + let g:rplugin_screensname = g:tmp_screensname unlet g:tmp_objbrtitle if g:vimrplugin_conqueplugin == 1 let b:conqueshell = g:tmp_conqueshell @@ -2799,7 +2789,6 @@ function MakeRMenu() amenu R.Help\ (plugin).Options.Vim\ as\ pager\ for\ R\ help :help vimrplugin_vimpager if !has("gui_win32") amenu R.Help\ (plugin).Options.Terminal\ emulator :help vimrplugin_term - amenu R.Help\ (plugin).Options.Number\ of\ R\ processes :help vimrplugin_nosingler amenu R.Help\ (plugin).Options.Screen\ configuration :help vimrplugin_noscreenrc amenu R.Help\ (plugin).Options.Screen\ plugin :help vimrplugin_screenplugin endif @@ -3132,7 +3121,6 @@ call RSetDefaultValue("g:vimrplugin_tmux", 1) call RSetDefaultValue("g:vimrplugin_vimshell", 0) call RSetDefaultValue("g:vimrplugin_listmethods", 0) call RSetDefaultValue("g:vimrplugin_specialplot", 0) -call RSetDefaultValue("g:vimrplugin_nosingler", 0) call RSetDefaultValue("g:vimrplugin_noscreenrc", 0) call RSetDefaultValue("g:vimrplugin_notmuxconf", 0) call RSetDefaultValue("g:vimrplugin_only_in_tmux", 0) @@ -3143,7 +3131,6 @@ call RSetDefaultValue("g:vimrplugin_objbr_w", 40) call RSetDefaultValue("g:vimrplugin_external_ob", 0) call RSetDefaultValue("g:vimrplugin_buildwait", 60) call RSetDefaultValue("g:vimrplugin_indent_commented", 1) -call RSetDefaultValue("g:vimrplugin_by_vim_instance", 0) call RSetDefaultValue("g:vimrplugin_never_unmake_menu", 0) call RSetDefaultValue("g:vimrplugin_vimpager", "'tab'") call RSetDefaultValue("g:vimrplugin_latexcmd", "'pdflatex'") @@ -3580,6 +3567,18 @@ let g:rplugin_lastrpl = "" let g:rplugin_ob_busy = 0 let g:rplugin_hasRSFbutton = 0 let g:rplugin_errlist = [] +let g:rplugin_screensname = substitute("vimrplugin-" . g:rplugin_userlogin . localtime() . g:rplugin_firstbuffer, '\W', '', 'g') + +if $VIMINSTANCEID == "" + let $VIMINSTANCEID = substitute(g:rplugin_firstbuffer . localtime(), '\W', '', 'g') +endif + +if has("clientserver") + let g:rplugin_obsname_arg = "--servername " . toupper(substitute(substitute(expand("%:r"), '\W', '', 'g'), "_", "", "g")) +else + let g:rplugin_obsname_arg = " " +endif + call SetRPath() From 82f2c1b41fb2ca98ae0fbcb9a832ac18c35c19fd Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 12 Jan 2013 13:57:03 -0300 Subject: [PATCH 0396/1050] Delete brackets to get valid classfor object. --- r-plugin/common_global.vim | 2 ++ 1 file changed, 2 insertions(+) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 33fcfab..4c1f4fa 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -2105,6 +2105,8 @@ function RGetClassFor(rkeyword) let classfor = substitute(classfor, ' .*', '', "") endif endif + let classfor = substitute(classfor, '\[.*\]', '', 'g') + let classfor = substitute(classfor, '\[.*', '', 'g') if classfor =~ "^'" && classfor =~ "'$" let classfor = substitute(classfor, "^'", '"', "") let classfor = substitute(classfor, "'$", '"', "") From ccf44ef25ca6761f28c3e283417fb2197dda0e8c Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 12 Jan 2013 23:37:24 -0300 Subject: [PATCH 0397/1050] Include brackets while getting classfor object. --- r-plugin/common_global.vim | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 4c1f4fa..954637d 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -2074,7 +2074,7 @@ function RGetClassFor(rkeyword) let begin += 1 let line = strpart(line, begin) let line = substitute(line, '^\s*', '', "") - if line =~ '^\k*\s*(' || line =~ '^\k*\s*=\s*\k*\s*(' + if (line =~ '^\k*\s*(' || line =~ '^\k*\s*=\s*\k*\s*(') && line !~ '[.*(' let idx = 0 while line[idx] != '(' let idx += 1 @@ -2099,14 +2099,37 @@ function RGetClassFor(rkeyword) endif endwhile let classfor = strpart(line, 0, idx) + elseif line =~ '^\(\k\|\$\)*\s*[' || line =~ '^\(k\|\$\)*\s*=\s*\(\k\|\$\)*\s*[.*(' + let idx = 0 + while line[idx] != '[' + let idx += 1 + endwhile + let idx += 1 + let nparen = 1 + let len = strlen(line) + let lnum = line(".") + while nparen != 0 + if line[idx] == '[' + let nparen += 1 + else + if line[idx] == ']' + let nparen -= 1 + endif + endif + let idx += 1 + if idx == len + let lnum += 1 + let line = line . substitute(getline(lnum), '#.*', '', "") + let len = strlen(line) + endif + endwhile + let classfor = strpart(line, 0, idx) else let classfor = substitute(line, ').*', '', "") let classfor = substitute(classfor, ',.*', '', "") let classfor = substitute(classfor, ' .*', '', "") endif endif - let classfor = substitute(classfor, '\[.*\]', '', 'g') - let classfor = substitute(classfor, '\[.*', '', 'g') if classfor =~ "^'" && classfor =~ "'$" let classfor = substitute(classfor, "^'", '"', "") let classfor = substitute(classfor, "'$", '"', "") From c4168b5d8d1cbb36c104426b0305d2b36d7deae6 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Tue, 22 Jan 2013 13:39:44 -0300 Subject: [PATCH 0398/1050] On Windows, use $USERNAME as rplugin_userlogin. --- r-plugin/common_global.vim | 3 +++ 1 file changed, 3 insertions(+) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 954637d..5ab14f5 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -3103,6 +3103,9 @@ endif if has("win32") || has("win64") let g:rplugin_home = substitute(g:rplugin_home, "\\", "/", "g") let g:rplugin_uservimfiles = substitute(g:rplugin_uservimfiles, "\\", "/", "g") + if $USERNAME != "" + let g:rplugin_userlogin = substitute($USERNAME, " ", "", "g") + endif endif if isdirectory("/tmp") From 648880b59bf34ba90cbeef38a4c47f739cafcf3b Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 26 Jan 2013 23:31:07 -0300 Subject: [PATCH 0399/1050] Update knitr options. --- r-plugin/common_global.vim | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 5ab14f5..52f3a04 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -148,10 +148,10 @@ function! CompleteChunkOptions() else let newbase = '^' . substitute(base, "\\$$", "", "") endif - let ktopt = ["aniopts=;'controls.loop'", "autodep=;FALSE", "background=;'#F7F7F7'", + let ktopt = ["animation.fun=;hook_ffmpeg_html", "aniopts=;'controls.loop'", "autodep=;FALSE", "background=;'#F7F7F7'", \ "cache.path=;'cache/'", "cache=;FALSE", "child=; ", "comment=;'##'", \ "dependson=;''", "dev.args=; ", "dev=; ", "dpi=;72", "echo=;TRUE", - \ "engine=; ", "error=;TRUE", "eval=;TRUE", "external=;TRUE", + \ "engine=;'R'", "error=;TRUE", "eval=;TRUE", "external=;TRUE", \ "fig.align=;'left|right|center'", "fig.cap=;''", "fig.env=;'figure'", \ "fig.ext=; ", "fig.height=;7", "fig.keep=;'high|none|all|first|last'", \ "fig.lp=;'fig:'", "fig.path=; ", "fig.pos=;''", "fig.scap=;''", @@ -160,7 +160,7 @@ function! CompleteChunkOptions() \ "out.extra=; ", "out.height=;'7in'", "out.width=;'7in'", \ "prompt=;FALSE", "ref.label=; ", "resize.height=; ", \ "resize.width=; ", "results=;'markup|asis|hide'", "sanitize=;FALSE", - \ "size=;'normalsize'", "split=;FALSE", "tidy=;TRUE", "warning=;TRUE"] + \ "size=;'normalsize'", "split=;FALSE", "tidy=;TRUE", "tidy.opts=; ", "warning=;TRUE"] for kopt in ktopt if kopt =~ newbase let tmp1 = split(kopt, ";") @@ -3104,7 +3104,7 @@ if has("win32") || has("win64") let g:rplugin_home = substitute(g:rplugin_home, "\\", "/", "g") let g:rplugin_uservimfiles = substitute(g:rplugin_uservimfiles, "\\", "/", "g") if $USERNAME != "" - let g:rplugin_userlogin = substitute($USERNAME, " ", "", "g") + let g:rplugin_userlogin = substitute($USERNAME, " ", "", "g") endif endif From 4fcfc1a505b3daf0bb1874150515f3f9b6cbff12 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sun, 27 Jan 2013 10:34:51 -0300 Subject: [PATCH 0400/1050] Don't imap if insert_mode_cmds = 0. --- r-plugin/common_global.vim | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 52f3a04..a4f04ca 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -3010,9 +3010,11 @@ function RCreateSendMaps() call RCreateMaps('ni0', 'RDSendLine', 'd', ':call SendLineToR("down")') call RCreateMaps('i', 'RSendLAndOpenNewOne', 'q', ':call SendLineToR("newline")') nmap r :call RSendPartOfLine("left", 0) - imap r l:call RSendPartOfLine("left", 0)i nmap r :call RSendPartOfLine("right", 0) - imap r l:call RSendPartOfLine("right", 0)i + if g:vimrplugin_insert_mode_cmds + imap r l:call RSendPartOfLine("left", 0)i + imap r l:call RSendPartOfLine("right", 0)i + endif " For compatibility with Johannes Ranke's plugin if g:vimrplugin_map_r == 1 From f65d352725ddcad0d0f67b4ba3d7d4ab34f58728 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Mon, 28 Jan 2013 10:14:08 -0300 Subject: [PATCH 0401/1050] Map only valid for current buffer. --- r-plugin/common_global.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index a4f04ca..1d07d9f 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -3012,8 +3012,8 @@ function RCreateSendMaps() nmap r :call RSendPartOfLine("left", 0) nmap r :call RSendPartOfLine("right", 0) if g:vimrplugin_insert_mode_cmds - imap r l:call RSendPartOfLine("left", 0)i - imap r l:call RSendPartOfLine("right", 0)i + imap r l:call RSendPartOfLine("left", 0)i + imap r l:call RSendPartOfLine("right", 0)i endif " For compatibility with Johannes Ranke's plugin From d3a69c0fa90b11a1f2c1a5abd5bf6fd60a24b919 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 31 Jan 2013 20:05:17 -0300 Subject: [PATCH 0402/1050] Require vimcom 0.9-7. --- doc/r-plugin.txt | 10 ++++++---- r-plugin/vimcom.py | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 1f1f191..9c19bc9 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -132,7 +132,7 @@ following dependencies: Vim >= 7.3 with Python support. Tmux >= 1.5: http://tmux.sourceforge.net Screen plugin: http://www.vim.org/scripts/script.php?script_id=2711 - vimcom = 0.9-6: An R package. + vimcom = 0.9-7: An R package. Suggests:~ ncurses-term: http://invisible-island.net/ncurses @@ -248,7 +248,7 @@ to install external dependencies: find the file that matches exactly the version of Python that you installed. - * vimcom = 0.9-6: An R package, available on CRAN and installable with the + * vimcom = 0.9-7: An R package, available on CRAN and installable with the install.packages() command. The vimcom package creates a server on R to allow the communication with Vim. You certainly will want to put the following lines at the end of your Rprofile (usually at @@ -1426,12 +1426,14 @@ write R packages or Sweave files. For example, if is set to the '\' character, typing '\dQuote' in a .Rd file tries to send the command! The option vimrplugin_insert_mode_cmds disables commands in insert mode. To -use it, add the following in your |vimrc|: +use it, add the following to your |vimrc|: > let g:vimrplugin_insert_mode_cmds = 0 < The default value is 1, for consistency with earlier versions. +See also: |r-plugin-localleader|. + 6.25. Show/remove hidden objects~ *vimrplugin_allnames* *vimrplugin_rmhidden* @@ -2127,7 +2129,7 @@ argument. Example: *r-plugin-news* 10. News~ -0.9.9.2 (2013-01-12) +0.9.9.2 (2013-01-31) * Update vimcom version requirement to 0.9-6 (fix incompatibility with tcltk package on Unix). diff --git a/r-plugin/vimcom.py b/r-plugin/vimcom.py index 824a9f1..cc085ac 100644 --- a/r-plugin/vimcom.py +++ b/r-plugin/vimcom.py @@ -48,8 +48,8 @@ def DiscoverVimComPort(): else: vim.command("let g:rplugin_vimcomport = " + str(VimComPort)) PortWarn = False - if repl.find("0.9-6") != 0: - vim.command("call RWarningMsg('This version of Vim-R-plugin requires vimcom 0.9-6.')") + if repl.find("0.9-7") != 0: + vim.command("call RWarningMsg('This version of Vim-R-plugin requires vimcom 0.9-7.')") vim.command("sleep 1") return(VimComPort) From 92d5cbdc9eb1157b89e31696a174bfd57de50f1f Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Fri, 1 Feb 2013 18:12:39 -0300 Subject: [PATCH 0403/1050] Version 0.9.9.2. --- doc/r-plugin.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 9c19bc9..16a6bf2 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -2129,9 +2129,9 @@ argument. Example: *r-plugin-news* 10. News~ -0.9.9.2 (2013-01-31) +0.9.9.2 (2013-02-01) - * Update vimcom version requirement to 0.9-6 (fix incompatibility with tcltk + * Update vimcom version requirement to 0.9-7 (fix incompatibility with tcltk package on Unix). * Change the default value of vimrplugin_rmhidden to 0. * New option for Windows: vimrplugin_Rterm. From e0dd22a00a0bab3b7f001eeccec55675c1cee209 Mon Sep 17 00:00:00 2001 From: has2k1 Date: Fri, 15 Feb 2013 05:34:34 -0600 Subject: [PATCH 0404/1050] Syntax highlighting for R code chunks in HTML file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Problem ------- In the knitted HTML output the R code chunks are not highlighted. Issue ----- Calling knit2html() with the options as an empty string changes the default options. That is     knit2html("file.Rmd", options="")   # No syntax highlight     knit2html("file.Rmd")               # Yes to Syntax Highlight Solution -------- Remove the options argument. Effect ------ Highlights R code in knitted HTML file. As desired. --- ftplugin/rmd.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ftplugin/rmd.vim b/ftplugin/rmd.vim index f1eb594..36be112 100644 --- a/ftplugin/rmd.vim +++ b/ftplugin/rmd.vim @@ -106,7 +106,7 @@ endfunction function! RMakeHTMLrmd(t) call RSetWD() update - let rcmd = 'require(knitr); knit2html("' . expand("%:t") . '", options = "")' + let rcmd = 'require(knitr); knit2html("' . expand("%:t") . '")' if a:t == "odt" if g:rplugin_has_soffice == 0 if has("win32") || has("win64") From 3c531f7974db881282c7f4887993838c40383d21 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Fri, 15 Feb 2013 20:08:32 -0300 Subject: [PATCH 0405/1050] Use the standard variable did_indent. Thanks to Will Gray for reporting the bug. --- indent/r.vim | 6 +++--- indent/rhelp.vim | 6 +++--- indent/rmd.vim | 6 +++--- indent/rnoweb.vim | 6 +++--- indent/rrst.vim | 6 +++--- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/indent/r.vim b/indent/r.vim index b69abd5..55d6fb4 100644 --- a/indent/r.vim +++ b/indent/r.vim @@ -2,14 +2,14 @@ " Language: R " Author: Jakson Alves de Aquino " URL: http://www.vim.org/scripts/script.php?script_id=2628 -" Last Change: Sun Sep 11, 2011 10:55PM +" Last Change: Fri Feb 15, 2013 08:06PM " Only load this indent file when no other was loaded. -if exists("b:did_r_indent") +if exists("b:did_indent") finish endif -let b:did_r_indent = 1 +let b:did_indent = 1 setlocal indentkeys=0{,0},:,!^F,o,O,e setlocal indentexpr=GetRIndent() diff --git a/indent/rhelp.vim b/indent/rhelp.vim index d159d76..1ec4b9c 100644 --- a/indent/rhelp.vim +++ b/indent/rhelp.vim @@ -2,14 +2,14 @@ " Language: R Documentation (Help), *.Rd " Author: Jakson Alves de Aquino " URL: http://www.vim.org/scripts/script.php?script_id=2628 -" Last Change: Sun Feb 06, 2011 04:22PM +" Last Change: Fri Feb 15, 2013 08:06PM " Only load this indent file when no other was loaded. -if exists("b:did_rhelp_indent") +if exists("b:did_indent") finish endif -let b:did_rhelp_indent = 1 +let b:did_indent = 1 setlocal indentkeys=0{,0},:,!^F,o,O,e setlocal indentexpr=GetRHelpIndent() diff --git a/indent/rmd.vim b/indent/rmd.vim index a86ba1c..7efbe06 100644 --- a/indent/rmd.vim +++ b/indent/rmd.vim @@ -2,14 +2,14 @@ " Language: Rmd " Author: Jakson Alves de Aquino " URL: http://www.vim.org/scripts/script.php?script_id=2628 -" Last Change: Thu Oct 11, 2012 10:54PM +" Last Change: Fri Feb 15, 2013 08:05PM " Only load this indent file when no other was loaded. -if exists("b:did_rmd_indent") +if exists("b:did_indent") finish endif -let b:did_rmd_indent = 1 +let b:did_indent = 1 diff --git a/indent/rnoweb.vim b/indent/rnoweb.vim index d5ed606..39954fd 100644 --- a/indent/rnoweb.vim +++ b/indent/rnoweb.vim @@ -2,14 +2,14 @@ " Language: Rnoweb " Author: Jakson Alves de Aquino " URL: http://www.vim.org/scripts/script.php?script_id=2628 -" Last Change: Fri Feb 04, 2011 05:10PM +" Last Change: Fri Feb 15, 2013 08:06PM " Only load this indent file when no other was loaded. -if exists("b:did_rnoweb_indent") +if exists("b:did_indent") finish endif -let b:did_rnoweb_indent = 1 +let b:did_indent = 1 diff --git a/indent/rrst.vim b/indent/rrst.vim index 12c4e62..e89583f 100644 --- a/indent/rrst.vim +++ b/indent/rrst.vim @@ -2,14 +2,14 @@ " Language: Rrst " Author: Jakson Alves de Aquino " URL: http://www.vim.org/scripts/script.php?script_id=2628 -" Last Change: Thu Oct 11, 2012 10:52PM +" Last Change: Fri Feb 15, 2013 08:06PM " Only load this indent file when no other was loaded. -if exists("b:did_rrst_indent") +if exists("b:did_indent") finish endif -let b:did_rrst_indent = 1 +let b:did_indent = 1 From 5e9077c5eb9be6d764d3f7bfa878860189735008 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 16 Feb 2013 07:04:38 -0300 Subject: [PATCH 0406/1050] Source indent/r.vim earlier. --- indent/rhelp.vim | 5 ++--- indent/rmd.vim | 7 ++----- indent/rnoweb.vim | 7 ++++--- indent/rrst.vim | 7 ++----- 4 files changed, 10 insertions(+), 16 deletions(-) diff --git a/indent/rhelp.vim b/indent/rhelp.vim index 1ec4b9c..0441a02 100644 --- a/indent/rhelp.vim +++ b/indent/rhelp.vim @@ -2,13 +2,14 @@ " Language: R Documentation (Help), *.Rd " Author: Jakson Alves de Aquino " URL: http://www.vim.org/scripts/script.php?script_id=2628 -" Last Change: Fri Feb 15, 2013 08:06PM +" Last Change: Fri Feb 15, 2013 09:46PM " Only load this indent file when no other was loaded. if exists("b:did_indent") finish endif +runtime indent/r.vim let b:did_indent = 1 setlocal indentkeys=0{,0},:,!^F,o,O,e @@ -19,8 +20,6 @@ if exists("*GetRHelpIndent") finish endif -runtime indent/r.vim - setlocal noautoindent setlocal nocindent setlocal nosmartindent diff --git a/indent/rmd.vim b/indent/rmd.vim index 7efbe06..9b586fb 100644 --- a/indent/rmd.vim +++ b/indent/rmd.vim @@ -2,18 +2,15 @@ " Language: Rmd " Author: Jakson Alves de Aquino " URL: http://www.vim.org/scripts/script.php?script_id=2628 -" Last Change: Fri Feb 15, 2013 08:05PM +" Last Change: Fri Feb 15, 2013 09:46PM " Only load this indent file when no other was loaded. if exists("b:did_indent") finish endif -let b:did_indent = 1 - - - runtime indent/r.vim +let b:did_indent = 1 setlocal indentkeys=0{,0},:,!^F,o,O,e setlocal indentexpr=GetRmdIndent() diff --git a/indent/rnoweb.vim b/indent/rnoweb.vim index 39954fd..4dcd996 100644 --- a/indent/rnoweb.vim +++ b/indent/rnoweb.vim @@ -2,19 +2,20 @@ " Language: Rnoweb " Author: Jakson Alves de Aquino " URL: http://www.vim.org/scripts/script.php?script_id=2628 -" Last Change: Fri Feb 15, 2013 08:06PM +" Last Change: Fri Feb 15, 2013 09:47PM " Only load this indent file when no other was loaded. if exists("b:did_indent") finish endif +runtime indent/r.vim +unlet b:did_indent +runtime r-plugin/tex_indent.vim let b:did_indent = 1 -runtime indent/r.vim -runtime r-plugin/tex_indent.vim setlocal indentkeys=0{,0},!^F,o,O,e,},=\bibitem,=\item setlocal indentexpr=GetRnowebIndent() diff --git a/indent/rrst.vim b/indent/rrst.vim index e89583f..a26cca2 100644 --- a/indent/rrst.vim +++ b/indent/rrst.vim @@ -2,18 +2,15 @@ " Language: Rrst " Author: Jakson Alves de Aquino " URL: http://www.vim.org/scripts/script.php?script_id=2628 -" Last Change: Fri Feb 15, 2013 08:06PM +" Last Change: Fri Feb 15, 2013 09:47PM " Only load this indent file when no other was loaded. if exists("b:did_indent") finish endif -let b:did_indent = 1 - - - runtime indent/r.vim +let b:did_indent = 1 setlocal indentkeys=0{,0},:,!^F,o,O,e setlocal indentexpr=GetRrstIndent() From 8ea2192bdc9e451664106252b1e739ed9216706b Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 2 Mar 2013 13:36:25 -0300 Subject: [PATCH 0407/1050] Set 'iskeyword' at both dirs: ftplugin and syntax. --- ftplugin/r.vim | 2 ++ ftplugin/rbrowser.vim | 2 ++ ftplugin/rdoc.vim | 2 ++ ftplugin/rhelp.vim | 2 ++ ftplugin/rnoweb.vim | 1 + syntax/rdoc.vim | 4 +++- syntax/rhelp.vim | 4 +++- syntax/rmd.vim | 5 ++++- syntax/rout.vim | 4 +++- syntax/rrst.vim | 4 +++- 10 files changed, 25 insertions(+), 5 deletions(-) diff --git a/ftplugin/r.vim b/ftplugin/r.vim index 14fdde9..e5bd09a 100644 --- a/ftplugin/r.vim +++ b/ftplugin/r.vim @@ -49,6 +49,8 @@ endif " need be defined after the global ones: runtime r-plugin/common_buffer.vim +setlocal iskeyword=@,48-57,_,. + " Run R CMD BATCH on current file and load the resulting .Rout in a split " window function! ShowRout() diff --git a/ftplugin/rbrowser.vim b/ftplugin/rbrowser.vim index c7096a6..45c8657 100644 --- a/ftplugin/rbrowser.vim +++ b/ftplugin/rbrowser.vim @@ -40,6 +40,8 @@ runtime r-plugin/common_buffer.vim setlocal noswapfile setlocal buftype=nofile setlocal nowrap +setlocal iskeyword=@,48-57,_,. + if g:vimrplugin_tmux && g:vimrplugin_screenplugin let showmarks_enable = 0 endif diff --git a/ftplugin/rdoc.vim b/ftplugin/rdoc.vim index 4e465d0..bc87335 100644 --- a/ftplugin/rdoc.vim +++ b/ftplugin/rdoc.vim @@ -40,6 +40,8 @@ runtime r-plugin/common_global.vim " defined after the global ones: runtime r-plugin/common_buffer.vim +setlocal iskeyword=@,48-57,_,. + " Prepare R documentation output to be displayed by Vim function! FixRdoc() let lnr = line("$") diff --git a/ftplugin/rhelp.vim b/ftplugin/rhelp.vim index 0959f2e..7313d13 100644 --- a/ftplugin/rhelp.vim +++ b/ftplugin/rhelp.vim @@ -43,6 +43,8 @@ endif " defined after the global ones: runtime r-plugin/common_buffer.vim +setlocal iskeyword=@,48-57,_,. + "========================================================================== " Key bindings and menu items diff --git a/ftplugin/rnoweb.vim b/ftplugin/rnoweb.vim index 8b167e0..94dbbda 100644 --- a/ftplugin/rnoweb.vim +++ b/ftplugin/rnoweb.vim @@ -34,6 +34,7 @@ set cpo&vim runtime ftplugin/tex_latexSuite.vim runtime ftplugin/tex_LatexBox.vim let b:main_tex_file = expand("%:p") +setlocal iskeyword=@,48-57,_,. " Enable syntax highlight of LaTeX errors in R Console (if using Conque " Shell) diff --git a/syntax/rdoc.vim b/syntax/rdoc.vim index 16667d8..ba004df 100644 --- a/syntax/rdoc.vim +++ b/syntax/rdoc.vim @@ -6,6 +6,8 @@ if exists("b:current_syntax") finish endif +setlocal iskeyword=@,48-57,_,. + if !exists("rdoc_minlines") let rdoc_minlines = 200 endif @@ -30,7 +32,7 @@ syn region rdocExample matchgroup=rdocExTitle start="^Examples:$" matchgroup=rdo " When using vim as R pager to see the output of help.search(): syn region rdocPackage start="^[A-Za-z]\S*::" end="[\s\r]" contains=rdocPackName,rdocFuncName transparent syn match rdocPackName "^[A-Za-z][A-Za-z0-9\.]*" contained -syn match rdocFuncName "::[A-Za-z0-9\.\-]*" contained +syn match rdocFuncName "::[A-Za-z0-9\.\-_]*" contained " Define the default highlighting. hi def link rdocTitle Title diff --git a/syntax/rhelp.vim b/syntax/rhelp.vim index 03c85f8..74d9853 100644 --- a/syntax/rhelp.vim +++ b/syntax/rhelp.vim @@ -2,7 +2,7 @@ " Language: R Help File " Maintainer: Jakson Aquino " Former Maintainer: Johannes Ranke -" Last Change: Wed Nov 02, 2011 03:47PM +" Last Change: Tue Feb 26, 2013 01:13PM " Remarks: - Includes R syntax highlighting in the appropriate " sections if an r.vim file is in the same directory or in the " default debian location. @@ -21,6 +21,8 @@ elseif exists("b:current_syntax") finish endif +setlocal iskeyword=@,48-57,_,. + syn case match " R help identifiers {{{1 diff --git a/syntax/rmd.vim b/syntax/rmd.vim index 92d661c..2fcb37f 100644 --- a/syntax/rmd.vim +++ b/syntax/rmd.vim @@ -1,6 +1,6 @@ " markdown Text with R statements " Language: markdown with R code chunks -" Last Change: Sat Oct 13, 2012 07:29AM +" Last Change: Tue Feb 26, 2013 01:48PM " " CONFIGURATION: " To highlight chunk headers as R code, put in your vimrc: @@ -31,6 +31,9 @@ syntax include @R syntax/r.vim if exists("b:current_syntax") unlet b:current_syntax endif + +setlocal iskeyword=@,48-57,_,. + if exists("g:rmd_syn_hl_chunk") " highlight R code inside chunk header syntax match rmdChunkDelim "^```{r" contained diff --git a/syntax/rout.vim b/syntax/rout.vim index d88e9cb..fb6cc81 100644 --- a/syntax/rout.vim +++ b/syntax/rout.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: R output Files " Maintainer: Jakson Aquino -" Last Change: Fri Jul 06, 2012 12:33PM +" Last Change: Tue Feb 26, 2013 01:13PM " " Version Clears: {{{1 @@ -17,6 +17,8 @@ if !exists("syn_rout_latex") let g:syn_rout_latex = 0 endif +setlocal iskeyword=@,48-57,_,. + syn case match " Strings diff --git a/syntax/rrst.vim b/syntax/rrst.vim index 7ba6a50..8275a4e 100644 --- a/syntax/rrst.vim +++ b/syntax/rrst.vim @@ -1,7 +1,7 @@ " reStructured Text with R statements " Language: reST with R code chunks " Maintainer: Alex Zvoleff, azvoleff@mail.sdsu.edu -" Last Change: Sat Oct 13, 2012 07:28AM +" Last Change: Tue Feb 26, 2013 01:13PM " " CONFIGURATION: " To highlight chunk headers as R code, put in your vimrc: @@ -21,6 +21,8 @@ unlet b:current_syntax " load all of the r syntax highlighting rules into @R syntax include @R syntax/r.vim +setlocal iskeyword=@,48-57,_,. + " highlight R chunks if exists("g:rrst_syn_hl_chunk") " highlight R code inside chunk header From c9a50b127281da239fc08dcd26c9118d87f0d95d Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 7 Mar 2013 14:29:01 -0300 Subject: [PATCH 0408/1050] =?UTF-8?q?Pass=20vimrplugin=5Fsweaveargs=20to?= =?UTF-8?q?=20Sweave().=20Thanks=20to=20Z=C3=A9=20Loff=20for=20reporting?= =?UTF-8?q?=20the=20bug.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ftplugin/rnoweb.vim | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ftplugin/rnoweb.vim b/ftplugin/rnoweb.vim index 94dbbda..a9d8253 100644 --- a/ftplugin/rnoweb.vim +++ b/ftplugin/rnoweb.vim @@ -182,7 +182,11 @@ function! RSweave() update let b:needsnewomnilist = 1 call RSetWD() - call SendCmdToR('Sweave("' . expand("%:t") . '")') + if exists("g:vimrplugin_sweaveargs") + call SendCmdToR('Sweave("' . expand("%:t") . '", ' . g:vimrplugin_sweaveargs . ')') + else + call SendCmdToR('Sweave("' . expand("%:t") . '")') + endif endfunction function! ROpenPDF() From d04a3ed6487c234dd8c1e62027bdf135b4380612 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Wed, 13 Mar 2013 17:16:12 -0300 Subject: [PATCH 0409/1050] Don't set the value of b:main_tex_file. --- ftplugin/rnoweb.vim | 1 - 1 file changed, 1 deletion(-) diff --git a/ftplugin/rnoweb.vim b/ftplugin/rnoweb.vim index a9d8253..5e2f951 100644 --- a/ftplugin/rnoweb.vim +++ b/ftplugin/rnoweb.vim @@ -33,7 +33,6 @@ set cpo&vim " Enables Vim-Latex-Suite, LaTeX-Box if installed runtime ftplugin/tex_latexSuite.vim runtime ftplugin/tex_LatexBox.vim -let b:main_tex_file = expand("%:p") setlocal iskeyword=@,48-57,_,. " Enable syntax highlight of LaTeX errors in R Console (if using Conque From b5ff5aa97abb98ad061d63392e2f2fb9e66c5e77 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Wed, 13 Mar 2013 21:06:49 -0300 Subject: [PATCH 0410/1050] Note on how to use LaTeX-Box. --- doc/r-plugin.txt | 42 ++++++++++++++++++++++++++++++++++-------- 1 file changed, 34 insertions(+), 8 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 16a6bf2..266c12b 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -251,13 +251,15 @@ to install external dependencies: * vimcom = 0.9-7: An R package, available on CRAN and installable with the install.packages() command. The vimcom package creates a server on R to allow the communication with Vim. You certainly will want to put the - following lines at the end of your Rprofile (usually at - ~/Documents/.Rprofile): + following lines at the end of your Rprofile. > if(interactive()){ library(vimcom) } < + You can do Sys.getenv("HOME") in the R Console to know where the file + should be, but usually it is at ~/Documents/.Rprofile. + Create your |vimfiles| directory if you do not have it yet. Its path will be similar to one of the following: > @@ -331,7 +333,7 @@ You may be interested in installing additional general plugins to get functionality not provided by this file type plugin. ShowMarks and snipMate are particularly interesting. Please read |r-plugin-tips| for details. If you edit Rnoweb files, you may want to try LaTeX-Box for omnicompletion of LaTeX -code. +code (see |r-plugin-latex-box| for details). ============================================================================== @@ -862,7 +864,7 @@ anything. 5.1. R's source() issues~ The R's source() function prints an extra new line between commands if the -option echo = TRUE, and error messages and warning are printed only after the +option echo = TRUE, and error and warning messages are printed only after the entire code is sourced, which makes it more difficult to find errors in the code sent to R. Details: @@ -918,7 +920,7 @@ browser, see the R documentation for any function, or do other tasks that require the hidden evaluation of code by R, the vimcom library will refuse to do the tasks to avoid any risk of corrupting R's memory. It will tell Vim that "R is busy" and Vim will display this message. Everything should work as -expected again after any valid code is executed in R Console. +expected again after any valid code is executed in the R Console. 5.6. Commands are sent twice on Mac OS X~ @@ -1008,7 +1010,7 @@ The last argument must be the one which precedes the command to be executed. 6.2. Use Rterm.exe on Windows~ - *r-plugin-Rterm.exe* + *vimrplugin_Rterm* If you rather prefer to use Rterm.exe than Rgui.exe, you have to set both the "Quick Edit Mode" and the "Insert mode" on either the Windows 7 PowerShell or the Windows XP Command Prompt (click on the title bar and choose @@ -1419,7 +1421,7 @@ you prefer the non strict rst code, put the following in your |vimrc|: < 6.24. Allow R commands in insert mode~ - *Vimrplugin_insert_mode_cmds* + *vimrplugin_insert_mode_cmds* Vim-R commands are designed to work in insert mode as well as normal mode. However, depending on your , this can make it very difficult to write R packages or Sweave files. For example, if is set to the @@ -2125,11 +2127,35 @@ argument. Example: vim --servername OBJBR file.R < +9.23. Integration with LaTeX-Box~ + *r-plugin-latex-box* +LaTeX-Box does not automatically recognize Rnoweb files as a valid LaTeX file. +You have to tell LaTeX-BoX that the .tex file compiled by either knitr() or +Sweave() is the main LaTeX file. You can do this in two ways. Suppose that +your Rnoweb file is called report.Rnw... You can: + + (1) Create an empty file called "report.tex.latexmain". + + or + + (2) Put in the first 5 lines of report.Rnw: + + % For LaTeX-Box: root = report.tex + +Of course you must run either knitr() or Sweave() before trying LaTeX-Box +omnicompletion. Please, read LaTeX-Box documentation for up-to-date +information: |latex-box-FAQ|. + + ============================================================================== *r-plugin-news* 10. News~ -0.9.9.2 (2013-02-01) +0.9.9.3 (2013-03-02) + + * Minor bug fixes. + +0.9.9.2 (2013-03-07) * Update vimcom version requirement to 0.9-7 (fix incompatibility with tcltk package on Unix). From 149633d775f2eecf3974289edc0bf26a59240007 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Tue, 9 Apr 2013 23:09:23 -0300 Subject: [PATCH 0411/1050] Scape backslashes to avoid Python error. --- r-plugin/windows.py | 1 + 1 file changed, 1 insertion(+) diff --git a/r-plugin/windows.py b/r-plugin/windows.py index 1b33731..818e859 100644 --- a/r-plugin/windows.py +++ b/r-plugin/windows.py @@ -166,6 +166,7 @@ def StartRPy(): else: Rterm = False rpath = vim.eval("g:rplugin_Rgui") + rpath = rpath.replace("\\", "\\\\") rargs = ['"' + rpath + '"'] r_args = vim.eval("b:rplugin_r_args") if r_args != " ": From f331c701fb9e33080e808b0110ad9bfe04102664 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Wed, 10 Apr 2013 11:54:37 -0300 Subject: [PATCH 0412/1050] New option: vimrplugin_source. --- doc/r-plugin.txt | 29 ++++++++++++++++++++++------- r-plugin/common_global.vim | 10 ++++++++++ 2 files changed, 32 insertions(+), 7 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 266c12b..ce1b5e3 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -5,7 +5,7 @@ Authors: Jakson A. Aquino Jose Claudio Faria -Version: 0.9.9.2 +Version: 0.9.9.3 For Vim version 7.3 1. Overview |r-plugin-overview| @@ -132,7 +132,7 @@ following dependencies: Vim >= 7.3 with Python support. Tmux >= 1.5: http://tmux.sourceforge.net Screen plugin: http://www.vim.org/scripts/script.php?script_id=2711 - vimcom = 0.9-7: An R package. + vimcom = 0.9-8: An R package. Suggests:~ ncurses-term: http://invisible-island.net/ncurses @@ -248,7 +248,7 @@ to install external dependencies: find the file that matches exactly the version of Python that you installed. - * vimcom = 0.9-7: An R package, available on CRAN and installable with the + * vimcom = 0.9-8: An R package, available on CRAN and installable with the install.packages() command. The vimcom package creates a server on R to allow the communication with Vim. You certainly will want to put the following lines at the end of your Rprofile. @@ -973,6 +973,7 @@ duplicated to R on Mac OS X. |vimrplugin_insert_mode_cmds| Allow R commands in insert mode. |vimrplugin_allnames| Show names which begin with a dot |vimrplugin_rmhidden| Remove hidden objects from R workspace. +|vimrplugin_source| Source additional scripts. 6.1. Terminal emulator (Linux/Unix only)~ @@ -1450,6 +1451,16 @@ you prefer to remove only visible objects, put in your |vimrc|: let g:vimrplugin_rmhidden = 0 < +6.26. Source additional scripts~ + *vimrplugin_source* +This variable should contain a comma separated list of Vim scripts to be +sourced by the Vim-R-plugin. These scripts may provide additional +functionality and/or change the behavior of the Vim-R-plugin. If you have such +scripts, put in your |vimrc|: +> + let vimrplugin_source = "~/path/to/MyScript.vim,/path/to/AnotherScript.vim" +< + ============================================================================== *r-plugin-key-bindings* 7. Custom key bindings~ @@ -1592,6 +1603,8 @@ you can create a shortcut to it by following the example: > map s :call SendCmdToR("search()") < +See also: |vimrplugin_source|. + ============================================================================== *r-plugin-files* @@ -1709,8 +1722,9 @@ The snipMate plugin does not come with snippets for R, but you can copy the files r.snippets and rmd.snippets that ship with the Vim-R-plugin (look at the r-plugin directory) to the snippets directory. The files have only a few snippets, but they will help you to get started. If you usually edit rnoweb -files, you may also want to create an rnoweb.snippet by concatenating both -tex.snippets and r.snippets. +files, you may also want to create an rnoweb.snippets by concatenating both +tex.snippets and r.snippets. If you edit R documentation, you may want to +create an rhelp.snippets 9.5. Easier key bindings for most used commands~ @@ -2151,11 +2165,12 @@ information: |latex-box-FAQ|. *r-plugin-news* 10. News~ -0.9.9.3 (2013-03-02) +0.9.9.3 (2013-04-09) * Minor bug fixes. + * New option: vimrplugin_source. -0.9.9.2 (2013-03-07) +0.9.9.2 (2013-02-01) * Update vimcom version requirement to 0.9-7 (fix incompatibility with tcltk package on Unix). diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 1d07d9f..9cc6d60 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -3612,3 +3612,13 @@ endif call SetRPath() +if exists("g:vimrplugin_source") + let flist = split(g:vimrplugin_source, ",") + for fl in flist + if fl =~ " " + call RWarningMsgInp("Invalid file name (empty spaces are not allowed): '" . fl . "'") + else + exe "source " . escape(fl, ' \') + endif + endfor +endif From 81306046efc0f25ff73f329646b4e4ad6404d85f Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Wed, 10 Apr 2013 15:14:40 -0300 Subject: [PATCH 0413/1050] Require vimcom 0.9.8. --- r-plugin/vimcom.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/r-plugin/vimcom.py b/r-plugin/vimcom.py index cc085ac..7ea15aa 100644 --- a/r-plugin/vimcom.py +++ b/r-plugin/vimcom.py @@ -48,8 +48,8 @@ def DiscoverVimComPort(): else: vim.command("let g:rplugin_vimcomport = " + str(VimComPort)) PortWarn = False - if repl.find("0.9-7") != 0: - vim.command("call RWarningMsg('This version of Vim-R-plugin requires vimcom 0.9-7.')") + if repl.find("0.9-8") != 0: + vim.command("call RWarningMsg('This version of Vim-R-plugin requires vimcom 0.9-8.')") vim.command("sleep 1") return(VimComPort) From 02c9284eb08349d6668493f0af57d55fad0a69cd Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 11 Apr 2013 08:31:53 -0300 Subject: [PATCH 0414/1050] Source other scripts at the end of ftplugin. --- ftplugin/r.vim | 2 ++ ftplugin/rbrowser.vim | 2 ++ ftplugin/rdoc.vim | 2 ++ ftplugin/rhelp.vim | 2 ++ ftplugin/rmd.vim | 2 ++ ftplugin/rnoweb.vim | 2 ++ ftplugin/rrst.vim | 2 ++ r-plugin/common_global.vim | 23 +++++++++++++---------- 8 files changed, 27 insertions(+), 10 deletions(-) diff --git a/ftplugin/r.vim b/ftplugin/r.vim index e5bd09a..3b57266 100644 --- a/ftplugin/r.vim +++ b/ftplugin/r.vim @@ -126,6 +126,8 @@ if has("gui_running") call MakeRMenu() endif +call RSourceOtherScripts() + let &cpo = s:cpo_save unlet s:cpo_save diff --git a/ftplugin/rbrowser.vim b/ftplugin/rbrowser.vim index 45c8657..ea06a3b 100644 --- a/ftplugin/rbrowser.vim +++ b/ftplugin/rbrowser.vim @@ -430,6 +430,8 @@ else endif unlet s:envstring +call RSourceOtherScripts() + let &cpo = s:cpo_save unlet s:cpo_save diff --git a/ftplugin/rdoc.vim b/ftplugin/rdoc.vim index bc87335..329cce3 100644 --- a/ftplugin/rdoc.vim +++ b/ftplugin/rdoc.vim @@ -74,6 +74,8 @@ if has("gui_running") call MakeRMenu() endif +call RSourceOtherScripts() + setlocal bufhidden=wipe setlocal noswapfile set buftype=nofile diff --git a/ftplugin/rhelp.vim b/ftplugin/rhelp.vim index 7313d13..c7cf31f 100644 --- a/ftplugin/rhelp.vim +++ b/ftplugin/rhelp.vim @@ -59,6 +59,8 @@ if has("gui_running") call MakeRMenu() endif +call RSourceOtherScripts() + let &cpo = s:cpo_save unlet s:cpo_save diff --git a/ftplugin/rmd.vim b/ftplugin/rmd.vim index 36be112..91fde31 100644 --- a/ftplugin/rmd.vim +++ b/ftplugin/rmd.vim @@ -213,6 +213,8 @@ endif let g:rplugin_has_pandoc = 0 let g:rplugin_has_soffice = 0 +call RSourceOtherScripts() + let &cpo = s:cpo_save unlet s:cpo_save diff --git a/ftplugin/rnoweb.vim b/ftplugin/rnoweb.vim index 5e2f951..a5be931 100644 --- a/ftplugin/rnoweb.vim +++ b/ftplugin/rnoweb.vim @@ -270,6 +270,8 @@ if has("gui_running") call MakeRMenu() endif +call RSourceOtherScripts() + let &cpo = s:cpo_save unlet s:cpo_save diff --git a/ftplugin/rrst.vim b/ftplugin/rrst.vim index 7b7d0c0..b49a7f6 100644 --- a/ftplugin/rrst.vim +++ b/ftplugin/rrst.vim @@ -215,5 +215,7 @@ endif let g:rplugin_has_rst2pdf = 0 +call RSourceOtherScripts() + let &cpo = s:cpo_save unlet s:cpo_save diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 9cc6d60..39a73c1 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -3058,6 +3058,19 @@ function SetRPath() endif endfunction +function RSourceOtherScripts() + if exists("g:vimrplugin_source") + let flist = split(g:vimrplugin_source, ",") + for fl in flist + if fl =~ " " + call RWarningMsgInp("Invalid file name (empty spaces are not allowed): '" . fl . "'") + else + exe "source " . escape(fl, ' \') + endif + endfor + endif +endfunction + command RUpdateObjList :call RBuildSyntaxFile() command -nargs=+ RAddLibToList :call RBuildSyntaxFile() command -nargs=1 -complete=customlist,RLisObjs Rinsert :call RInsert() @@ -3612,13 +3625,3 @@ endif call SetRPath() -if exists("g:vimrplugin_source") - let flist = split(g:vimrplugin_source, ",") - for fl in flist - if fl =~ " " - call RWarningMsgInp("Invalid file name (empty spaces are not allowed): '" . fl . "'") - else - exe "source " . escape(fl, ' \') - endif - endfor -endif From 7c6d4ca69a81f2bd0fdf573a43d6709fd196536e Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 11 Apr 2013 08:34:59 -0300 Subject: [PATCH 0415/1050] Version 0.9.9.3. --- Makefile | 2 +- doc/r-plugin.txt | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index a4ea5ac..af11372 100644 --- a/Makefile +++ b/Makefile @@ -29,7 +29,7 @@ PLUGINHOME=`pwd` -PLUGINVERSION=0.9.9.2 +PLUGINVERSION=0.9.9.3 DEBIANTIME=`date -R` PLUGINRELEASEDATE=`date +"%Y-%m-%d"` VIM2HTML=/usr/local/share/vim/vim73/doc/vim2html.pl diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index ce1b5e3..e777e6a 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -43,7 +43,9 @@ Cryptic error message are bugs... Please report them at: https://github.com/jcfaria/Vim-R-plugin/issues We do not plan to take the initiative of writing code for new features, but -patches and git pull requests are welcome. +patches and git pull requests are welcome. If you want a feature that only few +people might be interested in, you can write a script to be sourced by the +Vim-R-plugin (see |vimrplugin_source|). ============================================================================== @@ -2165,7 +2167,7 @@ information: |latex-box-FAQ|. *r-plugin-news* 10. News~ -0.9.9.3 (2013-04-09) +0.9.9.3 (2013-04-11) * Minor bug fixes. * New option: vimrplugin_source. From d9965578bda91dd06102a652ba8b187983d22d69 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 11 Apr 2013 13:44:47 -0300 Subject: [PATCH 0416/1050] Note on devtools.vim script. --- doc/r-plugin.txt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index e777e6a..222c8f7 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -5,7 +5,7 @@ Authors: Jakson A. Aquino Jose Claudio Faria -Version: 0.9.9.3 +Version: 0.9.9.4 For Vim version 7.3 1. Overview |r-plugin-overview| @@ -1462,6 +1462,10 @@ scripts, put in your |vimrc|: > let vimrplugin_source = "~/path/to/MyScript.vim,/path/to/AnotherScript.vim" < +Currently, there is only one script known to extend the Vim-R-plugin features: + + - https://github.com/mllg/vim-devtools-plugin + ============================================================================== *r-plugin-key-bindings* @@ -2167,6 +2171,10 @@ information: |latex-box-FAQ|. *r-plugin-news* 10. News~ +0.9.9.4 (2013-04-11) + + * Nothing worth of mention yet. + 0.9.9.3 (2013-04-11) * Minor bug fixes. From 151c844c031d88cbbcf07ff1c1218ba34dc8971f Mon Sep 17 00:00:00 2001 From: Alex Zvoleff Date: Thu, 18 Apr 2013 16:09:15 -0700 Subject: [PATCH 0417/1050] If specified, check if g:vimrplugin_rst2pdfpath is executable before checking if rst2pdf is in the path. Also fix bug in adding g:vimrplugin_rst2pdf_path to the pdfcmd. --- ftplugin/rrst.vim | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ftplugin/rrst.vim b/ftplugin/rrst.vim index b49a7f6..b6daaba 100644 --- a/ftplugin/rrst.vim +++ b/ftplugin/rrst.vim @@ -138,7 +138,9 @@ function! RMakePDFrrst() update call RSetWD() if g:rplugin_has_rst2pdf == 0 - if executable("rst2pdf") + if exists("g:vimrplugin_rst2pdfpath") && executable(g:vimrplugin_rst2pdfpath) + let g:rplugin_has_rst2pdf = 1 + elseif executable("rst2pdf") let g:rplugin_has_rst2pdf = 1 else call RWarningMsg("Is 'rst2pdf' application installed? Cannot convert into PDF: 'rst2pdf' executable not found.") @@ -154,7 +156,7 @@ function! RMakePDFrrst() let pdfcmd = pdfcmd . ", " . g:vimrplugin_knitargs endif if exists("g:vimrplugin_rst2pdfpath") - pdfcmd = pdfcmd . ", rst2pdfpath='" . g:vimrplugin_rst2pdf_path . "'" + let pdfcmd = pdfcmd . ", rst2pdfpath='" . g:vimrplugin_rst2pdfpath . "'" endif if exists("g:vimrplugin_rst2pdfargs") let pdfcmd = pdfcmd . ", " . g:vimrplugin_rst2pdfargs From 98486f7217bb6515fdfdbab48092b486bbef01e9 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 18 Apr 2013 20:42:38 -0300 Subject: [PATCH 0418/1050] Improve documentation of rrst support. --- doc/r-plugin.txt | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 222c8f7..0dd8492 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -1376,11 +1376,10 @@ either Tmux or GNU Screen in some systems. The Vim-R-plugin will add let vimrplugin_ca_ck = 1 < -6.23. Open PDF after processing rnoweb file~ +6.23. Open PDF after processing rnoweb, rmd or rrst files~ *vimrplugin_openpdf* *vimrplugin_openpdf_quietly* *vimrplugin_openhtml* - *vimrplugin_strict_rst* The plugin will try to open automatically the pdf file generated by pdflatex, after either Sweave() or knit(), if you put in your |vimrc|: > @@ -1416,14 +1415,25 @@ The html file will be automatically opened if you put the following in your > let vimrplugin_openhtml = 1 < + +6.24. Support to RreStructuredText file~ + *vimrplugin_strict_rst* + *vimrplugin_rst2pdfpath* + *vimrplugin_rst2pdfargs* + *vimrplugin_rrstcompiler* By default, the Vim-R-plugin sends the command render_rst(strict=TRUE) to R before using R's knit() function to convert an Rrst file into an rst one. If you prefer the non strict rst code, put the following in your |vimrc|: > let vimrplugin_strict_rst = 0 < +You can also set the value of vimrplugin_rst2pdfpath (the path to rst2pdf +application), vimrplugin_rrstcompiler (the compiler argument to be passed to R +function knit2pdf), and vimrplugin_rst2pdfargs (further arguments to be passed +to R function knit2pdf). -6.24. Allow R commands in insert mode~ + +6.25. Allow R commands in insert mode~ *vimrplugin_insert_mode_cmds* Vim-R commands are designed to work in insert mode as well as normal mode. However, depending on your , this can make it very difficult to @@ -1439,7 +1449,7 @@ The default value is 1, for consistency with earlier versions. See also: |r-plugin-localleader|. -6.25. Show/remove hidden objects~ +6.26. Show/remove hidden objects~ *vimrplugin_allnames* *vimrplugin_rmhidden* Hidden objects are not included in the list of objects for omni completion. If @@ -1453,7 +1463,7 @@ you prefer to remove only visible objects, put in your |vimrc|: let g:vimrplugin_rmhidden = 0 < -6.26. Source additional scripts~ +6.27. Source additional scripts~ *vimrplugin_source* This variable should contain a comma separated list of Vim scripts to be sourced by the Vim-R-plugin. These scripts may provide additional @@ -2171,9 +2181,9 @@ information: |latex-box-FAQ|. *r-plugin-news* 10. News~ -0.9.9.4 (2013-04-11) +0.9.9.4 (2013-04-18) - * Nothing worth of mention yet. + * Minor bug fixes. 0.9.9.3 (2013-04-11) From 844efd214dc0eed4e69ae4f02b821a5cceba200e Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 9 May 2013 23:50:45 -0300 Subject: [PATCH 0419/1050] Go out of Insert mode on BufEnter. --- ftplugin/rbrowser.vim | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ftplugin/rbrowser.vim b/ftplugin/rbrowser.vim index ea06a3b..4e740e9 100644 --- a/ftplugin/rbrowser.vim +++ b/ftplugin/rbrowser.vim @@ -406,6 +406,8 @@ if has("gui_running") call RBrowserMenu() endif +au BufEnter stopinsert + if $TMUX_PANE == "" au BufUnload Py SendToVimCom("\x08Stop updating info.") else From a5b4a5fcc1009fa0a19d86d5d9c828bd1958018c Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 11 May 2013 14:51:48 -0300 Subject: [PATCH 0420/1050] Minor improvement and bug fix. --- syntax/r.vim | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/syntax/r.vim b/syntax/r.vim index 8ff2240..73b0d64 100644 --- a/syntax/r.vim +++ b/syntax/r.vim @@ -3,7 +3,7 @@ " Maintainer: Jakson Aquino " Former Maintainers: Vaidotas Zemlys " Tom Payne -" Last Change: Wed Jul 11, 2012 01:28PM +" Last Change: Sat May 11, 2013 02:23PM " Filenames: *.R *.r *.Rhistory *.Rt " " NOTE: The highlighting of R functions is defined in the @@ -33,7 +33,7 @@ syn case match syn match rComment contains=@Spell "#.*" " Roxygen -syn match rOKeyword contained "@\(param\|return\|name\|rdname\|examples\|include\)" +syn match rOKeyword contained "@\(param\|return\|name\|rdname\|examples\|include\|docType\)" syn match rOKeyword contained "@\(S3method\|TODO\|aliases\|alias\|assignee\|author\|callGraphDepth\|callGraph\)" syn match rOKeyword contained "@\(callGraphPrimitives\|concept\|exportClass\|exportMethod\|exportPattern\|export\|formals\)" syn match rOKeyword contained "@\(format\|importClassesFrom\|importFrom\|importMethodsFrom\|import\|keywords\)" @@ -74,7 +74,7 @@ syn keyword rConditional if else syn keyword rRepeat for in repeat while " Constant (not really) -syn keyword rConstant T F LETTERS letters month.ab month.name pi +syn keyword rConstant T F LETTERS letters month.abb month.name pi syn keyword rConstant R.version.string syn keyword rNumber NA_integer_ NA_real_ NA_complex_ NA_character_ From e2c24f8c51314b97b51d85490b0be30f6898f40b Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 18 May 2013 15:04:44 -0300 Subject: [PATCH 0421/1050] Don't update the object browser twice. --- r-plugin/common_global.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 39a73c1..42bc9b7 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -1171,7 +1171,7 @@ function RBrowserOpenCloseLists(status) if g:rplugin_lastrpl == "R is busy." call RWarningMsg("R is busy.") - elseif exists("g:rplugin_curview") + elseif exists("g:rplugin_curview") && v:servername == "" call UpdateOB("both") endif From 5932e9cf9d7eb000b26a03b3e8419d8fc84e731b Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 18 May 2013 15:05:17 -0300 Subject: [PATCH 0422/1050] Improve links in html version of documentation. --- Makefile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index af11372..5a2b36f 100644 --- a/Makefile +++ b/Makefile @@ -29,7 +29,7 @@ PLUGINHOME=`pwd` -PLUGINVERSION=0.9.9.3 +PLUGINVERSION=0.9.9.4 DEBIANTIME=`date -R` PLUGINRELEASEDATE=`date +"%Y-%m-%d"` VIM2HTML=/usr/local/share/vim/vim73/doc/vim2html.pl @@ -225,6 +225,10 @@ htmldoc: (cd doc ;\ $(VIM2HTML) tags r-plugin.txt ;\ sed -i -e 's///' r-plugin.html ;\ + sed -i -e 's/||/<\/a>/g' r-plugin.html ;\ + sed -i -e 's/||/<\/code>/g' r-plugin.html ;\ mv r-plugin.html vim-stylesheet.css /tmp ) all: zip deb htmldoc From 88048812891f714f2e8c7794f43c59a8c91e4512 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sun, 19 May 2013 18:00:55 -0300 Subject: [PATCH 0423/1050] Escape the asterisk to make it a normal char. --- syntax/r.vim | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/syntax/r.vim b/syntax/r.vim index 73b0d64..5e76e7a 100644 --- a/syntax/r.vim +++ b/syntax/r.vim @@ -3,7 +3,7 @@ " Maintainer: Jakson Aquino " Former Maintainers: Vaidotas Zemlys " Tom Payne -" Last Change: Sat May 11, 2013 02:23PM +" Last Change: Sun May 19, 2013 05:59PM " Filenames: *.R *.r *.Rhistory *.Rt " " NOTE: The highlighting of R functions is defined in the @@ -111,7 +111,7 @@ syn match rComplex "\<\d\+[Ee][-+]\=\d\+i" syn match rOperator "&" syn match rOperator '-' -syn match rOperator '*' +syn match rOperator '\*' syn match rOperator '+' syn match rOperator '=' if &filetype != "rmd" && &filetype != "rrst" @@ -120,7 +120,7 @@ else syn match rOperator "[|!<>^~`/:]" endif syn match rOperator "%\{2}\|%\S*%" -syn match rOpError '*\{3}' +syn match rOpError '\*\{3}' syn match rOpError '//' syn match rOpError '&&&' syn match rOpError '|||' From 6f3a802ac0e477ff14cfb7c6d520c04be2ab8642 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 27 Jun 2013 08:21:37 -0300 Subject: [PATCH 0424/1050] Complete function args even if R isn't running. --- r-plugin/common_global.vim | 59 ++++++++++++++++++++------------------ 1 file changed, 31 insertions(+), 28 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 42bc9b7..1b499de 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -214,6 +214,8 @@ function RCompleteArgs() let classfor = substitute(classfor, '"', '\\"', "g") let rkeyword = '^' . rkeyword0 . "\x06" call cursor(cpos[1], cpos[2]) + + " If R is running, use it call delete($VIMRPLUGIN_TMPDIR . "/eval_reply") if classfor == "" exe 'Py SendToVimCom("vimcom:::vim.args(' . "'" . rkeyword0 . "', '" . argkey . "')" . '")' @@ -250,37 +252,38 @@ function RCompleteArgs() endif return '' endif + endif - for omniL in flines - if omniL =~ rkeyword && omniL =~ "\x06function\x06function\x06" - let tmp1 = split(omniL, "\x06") - if len(tmp1) < 5 - return '' - endif - let info = tmp1[4] - let argsL = split(info, "\x09") - let args = [] - for id in range(len(argsL)) - let newkey = '^' . argkey - let tmp2 = split(argsL[id], "\x07") - if (argkey == '' || tmp2[0] =~ newkey) && tmp2[0] !~ "No arguments" - if tmp2[0] != '...' - let tmp2[0] = tmp2[0] . " = " - endif - if len(tmp2) == 2 - let tmp3 = {'word': tmp2[0], 'menu': tmp2[1]} - else - let tmp3 = {'word': tmp2[0], 'menu': ''} - endif - call add(args, tmp3) - endif - endfor - call complete(idx2, args) + " If R isn't running, use the prebuilt list of objects + for omniL in flines + if omniL =~ rkeyword && omniL =~ "\x06function\x06function\x06" + let tmp1 = split(omniL, "\x06") + if len(tmp1) < 5 return '' endif - endfor - break - endif + let info = tmp1[4] + let argsL = split(info, "\x09") + let args = [] + for id in range(len(argsL)) + let newkey = '^' . argkey + let tmp2 = split(argsL[id], "\x07") + if (argkey == '' || tmp2[0] =~ newkey) && tmp2[0] !~ "No arguments" + if tmp2[0] != '...' + let tmp2[0] = tmp2[0] . " = " + endif + if len(tmp2) == 2 + let tmp3 = {'word': tmp2[0], 'menu': tmp2[1]} + else + let tmp3 = {'word': tmp2[0], 'menu': ''} + endif + call add(args, tmp3) + endif + endfor + call complete(idx2, args) + return '' + endif + endfor + break endif let idx -= 1 if idx <= 0 From 87f470a65c1833b778b6a584ac84321064b5896f Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 6 Jul 2013 10:18:19 -0300 Subject: [PATCH 0425/1050] Update object browser when opening/closing lists. --- r-plugin/common_global.vim | 3 +++ 1 file changed, 3 insertions(+) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 1b499de..b6dd57b 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -1185,6 +1185,9 @@ function RBrowserOpenCloseLists(status) if exists("g:rplugin_curview") && v:servername != "" exe 'Py SendToVimCom("\007' . v:servername . '")' endif + if has("gui_running") + call UpdateOB("both") + endif endfunction " Scroll conque term buffer (called by CursorHold event) From a9fac799fc41e9dbb4ec6b48ed8d155004f3d339 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 6 Jul 2013 19:48:57 -0300 Subject: [PATCH 0426/1050] Use quicker regular expression. --- syntax/rhelp.vim | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/syntax/rhelp.vim b/syntax/rhelp.vim index 74d9853..3ac5377 100644 --- a/syntax/rhelp.vim +++ b/syntax/rhelp.vim @@ -2,7 +2,7 @@ " Language: R Help File " Maintainer: Jakson Aquino " Former Maintainer: Johannes Ranke -" Last Change: Tue Feb 26, 2013 01:13PM +" Last Change: Sat Jul 06, 2013 07:45PM " Remarks: - Includes R syntax highlighting in the appropriate " sections if an r.vim file is in the same directory or in the " default debian location. @@ -51,7 +51,12 @@ syn region rhelpRcode matchgroup=Delimiter start="\\examples{" matchgroup=Delimi syn region rhelpRcode matchgroup=Delimiter start="\\usage{" matchgroup=Delimiter transparent end="}" contains=@R,rhelpIdentifier,rhelpS4method syn region rhelpRcode matchgroup=Delimiter start="\\synopsis{" matchgroup=Delimiter transparent end="}" contains=@R syn region rhelpRcode matchgroup=Delimiter start="\\special{" matchgroup=Delimiter transparent end="}" contains=@R -syn region rhelpRcode matchgroup=Delimiter start="\\code{" skip='\\\@ 703 + syn region rhelpRcode matchgroup=Delimiter start="\\code{" skip='\\\@1 703 + syn region rhelpVerbatim matchgroup=rhelpType start="\\samp{" skip='\\\@1" From aeb21d3690f54b4e507adb9d217cce84bd5c9458 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Mon, 8 Jul 2013 08:26:54 -0300 Subject: [PATCH 0427/1050] Send selection if the line has the \Sexpr string. --- r-plugin/common_global.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index b6dd57b..a420707 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -1573,7 +1573,7 @@ endfunction " Send selection to R function SendSelectionToR(e, m) - if &filetype == "rnoweb" && RnwIsInRCode() == 0 + if &filetype == "rnoweb" && RnwIsInRCode() == 0 && !(line("'<") == line("'>") && getline(".") =~ "\\Sexpr") call RWarningMsg("Not inside an R code chunk.") return endif From ef78ce5a8cb68e6bc380ea7bcc870220c80ac030 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Mon, 8 Jul 2013 08:30:03 -0300 Subject: [PATCH 0428/1050] Show latexmk as example of vimrplugin_latexcmd. --- doc/r-plugin.txt | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 0dd8492..31f384e 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -618,11 +618,11 @@ pathogen). 4.4. Omni completion~ Vim can automatically complete the names of R objects when CTRL-X CTRL-O is -pressed in insert mode (see |omni-completion| for details and 'completeopt' to -know how to customize the |omni-completion|). Omni completion shows in a pop -up menu the name of the object, its class and its environment (most -frequently, its package name). If the object is a function, its arguments are -shown in a separate window. +pressed in insert mode (see |omni-completion| for details). Omni completion +shows in a pop up menu the name of the object, its class and its environment +(most frequently, its package name). If the object is a function, its +arguments are shown in a separate window (see 'completeopt' if you want to +disable the preview window). If a data.frame is found, while building the list of objects, the columns in the data.frame are added to the list. When you try to use omni completion to @@ -1326,9 +1326,10 @@ Example: On Windows, the plugin calls tools::texi2pdf() to build the pdf from the generated .tex file. On Linux/Unix, by default, Vim calls pdflatex to produce a pdf document from the .tex file produced by the R Sweave command. You can -use the option vimrplugin_latexcmd to change this behavior. Example: +use the option vimrplugin_latexcmd to change this behavior. Examples: > let vimrplugin_latexcmd = "latex" + let vimrplugin_latexcmd = "latexmk -pdf" < If you want to pass arguments do the Sweave() function, set the value of the vimrplugin_sweaveargs variable. @@ -2181,7 +2182,7 @@ information: |latex-box-FAQ|. *r-plugin-news* 10. News~ -0.9.9.4 (2013-04-18) +0.9.9.4 (2013-07-08) * Minor bug fixes. From 30c813bd6855259f6770613ff62034a0268aad6d Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 25 Jul 2013 21:16:31 -0300 Subject: [PATCH 0429/1050] Fix OR operator. --- ftplugin/r.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ftplugin/r.vim b/ftplugin/r.vim index 3b57266..8a9f26c 100644 --- a/ftplugin/r.vim +++ b/ftplugin/r.vim @@ -62,7 +62,7 @@ function! ShowRout() " if not silent, the user will have to type silent update - if has("win32") | has("win64") + if has("win32") || has("win64") let rcmd = 'Rcmd.exe BATCH --no-restore --no-save "' . expand("%") . '" "' . routfile . '"' else let rcmd = b:rplugin_R . " CMD BATCH --no-restore --no-save '" . expand("%") . "' '" . routfile . "'" From ba36a528dfaaebf18817368cac4b01921d23bafe Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Mon, 29 Jul 2013 12:44:29 -0300 Subject: [PATCH 0430/1050] Do not set the value of 'completefunc'. Thanks to Chip Hogg for reporting the bug. --- autoload/rcomplete.vim | 2 -- 1 file changed, 2 deletions(-) diff --git a/autoload/rcomplete.vim b/autoload/rcomplete.vim index 2ec3214..33dc75f 100644 --- a/autoload/rcomplete.vim +++ b/autoload/rcomplete.vim @@ -51,5 +51,3 @@ fun! rcomplete#CompleteR(findstart, base) endif endfun -set completefunc=CompleteR - From 2ad9121636a98dce5626d122ed41bd988cdc852f Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Mon, 5 Aug 2013 13:39:44 -0300 Subject: [PATCH 0431/1050] Make it possible to restart R. --- r-plugin/common_global.vim | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index a420707..b998e6b 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -622,6 +622,7 @@ endfunction " Start R function StartR(whatr) + let g:rplugin_last_whatr = a:whatr call writefile([], $VIMRPLUGIN_TMPDIR . "/object_browser") call writefile([], $VIMRPLUGIN_TMPDIR . "/liblist") @@ -713,6 +714,7 @@ function StartR(whatr) let rcmd = 'VIMRPLUGIN_TMPDIR="' . $VIMRPLUGIN_TMPDIR . '" VIMINSTANCEID=' . $VIMINSTANCEID . " " . rcmd endif endif + let g:rplugin_rcmd = rcmd if g:vimrplugin_tmux == 0 && g:vimrplugin_noscreenrc == 0 && exists("g:ScreenShellScreenInitArgs") let g:ScreenShellScreenInitArgs = RWriteScreenRC() endif @@ -1815,6 +1817,13 @@ endfunction " Quit R function RQuit(how) + if a:how == "restart" + if !(exists("g:rplugin_last_whatr") || exists("g:rplugin_rcmd")) + call RWarningMsg("Cannot restart R.") + return + endif + endif + if bufloaded(b:objbrtitle) exe "bunload! " . b:objbrtitle sleep 150m @@ -1852,6 +1861,19 @@ function RQuit(how) sleep 250m endif + if a:how == "restart" + if exists("g:rplugin_objbrtitle") + unlet g:rplugin_objbrtitle + endif + sleep 100m + if exists("g:rplugin_rcmd") + call SendCmdToR(g:rplugin_rcmd) + else + call StartR(g:rplugin_last_whatr) + endif + return + endif + if g:vimrplugin_screenplugin if exists(':ScreenQuit') ScreenQuit From f8c7841c3524894b225f42c135bcbcf6a16f2091 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 10 Aug 2013 08:16:20 -0300 Subject: [PATCH 0432/1050] Improve error messages detecting R in registry. --- r-plugin/common_global.vim | 7 ++++++- r-plugin/windows.py | 8 ++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index b998e6b..8db21fc 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -3456,7 +3456,12 @@ if has("win32") || has("win64") else Py GetRPath() if exists("s:rinstallpath") - if s:rinstallpath == "Not found" + if s:rinstallpath == "Key not found" + call RWarningMsgInp("Could not find R key in Windows Registry. Please, either install R or set the value of 'vimrplugin_r_path'.") + let g:rplugin_failed = 1 + finish + endif + if s:rinstallpath == "Path not found" call RWarningMsgInp("Could not find R path in Windows Registry. Please, either install R or set the value of 'vimrplugin_r_path'.") let g:rplugin_failed = 1 finish diff --git a/r-plugin/windows.py b/r-plugin/windows.py index 818e859..ce26ecc 100644 --- a/r-plugin/windows.py +++ b/r-plugin/windows.py @@ -141,23 +141,27 @@ def GetRPath(): try: kHandle = win32api.RegOpenKeyEx(win32con.HKEY_LOCAL_MACHINE, keyName, 0, win32con.KEY_READ) rVersion, reserved, kclass, lastwrite = win32api.RegEnumKeyEx(kHandle)[-1] + win32api.RegCloseKey(kHandle) + kHandle = None keyName = keyName + "\\" + rVersion kHandle = win32api.RegOpenKeyEx(win32con.HKEY_LOCAL_MACHINE, keyName, 0, win32con.KEY_READ) except: try: kHandle = win32api.RegOpenKeyEx(win32con.HKEY_CURRENT_USER, keyName, 0, win32con.KEY_READ) rVersion, reserved, kclass, lastwrite = win32api.RegEnumKeyEx(kHandle)[-1] + win32api.RegCloseKey(kHandle) + kHandle = None keyName = keyName + "\\" + rVersion kHandle = win32api.RegOpenKeyEx(win32con.HKEY_CURRENT_USER, keyName, 0, win32con.KEY_READ) except: - vim.command("let s:rinstallpath = 'Not found'") + vim.command("let s:rinstallpath = 'Key not found'") if kHandle: (kname, rpath, vtype) = win32api.RegEnumValue(kHandle, 0) win32api.RegCloseKey(kHandle) if kname == 'InstallPath': vim.command("let s:rinstallpath = '" + rpath + "'") else: - vim.command("let s:rinstallpath = 'Not found'") + vim.command("let s:rinstallpath = 'Path not found'") def StartRPy(): global Rterm From c8279c941a97f16d893e424d74bc49f3abd84f70 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Tue, 13 Aug 2013 20:04:38 -0300 Subject: [PATCH 0433/1050] Fix bugs while deleting objects and opening lists. --- ftplugin/rbrowser.vim | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/ftplugin/rbrowser.vim b/ftplugin/rbrowser.vim index 4e740e9..68fe817 100644 --- a/ftplugin/rbrowser.vim +++ b/ftplugin/rbrowser.vim @@ -23,6 +23,7 @@ if exists("b:did_ftplugin") finish endif +let g:rplugin_upobcnt = 0 " Don't load another plugin for this buffer let b:did_ftplugin = 1 @@ -60,12 +61,14 @@ let g:rplugin_curview = "GlobalEnv" function! UpdateOB(what) + let g:rplugin_upobcnt += 1 if a:what == "both" let wht = g:rplugin_curview else let wht = a:what endif if g:rplugin_curview != wht + let g:rplugin_upobcnt -= 1 return "curview != what" endif @@ -75,6 +78,7 @@ function! UpdateOB(what) silent buffers redir END if s:bufl !~ "Object_Browser" + let g:rplugin_upobcnt -= 1 return "Object_Browser not listed" endif if exists("g:rplugin_curbuf") && g:rplugin_curbuf != "Object_Browser" @@ -104,13 +108,16 @@ function! UpdateOB(what) endif call cursor(curline, curcol) if bufname("%") =~ "Object_Browser" || b:rplugin_extern_ob - setlocal nomodifiable + if g:rplugin_upobcnt < 2 + setlocal nomodifiable + endif endif redraw if g:rplugin_switchedbuf exe "sil noautocmd sb " . g:rplugin_curbuf exe "set switchbuf=" . savesb endif + let g:rplugin_upobcnt -= 1 return "End of UpdateOB()" endfunction @@ -145,6 +152,9 @@ function! RBrowserDoubleClick() call RWarningMsg("R is busy.") endif endif + if has("win32") || has("win64") + call UpdateOB("both") + endif endfunction function! RBrowserRightClick() From 57a643f8500f23e0be8aba4e63d3921175bd8f02 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Tue, 13 Aug 2013 20:07:01 -0300 Subject: [PATCH 0434/1050] Update. --- doc/r-plugin.txt | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 31f384e..b898e85 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -6,7 +6,7 @@ Authors: Jakson A. Aquino Jose Claudio Faria Version: 0.9.9.4 -For Vim version 7.3 +For Vim version 7.4 1. Overview |r-plugin-overview| 2. Main features |r-plugin-features| @@ -74,7 +74,7 @@ Vim-R-plugin (see |vimrplugin_source|). - Automatic calculation of the best layout of the R documentation buffer (split the window either horizontally or vertically according to the available room). - - Automatic formating of the text to fit the panel width. + - Automatic formatting of the text to fit the panel width. - Send code and commands to R (useful to run examples). - Jump to another R documentation. - Syntax highlighting of R documentation. @@ -211,7 +211,7 @@ show how the plugin will work on Linux in different conditions: Note: On Mac OS X the plugin will use AppleScript in both Vim and GVim unless -vimrplugin_applescript = 0. Some user have reported more luck with iTerm than +vimrplugin_applescript = 0. Some users have reported more luck with iTerm than with the default Mac OS X terminal emulator. @@ -738,7 +738,7 @@ resize the panes by clicking on the border line and dragging it, and to scroll the R Console with the mouse wheel. When you use the mouse wheel, Tmux enters in its copy/scroll back mode (see below). -The configuration script also sets as the Tmux scape character (the +The configuration script also sets as the Tmux escape character (the default is ), that is, you have to type before typing a Tmux command. Below are the most useful key bindings to use Tmux with the tmux.conf created by the Vim-R-plugin (see |vimrplugin_notmuxconf| if you prefer to use @@ -771,7 +771,7 @@ configuration and learn more commands. To read the Tmux manual, type in the terminal emulator: > man tmux -> +< Note: was configured as the Tmux scape character, and it will not be passed to applications running under Tmux. To send to either R or Vim you have to type a. @@ -1140,8 +1140,8 @@ Vim will run the first R executable in the path. You can set an alternative R path in your |vimrc| as in the examples: > let vimrplugin_r_path = "/path/to/my/preferred/R/version/bin" - let vimrplugin_r_path = "C:\\Program Files\\R\\R-2.15.1\\bin\\i386" -> + let vimrplugin_r_path = "C:\\Program Files\\R\\R-3.0.1\\bin\\i386" +< On Windows, Vim will try to find the R install path in the Windows Registry. @@ -2182,7 +2182,7 @@ information: |latex-box-FAQ|. *r-plugin-news* 10. News~ -0.9.9.4 (2013-07-08) +0.9.9.4 (2013-08-13) * Minor bug fixes. From 36b9b3bec7d533ab8c9497e5dc748ff3432b4044 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Wed, 14 Aug 2013 09:22:56 -0300 Subject: [PATCH 0435/1050] Update vimcom version number to 0.9-9. --- doc/r-plugin.txt | 4 ++-- r-plugin/vimcom.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index b898e85..6ad97a0 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -134,7 +134,7 @@ following dependencies: Vim >= 7.3 with Python support. Tmux >= 1.5: http://tmux.sourceforge.net Screen plugin: http://www.vim.org/scripts/script.php?script_id=2711 - vimcom = 0.9-8: An R package. + vimcom = 0.9-9: An R package. Suggests:~ ncurses-term: http://invisible-island.net/ncurses @@ -250,7 +250,7 @@ to install external dependencies: find the file that matches exactly the version of Python that you installed. - * vimcom = 0.9-8: An R package, available on CRAN and installable with the + * vimcom = 0.9-9: An R package, available on CRAN and installable with the install.packages() command. The vimcom package creates a server on R to allow the communication with Vim. You certainly will want to put the following lines at the end of your Rprofile. diff --git a/r-plugin/vimcom.py b/r-plugin/vimcom.py index 7ea15aa..775c087 100644 --- a/r-plugin/vimcom.py +++ b/r-plugin/vimcom.py @@ -48,8 +48,8 @@ def DiscoverVimComPort(): else: vim.command("let g:rplugin_vimcomport = " + str(VimComPort)) PortWarn = False - if repl.find("0.9-8") != 0: - vim.command("call RWarningMsg('This version of Vim-R-plugin requires vimcom 0.9-8.')") + if repl.find("0.9-9") != 0: + vim.command("call RWarningMsg('This version of Vim-R-plugin requires vimcom 0.9-9.')") vim.command("sleep 1") return(VimComPort) From 964ff35fa33b828715d32504dee1c36df2abcd5f Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 17 Aug 2013 07:40:01 -0300 Subject: [PATCH 0436/1050] Suggest the use of latexmk. --- doc/r-plugin.txt | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 6ad97a0..ff71156 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -131,7 +131,7 @@ In addition to having R installed in your system, this plugin has the following dependencies: Depends:~ - Vim >= 7.3 with Python support. + Vim >= 7.4 with Python support. Tmux >= 1.5: http://tmux.sourceforge.net Screen plugin: http://www.vim.org/scripts/script.php?script_id=2711 vimcom = 0.9-9: An R package. @@ -140,6 +140,8 @@ following dependencies: ncurses-term: http://invisible-island.net/ncurses colorout: http://www.lepem.ufc.br/jaa/colorout.html setwidth: An R package. + latexmk: Automate the compilation of LaTeX documents. + See examples in |vimrplugin_latexcmd|. Note: Tmux and ncurses-term are already packaged for most GNU/Linux distributions and other Unix variants. The library ncurses-term is @@ -220,7 +222,7 @@ with the default Mac OS X terminal emulator. In addition to having R installed in your system, this plugin requires users to install external dependencies: - * Vim's version must be >= 7.3 + * Vim's version must be >= 7.4 * Python: http://www.python.org/download/ @@ -230,7 +232,7 @@ to install external dependencies: Note: Be careful to download the correct Python version because Vim needs a specific version of Python DLL. For example, the official - Vim 7.3 for Windows needs either Python 2.7 or 3.1. If Python was + Vim 7.4 for Windows needs either Python 2.7 or 3.1. If Python was not installed or was not found, the Vim-R-plugin will output information about what Python version Vim was compiled against. Do the following if you want to discover this information manually: @@ -1328,8 +1330,12 @@ generated .tex file. On Linux/Unix, by default, Vim calls pdflatex to produce a pdf document from the .tex file produced by the R Sweave command. You can use the option vimrplugin_latexcmd to change this behavior. Examples: > - let vimrplugin_latexcmd = "latex" let vimrplugin_latexcmd = "latexmk -pdf" + let vimrplugin_latexcmd = "latex" +< +You may also want to put the following in your .Rprofile: +> + options(vimcom.texerrs = TRUE) < If you want to pass arguments do the Sweave() function, set the value of the vimrplugin_sweaveargs variable. From 059332a6b8036081b05869468d42928acb745a8f Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 17 Aug 2013 07:40:34 -0300 Subject: [PATCH 0437/1050] Recognize _ as valid argument character. --- syntax/rdoc.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syntax/rdoc.vim b/syntax/rdoc.vim index ba004df..727a2e7 100644 --- a/syntax/rdoc.vim +++ b/syntax/rdoc.vim @@ -24,7 +24,7 @@ syn region rdocStringS start=" syn region rdocStringD start='"' skip='\\"' end='"' syn match rdocURL `\v<(((https?|ftp|gopher)://|(mailto|file|news):)[^' <>"]+|(www|web|w3)[a-z0-9_-]*\.[a-z0-9._-]+\.[^' <>"]+)[a-zA-Z0-9/]` syn keyword rdocNote note Note NOTE note: Note: NOTE: Notes Notes: -syn match rdocArg "^\s*\([a-z]\|[A-Z]\|[0-9]\|\.\)*: " +syn match rdocArg "^\s*\([a-z]\|[A-Z]\|[0-9]\|\.\|_\)*: " syn include @rdocR syntax/r.vim syn region rdocExample matchgroup=rdocExTitle start="^Examples:$" matchgroup=rdocExEnd end='^###$' contains=@rdocR keepend From bbe07c233a017fcabca834021adc9d703d8f5ac9 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Mon, 19 Aug 2013 00:06:07 -0300 Subject: [PATCH 0438/1050] Warn that vimcom is required to build the PDF. --- ftplugin/rmd.vim | 2 +- ftplugin/rnoweb.vim | 2 +- ftplugin/rrst.vim | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ftplugin/rmd.vim b/ftplugin/rmd.vim index 91fde31..1ce108c 100644 --- a/ftplugin/rmd.vim +++ b/ftplugin/rmd.vim @@ -132,7 +132,7 @@ function! RMakePDFrmd(t) if g:rplugin_vimcomport == 0 exe "Py DiscoverVimComPort()" if g:rplugin_vimcomport == 0 - return + call RWarningMsg("The vimcom package is required to make and open the PDF.") endif endif if g:rplugin_has_pandoc == 0 diff --git a/ftplugin/rnoweb.vim b/ftplugin/rnoweb.vim index a5be931..bdd7359 100644 --- a/ftplugin/rnoweb.vim +++ b/ftplugin/rnoweb.vim @@ -114,7 +114,7 @@ function! RMakePDF(bibtex, knit) if g:rplugin_vimcomport == 0 exe "Py DiscoverVimComPort()" if g:rplugin_vimcomport == 0 - return + call RWarningMsg("The vimcom package is required to make and open the PDF.") endif endif update diff --git a/ftplugin/rrst.vim b/ftplugin/rrst.vim index b6daaba..a1f09ff 100644 --- a/ftplugin/rrst.vim +++ b/ftplugin/rrst.vim @@ -132,7 +132,7 @@ function! RMakePDFrrst() if g:rplugin_vimcomport == 0 exe "Py DiscoverVimComPort()" if g:rplugin_vimcomport == 0 - return + call RWarningMsg("The vimcom package is required to make and open the PDF.") endif endif update From 4226112dde88e00693751c724ac8abe34410c3c2 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Tue, 20 Aug 2013 22:11:15 -0300 Subject: [PATCH 0439/1050] Drop support to GNU Screen, VimShell and Conque Shell. The maintenance of so many different ways of running R and sending commands to it was very complicated and was a source of bugs. People wanting integration between the Vim-R-plugin and GNU Screen, VimShell and Conque Shell will have to write extensions to the Vim-R-plugin (vimrplugin_source). To simplify the code even further, the integration with the screen plugin also was dropped. --- doc/r-plugin.txt | 443 ++++++++------------ ftplugin/r.vim | 2 +- ftplugin/rbrowser.vim | 8 +- ftplugin/rmd.vim | 4 +- ftplugin/rnoweb.vim | 14 +- ftplugin/rrst.vim | 4 +- r-plugin/common_buffer.vim | 40 +- r-plugin/common_global.vim | 837 +++++++++++++------------------------ syntax/rout.vim | 15 +- 9 files changed, 485 insertions(+), 882 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index ff71156..ecf38df 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -123,17 +123,11 @@ are in the same directory): > :helptags ~/.vim/doc < -Note: If you are using Mac OS X and prefer that Vim uses AppleScript to send -commands to R, then the installation is finished and you should now read -sections 3.3 and 3.4. - -In addition to having R installed in your system, this plugin has the +In addition to having R and Vim installed in your system, this plugin has the following dependencies: Depends:~ - Vim >= 7.4 with Python support. Tmux >= 1.5: http://tmux.sourceforge.net - Screen plugin: http://www.vim.org/scripts/script.php?script_id=2711 vimcom = 0.9-9: An R package. Suggests:~ @@ -148,7 +142,7 @@ following dependencies: necessary only for 256 color support in the terminal emulator. Unfortunately their installation instructions vary widely and are beyond the scope of this documentation. - + The vimcom package creates a server on R to allow the communication with Vim. The package is not used to send commands from Vim to R Console, but it is necessary to open R documentation in Vim's buffer, run the Object @@ -172,7 +166,7 @@ following dependencies: The colorout package colorizes the R output and the setwidth package adjusts the value of options("width") whenever the terminal is resized. They can be installed from within R. - + The setwidth package can be installed as usual: > install.packages("setwidth") @@ -186,31 +180,14 @@ following dependencies: library(vimcom) } < -The plugin will run R inside a Tmux session. If you are using Vim (not GVim), -you may be interested in reading |r-plugin-tmux| section to learn a few useful -shortcuts. The tmux.conf file created by the plugin sets Tmux to work with Vi -key bindings, as the escape character and also enables the mouse for -Tmux. - -Note: The plugin can use different mechanisms to send commands to R. The -mechanism that will be used depends on both what applications and plugins you -have installed and what options you have in your |vimrc|. The two lists below -show how the plugin will work on Linux in different conditions: - - Vim Condition~ - ------------------------------ ------------------------------------- - Screen plugin (Tmux) default on Linux - Screen plugin (GNU Screen) vimrplugin_tmux = 0 - Tmux (external terminal) vimrplugin_screenplugin = 0 - GNU Screen (external terminal) vimrplugin_screenplugin = 0 and - vimrplugin_tmux = 0 - - - GVim Condition~ - ------------------------------ ------------------------------------- - Tmux (external terminal) default on Linux - GNU Screen (external terminal) vimrplugin_tmux = 0 +If you start either GVim or Vim in a terminal emulator the plugin will start R +in a external terminal emulator. If you start Vim inside of a Tmux session, +the plugin will split the Tmux window in two and start R in the other pane. +Please, read the section |r-plugin-tmux|, especially the tip |r-plugin-tvim|. +If you don't want to read this entire document to find a few suggestions of +configuration of ~/.bashrc, ~/.tmux.conf and ~/.Rprofile, jump to +|r-plugin-quick-setup|. Note: On Mac OS X the plugin will use AppleScript in both Vim and GVim unless vimrplugin_applescript = 0. Some users have reported more luck with iTerm than @@ -244,7 +221,7 @@ to install external dependencies: 3. Install the Python version which corresponds to the version which Vim was linked against. In the example of step 2 (python27.dll) the required Python version is 2.7.x. - + * pywin32: http://sourceforge.net/projects/pywin32/ Note: The default download may not match the Python version Vim was @@ -287,10 +264,10 @@ may have to adjust the value of |vimrplugin_sleeptime|. Note: The is '\' by default. The plugin is a |file-type| plugin. It will be active only if you are editing -a .R or .Rnw file. The menu items and tool bar buttons will not be visible and -the key bindings will not be active while editing either unnamed files or -files with name extensions other than .R or .Rnw. If the plugin is active, -pressing rf should start R. +a .R, .Rnw, .Rd, Rmd, or Rrst file. The menu items and tool bar buttons will +not be visible and the key bindings will not be active while editing either +unnamed files or files with name extensions other than the mentioned above. If +the plugin is active, pressing rf should start R. Look at the ~/.vim (Linux, Unix, OS X) or ~/vimfiles (Windows) directory. Is there a subdirectory named "r-plugin"? If not, then you unpacked the plugin in @@ -476,7 +453,7 @@ Help (R) :Rhelp ----------------------------------------------------------- Please see |r-plugin-key-bindings| to learn how to customize the key bindings -without editing the plugin directly. +without editing the plugin directly. The plugin commands that send code to R Console are the most commonly used. If the code to be sent to R has a single line it is sent directly to R Console, @@ -653,8 +630,16 @@ requires the |+clientserver| feature to be automatically updated and the Note: On Linux you may find binaries without the |clientserver| feature if you install packages such as vim-nox on Debian/Ubuntu or vim-enhanced on Fedora/Red Hat. If you want to use Vim in a terminal emulator in Fedora/Red -Hat, you may want to create a symbolic link to "gvim" named "vim". - +Hat, you may want to create a symbolic link to "gvim" named "vim". You still +have to explicitly start the server with the argument |--servername|. To +avoid having to type this argument every time that you start Vim, you may put +in your ~/.bashrc: +> + if [ "x$DISPLAY" != "x" ] + then + alias vim='vim --servername VIM' + fi +< In the .GlobalEnv view, if an object has the attribute "label", it will also be displayed. Please, see the R help for package vimcom for some options to control the Object Browser behavior. In the Object Browser window, while in @@ -731,8 +716,27 @@ source code. 4.8. Tmux usage~ *r-plugin-tmux* -When running Vim in a terminal emulator (Linux/Unix only), the Vim-R-plugin -will use the screen.vim plugin to restart Vim and start R in a Tmux session. +When running either GVim or Vim in a terminal emulator (Linux/Unix only), the +Vim-R-plugin will use Tmux to start R in a separate terminal emulator. R will +be running inside a Tmux session, but you will hardly notice any difference +from R running directly in the terminal emulator. The remaining of this +section refers to the case of starting R when Vim already is in a Tmux +session. In this case, the terminal window is split in two regions: one for +Vim and the other for Tmux. Then, it's useful (but not required) to know some +Tmux commands. + *r-plugin-tvim* +If you always prefer to run Tmux before running Vim you may want to put in +your ~/.bashrc: +> + function tvim(){ tmux new-session "vim --servername VIM $@" ; } +< +Then you will be able to start Vim inside a Tmux session by typing: +> + tvim filename.R +< +The |--servername| argument is necessary for the automatic update of the +Object Browser. + The Tmux configuration file provided by the Vim-R-plugin configures Tmux to use vi key bindings. It also configures Tmux to react to mouse clicks. You should be able to switch the active pane by clicking on an inactive pane, to @@ -774,19 +778,14 @@ terminal emulator: > man tmux < -Note: was configured as the Tmux scape character, and it will not be +Note: was configured as the Tmux escape character, and it will not be passed to applications running under Tmux. To send to either R or Vim you have to type a. -With Tmux, you can the detach the Vim-R session and reattach it latter. This +With Tmux, you can detach the Vim-R session and reattach it latter. This is useful if you plan to begin the use the Vim-R-plugin in a machine and -latter move to another computer. However, normally you will get |E325|, caused -by the presence of a 'swapfile' (please, read the screen.vim plugin -documentation, especially the section |screen-gotchas| for details). This -problem will not happen if you start Vim from within a Tmux session, as in the -example below. - -A sample detachable session could be: +latter move to another computer and access remotely you previous Vim-R-plugin +session. - Create your ~/.tmux.conf if it does not exist yet. You may put the lines below in your ~/.tmux.conf as a starting point to your own configuration @@ -811,49 +810,13 @@ A sample detachable session could be: rf - Send code from Vim to R, and, then, detach Vim and R with d - The command will be d if you have not set as the scape + The command will be d if you have not set as the escape character in your ~/.tmux.conf. - Some time latter (even if accessing the machine remotely) reattach the Tmux session: tmux attach -See |vimrplugin_only_in_tmux| if you always prefer starting Tmux before -starting Vim, but sometimes forget to start Tmux. - -Note: The screen.vim plugin relies on the TERM environment variable starting -with the string "screen" to decide whether to start a new Tmux session or to -split the current one.  If you set the environment variable in your tmux.conf -to something different, the screen.vim plugin will not know that it is already -inside Tmux. See |screen-bootstrap| for details. - - -4.9. GNU Screen usage~ - *r-plugin-screen* -When running Vim in a terminal emulator (Linux/Unix only), the Vim-R-plugin -will use the screen.vim plugin to restart Vim and start R in a Tmux session. -However, the plugin will use GNU Screen if Tmux is not installed or if you -have set the value of vimrplugin_tmux = 0 in your |vimrc|. - -You may want to create your own ~/.screenrc to customize GNU Screen behavior -(see |vimrplugin_noscreenrc|). Below are the most useful key bindings to use -the Vim-R-plugin with the screenrc that the plugin creates: - - : Move the cursor to the next panel. - a : Decrease the height of the current panel. - z : Increase the height of the current panel. - [ : Enter the copy/scroll back mode. You can use , - and vi key bindings to move the cursor around - the panel. Press q to quit copy mode. - ] : Paste the content of GNU Screen paste buffer. - -While in the copy and scroll back mode, the following key bindings are very -useful: - - q : Quit the copy and scroll mode. - : Start text selection. - : Copy the selection to GNU Screen paste buffer. - ============================================================================== *r-plugin-known-bugs* @@ -927,12 +890,6 @@ do the tasks to avoid any risk of corrupting R's memory. It will tell Vim that expected again after any valid code is executed in the R Console. -5.6. Commands are sent twice on Mac OS X~ - -If you use the screen plugin with GNU Screen, individual lines may be sent -duplicated to R on Mac OS X. - - ============================================================================== *r-plugin-options* 6. Options~ @@ -957,10 +914,9 @@ duplicated to R on Mac OS X. |vimrplugin_routnotab| Show output of R CMD BATCH in new window |vimrplugin_indent_commented| Indent lines commented with the \xx command |vimrplugin_sleeptime| Delay while sending commands in MS Windows -|vimrplugin_noscreenrc| Do not write custom screenrc -|vimrplugin_screenplugin| Use the screen.vim plugin -|vimrplugin_screenvsplit| Split the window vertically (screen plugin) -|vimrplugin_tmux| Choose between Tmux and GNU Screen +|vimrplugin_rconsole_height| The number of lines of R Console (Tmux split) +|vimrplugin_vsplit| Make Tmux split the window vertically +|vimrplugin_rconsole_width| The number of columns of R Console (Tmux split) |vimrplugin_applescript| Use osascript in Mac OS X. |vimrplugin_listmethods| Do .vim.list.args() instead of args() |vimrplugin_specialplot| Do .vim.plot() instead of plot() @@ -984,18 +940,18 @@ duplicated to R on Mac OS X. *vimrplugin_term* The plugin uses the first terminal emulator that it finds in the following list: - 1. gnome-terminal, - 2. konsole, - 3. xfce4-terminal, - 4. iterm - 5. Eterm, - 6. rxvt, - 7. aterm, + 1. gnome-terminal, + 2. konsole, + 3. xfce4-terminal, + 4. iterm, + 5. Eterm, + 6. rxvt, + 7. aterm, 8. roxterm, 9. terminator, 10. xterm. -If Vim does not select your favorite terminal emulator, you may define it in +If Vim does not select your favorite terminal emulator, you may define it in your |vimrc| by setting the variable vimrplugin_term, as shown below: > let vimrplugin_term = "xterm" @@ -1106,7 +1062,7 @@ script. You can, for example, use rh to jump to another R help document. The valid values of vimrplugin_vimpager are: - + "tab" : Show the help document in a new tab. If there is already a tab with an R help document, use it. This is the default. @@ -1172,7 +1128,7 @@ set the value of |vimrplugin_buildwait| to a higher value. Example: *vimrplugin_routmorecolors* By default, the R commands in .Rout files are highlighted with the color of comments, and only the output of commands has some of its elements highlighted -(numbers, strings, index of vectors, warnings and errors). +(numbers, strings, index of vectors, warnings and errors). If you prefer that R commands in the R output are highlighted as they are in R scripts, put the following in your |vimrc|: @@ -1219,68 +1175,41 @@ example show how to adjust the value of sleeptime in your |vimrc|: let vimrplugin_sleeptime = 0.1 < -6.14. Tmux and Screen configuration (Linux/Unix only)~ - *vimrplugin_noscreenrc* +6.14. Tmux configuration (Linux/Unix only)~ *vimrplugin_notmuxconf* + GVim (or Vim running R in an external terminal emulator) runs Tmux with a -specially built configuration file. It also appends some arguments to -|g:ScreenShellTmuxInitArgs|. If you want to use your own ~/.tmux.conf and -|g:ScreenShellTmuxInitArgs|, put in your |vimrc|: +specially built configuration file. If you want to use your own ~/.tmux.conf, +put in your |vimrc|: > let vimrplugin_notmuxconf = 1 < -If you want to use your own ~/.screenrc, put in your vimrc: -> - let vimrplugin_noscreenrc = 1 -< If you opted for using your own configuration file, the plugin will write a minimum configuration which will set the value of two environment variables required for the communication with R and source your own configuration file -(either ~/.tmux.conf or ~/.screenrc). - - -6.15. Integration with screen.vim plugin (Linux/Unix only)~ - *vimrplugin_screenplugin* - *vimrplugin_screenvsplit* - *vimrplugin_tmux* - *vimrplugin_only_in_tmux* -The screen.vim plugin supports both GNU Screen and Tmux, but only Tmux allows -you to split the terminal vertically (that is, to have the panels side by -side). Please read |screen-intro| and |screen-shell-vertical| for details. By -default, the Vim-R-plugin will tell the screen.vim plugin to split the -terminal horizontally. If you prefer to split it vertically put in your -|vimrc|: -> - let vimrplugin_screenvsplit = 1 - let g:ScreenImpl = 'Tmux' -< -By default, when running in a terminal emulator, the Vim-R-plugin uses the -screen.vim plugin if it is installed and, by default, it will use Tmux instead -of GNU Screen. Tmux was chosen as default because it may split the terminal -vertically and its regions are easier to resize. If you want that the R -Console starts with a specific width, put in your |vimrc| your preferred value: -> - let g:ScreenShellWidth = 80 -< -If both GNU Screen and Tmux are installed but you prefer to use the GNU Screen -application, put in your |vimrc|: +(~/.tmux.conf). + + +6.15. Integration with Tmux (Linux/Unix only)~ + *vimrplugin_rconsole_height* + *vimrplugin_vsplit* + *vimrplugin_rconsole_width* +These three options are valid only when Vim is started inside a Tmux session. +In this case, when you type rf, the terminal will be split in two +regions and R will run in one of them. By default, the Vim-R-plugin will tell +Tmux to split the terminal window horizontally and you can set in your +|vimrc| the initial number of lines of the Tmux pane running R as in the +example below: > - let vimrplugin_tmux = 0 + let vimrplugin_rconsole_height = 15 < -Start Vim and do the command rf. The screen.vim plugin will split -the terminal in two regions and will run R in one of them. If you always -prefer to start Tmux before Vim (see |r-plugin-tmux|) you may want to set the -value of |vimrplugin_only_in_tmux| as below: +If you prefer to split it vertically: > - let vimrplugin_only_in_tmux = 1 + let vimrplugin_vsplit = 1 < -With the above option, the Vim-R-plugin will not start R if not running in a -Tmux session, and it will warn you about that. - -If you have the screen.vim plugin installed but prefer do not integrate it -with the Vim-R-plugin you will need to add the following to your |vimrc|: +In this case, you can choose the initial number of columns of R Console: > - let vimrplugin_screenplugin = 0 + let vimrplugin_rconsole_width = 15 < 6.16. Integration with AppleScript (OS X only)~ @@ -1295,7 +1224,6 @@ If you prefer to have R running in an external terminal emulator, put in your |vimrc|: > let vimrplugin_applescript = 0 - let vimrplugin_screenplugin = 0 < 6.17. Special R functions~ @@ -1377,8 +1305,8 @@ When one types in the R Console the cursor goes to the beginning of the line and one types the characters to the right of the cursor are deleted. This is useful to avoid characters left on the R Console being mixed with commands sent by Vim. However, sending may be problematic if using -either Tmux or GNU Screen in some systems. The Vim-R-plugin will add - to every command if you put in your |vimrc|: +either Tmux. The Vim-R-plugin will add to every command if you put +in your |vimrc|: > let vimrplugin_ca_ck = 1 < @@ -1450,7 +1378,7 @@ write R packages or Sweave files. For example, if is set to the The option vimrplugin_insert_mode_cmds disables commands in insert mode. To use it, add the following to your |vimrc|: > - let g:vimrplugin_insert_mode_cmds = 0 + let g:vimrplugin_insert_mode_cmds = 0 < The default value is 1, for consistency with earlier versions. @@ -1598,7 +1526,7 @@ its keybind you should put in your |vimrc| something as in the example: The plugin also contains a function called RAction which allows you to build ad-hoc commands to R. This function takes the name of an R function such as "levels" or "table" and the word under the cursor, and passes them to R as a -command. +command. For example, if your cursor is sitting on top of the object called gender and you call the RAction function, with an argument such as levels, Vim will pass @@ -1624,7 +1552,7 @@ and "levels" with the R function that you want to call. If the command that you want to send does not require an R object as argument, you can create a shortcut to it by following the example: > - map s :call SendCmdToR("search()") + map s :call g:SendCmdToR("search()") < See also: |vimrplugin_source|. @@ -1636,7 +1564,7 @@ See also: |vimrplugin_source|. The following files are part of the plugin and should be in your ~/.vim directory after the installation: - + autoload/rcomplete.vim bitmaps/RClearAll.bmp bitmaps/RClearAll.png @@ -1726,7 +1654,7 @@ We recommended the use of ShowMarks plugin which show what lines have marks defined. The plugin is available at: http://www.vim.org/scripts/script.php?script_id=152 - + This plugin makes it possible to visually manage your marks. You may want to add the following two lines to your |vimrc| to customize ShowMarks behavior: > @@ -1946,7 +1874,7 @@ Do you have many Rnoweb files included in a master tex or Rnoweb file and use a Makefile to build the pdf? You may consider it useful to put the following line in your |vimrc|: > - nmap sm :update:call SendCmdToR('system("make")') + nmap sm :update:call g:SendCmdToR('system("make")') < 9.15. Edit your ~/.Rprofile~ @@ -2048,7 +1976,7 @@ If you are using knitr with option cache=TRUE, you may want from time to time to delete all objects in R workspace and all files in the cache directory. If you want to use kr in Normal mode for this, put in your |vimrc|: > - nmap kr :call SendCmdToR('rm(list=ls(all.names=TRUE)); unlink("cache/*")') + nmap kr :call g:SendCmdToR('rm(list=ls(all.names=TRUE)); unlink("cache/*")') < When generating pdfs out of Rmd-files, you can send options to pandoc. State them in your vimrc. For example @@ -2057,140 +1985,101 @@ them in your vimrc. For example will produce a german document with a table of contents. -9.20. Start Tmux and Vim at once~ -If you always prefer to run Tmux before running Vim you may want to put in -your ~/.bashrc: -> - function tvim(){ tmux new-session "vim $@" ; } -< -Then you will be able to start Vim inside a Tmux session by typing: -> - tvim filename.R -< +9.20. Integration with LaTeX-Box~ + *r-plugin-latex-box* +LaTeX-Box does not automatically recognize Rnoweb files as a valid LaTeX file. +You have to tell LaTeX-BoX that the .tex file compiled by either knitr() or +Sweave() is the main LaTeX file. You can do this in two ways. Suppose that +your Rnoweb file is called report.Rnw... You can: -9.21. Integration with the Conque Shell plugin~ - *r-plugin-conque* -In addition to being integrated with the screen.vim plugin the Vim-R-plugin -can also use the Conque Shell plugin, but the Conque Shell still has some -important bugs and Vim has limitations that make the use of Conque Shell not -fully satisfying. The most important bug of Conque Shell is that it sometimes -do not show the complete output of an R command. This problem happens more -frequently when there are non ascii characters in the output. The two most -important Vim limitations are: + (1) Create an empty file called "report.tex.latexmain". - - We cannot scroll the windows of a buffer that is not being edited and, - thus, we have to go to the R Console buffer to scroll it. This is a - problem if we are running an R command that slowly generates a lot of - output because the shell buffer does not scroll when there is new output - but it is not the currently active buffer. + or - - Vim does not have a timer which would make the Conque Shell more - efficient. Vim uses the same variable, 'updatetime', to do both save swap - files and trigger |CursorHold| events. + (2) Put in the first 5 lines of report.Rnw: -These limitations will be solved only if someone with good knowledge of C -programming writes patches to Vim source code and the patches are accepted by -the Vim developer. + % For LaTeX-Box: root = report.tex -In addition to these two limitations, the automatic update of the Object -Browser is disabled when Conque Shell is active because the cursor placement -becomes unstable. Anyway, if you want to try the Conque Shell, install it from +Of course you must run either knitr() or Sweave() before trying LaTeX-Box +omnicompletion. Please, read LaTeX-Box documentation for more information. - http://www.vim.org/scripts/script.php?script_id=2771 +See also: |vimrplugin_latexcmd|. -do not load the R package "colorout", and put in your |vimrc|: -> - let vimrplugin_ca_ck = 0 - let vimrplugin_applescript = 0 - let vimrplugin_screenplugin = 0 - let vimrplugin_conqueplugin = 1 -< -You may also want to put the following Conque options in your |vimrc| (look at -the Conque Shell documentations for details): -> - let ConqueTerm_CWInsert = 1 - let ConqueTerm_Color = 0 - let ConqueTerm_ReadUnfocused = 1 -< -By default, the window will be split horizontally. Put the following in your -|vimrc| if you prefer to split the window vertically: -> - let vimrplugin_conquevsplit = 1 -< -You may also need to change the time that the Conque Shell waits for R output. -After a command is sent to the Conque buffer, the Conque Shell plugin waits -100 milliseconds (on Linux) or 200 milliseconds (on Windows) before reading -R's output. Longer values for the waiting time will increase the chances that -the output of R commands will be immediately shown in the R Console. To set a -different waiting time, change the value of vimrplugin_conquesleep in your -|vimrc| as in the example: -> - let vimrplugin_conquesleep = 300 -< -To manually scroll the R Console buffer, put the following in your |vimrc| -(replace with your preferred key): -> - nmap :call RScrollTerm() -< -Then, you will be able to scroll the R Console buffer at any time by pressing the - key in Normal mode. Of course, you should replace with your -preferred key. -The same highlighting scheme used for .Rout files is applied to the R Console -when using the Conque Shell plugin to run R inside a Vim's buffer. For one -hand, we do not need to highlight R commands in the Console if they were sent -by the plugin from an R script buffer since we have the code highlighted in -the script buffer and in the Console we want to pay attention to the output. A -too colorful highlighting scheme would be distracting. On the other hand, if -we were typing commands directly in the Console it would be beneficial to have -the R syntax highlighted. +9.21. Quick setup for the Vim-R-plugin on Linux/Unix environment~ + *r-plugin-quick-setup* +Please, look at section |r-plugin-options| if you want information about the +Vim-r-plugin customization. +Here are some suggestions of configuration of Bash, Tmux and R. To understand +what you are doing, and change the configuration to your taste, please read +this document from the beginning. -9.22. Integration with vimshell~ - *r-plugin-vimshell* -Vimshell is still under development, but if you want to integrate it with the -Vim-R-plugin, put in your |vimrc|: + ~/.bashr:~ > - let vimrplugin_screenplugin = 0 - let vimrplugin_ca_ck = 0 - let vimrplugin_applescript = 0 - let vimrplugin_vimshell = 1 + if [ "x$DISPLAY" == "x" ] + then + function tvim(){ tmux new-session "vim $@" ; } + else + alias vim='vim --servername VIM' + function tvim(){ tmux -2 new-session "TERM=screen-256color vim --servername VIM $@" ; } + fi < -If you want the automatic updating of the Object Browser even if running Vim -in a terminal emulator, you have to start Vim with the |--servername| -argument. Example: + ~/.tmux.conf:~ > - vim --servername OBJBR file.R + set-option -g prefix C-a + unbind-key C-b + bind-key C-a send-prefix + set -g status off + set-window-option -g mode-keys vi + set -g terminal-overrides 'xterm*:smcup@:rmcup@' + set -g mode-mouse on + set -g mouse-select-pane on + set -g mouse-resize-pane on +< + ~/.Rprofile~ +> + if(interactive()){ + options(setwidth.verbose = 1, + colorout.verbose = 1, + vimcom.verbose = 1, + vimcom.allnames = FALSE, + vimcom.texerrs = TRUE, + pager = "vim -c 'set ft=rdoc' -") + if(nchar(Sys.getenv("DISPLAY")) > 1) + options(editor = 'gvim -f -c "set ft=r"') + else + options(editor = 'vim -c "set ft=r"') + library(colorout) + if(Sys.getenv("TERM") != "linux" && Sys.getenv("TERM") != "") + setOutputColors256(verbose = FALSE) + library(setwidth) + if(Sys.getenv("VIMRPLUGIN_TMPDIR") != "") + library(vimcom) + } < -9.23. Integration with LaTeX-Box~ - *r-plugin-latex-box* -LaTeX-Box does not automatically recognize Rnoweb files as a valid LaTeX file. -You have to tell LaTeX-BoX that the .tex file compiled by either knitr() or -Sweave() is the main LaTeX file. You can do this in two ways. Suppose that -your Rnoweb file is called report.Rnw... You can: - - (1) Create an empty file called "report.tex.latexmain". - - or - - (2) Put in the first 5 lines of report.Rnw: - - % For LaTeX-Box: root = report.tex +9.22. Integragion with GNU Screen, screen plugin, Conque Shell or VimShell~ -Of course you must run either knitr() or Sweave() before trying LaTeX-Box -omnicompletion. Please, read LaTeX-Box documentation for up-to-date -information: |latex-box-FAQ|. +The plugin used to be able to use GNU Screen (through screen plugin), Conque +Shell or VimShell. This integration was removed on August 20, 2013. People +wanting this integration back into the plugin may want to use the old +Vim-R-plugin code as a starting point to create scripts to be sourced by the +Vim-R-plugin. Please look at |vimrplugin_source| for details. ============================================================================== *r-plugin-news* 10. News~ -0.9.9.4 (2013-08-13) +0.9.9.4 (2013-08-18) * Minor bug fixes. + * The support to GNU Screen, VimShell and Conque Shell was dropped. The + screen plugin no longer is used. + * New options: vimrplugin_vsplit, vimrplugin_rconsole_height and + vimrplugin_rconsole_width. 0.9.9.3 (2013-04-11) diff --git a/ftplugin/r.vim b/ftplugin/r.vim index 8a9f26c..9e26aa7 100644 --- a/ftplugin/r.vim +++ b/ftplugin/r.vim @@ -90,7 +90,7 @@ function! RSpin() update let b:needsnewomnilist = 1 call RSetWD() - call SendCmdToR('require(knitr); spin("' . expand("%:t") . '")') + call g:SendCmdToR('require(knitr); spin("' . expand("%:t") . '")') endfunction "========================================================================== diff --git a/ftplugin/rbrowser.vim b/ftplugin/rbrowser.vim index 68fe817..e862d0d 100644 --- a/ftplugin/rbrowser.vim +++ b/ftplugin/rbrowser.vim @@ -43,10 +43,6 @@ setlocal buftype=nofile setlocal nowrap setlocal iskeyword=@,48-57,_,. -if g:vimrplugin_tmux && g:vimrplugin_screenplugin - let showmarks_enable = 0 -endif - if !exists("g:rplugin_hasmenu") let g:rplugin_hasmenu = 0 endif @@ -98,7 +94,9 @@ function! UpdateOB(what) if !exists("curcol") let curcol = 1 endif + let save_unnamed_reg = @@ sil normal! ggdG + let @@ = save_unnamed_reg if wht == "GlobalEnv" call setline(1, ".GlobalEnv | Libraries") exe "silent read " . g:rplugin_esc_tmpdir . "/object_browser" @@ -360,7 +358,7 @@ function! OBSendDeleteCmd(cmd) if exists("*RBrSendToR") call RBrSendToR(a:cmd) else - call SendCmdToR(a:cmd) + call g:SendCmdToR(a:cmd) endif if g:rplugin_curview == "GlobalEnv" Py SendToVimCom("\003GlobalEnv [OBSendDeleteCmd]") diff --git a/ftplugin/rmd.vim b/ftplugin/rmd.vim index 1ce108c..48ed068 100644 --- a/ftplugin/rmd.vim +++ b/ftplugin/rmd.vim @@ -125,7 +125,7 @@ function! RMakeHTMLrmd(t) if g:vimrplugin_openhtml && a:t == "html" let rcmd = rcmd . '; browseURL("' . expand("%:r:t") . '.html")' endif - call SendCmdToR(rcmd) + call g:SendCmdToR(rcmd) endfunction function! RMakePDFrmd(t) @@ -161,7 +161,7 @@ function! RMakePDFrmd(t) endif let pdfcmd = pdfcmd . ")" let b:needsnewomnilist = 1 - call SendCmdToR(pdfcmd) + call g:SendCmdToR(pdfcmd) endfunction " Send Rmd chunk to R diff --git a/ftplugin/rnoweb.vim b/ftplugin/rnoweb.vim index bdd7359..a1e5427 100644 --- a/ftplugin/rnoweb.vim +++ b/ftplugin/rnoweb.vim @@ -35,10 +35,6 @@ runtime ftplugin/tex_latexSuite.vim runtime ftplugin/tex_LatexBox.vim setlocal iskeyword=@,48-57,_,. -" Enable syntax highlight of LaTeX errors in R Console (if using Conque -" Shell) -let syn_rout_latex = 1 - " Source scripts common to R, Rnoweb, Rhelp and Rdoc: runtime r-plugin/common_global.vim if exists("g:rplugin_failed") @@ -151,7 +147,7 @@ function! RMakePDF(bibtex, knit) let pdfcmd = pdfcmd . ")" let b:needsnewomnilist = 1 - let ok = SendCmdToR(pdfcmd) + let ok = g:SendCmdToR(pdfcmd) if ok == 0 return endif @@ -182,9 +178,9 @@ function! RSweave() let b:needsnewomnilist = 1 call RSetWD() if exists("g:vimrplugin_sweaveargs") - call SendCmdToR('Sweave("' . expand("%:t") . '", ' . g:vimrplugin_sweaveargs . ')') + call g:SendCmdToR('Sweave("' . expand("%:t") . '", ' . g:vimrplugin_sweaveargs . ')') else - call SendCmdToR('Sweave("' . expand("%:t") . '")') + call g:SendCmdToR('Sweave("' . expand("%:t") . '")') endif endfunction @@ -221,9 +217,9 @@ function! ROpenPDF() if g:rplugin_pdfviewer == "none" if g:vimrplugin_openpdf_quietly - call SendCmdToR('vim.openpdf("' . expand("%:p:r") . ".pdf" . '", TRUE)') + call g:SendCmdToR('vim.openpdf("' . expand("%:p:r") . ".pdf" . '", TRUE)') else - call SendCmdToR('vim.openpdf("' . expand("%:p:r") . ".pdf" . '")') + call g:SendCmdToR('vim.openpdf("' . expand("%:p:r") . ".pdf" . '")') endif else let openlog = system(g:rplugin_pdfviewer . " '" . expand("%:p:r") . ".pdf" . "'") diff --git a/ftplugin/rrst.vim b/ftplugin/rrst.vim index a1f09ff..365886d 100644 --- a/ftplugin/rrst.vim +++ b/ftplugin/rrst.vim @@ -125,7 +125,7 @@ function! RMakeHTMLrrst(t) let rcmd = rcmd . '; browseURL("' . expand("%:r:t") . '.html")' endif let b:needsnewomnilist = 1 - call SendCmdToR(rcmd) + call g:SendCmdToR(rcmd) endfunction function! RMakePDFrrst() @@ -163,7 +163,7 @@ function! RMakePDFrrst() endif let pdfcmd = pdfcmd . ")" let b:needsnewomnilist = 1 - let ok = SendCmdToR(pdfcmd) + let ok = g:SendCmdToR(pdfcmd) if ok == 0 return endif diff --git a/r-plugin/common_buffer.vim b/r-plugin/common_buffer.vim index fae9fd1..c0384ee 100644 --- a/r-plugin/common_buffer.vim +++ b/r-plugin/common_buffer.vim @@ -25,7 +25,7 @@ " Set completion with CTRL-X CTRL-O to autoloaded function. if exists('&ofu') - setlocal ofu=rcomplete#CompleteR + setlocal ofu=rcomplete#CompleteR endif " Automatically rebuild the file listing .GlobalEnv objects for omni @@ -39,37 +39,33 @@ let b:rplugin_extern_ob = 0 " Set the name of the Object Browser caption if not set yet let s:tnr = tabpagenr() if !exists("b:objbrtitle") - if s:tnr == 1 - let b:objbrtitle = "Object_Browser" - else - let b:objbrtitle = "Object_Browser" . s:tnr - endif - unlet s:tnr + if s:tnr == 1 + let b:objbrtitle = "Object_Browser" + else + let b:objbrtitle = "Object_Browser" . s:tnr + endif + unlet s:tnr endif " Initialize some local variables if Conque shell was already started if exists("g:rplugin_objbrtitle") - if g:vimrplugin_conqueplugin - let b:conqueshell = g:rplugin_conqueshell - let b:conque_bufname = g:rplugin_conque_bufname - endif - let b:objbrtitle = g:rplugin_objbrtitle + let b:objbrtitle = g:rplugin_objbrtitle endif " Make the file name of files to be sourced let b:bname = expand("%:t") let b:bname = substitute(b:bname, " ", "", "g") if exists("*getpid") " getpid() was introduced in Vim 7.1.142 - let b:rsource = $VIMRPLUGIN_TMPDIR . "/Rsource-" . getpid() . "-" . b:bname + let b:rsource = $VIMRPLUGIN_TMPDIR . "/Rsource-" . getpid() . "-" . b:bname else - let b:randnbr = system("echo $RANDOM") - let b:randnbr = substitute(b:randnbr, "\n", "", "") - if strlen(b:randnbr) == 0 - let b:randnbr = "NoRandom" - endif - let b:rsource = $VIMRPLUGIN_TMPDIR . "/Rsource-" . b:randnbr . "-" . b:bname - unlet b:randnbr + let b:randnbr = system("echo $RANDOM") + let b:randnbr = substitute(b:randnbr, "\n", "", "") + if strlen(b:randnbr) == 0 + let b:randnbr = "NoRandom" + endif + let b:rsource = $VIMRPLUGIN_TMPDIR . "/Rsource-" . b:randnbr . "-" . b:bname + unlet b:randnbr endif unlet b:bname @@ -83,3 +79,7 @@ endif let g:rplugin_lastft = &filetype +if !exists("g:SendCmdToR") + let g:SendCmdToR = function('SendCmdToR_fake') +endif + diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 8db21fc..b43cf03 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -14,7 +14,7 @@ "========================================================================== " Authors: Jakson Alves de Aquino " Jose Claudio Faria -" +" " Purposes of this file: Create all functions and commands and set the " value of all global variables and some buffer variables.for r, " rnoweb, rhelp, rdoc, and rbrowser files @@ -78,7 +78,9 @@ function ReplaceUnderS() let j = col(".") let s = getline(".") if g:vimrplugin_assign_map == "_" && j > 3 && s[j-3] == "<" && s[j-2] == "-" && s[j-1] == " " + let save_unnamed_reg = @@ exe "normal! 3h3xr_" + let @@ = save_unnamed_reg return endif let isString = 0 @@ -256,7 +258,7 @@ function RCompleteArgs() " If R isn't running, use the prebuilt list of objects for omniL in flines - if omniL =~ rkeyword && omniL =~ "\x06function\x06function\x06" + if omniL =~ rkeyword && omniL =~ "\x06function\x06function\x06" let tmp1 = split(omniL, "\x06") if len(tmp1) < 5 return '' @@ -580,44 +582,109 @@ function GoDown() endwhile endfunction -function RWriteScreenRC() - let scrcnf = $VIMRPLUGIN_TMPDIR . "/" . g:rplugin_screensname . ".screenrc" +" Adapted from screen plugin: +function TmuxActivePane() + let line = system('tmux list-panes | grep "(active)$"') + let paneid = matchstr(line, '\v\%\d+ \(active\)') + if !empty(paneid) + return matchstr(paneid, '\v^\%\d+') + else + return matchstr(line, '\v^\d+') + endif +endfunction + +function StartR_TmuxSplit(rcmd) + call system("tmux set-environment -g VIMRPLUGIN_TMPDIR " . g:rplugin_esc_tmpdir) + call system("tmux set-environment VIMINSTANCEID " . $VIMINSTANCEID) + let vimpane = TmuxActivePane() + if g:vimrplugin_vsplit + if g:vimrplugin_rconsole_width == -1 + let rlog = system("tmux split-window -h -v '" . a:rcmd . "'") + else + let rlog = system("tmux split-window -h -l " . g:vimrplugin_rconsole_width . " -v '" . a:rcmd . "'") + endif + else + let rlog = system("tmux split-window -l " . g:vimrplugin_rconsole_height . " -v '" . a:rcmd . "'") + endif + if v:shell_error + call RWarningMsg(rlog) + return + endif + let g:rplugin_rconsole_pane = TmuxActivePane() + let rlog = system("tmux select-pane -t " . vimpane) + if v:shell_error + call RWarningMsg(rlog) + return + endif + let g:SendCmdToR = function('SendCmdToR_TmuxSplit') +endfunction + + +function StartR_ExternalTerm(rcmd) + if $DISPLAY == "" + call RWarningMsg("The X Window system is required to run R in an external terminal.") + return + endif - if g:vimrplugin_noscreenrc + " Create a custom tmux.conf + if g:vimrplugin_notmuxconf let cnflines = [ - \ 'setenv VIMRPLUGIN_TMPDIR "' . $VIMRPLUGIN_TMPDIR . '"', - \ 'setenv VIMINSTANCEID ' . $VIMINSTANCEID , - \ 'source ~/.screenrc'] + \ 'set-environment -g VIMRPLUGIN_TMPDIR ' . g:rplugin_esc_tmpdir, + \ 'set-environment VIMINSTANCEID ' . $VIMINSTANCEID, + \ 'source-file ~/.tmux.conf' ] else - if g:vimrplugin_screenplugin - let cnflines = [ - \ 'msgwait 0', - \ 'vbell off', - \ 'setenv VIMRPLUGIN_TMPDIR "' . $VIMRPLUGIN_TMPDIR . '"', - \ 'setenv VIMINSTANCEID ' . $VIMINSTANCEID , - \ 'startup_message off', - \ 'bind a resize +1', - \ 'bind z resize -1', - \ "termcapinfo xterm* 'ti@:te@'"] - if $DISPLAY != "" || $TERM =~ "xterm" - let cnflines = cnflines + [ - \ "terminfo rxvt-unicode 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm'", - \ 'term screen-256color'] - endif + let cnflines = [ + \ 'set-option -g prefix C-a', + \ 'unbind-key C-b', + \ 'bind-key C-a send-prefix', + \ 'set-window-option -g mode-keys vi', + \ 'set -g status off', + \ "set -g terminal-overrides 'xterm*:smcup@:rmcup@'", + \ 'set-environment -g VIMRPLUGIN_TMPDIR "' . $VIMRPLUGIN_TMPDIR . '"', + \ 'set-environment VIMINSTANCEID "' . $VIMINSTANCEID . '"'] + if g:vimrplugin_external_ob || !has("gui_running") + let cnflines = extend(cnflines, ['set -g mode-mouse on', 'set -g mouse-select-pane on', 'set -g mouse-resize-pane on']) + endif + endif + call writefile(cnflines, s:tmxcnf) + let rcmd = "VIMINSTANCEID=" . $VIMINSTANCEID . " " . a:rcmd + call system('export VIMRPLUGIN_TMPDIR=' . $VIMRPLUGIN_TMPDIR) + call system('export VIMINSTANCEID=' . $VIMINSTANCEID) + " Start the terminal emulator even if inside a Tmux session + if $TMUX != "" + let tmuxenv = $TMUX + let $TMUX = "" + call system('tmux set-option -ga update-environment " TMUX_PANE VIMRPLUGIN_TMPDIR VIMINSTANCEID"') + endif + let tmuxcnf = '-f "' . s:tmxcnf . '"' + if $DISPLAY == "" + call RWarningMsg("The X Window system is required to run R in an external terminal.") + return + endif + call system("tmux has-session -t " . g:rplugin_screensname) + if v:shell_error + if g:rplugin_termcmd =~ "gnome-terminal" || g:rplugin_termcmd =~ "xfce4-terminal" || g:rplugin_termcmd =~ "terminal" || g:rplugin_termcmd =~ "iterm" + let opencmd = printf("%s 'tmux -2 %s new-session -s %s \"%s\"' &", g:rplugin_termcmd, tmuxcnf, g:rplugin_screensname, rcmd) else - let scrtitle = 'hardstatus string "' . expand("%:t") . '"' - - let cnflines = ["msgwait 1", - \ "hardstatus lastline", - \ scrtitle, - \ "caption splitonly", - \ 'caption string "Vim-R-plugin"', - \ "termcapinfo xterm* 'ti@:te@'", - \ 'vbell off'] + let opencmd = printf("%s tmux -2 %s new-session -s %s \"%s\" &", g:rplugin_termcmd, tmuxcnf, g:rplugin_screensname, rcmd) + endif + else + if g:rplugin_termcmd =~ "gnome-terminal" || g:rplugin_termcmd =~ "xfce4-terminal" || g:rplugin_termcmd =~ "terminal" || g:rplugin_termcmd =~ "iterm" + let opencmd = printf("%s 'tmux -2 %s attach-session -d -t %s' &", g:rplugin_termcmd, tmuxcnf, g:rplugin_screensname) + else + let opencmd = printf("%s tmux -2 %s attach-session -d -t %s &", g:rplugin_termcmd, tmuxcnf, g:rplugin_screensname) endif endif - call writefile(cnflines, scrcnf) - return ' -c "' . scrcnf . '"' + + let rlog = system(opencmd) + if v:shell_error + call RWarningMsg(rlog) + return + endif + if exists("tmuxenv") + let $TMUX = tmuxenv + endif + let g:SendCmdToR = function('SendCmdToR_Term') endfunction " Start R @@ -657,17 +724,21 @@ function StartR(whatr) call RWarningMsg(rlog) endif lcd - + let g:SendCmdToR = function('SendCmdToR_OSX') return endif if has("win32") || has("win64") - if g:vimrplugin_conqueplugin || g:vimrplugin_vimshell - let b:rplugin_R = "Rterm.exe" - else - Py StartRPy() - lcd - - return - endif + Py StartRPy() + lcd - + let g:SendCmdToR = function('SendCmdToR_Windows') + return + endif + + if g:vimrplugin_only_in_tmux && $TMUX_PANE == "" + call RWarningMsg("Not inside Tmux.") + lcd - + return endif if b:rplugin_r_args == " " @@ -676,191 +747,10 @@ function StartR(whatr) let rcmd = b:rplugin_R . " " . b:rplugin_r_args endif - " Create a custom tmux.conf - if g:vimrplugin_tmux - if g:vimrplugin_notmuxconf - let cnflines = [ - \ 'set-environment -g VIMRPLUGIN_TMPDIR ' . g:rplugin_esc_tmpdir, - \ 'set-environment VIMINSTANCEID ' . $VIMINSTANCEID, - \ 'source-file ~/.tmux.conf' ] - else - let cnflines = [ - \ 'set-option -g prefix C-a', - \ 'unbind-key C-b', - \ 'bind-key C-a send-prefix', - \ 'set-window-option -g mode-keys vi', - \ 'set -g status off', - \ "set -g terminal-overrides 'xterm*:smcup@:rmcup@'", - \ 'set-environment -g VIMRPLUGIN_TMPDIR "' . $VIMRPLUGIN_TMPDIR . '"', - \ 'set-environment VIMINSTANCEID "' . $VIMINSTANCEID . '"'] - if g:vimrplugin_external_ob || !has("gui_running") - let cnflines = extend(cnflines, ['set -g mode-mouse on', 'set -g mouse-select-pane on', 'set -g mouse-resize-pane on']) - endif - endif - call writefile(cnflines, s:tmxcnf) - endif - - if g:vimrplugin_screenplugin - if g:vimrplugin_only_in_tmux && g:vimrplugin_tmux && $TMUX_PANE == "" - call RWarningMsg("Not inside Tmux.") - return - endif - - if $TERM =~ "screen" - if g:vimrplugin_tmux - call system("tmux set-environment -g VIMRPLUGIN_TMPDIR " . g:rplugin_esc_tmpdir) - call system("tmux set-environment VIMINSTANCEID " . $VIMINSTANCEID) - else - let rcmd = 'VIMRPLUGIN_TMPDIR="' . $VIMRPLUGIN_TMPDIR . '" VIMINSTANCEID=' . $VIMINSTANCEID . " " . rcmd - endif - endif - let g:rplugin_rcmd = rcmd - if g:vimrplugin_tmux == 0 && g:vimrplugin_noscreenrc == 0 && exists("g:ScreenShellScreenInitArgs") - let g:ScreenShellScreenInitArgs = RWriteScreenRC() - endif - if g:vimrplugin_screenvsplit - if exists(":ScreenShellVertical") == 2 - exec 'ScreenShellVertical ' . rcmd - else - call RWarningMsgInp("Did you put \"let g:ScreenImpl = 'Tmux'\" in your vimrc?") - exec 'ScreenShell ' . rcmd - endif - else - exec 'ScreenShell ' . rcmd - endif - elseif g:vimrplugin_vimshell - if has("win32") || has("win64") - exe "VimShellInteractive " . rcmd . " --ess" - else - exe "VimShellInteractive " . rcmd - endif - lcd - - return - elseif g:vimrplugin_conqueplugin - if exists("b:conque_bufname") - if bufloaded(substitute(b:conque_bufname, "\\", "", "g")) - call RWarningMsg("This buffer already has a Conque Shell.") - lcd - - return - endif - endif - - if exists("g:ConqueTerm_BufName") && bufloaded(substitute(g:ConqueTerm_BufName, "\\", "", "g")) - call RWarningMsg("This Vim instance already has a Conque Shell.") - lcd - - return - endif - - let savesb = &switchbuf - let savewd = &autochdir - set noautochdir - set switchbuf=useopen,usetab - if g:vimrplugin_conquevsplit == 1 - let l:sr = &splitright - set splitright - let b:conqueshell = conque_term#open(rcmd, ['vsplit'], 1) - let &splitright = l:sr - else - let b:conqueshell = conque_term#open(rcmd, ['belowright split'], 1) - endif - - if b:conqueshell['idx'] == 1 - let b:objbrtitle = "Object_Browser" - else - let b:objbrtitle = "Object_Browser" . b:conqueshell['idx'] - endif - let b:conque_bufname = g:ConqueTerm_BufName - - " Copy the values of some local variables that will be inherited - let g:tmp_conqueshell = b:conqueshell - let g:tmp_conque_bufname = b:conque_bufname - let g:tmp_objbrtitle = b:objbrtitle - - exe "sil noautocmd sb " . b:conque_bufname - - " Inheritance of some local variables - let b:conqueshell = g:tmp_conqueshell - let b:conque_bufname = g:tmp_conque_bufname - let b:objbrtitle = g:tmp_objbrtitle - - let g:rplugin_conqueshell = b:conqueshell - let g:rplugin_conque_bufname = b:conque_bufname - let g:rplugin_objbrtitle = b:objbrtitle - - unlet g:tmp_conqueshell - unlet g:tmp_conque_bufname - unlet g:tmp_objbrtitle - - setlocal syntax=rout - exe "sil noautocmd sb " . g:rplugin_curbuf - exe "set switchbuf=" . savesb - if savewd - set autochdir - else - set noautochdir - endif + if g:rplugin_tmuxwasfirst + call StartR_TmuxSplit(rcmd) else - " External terminal emulator - if $DISPLAY == "" - call RWarningMsg("The X Window system is required to run R in an external terminal.") - lcd - - return - endif - - if g:vimrplugin_tmux - let rcmd = "VIMINSTANCEID=" . $VIMINSTANCEID . " " . rcmd - call system('export VIMRPLUGIN_TMPDIR=' . $VIMRPLUGIN_TMPDIR) - call system('export VIMINSTANCEID=' . $VIMINSTANCEID) - " Start the terminal emulator even if inside a Tmux session - if $TMUX != "" - let tmuxenv = $TMUX - let $TMUX = "" - call system('tmux set-option -ga update-environment " TMUX_PANE VIMRPLUGIN_TMPDIR VIMINSTANCEID"') - endif - let tmuxcnf = '-f "' . s:tmxcnf . '"' - if $DISPLAY == "" - call RWarningMsg("The X Window system is required to run R in an external terminal.") - lcd - - return - endif - call system("tmux has-session -t " . g:rplugin_screensname) - if v:shell_error - if g:rplugin_termcmd =~ "gnome-terminal" || g:rplugin_termcmd =~ "xfce4-terminal" || g:rplugin_termcmd =~ "terminal" || g:rplugin_termcmd =~ "iterm" - let opencmd = printf("%s 'tmux -2 %s new-session -s %s \"%s\"' &", g:rplugin_termcmd, tmuxcnf, g:rplugin_screensname, rcmd) - else - let opencmd = printf("%s tmux -2 %s new-session -s %s \"%s\" &", g:rplugin_termcmd, tmuxcnf, g:rplugin_screensname, rcmd) - endif - else - if g:rplugin_termcmd =~ "gnome-terminal" || g:rplugin_termcmd =~ "xfce4-terminal" || g:rplugin_termcmd =~ "terminal" || g:rplugin_termcmd =~ "iterm" - let opencmd = printf("%s 'tmux -2 %s attach-session -d -t %s' &", g:rplugin_termcmd, tmuxcnf, g:rplugin_screensname) - else - let opencmd = printf("%s tmux -2 %s attach-session -d -t %s &", g:rplugin_termcmd, tmuxcnf, g:rplugin_screensname) - endif - endif - else - if !executable("screen") - call RWarningMsgInp("The value of vimrplugin_tmux = 0 but the GNU Screen application was not found.") - lcd - - return - endif - let scrrc = RWriteScreenRC() - " Some terminals want quotes (see screen.vim) - if g:rplugin_termcmd =~ "gnome-terminal" || g:rplugin_termcmd =~ "xfce4-terminal" || g:rplugin_termcmd =~ "terminal" || g:rplugin_termcmd =~ "iterm" - let opencmd = printf("%s 'screen %s -d -RR -S %s %s' &", g:rplugin_termcmd, scrrc, g:rplugin_screensname, rcmd) - else - let opencmd = printf("%s screen %s -d -RR -S %s %s &", g:rplugin_termcmd, scrrc, g:rplugin_screensname, rcmd) - endif - endif - - let rlog = system(opencmd) - if v:shell_error - call RWarningMsg(rlog) - lcd - - return - endif - if exists("tmuxenv") - let $TMUX = tmuxenv - endif + call StartR_ExternalTerm(rcmd) endif " Go back to original directory: @@ -868,9 +758,7 @@ function StartR(whatr) echon endfunction -function StartObjectBrowser() - if g:vimrplugin_tmux && (g:vimrplugin_screenplugin || g:vimrplugin_external_ob) - +function StartObjBrowser_Tmux() if b:rplugin_extern_ob " This is the Object Browser let g:rplugin_running_objbr = 0 @@ -888,14 +776,10 @@ function StartObjectBrowser() sleep 250m let objbrowserfile = $VIMRPLUGIN_TMPDIR . "/objbrowserInit" - if exists("g:ScreenShellSession") - let tmxs = " -S " . g:ScreenShellSession . " " - else - let tmxs = " " - endif + let tmxs = " " if !exists("g:rplugin_edpane") - if g:vimrplugin_screenplugin == 0 + if g:rplugin_tmuxwasfirst == 0 let g:rplugin_edpane = "none" else let g:rplugin_edpane = $TMUX_PANE @@ -942,6 +826,7 @@ function StartObjectBrowser() \ 'let g:rplugin_edpane = "' . g:rplugin_edpane . '"', \ 'let g:rplugin_rpane = "' . g:rplugin_rpane . '"', \ 'let b:objbrtitle = "' . b:objbrtitle . '"', + \ 'let showmarks_enable = 0', \ 'let g:rplugin_screensname = "' . g:rplugin_screensname . '"', \ 'let b:rscript_buffer = "' . bufname("%") . '"', \ 'set filetype=rbrowser', @@ -953,7 +838,9 @@ function StartObjectBrowser() \ 'set noruler', \ 'let curline = line(".")', \ 'let curcol = col(".")', + \ 'let save_unnamed_reg = @@', \ 'normal! ggdG', + \ 'let @@ = save_unnamed_reg', \ 'setlocal nomodified', \ 'call cursor(curline, curcol)', \ 'exe "PyFile " . substitute(g:rplugin_home, " ", '. "'\\\\ '" . ', "g") . "/r-plugin/vimcom.py"', @@ -1045,24 +932,22 @@ function StartObjectBrowser() endif return endif +endfunction +function StartObjBrowser_Vim() let wmsg = "" - if g:vimrplugin_conqueplugin - let wmsg = "The Object Browser is not automatically updated under Conque Shell." - else - if v:servername == "" - if !has("clientserver") - let wmsg = "The +clientserver feature is required to automatically update the Object Browser." + if v:servername == "" + if !has("clientserver") + let wmsg = "The +clientserver feature is required to automatically update the Object Browser." + else + if $DISPLAY == "" && !(has("win32") || has("win64")) + let wmsg = "The X Window system is required to automatically update the Object Browser." else - if $DISPLAY == "" && !(has("win32") || has("win64")) - let wmsg = "The X Window system is required to automatically update the Object Browser." - else - let wmsg ="The Object Browser will not be automatically updated because Vim's client/server was not started." - endif + let wmsg ="The Object Browser will not be automatically updated because Vim's client/server was not started." endif - else - exe 'Py SendToVimCom("\007' . v:servername . '")' endif + else + exe 'Py SendToVimCom("\007' . v:servername . '")' endif " Either load or reload the Object Browser @@ -1077,17 +962,6 @@ function StartObjectBrowser() let g:tmp_screensname = g:rplugin_screensname let g:tmp_curbufname = bufname("%") - if g:vimrplugin_conqueplugin == 1 - " Copy the values of some local variables that will be inherited - let g:tmp_conqueshell = b:conqueshell - let g:tmp_conque_bufname = b:conque_bufname - - if g:vimrplugin_objbr_place =~ "console" - exe "sil sb " . b:conque_bufname - normal! G0 - endif - endif - let l:sr = &splitright if g:vimrplugin_objbr_place =~ "right" set splitright @@ -1100,12 +974,6 @@ function StartObjectBrowser() sil set filetype=rbrowser " Inheritance of some local variables - if g:vimrplugin_conqueplugin == 1 - let b:conqueshell = g:tmp_conqueshell - let b:conque_bufname = g:tmp_conque_bufname - unlet g:tmp_conqueshell - unlet g:tmp_conque_bufname - endif let g:rplugin_screensname = g:tmp_screensname let b:objbrtitle = g:tmp_objbrtitle let b:rscript_buffer = g:tmp_curbufname @@ -1130,10 +998,8 @@ function RObjBrowser() endif " Only opens the Object Browser if R is running - if g:vimrplugin_screenplugin && !exists("g:ScreenShellSend") && !b:rplugin_extern_ob - return - endif - if g:vimrplugin_conqueplugin && !exists("b:conque_bufname") + if string(g:SendCmdToR) == "function('SendCmdToR_fake')" + call RWarningMsg("The Object Browser can be opened only if R is running.") return endif if g:rplugin_running_objbr == 1 @@ -1144,7 +1010,11 @@ function RObjBrowser() let g:rplugin_running_objbr = 1 if !b:rplugin_extern_ob - call StartObjectBrowser() + if g:rplugin_tmuxwasfirst + call StartObjBrowser_Tmux() + else + call StartObjBrowser_Vim() + endif endif if exists("*UpdateOB") Py SendToVimCom("\003GlobalEnv [RObjBrowser()]") @@ -1192,26 +1062,6 @@ function RBrowserOpenCloseLists(status) endif endfunction -" Scroll conque term buffer (called by CursorHold event) -function RScrollTerm() - if &ft != "r" && &ft != "rnoweb" && &ft != "rhelp" && &ft != "rdoc" - return - endif - if !exists("b:conque_bufname") - return - endif - - let savesb = &switchbuf - set switchbuf=useopen,usetab - exe "sil noautocmd sb " . b:conque_bufname - - call b:conqueshell.read(50) - normal! G0 - - exe "sil noautocmd sb " . g:rplugin_curbuf - exe "set switchbuf=" . savesb -endfunction - function RFormatCode() range if g:rplugin_vimcomport == 0 exe "Py DiscoverVimComPort()" @@ -1262,110 +1112,81 @@ endfunction " Function to send commands " return 0 on failure and 1 on success -function SendCmdToR(cmd) +function SendCmdToR_fake(cmd) + call RWarningMsg("Did you already start R?") + return 0 +endfunction + +function SendCmdToR_TmuxSplit(cmd) if g:vimrplugin_ca_ck let cmd = "\001" . "\013" . a:cmd else let cmd = a:cmd endif - if (has("win32") || has("win64")) && g:vimrplugin_conqueplugin == 0 - let cmd = cmd . "\n" - if g:vimrplugin_vimshell - exe "VimShellSendString " . cmd - else - let slen = len(cmd) - let str = "" - for i in range(0, slen) - let str = str . printf("\\x%02X", char2nr(cmd[i])) - endfor - exe "Py" . " SendToRConsole(b'" . str . "')" - endif - return 1 + if !exists("g:rplugin_rconsole_pane") endif + let str = substitute(cmd, "'", "'\\\\''", "g") + let scmd = "tmux set-buffer '" . str . "\' && tmux paste-buffer -t " . g:rplugin_rconsole_pane + let rlog = system(scmd) + if v:shell_error + let rlog = substitute(rlog, "\n", " ", "g") + let rlog = substitute(rlog, "\r", " ", "g") + call RWarningMsg(rlog) + return 0 + endif + return 1 +endfunction - if g:vimrplugin_screenplugin - if !exists("g:ScreenShellSend") && !exists("*RBrSendToR") - call RWarningMsg("Did you already start R?") - return 0 - endif - if exists("g:ScreenShellSend") - call g:ScreenShellSend(cmd) - else - call RBrSendToR(cmd) - endif - return 1 - elseif g:vimrplugin_conqueplugin - if !exists("b:conque_bufname") - if exists("g:rplugin_conqueshell") - let b:conqueshell = g:rplugin_conqueshell - let b:conque_bufname = g:rplugin_conque_bufname - let b:objbrtitle = g:rplugin_objbrtitle - else - call RWarningMsg("This buffer does not have a Conque Shell yet.") - return 0 - endif - endif - - " Is the Conque buffer hidden or deleted? - if !bufloaded(substitute(b:conque_bufname, "\\", "", "g")) - call RWarningMsg("Could not find Conque Shell buffer.") - return 0 - endif - - " Code provided by Nico Raffo: use an aggressive sb option - let savesb = &switchbuf - set switchbuf=useopen,usetab - - " jump to terminal buffer - if bufwinnr(substitute(b:conque_bufname, "\\", "", "g")) < 0 - " The buffer either was hidden by the user with the :q command or is - " in another tab - exe "sil noautocmd belowright split " . b:conque_bufname - else - exe "sil noautocmd sb " . b:conque_bufname - endif +function SendCmdToR_Windows(cmd) + if g:vimrplugin_ca_ck + let cmd = "\001" . "\013" . a:cmd + else + let cmd = a:cmd + endif - " write variable content to terminal - call b:conqueshell.writeln(cmd) - exe "sleep " . g:vimrplugin_conquesleep . "m" - call b:conqueshell.read(50) - normal! G0 + let cmd = cmd . "\n" + let slen = len(cmd) + let str = "" + for i in range(0, slen) + let str = str . printf("\\x%02X", char2nr(cmd[i])) + endfor + exe "Py" . " SendToRConsole(b'" . str . "')" + return 1 +endfunction - " jump back to code buffer - exe "sil noautocmd sb " . g:rplugin_curbuf - exe "set switchbuf=" . savesb - return 1 +function SendCmdToR_OSX(cmd) + if g:vimrplugin_ca_ck + let cmd = "\001" . "\013" . a:cmd + else + let cmd = a:cmd endif - if g:vimrplugin_vimshell - call vimshell#interactive#send(cmd) - return 1 + if g:rplugin_r64app && g:vimrplugin_i386 == 0 + let rcmd = "R64" + else + let rcmd = "R" endif - if g:vimrplugin_applescript - if g:rplugin_r64app && g:vimrplugin_i386 == 0 - let rcmd = "R64" - else - let rcmd = "R" - endif + " for some reason it doesn't like "\025" + let cmd = a:cmd + let cmd = substitute(cmd, "\\", '\\\', 'g') + let cmd = substitute(cmd, '"', '\\"', "g") + let cmd = substitute(cmd, "'", "'\\\\''", "g") + call system("osascript -e 'tell application \"".rcmd."\" to cmd \"" . cmd . "\"'") + return 1 +endfunction - " for some reason it doesn't like "\025" +function SendCmdToR_Term(cmd) + if g:vimrplugin_ca_ck + let cmd = "\001" . "\013" . a:cmd + else let cmd = a:cmd - let cmd = substitute(cmd, "\\", '\\\', 'g') - let cmd = substitute(cmd, '"', '\\"', "g") - let cmd = substitute(cmd, "'", "'\\\\''", "g") - call system("osascript -e 'tell application \"".rcmd."\" to cmd \"" . cmd . "\"'") - return 1 endif " Send the command to R running in an external terminal emulator let str = substitute(cmd, "'", "'\\\\''", "g") - if g:vimrplugin_tmux - let scmd = "tmux set-buffer '" . str . "\' && tmux paste-buffer -t " . g:rplugin_screensname . '.0' - else - let scmd = 'screen -S ' . g:rplugin_screensname . " -X stuff '" . str . "\'" - endif + let scmd = "tmux set-buffer '" . str . "\' && tmux paste-buffer -t " . g:rplugin_screensname . '.0' let rlog = system(scmd) if v:shell_error let rlog = substitute(rlog, '\n', ' ', 'g') @@ -1419,7 +1240,7 @@ function RSourceLines(lines, e) else let rcmd = 'base::source("' . b:rsource . '")' endif - let ok = SendCmdToR(rcmd) + let ok = g:SendCmdToR(rcmd) return ok endfunction @@ -1487,7 +1308,7 @@ function SendMBlockToR(e, m) if a:m == "down" && lineB != line("$") call cursor(lineB, 1) call GoDown() - endif + endif endfunction " Send functions to R @@ -1599,7 +1420,7 @@ function SendSelectionToR(e, m) let j = col("'>") - i let l = getline("'<") let line = strpart(l, i, j) - let ok = SendCmdToR(line) + let ok = g:SendCmdToR(line) if ok && a:m =~ "down" call GoDown() endif @@ -1760,7 +1581,7 @@ function SendLineToR(godown) endif let b:needsnewomnilist = 1 - let ok = SendCmdToR(line) + let ok = g:SendCmdToR(line) if ok if a:godown =~ "down" call GoDown() @@ -1783,24 +1604,24 @@ function RSendPartOfLine(direction, correctpos) else let rcmd = strpart(lin, 0, idx) endif - call SendCmdToR(rcmd) + call g:SendCmdToR(rcmd) endfunction " Clear the console screen function RClearConsole() - if (has("win32") || has("win64")) && g:vimrplugin_conqueplugin == 0 && g:vimrplugin_vimshell == 0 + if (has("win32") || has("win64")) Py RClearConsolePy() else - call SendCmdToR("\014") + call g:SendCmdToR("\014") endif endfunction " Remove all objects function RClearAll() if g:vimrplugin_rmhidden - call SendCmdToR("rm(list=ls(all.names = TRUE))") + call g:SendCmdToR("rm(list=ls(all.names = TRUE))") else - call SendCmdToR("rm(list=ls())") + call g:SendCmdToR("rm(list=ls())") endif sleep 500m call RClearConsole() @@ -1812,7 +1633,7 @@ function RSetWD() if has("win32") || has("win64") let wdcmd = substitute(wdcmd, "\\", "/", "g") endif - call SendCmdToR(wdcmd) + call g:SendCmdToR(wdcmd) endfunction " Quit R @@ -1842,7 +1663,7 @@ function RQuit(how) if has("win32") || has("win64") exe "Py SendQuitMsg('" . qcmd . "')" else - call SendCmdToR(qcmd) + call g:SendCmdToR(qcmd) if a:how == "save" sleep 1 endif @@ -1867,34 +1688,24 @@ function RQuit(how) endif sleep 100m if exists("g:rplugin_rcmd") - call SendCmdToR(g:rplugin_rcmd) + call g:SendCmdToR(g:rplugin_rcmd) else call StartR(g:rplugin_last_whatr) endif return endif - if g:vimrplugin_screenplugin - if exists(':ScreenQuit') - ScreenQuit - endif - elseif g:vimrplugin_conqueplugin - sleep 200m - exe "sil bdelete " . b:conque_bufname - unlet b:conque_bufname - unlet b:conqueshell - endif - if exists("g:rplugin_objbrtitle") unlet g:rplugin_objbrtitle - if exists("g:rplugin_conqueshell") - unlet g:rplugin_conqueshell - unlet g:rplugin_conque_bufname - endif + endif + + if exists("g:rplugin_rconsole_pane") + unlet g:rplugin_rconsole_pane endif call delete($VIMRPLUGIN_TMPDIR . "/object_browser") call delete($VIMRPLUGIN_TMPDIR . "/liblist") + let g:SendCmdToR = function('SendCmdToR_fake') endfunction " knit the current buffer content @@ -1902,7 +1713,7 @@ function! RKnit() update let b:needsnewomnilist = 1 call RSetWD() - call SendCmdToR('require(knitr); knit("' . expand("%:t") . '")') + call g:SendCmdToR('require(knitr); knit("' . expand("%:t") . '")') endfunction " Tell R to create a list of objects file listing all currently available @@ -1944,7 +1755,7 @@ function BuildROmniList(env, packlist) echohl WarningMsg echo "Please, wait..." echohl Normal - call SendCmdToR(omnilistcmd) + call g:SendCmdToR(omnilistcmd) sleep 2 endif let ii = 0 @@ -2194,7 +2005,7 @@ function ShowRDoc(rkeyword, package, getclass) endif if g:vimrplugin_vimpager == "tabnew" - let s:rdoctitle = a:rkeyword . "\\ (help)" + let s:rdoctitle = a:rkeyword . "\\ (help)" else let s:tnr = tabpagenr() if g:vimrplugin_vimpager != "tab" && s:tnr > 1 @@ -2241,10 +2052,6 @@ function ShowRDoc(rkeyword, package, getclass) " Local variables that must be inherited by the rdoc buffer let g:tmp_screensname = g:rplugin_screensname let g:tmp_objbrtitle = b:objbrtitle - if g:vimrplugin_conqueplugin == 1 - let g:tmp_conqueshell = b:conqueshell - let g:tmp_conque_bufname = b:conque_bufname - endif let rdoccaption = substitute(s:rdoctitle, '\', '', "g") if bufloaded(rdoccaption) @@ -2284,17 +2091,13 @@ function ShowRDoc(rkeyword, package, getclass) let b:objbrtitle = g:tmp_objbrtitle let g:rplugin_screensname = g:tmp_screensname unlet g:tmp_objbrtitle - if g:vimrplugin_conqueplugin == 1 - let b:conqueshell = g:tmp_conqueshell - let b:conque_bufname = g:tmp_conque_bufname - unlet g:tmp_conqueshell - unlet g:tmp_conque_bufname - endif - normal! ggdG + let save_unnamed_reg = @@ + sil normal! ggdG exe "read " . substitute(g:rplugin_docfile, ' ', '\\ ', 'g') set filetype=rdoc normal! ggdd + let @@ = save_unnamed_reg setlocal nomodified setlocal nomodifiable redraw @@ -2330,21 +2133,21 @@ function RSourceDirectory(...) let dir = a:1 endif if dir == "" - call SendCmdToR("vim.srcdir()") + call g:SendCmdToR("vim.srcdir()") else - call SendCmdToR("vim.srcdir('" . dir . "')") + call g:SendCmdToR("vim.srcdir('" . dir . "')") endif endfunction function RAskHelp(...) if a:1 == "" - call SendCmdToR("help.start()") + call g:SendCmdToR("help.start()") return endif if g:vimrplugin_vimpager != "no" call ShowRDoc(a:1, "", 0) else - call SendCmdToR("help(" . a:1. ")") + call g:SendCmdToR("help(" . a:1. ")") endif endfunction @@ -2355,9 +2158,9 @@ function PrintRObject(rkeyword) let classfor = RGetClassFor(a:rkeyword) endif if classfor == "" - call SendCmdToR("print(" . a:rkeyword . ")") + call g:SendCmdToR("print(" . a:rkeyword . ")") else - call SendCmdToR('vim.print("' . a:rkeyword . '", ' . classfor . ")") + call g:SendCmdToR('vim.print("' . a:rkeyword . '", ' . classfor . ")") endif endfunction @@ -2371,9 +2174,9 @@ function RRealAction(rcmd) if strlen(rkeyword) > 0 if a:rcmd == "help" if g:vimrplugin_vimpager == "no" - call SendCmdToR("help(" . rkeyword . ")") + call g:SendCmdToR("help(" . rkeyword . ")") else - if bufname("%") =~ "Object_Browser" || exists("*RBrSendToR") + if bufname("%") =~ "Object_Browser" if g:rplugin_curview == "libraries" let pkg = RBGetPkgName() else @@ -2414,12 +2217,12 @@ function RRealAction(rcmd) else let raction = "plot(" . rkeyword . "); summary(" . rkeyword . ")" endif - call SendCmdToR(raction) + call g:SendCmdToR(raction) return endif let raction = rfun . "(" . rkeyword . ")" - call SendCmdToR(raction) + call g:SendCmdToR(raction) endif endfunction @@ -2551,7 +2354,7 @@ function RBrowserMenu() endfunction function RControlMenu() - call RCreateMenuItem("nvi", 'Command.List\ space', 'RListSpace', 'rl', ':call SendCmdToR("ls()")') + call RCreateMenuItem("nvi", 'Command.List\ space', 'RListSpace', 'rl', ':call g:SendCmdToR("ls()")') call RCreateMenuItem("nvi", 'Command.Clear\ console\ screen', 'RClearConsole', 'rr', ':call RClearConsole()') call RCreateMenuItem("nvi", 'Command.Clear\ all', 'RClearAll', 'rm', ':call RClearAll()') "------------------------------- @@ -2575,7 +2378,7 @@ endfunction function RControlMaps() " List space, clear console, clear all "------------------------------------- - call RCreateMaps("nvi", 'RListSpace', 'rl', ':call SendCmdToR("ls()")') + call RCreateMaps("nvi", 'RListSpace', 'rl', ':call g:SendCmdToR("ls()")') call RCreateMaps("nvi", 'RClearConsole', 'rr', ':call RClearConsole()') call RCreateMaps("nvi", 'RClearAll', 'rm', ':call RClearAll()') @@ -2766,8 +2569,8 @@ function MakeRMenu() "------------------------------- menu R.Command.-Sep7- if &filetype == "r" || &filetype == "rnoweb" || g:vimrplugin_never_unmake_menu - nmenu R.Command.Build\ tags\ file\ (cur\ dir):RBuildTags :call SendCmdToR('rtags(ofile = "TAGS")') - imenu R.Command.Build\ tags\ file\ (cur\ dir):RBuildTags :call SendCmdToR('rtags(ofile = "TAGS")')a + nmenu R.Command.Build\ tags\ file\ (cur\ dir):RBuildTags :call g:SendCmdToR('rtags(ofile = "TAGS")') + imenu R.Command.Build\ tags\ file\ (cur\ dir):RBuildTags :call g:SendCmdToR('rtags(ofile = "TAGS")')a endif menu R.-Sep7- @@ -2840,15 +2643,13 @@ function MakeRMenu() amenu R.Help\ (plugin).Options.Assignment\ operator\ and\ Rnoweb\ code :help vimrplugin_assign amenu R.Help\ (plugin).Options.Object\ Browser :help vimrplugin_objbr_place amenu R.Help\ (plugin).Options.Vim\ as\ pager\ for\ R\ help :help vimrplugin_vimpager - if !has("gui_win32") + if !(has("gui_win32") || has("gui_win64")) amenu R.Help\ (plugin).Options.Terminal\ emulator :help vimrplugin_term - amenu R.Help\ (plugin).Options.Screen\ configuration :help vimrplugin_noscreenrc - amenu R.Help\ (plugin).Options.Screen\ plugin :help vimrplugin_screenplugin endif if has("gui_macvim") || has("gui_mac") || has("mac") || has("macunix") amenu R.Help\ (plugin).Options.Integration\ with\ Apple\ Script :help vimrplugin_applescript endif - if has("gui_win32") + if has("gui_win32") || has("gui_win64") amenu R.Help\ (plugin).Options.Use\ 32\ bit\ version\ of\ R :help vimrplugin_i386 amenu R.Help\ (plugin).Options.Sleep\ time :help vimrplugin_sleeptime endif @@ -2876,7 +2677,7 @@ function MakeRMenu() amenu R.Help\ (plugin).FAQ\ and\ tips.Jump\ to\ function\ definitions :help r-plugin-tagsfile amenu R.Help\ (plugin).News :help r-plugin-news - amenu R.Help\ (R):Rhelp :call SendCmdToR("help.start()") + amenu R.Help\ (R):Rhelp :call g:SendCmdToR("help.start()") let g:rplugin_hasmenu = 1 "---------------------------------------------------------------------------- @@ -2901,8 +2702,8 @@ function MakeRMenu() nmenu ToolBar.RSendLine :call SendLineToR("down") imenu ToolBar.RSendLine :call SendLineToR("down") "--------------------------- - nmenu ToolBar.RListSpace :call SendCmdToR("ls()") - imenu ToolBar.RListSpace :call SendCmdToR("ls()") + nmenu ToolBar.RListSpace :call g:SendCmdToR("ls()") + imenu ToolBar.RListSpace :call g:SendCmdToR("ls()") nmenu ToolBar.RClear :call RClearConsole() imenu ToolBar.RClear :call RClearConsole() nmenu ToolBar.RClearAll :call RClearAll() @@ -2926,7 +2727,7 @@ function MakeRMenu() endfunction function UnMakeRMenu() - if g:rplugin_hasmenu == 0 || g:vimrplugin_never_unmake_menu == 1 || &previewwindow || (&buftype == "nofile" && &filetype != "conque_term" && &filetype != "rbrowser") + if g:rplugin_hasmenu == 0 || g:vimrplugin_never_unmake_menu == 1 || &previewwindow || (&buftype == "nofile" && &filetype != "rbrowser") return endif aunmenu R @@ -3061,7 +2862,7 @@ function RBufEnter() endif endif endif - if &buftype != "nofile" || &filetype == "conque_term" || &filetype == "rbrowser" + if &buftype != "nofile" || &filetype == "rbrowser" let g:rplugin_lastft = &filetype endif endfunction @@ -3103,7 +2904,7 @@ command RUpdateObjList :call RBuildSyntaxFile() command -nargs=+ RAddLibToList :call RBuildSyntaxFile() command -nargs=1 -complete=customlist,RLisObjs Rinsert :call RInsert() command -range=% Rformat ,:call RFormatCode() -command RBuildTags :call SendCmdToR('rtags(ofile = "TAGS")') +command RBuildTags :call g:SendCmdToR('rtags(ofile = "TAGS")') command -nargs=? -complete=customlist,RLisObjs Rhelp :call RAskHelp() command -nargs=? -complete=dir RSourceDir :call RSourceDirectory() @@ -3170,6 +2971,14 @@ if exists("g:vimrplugin_underscore") let g:vimrplugin_assign = g:vimrplugin_underscore endif +" Use the value set for ScreenShell if present +if exists("g:ScreenShellWidth") && !exists("g:vimrplugin_rconsole_width") && g:ScreenShellWidth != "-1" + let g:vimrplugin_rconsole_width = g:ScreenShellWidth +endif +if exists("g:ScreenShellHeight") && !exists("g:vimrplugin_rconsole_height") && g:ScreenShellHeight != "15" + let g:vimrplugin_rconsole_height = g:ScreenShellWidth +endif + " Variables whose default value is fixed call RSetDefaultValue("g:vimrplugin_map_r", 0) call RSetDefaultValue("g:vimrplugin_allnames", 0) @@ -3183,19 +2992,14 @@ call RSetDefaultValue("g:vimrplugin_openpdf_quietly", 0) call RSetDefaultValue("g:vimrplugin_openhtml", 0) call RSetDefaultValue("g:vimrplugin_i386", 0) call RSetDefaultValue("g:vimrplugin_Rterm", 0) -call RSetDefaultValue("g:vimrplugin_screenvsplit", 0) -call RSetDefaultValue("g:vimrplugin_conquevsplit", 0) -call RSetDefaultValue("g:vimrplugin_conqueplugin", 0) -call RSetDefaultValue("g:vimrplugin_screenplugin", 1) -call RSetDefaultValue("g:vimrplugin_vimshell", 0) -call RSetDefaultValue("g:vimrplugin_tmux", 1) -call RSetDefaultValue("g:vimrplugin_vimshell", 0) +call RSetDefaultValue("g:vimrplugin_vsplit", 0) +call RSetDefaultValue("g:vimrplugin_rconsole_width", -1) +call RSetDefaultValue("g:vimrplugin_rconsole_height", 15) call RSetDefaultValue("g:vimrplugin_listmethods", 0) call RSetDefaultValue("g:vimrplugin_specialplot", 0) -call RSetDefaultValue("g:vimrplugin_noscreenrc", 0) call RSetDefaultValue("g:vimrplugin_notmuxconf", 0) call RSetDefaultValue("g:vimrplugin_only_in_tmux", 0) -call RSetDefaultValue("g:vimrplugin_routnotab", 0) +call RSetDefaultValue("g:vimrplugin_routnotab", 0) call RSetDefaultValue("g:vimrplugin_editor_w", 66) call RSetDefaultValue("g:vimrplugin_help_w", 46) call RSetDefaultValue("g:vimrplugin_objbr_w", 40) @@ -3226,6 +3030,8 @@ endfor unlet objbrplace unlet obpllen + + " python has priority over python3, unless ConqueTerm_PyVersion == 3 if has("python3") && exists("g:ConqueTerm_PyVersion") && g:ConqueTerm_PyVersion == 3 command! -nargs=+ Py :py3 @@ -3254,13 +3060,11 @@ call RSetDefaultValue("g:vimrplugin_ca_ck", 0) " Set default mean of communication with R if has('gui_running') - let g:vimrplugin_screenplugin = 0 + let g:rplugin_tmuxwasfirst = 0 endif if has("win32") || has("win64") - let g:vimrplugin_screenplugin = 0 let g:vimrplugin_applescript = 0 - let g:vimrplugin_tmux = 0 endif if has("gui_macvim") || has("gui_mac") || has("mac") || has("macunix") @@ -3277,75 +3081,35 @@ else let g:vimrplugin_applescript = 0 endif -if g:vimrplugin_applescript - let g:vimrplugin_vimshell = 0 - let g:vimrplugin_screenplugin = 0 - let g:vimrplugin_conqueplugin = 0 - let g:vimrplugin_tmux = 0 - let g:vimrplugin_only_in_tmux = 0 -endif - -if g:vimrplugin_screenplugin - let g:vimrplugin_vimshell = 0 - let g:vimrplugin_conqueplugin = 0 - let g:vimrplugin_applescript = 0 +if has("gui_running") + let vimrplugin_only_in_tmux = 0 endif -if g:vimrplugin_vimshell - let g:vimrplugin_screenplugin = 0 - let g:vimrplugin_conqueplugin = 0 - let g:vimrplugin_applescript = 0 - let g:vimrplugin_tmux = 0 +if g:vimrplugin_applescript let g:vimrplugin_only_in_tmux = 0 endif -if g:vimrplugin_conqueplugin - let g:vimrplugin_screenplugin = 0 - let g:vimrplugin_vimshell = 0 +if $TMUX != "" + let g:rplugin_tmuxwasfirst = 1 let g:vimrplugin_applescript = 0 - let g:vimrplugin_tmux = 0 - let g:vimrplugin_only_in_tmux = 0 +else + let g:vimrplugin_external_ob = 0 + let g:rplugin_tmuxwasfirst = 0 endif -" ======================================================================== -if !g:vimrplugin_tmux - let g:vimrplugin_external_ob = 0 -endif +" ======================================================================== if g:vimrplugin_external_ob == 1 let g:vimrplugin_objbr_place = substitute(g:vimrplugin_objbr_place, "script", "console", "") endif -if g:vimrplugin_tmux && g:vimrplugin_objbr_place =~ "console" +if g:vimrplugin_objbr_place =~ "console" let g:vimrplugin_external_ob = 1 endif -if has("win32") || has("win64") - call RSetDefaultValue("g:vimrplugin_conquesleep", 200) -else - call RSetDefaultValue("g:vimrplugin_conquesleep", 100) -endif - -" Check whether vim's screen plugin is OK -if g:vimrplugin_screenplugin - if !exists("g:ScreenVersion") - call RWarningMsgInp("Please, either install the screen plugin (http://www.vim.org/scripts/script.php?script_id=2711) (recommended) or put 'let vimrplugin_screenplugin = 0' in your vimrc.") - let g:rplugin_failed = 1 - finish - endif - if g:ScreenVersion < "1.5" - call RWarningMsgInp("Vim-R-plugin requires Screen plugin >= 1.5") - let g:rplugin_failed = 1 - finish - endif -endif - " Check whether Tmux is OK -if g:vimrplugin_tmux - if !exists("g:ScreenShellTmuxInitArgs") - let g:ScreenShellTmuxInitArgs = " " - endif +if !has("win32") && !has("win64") && !has("mac") && !has("gui_macvim") || !has("gui_mac") || !has("mac") || !has("macunix") && !has("gui_win32") && !has("gui_win64") if !executable('tmux') call RWarningMsgInp("Please, install the 'Tmux' application to enable the Vim-R-plugin.") let g:rplugin_failed = 1 @@ -3357,66 +3121,24 @@ if g:vimrplugin_tmux if strlen(s:tmuxversion) != 3 let s:tmuxversion = "1.0" endif - if g:vimrplugin_tmux && s:tmuxversion < "1.5" + if s:tmuxversion < "1.5" call RWarningMsgInp("Vim-R-plugin requires Tmux >= 1.5") let g:rplugin_failed = 1 finish endif unlet s:tmuxversion - let g:ScreenImpl = 'Tmux' - " To get 256 colors you have to set the $TERM environment variable to - " xterm-256color. See :h r-plugin-tips + " xterm-256color. See :h r-plugin-tips let s:tmxcnf = $VIMRPLUGIN_TMPDIR . "/tmux.conf" - if g:vimrplugin_notmuxconf == 0 - if $DISPLAY != "" || $TERM =~ "xterm" - let g:ScreenShellTmuxInitArgs .= "-2" - endif - endif - let g:ScreenShellTmuxInitArgs .= ' -f "' . s:tmxcnf . '"' endif -" Check whether GNU Screen is OK -if g:vimrplugin_screenplugin && !g:vimrplugin_tmux - let g:ScreenImpl = 'GnuScreen' - if !executable('screen') - call RWarningMsgInp("The value of vimrplugin_tmux = 0 but the GNU Screen application was not found.") - let g:rplugin_failed = 1 - finish - endif -endif - -"Check whether Vim Shell is OK -if g:vimrplugin_vimshell - if !exists("g:vimshell_environment_term") - call RWarningMsgInp("Vim-R-plugin: You are trying to use Vim Shell plugin which is not installed.") - let g:rplugin_failed = 1 - finish - endif -endif - -"Check whether Conque Shell is OK -if g:vimrplugin_conqueplugin == 1 - if !exists("g:ConqueTerm_Version") - call RWarningMsgInp("Vim-R-plugin: You are trying to use Conque Shell plugin which is either too old or not installed.") - let g:rplugin_failed = 1 - finish - endif - if exists("g:ConqueTerm_Version") && g:ConqueTerm_Version < 230 - call RWarningMsgInp("You are using Conque Shell plugin " . g:ConqueTerm_Version . ". Vim-R-plugin requires Conque Shell >= 2.3") - let g:rplugin_failed = 1 - finish - endif -endif - - " Start with an empty list of objects in the workspace let g:rplugin_globalenvlines = [] if has("win32") || has("win64") - if !has("python") && !has("python3") && g:vimrplugin_vimshell == 0 + if !has("python") && !has("python3") redir => s:vimversion silent version redir END @@ -3444,7 +3166,7 @@ if has("win32") || has("win64") finish endif let rplugin_pywin32 = 1 - exe "PyFile " . substitute(g:rplugin_home, " ", '\\ ', "g") . '\r-plugin\windows.py' + exe "PyFile " . substitute(g:rplugin_home, " ", '\\ ', "g") . '\r-plugin\windows.py' if rplugin_pywin32 == 0 let g:rplugin_failed = 1 finish @@ -3491,7 +3213,6 @@ if has("win32") || has("win64") endif let g:vimrplugin_term_cmd = "none" let g:vimrplugin_term = "none" - let g:vimrplugin_noscreenrc = 1 if !exists("g:vimrplugin_r_args") let g:vimrplugin_r_args = "--sdi" endif @@ -3559,7 +3280,7 @@ let s:all_marks = "abcdefghijklmnopqrstuvwxyz" call writefile([], g:rplugin_globalenvfname) " Choose a terminal (code adapted from screen.vim) -if has("win32") || has("win64") || g:vimrplugin_applescript || $DISPLAY == "" || g:vimrplugin_screenplugin +if has("win32") || has("win64") || g:vimrplugin_applescript || $DISPLAY == "" || g:rplugin_tmuxwasfirst " No external terminal emulator will be called, so any value is good let g:vimrplugin_term = "xterm" else @@ -3645,9 +3366,7 @@ let g:rplugin_hasRSFbutton = 0 let g:rplugin_errlist = [] let g:rplugin_screensname = substitute("vimrplugin-" . g:rplugin_userlogin . localtime() . g:rplugin_firstbuffer, '\W', '', 'g') -if $VIMINSTANCEID == "" - let $VIMINSTANCEID = substitute(g:rplugin_firstbuffer . localtime(), '\W', '', 'g') -endif +let $VIMINSTANCEID = substitute(g:rplugin_firstbuffer . localtime(), '\W', '', 'g') if has("clientserver") let g:rplugin_obsname_arg = "--servername " . toupper(substitute(substitute(expand("%:r"), '\W', '', 'g'), "_", "", "g")) @@ -3658,3 +3377,17 @@ endif call SetRPath() + +" Compatibility with old versions (August 2013): +if exists("g:vimrplugin_tmux") + call RWarningMsg("The option vimrplugin_tmux is deprecated.") +endif +if exists("g:vimrplugin_noscreenrc") + call RWarningMsg("The option vimrplugin_noscreenrc is deprecated.") +endif +if exists("g:vimrplugin_screenplugin") + call RWarningMsg("The option vimrplugin_screenplugin is deprecated.") +endif +if exists("g:vimrplugin_screenvsplit") + call RWarningMsg("The option vimrplugin_screenvsplit is deprecated. Please use vimrplugin_vsplit instead.") +endif diff --git a/syntax/rout.vim b/syntax/rout.vim index fb6cc81..ce62e61 100644 --- a/syntax/rout.vim +++ b/syntax/rout.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: R output Files " Maintainer: Jakson Aquino -" Last Change: Tue Feb 26, 2013 01:13PM +" Last Change: Tue Aug 20, 2013 12:52PM " " Version Clears: {{{1 @@ -13,10 +13,6 @@ elseif exists("b:current_syntax") finish endif -if !exists("syn_rout_latex") - let g:syn_rout_latex = 0 -endif - setlocal iskeyword=@,48-57,_,. syn case match @@ -120,15 +116,6 @@ if v:lang =~ "^tr" syn match routWarn "^Uyarı.*" endif -" LaTeX errors -if syn_rout_latex == 1 - syn match routWarn "^No file .*" - syn match routWarn "^Underfull .*" - syn match routWarn "^Overfull .*" - syn match routWarn "^LaTeX Warning: .*" - syn match routError "^! LaTeX Error: .*" -endif - " Define the default highlighting. if g:vimrplugin_routmorecolors == 0 hi def link routComment Comment From c041b785268c5f0fdef0a3ec08aadc8bfcf52489 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Tue, 20 Aug 2013 23:13:05 -0300 Subject: [PATCH 0440/1050] Reset reference to SendCmdToR when R is not found. --- r-plugin/common_global.vim | 2 ++ 1 file changed, 2 insertions(+) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index b43cf03..d2149cf 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -1133,6 +1133,7 @@ function SendCmdToR_TmuxSplit(cmd) let rlog = substitute(rlog, "\n", " ", "g") let rlog = substitute(rlog, "\r", " ", "g") call RWarningMsg(rlog) + let g:SendCmdToR = function('SendCmdToR_fake') return 0 endif return 1 @@ -1192,6 +1193,7 @@ function SendCmdToR_Term(cmd) let rlog = substitute(rlog, '\n', ' ', 'g') let rlog = substitute(rlog, '\r', ' ', 'g') call RWarningMsg(rlog) + let g:SendCmdToR = function('SendCmdToR_fake') return 0 endif return 1 From 6746a42134ac80f8ac262006d1d5a908bd267111 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Wed, 21 Aug 2013 11:19:14 -0300 Subject: [PATCH 0441/1050] New option: vimrplugin_restart. --- doc/r-plugin.txt | 20 ++++++++- r-plugin/common_global.vim | 88 +++++++++++++++++++++++--------------- 2 files changed, 72 insertions(+), 36 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index ecf38df..ee71bf9 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -934,6 +934,7 @@ expected again after any valid code is executed in the R Console. |vimrplugin_allnames| Show names which begin with a dot |vimrplugin_rmhidden| Remove hidden objects from R workspace. |vimrplugin_source| Source additional scripts. +|vimrplugin_restart| Restart R if it is already running. 6.1. Terminal emulator (Linux/Unix only)~ @@ -1412,6 +1413,22 @@ Currently, there is only one script known to extend the Vim-R-plugin features: - https://github.com/mllg/vim-devtools-plugin +6.28. Restart R if it is already running (Linux/Unix only)~ + *vimrplugin_restart* +When R is already running and you type one of the commands to start R before +you have done rq, the Vim-R-plugin does one of the following: +(a) If R is in an external terminal emulator, the terminal is closed, a new +one is opened with the same R session running in it. (b) If both Vim and R are +running in different Tmux regions of the same terminal emulator, the plugin +warns that R is already running. + +If instead of the default behavior, you prefer to quit and restart R when you +do rf, rv or rc, then, put in your +|vimrc|: +> + let vimrplugin_restart = 1 +< + ============================================================================== *r-plugin-key-bindings* 7. Custom key bindings~ @@ -2073,13 +2090,14 @@ Vim-R-plugin. Please look at |vimrplugin_source| for details. *r-plugin-news* 10. News~ -0.9.9.4 (2013-08-18) +0.9.9.4 (2013-08-21) * Minor bug fixes. * The support to GNU Screen, VimShell and Conque Shell was dropped. The screen plugin no longer is used. * New options: vimrplugin_vsplit, vimrplugin_rconsole_height and vimrplugin_rconsole_width. + * New option: vimrplugin_restart. 0.9.9.3 (2013-04-11) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index d2149cf..6820445 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -597,15 +597,21 @@ function StartR_TmuxSplit(rcmd) call system("tmux set-environment -g VIMRPLUGIN_TMPDIR " . g:rplugin_esc_tmpdir) call system("tmux set-environment VIMINSTANCEID " . $VIMINSTANCEID) let vimpane = TmuxActivePane() + let tcmd = "tmux split-window " if g:vimrplugin_vsplit if g:vimrplugin_rconsole_width == -1 - let rlog = system("tmux split-window -h -v '" . a:rcmd . "'") + let tcmd .= "-h" else - let rlog = system("tmux split-window -h -l " . g:vimrplugin_rconsole_width . " -v '" . a:rcmd . "'") + let tcmd .= "-h -l " . g:vimrplugin_rconsole_width endif else - let rlog = system("tmux split-window -l " . g:vimrplugin_rconsole_height . " -v '" . a:rcmd . "'") + let tcmd .= "-l " . g:vimrplugin_rconsole_height endif + if !g:vimrplugin_restart + " Let Tmux automatically kill the panel when R quits. + let tcmd .= " '" . a:rcmd . "'" + endif + let rlog = system(tcmd) if v:shell_error call RWarningMsg(rlog) return @@ -617,6 +623,10 @@ function StartR_TmuxSplit(rcmd) return endif let g:SendCmdToR = function('SendCmdToR_TmuxSplit') + if g:vimrplugin_restart + call g:SendCmdToR(a:rcmd) + endif + let g:rplugin_last_rcmd = a:rcmd endfunction @@ -689,7 +699,6 @@ endfunction " Start R function StartR(whatr) - let g:rplugin_last_whatr = a:whatr call writefile([], $VIMRPLUGIN_TMPDIR . "/object_browser") call writefile([], $VIMRPLUGIN_TMPDIR . "/liblist") @@ -741,6 +750,25 @@ function StartR(whatr) return endif + if string(g:SendCmdToR) != "function('SendCmdToR_fake')" + if g:rplugin_tmuxwasfirst + if g:vimrplugin_restart + call g:SendCmdToR('quit(save = "no")') + call g:SendCmdToR("\014") + call CloseExternalOB() " TODO: Update OB instead of closing it. + call g:SendCmdToR(g:rplugin_last_rcmd) + return + else + call RWarningMsg("As far as I know, R is already running. Did you quit it from within Vim (" . g:maplocalleader . "rq if not remapped)?") + return + endif + else + if g:vimrplugin_restart + call RQuit("no") + endif + endif + endif + if b:rplugin_r_args == " " let rcmd = b:rplugin_R else @@ -1638,15 +1666,21 @@ function RSetWD() call g:SendCmdToR(wdcmd) endfunction -" Quit R -function RQuit(how) - if a:how == "restart" - if !(exists("g:rplugin_last_whatr") || exists("g:rplugin_rcmd")) - call RWarningMsg("Cannot restart R.") - return +function CloseExternalOB() + " check if the pane still exists before trying to kill it because the + " user may have already closed the Object Browser manually. + if exists("g:rplugin_obpane") + let plst = system("tmux list-panes | cat") + if plst =~ g:rplugin_obpane + call system("tmux kill-pane -t " . g:rplugin_obpane) + unlet g:rplugin_obpane endif + sleep 250m endif +endfunction +" Quit R +function RQuit(how) if bufloaded(b:objbrtitle) exe "bunload! " . b:objbrtitle sleep 150m @@ -1666,36 +1700,19 @@ function RQuit(how) exe "Py SendQuitMsg('" . qcmd . "')" else call g:SendCmdToR(qcmd) - if a:how == "save" - sleep 1 + if g:rplugin_tmuxwasfirst + if a:how == "save" + sleep 200m + endif + if g:vimrplugin_restart + call g:SendCmdToR("exit") + endif endif endif sleep 250m - " check if the pane still exists before trying to kill it because the - " user may have already closed the Object Browser manually. - if exists("g:rplugin_obpane") - let plst = system("tmux list-panes | cat") - if plst =~ g:rplugin_obpane - call system("tmux kill-pane -t " . g:rplugin_obpane) - unlet g:rplugin_obpane - endif - sleep 250m - endif - - if a:how == "restart" - if exists("g:rplugin_objbrtitle") - unlet g:rplugin_objbrtitle - endif - sleep 100m - if exists("g:rplugin_rcmd") - call g:SendCmdToR(g:rplugin_rcmd) - else - call StartR(g:rplugin_last_whatr) - endif - return - endif + call CloseExternalOB() if exists("g:rplugin_objbrtitle") unlet g:rplugin_objbrtitle @@ -2994,6 +3011,7 @@ call RSetDefaultValue("g:vimrplugin_openpdf_quietly", 0) call RSetDefaultValue("g:vimrplugin_openhtml", 0) call RSetDefaultValue("g:vimrplugin_i386", 0) call RSetDefaultValue("g:vimrplugin_Rterm", 0) +call RSetDefaultValue("g:vimrplugin_restart", 0) call RSetDefaultValue("g:vimrplugin_vsplit", 0) call RSetDefaultValue("g:vimrplugin_rconsole_width", -1) call RSetDefaultValue("g:vimrplugin_rconsole_height", 15) From 0c2a67011948cef35a404f639ba952b65eb3a0fb Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Wed, 21 Aug 2013 21:01:03 -0300 Subject: [PATCH 0442/1050] Minor improvements and corrections. --- doc/r-plugin.txt | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index ee71bf9..422630d 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -728,7 +728,12 @@ Tmux commands. If you always prefer to run Tmux before running Vim you may want to put in your ~/.bashrc: > - function tvim(){ tmux new-session "vim --servername VIM $@" ; } + if [ "x$DISPLAY" == "x" ] + then + function tvim(){ tmux new-session "vim $@" ; } + else + function tvim(){ tmux -2 new-session "TERM=screen-256color vim $@" ; } + fi < Then you will be able to start Vim inside a Tmux session by typing: > @@ -1023,19 +1028,19 @@ browser's default width by setting the value of |vimrplugin_objbr_w| in your let vimrplugin_objbr_w = 30 < The Object Browser will always be created by splitting the Vim script window -if you are running GVim. However, if running Vim in a terminal emulator, the -Object Browser will be created in a independent Vim instance in a Tmux panel -beside the R Console. Valid values for the Object Browser placement are -"script" or "console" and "right" or "left" separated by a comma. Examples: +if you are running either GVim or Vim not inside a Tmux session. However, if +running Vim in a terminal emulator inside a Tmux session, the Object Browser +will be created in a independent Vim instance in a Tmux panel beside the R +Console. Valid values for the Object Browser placement are "script" or +"console" and "right" or "left" separated by a comma. Examples: > let vimrplugin_objbr_place = "script,right" let vimrplugin_objbr_place = "console,left" < If vimrplugin_external_ob = 1 and R is running in an external terminal -emulator and the communication with R is being established through Tmux, the -Object Browser will be placed besides the R Console in the external terminal -emulator. In this case, the command rh will not work on the -Object Browser (you will see the message "Cmd not available"). +emulator, the Object Browser will be placed besides the R Console in the +external terminal emulator. In this case, the command rh will not +work on the Object Browser (you will see the message "Cmd not available"). 6.5. Vim as pager for R help~ @@ -2033,14 +2038,14 @@ Here are some suggestions of configuration of Bash, Tmux and R. To understand what you are doing, and change the configuration to your taste, please read this document from the beginning. - ~/.bashr:~ + ~/.bashrc:~ > if [ "x$DISPLAY" == "x" ] then function tvim(){ tmux new-session "vim $@" ; } else alias vim='vim --servername VIM' - function tvim(){ tmux -2 new-session "TERM=screen-256color vim --servername VIM $@" ; } + function tvim(){ tmux -2 new-session "TERM=screen-256color vim $@" ; } fi < ~/.tmux.conf:~ From 1a352dbf889b1293090fe18d0e53abf7d1b24866 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Wed, 21 Aug 2013 22:14:01 -0300 Subject: [PATCH 0443/1050] Hopefully make the Object Browser more stable. --- ftplugin/rbrowser.vim | 12 +++++------- r-plugin/common_global.vim | 27 +++++++++++---------------- 2 files changed, 16 insertions(+), 23 deletions(-) diff --git a/ftplugin/rbrowser.vim b/ftplugin/rbrowser.vim index e862d0d..7fa9534 100644 --- a/ftplugin/rbrowser.vim +++ b/ftplugin/rbrowser.vim @@ -354,12 +354,10 @@ function! OBGetDeleteCmd(lnum) endfunction function! OBSendDeleteCmd(cmd) - Py SendToVimCom("\x08Stop updating info. [OBSendDeleteCmd]") - if exists("*RBrSendToR") - call RBrSendToR(a:cmd) - else - call g:SendCmdToR(a:cmd) + if v:servername != "" + Py SendToVimCom("\x08Stop updating info. [OBSendDeleteCmd]") endif + call g:SendCmdToR(a:cmd) if g:rplugin_curview == "GlobalEnv" Py SendToVimCom("\003GlobalEnv [OBSendDeleteCmd]") else @@ -367,7 +365,7 @@ function! OBSendDeleteCmd(cmd) endif call UpdateOB("both") if v:servername != "" - exe 'Py SendToVimCom("\x07' . v:servername . ' [OBSendDeleteCmd]")' + exe 'Py SendToVimCom("\x07' . v:servername . '")' endif endfunction @@ -417,7 +415,7 @@ endif au BufEnter stopinsert if $TMUX_PANE == "" - au BufUnload Py SendToVimCom("\x08Stop updating info.") + au BufUnload Py SendToVimCom("\x08Stop updating info [OB BufUnload].") else au BufUnload call ObBrBufUnload() " Fix problems caused by some plugins diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 6820445..408fe70 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -872,16 +872,8 @@ function StartObjBrowser_Tmux() \ 'setlocal nomodified', \ 'call cursor(curline, curcol)', \ 'exe "PyFile " . substitute(g:rplugin_home, " ", '. "'\\\\ '" . ', "g") . "/r-plugin/vimcom.py"', - \ 'function! RBrSendToR(cmd)', - \ ' let scmd = "tmux set-buffer '. "'" . '" . a:cmd . "\' . "'" . ' && tmux' . tmxs . 'paste-buffer -t ' . g:rplugin_rpane . '"', - \ ' let rlog = system(scmd)', - \ ' if v:shell_error', - \ ' let rlog = substitute(rlog, "\n", " ", "g")', - \ ' let rlog = substitute(rlog, "\r", " ", "g")', - \ ' call RWarningMsg(rlog)', - \ ' return 0', - \ ' endif', - \ 'endfunction', + \ 'let g:rplugin_rconsole_pane = "' . g:rplugin_rconsole_pane . '"', + \ 'let g:SendCmdToR = function("SendCmdToR_TmuxSplit")', \ 'Py SendToVimCom("\003GlobalEnv [OB init]")', \ 'Py SendToVimCom("\004Libraries [OB init]")', \ 'if v:servername != ""', @@ -1088,6 +1080,9 @@ function RBrowserOpenCloseLists(status) if has("gui_running") call UpdateOB("both") endif + if v:servername != "" + exe 'Py SendToVimCom("\x07' . v:servername . '")' + endif endfunction function RFormatCode() range @@ -2246,13 +2241,13 @@ function RRealAction(rcmd) endfunction function RAction(rcmd) - if !g:vimrplugin_external_ob - Py SendToVimCom("\x08Stop updating info [RAction()]") - endif + "if v:servername != "" + " Py SendToVimCom("\x08Stop updating info [RAction()]") + "endif call RRealAction(a:rcmd) - if !g:vimrplugin_external_ob && v:servername != "" - exe 'Py SendToVimCom("\x07' . v:servername . '")' - endif + "if v:servername != "" + " exe 'Py SendToVimCom("\x07' . v:servername . '")' + "endif endfunction if exists('g:maplocalleader') From 5c9f7a979dc5785ed8dc36d869e8f9f4154a5d75 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Wed, 21 Aug 2013 22:20:05 -0300 Subject: [PATCH 0444/1050] Delete code that now is superfluous. --- r-plugin/common_buffer.vim | 3 --- r-plugin/global_r_plugin.vim | 4 ---- 2 files changed, 7 deletions(-) diff --git a/r-plugin/common_buffer.vim b/r-plugin/common_buffer.vim index c0384ee..fb6c31d 100644 --- a/r-plugin/common_buffer.vim +++ b/r-plugin/common_buffer.vim @@ -69,9 +69,6 @@ else endif unlet b:bname -" Special screenrc file -let b:scrfile = " " - if exists("g:rplugin_firstbuffer") && g:rplugin_firstbuffer == "" " The file global_r_plugin.vim was copied to ~/.vim/plugin let g:rplugin_firstbuffer = expand("%:p") diff --git a/r-plugin/global_r_plugin.vim b/r-plugin/global_r_plugin.vim index a0fba2b..e5ee0b7 100644 --- a/r-plugin/global_r_plugin.vim +++ b/r-plugin/global_r_plugin.vim @@ -1,8 +1,4 @@ -if !exists("g:ScreenVersion") - runtime plugin/screen.vim -endif - runtime ftplugin/r.vim function SetExeCmd() From 51e64328f317d146459821cff415486f9860ad55 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Wed, 21 Aug 2013 22:24:29 -0300 Subject: [PATCH 0445/1050] Rename rplugin_screensname to rplugin_tmuxsname. --- r-plugin/common_global.vim | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 408fe70..d1d811c 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -671,18 +671,18 @@ function StartR_ExternalTerm(rcmd) call RWarningMsg("The X Window system is required to run R in an external terminal.") return endif - call system("tmux has-session -t " . g:rplugin_screensname) + call system("tmux has-session -t " . g:rplugin_tmuxsname) if v:shell_error if g:rplugin_termcmd =~ "gnome-terminal" || g:rplugin_termcmd =~ "xfce4-terminal" || g:rplugin_termcmd =~ "terminal" || g:rplugin_termcmd =~ "iterm" - let opencmd = printf("%s 'tmux -2 %s new-session -s %s \"%s\"' &", g:rplugin_termcmd, tmuxcnf, g:rplugin_screensname, rcmd) + let opencmd = printf("%s 'tmux -2 %s new-session -s %s \"%s\"' &", g:rplugin_termcmd, tmuxcnf, g:rplugin_tmuxsname, rcmd) else - let opencmd = printf("%s tmux -2 %s new-session -s %s \"%s\" &", g:rplugin_termcmd, tmuxcnf, g:rplugin_screensname, rcmd) + let opencmd = printf("%s tmux -2 %s new-session -s %s \"%s\" &", g:rplugin_termcmd, tmuxcnf, g:rplugin_tmuxsname, rcmd) endif else if g:rplugin_termcmd =~ "gnome-terminal" || g:rplugin_termcmd =~ "xfce4-terminal" || g:rplugin_termcmd =~ "terminal" || g:rplugin_termcmd =~ "iterm" - let opencmd = printf("%s 'tmux -2 %s attach-session -d -t %s' &", g:rplugin_termcmd, tmuxcnf, g:rplugin_screensname) + let opencmd = printf("%s 'tmux -2 %s attach-session -d -t %s' &", g:rplugin_termcmd, tmuxcnf, g:rplugin_tmuxsname) else - let opencmd = printf("%s tmux -2 %s attach-session -d -t %s &", g:rplugin_termcmd, tmuxcnf, g:rplugin_screensname) + let opencmd = printf("%s tmux -2 %s attach-session -d -t %s &", g:rplugin_termcmd, tmuxcnf, g:rplugin_tmuxsname) endif endif @@ -855,7 +855,7 @@ function StartObjBrowser_Tmux() \ 'let g:rplugin_rpane = "' . g:rplugin_rpane . '"', \ 'let b:objbrtitle = "' . b:objbrtitle . '"', \ 'let showmarks_enable = 0', - \ 'let g:rplugin_screensname = "' . g:rplugin_screensname . '"', + \ 'let g:rplugin_tmuxsname = "' . g:rplugin_tmuxsname . '"', \ 'let b:rscript_buffer = "' . bufname("%") . '"', \ 'set filetype=rbrowser', \ 'let $VIMINSTANCEID="' . $VIMINSTANCEID . '"', @@ -979,7 +979,7 @@ function StartObjBrowser_Vim() else " Copy the values of some local variables that will be inherited let g:tmp_objbrtitle = b:objbrtitle - let g:tmp_screensname = g:rplugin_screensname + let g:tmp_tmuxsname = g:rplugin_tmuxsname let g:tmp_curbufname = bufname("%") let l:sr = &splitright @@ -994,11 +994,11 @@ function StartObjBrowser_Vim() sil set filetype=rbrowser " Inheritance of some local variables - let g:rplugin_screensname = g:tmp_screensname + let g:rplugin_tmuxsname = g:tmp_tmuxsname let b:objbrtitle = g:tmp_objbrtitle let b:rscript_buffer = g:tmp_curbufname unlet g:tmp_objbrtitle - unlet g:tmp_screensname + unlet g:tmp_tmuxsname unlet g:tmp_curbufname exe "PyFile " . substitute(g:rplugin_home, " ", '\\ ', "g") . "/r-plugin/vimcom.py" Py SendToVimCom("\003GlobalEnv [startobjectbrowser()]") @@ -1210,7 +1210,7 @@ function SendCmdToR_Term(cmd) " Send the command to R running in an external terminal emulator let str = substitute(cmd, "'", "'\\\\''", "g") - let scmd = "tmux set-buffer '" . str . "\' && tmux paste-buffer -t " . g:rplugin_screensname . '.0' + let scmd = "tmux set-buffer '" . str . "\' && tmux paste-buffer -t " . g:rplugin_tmuxsname . '.0' let rlog = system(scmd) if v:shell_error let rlog = substitute(rlog, '\n', ' ', 'g') @@ -2064,7 +2064,7 @@ function ShowRDoc(rkeyword, package, getclass) endif " Local variables that must be inherited by the rdoc buffer - let g:tmp_screensname = g:rplugin_screensname + let g:tmp_tmuxsname = g:rplugin_tmuxsname let g:tmp_objbrtitle = b:objbrtitle let rdoccaption = substitute(s:rdoctitle, '\', '', "g") @@ -2103,7 +2103,7 @@ function ShowRDoc(rkeyword, package, getclass) " Inheritance of local variables from the script buffer let b:objbrtitle = g:tmp_objbrtitle - let g:rplugin_screensname = g:tmp_screensname + let g:rplugin_tmuxsname = g:tmp_tmuxsname unlet g:tmp_objbrtitle let save_unnamed_reg = @@ @@ -3379,7 +3379,7 @@ let g:rplugin_lastrpl = "" let g:rplugin_ob_busy = 0 let g:rplugin_hasRSFbutton = 0 let g:rplugin_errlist = [] -let g:rplugin_screensname = substitute("vimrplugin-" . g:rplugin_userlogin . localtime() . g:rplugin_firstbuffer, '\W', '', 'g') +let g:rplugin_tmuxsname = substitute("vimrplugin-" . g:rplugin_userlogin . localtime() . g:rplugin_firstbuffer, '\W', '', 'g') let $VIMINSTANCEID = substitute(g:rplugin_firstbuffer . localtime(), '\W', '', 'g') @@ -3395,13 +3395,13 @@ call SetRPath() " Compatibility with old versions (August 2013): if exists("g:vimrplugin_tmux") - call RWarningMsg("The option vimrplugin_tmux is deprecated.") + call RWarningMsg("The option vimrplugin_tmux is deprecated and will be ignored.") endif if exists("g:vimrplugin_noscreenrc") - call RWarningMsg("The option vimrplugin_noscreenrc is deprecated.") + call RWarningMsg("The option vimrplugin_noscreenrc is deprecated and will be ignored.") endif if exists("g:vimrplugin_screenplugin") - call RWarningMsg("The option vimrplugin_screenplugin is deprecated.") + call RWarningMsg("The option vimrplugin_screenplugin is deprecated and will be ignored.") endif if exists("g:vimrplugin_screenvsplit") call RWarningMsg("The option vimrplugin_screenvsplit is deprecated. Please use vimrplugin_vsplit instead.") From c0024dd2325988afea0e67b9fba8cfb9f36fde2c Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 22 Aug 2013 13:37:31 -0300 Subject: [PATCH 0446/1050] Keep updating the Object Browser after R restart. --- r-plugin/common_global.vim | 355 +++++++++++++++++++------------------ 1 file changed, 178 insertions(+), 177 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index d1d811c..76eed52 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -596,7 +596,7 @@ endfunction function StartR_TmuxSplit(rcmd) call system("tmux set-environment -g VIMRPLUGIN_TMPDIR " . g:rplugin_esc_tmpdir) call system("tmux set-environment VIMINSTANCEID " . $VIMINSTANCEID) - let vimpane = TmuxActivePane() + let g:rplugin_vim_pane = TmuxActivePane() let tcmd = "tmux split-window " if g:vimrplugin_vsplit if g:vimrplugin_rconsole_width == -1 @@ -617,13 +617,14 @@ function StartR_TmuxSplit(rcmd) return endif let g:rplugin_rconsole_pane = TmuxActivePane() - let rlog = system("tmux select-pane -t " . vimpane) + let rlog = system("tmux select-pane -t " . g:rplugin_vim_pane) if v:shell_error call RWarningMsg(rlog) return endif let g:SendCmdToR = function('SendCmdToR_TmuxSplit') if g:vimrplugin_restart + sleep 200m call g:SendCmdToR(a:rcmd) endif let g:rplugin_last_rcmd = a:rcmd @@ -754,9 +755,16 @@ function StartR(whatr) if g:rplugin_tmuxwasfirst if g:vimrplugin_restart call g:SendCmdToR('quit(save = "no")') - call g:SendCmdToR("\014") - call CloseExternalOB() " TODO: Update OB instead of closing it. + sleep 100m call g:SendCmdToR(g:rplugin_last_rcmd) + if IsExternalOBRunning() + call delete($VIMRPLUGIN_TMPDIR . "/vimcom_running") + call WaitVimComStart() + exe 'Py SendToVimCom("\007' . g:rplugin_obsname . '")' + Py SendToVimCom("\004Libraries [Restarting R]") + Py SendToVimCom("\003GlobalEnv [Restarting R]") + call remote_expr(g:rplugin_obsname, 'UpdateOB("both")') + endif return else call RWarningMsg("As far as I know, R is already running. Did you quit it from within Vim (" . g:maplocalleader . "rq if not remapped)?") @@ -764,7 +772,7 @@ function StartR(whatr) endif else if g:vimrplugin_restart - call RQuit("no") + call RQuit("restartR") endif endif endif @@ -778,7 +786,19 @@ function StartR(whatr) if g:rplugin_tmuxwasfirst call StartR_TmuxSplit(rcmd) else + if g:vimrplugin_restart && bufloaded(b:objbrtitle) + call delete($VIMRPLUGIN_TMPDIR . "/vimcom_running") + endif call StartR_ExternalTerm(rcmd) + if g:vimrplugin_restart && bufloaded(b:objbrtitle) + call WaitVimComStart() + exe 'Py SendToVimCom("\007' . v:servername . '")' + Py SendToVimCom("\004Libraries [Restarting R]") + Py SendToVimCom("\003GlobalEnv [Restarting R]") + if exists("*UpdateOB") + call UpdateOB("both") + endif + endif endif " Go back to original directory: @@ -786,186 +806,170 @@ function StartR(whatr) echon endfunction -function StartObjBrowser_Tmux() - if b:rplugin_extern_ob - " This is the Object Browser - let g:rplugin_running_objbr = 0 - return - endif +function WaitVimComStart() + sleep 300m + let ii = 0 + while !filereadable($VIMRPLUGIN_TMPDIR . "/vimcom_running") && ii < 20 + let ii = ii + 1 + sleep 200m + endwhile + if filereadable($VIMRPLUGIN_TMPDIR . "/vimcom_running") && g:rplugin_tmuxwasfirst + sleep 100m + call g:SendCmdToR("\014") + endif +endfunction - " Don't start the Object Browser if it already exists - if exists("g:rplugin_obpane") - let plst = system("tmux list-panes | cat") - if plst =~ g:rplugin_obpane - return - endif - unlet g:rplugin_obpane +function IsExternalOBRunning() + if exists("g:rplugin_ob_pane") + let plst = system("tmux list-panes | cat") + if plst =~ g:rplugin_ob_pane + return 1 endif - sleep 250m + unlet g:rplugin_ob_pane + endif + return 0 +endfunction - let objbrowserfile = $VIMRPLUGIN_TMPDIR . "/objbrowserInit" - let tmxs = " " +function StartObjBrowser_Tmux() + if b:rplugin_extern_ob + " This is the Object Browser + echoerr "StartObjBrowser_Tmux() called." + return + endif - if !exists("g:rplugin_edpane") - if g:rplugin_tmuxwasfirst == 0 - let g:rplugin_edpane = "none" - else - let g:rplugin_edpane = $TMUX_PANE - endif - if strlen(g:rplugin_edpane) == 0 - if g:vimrplugin_external_ob - let g:rplugin_edpane = "none" - let g:vimrplugin_objbr_place = substitute(g:vimrplugin_objbr_place, "script", "console", "g") - else - echoer "Could not find the environment variable TMUX_PANE." - return - endif - endif - endif + " Don't start the Object Browser if it already exists + if IsExternalOBRunning() + return + endif - Py SendToVimCom("\001Tmux pane") - let ii = 0 - while !filereadable($VIMRPLUGIN_TMPDIR . "/rpane") && ii < 20 - let ii = ii + 1 - sleep 50m - endwhile - if !filereadable($VIMRPLUGIN_TMPDIR . "/rpane") - echoer "The number of the R Tmux pane is unknown." - return - endif - let xx = readfile($VIMRPLUGIN_TMPDIR . "/rpane") - let g:rplugin_rpane = xx[0] - if g:rplugin_rpane !~ "%[0-9]" - echoer 'The number of the R Tmux pane is invalid: "' . g:rplugin_rpane . '"' - unlet g:rplugin_rpane - return - endif + "sleep 250m + let objbrowserfile = $VIMRPLUGIN_TMPDIR . "/objbrowserInit" + let tmxs = " " - if v:servername == "" - let myservername = '""' - else - let myservername = '"' . v:servername . '"' - endif - - call writefile([ - \ 'call writefile([$TMUX_PANE], $VIMRPLUGIN_TMPDIR . "/objbrpane")', - \ 'let g:rplugin_editor_sname = ' . myservername, - \ 'let g:rplugin_edpane = "' . g:rplugin_edpane . '"', - \ 'let g:rplugin_rpane = "' . g:rplugin_rpane . '"', - \ 'let b:objbrtitle = "' . b:objbrtitle . '"', - \ 'let showmarks_enable = 0', - \ 'let g:rplugin_tmuxsname = "' . g:rplugin_tmuxsname . '"', - \ 'let b:rscript_buffer = "' . bufname("%") . '"', - \ 'set filetype=rbrowser', - \ 'let $VIMINSTANCEID="' . $VIMINSTANCEID . '"', - \ 'let b:rplugin_extern_ob = 1', - \ 'setlocal modifiable', - \ 'set shortmess=atI', - \ 'set rulerformat=%3(%l%)', - \ 'set noruler', - \ 'let curline = line(".")', - \ 'let curcol = col(".")', - \ 'let save_unnamed_reg = @@', - \ 'normal! ggdG', - \ 'let @@ = save_unnamed_reg', - \ 'setlocal nomodified', - \ 'call cursor(curline, curcol)', - \ 'exe "PyFile " . substitute(g:rplugin_home, " ", '. "'\\\\ '" . ', "g") . "/r-plugin/vimcom.py"', - \ 'let g:rplugin_rconsole_pane = "' . g:rplugin_rconsole_pane . '"', - \ 'let g:SendCmdToR = function("SendCmdToR_TmuxSplit")', - \ 'Py SendToVimCom("\003GlobalEnv [OB init]")', - \ 'Py SendToVimCom("\004Libraries [OB init]")', - \ 'if v:servername != ""', - \ " exe 'Py SendToVimCom(\"\\x07' . v:servername . '\")'", - \ 'endif', - \ 'call setline(1, ".GlobalEnv | Libraries")', - \ 'exe "silent read ' . substitute($VIMRPLUGIN_TMPDIR, ' ', '\\\\ ', 'g') . '/object_browser"', - \ 'redraw'], objbrowserfile) - - if g:vimrplugin_objbr_place =~ "left" - let panw = system("tmux list-panes | cat") - if g:vimrplugin_objbr_place =~ "console" - " Get the R Console width: - let panw = substitute(panw, '.*\n1: \[\([0-9]*\)x.*', '\1', "") - else - " Get the Vim with - let panw = substitute(panw, '.*0: \[\([0-9]*\)x.*', '\1', "") - endif - let panewidth = panw - g:vimrplugin_objbr_w - " Just to be safe: If the above code doesn't work as expected - " and we get a spurious value: - if panewidth < 40 || panewidth > 180 - let panewidth = 80 - endif - else - let panewidth = g:vimrplugin_objbr_w - endif + if v:servername == "" + let myservername = '""' + else + let myservername = '"' . v:servername . '"' + endif + + call writefile([ + \ 'let g:rplugin_editor_sname = ' . myservername, + \ 'let g:rplugin_vim_pane = "' . g:rplugin_vim_pane . '"', + \ 'let g:rplugin_rconsole_pane = "' . g:rplugin_rconsole_pane . '"', + \ 'let b:objbrtitle = "' . b:objbrtitle . '"', + \ 'let showmarks_enable = 0', + \ 'let g:rplugin_tmuxsname = "' . g:rplugin_tmuxsname . '"', + \ 'let b:rscript_buffer = "' . bufname("%") . '"', + \ 'set filetype=rbrowser', + \ 'let $VIMINSTANCEID="' . $VIMINSTANCEID . '"', + \ 'let b:rplugin_extern_ob = 1', + \ 'setlocal modifiable', + \ 'set shortmess=atI', + \ 'set rulerformat=%3(%l%)', + \ 'set noruler', + \ 'let curline = line(".")', + \ 'let curcol = col(".")', + \ 'let save_unnamed_reg = @@', + \ 'normal! ggdG', + \ 'let @@ = save_unnamed_reg', + \ 'setlocal nomodified', + \ 'call cursor(curline, curcol)', + \ 'exe "PyFile " . substitute(g:rplugin_home, " ", '. "'\\\\ '" . ', "g") . "/r-plugin/vimcom.py"', + \ 'let g:SendCmdToR = function("SendCmdToR_TmuxSplit")', + \ 'Py SendToVimCom("\003GlobalEnv [OB init]")', + \ 'Py SendToVimCom("\004Libraries [OB init]")', + \ 'if v:servername != ""', + \ " exe 'Py SendToVimCom(\"\\x07' . v:servername . '\")'", + \ 'endif', + \ 'call setline(1, ".GlobalEnv | Libraries")', + \ 'exe "silent read ' . substitute($VIMRPLUGIN_TMPDIR, ' ', '\\\\ ', 'g') . '/object_browser"', + \ 'redraw'], objbrowserfile) + + if g:vimrplugin_objbr_place =~ "left" + let panw = system("tmux list-panes | cat") if g:vimrplugin_objbr_place =~ "console" - let obpane = g:rplugin_rpane + " Get the R Console width: + let panw = substitute(panw, '.*\n1: \[\([0-9]*\)x.*', '\1', "") else - let obpane = g:rplugin_edpane + " Get the Vim with + let panw = substitute(panw, '.*0: \[\([0-9]*\)x.*', '\1', "") + endif + let panewidth = panw - g:vimrplugin_objbr_w + " Just to be safe: If the above code doesn't work as expected + " and we get a spurious value: + if panewidth < 40 || panewidth > 180 + let panewidth = 80 endif - let cmd = "tmux split-window -d -h -l " . panewidth . " -t " . obpane . ' "vim ' . g:rplugin_obsname_arg . " -c 'source " . substitute(objbrowserfile, ' ', '\\ ', 'g') . "'" . '"' + else + let panewidth = g:vimrplugin_objbr_w + endif + if g:vimrplugin_objbr_place =~ "console" + let obpane = g:rplugin_rconsole_pane + else + let obpane = g:rplugin_vim_pane + endif - call delete($VIMRPLUGIN_TMPDIR . "/objbrpane") + if has("clientserver") + let obsname = "--servername " . g:rplugin_obsname + else + let obsname = " " + endif - let rlog = system(cmd) - if v:shell_error - let rlog = substitute(rlog, '\n', ' ', 'g') - let rlog = substitute(rlog, '\r', ' ', 'g') - call RWarningMsg(rlog) - let g:rplugin_running_objbr = 0 - return 0 - endif + let cmd = "tmux split-window -h -l " . panewidth . " -t " . obpane . ' "vim ' . obsname . " -c 'source " . substitute(objbrowserfile, ' ', '\\ ', 'g') . "'" . '"' + let rlog = system(cmd) + if v:shell_error + let rlog = substitute(rlog, '\n', ' ', 'g') + let rlog = substitute(rlog, '\r', ' ', 'g') + call RWarningMsg(rlog) + let g:rplugin_running_objbr = 0 + return 0 + endif - let ii = 0 - while !filereadable($VIMRPLUGIN_TMPDIR . "/objbrpane") && ii < 20 - let ii = ii + 1 - sleep 50m - endwhile - if !filereadable($VIMRPLUGIN_TMPDIR . "/objbrpane") - echoer "The Tmux pane number of the Object Browser is unknown." - return - endif - let xx = readfile($VIMRPLUGIN_TMPDIR . "/objbrpane") - let g:rplugin_obpane = xx[0] - if g:rplugin_obpane !~ "%[0-9]" - echoer 'The number of the Object Browser Tmux pane is invalid: "' . g:rplugin_obpane . '"' - unlet g:rplugin_obpane - return - endif + let g:rplugin_ob_pane = TmuxActivePane() + let rlog = system("tmux select-pane -t " . g:rplugin_vim_pane) + if v:shell_error + call RWarningMsg(rlog) + return 0 + endif - if g:vimrplugin_objbr_place =~ "left" - if g:vimrplugin_objbr_place =~ "console" - call system("tmux swap-pane -d -s " . g:rplugin_rpane . " -t " . g:rplugin_obpane) - else - call system("tmux swap-pane -d -s " . g:rplugin_edpane . " -t " . g:rplugin_obpane) - endif + if g:vimrplugin_objbr_place =~ "left" + if g:vimrplugin_objbr_place =~ "console" + call system("tmux swap-pane -d -s " . g:rplugin_rconsole_pane . " -t " . g:rplugin_ob_pane) + else + call system("tmux swap-pane -d -s " . g:rplugin_vim_pane . " -t " . g:rplugin_ob_pane) endif + endif + if g:rplugin_ob_warn_shown == 0 if !has("clientserver") call RWarningMsg("The +clientserver feature is required to automatically update the Object Browser.") + sleep 200m else if $DISPLAY == "" call RWarningMsg("The X Window system is required to automatically update the Object Browser.") + sleep 200m endif endif - return + let g:rplugin_ob_warn_shown = 1 endif + return endfunction function StartObjBrowser_Vim() let wmsg = "" if v:servername == "" - if !has("clientserver") - let wmsg = "The +clientserver feature is required to automatically update the Object Browser." - else - if $DISPLAY == "" && !(has("win32") || has("win64")) - let wmsg = "The X Window system is required to automatically update the Object Browser." + if g:rplugin_ob_warn_shown == 0 + if !has("clientserver") + let wmsg = "The +clientserver feature is required to automatically update the Object Browser." else - let wmsg ="The Object Browser will not be automatically updated because Vim's client/server was not started." + if $DISPLAY == "" && !(has("win32") || has("win64")) + let wmsg = "The X Window system is required to automatically update the Object Browser." + else + let wmsg ="The Object Browser will not be automatically updated because Vim's client/server was not started." + endif endif endif + let g:rplugin_ob_warn_shown = 1 else exe 'Py SendToVimCom("\007' . v:servername . '")' endif @@ -1007,6 +1011,7 @@ function StartObjBrowser_Vim() endif if wmsg != "" call RWarningMsg(wmsg) + sleep 200m endif endfunction @@ -1662,23 +1667,20 @@ function RSetWD() endfunction function CloseExternalOB() - " check if the pane still exists before trying to kill it because the - " user may have already closed the Object Browser manually. - if exists("g:rplugin_obpane") - let plst = system("tmux list-panes | cat") - if plst =~ g:rplugin_obpane - call system("tmux kill-pane -t " . g:rplugin_obpane) - unlet g:rplugin_obpane - endif + if IsExternalOBRunning() + call system("tmux kill-pane -t " . g:rplugin_ob_pane) + unlet g:rplugin_ob_pane sleep 250m endif endfunction " Quit R function RQuit(how) - if bufloaded(b:objbrtitle) - exe "bunload! " . b:objbrtitle - sleep 150m + if a:how != "restartR" + if bufloaded(b:objbrtitle) + exe "bunload! " . b:objbrtitle + sleep 30m + endif endif if exists("b:quit_command") @@ -1705,20 +1707,22 @@ function RQuit(how) endif endif - sleep 250m + sleep 50m call CloseExternalOB() - if exists("g:rplugin_objbrtitle") - unlet g:rplugin_objbrtitle + if a:how != "restartR" + if exists("g:rplugin_objbrtitle") + unlet g:rplugin_objbrtitle + endif endif if exists("g:rplugin_rconsole_pane") unlet g:rplugin_rconsole_pane endif - call delete($VIMRPLUGIN_TMPDIR . "/object_browser") - call delete($VIMRPLUGIN_TMPDIR . "/liblist") + call writefile([], $VIMRPLUGIN_TMPDIR . "/object_browser") + call writefile([], $VIMRPLUGIN_TMPDIR . "/liblist") let g:SendCmdToR = function('SendCmdToR_fake') endfunction @@ -2197,10 +2201,10 @@ function RRealAction(rcmd) let pkg = "" endif if b:rplugin_extern_ob - if g:rplugin_edpane == "none" + if g:rplugin_vim_pane == "none" call RWarningMsg("Cmd not available.") else - let slog = system("tmux set-buffer '" . "\" . ':call ShowRDoc("' . rkeyword . '", "' . pkg . '", 0)' . "\' && tmux paste-buffer -t " . g:rplugin_edpane . " && tmux select-pane -t " . g:rplugin_edpane) + let slog = system("tmux set-buffer '" . "\" . ':call ShowRDoc("' . rkeyword . '", "' . pkg . '", 0)' . "\' && tmux paste-buffer -t " . g:rplugin_vim_pane . " && tmux select-pane -t " . g:rplugin_vim_pane) if v:shell_error call RWarningMsg(slog) endif @@ -3374,6 +3378,7 @@ let g:rplugin_firstbuffer = expand("%:p") let g:rplugin_running_objbr = 0 let g:rplugin_has_new_lib = 0 let g:rplugin_has_new_obj = 0 +let g:rplugin_ob_warn_shown = 0 let g:rplugin_vimcomport = 0 let g:rplugin_lastrpl = "" let g:rplugin_ob_busy = 0 @@ -3383,11 +3388,7 @@ let g:rplugin_tmuxsname = substitute("vimrplugin-" . g:rplugin_userlogin . local let $VIMINSTANCEID = substitute(g:rplugin_firstbuffer . localtime(), '\W', '', 'g') -if has("clientserver") - let g:rplugin_obsname_arg = "--servername " . toupper(substitute(substitute(expand("%:r"), '\W', '', 'g'), "_", "", "g")) -else - let g:rplugin_obsname_arg = " " -endif +let g:rplugin_obsname = toupper(substitute(substitute(expand("%:r"), '\W', '', 'g'), "_", "", "g")) call SetRPath() From 1db12ec5112fc75ba28a33298090e98280a2b617 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 22 Aug 2013 13:46:19 -0300 Subject: [PATCH 0447/1050] Remove "delete" command from Object Browser. The Normal mode command "d" was removed from the object browser because it was too buggy. If you want it back, you have to reimplement it as a complement to be sourced by the Vim-R-plugin (see vimrplugin_source). --- doc/r-plugin.txt | 4 ---- 1 file changed, 4 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 422630d..07f5db7 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -669,10 +669,6 @@ any) used to classify the objects: One limitation is that objects made available by the command data() may not have their classes recognized in the GlobalEnv view. -The Normal mode command d deletes the object on the cursor line or the -element of a list or data.frame. If the Object Browser is showing the -libraries, the library currently under the cursor line is detached. - 4.6. Commenting and uncommenting lines~ From 94ebf1f52eb0c059e55493883421df303864e2b2 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 22 Aug 2013 19:25:01 -0300 Subject: [PATCH 0448/1050] Really remove "delete" command from Object Browser The Normal mode command "d" was removed from the object browser because it was too buggy. If you want it back, you have to reimplement it as a complement to be sourced by the Vim-R-plugin (see vimrplugin_source). --- doc/r-plugin.txt | 1 + ftplugin/rbrowser.vim | 69 ------------------------------------------- 2 files changed, 1 insertion(+), 69 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 07f5db7..f8b6e39 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -2096,6 +2096,7 @@ Vim-R-plugin. Please look at |vimrplugin_source| for details. * Minor bug fixes. * The support to GNU Screen, VimShell and Conque Shell was dropped. The screen plugin no longer is used. + * The delete command was removed from the Object Browser. * New options: vimrplugin_vsplit, vimrplugin_rconsole_height and vimrplugin_rconsole_width. * New option: vimrplugin_restart. diff --git a/ftplugin/rbrowser.vim b/ftplugin/rbrowser.vim index 7fa9534..1d3a092 100644 --- a/ftplugin/rbrowser.vim +++ b/ftplugin/rbrowser.vim @@ -332,72 +332,6 @@ function! SourceObjBrLines() exe "source " . g:rplugin_esc_tmpdir . "/objbrowserInit" endfunction -function! OBGetDeleteCmd(lnum) - let obj = RBrowserGetName(1, a:lnum) - if g:rplugin_curview == "GlobalEnv" - if obj =~ '\$' - let cmd = obj . ' <- NULL' - elseif obj =~ '-\[\[[0-9]*\]\]' - let obj = substitute(obj, '-\(\[\[[0-9]*\]\]\)', '\1', '') - let cmd = obj . ' <- NULL' - else - let cmd = 'rm(' . obj . ')' - endif - else - if obj =~ "^package:" - let cmd = 'detach("' . obj . '", unload = TRUE, character.only = TRUE)' - else - return "" - endif - endif - return cmd -endfunction - -function! OBSendDeleteCmd(cmd) - if v:servername != "" - Py SendToVimCom("\x08Stop updating info. [OBSendDeleteCmd]") - endif - call g:SendCmdToR(a:cmd) - if g:rplugin_curview == "GlobalEnv" - Py SendToVimCom("\003GlobalEnv [OBSendDeleteCmd]") - else - Py SendToVimCom("\004Libraries [OBSendDeleteCmd]") - endif - call UpdateOB("both") - if v:servername != "" - exe 'Py SendToVimCom("\x07' . v:servername . '")' - endif -endfunction - -function! OBDelete() - if line(".") < 3 - return - endif - let cmd = OBGetDeleteCmd(line(".")) - call OBSendDeleteCmd(cmd) -endfunction - -function! OBMultiDelete() - let fline = line("'<") - let eline = line("'>") - if fline < 3 - return - endif - let nl= 0 - let cmd = "" - for ii in range(fline, eline) - let nl+= 1 - if nl > 1 - let cmd = cmd . "; " - endif - let cmd = cmd . OBGetDeleteCmd(ii) - if g:rplugin_curview == "GlobalEnv" - let cmd = substitute(cmd, "); rm(", ", ", "") - endif - endfor - call OBSendDeleteCmd(cmd) -endfunction - nmap :call RBrowserDoubleClick() nmap <2-LeftMouse> :call RBrowserDoubleClick() nmap :call RBrowserRightClick() @@ -427,9 +361,6 @@ else endif endif -nmap d :call OBDelete() -vmap d :call OBMultiDelete() - let s:envstring = tolower($LC_MESSAGES . $LC_ALL . $LANG) if s:envstring =~ "utf-8" || s:envstring =~ "utf8" let s:isutf8 = 1 From 3b946b1dd20a89788292537f808da5a88c160776 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 22 Aug 2013 21:45:36 -0300 Subject: [PATCH 0449/1050] Add incompatibility with Fish Shell as known bug. --- doc/r-plugin.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index f8b6e39..d2529c0 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -891,6 +891,13 @@ do the tasks to avoid any risk of corrupting R's memory. It will tell Vim that expected again after any valid code is executed in the R Console. +5.6. Problems with Fish Shell~ + +Some of the plugin features does not work correctly if Vim is running inside +Fish Shell, for example, in the Object Browser, lists and libraries do not +open and close when the key is pressed over them. + + ============================================================================== *r-plugin-options* 6. Options~ From a57368e3876cc0cb9ea1f7c8bedef31c1f8d2d71 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 22 Aug 2013 21:47:33 -0300 Subject: [PATCH 0450/1050] Test if 'object_browser' exists before reading. --- r-plugin/common_global.vim | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 76eed52..f6ef503 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -883,7 +883,10 @@ function StartObjBrowser_Tmux() \ " exe 'Py SendToVimCom(\"\\x07' . v:servername . '\")'", \ 'endif', \ 'call setline(1, ".GlobalEnv | Libraries")', - \ 'exe "silent read ' . substitute($VIMRPLUGIN_TMPDIR, ' ', '\\\\ ', 'g') . '/object_browser"', + \ 'if filereadable("' . $VIMRPLUGIN_TMPDIR . '/object_browser")', + \ ' exe "silent read ' . substitute($VIMRPLUGIN_TMPDIR, ' ', '\\\\ ', 'g') . '/object_browser"', + \ 'endif', + \ 'setlocal nomodifiable', \ 'redraw'], objbrowserfile) if g:vimrplugin_objbr_place =~ "left" From f94065d8a6e333719fafd4e5167b3408ac20a30d Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Fri, 23 Aug 2013 15:51:43 -0300 Subject: [PATCH 0451/1050] Improve update of Object Browser after restart. --- ftplugin/rbrowser.vim | 3 +-- r-plugin/common_global.vim | 22 +++++++++++++++------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/ftplugin/rbrowser.vim b/ftplugin/rbrowser.vim index 1d3a092..10ecdf2 100644 --- a/ftplugin/rbrowser.vim +++ b/ftplugin/rbrowser.vim @@ -57,16 +57,15 @@ let g:rplugin_curview = "GlobalEnv" function! UpdateOB(what) - let g:rplugin_upobcnt += 1 if a:what == "both" let wht = g:rplugin_curview else let wht = a:what endif if g:rplugin_curview != wht - let g:rplugin_upobcnt -= 1 return "curview != what" endif + let g:rplugin_upobcnt += 1 let g:rplugin_switchedbuf = 0 if $TMUX_PANE == "" diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index f6ef503..2d02f8d 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -756,14 +756,17 @@ function StartR(whatr) if g:vimrplugin_restart call g:SendCmdToR('quit(save = "no")') sleep 100m + call delete($VIMRPLUGIN_TMPDIR . "/vimcom_running") call g:SendCmdToR(g:rplugin_last_rcmd) if IsExternalOBRunning() - call delete($VIMRPLUGIN_TMPDIR . "/vimcom_running") + call remote_expr(g:rplugin_obsname, 'ResetVimComPort()') call WaitVimComStart() exe 'Py SendToVimCom("\007' . g:rplugin_obsname . '")' - Py SendToVimCom("\004Libraries [Restarting R]") - Py SendToVimCom("\003GlobalEnv [Restarting R]") - call remote_expr(g:rplugin_obsname, 'UpdateOB("both")') + Py SendToVimCom("\003.GlobalEnv [Restarting R]") + Py SendToVimCom("\004Libraries [Restarting()]") + " vimcom automatically update the libraries view, but not + " the GlobalEnv one because vimcom_count_objects() returns 0. + call remote_expr(g:rplugin_obsname, 'UpdateOB("GlobalEnv")') endif return else @@ -773,6 +776,7 @@ function StartR(whatr) else if g:vimrplugin_restart call RQuit("restartR") + call ResetVimComPort() endif endif endif @@ -793,10 +797,10 @@ function StartR(whatr) if g:vimrplugin_restart && bufloaded(b:objbrtitle) call WaitVimComStart() exe 'Py SendToVimCom("\007' . v:servername . '")' - Py SendToVimCom("\004Libraries [Restarting R]") - Py SendToVimCom("\003GlobalEnv [Restarting R]") + Py SendToVimCom("\003.GlobalEnv [Restarting R]") + Py SendToVimCom("\004Libraries [Restarting()]") if exists("*UpdateOB") - call UpdateOB("both") + call UpdateOB("GlobalEnv") endif endif endif @@ -830,6 +834,10 @@ function IsExternalOBRunning() return 0 endfunction +function ResetVimComPort() + Py VimComPort = 0 +endfunction + function StartObjBrowser_Tmux() if b:rplugin_extern_ob " This is the Object Browser From 786451991ef38836b28d7f8c59a3291d0f62f3d4 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 24 Aug 2013 13:59:30 -0300 Subject: [PATCH 0452/1050] Bug fixes in the Object Browser (Linux). --- ftplugin/rbrowser.vim | 23 +++++++++++++--------- r-plugin/common_global.vim | 40 ++++++++++++-------------------------- 2 files changed, 26 insertions(+), 37 deletions(-) diff --git a/ftplugin/rbrowser.vim b/ftplugin/rbrowser.vim index 10ecdf2..3725c5a 100644 --- a/ftplugin/rbrowser.vim +++ b/ftplugin/rbrowser.vim @@ -65,7 +65,10 @@ function! UpdateOB(what) if g:rplugin_curview != wht return "curview != what" endif - let g:rplugin_upobcnt += 1 + if g:rplugin_upobcnt + return "OB Called twice" + endif + let g:rplugin_upobcnt = 1 let g:rplugin_switchedbuf = 0 if $TMUX_PANE == "" @@ -73,7 +76,7 @@ function! UpdateOB(what) silent buffers redir END if s:bufl !~ "Object_Browser" - let g:rplugin_upobcnt -= 1 + let g:rplugin_upobcnt = 0 return "Object_Browser not listed" endif if exists("g:rplugin_curbuf") && g:rplugin_curbuf != "Object_Browser" @@ -105,16 +108,14 @@ function! UpdateOB(what) endif call cursor(curline, curcol) if bufname("%") =~ "Object_Browser" || b:rplugin_extern_ob - if g:rplugin_upobcnt < 2 - setlocal nomodifiable - endif + setlocal nomodifiable endif redraw if g:rplugin_switchedbuf exe "sil noautocmd sb " . g:rplugin_curbuf exe "set switchbuf=" . savesb endif - let g:rplugin_upobcnt -= 1 + let g:rplugin_upobcnt = 0 return "End of UpdateOB()" endfunction @@ -149,8 +150,12 @@ function! RBrowserDoubleClick() call RWarningMsg("R is busy.") endif endif - if has("win32") || has("win64") - call UpdateOB("both") + "if has("win32") || has("win64") + " call UpdateOB("both") + "endif + if v:servername == "" + sleep 50m " R needs some time to write the file. + call UpdateOB("both") endif endfunction @@ -323,7 +328,7 @@ endfunction function! ObBrBufUnload() if exists("g:rplugin_editor_sname") - call system("tmux select-pane -t " . g:rplugin_edpane) + call system("tmux select-pane -t " . g:rplugin_vim_pane) endif endfunction diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 2d02f8d..1d169ce 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -829,7 +829,6 @@ function IsExternalOBRunning() if plst =~ g:rplugin_ob_pane return 1 endif - unlet g:rplugin_ob_pane endif return 0 endfunction @@ -872,17 +871,9 @@ function StartObjBrowser_Tmux() \ 'set filetype=rbrowser', \ 'let $VIMINSTANCEID="' . $VIMINSTANCEID . '"', \ 'let b:rplugin_extern_ob = 1', - \ 'setlocal modifiable', \ 'set shortmess=atI', \ 'set rulerformat=%3(%l%)', \ 'set noruler', - \ 'let curline = line(".")', - \ 'let curcol = col(".")', - \ 'let save_unnamed_reg = @@', - \ 'normal! ggdG', - \ 'let @@ = save_unnamed_reg', - \ 'setlocal nomodified', - \ 'call cursor(curline, curcol)', \ 'exe "PyFile " . substitute(g:rplugin_home, " ", '. "'\\\\ '" . ', "g") . "/r-plugin/vimcom.py"', \ 'let g:SendCmdToR = function("SendCmdToR_TmuxSplit")', \ 'Py SendToVimCom("\003GlobalEnv [OB init]")', @@ -890,26 +881,21 @@ function StartObjBrowser_Tmux() \ 'if v:servername != ""', \ " exe 'Py SendToVimCom(\"\\x07' . v:servername . '\")'", \ 'endif', - \ 'call setline(1, ".GlobalEnv | Libraries")', - \ 'if filereadable("' . $VIMRPLUGIN_TMPDIR . '/object_browser")', - \ ' exe "silent read ' . substitute($VIMRPLUGIN_TMPDIR, ' ', '\\\\ ', 'g') . '/object_browser"', - \ 'endif', - \ 'setlocal nomodifiable', - \ 'redraw'], objbrowserfile) + \ 'call UpdateOB("GlobalEnv")'], objbrowserfile) if g:vimrplugin_objbr_place =~ "left" let panw = system("tmux list-panes | cat") if g:vimrplugin_objbr_place =~ "console" " Get the R Console width: - let panw = substitute(panw, '.*\n1: \[\([0-9]*\)x.*', '\1', "") + let panw = substitute(panw, '.*[0-9]: \[\([0-9]*\)x[0-9]*.\{-}' . g:rplugin_rconsole_pane . '\>.*', '\1', "") else - " Get the Vim with - let panw = substitute(panw, '.*0: \[\([0-9]*\)x.*', '\1', "") + " Get the Vim width + let panw = substitute(panw, '.*[0-9]: \[\([0-9]*\)x[0-9]*.\{-}' . g:rplugin_vim_pane . '\>.*', '\1', "") endif let panewidth = panw - g:vimrplugin_objbr_w " Just to be safe: If the above code doesn't work as expected " and we get a spurious value: - if panewidth < 40 || panewidth > 180 + if panewidth < 30 || panewidth > 180 let panewidth = 80 endif else @@ -1082,22 +1068,20 @@ function RBrowserOpenCloseLists(status) if g:rplugin_lastrpl == "R is busy." call RWarningMsg("R is busy.") - elseif exists("g:rplugin_curview") && v:servername == "" - call UpdateOB("both") endif if switchedbuf exe "sil noautocmd sb " . g:rplugin_curbuf exe "set switchbuf=" . savesb endif - if exists("g:rplugin_curview") && v:servername != "" - exe 'Py SendToVimCom("\007' . v:servername . '")' - endif - if has("gui_running") + if exists("g:rplugin_curview") call UpdateOB("both") - endif - if v:servername != "" - exe 'Py SendToVimCom("\x07' . v:servername . '")' + if v:servername != "" + exe 'Py SendToVimCom("\007' . v:servername . '")' + endif + elseif IsExternalOBRunning() + call remote_expr(g:rplugin_obsname, 'UpdateOB("GlobalEnv")') + exe 'Py SendToVimCom("\007' . g:rplugin_obsname . '")' endif endfunction From 7d63ddd23a39f6d0be6348755ab040f64a714e92 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 24 Aug 2013 15:03:17 -0300 Subject: [PATCH 0453/1050] Bug fixes on R startup and Obj. Browser (Windows). --- ftplugin/rbrowser.vim | 5 +---- r-plugin/common_global.vim | 23 +++++++++++++++++++---- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/ftplugin/rbrowser.vim b/ftplugin/rbrowser.vim index 3725c5a..7c5ea60 100644 --- a/ftplugin/rbrowser.vim +++ b/ftplugin/rbrowser.vim @@ -150,10 +150,7 @@ function! RBrowserDoubleClick() call RWarningMsg("R is busy.") endif endif - "if has("win32") || has("win64") - " call UpdateOB("both") - "endif - if v:servername == "" + if v:servername == "" || has("win32") || has("win64") sleep 50m " R needs some time to write the file. call UpdateOB("both") endif diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 1d169ce..68d917f 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -698,6 +698,18 @@ function StartR_ExternalTerm(rcmd) let g:SendCmdToR = function('SendCmdToR_Term') endfunction +function IsSendCmdToRFake() + if string(g:SendCmdToR) != "function('SendCmdToR_fake')" + if exists("g:maplocalleader") + call RWarningMsg("As far as I know, R is already running. Did you quit it from within Vim (" . g:maplocalleader . "rq if not remapped)?") + else + call RWarningMsg("As far as I know, R is already running. Did you quit it from within Vim (\\rq if not remapped)?") + endif + return 1 + endif + return 0 +endfunction + " Start R function StartR(whatr) call writefile([], $VIMRPLUGIN_TMPDIR . "/object_browser") @@ -720,6 +732,10 @@ function StartR(whatr) endif endif + if IsSendCmdToRFake() && (g:vimrplugin_applescript || has("win32") || has("win64")) + return + endif + if g:vimrplugin_applescript if g:rplugin_r64app && g:vimrplugin_i386 == 0 let rcmd = "/Applications/R64.app" @@ -769,9 +785,8 @@ function StartR(whatr) call remote_expr(g:rplugin_obsname, 'UpdateOB("GlobalEnv")') endif return - else - call RWarningMsg("As far as I know, R is already running. Did you quit it from within Vim (" . g:maplocalleader . "rq if not remapped)?") - return + elseif IsSendCmdToRFake() + return endif else if g:vimrplugin_restart @@ -3123,7 +3138,7 @@ if g:vimrplugin_objbr_place =~ "console" endif " Check whether Tmux is OK -if !has("win32") && !has("win64") && !has("mac") && !has("gui_macvim") || !has("gui_mac") || !has("mac") || !has("macunix") && !has("gui_win32") && !has("gui_win64") +if !has("win32") && !has("win64") && !has("mac") && !has("gui_macvim") && !has("gui_mac") && !has("mac") && !has("macunix") && !has("gui_win32") && !has("gui_win64") if !executable('tmux') call RWarningMsgInp("Please, install the 'Tmux' application to enable the Vim-R-plugin.") let g:rplugin_failed = 1 From a846a8aacce301d473ba914871e2a0c23072a551 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 24 Aug 2013 22:25:05 -0300 Subject: [PATCH 0454/1050] Improve message when R already started (Windows). --- r-plugin/common_global.vim | 59 ++++++++++++++++++++++++-------------- r-plugin/windows.py | 11 +++++-- 2 files changed, 46 insertions(+), 24 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 68d917f..6a0c26c 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -698,6 +698,41 @@ function StartR_ExternalTerm(rcmd) let g:SendCmdToR = function('SendCmdToR_Term') endfunction +function StartR_Windows() + if string(g:SendCmdToR) != "function('SendCmdToR_fake')" + Py FindRConsole() + Py vim.command("let g:rplugin_rconsole_hndl = " + str(RConsole)) + if g:rplugin_rconsole_hndl != 0 + call RWarningMsg("There is already a window called '" . g:rplugin_R_window_ttl . "'.") + unlet g:rplugin_R_window_ttl + return + endif + endif + Py StartRPy() + lcd - + let g:SendCmdToR = function('SendCmdToR_Windows') +endfunction + +function StartR_OSX(rcmd) + if IsSendCmdToRFake() + return + endif + if g:rplugin_r64app && g:vimrplugin_i386 == 0 + let rcmd = "/Applications/R64.app" + else + let rcmd = "/Applications/R.app" + endif + if b:rplugin_r_args != " " + let rcmd = rcmd . " " . b:rplugin_r_args + endif + let rlog = system("open " . rcmd) + if v:shell_error + call RWarningMsg(rlog) + endif + lcd - + let g:SendCmdToR = function('SendCmdToR_OSX') +endfunction + function IsSendCmdToRFake() if string(g:SendCmdToR) != "function('SendCmdToR_fake')" if exists("g:maplocalleader") @@ -732,32 +767,13 @@ function StartR(whatr) endif endif - if IsSendCmdToRFake() && (g:vimrplugin_applescript || has("win32") || has("win64")) - return - endif - if g:vimrplugin_applescript - if g:rplugin_r64app && g:vimrplugin_i386 == 0 - let rcmd = "/Applications/R64.app" - else - let rcmd = "/Applications/R.app" - endif - if b:rplugin_r_args != " " - let rcmd = rcmd . " " . b:rplugin_r_args - endif - let rlog = system("open " . rcmd) - if v:shell_error - call RWarningMsg(rlog) - endif - lcd - - let g:SendCmdToR = function('SendCmdToR_OSX') + call StartR_OSX() return endif if has("win32") || has("win64") - Py StartRPy() - lcd - - let g:SendCmdToR = function('SendCmdToR_Windows') + call StartR_Windows() return endif @@ -767,6 +783,7 @@ function StartR(whatr) return endif + " R was already started. Should restart it or warn? if string(g:SendCmdToR) != "function('SendCmdToR_fake')" if g:rplugin_tmuxwasfirst if g:vimrplugin_restart diff --git a/r-plugin/windows.py b/r-plugin/windows.py index ce26ecc..5e6c364 100644 --- a/r-plugin/windows.py +++ b/r-plugin/windows.py @@ -54,14 +54,19 @@ def CntrlV(): def FindRConsole(): global RConsole - Rtitle = vim.eval("g:vimrplugin_R_window_title") + Rttl = vim.eval("g:vimrplugin_R_window_title") + Rtitle = Rttl RConsole = win32gui.FindWindow(None, Rtitle) if RConsole == 0: - RConsole = win32gui.FindWindow(None, Rtitle + " (64-bit)") + Rtitle = Rttl + " (64-bit)" + RConsole = win32gui.FindWindow(None, Rtitle) if RConsole == 0: - RConsole = win32gui.FindWindow(None, Rtitle + " (32-bit)") + Rtitle = Rttl + " (32-bit)" + RConsole = win32gui.FindWindow(None, Rtitle) if RConsole == 0: vim.command("call RWarningMsg('Could not find R Console.')") + if RConsole: + vim.command("let g:rplugin_R_window_ttl = '" + Rtitle + "'") def SendToRConsole(aString): global RConsole From d71b20c6fc5362d0b7cef78d1d4099b5c799dfa0 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sun, 25 Aug 2013 18:50:22 -0300 Subject: [PATCH 0455/1050] Show elements of S4 objects in the Object Browser. --- doc/r-plugin.txt | 21 ++++++---- ftplugin/rbrowser.vim | 84 +++++++++++++++++++------------------- r-plugin/common_global.vim | 2 +- 3 files changed, 55 insertions(+), 52 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index d2529c0..3e732a6 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -284,6 +284,7 @@ you may prefer to install the Debian package available at: Did you see the message "VimCom port not found"? This means that R is not running, the vimcom package is not installed, or R was not started by Vim. + 3.4. General instructions II (optional steps)~ 3.4.1 Update list of objects~ @@ -1224,16 +1225,15 @@ In this case, you can choose the initial number of columns of R Console: 6.16. Integration with AppleScript (OS X only)~ *vimrplugin_applescript* In Mac OS X, the plugin will try to send commands to R gui using AppleScript. -If you prefer to run R and Vim in the same terminal emulator split in two -regions (Vim and R), put in your |vimrc|: -> - let vimrplugin_applescript = 0 -< -If you prefer to have R running in an external terminal emulator, put in your -|vimrc|: +If you prefer either to run R and Vim in the same terminal emulator split in +two regions (Vim and R) or to run R in an external terminal emulator, put in +your |vimrc|: > let vimrplugin_applescript = 0 < +If Vim is running inside Tmux, the terminal will be split in two regions. +Otherwise, R will start in an external terminal emulator. + 6.17. Special R functions~ *vimrplugin_listmethods* @@ -1314,7 +1314,7 @@ When one types in the R Console the cursor goes to the beginning of the line and one types the characters to the right of the cursor are deleted. This is useful to avoid characters left on the R Console being mixed with commands sent by Vim. However, sending may be problematic if using -either Tmux. The Vim-R-plugin will add to every command if you put +Tmux. The Vim-R-plugin will add to every command if you put in your |vimrc|: > let vimrplugin_ca_ck = 1 @@ -1393,6 +1393,7 @@ The default value is 1, for consistency with earlier versions. See also: |r-plugin-localleader|. + 6.26. Show/remove hidden objects~ *vimrplugin_allnames* *vimrplugin_rmhidden* @@ -1974,6 +1975,7 @@ on top" or a similar option provided by your desktop manager. There is also the R package "edtdbg" which aims to integrate R debugging facilities with Vim. + 9.17. Turn the R-plugin into a global plugin~ *r-plugin-global* The Vim-R-plugin is a file type plugin. If you want its functionality @@ -2098,7 +2100,7 @@ Vim-R-plugin. Please look at |vimrplugin_source| for details. *r-plugin-news* 10. News~ -0.9.9.4 (2013-08-21) +0.9.9.4 (2013-08-24) * Minor bug fixes. * The support to GNU Screen, VimShell and Conque Shell was dropped. The @@ -2107,6 +2109,7 @@ Vim-R-plugin. Please look at |vimrplugin_source| for details. * New options: vimrplugin_vsplit, vimrplugin_rconsole_height and vimrplugin_rconsole_width. * New option: vimrplugin_restart. + * Show elements of S4 objects in the Object Browser. 0.9.9.3 (2013-04-11) diff --git a/ftplugin/rbrowser.vim b/ftplugin/rbrowser.vim index 7c5ea60..6e56df1 100644 --- a/ftplugin/rbrowser.vim +++ b/ftplugin/rbrowser.vim @@ -66,7 +66,8 @@ function! UpdateOB(what) return "curview != what" endif if g:rplugin_upobcnt - return "OB Called twice" + call RWarningMsg("OB called twice") + return "OB called twice" endif let g:rplugin_upobcnt = 1 @@ -133,14 +134,13 @@ function! RBrowserDoubleClick() endif " Toggle state of list or data.frame: open X closed - let key = RBrowserGetName(1, line(".")) + let key = RBrowserGetName(0) if g:rplugin_curview == "GlobalEnv" - exe 'Py SendToVimCom("' . "\005" . '-' . substitute(key, '\$', '-', "g") . '")' + exe 'Py SendToVimCom("' . "\005" . key . '")' if g:rplugin_lastrpl == "R is busy." call RWarningMsg("R is busy.") endif else - let key = substitute(key, '\$', '-', "g") let key = substitute(key, '`', '', "g") if key !~ "^package:" let key = "package:" . RBGetPkgName() . '-' . key @@ -161,7 +161,7 @@ function! RBrowserRightClick() return endif - let key = RBrowserGetName(1, line(".")) + let key = RBrowserGetName(1) if key == "" return endif @@ -217,7 +217,10 @@ function! RBrowserFindParent(word, curline, curpos) let line = substitute(getline(curline), " .*", "", "") let curpos = stridx(line, '[#') if curpos == -1 - let curpos = a:curpos + let curpos = stridx(line, '<#') + if curpos == -1 + let curpos = a:curpos + endif endif endwhile @@ -231,7 +234,11 @@ function! RBrowserFindParent(word, curline, curpos) endif endif if curline > 1 - let word = substitute(line, '.*[#', "", "") . '$' . a:word + if line =~ '<#' + let word = substitute(line, '.*<#', "", "") . '@' . a:word + else + let word = substitute(line, '.*\[#', "", "") . '$' . a:word + endif if curpos != spacelimit let word = RBrowserFindParent(word, line("."), curpos) endif @@ -244,43 +251,28 @@ function! RBrowserFindParent(word, curline, curpos) return "" endfunction -function! RBrowserGetName(complete, lnum) - let curpos = col(".") - - let line = getline(a:lnum) +function! RBrowserGetName(cleantail) + let line = getline(".") if line =~ "^$" - return + return "" endif - " Is the object a top level one (curpos == 2)? - if g:rplugin_curview == "libraries" - let delim = ['##', '{#', '[#', '(#', '"#', "'#", '%#', '<#', '=#'] - else - let delim = ['{#', '[#', '(#', '"#', "'#", '%#', '<#', '=#'] - endif - let word = substitute(line, '^\W*#\{-1,}\(.*\)\t.*', '\1', "") + let curpos = stridx(line, "#") + let word = substitute(line, '.\{-}\(.#\)\(.\{-}\)\t', '\2\1', '') + let word = substitute(word, '\[#$', '$', '') + let word = substitute(word, '<#$', '@', '') + let word = substitute(word, '.#$', '', '') if word =~ ' ' || word =~ '^[0-9]' let word = '`' . word . '`' endif - if a:complete == 0 - return word - endif - - for i in delim - let curpos = stridx(line, i) - if curpos != -1 - break - endif - endfor - if curpos == -1 - return "" - endif - - - if curpos == 3 + if curpos == 4 " top level object + let word = substitute(word, '\$\[\[', '[[', "g") + if a:cleantail + let word = substitute(word, '[\$@]$', '', '') + endif if g:rplugin_curview == "libraries" return "package:" . word else @@ -289,20 +281,28 @@ function! RBrowserGetName(complete, lnum) else if g:rplugin_curview == "libraries" if s:isutf8 - if curpos == 10 + if curpos == 11 + if a:cleantail + let word = substitute(word, '[\$@]$', '', '') + endif + let word = substitute(word, '\$\[\[', '[[', "g") return word endif - elseif curpos == 6 + elseif curpos == 7 + if a:cleantail + let word = substitute(word, '[\$@]$', '', '') + endif + let word = substitute(word, '\$\[\[', '[[', "g") return word endif endif - if curpos > 3 + if curpos > 4 " Find the parent data.frame or list - let word = RBrowserFindParent(word, line("."), curpos) - " Unnamed objects of lists - if word =~ '\$\[\[[0-9]*\]\]' - let word = substitute(word, '\$\[\[\([0-9]*\)\]\]', '-[[\1]]', "g") + let word = RBrowserFindParent(word, line("."), curpos - 1) + if a:cleantail + let word = substitute(word, '[\$@]$', '', '') endif + let word = substitute(word, '\$\[\[', '[[', "g") return word else " Wrong object name delimiter: should never happen. diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 6a0c26c..a7bc8de 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -2212,7 +2212,7 @@ endfunction " Call R functions for the word under cursor function RRealAction(rcmd) if &filetype == "rbrowser" - let rkeyword = RBrowserGetName(1, line(".")) + let rkeyword = RBrowserGetName(1) else let rkeyword = RGetKeyWord() endif From 6a20d9bc91724bab2fc85e63e9acd6328de3f924 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Mon, 26 Aug 2013 08:24:01 -0300 Subject: [PATCH 0456/1050] Remove unused variable from the code. --- r-plugin/common_buffer.vim | 5 ----- r-plugin/common_global.vim | 18 ++---------------- 2 files changed, 2 insertions(+), 21 deletions(-) diff --git a/r-plugin/common_buffer.vim b/r-plugin/common_buffer.vim index fb6c31d..3a5585f 100644 --- a/r-plugin/common_buffer.vim +++ b/r-plugin/common_buffer.vim @@ -48,11 +48,6 @@ if !exists("b:objbrtitle") endif -" Initialize some local variables if Conque shell was already started -if exists("g:rplugin_objbrtitle") - let b:objbrtitle = g:rplugin_objbrtitle -endif - " Make the file name of files to be sourced let b:bname = expand("%:t") let b:bname = substitute(b:bname, " ", "", "g") diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index a7bc8de..0b5a148 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -1738,12 +1738,6 @@ function RQuit(how) call CloseExternalOB() - if a:how != "restartR" - if exists("g:rplugin_objbrtitle") - unlet g:rplugin_objbrtitle - endif - endif - if exists("g:rplugin_rconsole_pane") unlet g:rplugin_rconsole_pane endif @@ -3016,14 +3010,6 @@ if exists("g:vimrplugin_underscore") let g:vimrplugin_assign = g:vimrplugin_underscore endif -" Use the value set for ScreenShell if present -if exists("g:ScreenShellWidth") && !exists("g:vimrplugin_rconsole_width") && g:ScreenShellWidth != "-1" - let g:vimrplugin_rconsole_width = g:ScreenShellWidth -endif -if exists("g:ScreenShellHeight") && !exists("g:vimrplugin_rconsole_height") && g:ScreenShellHeight != "15" - let g:vimrplugin_rconsole_height = g:ScreenShellWidth -endif - " Variables whose default value is fixed call RSetDefaultValue("g:vimrplugin_map_r", 0) call RSetDefaultValue("g:vimrplugin_allnames", 0) @@ -3078,8 +3064,8 @@ unlet obpllen -" python has priority over python3, unless ConqueTerm_PyVersion == 3 -if has("python3") && exists("g:ConqueTerm_PyVersion") && g:ConqueTerm_PyVersion == 3 +" python has priority over python3 +if has("python3") command! -nargs=+ Py :py3 command! -nargs=+ PyFile :py3file elseif has("python") From 0abd2fd355af70cfd926453eaf294f369f65d381 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Mon, 26 Aug 2013 10:39:27 -0300 Subject: [PATCH 0457/1050] Unique tmp files names to each Vim instance Each Vim instance uses unique names for some temporary files. The file names are made unique by appending v:servername to their base names. --- ftplugin/rbrowser.vim | 6 ++-- r-plugin/common_global.vim | 58 ++++++++++++++++++++++++++------------ 2 files changed, 43 insertions(+), 21 deletions(-) diff --git a/ftplugin/rbrowser.vim b/ftplugin/rbrowser.vim index 6e56df1..c2a5799 100644 --- a/ftplugin/rbrowser.vim +++ b/ftplugin/rbrowser.vim @@ -66,7 +66,7 @@ function! UpdateOB(what) return "curview != what" endif if g:rplugin_upobcnt - call RWarningMsg("OB called twice") + echoerr "OB called twice" return "OB called twice" endif let g:rplugin_upobcnt = 1 @@ -102,10 +102,10 @@ function! UpdateOB(what) let @@ = save_unnamed_reg if wht == "GlobalEnv" call setline(1, ".GlobalEnv | Libraries") - exe "silent read " . g:rplugin_esc_tmpdir . "/object_browser" + exe "silent read " . g:rplugin_esc_tmpdir . g:rplugin_globenv_f else call setline(1, "Libraries | .GlobalEnv") - exe "silent read " . g:rplugin_esc_tmpdir . "/liblist" + exe "silent read " . g:rplugin_esc_tmpdir . g:rplugin_liblist_f endif call cursor(curline, curcol) if bufname("%") =~ "Object_Browser" || b:rplugin_extern_ob diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 0b5a148..74ae501 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -747,8 +747,8 @@ endfunction " Start R function StartR(whatr) - call writefile([], $VIMRPLUGIN_TMPDIR . "/object_browser") - call writefile([], $VIMRPLUGIN_TMPDIR . "/liblist") + call writefile([], $VIMRPLUGIN_TMPDIR . g:rplugin_globenv_f) + call writefile([], $VIMRPLUGIN_TMPDIR . g:rplugin_liblist_f) if !exists("b:rplugin_R") call SetRPath() @@ -908,12 +908,20 @@ function StartObjBrowser_Tmux() \ 'set noruler', \ 'exe "PyFile " . substitute(g:rplugin_home, " ", '. "'\\\\ '" . ', "g") . "/r-plugin/vimcom.py"', \ 'let g:SendCmdToR = function("SendCmdToR_TmuxSplit")', - \ 'Py SendToVimCom("\003GlobalEnv [OB init]")', - \ 'Py SendToVimCom("\004Libraries [OB init]")', - \ 'if v:servername != ""', + \ 'if v:servername == ""', + \ ' let g:rplugin_globenv_f = "' . g:rplugin_globenv_f . '"', + \ ' let g:rplugin_liblist_f = "' . g:rplugin_liblist_f . '"', + \ 'else', + \ ' let g:rplugin_globenv_f = "/globenv_" . v:servername', + \ ' let g:rplugin_liblist_f = "/liblist_" . v:servername', \ " exe 'Py SendToVimCom(\"\\x07' . v:servername . '\")'", \ 'endif', - \ 'call UpdateOB("GlobalEnv")'], objbrowserfile) + \ 'Py SendToVimCom("\003GlobalEnv [OB init]")', + \ 'Py SendToVimCom("\004Libraries [OB init]")', + \ 'if v:servername == ""', + \ ' sleep 100m', + \ ' call UpdateOB("GlobalEnv")', + \ 'endif'], objbrowserfile) if g:vimrplugin_objbr_place =~ "left" let panw = system("tmux list-panes | cat") @@ -1016,10 +1024,10 @@ function StartObjBrowser_Vim() let g:tmp_curbufname = bufname("%") let l:sr = &splitright - if g:vimrplugin_objbr_place =~ "right" - set splitright - else + if g:vimrplugin_objbr_place =~ "left" set nosplitright + else + set splitright endif sil exe "vsplit " . b:objbrtitle let &splitright = l:sr @@ -1742,8 +1750,8 @@ function RQuit(how) unlet g:rplugin_rconsole_pane endif - call writefile([], $VIMRPLUGIN_TMPDIR . "/object_browser") - call writefile([], $VIMRPLUGIN_TMPDIR . "/liblist") + call writefile([], $VIMRPLUGIN_TMPDIR . g:rplugin_globenv_f) + call writefile([], $VIMRPLUGIN_TMPDIR . g:rplugin_liblist_f) let g:SendCmdToR = function('SendCmdToR_fake') endfunction @@ -3002,9 +3010,6 @@ if !isdirectory($VIMRPLUGIN_TMPDIR) call mkdir($VIMRPLUGIN_TMPDIR, "p", 0700) endif -let g:rplugin_docfile = $VIMRPLUGIN_TMPDIR . "/Rdoc" -let g:rplugin_globalenvfname = $VIMRPLUGIN_TMPDIR . "/GlobalEnvList" - " Old name of vimrplugin_assign option if exists("g:vimrplugin_underscore") let g:vimrplugin_assign = g:vimrplugin_underscore @@ -3307,10 +3312,6 @@ endif let s:all_marks = "abcdefghijklmnopqrstuvwxyz" -" Create an empty file to avoid errors if the user do Ctrl-X Ctrl-O before -" starting R: -call writefile([], g:rplugin_globalenvfname) - " Choose a terminal (code adapted from screen.vim) if has("win32") || has("win64") || g:vimrplugin_applescript || $DISPLAY == "" || g:rplugin_tmuxwasfirst " No external terminal emulator will be called, so any value is good @@ -3403,6 +3404,27 @@ let $VIMINSTANCEID = substitute(g:rplugin_firstbuffer . localtime(), '\W', '', ' let g:rplugin_obsname = toupper(substitute(substitute(expand("%:r"), '\W', '', 'g'), "_", "", "g")) +let g:rplugin_docfile = $VIMRPLUGIN_TMPDIR . "/Rdoc" + +if g:rplugin_tmuxwasfirst + if $DISPLAY == "" + let g:rplugin_globenv_f = "/globenv_" + let g:rplugin_liblist_f = "/liblist_" + let g:rplugin_globalenvfname = $VIMRPLUGIN_TMPDIR . "/GlobalEnvList" + else + let g:rplugin_globenv_f = "/globenv_" . g:rplugin_obsname + let g:rplugin_liblist_f = "/liblist_" . g:rplugin_obsname + let g:rplugin_globalenvfname = $VIMRPLUGIN_TMPDIR . "/GlobalEnvList_" . g:rplugin_obsname + endif +else + let g:rplugin_globenv_f = "/globenv_" . v:servername + let g:rplugin_liblist_f = "/liblist_" . v:servername + let g:rplugin_globalenvfname = $VIMRPLUGIN_TMPDIR . "/GlobalEnvList_" . v:servername +endif + +" Create an empty file to avoid errors if the user do Ctrl-X Ctrl-O before +" starting R: +call writefile([], g:rplugin_globalenvfname) call SetRPath() From bb7be57cb646df9b027e867284a4f4ea4150726a Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Tue, 27 Aug 2013 07:05:19 -0300 Subject: [PATCH 0458/1050] Put `` around code. --- doc/r-plugin.txt | 122 +++++++++++++++++++++++++---------------------- 1 file changed, 65 insertions(+), 57 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 3e732a6..dd1fe89 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -80,7 +80,7 @@ Vim-R-plugin (see |vimrplugin_source|). - Syntax highlighting of R documentation. * Object Browser (.GlobalEnv and loaded packages): - Send commands with the object under cursor as argument. - - Call R's help() with the object under cursor as argument. + - Call R's `help()` with the object under cursor as argument. - Syntax highlighting of the Object Browser. * Most of the plugin's behavior is customizable. @@ -146,9 +146,9 @@ following dependencies: The vimcom package creates a server on R to allow the communication with Vim. The package is not used to send commands from Vim to R Console, but it is necessary to open R documentation in Vim's buffer, run the Object - Browser, run either Sweave() or knit() on the document being edited. It - also has some functions called by Vim such as vim.plot(), vim.print(), and - vim.bol(). This last one is required to build the data base used in + Browser, run either `Sweave()` or `knit()` on the document being edited. It + also has some functions called by Vim such as `vim.plot()`, `vim.print()`, and + `vim.bol()`. This last one is required to build the data base used in omnicompletion. Before installing vimcom from source, you have to install the X server development headers. On Debian/Ubuntu systems you can install them with the following command in a terminal emulator: @@ -164,7 +164,7 @@ following dependencies: install.packages("vimcom") < The colorout package colorizes the R output and the setwidth package - adjusts the value of options("width") whenever the terminal is resized. + adjusts the value of `options("width")` whenever the terminal is resized. They can be installed from within R. The setwidth package can be installed as usual: @@ -230,7 +230,7 @@ to install external dependencies: installed. * vimcom = 0.9-9: An R package, available on CRAN and installable with the - install.packages() command. The vimcom package creates a server on R to + `install.packages()` command. The vimcom package creates a server on R to allow the communication with Vim. You certainly will want to put the following lines at the end of your Rprofile. > @@ -238,7 +238,7 @@ to install external dependencies: library(vimcom) } < - You can do Sys.getenv("HOME") in the R Console to know where the file + You can do `Sys.getenv("HOME")` in the R Console to know where the file should be, but usually it is at ~/Documents/.Rprofile. Create your |vimfiles| directory if you do not have it yet. Its path will be @@ -527,23 +527,23 @@ You can source all .R files in a directory with the Normal mode command The command :Rinsert inserts one or more lines with the output of the R command sent to R. By using this command we can avoid the need of copying and pasting the output R from its console to Vim. For example, to insert the -output of "dput(levels(var))", where "var" is a factor vector, we could do in +output of `dput(levels(var))`, where `var` is a factor vector, we could do in Vim: > :Rinsert dput(levels(var)) < The output inserted by :Rinsert is limited to 5012 characters. -The command :Rformat call the function tidy.source() of formatR package to +The command :Rformat call the function `tidy.source()` of formatR package to format either the entire buffer or the selected lines. The value of the -"width.cutoff" argument is set to the buffer's 'textwidth' if it is not -outside the range 20-180. Se R help on "tidy.source" for details on how to +`width.cutoff` argument is set to the buffer's 'textwidth' if it is not +outside the range 20-180. Se R help on `tidy.source` for details on how to control the function behavior. 4.2. Edition of rnoweb files~ -In Rnoweb files (.Rnw), when the cursor is over the "@" character, which +In Rnoweb files (.Rnw), when the cursor is over the `@` character, which finishes an R chunk, the sending of all commands to R is suspended and the shortcut to send the current line makes the cursor to jump to the next chunk. While editing rnoweb files, the following commands are available in Normal @@ -562,7 +562,7 @@ R loads by default are highlighted. To add functions of other libraries, you should do the following: 1. Start R from within Vim. - 2. Use R's library() to load the libraries whose functions you want + 2. Use R's `library()` to load the libraries whose functions you want highlighted. 3. Run the following command in Vim's Normal mode: :RUpdateObjList @@ -667,7 +667,7 @@ any) used to classify the objects: Function is.function() Statement isS4() -One limitation is that objects made available by the command data() may not +One limitation is that objects made available by the command `data()` may not have their classes recognized in the GlobalEnv view. @@ -705,7 +705,7 @@ after : Vim can jump to functions defined in other files if you press CTRL-] over the name of a function, but it needs a tags file to be able to find the function definition (see |tags-and-searches|). The command :RBuildTags calls the R -function rtags() to build the tags file for the R scripts in the current +function `rtags()` to build the tags file for the R scripts in the current directory. Please read |r-plugin-tagsfile| to learn how to create a tags file referencing source code located in other directories, including the entire R source code. @@ -718,9 +718,16 @@ Vim-R-plugin will use Tmux to start R in a separate terminal emulator. R will be running inside a Tmux session, but you will hardly notice any difference from R running directly in the terminal emulator. The remaining of this section refers to the case of starting R when Vim already is in a Tmux -session. In this case, the terminal window is split in two regions: one for -Vim and the other for Tmux. Then, it's useful (but not required) to know some -Tmux commands. +session, that is, if you do: +> + tmux + vim filename.R + exit +< +In this case, the terminal window is split in two regions: one for Vim and the +other for Tmux. Then, it's useful (but not required) to know some Tmux +commands. After you finished editing the file, you have to type `exit` to quit +the Tmux session. *r-plugin-tvim* If you always prefer to run Tmux before running Vim you may want to put in your ~/.bashrc: @@ -732,12 +739,13 @@ your ~/.bashrc: function tvim(){ tmux -2 new-session "TERM=screen-256color vim $@" ; } fi < -Then you will be able to start Vim inside a Tmux session by typing: +Then you will be able to start a Tmux session running Vim by typing: > tvim filename.R < -The |--servername| argument is necessary for the automatic update of the -Object Browser. +Using the `tvim` function, the Tmux session is finished when you quits Vim. +That is, the only advantage of using `tvim` is that you do not have to type +`tmux` before and `exit` after the edition of the file. The Tmux configuration file provided by the Vim-R-plugin configures Tmux to use vi key bindings. It also configures Tmux to react to mouse clicks. You @@ -832,7 +840,7 @@ anything. 5.1. R's source() issues~ -The R's source() function prints an extra new line between commands if the +The R's `source()` function prints an extra new line between commands if the option echo = TRUE, and error and warning messages are printed only after the entire code is sourced, which makes it more difficult to find errors in the code sent to R. Details: @@ -881,10 +889,10 @@ indent the code below: 5.5. Wrong message that "R is busy" (Windows only)~ On Windows, when code is sent from Vim to R Console, the vimcom library sets -the value of the internal variable "r_is_busy" to 1. The value is set back to +the value of the internal variable `r_is_busy` to 1. The value is set back to 0 when any code is successfully evaluated. If you send invalid code to R, there will be no successful evaluation of code and, thus, the value of -"r_is_busy" will remain set to 1. Then, if you try to update the object +`r_is_busy` will remain set to 1. Then, if you try to update the object browser, see the R documentation for any function, or do other tasks that require the hidden evaluation of code by R, the vimcom library will refuse to do the tasks to avoid any risk of corrupting R's memory. It will tell Vim that @@ -927,11 +935,11 @@ open and close when the key is pressed over them. |vimrplugin_vsplit| Make Tmux split the window vertically |vimrplugin_rconsole_width| The number of columns of R Console (Tmux split) |vimrplugin_applescript| Use osascript in Mac OS X. -|vimrplugin_listmethods| Do .vim.list.args() instead of args() -|vimrplugin_specialplot| Do .vim.plot() instead of plot() -|vimrplugin_maxdeparse| Argument to R args() function +|vimrplugin_listmethods| Do `vim.list.args()` instead of `args()` +|vimrplugin_specialplot| Do `vim.plot()` instead of `plot()` +|vimrplugin_maxdeparse| Argument to R `args()` function |vimrplugin_latexcmd| Command to run on .tex files -|vimrplugin_sweaveargs| Arguments do Sweave() +|vimrplugin_sweaveargs| Arguments do `Sweave()` |vimrplugin_never_unmake_menu| Do not unmake the menu when switching buffers |vimrplugin_map_r| Use 'r' to send lines and selected text |vimrplugin_ca_ck| Add ^A^K to the beginning of commands. @@ -990,7 +998,7 @@ the Windows XP Command Prompt (click on the title bar and choose let vimrplugin_Rterm = 1 < Technical details: The plugin copies the code to be sent to R to the Windows -clipboard and, then, sends the key strokes "Ctrl+V" to R Console window. +clipboard and, then, sends the key strokes CTRL-V to R Console window. However, neither the Windows 7 PowerShell nor the Windows XP Command Prompt has a keyboard shortcut to "paste". The solution is to set the "Quick Edit Mode" on either PowerShell or Command Prompt and to send a "Right click" to @@ -1149,7 +1157,7 @@ scripts, put the following in your |vimrc|: 6.11. How to automatically open the .Rout file~ *vimrplugin_routnotab* After the command ao, Vim will save the current buffer if it has -any pending changes, run "R CMD BATCH --no-restore --no-save" on the current +any pending changes, run `R CMD BATCH --no-restore --no-save` on the current file and show the resulting .Rout file in a new tab. If you prefer that the file is open in a new split window, put in your |vimrc|: > @@ -1238,13 +1246,13 @@ Otherwise, R will start in an external terminal emulator. 6.17. Special R functions~ *vimrplugin_listmethods* *vimrplugin_specialplot* -The R function args() lists the arguments of a function, but not the arguments +The R function `args()` lists the arguments of a function, but not the arguments of its methods. If you want that the plugin calls the function -.vim.list.args() after ra, you have to add to your |vimrc|: +`vim.list.args()` after ra, you have to add to your |vimrc|: > let vimrplugin_listmethods = 1 < -By default, R makes a scatterplot of numeric vectors. The function .vim.plot() +By default, R makes a scatterplot of numeric vectors. The function `vim.plot()` do both a histogram and a boxplot. The function can be called by the plugin after rg if you put the following line in your |vimrc|: > @@ -1253,7 +1261,7 @@ after rg if you put the following line in your |vimrc|: 6.18. maxdeparse~ *vimrplugin_maxdeparse* -You can set the argument maxdeparse to be passed to R's source() function. +You can set the argument maxdeparse to be passed to R's `source()` function. Example: > let vimrplugin_maxdeparse = 300 @@ -1262,7 +1270,7 @@ Example: 6.19. LaTeX command~ *vimrplugin_latexcmd* *vimrplugin_sweaveargs* -On Windows, the plugin calls tools::texi2pdf() to build the pdf from the +On Windows, the plugin calls `tools::texi2pdf()` to build the pdf from the generated .tex file. On Linux/Unix, by default, Vim calls pdflatex to produce a pdf document from the .tex file produced by the R Sweave command. You can use the option vimrplugin_latexcmd to change this behavior. Examples: @@ -1274,7 +1282,7 @@ You may also want to put the following in your .Rprofile: > options(vimcom.texerrs = TRUE) < -If you want to pass arguments do the Sweave() function, set the value of the +If you want to pass arguments do the `Sweave()` function, set the value of the vimrplugin_sweaveargs variable. @@ -1325,7 +1333,7 @@ in your |vimrc|: *vimrplugin_openpdf_quietly* *vimrplugin_openhtml* The plugin will try to open automatically the pdf file generated by pdflatex, -after either Sweave() or knit(), if you put in your |vimrc|: +after either `Sweave()` or `knit()`, if you put in your |vimrc|: > let vimrplugin_openpdf = 1 < @@ -1365,8 +1373,8 @@ The html file will be automatically opened if you put the following in your *vimrplugin_rst2pdfpath* *vimrplugin_rst2pdfargs* *vimrplugin_rrstcompiler* -By default, the Vim-R-plugin sends the command render_rst(strict=TRUE) to R -before using R's knit() function to convert an Rrst file into an rst one. If +By default, the Vim-R-plugin sends the command `render_rst(strict=TRUE)` to R +before using R's `knit()` function to convert an Rrst file into an rst one. If you prefer the non strict rst code, put the following in your |vimrc|: > let vimrplugin_strict_rst = 0 @@ -1382,7 +1390,7 @@ to R function knit2pdf). Vim-R commands are designed to work in insert mode as well as normal mode. However, depending on your , this can make it very difficult to write R packages or Sweave files. For example, if is set to the -'\' character, typing '\dQuote' in a .Rd file tries to send the command! +`\` character, typing `\dQuote` in a .Rd file tries to send the command! The option vimrplugin_insert_mode_cmds disables commands in insert mode. To use it, add the following to your |vimrc|: @@ -1556,7 +1564,7 @@ command. For example, if your cursor is sitting on top of the object called gender and you call the RAction function, with an argument such as levels, Vim will pass -the command levels(gender) to R, which will show you the levels of the object +the command `levels(gender)` to R, which will show you the levels of the object gender. To make it even easier to use this function, you could write a custom key @@ -1650,7 +1658,7 @@ directory after the installation: 9.1. Is it possible to stop R from within Vim?~ -Sorry, it is not possible. The plugin can only send the quit() command. If you +Sorry, it is not possible. The plugin can only send the `quit()` command. If you want to stop R, you have to press ^C into R's terminal emulator. @@ -1730,9 +1738,9 @@ as the instead of the default backslash (see |maplocalleader|): *r-plugin-tagsfile* Vim can jump to a function definition if it finds a "tags" file with the information about the place where the function is defined. To generate the -tags file, use the R function rtags(), which will build an Emacs tags file. +tags file, use the R function `rtags()`, which will build an Emacs tags file. If Vim was compiled with the feature |emacs_tags|, it will be able to read the -tags file. Otherwise, you can use the function etags2ctags() from the script +tags file. Otherwise, you can use the function `etags2ctags()` from the script located at ~/.vim/r-plugin/etags2ctags.R to convert the Emacs tags file into a Vim's one. To jump to a function definition, put the cursor over the function name and hit CTRL-]. Please, read |tagsrch.txt| for details on how to use tags @@ -1756,7 +1764,7 @@ Note: While defining the autocmd, the RTAGS path must be put before RsrcTags. Example on how to test whether your setup is ok: - 1. Type "mapply()" in an R script and save the buffer. + 1. Type `mapply()` in an R script and save the buffer. 2. Press CTRL-] over "mapply" (Vim should jump to "mapply.R"). 3. Locate the string "do_mapply", which is the name of a C function. 4. Press CTRL-] over "do_mapply" (Vim sould jump to "mapply.c"). @@ -1775,10 +1783,10 @@ If you prefer do not have the arguments of functions aligned, put in your > let r_indent_align_args = 0 < -By default, all lines beginning with a comment character, #, get the same +By default, all lines beginning with a comment character, `#`, get the same indentation level of the normal R code. Users of Emacs/ESS may be used to have -lines beginning with a single # indented in the 40th column, ## indented as R -code, and ### not indented. If you prefer that lines beginning with comment +lines beginning with a single `#` indented in the 40th column, `##` indented as R +code, and `###` not indented. If you prefer that lines beginning with comment characters are aligned as they are by Emacs/ESS, put in your |vimrc|: > let r_indent_ess_comments = 1 @@ -1831,7 +1839,7 @@ plugin option. It is a feature defined in syntax/r.vim. Note: Indentation of R code is very slow because the indentation algorithm sometimes goes backwards looking for an opening parenthesis or brace or for -the beginning of a "for", "if" or "while" statement. This is necessary because +the beginning of a `for`, `if` or `while` statement. This is necessary because the indentation level of a given line depends on the indentation level of the previous line, but the previous line is not always the line above. It's the line where the statement immediately above started. Of course someone may @@ -1931,7 +1939,7 @@ two options and some others: The test for the environment variable DISPLAY is useful if you eventually use the plugin over ssh or on the Linux console. -The X11.options() is used to choose the position and dimensions of the X11 +The `X11.options()` is used to choose the position and dimensions of the X11 graphical device. You can also install the application wmctrl and create shortcuts in your desktop environment to the commands > @@ -1964,11 +1972,11 @@ the R package "debug": library(debug) mtrace(function) < -Once the library is installed and loaded, you should use mtrace(function_name) +Once the library is installed and loaded, you should use `mtrace(function_name)` to enable the debugging of a function. Then, the next time that the function is called it will enter in debugging mode. Once debugging a function, you can -hit to evaluate the current line, go(n) to go to line n in the -function and qqq() to quit the function (See debug's help for details). A +hit to evaluate the current line, `go(n)` to go to line `n` in the +function and `qqq()` to quit the function (See debug's help for details). A useful tip is to click on the title bar of the debug window and choose "Always on top" or a similar option provided by your desktop manager. @@ -2016,8 +2024,8 @@ will produce a german document with a table of contents. 9.20. Integration with LaTeX-Box~ *r-plugin-latex-box* LaTeX-Box does not automatically recognize Rnoweb files as a valid LaTeX file. -You have to tell LaTeX-BoX that the .tex file compiled by either knitr() or -Sweave() is the main LaTeX file. You can do this in two ways. Suppose that +You have to tell LaTeX-BoX that the .tex file compiled by either `knitr()` or +`Sweave()` is the main LaTeX file. You can do this in two ways. Suppose that your Rnoweb file is called report.Rnw... You can: (1) Create an empty file called "report.tex.latexmain". @@ -2028,7 +2036,7 @@ your Rnoweb file is called report.Rnw... You can: % For LaTeX-Box: root = report.tex -Of course you must run either knitr() or Sweave() before trying LaTeX-Box +Of course you must run either `knitr()` or `Sweave()` before trying LaTeX-Box omnicompletion. Please, read LaTeX-Box documentation for more information. See also: |vimrplugin_latexcmd|. @@ -2100,7 +2108,7 @@ Vim-R-plugin. Please look at |vimrplugin_source| for details. *r-plugin-news* 10. News~ -0.9.9.4 (2013-08-24) +0.9.9.4 (2013-08-27) * Minor bug fixes. * The support to GNU Screen, VimShell and Conque Shell was dropped. The From 933531ae86b302b103d821d37aff8a530be285d2 Mon Sep 17 00:00:00 2001 From: Michael Lerch Date: Thu, 5 Sep 2013 13:45:48 -0600 Subject: [PATCH 0459/1050] allow indented code chunks in rmd --- ftplugin/rmd.vim | 14 +++++++------- syntax/rmd.vim | 8 ++++---- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/ftplugin/rmd.vim b/ftplugin/rmd.vim index 48ed068..22de7ab 100644 --- a/ftplugin/rmd.vim +++ b/ftplugin/rmd.vim @@ -54,9 +54,9 @@ runtime r-plugin/common_buffer.vim function! RmdIsInRCode() let curline = line(".") - let chunkline = search("^```[ ]*{r", "bncW") + let chunkline = search("^[ ]*\t*```[ ]*{r", "bncW") call cursor(chunkline) - let docline = search("^```$", "ncW") + let docline = search("^[ ]*\t*```$", "ncW") call cursor(curline) if 0 < chunkline && chunkline < curline && curline < docline return 1 @@ -71,12 +71,12 @@ function! RmdPreviousChunk() range for var in range(1, chunk) let curline = line(".") if RmdIsInRCode() - let i = search("^```[ ]*{r", "bnW") + let i = search("^[ ]*\t*```[ ]*{r", "bnW") if i != 0 call cursor(i-1, 1) endif endif - let i = search("^```[ ]*{r", "bnW") + let i = search("^[ ]*\t*```[ ]*{r", "bnW") if i == 0 call cursor(curline, 1) call RWarningMsg("There is no previous R code chunk to go.") @@ -92,7 +92,7 @@ function! RmdNextChunk() range let rg = range(a:firstline, a:lastline) let chunk = len(rg) for var in range(1, chunk) - let i = search("^```[ ]*{r", "nW") + let i = search("^[ ]*\t*```[ ]*{r", "nW") if i == 0 call RWarningMsg("There is no next R code chunk to go.") return @@ -170,8 +170,8 @@ function! SendRmdChunkToR(e, m) call RWarningMsg("Not inside an R code chunk.") return endif - let chunkline = search("^```[ ]*{r", "bncW") + 1 - let docline = search("^```", "ncW") - 1 + let chunkline = search("^[ ]*\t*```[ ]*{r", "bncW") + 1 + let docline = search("^[ ]*\t*```", "ncW") - 1 let lines = getline(chunkline, docline) let b:needsnewomnilist = 1 let ok = RSourceLines(lines, a:e) diff --git a/syntax/rmd.vim b/syntax/rmd.vim index 2fcb37f..3ba4884 100644 --- a/syntax/rmd.vim +++ b/syntax/rmd.vim @@ -36,13 +36,13 @@ setlocal iskeyword=@,48-57,_,. if exists("g:rmd_syn_hl_chunk") " highlight R code inside chunk header - syntax match rmdChunkDelim "^```{r" contained + syntax match rmdChunkDelim "^[ ]*\t*```{r" contained syntax match rmdChunkDelim "}$" contained else - syntax match rmdChunkDelim "^```{r.*}$" contained + syntax match rmdChunkDelim "^[ ]*\t*```{r.*}$" contained endif -syntax match rmdChunkDelim "^```$" contained -syntax region rmdChunk start="^``` *{r.*}$" end="^```$" contains=@R,rmdChunkDelim keepend transparent fold +syntax match rmdChunkDelim "^[ ]*\t*```$" contained +syntax region rmdChunk start="^[ ]*\t*``` *{r.*}$" end="^```$" contains=@R,rmdChunkDelim keepend transparent fold " also match and syntax highlight in-line R code syntax match rmdEndInline "`" contained From 7161a2869b8321e2053d54d3a85010cead2b66ab Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 5 Sep 2013 18:40:26 -0300 Subject: [PATCH 0460/1050] Improve pattern of spaces at beginning of lines. --- ftplugin/rmd.vim | 14 +++++++------- syntax/rmd.vim | 10 +++++----- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/ftplugin/rmd.vim b/ftplugin/rmd.vim index 22de7ab..a91461a 100644 --- a/ftplugin/rmd.vim +++ b/ftplugin/rmd.vim @@ -54,9 +54,9 @@ runtime r-plugin/common_buffer.vim function! RmdIsInRCode() let curline = line(".") - let chunkline = search("^[ ]*\t*```[ ]*{r", "bncW") + let chunkline = search("^[ \t]*```[ ]*{r", "bncW") call cursor(chunkline) - let docline = search("^[ ]*\t*```$", "ncW") + let docline = search("^[ \t]*```$", "ncW") call cursor(curline) if 0 < chunkline && chunkline < curline && curline < docline return 1 @@ -71,12 +71,12 @@ function! RmdPreviousChunk() range for var in range(1, chunk) let curline = line(".") if RmdIsInRCode() - let i = search("^[ ]*\t*```[ ]*{r", "bnW") + let i = search("^[ \t]*```[ ]*{r", "bnW") if i != 0 call cursor(i-1, 1) endif endif - let i = search("^[ ]*\t*```[ ]*{r", "bnW") + let i = search("^[ \t]*```[ ]*{r", "bnW") if i == 0 call cursor(curline, 1) call RWarningMsg("There is no previous R code chunk to go.") @@ -92,7 +92,7 @@ function! RmdNextChunk() range let rg = range(a:firstline, a:lastline) let chunk = len(rg) for var in range(1, chunk) - let i = search("^[ ]*\t*```[ ]*{r", "nW") + let i = search("^[ \t]*```[ ]*{r", "nW") if i == 0 call RWarningMsg("There is no next R code chunk to go.") return @@ -170,8 +170,8 @@ function! SendRmdChunkToR(e, m) call RWarningMsg("Not inside an R code chunk.") return endif - let chunkline = search("^[ ]*\t*```[ ]*{r", "bncW") + 1 - let docline = search("^[ ]*\t*```", "ncW") - 1 + let chunkline = search("^[ \t]*```[ ]*{r", "bncW") + 1 + let docline = search("^[ \t]*```", "ncW") - 1 let lines = getline(chunkline, docline) let b:needsnewomnilist = 1 let ok = RSourceLines(lines, a:e) diff --git a/syntax/rmd.vim b/syntax/rmd.vim index 3ba4884..244ca41 100644 --- a/syntax/rmd.vim +++ b/syntax/rmd.vim @@ -1,6 +1,6 @@ " markdown Text with R statements " Language: markdown with R code chunks -" Last Change: Tue Feb 26, 2013 01:48PM +" Last Change: Thu Sep 05, 2013 06:35PM " " CONFIGURATION: " To highlight chunk headers as R code, put in your vimrc: @@ -36,13 +36,13 @@ setlocal iskeyword=@,48-57,_,. if exists("g:rmd_syn_hl_chunk") " highlight R code inside chunk header - syntax match rmdChunkDelim "^[ ]*\t*```{r" contained + syntax match rmdChunkDelim "^[ \t]*```{r" contained syntax match rmdChunkDelim "}$" contained else - syntax match rmdChunkDelim "^[ ]*\t*```{r.*}$" contained + syntax match rmdChunkDelim "^[ \t]*```{r.*}$" contained endif -syntax match rmdChunkDelim "^[ ]*\t*```$" contained -syntax region rmdChunk start="^[ ]*\t*``` *{r.*}$" end="^```$" contains=@R,rmdChunkDelim keepend transparent fold +syntax match rmdChunkDelim "^[ \t]*```$" contained +syntax region rmdChunk start="^[ \t]*``` *{r.*}$" end="^```$" contains=@R,rmdChunkDelim keepend transparent fold " also match and syntax highlight in-line R code syntax match rmdEndInline "`" contained From 64f2f0fc410498e7d017d5b4da84d428c0d991a5 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Mon, 9 Sep 2013 07:59:17 -0300 Subject: [PATCH 0461/1050] Define s:tmxcnf if vimrplugin_applescript == 0. --- r-plugin/common_global.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 74ae501..cbf2ce1 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -3146,7 +3146,7 @@ if g:vimrplugin_objbr_place =~ "console" endif " Check whether Tmux is OK -if !has("win32") && !has("win64") && !has("mac") && !has("gui_macvim") && !has("gui_mac") && !has("mac") && !has("macunix") && !has("gui_win32") && !has("gui_win64") +if !has("win32") && !has("win64") && !has("gui_win32") && !has("gui_win64") && g:vimrplugin_applescript == 0 if !executable('tmux') call RWarningMsgInp("Please, install the 'Tmux' application to enable the Vim-R-plugin.") let g:rplugin_failed = 1 From f5d1c7f1b2c1316e9e25904a9339d27192c00977 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Mon, 9 Sep 2013 08:28:47 -0300 Subject: [PATCH 0462/1050] The Object Browser doesn't need GlobalEnvList_. --- r-plugin/common_global.vim | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index cbf2ce1..22c89c5 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -3424,7 +3424,9 @@ endif " Create an empty file to avoid errors if the user do Ctrl-X Ctrl-O before " starting R: -call writefile([], g:rplugin_globalenvfname) +if &filetype != "rbrowser" + call writefile([], g:rplugin_globalenvfname) +endif call SetRPath() From 2717a473da8d9b786d7999c54127dc3c38574be4 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Mon, 9 Sep 2013 08:29:34 -0300 Subject: [PATCH 0463/1050] Set line 1 at while setting file type. --- ftplugin/rbrowser.vim | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ftplugin/rbrowser.vim b/ftplugin/rbrowser.vim index c2a5799..4ccff08 100644 --- a/ftplugin/rbrowser.vim +++ b/ftplugin/rbrowser.vim @@ -370,6 +370,8 @@ else endif unlet s:envstring +call setline(1, ".GlobalEnv | Libraries") + call RSourceOtherScripts() let &cpo = s:cpo_save From 9b74ec2f36c571ec71a5a8de81f5c0c33835290d Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Mon, 9 Sep 2013 08:31:03 -0300 Subject: [PATCH 0464/1050] Correct language declaration. --- syntax/rdoc.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syntax/rdoc.vim b/syntax/rdoc.vim index 727a2e7..3cacfd3 100644 --- a/syntax/rdoc.vim +++ b/syntax/rdoc.vim @@ -1,5 +1,5 @@ " Vim syntax file -" Language: Test version of R documentation +" Language: R documentation " Maintainer: Jakson A. Aquino if exists("b:current_syntax") From 2764da446710ce5f2dfdf926da360c1065e6781f Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Mon, 9 Sep 2013 09:19:52 -0300 Subject: [PATCH 0465/1050] StartR_OSX() does not need arguments. --- r-plugin/common_global.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 22c89c5..2f0d199 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -713,7 +713,7 @@ function StartR_Windows() let g:SendCmdToR = function('SendCmdToR_Windows') endfunction -function StartR_OSX(rcmd) +function StartR_OSX() if IsSendCmdToRFake() return endif From a88f08a01e8b9b5bc9a4bb9c6b3865cbdb25a207 Mon Sep 17 00:00:00 2001 From: Michael Lerch Date: Mon, 9 Sep 2013 07:46:03 -0600 Subject: [PATCH 0466/1050] fix rmd r syntax end expression --- syntax/rmd.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syntax/rmd.vim b/syntax/rmd.vim index 244ca41..d5f3908 100644 --- a/syntax/rmd.vim +++ b/syntax/rmd.vim @@ -42,7 +42,7 @@ else syntax match rmdChunkDelim "^[ \t]*```{r.*}$" contained endif syntax match rmdChunkDelim "^[ \t]*```$" contained -syntax region rmdChunk start="^[ \t]*``` *{r.*}$" end="^```$" contains=@R,rmdChunkDelim keepend transparent fold +syntax region rmdChunk start="^[ \t]*``` *{r.*}$" end="^[ \t]*```$" contains=@R,rmdChunkDelim keepend transparent fold " also match and syntax highlight in-line R code syntax match rmdEndInline "`" contained From 433c5943bcf8b2bfd590ddcb7c1ac02482372247 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Tue, 10 Sep 2013 18:59:36 -0300 Subject: [PATCH 0467/1050] Remove example of mapping to RStart. See https://github.com/jcfaria/Vim-R-plugin/issues/60 --- doc/r-plugin.txt | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index dd1fe89..a726830 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -1457,12 +1457,12 @@ insert mode, and visual mode. To customize a key binding you should put in your |vimrc| something like: > - nmap RStart - imap RStart - vmap RStart + nmap sr RStart + imap sr RStart + vmap sr RStart < The above example shows how to change key binding used to start R from -rf to . +rf to sr. Only the custom key bindings for Normal mode are shown in Vim's menu, but you can type |:map| to see the complete list of current mappings, and below is the @@ -1729,7 +1729,9 @@ You may also want to remap : 9.6. Remap the ~ *r-plugin-localleader* People writing Rnoweb documents may find it better to use a comma or other key -as the instead of the default backslash (see |maplocalleader|): +as the instead of the default backslash (see |maplocalleader|). +For example, to change the to a comma, put at the beginning of +your |vimrc| (before any mapping command): > let maplocalleader = "," < @@ -2095,20 +2097,20 @@ this document from the beginning. } < -9.22. Integragion with GNU Screen, screen plugin, Conque Shell or VimShell~ +9.22. Integration with GNU Screen, screen plugin, Conque Shell or VimShell~ The plugin used to be able to use GNU Screen (through screen plugin), Conque -Shell or VimShell. This integration was removed on August 20, 2013. People -wanting this integration back into the plugin may want to use the old -Vim-R-plugin code as a starting point to create scripts to be sourced by the -Vim-R-plugin. Please look at |vimrplugin_source| for details. +Shell or VimShell to send commands to R. This integration was removed on +August 20, 2013. People wanting this integration back into the plugin may want +to use the old Vim-R-plugin code as a starting point to create scripts to be +sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details. ============================================================================== *r-plugin-news* 10. News~ -0.9.9.4 (2013-08-27) +0.9.9.4 (2013-09-10) * Minor bug fixes. * The support to GNU Screen, VimShell and Conque Shell was dropped. The From ae277900f74883835a08061541284a3361042be7 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 12 Sep 2013 19:03:00 -0300 Subject: [PATCH 0468/1050] Improve syntax highlight of function arguments. --- ftplugin/rdoc.vim | 3 +++ syntax/rdoc.vim | 24 ++++++++++++++++-------- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/ftplugin/rdoc.vim b/ftplugin/rdoc.vim index 329cce3..cc5c5b2 100644 --- a/ftplugin/rdoc.vim +++ b/ftplugin/rdoc.vim @@ -47,6 +47,9 @@ function! FixRdoc() let lnr = line("$") for i in range(1, lnr) call setline(i, substitute(getline(i), "_\010", "", "g")) + " A space after 'Arguments:' is necessary for correct syntax highlight + " of the first argument + call setline(i, substitute(getline(i), "^Arguments:", "Arguments: ", "")) endfor let has_ex = search("^Examples:$") if has_ex diff --git a/syntax/rdoc.vim b/syntax/rdoc.vim index 3cacfd3..a0fbb5d 100644 --- a/syntax/rdoc.vim +++ b/syntax/rdoc.vim @@ -17,28 +17,36 @@ endif exec "syn sync minlines=" . rdoc_minlines . " maxlines=" . rdoc_maxlines -syn match rdocTitle "^[A-Z].*:" +syn match rdocTitle "^[A-Z].*:$" syn match rdocTitle "^\S.*R Documentation$" -syn region rdocStringS start="‘" end="’" -syn region rdocStringS start="‘" end="’" +syn match rdocFunction "\([A-Z]\|[a-z]\|\.\|_\)\([A-Z]\|[a-z]\|[0-9]\|\.\|_\)*" contained +syn region rdocStringS start="‘" end="’" contains=rdocFunction transparent keepend +syn region rdocStringS start="‘" end="’" contains=rdocFunction transparent keepend syn region rdocStringD start='"' skip='\\"' end='"' syn match rdocURL `\v<(((https?|ftp|gopher)://|(mailto|file|news):)[^' <>"]+|(www|web|w3)[a-z0-9_-]*\.[a-z0-9._-]+\.[^' <>"]+)[a-zA-Z0-9/]` syn keyword rdocNote note Note NOTE note: Note: NOTE: Notes Notes: -syn match rdocArg "^\s*\([a-z]\|[A-Z]\|[0-9]\|\.\|_\)*: " - -syn include @rdocR syntax/r.vim -syn region rdocExample matchgroup=rdocExTitle start="^Examples:$" matchgroup=rdocExEnd end='^###$' contains=@rdocR keepend " When using vim as R pager to see the output of help.search(): syn region rdocPackage start="^[A-Za-z]\S*::" end="[\s\r]" contains=rdocPackName,rdocFuncName transparent syn match rdocPackName "^[A-Za-z][A-Za-z0-9\.]*" contained syn match rdocFuncName "::[A-Za-z0-9\.\-_]*" contained +syn match rdocArgItems "\n\n.\{-}:" contains=rdocArg contained transparent + +syn region rdocArgReg matchgroup=rdocArgTitle start="^Arguments:" end="^[A-Z].*:$" contains=rdocArgItems,rdocArgTitle,rdocPackage,rdocFuncName,rdocStringS keepend transparent +syn match rdocArg "\([A-Z]\|[a-z]\|[0-9]\|\.\|_\)*" contained + + +syn include @rdocR syntax/r.vim +syn region rdocExample matchgroup=rdocExTitle start="^Examples:$" matchgroup=rdocExEnd end='^###$' contains=@rdocR keepend + " Define the default highlighting. +"hi def link rdocArgReg Statement hi def link rdocTitle Title +hi def link rdocArgTitle Title hi def link rdocExTitle Title hi def link rdocExEnd Comment -hi def link rdocStringS Function +hi def link rdocFunction Function hi def link rdocStringD String hi def link rdocURL HtmlLink hi def link rdocArg Special From 4cb57ef553938d84d2ef8e8566c7d27dafb7cd23 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 12 Sep 2013 19:10:06 -0300 Subject: [PATCH 0469/1050] Delete no longer necessary wrapper to RAction. --- r-plugin/common_global.vim | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 2f0d199..de6efb0 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -2212,7 +2212,7 @@ function PrintRObject(rkeyword) endfunction " Call R functions for the word under cursor -function RRealAction(rcmd) +function RAction(rcmd) if &filetype == "rbrowser" let rkeyword = RBrowserGetName(1) else @@ -2273,16 +2273,6 @@ function RRealAction(rcmd) endif endfunction -function RAction(rcmd) - "if v:servername != "" - " Py SendToVimCom("\x08Stop updating info [RAction()]") - "endif - call RRealAction(a:rcmd) - "if v:servername != "" - " exe 'Py SendToVimCom("\x07' . v:servername . '")' - "endif -endfunction - if exists('g:maplocalleader') let s:tll = '' . g:maplocalleader else From aa170d1ec06cec4802db7e237d8c67e09e8bcd42 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 12 Sep 2013 21:29:28 -0300 Subject: [PATCH 0470/1050] Don't write the first line of Object Browser. --- ftplugin/rbrowser.vim | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/ftplugin/rbrowser.vim b/ftplugin/rbrowser.vim index 4ccff08..c9bbe15 100644 --- a/ftplugin/rbrowser.vim +++ b/ftplugin/rbrowser.vim @@ -101,12 +101,11 @@ function! UpdateOB(what) sil normal! ggdG let @@ = save_unnamed_reg if wht == "GlobalEnv" - call setline(1, ".GlobalEnv | Libraries") - exe "silent read " . g:rplugin_esc_tmpdir . g:rplugin_globenv_f + let fcntt = readfile($VIMRPLUGIN_TMPDIR . g:rplugin_globenv_f) else - call setline(1, "Libraries | .GlobalEnv") - exe "silent read " . g:rplugin_esc_tmpdir . g:rplugin_liblist_f + let fcntt = readfile($VIMRPLUGIN_TMPDIR . g:rplugin_liblist_f) endif + call setline(1, fcntt) call cursor(curline, curcol) if bufname("%") =~ "Object_Browser" || b:rplugin_extern_ob setlocal nomodifiable @@ -267,14 +266,14 @@ function! RBrowserGetName(cleantail) let word = '`' . word . '`' endif - if curpos == 4 + if (g:rplugin_curview == "GlobalEnv" && curpos == 4) || (g:rplugin_curview == "libraries" && curpos == 3) " top level object let word = substitute(word, '\$\[\[', '[[', "g") if a:cleantail let word = substitute(word, '[\$@]$', '', '') endif if g:rplugin_curview == "libraries" - return "package:" . word + return "package:" . substitute(word, "#", "", "") else return word endif From bd0617fc3f6cbddd193eb65861332cd8f373c1f9 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 12 Sep 2013 21:30:11 -0300 Subject: [PATCH 0471/1050] Use readfile() instead of :read. --- r-plugin/common_global.vim | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index de6efb0..54af1d3 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -2141,9 +2141,10 @@ function ShowRDoc(rkeyword, package, getclass) let save_unnamed_reg = @@ sil normal! ggdG - exe "read " . substitute(g:rplugin_docfile, ' ', '\\ ', 'g') + let fcntt = readfile(g:rplugin_docfile) + call setline(1, fcntt) set filetype=rdoc - normal! ggdd + normal! gg let @@ = save_unnamed_reg setlocal nomodified setlocal nomodifiable From d2fff3326d2803a3837d6134c3405b9ae4b9ad28 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 14 Sep 2013 09:35:43 -0300 Subject: [PATCH 0472/1050] Improve warning message. --- r-plugin/common_global.vim | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 54af1d3..9a52f2f 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -633,7 +633,7 @@ endfunction function StartR_ExternalTerm(rcmd) if $DISPLAY == "" - call RWarningMsg("The X Window system is required to run R in an external terminal.") + call RWarningMsg("Start 'tmux' before Vim. The X Window system is required to run R in an external terminal.") return endif @@ -668,10 +668,7 @@ function StartR_ExternalTerm(rcmd) call system('tmux set-option -ga update-environment " TMUX_PANE VIMRPLUGIN_TMPDIR VIMINSTANCEID"') endif let tmuxcnf = '-f "' . s:tmxcnf . '"' - if $DISPLAY == "" - call RWarningMsg("The X Window system is required to run R in an external terminal.") - return - endif + call system("tmux has-session -t " . g:rplugin_tmuxsname) if v:shell_error if g:rplugin_termcmd =~ "gnome-terminal" || g:rplugin_termcmd =~ "xfce4-terminal" || g:rplugin_termcmd =~ "terminal" || g:rplugin_termcmd =~ "iterm" From abf548f6189acadfc90ce1e078c41099b37ad7d1 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sun, 22 Sep 2013 17:28:53 -0300 Subject: [PATCH 0473/1050] Update the Object Browser after \ro. --- r-plugin/common_global.vim | 2 ++ 1 file changed, 2 insertions(+) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 9a52f2f..1ebf57d 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -875,6 +875,8 @@ function StartObjBrowser_Tmux() " Don't start the Object Browser if it already exists if IsExternalOBRunning() + Py SendToVimCom("\003GlobalEnv [OB init]") + Py SendToVimCom("\004Libraries [OB init]") return endif From 7be86ae7569b6ffa476bc8b114fe2daadf5cd7e6 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sun, 22 Sep 2013 17:29:32 -0300 Subject: [PATCH 0474/1050] The package vimcom now is vimcom.plus. --- doc/r-plugin.txt | 107 ++++++++++++++++++++++++----------------------- 1 file changed, 54 insertions(+), 53 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index a726830..c98d79e 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -127,57 +127,51 @@ In addition to having R and Vim installed in your system, this plugin has the following dependencies: Depends:~ - Tmux >= 1.5: http://tmux.sourceforge.net - vimcom = 0.9-9: An R package. + + vimcom.plus = 0.9-9: http://www.lepem.ufc.br/jaa/vimcom.plus.html + The vimcom.plus (or vimcom) package creates a server on R to + allow the communication with Vim. The package is not used to + send commands from Vim to R Console, but it is necessary to + open R documentation in Vim's buffer, run the Object + Browser, run either `Sweave()` or `knit()` on the document + being edited. It also has some functions called by Vim such + as `vim.plot()`, `vim.print()`, and `vim.bol()`. This last + one is required to build the data base used in + omnicompletion. + + Tmux >= 1.5: http://tmux.sourceforge.net + Tmux is necessary to send commands from Vim to R Console. Suggests:~ - ncurses-term: http://invisible-island.net/ncurses + colorout: http://www.lepem.ufc.br/jaa/colorout.html - setwidth: An R package. + Colorizes the R output. + + setwidth: An R package that can be installed with the command + `install.packages("setwidth")`. + The library setwidth adjusts the value of `options("width")` + whenever the terminal is resized. + + ncurses-term: http://invisible-island.net/ncurses + Might be useful if you want support for 256 colors at the + terminal emulator. + latexmk: Automate the compilation of LaTeX documents. See examples in |vimrplugin_latexcmd|. Note: Tmux and ncurses-term are already packaged for most GNU/Linux - distributions and other Unix variants. The library ncurses-term is - necessary only for 256 color support in the terminal emulator. - Unfortunately their installation instructions vary widely and are beyond - the scope of this documentation. - - The vimcom package creates a server on R to allow the communication with - Vim. The package is not used to send commands from Vim to R Console, but it - is necessary to open R documentation in Vim's buffer, run the Object - Browser, run either `Sweave()` or `knit()` on the document being edited. It - also has some functions called by Vim such as `vim.plot()`, `vim.print()`, and - `vim.bol()`. This last one is required to build the data base used in - omnicompletion. Before installing vimcom from source, you have to install - the X server development headers. On Debian/Ubuntu systems you can install - them with the following command in a terminal emulator: -> - sudo apt-get install libx11-dev -< - On Fedora/Red Hat, the command is: -> - sudo yum install libX11-devel -< - Finally, do in R: -> - install.packages("vimcom") -< - The colorout package colorizes the R output and the setwidth package - adjusts the value of `options("width")` whenever the terminal is resized. - They can be installed from within R. - - The setwidth package can be installed as usual: -> - install.packages("setwidth") -< + distributions and other Unix variants. Unfortunately their installation + instructions vary widely and are beyond the scope of this documentation. + You certainly will want to put something like the following at the end of your ~/.Rprofile: > if(interactive()){ library(colorout) library(setwidth) - library(vimcom) + library(vimcom.plus) + # If you can't install the vimcom.plus package, do: + # library(vimcom) } < If you start either GVim or Vim in a terminal emulator the plugin will start R @@ -230,9 +224,11 @@ to install external dependencies: installed. * vimcom = 0.9-9: An R package, available on CRAN and installable with the - `install.packages()` command. The vimcom package creates a server on R to - allow the communication with Vim. You certainly will want to put the - following lines at the end of your Rprofile. + command: `install.packages("vimcom")` + See also: http://www.lepem.ufc.br/jaa/vimcom.plus.html + The vimcom package creates a server on R to allow the communication with + Vim. You certainly will want to put the following lines at the end of + your Rprofile. > if(interactive()){ library(vimcom) @@ -282,7 +278,8 @@ you may prefer to install the Debian package available at: http://www.lepem.ufc.br/jaa/vim-r-plugin.html Did you see the message "VimCom port not found"? This means that R is not -running, the vimcom package is not installed, or R was not started by Vim. +running, the vimcom.plus (or vimcom) package is not installed, or R was not +started by Vim. 3.4. General instructions II (optional steps)~ @@ -642,14 +639,14 @@ in your ~/.bashrc: fi < In the .GlobalEnv view, if an object has the attribute "label", it will also -be displayed. Please, see the R help for package vimcom for some options to -control the Object Browser behavior. In the Object Browser window, while in -Normal mode, you can either press or double click (GVim only) over a -data.frame or list to show/hide its elements (not if viewing the content of -loaded libraries). If you are running R in an environment where the string -UTF-8 is part of either LC_MESSAGES or LC_ALL variables, unicode line drawing -characters will be used to draw lines in the Object Browser. This is the case -of most Linux distributions. +be displayed. Please, see the R help for package vimcom.plus (or vimcom) for +some options to control the Object Browser behavior. In the Object Browser +window, while in Normal mode, you can either press or double click +(GVim only) over a data.frame or list to show/hide its elements (not if +viewing the content of loaded libraries). If you are running R in an +environment where the string UTF-8 is part of either LC_MESSAGES or LC_ALL +variables, unicode line drawing characters will be used to draw lines in the +Object Browser. This is the case of most Linux distributions. In the Libraries view, you can either double click or press over a library to see its objects. In the Object Browser, the libraries have the @@ -1924,7 +1921,9 @@ two options and some others: library(setwidth) options(vimcom.verbose = 1, vimcom.allnames = TRUE) if(Sys.getenv("VIMRPLUGIN_TMPDIR") != "") - library(vimcom) + library(vimcom.plus) + # If you can't install the vimcom.plus package, do: + # library(vimcom) if(Sys.getenv("TERM") != "linux" && Sys.getenv("TERM") != "") setOutputColors256(verbose = FALSE) if(nchar(Sys.getenv("DISPLAY")) > 1){ @@ -2093,7 +2092,9 @@ this document from the beginning. setOutputColors256(verbose = FALSE) library(setwidth) if(Sys.getenv("VIMRPLUGIN_TMPDIR") != "") - library(vimcom) + library(vimcom.plus) + # If you can't install the vimcom.plus package, do: + # library(vimcom) } < @@ -2110,7 +2111,7 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details. *r-plugin-news* 10. News~ -0.9.9.4 (2013-09-10) +0.9.9.4 (2013-09-14) * Minor bug fixes. * The support to GNU Screen, VimShell and Conque Shell was dropped. The From 427c2fd3aaaf3c7242f65f76ae0d8088ebd5724b Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Tue, 24 Sep 2013 09:23:49 -0300 Subject: [PATCH 0475/1050] Version 0.9.9.4. --- doc/r-plugin.txt | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index c98d79e..9af3731 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -232,6 +232,8 @@ to install external dependencies: > if(interactive()){ library(vimcom) + # If you can install vimcom.plus, do: + # library(vimcom.plus) } < You can do `Sys.getenv("HOME")` in the R Console to know where the file @@ -885,16 +887,17 @@ indent the code below: 5.5. Wrong message that "R is busy" (Windows only)~ -On Windows, when code is sent from Vim to R Console, the vimcom library sets -the value of the internal variable `r_is_busy` to 1. The value is set back to -0 when any code is successfully evaluated. If you send invalid code to R, -there will be no successful evaluation of code and, thus, the value of -`r_is_busy` will remain set to 1. Then, if you try to update the object -browser, see the R documentation for any function, or do other tasks that -require the hidden evaluation of code by R, the vimcom library will refuse to -do the tasks to avoid any risk of corrupting R's memory. It will tell Vim that -"R is busy" and Vim will display this message. Everything should work as -expected again after any valid code is executed in the R Console. +On Windows, when code is sent from Vim to R Console, the vimcom (or +vimcom.plus) library sets the value of the internal variable `r_is_busy` to 1. +The value is set back to 0 when any code is successfully evaluated. If you +send invalid code to R, there will be no successful evaluation of code and, +thus, the value of `r_is_busy` will remain set to 1. Then, if you try to +update the object browser, see the R documentation for any function, or do +other tasks that require the hidden evaluation of code by R, the vimcom +library will refuse to do the tasks to avoid any risk of corrupting R's +memory. It will tell Vim that "R is busy" and Vim will display this message. +Everything should work as expected again after any valid code is executed in +the R Console. 5.6. Problems with Fish Shell~ @@ -2111,9 +2114,10 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details. *r-plugin-news* 10. News~ -0.9.9.4 (2013-09-14) +0.9.9.4 (2013-09-24) * Minor bug fixes. + * The package now depends on vimcom.plus. * The support to GNU Screen, VimShell and Conque Shell was dropped. The screen plugin no longer is used. * The delete command was removed from the Object Browser. From d84926e8f0e3b0f6b91d3022c6de6a8b6ff00be3 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Wed, 25 Sep 2013 23:11:38 -0300 Subject: [PATCH 0476/1050] Note on conflict with Fish Shell and tcsh. --- doc/r-plugin.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 9af3731..0c5728b 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -174,6 +174,11 @@ following dependencies: # library(vimcom) } < + Conflicts:~ + + Users have reported that the Vim-R-plugin might not work well with Fish + Shell and tcsh. + If you start either GVim or Vim in a terminal emulator the plugin will start R in a external terminal emulator. If you start Vim inside of a Tmux session, the plugin will split the Tmux window in two and start R in the other pane. From 332b98b74198a17c9cf829b72a0439994e3f841e Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Wed, 25 Sep 2013 23:12:28 -0300 Subject: [PATCH 0477/1050] Delete ` from HTML version of documentation. --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 5a2b36f..e9109a4 100644 --- a/Makefile +++ b/Makefile @@ -229,6 +229,7 @@ htmldoc: sed -i -e 's/<\/a>|/<\/a>/g' r-plugin.html ;\ sed -i -e 's/||/<\/code>/g' r-plugin.html ;\ + sed -i -e 's/`//g' r-plugin.html ;\ mv r-plugin.html vim-stylesheet.css /tmp ) all: zip deb htmldoc From 235be9e19611c92c7191559b7469eb86207efa2f Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 26 Sep 2013 00:26:09 -0300 Subject: [PATCH 0478/1050] Warn that \r= is valid only for GlobalEnv. --- r-plugin/common_global.vim | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 1ebf57d..9b8af4b 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -789,14 +789,14 @@ function StartR(whatr) call delete($VIMRPLUGIN_TMPDIR . "/vimcom_running") call g:SendCmdToR(g:rplugin_last_rcmd) if IsExternalOBRunning() - call remote_expr(g:rplugin_obsname, 'ResetVimComPort()') + call VimExprToOB('ResetVimComPort()') call WaitVimComStart() exe 'Py SendToVimCom("\007' . g:rplugin_obsname . '")' Py SendToVimCom("\003.GlobalEnv [Restarting R]") Py SendToVimCom("\004Libraries [Restarting()]") " vimcom automatically update the libraries view, but not " the GlobalEnv one because vimcom_count_objects() returns 0. - call remote_expr(g:rplugin_obsname, 'UpdateOB("GlobalEnv")') + call VimExprToOB('UpdateOB("GlobalEnv")') endif return elseif IsSendCmdToRFake() @@ -1086,7 +1086,34 @@ function RObjBrowser() return endfunction +function VimExprToOB(msg) + if serverlist() =~ "\\<" . g:rplugin_obsname . "\n" + return remote_expr(g:rplugin_obsname, a:msg) + endif + return "Vim server not found" +endfunction + function RBrowserOpenCloseLists(status) + if a:status == 1 + if exists("g:rplugin_curview") + let curview = g:rplugin_curview + else + if IsExternalOBRunning() + let curview = VimExprToOB('g:rplugin_curview') + else + let curview = "GlobalEnv" + endif + endif + if curview == "libraries" + echohl WarningMsg + echon "GlobalEnv command only." + sleep 1 + echohl Normal + normal! : + return + endif + endif + " Avoid possibly freezing cross messages between Vim and R if exists("g:rplugin_curview") && v:servername != "" Py SendToVimCom("\x08Stop updating info [RBrowserOpenCloseLists()]") @@ -1119,7 +1146,7 @@ function RBrowserOpenCloseLists(status) exe 'Py SendToVimCom("\007' . v:servername . '")' endif elseif IsExternalOBRunning() - call remote_expr(g:rplugin_obsname, 'UpdateOB("GlobalEnv")') + call VimExprToOB('UpdateOB("GlobalEnv")') exe 'Py SendToVimCom("\007' . g:rplugin_obsname . '")' endif endfunction From 0d5084b4bb58f51ad0eaa8e8b2d8ad69721d7610 Mon Sep 17 00:00:00 2001 From: Michael Lerch Date: Fri, 27 Sep 2013 18:01:12 -0600 Subject: [PATCH 0479/1050] improve rmd syntax matching --- syntax/rmd.vim | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/syntax/rmd.vim b/syntax/rmd.vim index d5f3908..02429a6 100644 --- a/syntax/rmd.vim +++ b/syntax/rmd.vim @@ -42,12 +42,15 @@ else syntax match rmdChunkDelim "^[ \t]*```{r.*}$" contained endif syntax match rmdChunkDelim "^[ \t]*```$" contained -syntax region rmdChunk start="^[ \t]*``` *{r.*}$" end="^[ \t]*```$" contains=@R,rmdChunkDelim keepend transparent fold +syntax region rmdChunk start="^[ \t]*``` *{r.*}$" end="^[ \t]*```$" contains=@R,rmdChunkDelim keepend fold " also match and syntax highlight in-line R code syntax match rmdEndInline "`" contained syntax match rmdBeginInline "`r " contained -syntax region rmdrInline start="`r " end="`" contains=@R,rmdBeginInline,rmdEndInline keepend transparent +syntax region rmdrInline start="`r " end="`" contains=@R,rmdBeginInline,rmdEndInline keepend + +" match slidify special marker +syntax match rmdSlidifySpecial "\*\*\*" if rmdIsPandoc == 0 @@ -65,6 +68,7 @@ if rmdIsPandoc == 0 syntax match rmdLaTeXRegDelim "\$\$" contained syntax match rmdLaTeXRegDelim "\$\$latex$" contained syntax region rmdLaTeXRegion start="^\$\$" skip="\\\$" end="^\$\$" contains=@LaTeX,rmdLaTeXSt,rmdLaTeXRegDelim keepend + syntax region rmdLaTeXRegion2 start="^\\\[" end="\\\]" contains=@LaTeX,rmdLaTeXSt,rmdLaTeXRegDelim keepend hi def link rmdLaTeXSt Statement hi def link rmdLaTeXInlDelim Special hi def link rmdLaTeXRegDelim Special @@ -74,5 +78,6 @@ hi def link rmdChunkDelim Special hi def link rmdBeginInline Special hi def link rmdEndInline Special hi def link rmdBlockQuote Comment +hi def link rmdSlidifySpecial Special let b:current_syntax = "rmd" From 54b8ef90c833f8524e8c20092cc63de60980e273 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 28 Sep 2013 23:08:41 -0300 Subject: [PATCH 0480/1050] Begin of 0.9.9.5 development. --- Makefile | 4 ++-- doc/r-plugin.txt | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index e9109a4..192985d 100644 --- a/Makefile +++ b/Makefile @@ -29,7 +29,7 @@ PLUGINHOME=`pwd` -PLUGINVERSION=0.9.9.4 +PLUGINVERSION=0.9.9.5 DEBIANTIME=`date -R` PLUGINRELEASEDATE=`date +"%Y-%m-%d"` VIM2HTML=/usr/local/share/vim/vim73/doc/vim2html.pl @@ -54,7 +54,7 @@ zip: r-plugin/objlist/omnils_datasets r-plugin/objlist/omnils_graphics \ r-plugin/objlist/omnils_grDevices r-plugin/objlist/omnils_methods \ r-plugin/objlist/omnils_stats r-plugin/objlist/omnils_utils \ - r-plugin/objlist/omnils_vimcom r-plugin/objlist/README \ + r-plugin/objlist/omnils_vimcom.plus r-plugin/objlist/README \ r-plugin/tex_indent.vim r-plugin/r.snippets \ r-plugin/common_buffer.vim r-plugin/common_global.vim \ bitmaps/ricon.xbm bitmaps/ricon.png \ diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 0c5728b..f798faf 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -5,7 +5,7 @@ Authors: Jakson A. Aquino Jose Claudio Faria -Version: 0.9.9.4 +Version: 0.9.9.5 For Vim version 7.4 1. Overview |r-plugin-overview| @@ -2119,6 +2119,10 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details. *r-plugin-news* 10. News~ +0.9.9.5 (2013-09-28) + + * Minor bug fixes. + 0.9.9.4 (2013-09-24) * Minor bug fixes. From 8c1a332133ea95f2a6ca3dfcf4c8b3dd6e71055e Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 3 Oct 2013 01:00:32 -0300 Subject: [PATCH 0481/1050] Update warning message. --- r-plugin/vimcom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/r-plugin/vimcom.py b/r-plugin/vimcom.py index 775c087..da19294 100644 --- a/r-plugin/vimcom.py +++ b/r-plugin/vimcom.py @@ -49,7 +49,7 @@ def DiscoverVimComPort(): vim.command("let g:rplugin_vimcomport = " + str(VimComPort)) PortWarn = False if repl.find("0.9-9") != 0: - vim.command("call RWarningMsg('This version of Vim-R-plugin requires vimcom 0.9-9.')") + vim.command("call RWarningMsg('This version of Vim-R-plugin requires vimcom.plus (or vimcom) 0.9-9.')") vim.command("sleep 1") return(VimComPort) From 12469fa7b7d4be3dd609457daeae3b318574d6f2 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 3 Oct 2013 10:29:41 -0300 Subject: [PATCH 0482/1050] Check for "vimcom.plus" in "what port" reply. --- r-plugin/vimcom.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/r-plugin/vimcom.py b/r-plugin/vimcom.py index da19294..5428780 100644 --- a/r-plugin/vimcom.py +++ b/r-plugin/vimcom.py @@ -34,6 +34,8 @@ def DiscoverVimComPort(): sock.close() if repl.find(correct_repl): VimComFamily = af + if repl.find("vimcom.plus"): + vim.command("let g:rplugin_vimcom_pkg = 'vimcom.plus'") break except: sock = None From dedb8170b9ff10dc7d9bc48f56ca4a970a52a405 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 3 Oct 2013 10:32:24 -0300 Subject: [PATCH 0483/1050] Check if "vimcom.plus" is installed. --- r-plugin/common_global.vim | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 9b8af4b..25df416 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -217,12 +217,24 @@ function RCompleteArgs() let rkeyword = '^' . rkeyword0 . "\x06" call cursor(cpos[1], cpos[2]) + "TODO: Delete this temporary code when vimcom 1.0-0 is released: + if g:rplugin_vimcom_pkg != "vimcom.plus" + Py SendToVimCom("find.package('vimcom.plus', quiet = TRUE)") + let g:rplugin_lastrpl = ReadEvalReply() + if g:rplugin_vimcomport > 0 + let g:rplugin_lastrpl = ReadEvalReply() + if g:rplugin_lastrpl =~ "vimcom.plus" + let g:rplugin_vimcom_pkg = "vimcom.plus" + endif + endif + endif + " If R is running, use it call delete($VIMRPLUGIN_TMPDIR . "/eval_reply") if classfor == "" - exe 'Py SendToVimCom("vimcom:::vim.args(' . "'" . rkeyword0 . "', '" . argkey . "')" . '")' + exe 'Py SendToVimCom("' . g:rplugin_vimcom_pkg . ':::vim.args(' . "'" . rkeyword0 . "', '" . argkey . "')" . '")' else - exe 'Py SendToVimCom("vimcom:::vim.args(' . "'" . rkeyword0 . "', '" . argkey . "', classfor = " . classfor . ")" . '")' + exe 'Py SendToVimCom("' . g:rplugin_vimcom_pkg . ':::vim.args(' . "'" . rkeyword0 . "', '" . argkey . "', classfor = " . classfor . ")" . '")' endif if g:rplugin_vimcomport > 0 let g:rplugin_lastrpl = ReadEvalReply() @@ -3411,6 +3423,7 @@ let g:rplugin_has_new_lib = 0 let g:rplugin_has_new_obj = 0 let g:rplugin_ob_warn_shown = 0 let g:rplugin_vimcomport = 0 +let g:rplugin_vimcom_pkg = "vimcom" let g:rplugin_lastrpl = "" let g:rplugin_ob_busy = 0 let g:rplugin_hasRSFbutton = 0 From feef2aa55d8fc31c0765b76334700a4a03346d4f Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Mon, 7 Oct 2013 00:22:29 -0300 Subject: [PATCH 0484/1050] Update on how to use Vim to see R documentation. The command options(pager = "vim -c 'set ft=rdoc' -") no longer works. The solution is to write a shell script and use it as pager. The content of the script should be: #!/bin/sh cat | vim -c 'set ft=rdoc' - --- doc/r-plugin.txt | 56 +++++++++++++++++++++++++++--------------------- 1 file changed, 32 insertions(+), 24 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index f798faf..968d26e 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -340,8 +340,8 @@ commands to R. This plugin has many key bindings, which correspond with menu entries and, in some cases, toolbar buttons. In the list below, the backslash represents the -. Not all menu items and key bindings are -enabled in all filetypes supported by the plugin (r, rnoweb, rhelp): +. Not all menu items and key bindings are enabled in all +filetypes supported by the plugin (r, rnoweb, rhelp): Start/Close . Start R (default) \rf @@ -464,9 +464,11 @@ The plugin commands that send code to R Console are the most commonly used. If the code to be sent to R has a single line it is sent directly to R Console, but if it has more than one line (a selection of lines, a block of lines between two marks, a paragraph etc) the lines are written to a file and the -plugin sends to R the command to source the file. For example, when sending a -selection of lines, you should do either se or sa -instead of ss to see what lines are being sourced. +plugin sends to R the command to source the file. You should type quickly +d to send to R Console the line currently under the cursor. If +you want to see what lines are being sourced when sending a selection of +lines, you should do either se or sa instead of +ss. After the command ao, Vim will save the current buffer if it has any pending changes, run "R CMD BATCH --no-restore --no-save" on the current @@ -624,13 +626,12 @@ them. 4.5. The Object Browser~ You have to do ro to either start or updated the Object Browser. -The updating is automatic only if the Object Browser is running in a separate -Tmux panel. The Object Browser has two views: .GlobalEnv and Libraries. If you -either press or double click (GVim or Vim with 'mouse' set to "a") on -the first line of the Object Browser it will toggle the view between the -objects in .GlobalEnv and the currently loaded libraries. The Object Browser -requires the |+clientserver| feature to be automatically updated and the -|+conceal| feature to correctly align list items. +The Object Browser has two views: .GlobalEnv and Libraries. If you either +press or double click (GVim or Vim with 'mouse' set to "a") on the +first line of the Object Browser it will toggle the view between the objects +in .GlobalEnv and the currently loaded libraries. The Object Browser requires +the |+clientserver| feature to be automatically updated and the |+conceal| +feature to correctly align list items. Note: On Linux you may find binaries without the |clientserver| feature if you install packages such as vim-nox on Debian/Ubuntu or vim-enhanced on @@ -1072,10 +1073,10 @@ If you do not want to see R documentation in a Vim's buffer, put in your let vimrplugin_vimpager = "no" < If you want to use Vim to see R documentation even when looking for help in -the R console, put in your .Rprofile: -> - options(pager = "vim -c 'set ft=rdoc' -") -< +the R console, you have to create a shell script in your path that will call +Vim in the right way. You can, for example, create a file named +`~/bin/vimrpager` to do that (see |r-plugin-quick-setup|). + 6.5.2. Details and other options:~ @@ -1920,9 +1921,7 @@ line in your |vimrc|: 9.15. Edit your ~/.Rprofile~ -You may want to edit your ~/.Rprofile. Two common options are the use of GVim -as the text editor and the use of Vim as pager. Example for Linux with these -two options and some others: +You may want to edit your ~/.Rprofile. Example for Linux: > if(interactive()){ library(colorout) @@ -1938,15 +1937,13 @@ two options and some others: grDevices::X11.options(width = 4.5, height = 4, ypos = 0, xpos = 1000, pointsize = 10) options(editor = 'gvim -f -c "set ft=r"') - options(pager = "gvim -c 'set ft=rdoc' -") } else { options(editor = 'vim -c "set ft=r"') - options(pager = "vim -c 'set ft=rdoc' -") } } < The test for the environment variable DISPLAY is useful if you eventually use -the plugin over ssh or on the Linux console. +the plugin in the Linux console. The `X11.options()` is used to choose the position and dimensions of the X11 graphical device. You can also install the application wmctrl and create @@ -2090,7 +2087,7 @@ this document from the beginning. vimcom.verbose = 1, vimcom.allnames = FALSE, vimcom.texerrs = TRUE, - pager = "vim -c 'set ft=rdoc' -") + pager = "vimrpager") if(nchar(Sys.getenv("DISPLAY")) > 1) options(editor = 'gvim -f -c "set ft=r"') else @@ -2105,6 +2102,17 @@ this document from the beginning. # library(vimcom) } < + ~/bin/vimrpager~ +> + #!/bin/sh + + cat | vim -c 'set ft=rdoc' - +< +NOTE: You have to change the `~/bin/vimrpager` permissions to make it +executable: +> + chmod +x ~/bin/vimrpager +< 9.22. Integration with GNU Screen, screen plugin, Conque Shell or VimShell~ @@ -2119,7 +2127,7 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details. *r-plugin-news* 10. News~ -0.9.9.5 (2013-09-28) +0.9.9.5 (2013-10-07) * Minor bug fixes. From fb8207432b16985967005c5b410a3373b209a88a Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Wed, 9 Oct 2013 08:44:49 -0300 Subject: [PATCH 0485/1050] Get object name correctly when it has label. --- ftplugin/rbrowser.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ftplugin/rbrowser.vim b/ftplugin/rbrowser.vim index c9bbe15..bff1509 100644 --- a/ftplugin/rbrowser.vim +++ b/ftplugin/rbrowser.vim @@ -257,7 +257,7 @@ function! RBrowserGetName(cleantail) endif let curpos = stridx(line, "#") - let word = substitute(line, '.\{-}\(.#\)\(.\{-}\)\t', '\2\1', '') + let word = substitute(line, '.\{-}\(.#\)\(.\{-}\)\t.*', '\2\1', '') let word = substitute(word, '\[#$', '$', '') let word = substitute(word, '<#$', '@', '') let word = substitute(word, '.#$', '', '') From f31c031f898738a14ad887ed1353845c38279008 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 12 Oct 2013 15:22:43 -0300 Subject: [PATCH 0486/1050] Version 0.9.9.5. --- Makefile | 2 +- doc/r-plugin.txt | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 192985d..0544aaa 100644 --- a/Makefile +++ b/Makefile @@ -32,7 +32,7 @@ PLUGINHOME=`pwd` PLUGINVERSION=0.9.9.5 DEBIANTIME=`date -R` PLUGINRELEASEDATE=`date +"%Y-%m-%d"` -VIM2HTML=/usr/local/share/vim/vim73/doc/vim2html.pl +VIM2HTML=/usr/local/share/vim/vim74/doc/vim2html.pl zip: # Clean previously created files diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 968d26e..7057209 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -633,8 +633,8 @@ in .GlobalEnv and the currently loaded libraries. The Object Browser requires the |+clientserver| feature to be automatically updated and the |+conceal| feature to correctly align list items. -Note: On Linux you may find binaries without the |clientserver| feature if you -install packages such as vim-nox on Debian/Ubuntu or vim-enhanced on +Note: On Linux you may find Vim binaries without the |clientserver| feature if +you install packages such as vim-nox on Debian/Ubuntu or vim-enhanced on Fedora/Red Hat. If you want to use Vim in a terminal emulator in Fedora/Red Hat, you may want to create a symbolic link to "gvim" named "vim". You still have to explicitly start the server with the argument |--servername|. To @@ -2127,7 +2127,7 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details. *r-plugin-news* 10. News~ -0.9.9.5 (2013-10-07) +0.9.9.5 (2013-10-12) * Minor bug fixes. From f83a6c9c90d7c1ad71fd3aed4c6083104704c4de Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 12 Oct 2013 16:24:17 -0300 Subject: [PATCH 0487/1050] Expand vimrplugin_r_path. --- r-plugin/common_global.vim | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 25df416..00bbcef 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -2945,10 +2945,9 @@ endfunction function SetRPath() if exists("g:vimrplugin_r_path") - if isdirectory(g:vimrplugin_r_path) - let b:rplugin_R = g:vimrplugin_r_path . "/R" - else - let b:rplugin_R = g:vimrplugin_r_path + let b:rplugin_R = expand(g:vimrplugin_r_path) + if isdirectory(b:rplugin_R) + let b:rplugin_R = b:rplugin_R . "/R" endif else let b:rplugin_R = "R" From 04eb60ec0f014bde23ed5bc30ee4b5620b92825a Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 12 Oct 2013 16:37:33 -0300 Subject: [PATCH 0488/1050] Tip on vimrplugin_r_path usage. --- doc/r-plugin.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 7057209..8ad1974 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -1126,6 +1126,11 @@ path in your |vimrc| as in the examples: < On Windows, Vim will try to find the R install path in the Windows Registry. +You can set a different R version for specific R scripts in your |vimrc|. +Example: +> + autocmd BufReadPre ~/old* let vimrplugin_r_path='~/app/R-2.8.1/bin' +< 6.8. Arguments to R~ *vimrplugin_r_args* From 5700ebb8aae0077b010eac76feaf7386be3f940b Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Mon, 14 Oct 2013 07:33:19 -0300 Subject: [PATCH 0489/1050] Don't pass arguments to R.app. --- r-plugin/common_global.vim | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 00bbcef..77a5af8 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -732,7 +732,9 @@ function StartR_OSX() let rcmd = "/Applications/R.app" endif if b:rplugin_r_args != " " - let rcmd = rcmd . " " . b:rplugin_r_args + " https://github.com/jcfaria/Vim-R-plugin/issues/63 + " https://stat.ethz.ch/pipermail/r-sig-mac/2013-February/009978.html + call RWarningMsg("We cannot pass arguments to R.app (" . b:rplugin_r_args . ").") endif let rlog = system("open " . rcmd) if v:shell_error @@ -1106,7 +1108,7 @@ function VimExprToOB(msg) endfunction function RBrowserOpenCloseLists(status) - if a:status == 1 + if a:status == 1 if exists("g:rplugin_curview") let curview = g:rplugin_curview else From adc5cdeb7c4428042a6f12ac09838946cbc4cadd Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Mon, 14 Oct 2013 07:33:48 -0300 Subject: [PATCH 0490/1050] Don't tell people to not use this repository. --- README | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/README b/README index cf28b93..4b5d374 100644 --- a/README +++ b/README @@ -1,7 +1,5 @@ -This is the development code of Vim-R-plugin. You should use it if you want -to contribute to its development (testing unreleased versions, fixing bugs, -writing code etc). You may want to adjust Vim's 'runtimepath' in your -~/.vimrc as in the example below: +This is the development code of Vim-R-plugin. You may want to adjust Vim's +'runtimepath' in your ~/.vimrc as in the example below: set runtimepath=~/Vim-R-plugin,~/.vim,$VIMRUNTIME,~/.vim/after From 1cf850126bec6d8e1117c0db0e9240358aa97f1e Mon Sep 17 00:00:00 2001 From: Sebastian Gibb Date: Mon, 14 Oct 2013 22:11:26 +0200 Subject: [PATCH 0491/1050] add highlighting support for BUG, FIXME, NOTE and TODO keywords in comments --- syntax/r.vim | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/syntax/r.vim b/syntax/r.vim index 5e76e7a..ff358dc 100644 --- a/syntax/r.vim +++ b/syntax/r.vim @@ -30,7 +30,8 @@ endif syn case match " Comment -syn match rComment contains=@Spell "#.*" +syn match rCommentTodo contained "\(BUG\|FIXME\|NOTE\|TODO\):" +syn match rComment contains=@Spell,rCommentTodo "#.*" " Roxygen syn match rOKeyword contained "@\(param\|return\|name\|rdname\|examples\|include\|docType\)" @@ -187,6 +188,7 @@ hi def link rArrow Statement hi def link rBoolean Boolean hi def link rBraceError Error hi def link rComment Comment +hi def link rCommentTodo Todo hi def link rOComment Comment hi def link rComplex Number hi def link rConditional Conditional From 05970909194bc9772a231c90debac34e0e18072e Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 19 Oct 2013 08:55:07 -0300 Subject: [PATCH 0492/1050] Known bug: R must be started by Vim. --- doc/r-plugin.txt | 63 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 62 insertions(+), 1 deletion(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 8ad1974..9a03a94 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -5,7 +5,7 @@ Authors: Jakson A. Aquino Jose Claudio Faria -Version: 0.9.9.5 +Version: 0.9.9.6 For Vim version 7.4 1. Overview |r-plugin-overview| @@ -913,6 +913,63 @@ Fish Shell, for example, in the Object Browser, lists and libraries do not open and close when the key is pressed over them. +5.7. R must be started by Vim~ + +The communication between Vim and R will only work if R was started by Vim +through the rf command because the plugin was designed to connect +each Vim instance with its own R instance. If you start R before Vim, it will +not inherit from Vim the environment variables VIMRPLUGIN_TMPDIR and +VIMINSTANCEID. The former variable is the path used by the R package vimcom to +save temporary files used by the Vim-R-plugin to: perform omnicompletion, show +R documentation in a Vim buffer, and update the Object Browser. The latter is +used by the Vim-R-plugin to know that it is not connecting to an R instance +initiated by another Vim instance. If you use Vim to start R, but then closes +Vim, the VIMINSTANCEID variable in R will become outdated. Additionally, the +Vim-R-plugin sets the value of its internal variable SendCmdToR from +SendCmdToR_fake to the appropriate value when R is successfully started. It is +possible to set the values of all these variables manually, but, as you can +see below, it is not practical to do so. If you have either started R before +Vim or closed Vim and opened it again and really want full communication +between Vim and R, you can try the following (not all procedures are necessary +for all cases): + + In Normal mode Vim do: +> + :echo $VIMRPLUGIN_TMPDIR + :echo $VIMINSTANCEID +< + In R do: +> + detach("package:vimcom.plus", unload = TRUE) # or vimcom + Sys.setenv(VIMRPLUGIN_TMPDIR="X") # where "X" is what Vim has echoed + library(vimcom.plus) # or vimcom + Sys.setenv(VIMINSTANCEID="Y") # where "Y" is what Vim has echoed +< +If you are running R in a terminal emulator (Linux/Unix) Vim still needs to +know the name of Tmux session and Tmux pane where R is running. + +So, in R do: +> + Sys.getenv("TMUX_PANE") +< + and the following Tmux command: +> + :display-message -p '#S' +< +And in Normal mode Vim do: +> + :let rplugin_rconsole_pane = "X" + :let rplugin_tmuxsname = "Y" +< +Finally, do one of the commands below in Normal mode Vim, according to how R +is running: +> + let SendCmdToR = function('SendCmdToR_TmuxSplit') + let SendCmdToR = function('SendCmdToR_Term') + let SendCmdToR = function('SendCmdToR_OSX') + let SendCmdToR = function('SendCmdToR_Windows') +< + ============================================================================== *r-plugin-options* 6. Options~ @@ -2132,6 +2189,10 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details. *r-plugin-news* 10. News~ +0.9.9.6 (2013-10-12) + + * Minor bug fixes. + 0.9.9.5 (2013-10-12) * Minor bug fixes. From 97ce4f1cf8a78ada4f767d84516c6fe3e8b48d01 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 19 Oct 2013 23:55:28 -0300 Subject: [PATCH 0493/1050] Improve message (thanks to Ricardo). --- r-plugin/common_global.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 77a5af8..42574df 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -734,7 +734,7 @@ function StartR_OSX() if b:rplugin_r_args != " " " https://github.com/jcfaria/Vim-R-plugin/issues/63 " https://stat.ethz.ch/pipermail/r-sig-mac/2013-February/009978.html - call RWarningMsg("We cannot pass arguments to R.app (" . b:rplugin_r_args . ").") + call RWarningMsg('R.app does not support command line arguments. To pass "' . b:rplugin_r_args . '" to R, you must run it in a console. Set "vimrplugin_applescript = 0" (you may need to install XQuartz)') endif let rlog = system("open " . rcmd) if v:shell_error From 4fdf3a4edb3716ec496de4b66c80237533f6ec3b Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Tue, 22 Oct 2013 22:18:03 -0300 Subject: [PATCH 0494/1050] Update knitr chunk options. --- r-plugin/common_global.vim | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 42574df..4a4f2c5 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -151,17 +151,17 @@ function! CompleteChunkOptions() let newbase = '^' . substitute(base, "\\$$", "", "") endif let ktopt = ["animation.fun=;hook_ffmpeg_html", "aniopts=;'controls.loop'", "autodep=;FALSE", "background=;'#F7F7F7'", - \ "cache.path=;'cache/'", "cache=;FALSE", "child=; ", "comment=;'##'", + \ "cache.path=;'cache/'", "cache.vars=; ", "cache=;FALSE", "child=; ", "comment=;'##'", \ "dependson=;''", "dev.args=; ", "dev=; ", "dpi=;72", "echo=;TRUE", \ "engine=;'R'", "error=;TRUE", "eval=;TRUE", "external=;TRUE", \ "fig.align=;'left|right|center'", "fig.cap=;''", "fig.env=;'figure'", \ "fig.ext=; ", "fig.height=;7", "fig.keep=;'high|none|all|first|last'", - \ "fig.lp=;'fig:'", "fig.path=; ", "fig.pos=;''", "fig.scap=;''", - \ "fig.show=;'asis|hold|animate'", "fig.width=;7", "highlight=;TRUE", + \ "fig.lp=;'fig:'", "fig.path=; ", "fig.pos=;''", "fig.scap=;''", "fig.subcap=; ", + \ "fig.show=;'asis|hold|animate|hide'", "fig.width=;7", "highlight=;TRUE", \ "include=;TRUE", "interval=;1", "message=;TRUE", "opts.label=;''", \ "out.extra=; ", "out.height=;'7in'", "out.width=;'7in'", - \ "prompt=;FALSE", "ref.label=; ", "resize.height=; ", - \ "resize.width=; ", "results=;'markup|asis|hide'", "sanitize=;FALSE", + \ "prompt=;FALSE", "purl=;TRUE", "ref.label=; ", "resize.height=; ", + \ "resize.width=; ", "results=;'markup|asis|hold|hide'", "sanitize=;FALSE", \ "size=;'normalsize'", "split=;FALSE", "tidy=;TRUE", "tidy.opts=; ", "warning=;TRUE"] for kopt in ktopt if kopt =~ newbase From 4a0aee60e756cbf0f746a99639eae2a7500b491c Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Tue, 22 Oct 2013 22:27:34 -0300 Subject: [PATCH 0495/1050] Source current buffer and not a tmp copy. --- r-plugin/common_global.vim | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 4a4f2c5..261bfba 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -1352,10 +1352,11 @@ endfunction " Send file to R function SendFileToR(e) let b:needsnewomnilist = 1 - let lines = getline("1", line("$")) - let ok = RSourceLines(lines, a:e) - if ok == 0 - return + update + if a:e == "echo" + call g:SendCmdToR('base::source("' . expand("%:p") . '", echo=TRUE)') + else + call g:SendCmdToR('base::source("' . expand("%:p") . '")') endif endfunction From 9bdda6c39b51ee56b205c66de42e468698ec3e80 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 24 Oct 2013 11:13:54 -0300 Subject: [PATCH 0496/1050] Update. --- doc/r-plugin.txt | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 9a03a94..5990dc4 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -470,9 +470,10 @@ you want to see what lines are being sourced when sending a selection of lines, you should do either se or sa instead of ss. -After the command ao, Vim will save the current buffer if it has -any pending changes, run "R CMD BATCH --no-restore --no-save" on the current -file and show the resulting .Rout file in a new tab. Please see +After the commands that send, sweave or knit the current buffer, Vim will save +the current buffer if it has any pending changes before performing the tasks. +After ao, Vim will run "R CMD BATCH --no-restore --no-save" on +the current file and show the resulting .Rout file in a new tab. Please see |vimrplugin_routnotab| if you prefer that the file is open in a new split window. Note: The command ao, silently writes the current buffer to its file if it was modified and deletes the .Rout file if it exists. @@ -492,9 +493,9 @@ argument to the function to try to figure out whether the function is a generic one and whether it is more appropriate to show a specific method. The same procedure is followed with rp, that is, while printing an object. For example, if you run the code below and, then, press -rh and rp over the two occurrences of summary, the -plugin will show different documentations and print different objects in each -case: +rh and rp over the two occurrences of `summary`, the +plugin will show different help documents and print different function methods +in each case: > y <- rnorm(100) x <- rnorm(100) @@ -2193,7 +2194,7 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details. * Minor bug fixes. -0.9.9.5 (2013-10-12) +0.9.9.5 (2013-10-24) * Minor bug fixes. From 13583d972533f16b75086024f1abe38411984420 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 24 Oct 2013 21:47:08 -0300 Subject: [PATCH 0497/1050] Turn needsnewomnilist into global variable. --- autoload/rcomplete.vim | 2 +- doc/r-plugin.txt | 1 + ftplugin/r.vim | 2 +- ftplugin/rmd.vim | 4 ++-- ftplugin/rnoweb.vim | 6 +++--- ftplugin/rrst.vim | 6 +++--- r-plugin/common_buffer.vim | 5 ----- r-plugin/common_global.vim | 27 ++++++++++++++++----------- 8 files changed, 27 insertions(+), 26 deletions(-) diff --git a/autoload/rcomplete.vim b/autoload/rcomplete.vim index 33dc75f..a09622a 100644 --- a/autoload/rcomplete.vim +++ b/autoload/rcomplete.vim @@ -16,7 +16,7 @@ fun! rcomplete#CompleteR(findstart, base) endwhile return start else - if b:needsnewomnilist == 1 + if g:needsnewomnilist == 1 call BuildROmniList("GlobalEnv", "") endif let res = [] diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 5990dc4..5b025d1 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -961,6 +961,7 @@ And in Normal mode Vim do: > :let rplugin_rconsole_pane = "X" :let rplugin_tmuxsname = "Y" + :let g:needsnewomnilist = 1 < Finally, do one of the commands below in Normal mode Vim, according to how R is running: diff --git a/ftplugin/r.vim b/ftplugin/r.vim index 9e26aa7..a2a7c2f 100644 --- a/ftplugin/r.vim +++ b/ftplugin/r.vim @@ -88,7 +88,7 @@ endfunction " Convert R script into Rmd, md and, then, html. function! RSpin() update - let b:needsnewomnilist = 1 + let g:needsnewomnilist = 1 call RSetWD() call g:SendCmdToR('require(knitr); spin("' . expand("%:t") . '")') endfunction diff --git a/ftplugin/rmd.vim b/ftplugin/rmd.vim index a91461a..ff57c05 100644 --- a/ftplugin/rmd.vim +++ b/ftplugin/rmd.vim @@ -160,7 +160,7 @@ function! RMakePDFrmd(t) let pdfcmd = pdfcmd . ", pandoc_args = '" . g:vimrplugin_pandoc_args . "'" endif let pdfcmd = pdfcmd . ")" - let b:needsnewomnilist = 1 + let g:needsnewomnilist = 1 call g:SendCmdToR(pdfcmd) endfunction @@ -173,7 +173,7 @@ function! SendRmdChunkToR(e, m) let chunkline = search("^[ \t]*```[ ]*{r", "bncW") + 1 let docline = search("^[ \t]*```", "ncW") - 1 let lines = getline(chunkline, docline) - let b:needsnewomnilist = 1 + let g:needsnewomnilist = 1 let ok = RSourceLines(lines, a:e) if ok == 0 return diff --git a/ftplugin/rnoweb.vim b/ftplugin/rnoweb.vim index a1e5427..e95d9ae 100644 --- a/ftplugin/rnoweb.vim +++ b/ftplugin/rnoweb.vim @@ -146,7 +146,7 @@ function! RMakePDF(bibtex, knit) endif let pdfcmd = pdfcmd . ")" - let b:needsnewomnilist = 1 + let g:needsnewomnilist = 1 let ok = g:SendCmdToR(pdfcmd) if ok == 0 return @@ -162,7 +162,7 @@ function! SendChunkToR(e, m) let chunkline = search("^<<", "bncW") + 1 let docline = search("^@", "ncW") - 1 let lines = getline(chunkline, docline) - let b:needsnewomnilist = 1 + let g:needsnewomnilist = 1 let ok = RSourceLines(lines, a:e) if ok == 0 return @@ -175,7 +175,7 @@ endfunction " Sweave the current buffer content function! RSweave() update - let b:needsnewomnilist = 1 + let g:needsnewomnilist = 1 call RSetWD() if exists("g:vimrplugin_sweaveargs") call g:SendCmdToR('Sweave("' . expand("%:t") . '", ' . g:vimrplugin_sweaveargs . ')') diff --git a/ftplugin/rrst.vim b/ftplugin/rrst.vim index 365886d..0c72086 100644 --- a/ftplugin/rrst.vim +++ b/ftplugin/rrst.vim @@ -124,7 +124,7 @@ function! RMakeHTMLrrst(t) if g:vimrplugin_openhtml && a:t == "html" let rcmd = rcmd . '; browseURL("' . expand("%:r:t") . '.html")' endif - let b:needsnewomnilist = 1 + let g:needsnewomnilist = 1 call g:SendCmdToR(rcmd) endfunction @@ -162,7 +162,7 @@ function! RMakePDFrrst() let pdfcmd = pdfcmd . ", " . g:vimrplugin_rst2pdfargs endif let pdfcmd = pdfcmd . ")" - let b:needsnewomnilist = 1 + let g:needsnewomnilist = 1 let ok = g:SendCmdToR(pdfcmd) if ok == 0 return @@ -178,7 +178,7 @@ function! SendRrstChunkToR(e, m) let chunkline = search("^\\.\\. {r", "bncW") + 1 let docline = search("^\\.\\. \\.\\.", "ncW") - 1 let lines = getline(chunkline, docline) - let b:needsnewomnilist = 1 + let g:needsnewomnilist = 1 let ok = RSourceLines(lines, a:e) if ok == 0 return diff --git a/r-plugin/common_buffer.vim b/r-plugin/common_buffer.vim index 3a5585f..33ff8db 100644 --- a/r-plugin/common_buffer.vim +++ b/r-plugin/common_buffer.vim @@ -28,11 +28,6 @@ if exists('&ofu') setlocal ofu=rcomplete#CompleteR endif -" Automatically rebuild the file listing .GlobalEnv objects for omni -" completion if the user press and we know that the file either was -" not created yet or is outdated. -let b:needsnewomnilist = 0 - " This isn't the Object Browser running externally let b:rplugin_extern_ob = 0 diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 261bfba..1de50c0 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -196,7 +196,7 @@ function RCompleteArgs() let argkey = strpart(line, idx1, idx2 - idx1 + 1) let idx2 = cpos[2] - strlen(argkey) endif - if b:needsnewomnilist == 1 + if g:needsnewomnilist == 1 call BuildROmniList("GlobalEnv", "") endif let flines = g:rplugin_globalenvlines + g:rplugin_liblist @@ -1351,7 +1351,7 @@ endfunction " Send file to R function SendFileToR(e) - let b:needsnewomnilist = 1 + let g:needsnewomnilist = 1 update if a:e == "echo" call g:SendCmdToR('base::source("' . expand("%:p") . '", echo=TRUE)') @@ -1381,7 +1381,7 @@ function SendMBlockToR(e, m) return endif - let b:needsnewomnilist = 1 + let g:needsnewomnilist = 1 let curline = line(".") let lineA = 1 let lineB = line("$") @@ -1436,7 +1436,7 @@ function SendFunctionToR(e, m) return endif - let b:needsnewomnilist = 1 + let g:needsnewomnilist = 1 let startline = line(".") let save_cursor = getpos(".") let line = SanitizeRLine(getline(".")) @@ -1519,7 +1519,7 @@ function SendSelectionToR(e, m) return endif - let b:needsnewomnilist = 1 + let g:needsnewomnilist = 1 if line("'<") == line("'>") let i = col("'<") - 1 @@ -1595,7 +1595,7 @@ function SendParagraphToR(e, m) return endif - let b:needsnewomnilist = 1 + let g:needsnewomnilist = 1 let i = line(".") let c = col(".") let max = line("$") @@ -1686,7 +1686,7 @@ function SendLineToR(godown) endif endif - let b:needsnewomnilist = 1 + let g:needsnewomnilist = 1 let ok = g:SendCmdToR(line) if ok if a:godown =~ "down" @@ -1799,7 +1799,7 @@ endfunction " knit the current buffer content function! RKnit() update - let b:needsnewomnilist = 1 + let g:needsnewomnilist = 1 call RSetWD() call g:SendCmdToR('require(knitr); knit("' . expand("%:t") . '")') endfunction @@ -1809,7 +1809,7 @@ endfunction function BuildROmniList(env, packlist) if a:env =~ "GlobalEnv" let rtf = g:rplugin_globalenvfname - let b:needsnewomnilist = 0 + let g:needsnewomnilist = 0 else let rtf = g:rplugin_omnidname endif @@ -1828,13 +1828,13 @@ function BuildROmniList(env, packlist) exe "Py SendToVimCom('" . omnilistcmd . "')" if g:rplugin_vimcomport == 0 sleep 500m - let b:needsnewomnilist = 1 + let g:needsnewomnilist = 1 return endif let g:rplugin_lastrpl = ReadEvalReply() if g:rplugin_lastrpl == "R is busy." || g:rplugin_lastrpl == "No reply" call RWarningMsg(g:rplugin_lastrpl) - let b:needsnewomnilist = 1 + let g:needsnewomnilist = 1 sleep 800m return endif @@ -3462,6 +3462,11 @@ endif call SetRPath() +" Automatically rebuild the file listing .GlobalEnv objects for omni +" completion if the user press and we know that the file either was +" not created yet or is outdated. +let g:needsnewomnilist = 0 + " Compatibility with old versions (August 2013): if exists("g:vimrplugin_tmux") From 9628ff4c3b1189bfa66f39a5c5be125ca3651c92 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 26 Oct 2013 09:19:35 -0300 Subject: [PATCH 0498/1050] Improve example of Bash configuration. --- doc/r-plugin.txt | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 5b025d1..6d14d27 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -2123,12 +2123,29 @@ this document from the beginning. ~/.bashrc:~ > - if [ "x$DISPLAY" == "x" ] + # Get 256 colors and automatic update of Object Browser: + if [ "x$DISPLAY" != "x" ] then - function tvim(){ tmux new-session "vim $@" ; } - else + if [ "screen" = "$TERM" ] + then + export TERM=screen-256color + else + export TERM=xterm-256color + fi alias vim='vim --servername VIM' - function tvim(){ tmux -2 new-session "TERM=screen-256color vim $@" ; } + if [ "x$TERM" == "xxterm" ] || [ "x$TERM" == "xxterm-256color" ] + then + function tvim(){ tmux -2 new-session "TERM=screen-256color vim --servername VIM $@" ; } + else + function tvim(){ tmux new-session "vim --servername VIM $@" ; } + fi + else + if [ "x$TERM" == "xxterm" ] || [ "x$TERM" == "xxterm-256color" ] + then + function tvim(){ tmux -2 new-session "TERM=screen-256color vim $@" ; } + else + function tvim(){ tmux new-session "vim $@" ; } + fi fi < ~/.tmux.conf:~ @@ -2160,10 +2177,11 @@ this document from the beginning. if(Sys.getenv("TERM") != "linux" && Sys.getenv("TERM") != "") setOutputColors256(verbose = FALSE) library(setwidth) - if(Sys.getenv("VIMRPLUGIN_TMPDIR") != "") + if(Sys.getenv("VIMRPLUGIN_TMPDIR") != ""){ library(vimcom.plus) # If you can't install the vimcom.plus package, do: # library(vimcom) + } } < ~/bin/vimrpager~ From 8c86d8aa4b1b5f43ea4c1f797282b43b707a05b4 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 31 Oct 2013 08:57:51 -0300 Subject: [PATCH 0499/1050] Version 0.9.9.6. --- Makefile | 4 ++-- doc/r-plugin.txt | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 0544aaa..fc02eca 100644 --- a/Makefile +++ b/Makefile @@ -22,14 +22,14 @@ # file functions.vim.vanilla must exist. Run the Vim # # command :RUpdateObjList with R vanilla running (that # # is, R with only the default libraries loaded) and, # -# then, the file functions.vim be renamed to # +# then, rename the file functions.vim to # # functions.vim.vanilla. # ########################################################### PLUGINHOME=`pwd` -PLUGINVERSION=0.9.9.5 +PLUGINVERSION=0.9.9.6 DEBIANTIME=`date -R` PLUGINRELEASEDATE=`date +"%Y-%m-%d"` VIM2HTML=/usr/local/share/vim/vim74/doc/vim2html.pl diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 6d14d27..3306a98 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -2209,11 +2209,11 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details. *r-plugin-news* 10. News~ -0.9.9.6 (2013-10-12) +0.9.9.6 (2013-10-31) * Minor bug fixes. -0.9.9.5 (2013-10-24) +0.9.9.5 (2013-10-12) * Minor bug fixes. From 0aa96455d27c50747dd20750e647f7b722268cff Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 31 Oct 2013 21:21:25 -0300 Subject: [PATCH 0500/1050] Correctly recognize vimcom.plus. --- r-plugin/vimcom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/r-plugin/vimcom.py b/r-plugin/vimcom.py index 5428780..aad8496 100644 --- a/r-plugin/vimcom.py +++ b/r-plugin/vimcom.py @@ -34,7 +34,7 @@ def DiscoverVimComPort(): sock.close() if repl.find(correct_repl): VimComFamily = af - if repl.find("vimcom.plus"): + if repl.find(" vimcom.plus ") > -1: vim.command("let g:rplugin_vimcom_pkg = 'vimcom.plus'") break except: From 33b5c66d657e0e344a67b20385754e39becf3af3 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 31 Oct 2013 21:42:35 -0300 Subject: [PATCH 0501/1050] Be more specific about Python. --- doc/r-plugin.txt | 60 +++++++++++++++++++++++++++--------------------- 1 file changed, 34 insertions(+), 26 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 3306a98..ed9c09a 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -200,33 +200,18 @@ to install external dependencies: * Vim's version must be >= 7.4 - * Python: http://www.python.org/download/ + * Python 2.7.5 (32 bit): http://www.python.org/download/ + Do not choose the X86-64 version because it will not work. - Note: The official Vim is 32 bit and, thus, Python must be 32 bit too. - However, Vim and R run as independent processes, that is, you may have - 32 bit Vim sending commands to 64 bit R. + * pywin32: http://sourceforge.net/projects/pywin32/files/pywin32/Build%20218/pywin32-218.win32-py2.7.exe/download + + Note: The above versions of Python and pywin32 are known to work with + the official GVim 7.4 binary. The default download may not match the + Python version Vim was linked against: you have to "View all files" on + the download page to find the file that matches exactly the above + versions. Please, read |r-plugin-python| if want to use different + versions. - Note: Be careful to download the correct Python version because Vim - needs a specific version of Python DLL. For example, the official - Vim 7.4 for Windows needs either Python 2.7 or 3.1. If Python was - not installed or was not found, the Vim-R-plugin will output - information about what Python version Vim was compiled against. Do - the following if you want to discover this information manually: - - 1. Type :version in Vim (normal mode). - - 2. Look for a string like -DDYNAMIC_PYTHON_DLL="python27.dll". - - 3. Install the Python version which corresponds to the version - which Vim was linked against. In the example of step 2 - (python27.dll) the required Python version is 2.7.x. - - * pywin32: http://sourceforge.net/projects/pywin32/ - - Note: The default download may not match the Python version Vim was - linked against. You have to "View all files" on the download page to - find the file that matches exactly the version of Python that you - installed. * vimcom = 0.9-9: An R package, available on CRAN and installable with the command: `install.packages("vimcom")` @@ -2196,7 +2181,30 @@ executable: chmod +x ~/bin/vimrpager < -9.22. Integration with GNU Screen, screen plugin, Conque Shell or VimShell~ +9.22. Python versions~ + *r-plugin-python* +Are you using Windows and need to use a specific version of either Python or +pywin32? The official Vim is 32 bit and, thus, Python must be 32 bit too. +However, Vim and R run as independent processes, that is, you may have 32 bit +Vim sending commands to 64 bit R. Be careful to download the correct Python +version because Vim needs a specific version of Python DLL. For example, the +official Vim 7.4 for Windows needs either Python 2.7 or 3.1. If Python was not +installed or was not found, the Vim-R-plugin will output information about +what Python version Vim was compiled against. Do the following if you want to +discover this information manually: + + 1. Type :version in Vim (normal mode). + + 2. Look for a string like -DDYNAMIC_PYTHON_DLL="python27.dll". + + 3. Install the Python version which corresponds to the version which Vim + was linked against. In the example of step 2 (python27.dll) the required + Python version is 2.7.x. + + * pywin32: http://sourceforge.net/projects/pywin32/ + + +9.23. Integration with GNU Screen, screen plugin, Conque Shell or VimShell~ The plugin used to be able to use GNU Screen (through screen plugin), Conque Shell or VimShell to send commands to R. This integration was removed on From 1409ad3c1954c1b139618565e86b80d4d94e23db Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Fri, 1 Nov 2013 11:40:22 -0300 Subject: [PATCH 0502/1050] Warn about vimcom limitations on Windows. --- r-plugin/common_global.vim | 75 +++++++++++++++++++++++++++++++------- 1 file changed, 62 insertions(+), 13 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 1de50c0..31ebb0a 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -134,6 +134,20 @@ function! ReadEvalReply() return reply endfunction +function RCheckVimCom(msg) + if exists("g:rplugin_vimcom_checked") + return 1 + endif + if g:rplugin_vimcomport == 0 + Py DiscoverVimComPort() + endif + if g:rplugin_vimcomport && g:rplugin_vimcom_pkg == "vimcom" + call RWarningMsg("The R package vimcom.plus is required to " . a:msg) + return 1 + endif + return 0 +endfunction + function! CompleteChunkOptions() let cline = getline(".") let cpos = getpos(".") @@ -202,6 +216,13 @@ function RCompleteArgs() let flines = g:rplugin_globalenvlines + g:rplugin_liblist let np = 1 let nl = 0 + + if has("win32") || has("win64") && g:rplugin_vimcom_pkg == "vimcom" + if RCheckVimCom("complete function arguments.") + return + endif + endif + while np != 0 && nl < 10 if line[idx] == '(' let np -= 1 @@ -217,18 +238,6 @@ function RCompleteArgs() let rkeyword = '^' . rkeyword0 . "\x06" call cursor(cpos[1], cpos[2]) - "TODO: Delete this temporary code when vimcom 1.0-0 is released: - if g:rplugin_vimcom_pkg != "vimcom.plus" - Py SendToVimCom("find.package('vimcom.plus', quiet = TRUE)") - let g:rplugin_lastrpl = ReadEvalReply() - if g:rplugin_vimcomport > 0 - let g:rplugin_lastrpl = ReadEvalReply() - if g:rplugin_lastrpl =~ "vimcom.plus" - let g:rplugin_vimcom_pkg = "vimcom.plus" - endif - endif - endif - " If R is running, use it call delete($VIMRPLUGIN_TMPDIR . "/eval_reply") if classfor == "" @@ -1077,6 +1086,13 @@ function RObjBrowser() call RWarningMsg("The Object Browser can be opened only if R is running.") return endif + + if has("win32") || has("win64") && g:rplugin_vimcom_pkg == "vimcom" + if RCheckVimCom("run the Object Browser on Windows.") + return + endif + endif + if g:rplugin_running_objbr == 1 " Called twice due to BufEnter event return @@ -1172,6 +1188,13 @@ function RFormatCode() range return endif endif + + if has("win32") || has("win64") && g:rplugin_vimcom_pkg == "vimcom" + if RCheckVimCom("run :Rformat.") + return + endif + endif + let lns = getline(a:firstline, a:lastline) call writefile(lns, $VIMRPLUGIN_TMPDIR . "/unformatted_code") let wco = &textwidth @@ -1202,6 +1225,13 @@ function RInsert(cmd) return endif endif + + if has("win32") || has("win64") && g:rplugin_vimcom_pkg == "vimcom" + if RCheckVimCom("run :Rinsert.") + return + endif + endif + call delete($VIMRPLUGIN_TMPDIR . "/eval_reply") call delete($VIMRPLUGIN_TMPDIR . "/Rinsert") exe "Py SendToVimCom('capture.output(" . a:cmd . ', file = "' . $VIMRPLUGIN_TMPDIR . "/Rinsert" . '")' . "')" @@ -1807,6 +1837,19 @@ endfunction " Tell R to create a list of objects file listing all currently available " objects in its environment. The file is necessary for omni completion. function BuildROmniList(env, packlist) + + if has("win32") || has("win64") && g:rplugin_vimcom_pkg == "vimcom" + if !exists("g:rplugin_vimcom_omni_warn") + let g:rplugin_vimcom_omni_warn = 1 + if RCheckVimCom("complete the names of objects from R's workspace.") + sleep 2 + return + endif + else + return + endif + endif + if a:env =~ "GlobalEnv" let rtf = g:rplugin_globalenvfname let g:needsnewomnilist = 0 @@ -2072,6 +2115,12 @@ function ShowRDoc(rkeyword, package, getclass) return endif + if (has("win32") || has("win64")) && g:rplugin_vimcom_pkg == "vimcom" + if RCheckVimCom("see R help on Vim buffer.") + return + endif + endif + if filewritable(g:rplugin_docfile) call delete(g:rplugin_docfile) endif @@ -3371,7 +3420,7 @@ else endif if !exists("g:vimrplugin_term") && !exists("g:vimrplugin_term_cmd") - call RWarningMsgInp("Please, set the variable 'g:vimrplugin_term_cmd' in your .vimrc.\nRead the plugin documentation for details.") + call RWarningMsgInp("Please, set the variable 'g:vimrplugin_term_cmd' in your .vimrc. Read the plugin documentation for details.") let g:rplugin_failed = 1 finish endif From 78290d9763ef6faa4fbeb96c2352b091c884c14f Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Fri, 1 Nov 2013 11:42:10 -0300 Subject: [PATCH 0503/1050] Fix file path in SendFileToR() on Windows. --- r-plugin/common_global.vim | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 31ebb0a..e60bbe9 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -1383,10 +1383,14 @@ endfunction function SendFileToR(e) let g:needsnewomnilist = 1 update + let fpath = expand("%:p") + if has("win32") || has("win64") + let fpath = substitute(fpath, "\\", "/", "g") + endif if a:e == "echo" - call g:SendCmdToR('base::source("' . expand("%:p") . '", echo=TRUE)') + call g:SendCmdToR('base::source("' . fpath . '", echo=TRUE)') else - call g:SendCmdToR('base::source("' . expand("%:p") . '")') + call g:SendCmdToR('base::source("' . fpath . '")') endif endfunction From e2afb6108f62b2c5d26ac07f35c0d13828642009 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Fri, 1 Nov 2013 11:44:21 -0300 Subject: [PATCH 0504/1050] Require vimcom.plus (or vimcom) 0.9-91. --- doc/r-plugin.txt | 10 +++++++--- r-plugin/vimcom.py | 4 ++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index ed9c09a..391d8ec 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -5,7 +5,7 @@ Authors: Jakson A. Aquino Jose Claudio Faria -Version: 0.9.9.6 +Version: 0.9.9.7 For Vim version 7.4 1. Overview |r-plugin-overview| @@ -128,7 +128,7 @@ following dependencies: Depends:~ - vimcom.plus = 0.9-9: http://www.lepem.ufc.br/jaa/vimcom.plus.html + vimcom.plus = 0.9-91: http://www.lepem.ufc.br/jaa/vimcom.plus.html The vimcom.plus (or vimcom) package creates a server on R to allow the communication with Vim. The package is not used to send commands from Vim to R Console, but it is necessary to @@ -213,7 +213,7 @@ to install external dependencies: versions. - * vimcom = 0.9-9: An R package, available on CRAN and installable with the + * vimcom = 0.9-91: An R package, available on CRAN and installable with the command: `install.packages("vimcom")` See also: http://www.lepem.ufc.br/jaa/vimcom.plus.html The vimcom package creates a server on R to allow the communication with @@ -2217,6 +2217,10 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details. *r-plugin-news* 10. News~ +0.9.9.7 (2013-11-01) + + * Minor bug fixes. + 0.9.9.6 (2013-10-31) * Minor bug fixes. diff --git a/r-plugin/vimcom.py b/r-plugin/vimcom.py index aad8496..d382e4a 100644 --- a/r-plugin/vimcom.py +++ b/r-plugin/vimcom.py @@ -50,8 +50,8 @@ def DiscoverVimComPort(): else: vim.command("let g:rplugin_vimcomport = " + str(VimComPort)) PortWarn = False - if repl.find("0.9-9") != 0: - vim.command("call RWarningMsg('This version of Vim-R-plugin requires vimcom.plus (or vimcom) 0.9-9.')") + if repl.find("0.9-91") != 0: + vim.command("call RWarningMsg('This version of Vim-R-plugin requires vimcom.plus (or vimcom) 0.9-91.')") vim.command("sleep 1") return(VimComPort) From 31672eb301dceb615b0b46b52df742b2c5557f45 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 2 Nov 2013 10:40:24 -0300 Subject: [PATCH 0505/1050] Deal with spaces in name of parent objects. --- ftplugin/rbrowser.vim | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ftplugin/rbrowser.vim b/ftplugin/rbrowser.vim index bff1509..8ccfdb5 100644 --- a/ftplugin/rbrowser.vim +++ b/ftplugin/rbrowser.vim @@ -233,6 +233,9 @@ function! RBrowserFindParent(word, curline, curpos) endif endif if curline > 1 + if line =~ " " + let line = substitute(line, '\(.\)#\(.*\)$', '\1#`\2`', "") + endif if line =~ '<#' let word = substitute(line, '.*<#', "", "") . '@' . a:word else From d169e66c39d18a39b14207f1cb144d1ca0ef4431 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 2 Nov 2013 13:47:51 -0300 Subject: [PATCH 0506/1050] Improve support to objects with uncommon names. --- ftplugin/rbrowser.vim | 38 ++++++++++++++++++++++---------------- r-plugin/common_global.vim | 2 +- 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/ftplugin/rbrowser.vim b/ftplugin/rbrowser.vim index 8ccfdb5..746cc53 100644 --- a/ftplugin/rbrowser.vim +++ b/ftplugin/rbrowser.vim @@ -133,7 +133,7 @@ function! RBrowserDoubleClick() endif " Toggle state of list or data.frame: open X closed - let key = RBrowserGetName(0) + let key = RBrowserGetName(0, 1) if g:rplugin_curview == "GlobalEnv" exe 'Py SendToVimCom("' . "\005" . key . '")' if g:rplugin_lastrpl == "R is busy." @@ -160,7 +160,7 @@ function! RBrowserRightClick() return endif - let key = RBrowserGetName(1) + let key = RBrowserGetName(1, 0) if key == "" return endif @@ -233,7 +233,9 @@ function! RBrowserFindParent(word, curline, curpos) endif endif if curline > 1 - if line =~ " " + let line = substitute(line, '^.\{-}\(.\)#', '\1#', "") + let line = substitute(line, '^ *', '', "") + if line =~ " " || line =~ '^.#[0-9]' let line = substitute(line, '\(.\)#\(.*\)$', '\1#`\2`', "") endif if line =~ '<#' @@ -253,7 +255,19 @@ function! RBrowserFindParent(word, curline, curpos) return "" endfunction -function! RBrowserGetName(cleantail) +function! RBrowserCleanTailTick(word, cleantail, cleantick) + let nword = a:word + if a:cleantick + let nword = substitute(nword, "`", "", "g") + endif + if a:cleantail + let nword = substitute(nword, '[\$@]$', '', '') + let nword = substitute(nword, '[\$@]`$', '`', '') + endif + return nword +endfunction + +function! RBrowserGetName(cleantail, cleantick) let line = getline(".") if line =~ "^$" return "" @@ -272,9 +286,7 @@ function! RBrowserGetName(cleantail) if (g:rplugin_curview == "GlobalEnv" && curpos == 4) || (g:rplugin_curview == "libraries" && curpos == 3) " top level object let word = substitute(word, '\$\[\[', '[[', "g") - if a:cleantail - let word = substitute(word, '[\$@]$', '', '') - endif + let word = RBrowserCleanTailTick(word, a:cleantail, a:cleantick) if g:rplugin_curview == "libraries" return "package:" . substitute(word, "#", "", "") else @@ -284,16 +296,12 @@ function! RBrowserGetName(cleantail) if g:rplugin_curview == "libraries" if s:isutf8 if curpos == 11 - if a:cleantail - let word = substitute(word, '[\$@]$', '', '') - endif + let word = RBrowserCleanTailTick(word, a:cleantail, a:cleantick) let word = substitute(word, '\$\[\[', '[[', "g") return word endif elseif curpos == 7 - if a:cleantail - let word = substitute(word, '[\$@]$', '', '') - endif + let word = RBrowserCleanTailTick(word, a:cleantail, a:cleantick) let word = substitute(word, '\$\[\[', '[[', "g") return word endif @@ -301,9 +309,7 @@ function! RBrowserGetName(cleantail) if curpos > 4 " Find the parent data.frame or list let word = RBrowserFindParent(word, line("."), curpos - 1) - if a:cleantail - let word = substitute(word, '[\$@]$', '', '') - endif + let word = RBrowserCleanTailTick(word, a:cleantail, a:cleantick) let word = substitute(word, '\$\[\[', '[[', "g") return word else diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index e60bbe9..e92d8d4 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -2309,7 +2309,7 @@ endfunction " Call R functions for the word under cursor function RAction(rcmd) if &filetype == "rbrowser" - let rkeyword = RBrowserGetName(1) + let rkeyword = RBrowserGetName(1, 0) else let rkeyword = RGetKeyWord() endif From aecfa60f0f0af405667da0637dec9a5ccbf6e468 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 2 Nov 2013 14:11:57 -0300 Subject: [PATCH 0507/1050] Open R documentation in text editor tab. --- r-plugin/common_global.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index e92d8d4..bea5938 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -2318,7 +2318,7 @@ function RAction(rcmd) if g:vimrplugin_vimpager == "no" call g:SendCmdToR("help(" . rkeyword . ")") else - if bufname("%") =~ "Object_Browser" + if bufname("%") =~ "Object_Browser" || b:rplugin_extern_ob if g:rplugin_curview == "libraries" let pkg = RBGetPkgName() else From 805a67fc0304a45f18df6fde7d9a8ef0ed727f0a Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 2 Nov 2013 14:35:13 -0300 Subject: [PATCH 0508/1050] Update the libraries first at startup. --- r-plugin/common_global.vim | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index bea5938..172a45c 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -898,8 +898,9 @@ function StartObjBrowser_Tmux() " Don't start the Object Browser if it already exists if IsExternalOBRunning() - Py SendToVimCom("\003GlobalEnv [OB init]") Py SendToVimCom("\004Libraries [OB init]") + sleep 50m + Py SendToVimCom("\003GlobalEnv [OB init]") return endif @@ -938,8 +939,9 @@ function StartObjBrowser_Tmux() \ ' let g:rplugin_liblist_f = "/liblist_" . v:servername', \ " exe 'Py SendToVimCom(\"\\x07' . v:servername . '\")'", \ 'endif', - \ 'Py SendToVimCom("\003GlobalEnv [OB init]")', \ 'Py SendToVimCom("\004Libraries [OB init]")', + \ 'sleep 50m', + \ 'Py SendToVimCom("\003GlobalEnv [OB init]")', \ 'if v:servername == ""', \ ' sleep 100m', \ ' call UpdateOB("GlobalEnv")', From 59b9f166d1c38a36405d7ccd6cb92699e64c0318 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 2 Nov 2013 14:44:29 -0300 Subject: [PATCH 0509/1050] Use four spaces as 'shiftwidth'. --- r-plugin/r.snippets | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/r-plugin/r.snippets b/r-plugin/r.snippets index b135851..4da1600 100644 --- a/r-plugin/r.snippets +++ b/r-plugin/r.snippets @@ -4,30 +4,30 @@ snippet li # If Condition snippet if if(${1:condition}){ - ${2:} + ${2:} } snippet el else { - ${1:} + ${1:} } snippet wh while(${1:condition}){ - ${2:} + ${2:} } # For Loop snippet for for(${1:i} in ${2:range}){ - ${3:} + ${3:} } # Function snippet fun ${1:funname} <- function(${2:}) { - ${3:} + ${3:} } # repeat snippet re repeat{ - ${2:} - if(${1:condition}) break + ${2:} + if(${1:condition}) break } From cabd960ceb99ff10e008cf9c87a8e3de58ce1be9 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 2 Nov 2013 22:37:12 -0300 Subject: [PATCH 0510/1050] Version 0.9.9.7. --- Makefile | 2 +- doc/r-plugin.txt | 31 +++++++++++++++---------------- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/Makefile b/Makefile index fc02eca..49dd929 100644 --- a/Makefile +++ b/Makefile @@ -29,7 +29,7 @@ PLUGINHOME=`pwd` -PLUGINVERSION=0.9.9.6 +PLUGINVERSION=0.9.9.7 DEBIANTIME=`date -R` PLUGINRELEASEDATE=`date +"%Y-%m-%d"` VIM2HTML=/usr/local/share/vim/vim74/doc/vim2html.pl diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 391d8ec..05068ea 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -213,17 +213,22 @@ to install external dependencies: versions. - * vimcom = 0.9-91: An R package, available on CRAN and installable with the - command: `install.packages("vimcom")` - See also: http://www.lepem.ufc.br/jaa/vimcom.plus.html - The vimcom package creates a server on R to allow the communication with - Vim. You certainly will want to put the following lines at the end of - your Rprofile. + * vimcom.plus = 0.9-91: http://www.lepem.ufc.br/jaa/vimcom.plus.html + The vimcom.plus (or vimcom) package creates a server on R to allow the + communication with Vim. The package is not used to send commands from + Vim to R Console, but it is necessary to open R documentation in Vim's + buffer, run the Object Browser, run either `Sweave()` or `knit()` on the + document being edited. It also has some functions called by Vim such as + `vim.plot()`, `vim.print()`, and `vim.bol()`. This last one is required + to build the data base used in omnicompletion. + The vimcom.plus package creates a server on R to allow the communication + with Vim. You certainly will want to put the following lines at the end + of your Rprofile. > if(interactive()){ - library(vimcom) - # If you can install vimcom.plus, do: - # library(vimcom.plus) + library(vimcom.plus) + # If you cannot install vimcom.plus, do: + # library(vimcom) } < You can do `Sys.getenv("HOME")` in the R Console to know where the file @@ -1333,10 +1338,6 @@ use the option vimrplugin_latexcmd to change this behavior. Examples: let vimrplugin_latexcmd = "latexmk -pdf" let vimrplugin_latexcmd = "latex" < -You may also want to put the following in your .Rprofile: -> - options(vimcom.texerrs = TRUE) -< If you want to pass arguments do the `Sweave()` function, set the value of the vimrplugin_sweaveargs variable. @@ -2151,8 +2152,6 @@ this document from the beginning. options(setwidth.verbose = 1, colorout.verbose = 1, vimcom.verbose = 1, - vimcom.allnames = FALSE, - vimcom.texerrs = TRUE, pager = "vimrpager") if(nchar(Sys.getenv("DISPLAY")) > 1) options(editor = 'gvim -f -c "set ft=r"') @@ -2217,7 +2216,7 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details. *r-plugin-news* 10. News~ -0.9.9.7 (2013-11-01) +0.9.9.7 (2013-11-02) * Minor bug fixes. From 86f1cea037cb93ed37fc3208fa9448bb9d35886d Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Tue, 5 Nov 2013 19:55:29 -0300 Subject: [PATCH 0511/1050] New environment variable VIMRPLUGIN_HOME --- r-plugin/common_global.vim | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 172a45c..c38fd0c 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -616,6 +616,7 @@ endfunction function StartR_TmuxSplit(rcmd) call system("tmux set-environment -g VIMRPLUGIN_TMPDIR " . g:rplugin_esc_tmpdir) + call system("tmux set-environment -g VIMRPLUGIN_HOME " . g:rplugin_home) call system("tmux set-environment VIMINSTANCEID " . $VIMINSTANCEID) let g:rplugin_vim_pane = TmuxActivePane() let tcmd = "tmux split-window " @@ -662,6 +663,7 @@ function StartR_ExternalTerm(rcmd) if g:vimrplugin_notmuxconf let cnflines = [ \ 'set-environment -g VIMRPLUGIN_TMPDIR ' . g:rplugin_esc_tmpdir, + \ 'set-environment -g VIMRPLUGIN_HOME ' . g:rplugin_home, \ 'set-environment VIMINSTANCEID ' . $VIMINSTANCEID, \ 'source-file ~/.tmux.conf' ] else @@ -673,6 +675,7 @@ function StartR_ExternalTerm(rcmd) \ 'set -g status off', \ "set -g terminal-overrides 'xterm*:smcup@:rmcup@'", \ 'set-environment -g VIMRPLUGIN_TMPDIR "' . $VIMRPLUGIN_TMPDIR . '"', + \ 'set-environment -g VIMRPLUGIN_HOME "' . g:rplugin_home . '"', \ 'set-environment VIMINSTANCEID "' . $VIMINSTANCEID . '"'] if g:vimrplugin_external_ob || !has("gui_running") let cnflines = extend(cnflines, ['set -g mode-mouse on', 'set -g mouse-select-pane on', 'set -g mouse-resize-pane on']) @@ -681,6 +684,7 @@ function StartR_ExternalTerm(rcmd) call writefile(cnflines, s:tmxcnf) let rcmd = "VIMINSTANCEID=" . $VIMINSTANCEID . " " . a:rcmd call system('export VIMRPLUGIN_TMPDIR=' . $VIMRPLUGIN_TMPDIR) + call system('export VIMRPLUGIN_TMPDIR=' . g:rplugin_home) call system('export VIMINSTANCEID=' . $VIMINSTANCEID) " Start the terminal emulator even if inside a Tmux session if $TMUX != "" @@ -2221,7 +2225,7 @@ function ShowRDoc(rkeyword, package, getclass) endif else echohl WarningMsg - echomsg "Invalid vimrplugin_vimpager value: '" . g:vimrplugin_vimpager . "'" + echomsg 'Invalid vimrplugin_vimpager value: "' . g:vimrplugin_vimpager . '". Valid values are: "tab", "vertical", "horizontal", "tabnew" and "no".' echohl Normal return endif @@ -3085,6 +3089,8 @@ if has("win32") || has("win64") endif endif +let $VIMRPLUGIN_HOME = g:rplugin_home + if isdirectory("/tmp") let $VIMRPLUGIN_TMPDIR = "/tmp/r-plugin-" . g:rplugin_userlogin else @@ -3145,7 +3151,7 @@ if obpllen > 1 endif for idx in range(0, obpllen) if objbrplace[idx] != "console" && objbrplace[idx] != "script" && objbrplace[idx] != "left" && objbrplace[idx] != "right" - call RWarningMsgInp("Invalid option for vimrplugin_objbr_place: " . objbrplace[idx]) + call RWarningMsgInp('Invalid option for vimrplugin_objbr_place: "' . objbrplace[idx] . '". Valid options are: console or script and right or left."') let g:rplugin_failed = 1 finish endif From f362d985fab2a687e93518cde242e30a65c2c19c Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Tue, 5 Nov 2013 20:03:21 -0300 Subject: [PATCH 0512/1050] Run helptags before converting into HTML. --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 49dd929..b1079d6 100644 --- a/Makefile +++ b/Makefile @@ -222,6 +222,7 @@ deb: fakeroot dpkg-deb -b vim-r-plugin-tmp vim-r-plugin_$(PLUGINVERSION)-1_all.deb ) htmldoc: + vim -c ':helptags ~/src/Vim-R-plugin' -c ':quit' (cd doc ;\ $(VIM2HTML) tags r-plugin.txt ;\ sed -i -e 's///' r-plugin.html ;\ From 1094a6982b4f84da059a259c1b436d213b6ed59d Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Wed, 6 Nov 2013 11:18:52 -0300 Subject: [PATCH 0513/1050] Dynamically update the list of objects. The R package vimcom.plus now builds dynamically (as the libraries are loaded) the lists of objects for omnicompletion and the vim scripts for syntax highlight. Deprecated commands and options: :RUpdateObjList, :RAddLibToList, vimrplugin_buildwait. New option: vimrplugin_permanent_libs. --- Makefile | 18 +-- autoload/rcomplete.vim | 2 +- doc/r-plugin.txt | 107 +++++++----------- r-plugin/common_global.vim | 219 +++++++++++++++++-------------------- r-plugin/objlist/README | 9 +- r-plugin/vimcom.py | 4 +- syntax/r.vim | 8 +- 7 files changed, 159 insertions(+), 208 deletions(-) diff --git a/Makefile b/Makefile index b1079d6..7d77758 100644 --- a/Makefile +++ b/Makefile @@ -17,13 +17,6 @@ # This script builds both the zip and the deb files of # # released versions of the plugin. The files are # # created at the /tmp directory. # -# # -# To make the distribution version of the plugin the # -# file functions.vim.vanilla must exist. Run the Vim # -# command :RUpdateObjList with R vanilla running (that # -# is, R with only the default libraries loaded) and, # -# then, rename the file functions.vim to # -# functions.vim.vanilla. # ########################################################### @@ -48,13 +41,9 @@ zip: indent/rrst.vim indent/rnoweb.vim indent/rhelp.vim autoload/rcomplete.vim ftplugin/r*.vim \ syntax/rout.vim syntax/r.vim syntax/rhelp.vim syntax/rmd.vim \ syntax/rrst.vim syntax/rdoc.vim syntax/rbrowser.vim \ - doc/r-plugin.txt r-plugin/functions.vim.vanilla r-plugin/vimcom.py \ + doc/r-plugin.txt r-plugin/vimcom.py \ r-plugin/global_r_plugin.vim r-plugin/windows.py \ - r-plugin/objlist/omnils_base r-plugin/objlist/omnils_colorout \ - r-plugin/objlist/omnils_datasets r-plugin/objlist/omnils_graphics \ - r-plugin/objlist/omnils_grDevices r-plugin/objlist/omnils_methods \ - r-plugin/objlist/omnils_stats r-plugin/objlist/omnils_utils \ - r-plugin/objlist/omnils_vimcom.plus r-plugin/objlist/README \ + r-plugin/objlist/README \ r-plugin/tex_indent.vim r-plugin/r.snippets \ r-plugin/common_buffer.vim r-plugin/common_global.vim \ bitmaps/ricon.xbm bitmaps/ricon.png \ @@ -75,7 +64,6 @@ zip: rm vimrplugintmpfile.tar.gz ) (cd /tmp/vim-r-plugin-tmp/usr/share/vim/addons ;\ chmod +w r-plugin/tex_indent.vim ;\ - mv r-plugin/functions.vim.vanilla r-plugin/functions.vim;\ rm -f /tmp/vim-r-plugin-$(PLUGINVERSION).zip ;\ zip -r /tmp/vim-r-plugin-$(PLUGINVERSION).zip . ) @@ -222,7 +210,7 @@ deb: fakeroot dpkg-deb -b vim-r-plugin-tmp vim-r-plugin_$(PLUGINVERSION)-1_all.deb ) htmldoc: - vim -c ':helptags ~/src/Vim-R-plugin' -c ':quit' + vim -c ":helptags ~/src/Vim-R-plugin/doc" -c ":quit" ;\ (cd doc ;\ $(VIM2HTML) tags r-plugin.txt ;\ sed -i -e 's///' r-plugin.html ;\ diff --git a/autoload/rcomplete.vim b/autoload/rcomplete.vim index a09622a..61e91de 100644 --- a/autoload/rcomplete.vim +++ b/autoload/rcomplete.vim @@ -17,7 +17,7 @@ fun! rcomplete#CompleteR(findstart, base) return start else if g:needsnewomnilist == 1 - call BuildROmniList("GlobalEnv", "") + call BuildROmniList() endif let res = [] if strlen(a:base) == 0 diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 05068ea..67980bf 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -128,7 +128,7 @@ following dependencies: Depends:~ - vimcom.plus = 0.9-91: http://www.lepem.ufc.br/jaa/vimcom.plus.html + vimcom.plus = 0.9-92: http://www.lepem.ufc.br/jaa/vimcom.plus.html The vimcom.plus (or vimcom) package creates a server on R to allow the communication with Vim. The package is not used to send commands from Vim to R Console, but it is necessary to @@ -213,7 +213,7 @@ to install external dependencies: versions. - * vimcom.plus = 0.9-91: http://www.lepem.ufc.br/jaa/vimcom.plus.html + * vimcom.plus = 0.9-92: http://www.lepem.ufc.br/jaa/vimcom.plus.html The vimcom.plus (or vimcom) package creates a server on R to allow the communication with Vim. The package is not used to send commands from Vim to R Console, but it is necessary to open R documentation in Vim's @@ -281,19 +281,13 @@ started by Vim. 3.4. General instructions II (optional steps)~ -3.4.1 Update list of objects~ - -Start R and update the list of objects for omni completion and syntax -highlight (see |:RUpdateObjList| for details). - - -3.4.2 Customize the plugin~ +3.4.1 Customize the plugin~ Please, read the section |r-plugin-options|. Emacs/ESS users should read the section Indenting setup (|r-plugin-indenting|) of this document. -3.4.3 Hide unused buttons~ +3.4.2 Hide unused buttons~ Edit GVim's toolbar and remove the buttons that you never use. The plugin adds some buttons to the toolbar, but you may not see them because GVim has too @@ -303,7 +297,7 @@ on the toolbar: http://vim.wikia.com/wiki/Hide_toolbar_or_menus_to_see_more_text -3.4.4 Install additional plugins~ +3.4.3 Install additional plugins~ You may be interested in installing additional general plugins to get functionality not provided by this file type plugin. ShowMarks and snipMate @@ -432,10 +426,6 @@ Edit . Go (previous R chunk) gN ----------------------------------------------------------- -Syntax - . Build omnils (loaded packages) :RUpdateObjList ------------------------------------------------------------ - Object Browser . Show/Update \ro . Expand (all lists) \r= @@ -502,11 +492,13 @@ CTRL-A can also be used to complete knitr chunk options if the cursor is inside the chunk header. If R is not running or if it is running but is busy the completion will be -based on information saved with the command |:RUpdateObjList|. Otherwise, the -pop up menu for completion of function arguments will include an additional -line with the name of the library where the function is (if the function name -can be found in more than one library) and the function method (if what is -being shown are the arguments of a method and not of the function itself). +based on information from the packages listed by |vimrplugin_permanent_libs| +(provided that the libraries were loaded at least once during a session of +Vim-R-plugin usage). Otherwise, the pop up menu for completion of function +arguments will include an additional line with the name of the library where +the function is (if the function name can be found in more than one library) +and the function method (if what is being shown are the arguments of a method +and not of the function itself). To get help on an R topic, type in Vim (Normal mode): > @@ -516,7 +508,8 @@ The command may be abbreviated to :Rh and you can either press to trigger the autocompletion of R objects names or hit CTRL-D to list the possible completions (see |cmdline-completion| for details on the various ways of getting command-line completion). The list of objects used for -completion is the same one built by |:RUpdateObjList|. +completion is the available for omnicompletion (see +|vimrplugin_permanent_libs|). You can source all .R files in a directory with the Normal mode command :RSourceDir, which accepts an optional argument (the directory to be sourced). @@ -551,45 +544,14 @@ mode: 4.3. Omni completion and the highlighting of functions~ - *:RUpdateObjList* - *:RAddLibToList* + The plugin adds some features to the default syntax highlight of R code. One -such feature is the highlight of R functions. However, only functions that -R loads by default are highlighted. To add functions of other libraries, you -should do the following: - - 1. Start R from within Vim. - 2. Use R's `library()` to load the libraries whose functions you want - highlighted. - 3. Run the following command in Vim's Normal mode: - :RUpdateObjList - -The command :RUpdateObjList in addition to creating a list of function names -to be highlighted also creates a file containing a list of objects for omni -completion (|compl-omni|) including all objects currently in R's workspace, -except the .GlobalEnv objects. These two lists are stored permanently in the -~/.vim/r-plugin directory. - -The command :RUpdateObjList waits 60 seconds to R finish building the list. -If this time is not enough to your system, please, set a different value of -|vimrplugin_buildwait|. - -You should run :RUpdateObjList whenever you upgrade R since some functions -are removed and new ones are added at each new R version. - -If have already run :RUpdateObjList and now want to add the objects of -specific libraries to both the list of objects for omnicompletion and the list -of functions for syntax highlight you can use the Vim command :RAddLibToList. -Example: -> - :RAddLibToList foreign Matrix -< +such feature is the highlight of R functions. However, functions are +highlighted only if their libraries are loaded by R (but see +|vimrplugin_permanent_libs|). + Note: If you have too many loaded packages Vim may be unable to load the list -of functions for syntax highlight. If you want to remove the objects of -specific libraries, please, delete the corresponding files from -~/.vim/r-plugin/objlist/ directory (the directory may be at a different -location if you are using a plugin management system like vim-addons or -pathogen). +of functions for syntax highlight. 4.4. Omni completion~ @@ -981,7 +943,7 @@ is running: |vimrplugin_i386| Use 32 bit version of R |vimrplugin_r_path| Directory where R is |vimrplugin_r_args| Arguments to pass to R -|vimrplugin_buildwait| Time to wait for :RUpdateObjList to finish +|vimrplugin_permanent_libs| Objects for omnicompletion and syntax highlight |vimrplugin_routmorecolors| More syntax highlighting in R output |vimrplugin_routnotab| Show output of R CMD BATCH in new window |vimrplugin_indent_commented| Indent lines commented with the \xx command @@ -1193,14 +1155,18 @@ default value is "--sdi", but you may change it to "--mdi" if you do not like the SDI style of the graphical user interface. -6.9. Time necessary to build list of objects for omni completion~ - *vimrplugin_buildwait* -If your system needs more than 60 seconds to build the list of objects for -omni completion after you do the command |:RUpdateObjList|, then you should -set the value of |vimrplugin_buildwait| to a higher value. Example: -> - let vimrplugin_buildwait = 240 +6.9. Omnicompletion and syntax highlight of R functions~ + *vimrplugin_permanent_libs* +The list of functions to be highlighted and the list of objects for +omnicompletion are built dynamically as the libraries are loaded by R. +However, you can set the value of vimrplugin_permanent_libs if you want that +the functions and objects of specific packages are respectively highlighted +and available for omnicompletion even if R is not running. By default, only +the functions of vanilla R are always highlighted. Below is the default value +of vimrplugin_permanent_libs: > + let vimrplugin_permanent_libs = "base,stats,graphics,grDevices,utils,datasets,methods" +< 6.10. More colorful syntax highlight of .Rout files~ *vimrplugin_routmorecolors* @@ -2216,7 +2182,14 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details. *r-plugin-news* 10. News~ -0.9.9.7 (2013-11-02) +0.9.9.8 (2013-11-05) + + * The list of objects for omnicompletion and the list of functions for syntax + highlight now are built dynamically. Deprecated commands and options: + :RUpdateObjList, :RAddLibToList, vimrplugin_buildwait. New option: + vimrplugin_permanent_libs. + +0.9.9.7 (2013-11-06) * Minor bug fixes. diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index c38fd0c..59bae74 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -211,7 +211,7 @@ function RCompleteArgs() let idx2 = cpos[2] - strlen(argkey) endif if g:needsnewomnilist == 1 - call BuildROmniList("GlobalEnv", "") + call BuildROmniList() endif let flines = g:rplugin_globalenvlines + g:rplugin_liblist let np = 1 @@ -617,6 +617,9 @@ endfunction function StartR_TmuxSplit(rcmd) call system("tmux set-environment -g VIMRPLUGIN_TMPDIR " . g:rplugin_esc_tmpdir) call system("tmux set-environment -g VIMRPLUGIN_HOME " . g:rplugin_home) + if v:servername != "" + call system("tmux set-environment VIMEDITOR_SVRNM " . v:servername) + endif call system("tmux set-environment VIMINSTANCEID " . $VIMINSTANCEID) let g:rplugin_vim_pane = TmuxActivePane() let tcmd = "tmux split-window " @@ -660,32 +663,37 @@ function StartR_ExternalTerm(rcmd) endif " Create a custom tmux.conf + let cnflines = [ + \ 'set-environment -g VIMRPLUGIN_TMPDIR ' . g:rplugin_esc_tmpdir, + \ 'set-environment -g VIMRPLUGIN_HOME ' . g:rplugin_home, + \ 'set-environment VIMINSTANCEID ' . $VIMINSTANCEID ] + if v:servername != "" + let cnflines = cnflines + [ 'set-environment VIMEDITOR_SVRNM ' . v:servername, + endif if g:vimrplugin_notmuxconf - let cnflines = [ - \ 'set-environment -g VIMRPLUGIN_TMPDIR ' . g:rplugin_esc_tmpdir, - \ 'set-environment -g VIMRPLUGIN_HOME ' . g:rplugin_home, - \ 'set-environment VIMINSTANCEID ' . $VIMINSTANCEID, - \ 'source-file ~/.tmux.conf' ] + let cnflines = cnflines + [ 'source-file ~/.tmux.conf' ] else - let cnflines = [ + let cnflines = cnflines + [ \ 'set-option -g prefix C-a', \ 'unbind-key C-b', \ 'bind-key C-a send-prefix', \ 'set-window-option -g mode-keys vi', \ 'set -g status off', \ "set -g terminal-overrides 'xterm*:smcup@:rmcup@'", - \ 'set-environment -g VIMRPLUGIN_TMPDIR "' . $VIMRPLUGIN_TMPDIR . '"', - \ 'set-environment -g VIMRPLUGIN_HOME "' . g:rplugin_home . '"', - \ 'set-environment VIMINSTANCEID "' . $VIMINSTANCEID . '"'] + ] if g:vimrplugin_external_ob || !has("gui_running") - let cnflines = extend(cnflines, ['set -g mode-mouse on', 'set -g mouse-select-pane on', 'set -g mouse-resize-pane on']) + call extend(cnflines, ['set -g mode-mouse on', 'set -g mouse-select-pane on', 'set -g mouse-resize-pane on']) endif endif + call extend(cnflines, ['set-environment VIMINSTANCEID "' . $VIMINSTANCEID . '"']) call writefile(cnflines, s:tmxcnf) let rcmd = "VIMINSTANCEID=" . $VIMINSTANCEID . " " . a:rcmd call system('export VIMRPLUGIN_TMPDIR=' . $VIMRPLUGIN_TMPDIR) - call system('export VIMRPLUGIN_TMPDIR=' . g:rplugin_home) + call system('export VIMRPLUGIN_HOME=' . g:rplugin_home) call system('export VIMINSTANCEID=' . $VIMINSTANCEID) + if v:servername != "" + call system('export VIMEDITOR_SVRNM=' . v:servername) + endif " Start the terminal emulator even if inside a Tmux session if $TMUX != "" let tmuxenv = $TMUX @@ -773,6 +781,9 @@ endfunction function StartR(whatr) call writefile([], $VIMRPLUGIN_TMPDIR . g:rplugin_globenv_f) call writefile([], $VIMRPLUGIN_TMPDIR . g:rplugin_liblist_f) + if filereadable($VIMRPLUGIN_TMPDIR . "/libnames_" . $VIMINSTANCEID) + call delete($VIMRPLUGIN_TMPDIR . "/libnames_" . $VIMINSTANCEID) + endif if !exists("b:rplugin_R") call SetRPath() @@ -1846,7 +1857,7 @@ endfunction " Tell R to create a list of objects file listing all currently available " objects in its environment. The file is necessary for omni completion. -function BuildROmniList(env, packlist) +function BuildROmniList() if has("win32") || has("win64") && g:rplugin_vimcom_pkg == "vimcom" if !exists("g:rplugin_vimcom_omni_warn") @@ -1860,23 +1871,15 @@ function BuildROmniList(env, packlist) endif endif - if a:env =~ "GlobalEnv" - let rtf = g:rplugin_globalenvfname - let g:needsnewomnilist = 0 - else - let rtf = g:rplugin_omnidname - endif + let rtf = g:rplugin_globalenvfname + let g:needsnewomnilist = 0 let omnilistcmd = 'vim.bol("' . rtf . '"' - if a:packlist != "" - let omnilistcmd = omnilistcmd . ", packlist=" . a:packlist - endif if g:vimrplugin_allnames == 1 let omnilistcmd = omnilistcmd . ', allnames = TRUE' endif let omnilistcmd = omnilistcmd . ')' call delete($VIMRPLUGIN_TMPDIR . "/vimbol_finished") - if a:env =~ "GlobalEnv" call delete($VIMRPLUGIN_TMPDIR . "/eval_reply") exe "Py SendToVimCom('" . omnilistcmd . "')" if g:rplugin_vimcomport == 0 @@ -1892,91 +1895,88 @@ function BuildROmniList(env, packlist) return endif sleep 20m - else - echohl WarningMsg - echo "Please, wait..." - echohl Normal - call g:SendCmdToR(omnilistcmd) - sleep 2 - endif let ii = 0 - while !filereadable($VIMRPLUGIN_TMPDIR . "/vimbol_finished") && ii < g:vimrplugin_buildwait + while !filereadable($VIMRPLUGIN_TMPDIR . "/vimbol_finished") && ii < 5 let ii += 1 sleep endwhile echon "\r " - if ii == g:vimrplugin_buildwait + if ii == 5 call RWarningMsg("No longer waiting...") return endif - if a:env == "GlobalEnv" - let g:rplugin_globalenvlines = readfile(g:rplugin_globalenvfname) - endif + let g:rplugin_globalenvlines = readfile(g:rplugin_globalenvfname) echon endfunction -function RFillLibList() - let g:rplugin_liblist = [] - if isdirectory(g:rplugin_uservimfiles . "/r-plugin/objlist") - let dirls = split(glob(g:rplugin_uservimfiles . "/r-plugin/objlist/omnils_*"), "\n") - for omf in dirls - let g:rplugin_liblist = g:rplugin_liblist + readfile(omf) - endfor - endif +function RRemoveFromLibls(nlib) + let idx = 0 + for lib in g:rplugin_libls + if lib == a:nlib + call remove(g:rplugin_libls, idx) + break + endif + let idx += 1 + endfor endfunction -function RBuildSyntaxFile(...) - if g:rplugin_vimcomport == 0 - exe "Py DiscoverVimComPort()" - if g:rplugin_vimcomport == 0 +function RAddToLibList(nlib, verbose) + if isdirectory(g:rplugin_uservimfiles . "/r-plugin/objlist") + let omf = split(glob(g:rplugin_uservimfiles . "/r-plugin/objlist/omnils_" . a:nlib . "_*"), "\n") + if len(omf) == 1 + let nlist = readfile(omf[0]) + + " List of objects for omni completion + let g:rplugin_liblist = g:rplugin_liblist + nlist + + " List of objects for :Rhelp completion + for xx in nlist + let xxx = split(xx, "\x06") + if xxx[0] !~ '\$' + call add(s:list_of_objs, xxx[0]) + endif + endfor + + let fnf = split(glob(g:rplugin_uservimfiles . "/r-plugin/objlist/fun_" . a:nlib . "_*"), "\n") + if len(fnf) == 1 + " List of functions for syntax highlith + silent exe "source " . fnf[0] + elseif a:verbose && len(fnf) == 0 + call RWarningMsg('Fun_ file for "' . a:nlib . '" not found.') + return + elseif a:verbose && len(fnf) > 1 + call RWarningMsg('There is more than one fun_ file for "' . a:nlib . '".') + return + endif + elseif a:verbose && len(omf) == 0 + call RWarningMsg('Omnils file for "' . a:nlib . '" not found.') + call RRemoveFromLibls(a:nlib) + return + elseif a:verbose && len(omf) > 1 + call RWarningMsg('There is more than one omnils file for "' . a:nlib . '".') + call RRemoveFromLibls(a:nlib) return endif endif - if a:0 == 0 - let packls = "" - else - let packls = 'c("' . join(split(a:1), '", "') . '")' - endif - call BuildROmniList("libraries", packls) - sleep 100m - call RFillLibList() - call BuildRHelpList() - let res = [] - let nf = 0 - let funlist = "" - for line in g:rplugin_liblist - let obj = split(line, "\x06", 1) - if obj[2] == "function" && obj[0] !~ '%' - if obj[0] !~ '[[:punct:]]' || (obj[0] =~ '\.[a-zA-Z]' && obj[0] !~ '[[:punct:]][[:punct:]]') - let nf += 1 - let funlist = funlist . " " . obj[0] - if nf == 7 - let line = "syn keyword rFunction " . funlist - call add(res, line) - let nf = 0 - let funlist = "" +endfunction + +function RFillLibList() + if filereadable($VIMRPLUGIN_TMPDIR . "/libnames_" . $VIMINSTANCEID) + let newls = readfile($VIMRPLUGIN_TMPDIR . "/libnames_" . $VIMINSTANCEID) + for nlib in newls + let isold = 0 + for olib in g:rplugin_libls + if nlib == olib + let isold = 1 + break endif + endfor + if isold == 0 + let g:rplugin_libls = g:rplugin_libls + [ nlib ] + call RAddToLibList(nlib, 1) endif - endif - endfor - if nf > 0 - let line = "syn keyword rFunction " . funlist - call add(res, line) - endif - call writefile(res, g:rplugin_uservimfiles . "/r-plugin/functions.vim") - if &filetype == "rbrowser" - let savesb = &switchbuf - set switchbuf=useopen,usetab - exe "sb " . b:rscript_buffer - unlet b:current_syntax - exe "runtime syntax/r.vim" - exe "sb " . b:objbrtitle - exe "set switchbuf=" . savesb - call UpdateOB("libraries") - else - unlet b:current_syntax - exe "set filetype=" . &filetype + endfor endif endfunction @@ -2251,18 +2251,6 @@ function ShowRDoc(rkeyword, package, getclass) redraw endfunction -function BuildRHelpList() - if !exists("s:list_of_objs") - let s:list_of_objs = [] - endif - for xx in g:rplugin_liblist - let xxx = split(xx, "\x06") - if xxx[0] !~ '\$' - call add(s:list_of_objs, xxx[0]) - endif - endfor -endfunction - function RLisObjs(arglead, cmdline, curpos) let lob = [] let rkeyword = '^' . a:arglead @@ -2762,12 +2750,6 @@ function MakeRMenu() "---------------------------------------------------------------------------- call RBrowserMenu() - "---------------------------------------------------------------------------- - " Syntax - "---------------------------------------------------------------------------- - nmenu R.Syntax.Build\ omniList\ (loaded):RUpdateObjList :call RBuildSyntaxFile() - imenu R.Syntax.Build\ omniList\ (loaded):RUpdateObjList :call RBuildSyntaxFile()a - "---------------------------------------------------------------------------- " Help "---------------------------------------------------------------------------- @@ -2793,7 +2775,6 @@ function MakeRMenu() endif amenu R.Help\ (plugin).Options.R\ path :help vimrplugin_r_path amenu R.Help\ (plugin).Options.Arguments\ to\ R :help vimrplugin_r_args - amenu R.Help\ (plugin).Options.Time\ building\ omniList :help vimrplugin_buildwait amenu R.Help\ (plugin).Options.Syntax\ highlighting\ of\ \.Rout\ files :help vimrplugin_routmorecolors amenu R.Help\ (plugin).Options.Automatically\ open\ the\ \.Rout\ file :help vimrplugin_routnotab amenu R.Help\ (plugin).Options.Special\ R\ functions :help vimrplugin_listmethods @@ -3037,14 +3018,16 @@ function RSourceOtherScripts() endif endfunction -command RUpdateObjList :call RBuildSyntaxFile() -command -nargs=+ RAddLibToList :call RBuildSyntaxFile() command -nargs=1 -complete=customlist,RLisObjs Rinsert :call RInsert() command -range=% Rformat ,:call RFormatCode() command RBuildTags :call g:SendCmdToR('rtags(ofile = "TAGS")') command -nargs=? -complete=customlist,RLisObjs Rhelp :call RAskHelp() command -nargs=? -complete=dir RSourceDir :call RSourceDirectory() +" TODO: Delete these two commands (Nov 2013): +command RUpdateObjList :call RWarningMsg("This command is deprecated. Now the list of objects is automatically updated by the R package vimcom.plus.") +command -nargs=? RAddLibToList :call RWarningMsg("This command is deprecated. Now the list of objects is automatically updated by the R package vimcom.plus.") + "========================================================================== " Global variables " Convention: vimrplugin_ for user options @@ -3090,6 +3073,9 @@ if has("win32") || has("win64") endif let $VIMRPLUGIN_HOME = g:rplugin_home +if v:servername != "" + let $VIMEDITOR_SVRNM = v:servername +endif if isdirectory("/tmp") let $VIMRPLUGIN_TMPDIR = "/tmp/r-plugin-" . g:rplugin_userlogin @@ -3133,13 +3119,13 @@ call RSetDefaultValue("g:vimrplugin_editor_w", 66) call RSetDefaultValue("g:vimrplugin_help_w", 46) call RSetDefaultValue("g:vimrplugin_objbr_w", 40) call RSetDefaultValue("g:vimrplugin_external_ob", 0) -call RSetDefaultValue("g:vimrplugin_buildwait", 60) call RSetDefaultValue("g:vimrplugin_indent_commented", 1) call RSetDefaultValue("g:vimrplugin_never_unmake_menu", 0) call RSetDefaultValue("g:vimrplugin_vimpager", "'tab'") call RSetDefaultValue("g:vimrplugin_latexcmd", "'pdflatex'") call RSetDefaultValue("g:vimrplugin_objbr_place", "'script,right'") call RSetDefaultValue("g:vimrplugin_insert_mode_cmds", 1) +call RSetDefaultValue("g:vimrplugin_permanent_libs", "'base,stats,graphics,grDevices,utils,datasets,methods'") " Look for invalid options let objbrplace = split(g:vimrplugin_objbr_place, ",") @@ -3389,11 +3375,6 @@ if g:vimrplugin_objbr_w < 10 let g:vimrplugin_objbr_w = 10 endif -" Keeps the libraries object list in memory to avoid the need of reading the file -" repeatedly: -call RFillLibList() -call BuildRHelpList() - " Control the menu 'R' and the tool bar buttons if !exists("g:rplugin_hasmenu") @@ -3528,6 +3509,12 @@ call SetRPath() " not created yet or is outdated. let g:needsnewomnilist = 0 +" Keeps the names object list in memory to avoid the need of reading the files +" repeatedly: +let g:rplugin_libls = split(g:vimrplugin_permanent_libs, ",") +let g:rplugin_liblist = [] +let s:list_of_objs = [] + " Compatibility with old versions (August 2013): if exists("g:vimrplugin_tmux") diff --git a/r-plugin/objlist/README b/r-plugin/objlist/README index b987a68..a0bee4e 100644 --- a/r-plugin/objlist/README +++ b/r-plugin/objlist/README @@ -1,6 +1,5 @@ -The omnils_* files in this directory are generated by Vim-R-plugin -and are used for omni completion. Please, read :h RUpdateObjList -fort details. +The omnils_ and fun_ files in this directory are generated by Vim-R-plugin and +vimcom.plus and are used for omni completion and syntax highlight. -You should manually delete files corresponding to libraries that -you no longer use. +You should manually delete files corresponding to libraries that you no longer +use. diff --git a/r-plugin/vimcom.py b/r-plugin/vimcom.py index d382e4a..37408f3 100644 --- a/r-plugin/vimcom.py +++ b/r-plugin/vimcom.py @@ -50,8 +50,8 @@ def DiscoverVimComPort(): else: vim.command("let g:rplugin_vimcomport = " + str(VimComPort)) PortWarn = False - if repl.find("0.9-91") != 0: - vim.command("call RWarningMsg('This version of Vim-R-plugin requires vimcom.plus (or vimcom) 0.9-91.')") + if repl.find("0.9-92") != 0: + vim.command("call RWarningMsg('This version of Vim-R-plugin requires vimcom.plus (or vimcom) 0.9-92.')") vim.command("sleep 1") return(VimComPort) diff --git a/syntax/r.vim b/syntax/r.vim index ff358dc..dce63a1 100644 --- a/syntax/r.vim +++ b/syntax/r.vim @@ -3,7 +3,7 @@ " Maintainer: Jakson Aquino " Former Maintainers: Vaidotas Zemlys " Tom Payne -" Last Change: Sun May 19, 2013 05:59PM +" Last Change: Wed Nov 06, 2013 10:00AM " Filenames: *.R *.r *.Rhistory *.Rt " " NOTE: The highlighting of R functions is defined in the @@ -152,7 +152,11 @@ syn match rParenError "[\]}]" contained " Source list of R functions. The list is produced by the Vim-R-plugin " http://www.vim.org/scripts/script.php?script_id=2628 -runtime r-plugin/functions.vim +if exists("g:rplugin_libls") && exists("*RAddToLibList") + for lib in g:rplugin_libls + call RAddToLibList(lib, 0) + endfor +endif syn match rDollar display contained "\$" syn match rDollar display contained "@" From 4efb97ccd3d61b279f3f222f0c2c7f9c96afbee3 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Wed, 6 Nov 2013 11:42:17 -0300 Subject: [PATCH 0514/1050] Show preview window if vimrplugin_show_args=1. By default, don't show the preview window with the list of arguments and their default values during omnicompletion because the use of ^X^A is more convenient. --- autoload/rcomplete.vim | 12 ++++++++---- doc/r-plugin.txt | 35 +++++++++++++++++++++++++---------- r-plugin/common_global.vim | 1 + 3 files changed, 34 insertions(+), 14 deletions(-) diff --git a/autoload/rcomplete.vim b/autoload/rcomplete.vim index 61e91de..bc175f5 100644 --- a/autoload/rcomplete.vim +++ b/autoload/rcomplete.vim @@ -39,10 +39,14 @@ fun! rcomplete#CompleteR(findstart, base) continue endif let tmp1 = split(line, "\x06", 1) - let info = tmp1[4] - let info = substitute(info, "\t", ", ", "g") - let info = substitute(info, "\x07", " = ", "g") - let tmp2 = {'word': tmp1[0], 'menu': tmp1[1] . ' ' . tmp1[3], 'info': info} + if g:vimrplugin_show_args + let info = tmp1[4] + let info = substitute(info, "\t", ", ", "g") + let info = substitute(info, "\x07", " = ", "g") + let tmp2 = {'word': tmp1[0], 'menu': tmp1[1] . ' ' . tmp1[3], 'info': info} + else + let tmp2 = {'word': tmp1[0], 'menu': tmp1[1] . ' ' . tmp1[3]} + endif call add(res, tmp2) endif endfor diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 67980bf..83731dc 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -951,7 +951,7 @@ is running: |vimrplugin_rconsole_height| The number of lines of R Console (Tmux split) |vimrplugin_vsplit| Make Tmux split the window vertically |vimrplugin_rconsole_width| The number of columns of R Console (Tmux split) -|vimrplugin_applescript| Use osascript in Mac OS X. +|vimrplugin_applescript| Use osascript in Mac OS X |vimrplugin_listmethods| Do `vim.list.args()` instead of `args()` |vimrplugin_specialplot| Do `vim.plot()` instead of `plot()` |vimrplugin_maxdeparse| Argument to R `args()` function @@ -959,16 +959,17 @@ is running: |vimrplugin_sweaveargs| Arguments do `Sweave()` |vimrplugin_never_unmake_menu| Do not unmake the menu when switching buffers |vimrplugin_map_r| Use 'r' to send lines and selected text -|vimrplugin_ca_ck| Add ^A^K to the beginning of commands. -|vimrplugin_openpdf| Open PDF after processing rnoweb file. -|vimrplugin_openpdf_quietly| Open PDF quietly. -|vimrplugin_openhtml| Open PDF quietly. -|vimrplugin_strict_rst| Code style for generated rst files. -|vimrplugin_insert_mode_cmds| Allow R commands in insert mode. +|vimrplugin_ca_ck| Add ^A^K to the beginning of commands +|vimrplugin_openpdf| Open PDF after processing rnoweb file +|vimrplugin_openpdf_quietly| Open PDF quietly +|vimrplugin_openhtml| Open PDF quietly +|vimrplugin_strict_rst| Code style for generated rst files +|vimrplugin_insert_mode_cmds| Allow R commands in insert mode |vimrplugin_allnames| Show names which begin with a dot -|vimrplugin_rmhidden| Remove hidden objects from R workspace. -|vimrplugin_source| Source additional scripts. -|vimrplugin_restart| Restart R if it is already running. +|vimrplugin_rmhidden| Remove hidden objects from R workspace +|vimrplugin_source| Source additional scripts +|vimrplugin_restart| Restart R if it is already running +|vimrplugin_show_args| Show extra information during omnicompletion 6.1. Terminal emulator (Linux/Unix only)~ @@ -1468,6 +1469,18 @@ do rf, rv or rc, then, put in your let vimrplugin_restart = 1 < +6.29. Show extra information during omnicompletion~ + *vimrplugin_show_args* +If you want that Vim shows a preview window with the function arguments as you +do omnicompletion, put in your |vimrc|: +> + let vimrplugin_show_args = 1 +< +The preview window is not shown by default because it is more convenient to +run to complete the function arguments. The preview window +will be shown only if "preview" is included in your 'completeopt'. + + ============================================================================== *r-plugin-key-bindings* 7. Custom key bindings~ @@ -2189,6 +2202,8 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details. :RUpdateObjList, :RAddLibToList, vimrplugin_buildwait. New option: vimrplugin_permanent_libs. + * New option: vimrplugin_show_args. + 0.9.9.7 (2013-11-06) * Minor bug fixes. diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 59bae74..45a4014 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -3119,6 +3119,7 @@ call RSetDefaultValue("g:vimrplugin_editor_w", 66) call RSetDefaultValue("g:vimrplugin_help_w", 46) call RSetDefaultValue("g:vimrplugin_objbr_w", 40) call RSetDefaultValue("g:vimrplugin_external_ob", 0) +call RSetDefaultValue("g:vimrplugin_show_args", 0) call RSetDefaultValue("g:vimrplugin_indent_commented", 1) call RSetDefaultValue("g:vimrplugin_never_unmake_menu", 0) call RSetDefaultValue("g:vimrplugin_vimpager", "'tab'") From 89f6aa55bcce745642f6686fcd38904ec3dc38c0 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Wed, 6 Nov 2013 12:49:12 -0300 Subject: [PATCH 0515/1050] Remove icons from bitmap directory. The buttons are being removed because the bmp and png files are binary and binary files cannot be included in a vimball. For users that are starting to use Vim on Windows and who don't known very well how files are organized in the Windows file system, it's easier to install a vimball than to unpack the zip file and, then, run :helptags in the correct directories. Moreover, the buttons are more a cosmetic than a practical addition because Vim users are expected to use the keyboard and not the mouse. Anyway, people who want to add the buttons can download them from http://www.lepem.ufc.br/jaa/bitmaps.zip --- Makefile | 29 +---------- bitmaps/RClear.bmp | Bin 702 -> 0 bytes bitmaps/RClear.png | Bin 1079 -> 0 bytes bitmaps/RClearAll.bmp | Bin 702 -> 0 bytes bitmaps/RClearAll.png | Bin 718 -> 0 bytes bitmaps/RClose.bmp | Bin 702 -> 0 bytes bitmaps/RClose.png | Bin 999 -> 0 bytes bitmaps/RListSpace.bmp | Bin 702 -> 0 bytes bitmaps/RListSpace.png | Bin 667 -> 0 bytes bitmaps/RSendBlock.bmp | Bin 702 -> 0 bytes bitmaps/RSendBlock.png | Bin 553 -> 0 bytes bitmaps/RSendFile.bmp | Bin 702 -> 0 bytes bitmaps/RSendFile.png | Bin 530 -> 0 bytes bitmaps/RSendFunction.bmp | Bin 702 -> 0 bytes bitmaps/RSendFunction.png | Bin 871 -> 0 bytes bitmaps/RSendLine.bmp | Bin 702 -> 0 bytes bitmaps/RSendLine.png | Bin 949 -> 0 bytes bitmaps/RSendParagraph.bmp | Bin 702 -> 0 bytes bitmaps/RSendParagraph.png | Bin 390 -> 0 bytes bitmaps/RSendSelection.bmp | Bin 702 -> 0 bytes bitmaps/RSendSelection.png | Bin 502 -> 0 bytes bitmaps/RStart.bmp | Bin 702 -> 0 bytes bitmaps/RStart.png | Bin 1050 -> 0 bytes bitmaps/ricon.png | Bin 904 -> 0 bytes bitmaps/ricon.xbm | 10 ---- doc/r-plugin.txt | 59 +++++++++++++---------- r-plugin/common_global.vim | 95 +++++++++++++++++++++---------------- 27 files changed, 91 insertions(+), 102 deletions(-) delete mode 100644 bitmaps/RClear.bmp delete mode 100644 bitmaps/RClear.png delete mode 100644 bitmaps/RClearAll.bmp delete mode 100644 bitmaps/RClearAll.png delete mode 100644 bitmaps/RClose.bmp delete mode 100644 bitmaps/RClose.png delete mode 100644 bitmaps/RListSpace.bmp delete mode 100644 bitmaps/RListSpace.png delete mode 100644 bitmaps/RSendBlock.bmp delete mode 100644 bitmaps/RSendBlock.png delete mode 100644 bitmaps/RSendFile.bmp delete mode 100644 bitmaps/RSendFile.png delete mode 100644 bitmaps/RSendFunction.bmp delete mode 100644 bitmaps/RSendFunction.png delete mode 100644 bitmaps/RSendLine.bmp delete mode 100644 bitmaps/RSendLine.png delete mode 100644 bitmaps/RSendParagraph.bmp delete mode 100644 bitmaps/RSendParagraph.png delete mode 100644 bitmaps/RSendSelection.bmp delete mode 100644 bitmaps/RSendSelection.png delete mode 100644 bitmaps/RStart.bmp delete mode 100644 bitmaps/RStart.png delete mode 100644 bitmaps/ricon.png delete mode 100644 bitmaps/ricon.xbm diff --git a/Makefile b/Makefile index 7d77758..86241c6 100644 --- a/Makefile +++ b/Makefile @@ -45,19 +45,7 @@ zip: r-plugin/global_r_plugin.vim r-plugin/windows.py \ r-plugin/objlist/README \ r-plugin/tex_indent.vim r-plugin/r.snippets \ - r-plugin/common_buffer.vim r-plugin/common_global.vim \ - bitmaps/ricon.xbm bitmaps/ricon.png \ - bitmaps/RStart.png bitmaps/RStart.bmp \ - bitmaps/RClose.png bitmaps/RClose.bmp \ - bitmaps/RSendFile.png bitmaps/RSendFile.bmp \ - bitmaps/RSendBlock.png bitmaps/RSendBlock.bmp \ - bitmaps/RSendFunction.png bitmaps/RSendFunction.bmp \ - bitmaps/RSendParagraph.png bitmaps/RSendParagraph.bmp \ - bitmaps/RSendSelection.png bitmaps/RSendSelection.bmp \ - bitmaps/RSendLine.png bitmaps/RSendLine.bmp \ - bitmaps/RListSpace.png bitmaps/RListSpace.bmp \ - bitmaps/RClear.png bitmaps/RClear.bmp \ - bitmaps/RClearAll.png bitmaps/RClearAll.bmp + r-plugin/common_buffer.vim r-plugin/common_global.vim # Unpack the tar.gz and create the zip file (cd /tmp ;\ tar -xvzf vimrplugintmpfile.tar.gz -C vim-r-plugin-tmp/usr/share/vim/addons > /dev/null ;\ @@ -88,19 +76,6 @@ deb: disabledby: \"let disable_r_ftplugin = 1\"\n\ files:\n\ - autoload/rcomplete.vim\n\ - - bitmaps/RClose.png\n\ - - bitmaps/RClear.png\n\ - - bitmaps/RClearAll.png\n\ - - bitmaps/RListSpace.png\n\ - - bitmaps/RSendBlock.png\n\ - - bitmaps/RSendFile.png\n\ - - bitmaps/RSendFunction.png\n\ - - bitmaps/RSendLine.png\n\ - - bitmaps/RSendParagraph.png\n\ - - bitmaps/RSendSelection.png\n\ - - bitmaps/RStart.png\n\ - - bitmaps/ricon.png\n\ - - bitmaps/ricon.xbm\n\ - doc/r-plugin.txt\n\ - ftdetect/r.vim\n\ - ftplugin/r.vim\n\ @@ -154,7 +129,7 @@ deb: unzip /tmp/vim-r-plugin-$(PLUGINVERSION).zip -d /tmp/vim-r-plugin-tmp/usr/share/vim/addons # Delete the files unnecessary in a Debian system (cd /tmp/vim-r-plugin-tmp/usr/share/vim/addons ;\ - rm bitmaps/*.bmp r-plugin/windows.py ) + rm r-plugin/windows.py ) # Add a comment to r-plugin.txt (cd /tmp/vim-r-plugin-tmp/usr/share/vim/addons ;\ sed -e 's/3.2.1. Unix (Linux, OS X, etc.)./3.2.1. Unix (Linux, OS X, etc.)~\n\nNote: If the plugin was installed from the Debian package, then the\ninstallation is finished and you should now read sections 3.3 and 3.4./' -i doc/r-plugin.txt ) diff --git a/bitmaps/RClear.bmp b/bitmaps/RClear.bmp deleted file mode 100644 index 523bb7b64b0a379e866296c0adf3d41816173b46..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 702 zcmaixF>BjE6oB2*7L|%xv;t*_!G;|8prY2G5Dzw35Wxu|unHP(kcdNDNFfGm2xKvd z7dIYKkhe@tyM$<~J*JD2sid3z2Lhp!yR_%geRpXZLkrc%JDuM9?$Eol);{0Oh-Vqb zBE*y5aVMjQd>86ZA6^CHSpt}g?}p3* z?hw>+7B=#kRN0kh?bGek?VUHfa;l_is^&9VC>$KST3D0z^&_y}14qgw)Km3R&EM0) z@37CNKJcbNL*8k!fLCte4hynXf_nPUXLL_K)_>B&=2C98aKp>Oy2NPKBIv{zLDy&M zVf4d4*1Px>`s1K=X+#x^;KbzT(viQIZ*@)=zs9SDr5u9&YSPFzY=SOKMhE`+!hy48 zbJi@*v+Bd;Z|0sn^gRchG7I|Nx%$p&3P*Ut+_FEa1Ha`GG^tF3*gaDpUsX5-@%N1F6_C diff --git a/bitmaps/RClear.png b/bitmaps/RClear.png deleted file mode 100644 index 34c6d2ea4d81f094c536d6b32c1d22df708ddda1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1079 zcmV-71jze|P)Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2iXY} z04xP!)!N?x00Xy4L_t(Y$F-JQXdP7)hQB#`pIc5%z=%boAc~c$c%v^OwiJ=7MMNJg z)K(Bn`rri=6dxl}L@bCzpQLX}!H0N3U#u6rwZvX%lBNYKNh-B{NltS)Idk1>`7m=P z=OhPO3LTi)ml^(l{r_Hj?SX52c>qI0L#5vS+D9U8hd9?GB8Vty>rfG#2%>^G$>u>s zP|3!cwy637BL!D{b$ECUZCN zvukW}tO2}X0pcj$`{=`4swc;fGd@1i5{BnxB0cc3xy$wM+;9impL)77dTex0P7uYe zr>9n9^7I)Fe)&0`=Yi@<@T!33LR7UwS~^rj9eek@&I9*tLK3$Qzyi1=0l*l8itzS( zgSliyS1h1qMdm#Uy7Kh%Q<|9ZR)TyszWLCB16dk@aV z%+1bYttAKoM0AC~wFr!%R;zIPT?09&v_+^YD4J)D?=R8t=V|&4a51JRSZnYDKTm{I zL6XWb)-r!-k)uZ@^2k$<9V(z?z(Ip$e+hBY$^ihHOA*Fce7~8mPeu@D78%Ob5<~Co z=g{vX{4;Yp1(np2MstycMx9d8QNFIHZ6~FjQrV^on%xwrVytCpVVUz6X4v)IYy5Zd z93Sj|m+A9o3BqO?h}UJOwiGN!Sld$2Mi9p_&I#5SiY3D*2j0ipB7?i%-4ELv^G@`G{aQ{aZD6N zSZj!agy(lY)9JFewnTbeRv`)!thG3obXw#jA&f$-u@p>!VtK{uvtt+66uAu#-n>dt z`Y0F=&+~9jR$G)1h9O?T1BDAy_56dLb>%Cs{RJ=GgwAymhzLm>Gc$9Jk*`P6Vs{mn zsxm!2L)n%(2~dLBx!Fo{X_;Ss{P~IjA9~qv;(%l7-zoa~dg<@Gfoi47jqBGV;+i=@ z7=~XR`ss%kwmtqt$rzKLT25RpIjuj6YxTvE92M@pN7%UW?(76~#Bs!_$%!}&<8O0< zKY#n7v_dwumF(wUr#E8=|s?&CLrVxEQl%uUy;R$ z0|uQrK;q~s7#NlblsT2zLEuGQkSdrOwa~{25ZLHa>Sk&c3WmOlFctsn85lYfnR8jd zP^FZCWrvrkm8sPyLk0#$xUZ4bu#__J-@m*72q#p7OoFI^*$tuz8WQMOwlNX7s90t|CNIv}od fEu2{PIH#bjv+xm`T?kVj=Ntsuaxmvn4ofZoPx#24YJ`L;(K){{a7>y{D4^000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2iXY} z4IUG7si>>~00K@)L_t(Y$K91bXj4%X#($;(ZG}==$RrO71xtml*|S(Bi=8ThC=NO} zh*;-B!PW$!*r7TEi3mCchk~?-p}2^aI*3t9LTy7?jL_BFhn|Sx9B`pLUAIMW za_DG3MscfYLo|&_xy06ln@TZ{z8!6Oi}qENWMrygo_~@?e->);d%s&+I`uj})fva2i+xa?S>a_!qRzkNe73|HxDm+1lG}fK@=NX2j9y zJ}&ua1Y`lj7QvuFe8ruQ6ODaV28kKnRf%Xfv-Ru$W)`Zl_FnonM5jA zn@`S#0M3};NuX4JK7TY%I0klLoFy^4#b zO93di`YL+NAM;zk5;%ZE=4kD7*$(P)4ER)4QJ7v_dwumF(wUr!8_N*1zPXV|AJ=!8&hnSQ~v z*KnPwpwrbTkm$`QGpBN|8A0m}5o$IXn%V6P3U$lVgoxb=i*O5fyN#q~yPv3CrQ2>l z5xZ$Y5H&ZWBHhI7W_cmZDfJ3>igYrw`)paA4^tE2W@a_Z52ogN*k?-%CkrQ2C(Cr0 z?I3eR?Pf#GnUi1UXJ%(+7w$C8Pa+wvCal6u)arInzwT0rmlDQqUoB^OT{5(R%Y)S2 z3GY@oq#~-CIhQ&2fBmhf3NH~WQM>7WyMlHGfpEB+xt$x(oT%#m z^#x#aERt*U=jG4MpOaq$Cg%WI`_ol&Czdhi7L;`sJ_g!_9Wv)0%mLxYIV`yV!E{kz diff --git a/bitmaps/RClose.png b/bitmaps/RClose.png deleted file mode 100644 index 970140675878816e92e7fa969b408290a6e1cdd1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 999 zcmVPx#24YJ`L;(K){{a7>y{D4^000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2igc6 z0~0fex2Vzp00U=9L_t(Y$K91dXdGn}$A1$?cy0FZfl&uZ!w8EE5_AtM4zfrnp^Xqk zLy+L9U=Is=$RSAaWNv4l^w$SGcyAE~M*&C@p%Jx7k{A$-2)=K? zHK;1$f~JDFitU577FFeaz&St7l=~#JUw+TjxoO;IpBu7pPY5X>hzMrJC!7z6<2LpB zEz~NCA_!s({%n9>46vFrI=Ecq!tHywPd!8W$8YrBd1Vv;fPic8j7MTE+uPeLg#MX* zP_;A~bxP$BfVrK0rp`^1{+{4I?J@Vwj~u-5!YF{8iKdDkDrQF5_;6#S5o%wzvUVo{ zAUitZ?*4L{v@7!c8Kwe}3 zN3~vNQkE{A2(*9t8r{DmON-lXN2xgE2my*CCi+00VI^ z!4wSZ>s1zCpC3EZPHT{!^t#iH5f_?wo5RC9cbeI)T12T7q9T+k3qwPUi>b2-NypoB z`BKGsYpFz%#AshZh4x;;2On)_&AYAa@c^l!t_=M&Dx@ITegdgQ!~lZl`9!Ul?)`2y z0U&RWJmwZJU#d7ul@iw4yqzKlLfo^|ciWQ~=wMjr5Ny<>0$5#Hbo|+WFqND|r)z2b zu$PTxASj+Oc%C3Kc@{~*U=J;zc%FwhYcK^NYIVjl&{UB^{!`JuMJE7UeRt8x#kPRO z6a*;7v_dwumF(wUr#E8=|s?&CLrVxEQl%uUy;R$ z0|uQrK;q~s7#NlblsSdjm4V?!U63l68nw{J2@u%mQtD=E6$*yFiZB)b>lqk26Pa^a zz)+=>fn|r6sgW-2962!eEI(6 z{^bEc2r>zx24**iR%9ut2FV5hRTTjBBm56>8OTiI{6L^Ax;Zd;h?$BkTkDI!Y9`e$ emcTRxrs`vwQ1-_(R#ogOAgVyF00Cqh2(baXKnd^w diff --git a/bitmaps/RListSpace.png b/bitmaps/RListSpace.png deleted file mode 100644 index 51c7da8d83a3887d78fa21f8f17ea9aed131d784..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 667 zcmV;M0%ZM(P)Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2iXY} z05u;3w~D<000J9HL_t(Y$K{pHYZE~j#(!y2YgP%Rr9wf_fT$=6;-UTprG=h)stBb; zya^Gp-h_f+Yl0BWp{JlJ9z2wsycj4Uco8Y>!8UlPL|cumfqXS4{n*KP=xk{=>9!j^ z=?lX!vop{0KJV;21OH=O2EsrZkg9(PTmxGE6nqGf@83R=`P8&5etjkLscAVo{keD$cbh=}wY&!o zAVnF^$u?$Zd;mV69dOzu=s$P115x?b@S_xEuAKJ(+yJ_ORx^P-q;T^D>R<(Ur!r3hD?r{*&7v_dwumF(wUk`#X9y$$?{a+vG#&7q|@~q`r z(=~?OhS|Cx*kicHbgk)G%XhX0P9SyfY-bnmEyoV$6!Y7G)V#N?%C1bW&Yx3^fU}FM z^FeTL`FmTC8Y902j0+gon(ZyW7WF+20Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2iXY} z4KEE(`;vVC00F57-rWB|!*F{sHf3(Fi$)wFR_net;PGG?gSoB}sZ~ zUR_rmgRT2pN~*OVT4d`AZuiAvzW2e)znjGpCISE;&o^OLVW;yF z*+f)9;Rd8p=pJlDEhKKEgCJ5AWj_N|t^492f-OM;A|B1aog&8A zRuKZC+XR3J*ZgCxz%J-^Uw7iER4QA00nrUOx0YS2Reg{I_s|p>#uSJEI1dtoK;cM; z?1EmeAM2PXl}ge6WDAYO){7))_M2zq6isfv)+w80KHM#P?gJN9~|CeB9Z}V1mp48ad>%C;uVZ+005B7<^FdEBl;VNqWJ#wteq!v(Ib9% zF8xB`Ovs<+Pez|3*_h4bU(=MA%cZ7v_dwumF(wUk`#X9y$$?{a+vG#&7q|@~q`r z(=~?OhS|Cx*kicHbgk)G%XhX0P9SyfY-bnmEyoV$6!Y6b)a)&vQ;Z5{7gy(l;NJ50 zwlFmiQ?5mQkAuK#QFDqx>M+$n^g>9Gxga+nn==P$I!s+uc6I(76gBs%qq1T4!04!K zbT#*?k>TBHh(D0+0?GfYFZM$~kS{RJ`3DYhkWc^B->U|h1cC@R->d##zcmbDO0nOR zpnG6d$Z9~U5D;V%ra9I5-{T~bVG!iEs(g@r$mZ-V--8DCmV?YfR)g$w1RJJ?-{~7P dmSCZWpufclfYU~x7r)(mTkMeEF3{_LJphW5aex2- diff --git a/bitmaps/RSendFile.png b/bitmaps/RSendFile.png deleted file mode 100644 index 70508caab134b2078e3259b3bd9e60ed2b893172..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 530 zcmV+t0`2{YP)Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2iXY} z4KM-{9)WTI00ELoL_t(Y$F-HsPQpMC$7hzdmdZ?UJV1nG;#{NTu$8M4_U-H`-4Q~Td7p!cCwd& zVHgov#6`b(N@pMhuB&7<(Jz3A0dbOD1AlbG;c%xl#a6%iMRXbT~1A;fnkld%<5nQEFk&FAv=Xf*nqOupukb(?nk1%3Mm USn!x;n*aa+07*qoM6N<$f_%y05C8xG diff --git a/bitmaps/RSendFunction.bmp b/bitmaps/RSendFunction.bmp deleted file mode 100644 index 33738c2dcdf773cfaf400fe59f7ebc2e65fc1f52..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 702 zcmZ?r-N(cL24+A~1Biv7n2|vMEZzZ>7vhFsumF(wUq4vky=pH_bhjZyATFO0WatJ` z(_{EO?tlHYs2;=r^@eU!f*|@JYBW_X(?R@u)z4+FMR6$JtNveanXajdtR|UfZ#jhj zJ&u7vA{oTqTb|5=tOgcV_o_J*gS;T-{I7?ILPGO@J+O%smjZ oA*4hy%soyV)%pMHVg5o^gYcJtlOhYqUPNfX)M1LiWClA80BE19>Hq)$ diff --git a/bitmaps/RSendFunction.png b/bitmaps/RSendFunction.png deleted file mode 100644 index 9900acbb0fa689e5506abc4664cefe64bb0692a0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 871 zcmV-t1DO1YP)Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01FZT01FZU(%pXi00007bV*G`2iXY} z05||V5%~oG00QSpL_t(Y$L*EdOH@%5#((R~IO9xIP|i4}l@@fhD22-IQQ35XZWdv^ zRP+)-{Rh4FClo%W4^d6hONj-MSyrZoT`3bZx@(z^(_GHpz3dZ{%m{|jOA8KX!}-qs zzP0vR--iG3uS5O-r^i!3InV~gfqK9LSYz2>G;lG{2s8mNfq8%raE~GLQR9Ls$0{HQ z1c1pV3mJvvw{O`%0pJ}l0F(khfJE7n1>Tb4qLY?L)x|3fO92~D&QJUIg!{DCL$<9> zN3J&30jX>ysx+l&H6oJR!|Ot`OQyG2BGvt02actkha*yKTb&V+86t8V$OT-P2tEO| zX1xV?o*&Hf`hB^VL}cds51$X-yw&nDld8V{Z|4ClOXe5?w>tx_&~#2Ia0s}yth}^Z zM3yF#soFdD+Isfx++5>wxx!lO*B?H835SAtHNfoVmiA@Az!XGef~kO&DFYuc-yCoU z5chgLRRDv7L)QV-aHILKQmR8l76Jo`$-0#cX1~43pMSv8btqeW9+^iouZK$=50!#}9 zCW3^N(rq1`FOJ$uJ+&-r(T?!?nhk50m$+Q6eM+hJrn`?KKoYPsW#AAr8x=P23MijH zch=rZ^$it{AHDACSq->XSCq{QnGLiN=1v>Dq*I=B=dCvzy#T6=_e@MPHUV+~Zx%4jh}Gm4h*#R^rip+002ovPDHLkV1iV!f_ne} diff --git a/bitmaps/RSendLine.bmp b/bitmaps/RSendLine.bmp deleted file mode 100644 index 6832ac4ff0f34109260ffc03d2549841396d2a86..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 702 zcmb7>u};G<5QYmYvQ&dy$wC=CL?TP&bVwxz1`in`Q7IEVM=~*WWsjGQO_5ZA}Jn9Ya$E8O2)jWHx(J8b{ABpuhe zSCZDe;*$Q&NLsQ^IB}k-xD#ezG(V+|_~r!bMtty(NYB}t$ssP!JFFdfbN;^n>t zPrjo$k@O?kCpbaPI{{3#D;!k!DR502fo#q82{L^?t#;VLgb2Q>p~J5Y>MWKG^L6}l h!}_AncN-`CYPx#24YJ`L;(K){{a7>y{D4^000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2iXY} z05Bbw&L7kO00T8iL_t(Y$K_Q`Y#T)s{@$#2*WUOi_Sz2QuPy}zsS*?sIOTxo0m(hI z2!w=WsS?OsI3X@nT#-yw#GwZc_!`cf$^nE#B~*mus72*Zgc2ttO;rEvy7umR*E=&D z+*TF}%_@NtbDa0h_q~~U?|Z<1yy&O|%hlD(0FD8;*r->o{i_1cy|w!JBj(h(`I#)% ze%awd$m5NA<>g zaieKt<Y87R5T|+S90Dzto zAeBr2kg4VBssZ3qCKZS4bL5g5{@CuKZ96`IYE%L4`6DQ7+~^7;41@4~?A=UCH%oI_ za{Um7rr_H34R9{rXw)krszApXc+fRvTrx2R$MFEb0`Sb@Yz_;LngD?2P6zIA1OQj} zBidI$O8Lp1R#zHvb=)ipgX8&-Qf@FtOS-DUb^;I)!jMBz*xg3GvJ+VVz{Q~-h@L$_ z%Fr<40%}YJ5iJNI*P6Gx&{c+B-^1EZ+u&TB`A19HZ_{4?nomD*dgM6ni!()&hCv8b zAy`%~Idq(xOiw)a`({hKwbhbB$jgm-<VJe-0%7AvO1Iy|;=IneC zzzTq^M!oXu!#Eyp*HT(N`)(mKJ&k}1Wb;{ct)9`SS6l#JMlr^N-1Jfyh6p*wC=`&A z04Zt0GLAknOXb>+3Bx#P77K9teb`;g+qm+c5mg|{Jb1zLyv^3Yt;7v_dwumF(wUk`#X9y$$?{a+vG#&7q|@~q`r z(=~?OhS|E=y4|`xhHFgMnx32__t!6A z+*gfIbBObPJ-V;%*B{~}RSlY5AUo0QnnQ$}L1BpOXBZpB?^FzD?D4e+8ejZQ*P_11 aVTaeE1i)z{(2L*hy)AagZx`tGza9W(=x(t9 diff --git a/bitmaps/RSendParagraph.png b/bitmaps/RSendParagraph.png deleted file mode 100644 index 1c1ddf0e8dad68b01053e13b3d0728421943adb0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 390 zcmeAS@N?(olHy`uVBq!ia0vp^5+KaM1|%Pp+x`GjjKx9jP7LeL$-D$|*pj^6T^Rm@ z;DWu&Cj&(|3p^r=85p>QL70(Y)*O%l>?NMQuIx9tczI=ojZ9~*0-D0+>EamTar|xQ zL9fFO0=3pRV{grPuvPBu^Do?&y8kjqbJevfumv88uD-bYf%?+~{-93Jn9bJns;s!`{)v9F_@ZZR_cqf%{r>-i z#Vns6IFpbjAh>4hSC%e|{Bj?2#_zi`*r&}6diC+!yR-`@7K%U0eEZ`2@8g@wuUN;} z=>O3<|Cc}c&nBJP?AQl$c;`H3P7^nB=2X1bDxfL2)aA>w$~dj5XSRezO0;B7Qqe#C gG@G&Eb{WTf@7$!XPk(o_0t1P`)78&qol`;+0Kk!=D*ylh diff --git a/bitmaps/RSendSelection.bmp b/bitmaps/RSendSelection.bmp deleted file mode 100644 index f20db182f11a1c323f70e5692c0971e4f113beeb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 702 zcmZ?r-N(cL24+A~1Biv7n2|vMEZzZ>7v_dwumF(wUk`#X9y$$?{a+vG#&7q|@~q`r z(=~?OhS|Cx*kicHbgk)G%XhX0P9SyfY-bnmEyoV$6!Y6b)a)&vQ;Z5{7tb!P&ackj zTmIe_re<$>RQC5c1pF3vEy^+-UCkV@K9F7n1i1m(9FTnoSr7|kJF=R))%U84{erv@ zu-Ffz3t7!QpqeQ`#eN7lB?wc^|9W!N+^YtK8N$u?s{hxcy9ZMZNEHJ9tB0sSHK#iN zdz?fv41z+lD*rCfHe|c@mhVA>d&@y)A*%uT9uvaU@H>4&iYY{#fmq+-1i)z{(2L*h Oy)AagZx`tGza9WO+F^14 diff --git a/bitmaps/RSendSelection.png b/bitmaps/RSendSelection.png deleted file mode 100644 index fb7db34dea9c3ec52aea23719dcb700a45787ca5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 502 zcmVPx#24YJ`L;(K){{a7>y{D4^000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2iXY~ z023XN+YitH00DMML_t(Y$F-HuO2a@9#%DIkR$`0vR*&{^N>AnzvDjA-!AB5^#iIBG z^`g+D;3M^54^m10#bm}qx@elj?$&f55O%ZkoA2A%EWn-v)yv?%{~U&)Uq(_X<;&IO z^;v4LcYDKSMgOkHDzCjsU#*rqSI*2(sT`!n>@qB2W?%*Y;LKbhU^sj-f^<6Pz-$2M zb}uxl{&|Sl46r?MV#y}R2%u||@B6y}^i|P*0m^@EK;DOX3Sc|nuMI0j0TBT+7y_tJ zd7*+Jm>C1KPO?%Ur3BCOHhMjKz?d20I07LoJ%Cyy1g;a}dLgG0AmZ8*p z8X0v`yWP^=gQODAJI%EusTh7$uI3CCP5Syo^> s_FPJ5UaQuE@p$|(oqjHJ`?l=(1`J7`od&dr1ONa407*qoM6N<$f&?koH2?qr diff --git a/bitmaps/RStart.bmp b/bitmaps/RStart.bmp deleted file mode 100644 index 026c70f3a78d7eaabac5ff18dde20c73a3517bf8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 702 zcmZ?r-N(cL24+A~1Biv7n2|vMEZzZ>7v_dwumF(wUr!8_N*1zPXV|AJ=!8&hnSQ~v z*KnPwpwrbTkm$`QGpBN|8A0m}5o$IXn%V6P3U$lVgoxb=i*O5fyN#q~yPv3CrQ2>l z5xZ$Y5H&ZWBHhI7W_cmZDfJ3>igYrw`)paA4^tE2W@a_Z52ogN*k?-%CkrQ2C(Cr0 z?I3eR?Pf#GnUi1UXJ%(+7w$C8Pa+wvCal6u)arInzwT0rmlDQqUoB^OT{5(R%Y)S2 z3LxIJK>pf@6o$8hE}N?IW=JZsOaX@w zP>q)u)bHP;rUVJt_2@pAN#bx9)RxN-)l}VE4suT<(45^teVRdj-=ZwyMT0-PU9?)S z*Q=HbgdLKasvtEHZX!UxPxs5!4DqT;uZRu{HuW~P|7dnz?}A>sprPCU`dd*IULsba zcGLZK1?>m}+U3+^$f1}b;34@zPe)A)9IF<|wfXb%=jPAJugR~?o(p8nE1sJ@-7iCQ br7Q!()-ag=G3k5N?=5=_=M>+o{$CFOA@WA( diff --git a/bitmaps/RStart.png b/bitmaps/RStart.png deleted file mode 100644 index 524aaabade86c62ef163265438a15dcbdd7e8906..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1050 zcmV+#1m*jQP)Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2igc6 z0}?TQqWHf600WvyL_t(Y$K8}aXd71?$3GXY@EbI|!NU!vXz-xH6b&6jFt(wlF-11T zcqo|+>EI!Q2UFq(Ozk$N&{8s$4lXSOOem(9s)JHA*dT%^N)glv3aF`QjC5_?^u<0q z&-S^m!%4CwTkevnUpVglxqILD{e8dh!ApR()&h2EX~{OhONPCk`^*9suq!JoEdsaM z$p2WhO2r!^2ExW{>n-4#=;JVY>A+x&FmkyUfNS?|@#U49l*?t#5cs~ZUMS)FRX|W8 z#N!HFg)xR#d!A9N)u`9&)a!L>wOXs+#NP1%*Y4e7@ybmynT$=R(>Tq^)$fY7Ts3H2 zMfJo<^(UxSOJs9dj5d7o`3%94;rUU3KHNhe2B)4qUL3z*@A#lacK5ACHa0d+6hshk z6`u0&wPtN?jp0-rfTzDbCE$Ra<9(hV@3ZsIi?((rMrW@wG&Iyn5Y^v=2D5EYJ;LmJ zvkt(+Umx2)cK_li2-(>WI0ypt?lXSh-R95W@3s{VA8qsCPVTG%!9->@5uP-E`T6m= z9@J_zeBbAducq1eb!+iVCd1(1U^{_n*e)&@(Py zs#p6~N@gh!gKUrBosn<%*{G)28jJ zKrnbp;dz2ccNI~o6na|&2G8^GdKD@r6pH2U3QTB_m>{mf1R8Sz!Mj&SoXBhqXjDv) zn6RENoF7va1HE0s-_n!{5lJ%Pv3fxSr`}1C%@ru*P8N-Oiq&sd?c~Iy!~X*R0;b2* U0jSeUJOBUy07*qoM6N<$g4aOgCjbBd diff --git a/bitmaps/ricon.png b/bitmaps/ricon.png deleted file mode 100644 index a91dda55896f112b85c11abb68e633fa97fd49ee..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 904 zcmV;319$w1P)Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2iXP< z5eP1gB!s#E00Rg~L_t(Y$JLfGXdFirhChcbUa`e1t{8}lEfiRgiUq6KAO{4BK|ur} zu1QD}Fabdb2u#2sO^OsLT?S%_6}S|NUogU0q#W@doQH-f%_JhvVN*P)#N?4)tVpHVQ=EY_6NZ z#*VvSW^_MTnG0}hO3}fyQ$}S)Rh59CA|#1Iq_{g0f!BgWj*Y?0n)z7JH~zyU!-&`v_Wno^cS`u!)kIgTR;qDr!qk}Ri~J3e-7Y*0JBr#)7_{-O;4Kp;|r z1}Zapy&fBRa%~;ljlrN#ww9x@H1oAkURb*ZuXf_KIqB)=1Tv_Xqag1XjS9?bU7irRH5HFSy~G&$5i94-RzNm%#{Y+h0UbaysM zmR{*pnl46X#>pS2?HveCP$dLGWN{Wrtk|UiP6&apq-ZP@FGlShc->qe5;;D$Cd69m z-Y1(Au?;XZ79 is '\' by default. The plugin is a |file-type| plugin. It will be active only if you are editing -a .R, .Rnw, .Rd, Rmd, or Rrst file. The menu items and tool bar buttons will -not be visible and the key bindings will not be active while editing either -unnamed files or files with name extensions other than the mentioned above. If -the plugin is active, pressing rf should start R. +a .R, .Rnw, .Rd, Rmd, or Rrst file. The menu items will not be visible and the +key bindings will not be active while editing either unnamed files or files +with name extensions other than the mentioned above. If the plugin is active, +pressing rf should start R. Look at the ~/.vim (Linux, Unix, OS X) or ~/vimfiles (Windows) directory. Is there a subdirectory named "r-plugin"? If not, then you unpacked the plugin in @@ -287,17 +287,7 @@ Please, read the section |r-plugin-options|. Emacs/ESS users should read the section Indenting setup (|r-plugin-indenting|) of this document. -3.4.2 Hide unused buttons~ - -Edit GVim's toolbar and remove the buttons that you never use. The plugin adds -some buttons to the toolbar, but you may not see them because GVim has too -many buttons by default. Please see the page below to know how to hide buttons -on the toolbar: - - http://vim.wikia.com/wiki/Hide_toolbar_or_menus_to_see_more_text - - -3.4.3 Install additional plugins~ +3.4.2 Install additional plugins~ You may be interested in installing additional general plugins to get functionality not provided by this file type plugin. ShowMarks and snipMate @@ -306,6 +296,11 @@ edit Rnoweb files, you may want to try LaTeX-Box for omnicompletion of LaTeX code (see |r-plugin-latex-box| for details). +3.4.3 Add buttons to GVim~ + +Please read |r-plugin-toolbar| if you want to add R buttons to GVim's tool +bar. + ============================================================================== *r-plugin-use* 4. Use~ @@ -323,9 +318,9 @@ To use the plugin, open a .R or .Rnw or .Rd file with Vim and type commands to R. This plugin has many key bindings, which correspond with menu entries and, in -some cases, toolbar buttons. In the list below, the backslash represents the -. Not all menu items and key bindings are enabled in all -filetypes supported by the plugin (r, rnoweb, rhelp): +some cases. In the list below, the backslash represents the . Not +all menu items and key bindings are enabled in all filetypes supported by the +plugin (r, rnoweb, rhelp): Start/Close . Start R (default) \rf @@ -1309,16 +1304,18 @@ If you want to pass arguments do the `Sweave()` function, set the value of the vimrplugin_sweaveargs variable. -6.20. Never unmake the R menu and tool bar buttons~ +6.20. Never unmake the R menu~ *vimrplugin_never_unmake_menu* -Use this option if you want that the menu item R and the R related tool bar -buttons are not deleted when you change from one buffer to another, for -example, when going from an .R file to a .txt one: +Use this option if you want that the menu item R is not deleted when you +change from one buffer to another, for example, when going from an .R file to +a .txt one: > let vimrplugin_never_unmake_menu = 1 < -When this options is enabled all menu items are created regardless of the file -type. +When this option is enabled all menu items are created regardless of the file +type. If you have added R related tool bar buttons (see |r-plugin-toolbar|) +the buttons also are created at the plugin startup and kept while you go to +different file type buffers. 6.21. Map 'r'~ @@ -2182,7 +2179,19 @@ discover this information manually: * pywin32: http://sourceforge.net/projects/pywin32/ -9.23. Integration with GNU Screen, screen plugin, Conque Shell or VimShell~ +9.23. Add tool bar icons and hide unused buttons~ + *r-plugin-toolbar* +If you want to add some R buttons to GVim tool bar download the zip file +http://www.lepem.ufc.br/jaa/bitmaps.zip and unpack it at either ~/.vim +(Unix/Linux/Mac OS X) or ~/vimfiles (Windows). You may not see the buttons +because GVim has too many buttons by default. Then, you may want to edit +GVim's toolbar and remove the buttons that you never use. Please see the page +below to know how to hide buttons on the toolbar: + + http://vim.wikia.com/wiki/Hide_toolbar_or_menus_to_see_more_text + + +9.24. Integration with GNU Screen, screen plugin, Conque Shell or VimShell~ The plugin used to be able to use GNU Screen (through screen plugin), Conque Shell or VimShell to send commands to R. This integration was removed on diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 45a4014..7893af0 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -2802,47 +2802,51 @@ function MakeRMenu() "---------------------------------------------------------------------------- " ToolBar "---------------------------------------------------------------------------- - " Buttons - amenu ToolBar.RStart :call StartR("R") - amenu ToolBar.RClose :call RQuit('no') - "--------------------------- - if &filetype == "r" || g:vimrplugin_never_unmake_menu - nmenu ToolBar.RSendFile :call SendFileToR("echo") - imenu ToolBar.RSendFile :call SendFileToR("echo") - let g:rplugin_hasRSFbutton = 1 - endif - nmenu ToolBar.RSendBlock :call SendMBlockToR("echo", "down") - imenu ToolBar.RSendBlock :call SendMBlockToR("echo", "down") - nmenu ToolBar.RSendFunction :call SendFunctionToR("echo", "down") - imenu ToolBar.RSendFunction :call SendFunctionToR("echo", "down") - vmenu ToolBar.RSendSelection :call SendSelectionToR("echo", "down") - nmenu ToolBar.RSendParagraph :call SendParagraphToR("echo", "down") - imenu ToolBar.RSendParagraph :call SendParagraphToR("echo", "down") - nmenu ToolBar.RSendLine :call SendLineToR("down") - imenu ToolBar.RSendLine :call SendLineToR("down") - "--------------------------- - nmenu ToolBar.RListSpace :call g:SendCmdToR("ls()") - imenu ToolBar.RListSpace :call g:SendCmdToR("ls()") - nmenu ToolBar.RClear :call RClearConsole() - imenu ToolBar.RClear :call RClearConsole() - nmenu ToolBar.RClearAll :call RClearAll() - imenu ToolBar.RClearAll :call RClearAll() - - " Hints - tmenu ToolBar.RStart Start R (default) - tmenu ToolBar.RClose Close R (no save) - if &filetype == "r" || g:vimrplugin_never_unmake_menu - tmenu ToolBar.RSendFile Send file (echo) + if g:rplugin_has_icons + " Buttons + amenu ToolBar.RStart :call StartR("R") + amenu ToolBar.RClose :call RQuit('no') + "--------------------------- + if &filetype == "r" || g:vimrplugin_never_unmake_menu + nmenu ToolBar.RSendFile :call SendFileToR("echo") + imenu ToolBar.RSendFile :call SendFileToR("echo") + let g:rplugin_hasRSFbutton = 1 + endif + nmenu ToolBar.RSendBlock :call SendMBlockToR("echo", "down") + imenu ToolBar.RSendBlock :call SendMBlockToR("echo", "down") + nmenu ToolBar.RSendFunction :call SendFunctionToR("echo", "down") + imenu ToolBar.RSendFunction :call SendFunctionToR("echo", "down") + vmenu ToolBar.RSendSelection :call SendSelectionToR("echo", "down") + nmenu ToolBar.RSendParagraph :call SendParagraphToR("echo", "down") + imenu ToolBar.RSendParagraph :call SendParagraphToR("echo", "down") + nmenu ToolBar.RSendLine :call SendLineToR("down") + imenu ToolBar.RSendLine :call SendLineToR("down") + "--------------------------- + nmenu ToolBar.RListSpace :call g:SendCmdToR("ls()") + imenu ToolBar.RListSpace :call g:SendCmdToR("ls()") + nmenu ToolBar.RClear :call RClearConsole() + imenu ToolBar.RClear :call RClearConsole() + nmenu ToolBar.RClearAll :call RClearAll() + imenu ToolBar.RClearAll :call RClearAll() + + " Hints + tmenu ToolBar.RStart Start R (default) + tmenu ToolBar.RClose Close R (no save) + if &filetype == "r" || g:vimrplugin_never_unmake_menu + tmenu ToolBar.RSendFile Send file (echo) + endif + tmenu ToolBar.RSendBlock Send block (cur, echo and down) + tmenu ToolBar.RSendFunction Send function (cur, echo and down) + tmenu ToolBar.RSendSelection Send selection (cur, echo and down) + tmenu ToolBar.RSendParagraph Send paragraph (cur, echo and down) + tmenu ToolBar.RSendLine Send line (cur and down) + tmenu ToolBar.RListSpace List objects + tmenu ToolBar.RClear Clear the console screen + tmenu ToolBar.RClearAll Remove objects from workspace and clear the console screen + let g:rplugin_hasbuttons = 1 + else + let g:rplugin_hasbuttons = 0 endif - tmenu ToolBar.RSendBlock Send block (cur, echo and down) - tmenu ToolBar.RSendFunction Send function (cur, echo and down) - tmenu ToolBar.RSendSelection Send selection (cur, echo and down) - tmenu ToolBar.RSendParagraph Send paragraph (cur, echo and down) - tmenu ToolBar.RSendLine Send line (cur and down) - tmenu ToolBar.RListSpace List objects - tmenu ToolBar.RClear Clear the console screen - tmenu ToolBar.RClearAll Remove objects from workspace and clear the console screen - let g:rplugin_hasbuttons = 1 endfunction function UnMakeRMenu() @@ -3516,6 +3520,17 @@ let g:rplugin_libls = split(g:vimrplugin_permanent_libs, ",") let g:rplugin_liblist = [] let s:list_of_objs = [] +" Check whether tool bar icons exist +let g:rplugin_has_icons = 0 +if has("win32") || has("win64") + if filereadable(g:rplugin_uservimfiles . "/bitmaps/RStart.bmp") + let g:rplugin_has_icons = 1 + endif +else + if filereadable(g:rplugin_uservimfiles . "/bitmaps/RStart.png") + let g:rplugin_has_icons = 1 + endif +endif " Compatibility with old versions (August 2013): if exists("g:vimrplugin_tmux") From bb335b7569207d4a9fd5b1ede7be90fc26e8ef1c Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Wed, 6 Nov 2013 17:13:40 -0300 Subject: [PATCH 0516/1050] Use Vimball to distribute the plugin. --- Makefile | 18 +++++--- doc/r-plugin.txt | 105 +++++++++++++++++++++-------------------------- list_for_vimball | 30 ++++++++++++++ 3 files changed, 88 insertions(+), 65 deletions(-) create mode 100644 list_for_vimball diff --git a/Makefile b/Makefile index 86241c6..f36f9ec 100644 --- a/Makefile +++ b/Makefile @@ -22,11 +22,19 @@ PLUGINHOME=`pwd` -PLUGINVERSION=0.9.9.7 +PLUGINVERSION=0.9.9.8 DEBIANTIME=`date -R` PLUGINRELEASEDATE=`date +"%Y-%m-%d"` VIM2HTML=/usr/local/share/vim/vim74/doc/vim2html.pl + +vimball: + # Update the version date in doc/r-plugin.txt header and in the news + sed -i -e "s/^Version: [0-9].[0-9].[0-9].[0-9]/Version: $(PLUGINVERSION)/" doc/r-plugin.txt + sed -i -e "s/vim-r-plugin_[0-9].[0-9].[0-9].[0-9].vmb/vim-r-plugin_$(PLUGINVERSION).vmb/" doc/r-plugin.txt + sed -i -e "s/^$(PLUGINVERSION) (201[0-9]-[0-9][0-9]-[0-9][0-9])$$/$(PLUGINVERSION) ($(PLUGINRELEASEDATE))/" doc/r-plugin.txt + vim -c "%MkVimball vim-r-plugin_$(PLUGINVERSION) ." -c "q" list_for_vimball + mv vim-r-plugin_$(PLUGINVERSION).vmb /tmp zip: # Clean previously created files (cd /tmp ;\ @@ -126,13 +134,11 @@ deb: for the terms of the latest version\n\ of the GNU General Public License.\n\ " > /tmp/vim-r-plugin-tmp/usr/share/doc/vim-r-plugin/copyright - unzip /tmp/vim-r-plugin-$(PLUGINVERSION).zip -d /tmp/vim-r-plugin-tmp/usr/share/vim/addons - # Delete the files unnecessary in a Debian system + # Unpack the plugin + vim -c 'let g:vimball_home="/tmp/vim-r-plugin-tmp/usr/share/vim/addons"' -c "so %" -c "q" /tmp/vim-r-plugin_$(PLUGINVERSION).vmb + # Delete file unnecessary in a Debian system (cd /tmp/vim-r-plugin-tmp/usr/share/vim/addons ;\ rm r-plugin/windows.py ) - # Add a comment to r-plugin.txt - (cd /tmp/vim-r-plugin-tmp/usr/share/vim/addons ;\ - sed -e 's/3.2.1. Unix (Linux, OS X, etc.)./3.2.1. Unix (Linux, OS X, etc.)~\n\nNote: If the plugin was installed from the Debian package, then the\ninstallation is finished and you should now read sections 3.3 and 3.4./' -i doc/r-plugin.txt ) # Create the DEBIAN directory ( cd /tmp/vim-r-plugin-tmp ;\ mkdir DEBIAN ;\ diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 6d51674..19d0dc1 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -5,7 +5,7 @@ Authors: Jakson A. Aquino Jose Claudio Faria -Version: 0.9.9.7 +Version: 0.9.9.8 For Vim version 7.4 1. Overview |r-plugin-overview| @@ -90,14 +90,16 @@ For screenshots see: http://www.lepem.ufc.br/jaa/vim-r-plugin.html *r-plugin-installation* 3. Installation~ -The installation instructions are split in four sections: (1) general -instructions for all operating systems; (2) instructions that are specific for -either Unix/Linux/OSX or Windows; (3) troubleshooting; and (4) optional steps. +The installation instructions are split in four sections: -3.1. General instructions I~ + 1. Instructions specific for Unix/Linux/OSX + 2. Instructions specific for Windows + 3. Troubleshooting + 4. Optional steps -Note: Most of the plugin commands require that you type the -which is '\' by default. +3.1. Instructions for Unix (Linux, OS X, etc.)~ + +If you are using Windows, jump to section 3.2. You need to activate plugins and indentation according to 'filetype'. You should have at least the following options in your |vimrc|: @@ -110,21 +112,17 @@ should have at least the following options in your |vimrc|: Make a backup of your ~/.vim directory because existing files will be replaced. Please, look at |r-plugin-files| to see the list of files. -3.2. Operating system specific instructions~ - -3.2.1. Unix (Linux, OS X, etc.)~ - -Uncompress the archive: +Start a terminal emulator, go to the directory where you have downloaded the +plugin and type: > - unzip vim-r-plugin-*.zip -d ~/.vim + vim vim-r-plugin_0.9.9.8.vmb < -Start Vim and build the tags file for this document (and others that eventually -are in the same directory): +Then, in Vim, type: > - :helptags ~/.vim/doc + :so % < -In addition to having R and Vim installed in your system, this plugin has the -following dependencies: +The plugin is installed, but in addition to having R and Vim installed in your +system, this plugin has the following dependencies: Depends:~ @@ -193,10 +191,22 @@ vimrplugin_applescript = 0. Some users have reported more luck with iTerm than with the default Mac OS X terminal emulator. -3.2.2. Windows~ +3.2. Instructions for Windows ~ -In addition to having R installed in your system, this plugin requires users -to install external dependencies: +Open the directory where you have downloaded the file +`vim-r-plugin_0.9.9.8.vmb`, right click on it and choose "Edit with Vim". +> +Then, in Vim, type: +> + :so % +< +Press and the plugin will be installed (because the plugin has many +files, you have to press the space bar a few times to finish the +installation). You can, then, can quit Vim. However in addition to having R +and Vim installed in your system, this plugin requires users to install +external dependencies: + + * R's version must be >= 3.0.0. * Vim's version must be >= 7.4 @@ -212,41 +222,18 @@ to install external dependencies: versions. Please, read |r-plugin-python| if want to use different versions. - * vimcom.plus = 0.9-92: http://www.lepem.ufc.br/jaa/vimcom.plus.html - The vimcom.plus (or vimcom) package creates a server on R to allow the - communication with Vim. The package is not used to send commands from - Vim to R Console, but it is necessary to open R documentation in Vim's - buffer, run the Object Browser, run either `Sweave()` or `knit()` on the - document being edited. It also has some functions called by Vim such as - `vim.plot()`, `vim.print()`, and `vim.bol()`. This last one is required - to build the data base used in omnicompletion. The vimcom.plus package creates a server on R to allow the communication - with Vim. You certainly will want to put the following lines at the end - of your Rprofile. + with Vim and it must be loaded to Vim-R-plugin to work properly. Instead + of loading it manually with the command `library(vimcom.plus)` each time + that R is started, you should start it at your Rprofile. You can do + `Sys.getenv("HOME")` in the R Console to know where the file should be + created, but usually it is at ~/Documents/.Rprofile. Put the following + lines at the end of your Rprofile. > - if(interactive()){ - library(vimcom.plus) - # If you cannot install vimcom.plus, do: - # library(vimcom) - } -< - You can do `Sys.getenv("HOME")` in the R Console to know where the file - should be, but usually it is at ~/Documents/.Rprofile. - -Create your |vimfiles| directory if you do not have it yet. Its path will be -similar to one of the following: -> - C:\Documents and Settings\yourlogin\vimfiles - C:\Users\yourlogin\vimfiles -< -Uncompress the archive. Right click on the plugin's zip file and choose -"Extract all". Then choose ~/vimfiles as the destination directory. - -Start Vim and build the tags file for this document (and others that eventually -are in the same directory): -> - :helptags ~\vimfiles\doc + library(vimcom.plus) + # If you cannot install vimcom.plus, do: + # library(vimcom) < Start editing an R file with GVim and try to send some lines to R Console. You may have to adjust the value of |vimrplugin_sleeptime|. @@ -262,10 +249,6 @@ key bindings will not be active while editing either unnamed files or files with name extensions other than the mentioned above. If the plugin is active, pressing rf should start R. -Look at the ~/.vim (Linux, Unix, OS X) or ~/vimfiles (Windows) directory. Is -there a subdirectory named "r-plugin"? If not, then you unpacked the plugin in -the wrong place. - Did you see warning messages but they disappeared before you have had time to read them? Type the command |:messages| in Normal mode to see them again. @@ -279,7 +262,7 @@ running, the vimcom.plus (or vimcom) package is not installed, or R was not started by Vim. -3.4. General instructions II (optional steps)~ +3.4. Optional steps~ 3.4.1 Customize the plugin~ @@ -301,6 +284,7 @@ code (see |r-plugin-latex-box| for details). Please read |r-plugin-toolbar| if you want to add R buttons to GVim's tool bar. + ============================================================================== *r-plugin-use* 4. Use~ @@ -2204,7 +2188,7 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details. *r-plugin-news* 10. News~ -0.9.9.8 (2013-11-05) +0.9.9.8 (2013-11-06) * The list of objects for omnicompletion and the list of functions for syntax highlight now are built dynamically. Deprecated commands and options: @@ -2213,6 +2197,9 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details. * New option: vimrplugin_show_args. + * Remove toolbar icons (they still may be added back manually by interested + users). + 0.9.9.7 (2013-11-06) * Minor bug fixes. diff --git a/list_for_vimball b/list_for_vimball new file mode 100644 index 0000000..275d349 --- /dev/null +++ b/list_for_vimball @@ -0,0 +1,30 @@ +ftdetect/r.vim +indent/r.vim +indent/rmd.vim +indent/rrst.vim +indent/rnoweb.vim +indent/rhelp.vim +autoload/rcomplete.vim +ftplugin/r.vim +ftplugin/rbrowser.vim +ftplugin/rdoc.vim +ftplugin/rhelp.vim +ftplugin/rmd.vim +ftplugin/rrst.vim +ftplugin/rnoweb.vim +syntax/rout.vim +syntax/r.vim +syntax/rhelp.vim +syntax/rmd.vim +syntax/rrst.vim +syntax/rdoc.vim +syntax/rbrowser.vim +doc/r-plugin.txt +r-plugin/vimcom.py +r-plugin/global_r_plugin.vim +r-plugin/windows.py +r-plugin/objlist/README +r-plugin/tex_indent.vim +r-plugin/r.snippets +r-plugin/common_buffer.vim +r-plugin/common_global.vim From c60b2dba36416ee28edff818fc6155bb1a36bfad Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Wed, 6 Nov 2013 17:15:38 -0300 Subject: [PATCH 0517/1050] Delete zip rule for distributing the plugin. --- Makefile | 27 --------------------------- 1 file changed, 27 deletions(-) diff --git a/Makefile b/Makefile index f36f9ec..5bf40e5 100644 --- a/Makefile +++ b/Makefile @@ -35,33 +35,6 @@ vimball: sed -i -e "s/^$(PLUGINVERSION) (201[0-9]-[0-9][0-9]-[0-9][0-9])$$/$(PLUGINVERSION) ($(PLUGINRELEASEDATE))/" doc/r-plugin.txt vim -c "%MkVimball vim-r-plugin_$(PLUGINVERSION) ." -c "q" list_for_vimball mv vim-r-plugin_$(PLUGINVERSION).vmb /tmp -zip: - # Clean previously created files - (cd /tmp ;\ - rm -rf vim-r-plugin-tmp/usr/share/vim/addons ;\ - mkdir -p vim-r-plugin-tmp/usr/share/vim/addons ) - rm -f /tmp/vim-r-plugin-$(PLUGINVERSION).zip - # Update the version date in doc/r-plugin.txt header and in the news - sed -i -e "s/^Version: [0-9].[0-9].[0-9].[0-9]/Version: $(PLUGINVERSION)/" doc/r-plugin.txt - sed -i -e "s/^$(PLUGINVERSION) (201[0-9]-[0-9][0-9]-[0-9][0-9])$$/$(PLUGINVERSION) ($(PLUGINRELEASEDATE))/" doc/r-plugin.txt - # Create a tar.gz file - tar -cvzf /tmp/vimrplugintmpfile.tar.gz ftdetect/r.vim indent/r.vim indent/rmd.vim \ - indent/rrst.vim indent/rnoweb.vim indent/rhelp.vim autoload/rcomplete.vim ftplugin/r*.vim \ - syntax/rout.vim syntax/r.vim syntax/rhelp.vim syntax/rmd.vim \ - syntax/rrst.vim syntax/rdoc.vim syntax/rbrowser.vim \ - doc/r-plugin.txt r-plugin/vimcom.py \ - r-plugin/global_r_plugin.vim r-plugin/windows.py \ - r-plugin/objlist/README \ - r-plugin/tex_indent.vim r-plugin/r.snippets \ - r-plugin/common_buffer.vim r-plugin/common_global.vim - # Unpack the tar.gz and create the zip file - (cd /tmp ;\ - tar -xvzf vimrplugintmpfile.tar.gz -C vim-r-plugin-tmp/usr/share/vim/addons > /dev/null ;\ - rm vimrplugintmpfile.tar.gz ) - (cd /tmp/vim-r-plugin-tmp/usr/share/vim/addons ;\ - chmod +w r-plugin/tex_indent.vim ;\ - rm -f /tmp/vim-r-plugin-$(PLUGINVERSION).zip ;\ - zip -r /tmp/vim-r-plugin-$(PLUGINVERSION).zip . ) deb: # Clean previously created files From 41027887a78ff0887f7a63830aa2dfbfdeaa45ef Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 7 Nov 2013 00:03:39 -0300 Subject: [PATCH 0518/1050] Find bitmaps anywhere in the runtime path. --- r-plugin/common_global.vim | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 7893af0..4bc6ca6 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -3521,15 +3521,10 @@ let g:rplugin_liblist = [] let s:list_of_objs = [] " Check whether tool bar icons exist -let g:rplugin_has_icons = 0 if has("win32") || has("win64") - if filereadable(g:rplugin_uservimfiles . "/bitmaps/RStart.bmp") - let g:rplugin_has_icons = 1 - endif + let g:rplugin_has_icons = len(globpath(&rtp, "bitmaps/RStart.bmp")) > 0 else - if filereadable(g:rplugin_uservimfiles . "/bitmaps/RStart.png") - let g:rplugin_has_icons = 1 - endif + let g:rplugin_has_icons = len(globpath(&rtp, "bitmaps/RStart.png")) > 0 endif " Compatibility with old versions (August 2013): From 267b4c7fa419cb4e6dba460d00749a91ca315c43 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 7 Nov 2013 00:05:47 -0300 Subject: [PATCH 0519/1050] Recommend the use of tvim. --- doc/r-plugin.txt | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 19d0dc1..095f10c 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -180,11 +180,12 @@ system, this plugin has the following dependencies: If you start either GVim or Vim in a terminal emulator the plugin will start R in a external terminal emulator. If you start Vim inside of a Tmux session, the plugin will split the Tmux window in two and start R in the other pane. -Please, read the section |r-plugin-tmux|, especially the tip |r-plugin-tvim|. -If you don't want to read this entire document to find a few suggestions of -configuration of ~/.bashrc, ~/.tmux.conf and ~/.Rprofile, jump to -|r-plugin-quick-setup|. +The recommended way of running the plugin on Linux is through the custom Bash +function `tvim`. Please, read the section |r-plugin-tmux|, especially the tip +|r-plugin-tvim|. If you don't want to read this entire document to find a few +suggestions of configuration of ~/.bashrc, ~/.tmux.conf and ~/.Rprofile, jump +to |r-plugin-quick-setup|. Note: On Mac OS X the plugin will use AppleScript in both Vim and GVim unless vimrplugin_applescript = 0. Some users have reported more luck with iTerm than From 231fa8c54db509991c8fe68e92718ba3bfbab5d3 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 7 Nov 2013 08:51:03 -0300 Subject: [PATCH 0520/1050] Improvements. --- doc/r-plugin.txt | 51 +++++++++++++++++++++++++++--------------------- 1 file changed, 29 insertions(+), 22 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 095f10c..97ded58 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -181,15 +181,17 @@ If you start either GVim or Vim in a terminal emulator the plugin will start R in a external terminal emulator. If you start Vim inside of a Tmux session, the plugin will split the Tmux window in two and start R in the other pane. -The recommended way of running the plugin on Linux is through the custom Bash -function `tvim`. Please, read the section |r-plugin-tmux|, especially the tip -|r-plugin-tvim|. If you don't want to read this entire document to find a few -suggestions of configuration of ~/.bashrc, ~/.tmux.conf and ~/.Rprofile, jump -to |r-plugin-quick-setup|. +The recommended way of running the plugin on Linux is running Vim inside a +Tmux session. If you do not use Tmux frequently, it is recommended that you +create a custom Bash function. Please, read the section |r-plugin-tmux|, +especially the tip |r-plugin-tvim|. If you don't want to read this entire +document to find a few suggestions of configuration of ~/.bashrc, ~/.tmux.conf +and ~/.Rprofile, jump to |r-plugin-quick-setup|. -Note: On Mac OS X the plugin will use AppleScript in both Vim and GVim unless -vimrplugin_applescript = 0. Some users have reported more luck with iTerm than -with the default Mac OS X terminal emulator. +Note: On Mac OS X, in both Vim and GVim, the plugin will use AppleScript to +send commands to the R Console application unless vimrplugin_applescript = 0. +Some users have reported more luck with iTerm than with the default Mac OS X +terminal emulator. 3.2. Instructions for Windows ~ @@ -667,17 +669,10 @@ other for Tmux. Then, it's useful (but not required) to know some Tmux commands. After you finished editing the file, you have to type `exit` to quit the Tmux session. *r-plugin-tvim* -If you always prefer to run Tmux before running Vim you may want to put in -your ~/.bashrc: -> - if [ "x$DISPLAY" == "x" ] - then - function tvim(){ tmux new-session "vim $@" ; } - else - function tvim(){ tmux -2 new-session "TERM=screen-256color vim $@" ; } - fi -< -Then you will be able to start a Tmux session running Vim by typing: +If you always prefer to run Tmux before running Vim you could create a Bash +function called `tvim` (please, see the ~/.bashrc example at +|r-plugin-quick-setup|). Then you will be able to start a Tmux session running +Vim by typing: > tvim filename.R < @@ -2070,7 +2065,9 @@ this document from the beginning. ~/.bashrc:~ > - # Get 256 colors and automatic update of Object Browser: + # Change the TERM environment variable (to get 256 colors) and make Vim + # connecting to X Server even if running in a terminal emulator (to get + # dynamic update of syntax highlight and Object Browser): if [ "x$DISPLAY" != "x" ] then if [ "screen" = "$TERM" ] @@ -2110,18 +2107,27 @@ this document from the beginning. ~/.Rprofile~ > if(interactive()){ + # Get startup messages of three packages and set Vim as R pager: options(setwidth.verbose = 1, colorout.verbose = 1, vimcom.verbose = 1, pager = "vimrpager") + # Use either Vim or GVim as text editor for R: if(nchar(Sys.getenv("DISPLAY")) > 1) options(editor = 'gvim -f -c "set ft=r"') else options(editor = 'vim -c "set ft=r"') + # Load the colorout library: library(colorout) - if(Sys.getenv("TERM") != "linux" && Sys.getenv("TERM") != "") + if(Sys.getenv("TERM") != "linux" && Sys.getenv("TERM") != ""){ + # Choose the colors for R output among 256 options. + # You should run show256Colors() and help(setOutputColors256) to + # know how to change the colors according to your taste: setOutputColors256(verbose = FALSE) + } + # Load the setwidth library: library(setwidth) + # Load the vimcom.plus library only if R was started by Vim: if(Sys.getenv("VIMRPLUGIN_TMPDIR") != ""){ library(vimcom.plus) # If you can't install the vimcom.plus package, do: @@ -2132,7 +2138,8 @@ this document from the beginning. ~/bin/vimrpager~ > #!/bin/sh - + # I don't know the reason, but we can't pipe the output directly to Vim. So + # we need this script to use 'cat' is intermediary. cat | vim -c 'set ft=rdoc' - < NOTE: You have to change the `~/bin/vimrpager` permissions to make it From f90ccfee7cdd08a4b7b0a6c685faeab200726947 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 7 Nov 2013 19:52:43 -0300 Subject: [PATCH 0521/1050] New command :RpluginConfig. --- Makefile | 2 + doc/r-plugin.txt | 113 ++++++++++----- list_for_vimball | 2 + r-plugin/Rconfig.R | 52 +++++++ r-plugin/common_global.vim | 14 +- r-plugin/vimrconfig.vim | 278 +++++++++++++++++++++++++++++++++++++ 6 files changed, 421 insertions(+), 40 deletions(-) create mode 100644 r-plugin/Rconfig.R create mode 100644 r-plugin/vimrconfig.vim diff --git a/Makefile b/Makefile index 5bf40e5..2d01df2 100644 --- a/Makefile +++ b/Makefile @@ -76,6 +76,8 @@ deb: - r-plugin/vimcom.py\n\ - r-plugin/global_r_plugin.vim\n\ - r-plugin/tex_indent.vim\n\ + - r-plugin/Rconfig.R\n\ + - r-plugin/vimrconfig.vim\n\ - syntax/r.vim\n\ - syntax/rdoc.vim\n\ - syntax/rout.vim\n\ diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 97ded58..0d4b635 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -196,22 +196,12 @@ terminal emulator. 3.2. Instructions for Windows ~ -Open the directory where you have downloaded the file -`vim-r-plugin_0.9.9.8.vmb`, right click on it and choose "Edit with Vim". -> -Then, in Vim, type: -> - :so % -< -Press and the plugin will be installed (because the plugin has many -files, you have to press the space bar a few times to finish the -installation). You can, then, can quit Vim. However in addition to having R -and Vim installed in your system, this plugin requires users to install -external dependencies: +Before installing the plugin, you should install several external +dependencies: - * R's version must be >= 3.0.0. + * R's version must be >= 3.0.0: http://www.r-project.org/ - * Vim's version must be >= 7.4 + * Vim's version must be >= 7.4: http://www.vim.org/download.php * Python 2.7.5 (32 bit): http://www.python.org/download/ Do not choose the X86-64 version because it will not work. @@ -220,24 +210,50 @@ external dependencies: Note: The above versions of Python and pywin32 are known to work with the official GVim 7.4 binary. The default download may not match the - Python version Vim was linked against: you have to "View all files" on - the download page to find the file that matches exactly the above + Python version Vim was linked against: then you have to "View all files" + on the download page to find the file that matches exactly the above versions. Please, read |r-plugin-python| if want to use different versions. * vimcom.plus = 0.9-92: http://www.lepem.ufc.br/jaa/vimcom.plus.html - The vimcom.plus package creates a server on R to allow the communication - with Vim and it must be loaded to Vim-R-plugin to work properly. Instead - of loading it manually with the command `library(vimcom.plus)` each time - that R is started, you should start it at your Rprofile. You can do - `Sys.getenv("HOME")` in the R Console to know where the file should be - created, but usually it is at ~/Documents/.Rprofile. Put the following - lines at the end of your Rprofile. -> - library(vimcom.plus) - # If you cannot install vimcom.plus, do: - # library(vimcom) + + Note: If you cannot build vimcom.plus yourself, you will want to + download and install the zip file. + +Now, download the file `vim-r-plugin_0.9.9.8.vmb` from + + http://www.vim.org/scripts/script.php?script_id=2628 + +and open the directory where you have downloaded it, right click on it and +choose "Edit with Vim". +> +Then, in Vim, type: +> + :so % +< +Press and the plugin will be installed (because the plugin has many +files, you have to press the space bar a few times to finish the +installation). You should, then, quit Vim. + +Start GVim again and edit an R script. You can right click a .R file and +choose "Edit with Vim" or create a new one with the Normal mode command: +> + :e example.R < +To finish the installation, start R and click on the menu bar +> + R + Start/Close + Start R (default) +< +and, finally, do in Vim: +> + :RpluginConfig +< +The above command will guide you through additional configuration steps. You +may not want to run it if you are already an experienced Vim user, but, you +may want to see |r-plugin-Rprofile-Windows|. + Start editing an R file with GVim and try to send some lines to R Console. You may have to adjust the value of |vimrplugin_sleeptime|. @@ -1926,7 +1942,7 @@ line in your |vimrc|: < 9.15. Edit your ~/.Rprofile~ - + *r-plugin-Rprofile* You may want to edit your ~/.Rprofile. Example for Linux: > if(interactive()){ @@ -1965,13 +1981,12 @@ which can display R plots in a separate panel. Although we can not embed an R graphical device in Vim, we can at least make it always visible over the terminal emulator or the GVim window. + *r-plugin-Rprofile-Windows* An example for Windows: > if (interactive()) { - local({ - options(editor = '"C:/Program Files (x86)/Vim/vim73/gvim.exe" "-c" "set filetype=r"') - options(help_type = "html") - }) + library(vimcom.plus) + options(editor = '"C:/Program Files (x86)/Vim/vim74/gvim.exe" "-c" "set filetype=r"') } < @@ -2059,10 +2074,31 @@ See also: |vimrplugin_latexcmd|. Please, look at section |r-plugin-options| if you want information about the Vim-r-plugin customization. -Here are some suggestions of configuration of Bash, Tmux and R. To understand -what you are doing, and change the configuration to your taste, please read -this document from the beginning. +Here are some suggestions of configuration of Vim, Bash, Tmux and R. To +understand what you are doing, and change the configuration to your taste, +please read this document from the beginning. + ~/.vimrc~ +> + " Minimum required configuration: + set nocompatible + syntax on + filetype plugin on + filetype indent on + " Change Leader and LocalLeader keys: + let maplocalleader = "," + let mapleader = ";" + " Use Ctrl+Space to do omnicompletion: + if has("gui_running") + inoremap + else + inoremap + endif + " Press the space bar to send lines and selection to R: + vmap RDSendSelection + nmap RDSendLine +< + *r-plugin-quick-bash-setup* ~/.bashrc:~ > # Change the TERM environment variable (to get 256 colors) and make Vim @@ -2092,6 +2128,8 @@ this document from the beginning. fi fi < + + *r-plugin-quick-tmux-setup* ~/.tmux.conf:~ > set-option -g prefix C-a @@ -2104,6 +2142,8 @@ this document from the beginning. set -g mouse-select-pane on set -g mouse-resize-pane on < + + *r-plugin-quick-R-setup* ~/.Rprofile~ > if(interactive()){ @@ -2135,6 +2175,7 @@ this document from the beginning. } } < + ~/bin/vimrpager~ > #!/bin/sh @@ -2196,7 +2237,7 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details. *r-plugin-news* 10. News~ -0.9.9.8 (2013-11-06) +0.9.9.8 (2013-11-07) * The list of objects for omnicompletion and the list of functions for syntax highlight now are built dynamically. Deprecated commands and options: diff --git a/list_for_vimball b/list_for_vimball index 275d349..da7dd7b 100644 --- a/list_for_vimball +++ b/list_for_vimball @@ -28,3 +28,5 @@ r-plugin/tex_indent.vim r-plugin/r.snippets r-plugin/common_buffer.vim r-plugin/common_global.vim +r-plugin/Rconfig.R +r-plugin/vimrconfig.vim diff --git a/r-plugin/Rconfig.R b/r-plugin/Rconfig.R new file mode 100644 index 0000000..f65f845 --- /dev/null +++ b/r-plugin/Rconfig.R @@ -0,0 +1,52 @@ + +if(.Platform$OS.type == "windows"){ + .rpf <- Sys.getenv("R_PROFILE_USER") + if(.rpf == ""){ + if(Sys.getenv("R_USER") == "") + stop("R_USER environment variable not set.") + .rpf <- paste0(Sys.getenv("R_USER"), "\\.Rprofile") + } +} else { + if(Sys.getenv("HOME") == ""){ + stop("HOME environment variable not set.") + } else { + .rpf <- paste0(Sys.getenv("HOME"), "/.Rprofile") + } +} +if(file.exists(.rpf)){ + .rpflines <- readLines(.rpf) +} else { + .rpflines <- "" +} +if(length(grep("vimcom", .rpflines)) > 0){ + writeLines(c(.rpf, "vimcom_found"), + con = paste0(Sys.getenv("VIMRPLUGIN_TMPDIR"), "/configR_result")) +} else { + .rpflines <- c(.rpflines, + '', + '# Added by Vim-R-plugin command :RpluginConfig :', + 'if(interactive()){', + ' library("vimcom.plus")') + if(.Platform$OS.type == "windows"){ + .rpflines <- c(.rpflines, ' options(editor = \'"C:/Program Files (x86)/Vim/vim74/gvim.exe" "-c" "set filetype=r"\')') + } else { + .rpflines <- c(.rpflines, + ' if(nchar(Sys.getenv("DISPLAY")) > 1)', + ' options(editor = \'gvim -f -c "set ft=r"\')', + ' else', + ' options(editor = \'vim -c "set ft=r"\')', + ' library(colorout)', + ' if(Sys.getenv("TERM") != "linux" && Sys.getenv("TERM") != ""){', + ' # Choose the colors for R output among 256 options.', + ' # You should run show256Colors() and help(setOutputColors256) to', + ' # know how to change the colors according to your taste:', + ' setOutputColors256(verbose = FALSE)', + ' }', + ' library(setwidth)') + } + .rpflines <- c(.rpflines, "}") + writeLines(.rpflines, con = .rpf) + writeLines(c(.rpf, "new_Rprofile"), + con = paste0(Sys.getenv("VIMRPLUGIN_TMPDIR"), "/configR_result")) +} + diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 4bc6ca6..276bd3c 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -668,7 +668,7 @@ function StartR_ExternalTerm(rcmd) \ 'set-environment -g VIMRPLUGIN_HOME ' . g:rplugin_home, \ 'set-environment VIMINSTANCEID ' . $VIMINSTANCEID ] if v:servername != "" - let cnflines = cnflines + [ 'set-environment VIMEDITOR_SVRNM ' . v:servername, + let cnflines = cnflines + [ 'set-environment VIMEDITOR_SVRNM ' . v:servername ] endif if g:vimrplugin_notmuxconf let cnflines = cnflines + [ 'source-file ~/.tmux.conf' ] @@ -679,8 +679,7 @@ function StartR_ExternalTerm(rcmd) \ 'bind-key C-a send-prefix', \ 'set-window-option -g mode-keys vi', \ 'set -g status off', - \ "set -g terminal-overrides 'xterm*:smcup@:rmcup@'", - ] + \ "set -g terminal-overrides 'xterm*:smcup@:rmcup@'" ] if g:vimrplugin_external_ob || !has("gui_running") call extend(cnflines, ['set -g mode-mouse on', 'set -g mouse-select-pane on', 'set -g mouse-resize-pane on']) endif @@ -1933,7 +1932,7 @@ function RAddToLibList(nlib, verbose) " List of objects for :Rhelp completion for xx in nlist let xxx = split(xx, "\x06") - if xxx[0] !~ '\$' + if len(xxx) > 0 && xxx[0] !~ '\$' call add(s:list_of_objs, xxx[0]) endif endfor @@ -3027,6 +3026,7 @@ command -range=% Rformat ,:call RFormatCode() command RBuildTags :call g:SendCmdToR('rtags(ofile = "TAGS")') command -nargs=? -complete=customlist,RLisObjs Rhelp :call RAskHelp() command -nargs=? -complete=dir RSourceDir :call RSourceDirectory() +command RpluginConfig :runtime r-plugin/vimrconfig.vim " TODO: Delete these two commands (Nov 2013): command RUpdateObjList :call RWarningMsg("This command is deprecated. Now the list of objects is automatically updated by the R package vimcom.plus.") @@ -3519,6 +3519,12 @@ let g:needsnewomnilist = 0 let g:rplugin_libls = split(g:vimrplugin_permanent_libs, ",") let g:rplugin_liblist = [] let s:list_of_objs = [] +if exists("b:current_syntax") + " The syntax/r.vim was read before this script + for lib in g:rplugin_libls + call RAddToLibList(lib, 0) + endfor +endif " Check whether tool bar icons exist if has("win32") || has("win64") diff --git a/r-plugin/vimrconfig.vim b/r-plugin/vimrconfig.vim new file mode 100644 index 0000000..b28db6d --- /dev/null +++ b/r-plugin/vimrconfig.vim @@ -0,0 +1,278 @@ + +function! RFindString(lll, sss) + for line in a:lll + if line =~ a:sss + return 1 + endif + endfor + return 0 +endfunction + +" Configure .Rprofile +function! RConfigRprofile() + call delete($VIMRPLUGIN_TMPDIR . "/configR_result") + let rcmd = 'source("' . g:rplugin_uservimfiles . '/r-plugin/Rconfig.R")' + call g:SendCmdToR(rcmd) + sleep 1 + if filereadable($VIMRPLUGIN_TMPDIR . "/configR_result") + let res = readfile($VIMRPLUGIN_TMPDIR . "/configR_result") + if res[1] == "vimcom_found" + call RWarningMsg('The string "vimcom" was found in your .Rprofile. No change was done.') + elseif res[1] == "new_Rprofile" + call RWarningMsg('Your new .Rprofile was created.') + endif + if has("win32") || has("win64") + echohl Question + let what = input("Do you want to see your .Rprofile now? [yes/no]: ") + echohl Normal + if what =~ "^[yY]" + silent exe "tabnew " . res[0] + endif + else + echohl Question + let what = input("Do you want to see your .Rprofile along with tips on how to\nconfigure it? [yes/no]: ") + echohl Normal + if what =~ "^[yY]" + silent exe "tabnew " . res[0] + silent help r-plugin-quick-R-setup + endif + endif + redraw + else + redraw + call RWarningMsg("Error: configR_result not found.") + sleep 1 + return 1 + endif + return 0 +endfunction + +" Configure vimrc +function! RConfigVimrc() + if has("win32") || has("win64") + if filereadable($HOME . "/_vimrc") + let uvimrc = $HOME . "/_vimrc" + elseif filereadable($HOME . "/vimfiles/vimrc") + let uvimrc = $HOME . "/vimfiles/vimrc" + else + let uvimrc = $HOME . "/_vimrc" + endif + else + if filereadable($HOME . "/.vimrc") + let uvimrc = $HOME . "/.vimrc" + elseif filereadable($HOME . "/.vim/vimrc") + let uvimrc = $HOME . "/.vim/vimrc" + else + let uvimrc = $HOME . "/.vimrc" + endif + endif + if filereadable(uvimrc) + echohl WarningMsg + echo "You already have a vimrc." + echohl Normal + let vlines = readfile(uvimrc) + if RFindString(vlines, "maplocalleader") == 0 + echo "It seems that you didn't map your to another key." + endif + if RFindString(vlines, "") == 0 && RFindString(vlines, "") == 0 && RFindString(vlines, "") == 0 + echo "It seems that you didn't create an easier map for omnicompletion yet." + endif + if RFindString(vlines, "RDSendLine") == 0 + echo "It seems that you didn't create an easier map to send lines." + endif + if RFindString(vlines, "RDSendSelection") == 0 + echo "It seems that you didn't create an easier map to send selected lines." + endif + echohl Question + let what = input("Do you want to see your vimrc along with the plugin tips on how to\nconfigure the vimrc? [yes/no]: ") + echohl Normal + if what =~ "^[yY]" + silent exe "tabnew " . uvimrc + silent help r-plugin-quick-setup + endif + redraw + else + echohl Question + let what = input("It seems that you don't have a vimrc yet. Should I create it now? [yes/no]: ") + echohl Normal + if what =~ "^[yY]" + let vlines = ['" The lines below were created by Vim-R-plugin command :RpluginConfig:', + \ '" Minimum required configuration:', + \ 'set nocompatible', + \ 'syntax on', + \ 'filetype plugin on', + \ 'filetype indent on' ] + + echo " " + echo "By default, Vim's LocalLeader is the backslash (\\) which is problematic" + echo "if we are editing LaTeX or Rnoweb (R+LaTeX) files." + echohl Question + let what = input("Do you want to change the LocalLeader to a comma (,)? [yes/no]: ") + echohl Normal + if what =~ "^[yY]" + let vlines = vlines + ['" Change the key:', + \ 'let maplocalleader = ","' ] + endif + echo " " + echo "By default, you have to press Ctrl+X Ctrl+O to complete the names of" + echo "functions and other objects. This is called omnicompletion." + echohl Question + let what = input("Do you want to press Ctrl+Space to do omnicompletion? [yes/no]: ") + echohl Normal + if what =~ "^[yY]" + let vlines = vlines + ['" Use Ctrl+Space to do omnicompletion:', + \ 'if has("gui_running")', + \ ' inoremap ', + \ 'else', + \ ' inoremap ', + \ 'endif' ] + endif + echo " " + echo "By default, you have to press \\d to send one line of code to R" + echo "and \\ss to send a selection of lines." + echohl Question + let what = input("Do you prefer to press the space bar to send lines and selections\nto R Console? [yes/no]: ") + if what =~ "^[yY]" + let vlines = vlines + ['" Press the space bar to send lines (in Normal mode) and selections to R:', + \ 'vmap RDSendSelection', + \ 'nmap RDSendLine' ] + endif + call writefile(vlines, uvimrc) + echo " " + echohl Question + let what = input("You now have a new vimrc. Do you want to see it now? [yes/no]: ") + echohl Normal + if what =~ "^[yY]" + silent exe "tabnew " . uvimrc + endif + redraw + call RWarningMsg("The changes in your vimrc will be effective only after you quit Vim and start it again.") + endif + endif +endfunction + +" Configure .bashrc +function! RConfigBash() + echo " " + if filereadable($HOME . "/.bashrc") + let blines = readfile($HOME . "/.bashrc") + let hastvim = 0 + for line in blines + if line =~ "tvim" + let hastvim = 1 + break + endif + endfor + + if hastvim + echohl WarningMsg + echo "Nothing was added to your ~/.bashrc because the string 'tvim' was found in it." + echohl Question + let what = input("Do you want to see your ~/.bashrc along with the plugin\ntips on how to configure Bash? [yes/no]: ") + echohl Normal + if what =~ "^[yY]" + silent exe "tabnew " . $HOME . "/.bashrc" + silent help r-plugin-quick-bash-setup + endif + else + echo "Vim and Tmux can display up to 256 colors in the terminal emulator," + echo "but we have to configure the TERM environment variable for that." + echo "Instead of starting Tmux and then starting Vim, we can configure" + echo "Bash to start both at once with the 'tmux' command." + echo "The serverclient feature must be enabled for automatic update of the" + echo "Object Browser and syntax highlight of function names." + echohl Question + let what = input("Do you want that all these features are added to your .bashrc? [yes/no]: ") + echohl Normal + if what =~ "^[yY]" + silent exe "tabnew " . $HOME . "/.bashrc" + silent help r-plugin-quick-bash-setup + endif + let blines = blines + ['', + \ '# The lines below were created by Vim-R-plugin command :RpluginConfig:', + \ '# Change the TERM environment variable (to get 256 colors) and make Vim', + \ '# connecting to X Server even if running in a terminal emulator (to get', + \ '# dynamic update of syntax highlight and Object Browser):', + \ 'if [ "x$DISPLAY" != "x" ]', + \ 'then', + \ ' if [ "screen" = "$TERM" ]', + \ ' then', + \ ' export TERM=screen-256color', + \ ' else', + \ ' export TERM=xterm-256color', + \ ' fi', + \ ' alias vim="vim --servername VIM"', + \ ' if [ "x$TERM" == "xxterm" ] || [ "x$TERM" == "xxterm-256color" ]', + \ ' then', + \ ' function tvim(){ tmux -2 new-session "TERM=screen-256color vim --servername VIM $@" ; }', + \ ' else', + \ ' function tvim(){ tmux new-session "vim --servername VIM $@" ; }', + \ ' fi', + \ 'else', + \ ' if [ "x$TERM" == "xxterm" ] || [ "x$TERM" == "xxterm-256color" ]', + \ ' then', + \ ' function tvim(){ tmux -2 new-session "TERM=screen-256color vim $@" ; }', + \ ' else', + \ ' function tvim(){ tmux new-session "vim $@" ; }', + \ ' fi', + \ 'fi' ] + call writefile(blines, $HOME . "/.bashrc") + endif + endif +endfunction + +function! RConfigTmux() + echo " " + if filereadable($HOME . "/.tmux.conf") + echohl WarningMsg + echo "You already have a .tmux.conf." + echohl Question + let what = input("Do you want to see it along with the plugin tips on how to\nconfigure Tmux? [yes/no]: ") + echohl Normal + if what =~ "^[yY]" + silent exe "tabnew " . $HOME . "/.tmux.conf" + silent help r-plugin-quick-tmux-setup + endif + redraw + else + echohl Question + let what = input("You don't have a ~/.tmux.conf yet. Should I create it now? [yes/no]: ") + echohl Normal + if what =~ "^[yY]" + let vlines = ['# The lines below were created by Vim-R-plugin command :RpluginConfig:', + \ "set-option -g prefix C-a", + \ "unbind-key C-b", + \ "bind-key C-a send-prefix", + \ "set -g status off", + \ "set-window-option -g mode-keys vi", + \ "set -g terminal-overrides 'xterm*:smcup@:rmcup@'", + \ "set -g mode-mouse on", + \ "set -g mouse-select-pane on", + \ "set -g mouse-resize-pane on" ] + call writefile(vlines, $HOME . "/.tmux.conf") + echo " " + echohl Question + let what = input("You now have a new .tmux.conf. Do you want to see it now? [yes/no]: ") + echohl Normal + if what =~ "^[yY]" + silent exe "tabnew " . $HOME . "/.tmux.conf" + endif + redraw + endif + endif +endfunction + +function! RConfigVimR() + if RConfigRprofile() + return + endif + call RConfigVimrc() + if has("win32") || has("win64") + return + endif + call RConfigTmux() + call RConfigBash() +endfunction + +call RConfigVimR() + From a80c314ad55dc78e6386630218408298fbdfb988 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 7 Nov 2013 20:03:07 -0300 Subject: [PATCH 0522/1050] Fix bug in Bash configuration. --- r-plugin/vimrconfig.vim | 60 ++++++++++++++++++++--------------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/r-plugin/vimrconfig.vim b/r-plugin/vimrconfig.vim index b28db6d..f5c4e0c 100644 --- a/r-plugin/vimrconfig.vim +++ b/r-plugin/vimrconfig.vim @@ -178,45 +178,45 @@ function! RConfigBash() echo "Vim and Tmux can display up to 256 colors in the terminal emulator," echo "but we have to configure the TERM environment variable for that." echo "Instead of starting Tmux and then starting Vim, we can configure" - echo "Bash to start both at once with the 'tmux' command." + echo "Bash to start both at once with the 'tvim' command." echo "The serverclient feature must be enabled for automatic update of the" echo "Object Browser and syntax highlight of function names." echohl Question let what = input("Do you want that all these features are added to your .bashrc? [yes/no]: ") echohl Normal if what =~ "^[yY]" + let blines = blines + ['', + \ '# The lines below were created by Vim-R-plugin command :RpluginConfig:', + \ '# Change the TERM environment variable (to get 256 colors) and make Vim', + \ '# connecting to X Server even if running in a terminal emulator (to get', + \ '# dynamic update of syntax highlight and Object Browser):', + \ 'if [ "x$DISPLAY" != "x" ]', + \ 'then', + \ ' if [ "screen" = "$TERM" ]', + \ ' then', + \ ' export TERM=screen-256color', + \ ' else', + \ ' export TERM=xterm-256color', + \ ' fi', + \ ' alias vim="vim --servername VIM"', + \ ' if [ "x$TERM" == "xxterm" ] || [ "x$TERM" == "xxterm-256color" ]', + \ ' then', + \ ' function tvim(){ tmux -2 new-session "TERM=screen-256color vim --servername VIM $@" ; }', + \ ' else', + \ ' function tvim(){ tmux new-session "vim --servername VIM $@" ; }', + \ ' fi', + \ 'else', + \ ' if [ "x$TERM" == "xxterm" ] || [ "x$TERM" == "xxterm-256color" ]', + \ ' then', + \ ' function tvim(){ tmux -2 new-session "TERM=screen-256color vim $@" ; }', + \ ' else', + \ ' function tvim(){ tmux new-session "vim $@" ; }', + \ ' fi', + \ 'fi' ] + call writefile(blines, $HOME . "/.bashrc") silent exe "tabnew " . $HOME . "/.bashrc" silent help r-plugin-quick-bash-setup endif - let blines = blines + ['', - \ '# The lines below were created by Vim-R-plugin command :RpluginConfig:', - \ '# Change the TERM environment variable (to get 256 colors) and make Vim', - \ '# connecting to X Server even if running in a terminal emulator (to get', - \ '# dynamic update of syntax highlight and Object Browser):', - \ 'if [ "x$DISPLAY" != "x" ]', - \ 'then', - \ ' if [ "screen" = "$TERM" ]', - \ ' then', - \ ' export TERM=screen-256color', - \ ' else', - \ ' export TERM=xterm-256color', - \ ' fi', - \ ' alias vim="vim --servername VIM"', - \ ' if [ "x$TERM" == "xxterm" ] || [ "x$TERM" == "xxterm-256color" ]', - \ ' then', - \ ' function tvim(){ tmux -2 new-session "TERM=screen-256color vim --servername VIM $@" ; }', - \ ' else', - \ ' function tvim(){ tmux new-session "vim --servername VIM $@" ; }', - \ ' fi', - \ 'else', - \ ' if [ "x$TERM" == "xxterm" ] || [ "x$TERM" == "xxterm-256color" ]', - \ ' then', - \ ' function tvim(){ tmux -2 new-session "TERM=screen-256color vim $@" ; }', - \ ' else', - \ ' function tvim(){ tmux new-session "vim $@" ; }', - \ ' fi', - \ 'fi' ] - call writefile(blines, $HOME . "/.bashrc") endif endif endfunction From c35743e46826239b56267948e97de55447e8881c Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 7 Nov 2013 21:24:24 -0300 Subject: [PATCH 0523/1050] Reorganize installation instructions for Unix. --- doc/r-plugin.txt | 103 +++++++++++++++++++++++------------------------ 1 file changed, 50 insertions(+), 53 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 0d4b635..e4f9eb6 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -101,41 +101,15 @@ The installation instructions are split in four sections: If you are using Windows, jump to section 3.2. -You need to activate plugins and indentation according to 'filetype'. You -should have at least the following options in your |vimrc|: -> - set nocompatible - syntax enable - filetype plugin on - filetype indent on -< -Make a backup of your ~/.vim directory because existing files will be -replaced. Please, look at |r-plugin-files| to see the list of files. - -Start a terminal emulator, go to the directory where you have downloaded the -plugin and type: -> - vim vim-r-plugin_0.9.9.8.vmb -< -Then, in Vim, type: -> - :so % -< -The plugin is installed, but in addition to having R and Vim installed in your -system, this plugin has the following dependencies: +Before installing the plugin, you should install its dependencies: Depends:~ + Vim >= 7.4: http://www.vim.org/download.php + + R >= 3.0.0: http://www.r-project.org/ + vimcom.plus = 0.9-92: http://www.lepem.ufc.br/jaa/vimcom.plus.html - The vimcom.plus (or vimcom) package creates a server on R to - allow the communication with Vim. The package is not used to - send commands from Vim to R Console, but it is necessary to - open R documentation in Vim's buffer, run the Object - Browser, run either `Sweave()` or `knit()` on the document - being edited. It also has some functions called by Vim such - as `vim.plot()`, `vim.print()`, and `vim.bol()`. This last - one is required to build the data base used in - omnicompletion. Tmux >= 1.5: http://tmux.sourceforge.net Tmux is necessary to send commands from Vim to R Console. @@ -157,36 +131,60 @@ system, this plugin has the following dependencies: latexmk: Automate the compilation of LaTeX documents. See examples in |vimrplugin_latexcmd|. - Note: Tmux and ncurses-term are already packaged for most GNU/Linux - distributions and other Unix variants. Unfortunately their installation - instructions vary widely and are beyond the scope of this documentation. + Note: Vim, R, Tmux, ncurses-term and latexmk are already packaged for most + GNU/Linux distributions and other Unix variants. Unfortunately their + installation instructions vary widely and are beyond the scope of this + documentation. - You certainly will want to put something like the following at the end of - your ~/.Rprofile: -> - if(interactive()){ - library(colorout) - library(setwidth) - library(vimcom.plus) - # If you can't install the vimcom.plus package, do: - # library(vimcom) - } -< Conflicts:~ Users have reported that the Vim-R-plugin might not work well with Fish Shell and tcsh. + +You need to activate plugins and indentation according to 'filetype'. You +should have at least the following options in your |vimrc|: +> + set nocompatible + syntax enable + filetype plugin on + filetype indent on +< +Make a backup of your ~/.vim directory because existing files will be +replaced. Please, look at |r-plugin-files| to see the list of files. + +Start a terminal emulator, go to the directory where you have downloaded the +plugin and type: +> + vim vim-r-plugin_0.9.9.8.vmb +< +Then, in Vim, type: +> + :so % +< +Press and the plugin will be installed (because the plugin has many +files, you have to press the space bar a few times to finish the +installation). You should, then, quit Vim. + +Start Vim again and edit an R script. Type rf to start R and run +the command below to get help configuring ~/.vimrc, ~/.bashrc, ~/.tmux.conf +and ~/.Rprofile (the is `\` by default): +> + :RpluginConfig +< +The above command will guide you through additional configuration steps, but +if you prefer to configure everything by yourself, please, read the section +|r-plugin-quick-setup|. + If you start either GVim or Vim in a terminal emulator the plugin will start R in a external terminal emulator. If you start Vim inside of a Tmux session, the plugin will split the Tmux window in two and start R in the other pane. The recommended way of running the plugin on Linux is running Vim inside a Tmux session. If you do not use Tmux frequently, it is recommended that you -create a custom Bash function. Please, read the section |r-plugin-tmux|, -especially the tip |r-plugin-tvim|. If you don't want to read this entire -document to find a few suggestions of configuration of ~/.bashrc, ~/.tmux.conf -and ~/.Rprofile, jump to |r-plugin-quick-setup|. +create a custom Bash function as explained in the section |r-plugin-tmux|, +especially the tip |r-plugin-tvim| (the above command :RpluginConfig should do +this for you). Note: On Mac OS X, in both Vim and GVim, the plugin will use AppleScript to send commands to the R Console application unless vimrplugin_applescript = 0. @@ -251,11 +249,10 @@ and, finally, do in Vim: :RpluginConfig < The above command will guide you through additional configuration steps. You -may not want to run it if you are already an experienced Vim user, but, you -may want to see |r-plugin-Rprofile-Windows|. +you are already an experienced Vim user, instead of running the above command +you may preffer to read |r-plugin-Rprofile-Windows|. -Start editing an R file with GVim and try to send some lines to R Console. You -may have to adjust the value of |vimrplugin_sleeptime|. +You may have to adjust the value of |vimrplugin_sleeptime|. 3.3. Troubleshooting (if the plugin doesn't work)~ From b42d68d38f5d5a1844d10b88b3612229b430623e Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 7 Nov 2013 23:35:45 -0300 Subject: [PATCH 0524/1050] Append options to existing vimrc. --- r-plugin/vimrconfig.vim | 161 ++++++++++++++++++++++++---------------- 1 file changed, 96 insertions(+), 65 deletions(-) diff --git a/r-plugin/vimrconfig.vim b/r-plugin/vimrconfig.vim index f5c4e0c..bd67afa 100644 --- a/r-plugin/vimrconfig.vim +++ b/r-plugin/vimrconfig.vim @@ -66,89 +66,120 @@ function! RConfigVimrc() let uvimrc = $HOME . "/.vimrc" endif endif + if filereadable(uvimrc) + let hasvimrc = 1 echohl WarningMsg echo "You already have a vimrc." echohl Normal - let vlines = readfile(uvimrc) - if RFindString(vlines, "maplocalleader") == 0 - echo "It seems that you didn't map your to another key." - endif - if RFindString(vlines, "") == 0 && RFindString(vlines, "") == 0 && RFindString(vlines, "") == 0 - echo "It seems that you didn't create an easier map for omnicompletion yet." - endif - if RFindString(vlines, "RDSendLine") == 0 - echo "It seems that you didn't create an easier map to send lines." - endif - if RFindString(vlines, "RDSendSelection") == 0 - echo "It seems that you didn't create an easier map to send selected lines." - endif echohl Question - let what = input("Do you want to see your vimrc along with the plugin tips on how to\nconfigure the vimrc? [yes/no]: ") + let what = input("Do you want to add to the bottom of your vimrc some options that\nmost users consider convenient for the Vim-R-plugin? [yes/no]: ") echohl Normal if what =~ "^[yY]" - silent exe "tabnew " . uvimrc - silent help r-plugin-quick-setup + let vlines = readfile(uvimrc) + else + return endif - redraw else + let hasvimrc = 0 echohl Question let what = input("It seems that you don't have a vimrc yet. Should I create it now? [yes/no]: ") echohl Normal if what =~ "^[yY]" - let vlines = ['" The lines below were created by Vim-R-plugin command :RpluginConfig:', - \ '" Minimum required configuration:', - \ 'set nocompatible', - \ 'syntax on', - \ 'filetype plugin on', - \ 'filetype indent on' ] + let vlines = [] + else + return + endif + endif - echo " " - echo "By default, Vim's LocalLeader is the backslash (\\) which is problematic" - echo "if we are editing LaTeX or Rnoweb (R+LaTeX) files." - echohl Question - let what = input("Do you want to change the LocalLeader to a comma (,)? [yes/no]: ") + let vlines = vlines + ['', '" The lines below were created by Vim-R-plugin command :RpluginConfig:'] + + if RFindString(vlines, 'set\s*nocompatible') == 0 && RFindString(vlines, 'set\s*nocp') == 0 + let vlines = vlines + ['set nocompatible'] + endif + if RFindString(vlines, 'syntax\s*on') == 0 + let vlines = vlines + ['syntax on'] + endif + if RFindString(vlines, 'filet.* plugin on') == 0 + let vlines = vlines + ['filetype plugin on'] + endif + if RFindString(vlines, 'filet.* indent on') == 0 + let vlines = vlines + ['filetype indent on'] + endif + + echo " " + if RFindString(vlines, "maplocalleader") == 0 + if hasvimrc + echohl WarningMsg + echo "It seems that you didn't map your to another key." echohl Normal - if what =~ "^[yY]" - let vlines = vlines + ['" Change the key:', - \ 'let maplocalleader = ","' ] - endif - echo " " - echo "By default, you have to press Ctrl+X Ctrl+O to complete the names of" - echo "functions and other objects. This is called omnicompletion." - echohl Question - let what = input("Do you want to press Ctrl+Space to do omnicompletion? [yes/no]: ") + endif + echo "By default, Vim's LocalLeader is the backslash (\\) which is problematic" + echo "if we are editing LaTeX or Rnoweb (R+LaTeX) files." + echohl Question + let what = input("Do you want to change the LocalLeader to a comma (,)? [yes/no]: ") + echohl Normal + if what =~ "^[yY]" + let vlines = vlines + ['" Change the key:', + \ 'let maplocalleader = ","'] + endif + endif + + echo " " + if RFindString(vlines, "") == 0 && RFindString(vlines, "") == 0 && RFindString(vlines, "") == 0 + if hasvimrc + echohl WarningMsg + echo "It seems that you didn't create an easier map for omnicompletion yet." echohl Normal - if what =~ "^[yY]" - let vlines = vlines + ['" Use Ctrl+Space to do omnicompletion:', - \ 'if has("gui_running")', - \ ' inoremap ', - \ 'else', - \ ' inoremap ', - \ 'endif' ] - endif - echo " " - echo "By default, you have to press \\d to send one line of code to R" - echo "and \\ss to send a selection of lines." - echohl Question - let what = input("Do you prefer to press the space bar to send lines and selections\nto R Console? [yes/no]: ") - if what =~ "^[yY]" - let vlines = vlines + ['" Press the space bar to send lines (in Normal mode) and selections to R:', - \ 'vmap RDSendSelection', - \ 'nmap RDSendLine' ] - endif - call writefile(vlines, uvimrc) - echo " " - echohl Question - let what = input("You now have a new vimrc. Do you want to see it now? [yes/no]: ") + endif + echo "By default, you have to press Ctrl+X Ctrl+O to complete the names of" + echo "functions and other objects. This is called omnicompletion." + echohl Question + let what = input("Do you want to press Ctrl+Space to do omnicompletion? [yes/no]: ") + echohl Normal + if what =~ "^[yY]" + let vlines = vlines + ['" Use Ctrl+Space to do omnicompletion:', + \ 'if has("gui_running")', + \ ' inoremap ', + \ 'else', + \ ' inoremap ', + \ 'endif'] + endif + endif + + echo " " + if RFindString(vlines, "RDSendLine") == 0 || RFindString(vlines, "RDSendSelection") == 0 + if hasvimrc + echohl WarningMsg + echo "It seems that you didn't create an easier map to" + echo "either send lines or send selected lines." echohl Normal - if what =~ "^[yY]" - silent exe "tabnew " . uvimrc - endif - redraw - call RWarningMsg("The changes in your vimrc will be effective only after you quit Vim and start it again.") endif + echo "By default, you have to press \\d to send one line of code to R" + echo "and \\ss to send a selection of lines." + echohl Question + let what = input("Do you prefer to press the space bar to send lines and selections\nto R Console? [yes/no]: ") + echohl Normal + if what =~ "^[yY]" + let vlines = vlines + ['" Press the space bar to send lines (in Normal mode) and selections to R:', + \ 'vmap RDSendSelection', + \ 'nmap RDSendLine'] + endif + endif + call writefile(vlines, uvimrc) + + echo " " + echohl Question + let what = input("You now have a new vimrc. Do you want to see it now? [yes/no]: ") + echohl Normal + if what =~ "^[yY]" + silent exe "tabnew " . uvimrc endif + redraw + echohl WarningMsg + echo "The changes in your vimrc will be effective" + echo "only after you quit Vim and start it again." + echohl Normal endfunction " Configure .bashrc @@ -248,7 +279,7 @@ function! RConfigTmux() \ "set -g terminal-overrides 'xterm*:smcup@:rmcup@'", \ "set -g mode-mouse on", \ "set -g mouse-select-pane on", - \ "set -g mouse-resize-pane on" ] + \ "set -g mouse-resize-pane on"] call writefile(vlines, $HOME . "/.tmux.conf") echo " " echohl Question From aa67bcc5f60029cafd5402bdf7ad222cf60f8d35 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 7 Nov 2013 23:52:34 -0300 Subject: [PATCH 0525/1050] Don't go to beginning of line if not going down. --- r-plugin/common_global.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 276bd3c..e937867 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -1679,7 +1679,7 @@ function SendParagraphToR(e, m) endif endfunction -" Send current line to R. Don't go down if called by . +" Send current line to R. function SendLineToR(godown) let line = getline(".") if strlen(line) == 0 @@ -2957,7 +2957,7 @@ function RCreateSendMaps() " *Line* "------------------------------------- - call RCreateMaps("ni0", 'RSendLine', 'l', ':call SendLineToR("stay")') + call RCreateMaps("ni", 'RSendLine', 'l', ':call SendLineToR("stay")') call RCreateMaps('ni0', 'RDSendLine', 'd', ':call SendLineToR("down")') call RCreateMaps('i', 'RSendLAndOpenNewOne', 'q', ':call SendLineToR("newline")') nmap r :call RSendPartOfLine("left", 0) From 77e9761c2f0a1aec15777886eab4ec46b994a2f6 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Fri, 8 Nov 2013 08:50:04 -0300 Subject: [PATCH 0526/1050] Add time of configuration to files. --- r-plugin/Rconfig.R | 2 +- r-plugin/vimrconfig.vim | 43 ++++++++++++++++++++++++++++++----------- 2 files changed, 33 insertions(+), 12 deletions(-) diff --git a/r-plugin/Rconfig.R b/r-plugin/Rconfig.R index f65f845..68f0ac4 100644 --- a/r-plugin/Rconfig.R +++ b/r-plugin/Rconfig.R @@ -24,7 +24,7 @@ if(length(grep("vimcom", .rpflines)) > 0){ } else { .rpflines <- c(.rpflines, '', - '# Added by Vim-R-plugin command :RpluginConfig :', + paste0('# Lines added by the Vim-R-plugin command :RpluginConfig (', format(Sys.time(), "%Y-%b-%d %H:%M"), '):'), 'if(interactive()){', ' library("vimcom.plus")') if(.Platform$OS.type == "windows"){ diff --git a/r-plugin/vimrconfig.vim b/r-plugin/vimrconfig.vim index bd67afa..37c7d60 100644 --- a/r-plugin/vimrconfig.vim +++ b/r-plugin/vimrconfig.vim @@ -92,7 +92,12 @@ function! RConfigVimrc() endif endif - let vlines = vlines + ['', '" The lines below were created by Vim-R-plugin command :RpluginConfig:'] + let vlines = vlines + [''] + if exists("*strftime") + let vlines = vlines + ['" Lines added by the Vim-R-plugin command :RpluginConfig (' . strftime("%Y-%b-%d %H:%M") . '):'] + else + let vlines = vlines + ['" Lines added by the Vim-R-plugin command :RpluginConfig:'] + endif if RFindString(vlines, 'set\s*nocompatible') == 0 && RFindString(vlines, 'set\s*nocp') == 0 let vlines = vlines + ['set nocompatible'] @@ -170,10 +175,11 @@ function! RConfigVimrc() echo " " echohl Question - let what = input("You now have a new vimrc. Do you want to see it now? [yes/no]: ") + let what = input("Do you want to see your vimrc now? [yes/no]: ") echohl Normal if what =~ "^[yY]" silent exe "tabnew " . uvimrc + normal! G endif redraw echohl WarningMsg @@ -216,9 +222,13 @@ function! RConfigBash() let what = input("Do you want that all these features are added to your .bashrc? [yes/no]: ") echohl Normal if what =~ "^[yY]" - let blines = blines + ['', - \ '# The lines below were created by Vim-R-plugin command :RpluginConfig:', - \ '# Change the TERM environment variable (to get 256 colors) and make Vim', + let blines = blines + [''] + if exists("*strftime") + let blines = blines + ['# Lines added by the Vim-R-plugin command :RpluginConfig (' . strftime("%Y-%b-%d %H:%M") . '):'] + else + let blines = blines + ['# Lines added by the Vim-R-plugin command :RpluginConfig:'] + endif + let blines = blines + ['# Change the TERM environment variable (to get 256 colors) and make Vim', \ '# connecting to X Server even if running in a terminal emulator (to get', \ '# dynamic update of syntax highlight and Object Browser):', \ 'if [ "x$DISPLAY" != "x" ]', @@ -245,10 +255,16 @@ function! RConfigBash() \ ' fi', \ 'fi' ] call writefile(blines, $HOME . "/.bashrc") - silent exe "tabnew " . $HOME . "/.bashrc" - silent help r-plugin-quick-bash-setup + echohl Question + let what = input("Do you want to see your .bashrc now? [yes/no]: ") + echohl Normal + if what =~ "^[yY]" + silent exe "tabnew " . $HOME . "/.bashrc" + normal! G27k + endif endif endif + redraw endif endfunction @@ -270,8 +286,13 @@ function! RConfigTmux() let what = input("You don't have a ~/.tmux.conf yet. Should I create it now? [yes/no]: ") echohl Normal if what =~ "^[yY]" - let vlines = ['# The lines below were created by Vim-R-plugin command :RpluginConfig:', - \ "set-option -g prefix C-a", + let tlines = [''] + if exists("*strftime") + let tlines = tlines + ['# Lines added by the Vim-R-plugin command :RpluginConfig (' . strftime("%Y-%b-%d %H:%M") . '):'] + else + let tlines = tlines + ['# Lines added by the Vim-R-plugin command :RpluginConfig:'] + endif + let tlines = tlines + ["set-option -g prefix C-a", \ "unbind-key C-b", \ "bind-key C-a send-prefix", \ "set -g status off", @@ -280,10 +301,10 @@ function! RConfigTmux() \ "set -g mode-mouse on", \ "set -g mouse-select-pane on", \ "set -g mouse-resize-pane on"] - call writefile(vlines, $HOME . "/.tmux.conf") + call writefile(tlines, $HOME . "/.tmux.conf") echo " " echohl Question - let what = input("You now have a new .tmux.conf. Do you want to see it now? [yes/no]: ") + let what = input("Do you want to see your .tmux.conf now? [yes/no]: ") echohl Normal if what =~ "^[yY]" silent exe "tabnew " . $HOME . "/.tmux.conf" From f7a9a89c66d3540a93088ba8f26afde91bfcf3f1 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Fri, 8 Nov 2013 09:17:11 -0300 Subject: [PATCH 0527/1050] Add :RpluginConfig to GVim menu bar. --- r-plugin/common_global.vim | 1 + 1 file changed, 1 insertion(+) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index e937867..0418b22 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -2796,6 +2796,7 @@ function MakeRMenu() amenu R.Help\ (plugin).News :help r-plugin-news amenu R.Help\ (R):Rhelp :call g:SendCmdToR("help.start()") + amenu R.Configure\ (Vim-R):RpluginConfig :RpluginConfig let g:rplugin_hasmenu = 1 "---------------------------------------------------------------------------- From edbad12d8ec1286c2841bda5ad4031268bb7a43a Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Fri, 8 Nov 2013 09:25:20 -0300 Subject: [PATCH 0528/1050] Start R automatically if it's not running yet. --- r-plugin/vimrconfig.vim | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/r-plugin/vimrconfig.vim b/r-plugin/vimrconfig.vim index 37c7d60..6af1663 100644 --- a/r-plugin/vimrconfig.vim +++ b/r-plugin/vimrconfig.vim @@ -78,6 +78,7 @@ function! RConfigVimrc() if what =~ "^[yY]" let vlines = readfile(uvimrc) else + redraw return endif else @@ -88,6 +89,7 @@ function! RConfigVimrc() if what =~ "^[yY]" let vlines = [] else + redraw return endif endif @@ -315,6 +317,13 @@ function! RConfigTmux() endfunction function! RConfigVimR() + if string(g:SendCmdToR) == "function('SendCmdToR_fake')" + call StartR("R") + echohl WarningMsg + echo "Please wait..." + echohl Normal + sleep 2 + endif if RConfigRprofile() return endif From 0a95eb4f92476eb14ba908474bc994d28b7bc410 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Fri, 8 Nov 2013 13:01:18 -0300 Subject: [PATCH 0529/1050] Offer y/N as options of answer. --- r-plugin/vimrconfig.vim | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/r-plugin/vimrconfig.vim b/r-plugin/vimrconfig.vim index 6af1663..13043a4 100644 --- a/r-plugin/vimrconfig.vim +++ b/r-plugin/vimrconfig.vim @@ -23,14 +23,14 @@ function! RConfigRprofile() endif if has("win32") || has("win64") echohl Question - let what = input("Do you want to see your .Rprofile now? [yes/no]: ") + let what = input("Do you want to see your .Rprofile now? [y/N]: ") echohl Normal if what =~ "^[yY]" silent exe "tabnew " . res[0] endif else echohl Question - let what = input("Do you want to see your .Rprofile along with tips on how to\nconfigure it? [yes/no]: ") + let what = input("Do you want to see your .Rprofile along with tips on how to\nconfigure it? [y/N]: ") echohl Normal if what =~ "^[yY]" silent exe "tabnew " . res[0] @@ -73,7 +73,7 @@ function! RConfigVimrc() echo "You already have a vimrc." echohl Normal echohl Question - let what = input("Do you want to add to the bottom of your vimrc some options that\nmost users consider convenient for the Vim-R-plugin? [yes/no]: ") + let what = input("Do you want to add to the bottom of your vimrc some options that\nmost users consider convenient for the Vim-R-plugin? [y/N]: ") echohl Normal if what =~ "^[yY]" let vlines = readfile(uvimrc) @@ -84,7 +84,7 @@ function! RConfigVimrc() else let hasvimrc = 0 echohl Question - let what = input("It seems that you don't have a vimrc yet. Should I create it now? [yes/no]: ") + let what = input("It seems that you don't have a vimrc yet. Should I create it now? [y/N]: ") echohl Normal if what =~ "^[yY]" let vlines = [] @@ -124,7 +124,7 @@ function! RConfigVimrc() echo "By default, Vim's LocalLeader is the backslash (\\) which is problematic" echo "if we are editing LaTeX or Rnoweb (R+LaTeX) files." echohl Question - let what = input("Do you want to change the LocalLeader to a comma (,)? [yes/no]: ") + let what = input("Do you want to change the LocalLeader to a comma (,)? [y/N]: ") echohl Normal if what =~ "^[yY]" let vlines = vlines + ['" Change the key:', @@ -142,7 +142,7 @@ function! RConfigVimrc() echo "By default, you have to press Ctrl+X Ctrl+O to complete the names of" echo "functions and other objects. This is called omnicompletion." echohl Question - let what = input("Do you want to press Ctrl+Space to do omnicompletion? [yes/no]: ") + let what = input("Do you want to press Ctrl+Space to do omnicompletion? [y/N]: ") echohl Normal if what =~ "^[yY]" let vlines = vlines + ['" Use Ctrl+Space to do omnicompletion:', @@ -165,7 +165,7 @@ function! RConfigVimrc() echo "By default, you have to press \\d to send one line of code to R" echo "and \\ss to send a selection of lines." echohl Question - let what = input("Do you prefer to press the space bar to send lines and selections\nto R Console? [yes/no]: ") + let what = input("Do you prefer to press the space bar to send lines and selections\nto R Console? [y/N]: ") echohl Normal if what =~ "^[yY]" let vlines = vlines + ['" Press the space bar to send lines (in Normal mode) and selections to R:', @@ -177,7 +177,7 @@ function! RConfigVimrc() echo " " echohl Question - let what = input("Do you want to see your vimrc now? [yes/no]: ") + let what = input("Do you want to see your vimrc now? [y/N]: ") echohl Normal if what =~ "^[yY]" silent exe "tabnew " . uvimrc @@ -207,7 +207,7 @@ function! RConfigBash() echohl WarningMsg echo "Nothing was added to your ~/.bashrc because the string 'tvim' was found in it." echohl Question - let what = input("Do you want to see your ~/.bashrc along with the plugin\ntips on how to configure Bash? [yes/no]: ") + let what = input("Do you want to see your ~/.bashrc along with the plugin\ntips on how to configure Bash? [y/N]: ") echohl Normal if what =~ "^[yY]" silent exe "tabnew " . $HOME . "/.bashrc" @@ -221,7 +221,7 @@ function! RConfigBash() echo "The serverclient feature must be enabled for automatic update of the" echo "Object Browser and syntax highlight of function names." echohl Question - let what = input("Do you want that all these features are added to your .bashrc? [yes/no]: ") + let what = input("Do you want that all these features are added to your .bashrc? [y/N]: ") echohl Normal if what =~ "^[yY]" let blines = blines + [''] @@ -258,7 +258,7 @@ function! RConfigBash() \ 'fi' ] call writefile(blines, $HOME . "/.bashrc") echohl Question - let what = input("Do you want to see your .bashrc now? [yes/no]: ") + let what = input("Do you want to see your .bashrc now? [y/N]: ") echohl Normal if what =~ "^[yY]" silent exe "tabnew " . $HOME . "/.bashrc" @@ -276,7 +276,7 @@ function! RConfigTmux() echohl WarningMsg echo "You already have a .tmux.conf." echohl Question - let what = input("Do you want to see it along with the plugin tips on how to\nconfigure Tmux? [yes/no]: ") + let what = input("Do you want to see it along with the plugin tips on how to\nconfigure Tmux? [y/N]: ") echohl Normal if what =~ "^[yY]" silent exe "tabnew " . $HOME . "/.tmux.conf" @@ -285,7 +285,7 @@ function! RConfigTmux() redraw else echohl Question - let what = input("You don't have a ~/.tmux.conf yet. Should I create it now? [yes/no]: ") + let what = input("You don't have a ~/.tmux.conf yet. Should I create it now? [y/N]: ") echohl Normal if what =~ "^[yY]" let tlines = [''] @@ -306,7 +306,7 @@ function! RConfigTmux() call writefile(tlines, $HOME . "/.tmux.conf") echo " " echohl Question - let what = input("Do you want to see your .tmux.conf now? [yes/no]: ") + let what = input("Do you want to see your .tmux.conf now? [y/N]: ") echohl Normal if what =~ "^[yY]" silent exe "tabnew " . $HOME . "/.tmux.conf" From 710ac041e5041d507741ed8b0c766e222a07e7c0 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Fri, 8 Nov 2013 13:03:10 -0300 Subject: [PATCH 0530/1050] Load colorout first. --- r-plugin/Rconfig.R | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/r-plugin/Rconfig.R b/r-plugin/Rconfig.R index 68f0ac4..f6c84c3 100644 --- a/r-plugin/Rconfig.R +++ b/r-plugin/Rconfig.R @@ -18,15 +18,14 @@ if(file.exists(.rpf)){ } else { .rpflines <- "" } -if(length(grep("vimcom", .rpflines)) > 0){ +if(length(grep("library.*vimcom", .rpflines)) > 0 || length(grep("require.*vimcom", .rpflines) > 0)){ writeLines(c(.rpf, "vimcom_found"), con = paste0(Sys.getenv("VIMRPLUGIN_TMPDIR"), "/configR_result")) } else { .rpflines <- c(.rpflines, '', paste0('# Lines added by the Vim-R-plugin command :RpluginConfig (', format(Sys.time(), "%Y-%b-%d %H:%M"), '):'), - 'if(interactive()){', - ' library("vimcom.plus")') + 'if(interactive()){') if(.Platform$OS.type == "windows"){ .rpflines <- c(.rpflines, ' options(editor = \'"C:/Program Files (x86)/Vim/vim74/gvim.exe" "-c" "set filetype=r"\')') } else { @@ -44,7 +43,7 @@ if(length(grep("vimcom", .rpflines)) > 0){ ' }', ' library(setwidth)') } - .rpflines <- c(.rpflines, "}") + .rpflines <- c(.rpflines, ' library(vimcom.plus)', "}") writeLines(.rpflines, con = .rpf) writeLines(c(.rpf, "new_Rprofile"), con = paste0(Sys.getenv("VIMRPLUGIN_TMPDIR"), "/configR_result")) From bdf9fb642406fbb0eba41f7a0b7a45c1d597f963 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Fri, 8 Nov 2013 17:19:45 -0300 Subject: [PATCH 0531/1050] Don't start R and require "y" or "n" or . --- r-plugin/vimrconfig.vim | 55 ++++++++++++++++++++++++++++------------- 1 file changed, 38 insertions(+), 17 deletions(-) diff --git a/r-plugin/vimrconfig.vim b/r-plugin/vimrconfig.vim index 13043a4..4c398c5 100644 --- a/r-plugin/vimrconfig.vim +++ b/r-plugin/vimrconfig.vim @@ -8,6 +8,19 @@ function! RFindString(lll, sss) return 0 endfunction +function! RGetYesOrNo(ans) + if a:ans =~ "^[yY]" + return 1 + elseif a:ans =~ "^[nN]" || a:ans == "" + return 0 + else + echohl WarningMsg + let newans = input('Please, type "y", "n" or : ') + echohl Normal + return RGetYesOrNo(newans) + endif +endfunction + " Configure .Rprofile function! RConfigRprofile() call delete($VIMRPLUGIN_TMPDIR . "/configR_result") @@ -25,14 +38,14 @@ function! RConfigRprofile() echohl Question let what = input("Do you want to see your .Rprofile now? [y/N]: ") echohl Normal - if what =~ "^[yY]" + if RGetYesOrNo(what) silent exe "tabnew " . res[0] endif else echohl Question let what = input("Do you want to see your .Rprofile along with tips on how to\nconfigure it? [y/N]: ") echohl Normal - if what =~ "^[yY]" + if RGetYesOrNo(what) silent exe "tabnew " . res[0] silent help r-plugin-quick-R-setup endif @@ -75,7 +88,7 @@ function! RConfigVimrc() echohl Question let what = input("Do you want to add to the bottom of your vimrc some options that\nmost users consider convenient for the Vim-R-plugin? [y/N]: ") echohl Normal - if what =~ "^[yY]" + if RGetYesOrNo(what) let vlines = readfile(uvimrc) else redraw @@ -86,7 +99,7 @@ function! RConfigVimrc() echohl Question let what = input("It seems that you don't have a vimrc yet. Should I create it now? [y/N]: ") echohl Normal - if what =~ "^[yY]" + if RGetYesOrNo(what) let vlines = [] else redraw @@ -126,7 +139,7 @@ function! RConfigVimrc() echohl Question let what = input("Do you want to change the LocalLeader to a comma (,)? [y/N]: ") echohl Normal - if what =~ "^[yY]" + if RGetYesOrNo(what) let vlines = vlines + ['" Change the key:', \ 'let maplocalleader = ","'] endif @@ -144,7 +157,7 @@ function! RConfigVimrc() echohl Question let what = input("Do you want to press Ctrl+Space to do omnicompletion? [y/N]: ") echohl Normal - if what =~ "^[yY]" + if RGetYesOrNo(what) let vlines = vlines + ['" Use Ctrl+Space to do omnicompletion:', \ 'if has("gui_running")', \ ' inoremap ', @@ -167,7 +180,7 @@ function! RConfigVimrc() echohl Question let what = input("Do you prefer to press the space bar to send lines and selections\nto R Console? [y/N]: ") echohl Normal - if what =~ "^[yY]" + if RGetYesOrNo(what) let vlines = vlines + ['" Press the space bar to send lines (in Normal mode) and selections to R:', \ 'vmap RDSendSelection', \ 'nmap RDSendLine'] @@ -179,7 +192,7 @@ function! RConfigVimrc() echohl Question let what = input("Do you want to see your vimrc now? [y/N]: ") echohl Normal - if what =~ "^[yY]" + if RGetYesOrNo(what) silent exe "tabnew " . uvimrc normal! G endif @@ -209,7 +222,7 @@ function! RConfigBash() echohl Question let what = input("Do you want to see your ~/.bashrc along with the plugin\ntips on how to configure Bash? [y/N]: ") echohl Normal - if what =~ "^[yY]" + if RGetYesOrNo(what) silent exe "tabnew " . $HOME . "/.bashrc" silent help r-plugin-quick-bash-setup endif @@ -223,7 +236,7 @@ function! RConfigBash() echohl Question let what = input("Do you want that all these features are added to your .bashrc? [y/N]: ") echohl Normal - if what =~ "^[yY]" + if RGetYesOrNo(what) let blines = blines + [''] if exists("*strftime") let blines = blines + ['# Lines added by the Vim-R-plugin command :RpluginConfig (' . strftime("%Y-%b-%d %H:%M") . '):'] @@ -260,7 +273,7 @@ function! RConfigBash() echohl Question let what = input("Do you want to see your .bashrc now? [y/N]: ") echohl Normal - if what =~ "^[yY]" + if RGetYesOrNo(what) silent exe "tabnew " . $HOME . "/.bashrc" normal! G27k endif @@ -278,7 +291,7 @@ function! RConfigTmux() echohl Question let what = input("Do you want to see it along with the plugin tips on how to\nconfigure Tmux? [y/N]: ") echohl Normal - if what =~ "^[yY]" + if RGetYesOrNo(what) silent exe "tabnew " . $HOME . "/.tmux.conf" silent help r-plugin-quick-tmux-setup endif @@ -287,7 +300,7 @@ function! RConfigTmux() echohl Question let what = input("You don't have a ~/.tmux.conf yet. Should I create it now? [y/N]: ") echohl Normal - if what =~ "^[yY]" + if RGetYesOrNo(what) let tlines = [''] if exists("*strftime") let tlines = tlines + ['# Lines added by the Vim-R-plugin command :RpluginConfig (' . strftime("%Y-%b-%d %H:%M") . '):'] @@ -308,7 +321,7 @@ function! RConfigTmux() echohl Question let what = input("Do you want to see your .tmux.conf now? [y/N]: ") echohl Normal - if what =~ "^[yY]" + if RGetYesOrNo(what) silent exe "tabnew " . $HOME . "/.tmux.conf" endif redraw @@ -318,11 +331,19 @@ endfunction function! RConfigVimR() if string(g:SendCmdToR) == "function('SendCmdToR_fake')" - call StartR("R") + if hasmapto("RStart", "n") + let cmd = RNMapCmd("RStart") + else + if exists("g:maplocalleader") + let cmd = g:maplocalleader . "rf" + else + let cmd = "\\rf" + endif + endif echohl WarningMsg - echo "Please wait..." + echomsg "Please type " . cmd . " to start R before running :RpluginConfig" echohl Normal - sleep 2 + return endif if RConfigRprofile() return From 1ac3b8908211ba6ce2346650879c3a5ba8392131 Mon Sep 17 00:00:00 2001 From: Michael Lerch Date: Fri, 8 Nov 2013 17:38:30 -0700 Subject: [PATCH 0532/1050] option to set maximum help text width --- doc/r-plugin.txt | 6 ++++++ r-plugin/common_global.vim | 3 +++ 2 files changed, 9 insertions(+) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index e4f9eb6..6a36a9d 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -928,6 +928,7 @@ is running: |vimrplugin_vimpager| Use Vim to see R documentation |vimrplugin_editor_w| Minimum width of R script buffer |vimrplugin_help_w| Desired width of R documentation buffer +|vimrplugin_htw| Maximum text width of R documentation |vimrplugin_i386| Use 32 bit version of R |vimrplugin_r_path| Directory where R is |vimrplugin_r_args| Arguments to pass to R @@ -1065,6 +1066,7 @@ work on the Object Browser (you will see the message "Cmd not available"). *vimrplugin_vimpager* *vimrplugin_editor_w* *vimrplugin_help_w* + *vimrplugin_htw* 6.5.1. Quick setup~ If you do not want to see R documentation in a Vim's buffer, put in your @@ -1107,6 +1109,10 @@ values to some variables in your |vimrc|, as in the example: let vimrplugin_editor_w = 80 let vimrplugin_editor_h = 60 < +To set the maximum text width of the documentation, use vimrplugin_htw as in +> + let vimrplugin_htw = 80 +< 6.6. Use 32 bit version of R (Windows and Mac OS X only)~ *vimrplugin_i386* diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index e937867..10c84a9 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -2029,6 +2029,9 @@ function SetRTextWidth() exe "language " . curlang endif endif + if exists('g:vimrplugin_htw') && g:vimrplugin_htw < g:rplugin_htw + let g:rplugin_htw = g:vimrplugin_htw + endif endfunction function RGetClassFor(rkeyword) From 8a7285bdd49bfd7ef56759cf2e24ea5c1c388f2d Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 9 Nov 2013 10:13:30 -0300 Subject: [PATCH 0533/1050] Update. --- doc/r-plugin.txt | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index e4f9eb6..04d9da6 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -167,8 +167,8 @@ files, you have to press the space bar a few times to finish the installation). You should, then, quit Vim. Start Vim again and edit an R script. Type rf to start R and run -the command below to get help configuring ~/.vimrc, ~/.bashrc, ~/.tmux.conf -and ~/.Rprofile (the is `\` by default): +the command below to get help configuring ~/.Rprofile, ~/.vimrc, ~/.tmux.conf, +and ~/.bashrc (the is `\` by default): > :RpluginConfig < @@ -238,17 +238,19 @@ choose "Edit with Vim" or create a new one with the Normal mode command: > :e example.R < -To finish the installation, start R and click on the menu bar +To finish the installation, you have to start R to run a configuration script. +Please, click on the menu bar > R Start/Close Start R (default) < -and, finally, do in Vim: +and, finally, click on the menu bar > - :RpluginConfig + R + Configure (Vim-R) < -The above command will guide you through additional configuration steps. You +The above command will guide you through additional configuration steps. If you are already an experienced Vim user, instead of running the above command you may preffer to read |r-plugin-Rprofile-Windows|. From 6c69c57d08c3aafde668d19128af26ea4c37c107 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 9 Nov 2013 10:29:51 -0300 Subject: [PATCH 0534/1050] Fix maximum width of R documentation. --- r-plugin/common_global.vim | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index bb994ef..52d66dc 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -2001,18 +2001,17 @@ function SetRTextWidth() endif if s:vimpager == "horizontal" - " Use the window width (at most 80 columns) - let htwf = (wwidth > 80) ? 88.1 : ((wwidth - 1) / 0.9) + " Use the window width (at most g:vimrplugin_htw columns) + let htwf = (wwidth > g:vimrplugin_htw) ? 88.1 : ((wwidth - 1) / 0.9) elseif g:vimrplugin_vimpager == "tab" || g:vimrplugin_vimpager == "tabnew" let wwidth = &columns - let htwf = (wwidth > 80) ? 88.1 : ((wwidth - 1) / 0.9) + let htwf = (wwidth > g:vimrplugin_htw) ? 88.1 : ((wwidth - 1) / 0.9) else - let min_e = (g:vimrplugin_editor_w > 80) ? g:vimrplugin_editor_w : 80 + let min_e = (g:vimrplugin_editor_w > g:vimrplugin_htw) ? g:vimrplugin_editor_w : g:vimrplugin_htw let min_h = (g:vimrplugin_help_w > 73) ? g:vimrplugin_help_w : 73 if wwidth > (min_e + min_h) - " The editor window is large enough to be split as either >80+73 or - " the user defined minimum values + " The editor window is large enough to be split let s:hwidth = min_h elseif wwidth > (min_e + g:vimrplugin_help_w) " The help window must have less than min_h columns @@ -2029,9 +2028,6 @@ function SetRTextWidth() exe "language " . curlang endif endif - if exists('g:vimrplugin_htw') && g:vimrplugin_htw < g:rplugin_htw - let g:rplugin_htw = g:vimrplugin_htw - endif endfunction function RGetClassFor(rkeyword) @@ -3125,6 +3121,7 @@ call RSetDefaultValue("g:vimrplugin_only_in_tmux", 0) call RSetDefaultValue("g:vimrplugin_routnotab", 0) call RSetDefaultValue("g:vimrplugin_editor_w", 66) call RSetDefaultValue("g:vimrplugin_help_w", 46) +call RSetDefaultValue("g:vimrplugin_htw", 80) call RSetDefaultValue("g:vimrplugin_objbr_w", 40) call RSetDefaultValue("g:vimrplugin_external_ob", 0) call RSetDefaultValue("g:vimrplugin_show_args", 0) From 0ec874ec8e3488080e7494ba551fe9a53c611619 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 9 Nov 2013 19:06:55 -0300 Subject: [PATCH 0535/1050] Update highlighting of functions on BufEnter. --- r-plugin/common_buffer.vim | 2 ++ r-plugin/common_global.vim | 30 +++++++----------- syntax/r.vim | 64 +++++++++++++++++++++++++++++++++----- 3 files changed, 70 insertions(+), 26 deletions(-) diff --git a/r-plugin/common_buffer.vim b/r-plugin/common_buffer.vim index 33ff8db..053d92e 100644 --- a/r-plugin/common_buffer.vim +++ b/r-plugin/common_buffer.vim @@ -70,3 +70,5 @@ if !exists("g:SendCmdToR") let g:SendCmdToR = function('SendCmdToR_fake') endif +autocmd BufEnter call RUpdateFunSyntax(0) + diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 52d66dc..735f8a3 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -1922,7 +1922,7 @@ endfunction function RAddToLibList(nlib, verbose) if isdirectory(g:rplugin_uservimfiles . "/r-plugin/objlist") - let omf = split(glob(g:rplugin_uservimfiles . "/r-plugin/objlist/omnils_" . a:nlib . "_*"), "\n") + let omf = split(globpath(&rtp, 'r-plugin/objlist/omnils_' . a:nlib . '_*'), "\n") if len(omf) == 1 let nlist = readfile(omf[0]) @@ -1936,24 +1936,15 @@ function RAddToLibList(nlib, verbose) call add(s:list_of_objs, xxx[0]) endif endfor - - let fnf = split(glob(g:rplugin_uservimfiles . "/r-plugin/objlist/fun_" . a:nlib . "_*"), "\n") - if len(fnf) == 1 - " List of functions for syntax highlith - silent exe "source " . fnf[0] - elseif a:verbose && len(fnf) == 0 - call RWarningMsg('Fun_ file for "' . a:nlib . '" not found.') - return - elseif a:verbose && len(fnf) > 1 - call RWarningMsg('There is more than one fun_ file for "' . a:nlib . '".') - return - endif elseif a:verbose && len(omf) == 0 call RWarningMsg('Omnils file for "' . a:nlib . '" not found.') call RRemoveFromLibls(a:nlib) return elseif a:verbose && len(omf) > 1 call RWarningMsg('There is more than one omnils file for "' . a:nlib . '".') + for obl in omf + call RWarningMsg(obl) + endfor call RRemoveFromLibls(a:nlib) return endif @@ -1977,6 +1968,10 @@ function RFillLibList() endif endfor endif + + if exists("*RUpdateFunSyntax") + call RUpdateFunSyntax(0) + endif endfunction function SetRTextWidth() @@ -3520,12 +3515,9 @@ let g:needsnewomnilist = 0 let g:rplugin_libls = split(g:vimrplugin_permanent_libs, ",") let g:rplugin_liblist = [] let s:list_of_objs = [] -if exists("b:current_syntax") - " The syntax/r.vim was read before this script - for lib in g:rplugin_libls - call RAddToLibList(lib, 0) - endfor -endif +for lib in g:rplugin_libls + call RAddToLibList(lib, 0) +endfor " Check whether tool bar icons exist if has("win32") || has("win64") diff --git a/syntax/r.vim b/syntax/r.vim index dce63a1..7feac28 100644 --- a/syntax/r.vim +++ b/syntax/r.vim @@ -3,7 +3,7 @@ " Maintainer: Jakson Aquino " Former Maintainers: Vaidotas Zemlys " Tom Payne -" Last Change: Wed Nov 06, 2013 10:00AM +" Last Change: Sat Nov 09, 2013 06:36PM " Filenames: *.R *.r *.Rhistory *.Rt " " NOTE: The highlighting of R functions is defined in the @@ -150,13 +150,63 @@ syn match rBraceError "[)}]" contained syn match rCurlyError "[)\]]" contained syn match rParenError "[\]}]" contained -" Source list of R functions. The list is produced by the Vim-R-plugin +" Source lists of R functions. The lists are produced by the Vim-R-plugin " http://www.vim.org/scripts/script.php?script_id=2628 -if exists("g:rplugin_libls") && exists("*RAddToLibList") - for lib in g:rplugin_libls - call RAddToLibList(lib, 0) - endfor +if !exists("g:vimrplugin_permanent_libs") + let g:vimrplugin_permanent_libs = "base,stats,graphics,grDevices,utils,datasets,methods" endif +let b:rplugin_funls = [] + +function! RAddToFunList(lib, verbose) + " Only run once for each package: + for pkg in b:rplugin_funls + if pkg == a:lib + return + endif + endfor + + " The fun_ files list functions of R packages and are created by the + " Vim-R-plugin: + let fnf = split(globpath(&rtp, 'r-plugin/objlist/fun_' . a:lib . '_*'), "\n") + + if len(fnf) == 1 + silent exe "source " . fnf[0] + let b:rplugin_funls += [a:lib] + elseif a:verbose && len(fnf) == 0 + echohl WarningMsg + echomsg 'Fun_ file for "' . a:lib . '" not found.' + echohl Normal + return + elseif a:verbose && len(fnf) > 1 + echohl WarningMsg + echomsg 'There is more than one fun_ file for "' . a:lib . '":' + for fff in fnf + echomsg fff + endfor + echohl Normal + return + endif +endfunction + +function! RUpdateFunSyntax(verbose) + " Do nothing if called at a buffer that doesn't include R syntax: + if !exists("b:rplugin_funls") + return + endif + if exists("g:rplugin_libls") + for lib in g:rplugin_libls + call RAddToFunList(lib, a:verbose) + endfor + else + if exists("g:vimrplugin_permanent_libs") + for lib in split(g:vimrplugin_permanent_libs, ",") + call RAddToFunList(lib, a:verbose) + endfor + endif + endif +endfunction + +call RUpdateFunSyntax(0) syn match rDollar display contained "\$" syn match rDollar display contained "@" @@ -224,4 +274,4 @@ hi def link rOKeyword Title let b:current_syntax="r" -" vim: ts=8 sw=2 +" vim: ts=8 sw=4 From 5b29c0fed8b46b54c14ad8ed162412dc83dfbe15 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 9 Nov 2013 19:30:26 -0300 Subject: [PATCH 0536/1050] Set shift width to 4. --- syntax/r.vim | 46 +++++++++++++++++----------------- syntax/rbrowser.vim | 53 ++++++++++++++++++++------------------- syntax/rdoc.vim | 8 +++--- syntax/rhelp.vim | 61 +++++++++++++++++++++++---------------------- syntax/rmd.vim | 4 ++- syntax/rout.vim | 50 +++++++++++++++++++------------------ syntax/rrst.vim | 4 ++- 7 files changed, 117 insertions(+), 109 deletions(-) diff --git a/syntax/r.vim b/syntax/r.vim index 7feac28..eae4368 100644 --- a/syntax/r.vim +++ b/syntax/r.vim @@ -3,7 +3,7 @@ " Maintainer: Jakson Aquino " Former Maintainers: Vaidotas Zemlys " Tom Payne -" Last Change: Sat Nov 09, 2013 06:36PM +" Last Change: Sat Nov 09, 2013 07:27PM " Filenames: *.R *.r *.Rhistory *.Rt " " NOTE: The highlighting of R functions is defined in the @@ -18,13 +18,13 @@ " Some lines of code were borrowed from Zhuojun Chen. if exists("b:current_syntax") - finish + finish endif setlocal iskeyword=@,48-57,_,. if exists("g:r_syntax_folding") - setlocal foldmethod=syntax + setlocal foldmethod=syntax endif syn case match @@ -43,15 +43,15 @@ syn match rOComment contains=@Spell,rOKeyword "#'.*" if &filetype == "rhelp" - " string enclosed in double quotes - syn region rString contains=rSpecial,@Spell start=/"/ skip=/\\\\\|\\"/ end=/"/ - " string enclosed in single quotes - syn region rString contains=rSpecial,@Spell start=/'/ skip=/\\\\\|\\'/ end=/'/ + " string enclosed in double quotes + syn region rString contains=rSpecial,@Spell start=/"/ skip=/\\\\\|\\"/ end=/"/ + " string enclosed in single quotes + syn region rString contains=rSpecial,@Spell start=/'/ skip=/\\\\\|\\'/ end=/'/ else - " string enclosed in double quotes - syn region rString contains=rSpecial,rStrError,@Spell start=/"/ skip=/\\\\\|\\"/ end=/"/ - " string enclosed in single quotes - syn region rString contains=rSpecial,rStrError,@Spell start=/'/ skip=/\\\\\|\\'/ end=/'/ + " string enclosed in double quotes + syn region rString contains=rSpecial,rStrError,@Spell start=/"/ skip=/\\\\\|\\"/ end=/"/ + " string enclosed in single quotes + syn region rString contains=rSpecial,rStrError,@Spell start=/'/ skip=/\\\\\|\\'/ end=/'/ endif syn match rStrError display contained "\\." @@ -116,9 +116,9 @@ syn match rOperator '\*' syn match rOperator '+' syn match rOperator '=' if &filetype != "rmd" && &filetype != "rrst" - syn match rOperator "[|!<>^~/:]" + syn match rOperator "[|!<>^~/:]" else - syn match rOperator "[|!<>^~`/:]" + syn match rOperator "[|!<>^~`/:]" endif syn match rOperator "%\{2}\|%\S*%" syn match rOpError '\*\{3}' @@ -136,13 +136,13 @@ syn match rDelimiter "[,;:]" " Error if exists("g:r_syntax_folding") - syn region rRegion matchgroup=Delimiter start=/(/ matchgroup=Delimiter end=/)/ transparent contains=ALLBUT,rError,rBraceError,rCurlyError fold - syn region rRegion matchgroup=Delimiter start=/{/ matchgroup=Delimiter end=/}/ transparent contains=ALLBUT,rError,rBraceError,rParenError fold - syn region rRegion matchgroup=Delimiter start=/\[/ matchgroup=Delimiter end=/]/ transparent contains=ALLBUT,rError,rCurlyError,rParenError fold + syn region rRegion matchgroup=Delimiter start=/(/ matchgroup=Delimiter end=/)/ transparent contains=ALLBUT,rError,rBraceError,rCurlyError fold + syn region rRegion matchgroup=Delimiter start=/{/ matchgroup=Delimiter end=/}/ transparent contains=ALLBUT,rError,rBraceError,rParenError fold + syn region rRegion matchgroup=Delimiter start=/\[/ matchgroup=Delimiter end=/]/ transparent contains=ALLBUT,rError,rCurlyError,rParenError fold else - syn region rRegion matchgroup=Delimiter start=/(/ matchgroup=Delimiter end=/)/ transparent contains=ALLBUT,rError,rBraceError,rCurlyError - syn region rRegion matchgroup=Delimiter start=/{/ matchgroup=Delimiter end=/}/ transparent contains=ALLBUT,rError,rBraceError,rParenError - syn region rRegion matchgroup=Delimiter start=/\[/ matchgroup=Delimiter end=/]/ transparent contains=ALLBUT,rError,rCurlyError,rParenError + syn region rRegion matchgroup=Delimiter start=/(/ matchgroup=Delimiter end=/)/ transparent contains=ALLBUT,rError,rBraceError,rCurlyError + syn region rRegion matchgroup=Delimiter start=/{/ matchgroup=Delimiter end=/}/ transparent contains=ALLBUT,rError,rBraceError,rParenError + syn region rRegion matchgroup=Delimiter start=/\[/ matchgroup=Delimiter end=/]/ transparent contains=ALLBUT,rError,rCurlyError,rParenError endif syn match rError "[)\]}]" @@ -228,13 +228,13 @@ syn keyword rType array category character complex double function integer list " Name of object with spaces if &filetype != "rmd" && &filetype != "rrst" - syn region rNameWSpace start="`" end="`" + syn region rNameWSpace start="`" end="`" endif if &filetype == "rhelp" - syn match rhPreProc "^#ifdef.*" - syn match rhPreProc "^#endif.*" - syn match rhSection "\\dontrun\>" + syn match rhPreProc "^#ifdef.*" + syn match rhPreProc "^#endif.*" + syn match rhSection "\\dontrun\>" endif " Define the default highlighting. diff --git a/syntax/rbrowser.vim b/syntax/rbrowser.vim index e6e62e7..2e0d9b6 100644 --- a/syntax/rbrowser.vim +++ b/syntax/rbrowser.vim @@ -3,34 +3,34 @@ " Maintainer: Jakson Alves de Aquino (jalvesaq@gmail.com) if exists("b:current_syntax") - finish + finish endif scriptencoding utf-8 setlocal iskeyword=@,48-57,_,. if has("conceal") - setlocal conceallevel=2 - setlocal concealcursor=nvc - syn match rbrowserNumeric "{#.*\t" contains=rbrowserDelim,rbrowserTab - syn match rbrowserCharacter /"#.*\t/ contains=rbrowserDelim,rbrowserTab - syn match rbrowserFactor "'#.*\t" contains=rbrowserDelim,rbrowserTab - syn match rbrowserFunction "(#.*\t" contains=rbrowserDelim,rbrowserTab - syn match rbrowserList "\[#.*\t" contains=rbrowserDelim,rbrowserTab - syn match rbrowserLogical "%#.*\t" contains=rbrowserDelim,rbrowserTab - syn match rbrowserLibrary "##.*\t" contains=rbrowserDelim,rbrowserTab - syn match rbrowserS4 "<#.*\t" contains=rbrowserDelim,rbrowserTab - syn match rbrowserUnknown "=#.*\t" contains=rbrowserDelim,rbrowserTab + setlocal conceallevel=2 + setlocal concealcursor=nvc + syn match rbrowserNumeric "{#.*\t" contains=rbrowserDelim,rbrowserTab + syn match rbrowserCharacter /"#.*\t/ contains=rbrowserDelim,rbrowserTab + syn match rbrowserFactor "'#.*\t" contains=rbrowserDelim,rbrowserTab + syn match rbrowserFunction "(#.*\t" contains=rbrowserDelim,rbrowserTab + syn match rbrowserList "\[#.*\t" contains=rbrowserDelim,rbrowserTab + syn match rbrowserLogical "%#.*\t" contains=rbrowserDelim,rbrowserTab + syn match rbrowserLibrary "##.*\t" contains=rbrowserDelim,rbrowserTab + syn match rbrowserS4 "<#.*\t" contains=rbrowserDelim,rbrowserTab + syn match rbrowserUnknown "=#.*\t" contains=rbrowserDelim,rbrowserTab else - syn match rbrowserNumeric "{.*\t" contains=rbrowserDelim,rbrowserTab - syn match rbrowserCharacter /".*\t/ contains=rbrowserDelim,rbrowserTab - syn match rbrowserFactor "'.*\t" contains=rbrowserDelim,rbrowserTab - syn match rbrowserFunction "(.*\t" contains=rbrowserDelim,rbrowserTab - syn match rbrowserList "\[.*\t" contains=rbrowserDelim,rbrowserTab - syn match rbrowserLogical "%.*\t" contains=rbrowserDelim,rbrowserTab - syn match rbrowserLibrary "#.*\t" contains=rbrowserDelim,rbrowserTab - syn match rbrowserS4 "<.*\t" contains=rbrowserDelim,rbrowserTab - syn match rbrowserUnknown "=.*\t" contains=rbrowserDelim,rbrowserTab + syn match rbrowserNumeric "{.*\t" contains=rbrowserDelim,rbrowserTab + syn match rbrowserCharacter /".*\t/ contains=rbrowserDelim,rbrowserTab + syn match rbrowserFactor "'.*\t" contains=rbrowserDelim,rbrowserTab + syn match rbrowserFunction "(.*\t" contains=rbrowserDelim,rbrowserTab + syn match rbrowserList "\[.*\t" contains=rbrowserDelim,rbrowserTab + syn match rbrowserLogical "%.*\t" contains=rbrowserDelim,rbrowserTab + syn match rbrowserLibrary "#.*\t" contains=rbrowserDelim,rbrowserTab + syn match rbrowserS4 "<.*\t" contains=rbrowserDelim,rbrowserTab + syn match rbrowserUnknown "=.*\t" contains=rbrowserDelim,rbrowserTab endif syn match rbrowserEnv "^.GlobalEnv " syn match rbrowserEnv "^Libraries " @@ -40,16 +40,16 @@ syn match rbrowserTreePart "├─" syn match rbrowserTreePart "└─" syn match rbrowserTreePart "│" if &encoding != "utf-8" - syn match rbrowserTreePart "|" - syn match rbrowserTreePart "`-" - syn match rbrowserTreePart "|-" + syn match rbrowserTreePart "|" + syn match rbrowserTreePart "`-" + syn match rbrowserTreePart "|-" endif syn match rbrowserTab contained "\t" if has("conceal") - syn match rbrowserDelim contained /'#\|"#\|(#\|\[#\|{#\|%#\|##\|<#\|=#/ conceal + syn match rbrowserDelim contained /'#\|"#\|(#\|\[#\|{#\|%#\|##\|<#\|=#/ conceal else - syn match rbrowserDelim contained /'\|"\|(\|\[\|{\|%\|#\|<\|=/ + syn match rbrowserDelim contained /'\|"\|(\|\[\|{\|%\|#\|<\|=/ endif hi def link rbrowserEnv Statement @@ -68,3 +68,4 @@ hi def link rbrowserTreePart Comment hi def link rbrowserDelim Ignore hi def link rbrowserTab Ignore +" vim: ts=8 sw=4 diff --git a/syntax/rdoc.vim b/syntax/rdoc.vim index a0fbb5d..7efaeeb 100644 --- a/syntax/rdoc.vim +++ b/syntax/rdoc.vim @@ -3,16 +3,16 @@ " Maintainer: Jakson A. Aquino if exists("b:current_syntax") - finish + finish endif setlocal iskeyword=@,48-57,_,. if !exists("rdoc_minlines") - let rdoc_minlines = 200 + let rdoc_minlines = 200 endif if !exists("rdoc_maxlines") - let rdoc_maxlines = 2 * rdoc_minlines + let rdoc_maxlines = 2 * rdoc_minlines endif exec "syn sync minlines=" . rdoc_minlines . " maxlines=" . rdoc_maxlines @@ -57,4 +57,4 @@ hi def link rdocFuncName Function let b:current_syntax = "rdoc" -" vim:ts=8 sts=2 sw=2: +" vim: ts=8 sw=4 diff --git a/syntax/rhelp.vim b/syntax/rhelp.vim index 3ac5377..70eb16f 100644 --- a/syntax/rhelp.vim +++ b/syntax/rhelp.vim @@ -2,7 +2,7 @@ " Language: R Help File " Maintainer: Jakson Aquino " Former Maintainer: Johannes Ranke -" Last Change: Sat Jul 06, 2013 07:45PM +" Last Change: Sat Nov 09, 2013 07:29PM " Remarks: - Includes R syntax highlighting in the appropriate " sections if an r.vim file is in the same directory or in the " default debian location. @@ -16,9 +16,9 @@ " For version 5.x: Clear all syntax items " For version 6.x and 7.x: Quit when a syntax file was already loaded if version < 600 - syntax clear + syntax clear elseif exists("b:current_syntax") - finish + finish endif setlocal iskeyword=@,48-57,_,. @@ -214,33 +214,34 @@ syn match rhelpParenError /[\]}]/ contained " For version 5.7 and earlier: only when not done already " For version 5.8 and later: only when an item doesn't have highlighting yet if version >= 508 || !exists("did_rhelp_syntax_inits") - if version < 508 - let did_rhelp_syntax_inits = 1 - command -nargs=+ HiLink hi link - else - command -nargs=+ HiLink hi def link - endif - HiLink rhelpVerbatim String - HiLink rhelpDelimiter Delimiter - HiLink rhelpIdentifier Identifier - HiLink rhelpString String - HiLink rhelpCodeSpecial Special - HiLink rhelpKeyword Keyword - HiLink rhelpDots Keyword - HiLink rhelpLink Underlined - HiLink rhelpType Type - HiLink rhelpSection PreCondit - HiLink rhelpError Error - HiLink rhelpBraceError Error - HiLink rhelpCurlyError Error - HiLink rhelpParenError Error - HiLink rhelpPreProc PreProc - HiLink rhelpDelimiter Delimiter - HiLink rhelpComment Comment - HiLink rhelpRComment Comment - HiLink rhelpSpecialChar SpecialChar - delcommand HiLink + if version < 508 + let did_rhelp_syntax_inits = 1 + command -nargs=+ HiLink hi link + else + command -nargs=+ HiLink hi def link + endif + HiLink rhelpVerbatim String + HiLink rhelpDelimiter Delimiter + HiLink rhelpIdentifier Identifier + HiLink rhelpString String + HiLink rhelpCodeSpecial Special + HiLink rhelpKeyword Keyword + HiLink rhelpDots Keyword + HiLink rhelpLink Underlined + HiLink rhelpType Type + HiLink rhelpSection PreCondit + HiLink rhelpError Error + HiLink rhelpBraceError Error + HiLink rhelpCurlyError Error + HiLink rhelpParenError Error + HiLink rhelpPreProc PreProc + HiLink rhelpDelimiter Delimiter + HiLink rhelpComment Comment + HiLink rhelpRComment Comment + HiLink rhelpSpecialChar SpecialChar + delcommand HiLink endif let b:current_syntax = "rhelp" -" vim: foldmethod=marker: + +" vim: foldmethod=marker sw=4 diff --git a/syntax/rmd.vim b/syntax/rmd.vim index 02429a6..26c6f23 100644 --- a/syntax/rmd.vim +++ b/syntax/rmd.vim @@ -1,6 +1,6 @@ " markdown Text with R statements " Language: markdown with R code chunks -" Last Change: Thu Sep 05, 2013 06:35PM +" Last Change: Sat Nov 09, 2013 07:28PM " " CONFIGURATION: " To highlight chunk headers as R code, put in your vimrc: @@ -81,3 +81,5 @@ hi def link rmdBlockQuote Comment hi def link rmdSlidifySpecial Special let b:current_syntax = "rmd" + +" vim: ts=8 sw=4 diff --git a/syntax/rout.vim b/syntax/rout.vim index ce62e61..9b928a6 100644 --- a/syntax/rout.vim +++ b/syntax/rout.vim @@ -1,16 +1,16 @@ " Vim syntax file " Language: R output Files " Maintainer: Jakson Aquino -" Last Change: Tue Aug 20, 2013 12:52PM +" Last Change: Sat Nov 09, 2013 07:29PM " " Version Clears: {{{1 " For version 5.x: Clear all syntax items " For version 6.x and 7.x: Quit when a syntax file was already loaded if version < 600 - syntax clear + syntax clear elseif exists("b:current_syntax") - finish + finish endif setlocal iskeyword=@,48-57,_,. @@ -51,17 +51,17 @@ syn match rComplex "\<\.\d\+\([Ee][-+]\=\d\+\)\=i" syn match rComplex "\<\d\+[Ee][-+]\=\d\+i" if !exists("g:vimrplugin_routmorecolors") - let g:vimrplugin_routmorecolors = 0 + let g:vimrplugin_routmorecolors = 0 endif if g:vimrplugin_routmorecolors == 1 - syn include @routR syntax/r.vim - syn region routColoredR start="^> " end='$' contains=@routR keepend - syn region routColoredR start="^+ " end='$' contains=@routR keepend + syn include @routR syntax/r.vim + syn region routColoredR start="^> " end='$' contains=@routR keepend + syn region routColoredR start="^+ " end='$' contains=@routR keepend else - " Comment - syn match routComment /^> .*/ - syn match routComment /^+ .*/ + " Comment + syn match routComment /^> .*/ + syn match routComment /^+ .*/ endif " Index of vectors @@ -72,27 +72,27 @@ syn match routError "^Error.*" syn match routWarn "^Warning.*" if v:lang =~ "^de" - syn match routError "^Fehler.*" - syn match routWarn "^Warnung.*" + syn match routError "^Fehler.*" + syn match routWarn "^Warnung.*" endif if v:lang =~ "^es" - syn match routWarn "^Aviso.*" + syn match routWarn "^Aviso.*" endif if v:lang =~ "^fr" - syn match routError "^Erreur.*" - syn match routWarn "^Avis.*" + syn match routError "^Erreur.*" + syn match routWarn "^Avis.*" endif if v:lang =~ "^it" - syn match routError "^Errore.*" - syn match routWarn "^Avviso.*" + syn match routError "^Errore.*" + syn match routWarn "^Avviso.*" endif if v:lang =~ "^nn" - syn match routError "^Feil.*" - syn match routWarn "^Åtvaring.*" + syn match routError "^Feil.*" + syn match routWarn "^Åtvaring.*" endif if v:lang =~ "^pl" @@ -102,13 +102,13 @@ if v:lang =~ "^pl" endif if v:lang =~ "^pt_BR" - syn match routError "^Erro.*" - syn match routWarn "^Aviso.*" + syn match routError "^Erro.*" + syn match routWarn "^Aviso.*" endif if v:lang =~ "^ru" - syn match routError "^Ошибка.*" - syn match routWarn "^Предупреждение.*" + syn match routError "^Ошибка.*" + syn match routWarn "^Предупреждение.*" endif if v:lang =~ "^tr" @@ -118,7 +118,7 @@ endif " Define the default highlighting. if g:vimrplugin_routmorecolors == 0 - hi def link routComment Comment + hi def link routComment Comment endif hi def link rNumber Number hi def link rComplex Number @@ -132,3 +132,5 @@ hi def link routWarn WarningMsg hi def link routIndex Special let b:current_syntax = "rout" + +" vim: ts=8 sw=4 diff --git a/syntax/rrst.vim b/syntax/rrst.vim index 8275a4e..7247407 100644 --- a/syntax/rrst.vim +++ b/syntax/rrst.vim @@ -1,7 +1,7 @@ " reStructured Text with R statements " Language: reST with R code chunks " Maintainer: Alex Zvoleff, azvoleff@mail.sdsu.edu -" Last Change: Tue Feb 26, 2013 01:13PM +" Last Change: Sat Nov 09, 2013 07:28PM " " CONFIGURATION: " To highlight chunk headers as R code, put in your vimrc: @@ -43,3 +43,5 @@ hi def link rrstChunkDelim Special hi def link rrstInlineDelim Special let b:current_syntax = "rrst" + +" vim: ts=8 sw=4 From bf15f003e469da6c1755bad5c2c9a4e61e712bc4 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 9 Nov 2013 19:34:02 -0300 Subject: [PATCH 0537/1050] Don't include version number in vimball file name. --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 2d01df2..7a2ccd3 100644 --- a/Makefile +++ b/Makefile @@ -33,8 +33,8 @@ vimball: sed -i -e "s/^Version: [0-9].[0-9].[0-9].[0-9]/Version: $(PLUGINVERSION)/" doc/r-plugin.txt sed -i -e "s/vim-r-plugin_[0-9].[0-9].[0-9].[0-9].vmb/vim-r-plugin_$(PLUGINVERSION).vmb/" doc/r-plugin.txt sed -i -e "s/^$(PLUGINVERSION) (201[0-9]-[0-9][0-9]-[0-9][0-9])$$/$(PLUGINVERSION) ($(PLUGINRELEASEDATE))/" doc/r-plugin.txt - vim -c "%MkVimball vim-r-plugin_$(PLUGINVERSION) ." -c "q" list_for_vimball - mv vim-r-plugin_$(PLUGINVERSION).vmb /tmp + vim -c "%MkVimball vim-r-plugin ." -c "q" list_for_vimball + mv vim-r-plugin.vmb /tmp deb: # Clean previously created files From ae264c559bb8148767728c67fe662166b6cda745 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 9 Nov 2013 19:48:23 -0300 Subject: [PATCH 0538/1050] Consider 'number' while calculating window width. If the user has set the 'number' option the real window width will be less than the value reported by winwdith(0). --- r-plugin/common_global.vim | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 735f8a3..24d5361 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -1988,7 +1988,12 @@ function SetRTextWidth() " and to decide whether to obey vimrplugin_vimpager = 'vertical' let s:vimpager = g:vimrplugin_vimpager - let wwidth = winwidth(0) + " Consider 'numberwidth' = 5 + if &number + let wwidth = winwidth(0) - 5 + else + let wwidth = winwidth(0) + endif " Not enough room to split vertically if g:vimrplugin_vimpager == "vertical" && wwidth <= (g:vimrplugin_help_w + g:vimrplugin_editor_w) From 0bd0f146bbed883eca63a70fcb3c8c6e6e5fd8aa Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 9 Nov 2013 20:12:17 -0300 Subject: [PATCH 0539/1050] Consider 'relativenumber' while calculating width. --- r-plugin/common_global.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 24d5361..4afc296 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -1989,7 +1989,7 @@ function SetRTextWidth() let s:vimpager = g:vimrplugin_vimpager " Consider 'numberwidth' = 5 - if &number + if &number || &relativenumber let wwidth = winwidth(0) - 5 else let wwidth = winwidth(0) From dd953519bb27335bf11eb9b66189c544f131f270 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 9 Nov 2013 23:15:04 -0300 Subject: [PATCH 0540/1050] Remove option vimrplugin_htw. The real problem was solved taking into account the Vim options 'number' and 'relativenumbers' --- doc/r-plugin.txt | 10 ++-------- r-plugin/common_global.vim | 9 ++++----- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 19881c8..6c18f35 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -930,7 +930,6 @@ is running: |vimrplugin_vimpager| Use Vim to see R documentation |vimrplugin_editor_w| Minimum width of R script buffer |vimrplugin_help_w| Desired width of R documentation buffer -|vimrplugin_htw| Maximum text width of R documentation |vimrplugin_i386| Use 32 bit version of R |vimrplugin_r_path| Directory where R is |vimrplugin_r_args| Arguments to pass to R @@ -1068,7 +1067,6 @@ work on the Object Browser (you will see the message "Cmd not available"). *vimrplugin_vimpager* *vimrplugin_editor_w* *vimrplugin_help_w* - *vimrplugin_htw* 6.5.1. Quick setup~ If you do not want to see R documentation in a Vim's buffer, put in your @@ -1111,10 +1109,6 @@ values to some variables in your |vimrc|, as in the example: let vimrplugin_editor_w = 80 let vimrplugin_editor_h = 60 < -To set the maximum text width of the documentation, use vimrplugin_htw as in -> - let vimrplugin_htw = 80 -< 6.6. Use 32 bit version of R (Windows and Mac OS X only)~ *vimrplugin_i386* @@ -2242,14 +2236,14 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details. *r-plugin-news* 10. News~ -0.9.9.8 (2013-11-07) +0.9.9.8 (2013-11-09) * The list of objects for omnicompletion and the list of functions for syntax highlight now are built dynamically. Deprecated commands and options: :RUpdateObjList, :RAddLibToList, vimrplugin_buildwait. New option: vimrplugin_permanent_libs. - * New option: vimrplugin_show_args. + * New options: vimrplugin_show_args. * Remove toolbar icons (they still may be added back manually by interested users). diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 4afc296..dd06fe5 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -2001,13 +2001,13 @@ function SetRTextWidth() endif if s:vimpager == "horizontal" - " Use the window width (at most g:vimrplugin_htw columns) - let htwf = (wwidth > g:vimrplugin_htw) ? 88.1 : ((wwidth - 1) / 0.9) + " Use the window width (at most 80 columns) + let htwf = (wwidth > 80) ? 88.1 : ((wwidth - 1) / 0.9) elseif g:vimrplugin_vimpager == "tab" || g:vimrplugin_vimpager == "tabnew" let wwidth = &columns - let htwf = (wwidth > g:vimrplugin_htw) ? 88.1 : ((wwidth - 1) / 0.9) + let htwf = (wwidth > 80) ? 88.1 : ((wwidth - 1) / 0.9) else - let min_e = (g:vimrplugin_editor_w > g:vimrplugin_htw) ? g:vimrplugin_editor_w : g:vimrplugin_htw + let min_e = (g:vimrplugin_editor_w > 80) ? g:vimrplugin_editor_w : 80 let min_h = (g:vimrplugin_help_w > 73) ? g:vimrplugin_help_w : 73 if wwidth > (min_e + min_h) @@ -3121,7 +3121,6 @@ call RSetDefaultValue("g:vimrplugin_only_in_tmux", 0) call RSetDefaultValue("g:vimrplugin_routnotab", 0) call RSetDefaultValue("g:vimrplugin_editor_w", 66) call RSetDefaultValue("g:vimrplugin_help_w", 46) -call RSetDefaultValue("g:vimrplugin_htw", 80) call RSetDefaultValue("g:vimrplugin_objbr_w", 40) call RSetDefaultValue("g:vimrplugin_external_ob", 0) call RSetDefaultValue("g:vimrplugin_show_args", 0) From 589894d794c5d416af9c1b62c62d1177eef7c6b5 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 9 Nov 2013 23:17:05 -0300 Subject: [PATCH 0541/1050] Comment on why BufEnter event is used. --- r-plugin/common_buffer.vim | 3 +++ 1 file changed, 3 insertions(+) diff --git a/r-plugin/common_buffer.vim b/r-plugin/common_buffer.vim index 053d92e..18eae06 100644 --- a/r-plugin/common_buffer.vim +++ b/r-plugin/common_buffer.vim @@ -70,5 +70,8 @@ if !exists("g:SendCmdToR") let g:SendCmdToR = function('SendCmdToR_fake') endif +" It would be better if we could call RUpdateFunSyntax() for all buffers +" immediately after a new library was loaded, but the command :bufdo +" temporarily disables Syntax events. autocmd BufEnter call RUpdateFunSyntax(0) From 287bfa92507a09d25227c27544bd7d8f6dccd8ad Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sun, 10 Nov 2013 08:44:18 -0300 Subject: [PATCH 0542/1050] Use the actual value of &numberwidth. --- r-plugin/common_global.vim | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index dd06fe5..f0e8ce3 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -1988,12 +1988,7 @@ function SetRTextWidth() " and to decide whether to obey vimrplugin_vimpager = 'vertical' let s:vimpager = g:vimrplugin_vimpager - " Consider 'numberwidth' = 5 - if &number || &relativenumber - let wwidth = winwidth(0) - 5 - else - let wwidth = winwidth(0) - endif + let wwidth = winwidth(0) " Not enough room to split vertically if g:vimrplugin_vimpager == "vertical" && wwidth <= (g:vimrplugin_help_w + g:vimrplugin_editor_w) @@ -2024,6 +2019,7 @@ function SetRTextWidth() endif let htw = printf("%f", htwf) let g:rplugin_htw = substitute(htw, "\\..*", "", "") + let g:rplugin_htw = g:rplugin_htw - (&number || &relativenumber) * &numberwidth if !(has("win32") || has("win64")) exe "language " . curlang endif From 3557797f7d7bd010851642275e4d34bdc59e7363 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sun, 10 Nov 2013 10:48:09 -0300 Subject: [PATCH 0543/1050] Fix inconsistencies between doc, menu and code. --- doc/r-plugin.txt | 29 ++++++++++++----------- ftplugin/rmd.vim | 2 +- r-plugin/common_global.vim | 47 +++++++++++++++++++++++++++----------- 3 files changed, 51 insertions(+), 27 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 6c18f35..12cba15 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -313,17 +313,18 @@ Note: The is '\' by default. Note: It is recommended the use of different keys for and to avoid clashes between filetype plugins and general plugins -key binds. See |filetype-plugins| and |maplocalleader|. +key binds. See |filetype-plugins|, |maplocalleader| and |r-plugin-localleader|. To use the plugin, open a .R or .Rnw or .Rd file with Vim and type rf. Then, you will be able to use the plugin key bindings to send commands to R. -This plugin has many key bindings, which correspond with menu entries and, in -some cases. In the list below, the backslash represents the . Not -all menu items and key bindings are enabled in all filetypes supported by the -plugin (r, rnoweb, rhelp): +This plugin has many key bindings, which correspond with menu entries. In the +list below, the backslash represents the . Not all menu items and +key bindings are enabled in all filetypes supported by the plugin (r, rnoweb, +rhelp, rrst, rmd). +Menu entry Default shortcut~ Start/Close . Start R (default) \rf . Start R --vanilla \rv @@ -394,11 +395,12 @@ Command . Sweave, BibTeX and PDF (cur file) (Linux/Unix) \sb -------------------------------------------------------- . Knit (cur file) \kn - . Spin (cur file) \ks . Knit and PDF (cur file) \kp - . Knit and Beamer PDF (cur file) (Only Rmd) \kl - . Knit and PDF (cur file, verbose) (Windows) \kv . Knit, BibTeX and PDF (cur file) (Linux/Unix) \kb + . Knit and Beamer PDF (cur file) (only .Rmd) \kl + . Knit and HTML (cur file, verbose) (only .Rmd) \kh + . Knit and PDF (cur file, verbose) (Windows) \kv + . Spin (cur file) (only .R) \ks -------------------------------------------------------- . Open PDF (cur file) \op -------------------------------------------------------- @@ -1558,19 +1560,20 @@ RD, "cursor down"; RED, both "echo" and "down"): RSummary RListSpace - Support to Rnoweb, Rmd, Rrst~ + Support to Sweave and knitr~ RSendChunk RDSendChunk RESendChunk REDSendChunk - RBibTeX - RBibTeXK + RBibTeX (Sweave) + RBibTeXK (Knitr) RSweave RKnit RMakeHTML RMakeODT - RMakePDF - RMakePDFK + RMakePDF (Sweave) + RMakePDFK (Knitr) + RMakePDFKb (.Rmd, beamer) ROpenPDF RSpinFile diff --git a/ftplugin/rmd.vim b/ftplugin/rmd.vim index ff57c05..917e977 100644 --- a/ftplugin/rmd.vim +++ b/ftplugin/rmd.vim @@ -195,7 +195,7 @@ call RCreateMaps("nvi", 'RSetwd', 'rd', ':call RSetWD()') " Only .Rmd files use these functions: call RCreateMaps("nvi", 'RKnit', 'kn', ':call RKnit()') call RCreateMaps("nvi", 'RMakePDFK', 'kp', ':call RMakePDFrmd("latex")') -call RCreateMaps("nvi", 'RMakePDFK', 'kl', ':call RMakePDFrmd("beamer")') +call RCreateMaps("nvi", 'RMakePDFKb', 'kl', ':call RMakePDFrmd("beamer")') call RCreateMaps("nvi", 'RMakeHTML', 'kh', ':call RMakeHTMLrmd("html")') call RCreateMaps("nvi", 'RMakeODT', 'ko', ':call RMakeHTMLrmd("odt")') call RCreateMaps("ni", 'RSendChunk', 'cc', ':call SendRmdChunkToR("silent", "stay")') diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index f0e8ce3..aed8af1 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -2609,12 +2609,20 @@ function MakeRMenu() call RCreateMenuItem("ni", 'Send.Chunk\ (cur,\ echo\ and\ down)', 'REDSendChunk', 'ca', ':call SendChunkToR("echo", "down")') endif "------------------------------- + if &filetype == "rmd" || g:vimrplugin_never_unmake_menu + menu R.Send.-Sep2- + call RCreateMenuItem("ni", 'Send.Chunk\ (cur)', 'RSendChunk', 'cc', ':call SendRmdChunkToR("silent", "stay")') + call RCreateMenuItem("ni", 'Send.Chunk\ (cur,\ echo)', 'RESendChunk', 'ce', ':call SendRmdChunkToR("echo", "stay")') + call RCreateMenuItem("ni", 'Send.Chunk\ (cur,\ down)', 'RDSendChunk', 'cd', ':call SendRmdChunkToR("silent", "down")') + call RCreateMenuItem("ni", 'Send.Chunk\ (cur,\ echo\ and\ down)', 'REDSendChunk', 'ca', ':call SendRmdChunkToR("echo", "down")') + endif + "------------------------------- if &filetype == "rrst" || g:vimrplugin_never_unmake_menu menu R.Send.-Sep2- - call RCreateMenuItem("ni", 'Send.Chunk\ (cur)', 'RSendChunk', 'cc', ':call SendChunkToR("silent", "stay")') - call RCreateMenuItem("ni", 'Send.Chunk\ (cur,\ echo)', 'RESendChunk', 'ce', ':call SendChunkToR("echo", "stay")') - call RCreateMenuItem("ni", 'Send.Chunk\ (cur,\ down)', 'RDSendChunk', 'cd', ':call SendChunkToR("silent", "down")') - call RCreateMenuItem("ni", 'Send.Chunk\ (cur,\ echo\ and\ down)', 'REDSendChunk', 'ca', ':call SendChunkToR("echo", "down")') + call RCreateMenuItem("ni", 'Send.Chunk\ (cur)', 'RSendChunk', 'cc', ':call SendRrstChunkToR("silent", "stay")') + call RCreateMenuItem("ni", 'Send.Chunk\ (cur,\ echo)', 'RESendChunk', 'ce', ':call SendRrstChunkToR("echo", "stay")') + call RCreateMenuItem("ni", 'Send.Chunk\ (cur,\ down)', 'RDSendChunk', 'cd', ':call SendRrstChunkToR("silent", "down")') + call RCreateMenuItem("ni", 'Send.Chunk\ (cur,\ echo\ and\ down)', 'REDSendChunk', 'ca', ':call SendRrstChunkToR("echo", "down")') endif "------------------------------- menu R.Send.-Sep3- @@ -2662,20 +2670,29 @@ function MakeRMenu() if has("win32") || has("win64") call RCreateMenuItem("nvi", 'Command.Sweave\ and\ PDF\ (cur\ file,\ verbose)', 'RMakePDF', 'sv', ':call RMakePDF("verbose", 0)') else - call RCreateMenuItem("nvi", 'Command.Sweave,\ BibTeX\ and\ PDF\ (cur\ file)', 'RMakePDF', 'sb', ':call RMakePDF("bibtex", 0)') + call RCreateMenuItem("nvi", 'Command.Sweave,\ BibTeX\ and\ PDF\ (cur\ file)', 'RBibTeX', 'sb', ':call RMakePDF("bibtex", 0)') endif endif menu R.Command.-Sep6- call RCreateMenuItem("nvi", 'Command.Knit\ (cur\ file)', 'RKnit', 'kn', ':call RKnit()') - call RCreateMenuItem("nvi", 'Command.Knit\ and\ PDF\ (cur\ file)', 'RMakePDF', 'kp', ':call RMakePDF("nobib", 1)') - if has("win32") || has("win64") - call RCreateMenuItem("nvi", 'Command.Knit\ and\ PDF\ (cur\ file,\ verbose)', 'RMakePDF', 'kv', ':call RMakePDF("verbose", 1)') - else - call RCreateMenuItem("nvi", 'Command.Knit,\ BibTeX\ and\ PDF\ (cur\ file)', 'RMakePDF', 'kb', ':call RMakePDF("bibtex", 1)') + if &filetype == "rnoweb" || g:vimrplugin_never_unmake_menu + call RCreateMenuItem("nvi", 'Command.Knit\ and\ PDF\ (cur\ file)', 'RMakePDFK', 'kp', ':call RMakePDF("nobib", 1)') + if has("win32") || has("win64") + call RCreateMenuItem("nvi", 'Command.Knit\ and\ PDF\ (cur\ file,\ verbose)', 'RMakePDFKv', 'kv', ':call RMakePDF("verbose", 1)') + else + call RCreateMenuItem("nvi", 'Command.Knit,\ BibTeX\ and\ PDF\ (cur\ file)', 'RBibTeXK', 'kb', ':call RMakePDF("bibtex", 1)') + endif endif if &filetype == "rmd" || g:vimrplugin_never_unmake_menu - call RCreateMenuItem("nvi", 'Command.Knit\ and\ HTML\ (cur\ file)', 'RMakeHTML', 'kh', ':call RMakeHTML("html")') - call RCreateMenuItem("nvi", 'Command.Knit\ and\ ODT\ (cur\ file)', 'RMakeODT', 'ko', ':call RMakeHTML("odt")') + call RCreateMenuItem("nvi", 'Command.Knit\ and\ PDF\ (cur\ file)', 'RMakePDFK', 'kp', ':call RMakePDFrmd("latex")') + call RCreateMenuItem("nvi", 'Command.Knit\ and\ Beamer PDF\ (cur\ file)', 'RMakePDFKb', 'kl', ':call RMakePDFrmd("beamer")') + call RCreateMenuItem("nvi", 'Command.Knit\ and\ HTML\ (cur\ file)', 'RMakeHTML', 'kh', ':call RMakeHTMLrmd("html")') + call RCreateMenuItem("nvi", 'Command.Knit\ and\ ODT\ (cur\ file)', 'RMakeODT', 'ko', ':call RMakeHTMLrmd("odt")') + endif + if &filetype == "rrst" || g:vimrplugin_never_unmake_menu + call RCreateMenuItem("nvi", 'Command.Knit\ and\ PDF\ (cur\ file)', 'RMakePDFK', 'kp', ':call RMakePDFrrst()') + call RCreateMenuItem("nvi", 'Command.Knit\ and\ HTML\ (cur\ file)', 'RMakeHTML', 'kh', ':call RMakeHTMLrrst("html")') + call RCreateMenuItem("nvi", 'Command.Knit\ and\ ODT\ (cur\ file)', 'RMakeODT', 'ko', ':call RMakeHTMLrrst("odt")') endif menu R.Command.-Sep61- call RCreateMenuItem("nvi", 'Command.Open\ PDF\ (cur\ file)', 'ROpenPDF', 'op', ':call ROpenPDF()') @@ -2687,7 +2704,11 @@ function MakeRMenu() call RCreateMenuItem("nvi", 'Command.Knit\ and\ PDF\ (cur\ file)', 'RMakePDF', 'kp', ':call RMakePDF("nobib")') endif "------------------------------- - menu R.Command.-Sep7- + if &filetype == "r" || g:vimrplugin_never_unmake_menu + menu R.Command.-Sep71- + call RCreateMenuItem("nvi", 'Command.Spin\ (cur\ file)', 'RSpinFile', 'ks', ':call RSpin()') + endif + menu R.Command.-Sep72- if &filetype == "r" || &filetype == "rnoweb" || g:vimrplugin_never_unmake_menu nmenu R.Command.Build\ tags\ file\ (cur\ dir):RBuildTags :call g:SendCmdToR('rtags(ofile = "TAGS")') imenu R.Command.Build\ tags\ file\ (cur\ dir):RBuildTags :call g:SendCmdToR('rtags(ofile = "TAGS")')a From a0242079856d00aa76d3ba8450e846d9118bc590 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sun, 10 Nov 2013 12:26:06 -0300 Subject: [PATCH 0544/1050] Update. --- doc/r-plugin.txt | 60 +++++++++++------------------------------------- 1 file changed, 13 insertions(+), 47 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 12cba15..560d211 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -434,6 +434,7 @@ Object Browser Help (plugin) Help (R) :Rhelp +Configure (Vim-R) :RpluginConfig ----------------------------------------------------------- Please see |r-plugin-key-bindings| to learn how to customize the key bindings @@ -1910,18 +1911,7 @@ code automatically, breaking only comment lines, put in your |vimrc|: 9.13. Vim with 256 colors in a terminal emulator (Linux/Unix only)~ If you want 256 colors support in Vim, install the package ncurses-term. Then -put in your ~/.bashrc: -> - if [ "x" != "x$DISPLAY" ] - then - if [ "screen" = "$TERM" ] - then - export TERM=screen-256color - else - export TERM=xterm-256color - fi - fi -< +put in your ~/.bashrc the lines suggested at |r-plugin-quick-bash-setup|. Finally, put in your |vimrc|: > if &term =~ "xterm" || &term =~ "256" || $DISPLAY != "" @@ -1945,30 +1935,13 @@ line in your |vimrc|: 9.15. Edit your ~/.Rprofile~ *r-plugin-Rprofile* -You may want to edit your ~/.Rprofile. Example for Linux: +You may want to edit your ~/.Rprofile in addition to considering the +suggestions of |r-plugin-quick-R-setup| you may also want to put the following +lines in your .Rprofile if you are using Linux: > - if(interactive()){ - library(colorout) - library(setwidth) - options(vimcom.verbose = 1, vimcom.allnames = TRUE) - if(Sys.getenv("VIMRPLUGIN_TMPDIR") != "") - library(vimcom.plus) - # If you can't install the vimcom.plus package, do: - # library(vimcom) - if(Sys.getenv("TERM") != "linux" && Sys.getenv("TERM") != "") - setOutputColors256(verbose = FALSE) - if(nchar(Sys.getenv("DISPLAY")) > 1){ - grDevices::X11.options(width = 4.5, height = 4, ypos = 0, - xpos = 1000, pointsize = 10) - options(editor = 'gvim -f -c "set ft=r"') - } else { - options(editor = 'vim -c "set ft=r"') - } - } + grDevices::X11.options(width = 4.5, height = 4, ypos = 0, + xpos = 1000, pointsize = 10) < -The test for the environment variable DISPLAY is useful if you eventually use -the plugin in the Linux console. - The `X11.options()` is used to choose the position and dimensions of the X11 graphical device. You can also install the application wmctrl and create shortcuts in your desktop environment to the commands @@ -1983,14 +1956,6 @@ which can display R plots in a separate panel. Although we can not embed an R graphical device in Vim, we can at least make it always visible over the terminal emulator or the GVim window. - *r-plugin-Rprofile-Windows* -An example for Windows: -> - if (interactive()) { - library(vimcom.plus) - options(editor = '"C:/Program Files (x86)/Vim/vim74/gvim.exe" "-c" "set filetype=r"') - } -< 9.16. Debugging R functions~ @@ -2029,13 +1994,14 @@ On Windows, you probably will have to make a copy of the file to the 9.18. Disable syntax highlight of R functions~ -If you want to disable the syntax highlight of R functions edit the file -~/.vim/r-plugin/functions.vim and delete all lines, but do not delete the -file. - +If you want to disable the syntax highlight of R functions put in your +|vimrc|: +> + autocmd Syntax * syntax clear rFunction +< 9.19. Tips for knitr users~ - *knitr* + *r-plugin-knitr* If you are using knitr with option cache=TRUE, you may want from time to time to delete all objects in R workspace and all files in the cache directory. If you want to use kr in Normal mode for this, put in your |vimrc|: From 24e30572501f5e01d666a5ba10e475c67e984e6d Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sun, 10 Nov 2013 12:26:16 -0300 Subject: [PATCH 0545/1050] Update help menu. --- r-plugin/common_global.vim | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index aed8af1..1fe08d5 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -2685,7 +2685,7 @@ function MakeRMenu() endif if &filetype == "rmd" || g:vimrplugin_never_unmake_menu call RCreateMenuItem("nvi", 'Command.Knit\ and\ PDF\ (cur\ file)', 'RMakePDFK', 'kp', ':call RMakePDFrmd("latex")') - call RCreateMenuItem("nvi", 'Command.Knit\ and\ Beamer PDF\ (cur\ file)', 'RMakePDFKb', 'kl', ':call RMakePDFrmd("beamer")') + call RCreateMenuItem("nvi", 'Command.Knit\ and\ Beamer\ PDF\ (cur\ file)', 'RMakePDFKb', 'kl', ':call RMakePDFrmd("beamer")') call RCreateMenuItem("nvi", 'Command.Knit\ and\ HTML\ (cur\ file)', 'RMakeHTML', 'kh', ':call RMakeHTMLrmd("html")') call RCreateMenuItem("nvi", 'Command.Knit\ and\ ODT\ (cur\ file)', 'RMakeODT', 'ko', ':call RMakeHTMLrmd("odt")') endif @@ -2790,11 +2790,11 @@ function MakeRMenu() endif amenu R.Help\ (plugin).Options.R\ path :help vimrplugin_r_path amenu R.Help\ (plugin).Options.Arguments\ to\ R :help vimrplugin_r_args + amenu R.Help\ (plugin).Options.Omni\ completion\ when\ R\ not\ running :help vimrplugin_permanent_libs amenu R.Help\ (plugin).Options.Syntax\ highlighting\ of\ \.Rout\ files :help vimrplugin_routmorecolors amenu R.Help\ (plugin).Options.Automatically\ open\ the\ \.Rout\ file :help vimrplugin_routnotab amenu R.Help\ (plugin).Options.Special\ R\ functions :help vimrplugin_listmethods amenu R.Help\ (plugin).Options.Indent\ commented\ lines :help vimrplugin_indent_commented - amenu R.Help\ (plugin).Options.maxdeparse :help vimrplugin_maxdeparse amenu R.Help\ (plugin).Options.LaTeX\ command :help vimrplugin_latexcmd amenu R.Help\ (plugin).Options.Never\ unmake\ the\ R\ menu :help vimrplugin_never_unmake_menu @@ -2805,7 +2805,9 @@ function MakeRMenu() amenu R.Help\ (plugin).FAQ\ and\ tips.Folding\ setup :help r-plugin-folding amenu R.Help\ (plugin).FAQ\ and\ tips.Remap\ LocalLeader :help r-plugin-localleader amenu R.Help\ (plugin).FAQ\ and\ tips.Customize\ key\ bindings :help r-plugin-bindings + amenu R.Help\ (plugin).FAQ\ and\ tips.ShowMarks :help r-plugin-showmarks amenu R.Help\ (plugin).FAQ\ and\ tips.SnipMate :help r-plugin-snippets + amenu R.Help\ (plugin).FAQ\ and\ tips.LaTeX-Box :help r-plugin-latex-box amenu R.Help\ (plugin).FAQ\ and\ tips.Highlight\ marks :help r-plugin-showmarks amenu R.Help\ (plugin).FAQ\ and\ tips.Global\ plugin :help r-plugin-global amenu R.Help\ (plugin).FAQ\ and\ tips.Jump\ to\ function\ definitions :help r-plugin-tagsfile From 40baddffbc38773183027586b11891bf14bd985c Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sun, 10 Nov 2013 13:36:18 -0300 Subject: [PATCH 0546/1050] Add options not related with the plugin to vimrc. --- r-plugin/vimrconfig.vim | 51 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 47 insertions(+), 4 deletions(-) diff --git a/r-plugin/vimrconfig.vim b/r-plugin/vimrconfig.vim index 4c398c5..623d2a0 100644 --- a/r-plugin/vimrconfig.vim +++ b/r-plugin/vimrconfig.vim @@ -186,9 +186,45 @@ function! RConfigVimrc() \ 'nmap RDSendLine'] endif endif + + if !hasvimrc + echo " " + echo "There are some options that most Vim users like, but that are not enabled by" + echo "default such as highlighting the last search pattern, incremental search" + echo "and setting the indentation as four spaces." + echohl Question + let what = input("Do you want these options in your vimrc? [y/N]: ") + echohl Normal + if RGetYesOrNo(what) + let vlines = vlines + [ + \ '" The lines below were also added by the Vim-R-plugin because you did not have', + \ '" a vimrc yet in the hope that they will help you getting started with Vim:', + \ '', + \ '" Highlight the last searched pattern:', + \ 'set hlsearch', + \ '', + \ '" Show where the next patter is as you type it:', + \ 'set incsearch', + \ '', + \ '" By default, Vim indents code by 8 spaces. Most people preffer 4 spaces:', + \ 'set sw=4', + \ '', + \ '" There are hundreds of color schemes for Vim on the internet, but you can', + \ '" start with color schemes already installed.', + \ '" Click on GVim menu bar "Edit / Color scheme" to know the name of your', + \ '" preffered color scheme, then, remove the double quote (which is a comment', + \ '" character, like the # is for R language) and replace the value "not_defined"', + \ '" below:', + \ '"colorscheme not_defined'] + endif + endif + call writefile(vlines, uvimrc) echo " " + echohl WarningMsg + echo "The changes in your vimrc will be effective" + echo "only after you quit Vim and start it again." echohl Question let what = input("Do you want to see your vimrc now? [y/N]: ") echohl Normal @@ -197,10 +233,6 @@ function! RConfigVimrc() normal! G endif redraw - echohl WarningMsg - echo "The changes in your vimrc will be effective" - echo "only after you quit Vim and start it again." - echohl Normal endfunction " Configure .bashrc @@ -270,6 +302,17 @@ function! RConfigBash() \ ' fi', \ 'fi' ] call writefile(blines, $HOME . "/.bashrc") + if !has("gui_running") + echo " " + echohl WarningMsg + echo "The changes in your bashrc will be effective" + echo "only after you exit from Bash and start it again" + if $DISPLAY == "" + echo "(logoff and login again)." + else + echo "(close the terminal emulator and start it again)." + endif + endif echohl Question let what = input("Do you want to see your .bashrc now? [y/N]: ") echohl Normal From 5658e3f0936d17ab13338245443cce56a5621bdd Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Mon, 11 Nov 2013 22:12:30 -0300 Subject: [PATCH 0547/1050] Update syntax of file types that include R code. --- r-plugin/common_global.vim | 6 ++ syntax/r.vim | 133 +++++++++++++++++++++---------------- 2 files changed, 80 insertions(+), 59 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 1fe08d5..8ff1d02 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -1971,6 +1971,12 @@ function RFillLibList() if exists("*RUpdateFunSyntax") call RUpdateFunSyntax(0) + " If is included in another file type (like rnoweb or rhelp), the R + " syntax isn't automatically updated. So, we call "syntax on" to force + " the update. + if &filetype != "r" + syntax on + endif endif endfunction diff --git a/syntax/r.vim b/syntax/r.vim index eae4368..08b3413 100644 --- a/syntax/r.vim +++ b/syntax/r.vim @@ -3,7 +3,7 @@ " Maintainer: Jakson Aquino " Former Maintainers: Vaidotas Zemlys " Tom Payne -" Last Change: Sat Nov 09, 2013 07:27PM +" Last Change: Mon Nov 11, 2013 10:12PM " Filenames: *.R *.r *.Rhistory *.Rt " " NOTE: The highlighting of R functions is defined in the @@ -150,64 +150,6 @@ syn match rBraceError "[)}]" contained syn match rCurlyError "[)\]]" contained syn match rParenError "[\]}]" contained -" Source lists of R functions. The lists are produced by the Vim-R-plugin -" http://www.vim.org/scripts/script.php?script_id=2628 -if !exists("g:vimrplugin_permanent_libs") - let g:vimrplugin_permanent_libs = "base,stats,graphics,grDevices,utils,datasets,methods" -endif -let b:rplugin_funls = [] - -function! RAddToFunList(lib, verbose) - " Only run once for each package: - for pkg in b:rplugin_funls - if pkg == a:lib - return - endif - endfor - - " The fun_ files list functions of R packages and are created by the - " Vim-R-plugin: - let fnf = split(globpath(&rtp, 'r-plugin/objlist/fun_' . a:lib . '_*'), "\n") - - if len(fnf) == 1 - silent exe "source " . fnf[0] - let b:rplugin_funls += [a:lib] - elseif a:verbose && len(fnf) == 0 - echohl WarningMsg - echomsg 'Fun_ file for "' . a:lib . '" not found.' - echohl Normal - return - elseif a:verbose && len(fnf) > 1 - echohl WarningMsg - echomsg 'There is more than one fun_ file for "' . a:lib . '":' - for fff in fnf - echomsg fff - endfor - echohl Normal - return - endif -endfunction - -function! RUpdateFunSyntax(verbose) - " Do nothing if called at a buffer that doesn't include R syntax: - if !exists("b:rplugin_funls") - return - endif - if exists("g:rplugin_libls") - for lib in g:rplugin_libls - call RAddToFunList(lib, a:verbose) - endfor - else - if exists("g:vimrplugin_permanent_libs") - for lib in split(g:vimrplugin_permanent_libs, ",") - call RAddToFunList(lib, a:verbose) - endfor - endif - endif -endfunction - -call RUpdateFunSyntax(0) - syn match rDollar display contained "\$" syn match rDollar display contained "@" @@ -274,4 +216,77 @@ hi def link rOKeyword Title let b:current_syntax="r" +" The code below is used by the Vim-R-plugin: +" http://www.vim.org/scripts/script.php?script_id=2628 + +" Users may define the value of g:vimrplugin_permanent_libs to determine what +" functions should be highlighted even if R is not running. By default, the +" functions of packages loaded by R --vanilla are highlighted. +if !exists("g:vimrplugin_permanent_libs") + let g:vimrplugin_permanent_libs = "base,stats,graphics,grDevices,utils,datasets,methods" +endif + +" Store the names R package whose functions were already added to syntax +" highlight to avoid sourcing them repeatedly. +let b:rplugin_funls = [] + +" The function RUpdateFunSyntax() is called by the Vim-R-plugin whenever the +" user loads a new package in R. The function should be defined only once. +" Thus, if it's already defined, call it and finish. +if exists("*RUpdateFunSyntax") + call RUpdateFunSyntax(0) + finish +endif + +function RAddToFunList(lib, verbose) + " Only run once for each package: + for pkg in b:rplugin_funls + if pkg == a:lib + return + endif + endfor + + " The fun_ files list functions of R packages and are created by the + " Vim-R-plugin: + let fnf = split(globpath(&rtp, 'r-plugin/objlist/fun_' . a:lib . '_*'), "\n") + + if len(fnf) == 1 + silent exe "source " . fnf[0] + let b:rplugin_funls += [a:lib] + elseif a:verbose && len(fnf) == 0 + echohl WarningMsg + echomsg 'Fun_ file for "' . a:lib . '" not found.' + echohl Normal + return + elseif a:verbose && len(fnf) > 1 + echohl WarningMsg + echomsg 'There is more than one fun_ file for "' . a:lib . '":' + for fff in fnf + echomsg fff + endfor + echohl Normal + return + endif +endfunction + +function RUpdateFunSyntax(verbose) + " Do nothing if called at a buffer that doesn't include R syntax: + if !exists("b:rplugin_funls") + return + endif + if exists("g:rplugin_libls") + for lib in g:rplugin_libls + call RAddToFunList(lib, a:verbose) + endfor + else + if exists("g:vimrplugin_permanent_libs") + for lib in split(g:vimrplugin_permanent_libs, ",") + call RAddToFunList(lib, a:verbose) + endfor + endif + endif +endfunction + +call RUpdateFunSyntax(0) + " vim: ts=8 sw=4 From f4c97e1a92666e4e0459f75e40931e97924a8fee Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Mon, 11 Nov 2013 22:21:26 -0300 Subject: [PATCH 0548/1050] Use Vim-R-plugin as the vimball name. --- Makefile | 6 ++-- doc/r-plugin.txt | 75 +++++++++++++++++++----------------------------- list_for_vimball | 42 +++++++++++++-------------- 3 files changed, 54 insertions(+), 69 deletions(-) diff --git a/Makefile b/Makefile index 7a2ccd3..1b44e71 100644 --- a/Makefile +++ b/Makefile @@ -33,8 +33,8 @@ vimball: sed -i -e "s/^Version: [0-9].[0-9].[0-9].[0-9]/Version: $(PLUGINVERSION)/" doc/r-plugin.txt sed -i -e "s/vim-r-plugin_[0-9].[0-9].[0-9].[0-9].vmb/vim-r-plugin_$(PLUGINVERSION).vmb/" doc/r-plugin.txt sed -i -e "s/^$(PLUGINVERSION) (201[0-9]-[0-9][0-9]-[0-9][0-9])$$/$(PLUGINVERSION) ($(PLUGINRELEASEDATE))/" doc/r-plugin.txt - vim -c "%MkVimball vim-r-plugin ." -c "q" list_for_vimball - mv vim-r-plugin.vmb /tmp + vim -c "%MkVimball Vim-R-plugin ." -c "q" list_for_vimball + mv Vim-R-plugin.vmb /tmp deb: # Clean previously created files @@ -110,7 +110,7 @@ deb: of the GNU General Public License.\n\ " > /tmp/vim-r-plugin-tmp/usr/share/doc/vim-r-plugin/copyright # Unpack the plugin - vim -c 'let g:vimball_home="/tmp/vim-r-plugin-tmp/usr/share/vim/addons"' -c "so %" -c "q" /tmp/vim-r-plugin_$(PLUGINVERSION).vmb + vim -c 'set nomore' -c 'let g:vimball_home="/tmp/vim-r-plugin-tmp/usr/share/vim/addons"' -c "so %" -c "q" /tmp/Vim-R-plugin.vmb # Delete file unnecessary in a Debian system (cd /tmp/vim-r-plugin-tmp/usr/share/vim/addons ;\ rm r-plugin/windows.py ) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 560d211..45e7bff 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -153,10 +153,14 @@ should have at least the following options in your |vimrc|: Make a backup of your ~/.vim directory because existing files will be replaced. Please, look at |r-plugin-files| to see the list of files. +Download the latest version of the plugin from: + + http://www.vim.org/scripts/script.php?script_id=2628 + Start a terminal emulator, go to the directory where you have downloaded the plugin and type: > - vim vim-r-plugin_0.9.9.8.vmb + vim Vim-R-plugin.vmb < Then, in Vim, type: > @@ -218,7 +222,7 @@ dependencies: Note: If you cannot build vimcom.plus yourself, you will want to download and install the zip file. -Now, download the file `vim-r-plugin_0.9.9.8.vmb` from +Now, download the latest version of `Vim-R-plugin.vmb` from http://www.vim.org/scripts/script.php?script_id=2628 @@ -1630,57 +1634,38 @@ The following files are part of the plugin and should be in your ~/.vim directory after the installation: - autoload/rcomplete.vim - bitmaps/RClearAll.bmp - bitmaps/RClearAll.png - bitmaps/RClear.bmp - bitmaps/RClear.png - bitmaps/RClose.bmp - bitmaps/RClose.png - bitmaps/ricon.png - bitmaps/ricon.xbm - bitmaps/RListSpace.bmp - bitmaps/RListSpace.png - bitmaps/RSendBlock.bmp - bitmaps/RSendBlock.png - bitmaps/RSendFile.bmp - bitmaps/RSendFile.png - bitmaps/RSendFunction.bmp - bitmaps/RSendFunction.png - bitmaps/RSendLine.bmp - bitmaps/RSendLine.png - bitmaps/RSendParagraph.bmp - bitmaps/RSendParagraph.png - bitmaps/RSendSelection.bmp - bitmaps/RSendSelection.png - bitmaps/RStart.bmp - bitmaps/RStart.png - doc/r-plugin.txt ftdetect/r.vim - ftplugin/rhelp.vim - ftplugin/rnoweb.vim + indent/r.vim + indent/rmd.vim + indent/rrst.vim + indent/rnoweb.vim + indent/rhelp.vim + autoload/rcomplete.vim ftplugin/r.vim ftplugin/rbrowser.vim + ftplugin/rdoc.vim + ftplugin/rhelp.vim ftplugin/rmd.vim ftplugin/rrst.vim - indent/r.vim - indent/rhelp.vim - indent/rnoweb.vim - indent/rmd.vim - indent/rrst.vim - r-plugin/common_buffer.vim - r-plugin/common_global.vim - r-plugin/functions.vim - r-plugin/objlist/ - r-plugin/r.snippets - r-plugin/tex_indent.vim - r-plugin/vimcom.py - r-plugin/windows.py - syntax/rbrowser.vim + ftplugin/rnoweb.vim syntax/rout.vim syntax/r.vim + syntax/rhelp.vim syntax/rmd.vim syntax/rrst.vim + syntax/rdoc.vim + syntax/rbrowser.vim + doc/r-plugin.txt + r-plugin/vimcom.py + r-plugin/global_r_plugin.vim + r-plugin/windows.py + r-plugin/objlist/README + r-plugin/tex_indent.vim + r-plugin/r.snippets + r-plugin/common_buffer.vim + r-plugin/common_global.vim + r-plugin/Rconfig.R + r-plugin/vimrconfig.vim ============================================================================== @@ -2205,7 +2190,7 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details. *r-plugin-news* 10. News~ -0.9.9.8 (2013-11-09) +0.9.9.8 (2013-11-10) * The list of objects for omnicompletion and the list of functions for syntax highlight now are built dynamically. Deprecated commands and options: diff --git a/list_for_vimball b/list_for_vimball index da7dd7b..ca6f17c 100644 --- a/list_for_vimball +++ b/list_for_vimball @@ -1,32 +1,32 @@ -ftdetect/r.vim -indent/r.vim -indent/rmd.vim -indent/rrst.vim -indent/rnoweb.vim -indent/rhelp.vim autoload/rcomplete.vim +doc/r-plugin.txt +ftdetect/r.vim ftplugin/r.vim ftplugin/rbrowser.vim ftplugin/rdoc.vim ftplugin/rhelp.vim ftplugin/rmd.vim -ftplugin/rrst.vim ftplugin/rnoweb.vim -syntax/rout.vim -syntax/r.vim -syntax/rhelp.vim -syntax/rmd.vim -syntax/rrst.vim -syntax/rdoc.vim -syntax/rbrowser.vim -doc/r-plugin.txt -r-plugin/vimcom.py +ftplugin/rrst.vim +indent/r.vim +indent/rhelp.vim +indent/rmd.vim +indent/rnoweb.vim +indent/rrst.vim +r-plugin/Rconfig.R +r-plugin/common_buffer.vim +r-plugin/common_global.vim r-plugin/global_r_plugin.vim -r-plugin/windows.py r-plugin/objlist/README -r-plugin/tex_indent.vim r-plugin/r.snippets -r-plugin/common_buffer.vim -r-plugin/common_global.vim -r-plugin/Rconfig.R +r-plugin/tex_indent.vim +r-plugin/vimcom.py r-plugin/vimrconfig.vim +r-plugin/windows.py +syntax/r.vim +syntax/rbrowser.vim +syntax/rdoc.vim +syntax/rhelp.vim +syntax/rmd.vim +syntax/rout.vim +syntax/rrst.vim From d675647a3dfc04c157199d4b2d5419b0a8093ccc Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Tue, 12 Nov 2013 16:53:37 -0300 Subject: [PATCH 0549/1050] Improve syntax update of multiple buffers. --- r-plugin/common_buffer.vim | 4 --- r-plugin/common_global.vim | 50 +++++++++++++++++++++----------------- 2 files changed, 28 insertions(+), 26 deletions(-) diff --git a/r-plugin/common_buffer.vim b/r-plugin/common_buffer.vim index 18eae06..b1e8eaa 100644 --- a/r-plugin/common_buffer.vim +++ b/r-plugin/common_buffer.vim @@ -70,8 +70,4 @@ if !exists("g:SendCmdToR") let g:SendCmdToR = function('SendCmdToR_fake') endif -" It would be better if we could call RUpdateFunSyntax() for all buffers -" immediately after a new library was loaded, but the command :bufdo -" temporarily disables Syntax events. -autocmd BufEnter call RUpdateFunSyntax(0) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 8ff1d02..5bc4fb7 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -1951,7 +1951,10 @@ function RAddToLibList(nlib, verbose) endif endfunction +" This function is called by the R package vimcom.plus whenever a library is +" loaded. function RFillLibList() + " Update the list of objects for omnicompletion if filereadable($VIMRPLUGIN_TMPDIR . "/libnames_" . $VIMINSTANCEID) let newls = readfile($VIMRPLUGIN_TMPDIR . "/libnames_" . $VIMINSTANCEID) for nlib in newls @@ -1971,11 +1974,8 @@ function RFillLibList() if exists("*RUpdateFunSyntax") call RUpdateFunSyntax(0) - " If is included in another file type (like rnoweb or rhelp), the R - " syntax isn't automatically updated. So, we call "syntax on" to force - " the update. if &filetype != "r" - syntax on + silent exe "set filetype=" . &filetype endif endif endfunction @@ -2999,18 +2999,32 @@ function RCreateSendMaps() endfunction function RBufEnter() - if &filetype != g:rplugin_lastft - call UnMakeRMenu() - if &filetype == "r" || &filetype == "rnoweb" || &filetype == "rrst" || &filetype == "rdoc" || &filetype == "rbrowser" || &filetype == "rhelp" - if &filetype == "rbrowser" - call MakeRBrowserMenu() - else - call MakeRMenu() + let g:rplugin_curbuf = bufname("%") + if has("gui_running") + if &filetype != g:rplugin_lastft + call UnMakeRMenu() + if &filetype == "r" || &filetype == "rnoweb" || &filetype == "rmd" || &filetype == "rrst" || &filetype == "rdoc" || &filetype == "rbrowser" || &filetype == "rhelp" + if &filetype == "rbrowser" + call MakeRBrowserMenu() + else + call MakeRMenu() + endif endif endif + if &buftype != "nofile" || (&buftype == "nofile" && &filetype != "rbrowser") + let g:rplugin_lastft = &filetype + endif endif - if &buftype != "nofile" || &filetype == "rbrowser" - let g:rplugin_lastft = &filetype + + " It would be better if we could call RUpdateFunSyntax() for all buffers + " immediately after a new library was loaded, but the command :bufdo + " temporarily disables Syntax events. + if exists("b:rplugin_funls") && len(b:rplugin_funls) < len(g:rplugin_libls) + call RUpdateFunSyntax(0) + " If R code is included in another file type (like rnoweb or + " rhelp), the R syntax isn't automatically updated. So, we force + " it: + silent exe "set filetype=" . &filetype endif endfunction @@ -3481,15 +3495,7 @@ if exists("g:vimrplugin_term_cmd") let g:rplugin_termcmd = g:vimrplugin_term_cmd endif -augroup RBufControl - au BufEnter * let g:rplugin_curbuf = bufname("%") -augroup END - -if has("gui_running") - augroup RMenuControl - au BufEnter * call RBufEnter() - augroup END -endif +autocmd BufEnter * call RBufEnter() let g:rplugin_firstbuffer = expand("%:p") let g:rplugin_running_objbr = 0 From dfbff17a56d17bdea0c85b10392aac4b3de75c44 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Tue, 12 Nov 2013 17:00:08 -0300 Subject: [PATCH 0550/1050] No longer use the variable g:needsnewomnilist. --- autoload/rcomplete.vim | 2 +- ftplugin/r.vim | 1 - ftplugin/rmd.vim | 2 -- ftplugin/rnoweb.vim | 3 --- ftplugin/rrst.vim | 3 --- r-plugin/common_global.vim | 18 +----------------- 6 files changed, 2 insertions(+), 27 deletions(-) diff --git a/autoload/rcomplete.vim b/autoload/rcomplete.vim index bc175f5..f4e5808 100644 --- a/autoload/rcomplete.vim +++ b/autoload/rcomplete.vim @@ -16,7 +16,7 @@ fun! rcomplete#CompleteR(findstart, base) endwhile return start else - if g:needsnewomnilist == 1 + if string(g:SendCmdToR) != "function('SendCmdToR_fake')" call BuildROmniList() endif let res = [] diff --git a/ftplugin/r.vim b/ftplugin/r.vim index a2a7c2f..bea11fa 100644 --- a/ftplugin/r.vim +++ b/ftplugin/r.vim @@ -88,7 +88,6 @@ endfunction " Convert R script into Rmd, md and, then, html. function! RSpin() update - let g:needsnewomnilist = 1 call RSetWD() call g:SendCmdToR('require(knitr); spin("' . expand("%:t") . '")') endfunction diff --git a/ftplugin/rmd.vim b/ftplugin/rmd.vim index 917e977..9b91b5b 100644 --- a/ftplugin/rmd.vim +++ b/ftplugin/rmd.vim @@ -160,7 +160,6 @@ function! RMakePDFrmd(t) let pdfcmd = pdfcmd . ", pandoc_args = '" . g:vimrplugin_pandoc_args . "'" endif let pdfcmd = pdfcmd . ")" - let g:needsnewomnilist = 1 call g:SendCmdToR(pdfcmd) endfunction @@ -173,7 +172,6 @@ function! SendRmdChunkToR(e, m) let chunkline = search("^[ \t]*```[ ]*{r", "bncW") + 1 let docline = search("^[ \t]*```", "ncW") - 1 let lines = getline(chunkline, docline) - let g:needsnewomnilist = 1 let ok = RSourceLines(lines, a:e) if ok == 0 return diff --git a/ftplugin/rnoweb.vim b/ftplugin/rnoweb.vim index e95d9ae..eab269b 100644 --- a/ftplugin/rnoweb.vim +++ b/ftplugin/rnoweb.vim @@ -146,7 +146,6 @@ function! RMakePDF(bibtex, knit) endif let pdfcmd = pdfcmd . ")" - let g:needsnewomnilist = 1 let ok = g:SendCmdToR(pdfcmd) if ok == 0 return @@ -162,7 +161,6 @@ function! SendChunkToR(e, m) let chunkline = search("^<<", "bncW") + 1 let docline = search("^@", "ncW") - 1 let lines = getline(chunkline, docline) - let g:needsnewomnilist = 1 let ok = RSourceLines(lines, a:e) if ok == 0 return @@ -175,7 +173,6 @@ endfunction " Sweave the current buffer content function! RSweave() update - let g:needsnewomnilist = 1 call RSetWD() if exists("g:vimrplugin_sweaveargs") call g:SendCmdToR('Sweave("' . expand("%:t") . '", ' . g:vimrplugin_sweaveargs . ')') diff --git a/ftplugin/rrst.vim b/ftplugin/rrst.vim index 0c72086..948ba22 100644 --- a/ftplugin/rrst.vim +++ b/ftplugin/rrst.vim @@ -124,7 +124,6 @@ function! RMakeHTMLrrst(t) if g:vimrplugin_openhtml && a:t == "html" let rcmd = rcmd . '; browseURL("' . expand("%:r:t") . '.html")' endif - let g:needsnewomnilist = 1 call g:SendCmdToR(rcmd) endfunction @@ -162,7 +161,6 @@ function! RMakePDFrrst() let pdfcmd = pdfcmd . ", " . g:vimrplugin_rst2pdfargs endif let pdfcmd = pdfcmd . ")" - let g:needsnewomnilist = 1 let ok = g:SendCmdToR(pdfcmd) if ok == 0 return @@ -178,7 +176,6 @@ function! SendRrstChunkToR(e, m) let chunkline = search("^\\.\\. {r", "bncW") + 1 let docline = search("^\\.\\. \\.\\.", "ncW") - 1 let lines = getline(chunkline, docline) - let g:needsnewomnilist = 1 let ok = RSourceLines(lines, a:e) if ok == 0 return diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 5bc4fb7..c29206d 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -210,7 +210,7 @@ function RCompleteArgs() let argkey = strpart(line, idx1, idx2 - idx1 + 1) let idx2 = cpos[2] - strlen(argkey) endif - if g:needsnewomnilist == 1 + if string(g:SendCmdToR) != "function('SendCmdToR_fake')" call BuildROmniList() endif let flines = g:rplugin_globalenvlines + g:rplugin_liblist @@ -1397,7 +1397,6 @@ endfunction " Send file to R function SendFileToR(e) - let g:needsnewomnilist = 1 update let fpath = expand("%:p") if has("win32") || has("win64") @@ -1431,7 +1430,6 @@ function SendMBlockToR(e, m) return endif - let g:needsnewomnilist = 1 let curline = line(".") let lineA = 1 let lineB = line("$") @@ -1486,7 +1484,6 @@ function SendFunctionToR(e, m) return endif - let g:needsnewomnilist = 1 let startline = line(".") let save_cursor = getpos(".") let line = SanitizeRLine(getline(".")) @@ -1569,8 +1566,6 @@ function SendSelectionToR(e, m) return endif - let g:needsnewomnilist = 1 - if line("'<") == line("'>") let i = col("'<") - 1 let j = col("'>") - i @@ -1645,7 +1640,6 @@ function SendParagraphToR(e, m) return endif - let g:needsnewomnilist = 1 let i = line(".") let c = col(".") let max = line("$") @@ -1736,7 +1730,6 @@ function SendLineToR(godown) endif endif - let g:needsnewomnilist = 1 let ok = g:SendCmdToR(line) if ok if a:godown =~ "down" @@ -1849,7 +1842,6 @@ endfunction " knit the current buffer content function! RKnit() update - let g:needsnewomnilist = 1 call RSetWD() call g:SendCmdToR('require(knitr); knit("' . expand("%:t") . '")') endfunction @@ -1871,7 +1863,6 @@ function BuildROmniList() endif let rtf = g:rplugin_globalenvfname - let g:needsnewomnilist = 0 let omnilistcmd = 'vim.bol("' . rtf . '"' if g:vimrplugin_allnames == 1 let omnilistcmd = omnilistcmd . ', allnames = TRUE' @@ -1883,13 +1874,11 @@ function BuildROmniList() exe "Py SendToVimCom('" . omnilistcmd . "')" if g:rplugin_vimcomport == 0 sleep 500m - let g:needsnewomnilist = 1 return endif let g:rplugin_lastrpl = ReadEvalReply() if g:rplugin_lastrpl == "R is busy." || g:rplugin_lastrpl == "No reply" call RWarningMsg(g:rplugin_lastrpl) - let g:needsnewomnilist = 1 sleep 800m return endif @@ -3540,11 +3529,6 @@ endif call SetRPath() -" Automatically rebuild the file listing .GlobalEnv objects for omni -" completion if the user press and we know that the file either was -" not created yet or is outdated. -let g:needsnewomnilist = 0 - " Keeps the names object list in memory to avoid the need of reading the files " repeatedly: let g:rplugin_libls = split(g:vimrplugin_permanent_libs, ",") From 6566d52d65a2d2bd397e601ba5e2f33c51c3295f Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Wed, 13 Nov 2013 09:16:10 -0300 Subject: [PATCH 0551/1050] Note on https://github.com/jalvesaq/screenR --- doc/r-plugin.txt | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 45e7bff..f6511f7 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -54,7 +54,7 @@ Vim-R-plugin (see |vimrplugin_source|). * Syntax highlighting for R code, including: - Special characters in strings. - - Functions of all installed packages (must be updated manually). + - Functions of loaded packages. - Special highlighting for R output (.Rout files). - Spell check only strings and comments. - Fold code when foldmethod=syntax. @@ -203,6 +203,11 @@ dependencies: * R's version must be >= 3.0.0: http://www.r-project.org/ + * vimcom.plus = 0.9-92: http://www.lepem.ufc.br/jaa/vimcom.plus.html + + Note: If you cannot build vimcom.plus yourself, you will want to + download and install the zip file. + * Vim's version must be >= 7.4: http://www.vim.org/download.php * Python 2.7.5 (32 bit): http://www.python.org/download/ @@ -217,11 +222,6 @@ dependencies: versions. Please, read |r-plugin-python| if want to use different versions. - * vimcom.plus = 0.9-92: http://www.lepem.ufc.br/jaa/vimcom.plus.html - - Note: If you cannot build vimcom.plus yourself, you will want to - download and install the zip file. - Now, download the latest version of `Vim-R-plugin.vmb` from http://www.vim.org/scripts/script.php?script_id=2628 @@ -910,7 +910,6 @@ And in Normal mode Vim do: > :let rplugin_rconsole_pane = "X" :let rplugin_tmuxsname = "Y" - :let g:needsnewomnilist = 1 < Finally, do one of the commands below in Normal mode Vim, according to how R is running: @@ -951,7 +950,7 @@ is running: |vimrplugin_applescript| Use osascript in Mac OS X |vimrplugin_listmethods| Do `vim.list.args()` instead of `args()` |vimrplugin_specialplot| Do `vim.plot()` instead of `plot()` -|vimrplugin_maxdeparse| Argument to R `args()` function +|vimrplugin_maxdeparse| Argument to R `source()` function |vimrplugin_latexcmd| Command to run on .tex files |vimrplugin_sweaveargs| Arguments do `Sweave()` |vimrplugin_never_unmake_menu| Do not unmake the menu when switching buffers @@ -1447,9 +1446,11 @@ scripts, put in your |vimrc|: > let vimrplugin_source = "~/path/to/MyScript.vim,/path/to/AnotherScript.vim" < -Currently, there is only one script known to extend the Vim-R-plugin features: +Currently, there are only two scripts known to extend the Vim-R-plugin +features: - https://github.com/mllg/vim-devtools-plugin + - https://github.com/jalvesaq/screenR 6.28. Restart R if it is already running (Linux/Unix only)~ @@ -1487,7 +1488,7 @@ will be shown only if "preview" is included in your 'completeopt'. When creating custom key bindings for the Vim-R-plugin, it is necessary to create three maps for most functions because the way the function is called is different in each Vim mode. Thus, key bindings must be made for Normal mode, -insert mode, and visual mode. +Insert mode, and Visual mode. To customize a key binding you should put in your |vimrc| something like: > @@ -1949,7 +1950,7 @@ the R package "debug": > install.packages("debug") library(debug) - mtrace(function) + mtrace(function_name) < Once the library is installed and loaded, you should use `mtrace(function_name)` to enable the debugging of a function. Then, the next time that the function @@ -1959,9 +1960,6 @@ function and `qqq()` to quit the function (See debug's help for details). A useful tip is to click on the title bar of the debug window and choose "Always on top" or a similar option provided by your desktop manager. -There is also the R package "edtdbg" which aims to integrate R debugging -facilities with Vim. - 9.17. Turn the R-plugin into a global plugin~ *r-plugin-global* @@ -2190,7 +2188,7 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details. *r-plugin-news* 10. News~ -0.9.9.8 (2013-11-10) +0.9.9.8 (2013-11-13) * The list of objects for omnicompletion and the list of functions for syntax highlight now are built dynamically. Deprecated commands and options: From 541129a765403bdc07bc19f206b5514e8c41acbe Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 14 Nov 2013 22:06:55 -0300 Subject: [PATCH 0552/1050] Pointers to similar functions: Rnw, Rmd, Rrst... Create pointers to functions that have similar goals but are of different file types and call these pointers in common_global.vim instead of calling the functions directly. One advantage is that the code becomes less repetitive and easier to maintain. --- autoload/rcomplete.vim | 2 +- ftplugin/r.vim | 7 + ftplugin/rdoc.vim | 14 ++ ftplugin/rhelp.vim | 15 ++ ftplugin/rmd.vim | 33 +++-- ftplugin/rnoweb.vim | 30 ++-- ftplugin/rrst.vim | 31 ++-- r-plugin/common_global.vim | 290 +++++++++++-------------------------- 8 files changed, 181 insertions(+), 241 deletions(-) diff --git a/autoload/rcomplete.vim b/autoload/rcomplete.vim index f4e5808..0d659d6 100644 --- a/autoload/rcomplete.vim +++ b/autoload/rcomplete.vim @@ -4,7 +4,7 @@ " fun! rcomplete#CompleteR(findstart, base) - if &filetype == "rnoweb" && RnwIsInRCode() == 0 && exists("*LatexBox_Complete") + if &filetype == "rnoweb" && RnwIsInRCode(0) == 0 && exists("*LatexBox_Complete") let texbegin = LatexBox_Complete(a:findstart, a:base) return texbegin endif diff --git a/ftplugin/r.vim b/ftplugin/r.vim index bea11fa..e0d7036 100644 --- a/ftplugin/r.vim +++ b/ftplugin/r.vim @@ -92,9 +92,16 @@ function! RSpin() call g:SendCmdToR('require(knitr); spin("' . expand("%:t") . '")') endfunction +" Default IsInRCode function when the plugin is used as a global plugin +function DefaultIsInRCode(vrb) + return 1 +endfunction + "========================================================================== " Key bindings and menu items +let b:IsInRCode = function("DefaultIsInRCode") + call RCreateStartMaps() call RCreateEditMaps() diff --git a/ftplugin/rdoc.vim b/ftplugin/rdoc.vim index cc5c5b2..98359d1 100644 --- a/ftplugin/rdoc.vim +++ b/ftplugin/rdoc.vim @@ -66,9 +66,23 @@ function! FixRdoc() unlet old_undolevels endfunction +function! RdocIsInRCode(vrb) + let exline = search("^Examples:$", "bncW") + if exline > 0 && line(".") > exline + return 1 + else + if a:vrb + call RWarningMsg('Not in the "Examples" section.') + endif + return 0 + endif +endfunction + "========================================================================== " Key bindings and menu items +let b:IsInRCode = function("RdocIsInRCode") + call RCreateSendMaps() call RControlMaps() diff --git a/ftplugin/rhelp.vim b/ftplugin/rhelp.vim index c7cf31f..6ee404c 100644 --- a/ftplugin/rhelp.vim +++ b/ftplugin/rhelp.vim @@ -45,9 +45,24 @@ runtime r-plugin/common_buffer.vim setlocal iskeyword=@,48-57,_,. +function! RhelpIsInRCode(vrb) + let lastsec = search('^\\[a-z][a-z]*{', "bncW") + let secname = getline(lastsec) + if line(".") > lastsec && (secname =~ '^\\usage{' || secname =~ '^\\examples{' || secname =~ '^\\dontshow{' || secname =~ '^\\dontrun{' || secname =~ '^\\donttest{' || secname =~ '^\\testonly{') + return 1 + else + if a:vrb + call RWarningMsg("Not inside an R section.") + endif + return 0 + endif +endfunction + "========================================================================== " Key bindings and menu items +let b:IsInRCode = function("RhelpIsInRCode") + call RCreateStartMaps() call RCreateEditMaps() call RCreateSendMaps() diff --git a/ftplugin/rmd.vim b/ftplugin/rmd.vim index 9b91b5b..45c5209 100644 --- a/ftplugin/rmd.vim +++ b/ftplugin/rmd.vim @@ -52,15 +52,15 @@ endif " be defined after the global ones: runtime r-plugin/common_buffer.vim -function! RmdIsInRCode() - let curline = line(".") +function! RmdIsInRCode(vrb) let chunkline = search("^[ \t]*```[ ]*{r", "bncW") - call cursor(chunkline) - let docline = search("^[ \t]*```$", "ncW") - call cursor(curline) - if 0 < chunkline && chunkline < curline && curline < docline + let docline = search("^[ \t]*```$", "bncW") + if chunkline > docline && chunkline != line(".") return 1 else + if a:vrb + call RWarningMsg("Not inside an R code chunk.") + endif return 0 endif endfunction @@ -70,7 +70,7 @@ function! RmdPreviousChunk() range let chunk = len(rg) for var in range(1, chunk) let curline = line(".") - if RmdIsInRCode() + if RmdIsInRCode(0) let i = search("^[ \t]*```[ ]*{r", "bnW") if i != 0 call cursor(i-1, 1) @@ -165,7 +165,7 @@ endfunction " Send Rmd chunk to R function! SendRmdChunkToR(e, m) - if RmdIsInRCode() == 0 + if RmdIsInRCode(0) == 0 call RWarningMsg("Not inside an R code chunk.") return endif @@ -181,6 +181,11 @@ function! SendRmdChunkToR(e, m) endif endfunction +let b:IsInRCode = function("RmdIsInRCode") +let b:PreviousRChunk = function("RmdPreviousChunk") +let b:NextRChunk = function("RmdNextChunk") +let b:SendChunkToR = function("SendRmdChunkToR") + "========================================================================== " Key bindings and menu items @@ -196,12 +201,12 @@ call RCreateMaps("nvi", 'RMakePDFK', 'kp', ':call RMakePDFrmd("latex")' call RCreateMaps("nvi", 'RMakePDFKb', 'kl', ':call RMakePDFrmd("beamer")') call RCreateMaps("nvi", 'RMakeHTML', 'kh', ':call RMakeHTMLrmd("html")') call RCreateMaps("nvi", 'RMakeODT', 'ko', ':call RMakeHTMLrmd("odt")') -call RCreateMaps("ni", 'RSendChunk', 'cc', ':call SendRmdChunkToR("silent", "stay")') -call RCreateMaps("ni", 'RESendChunk', 'ce', ':call SendRmdChunkToR("echo", "stay")') -call RCreateMaps("ni", 'RDSendChunk', 'cd', ':call SendRmdChunkToR("silent", "down")') -call RCreateMaps("ni", 'REDSendChunk', 'ca', ':call SendRmdChunkToR("echo", "down")') -nmap gn :call RmdNextChunk() -nmap gN :call RmdPreviousChunk() +call RCreateMaps("ni", 'RSendChunk', 'cc', ':call b:SendChunkToR("silent", "stay")') +call RCreateMaps("ni", 'RESendChunk', 'ce', ':call b:SendChunkToR("echo", "stay")') +call RCreateMaps("ni", 'RDSendChunk', 'cd', ':call b:SendChunkToR("silent", "down")') +call RCreateMaps("ni", 'REDSendChunk', 'ca', ':call b:SendChunkToR("echo", "down")') +nmap gn :call b:NextRChunk() +nmap gN :call b:PreviousRChunk() " Menu R if has("gui_running") diff --git a/ftplugin/rnoweb.vim b/ftplugin/rnoweb.vim index eab269b..aa1d41a 100644 --- a/ftplugin/rnoweb.vim +++ b/ftplugin/rnoweb.vim @@ -48,7 +48,7 @@ runtime r-plugin/common_buffer.vim setlocal iskeyword=@,48-57,_,. function! RWriteChunk() - if getline(".") =~ "^\\s*$" && RnwIsInRCode() == 0 + if getline(".") =~ "^\\s*$" && RnwIsInRCode(0) == 0 call setline(line("."), "<<>>=") exe "normal! o@" exe "normal! 0kl" @@ -57,12 +57,15 @@ function! RWriteChunk() endif endfunction -function! RnwIsInRCode() +function! RnwIsInRCode(vrb) let chunkline = search("^<<", "bncW") let docline = search("^@", "bncW") - if chunkline > docline + if chunkline > docline && chunkline != line(".") return 1 else + if a:vrb + call RWarningMsg("Not inside an R code chunk.") + endif return 0 endif endfunction @@ -72,7 +75,7 @@ function! RnwPreviousChunk() range let chunk = len(rg) for var in range(1, chunk) let curline = line(".") - if RnwIsInRCode() + if RnwIsInRCode(0) let i = search("^<<.*$", "bnW") if i != 0 call cursor(i-1, 1) @@ -153,8 +156,8 @@ function! RMakePDF(bibtex, knit) endfunction " Send Sweave chunk to R -function! SendChunkToR(e, m) - if RnwIsInRCode() == 0 +function! RnwSendChunkToR(e, m) + if RnwIsInRCode(0) == 0 call RWarningMsg("Not inside an R code chunk.") return endif @@ -233,6 +236,13 @@ if g:vimrplugin_rnowebchunk == 1 imap < :call RWriteChunk()a endif +" Pointers to functions whose purposes are the same in rnoweb, rrst, rmd, +" rhelp and rdoc and which are called at common_global.vim +let b:IsInRCode = function("RnwIsInRCode") +let b:PreviousRChunk = function("RnwPreviousChunk") +let b:NextRChunk = function("RnwNextChunk") +let b:SendChunkToR = function("RnwSendChunkToR") + "========================================================================== " Key bindings and menu items @@ -251,10 +261,10 @@ call RCreateMaps("nvi", 'RMakePDFK', 'kp', ':call RMakePDF("nobib", 1)' call RCreateMaps("nvi", 'RBibTeXK', 'kb', ':call RMakePDF("bibtex", 1)') call RCreateMaps("nvi", 'ROpenPDF', 'op', ':call ROpenPDF()') call RCreateMaps("nvi", 'RIndent', 'si', ':call RnwToggleIndentSty()') -call RCreateMaps("ni", 'RSendChunk', 'cc', ':call SendChunkToR("silent", "stay")') -call RCreateMaps("ni", 'RESendChunk', 'ce', ':call SendChunkToR("echo", "stay")') -call RCreateMaps("ni", 'RDSendChunk', 'cd', ':call SendChunkToR("silent", "down")') -call RCreateMaps("ni", 'REDSendChunk', 'ca', ':call SendChunkToR("echo", "down")') +call RCreateMaps("ni", 'RSendChunk', 'cc', ':call b:SendChunkToR("silent", "stay")') +call RCreateMaps("ni", 'RESendChunk', 'ce', ':call b:SendChunkToR("echo", "stay")') +call RCreateMaps("ni", 'RDSendChunk', 'cd', ':call b:SendChunkToR("silent", "down")') +call RCreateMaps("ni", 'REDSendChunk', 'ca', ':call b:SendChunkToR("echo", "down")') nmap gn :call RnwNextChunk() nmap gN :call RnwPreviousChunk() diff --git a/ftplugin/rrst.vim b/ftplugin/rrst.vim index 948ba22..22d100e 100644 --- a/ftplugin/rrst.vim +++ b/ftplugin/rrst.vim @@ -46,15 +46,15 @@ setlocal iskeyword=@,48-57,_,. " defined after the global ones: runtime r-plugin/common_buffer.vim -function! RrstIsInRCode() - let curline = line(".") +function! RrstIsInRCode(vrb) let chunkline = search("^\\.\\. {r", "bncW") - call cursor(chunkline) let docline = search("^\\.\\. \\.\\.", "bncW") - call cursor(curline) - if chunkline > docline + if chunkline > docline && chunkline != line(".") return 1 else + if a:vrb + call RWarningMsg("Not inside an R code chunk.") + endif return 0 endif endfunction @@ -64,7 +64,7 @@ function! RrstPreviousChunk() range let chunk = len(rg) for var in range(1, chunk) let curline = line(".") - if RrstIsInRCode() + if RrstIsInRCode(0) let i = search("^\\.\\. {r", "bnW") if i != 0 call cursor(i-1, 1) @@ -169,7 +169,7 @@ endfunction " Send Rrst chunk to R function! SendRrstChunkToR(e, m) - if RrstIsInRCode() == 0 + if RrstIsInRCode(0) == 0 call RWarningMsg("Not inside an R code chunk.") return endif @@ -185,6 +185,11 @@ function! SendRrstChunkToR(e, m) endif endfunction +let b:IsInRCode = function("RrstIsInRCode") +let b:PreviousRChunk = function("RrstPreviousChunk") +let b:NextRChunk = function("RrstNextChunk") +let b:SendChunkToR = function("SendRrstChunkToR") + "========================================================================== " Key bindings and menu items @@ -200,12 +205,12 @@ call RCreateMaps("nvi", 'RMakePDFK', 'kp', ':call RMakePDFrrst()') call RCreateMaps("nvi", 'RMakeHTML', 'kh', ':call RMakeHTMLrrst("html")') call RCreateMaps("nvi", 'RMakeODT', 'ko', ':call RMakeHTMLrrst("odt")') call RCreateMaps("nvi", 'RIndent', 'si', ':call RrstToggleIndentSty()') -call RCreateMaps("ni", 'RSendChunk', 'cc', ':call SendRrstChunkToR("silent", "stay")') -call RCreateMaps("ni", 'RESendChunk', 'ce', ':call SendRrstChunkToR("echo", "stay")') -call RCreateMaps("ni", 'RDSendChunk', 'cd', ':call SendRrstChunkToR("silent", "down")') -call RCreateMaps("ni", 'REDSendChunk', 'ca', ':call SendRrstChunkToR("echo", "down")') -nmap gn :call RrstNextChunk() -nmap gN :call RrstPreviousChunk() +call RCreateMaps("ni", 'RSendChunk', 'cc', ':call b:SendChunkToR("silent", "stay")') +call RCreateMaps("ni", 'RESendChunk', 'ce', ':call b:SendChunkToR("echo", "stay")') +call RCreateMaps("ni", 'RDSendChunk', 'cd', ':call b:SendChunkToR("silent", "down")') +call RCreateMaps("ni", 'REDSendChunk', 'ca', ':call b:SendChunkToR("echo", "down")') +nmap gn :call b:NextRChunk() +nmap gN :call b:PreviousRChunk() " Menu R if has("gui_running") diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index c29206d..a5ed5bc 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -72,7 +72,7 @@ function RSetDefaultValue(var, val) endfunction function ReplaceUnderS() - if (&filetype == "rnoweb" || &filetype == "tex") && RnwIsInRCode() == 0 + if &filetype != "r" && b:IsInRCode(0) == 0 let isString = 1 else let j = col(".") @@ -323,33 +323,6 @@ function RCompleteArgs() return '' endfunction -function IsRCode(lnum) - let save_cursor = getpos(".") - call cursor(a:lnum, 0) - let isRcode = 1 - if &filetype == "rnoweb" && RnwIsInRCode() == 0 - let isRcode = 0 - endif - if &filetype == "rrst" && RrstIsInRCode() == 0 - let isRcode = 0 - endif - if &filetype == "rmd" && RmdIsInRCode() == 0 - let isRcode = 0 - endif - if &filetype == "rhelp" - let lastsection = search('^\\[a-z]*{', "bncW") - let secname = getline(lastsection) - if secname =~ '^\\usage{' || secname =~ '^\\examples{' || secname =~ '^\\dontshow{' || secname =~ '^\\dontrun{' || secname =~ '^\\donttest{' || secname =~ '^\\testonly{' - let isRcode = 1 - else - let isRcode = 0 - endif - endif - call setpos(".", save_cursor) - let g:risrcode = isRcode - return isRcode -endfunction - function RGetFL(mode) if a:mode == "normal" let fline = line(".") @@ -366,28 +339,32 @@ function RGetFL(mode) return [fline, lline] endfunction -function RSimpleCommentLine(mode) +function IsLineInRCode(vrb, line) + let save_cursor = getpos(".") + call setpos(".", [0, a:line, 1, 0]) + let isR = b:IsInRCode(a:vrb) + call setpos('.', save_cursor) + return isR +endfunction + +function RSimpleCommentLine(mode, what) let [fline, lline] = RGetFL(a:mode) - if IsRCode(fline) - let cstr = "#" - else + let cstr = "#" + if (&filetype == "rnoweb"|| &filetype == "rhelp") && IsLineInRCode(0, fline) == 0 let cstr = "%" + elseif (&filetype == "rmd" || &filetype == "rrst") && IsLineInRCode(0, fline) == 0 + return endif - for ii in range(fline, lline) - call setline(ii, cstr . getline(ii)) - endfor -endfunction -function RSimpleUncommentLine(mode) - let [fline, lline] = RGetFL(a:mode) - if IsRCode(fline) - let cstr = "#" + if a:what == "c" + for ii in range(fline, lline) + call setline(ii, cstr . getline(ii)) + endfor else - let cstr = "%" + for ii in range(fline, lline) + call setline(ii, substitute(getline(ii), "^" . cstr, "", "")) + endfor endif - for ii in range(fline, lline) - call setline(ii, substitute(getline(ii), "^" . cstr, "", "")) - endfor endfunction function RCommentLine(lnum, ind, cmt) @@ -418,19 +395,19 @@ function RComment(mode) let [fline, lline] = RGetFL(a:mode) " What comment string to use? - let isRcode = IsRCode(fline) - if isRcode == 0 - let cmt = '%' - else - if g:r_indent_ess_comments - if g:vimrplugin_indent_commented - let cmt = '##' - else - let cmt = '###' - endif + if g:r_indent_ess_comments + if g:vimrplugin_indent_commented + let cmt = '##' else - let cmt = '#' + let cmt = '###' endif + else + let cmt = '#' + endif + if (&filetype == "rnoweb" || &filetype == "rhelp") && IsLineInRCode(0, fline) == 0 + let cmt = "%" + elseif (&filetype == "rmd" || &filetype == "rrst") && IsLineInRCode(0, fline) == 0 + return endif let lnum = fline @@ -543,36 +520,6 @@ function CountBraces(line) return result endfunction -function RnwPreviousChunk() - let curline = line(".") - if RnwIsInRCode() - let i = search("^<<.*$", "bnW") - if i != 0 - call cursor(i-1, 1) - endif - endif - - let i = search("^<<.*$", "bnW") - if i == 0 - call cursor(curline, 1) - call RWarningMsg("There is no previous R code chunk to go.") - else - call cursor(i+1, 1) - endif - return -endfunction - -function RnwNextChunk() - let linenr = search("^<<.*", "nW") - if linenr == 0 - call RWarningMsg("There is no next R code chunk to go.") - else - let linenr += 1 - call cursor(linenr, 1) - endif - return -endfunction - " Skip empty lines and lines whose first non blank char is '#' function GoDown() if &filetype == "rnoweb" @@ -588,6 +535,12 @@ function GoDown() call RmdNextChunk() return endif + elseif &filetype == "rrst" + let curline = getline(".") + if curline =~ '^\.\. \.\.$' + call RrstNextChunk() + return + endif endif let i = line(".") + 1 @@ -1274,6 +1227,8 @@ function SendCmdToR_TmuxSplit(cmd) endif if !exists("g:rplugin_rconsole_pane") + " Should never happen + call RWarningMsg("Missing internal variable: g:rplugin_rconsole_pane") endif let str = substitute(cmd, "'", "'\\\\''", "g") let scmd = "tmux set-buffer '" . str . "\' && tmux paste-buffer -t " . g:rplugin_rconsole_pane @@ -1413,20 +1368,7 @@ endfunction " Adapted of the plugin marksbrowser " Function to get the marks which the cursor is between function SendMBlockToR(e, m) - if &filetype == "rnoweb" && RnwIsInRCode() == 0 - call RWarningMsg("Not inside an R code chunk.") - return - endif - if &filetype == "rdoc" && search("^Examples:$", "bncW") == 0 - call RWarningMsg('Not in the "Examples" section.') - return - endif - if &filetype == "rrst" && RrstIsInRCode() == 0 - call RWarningMsg("Not inside an R code chunk.") - return - endif - if &filetype == "rmd" && RmdIsInRCode() == 0 - call RWarningMsg("Not inside an R code chunk.") + if &filetype != "r" && b:IsInRCode(1) == 0 return endif @@ -1467,20 +1409,7 @@ endfunction " Send functions to R function SendFunctionToR(e, m) - if &filetype == "rnoweb" && RnwIsInRCode() == 0 - call RWarningMsg("Not inside an R code chunk.") - return - endif - if &filetype == "rdoc" && search("^Examples:$", "bncW") == 0 - call RWarningMsg('Not in the "Examples" section.') - return - endif - if &filetype == "rrst" && RrstIsInRCode() == 0 - call RWarningMsg("Not inside an R code chunk.") - return - endif - if &filetype == "rmd" && RmdIsInRCode() == 0 - call RWarningMsg("Not inside an R code chunk.") + if &filetype != "r" && b:IsInRCode(1) == 0 return endif @@ -1549,20 +1478,7 @@ endfunction " Send selection to R function SendSelectionToR(e, m) - if &filetype == "rnoweb" && RnwIsInRCode() == 0 && !(line("'<") == line("'>") && getline(".") =~ "\\Sexpr") - call RWarningMsg("Not inside an R code chunk.") - return - endif - if &filetype == "rdoc" && search("^Examples:$", "bncW") == 0 - call RWarningMsg('Not in the "Examples" section.') - return - endif - if &filetype == "rrst" && RrstIsInRCode() == 0 - call RWarningMsg("Not inside an R code chunk.") - return - endif - if &filetype == "rmd" && RmdIsInRCode() == 0 - call RWarningMsg("Not inside an R code chunk.") + if &filetype != "r" && b:IsInRCode(1) == 0 return endif @@ -1623,20 +1539,7 @@ endfunction " Send paragraph to R function SendParagraphToR(e, m) - if &filetype == "rnoweb" && RnwIsInRCode() == 0 - call RWarningMsg("Not inside an R code chunk.") - return - endif - if &filetype == "rdoc" && search("^Examples:$", "bncW") == 0 - call RWarningMsg('Not in the "Examples" section.') - return - endif - if &filetype == "rrst" && RrstIsInRCode() == 0 - call RWarningMsg("Not inside an R code chunk.") - return - endif - if &filetype == "rmd" && RmdIsInRCode() == 0 - call RWarningMsg("Not inside an R code chunk.") + if &filetype != "r" && b:IsInRCode(1) == 0 return endif @@ -1690,46 +1593,53 @@ function SendLineToR(godown) endif return endif - if RnwIsInRCode() == 0 - call RWarningMsg("Not inside an R code chunk.") + if RnwIsInRCode(1) == 0 return endif endif - if &filetype == "rdoc" - if getline(1) =~ '^The topic' - let topic = substitute(line, '.*::', '', "") - let package = substitute(line, '::.*', '', "") - call ShowRDoc(topic, package, 1) + if &filetype == "rmd" + if line =~ "^```$" + if a:godown =~ "down" + call GoDown() + endif return endif - if search("^Examples:$", "bncW") == 0 - call RWarningMsg('Not in the "Examples" section.') + let line = substitute(line, "^\\`\\`\\?", "", "") + if RmdIsInRCode(1) == 0 return endif endif if &filetype == "rrst" + if line =~ "^\.\. \.\.$" + if a:godown =~ "down" + call GoDown() + endif + return + endif let line = substitute(line, "^\\.\\. \\?", "", "") - if RrstIsInRCode() == 0 - call RWarningMsg("Not inside an R code chunk.") + if RrstIsInRCode(1) == 0 return endif endif - if &filetype == "rmd" - if line =~ "^```$" - if a:godown =~ "down" - call GoDown() - endif + + if &filetype == "rdoc" + if getline(1) =~ '^The topic' + let topic = substitute(line, '.*::', '', "") + let package = substitute(line, '::.*', '', "") + call ShowRDoc(topic, package, 1) return endif - let line = substitute(line, "^\\`\\`\\?", "", "") - if RmdIsInRCode() == 0 - call RWarningMsg("Not inside an R code chunk.") + if RdocIsInRCode(1) == 0 return endif endif + if &filetype == "rhelp" && RhelpIsInRCode(1) == 0 + return + endif + let ok = g:SendCmdToR(line) if ok if a:godown =~ "down" @@ -2596,28 +2506,12 @@ function MakeRMenu() call RCreateMenuItem("ni", 'Send.Block\ (cur,\ down)', 'RDSendMBlock', 'bd', ':call SendMBlockToR("silent", "down")') call RCreateMenuItem("ni", 'Send.Block\ (cur,\ echo\ and\ down)', 'REDSendMBlock', 'ba', ':call SendMBlockToR("echo", "down")') "------------------------------- - if &filetype == "rnoweb" || g:vimrplugin_never_unmake_menu - menu R.Send.-Sep2- - call RCreateMenuItem("ni", 'Send.Chunk\ (cur)', 'RSendChunk', 'cc', ':call SendChunkToR("silent", "stay")') - call RCreateMenuItem("ni", 'Send.Chunk\ (cur,\ echo)', 'RESendChunk', 'ce', ':call SendChunkToR("echo", "stay")') - call RCreateMenuItem("ni", 'Send.Chunk\ (cur,\ down)', 'RDSendChunk', 'cd', ':call SendChunkToR("silent", "down")') - call RCreateMenuItem("ni", 'Send.Chunk\ (cur,\ echo\ and\ down)', 'REDSendChunk', 'ca', ':call SendChunkToR("echo", "down")') - endif - "------------------------------- - if &filetype == "rmd" || g:vimrplugin_never_unmake_menu - menu R.Send.-Sep2- - call RCreateMenuItem("ni", 'Send.Chunk\ (cur)', 'RSendChunk', 'cc', ':call SendRmdChunkToR("silent", "stay")') - call RCreateMenuItem("ni", 'Send.Chunk\ (cur,\ echo)', 'RESendChunk', 'ce', ':call SendRmdChunkToR("echo", "stay")') - call RCreateMenuItem("ni", 'Send.Chunk\ (cur,\ down)', 'RDSendChunk', 'cd', ':call SendRmdChunkToR("silent", "down")') - call RCreateMenuItem("ni", 'Send.Chunk\ (cur,\ echo\ and\ down)', 'REDSendChunk', 'ca', ':call SendRmdChunkToR("echo", "down")') - endif - "------------------------------- - if &filetype == "rrst" || g:vimrplugin_never_unmake_menu + if &filetype == "rnoweb" || &filetype == "rmd" || &filetype == "rrst" || g:vimrplugin_never_unmake_menu menu R.Send.-Sep2- - call RCreateMenuItem("ni", 'Send.Chunk\ (cur)', 'RSendChunk', 'cc', ':call SendRrstChunkToR("silent", "stay")') - call RCreateMenuItem("ni", 'Send.Chunk\ (cur,\ echo)', 'RESendChunk', 'ce', ':call SendRrstChunkToR("echo", "stay")') - call RCreateMenuItem("ni", 'Send.Chunk\ (cur,\ down)', 'RDSendChunk', 'cd', ':call SendRrstChunkToR("silent", "down")') - call RCreateMenuItem("ni", 'Send.Chunk\ (cur,\ echo\ and\ down)', 'REDSendChunk', 'ca', ':call SendRrstChunkToR("echo", "down")') + call RCreateMenuItem("ni", 'Send.Chunk\ (cur)', 'RSendChunk', 'cc', ':call b:SendChunkToR("silent", "stay")') + call RCreateMenuItem("ni", 'Send.Chunk\ (cur,\ echo)', 'RESendChunk', 'ce', ':call b:SendChunkToR("echo", "stay")') + call RCreateMenuItem("ni", 'Send.Chunk\ (cur,\ down)', 'RDSendChunk', 'cd', ':call b:SendChunkToR("silent", "down")') + call RCreateMenuItem("ni", 'Send.Chunk\ (cur,\ echo\ and\ down)', 'REDSendChunk', 'ca', ':call b:SendChunkToR("echo", "down")') endif "------------------------------- menu R.Send.-Sep3- @@ -2732,26 +2626,16 @@ function MakeRMenu() menu R.Edit.-Sep72- call RCreateMenuItem("ni", 'Edit.Toggle\ comment\ (line/sel)', 'RToggleComment', 'xx', ':call RComment("normal")') call RCreateMenuItem("v", 'Edit.Toggle\ comment\ (line/sel)', 'RToggleComment', 'xx', ':call RComment("selection")') - call RCreateMenuItem("ni", 'Edit.Comment\ (line/sel)', 'RToggleComment', 'xc', ':call RComment("normal")') - call RCreateMenuItem("v", 'Edit.Comment\ (line/sel)', 'RToggleComment', 'xc', ':call RComment("selection")') - call RCreateMenuItem("ni", 'Edit.Uncomment\ (line/sel)', 'RToggleComment', 'xu', ':call RComment("normal")') - call RCreateMenuItem("v", 'Edit.Uncomment\ (line/sel)', 'RToggleComment', 'xu', ':call RComment("selection")') + call RCreateMenuItem("ni", 'Edit.Comment\ (line/sel)', 'RSimpleComment', 'xc', ':call RSimpleCommentLine("normal", "c")') + call RCreateMenuItem("v", 'Edit.Comment\ (line/sel)', 'RSimpleComment', 'xc', ':call RSimpleCommentLine("selection", "c")') + call RCreateMenuItem("ni", 'Edit.Uncomment\ (line/sel)', 'RSimpleUnComment', 'xu', ':call RSimpleCommentLine("normal", "u")') + call RCreateMenuItem("v", 'Edit.Uncomment\ (line/sel)', 'RSimpleUnComment', 'xu', ':call RSimpleCommentLine("selection", "u")') call RCreateMenuItem("ni", 'Edit.Add/Align\ right\ comment\ (line,\ sel)', 'RRightComment', ';', ':call MovePosRCodeComment("normal")') call RCreateMenuItem("v", 'Edit.Add/Align\ right\ comment\ (line,\ sel)', 'RRightComment', ';', ':call MovePosRCodeComment("selection")') - if &filetype == "rnoweb" || g:vimrplugin_never_unmake_menu - menu R.Edit.-Sep73- - nmenu R.Edit.Go\ (next\ R\ chunk)gn :call RnwNextChunk() - nmenu R.Edit.Go\ (previous\ R\ chunk)gN :call RnwPreviousChunk() - endif - if &filetype == "rrst" || g:vimrplugin_never_unmake_menu - menu R.Edit.-Sep73- - nmenu R.Edit.Go\ (next\ R\ chunk)gn :call RrstNextChunk() - nmenu R.Edit.Go\ (previous\ R\ chunk)gN :call RrstPreviousChunk() - endif - if &filetype == "rmd" || g:vimrplugin_never_unmake_menu + if &filetype == "rnoweb" || &filetype == "rrst" || &filetype == "rmd" || g:vimrplugin_never_unmake_menu menu R.Edit.-Sep73- - nmenu R.Edit.Go\ (next\ R\ chunk)gn :call RmdNextChunk() - nmenu R.Edit.Go\ (previous\ R\ chunk)gN :call RmdPreviousChunk() + nmenu R.Edit.Go\ (next\ R\ chunk)gn :call b:NextRChunk() + nmenu R.Edit.Go\ (previous\ R\ chunk)gN :call b:PreviousRChunk() endif endif @@ -2923,10 +2807,10 @@ function RCreateEditMaps() "------------------------------------- call RCreateMaps("ni", 'RToggleComment', 'xx', ':call RComment("normal")') call RCreateMaps("v", 'RToggleComment', 'xx', ':call RComment("selection")') - call RCreateMaps("ni", 'RSimpleComment', 'xc', ':call RSimpleCommentLine("normal")') - call RCreateMaps("v", 'RSimpleComment', 'xc', ':call RSimpleCommentLine("selection")') - call RCreateMaps("ni", 'RSimpleUnComment', 'xu', ':call RSimpleUncommentLine("normal")') - call RCreateMaps("v", 'RSimpleUnComment', 'xu', ':call RSimpleUncommentLine("selection")') + call RCreateMaps("ni", 'RSimpleComment', 'xc', ':call RSimpleCommentLine("normal", "c")') + call RCreateMaps("v", 'RSimpleComment', 'xc', ':call RSimpleCommentLine("selection", "c")') + call RCreateMaps("ni", 'RSimpleUnComment', 'xu', ':call RSimpleCommentLine("normal", "u")') + call RCreateMaps("v", 'RSimpleUnComment', 'xu', ':call RSimpleCommentLine("selection", "u")') call RCreateMaps("ni", 'RRightComment', ';', ':call MovePosRCodeComment("normal")') call RCreateMaps("v", 'RRightComment', ';', ':call MovePosRCodeComment("selection")') " Replace 'underline' with '<-' @@ -3000,7 +2884,7 @@ function RBufEnter() endif endif endif - if &buftype != "nofile" || (&buftype == "nofile" && &filetype != "rbrowser") + if &buftype != "nofile" || (&buftype == "nofile" && &filetype == "rbrowser") let g:rplugin_lastft = &filetype endif endif From fddba6b9fd4aae79edbef589024ae2cd56a2c578 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 14 Nov 2013 23:00:25 -0300 Subject: [PATCH 0553/1050] New command \ch sends lines: 1st chunk--here. --- doc/r-plugin.txt | 18 +++++++++++++++--- r-plugin/common_global.vim | 39 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+), 3 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index f6511f7..d252acb 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -351,6 +351,7 @@ Send . Chunk (cur, echo) \ce . Chunk (cur, down) \cd . Chunk (cur, echo and down) \ca + . Chunk (from first to here) \ch -------------------------------------------------------- . Function (cur) \ff . Function (cur, echo) \fe @@ -546,6 +547,10 @@ mode: [count]gn : go to the next chunk of R code [count]gN : go to the previous chunk of R code +The commands cc, ce, cd and ca send the current chunk of R code +to R Console. The command ch sends the R code from the first +chunk up to the current line. + 4.3. Omni completion and the highlighting of functions~ @@ -1449,8 +1454,11 @@ scripts, put in your |vimrc|: Currently, there are only two scripts known to extend the Vim-R-plugin features: - - https://github.com/mllg/vim-devtools-plugin - - https://github.com/jalvesaq/screenR + Support to the devtools R package~ + https://github.com/mllg/vim-devtools-plugin + + Basic integration with GNU screen~ + https://github.com/jalvesaq/screenR 6.28. Restart R if it is already running (Linux/Unix only)~ @@ -1571,6 +1579,7 @@ RD, "cursor down"; RED, both "echo" and "down"): RDSendChunk RESendChunk REDSendChunk + RSendChunkFH (from the first chunk to here) RBibTeX (Sweave) RBibTeXK (Knitr) RSweave @@ -2188,7 +2197,7 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details. *r-plugin-news* 10. News~ -0.9.9.8 (2013-11-13) +0.9.9.8 (2013-11-14) * The list of objects for omnicompletion and the list of functions for syntax highlight now are built dynamically. Deprecated commands and options: @@ -2197,6 +2206,9 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details. * New options: vimrplugin_show_args. + * New command \ch: send to R Console all R code from the first chunk up to + this line. + * Remove toolbar icons (they still may be added back manually by interested users). diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index a5ed5bc..dd53351 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -1576,6 +1576,40 @@ function SendParagraphToR(e, m) endif endfunction +" Send R code from the first chunk up to current line +function SendFHChunkToR() + if &filetype == "rnoweb" + let begchk = "^<<.*>>=\$" + let endchk = "^@" + elseif &filetype == "rmd" + let begchk = "^[ \t]*```[ ]*{r" + let endchk = "^[ \t]*```$" + elseif &filetype == "rrst" + let begchk = "^\\.\\. {r" + let endchk = "^\\.\\. \\.\\." + else + " Should never happen + call RWarningMsg('Strange filetype (SendFHChunkToR): "' . &filetype '"') + endif + + let codelines = [] + let here = line(".") + let curbuf = getline(1, "$") + let idx = 1 + while idx < here + if curbuf[idx] =~ begchk + let idx += 1 + while curbuf[idx] !~ endchk && idx < here + let codelines += [curbuf[idx]] + let idx += 1 + endwhile + else + let idx += 1 + endif + endwhile + call RSourceLines(codelines, "silent") +endfunction + " Send current line to R. function SendLineToR(godown) let line = getline(".") @@ -2512,6 +2546,7 @@ function MakeRMenu() call RCreateMenuItem("ni", 'Send.Chunk\ (cur,\ echo)', 'RESendChunk', 'ce', ':call b:SendChunkToR("echo", "stay")') call RCreateMenuItem("ni", 'Send.Chunk\ (cur,\ down)', 'RDSendChunk', 'cd', ':call b:SendChunkToR("silent", "down")') call RCreateMenuItem("ni", 'Send.Chunk\ (cur,\ echo\ and\ down)', 'REDSendChunk', 'ca', ':call b:SendChunkToR("echo", "down")') + call RCreateMenuItem("ni", 'Send.Chunk\ (from\ first\ to\ here)', 'RSendChunkFH', 'ch', ':call SendFHChunkToR()') endif "------------------------------- menu R.Send.-Sep3- @@ -2853,6 +2888,10 @@ function RCreateSendMaps() call RCreateMaps("ni", 'RDSendParagraph', 'pd', ':call SendParagraphToR("silent", "down")') call RCreateMaps("ni", 'REDSendParagraph', 'pa', ':call SendParagraphToR("echo", "down")') + if &filetype == "rnoweb" || &filetype == "rmd" || &filetype == "rrst" + call RCreateMaps("ni", 'RSendChunkFH', 'ch', ':call SendFHChunkToR()') + endif + " *Line* "------------------------------------- call RCreateMaps("ni", 'RSendLine', 'l', ':call SendLineToR("stay")') From ba6b8b6d4adc5161e2c8abd454a3498f05bb1777 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 16 Nov 2013 00:26:57 -0300 Subject: [PATCH 0554/1050] Set VIM_PANE environment variable if inside Tmux. --- r-plugin/common_global.vim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index dd53351..ff25070 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -568,13 +568,14 @@ function TmuxActivePane() endfunction function StartR_TmuxSplit(rcmd) + let g:rplugin_vim_pane = TmuxActivePane() call system("tmux set-environment -g VIMRPLUGIN_TMPDIR " . g:rplugin_esc_tmpdir) call system("tmux set-environment -g VIMRPLUGIN_HOME " . g:rplugin_home) + call system("tmux set-environment -g VIM_PANE " . g:rplugin_vim_pane) if v:servername != "" call system("tmux set-environment VIMEDITOR_SVRNM " . v:servername) endif call system("tmux set-environment VIMINSTANCEID " . $VIMINSTANCEID) - let g:rplugin_vim_pane = TmuxActivePane() let tcmd = "tmux split-window " if g:vimrplugin_vsplit if g:vimrplugin_rconsole_width == -1 From bbc2e3c2e9fbacf5af12915716113c31a74c8c1b Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 16 Nov 2013 09:45:46 -0300 Subject: [PATCH 0555/1050] Don't send neither ^A nor ^K to bash. --- r-plugin/common_global.vim | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index ff25070..81315ec 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -604,7 +604,10 @@ function StartR_TmuxSplit(rcmd) let g:SendCmdToR = function('SendCmdToR_TmuxSplit') if g:vimrplugin_restart sleep 200m + let ca_ck = g:vimrplugin_ca_ck + let g:vimrplugin_ca_ck = 0 call g:SendCmdToR(a:rcmd) + let g:vimrplugin_ca_ck = ca_ck endif let g:rplugin_last_rcmd = a:rcmd endfunction @@ -1766,7 +1769,10 @@ function RQuit(how) sleep 200m endif if g:vimrplugin_restart + let ca_ck = g:vimrplugin_ca_ck + let g:vimrplugin_ca_ck = 0 call g:SendCmdToR("exit") + let g:vimrplugin_ca_ck = ca_ck endif endif endif From eeb922a6766f0e59136961a9175ab00f52b17b3d Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 16 Nov 2013 10:01:24 -0300 Subject: [PATCH 0556/1050] Redefine DefaultIsInRCode() if necessary. --- ftplugin/r.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ftplugin/r.vim b/ftplugin/r.vim index e0d7036..d352473 100644 --- a/ftplugin/r.vim +++ b/ftplugin/r.vim @@ -93,7 +93,7 @@ function! RSpin() endfunction " Default IsInRCode function when the plugin is used as a global plugin -function DefaultIsInRCode(vrb) +function! DefaultIsInRCode(vrb) return 1 endfunction From 8278eee7ef2b3cce3fe528500e5476b410a4ba3b Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 16 Nov 2013 19:27:28 -0300 Subject: [PATCH 0557/1050] Set latexmk as default if installed. --- r-plugin/common_global.vim | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 81315ec..8ead8f9 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -3085,11 +3085,16 @@ call RSetDefaultValue("g:vimrplugin_show_args", 0) call RSetDefaultValue("g:vimrplugin_indent_commented", 1) call RSetDefaultValue("g:vimrplugin_never_unmake_menu", 0) call RSetDefaultValue("g:vimrplugin_vimpager", "'tab'") -call RSetDefaultValue("g:vimrplugin_latexcmd", "'pdflatex'") call RSetDefaultValue("g:vimrplugin_objbr_place", "'script,right'") call RSetDefaultValue("g:vimrplugin_insert_mode_cmds", 1) call RSetDefaultValue("g:vimrplugin_permanent_libs", "'base,stats,graphics,grDevices,utils,datasets,methods'") +if executable("latexmk") + call RSetDefaultValue("g:vimrplugin_latexcmd", "'latexmk -pdf'") +else + call RSetDefaultValue("g:vimrplugin_latexcmd", "'pdflatex'") +endif + " Look for invalid options let objbrplace = split(g:vimrplugin_objbr_place, ",") let obpllen = len(objbrplace) - 1 From 74010f90e66682e2801bc83ac64f68f46a67a414 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 16 Nov 2013 19:54:05 -0300 Subject: [PATCH 0558/1050] Use remote_expr() to open R doc on Editor pane. --- r-plugin/common_global.vim | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 8ead8f9..18f2809 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -887,7 +887,7 @@ function StartObjBrowser_Tmux() endif call writefile([ - \ 'let g:rplugin_editor_sname = ' . myservername, + \ 'let g:rplugin_editor_sname = "' . myservername . '"', \ 'let g:rplugin_vim_pane = "' . g:rplugin_vim_pane . '"', \ 'let g:rplugin_rconsole_pane = "' . g:rplugin_rconsole_pane . '"', \ 'let b:objbrtitle = "' . b:objbrtitle . '"', @@ -1731,6 +1731,7 @@ function RSetWD() let wdcmd = substitute(wdcmd, "\\", "/", "g") endif call g:SendCmdToR(wdcmd) + sleep 100m endfunction function CloseExternalOB() @@ -2262,9 +2263,13 @@ function RAction(rcmd) if g:rplugin_vim_pane == "none" call RWarningMsg("Cmd not available.") else - let slog = system("tmux set-buffer '" . "\" . ':call ShowRDoc("' . rkeyword . '", "' . pkg . '", 0)' . "\' && tmux paste-buffer -t " . g:rplugin_vim_pane . " && tmux select-pane -t " . g:rplugin_vim_pane) - if v:shell_error - call RWarningMsg(slog) + if g:rplugin_editor_sname == "" + let slog = system("tmux set-buffer '" . "\" . ':call ShowRDoc("' . rkeyword . '", "' . pkg . '", 0)' . "\' && tmux paste-buffer -t " . g:rplugin_vim_pane . " && tmux select-pane -t " . g:rplugin_vim_pane) + if v:shell_error + call RWarningMsg(slog) + endif + else + silent exe 'call remote_expr("' . g:rplugin_editor_sname . '", ' . "'ShowRDoc(" . '"' . rkeyword . '", "' . pkg . '", 0)' . "')" endif endif else From 0974e9cfbf8d75d63ec99bd1b78a6fc9c1883264 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 16 Nov 2013 20:32:48 -0300 Subject: [PATCH 0559/1050] Documentation update. Latexmk is the new default application to compile pdf from Rnw. New tip: use vimrw3mbrowser to browse R documentation (thanks to theo). --- doc/r-plugin.txt | 64 +++++++++++++++++++++++++++++++++++++----------- 1 file changed, 50 insertions(+), 14 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index d252acb..aa4e56a 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -1299,11 +1299,11 @@ Example: *vimrplugin_latexcmd* *vimrplugin_sweaveargs* On Windows, the plugin calls `tools::texi2pdf()` to build the pdf from the -generated .tex file. On Linux/Unix, by default, Vim calls pdflatex to produce -a pdf document from the .tex file produced by the R Sweave command. You can -use the option vimrplugin_latexcmd to change this behavior. Examples: +generated .tex file. On Linux/Unix, by default, Vim calls `latexmk` `-pdf` to +produce a pdf document from the .tex file produced by either `Sweave()` or +`knit()` command. If `latexmk` is not installed, it calls `pdflatex`. You can +use the option vimrplugin_latexcmd to change this behavior. Example: > - let vimrplugin_latexcmd = "latexmk -pdf" let vimrplugin_latexcmd = "latex" < If you want to pass arguments do the `Sweave()` function, set the value of the @@ -1906,7 +1906,7 @@ code automatically, breaking only comment lines, put in your |vimrc|: 9.13. Vim with 256 colors in a terminal emulator (Linux/Unix only)~ If you want 256 colors support in Vim, install the package ncurses-term. Then -put in your ~/.bashrc the lines suggested at |r-plugin-quick-bash-setup|. +put in your ~/.bashrc the lines suggested at |r-plugin-bash-setup|. Finally, put in your |vimrc|: > if &term =~ "xterm" || &term =~ "256" || $DISPLAY != "" @@ -1931,7 +1931,7 @@ line in your |vimrc|: 9.15. Edit your ~/.Rprofile~ *r-plugin-Rprofile* You may want to edit your ~/.Rprofile in addition to considering the -suggestions of |r-plugin-quick-R-setup| you may also want to put the following +suggestions of |r-plugin-R-setup| you may also want to put the following lines in your .Rprofile if you are using Linux: > grDevices::X11.options(width = 4.5, height = 4, ypos = 0, @@ -2058,7 +2058,7 @@ please read this document from the beginning. vmap RDSendSelection nmap RDSendLine < - *r-plugin-quick-bash-setup* + *r-plugin-bash-setup* ~/.bashrc:~ > # Change the TERM environment variable (to get 256 colors) and make Vim @@ -2089,7 +2089,7 @@ please read this document from the beginning. fi < - *r-plugin-quick-tmux-setup* + *r-plugin-tmux-setup* ~/.tmux.conf:~ > set-option -g prefix C-a @@ -2103,7 +2103,7 @@ please read this document from the beginning. set -g mouse-resize-pane on < - *r-plugin-quick-R-setup* + *r-plugin-R-setup* ~/.Rprofile~ > if(interactive()){ @@ -2112,6 +2112,10 @@ please read this document from the beginning. colorout.verbose = 1, vimcom.verbose = 1, pager = "vimrpager") + # Use the text based web browser w3m to navigate through R docs: + if(Sys.getenv("TMUX") != "") + options(browser="~/bin/vimrw3mbrowser", + help_type = "html") # Use either Vim or GVim as text editor for R: if(nchar(Sys.getenv("DISPLAY")) > 1) options(editor = 'gvim -f -c "set ft=r"') @@ -2139,14 +2143,44 @@ please read this document from the beginning. ~/bin/vimrpager~ > #!/bin/sh - # I don't know the reason, but we can't pipe the output directly to Vim. So - # we need this script to use 'cat' is intermediary. + # I don't know the reason, but we can't pipe the output directly to Vim. + # So we need this script to use 'cat' is intermediary. cat | vim -c 'set ft=rdoc' - < -NOTE: You have to change the `~/bin/vimrpager` permissions to make it -executable: + + ~/bin/vimrw3mbrowser~ +> + #!/bin/sh + NCOLS=$(tput cols) + if [ "$NCOLS" -gt "140" ] + then + if [ "x$VIM_PANE" = "x" ] + then + tmux split-window -h "w3m $1 && exit" + else + tmux split-window -h -t $VIM_PANE "w3m $1 && exit" + fi + else + tmux new-window "w3m $1 && exit" + fi +< + +NOTES: 1. The `~/bin` diretory must be in your PATH. + 2. To use the `vimrw3mbrower` script the web browser w3m must be + installed. + 3. You have to change `~/bin/vimrpager` and `~/bin/vimrw3mbrowser` + permissions to make them executable: > chmod +x ~/bin/vimrpager + chmod +x ~/bin/vimrw3mbrowser +< + +Finally, if you want to use vi key bindings in Bash: + + ~/.inputrc~ +> + set editing-mode vi + set keymap vi < 9.22. Python versions~ @@ -2197,7 +2231,7 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details. *r-plugin-news* 10. News~ -0.9.9.8 (2013-11-14) +0.9.9.8 (2013-11-16) * The list of objects for omnicompletion and the list of functions for syntax highlight now are built dynamically. Deprecated commands and options: @@ -2212,6 +2246,8 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details. * Remove toolbar icons (they still may be added back manually by interested users). + * If latexmk is installed, use it by default to compile the pdf. + 0.9.9.7 (2013-11-06) * Minor bug fixes. From b75385a34af3003d04030f9a2b5fb7ffe2173fb0 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sun, 17 Nov 2013 13:10:06 -0300 Subject: [PATCH 0560/1050] Documentation update. Improve section on Tmux usage. Add tip on toggle of mouse support on Tmux (thanks to theo). --- doc/r-plugin.txt | 92 +++++++++++++++++++++++++++++++----------------- 1 file changed, 60 insertions(+), 32 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index aa4e56a..b63f406 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -518,7 +518,7 @@ completion is the available for omnicompletion (see You can source all .R files in a directory with the Normal mode command :RSourceDir, which accepts an optional argument (the directory to be sourced). - + *:Rinsert* The command :Rinsert inserts one or more lines with the output of the R command sent to R. By using this command we can avoid the need of copying and pasting the output R from its console to Vim. For example, to insert the @@ -695,9 +695,12 @@ In this case, the terminal window is split in two regions: one for Vim and the other for Tmux. Then, it's useful (but not required) to know some Tmux commands. After you finished editing the file, you have to type `exit` to quit the Tmux session. + + +4.8.1 tvim~ *r-plugin-tvim* -If you always prefer to run Tmux before running Vim you could create a Bash -function called `tvim` (please, see the ~/.bashrc example at +If, as recommended, you always prefer to run Tmux before running Vim you could +create a Bash function called `tvim` (please, see the ~/.bashrc example at |r-plugin-quick-setup|). Then you will be able to start a Tmux session running Vim by typing: > @@ -707,18 +710,33 @@ Using the `tvim` function, the Tmux session is finished when you quits Vim. That is, the only advantage of using `tvim` is that you do not have to type `tmux` before and `exit` after the edition of the file. -The Tmux configuration file provided by the Vim-R-plugin configures Tmux to -use vi key bindings. It also configures Tmux to react to mouse clicks. You -should be able to switch the active pane by clicking on an inactive pane, to -resize the panes by clicking on the border line and dragging it, and to scroll -the R Console with the mouse wheel. When you use the mouse wheel, Tmux enters -in its copy/scroll back mode (see below). +If you are going to run Vim inside Tmux, than you should create your +~/.tmux.conf if it does not exist yet. You may put the lines below in your +~/.tmux.conf as a starting point to your own configuration file: +> + set-option -g prefix C-a + unbind-key C-b + bind-key C-a send-prefix + set-window-option -g mode-keys vi + set -g terminal-overrides 'xterm*:smcup@:rmcup@' + set -g mode-mouse on + set -g mouse-select-pane on + set -g mouse-resize-pane on +< + +4.8.2 Key bindings and mouse support~ + +The Tmux configuration file suggested above configures Tmux to use vi key +bindings. It also configures Tmux to react to mouse clicks. You should be able +to switch the active pane by clicking on an inactive pane, to resize the panes +by clicking on the border line and dragging it, and to scroll the R Console +with the mouse wheel. When you use the mouse wheel, Tmux enters in its +copy/scroll back mode (see below). The configuration script also sets as the Tmux escape character (the default is ), that is, you have to type before typing a Tmux -command. Below are the most useful key bindings to use Tmux with the tmux.conf -created by the Vim-R-plugin (see |vimrplugin_notmuxconf| if you prefer to use -your own ~/.tmux.conf) +command. Below are the most useful key bindings to use Tmux with the above +tmux.conf: arrow keys : Move the cursor to the Tmux panel above, below, at the right or at the left of the current one. @@ -748,33 +766,43 @@ terminal emulator: > man tmux < -Note: was configured as the Tmux escape character, and it will not be -passed to applications running under Tmux. To send to either R or Vim +Note: Because was configured as the Tmux escape character, it will not +be passed to applications running under Tmux. To send to either R or Vim you have to type a. -With Tmux, you can detach the Vim-R session and reattach it latter. This -is useful if you plan to begin the use the Vim-R-plugin in a machine and -latter move to another computer and access remotely you previous Vim-R-plugin -session. - - Create your ~/.tmux.conf if it does not exist yet. You may put the lines - below in your ~/.tmux.conf as a starting point to your own configuration - file: +4.8.3 Copying and pasting~ + +You do not need to copy code from Vim to R because you can use the plugin's +shortcuts to send the code, but you may want to copy something from R Console +and paste it in another application. For pasting the output of R commands into +Vim's buffer, you can use the command |:Rinsert|. If you want to copy text +from an application running inside the Tmux to another application also +running in Tmux, as explained in the previous subsection, you can enter in +Tmux copy/scroll mode, select the text, copy it, switch to the other +application pane and, then, paste. + +However, if you want to copy something from either Vim or R to another +application not running inside Tmux, Tmux may prevent the X server from +capturing the text selected by the mouse. The solution is to disable mouse +support in Tmux. You will be able to toggle mouse support on and off by typing +m if you add the following line to your ~/.tmux.conf: > - set-option -g prefix C-a - unbind-key C-b - bind-key C-a send-prefix - set-window-option -g mode-keys vi - set -g terminal-overrides 'xterm*:smcup@:rmcup@' - set -g mode-mouse on - set -g mouse-select-pane on - set -g mouse-resize-pane on + bind m run-shell '( if [ "mode-mouse on" = "$(tmux show-window-option | grep mode-mouse)" ]; then toggle=off; else toggle=on; fi; tmux display-message "mouse $toggle"; tmux set-option -w mode-mouse $toggle ; for cmd in mouse-select-pane mouse-resize-pane mouse-select-window; do tmux set-option -g $cmd $toggle ; done;) > /dev/null 2>&1' < + +4.8.2 Remote access~ + +With Tmux, you can detach the Vim-R session and reattach it latter. This is +useful if you plan to begin the use the Vim-R-plugin in a machine and latter +move to another computer and access remotely your previous Vim-R-plugin +session. Below is the step-by-step procedure to run the Vim-R-plugin remotely: + - Start Tmux: tmux - Start Vim: - vim theScript.R + vim the_script.R - Use Vim to start an R session: rf @@ -1232,8 +1260,8 @@ put in your |vimrc|: < If you opted for using your own configuration file, the plugin will write a minimum configuration which will set the value of two environment variables -required for the communication with R and source your own configuration file -(~/.tmux.conf). +required for the communication with R and then source your own configuration +file (~/.tmux.conf). 6.15. Integration with Tmux (Linux/Unix only)~ From e72132499c6bd71c623ba37d2c6a7afabbe0c9a5 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sun, 17 Nov 2013 20:01:15 -0300 Subject: [PATCH 0561/1050] Minor bug fixes. Don't send ^A^K to shell when restarting R. Don't put extra quotes around the servername. --- r-plugin/common_global.vim | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 18f2809..e1fb2fe 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -781,7 +781,10 @@ function StartR(whatr) call g:SendCmdToR('quit(save = "no")') sleep 100m call delete($VIMRPLUGIN_TMPDIR . "/vimcom_running") + let ca_ck = g:vimrplugin_ca_ck + let g:vimrplugin_ca_ck = 0 call g:SendCmdToR(g:rplugin_last_rcmd) + let g:vimrplugin_ca_ck = ca_ck if IsExternalOBRunning() call VimExprToOB('ResetVimComPort()') call WaitVimComStart() @@ -875,8 +878,6 @@ function StartObjBrowser_Tmux() return endif - "sleep 250m - let objbrowserfile = $VIMRPLUGIN_TMPDIR . "/objbrowserInit" let tmxs = " " @@ -887,7 +888,7 @@ function StartObjBrowser_Tmux() endif call writefile([ - \ 'let g:rplugin_editor_sname = "' . myservername . '"', + \ 'let g:rplugin_editor_sname = ' . myservername, \ 'let g:rplugin_vim_pane = "' . g:rplugin_vim_pane . '"', \ 'let g:rplugin_rconsole_pane = "' . g:rplugin_rconsole_pane . '"', \ 'let b:objbrtitle = "' . b:objbrtitle . '"', From a16bdeedd87873e5d44d1bcf7b98fde1ecc2fa21 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Tue, 19 Nov 2013 11:37:01 -0300 Subject: [PATCH 0562/1050] Use 256 colors in terminal emulator. --- r-plugin/vimrconfig.vim | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/r-plugin/vimrconfig.vim b/r-plugin/vimrconfig.vim index 623d2a0..3a9db32 100644 --- a/r-plugin/vimrconfig.vim +++ b/r-plugin/vimrconfig.vim @@ -196,26 +196,33 @@ function! RConfigVimrc() let what = input("Do you want these options in your vimrc? [y/N]: ") echohl Normal if RGetYesOrNo(what) - let vlines = vlines + [ + let vlines = vlines + ['', \ '" The lines below were also added by the Vim-R-plugin because you did not have', \ '" a vimrc yet in the hope that they will help you getting started with Vim:', \ '', \ '" Highlight the last searched pattern:', \ 'set hlsearch', \ '', - \ '" Show where the next patter is as you type it:', + \ '" Show where the next pattern is as you type it:', \ 'set incsearch', \ '', - \ '" By default, Vim indents code by 8 spaces. Most people preffer 4 spaces:', + \ '" By default, Vim indents code by 8 spaces. Most people prefer 4 spaces:', \ 'set sw=4', \ '', \ '" There are hundreds of color schemes for Vim on the internet, but you can', \ '" start with color schemes already installed.', \ '" Click on GVim menu bar "Edit / Color scheme" to know the name of your', - \ '" preffered color scheme, then, remove the double quote (which is a comment', + \ '" preferred color scheme, then, remove the double quote (which is a comment', \ '" character, like the # is for R language) and replace the value "not_defined"', \ '" below:', \ '"colorscheme not_defined'] + if has("unix") && has("syntax") && (&term =~ "xterm" || &term =~ "256" || $DISPLAY != "") + let vlines = vlines + ['', + \ '" Use 256 colors even if in a terminal emulator:', + \ 'if &term =~ "xterm" || &term =~ "256" || $DISPLAY != ""', + \ ' set t_Co=256', + \ 'endif'] + endif endif endif From 0c8b6015f3e167d2530cc2cf4eacc749bb9c751a Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Tue, 19 Nov 2013 11:39:00 -0300 Subject: [PATCH 0563/1050] Additional suggestions to vimrc. --- doc/r-plugin.txt | 39 +++++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index b63f406..16c524d 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -106,6 +106,8 @@ Before installing the plugin, you should install its dependencies: Depends:~ Vim >= 7.4: http://www.vim.org/download.php + In addition to the most commonly used features, the plugin + requires: |+python| or |+python3|, |+clientserver| and |+conceal|. R >= 3.0.0: http://www.r-project.org/ @@ -168,7 +170,7 @@ Then, in Vim, type: < Press and the plugin will be installed (because the plugin has many files, you have to press the space bar a few times to finish the -installation). You should, then, quit Vim. +installation). You should, then, quit Vim. Start Vim again and edit an R script. Type rf to start R and run the command below to get help configuring ~/.Rprofile, ~/.vimrc, ~/.tmux.conf, @@ -600,14 +602,9 @@ you install packages such as vim-nox on Debian/Ubuntu or vim-enhanced on Fedora/Red Hat. If you want to use Vim in a terminal emulator in Fedora/Red Hat, you may want to create a symbolic link to "gvim" named "vim". You still have to explicitly start the server with the argument |--servername|. To -avoid having to type this argument every time that you start Vim, you may put -in your ~/.bashrc: -> - if [ "x$DISPLAY" != "x" ] - then - alias vim='vim --servername VIM' - fi -< +avoid having to type this argument every time that you start Vim, please look +at the example in |r-plugin-bash-setup|. + In the .GlobalEnv view, if an object has the attribute "label", it will also be displayed. Please, see the R help for package vimcom.plus (or vimcom) for some options to control the Object Browser behavior. In the Object Browser @@ -1940,11 +1937,12 @@ Finally, put in your |vimrc|: if &term =~ "xterm" || &term =~ "256" || $DISPLAY != "" set t_Co=256 endif - colorscheme your_prefered_color_scheme + colorscheme your_preferred_color_scheme < You have to search the internet for color schemes supporting 256 colors, download and copy them to ~/.vim/colors. You may use the command -|:colorscheme| to try them all before setting your preference in your |vimrc|. +|:colorscheme| to try them one by one before setting your preference in your +|vimrc|. 9.14. Run your Makefile from within R~ @@ -2085,6 +2083,23 @@ please read this document from the beginning. " Press the space bar to send lines and selection to R: vmap RDSendSelection nmap RDSendLine + " The lines below are suggestions for Vim in general and are not + " specific to the improvement of the Vim-R-plugin. + " Highlight the last searched pattern: + set hlsearch + " Show where the next pattern is as you type it: + set incsearch + " By default, Vim indents code by 8 spaces. Most people prefer 4 + " spaces: + set sw=4 + " Search "Vim colorscheme 256" in the internet and download color + " schemes that supports 256 colors in the terminal emulator. Then, + " uncomment the code below to set you color scheme: + "colorscheme not_defined + " Use 256 colors even if in a terminal emulator: + if &term =~ "xterm" || &term =~ "256" || $DISPLAY != "" + set t_Co=256 + endif < *r-plugin-bash-setup* ~/.bashrc:~ @@ -2259,7 +2274,7 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details. *r-plugin-news* 10. News~ -0.9.9.8 (2013-11-16) +0.9.9.8 (2013-11-19) * The list of objects for omnicompletion and the list of functions for syntax highlight now are built dynamically. Deprecated commands and options: From 72a0b81366fa376dacfb3f0cd133fbe91fc0b5eb Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Tue, 19 Nov 2013 11:41:48 -0300 Subject: [PATCH 0564/1050] Minor bug fixes. Update the Object Browser even in Linux Console with the command \ro. Don't beep if calling ShowRDoc from the Object Browser in Linux Console. --- r-plugin/common_global.vim | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index e1fb2fe..2f1bf48 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -875,6 +875,13 @@ function StartObjBrowser_Tmux() Py SendToVimCom("\004Libraries [OB init]") sleep 50m Py SendToVimCom("\003GlobalEnv [OB init]") + sleep 50m + if $DISPLAY == "" && exists("g:rplugin_ob_pane") + let slog = system("tmux set-buffer ':silent call UpdateOB(\"both\")\:\' && tmux paste-buffer -t " . g:rplugin_ob_pane . " && tmux select-pane -t " . g:rplugin_ob_pane) + if v:shell_error + call RWarningMsg(slog) + endif + endif return endif @@ -1104,6 +1111,9 @@ function RBrowserOpenCloseLists(status) else if IsExternalOBRunning() let curview = VimExprToOB('g:rplugin_curview') + if curview == "Vim server not found" + return + endif else let curview = "GlobalEnv" endif @@ -2265,7 +2275,7 @@ function RAction(rcmd) call RWarningMsg("Cmd not available.") else if g:rplugin_editor_sname == "" - let slog = system("tmux set-buffer '" . "\" . ':call ShowRDoc("' . rkeyword . '", "' . pkg . '", 0)' . "\' && tmux paste-buffer -t " . g:rplugin_vim_pane . " && tmux select-pane -t " . g:rplugin_vim_pane) + let slog = system("tmux set-buffer '" . "\\" . ':call ShowRDoc("' . rkeyword . '", "' . pkg . '", 0)' . "\' && tmux paste-buffer -t " . g:rplugin_vim_pane . " && tmux select-pane -t " . g:rplugin_vim_pane) if v:shell_error call RWarningMsg(slog) endif From bcb4b2cda9df6db08e5d3ab84c0545ffbe675f68 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Tue, 19 Nov 2013 23:09:40 -0300 Subject: [PATCH 0565/1050] Documentation update. Tip on how to see R documentation on Vim buffer even if asking for help in R Console. --- doc/r-plugin.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 16c524d..9f07dff 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -2179,6 +2179,9 @@ please read this document from the beginning. library(vimcom.plus) # If you can't install the vimcom.plus package, do: # library(vimcom) + # See R documentation on Vim buffer even if asking for help in R Console: + if(Sys.getenv("VIM_PANE") != "") + options(help_type = "text", pager = vim.pager) } } < From e2ab6911a59294214134cfb86e8e8a7a3512aa56 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Wed, 20 Nov 2013 16:15:35 -0300 Subject: [PATCH 0566/1050] Delete file r-plugin/Rconfig.R. --- Makefile | 2 - doc/r-plugin.txt | 3 +- list_for_vimball | 1 - r-plugin/Rconfig.R | 51 ------------- r-plugin/vimrconfig.vim | 160 +++++++++++++++++++++++++++++++++------- 5 files changed, 134 insertions(+), 83 deletions(-) delete mode 100644 r-plugin/Rconfig.R diff --git a/Makefile b/Makefile index 1b44e71..801b554 100644 --- a/Makefile +++ b/Makefile @@ -31,7 +31,6 @@ VIM2HTML=/usr/local/share/vim/vim74/doc/vim2html.pl vimball: # Update the version date in doc/r-plugin.txt header and in the news sed -i -e "s/^Version: [0-9].[0-9].[0-9].[0-9]/Version: $(PLUGINVERSION)/" doc/r-plugin.txt - sed -i -e "s/vim-r-plugin_[0-9].[0-9].[0-9].[0-9].vmb/vim-r-plugin_$(PLUGINVERSION).vmb/" doc/r-plugin.txt sed -i -e "s/^$(PLUGINVERSION) (201[0-9]-[0-9][0-9]-[0-9][0-9])$$/$(PLUGINVERSION) ($(PLUGINRELEASEDATE))/" doc/r-plugin.txt vim -c "%MkVimball Vim-R-plugin ." -c "q" list_for_vimball mv Vim-R-plugin.vmb /tmp @@ -76,7 +75,6 @@ deb: - r-plugin/vimcom.py\n\ - r-plugin/global_r_plugin.vim\n\ - r-plugin/tex_indent.vim\n\ - - r-plugin/Rconfig.R\n\ - r-plugin/vimrconfig.vim\n\ - syntax/r.vim\n\ - syntax/rdoc.vim\n\ diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 9f07dff..306c7b7 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -1699,7 +1699,6 @@ directory after the installation: r-plugin/r.snippets r-plugin/common_buffer.vim r-plugin/common_global.vim - r-plugin/Rconfig.R r-plugin/vimrconfig.vim @@ -2190,7 +2189,7 @@ please read this document from the beginning. > #!/bin/sh # I don't know the reason, but we can't pipe the output directly to Vim. - # So we need this script to use 'cat' is intermediary. + # So we need this script to use 'cat' as intermediary. cat | vim -c 'set ft=rdoc' - < diff --git a/list_for_vimball b/list_for_vimball index ca6f17c..c7956cd 100644 --- a/list_for_vimball +++ b/list_for_vimball @@ -13,7 +13,6 @@ indent/rhelp.vim indent/rmd.vim indent/rnoweb.vim indent/rrst.vim -r-plugin/Rconfig.R r-plugin/common_buffer.vim r-plugin/common_global.vim r-plugin/global_r_plugin.vim diff --git a/r-plugin/Rconfig.R b/r-plugin/Rconfig.R deleted file mode 100644 index f6c84c3..0000000 --- a/r-plugin/Rconfig.R +++ /dev/null @@ -1,51 +0,0 @@ - -if(.Platform$OS.type == "windows"){ - .rpf <- Sys.getenv("R_PROFILE_USER") - if(.rpf == ""){ - if(Sys.getenv("R_USER") == "") - stop("R_USER environment variable not set.") - .rpf <- paste0(Sys.getenv("R_USER"), "\\.Rprofile") - } -} else { - if(Sys.getenv("HOME") == ""){ - stop("HOME environment variable not set.") - } else { - .rpf <- paste0(Sys.getenv("HOME"), "/.Rprofile") - } -} -if(file.exists(.rpf)){ - .rpflines <- readLines(.rpf) -} else { - .rpflines <- "" -} -if(length(grep("library.*vimcom", .rpflines)) > 0 || length(grep("require.*vimcom", .rpflines) > 0)){ - writeLines(c(.rpf, "vimcom_found"), - con = paste0(Sys.getenv("VIMRPLUGIN_TMPDIR"), "/configR_result")) -} else { - .rpflines <- c(.rpflines, - '', - paste0('# Lines added by the Vim-R-plugin command :RpluginConfig (', format(Sys.time(), "%Y-%b-%d %H:%M"), '):'), - 'if(interactive()){') - if(.Platform$OS.type == "windows"){ - .rpflines <- c(.rpflines, ' options(editor = \'"C:/Program Files (x86)/Vim/vim74/gvim.exe" "-c" "set filetype=r"\')') - } else { - .rpflines <- c(.rpflines, - ' if(nchar(Sys.getenv("DISPLAY")) > 1)', - ' options(editor = \'gvim -f -c "set ft=r"\')', - ' else', - ' options(editor = \'vim -c "set ft=r"\')', - ' library(colorout)', - ' if(Sys.getenv("TERM") != "linux" && Sys.getenv("TERM") != ""){', - ' # Choose the colors for R output among 256 options.', - ' # You should run show256Colors() and help(setOutputColors256) to', - ' # know how to change the colors according to your taste:', - ' setOutputColors256(verbose = FALSE)', - ' }', - ' library(setwidth)') - } - .rpflines <- c(.rpflines, ' library(vimcom.plus)', "}") - writeLines(.rpflines, con = .rpf) - writeLines(c(.rpf, "new_Rprofile"), - con = paste0(Sys.getenv("VIMRPLUGIN_TMPDIR"), "/configR_result")) -} - diff --git a/r-plugin/vimrconfig.vim b/r-plugin/vimrconfig.vim index 3a9db32..4d4b505 100644 --- a/r-plugin/vimrconfig.vim +++ b/r-plugin/vimrconfig.vim @@ -24,17 +24,123 @@ endfunction " Configure .Rprofile function! RConfigRprofile() call delete($VIMRPLUGIN_TMPDIR . "/configR_result") - let rcmd = 'source("' . g:rplugin_uservimfiles . '/r-plugin/Rconfig.R")' - call g:SendCmdToR(rcmd) + let configR = ['if(.Platform$OS.type == "windows"){', + \ ' .rpf <- Sys.getenv("R_PROFILE_USER")', + \ ' if(.rpf == ""){', + \ ' if(Sys.getenv("R_USER") == "")', + \ ' stop("R_USER environment variable not set.")', + \ ' .rpf <- paste0(Sys.getenv("R_USER"), "\\.Rprofile")', + \ ' }', + \ '} else {', + \ ' if(Sys.getenv("HOME") == ""){', + \ ' stop("HOME environment variable not set.")', + \ ' } else {', + \ ' .rpf <- paste0(Sys.getenv("HOME"), "/.Rprofile")', + \ ' }', + \ '}', + \ 'writeLines(.rpf, con = paste0(Sys.getenv("VIMRPLUGIN_TMPDIR"), "/configR_result"))', + \ 'rm(.rpf)'] + call RSourceLines(configR, "silent") sleep 1 + if !filereadable($VIMRPLUGIN_TMPDIR . "/configR_result") + sleep 2 + endif if filereadable($VIMRPLUGIN_TMPDIR . "/configR_result") let res = readfile($VIMRPLUGIN_TMPDIR . "/configR_result") - if res[1] == "vimcom_found" + if filereadable(res[0]) + let rpflines = readfile(res[0]) + else + let rpflines = [] + endif + + let hasvimcom = 0 + for line in rpflines + if line =~ "library.*vimcom" || line =~ "require.*vimcom" + let hasvimcom = 1 + break + endif + endfor + if hasvimcom call RWarningMsg('The string "vimcom" was found in your .Rprofile. No change was done.') - elseif res[1] == "new_Rprofile" + else + let rpflines += [''] + if exists("*strftime") + let rpflines += ['# Lines added by the Vim-R-plugin command :RpluginConfig (' . strftime("%Y-%b-%d %H:%M") . '):'] + else + let rpflines += ['# Lines added by the Vim-R-plugin command :RpluginConfig:'] + endif + let rpflines += ['if(interactive()){'] + if has("win32") || has("win64") + let rpflines += [" options(editor = '" . '"C:/Program Files (x86)/Vim/vim74/gvim.exe" "-c" "set filetype=r"' . "')"] + else + let rpflines += [' if(nchar(Sys.getenv("DISPLAY")) > 1)', + \ " options(editor = '" . 'gvim -f -c "set ft=r"' . "')", + \ ' else', + \ " options(editor = '" . 'vim -c "set ft=r"' . "')", + \ ' library(colorout)', + \ ' if(Sys.getenv("TERM") != "linux" && Sys.getenv("TERM") != ""){', + \ ' # Choose the colors for R output among 256 options.', + \ ' # You should run show256Colors() and help(setOutputColors256) to', + \ ' # know how to change the colors according to your taste:', + \ ' setOutputColors256(verbose = FALSE)', + \ ' }', + \ ' library(setwidth)'] + endif + let rpflines += [' library(vimcom.plus)'] + + echo " " + echo "By defalt, R uses the 'less' application to show help documents." + echohl Question + let what = input("Dou you prefer to see help documents in Vim? [y/N]: ") + echohl Normal + if RGetYesOrNo(what) + let rpflines += [' # See R documentation on Vim buffer even if asking for help in R Console:'] + if ($PATH =~ "\\~/bin" || $PATH =~ expand("~/bin")) && filewritable(expand("~/bin")) == 2 && !filereadable(expand("~/bin/vimrpager")) + call writefile(['#!/bin/sh', + \ 'cat | vim -c "set ft=rdoc" -'], expand("~/bin/vimrpager")) + call system("chmod +x " . expand("~/bin/vimrpager")) + let rpflines += [' options(help_type = "text", pager = "~/bin/vimrpager")'] + endif + let rpflines += [' if(Sys.getenv("VIM_PANE") != "")', + \ ' options(pager = vim.pager)'] + endif + + if executable("w3m") && ($PATH =~ "\\~/bin" || $PATH =~ expand("~/bin")) && filewritable(expand("~/bin")) == 2 && !filereadable(expand("~/bin/vimrw3mbrowser")) + echo " " + echo "The w3m application, a text based web browser, is installed in your system." + echo "When R is running inside of a Tmux session, it can be configured to" + echo "start its help system in w3m running in a Tmux pane." + echohl Question + let what = input("Do you want to use w3m instead of your default web browser? [y/N]: ") + if RGetYesOrNo(what) + call writefile(['#!/bin/sh', + \ 'NCOLS=$(tput cols)', + \ 'if [ "$NCOLS" -gt "140" ]', + \ 'then', + \ ' if [ "x$VIM_PANE" = "x" ]', + \ ' then', + \ ' tmux split-window -h "w3m $1 && exit"', + \ ' else', + \ ' tmux split-window -h -t $VIM_PANE "w3m $1 && exit"', + \ ' fi', + \ 'else', + \ ' tmux new-window "w3m $1 && exit"', + \ 'fi'], expand("~/bin/vimrw3mbrowser")) + call system("chmod +x " . expand("~/bin/vimrw3mbrowser")) + let rpflines += [' # Use the text based web browser w3m to navigate through R docs:', + \ ' # Replace VIM_PANE with TMUX if you know what you are doing.', + \ ' if(Sys.getenv("VIM_PANE") != "")', + \ ' options(browser="~/bin/vimrw3mbrowser")'] + endif + endif + + let rpflines += ["}"] + call writefile(rpflines, res[0]) + echo " " call RWarningMsg('Your new .Rprofile was created.') endif - if has("win32") || has("win64") + + if has("win32") || has("win64") || !hasvimcom echohl Question let what = input("Do you want to see your .Rprofile now? [y/N]: ") echohl Normal @@ -47,7 +153,7 @@ function! RConfigRprofile() echohl Normal if RGetYesOrNo(what) silent exe "tabnew " . res[0] - silent help r-plugin-quick-R-setup + silent help r-plugin-R-setup endif endif redraw @@ -107,24 +213,24 @@ function! RConfigVimrc() endif endif - let vlines = vlines + [''] + let vlines += [''] if exists("*strftime") - let vlines = vlines + ['" Lines added by the Vim-R-plugin command :RpluginConfig (' . strftime("%Y-%b-%d %H:%M") . '):'] + let vlines += ['" Lines added by the Vim-R-plugin command :RpluginConfig (' . strftime("%Y-%b-%d %H:%M") . '):'] else - let vlines = vlines + ['" Lines added by the Vim-R-plugin command :RpluginConfig:'] + let vlines += ['" Lines added by the Vim-R-plugin command :RpluginConfig:'] endif if RFindString(vlines, 'set\s*nocompatible') == 0 && RFindString(vlines, 'set\s*nocp') == 0 - let vlines = vlines + ['set nocompatible'] + let vlines += ['set nocompatible'] endif if RFindString(vlines, 'syntax\s*on') == 0 - let vlines = vlines + ['syntax on'] + let vlines += ['syntax on'] endif if RFindString(vlines, 'filet.* plugin on') == 0 - let vlines = vlines + ['filetype plugin on'] + let vlines += ['filetype plugin on'] endif if RFindString(vlines, 'filet.* indent on') == 0 - let vlines = vlines + ['filetype indent on'] + let vlines += ['filetype indent on'] endif echo " " @@ -140,7 +246,7 @@ function! RConfigVimrc() let what = input("Do you want to change the LocalLeader to a comma (,)? [y/N]: ") echohl Normal if RGetYesOrNo(what) - let vlines = vlines + ['" Change the key:', + let vlines += ['" Change the key:', \ 'let maplocalleader = ","'] endif endif @@ -158,7 +264,7 @@ function! RConfigVimrc() let what = input("Do you want to press Ctrl+Space to do omnicompletion? [y/N]: ") echohl Normal if RGetYesOrNo(what) - let vlines = vlines + ['" Use Ctrl+Space to do omnicompletion:', + let vlines += ['" Use Ctrl+Space to do omnicompletion:', \ 'if has("gui_running")', \ ' inoremap ', \ 'else', @@ -181,7 +287,7 @@ function! RConfigVimrc() let what = input("Do you prefer to press the space bar to send lines and selections\nto R Console? [y/N]: ") echohl Normal if RGetYesOrNo(what) - let vlines = vlines + ['" Press the space bar to send lines (in Normal mode) and selections to R:', + let vlines += ['" Press the space bar to send lines (in Normal mode) and selections to R:', \ 'vmap RDSendSelection', \ 'nmap RDSendLine'] endif @@ -196,7 +302,7 @@ function! RConfigVimrc() let what = input("Do you want these options in your vimrc? [y/N]: ") echohl Normal if RGetYesOrNo(what) - let vlines = vlines + ['', + let vlines += ['', \ '" The lines below were also added by the Vim-R-plugin because you did not have', \ '" a vimrc yet in the hope that they will help you getting started with Vim:', \ '', @@ -217,7 +323,7 @@ function! RConfigVimrc() \ '" below:', \ '"colorscheme not_defined'] if has("unix") && has("syntax") && (&term =~ "xterm" || &term =~ "256" || $DISPLAY != "") - let vlines = vlines + ['', + let vlines += ['', \ '" Use 256 colors even if in a terminal emulator:', \ 'if &term =~ "xterm" || &term =~ "256" || $DISPLAY != ""', \ ' set t_Co=256', @@ -263,7 +369,7 @@ function! RConfigBash() echohl Normal if RGetYesOrNo(what) silent exe "tabnew " . $HOME . "/.bashrc" - silent help r-plugin-quick-bash-setup + silent help r-plugin-bash-setup endif else echo "Vim and Tmux can display up to 256 colors in the terminal emulator," @@ -276,13 +382,13 @@ function! RConfigBash() let what = input("Do you want that all these features are added to your .bashrc? [y/N]: ") echohl Normal if RGetYesOrNo(what) - let blines = blines + [''] + let blines += [''] if exists("*strftime") - let blines = blines + ['# Lines added by the Vim-R-plugin command :RpluginConfig (' . strftime("%Y-%b-%d %H:%M") . '):'] + let blines += ['# Lines added by the Vim-R-plugin command :RpluginConfig (' . strftime("%Y-%b-%d %H:%M") . '):'] else - let blines = blines + ['# Lines added by the Vim-R-plugin command :RpluginConfig:'] + let blines += ['# Lines added by the Vim-R-plugin command :RpluginConfig:'] endif - let blines = blines + ['# Change the TERM environment variable (to get 256 colors) and make Vim', + let blines += ['# Change the TERM environment variable (to get 256 colors) and make Vim', \ '# connecting to X Server even if running in a terminal emulator (to get', \ '# dynamic update of syntax highlight and Object Browser):', \ 'if [ "x$DISPLAY" != "x" ]', @@ -343,7 +449,7 @@ function! RConfigTmux() echohl Normal if RGetYesOrNo(what) silent exe "tabnew " . $HOME . "/.tmux.conf" - silent help r-plugin-quick-tmux-setup + silent help r-plugin-tmux-setup endif redraw else @@ -353,11 +459,11 @@ function! RConfigTmux() if RGetYesOrNo(what) let tlines = [''] if exists("*strftime") - let tlines = tlines + ['# Lines added by the Vim-R-plugin command :RpluginConfig (' . strftime("%Y-%b-%d %H:%M") . '):'] + let tlines += ['# Lines added by the Vim-R-plugin command :RpluginConfig (' . strftime("%Y-%b-%d %H:%M") . '):'] else - let tlines = tlines + ['# Lines added by the Vim-R-plugin command :RpluginConfig:'] + let tlines += ['# Lines added by the Vim-R-plugin command :RpluginConfig:'] endif - let tlines = tlines + ["set-option -g prefix C-a", + let tlines += ["set-option -g prefix C-a", \ "unbind-key C-b", \ "bind-key C-a send-prefix", \ "set -g status off", From 74843dc9a7762f758710aa50bc0cb104959fdb3f Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 21 Nov 2013 11:56:30 -0300 Subject: [PATCH 0567/1050] Stronger support to 256 colors in terminal. --- r-plugin/vimrconfig.vim | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/r-plugin/vimrconfig.vim b/r-plugin/vimrconfig.vim index 4d4b505..02e9fa5 100644 --- a/r-plugin/vimrconfig.vim +++ b/r-plugin/vimrconfig.vim @@ -233,8 +233,8 @@ function! RConfigVimrc() let vlines += ['filetype indent on'] endif - echo " " if RFindString(vlines, "maplocalleader") == 0 + echo " " if hasvimrc echohl WarningMsg echo "It seems that you didn't map your to another key." @@ -251,8 +251,8 @@ function! RConfigVimrc() endif endif - echo " " if RFindString(vlines, "") == 0 && RFindString(vlines, "") == 0 && RFindString(vlines, "") == 0 + echo " " if hasvimrc echohl WarningMsg echo "It seems that you didn't create an easier map for omnicompletion yet." @@ -273,8 +273,8 @@ function! RConfigVimrc() endif endif - echo " " if RFindString(vlines, "RDSendLine") == 0 || RFindString(vlines, "RDSendSelection") == 0 + echo " " if hasvimrc echohl WarningMsg echo "It seems that you didn't create an easier map to" @@ -293,6 +293,23 @@ function! RConfigVimrc() endif endif + if has("unix") && has("syntax") && RFindString(vlines, "t_Co") == 0 + echo " " + echo "Vim is capable of displaying 256 colors in terminal emulators. However, it" + echo "doesn't always detect that the terminal has this feature and defaults to" + echo "using only 8 colors." + echohl Question + let what = input("Do you want to enable the use of 256 colors whenever possible? [y/N]: ") + echohl Normal + if RGetYesOrNo(what) + let vlines += ['', + \ '" Force Vim to use 256 colors if running in a capable terminal emulator:', + \ 'if &term =~ "xterm" || &term =~ "256" || $DISPLAY != "" || $HAS_256_COLORS == "yes"', + \ ' set t_Co=256', + \ 'endif'] + endif + endif + if !hasvimrc echo " " echo "There are some options that most Vim users like, but that are not enabled by" @@ -322,13 +339,6 @@ function! RConfigVimrc() \ '" character, like the # is for R language) and replace the value "not_defined"', \ '" below:', \ '"colorscheme not_defined'] - if has("unix") && has("syntax") && (&term =~ "xterm" || &term =~ "256" || $DISPLAY != "") - let vlines += ['', - \ '" Use 256 colors even if in a terminal emulator:', - \ 'if &term =~ "xterm" || &term =~ "256" || $DISPLAY != ""', - \ ' set t_Co=256', - \ 'endif'] - endif endif endif @@ -350,7 +360,6 @@ endfunction " Configure .bashrc function! RConfigBash() - echo " " if filereadable($HOME . "/.bashrc") let blines = readfile($HOME . "/.bashrc") let hastvim = 0 @@ -361,6 +370,7 @@ function! RConfigBash() endif endfor + echo " " if hastvim echohl WarningMsg echo "Nothing was added to your ~/.bashrc because the string 'tvim' was found in it." @@ -393,6 +403,8 @@ function! RConfigBash() \ '# dynamic update of syntax highlight and Object Browser):', \ 'if [ "x$DISPLAY" != "x" ]', \ 'then', + \ ' export HAS_256_COLORS=yes', + \ ' alias tmux="tmux -2"', \ ' if [ "screen" = "$TERM" ]', \ ' then', \ ' export TERM=screen-256color', @@ -409,6 +421,8 @@ function! RConfigBash() \ 'else', \ ' if [ "x$TERM" == "xxterm" ] || [ "x$TERM" == "xxterm-256color" ]', \ ' then', + \ ' export HAS_256_COLORS=yes', + \ ' alias tmux="tmux -2"', \ ' function tvim(){ tmux -2 new-session "TERM=screen-256color vim $@" ; }', \ ' else', \ ' function tvim(){ tmux new-session "vim $@" ; }', From 715ce2c4f1dd91a485084708a13f8d4c0af48caa Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 21 Nov 2013 12:47:39 -0300 Subject: [PATCH 0568/1050] Expand "~/" while writing file names. --- r-plugin/vimrconfig.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/r-plugin/vimrconfig.vim b/r-plugin/vimrconfig.vim index 02e9fa5..058bc6e 100644 --- a/r-plugin/vimrconfig.vim +++ b/r-plugin/vimrconfig.vim @@ -99,7 +99,7 @@ function! RConfigRprofile() call writefile(['#!/bin/sh', \ 'cat | vim -c "set ft=rdoc" -'], expand("~/bin/vimrpager")) call system("chmod +x " . expand("~/bin/vimrpager")) - let rpflines += [' options(help_type = "text", pager = "~/bin/vimrpager")'] + let rpflines += [' options(help_type = "text", pager = "' . expand("~/bin/vimrpager") . '")'] endif let rpflines += [' if(Sys.getenv("VIM_PANE") != "")', \ ' options(pager = vim.pager)'] @@ -130,7 +130,7 @@ function! RConfigRprofile() let rpflines += [' # Use the text based web browser w3m to navigate through R docs:', \ ' # Replace VIM_PANE with TMUX if you know what you are doing.', \ ' if(Sys.getenv("VIM_PANE") != "")', - \ ' options(browser="~/bin/vimrw3mbrowser")'] + \ ' options(browser="' . expand("~/bin/vimrw3mbrowser") . '")'] endif endif From 33df1cd69cc3154d1dda1db1891c6c99b4bb44fe Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Thu, 21 Nov 2013 15:13:45 -0300 Subject: [PATCH 0569/1050] Export TERM=screen-256color at the right moment. --- r-plugin/vimrconfig.vim | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/r-plugin/vimrconfig.vim b/r-plugin/vimrconfig.vim index 058bc6e..8ba3346 100644 --- a/r-plugin/vimrconfig.vim +++ b/r-plugin/vimrconfig.vim @@ -405,21 +405,19 @@ function! RConfigBash() \ 'then', \ ' export HAS_256_COLORS=yes', \ ' alias tmux="tmux -2"', - \ ' if [ "screen" = "$TERM" ]', + \ ' if [ "$TERM" = "xterm" ]', \ ' then', - \ ' export TERM=screen-256color', - \ ' else', \ ' export TERM=xterm-256color', \ ' fi', \ ' alias vim="vim --servername VIM"', - \ ' if [ "x$TERM" == "xxterm" ] || [ "x$TERM" == "xxterm-256color" ]', + \ ' if [ "$TERM" == "xterm" ] || [ "$TERM" == "xterm-256color" ]', \ ' then', \ ' function tvim(){ tmux -2 new-session "TERM=screen-256color vim --servername VIM $@" ; }', \ ' else', \ ' function tvim(){ tmux new-session "vim --servername VIM $@" ; }', \ ' fi', \ 'else', - \ ' if [ "x$TERM" == "xxterm" ] || [ "x$TERM" == "xxterm-256color" ]', + \ ' if [ "$TERM" == "xterm" ] || [ "$TERM" == "xterm-256color" ]', \ ' then', \ ' export HAS_256_COLORS=yes', \ ' alias tmux="tmux -2"', @@ -427,6 +425,10 @@ function! RConfigBash() \ ' else', \ ' function tvim(){ tmux new-session "vim $@" ; }', \ ' fi', + \ 'fi', + \ 'if [ "$TERM" = "screen" ] && [ "$HAS_256_COLORS" = "yes" ]', + \ 'then', + \ ' export TERM=screen-256color', \ 'fi' ] call writefile(blines, $HOME . "/.bashrc") if !has("gui_running") @@ -445,7 +447,7 @@ function! RConfigBash() echohl Normal if RGetYesOrNo(what) silent exe "tabnew " . $HOME . "/.bashrc" - normal! G27k + normal! G32k endif endif endif From 64e92c499602232027cb631cf2b9def915fc2eea Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Mon, 25 Nov 2013 00:51:42 -0300 Subject: [PATCH 0570/1050] Set rout filetype. This is necessary if ftdetect/r.vim is not installed at ~/.vim directory. --- ftplugin/r.vim | 1 + 1 file changed, 1 insertion(+) diff --git a/ftplugin/r.vim b/ftplugin/r.vim index d352473..fdf356c 100644 --- a/ftplugin/r.vim +++ b/ftplugin/r.vim @@ -80,6 +80,7 @@ function! ShowRout() else exe "tabnew " . routfile endif + set filetype=rout else call RWarningMsg("The file '" . routfile . "' is not readable.") endif From 4eae887ea8e78d3eddbae03a8df8d98118eff3f6 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Mon, 25 Nov 2013 00:54:22 -0300 Subject: [PATCH 0571/1050] Redraw the screen before displaying next message. --- r-plugin/vimrconfig.vim | 47 +++++++++++++++++++++++++++++------------ 1 file changed, 33 insertions(+), 14 deletions(-) diff --git a/r-plugin/vimrconfig.vim b/r-plugin/vimrconfig.vim index 8ba3346..41a0139 100644 --- a/r-plugin/vimrconfig.vim +++ b/r-plugin/vimrconfig.vim @@ -61,7 +61,9 @@ function! RConfigRprofile() endif endfor if hasvimcom - call RWarningMsg('The string "vimcom" was found in your .Rprofile. No change was done.') + echohl WarningMsg + echo 'The string "vimcom" was found in your .Rprofile. No change was done.' + echohl Normal else let rpflines += [''] if exists("*strftime") @@ -88,6 +90,7 @@ function! RConfigRprofile() endif let rpflines += [' library(vimcom.plus)'] + redraw echo " " echo "By defalt, R uses the 'less' application to show help documents." echohl Question @@ -106,6 +109,7 @@ function! RConfigRprofile() endif if executable("w3m") && ($PATH =~ "\\~/bin" || $PATH =~ expand("~/bin")) && filewritable(expand("~/bin")) == 2 && !filereadable(expand("~/bin/vimrw3mbrowser")) + redraw echo " " echo "The w3m application, a text based web browser, is installed in your system." echo "When R is running inside of a Tmux session, it can be configured to" @@ -136,8 +140,11 @@ function! RConfigRprofile() let rpflines += ["}"] call writefile(rpflines, res[0]) + redraw echo " " - call RWarningMsg('Your new .Rprofile was created.') + echohl WarningMsg + echo 'Your new .Rprofile was created.' + echohl Normal endif if has("win32") || has("win64") || !hasvimcom @@ -159,6 +166,7 @@ function! RConfigRprofile() redraw else redraw + echo " " call RWarningMsg("Error: configR_result not found.") sleep 1 return 1 @@ -188,6 +196,7 @@ function! RConfigVimrc() if filereadable(uvimrc) let hasvimrc = 1 + echo " " echohl WarningMsg echo "You already have a vimrc." echohl Normal @@ -234,6 +243,7 @@ function! RConfigVimrc() endif if RFindString(vlines, "maplocalleader") == 0 + redraw echo " " if hasvimrc echohl WarningMsg @@ -252,6 +262,7 @@ function! RConfigVimrc() endif if RFindString(vlines, "") == 0 && RFindString(vlines, "") == 0 && RFindString(vlines, "") == 0 + redraw echo " " if hasvimrc echohl WarningMsg @@ -274,6 +285,7 @@ function! RConfigVimrc() endif if RFindString(vlines, "RDSendLine") == 0 || RFindString(vlines, "RDSendSelection") == 0 + redraw echo " " if hasvimrc echohl WarningMsg @@ -294,6 +306,7 @@ function! RConfigVimrc() endif if has("unix") && has("syntax") && RFindString(vlines, "t_Co") == 0 + redraw echo " " echo "Vim is capable of displaying 256 colors in terminal emulators. However, it" echo "doesn't always detect that the terminal has this feature and defaults to" @@ -311,6 +324,7 @@ function! RConfigVimrc() endif if !hasvimrc + redraw echo " " echo "There are some options that most Vim users like, but that are not enabled by" echo "default such as highlighting the last search pattern, incremental search" @@ -330,20 +344,23 @@ function! RConfigVimrc() \ 'set incsearch', \ '', \ '" By default, Vim indents code by 8 spaces. Most people prefer 4 spaces:', - \ 'set sw=4', - \ '', - \ '" There are hundreds of color schemes for Vim on the internet, but you can', - \ '" start with color schemes already installed.', - \ '" Click on GVim menu bar "Edit / Color scheme" to know the name of your', - \ '" preferred color scheme, then, remove the double quote (which is a comment', - \ '" character, like the # is for R language) and replace the value "not_defined"', - \ '" below:', - \ '"colorscheme not_defined'] + \ 'set sw=4'] endif endif + if RFindString(vlines, "^\s*colo") == 0 + let vlines += ['', + \ '" There are hundreds of color schemes for Vim on the internet, but you can', + \ '" start with color schemes already installed.', + \ '" Click on GVim menu bar "Edit / Color scheme" to know the name of your', + \ '" preferred color scheme, then, remove the double quote (which is a comment', + \ '" character, like the # is for R language) and replace the value "not_defined"', + \ '" below:', + \ '"colorscheme not_defined'] + endif call writefile(vlines, uvimrc) + redraw echo " " echohl WarningMsg echo "The changes in your vimrc will be effective" @@ -370,6 +387,7 @@ function! RConfigBash() endif endfor + redraw echo " " if hastvim echohl WarningMsg @@ -432,6 +450,7 @@ function! RConfigBash() \ 'fi' ] call writefile(blines, $HOME . "/.bashrc") if !has("gui_running") + redraw echo " " echohl WarningMsg echo "The changes in your bashrc will be effective" @@ -456,6 +475,7 @@ function! RConfigBash() endfunction function! RConfigTmux() + redraw echo " " if filereadable($HOME . "/.tmux.conf") echohl WarningMsg @@ -489,6 +509,7 @@ function! RConfigTmux() \ "set -g mouse-select-pane on", \ "set -g mouse-resize-pane on"] call writefile(tlines, $HOME . "/.tmux.conf") + redraw echo " " echohl Question let what = input("Do you want to see your .tmux.conf now? [y/N]: ") @@ -512,9 +533,7 @@ function! RConfigVimR() let cmd = "\\rf" endif endif - echohl WarningMsg - echomsg "Please type " . cmd . " to start R before running :RpluginConfig" - echohl Normal + call RWarningMsg("Please type " . cmd . " to start R before running :RpluginConfig") return endif if RConfigRprofile() From 4e2e2eb0995d32ee3ddfd81d209b2970373a0897 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Mon, 25 Nov 2013 00:55:40 -0300 Subject: [PATCH 0572/1050] Documentation update. --- doc/r-plugin.txt | 78 ++++++++++++++++++++++++------------------------ 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 306c7b7..6e43ae5 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -152,9 +152,6 @@ should have at least the following options in your |vimrc|: filetype plugin on filetype indent on < -Make a backup of your ~/.vim directory because existing files will be -replaced. Please, look at |r-plugin-files| to see the list of files. - Download the latest version of the plugin from: http://www.vim.org/scripts/script.php?script_id=2628 @@ -178,7 +175,7 @@ and ~/.bashrc (the is `\` by default): > :RpluginConfig < -The above command will guide you through additional configuration steps, but +The above command will guide you through the final configuration steps, but if you prefer to configure everything by yourself, please, read the section |r-plugin-quick-setup|. @@ -221,7 +218,7 @@ dependencies: the official GVim 7.4 binary. The default download may not match the Python version Vim was linked against: then you have to "View all files" on the download page to find the file that matches exactly the above - versions. Please, read |r-plugin-python| if want to use different + versions. Please, read |r-plugin-python| if need to use different versions. Now, download the latest version of `Vim-R-plugin.vmb` from @@ -256,9 +253,7 @@ and, finally, click on the menu bar R Configure (Vim-R) < -The above command will guide you through additional configuration steps. If -you are already an experienced Vim user, instead of running the above command -you may preffer to read |r-plugin-Rprofile-Windows|. +The above command will guide you through the final configuration steps. You may have to adjust the value of |vimrplugin_sleeptime|. @@ -515,7 +510,7 @@ The command may be abbreviated to :Rh and you can either press to trigger the autocompletion of R objects names or hit CTRL-D to list the possible completions (see |cmdline-completion| for details on the various ways of getting command-line completion). The list of objects used for -completion is the available for omnicompletion (see +completion is the same available for omnicompletion (see |vimrplugin_permanent_libs|). You can source all .R files in a directory with the Normal mode command @@ -685,7 +680,7 @@ section refers to the case of starting R when Vim already is in a Tmux session, that is, if you do: > tmux - vim filename.R + vim --servername VIM filename.R exit < In this case, the terminal window is split in two regions: one for Vim and the @@ -704,8 +699,10 @@ Vim by typing: tvim filename.R < Using the `tvim` function, the Tmux session is finished when you quits Vim. -That is, the only advantage of using `tvim` is that you do not have to type -`tmux` before and `exit` after the edition of the file. +That is, the main advantage of using `tvim` is that you do not have to type +`tmux` before and `exit` after the edition of the file. Moreover, the +`tvim` command also pass the |--servername| argument to Vim, which is required +update of the Object Browser and functions highlight. If you are going to run Vim inside Tmux, than you should create your ~/.tmux.conf if it does not exist yet. You may put the lines below in your @@ -771,13 +768,12 @@ you have to type a. 4.8.3 Copying and pasting~ You do not need to copy code from Vim to R because you can use the plugin's -shortcuts to send the code, but you may want to copy something from R Console -and paste it in another application. For pasting the output of R commands into -Vim's buffer, you can use the command |:Rinsert|. If you want to copy text -from an application running inside the Tmux to another application also -running in Tmux, as explained in the previous subsection, you can enter in -Tmux copy/scroll mode, select the text, copy it, switch to the other -application pane and, then, paste. +shortcuts to send the code. For pasting the output of R commands into Vim's +buffer, you can use the command |:Rinsert|. If you want to copy text from an +application running inside the Tmux to another application also running in +Tmux, as explained in the previous subsection, you can enter in Tmux +copy/scroll mode, select the text, copy it, switch to the other application +pane and, then, paste. However, if you want to copy something from either Vim or R to another application not running inside Tmux, Tmux may prevent the X server from @@ -792,8 +788,8 @@ support in Tmux. You will be able to toggle mouse support on and off by typing With Tmux, you can detach the Vim-R session and reattach it latter. This is useful if you plan to begin the use the Vim-R-plugin in a machine and latter -move to another computer and access remotely your previous Vim-R-plugin -session. Below is the step-by-step procedure to run the Vim-R-plugin remotely: +move to another computer and access remotely your previous Vim-R session. +Below is the step-by-step procedure to run the Vim-R remotely: - Start Tmux: tmux @@ -895,35 +891,39 @@ open and close when the key is pressed over them. 5.7. R must be started by Vim~ -The communication between Vim and R will only work if R was started by Vim +The communication between Vim and R will work only if R was started by Vim through the rf command because the plugin was designed to connect each Vim instance with its own R instance. If you start R before Vim, it will -not inherit from Vim the environment variables VIMRPLUGIN_TMPDIR and -VIMINSTANCEID. The former variable is the path used by the R package vimcom to -save temporary files used by the Vim-R-plugin to: perform omnicompletion, show -R documentation in a Vim buffer, and update the Object Browser. The latter is -used by the Vim-R-plugin to know that it is not connecting to an R instance -initiated by another Vim instance. If you use Vim to start R, but then closes -Vim, the VIMINSTANCEID variable in R will become outdated. Additionally, the -Vim-R-plugin sets the value of its internal variable SendCmdToR from -SendCmdToR_fake to the appropriate value when R is successfully started. It is -possible to set the values of all these variables manually, but, as you can -see below, it is not practical to do so. If you have either started R before -Vim or closed Vim and opened it again and really want full communication -between Vim and R, you can try the following (not all procedures are necessary -for all cases): +not inherit from Vim the environment variables VIMRPLUGIN_TMPDIR, +VIMRPLUGIN_HOME, VIMEDITOR_SVRNM and VIMINSTANCEID. The first one is the path +used by the R package vimcom to save temporary files used by the Vim-R-plugin +to: perform omnicompletion, show R documentation in a Vim buffer, and update +the Object Browser. The latter is used by the Vim-R-plugin to know that it is +not connecting to an R instance initiated by another Vim instance. If you use +Vim to start R, but then closes Vim, the VIMINSTANCEID variable in R will +become outdated. Additionally, the Vim-R-plugin sets the value of its internal +variable SendCmdToR from SendCmdToR_fake to the appropriate value when R is +successfully started. It is possible to set the values of all these variables +manually, but, as you can see below, it is not practical to do so. If you have +either started R before Vim or closed Vim and opened it again and really want +full communication between Vim and R, you can try the following (not all +procedures are necessary for all cases): In Normal mode Vim do: > :echo $VIMRPLUGIN_TMPDIR :echo $VIMINSTANCEID + :echo $VIMEDITOR_SVRNM + :echo $VIMRPLUGIN_HOME < In R do: > detach("package:vimcom.plus", unload = TRUE) # or vimcom - Sys.setenv(VIMRPLUGIN_TMPDIR="X") # where "X" is what Vim has echoed + Sys.setenv(VIMRPLUGIN_TMPDIR="T") # where "T" is what Vim has echoed library(vimcom.plus) # or vimcom - Sys.setenv(VIMINSTANCEID="Y") # where "Y" is what Vim has echoed + Sys.setenv(VIMINSTANCEID="I") # where "I" is what Vim has echoed + Sys.setenv(VIMEDITOR_SVRNM"="S") # where "S" is what Vim has echoed + Sys.setenv(VIMRPLUGIN_HOME"="H") # where "H" is what Vim has echoed < If you are running R in a terminal emulator (Linux/Unix) Vim still needs to know the name of Tmux session and Tmux pane where R is running. @@ -2276,7 +2276,7 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details. *r-plugin-news* 10. News~ -0.9.9.8 (2013-11-19) +0.9.9.8 (2013-11-24) * The list of objects for omnicompletion and the list of functions for syntax highlight now are built dynamically. Deprecated commands and options: From 7be22f6cb10e2f5e27bcf1da17c25e3b662c6ee7 Mon Sep 17 00:00:00 2001 From: Nir Atias Date: Tue, 26 Nov 2013 13:14:24 +0200 Subject: [PATCH 0573/1050] should fix problems with tcsh. seems to work OK with bash --- r-plugin/common_global.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 2f1bf48..45464ea 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -558,7 +558,7 @@ endfunction " Adapted from screen plugin: function TmuxActivePane() - let line = system('tmux list-panes | grep "(active)$"') + let line = system("tmux list-panes | grep \'(active)$'") let paneid = matchstr(line, '\v\%\d+ \(active\)') if !empty(paneid) return matchstr(paneid, '\v^\%\d+') From ba37f21a79a1a7a8eb0974afa2b9b7c82060e135 Mon Sep 17 00:00:00 2001 From: jcfaria Date: Tue, 26 Nov 2013 10:16:39 -0300 Subject: [PATCH 0574/1050] README deleted README.md added --- README | 14 -------------- README.md | 14 ++++++++++++++ 2 files changed, 14 insertions(+), 14 deletions(-) delete mode 100644 README create mode 100644 README.md diff --git a/README b/README deleted file mode 100644 index 4b5d374..0000000 --- a/README +++ /dev/null @@ -1,14 +0,0 @@ -This is the development code of Vim-R-plugin. You may want to adjust Vim's -'runtimepath' in your ~/.vimrc as in the example below: - -set runtimepath=~/Vim-R-plugin,~/.vim,$VIMRUNTIME,~/.vim/after - -Stable versions are released at -http://www.vim.org/scripts/script.php?script_id=2628 - -Please, read the file doc/r-plugin.txt for usage details. - -If you decide to use this version, you will also need the development version -of vimcom: - -https://github.com/jalvesaq/VimCom diff --git a/README.md b/README.md new file mode 100644 index 0000000..7ef4218 --- /dev/null +++ b/README.md @@ -0,0 +1,14 @@ +### Vim-R-plugin + +This is the development code of Vim-R-plugin. You may want to adjust Vim's +**runtimepath** in your **~/.vimrc** as in the example below: + +> set runtimepath=~/Vim-R-plugin,~/.vim,$VIMRUNTIME,~/.vim/after + +Stable versions are released at +http://www.vim.org/scripts/script.php?script_id=2628 + +Please, read the file *doc/r-plugin.txt* for usage details. + +If you decide to use this version, you will also need the development version +of vimcom: https://github.com/jalvesaq/VimCom From adf8d051ec1176e216f07abe7d04f347d40f2545 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Tue, 26 Nov 2013 10:49:49 -0300 Subject: [PATCH 0575/1050] Documentation update. Fish shell problems with Object Browser seems to be fixed. Added instructions on how to uninstall the plugin. --- doc/r-plugin.txt | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 6e43ae5..64807e5 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -167,7 +167,8 @@ Then, in Vim, type: < Press and the plugin will be installed (because the plugin has many files, you have to press the space bar a few times to finish the -installation). You should, then, quit Vim. +installation). You should, then, quit Vim. Note: if you need too install the +plugin in a non default directory, do `:UseVimball` `[path]`. Start Vim again and edit an R script. Type rf to start R and run the command below to get help configuring ~/.Rprofile, ~/.vimrc, ~/.tmux.conf, @@ -194,6 +195,10 @@ send commands to the R Console application unless vimrplugin_applescript = 0. Some users have reported more luck with iTerm than with the default Mac OS X terminal emulator. +If you want to uninstall the plugin, do +> + :RmVimball Vim-R-plugin +< 3.2. Instructions for Windows ~ @@ -234,7 +239,8 @@ Then, in Vim, type: < Press and the plugin will be installed (because the plugin has many files, you have to press the space bar a few times to finish the -installation). You should, then, quit Vim. +installation). You should, then, quit Vim. Note: if you need too install the +plugin in a non default directory, do `:UseVimball` `[path]`. Start GVim again and edit an R script. You can right click a .R file and choose "Edit with Vim" or create a new one with the Normal mode command: @@ -257,6 +263,10 @@ The above command will guide you through the final configuration steps. You may have to adjust the value of |vimrplugin_sleeptime|. +If you want to uninstall the plugin, do +> + :RmVimball Vim-R-plugin +< 3.3. Troubleshooting (if the plugin doesn't work)~ @@ -882,14 +892,7 @@ Everything should work as expected again after any valid code is executed in the R Console. -5.6. Problems with Fish Shell~ - -Some of the plugin features does not work correctly if Vim is running inside -Fish Shell, for example, in the Object Browser, lists and libraries do not -open and close when the key is pressed over them. - - -5.7. R must be started by Vim~ +5.6. R must be started by Vim~ The communication between Vim and R will work only if R was started by Vim through the rf command because the plugin was designed to connect @@ -2276,7 +2279,7 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details. *r-plugin-news* 10. News~ -0.9.9.8 (2013-11-24) +0.9.9.8 (2013-11-26) * The list of objects for omnicompletion and the list of functions for syntax highlight now are built dynamically. Deprecated commands and options: From 9fc9adff3490371e6bc557f7fe2faccbc1456263 Mon Sep 17 00:00:00 2001 From: Nir Atias Date: Thu, 28 Nov 2013 17:11:58 +0200 Subject: [PATCH 0576/1050] fix tcsh errors in external terminal --- r-plugin/common_global.vim | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim index 45464ea..eb74ceb 100644 --- a/r-plugin/common_global.vim +++ b/r-plugin/common_global.vim @@ -643,7 +643,14 @@ function StartR_ExternalTerm(rcmd) endif call extend(cnflines, ['set-environment VIMINSTANCEID "' . $VIMINSTANCEID . '"']) call writefile(cnflines, s:tmxcnf) - let rcmd = "VIMINSTANCEID=" . $VIMINSTANCEID . " " . a:rcmd + + let is_bash = system('echo $BASH') + if v:shell_error || len(is_bash) == 0 || empty(matchstr(tolower(is_bash),'undefined variable')) == 0 + let rcmd = a:rcmd + else + let rcmd = "VIMINSTANCEID=" . $VIMINSTANCEID . " " . a:rcmd + endif + call system('export VIMRPLUGIN_TMPDIR=' . $VIMRPLUGIN_TMPDIR) call system('export VIMRPLUGIN_HOME=' . g:rplugin_home) call system('export VIMINSTANCEID=' . $VIMINSTANCEID) From 6a93b4bfb9505401885b2746e75d3ae924976aea Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Fri, 29 Nov 2013 10:59:13 -0300 Subject: [PATCH 0577/1050] Perhaps no conflict with Fish shell and tcsh. I can no longer reproduce the Object Browser bug when running under Fish Shell (pressing over a list didn't open/close it) and Nir Atias recently fixed some bugs specific to tcsh. So, I suppose that there are no bugs specific to tcsh and Fish shell. People have to report them again if they still exist. --- doc/r-plugin.txt | 6 ------ 1 file changed, 6 deletions(-) diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt index 64807e5..b8e62a0 100644 --- a/doc/r-plugin.txt +++ b/doc/r-plugin.txt @@ -138,12 +138,6 @@ Before installing the plugin, you should install its dependencies: installation instructions vary widely and are beyond the scope of this documentation. - Conflicts:~ - - Users have reported that the Vim-R-plugin might not work well with Fish - Shell and tcsh. - - You need to activate plugins and indentation according to 'filetype'. You should have at least the following options in your |vimrc|: > From 2bc7a8d89a0973f3c52f5191bfb4c5662dfec860 Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 30 Nov 2013 00:38:00 -0300 Subject: [PATCH 0578/1050] Don't use neither Vim nor w3m as pager on Windows. --- r-plugin/vimrconfig.vim | 86 +++++++++++++++++++++-------------------- 1 file changed, 44 insertions(+), 42 deletions(-) diff --git a/r-plugin/vimrconfig.vim b/r-plugin/vimrconfig.vim index 41a0139..b6e3a85 100644 --- a/r-plugin/vimrconfig.vim +++ b/r-plugin/vimrconfig.vim @@ -90,51 +90,53 @@ function! RConfigRprofile() endif let rpflines += [' library(vimcom.plus)'] - redraw - echo " " - echo "By defalt, R uses the 'less' application to show help documents." - echohl Question - let what = input("Dou you prefer to see help documents in Vim? [y/N]: ") - echohl Normal - if RGetYesOrNo(what) - let rpflines += [' # See R documentation on Vim buffer even if asking for help in R Console:'] - if ($PATH =~ "\\~/bin" || $PATH =~ expand("~/bin")) && filewritable(expand("~/bin")) == 2 && !filereadable(expand("~/bin/vimrpager")) - call writefile(['#!/bin/sh', - \ 'cat | vim -c "set ft=rdoc" -'], expand("~/bin/vimrpager")) - call system("chmod +x " . expand("~/bin/vimrpager")) - let rpflines += [' options(help_type = "text", pager = "' . expand("~/bin/vimrpager") . '")'] - endif - let rpflines += [' if(Sys.getenv("VIM_PANE") != "")', - \ ' options(pager = vim.pager)'] - endif - - if executable("w3m") && ($PATH =~ "\\~/bin" || $PATH =~ expand("~/bin")) && filewritable(expand("~/bin")) == 2 && !filereadable(expand("~/bin/vimrw3mbrowser")) + if !(has("win32") || has("win64")) redraw echo " " - echo "The w3m application, a text based web browser, is installed in your system." - echo "When R is running inside of a Tmux session, it can be configured to" - echo "start its help system in w3m running in a Tmux pane." + echo "By defalt, R uses the 'less' application to show help documents." echohl Question - let what = input("Do you want to use w3m instead of your default web browser? [y/N]: ") + let what = input("Dou you prefer to see help documents in Vim? [y/N]: ") + echohl Normal if RGetYesOrNo(what) - call writefile(['#!/bin/sh', - \ 'NCOLS=$(tput cols)', - \ 'if [ "$NCOLS" -gt "140" ]', - \ 'then', - \ ' if [ "x$VIM_PANE" = "x" ]', - \ ' then', - \ ' tmux split-window -h "w3m $1 && exit"', - \ ' else', - \ ' tmux split-window -h -t $VIM_PANE "w3m $1 && exit"', - \ ' fi', - \ 'else', - \ ' tmux new-window "w3m $1 && exit"', - \ 'fi'], expand("~/bin/vimrw3mbrowser")) - call system("chmod +x " . expand("~/bin/vimrw3mbrowser")) - let rpflines += [' # Use the text based web browser w3m to navigate through R docs:', - \ ' # Replace VIM_PANE with TMUX if you know what you are doing.', - \ ' if(Sys.getenv("VIM_PANE") != "")', - \ ' options(browser="' . expand("~/bin/vimrw3mbrowser") . '")'] + let rpflines += [' # See R documentation on Vim buffer even if asking for help in R Console:'] + if ($PATH =~ "\\~/bin" || $PATH =~ expand("~/bin")) && filewritable(expand("~/bin")) == 2 && !filereadable(expand("~/bin/vimrpager")) + call writefile(['#!/bin/sh', + \ 'cat | vim -c "set ft=rdoc" -'], expand("~/bin/vimrpager")) + call system("chmod +x " . expand("~/bin/vimrpager")) + let rpflines += [' options(help_type = "text", pager = "' . expand("~/bin/vimrpager") . '")'] + endif + let rpflines += [' if(Sys.getenv("VIM_PANE") != "")', + \ ' options(pager = vim.pager)'] + endif + + if executable("w3m") && ($PATH =~ "\\~/bin" || $PATH =~ expand("~/bin")) && filewritable(expand("~/bin")) == 2 && !filereadable(expand("~/bin/vimrw3mbrowser")) + redraw + echo " " + echo "The w3m application, a text based web browser, is installed in your system." + echo "When R is running inside of a Tmux session, it can be configured to" + echo "start its help system in w3m running in a Tmux pane." + echohl Question + let what = input("Do you want to use w3m instead of your default web browser? [y/N]: ") + if RGetYesOrNo(what) + call writefile(['#!/bin/sh', + \ 'NCOLS=$(tput cols)', + \ 'if [ "$NCOLS" -gt "140" ]', + \ 'then', + \ ' if [ "x$VIM_PANE" = "x" ]', + \ ' then', + \ ' tmux split-window -h "w3m $1 && exit"', + \ ' else', + \ ' tmux split-window -h -t $VIM_PANE "w3m $1 && exit"', + \ ' fi', + \ 'else', + \ ' tmux new-window "w3m $1 && exit"', + \ 'fi'], expand("~/bin/vimrw3mbrowser")) + call system("chmod +x " . expand("~/bin/vimrw3mbrowser")) + let rpflines += [' # Use the text based web browser w3m to navigate through R docs:', + \ ' # Replace VIM_PANE with TMUX if you know what you are doing.', + \ ' if(Sys.getenv("VIM_PANE") != "")', + \ ' options(browser="' . expand("~/bin/vimrw3mbrowser") . '")'] + endif endif endif @@ -348,7 +350,7 @@ function! RConfigVimrc() endif endif - if RFindString(vlines, "^\s*colo") == 0 + if RFindString(vlines, "colorscheme") == 0 let vlines += ['', \ '" There are hundreds of color schemes for Vim on the internet, but you can', \ '" start with color schemes already installed.', From 19e67325488a6dece1d907c84a4538dd29474b4f Mon Sep 17 00:00:00 2001 From: Jakson Aquino Date: Sat, 30 Nov 2013 08:03:37 -0300 Subject: [PATCH 0579/1050] Version 0.9.9.8. --- Makefile | 1 + doc/r-plugin.txt | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 801b554..317a758 100644 --- a/Makefile +++ b/Makefile @@ -173,6 +173,7 @@ htmldoc: sed -i -e 's/||/<\/code>/g' r-plugin.html ;\ sed -i -e 's/`//g' r-plugin.html ;\ + sed -i -e 's/<\/pre>
/  --------------------------------------------------------\n/' r-plugin.html ;\
 	    mv r-plugin.html vim-stylesheet.css /tmp )
 
 all: zip deb htmldoc
diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index b8e62a0..b6f95cc 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -2273,7 +2273,7 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details.
 							       *r-plugin-news*
 10. News~
 
-0.9.9.8 (2013-11-26)
+0.9.9.8 (2013-11-30)
 
  * The list of objects for omnicompletion and the list of functions for syntax
    highlight now are built dynamically. Deprecated commands and options:

From 53717c7751b0e1ffbd1373905aca0b921c966a22 Mon Sep 17 00:00:00 2001
From: Keith Hughitt 
Date: Tue, 3 Dec 2013 21:25:33 -0500
Subject: [PATCH 0580/1050] Fix issue relating to R Markdown single-line LaTeX
 $$display equations$$

---
 syntax/rmd.vim | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/syntax/rmd.vim b/syntax/rmd.vim
index 26c6f23..ac31fba 100644
--- a/syntax/rmd.vim
+++ b/syntax/rmd.vim
@@ -67,7 +67,7 @@ if rmdIsPandoc == 0
     " Region
     syntax match rmdLaTeXRegDelim "\$\$" contained
     syntax match rmdLaTeXRegDelim "\$\$latex$" contained
-    syntax region rmdLaTeXRegion start="^\$\$" skip="\\\$" end="^\$\$" contains=@LaTeX,rmdLaTeXSt,rmdLaTeXRegDelim keepend 
+    syntax region rmdLaTeXRegion start="^\$\$" skip="\\\$" end="\$\$$" contains=@LaTeX,rmdLaTeXSt,rmdLaTeXRegDelim keepend
     syntax region rmdLaTeXRegion2 start="^\\\[" end="\\\]" contains=@LaTeX,rmdLaTeXSt,rmdLaTeXRegDelim keepend
     hi def link rmdLaTeXSt Statement
     hi def link rmdLaTeXInlDelim Special

From 40e9cbc469c111b0e58595f29837f7b0462ed5bb Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Wed, 4 Dec 2013 09:23:25 -0300
Subject: [PATCH 0581/1050] Add note on symbolic link to ftdetect/r.vim.

---
 doc/r-plugin.txt | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index b6f95cc..4967252 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -161,8 +161,11 @@ Then, in Vim, type:
 <
 Press  and the plugin will be installed (because the plugin has many
 files, you have to press the space bar a few times to finish the
-installation). You should, then, quit Vim. Note: if you need too install the
-plugin in a non default directory, do `:UseVimball` `[path]`.
+installation). You should, then, quit Vim.
+
+Note: If you need too install the plugin in a non default directory, do
+`:UseVimball` `[path]`. Then, create a symbolic link to `path/ftdetect/r.vim`
+into `~/.vim/ftdetect/r.vim`.
 
 Start Vim again and edit an R script. Type rf to start R and run
 the command below to get help configuring ~/.Rprofile, ~/.vimrc, ~/.tmux.conf,
@@ -233,8 +236,11 @@ Then, in Vim, type:
 <
 Press  and the plugin will be installed (because the plugin has many
 files, you have to press the space bar a few times to finish the
-installation). You should, then, quit Vim. Note: if you need too install the
-plugin in a non default directory, do `:UseVimball` `[path]`.
+installation). You should, then, quit Vim.
+
+Note: If you need too install the plugin in a non default directory, do
+`:UseVimball` `[path]`. Then, create a symbolic link to `path/ftdetect/r.vim`
+into `~/vimfiles/ftdetect/r.vim`.
 
 Start GVim again and edit an R script. You can right click a .R file and
 choose "Edit with Vim" or create a new one with the Normal mode command:

From ae5318e126c0652c65bd46f350addb17e1fad42e Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Sun, 8 Dec 2013 11:27:16 -0300
Subject: [PATCH 0582/1050] Note on new Vim-R-plugin forum on Google Groups.

---
 doc/r-plugin.txt | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 4967252..4eaa012 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -36,9 +36,13 @@ The latest stable version of this plugin is available at:
     http://www.vim.org/scripts/script.php?script_id=2628
 
 Feedback is welcomed. Please submit bug reports to the developers. Do not like
-a feature? Tell us and we may add an option to disable it. The plugin should
-emit useful warnings if you do things it was not programmed to deal with.
-Cryptic error message are bugs... Please report them at:
+a feature? Tell us and we may add an option to disable it. If you have any
+comments or questions, please post them at:
+
+    https://groups.google.com/forum/#!forum/vim-r-plugin
+
+The plugin should emit useful warnings if you do things it was not programmed
+to deal with. Cryptic error message are bugs... Please report them at:
 
     https://github.com/jcfaria/Vim-R-plugin/issues
 

From a9038ff734a0e05d1c7d2b7df29d80109e96d315 Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Sun, 8 Dec 2013 11:27:50 -0300
Subject: [PATCH 0583/1050] Require vimcom 0.9-93.

---
 r-plugin/vimcom.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/r-plugin/vimcom.py b/r-plugin/vimcom.py
index 37408f3..cd02fe7 100644
--- a/r-plugin/vimcom.py
+++ b/r-plugin/vimcom.py
@@ -50,8 +50,8 @@ def DiscoverVimComPort():
     else:
         vim.command("let g:rplugin_vimcomport = " + str(VimComPort))
         PortWarn = False
-        if repl.find("0.9-92") != 0:
-            vim.command("call RWarningMsg('This version of Vim-R-plugin requires vimcom.plus (or vimcom) 0.9-92.')")
+        if repl.find("0.9-93") != 0:
+            vim.command("call RWarningMsg('This version of Vim-R-plugin requires vimcom.plus (or vimcom) 0.9-93.')")
             vim.command("sleep 1")
     return(VimComPort)
 

From e0387124064f165ad16944b4305a79d11481eabf Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Sun, 8 Dec 2013 11:28:21 -0300
Subject: [PATCH 0584/1050] Add $VIMINSTANCEID to some file names.

---
 ftplugin/rbrowser.vim      |  4 ++--
 r-plugin/common_global.vim | 49 +++++++++++++-------------------------
 2 files changed, 18 insertions(+), 35 deletions(-)

diff --git a/ftplugin/rbrowser.vim b/ftplugin/rbrowser.vim
index 746cc53..86989f2 100644
--- a/ftplugin/rbrowser.vim
+++ b/ftplugin/rbrowser.vim
@@ -101,9 +101,9 @@ function! UpdateOB(what)
     sil normal! ggdG
     let @@ = save_unnamed_reg 
     if wht == "GlobalEnv"
-        let fcntt = readfile($VIMRPLUGIN_TMPDIR . g:rplugin_globenv_f)
+        let fcntt = readfile($VIMRPLUGIN_TMPDIR . "/globenv_" . $VIMINSTANCEID)
     else
-        let fcntt = readfile($VIMRPLUGIN_TMPDIR . g:rplugin_liblist_f)
+        let fcntt = readfile($VIMRPLUGIN_TMPDIR . "/liblist_" . $VIMINSTANCEID)
     endif
     call setline(1, fcntt)
     call cursor(curline, curcol)
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index eb74ceb..38d62ee 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -742,8 +742,8 @@ endfunction
 
 " Start R
 function StartR(whatr)
-    call writefile([], $VIMRPLUGIN_TMPDIR . g:rplugin_globenv_f)
-    call writefile([], $VIMRPLUGIN_TMPDIR . g:rplugin_liblist_f)
+    call writefile([], $VIMRPLUGIN_TMPDIR . "/globenv_" . $VIMINSTANCEID)
+    call writefile([], $VIMRPLUGIN_TMPDIR . "/liblist_" . $VIMINSTANCEID)
     if filereadable($VIMRPLUGIN_TMPDIR . "/libnames_" . $VIMINSTANCEID)
         call delete($VIMRPLUGIN_TMPDIR . "/libnames_" . $VIMINSTANCEID)
     endif
@@ -910,20 +910,14 @@ function StartObjBrowser_Tmux()
                 \ 'let g:rplugin_tmuxsname = "' . g:rplugin_tmuxsname . '"',
                 \ 'let b:rscript_buffer = "' . bufname("%") . '"',
                 \ 'set filetype=rbrowser',
-                \ 'let $VIMINSTANCEID="' . $VIMINSTANCEID . '"',
                 \ 'let b:rplugin_extern_ob = 1',
                 \ 'set shortmess=atI',
                 \ 'set rulerformat=%3(%l%)',
                 \ 'set noruler',
                 \ 'exe "PyFile " . substitute(g:rplugin_home, " ", '. "'\\\\ '" . ', "g") . "/r-plugin/vimcom.py"',
                 \ 'let g:SendCmdToR = function("SendCmdToR_TmuxSplit")',
-                \ 'if v:servername == ""',
-                \ '    let g:rplugin_globenv_f = "' . g:rplugin_globenv_f . '"',
-                \ '    let g:rplugin_liblist_f = "' . g:rplugin_liblist_f . '"',
-                \ 'else',
-                \ '    let g:rplugin_globenv_f = "/globenv_" . v:servername',
-                \ '    let g:rplugin_liblist_f = "/liblist_" . v:servername',
-                \ "    exe 'Py SendToVimCom(\"\\x07' . v:servername . '\")'",
+                \ 'if has("clientserver") && v:servername != ""',
+                \ "   exe 'Py SendToVimCom(" . '"\007' . "' . v:servername . '" . '")' . "'",
                 \ 'endif',
                 \ 'Py SendToVimCom("\004Libraries [OB init]")',
                 \ 'sleep 50m',
@@ -1804,8 +1798,10 @@ function RQuit(how)
         unlet g:rplugin_rconsole_pane
     endif
 
-    call writefile([], $VIMRPLUGIN_TMPDIR . g:rplugin_globenv_f)
-    call writefile([], $VIMRPLUGIN_TMPDIR . g:rplugin_liblist_f)
+    call delete($VIMRPLUGIN_TMPDIR . "/globenv_" . $VIMINSTANCEID)
+    call delete($VIMRPLUGIN_TMPDIR . "/liblist_" . $VIMINSTANCEID)
+    call delete($VIMRPLUGIN_TMPDIR . "/libnames_" . $VIMINSTANCEID)
+    call delete($VIMRPLUGIN_TMPDIR . "/GlobalEnvList_" . $VIMINSTANCEID)
     let g:SendCmdToR = function('SendCmdToR_fake')
 endfunction
 
@@ -1832,8 +1828,7 @@ function BuildROmniList()
 	endif
     endif
 
-    let rtf = g:rplugin_globalenvfname
-    let omnilistcmd = 'vim.bol("' . rtf . '"'
+    let omnilistcmd = 'vim.bol("' . $VIMRPLUGIN_TMPDIR . "/GlobalEnvList_" . $VIMINSTANCEID . '"'
     if g:vimrplugin_allnames == 1
         let omnilistcmd = omnilistcmd . ', allnames = TRUE'
     endif
@@ -1864,7 +1859,7 @@ function BuildROmniList()
         return
     endif
 
-    let g:rplugin_globalenvlines = readfile(g:rplugin_globalenvfname)
+    let g:rplugin_globalenvlines = readfile($VIMRPLUGIN_TMPDIR . "/GlobalEnvList_" . $VIMINSTANCEID)
     echon
 endfunction
 
@@ -3457,32 +3452,20 @@ let g:rplugin_hasRSFbutton = 0
 let g:rplugin_errlist = []
 let g:rplugin_tmuxsname = substitute("vimrplugin-" . g:rplugin_userlogin . localtime() . g:rplugin_firstbuffer, '\W', '', 'g')
 
-let $VIMINSTANCEID = substitute(g:rplugin_firstbuffer . localtime(), '\W', '', 'g')
+" If this is the Object Browser running in a Tmux pane, $VIMINSTANCEID is
+" already defined and shouldn't be changed
+if $VIMINSTANCEID == ""
+    let $VIMINSTANCEID = substitute(g:rplugin_firstbuffer . localtime(), '\W', '', 'g')
+endif
 
 let g:rplugin_obsname = toupper(substitute(substitute(expand("%:r"), '\W', '', 'g'), "_", "", "g"))
 
 let g:rplugin_docfile = $VIMRPLUGIN_TMPDIR . "/Rdoc"
 
-if g:rplugin_tmuxwasfirst
-    if $DISPLAY == ""
-        let g:rplugin_globenv_f = "/globenv_"
-        let g:rplugin_liblist_f = "/liblist_"
-        let g:rplugin_globalenvfname = $VIMRPLUGIN_TMPDIR . "/GlobalEnvList"
-    else
-        let g:rplugin_globenv_f = "/globenv_" . g:rplugin_obsname
-        let g:rplugin_liblist_f = "/liblist_" . g:rplugin_obsname
-        let g:rplugin_globalenvfname = $VIMRPLUGIN_TMPDIR . "/GlobalEnvList_" . g:rplugin_obsname
-    endif
-else
-    let g:rplugin_globenv_f = "/globenv_" . v:servername
-    let g:rplugin_liblist_f = "/liblist_" . v:servername
-    let g:rplugin_globalenvfname = $VIMRPLUGIN_TMPDIR . "/GlobalEnvList_" . v:servername
-endif
-
 " Create an empty file to avoid errors if the user do Ctrl-X Ctrl-O before
 " starting R:
 if &filetype != "rbrowser"
-    call writefile([], g:rplugin_globalenvfname)
+    call writefile([], $VIMRPLUGIN_TMPDIR . "/GlobalEnvList_" . $VIMINSTANCEID)
 endif
 
 call SetRPath()

From 3e671b34f005ce38972d348000caedea40a7be99 Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Sun, 8 Dec 2013 11:29:24 -0300
Subject: [PATCH 0585/1050] Delete temporary file.

---
 r-plugin/vimrconfig.vim | 1 +
 1 file changed, 1 insertion(+)

diff --git a/r-plugin/vimrconfig.vim b/r-plugin/vimrconfig.vim
index b6e3a85..abbf17f 100644
--- a/r-plugin/vimrconfig.vim
+++ b/r-plugin/vimrconfig.vim
@@ -47,6 +47,7 @@ function! RConfigRprofile()
     endif
     if filereadable($VIMRPLUGIN_TMPDIR . "/configR_result")
         let res = readfile($VIMRPLUGIN_TMPDIR . "/configR_result")
+        call delete($VIMRPLUGIN_TMPDIR . "/configR_result")
         if filereadable(res[0])
             let rpflines = readfile(res[0])
         else

From 66e2ade9f71a54d59a45cb7deef1f1d2f6a73652 Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Sun, 8 Dec 2013 11:33:16 -0300
Subject: [PATCH 0586/1050] Delete temporary files on VimLeave event.

---
 r-plugin/common_global.vim | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 38d62ee..eb19ff8 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -2965,6 +2965,21 @@ function RBufEnter()
     endif
 endfunction
 
+function RVimLeave()
+    call delete($VIMRPLUGIN_TMPDIR . "/eval_reply")
+    call delete($VIMRPLUGIN_TMPDIR . "/formatted_code")
+    call delete($VIMRPLUGIN_TMPDIR . "/GlobalEnvList_" . $VIMINSTANCEID)
+    call delete($VIMRPLUGIN_TMPDIR . "/globenv_" . $VIMINSTANCEID)
+    call delete($VIMRPLUGIN_TMPDIR . "/liblist_" . $VIMINSTANCEID)
+    call delete($VIMRPLUGIN_TMPDIR . "/libnames_" . $VIMINSTANCEID)
+    call delete($VIMRPLUGIN_TMPDIR . "/objbrowserInit")
+    call delete($VIMRPLUGIN_TMPDIR . "/Rinsert")
+    call delete($VIMRPLUGIN_TMPDIR . "/tmux.conf")
+    call delete($VIMRPLUGIN_TMPDIR . "/unformatted_code")
+    call delete($VIMRPLUGIN_TMPDIR . "/vimbol_finished")
+    call delete($VIMRPLUGIN_TMPDIR . "/vimcom_running")
+endfunction
+
 function SetRPath()
     if exists("g:vimrplugin_r_path")
         let b:rplugin_R = expand(g:vimrplugin_r_path)
@@ -3438,6 +3453,9 @@ if exists("g:vimrplugin_term_cmd")
 endif
 
 autocmd BufEnter * call RBufEnter()
+if &filetype != "rbrowser"
+    autocmd VimLeave * call RVimLeave()
+endif
 
 let g:rplugin_firstbuffer = expand("%:p")
 let g:rplugin_running_objbr = 0

From ccfe710d0e5f9f6ace231c1d244b281e6a1a3e9e Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Sun, 8 Dec 2013 12:11:08 -0300
Subject: [PATCH 0587/1050] Delete more temporary files on VimLeave.

---
 r-plugin/common_global.vim | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index eb19ff8..eb084fd 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -2966,6 +2966,7 @@ function RBufEnter()
 endfunction
 
 function RVimLeave()
+    call delete(b:rsource)
     call delete($VIMRPLUGIN_TMPDIR . "/eval_reply")
     call delete($VIMRPLUGIN_TMPDIR . "/formatted_code")
     call delete($VIMRPLUGIN_TMPDIR . "/GlobalEnvList_" . $VIMINSTANCEID)
@@ -2973,6 +2974,7 @@ function RVimLeave()
     call delete($VIMRPLUGIN_TMPDIR . "/liblist_" . $VIMINSTANCEID)
     call delete($VIMRPLUGIN_TMPDIR . "/libnames_" . $VIMINSTANCEID)
     call delete($VIMRPLUGIN_TMPDIR . "/objbrowserInit")
+    call delete($VIMRPLUGIN_TMPDIR . "/Rdoc")
     call delete($VIMRPLUGIN_TMPDIR . "/Rinsert")
     call delete($VIMRPLUGIN_TMPDIR . "/tmux.conf")
     call delete($VIMRPLUGIN_TMPDIR . "/unformatted_code")
@@ -3456,6 +3458,7 @@ autocmd BufEnter * call RBufEnter()
 if &filetype != "rbrowser"
     autocmd VimLeave * call RVimLeave()
 endif
+autocmd BufLeave * call delete(b:rsource)
 
 let g:rplugin_firstbuffer = expand("%:p")
 let g:rplugin_running_objbr = 0

From 7169521f10056f3799299466bb267df3254586be Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Sun, 8 Dec 2013 12:47:54 -0300
Subject: [PATCH 0588/1050] Test if b:Rsource exists before using it.

---
 r-plugin/common_global.vim | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index eb084fd..3479f8a 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -3458,7 +3458,7 @@ autocmd BufEnter * call RBufEnter()
 if &filetype != "rbrowser"
     autocmd VimLeave * call RVimLeave()
 endif
-autocmd BufLeave * call delete(b:rsource)
+autocmd BufLeave * if exists("b:rsource") | call delete(b:rsource) | endif
 
 let g:rplugin_firstbuffer = expand("%:p")
 let g:rplugin_running_objbr = 0

From 6f6c02d7dd01af0f08aa6442d7846151e01645be Mon Sep 17 00:00:00 2001
From: Michael Lerch 
Date: Sun, 8 Dec 2013 21:28:41 -0700
Subject: [PATCH 0589/1050] add support for slidify

---
 doc/r-plugin.txt           |  2 ++
 ftplugin/rmd.vim           | 12 ++++++++++++
 r-plugin/common_global.vim |  1 +
 3 files changed, 15 insertions(+)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 4eaa012..2a08ff3 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -417,6 +417,7 @@ Command
   . Knit and HTML (cur file, verbose) (only .Rmd)      \kh
   . Knit and PDF (cur file, verbose) (Windows)         \kv
   . Spin (cur file) (only .R)                          \ks
+  . Slidify (cur file) (only .Rmd)                     \sl
   --------------------------------------------------------
   . Open PDF (cur file)                                \op
   --------------------------------------------------------
@@ -1623,6 +1624,7 @@ RD, "cursor down"; RED, both "echo" and "down"):
    RMakePDFKb (.Rmd, beamer)
    ROpenPDF
    RSpinFile
+   RMakeSlides (Slidify)
 
    Object browser~
    RUpdateObjBrowser
diff --git a/ftplugin/rmd.vim b/ftplugin/rmd.vim
index 45c5209..1c93e75 100644
--- a/ftplugin/rmd.vim
+++ b/ftplugin/rmd.vim
@@ -128,6 +128,17 @@ function! RMakeHTMLrmd(t)
     call g:SendCmdToR(rcmd)
 endfunction
 
+function! RMakeSlidesrmd()
+    call RSetWD()
+    update
+    let rcmd = 'require(slidify); slidify("' . expand("%:t") . '")'
+    if g:vimrplugin_openhtml
+        let rcmd = rcmd . '; browseURL("' . expand("%:r:t") . '.html")'
+    endif
+    call g:SendCmdToR(rcmd)
+endfunction
+
+
 function! RMakePDFrmd(t)
     if g:rplugin_vimcomport == 0
         exe "Py DiscoverVimComPort()"
@@ -200,6 +211,7 @@ call RCreateMaps("nvi", 'RKnit',        'kn', ':call RKnit()')
 call RCreateMaps("nvi", 'RMakePDFK',    'kp', ':call RMakePDFrmd("latex")')
 call RCreateMaps("nvi", 'RMakePDFKb',   'kl', ':call RMakePDFrmd("beamer")')
 call RCreateMaps("nvi", 'RMakeHTML',    'kh', ':call RMakeHTMLrmd("html")')
+call RCreateMaps("nvi", 'RMakeSlides',  'sl', ':call RMakeSlidesrmd()')
 call RCreateMaps("nvi", 'RMakeODT',     'ko', ':call RMakeHTMLrmd("odt")')
 call RCreateMaps("ni",  'RSendChunk',   'cc', ':call b:SendChunkToR("silent", "stay")')
 call RCreateMaps("ni",  'RESendChunk',  'ce', ':call b:SendChunkToR("echo", "stay")')
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 3479f8a..653424a 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -2637,6 +2637,7 @@ function MakeRMenu()
             call RCreateMenuItem("nvi", 'Command.Knit\ and\ Beamer\ PDF\ (cur\ file)', 'RMakePDFKb', 'kl', ':call RMakePDFrmd("beamer")')
             call RCreateMenuItem("nvi", 'Command.Knit\ and\ HTML\ (cur\ file)', 'RMakeHTML', 'kh', ':call RMakeHTMLrmd("html")')
             call RCreateMenuItem("nvi", 'Command.Knit\ and\ ODT\ (cur\ file)', 'RMakeODT', 'ko', ':call RMakeHTMLrmd("odt")')
+            call RCreateMenuItem("nvi", 'Command.Slidify\ (cur\ file)', 'RMakeSlides', 'sl', ':call RMakeSlidesrmd()')
         endif
         if &filetype == "rrst" || g:vimrplugin_never_unmake_menu
             call RCreateMenuItem("nvi", 'Command.Knit\ and\ PDF\ (cur\ file)', 'RMakePDFK', 'kp', ':call RMakePDFrrst()')

From 7a083fb53dd868b7362b342897cdfcb070c766a8 Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Mon, 9 Dec 2013 10:31:17 -0300
Subject: [PATCH 0590/1050] Update version number.

---
 Makefile         | 2 +-
 doc/r-plugin.txt | 8 +++++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 317a758..1cb629a 100644
--- a/Makefile
+++ b/Makefile
@@ -22,7 +22,7 @@
 
 
 PLUGINHOME=`pwd`
-PLUGINVERSION=0.9.9.8
+PLUGINVERSION=0.9.9.9
 DEBIANTIME=`date -R`
 PLUGINRELEASEDATE=`date +"%Y-%m-%d"`
 VIM2HTML=/usr/local/share/vim/vim74/doc/vim2html.pl 
diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 2a08ff3..8a9ed9c 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -5,7 +5,7 @@
 Authors: Jakson A. Aquino   
          Jose Claudio Faria 
 
-Version: 0.9.9.8
+Version: 0.9.9.9
 For Vim version 7.4
 
  1. Overview                                    |r-plugin-overview|
@@ -2285,6 +2285,12 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details.
 							       *r-plugin-news*
 10. News~
 
+0.9.9.9 (2013-12-09)
+
+ * Minor bug fixes.
+ 
+ * Support to R package slidify (thanks to Michael Lerch).
+
 0.9.9.8 (2013-11-30)
 
  * The list of objects for omnicompletion and the list of functions for syntax

From 86d9dd14ec731c2543e875513364747f192fc740 Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Tue, 10 Dec 2013 09:43:12 -0300
Subject: [PATCH 0591/1050] Remove \t from indentation (Python 3 error).

---
 r-plugin/windows.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/r-plugin/windows.py b/r-plugin/windows.py
index 5e6c364..41f1ac7 100644
--- a/r-plugin/windows.py
+++ b/r-plugin/windows.py
@@ -58,15 +58,15 @@ def FindRConsole():
     Rtitle = Rttl
     RConsole = win32gui.FindWindow(None, Rtitle)
     if RConsole == 0:
-	Rtitle = Rttl + " (64-bit)"
+        Rtitle = Rttl + " (64-bit)"
         RConsole = win32gui.FindWindow(None, Rtitle)
         if RConsole == 0:
-	    Rtitle = Rttl + " (32-bit)"
+            Rtitle = Rttl + " (32-bit)"
             RConsole = win32gui.FindWindow(None, Rtitle)
             if RConsole == 0:
                 vim.command("call RWarningMsg('Could not find R Console.')")
     if RConsole:
-	vim.command("let g:rplugin_R_window_ttl = '" + Rtitle + "'")
+        vim.command("let g:rplugin_R_window_ttl = '" + Rtitle + "'")
 
 def SendToRConsole(aString):
     global RConsole

From 687434472aa1566e3bd79a890fbcffc9af4941b4 Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Tue, 10 Dec 2013 09:48:47 -0300
Subject: [PATCH 0592/1050] Don't do \r- and \r= on Windows. The attempt of
 opening/closing all lists in the Object Browser on Windows causes error on
 vimcom server.

---
 doc/r-plugin.txt           |  6 +++---
 r-plugin/common_global.vim | 12 ++++++++----
 2 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 8a9ed9c..8577a29 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -444,8 +444,8 @@ Edit
 
 Object Browser
   . Show/Update                                        \ro
-  . Expand (all lists)                                 \r=
-  . Collapse (all lists)                               \r-
+  . Expand (all lists) (Linux/Unix)                    \r=
+  . Collapse (all lists) (Linux/Unix)                  \r-
   . Toggle (cur)                                     Enter
 -----------------------------------------------------------
 
@@ -2285,7 +2285,7 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details.
 							       *r-plugin-news*
 10. News~
 
-0.9.9.9 (2013-12-09)
+0.9.9.9 (2013-12-10)
 
  * Minor bug fixes.
  
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 653424a..ebeb1d9 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -2428,8 +2428,10 @@ endfunction
 
 function RBrowserMenu()
     call RCreateMenuItem("nvi", 'Object\ browser.Show/Update', 'RUpdateObjBrowser', 'ro', ':call RObjBrowser()')
-    call RCreateMenuItem("nvi", 'Object\ browser.Expand\ (all\ lists)', 'ROpenLists', 'r=', ':call RBrowserOpenCloseLists(1)')
-    call RCreateMenuItem("nvi", 'Object\ browser.Collapse\ (all\ lists)', 'RCloseLists', 'r-', ':call RBrowserOpenCloseLists(0)')
+    if !has("win32") && !has("win64") && !has("gui_win32") && !has("gui_win64")
+        call RCreateMenuItem("nvi", 'Object\ browser.Expand\ (all\ lists)', 'ROpenLists', 'r=', ':call RBrowserOpenCloseLists(1)')
+        call RCreateMenuItem("nvi", 'Object\ browser.Collapse\ (all\ lists)', 'RCloseLists', 'r-', ':call RBrowserOpenCloseLists(0)')
+    endif
     if &filetype == "rbrowser"
         imenu  R.Object\ browser.Toggle\ (cur)Enter :call RBrowserDoubleClick()
         nmenu  R.Object\ browser.Toggle\ (cur)Enter :call RBrowserDoubleClick()
@@ -2487,8 +2489,10 @@ function RControlMaps()
     " Build list of objects for omni completion
     "-------------------------------------
     call RCreateMaps("nvi", 'RUpdateObjBrowser', 'ro', ':call RObjBrowser()')
-    call RCreateMaps("nvi", 'ROpenLists',        'r=', ':call RBrowserOpenCloseLists(1)')
-    call RCreateMaps("nvi", 'RCloseLists',       'r-', ':call RBrowserOpenCloseLists(0)')
+    if !has("win32") && !has("win64") && !has("gui_win32") && !has("gui_win64")
+        call RCreateMaps("nvi", 'ROpenLists',        'r=', ':call RBrowserOpenCloseLists(1)')
+        call RCreateMaps("nvi", 'RCloseLists',       'r-', ':call RBrowserOpenCloseLists(0)')
+    endif
 endfunction
 
 

From e8f73e10c09865211d747df951f8f508abf96a0f Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Tue, 10 Dec 2013 16:57:07 -0300
Subject: [PATCH 0593/1050] Support Python 3 strings.

---
 r-plugin/vimcom.py  | 17 ++++++++++++-----
 r-plugin/windows.py | 11 ++++++++---
 2 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/r-plugin/vimcom.py b/r-plugin/vimcom.py
index cd02fe7..7512809 100644
--- a/r-plugin/vimcom.py
+++ b/r-plugin/vimcom.py
@@ -29,8 +29,12 @@ def DiscoverVimComPort():
                 sock = socket.socket(af, socktype, proto)
                 sock.settimeout(0.1)
                 sock.connect(sa)
-                sock.send("\002What port?")
-                repl = sock.recv(1024)
+                if sys.hexversion < 0x03000000:
+                    sock.send("\002What port?")
+                    repl = sock.recv(1024)
+                else:
+                    sock.send("\002What port?".encode())
+                    repl = sock.recv(1024).decode()
                 sock.close()
                 if repl.find(correct_repl):
                     VimComFamily = af
@@ -71,8 +75,12 @@ def SendToVimCom(aString):
 
     try:
         sock.connect((HOST, VimComPort))
-        sock.send(aString)
-        received = sock.recv(5012)
+        if sys.hexversion < 0x03000000:
+            sock.send(aString)
+            received = sock.recv(5012)
+        else:
+            sock.send(aString.encode())
+            received = sock.recv(5012).decode()
     except:
         pass
     finally:
@@ -86,4 +94,3 @@ def SendToVimCom(aString):
         received = received.replace("'", "' . \"'\" . '")
         vim.command("let g:rplugin_lastrpl = '" + received + "'")
 
-
diff --git a/r-plugin/windows.py b/r-plugin/windows.py
index 41f1ac7..c0ef9b8 100644
--- a/r-plugin/windows.py
+++ b/r-plugin/windows.py
@@ -24,7 +24,6 @@ def RightClick():
     myHandle = win32gui.GetForegroundWindow()
     RaiseRConsole()
     time.sleep(0.05)
-    #lParam = (y << 16) | x
     lParam = (100 << 16) | 100
     win32gui.SendMessage(RConsole, win32con.WM_RBUTTONDOWN, 0, lParam)
     win32gui.SendMessage(RConsole, win32con.WM_RBUTTONUP, 0, lParam)
@@ -72,7 +71,10 @@ def SendToRConsole(aString):
     global RConsole
     global Rterm
     SendToVimCom("\x09Set R as busy [SendToRConsole()]")
-    finalString = aString.decode("latin-1") + "\n"
+    if sys.hexversion < 0x03000000:
+        finalString = aString.decode("latin-1") + "\n"
+    else:
+        finalString = aString
     win32clipboard.OpenClipboard(0)
     win32clipboard.EmptyClipboard()
     win32clipboard.SetClipboardText(finalString)
@@ -120,7 +122,10 @@ def SendQuitMsg(aString):
     global RConsole
     global Rterm
     SendToVimCom("\x09Set R as busy [SendQuitMsg()]")
-    finalString = aString.decode("latin-1") + "\n"
+    if sys.hexversion < 0x03000000:
+        finalString = aString.decode("latin-1") + "\n"
+    else:
+        finalString = aString + "\n"
     win32clipboard.OpenClipboard(0)
     win32clipboard.EmptyClipboard()
     win32clipboard.SetClipboardText(finalString)

From a61dcc879a9b607ccf8375d9ebc704ca4c7e9e60 Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Tue, 10 Dec 2013 21:20:59 -0300
Subject: [PATCH 0594/1050] Close/Open lists on Windows again. The bug was
 fixed on vimcom.plus package.

---
 doc/r-plugin.txt           | 10 ++++++----
 r-plugin/common_global.vim | 12 ++++--------
 2 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 8577a29..9eb2b38 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -215,10 +215,12 @@ dependencies:
 
     * Vim's version must be >= 7.4: http://www.vim.org/download.php
 
-    * Python 2.7.5 (32 bit): http://www.python.org/download/
+    * Python 2.7.6 (32 bit):
+      http://www.python.org/ftp/python/2.7.6/python-2.7.6.msi
       Do not choose the X86-64 version because it will not work. 
 
-    * pywin32: http://sourceforge.net/projects/pywin32/files/pywin32/Build%20218/pywin32-218.win32-py2.7.exe/download
+    * pywin32:
+      http://sourceforge.net/projects/pywin32/files/pywin32/Build%20218/pywin32-218.win32-py2.7.exe/download
 			     
       Note: The above versions of Python and pywin32 are known to work with
       the official GVim 7.4 binary. The default download may not match the
@@ -444,8 +446,8 @@ Edit
 
 Object Browser
   . Show/Update                                        \ro
-  . Expand (all lists) (Linux/Unix)                    \r=
-  . Collapse (all lists) (Linux/Unix)                  \r-
+  . Expand (all lists)                                 \r=
+  . Collapse (all lists)                               \r-
   . Toggle (cur)                                     Enter
 -----------------------------------------------------------
 
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index ebeb1d9..653424a 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -2428,10 +2428,8 @@ endfunction
 
 function RBrowserMenu()
     call RCreateMenuItem("nvi", 'Object\ browser.Show/Update', 'RUpdateObjBrowser', 'ro', ':call RObjBrowser()')
-    if !has("win32") && !has("win64") && !has("gui_win32") && !has("gui_win64")
-        call RCreateMenuItem("nvi", 'Object\ browser.Expand\ (all\ lists)', 'ROpenLists', 'r=', ':call RBrowserOpenCloseLists(1)')
-        call RCreateMenuItem("nvi", 'Object\ browser.Collapse\ (all\ lists)', 'RCloseLists', 'r-', ':call RBrowserOpenCloseLists(0)')
-    endif
+    call RCreateMenuItem("nvi", 'Object\ browser.Expand\ (all\ lists)', 'ROpenLists', 'r=', ':call RBrowserOpenCloseLists(1)')
+    call RCreateMenuItem("nvi", 'Object\ browser.Collapse\ (all\ lists)', 'RCloseLists', 'r-', ':call RBrowserOpenCloseLists(0)')
     if &filetype == "rbrowser"
         imenu  R.Object\ browser.Toggle\ (cur)Enter :call RBrowserDoubleClick()
         nmenu  R.Object\ browser.Toggle\ (cur)Enter :call RBrowserDoubleClick()
@@ -2489,10 +2487,8 @@ function RControlMaps()
     " Build list of objects for omni completion
     "-------------------------------------
     call RCreateMaps("nvi", 'RUpdateObjBrowser', 'ro', ':call RObjBrowser()')
-    if !has("win32") && !has("win64") && !has("gui_win32") && !has("gui_win64")
-        call RCreateMaps("nvi", 'ROpenLists',        'r=', ':call RBrowserOpenCloseLists(1)')
-        call RCreateMaps("nvi", 'RCloseLists',       'r-', ':call RBrowserOpenCloseLists(0)')
-    endif
+    call RCreateMaps("nvi", 'ROpenLists',        'r=', ':call RBrowserOpenCloseLists(1)')
+    call RCreateMaps("nvi", 'RCloseLists',       'r-', ':call RBrowserOpenCloseLists(0)')
 endfunction
 
 

From cb66b051fbd04c729c5330da924a0cb01e83506f Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Fri, 20 Dec 2013 12:17:43 -0300
Subject: [PATCH 0595/1050] Tip on how to map  in Vim.

---
 doc/r-plugin.txt | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 9eb2b38..fd685b1 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -1074,6 +1074,14 @@ emulates RStudio behavior (may only works on GVim):
 >
    let vimrplugin_assign_map = ""
 <
+Note: If you are using Vim in a terminal emulator, you have to put in your
+|vimrc|:
+>
+   set =^[-
+   let vimrplugin_assign_map = ""
+<
+where `^[` is obtained by pressing CTRL-V CTRL-[ in Insert mode.
+
 Note: You can't map , as StatET does.
 
 In Rnoweb files, a '<' is replaced with '<<>>=\n@'. To disable this feature,
@@ -2246,7 +2254,7 @@ pywin32? The official Vim is 32 bit and, thus, Python must be 32 bit too.
 However, Vim and R run as independent processes, that is, you may have 32 bit
 Vim sending commands to 64 bit R. Be careful to download the correct Python
 version because Vim needs a specific version of Python DLL. For example, the
-official Vim 7.4 for Windows needs either Python 2.7 or 3.1. If Python was not
+official Vim 7.4 for Windows needs either Python 2.7 or 3.2. If Python was not
 installed or was not found, the Vim-R-plugin will output information about
 what Python version Vim was compiled against. Do the following if you want to
 discover this information manually:
@@ -2287,7 +2295,7 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details.
 							       *r-plugin-news*
 10. News~
 
-0.9.9.9 (2013-12-10)
+0.9.9.9 (2013-12-20)
 
  * Minor bug fixes.
  

From 04fd8f578cdcaba9aca2ea098e558c8f9ed1291c Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Fri, 20 Dec 2013 12:20:23 -0300
Subject: [PATCH 0596/1050] Minor bug fixes. Update list of objects before list
 of libraries. In Rnoweb files, send selection to R if line contains
 '\Sexpr{'.

---
 r-plugin/common_global.vim | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 653424a..07117e5 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -879,9 +879,9 @@ function StartObjBrowser_Tmux()
 
     " Don't start the Object Browser if it already exists
     if IsExternalOBRunning()
-        Py SendToVimCom("\004Libraries [OB init]")
+        Py SendToVimCom("\003GlobalEnv [OB StartObjBrowser_Tmux]")
         sleep 50m
-        Py SendToVimCom("\003GlobalEnv [OB init]")
+        Py SendToVimCom("\004Libraries [OB StartObjBrowser_Tmux]")
         sleep 50m
         if $DISPLAY == "" && exists("g:rplugin_ob_pane")
             let slog = system("tmux set-buffer ':silent call UpdateOB(\"both\")\:\' && tmux paste-buffer -t " . g:rplugin_ob_pane . " && tmux select-pane -t " . g:rplugin_ob_pane)
@@ -919,9 +919,9 @@ function StartObjBrowser_Tmux()
                 \ 'if has("clientserver") && v:servername != ""',
                 \ "   exe 'Py SendToVimCom(" . '"\007' . "' . v:servername . '" . '")' . "'",
                 \ 'endif',
-                \ 'Py SendToVimCom("\004Libraries [OB init]")',
-                \ 'sleep 50m',
                 \ 'Py SendToVimCom("\003GlobalEnv [OB init]")',
+                \ 'sleep 50m',
+                \ 'Py SendToVimCom("\004Libraries [OB init]")',
                 \ 'if v:servername == ""',
                 \ '    sleep 100m',
                 \ '    call UpdateOB("GlobalEnv")',
@@ -1046,8 +1046,8 @@ function StartObjBrowser_Vim()
         unlet g:tmp_tmuxsname
         unlet g:tmp_curbufname
         exe "PyFile " . substitute(g:rplugin_home, " ", '\\ ', "g") . "/r-plugin/vimcom.py"
-        Py SendToVimCom("\003GlobalEnv [startobjectbrowser()]")
-        Py SendToVimCom("\004Libraries [startobjectbrowser()]")
+        Py SendToVimCom("\003GlobalEnv [StartObjBrowser_Vim]")
+        Py SendToVimCom("\004Libraries [StartObjBrowser_Vim]")
         call UpdateOB("GlobalEnv")
     endif
     if wmsg != ""
@@ -1495,7 +1495,9 @@ endfunction
 " Send selection to R
 function SendSelectionToR(e, m)
     if &filetype != "r" && b:IsInRCode(1) == 0
-        return
+        if !(&filetype == "rnoweb" && getline(".") =~ "\\Sexpr{")
+            return
+        endif
     endif
 
     if line("'<") == line("'>")

From 0b14fc573892149e0520a83302abe017434a31de Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Mon, 23 Dec 2013 14:53:05 -0300
Subject: [PATCH 0597/1050] Documentation update. New option
 vimrplugin_rcomment_string. Replace some tabs with spaces.

---
 doc/r-plugin.txt | 87 ++++++++++++++++++++++++++----------------------
 1 file changed, 48 insertions(+), 39 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index fd685b1..670bc23 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -68,7 +68,7 @@ Vim-R-plugin (see |vimrplugin_source|).
       - Start/Close R.
       - Send lines, selection, paragraphs, functions, blocks, entire file.
       - Send commands with the object under cursor as argument: help, args,
-	plot, print, str, summary, example, names.
+        plot, print, str, summary, example, names.
       - Send to R the Sweave and pdflatex commands.
   * Omni completion (auto-completion) for R objects (.GlobalEnv and installed
     packages). The list of installed packages must be updated manually.
@@ -76,8 +76,8 @@ Vim-R-plugin (see |vimrplugin_source|).
   * Auto-completion of knitr chunk options.
   * Ability to see R's documentation in a Vim's buffer:
       - Automatic calculation of the best layout of the R documentation buffer
-	(split the window either horizontally or vertically according to the
-	available room).
+        (split the window either horizontally or vertically according to the
+        available room).
       - Automatic formatting of the text to fit the panel width.
       - Send code and commands to R (useful to run examples).
       - Jump to another R documentation.
@@ -110,9 +110,8 @@ Before installing the plugin, you should install its dependencies:
    Depends:~
 
    Vim >= 7.4: http://www.vim.org/download.php
-	       In addition to the most commonly used features, the plugin
-	       requires: |+python| or |+python3|, |+clientserver| and |+conceal|.
-
+               In addition to the most commonly used features, the plugin
+               requires: |+python| or |+python3|, |+clientserver| and |+conceal|. 
    R >= 3.0.0: http://www.r-project.org/
 
    vimcom.plus = 0.9-92: http://www.lepem.ufc.br/jaa/vimcom.plus.html
@@ -127,12 +126,12 @@ Before installing the plugin, you should install its dependencies:
 
    setwidth:      An R package that can be installed with the command
                   `install.packages("setwidth")`.
-		  The library setwidth adjusts the value of `options("width")`
-		  whenever the terminal is resized.
+                  The library setwidth adjusts the value of `options("width")`
+                  whenever the terminal is resized.
 
    ncurses-term:  http://invisible-island.net/ncurses
                   Might be useful if you want support for 256 colors at the
-		  terminal emulator.
+                  terminal emulator.
 
    latexmk:       Automate the compilation of LaTeX documents.
                   See examples in |vimrplugin_latexcmd|.
@@ -649,16 +648,22 @@ have their classes recognized in the GlobalEnv view.
 
 4.6. Commenting and uncommenting lines~
 
-You can add the comment character to the beginning of a line by typing
-xc and remove it with xu. For more sophisticated
-ways of commenting and uncommenting, see below.
-
 You can toggle the state of a line as either commented or uncommented by
-typing xx.
+typing xx. The string used to comment the line will be "# ",
+"## " or "### ", depending on the values of |vimrplugin_indent_commented| and
+|r_indent_ess_comments|.
 
-You can also add comments to the right of a line with the ;
-shortcut. By default, the comment starts at the 40th column, which can be
-changed by setting the value of r_indent_comment_column, as below:
+You can also add the string "# " to the beginning of a line by typing
+xc and remove it with xu. In this case, you can set
+the value of vimrplugin_rcomment_string to control what string will be added
+to the begining of the line. Example:
+>
+   let vimrplugin_rcomment_string = "# "
+<
+Finally, you can also add comments to the right of a line with the
+; shortcut. By default, the comment starts at the 40th column,
+which can be changed by setting the value of r_indent_comment_column, as
+below:
 >
    let r_indent_comment_column = 20
 <
@@ -667,7 +672,7 @@ after the last character in the line. If you are running ; over a
 selection of lines, the comments will be aligned according to the longest
 line.
 
-While typing comments the leader comment string is automatically added to new
+Note: While typing comments the leader comment string is automatically added to new
 lines when you reach 'textwidth' but not when you press . Please, read
 the Vim help about 'formatoptions' and |fo-table|. For example, you can add the
 following line to your |vimrc| if you want the comment string being added
@@ -753,14 +758,14 @@ tmux.conf:
                       right or at the left of the current one.
 
          : Move the panel division upward one line, that is, resize
-		      the panels. Repeat  to move more.  will
-		      move the division downward one line. If you are using
-		      the vertical split, you should use  and
-		       to resize the panels.
+                      the panels. Repeat  to move more.  will
+                      move the division downward one line. If you are using
+                      the vertical split, you should use  and
+                       to resize the panels.
 
     [          : Enter the copy/scroll back mode. You can use ,
-		       and vi key bindings to move the cursor around
-		      the panel. Press q to quit copy mode.
+                       and vi key bindings to move the cursor around
+                      the panel. Press q to quit copy mode.
     ]          : Paste the content of Tmux paste buffer.
 
 While in the copy and scroll back mode, the following key bindings are very
@@ -877,10 +882,10 @@ indent the code below:
     # But this one will be correctly indented:
 
     levels(x) <- ## nl == nL or 1
-	if (nl == nL)
-	    as.character(labels)
-	else
-	    paste(labels, seq_along(levels), sep = "")
+        if (nl == nL)
+            as.character(labels)
+        else
+            paste(labels, seq_along(levels), sep = "")
     class(x) <- c(if(ordered) "ordered", "factor")
 <
 
@@ -1082,7 +1087,8 @@ Note: If you are using Vim in a terminal emulator, you have to put in your
 <
 where `^[` is obtained by pressing CTRL-V CTRL-[ in Insert mode.
 
-Note: You can't map , as StatET does.
+Note: You can't map , as StatET does because only alphabetic letters can
+be mapped in combination with the CTRL key.
 
 In Rnoweb files, a '<' is replaced with '<<>>=\n@'. To disable this feature,
 put in your |vimrc|:
@@ -1145,10 +1151,10 @@ The valid values of vimrplugin_vimpager are:
 
    "tab"       : Show the help document in a new tab. If there is already a
                  tab with an R help document, use it.
-		 This is the default.
+                 This is the default.
    "vertical"  : Split the window vertically if the editor width is large
-		 enough; otherwise, split the window horizontally and attempt
-		 to set the window height to at least 20 lines.
+                 enough; otherwise, split the window horizontally and attempt
+                 to set the window height to at least 20 lines.
    "horizontal": Split the window horizontally.
    "tabnew"    : Show the help document in a new tab.
    "no"        : Do not show R documentation in Vim.
@@ -1237,6 +1243,7 @@ file is open in a new split window, put in your |vimrc|:
 
 6.12. Indent commented lines~
 						 *vimrplugin_indent_commented*
+						       *r_indent_ess_comments*
 You can type xx to comment out a line or selected lines. If the
 line already starts with a comment string, it will be removed. After adding
 the comment string, the line will be reindented by default. To turn off the
@@ -1250,9 +1257,9 @@ table below (see |r-plugin-indenting|):
 >
    vimrplugin_indent_commented   r_indent_ess_comments   string
                  1                        0                #
-		 0                        1                #
-		 1                        1                ##
-		 0                        0                ###
+                 0                        0                #
+                 1                        1                ##
+                 0                        1                ###
 <
 
 6.13. Sleep time (Windows only)~
@@ -1884,10 +1891,10 @@ Below is an example of indentation with and without this option enabled:
    }                                             }
 <
 Notes: (1) Not all code indented by Emacs/ESS will be indented by the
-	   Vim-R-plugin in the same way, and, in some circumstances it may be
-	   necessary to make changes in the code to get it properly indented
-	   by Vim (you may have to either put or remove braces and line
-	   breaks).
+           Vim-R-plugin in the same way, and, in some circumstances it may be
+           necessary to make changes in the code to get it properly indented
+           by Vim (you may have to either put or remove braces and line
+           breaks).
        (2) Indenting is not a file type plugin option. It is a feature defined
            in indent/r.vim. That is why it is documented in this section.
 
@@ -2301,6 +2308,8 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details.
  
  * Support to R package slidify (thanks to Michael Lerch).
 
+ * New option: vimrplugin_rcomment_string.
+
 0.9.9.8 (2013-11-30)
 
  * The list of objects for omnicompletion and the list of functions for syntax

From 8846c0f69fd79946deafe08003aec466c129f25c Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Mon, 23 Dec 2013 14:53:37 -0300
Subject: [PATCH 0598/1050] New option: vimrplugin_rcomment_string.

---
 r-plugin/common_global.vim | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 07117e5..fc85445 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -349,7 +349,7 @@ endfunction
 
 function RSimpleCommentLine(mode, what)
     let [fline, lline] = RGetFL(a:mode)
-    let cstr = "#"
+    let cstr = g:vimrplugin_rcomment_string
     if (&filetype == "rnoweb"|| &filetype == "rhelp") && IsLineInRCode(0, fline) == 0
         let cstr = "%"
     elseif (&filetype == "rmd" || &filetype == "rrst") && IsLineInRCode(0, fline) == 0
@@ -3120,12 +3120,13 @@ call RSetDefaultValue("g:vimrplugin_help_w",           46)
 call RSetDefaultValue("g:vimrplugin_objbr_w",          40)
 call RSetDefaultValue("g:vimrplugin_external_ob",       0)
 call RSetDefaultValue("g:vimrplugin_show_args",         0)
-call RSetDefaultValue("g:vimrplugin_indent_commented",  1)
 call RSetDefaultValue("g:vimrplugin_never_unmake_menu", 0)
-call RSetDefaultValue("g:vimrplugin_vimpager",       "'tab'")
-call RSetDefaultValue("g:vimrplugin_objbr_place", "'script,right'")
 call RSetDefaultValue("g:vimrplugin_insert_mode_cmds",  1)
-call RSetDefaultValue("g:vimrplugin_permanent_libs", "'base,stats,graphics,grDevices,utils,datasets,methods'")
+call RSetDefaultValue("g:vimrplugin_indent_commented",  1)
+call RSetDefaultValue("g:vimrplugin_rcomment_string", "'# '")
+call RSetDefaultValue("g:vimrplugin_vimpager",        "'tab'")
+call RSetDefaultValue("g:vimrplugin_objbr_place",     "'script,right'")
+call RSetDefaultValue("g:vimrplugin_permanent_libs",  "'base,stats,graphics,grDevices,utils,datasets,methods'")
 
 if executable("latexmk")
     call RSetDefaultValue("g:vimrplugin_latexcmd", "'latexmk -pdf'")

From 74b0d42d74aeeb23cfc7f251c14debf9681dc692 Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Wed, 25 Dec 2013 20:54:03 -0300
Subject: [PATCH 0599/1050] Tmux tip: ^Az to hide/show all other panes.

---
 doc/r-plugin.txt | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 670bc23..822bc61 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -672,14 +672,17 @@ after the last character in the line. If you are running ; over a
 selection of lines, the comments will be aligned according to the longest
 line.
 
-Note: While typing comments the leader comment string is automatically added to new
-lines when you reach 'textwidth' but not when you press . Please, read
-the Vim help about 'formatoptions' and |fo-table|. For example, you can add the
-following line to your |vimrc| if you want the comment string being added
-after :
+Note: While typing comments the leader comment string is automatically added
+to new lines when you reach 'textwidth' but not when you press .
+Please, read the Vim help about 'formatoptions' and |fo-table|. For example,
+you can add the following line to your |vimrc| if you want the comment string
+being added after :
 >
    autocmd FileType r setlocal formatoptions-=t formatoptions+=croql
 <
+Tip: You can use Vim substitution command `:%s/#.*//` to delete all comments
+in a buffer (see |:s| and |pattern-overview|).
+
 
 4.7. Build a tags file to jump to function definitions~
 								 *:RBuildTags*
@@ -766,8 +769,11 @@ tmux.conf:
     [          : Enter the copy/scroll back mode. You can use ,
                        and vi key bindings to move the cursor around
                       the panel. Press q to quit copy mode.
+
     ]          : Paste the content of Tmux paste buffer.
 
+    z          : Hide/show all panes execpt the current one.
+
 While in the copy and scroll back mode, the following key bindings are very
 useful:
 
@@ -2302,7 +2308,7 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details.
 							       *r-plugin-news*
 10. News~
 
-0.9.9.9 (2013-12-20)
+0.9.9.9 (2013-12-25)
 
  * Minor bug fixes.
  

From 88efcfef71ec015ce3d7af032a7bde981aa7a2c9 Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Sun, 5 Jan 2014 09:45:22 -0300
Subject: [PATCH 0600/1050] Avoid error if filetype of last file isn't .R*.

---
 r-plugin/common_global.vim | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index fc85445..3e21d81 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -2969,7 +2969,10 @@ function RBufEnter()
 endfunction
 
 function RVimLeave()
-    call delete(b:rsource)
+    if exists("b:rsource")
+        " b:rsource only exists if the filetype of the last buffer is .R*
+        call delete(b:rsource)
+    endif
     call delete($VIMRPLUGIN_TMPDIR . "/eval_reply")
     call delete($VIMRPLUGIN_TMPDIR . "/formatted_code")
     call delete($VIMRPLUGIN_TMPDIR . "/GlobalEnvList_" . $VIMINSTANCEID)

From aade929242a5099b9dd82822e4817ba8674fffcb Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Sat, 1 Feb 2014 10:22:24 -0300
Subject: [PATCH 0601/1050] Version 0.9.9.9.

---
 doc/r-plugin.txt | 77 ++++++++++++++++++++++++++++--------------------
 1 file changed, 45 insertions(+), 32 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 822bc61..813b958 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -69,9 +69,9 @@ Vim-R-plugin (see |vimrplugin_source|).
       - Send lines, selection, paragraphs, functions, blocks, entire file.
       - Send commands with the object under cursor as argument: help, args,
         plot, print, str, summary, example, names.
-      - Send to R the Sweave and pdflatex commands.
-  * Omni completion (auto-completion) for R objects (.GlobalEnv and installed
-    packages). The list of installed packages must be updated manually.
+      - Send to R the Sweave, knit and pdflatex commands.
+  * Omni completion (auto-completion) for R objects (.GlobalEnv and loaded
+    packages).
   * Auto-completion of function arguments.
   * Auto-completion of knitr chunk options.
   * Ability to see R's documentation in a Vim's buffer:
@@ -105,6 +105,9 @@ The installation instructions are split in four sections:
 
 If you are using Windows, jump to section 3.2.
 
+If you are an unexperienced Vim user, start a terminal emulator and type in
+it: `vimtutor`
+
 Before installing the plugin, you should install its dependencies:
 
    Depends:~
@@ -112,9 +115,10 @@ Before installing the plugin, you should install its dependencies:
    Vim >= 7.4: http://www.vim.org/download.php
                In addition to the most commonly used features, the plugin
                requires: |+python| or |+python3|, |+clientserver| and |+conceal|. 
+
    R >= 3.0.0: http://www.r-project.org/
 
-   vimcom.plus = 0.9-92: http://www.lepem.ufc.br/jaa/vimcom.plus.html
+   vimcom.plus = 0.9-93: http://www.lepem.ufc.br/jaa/vimcom.plus.html
 
    Tmux >= 1.5:   http://tmux.sourceforge.net
                   Tmux is necessary to send commands from Vim to R Console.
@@ -191,7 +195,7 @@ especially the tip |r-plugin-tvim| (the above command :RpluginConfig should do
 this for you).
 
 Note: On Mac OS X, in both Vim and GVim, the plugin will use AppleScript to
-send commands to the R Console application unless vimrplugin_applescript = 0.
+send commands to the R Console application unless |vimrplugin_applescript| = 0.
 Some users have reported more luck with iTerm than with the default Mac OS X
 terminal emulator.
 
@@ -207,7 +211,7 @@ dependencies:
 
     * R's version must be >= 3.0.0: http://www.r-project.org/
 
-    * vimcom.plus = 0.9-92: http://www.lepem.ufc.br/jaa/vimcom.plus.html
+    * vimcom.plus = 0.9-93: http://www.lepem.ufc.br/jaa/vimcom.plus.html
       
       Note: If you cannot build vimcom.plus yourself, you will want to
       download and install the zip file.
@@ -225,7 +229,7 @@ dependencies:
       the official GVim 7.4 binary. The default download may not match the
       Python version Vim was linked against: then you have to "View all files"
       on the download page to find the file that matches exactly the above
-      versions. Please, read |r-plugin-python| if need to use different
+      versions. Please, read |r-plugin-python| if you need to use different
       versions.
 
 Now, download the latest version of `Vim-R-plugin.vmb` from
@@ -292,8 +296,8 @@ you may prefer to install the Debian package available at:
    http://www.lepem.ufc.br/jaa/vim-r-plugin.html
 
 Did you see the message "VimCom port not found"? This means that R is not
-running, the vimcom.plus (or vimcom) package is not installed, or R was not
-started by Vim.
+running, the vimcom.plus (or vimcom) package is not installed (or is installed
+but is not loaded), or R was not started by Vim.
 
 
 3.4. Optional steps~
@@ -542,8 +546,8 @@ Vim:
 <
 The output inserted by  :Rinsert  is limited to 5012 characters.
 
-The command  :Rformat  call the function `tidy.source()` of formatR package to
-format either the entire buffer or the selected lines. The value of the
+The command  :Rformat  calls the function `tidy.source()` of formatR package
+to format either the entire buffer or the selected lines. The value of the
 `width.cutoff` argument is set to the buffer's 'textwidth' if it is not
 outside the range 20-180. Se R help on `tidy.source` for details on how to
 control the function behavior.
@@ -591,11 +595,11 @@ complete the name of a data.frame, the columns are not shown. But when the
 data.frame name is already complete, and you have inserted the '$' symbol,
 omni completion will show the column names.
 
-Vim uses one for the objects of .GlobalEnv and a list of files for all other
-objects. The .GlobalEnv list is stored in the /tmp/r-plugin-yourlogin
-directory and, thus, is deleted after each reboot. The other files are stored
-in ~/.vim/r-plugin/objlist/ and remain available until you manually delete
-them.
+Vim uses one file to store the names of .GlobalEnv objects and a list of files
+for all other objects. The .GlobalEnv list is stored in the
+/tmp/r-plugin-yourlogin directory and is deleted when you quits Vim. The other
+files are stored in ~/.vim/r-plugin/objlist/ and remain available until you
+manually delete them.
 
 
 4.5. The Object Browser~
@@ -616,6 +620,11 @@ have to explicitly start the server with the argument |--servername|.  To
 avoid having to type this argument every time that you start Vim, please look
 at the example in |r-plugin-bash-setup|.
 
+Note: On Mac OS X the Object Browser will not be automatically updated if you
+are using MacVim because the R package vimcom.plus has support only for
+Windows and X11 interprocess communication systems while MacVim is a Cocoa
+application.
+
 In the .GlobalEnv view, if an object has the attribute "label", it will also
 be displayed. Please, see the R help for package vimcom.plus (or vimcom) for
 some options to control the Object Browser behavior. In the Object Browser
@@ -772,7 +781,9 @@ tmux.conf:
 
     ]          : Paste the content of Tmux paste buffer.
 
-    z          : Hide/show all panes execpt the current one.
+    z          : Hide/show all panes except the current one.
+		      Note: If you mistakenly press , you have to
+		      type `fg` to get Tmux back to the foreground.
 
 While in the copy and scroll back mode, the following key bindings are very
 useful:
@@ -849,10 +860,10 @@ anything.
 
 5.1. R's source() issues~
 
-The R's `source()` function prints an extra new line between commands if the
-option echo = TRUE, and error and warning messages are printed only after the
-entire code is sourced, which makes it more difficult to find errors in the
-code sent to R. Details:
+The R's `source()` function of base package prints an extra new line between
+commands if the option echo = TRUE, and error and warning messages are printed
+only after the entire code is sourced, which makes it more difficult to find
+errors in the code sent to R. Details:
 
    https://stat.ethz.ch/pipermail/r-devel/2012-December/065352.html
 
@@ -1071,17 +1082,18 @@ it.
 
 
 6.3. Assignment operator and Rnoweb completion of code block~
-							   *vimrplugin_assign*
-						       *vimrplugin_assign_map*
 						      *vimrplugin_rnowebchunk*
-While editing R code, '_' is replaced with ' <- '. To disable this feature,
+						       *vimrplugin_assign_map*
+							   *vimrplugin_assign*
+In Rnoweb files, a '<' is replaced with '<<>>=\n@'. To disable this feature,
 put in your |vimrc|:
 >
-   let vimrplugin_assign = 0
+   let vimrplugin_rnowebchunk = 0
 <
-If want to bind other keys to be replaced by ' <- ', set the value of
-|vimrplugin_assign_map| in your |vimrc|, as in the example below which
-emulates RStudio behavior (may only works on GVim):
+While editing R code, '_' is replaced with ' <- '. If want to bind other keys
+to be replaced by ' <- ', set the value of |vimrplugin_assign_map| in your
+|vimrc|, as in the example below which emulates RStudio behavior (may only
+works on GVim):
 >
    let vimrplugin_assign_map = ""
 <
@@ -1096,10 +1108,9 @@ where `^[` is obtained by pressing CTRL-V CTRL-[ in Insert mode.
 Note: You can't map , as StatET does because only alphabetic letters can
 be mapped in combination with the CTRL key.
 
-In Rnoweb files, a '<' is replaced with '<<>>=\n@'. To disable this feature,
-put in your |vimrc|:
+To completely disable this feature, put in your |vimrc|:
 >
-   let vimrplugin_rnowebchunk = 0
+   let vimrplugin_assign = 0
 <
 
 6.4. Object Browser options~
@@ -2308,10 +2319,12 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details.
 							       *r-plugin-news*
 10. News~
 
-0.9.9.9 (2013-12-25)
+0.9.9.9 (2014-02-01)
 
  * Minor bug fixes.
  
+ * Delete temporary files on VimLeave event.
+
  * Support to R package slidify (thanks to Michael Lerch).
 
  * New option: vimrplugin_rcomment_string.

From dcbe6f0d27f74e270fd6f5871b4f14f82a723d08 Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Wed, 12 Feb 2014 08:06:06 -0300
Subject: [PATCH 0602/1050] Don't require Tmux if using screenR.vim.

---
 r-plugin/common_global.vim | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 3e21d81..cd608c2 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -3126,6 +3126,7 @@ call RSetDefaultValue("g:vimrplugin_show_args",         0)
 call RSetDefaultValue("g:vimrplugin_never_unmake_menu", 0)
 call RSetDefaultValue("g:vimrplugin_insert_mode_cmds",  1)
 call RSetDefaultValue("g:vimrplugin_indent_commented",  1)
+call RSetDefaultValue("g:vimrplugin_source",         "''")
 call RSetDefaultValue("g:vimrplugin_rcomment_string", "'# '")
 call RSetDefaultValue("g:vimrplugin_vimpager",        "'tab'")
 call RSetDefaultValue("g:vimrplugin_objbr_place",     "'script,right'")
@@ -3235,7 +3236,7 @@ endif
 
 " Check whether Tmux is OK
 if !has("win32") && !has("win64") && !has("gui_win32") && !has("gui_win64") && g:vimrplugin_applescript == 0
-    if !executable('tmux')
+    if !executable('tmux') && g:vimrplugin_source !~ "screenR"
         call RWarningMsgInp("Please, install the 'Tmux' application to enable the Vim-R-plugin.")
         let g:rplugin_failed = 1
         finish
@@ -3246,7 +3247,7 @@ if !has("win32") && !has("win64") && !has("gui_win32") && !has("gui_win64") && g
     if strlen(s:tmuxversion) != 3
         let s:tmuxversion = "1.0"
     endif
-    if s:tmuxversion < "1.5"
+    if s:tmuxversion < "1.5" && g:vimrplugin_source !~ "screenR"
         call RWarningMsgInp("Vim-R-plugin requires Tmux >= 1.5")
         let g:rplugin_failed = 1
         finish

From 95f0c6a102238469e3fd2bebea71c3c5bfb0a7f5 Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Wed, 19 Feb 2014 17:00:05 -0300
Subject: [PATCH 0603/1050] Update.

---
 Makefile | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/Makefile b/Makefile
index 1cb629a..3c23f6a 100644
--- a/Makefile
+++ b/Makefile
@@ -14,9 +14,9 @@
 
 
 ###########################################################
-#   This script builds both the zip and the deb files of  #
-#   released versions of the plugin. The files are        #
-#   created at the /tmp directory.                        #
+#   This script builds both the Vimball and the deb       #
+#   files of released versions of the plugin. The files   #
+#   are created at the /tmp directory.                    #
 ###########################################################
 
 
@@ -176,5 +176,5 @@ htmldoc:
 	    sed -i -e 's/<\/pre>
/  --------------------------------------------------------\n/' r-plugin.html ;\
 	    mv r-plugin.html vim-stylesheet.css /tmp )
 
-all: zip deb htmldoc
+all: vimball deb htmldoc
 

From 27cd26dbaa20b311845580fb13b3edf10bd40af8 Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Wed, 19 Feb 2014 17:00:17 -0300
Subject: [PATCH 0604/1050] Add support for Julia.

---
 r-plugin/global_r_plugin.vim | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/r-plugin/global_r_plugin.vim b/r-plugin/global_r_plugin.vim
index e5ee0b7..ce1aae6 100644
--- a/r-plugin/global_r_plugin.vim
+++ b/r-plugin/global_r_plugin.vim
@@ -3,7 +3,11 @@ runtime ftplugin/r.vim
 
 function SetExeCmd()
     runtime r-plugin/common_buffer.vim
-    if &filetype == "python"
+    if &filetype == "julia"
+        let b:rplugin_R = "julia"
+        let b:rplugin_r_args = " "
+        let b:quit_command = "quit()"
+    elseif &filetype == "python"
         let b:rplugin_R = "python"
         let b:rplugin_r_args = " "
         let b:quit_command = "quit()"

From 913ad0ea08d98c0a2f72c28a7d7b11f26cc0b257 Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Thu, 20 Feb 2014 00:41:33 -0300
Subject: [PATCH 0605/1050] Improve note on ftdetect.

---
 doc/r-plugin.txt | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 813b958..6718158 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -171,8 +171,10 @@ files, you have to press the space bar a few times to finish the
 installation). You should, then, quit Vim.
 
 Note: If you need too install the plugin in a non default directory, do
-`:UseVimball` `[path]`. Then, create a symbolic link to `path/ftdetect/r.vim`
-into `~/.vim/ftdetect/r.vim`.
+`:UseVimball` `[path]`. In this case, the configuration of Vim's 'runtimepath'
+must be done before the command "filetype on" in both the system and the user
+|vimrc| files, otherwise, you would have to create a symbolic link to
+`path/ftdetect/r.vim` into `~/.vim/ftdetect/r.vim`.
 
 Start Vim again and edit an R script. Type rf to start R and run
 the command below to get help configuring ~/.Rprofile, ~/.vimrc, ~/.tmux.conf,
@@ -248,8 +250,10 @@ files, you have to press the space bar a few times to finish the
 installation). You should, then, quit Vim.
 
 Note: If you need too install the plugin in a non default directory, do
-`:UseVimball` `[path]`. Then, create a symbolic link to `path/ftdetect/r.vim`
-into `~/vimfiles/ftdetect/r.vim`.
+`:UseVimball` `[path]`. In this case, the configuration of Vim's 'runtimepath'
+must be done before the command "filetype on" in both the system and the user
+|vimrc| files, otherwise, you would have to create a symbolic link to
+`path/ftdetect/r.vim` into `~/.vim/ftdetect/r.vim`.
 
 Start GVim again and edit an R script. You can right click a .R file and
 choose "Edit with Vim" or create a new one with the Normal mode command:
@@ -2038,7 +2042,7 @@ useful tip is to click on the title bar of the debug window and choose "Always
 on top" or a similar option provided by your desktop manager.
 
 
-9.17. Turn the R-plugin into a global plugin~
+9.17. Turn the R-plugin into a global plugin (Linux/Unix only)~
 							     *r-plugin-global*
 The Vim-R-plugin is a file type plugin. If you want its functionality
 available for all file types, then go to your ~/.vim/plugin directory and
@@ -2048,8 +2052,9 @@ the following in a terminal emulator:
    cd ~/.vim/plugin/
    ln -s ../r-plugin/global_r_plugin.vim
 <
-On Windows, you probably will have to make a copy of the file to the
-~/vimfiles/plugin directory.
+You will then be able to type rf to start and rq to
+quit different command line interpreters (Julia, Python, Haskell, Ruby and
+Lisp) and d, l, ss, bb, etc to send code to the interpreter.
 
 
 9.18. Disable syntax highlight of R functions~

From 6bee50f737eb51e68f54aee942f2e4f0d239962a Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Thu, 20 Feb 2014 10:00:38 -0300
Subject: [PATCH 0606/1050] Allow SourceLines() be filetype specific.

---
 ftplugin/r.vim               |  8 ++++++--
 ftplugin/rbrowser.vim        |  2 ++
 ftplugin/rdoc.vim            |  5 +++--
 ftplugin/rhelp.vim           |  5 +++--
 ftplugin/rmd.vim             |  1 +
 ftplugin/rnoweb.vim          |  5 +++++
 ftplugin/rrst.vim            |  1 +
 r-plugin/common_global.vim   | 10 +++++-----
 r-plugin/global_r_plugin.vim | 18 ++++++++++++++++++
 9 files changed, 44 insertions(+), 11 deletions(-)

diff --git a/ftplugin/r.vim b/ftplugin/r.vim
index fdf356c..9d2a9a8 100644
--- a/ftplugin/r.vim
+++ b/ftplugin/r.vim
@@ -98,11 +98,15 @@ function! DefaultIsInRCode(vrb)
     return 1
 endfunction
 
+let b:IsInRCode = function("DefaultIsInRCode")
+
+" Pointers to functions that must be different if the plugin is used as a
+" global one:
+let b:SourceLines = function("RSourceLines")
+
 "==========================================================================
 " Key bindings and menu items
 
-let b:IsInRCode = function("DefaultIsInRCode")
-
 call RCreateStartMaps()
 call RCreateEditMaps()
 
diff --git a/ftplugin/rbrowser.vim b/ftplugin/rbrowser.vim
index 86989f2..3c4ee53 100644
--- a/ftplugin/rbrowser.vim
+++ b/ftplugin/rbrowser.vim
@@ -380,6 +380,8 @@ unlet s:envstring
 
 call setline(1, ".GlobalEnv | Libraries")
 
+let b:SourceLines = function("RSourceLines")
+
 call RSourceOtherScripts()
 
 let &cpo = s:cpo_save
diff --git a/ftplugin/rdoc.vim b/ftplugin/rdoc.vim
index 98359d1..29ef98c 100644
--- a/ftplugin/rdoc.vim
+++ b/ftplugin/rdoc.vim
@@ -78,11 +78,12 @@ function! RdocIsInRCode(vrb)
     endif
 endfunction
 
+let b:IsInRCode = function("RdocIsInRCode")
+let b:SourceLines = function("RSourceLines")
+
 "==========================================================================
 " Key bindings and menu items
 
-let b:IsInRCode = function("RdocIsInRCode")
-
 call RCreateSendMaps()
 call RControlMaps()
 
diff --git a/ftplugin/rhelp.vim b/ftplugin/rhelp.vim
index 6ee404c..c57be04 100644
--- a/ftplugin/rhelp.vim
+++ b/ftplugin/rhelp.vim
@@ -58,11 +58,12 @@ function! RhelpIsInRCode(vrb)
     endif
 endfunction
 
+let b:IsInRCode = function("RhelpIsInRCode")
+let b:SourceLines = function("RSourceLines")
+
 "==========================================================================
 " Key bindings and menu items
 
-let b:IsInRCode = function("RhelpIsInRCode")
-
 call RCreateStartMaps()
 call RCreateEditMaps()
 call RCreateSendMaps()
diff --git a/ftplugin/rmd.vim b/ftplugin/rmd.vim
index 1c93e75..93a4e22 100644
--- a/ftplugin/rmd.vim
+++ b/ftplugin/rmd.vim
@@ -196,6 +196,7 @@ let b:IsInRCode = function("RmdIsInRCode")
 let b:PreviousRChunk = function("RmdPreviousChunk")
 let b:NextRChunk = function("RmdNextChunk")
 let b:SendChunkToR = function("SendRmdChunkToR")
+let b:SourceLines = function("RSourceLines")
 
 "==========================================================================
 " Key bindings and menu items
diff --git a/ftplugin/rnoweb.vim b/ftplugin/rnoweb.vim
index aa1d41a..79119de 100644
--- a/ftplugin/rnoweb.vim
+++ b/ftplugin/rnoweb.vim
@@ -243,6 +243,11 @@ let b:PreviousRChunk = function("RnwPreviousChunk")
 let b:NextRChunk = function("RnwNextChunk")
 let b:SendChunkToR = function("RnwSendChunkToR")
 
+" Pointers to functions that must be different if the plugin is used as a
+" global one:
+let b:SourceLines = function("RSourceLines")
+
+
 "==========================================================================
 " Key bindings and menu items
 
diff --git a/ftplugin/rrst.vim b/ftplugin/rrst.vim
index 22d100e..4f4810a 100644
--- a/ftplugin/rrst.vim
+++ b/ftplugin/rrst.vim
@@ -189,6 +189,7 @@ let b:IsInRCode = function("RrstIsInRCode")
 let b:PreviousRChunk = function("RrstPreviousChunk")
 let b:NextRChunk = function("RrstNextChunk")
 let b:SendChunkToR = function("SendRrstChunkToR")
+let b:SourceLines = function("RSourceLines")
 
 "==========================================================================
 " Key bindings and menu items
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index cd608c2..9c80ce1 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -1413,7 +1413,7 @@ function SendMBlockToR(e, m)
         let lineB -= 1
     endif
     let lines = getline(lineA, lineB)
-    let ok = RSourceLines(lines, a:e)
+    let ok = b:SourceLines(lines, a:e)
     if ok == 0
         return
     endif
@@ -1482,7 +1482,7 @@ function SendFunctionToR(e, m)
     endif
 
     let lines = getline(firstline, lastline)
-    let ok = RSourceLines(lines, a:e)
+    let ok = b:SourceLines(lines, a:e)
     if  ok == 0
         return
     endif
@@ -1543,7 +1543,7 @@ function SendSelectionToR(e, m)
         let lines[llen] = strpart(lines[llen], 0, j)
     endif
 
-    let ok = RSourceLines(lines, a:e)
+    let ok = b:SourceLines(lines, a:e)
     if ok == 0
         return
     endif
@@ -1578,7 +1578,7 @@ function SendParagraphToR(e, m)
         endif
     endwhile
     let lines = getline(i, j)
-    let ok = RSourceLines(lines, a:e)
+    let ok = b:SourceLines(lines, a:e)
     if ok == 0
         return
     endif
@@ -1625,7 +1625,7 @@ function SendFHChunkToR()
             let idx += 1
         endif
     endwhile
-    call RSourceLines(codelines, "silent")
+    call b:SourceLines(codelines, "silent")
 endfunction
 
 " Send current line to R.
diff --git a/r-plugin/global_r_plugin.vim b/r-plugin/global_r_plugin.vim
index ce1aae6..d889246 100644
--- a/r-plugin/global_r_plugin.vim
+++ b/r-plugin/global_r_plugin.vim
@@ -1,28 +1,46 @@
 
 runtime ftplugin/r.vim
 
+function SourceNotDefined(lines, e)
+    echohl WarningMsg
+    echo 'The function to source "' . &filetype . '" lines is not defined.'
+    echohl Normal
+endfunction
+
+function JuliaSourceLines(lines, e)
+    call writefile(a:lines, b:rsource)
+    let jcmd = 'include("' . b:rsource . '")'
+    let ok = g:SendCmdToR(jcmd)
+    return ok
+endfunction
+
 function SetExeCmd()
     runtime r-plugin/common_buffer.vim
     if &filetype == "julia"
         let b:rplugin_R = "julia"
         let b:rplugin_r_args = " "
         let b:quit_command = "quit()"
+        let b:SourceLines = function("JuliaSourceLines")
     elseif &filetype == "python"
         let b:rplugin_R = "python"
         let b:rplugin_r_args = " "
         let b:quit_command = "quit()"
+        let b:SourceLines = function("SourceNotDefined")
     elseif &filetype == "haskell"
         let b:rplugin_R = "ghci"
         let b:rplugin_r_args = " "
         let b:quit_command = ":quit"
+        let b:SourceLines = function("SourceNotDefined")
     elseif &filetype == "ruby"
         let b:rplugin_R = "irb"
         let b:rplugin_r_args = " "
         let b:quit_command = "quit"
+        let b:SourceLines = function("SourceNotDefined")
     elseif &filetype == "lisp"
         let b:rplugin_R = "clisp"
         let b:rplugin_r_args = " "
         let b:quit_command = "(quit)"
+        let b:SourceLines = function("SourceNotDefined")
     endif
 endfunction
 

From 0cea1f5892e9e5c0c51df7077e9834bae6390ee6 Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Thu, 20 Feb 2014 22:15:46 -0300
Subject: [PATCH 0607/1050] Improve use as global plugin.

---
 ftplugin/r.vim               | 17 +++--------------
 r-plugin/common_buffer.vim   |  4 +++-
 r-plugin/global_r_plugin.vim | 27 ++++++++++++++++++++++++++-
 3 files changed, 32 insertions(+), 16 deletions(-)

diff --git a/ftplugin/r.vim b/ftplugin/r.vim
index 9d2a9a8..3e03f8e 100644
--- a/ftplugin/r.vim
+++ b/ftplugin/r.vim
@@ -33,11 +33,8 @@ let b:did_r_ftplugin = 1
 let s:cpo_save = &cpo
 set cpo&vim
 
-" Don't do this if called by ../r-plugin/common_global.vim
-if &filetype == "r"
-    setlocal commentstring=#%s
-    setlocal comments=b:#,b:##,b:###,b:#'
-endif
+setlocal commentstring=#%s
+setlocal comments=b:#,b:##,b:###,b:#'
 
 " Source scripts common to R, Rnoweb, Rhelp, Rmd, Rrst and rdoc files:
 runtime r-plugin/common_global.vim
@@ -100,7 +97,7 @@ endfunction
 
 let b:IsInRCode = function("DefaultIsInRCode")
 
-" Pointers to functions that must be different if the plugin is used as a
+" Pointer to function that must be different if the plugin is used as a
 " global one:
 let b:SourceLines = function("RSourceLines")
 
@@ -123,14 +120,6 @@ call RCreateSendMaps()
 call RControlMaps()
 call RCreateMaps("nvi", 'RSetwd',        'rd', ':call RSetWD()')
 
-" Sweave (cur file)
-"-------------------------------------
-if &filetype == "rnoweb"
-    call RCreateMaps("nvi", 'RSweave',      'sw', ':call RSweave()')
-    call RCreateMaps("nvi", 'RMakePDF',     'sp', ':call RMakePDF("nobib")')
-    call RCreateMaps("nvi", 'RIndent',      'si', ':call RnwToggleIndentSty()')
-endif
-
 
 " Menu R
 if has("gui_running")
diff --git a/r-plugin/common_buffer.vim b/r-plugin/common_buffer.vim
index b1e8eaa..a7f8528 100644
--- a/r-plugin/common_buffer.vim
+++ b/r-plugin/common_buffer.vim
@@ -25,7 +25,9 @@
 
 " Set completion with CTRL-X CTRL-O to autoloaded function.
 if exists('&ofu')
-    setlocal ofu=rcomplete#CompleteR
+    if &filetype == "r" || &filetype == "rnoweb" || &filetype == "rdoc" || &filetype == "rhelp" || &filetype == "rrst" || &filetype == "rmd"
+        setlocal omnifunc=rcomplete#CompleteR
+    endif
 endif
 
 " This isn't the Object Browser running externally
diff --git a/r-plugin/global_r_plugin.vim b/r-plugin/global_r_plugin.vim
index d889246..07ff22e 100644
--- a/r-plugin/global_r_plugin.vim
+++ b/r-plugin/global_r_plugin.vim
@@ -1,5 +1,29 @@
 
-runtime ftplugin/r.vim
+runtime r-plugin/common_global.vim
+if exists("g:rplugin_failed")
+    finish
+endif
+
+runtime r-plugin/common_buffer.vim
+
+" Default IsInRCode function when the plugin is used as a global plugin
+function! DefaultIsInRCode(vrb)
+    return 1
+endfunction
+
+let b:IsInRCode = function("DefaultIsInRCode")
+
+call RCreateStartMaps()
+call RCreateEditMaps()
+call RCreateSendMaps()
+call RControlMaps()
+
+" Menu R
+if has("gui_running")
+    call MakeRMenu()
+endif
+
+call RSourceOtherScripts()
 
 function SourceNotDefined(lines, e)
     echohl WarningMsg
@@ -21,6 +45,7 @@ function SetExeCmd()
         let b:rplugin_r_args = " "
         let b:quit_command = "quit()"
         let b:SourceLines = function("JuliaSourceLines")
+        call RCreateMaps("ni", 'RSendFile',     'aa', ':call JuliaSourceLines(getline(1, "$"), "silent")')
     elseif &filetype == "python"
         let b:rplugin_R = "python"
         let b:rplugin_r_args = " "

From 97fe113bef3e70078153e20633bc2261717e56aa Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Sat, 22 Feb 2014 20:35:38 -0300
Subject: [PATCH 0608/1050] Add or improve b:undo_ftplugin.

---
 ftplugin/r.vim      |  8 ++++----
 ftplugin/rhelp.vim  |  9 +++++----
 ftplugin/rmd.vim    | 14 +++++++-------
 ftplugin/rnoweb.vim | 11 +++++++++--
 ftplugin/rrst.vim   | 11 +++++++++--
 5 files changed, 34 insertions(+), 19 deletions(-)

diff --git a/ftplugin/r.vim b/ftplugin/r.vim
index 3e03f8e..d8758d3 100644
--- a/ftplugin/r.vim
+++ b/ftplugin/r.vim
@@ -23,16 +23,17 @@
 "==========================================================================
 
 " Only do this when not yet done for this buffer
-if exists("b:did_r_ftplugin") || exists("disable_r_ftplugin")
+if exists("b:did_ftplugin") || exists("disable_r_ftplugin")
     finish
 endif
 
 " Don't load another plugin for this buffer
-let b:did_r_ftplugin = 1
+let b:did_ftplugin = 1
 
 let s:cpo_save = &cpo
 set cpo&vim
 
+setlocal iskeyword=@,48-57,_,.
 setlocal commentstring=#%s
 setlocal comments=b:#,b:##,b:###,b:#'
 
@@ -46,8 +47,6 @@ endif
 " need be defined after the global ones:
 runtime r-plugin/common_buffer.vim
 
-setlocal iskeyword=@,48-57,_,.
-
 " Run R CMD BATCH on current file and load the resulting .Rout in a split
 " window
 function! ShowRout()
@@ -128,6 +127,7 @@ endif
 
 call RSourceOtherScripts()
 
+let b:undo_ftplugin = "setl cms< com< fo< isk< | unlet! b:IsInRCode b:SourceLines"
 let &cpo = s:cpo_save
 unlet s:cpo_save
 
diff --git a/ftplugin/rhelp.vim b/ftplugin/rhelp.vim
index c57be04..3539600 100644
--- a/ftplugin/rhelp.vim
+++ b/ftplugin/rhelp.vim
@@ -23,16 +23,18 @@
 "==========================================================================
 
 " Only do this when not yet done for this buffer
-if exists("b:did_rhelp_ftplugin") || exists("disable_r_ftplugin")
+if exists("b:did_ftplugin") || exists("disable_r_ftplugin")
     finish
 endif
 
 " Don't load another plugin for this buffer
-let b:did_rhelp_ftplugin = 1
+let b:did_ftplugin = 1
 
 let s:cpo_save = &cpo
 set cpo&vim
 
+setlocal iskeyword=@,48-57,_,.
+
 " Source scripts common to R, Rnoweb, Rhelp and rdoc files:
 runtime r-plugin/common_global.vim
 if exists("g:rplugin_failed")
@@ -43,8 +45,6 @@ endif
 " defined after the global ones:
 runtime r-plugin/common_buffer.vim
 
-setlocal iskeyword=@,48-57,_,.
-
 function! RhelpIsInRCode(vrb)
     let lastsec = search('^\\[a-z][a-z]*{', "bncW")
     let secname = getline(lastsec)
@@ -77,6 +77,7 @@ endif
 
 call RSourceOtherScripts()
 
+let b:undo_ftplugin = "setl isk< | unlet! b:IsInRCode b:SourceLines"
 let &cpo = s:cpo_save
 unlet s:cpo_save
 
diff --git a/ftplugin/rmd.vim b/ftplugin/rmd.vim
index 93a4e22..9b9cd16 100644
--- a/ftplugin/rmd.vim
+++ b/ftplugin/rmd.vim
@@ -21,15 +21,11 @@
 "==========================================================================
 
 " Only do this when not yet done for this buffer
-if exists("b:did_rmd_ftplugin") || exists("disable_r_ftplugin") || exists("b:did_ftplugin")
+if exists("b:did_ftplugin") || exists("disable_r_ftplugin") || exists("b:did_ftplugin")
     finish
 endif
 
-" Don't load another plugin for this buffer
-let b:did_rmd_ftplugin = 1
-
 runtime! ftplugin/html.vim ftplugin/html_*.vim ftplugin/html/*.vim
-unlet! b:did_ftplugin
 
 setlocal comments=fb:*,fb:-,fb:+,n:> commentstring=>\ %s
 setlocal formatoptions+=tcqln
@@ -40,8 +36,12 @@ let s:cpo_save = &cpo
 set cpo&vim
 
 " Enables pandoc if it is installed
+unlet! b:did_ftplugin
 runtime ftplugin/pandoc.vim
 
+" Don't load another plugin for this buffer
+let b:did_ftplugin = 1
+
 " Source scripts common to R, Rrst, Rnoweb, Rhelp and Rdoc:
 runtime r-plugin/common_global.vim
 if exists("g:rplugin_failed")
@@ -235,8 +235,8 @@ let &cpo = s:cpo_save
 unlet s:cpo_save
 
 if exists('b:undo_ftplugin')
-  let b:undo_ftplugin .= "|setl cms< com< fo< flp<"
+  let b:undo_ftplugin .= "|setl cms< com< fo< flp< isk< | unlet! b:IsInRCode b:SourceLines b:PreviousRChunk b:NextRChunk b:SendChunkToR"
 else
-  let b:undo_ftplugin = "setl cms< com< fo< flp<"
+  let b:undo_ftplugin = "setl cms< com< fo< flp< isk< | unlet! b:IsInRCode b:SourceLines b:PreviousRChunk b:NextRChunk b:SendChunkToR"
 endif
 
diff --git a/ftplugin/rnoweb.vim b/ftplugin/rnoweb.vim
index 79119de..a1f7a2a 100644
--- a/ftplugin/rnoweb.vim
+++ b/ftplugin/rnoweb.vim
@@ -20,12 +20,12 @@
 "==========================================================================
 
 " Only do this when not yet done for this buffer
-if exists("b:did_rnoweb_ftplugin") || exists("disable_r_ftplugin")
+if exists("b:did_ftplugin") || exists("disable_r_ftplugin")
     finish
 endif
 
 " Don't load another plugin for this buffer
-let b:did_rnoweb_ftplugin = 1
+let b:did_ftplugin = 1
 
 let s:cpo_save = &cpo
 set cpo&vim
@@ -33,6 +33,7 @@ set cpo&vim
 " Enables Vim-Latex-Suite, LaTeX-Box if installed
 runtime ftplugin/tex_latexSuite.vim
 runtime ftplugin/tex_LatexBox.vim
+
 setlocal iskeyword=@,48-57,_,.
 
 " Source scripts common to R, Rnoweb, Rhelp and Rdoc:
@@ -283,3 +284,9 @@ call RSourceOtherScripts()
 let &cpo = s:cpo_save
 unlet s:cpo_save
 
+if exists('b:undo_ftplugin')
+  let b:undo_ftplugin .= "|setl isk< | unlet! b:IsInRCode b:SourceLines b:PreviousRChunk b:NextRChunk b:SendChunkToR"
+else
+  let b:undo_ftplugin = "setl isk< | unlet! b:IsInRCode b:SourceLines b:PreviousRChunk b:NextRChunk b:SendChunkToR"
+endif
+
diff --git a/ftplugin/rrst.vim b/ftplugin/rrst.vim
index 4f4810a..2bc1712 100644
--- a/ftplugin/rrst.vim
+++ b/ftplugin/rrst.vim
@@ -21,12 +21,12 @@
 "==========================================================================
 
 " Only do this when not yet done for this buffer
-if exists("b:did_rrst_ftplugin") || exists("disable_r_ftplugin")
+if exists("b:did_ftplugin") || exists("disable_r_ftplugin")
     finish
 endif
 
 " Don't load another plugin for this buffer
-let b:did_rrst_ftplugin = 1
+let b:did_ftplugin = 1
 
 let s:cpo_save = &cpo
 set cpo&vim
@@ -224,3 +224,10 @@ call RSourceOtherScripts()
 
 let &cpo = s:cpo_save
 unlet s:cpo_save
+
+if exists('b:undo_ftplugin')
+  let b:undo_ftplugin .= "|setl cms< com< fo< flp< isk< | unlet! b:IsInRCode b:SourceLines b:PreviousRChunk b:NextRChunk b:SendChunkToR"
+else
+  let b:undo_ftplugin = "setl cms< com< fo< flp< isk< | unlet! b:IsInRCode b:SourceLines b:PreviousRChunk b:NextRChunk b:SendChunkToR"
+endif
+

From 029aa30bc7eb8155ea9c0e08a4ff08066ce57166 Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Sat, 22 Feb 2014 20:36:52 -0300
Subject: [PATCH 0609/1050] Remove 't' from 'formatoptions' (auto-wrap text).

---
 ftplugin/r.vim | 1 +
 1 file changed, 1 insertion(+)

diff --git a/ftplugin/r.vim b/ftplugin/r.vim
index d8758d3..758f713 100644
--- a/ftplugin/r.vim
+++ b/ftplugin/r.vim
@@ -34,6 +34,7 @@ let s:cpo_save = &cpo
 set cpo&vim
 
 setlocal iskeyword=@,48-57,_,.
+setlocal formatoptions-=t
 setlocal commentstring=#%s
 setlocal comments=b:#,b:##,b:###,b:#'
 

From df73f0e568842d8b0036f8fe252c99dfbdb82db7 Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Sat, 22 Feb 2014 21:03:10 -0300
Subject: [PATCH 0610/1050] Don't read common_buffer.vim on Vim startup.

---
 r-plugin/global_r_plugin.vim | 2 --
 1 file changed, 2 deletions(-)

diff --git a/r-plugin/global_r_plugin.vim b/r-plugin/global_r_plugin.vim
index 07ff22e..364c68b 100644
--- a/r-plugin/global_r_plugin.vim
+++ b/r-plugin/global_r_plugin.vim
@@ -4,8 +4,6 @@ if exists("g:rplugin_failed")
     finish
 endif
 
-runtime r-plugin/common_buffer.vim
-
 " Default IsInRCode function when the plugin is used as a global plugin
 function! DefaultIsInRCode(vrb)
     return 1

From 3c6ffefb4394f315cdc9a75a266478826c1d8397 Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Sun, 23 Feb 2014 09:15:10 -0300
Subject: [PATCH 0611/1050] Keep only "official" stuff. Move the code that
 should not be part of the official Vim (www.vim.org) to
 r-plugin/functions.vim.

---
 r-plugin/functions.vim | 71 +++++++++++++++++++++++++++++++++++++
 syntax/r.vim           | 79 +++---------------------------------------
 2 files changed, 76 insertions(+), 74 deletions(-)
 create mode 100644 r-plugin/functions.vim

diff --git a/r-plugin/functions.vim b/r-plugin/functions.vim
new file mode 100644
index 0000000..ffff15d
--- /dev/null
+++ b/r-plugin/functions.vim
@@ -0,0 +1,71 @@
+
+" Users may define the value of g:vimrplugin_permanent_libs to determine what
+" functions should be highlighted even if R is not running. By default, the
+" functions of packages loaded by R --vanilla are highlighted.
+if !exists("g:vimrplugin_permanent_libs")
+    let g:vimrplugin_permanent_libs = "base,stats,graphics,grDevices,utils,datasets,methods"
+endif
+
+" Store the names R package whose functions were already added to syntax
+" highlight to avoid sourcing them repeatedly.
+let b:rplugin_funls = []
+
+" The function RUpdateFunSyntax() is called by the Vim-R-plugin whenever the
+" user loads a new package in R. The function should be defined only once.
+" Thus, if it's already defined, call it and finish.
+if exists("*RUpdateFunSyntax")
+    call RUpdateFunSyntax(0)
+    finish
+endif
+
+function RAddToFunList(lib, verbose)
+    " Only run once for each package:
+    for pkg in b:rplugin_funls
+        if pkg == a:lib
+            return
+        endif
+    endfor
+
+    " The fun_ files list functions of R packages and are created by the
+    " Vim-R-plugin:
+    let fnf = split(globpath(&rtp, 'r-plugin/objlist/fun_' . a:lib . '_*'), "\n")
+
+    if len(fnf) == 1
+        silent exe "source " . fnf[0]
+        let b:rplugin_funls += [a:lib]
+    elseif a:verbose && len(fnf) == 0
+        echohl WarningMsg
+        echomsg 'Fun_ file for "' . a:lib . '" not found.'
+        echohl Normal
+        return
+    elseif a:verbose && len(fnf) > 1
+        echohl WarningMsg
+        echomsg 'There is more than one fun_ file for "' . a:lib . '":'
+        for fff in fnf
+            echomsg fff
+        endfor
+        echohl Normal
+        return
+    endif
+endfunction
+
+function RUpdateFunSyntax(verbose)
+    " Do nothing if called at a buffer that doesn't include R syntax:
+    if !exists("b:rplugin_funls")
+        return
+    endif
+    if exists("g:rplugin_libls")
+        for lib in g:rplugin_libls
+            call RAddToFunList(lib, a:verbose)
+        endfor
+    else
+        if exists("g:vimrplugin_permanent_libs")
+            for lib in split(g:vimrplugin_permanent_libs, ",")
+                call RAddToFunList(lib, a:verbose)
+            endfor
+        endif
+    endif
+endfunction
+
+call RUpdateFunSyntax(0)
+
diff --git a/syntax/r.vim b/syntax/r.vim
index 08b3413..7f0c783 100644
--- a/syntax/r.vim
+++ b/syntax/r.vim
@@ -3,7 +3,7 @@
 " Maintainer:	      Jakson Aquino 
 " Former Maintainers: Vaidotas Zemlys 
 " 		      Tom Payne 
-" Last Change:	      Mon Nov 11, 2013  10:12PM
+" Last Change:	      Sun Feb 23, 2014  08:53AM
 " Filenames:	      *.R *.r *.Rhistory *.Rt
 " 
 " NOTE: The highlighting of R functions is defined in the
@@ -150,6 +150,10 @@ syn match rBraceError "[)}]" contained
 syn match rCurlyError "[)\]]" contained
 syn match rParenError "[\]}]" contained
 
+" Source list of R functions. The list is produced by the Vim-R-plugin
+" http://www.vim.org/scripts/script.php?script_id=2628
+runtime r-plugin/functions.vim
+
 syn match rDollar display contained "\$"
 syn match rDollar display contained "@"
 
@@ -216,77 +220,4 @@ hi def link rOKeyword    Title
 
 let b:current_syntax="r"
 
-" The code below is used by the Vim-R-plugin:
-" http://www.vim.org/scripts/script.php?script_id=2628
-
-" Users may define the value of g:vimrplugin_permanent_libs to determine what
-" functions should be highlighted even if R is not running. By default, the
-" functions of packages loaded by R --vanilla are highlighted.
-if !exists("g:vimrplugin_permanent_libs")
-    let g:vimrplugin_permanent_libs = "base,stats,graphics,grDevices,utils,datasets,methods"
-endif
-
-" Store the names R package whose functions were already added to syntax
-" highlight to avoid sourcing them repeatedly.
-let b:rplugin_funls = []
-
-" The function RUpdateFunSyntax() is called by the Vim-R-plugin whenever the
-" user loads a new package in R. The function should be defined only once.
-" Thus, if it's already defined, call it and finish.
-if exists("*RUpdateFunSyntax")
-    call RUpdateFunSyntax(0)
-    finish
-endif
-
-function RAddToFunList(lib, verbose)
-    " Only run once for each package:
-    for pkg in b:rplugin_funls
-        if pkg == a:lib
-            return
-        endif
-    endfor
-
-    " The fun_ files list functions of R packages and are created by the
-    " Vim-R-plugin:
-    let fnf = split(globpath(&rtp, 'r-plugin/objlist/fun_' . a:lib . '_*'), "\n")
-
-    if len(fnf) == 1
-        silent exe "source " . fnf[0]
-        let b:rplugin_funls += [a:lib]
-    elseif a:verbose && len(fnf) == 0
-        echohl WarningMsg
-        echomsg 'Fun_ file for "' . a:lib . '" not found.'
-        echohl Normal
-        return
-    elseif a:verbose && len(fnf) > 1
-        echohl WarningMsg
-        echomsg 'There is more than one fun_ file for "' . a:lib . '":'
-        for fff in fnf
-            echomsg fff
-        endfor
-        echohl Normal
-        return
-    endif
-endfunction
-
-function RUpdateFunSyntax(verbose)
-    " Do nothing if called at a buffer that doesn't include R syntax:
-    if !exists("b:rplugin_funls")
-        return
-    endif
-    if exists("g:rplugin_libls")
-        for lib in g:rplugin_libls
-            call RAddToFunList(lib, a:verbose)
-        endfor
-    else
-        if exists("g:vimrplugin_permanent_libs")
-            for lib in split(g:vimrplugin_permanent_libs, ",")
-                call RAddToFunList(lib, a:verbose)
-            endfor
-        endif
-    endif
-endfunction
-
-call RUpdateFunSyntax(0)
-
 " vim: ts=8 sw=4

From f9cc615aa54f469ccbe4091aa7517206ecd12dd0 Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Sun, 23 Feb 2014 16:37:50 -0300
Subject: [PATCH 0612/1050] Move plugin specific code to _rplugin.vim files.
 Prepare the files from ftplugin directory to be submitted to Vim as official
 runtime files. Remove all code specific to the Vim-R-plugin from the official
 files and put them in the corresponding _rplugin.vim files which will only be
 distributed as part of the Vim-R-plugin. Note: the ftplugin/rbrowser.vim and
 ftplugin/rdoc.vim files will not be submitted to Vim because they are
 generated and used only by the plugin.

---
 Makefile                    |   5 +
 doc/r-plugin.txt            |  28 +++-
 ftplugin/r.vim              | 125 ++-------------
 ftplugin/r_rplugin.vim      |  97 ++++++++++++
 ftplugin/rbrowser.vim       |  24 +--
 ftplugin/rdoc.vim           |  28 +---
 ftplugin/rhelp.vim          |  74 ++-------
 ftplugin/rhelp_rplugin.vim  |  48 ++++++
 ftplugin/rmd.vim            | 227 ++--------------------------
 ftplugin/rmd_rplugin.vim    | 197 ++++++++++++++++++++++++
 ftplugin/rnoweb.vim         | 292 +++---------------------------------
 ftplugin/rnoweb_rplugin.vim | 249 ++++++++++++++++++++++++++++++
 ftplugin/rrst.vim           | 224 ++-------------------------
 ftplugin/rrst_rplugin.vim   | 192 ++++++++++++++++++++++++
 list_for_vimball            |   5 +
 15 files changed, 892 insertions(+), 923 deletions(-)
 create mode 100644 ftplugin/r_rplugin.vim
 create mode 100644 ftplugin/rhelp_rplugin.vim
 create mode 100644 ftplugin/rmd_rplugin.vim
 create mode 100644 ftplugin/rnoweb_rplugin.vim
 create mode 100644 ftplugin/rrst_rplugin.vim

diff --git a/Makefile b/Makefile
index 3c23f6a..2060c77 100644
--- a/Makefile
+++ b/Makefile
@@ -59,12 +59,17 @@ deb:
 	  - doc/r-plugin.txt\n\
 	  - ftdetect/r.vim\n\
 	  - ftplugin/r.vim\n\
+	  - ftplugin/r_rplugin.vim\n\
 	  - ftplugin/rbrowser.vim\n\
 	  - ftplugin/rdoc.vim\n\
 	  - ftplugin/rhelp.vim\n\
+	  - ftplugin/rhelp_rplugin.vim\n\
 	  - ftplugin/rnoweb.vim\n\
+	  - ftplugin/rnoweb_rplugin.vim\n\
 	  - ftplugin/rmd.vim\n\
+	  - ftplugin/rmd_rplugin.vim\n\
 	  - ftplugin/rrst.vim\n\
+	  - ftplugin/rrst_rplugin.vim\n\
 	  - indent/r.vim\n\
 	  - indent/rnoweb.vim\n\
 	  - indent/rhelp.vim\n\
diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 6718158..8ee208d 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -15,7 +15,7 @@ For Vim version 7.4
  5. Known bugs and workarounds                  |r-plugin-known-bugs|
  6. Options                                     |r-plugin-options|
  7. Custom key bindings                         |r-plugin-key-bindings|
- 8. Files                                       |r-plugin-files|
+ 8. License and files                           |r-plugin-files|
  9. FAQ and tips                                |r-plugin-tips|
 10. News                                        |r-plugin-news|
 
@@ -1710,12 +1710,27 @@ See also: |vimrplugin_source|.
 
 ==============================================================================
 							      *r-plugin-files*
-8. Files~
+8. License and files~
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+details.
+
+A copy of the GNU General Public License is available at
+http://www.r-project.org/Licenses/
+
+The files released with Vim runtime files are distributed under the Vim
+Charityware license.
 
 The following files are part of the plugin and should be in your ~/.vim
 directory after the installation:
 
-
    ftdetect/r.vim
    indent/r.vim
    indent/rmd.vim
@@ -1724,12 +1739,17 @@ directory after the installation:
    indent/rhelp.vim
    autoload/rcomplete.vim
    ftplugin/r.vim
+   ftplugin/r_rplugin.vim
    ftplugin/rbrowser.vim
    ftplugin/rdoc.vim
    ftplugin/rhelp.vim
+   ftplugin/rhelp_rplugin.vim
    ftplugin/rmd.vim
+   ftplugin/rmd_rplugin.vim
    ftplugin/rrst.vim
+   ftplugin/rrst_rplugin.vim
    ftplugin/rnoweb.vim
+   ftplugin/rnoweb_rplugin.vim
    syntax/rout.vim
    syntax/r.vim
    syntax/rhelp.vim
@@ -2324,7 +2344,7 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details.
 							       *r-plugin-news*
 10. News~
 
-0.9.9.9 (2014-02-01)
+0.9.9.9 (2014-02-23)
 
  * Minor bug fixes.
  
diff --git a/ftplugin/r.vim b/ftplugin/r.vim
index 758f713..514710e 100644
--- a/ftplugin/r.vim
+++ b/ftplugin/r.vim
@@ -1,30 +1,11 @@
-"  This program is free software; you can redistribute it and/or modify
-"  it under the terms of the GNU General Public License as published by
-"  the Free Software Foundation; either version 2 of the License, or
-"  (at your option) any later version.
-"
-"  This program is distributed in the hope that it will be useful,
-"  but WITHOUT ANY WARRANTY; without even the implied warranty of
-"  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-"  GNU General Public License for more details.
-"
-"  A copy of the GNU General Public License is available at
-"  http://www.r-project.org/Licenses/
-
-"==========================================================================
-" ftplugin for R files
-"
-" Authors: Jakson Alves de Aquino 
-"          Jose Claudio Faria
-"          
-"          Based on previous work by Johannes Ranke
-"
-" Please see doc/r-plugin.txt for usage details.
-"==========================================================================
+" Vim filetype plugin file
+" Language: R
+" Maintainer: Jakson Alves de Aquino 
+" Last Change:	Sun Feb 23, 2014  04:07PM
 
 " Only do this when not yet done for this buffer
-if exists("b:did_ftplugin") || exists("disable_r_ftplugin")
-    finish
+if exists("b:did_ftplugin")
+  finish
 endif
 
 " Don't load another plugin for this buffer
@@ -38,97 +19,13 @@ setlocal formatoptions-=t
 setlocal commentstring=#%s
 setlocal comments=b:#,b:##,b:###,b:#'
 
-" Source scripts common to R, Rnoweb, Rhelp, Rmd, Rrst and rdoc files:
-runtime r-plugin/common_global.vim
-if exists("g:rplugin_failed")
-    finish
-endif
-
-" Some buffer variables common to R, Rnoweb, Rhelp, Rmd, Rrst and rdoc files
-" need be defined after the global ones:
-runtime r-plugin/common_buffer.vim
-
-" Run R CMD BATCH on current file and load the resulting .Rout in a split
-" window
-function! ShowRout()
-    let routfile = expand("%:r") . ".Rout"
-    if bufloaded(routfile)
-        exe "bunload " . routfile
-        call delete(routfile)
-    endif
-
-    " if not silent, the user will have to type 
-    silent update
-    if has("win32") || has("win64")
-        let rcmd = 'Rcmd.exe BATCH --no-restore --no-save "' . expand("%") . '" "' . routfile . '"'
-    else
-        let rcmd = b:rplugin_R . " CMD BATCH --no-restore --no-save '" . expand("%") . "' '" . routfile . "'"
-    endif
-    echo "Please wait for: " . rcmd
-    let rlog = system(rcmd)
-    if v:shell_error && rlog != ""
-        call RWarningMsg('Error: "' . rlog . '"')
-        sleep 1
-    endif
-
-    if filereadable(routfile)
-        if g:vimrplugin_routnotab == 1
-            exe "split " . routfile
-        else
-            exe "tabnew " . routfile
-        endif
-        set filetype=rout
-    else
-        call RWarningMsg("The file '" . routfile . "' is not readable.")
-    endif
-endfunction
-
-" Convert R script into Rmd, md and, then, html.
-function! RSpin()
-    update
-    call RSetWD()
-    call g:SendCmdToR('require(knitr); spin("' . expand("%:t") . '")')
-endfunction
-
-" Default IsInRCode function when the plugin is used as a global plugin
-function! DefaultIsInRCode(vrb)
-    return 1
-endfunction
-
-let b:IsInRCode = function("DefaultIsInRCode")
-
-" Pointer to function that must be different if the plugin is used as a
-" global one:
-let b:SourceLines = function("RSourceLines")
-
-"==========================================================================
-" Key bindings and menu items
-
-call RCreateStartMaps()
-call RCreateEditMaps()
-
-" Only .R files are sent to R
-call RCreateMaps("ni", 'RSendFile',     'aa', ':call SendFileToR("silent")')
-call RCreateMaps("ni", 'RESendFile',    'ae', ':call SendFileToR("echo")')
-call RCreateMaps("ni", 'RShowRout',     'ao', ':call ShowRout()')
-
-" Knitr::spin
-" -------------------------------------
-call RCreateMaps("ni", 'RSpinFile',     'ks', ':call RSpin()')
-
-call RCreateSendMaps()
-call RControlMaps()
-call RCreateMaps("nvi", 'RSetwd',        'rd', ':call RSetWD()')
-
-
-" Menu R
-if has("gui_running")
-    call MakeRMenu()
+if has("gui_win32") && !exists("b:browsefilter")
+  let b:browsefilter = "R Source Files (*.R)\t*.R\n" .
+        \ "Files that include R (*.Rnw *.Rd *.Rmd *.Rrst)\t*.Rnw;*.Rd;*.Rmd;*.Rrst\n" .
+        \ "All Files (*.*)\t*.*\n"
 endif
 
-call RSourceOtherScripts()
+let b:undo_ftplugin = "setl cms< com< fo< isk< | unlet! b:browsefilter"
 
-let b:undo_ftplugin = "setl cms< com< fo< isk< | unlet! b:IsInRCode b:SourceLines"
 let &cpo = s:cpo_save
 unlet s:cpo_save
-
diff --git a/ftplugin/r_rplugin.vim b/ftplugin/r_rplugin.vim
new file mode 100644
index 0000000..737bf21
--- /dev/null
+++ b/ftplugin/r_rplugin.vim
@@ -0,0 +1,97 @@
+
+if exists("g:disable_r_ftplugin")
+    finish
+endif
+
+" Source scripts common to R, Rnoweb, Rhelp, Rmd, Rrst and rdoc files:
+runtime r-plugin/common_global.vim
+if exists("g:rplugin_failed")
+    finish
+endif
+
+" Some buffer variables common to R, Rnoweb, Rhelp, Rmd, Rrst and rdoc files
+" need be defined after the global ones:
+runtime r-plugin/common_buffer.vim
+
+" Run R CMD BATCH on current file and load the resulting .Rout in a split
+" window
+function! ShowRout()
+    let routfile = expand("%:r") . ".Rout"
+    if bufloaded(routfile)
+        exe "bunload " . routfile
+        call delete(routfile)
+    endif
+
+    " if not silent, the user will have to type 
+    silent update
+    if has("win32") || has("win64")
+        let rcmd = 'Rcmd.exe BATCH --no-restore --no-save "' . expand("%") . '" "' . routfile . '"'
+    else
+        let rcmd = b:rplugin_R . " CMD BATCH --no-restore --no-save '" . expand("%") . "' '" . routfile . "'"
+    endif
+    echo "Please wait for: " . rcmd
+    let rlog = system(rcmd)
+    if v:shell_error && rlog != ""
+        call RWarningMsg('Error: "' . rlog . '"')
+        sleep 1
+    endif
+
+    if filereadable(routfile)
+        if g:vimrplugin_routnotab == 1
+            exe "split " . routfile
+        else
+            exe "tabnew " . routfile
+        endif
+        set filetype=rout
+    else
+        call RWarningMsg("The file '" . routfile . "' is not readable.")
+    endif
+endfunction
+
+" Convert R script into Rmd, md and, then, html.
+function! RSpin()
+    update
+    call RSetWD()
+    call g:SendCmdToR('require(knitr); spin("' . expand("%:t") . '")')
+endfunction
+
+" Default IsInRCode function when the plugin is used as a global plugin
+function! DefaultIsInRCode(vrb)
+    return 1
+endfunction
+
+let b:IsInRCode = function("DefaultIsInRCode")
+
+" Pointer to function that must be different if the plugin is used as a
+" global one:
+let b:SourceLines = function("RSourceLines")
+
+"==========================================================================
+" Key bindings and menu items
+
+call RCreateStartMaps()
+call RCreateEditMaps()
+
+" Only .R files are sent to R
+call RCreateMaps("ni", 'RSendFile',     'aa', ':call SendFileToR("silent")')
+call RCreateMaps("ni", 'RESendFile',    'ae', ':call SendFileToR("echo")')
+call RCreateMaps("ni", 'RShowRout',     'ao', ':call ShowRout()')
+
+" Knitr::spin
+" -------------------------------------
+call RCreateMaps("ni", 'RSpinFile',     'ks', ':call RSpin()')
+
+call RCreateSendMaps()
+call RControlMaps()
+call RCreateMaps("nvi", 'RSetwd',        'rd', ':call RSetWD()')
+
+
+" Menu R
+if has("gui_running")
+    call MakeRMenu()
+endif
+
+call RSourceOtherScripts()
+
+
+let b:undo_ftplugin .= " | unlet! b:IsInRCode b:SourceLines"
diff --git a/ftplugin/rbrowser.vim b/ftplugin/rbrowser.vim
index 3c4ee53..74f36f6 100644
--- a/ftplugin/rbrowser.vim
+++ b/ftplugin/rbrowser.vim
@@ -1,22 +1,8 @@
-"  This program is free software; you can redistribute it and/or modify
-"  it under the terms of the GNU General Public License as published by
-"  the Free Software Foundation; either version 2 of the License, or
-"  (at your option) any later version.
-"
-"  This program is distributed in the hope that it will be useful,
-"  but WITHOUT ANY WARRANTY; without even the implied warranty of
-"  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-"  GNU General Public License for more details.
-"
-"  A copy of the GNU General Public License is available at
-"  http://www.r-project.org/Licenses/
-
-"==========================================================================
-" ftplugin for RBrowser files (created by the Vim-R-plugin)
-"
-" Author: Jakson Alves de Aquino 
-"          
-"==========================================================================
+" Vim filetype plugin file
+" Language: R Browser (generated by the Vim-R-plugin)
+" Maintainer: Jakson Alves de Aquino 
+" Last Change:	Sun Feb 23, 2014  10:09AM
+
 
 " Only do this when not yet done for this buffer
 if exists("b:did_ftplugin")
diff --git a/ftplugin/rdoc.vim b/ftplugin/rdoc.vim
index 29ef98c..48832f3 100644
--- a/ftplugin/rdoc.vim
+++ b/ftplugin/rdoc.vim
@@ -1,29 +1,11 @@
-"  This program is free software; you can redistribute it and/or modify
-"  it under the terms of the GNU General Public License as published by
-"  the Free Software Foundation; either version 2 of the License, or
-"  (at your option) any later version.
-"
-"  This program is distributed in the hope that it will be useful,
-"  but WITHOUT ANY WARRANTY; without even the implied warranty of
-"  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-"  GNU General Public License for more details.
-"
-"  A copy of the GNU General Public License is available at
-"  http://www.r-project.org/Licenses/
+" Vim filetype plugin file
+" Language: R Documentation (generated by the Vim-R-plugin)
+" Maintainer: Jakson Alves de Aquino 
+" Last Change:	Sun Feb 23, 2014  10:10AM
 
-"==========================================================================
-" ftplugin for R files
-"
-" Authors: Jakson Alves de Aquino 
-"          Jose Claudio Faria
-"          
-"          Based on previous work by Johannes Ranke
-"
-" Please see doc/r-plugin.txt for usage details.
-"==========================================================================
 
 " Only do this when not yet done for this buffer
-if exists("b:did_rdoc_ftplugin") || exists("disable_r_ftplugin")
+if exists("b:did_rdoc_ftplugin")
     finish
 endif
 
diff --git a/ftplugin/rhelp.vim b/ftplugin/rhelp.vim
index 3539600..e765060 100644
--- a/ftplugin/rhelp.vim
+++ b/ftplugin/rhelp.vim
@@ -1,29 +1,10 @@
-"  This program is free software; you can redistribute it and/or modify
-"  it under the terms of the GNU General Public License as published by
-"  the Free Software Foundation; either version 2 of the License, or
-"  (at your option) any later version.
-"
-"  This program is distributed in the hope that it will be useful,
-"  but WITHOUT ANY WARRANTY; without even the implied warranty of
-"  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-"  GNU General Public License for more details.
-"
-"  A copy of the GNU General Public License is available at
-"  http://www.r-project.org/Licenses/
-
-"==========================================================================
-" ftplugin for R files
-"
-" Authors: Jakson Alves de Aquino 
-"          Jose Claudio Faria
-"          
-"          Based on previous work by Johannes Ranke
-"
-" Please see doc/r-plugin.txt for usage details.
-"==========================================================================
+" Vim filetype plugin file
+" Language: R help file
+" Maintainer: Jakson Alves de Aquino 
+" Last Change:	Sun Feb 23, 2014  04:06PM
 
 " Only do this when not yet done for this buffer
-if exists("b:did_ftplugin") || exists("disable_r_ftplugin")
+if exists("b:did_ftplugin")
     finish
 endif
 
@@ -35,49 +16,12 @@ set cpo&vim
 
 setlocal iskeyword=@,48-57,_,.
 
-" Source scripts common to R, Rnoweb, Rhelp and rdoc files:
-runtime r-plugin/common_global.vim
-if exists("g:rplugin_failed")
-    finish
-endif
-
-" Some buffer variables common to R, Rnoweb, Rhelp and rdoc file need be
-" defined after the global ones:
-runtime r-plugin/common_buffer.vim
-
-function! RhelpIsInRCode(vrb)
-    let lastsec = search('^\\[a-z][a-z]*{', "bncW")
-    let secname = getline(lastsec)
-    if line(".") > lastsec && (secname =~ '^\\usage{' || secname =~ '^\\examples{' || secname =~ '^\\dontshow{' || secname =~ '^\\dontrun{' || secname =~ '^\\donttest{' || secname =~ '^\\testonly{')
-        return 1
-    else
-        if a:vrb
-            call RWarningMsg("Not inside an R section.")
-        endif
-        return 0
-    endif
-endfunction
-
-let b:IsInRCode = function("RhelpIsInRCode")
-let b:SourceLines = function("RSourceLines")
-
-"==========================================================================
-" Key bindings and menu items
-
-call RCreateStartMaps()
-call RCreateEditMaps()
-call RCreateSendMaps()
-call RControlMaps()
-call RCreateMaps("nvi", 'RSetwd',        'rd', ':call RSetWD()')
-
-" Menu R
-if has("gui_running")
-    call MakeRMenu()
+if has("gui_win32") && !exists("b:browsefilter")
+  let b:browsefilter = "R Source Files (*.R *.Rnw *.Rd *.Rmd *.Rrst)\t*.R;*.Rnw;*.Rd;*.Rmd;*.Rrst\n" .
+        \ "All Files (*.*)\t*.*\n"
 endif
 
-call RSourceOtherScripts()
+let b:undo_ftplugin = "setl isk< | unlet! b:browsefilter"
 
-let b:undo_ftplugin = "setl isk< | unlet! b:IsInRCode b:SourceLines"
 let &cpo = s:cpo_save
 unlet s:cpo_save
-
diff --git a/ftplugin/rhelp_rplugin.vim b/ftplugin/rhelp_rplugin.vim
new file mode 100644
index 0000000..6e184e4
--- /dev/null
+++ b/ftplugin/rhelp_rplugin.vim
@@ -0,0 +1,48 @@
+
+if exists("g:disable_r_ftplugin")
+    finish
+endif
+
+" Source scripts common to R, Rnoweb, Rhelp and rdoc files:
+runtime r-plugin/common_global.vim
+if exists("g:rplugin_failed")
+    finish
+endif
+
+" Some buffer variables common to R, Rnoweb, Rhelp and rdoc file need be
+" defined after the global ones:
+runtime r-plugin/common_buffer.vim
+
+function! RhelpIsInRCode(vrb)
+    let lastsec = search('^\\[a-z][a-z]*{', "bncW")
+    let secname = getline(lastsec)
+    if line(".") > lastsec && (secname =~ '^\\usage{' || secname =~ '^\\examples{' || secname =~ '^\\dontshow{' || secname =~ '^\\dontrun{' || secname =~ '^\\donttest{' || secname =~ '^\\testonly{')
+        return 1
+    else
+        if a:vrb
+            call RWarningMsg("Not inside an R section.")
+        endif
+        return 0
+    endif
+endfunction
+
+let b:IsInRCode = function("RhelpIsInRCode")
+let b:SourceLines = function("RSourceLines")
+
+"==========================================================================
+" Key bindings and menu items
+
+call RCreateStartMaps()
+call RCreateEditMaps()
+call RCreateSendMaps()
+call RControlMaps()
+call RCreateMaps("nvi", 'RSetwd',        'rd', ':call RSetWD()')
+
+" Menu R
+if has("gui_running")
+    call MakeRMenu()
+endif
+
+call RSourceOtherScripts()
+
+let b:undo_ftplugin .= " | unlet! b:IsInRCode b:SourceLines"
diff --git a/ftplugin/rmd.vim b/ftplugin/rmd.vim
index 9b9cd16..fcc8b8a 100644
--- a/ftplugin/rmd.vim
+++ b/ftplugin/rmd.vim
@@ -1,27 +1,11 @@
-"  This program is free software; you can redistribute it and/or modify
-"  it under the terms of the GNU General Public License as published by
-"  the Free Software Foundation; either version 2 of the License, or
-"  (at your option) any later version.
-"
-"  This program is distributed in the hope that it will be useful,
-"  but WITHOUT ANY WARRANTY; without even the implied warranty of
-"  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-"  GNU General Public License for more details.
-"
-"  A copy of the GNU General Public License is available at
-"  http://www.r-project.org/Licenses/
-
-"==========================================================================
-" ftplugin for Rmd files
-"
-" Authors: Jakson Alves de Aquino 
-"          Jose Claudio Faria
-"          Alex Zvoleff (adjusting for rmd by Michel Kuhlmann)
-"
-"==========================================================================
+" Vim filetype plugin file
+" Language: R help file
+" Maintainer: Jakson Alves de Aquino 
+" Last Change:	Sun Feb 23, 2014  04:06PM
+" Original work by Alex Zvoleff (adjusted for rmd by Michel Kuhlmann)
 
 " Only do this when not yet done for this buffer
-if exists("b:did_ftplugin") || exists("disable_r_ftplugin") || exists("b:did_ftplugin")
+if exists("b:did_ftplugin")
     finish
 endif
 
@@ -42,201 +26,16 @@ runtime ftplugin/pandoc.vim
 " Don't load another plugin for this buffer
 let b:did_ftplugin = 1
 
-" Source scripts common to R, Rrst, Rnoweb, Rhelp and Rdoc:
-runtime r-plugin/common_global.vim
-if exists("g:rplugin_failed")
-    finish
-endif
-
-" Some buffer variables common to R, Rmd, Rrst, Rnoweb, Rhelp and Rdoc need to
-" be defined after the global ones:
-runtime r-plugin/common_buffer.vim
-
-function! RmdIsInRCode(vrb)
-    let chunkline = search("^[ \t]*```[ ]*{r", "bncW")
-    let docline = search("^[ \t]*```$", "bncW")
-    if chunkline > docline && chunkline != line(".")
-        return 1
-    else
-        if a:vrb
-            call RWarningMsg("Not inside an R code chunk.")
-        endif
-        return 0
-    endif
-endfunction
-
-function! RmdPreviousChunk() range
-    let rg = range(a:firstline, a:lastline)
-    let chunk = len(rg)
-    for var in range(1, chunk)
-        let curline = line(".")
-        if RmdIsInRCode(0)
-            let i = search("^[ \t]*```[ ]*{r", "bnW")
-            if i != 0
-                call cursor(i-1, 1)
-            endif
-        endif
-        let i = search("^[ \t]*```[ ]*{r", "bnW")
-        if i == 0
-            call cursor(curline, 1)
-            call RWarningMsg("There is no previous R code chunk to go.")
-            return
-        else
-            call cursor(i+1, 1)
-        endif
-    endfor
-    return
-endfunction
-
-function! RmdNextChunk() range
-    let rg = range(a:firstline, a:lastline)
-    let chunk = len(rg)
-    for var in range(1, chunk)
-        let i = search("^[ \t]*```[ ]*{r", "nW")
-        if i == 0
-            call RWarningMsg("There is no next R code chunk to go.")
-            return
-        else
-            call cursor(i+1, 1)
-        endif
-    endfor
-    return
-endfunction
-
-function! RMakeHTMLrmd(t)
-    call RSetWD()
-    update
-    let rcmd = 'require(knitr); knit2html("' . expand("%:t") . '")'
-    if a:t == "odt"
-        if g:rplugin_has_soffice == 0
-            if has("win32") || has("win64")
-                let soffbin = "soffice.exe"
-            else
-                let soffbin = "soffice"
-            endif
-            if executable(soffbin)
-                let g:rplugin_has_soffice = 1
-            else
-                call RWarningMsg("Is Libre Office installed? Cannot convert into ODT: '" . soffbin . "' not found.")
-            endif
-        endif
-        let rcmd = rcmd . '; system("' . soffbin . ' --invisible --convert-to odt ' . expand("%:r:t") . '.html")'
-    endif
-    if g:vimrplugin_openhtml && a:t == "html"
-        let rcmd = rcmd . '; browseURL("' . expand("%:r:t") . '.html")'
-    endif
-    call g:SendCmdToR(rcmd)
-endfunction
-
-function! RMakeSlidesrmd()
-    call RSetWD()
-    update
-    let rcmd = 'require(slidify); slidify("' . expand("%:t") . '")'
-    if g:vimrplugin_openhtml
-        let rcmd = rcmd . '; browseURL("' . expand("%:r:t") . '.html")'
-    endif
-    call g:SendCmdToR(rcmd)
-endfunction
-
-
-function! RMakePDFrmd(t)
-    if g:rplugin_vimcomport == 0
-        exe "Py DiscoverVimComPort()"
-        if g:rplugin_vimcomport == 0
-            call RWarningMsg("The vimcom package is required to make and open the PDF.")
-        endif
-    endif
-    if g:rplugin_has_pandoc == 0
-        if executable("pandoc")
-            let g:rplugin_has_pandoc = 1
-        else
-            call RWarningMsg("Cannot convert into PDF: 'pandoc' not found.")
-            return
-        endif
-    endif
-    call RSetWD()
-    update
-    let pdfcmd = "vim.interlace.rmd('" . expand("%:t") . "'"
-    let pdfcmd = pdfcmd . ", pdfout = '" . a:t  . "'"
-    if exists("g:vimrplugin_rmdcompiler")
-        let pdfcmd = pdfcmd . ", compiler='" . g:vimrplugin_rmdcompiler . "'"
-    endif
-    if exists("g:vimrplugin_knitargs")
-        let pdfcmd = pdfcmd . ", " . g:vimrplugin_knitargs
-    endif
-    if exists("g:vimrplugin_rmd2pdfpath")
-        pdfcmd = pdfcmd . ", rmd2pdfpath='" . g:vimrplugin_rmd2pdf_path . "'"
-    endif
-    if exists("g:vimrplugin_pandoc_args")
-        let pdfcmd = pdfcmd . ", pandoc_args = '" . g:vimrplugin_pandoc_args . "'"
-    endif
-    let pdfcmd = pdfcmd . ")"
-    call g:SendCmdToR(pdfcmd)
-endfunction  
-
-" Send Rmd chunk to R
-function! SendRmdChunkToR(e, m)
-    if RmdIsInRCode(0) == 0
-        call RWarningMsg("Not inside an R code chunk.")
-        return
-    endif
-    let chunkline = search("^[ \t]*```[ ]*{r", "bncW") + 1
-    let docline = search("^[ \t]*```", "ncW") - 1
-    let lines = getline(chunkline, docline)
-    let ok = RSourceLines(lines, a:e)
-    if ok == 0
-        return
-    endif
-    if a:m == "down"
-        call RmdNextChunk()
-    endif  
-endfunction
-
-let b:IsInRCode = function("RmdIsInRCode")
-let b:PreviousRChunk = function("RmdPreviousChunk")
-let b:NextRChunk = function("RmdNextChunk")
-let b:SendChunkToR = function("SendRmdChunkToR")
-let b:SourceLines = function("RSourceLines")
-
-"==========================================================================
-" Key bindings and menu items
-
-call RCreateStartMaps()
-call RCreateEditMaps()
-call RCreateSendMaps()
-call RControlMaps()
-call RCreateMaps("nvi", 'RSetwd',        'rd', ':call RSetWD()')
-
-" Only .Rmd files use these functions:
-call RCreateMaps("nvi", 'RKnit',        'kn', ':call RKnit()')
-call RCreateMaps("nvi", 'RMakePDFK',    'kp', ':call RMakePDFrmd("latex")')
-call RCreateMaps("nvi", 'RMakePDFKb',   'kl', ':call RMakePDFrmd("beamer")')
-call RCreateMaps("nvi", 'RMakeHTML',    'kh', ':call RMakeHTMLrmd("html")')
-call RCreateMaps("nvi", 'RMakeSlides',  'sl', ':call RMakeSlidesrmd()')
-call RCreateMaps("nvi", 'RMakeODT',     'ko', ':call RMakeHTMLrmd("odt")')
-call RCreateMaps("ni",  'RSendChunk',   'cc', ':call b:SendChunkToR("silent", "stay")')
-call RCreateMaps("ni",  'RESendChunk',  'ce', ':call b:SendChunkToR("echo", "stay")')
-call RCreateMaps("ni",  'RDSendChunk',  'cd', ':call b:SendChunkToR("silent", "down")')
-call RCreateMaps("ni",  'REDSendChunk', 'ca', ':call b:SendChunkToR("echo", "down")')
-nmap  gn :call b:NextRChunk()
-nmap  gN :call b:PreviousRChunk()
-
-" Menu R
-if has("gui_running")
-    call MakeRMenu()
+if has("gui_win32") && !exists("b:browsefilter")
+  let b:browsefilter = "R Source Files (*.R *.Rnw *.Rd *.Rmd *.Rrst)\t*.R;*.Rnw;*.Rd;*.Rmd;*.Rrst\n" .
+        \ "All Files (*.*)\t*.*\n"
 endif
 
-let g:rplugin_has_pandoc = 0
-let g:rplugin_has_soffice = 0
-
-call RSourceOtherScripts()
-
-let &cpo = s:cpo_save
-unlet s:cpo_save
-
 if exists('b:undo_ftplugin')
-  let b:undo_ftplugin .= "|setl cms< com< fo< flp< isk< | unlet! b:IsInRCode b:SourceLines b:PreviousRChunk b:NextRChunk b:SendChunkToR"
+  let b:undo_ftplugin .= " | setl cms< com< fo< flp< isk< | unlet! b:browsefilter"
 else
-  let b:undo_ftplugin = "setl cms< com< fo< flp< isk< | unlet! b:IsInRCode b:SourceLines b:PreviousRChunk b:NextRChunk b:SendChunkToR"
+  let b:undo_ftplugin = "setl cms< com< fo< flp< isk< | unlet! b:browsefilter"
 endif
 
+let &cpo = s:cpo_save
+unlet s:cpo_save
diff --git a/ftplugin/rmd_rplugin.vim b/ftplugin/rmd_rplugin.vim
new file mode 100644
index 0000000..d18c4af
--- /dev/null
+++ b/ftplugin/rmd_rplugin.vim
@@ -0,0 +1,197 @@
+
+if exists("g:disable_r_ftplugin")
+    finish
+endif
+
+
+" Source scripts common to R, Rrst, Rnoweb, Rhelp and Rdoc:
+runtime r-plugin/common_global.vim
+if exists("g:rplugin_failed")
+    finish
+endif
+
+" Some buffer variables common to R, Rmd, Rrst, Rnoweb, Rhelp and Rdoc need to
+" be defined after the global ones:
+runtime r-plugin/common_buffer.vim
+
+function! RmdIsInRCode(vrb)
+    let chunkline = search("^[ \t]*```[ ]*{r", "bncW")
+    let docline = search("^[ \t]*```$", "bncW")
+    if chunkline > docline && chunkline != line(".")
+        return 1
+    else
+        if a:vrb
+            call RWarningMsg("Not inside an R code chunk.")
+        endif
+        return 0
+    endif
+endfunction
+
+function! RmdPreviousChunk() range
+    let rg = range(a:firstline, a:lastline)
+    let chunk = len(rg)
+    for var in range(1, chunk)
+        let curline = line(".")
+        if RmdIsInRCode(0)
+            let i = search("^[ \t]*```[ ]*{r", "bnW")
+            if i != 0
+                call cursor(i-1, 1)
+            endif
+        endif
+        let i = search("^[ \t]*```[ ]*{r", "bnW")
+        if i == 0
+            call cursor(curline, 1)
+            call RWarningMsg("There is no previous R code chunk to go.")
+            return
+        else
+            call cursor(i+1, 1)
+        endif
+    endfor
+    return
+endfunction
+
+function! RmdNextChunk() range
+    let rg = range(a:firstline, a:lastline)
+    let chunk = len(rg)
+    for var in range(1, chunk)
+        let i = search("^[ \t]*```[ ]*{r", "nW")
+        if i == 0
+            call RWarningMsg("There is no next R code chunk to go.")
+            return
+        else
+            call cursor(i+1, 1)
+        endif
+    endfor
+    return
+endfunction
+
+function! RMakeHTMLrmd(t)
+    call RSetWD()
+    update
+    let rcmd = 'require(knitr); knit2html("' . expand("%:t") . '")'
+    if a:t == "odt"
+        if g:rplugin_has_soffice == 0
+            if has("win32") || has("win64")
+                let soffbin = "soffice.exe"
+            else
+                let soffbin = "soffice"
+            endif
+            if executable(soffbin)
+                let g:rplugin_has_soffice = 1
+            else
+                call RWarningMsg("Is Libre Office installed? Cannot convert into ODT: '" . soffbin . "' not found.")
+            endif
+        endif
+        let rcmd = rcmd . '; system("' . soffbin . ' --invisible --convert-to odt ' . expand("%:r:t") . '.html")'
+    endif
+    if g:vimrplugin_openhtml && a:t == "html"
+        let rcmd = rcmd . '; browseURL("' . expand("%:r:t") . '.html")'
+    endif
+    call g:SendCmdToR(rcmd)
+endfunction
+
+function! RMakeSlidesrmd()
+    call RSetWD()
+    update
+    let rcmd = 'require(slidify); slidify("' . expand("%:t") . '")'
+    if g:vimrplugin_openhtml
+        let rcmd = rcmd . '; browseURL("' . expand("%:r:t") . '.html")'
+    endif
+    call g:SendCmdToR(rcmd)
+endfunction
+
+
+function! RMakePDFrmd(t)
+    if g:rplugin_vimcomport == 0
+        exe "Py DiscoverVimComPort()"
+        if g:rplugin_vimcomport == 0
+            call RWarningMsg("The vimcom package is required to make and open the PDF.")
+        endif
+    endif
+    if g:rplugin_has_pandoc == 0
+        if executable("pandoc")
+            let g:rplugin_has_pandoc = 1
+        else
+            call RWarningMsg("Cannot convert into PDF: 'pandoc' not found.")
+            return
+        endif
+    endif
+    call RSetWD()
+    update
+    let pdfcmd = "vim.interlace.rmd('" . expand("%:t") . "'"
+    let pdfcmd = pdfcmd . ", pdfout = '" . a:t  . "'"
+    if exists("g:vimrplugin_rmdcompiler")
+        let pdfcmd = pdfcmd . ", compiler='" . g:vimrplugin_rmdcompiler . "'"
+    endif
+    if exists("g:vimrplugin_knitargs")
+        let pdfcmd = pdfcmd . ", " . g:vimrplugin_knitargs
+    endif
+    if exists("g:vimrplugin_rmd2pdfpath")
+        pdfcmd = pdfcmd . ", rmd2pdfpath='" . g:vimrplugin_rmd2pdf_path . "'"
+    endif
+    if exists("g:vimrplugin_pandoc_args")
+        let pdfcmd = pdfcmd . ", pandoc_args = '" . g:vimrplugin_pandoc_args . "'"
+    endif
+    let pdfcmd = pdfcmd . ")"
+    call g:SendCmdToR(pdfcmd)
+endfunction  
+
+" Send Rmd chunk to R
+function! SendRmdChunkToR(e, m)
+    if RmdIsInRCode(0) == 0
+        call RWarningMsg("Not inside an R code chunk.")
+        return
+    endif
+    let chunkline = search("^[ \t]*```[ ]*{r", "bncW") + 1
+    let docline = search("^[ \t]*```", "ncW") - 1
+    let lines = getline(chunkline, docline)
+    let ok = RSourceLines(lines, a:e)
+    if ok == 0
+        return
+    endif
+    if a:m == "down"
+        call RmdNextChunk()
+    endif  
+endfunction
+
+let b:IsInRCode = function("RmdIsInRCode")
+let b:PreviousRChunk = function("RmdPreviousChunk")
+let b:NextRChunk = function("RmdNextChunk")
+let b:SendChunkToR = function("SendRmdChunkToR")
+let b:SourceLines = function("RSourceLines")
+
+"==========================================================================
+" Key bindings and menu items
+
+call RCreateStartMaps()
+call RCreateEditMaps()
+call RCreateSendMaps()
+call RControlMaps()
+call RCreateMaps("nvi", 'RSetwd',        'rd', ':call RSetWD()')
+
+" Only .Rmd files use these functions:
+call RCreateMaps("nvi", 'RKnit',        'kn', ':call RKnit()')
+call RCreateMaps("nvi", 'RMakePDFK',    'kp', ':call RMakePDFrmd("latex")')
+call RCreateMaps("nvi", 'RMakePDFKb',   'kl', ':call RMakePDFrmd("beamer")')
+call RCreateMaps("nvi", 'RMakeHTML',    'kh', ':call RMakeHTMLrmd("html")')
+call RCreateMaps("nvi", 'RMakeSlides',  'sl', ':call RMakeSlidesrmd()')
+call RCreateMaps("nvi", 'RMakeODT',     'ko', ':call RMakeHTMLrmd("odt")')
+call RCreateMaps("ni",  'RSendChunk',   'cc', ':call b:SendChunkToR("silent", "stay")')
+call RCreateMaps("ni",  'RESendChunk',  'ce', ':call b:SendChunkToR("echo", "stay")')
+call RCreateMaps("ni",  'RDSendChunk',  'cd', ':call b:SendChunkToR("silent", "down")')
+call RCreateMaps("ni",  'REDSendChunk', 'ca', ':call b:SendChunkToR("echo", "down")')
+nmap  gn :call b:NextRChunk()
+nmap  gN :call b:PreviousRChunk()
+
+" Menu R
+if has("gui_running")
+    call MakeRMenu()
+endif
+
+let g:rplugin_has_pandoc = 0
+let g:rplugin_has_soffice = 0
+
+call RSourceOtherScripts()
+
+
+let b:undo_ftplugin .= " | unlet! b:IsInRCode b:SourceLines b:PreviousRChunk b:NextRChunk b:SendChunkToR"
diff --git a/ftplugin/rnoweb.vim b/ftplugin/rnoweb.vim
index a1f7a2a..fe57ae7 100644
--- a/ftplugin/rnoweb.vim
+++ b/ftplugin/rnoweb.vim
@@ -1,292 +1,38 @@
-"  This program is free software; you can redistribute it and/or modify
-"  it under the terms of the GNU General Public License as published by
-"  the Free Software Foundation; either version 2 of the License, or
-"  (at your option) any later version.
-"
-"  This program is distributed in the hope that it will be useful,
-"  but WITHOUT ANY WARRANTY; without even the implied warranty of
-"  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-"  GNU General Public License for more details.
-"
-"  A copy of the GNU General Public License is available at
-"  http://www.r-project.org/Licenses/
-
-"==========================================================================
-" ftplugin for R files
-"
-" Authors: Jakson Alves de Aquino 
-"          Jose Claudio Faria
-"
-"==========================================================================
+" Vim filetype plugin file
+" Language: Rnoweb
+" Maintainer: Jakson Alves de Aquino 
+" Last Change:	Sun Feb 23, 2014  04:06PM
 
 " Only do this when not yet done for this buffer
-if exists("b:did_ftplugin") || exists("disable_r_ftplugin")
+if exists("b:did_ftplugin")
     finish
 endif
 
-" Don't load another plugin for this buffer
-let b:did_ftplugin = 1
-
 let s:cpo_save = &cpo
 set cpo&vim
 
-" Enables Vim-Latex-Suite, LaTeX-Box if installed
-runtime ftplugin/tex_latexSuite.vim
-runtime ftplugin/tex_LatexBox.vim
+runtime! ftplugin/tex.vim
 
-setlocal iskeyword=@,48-57,_,.
-
-" Source scripts common to R, Rnoweb, Rhelp and Rdoc:
-runtime r-plugin/common_global.vim
-if exists("g:rplugin_failed")
-    finish
-endif
+" Don't load another plugin for this buffer
+let b:did_ftplugin = 1
 
-" Some buffer variables common to R, Rnoweb, Rhelp and Rdoc need to be defined
-" after the global ones:
-runtime r-plugin/common_buffer.vim
+" Enables Vim-Latex-Suite, LaTeX-Box if installed
+runtime ftplugin/tex_*.vim
 
 setlocal iskeyword=@,48-57,_,.
+setlocal suffixesadd=.bib,.tex
+setlocal comments=b:%,b:#,b:##,b:###,b:#'
 
-function! RWriteChunk()
-    if getline(".") =~ "^\\s*$" && RnwIsInRCode(0) == 0
-        call setline(line("."), "<<>>=")
-        exe "normal! o@"
-        exe "normal! 0kl"
-    else
-        exe "normal! a<"
-    endif
-endfunction
-
-function! RnwIsInRCode(vrb)
-    let chunkline = search("^<<", "bncW")
-    let docline = search("^@", "bncW")
-    if chunkline > docline && chunkline != line(".")
-        return 1
-    else
-        if a:vrb
-            call RWarningMsg("Not inside an R code chunk.")
-        endif
-        return 0
-    endif
-endfunction
-
-function! RnwPreviousChunk() range
-    let rg = range(a:firstline, a:lastline)
-    let chunk = len(rg)
-    for var in range(1, chunk)
-        let curline = line(".")
-        if RnwIsInRCode(0)
-            let i = search("^<<.*$", "bnW")
-            if i != 0
-                call cursor(i-1, 1)
-            endif
-        endif
-        let i = search("^<<.*$", "bnW")
-        if i == 0
-            call cursor(curline, 1)
-            call RWarningMsg("There is no previous R code chunk to go.")
-            return
-        else
-            call cursor(i+1, 1)
-        endif
-    endfor
-    return
-endfunction
-
-function! RnwNextChunk() range
-    let rg = range(a:firstline, a:lastline)
-    let chunk = len(rg)
-    for var in range(1, chunk)
-        let i = search("^<<.*$", "nW")
-        if i == 0
-            call RWarningMsg("There is no next R code chunk to go.")
-            return
-        else
-            call cursor(i+1, 1)
-        endif
-    endfor
-    return
-endfunction
-
-" Sweave and compile the current buffer content
-function! RMakePDF(bibtex, knit)
-    if g:rplugin_vimcomport == 0
-        exe "Py DiscoverVimComPort()"
-        if g:rplugin_vimcomport == 0
-            call RWarningMsg("The vimcom package is required to make and open the PDF.")
-        endif
-    endif
-    update
-    call RSetWD()
-    let pdfcmd = "vim.interlace.rnoweb('" . expand("%:t") . "'"
-
-    if a:knit
-        let pdfcmd = pdfcmd . ', knit = TRUE'
-    endif
-
-    if g:vimrplugin_latexcmd != "pdflatex"
-        let pdfcmd = pdfcmd . ", latexcmd = '" . g:vimrplugin_latexcmd . "'"
-    endif
-
-    if a:bibtex == "bibtex"
-        let pdfcmd = pdfcmd . ", bibtex = TRUE"
-    endif
-
-    if a:bibtex == "verbose"
-        let pdfcmd = pdfcmd . ", quiet = FALSE"
-    endif
-
-    if g:vimrplugin_openpdf == 0
-        let pdfcmd = pdfcmd . ", view = FALSE"
-    endif
-
-    if g:vimrplugin_openpdf_quietly
-        let pdfcmd = pdfcmd . ", pdfquiet = TRUE"
-    endif
-
-    if a:knit == 0 && exists("g:vimrplugin_sweaveargs")
-        let pdfcmd = pdfcmd . ", " . g:vimrplugin_sweaveargs
-    endif
-
-    let pdfcmd = pdfcmd . ")"
-    let ok = g:SendCmdToR(pdfcmd)
-    if ok == 0
-        return
-    endif
-endfunction  
-
-" Send Sweave chunk to R
-function! RnwSendChunkToR(e, m)
-    if RnwIsInRCode(0) == 0
-        call RWarningMsg("Not inside an R code chunk.")
-        return
-    endif
-    let chunkline = search("^<<", "bncW") + 1
-    let docline = search("^@", "ncW") - 1
-    let lines = getline(chunkline, docline)
-    let ok = RSourceLines(lines, a:e)
-    if ok == 0
-        return
-    endif
-    if a:m == "down"
-        call RnwNextChunk()
-    endif  
-endfunction
-
-" Sweave the current buffer content
-function! RSweave()
-    update
-    call RSetWD()
-    if exists("g:vimrplugin_sweaveargs")
-        call g:SendCmdToR('Sweave("' . expand("%:t") . '", ' . g:vimrplugin_sweaveargs . ')')
-    else
-        call g:SendCmdToR('Sweave("' . expand("%:t") . '")')
-    endif
-endfunction
-
-function! ROpenPDF()
-    if has("win32") || has("win64")
-        exe 'Py OpenPDF("' . expand("%:t:r") . '.pdf")'
-        return
-    endif
-
-    if !exists("g:rplugin_pdfviewer")
-        let g:rplugin_pdfviewer = "none"
-        if has("gui_macvim") || has("gui_mac") || has("mac") || has("macunix")
-            if $R_PDFVIEWER == ""
-                let pdfvl = ["open"]
-            else
-                let pdfvl = [$R_PDFVIEWER, "open"]
-            endif
-        else
-            if $R_PDFVIEWER == ""
-                let pdfvl = ["xdg-open"]
-            else
-                let pdfvl = [$R_PDFVIEWER, "xdg-open"]
-            endif
-        endif
-        " List from R configure script:
-        let pdfvl += ["evince", "okular", "xpdf", "gv", "gnome-gv", "ggv", "kpdf", "gpdf", "kghostview,", "acroread", "acroread4"]
-        for prog in pdfvl
-            if executable(prog)
-                let g:rplugin_pdfviewer = prog
-                break
-            endif
-        endfor
-    endif
-
-    if g:rplugin_pdfviewer == "none"
-        if g:vimrplugin_openpdf_quietly
-            call g:SendCmdToR('vim.openpdf("' . expand("%:p:r") . ".pdf" . '", TRUE)')
-        else
-            call g:SendCmdToR('vim.openpdf("' . expand("%:p:r") . ".pdf" . '")')
-        endif
-    else
-        let openlog = system(g:rplugin_pdfviewer . " '" . expand("%:p:r") . ".pdf" . "'")
-        if v:shell_error
-            let rlog = substitute(openlog, "\n", " ", "g")
-            let rlog = substitute(openlog, "\r", " ", "g")
-            call RWarningMsg(openlog)
-        endif
-    endif
-endfunction
-
-if g:vimrplugin_rnowebchunk == 1
-    " Write code chunk in rnoweb files
-    imap  < :call RWriteChunk()a
-endif
-
-" Pointers to functions whose purposes are the same in rnoweb, rrst, rmd,
-" rhelp and rdoc and which are called at common_global.vim
-let b:IsInRCode = function("RnwIsInRCode")
-let b:PreviousRChunk = function("RnwPreviousChunk")
-let b:NextRChunk = function("RnwNextChunk")
-let b:SendChunkToR = function("RnwSendChunkToR")
-
-" Pointers to functions that must be different if the plugin is used as a
-" global one:
-let b:SourceLines = function("RSourceLines")
-
-
-"==========================================================================
-" Key bindings and menu items
-
-call RCreateStartMaps()
-call RCreateEditMaps()
-call RCreateSendMaps()
-call RControlMaps()
-call RCreateMaps("nvi", 'RSetwd',        'rd', ':call RSetWD()')
-
-" Only .Rnw files use these functions:
-call RCreateMaps("nvi", 'RSweave',      'sw', ':call RSweave()')
-call RCreateMaps("nvi", 'RMakePDF',     'sp', ':call RMakePDF("nobib", 0)')
-call RCreateMaps("nvi", 'RBibTeX',      'sb', ':call RMakePDF("bibtex", 0)')
-call RCreateMaps("nvi", 'RKnit',        'kn', ':call RKnit()')
-call RCreateMaps("nvi", 'RMakePDFK',    'kp', ':call RMakePDF("nobib", 1)')
-call RCreateMaps("nvi", 'RBibTeXK',     'kb', ':call RMakePDF("bibtex", 1)')
-call RCreateMaps("nvi", 'ROpenPDF',     'op', ':call ROpenPDF()')
-call RCreateMaps("nvi", 'RIndent',      'si', ':call RnwToggleIndentSty()')
-call RCreateMaps("ni",  'RSendChunk',   'cc', ':call b:SendChunkToR("silent", "stay")')
-call RCreateMaps("ni",  'RESendChunk',  'ce', ':call b:SendChunkToR("echo", "stay")')
-call RCreateMaps("ni",  'RDSendChunk',  'cd', ':call b:SendChunkToR("silent", "down")')
-call RCreateMaps("ni",  'REDSendChunk', 'ca', ':call b:SendChunkToR("echo", "down")')
-nmap  gn :call RnwNextChunk()
-nmap  gN :call RnwPreviousChunk()
-
-" Menu R
-if has("gui_running")
-    call MakeRMenu()
+if has("gui_win32") && !exists("b:browsefilter")
+  let b:browsefilter = "R Source Files (*.R *.Rnw *.Rd *.Rmd *.Rrst)\t*.R;*.Rnw;*.Rd;*.Rmd;*.Rrst\n" .
+        \ "All Files (*.*)\t*.*\n"
 endif
 
-call RSourceOtherScripts()
-
-let &cpo = s:cpo_save
-unlet s:cpo_save
-
 if exists('b:undo_ftplugin')
-  let b:undo_ftplugin .= "|setl isk< | unlet! b:IsInRCode b:SourceLines b:PreviousRChunk b:NextRChunk b:SendChunkToR"
+  let b:undo_ftplugin .= " | setl isk< sua< com< | unlet! b:browsefilter"
 else
-  let b:undo_ftplugin = "setl isk< | unlet! b:IsInRCode b:SourceLines b:PreviousRChunk b:NextRChunk b:SendChunkToR"
+  let b:undo_ftplugin = "setl isk< sua< com< | unlet! b:browsefilter"
 endif
 
+let &cpo = s:cpo_save
+unlet s:cpo_save
diff --git a/ftplugin/rnoweb_rplugin.vim b/ftplugin/rnoweb_rplugin.vim
new file mode 100644
index 0000000..0393cfe
--- /dev/null
+++ b/ftplugin/rnoweb_rplugin.vim
@@ -0,0 +1,249 @@
+
+if exists("g:disable_r_ftplugin")
+    finish
+endif
+
+" Source scripts common to R, Rnoweb, Rhelp and Rdoc:
+runtime r-plugin/common_global.vim
+if exists("g:rplugin_failed")
+    finish
+endif
+
+" Some buffer variables common to R, Rnoweb, Rhelp and Rdoc need to be defined
+" after the global ones:
+runtime r-plugin/common_buffer.vim
+
+function! RWriteChunk()
+    if getline(".") =~ "^\\s*$" && RnwIsInRCode(0) == 0
+        call setline(line("."), "<<>>=")
+        exe "normal! o@"
+        exe "normal! 0kl"
+    else
+        exe "normal! a<"
+    endif
+endfunction
+
+function! RnwIsInRCode(vrb)
+    let chunkline = search("^<<", "bncW")
+    let docline = search("^@", "bncW")
+    if chunkline > docline && chunkline != line(".")
+        return 1
+    else
+        if a:vrb
+            call RWarningMsg("Not inside an R code chunk.")
+        endif
+        return 0
+    endif
+endfunction
+
+function! RnwPreviousChunk() range
+    let rg = range(a:firstline, a:lastline)
+    let chunk = len(rg)
+    for var in range(1, chunk)
+        let curline = line(".")
+        if RnwIsInRCode(0)
+            let i = search("^<<.*$", "bnW")
+            if i != 0
+                call cursor(i-1, 1)
+            endif
+        endif
+        let i = search("^<<.*$", "bnW")
+        if i == 0
+            call cursor(curline, 1)
+            call RWarningMsg("There is no previous R code chunk to go.")
+            return
+        else
+            call cursor(i+1, 1)
+        endif
+    endfor
+    return
+endfunction
+
+function! RnwNextChunk() range
+    let rg = range(a:firstline, a:lastline)
+    let chunk = len(rg)
+    for var in range(1, chunk)
+        let i = search("^<<.*$", "nW")
+        if i == 0
+            call RWarningMsg("There is no next R code chunk to go.")
+            return
+        else
+            call cursor(i+1, 1)
+        endif
+    endfor
+    return
+endfunction
+
+" Sweave and compile the current buffer content
+function! RMakePDF(bibtex, knit)
+    if g:rplugin_vimcomport == 0
+        exe "Py DiscoverVimComPort()"
+        if g:rplugin_vimcomport == 0
+            call RWarningMsg("The vimcom package is required to make and open the PDF.")
+        endif
+    endif
+    update
+    call RSetWD()
+    let pdfcmd = "vim.interlace.rnoweb('" . expand("%:t") . "'"
+
+    if a:knit
+        let pdfcmd = pdfcmd . ', knit = TRUE'
+    endif
+
+    if g:vimrplugin_latexcmd != "pdflatex"
+        let pdfcmd = pdfcmd . ", latexcmd = '" . g:vimrplugin_latexcmd . "'"
+    endif
+
+    if a:bibtex == "bibtex"
+        let pdfcmd = pdfcmd . ", bibtex = TRUE"
+    endif
+
+    if a:bibtex == "verbose"
+        let pdfcmd = pdfcmd . ", quiet = FALSE"
+    endif
+
+    if g:vimrplugin_openpdf == 0
+        let pdfcmd = pdfcmd . ", view = FALSE"
+    endif
+
+    if g:vimrplugin_openpdf_quietly
+        let pdfcmd = pdfcmd . ", pdfquiet = TRUE"
+    endif
+
+    if a:knit == 0 && exists("g:vimrplugin_sweaveargs")
+        let pdfcmd = pdfcmd . ", " . g:vimrplugin_sweaveargs
+    endif
+
+    let pdfcmd = pdfcmd . ")"
+    let ok = g:SendCmdToR(pdfcmd)
+    if ok == 0
+        return
+    endif
+endfunction  
+
+" Send Sweave chunk to R
+function! RnwSendChunkToR(e, m)
+    if RnwIsInRCode(0) == 0
+        call RWarningMsg("Not inside an R code chunk.")
+        return
+    endif
+    let chunkline = search("^<<", "bncW") + 1
+    let docline = search("^@", "ncW") - 1
+    let lines = getline(chunkline, docline)
+    let ok = RSourceLines(lines, a:e)
+    if ok == 0
+        return
+    endif
+    if a:m == "down"
+        call RnwNextChunk()
+    endif  
+endfunction
+
+" Sweave the current buffer content
+function! RSweave()
+    update
+    call RSetWD()
+    if exists("g:vimrplugin_sweaveargs")
+        call g:SendCmdToR('Sweave("' . expand("%:t") . '", ' . g:vimrplugin_sweaveargs . ')')
+    else
+        call g:SendCmdToR('Sweave("' . expand("%:t") . '")')
+    endif
+endfunction
+
+function! ROpenPDF()
+    if has("win32") || has("win64")
+        exe 'Py OpenPDF("' . expand("%:t:r") . '.pdf")'
+        return
+    endif
+
+    if !exists("g:rplugin_pdfviewer")
+        let g:rplugin_pdfviewer = "none"
+        if has("gui_macvim") || has("gui_mac") || has("mac") || has("macunix")
+            if $R_PDFVIEWER == ""
+                let pdfvl = ["open"]
+            else
+                let pdfvl = [$R_PDFVIEWER, "open"]
+            endif
+        else
+            if $R_PDFVIEWER == ""
+                let pdfvl = ["xdg-open"]
+            else
+                let pdfvl = [$R_PDFVIEWER, "xdg-open"]
+            endif
+        endif
+        " List from R configure script:
+        let pdfvl += ["evince", "okular", "xpdf", "gv", "gnome-gv", "ggv", "kpdf", "gpdf", "kghostview,", "acroread", "acroread4"]
+        for prog in pdfvl
+            if executable(prog)
+                let g:rplugin_pdfviewer = prog
+                break
+            endif
+        endfor
+    endif
+
+    if g:rplugin_pdfviewer == "none"
+        if g:vimrplugin_openpdf_quietly
+            call g:SendCmdToR('vim.openpdf("' . expand("%:p:r") . ".pdf" . '", TRUE)')
+        else
+            call g:SendCmdToR('vim.openpdf("' . expand("%:p:r") . ".pdf" . '")')
+        endif
+    else
+        let openlog = system(g:rplugin_pdfviewer . " '" . expand("%:p:r") . ".pdf" . "'")
+        if v:shell_error
+            let rlog = substitute(openlog, "\n", " ", "g")
+            let rlog = substitute(openlog, "\r", " ", "g")
+            call RWarningMsg(openlog)
+        endif
+    endif
+endfunction
+
+if g:vimrplugin_rnowebchunk == 1
+    " Write code chunk in rnoweb files
+    imap  < :call RWriteChunk()a
+endif
+
+" Pointers to functions whose purposes are the same in rnoweb, rrst, rmd,
+" rhelp and rdoc and which are called at common_global.vim
+let b:IsInRCode = function("RnwIsInRCode")
+let b:PreviousRChunk = function("RnwPreviousChunk")
+let b:NextRChunk = function("RnwNextChunk")
+let b:SendChunkToR = function("RnwSendChunkToR")
+
+" Pointers to functions that must be different if the plugin is used as a
+" global one:
+let b:SourceLines = function("RSourceLines")
+
+
+"==========================================================================
+" Key bindings and menu items
+
+call RCreateStartMaps()
+call RCreateEditMaps()
+call RCreateSendMaps()
+call RControlMaps()
+call RCreateMaps("nvi", 'RSetwd',        'rd', ':call RSetWD()')
+
+" Only .Rnw files use these functions:
+call RCreateMaps("nvi", 'RSweave',      'sw', ':call RSweave()')
+call RCreateMaps("nvi", 'RMakePDF',     'sp', ':call RMakePDF("nobib", 0)')
+call RCreateMaps("nvi", 'RBibTeX',      'sb', ':call RMakePDF("bibtex", 0)')
+call RCreateMaps("nvi", 'RKnit',        'kn', ':call RKnit()')
+call RCreateMaps("nvi", 'RMakePDFK',    'kp', ':call RMakePDF("nobib", 1)')
+call RCreateMaps("nvi", 'RBibTeXK',     'kb', ':call RMakePDF("bibtex", 1)')
+call RCreateMaps("nvi", 'ROpenPDF',     'op', ':call ROpenPDF()')
+call RCreateMaps("nvi", 'RIndent',      'si', ':call RnwToggleIndentSty()')
+call RCreateMaps("ni",  'RSendChunk',   'cc', ':call b:SendChunkToR("silent", "stay")')
+call RCreateMaps("ni",  'RESendChunk',  'ce', ':call b:SendChunkToR("echo", "stay")')
+call RCreateMaps("ni",  'RDSendChunk',  'cd', ':call b:SendChunkToR("silent", "down")')
+call RCreateMaps("ni",  'REDSendChunk', 'ca', ':call b:SendChunkToR("echo", "down")')
+nmap  gn :call RnwNextChunk()
+nmap  gN :call RnwPreviousChunk()
+
+" Menu R
+if has("gui_running")
+    call MakeRMenu()
+endif
+
+call RSourceOtherScripts()
+
+let b:undo_ftplugin .= " | unlet! b:IsInRCode b:SourceLines b:PreviousRChunk b:NextRChunk b:SendChunkToR"
diff --git a/ftplugin/rrst.vim b/ftplugin/rrst.vim
index 2bc1712..f9a0c17 100644
--- a/ftplugin/rrst.vim
+++ b/ftplugin/rrst.vim
@@ -1,27 +1,11 @@
-"  This program is free software; you can redistribute it and/or modify
-"  it under the terms of the GNU General Public License as published by
-"  the Free Software Foundation; either version 2 of the License, or
-"  (at your option) any later version.
-"
-"  This program is distributed in the hope that it will be useful,
-"  but WITHOUT ANY WARRANTY; without even the implied warranty of
-"  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-"  GNU General Public License for more details.
-"
-"  A copy of the GNU General Public License is available at
-"  http://www.r-project.org/Licenses/
-
-"==========================================================================
-" ftplugin for Rrst files
-"
-" Authors: Jakson Alves de Aquino 
-"          Jose Claudio Faria
-"          Alex Zvoleff
-"
-"==========================================================================
+" Vim filetype plugin file
+" Language: reStructuredText documentation format with R code
+" Maintainer: Jakson Alves de Aquino 
+" Last Change:	Sun Feb 23, 2014  04:07PM
+" Original work by Alex Zvoleff
 
 " Only do this when not yet done for this buffer
-if exists("b:did_ftplugin") || exists("disable_r_ftplugin")
+if exists("b:did_ftplugin")
     finish
 endif
 
@@ -31,203 +15,21 @@ let b:did_ftplugin = 1
 let s:cpo_save = &cpo
 set cpo&vim
 
-" Source scripts common to R, Rrst, Rnoweb, Rhelp and Rdoc:
-runtime r-plugin/common_global.vim
-if exists("g:rplugin_failed")
-    finish
-endif
-
 setlocal comments=fb:*,fb:-,fb:+,n:> commentstring=>\ %s
 setlocal formatoptions+=tcqln
 setlocal formatlistpat=^\\s*\\d\\+\\.\\s\\+\\\|^\\s*[-*+]\\s\\+
 setlocal iskeyword=@,48-57,_,.
 
-" Some buffer variables common to R, Rrst, Rnoweb, Rhelp and Rdoc need to be 
-" defined after the global ones:
-runtime r-plugin/common_buffer.vim
-
-function! RrstIsInRCode(vrb)
-    let chunkline = search("^\\.\\. {r", "bncW")
-    let docline = search("^\\.\\. \\.\\.", "bncW")
-    if chunkline > docline && chunkline != line(".")
-        return 1
-    else
-        if a:vrb
-            call RWarningMsg("Not inside an R code chunk.")
-        endif
-        return 0
-    endif
-endfunction
-
-function! RrstPreviousChunk() range
-    let rg = range(a:firstline, a:lastline)
-    let chunk = len(rg)
-    for var in range(1, chunk)
-        let curline = line(".")
-        if RrstIsInRCode(0)
-            let i = search("^\\.\\. {r", "bnW")
-            if i != 0
-                call cursor(i-1, 1)
-            endif
-        endif
-        let i = search("^\\.\\. {r", "bnW")
-        if i == 0
-            call cursor(curline, 1)
-            call RWarningMsg("There is no previous R code chunk to go.")
-            return
-        else
-            call cursor(i+1, 1)
-        endif
-    endfor
-    return
-endfunction
-
-function! RrstNextChunk() range
-    let rg = range(a:firstline, a:lastline)
-    let chunk = len(rg)
-    for var in range(1, chunk)
-        let i = search("^\\.\\. {r", "nW")
-        if i == 0
-            call RWarningMsg("There is no next R code chunk to go.")
-            return
-        else
-            call cursor(i+1, 1)
-        endif
-    endfor
-    return
-endfunction
-
-function! RMakeHTMLrrst(t)
-    call RSetWD()
-    update
-    if g:rplugin_has_rst2pdf == 0
-        if executable("rst2pdf")
-            let g:rplugin_has_rst2pdf = 1
-        else
-            call RWarningMsg("Is 'rst2pdf' application installed? Cannot convert into HTML/ODT: 'rst2pdf' executable not found.")
-            return
-        endif
-    endif
-
-    let rcmd = 'require(knitr)'
-    if g:vimrplugin_strict_rst
-        let rcmd = rcmd . '; render_rst(strict=TRUE)'
-    endif
-    let rcmd = rcmd . '; knit("' . expand("%:t") . '")'
-    
-    if a:t == "odt"
-        let rcmd = rcmd . '; system("rst2odt ' . expand("%:r:t") . ".rst " . expand("%:r:t") . '.odt")'
-    else
-        let rcmd = rcmd . '; system("rst2html ' . expand("%:r:t") . ".rst " . expand("%:r:t") . '.html")'
-    endif
-
-    if g:vimrplugin_openhtml && a:t == "html"
-        let rcmd = rcmd . '; browseURL("' . expand("%:r:t") . '.html")'
-    endif
-    call g:SendCmdToR(rcmd)
-endfunction
-
-function! RMakePDFrrst()
-    if g:rplugin_vimcomport == 0
-        exe "Py DiscoverVimComPort()"
-        if g:rplugin_vimcomport == 0
-            call RWarningMsg("The vimcom package is required to make and open the PDF.")
-        endif
-    endif
-    update
-    call RSetWD()
-    if g:rplugin_has_rst2pdf == 0
-        if exists("g:vimrplugin_rst2pdfpath") && executable(g:vimrplugin_rst2pdfpath)
-            let g:rplugin_has_rst2pdf = 1
-        elseif executable("rst2pdf")
-            let g:rplugin_has_rst2pdf = 1
-        else
-            call RWarningMsg("Is 'rst2pdf' application installed? Cannot convert into PDF: 'rst2pdf' executable not found.")
-            return
-        endif
-    endif
-
-    let pdfcmd = "vim.interlace.rrst('" . expand("%:t") . "'"
-    if exists("g:vimrplugin_rrstcompiler")
-        let pdfcmd = pdfcmd . ", compiler='" . g:vimrplugin_rrstcompiler . "'"
-    endif
-    if exists("g:vimrplugin_knitargs")
-        let pdfcmd = pdfcmd . ", " . g:vimrplugin_knitargs
-    endif
-    if exists("g:vimrplugin_rst2pdfpath")
-        let pdfcmd = pdfcmd . ", rst2pdfpath='" . g:vimrplugin_rst2pdfpath . "'"
-    endif
-    if exists("g:vimrplugin_rst2pdfargs")
-        let pdfcmd = pdfcmd . ", " . g:vimrplugin_rst2pdfargs
-    endif
-    let pdfcmd = pdfcmd . ")"
-    let ok = g:SendCmdToR(pdfcmd)
-    if ok == 0
-        return
-    endif
-endfunction  
-
-" Send Rrst chunk to R
-function! SendRrstChunkToR(e, m)
-    if RrstIsInRCode(0) == 0
-        call RWarningMsg("Not inside an R code chunk.")
-        return
-    endif
-    let chunkline = search("^\\.\\. {r", "bncW") + 1
-    let docline = search("^\\.\\. \\.\\.", "ncW") - 1
-    let lines = getline(chunkline, docline)
-    let ok = RSourceLines(lines, a:e)
-    if ok == 0
-        return
-    endif
-    if a:m == "down"
-        call RrstNextChunk()
-    endif  
-endfunction
-
-let b:IsInRCode = function("RrstIsInRCode")
-let b:PreviousRChunk = function("RrstPreviousChunk")
-let b:NextRChunk = function("RrstNextChunk")
-let b:SendChunkToR = function("SendRrstChunkToR")
-let b:SourceLines = function("RSourceLines")
-
-"==========================================================================
-" Key bindings and menu items
-
-call RCreateStartMaps()
-call RCreateEditMaps()
-call RCreateSendMaps()
-call RControlMaps()
-call RCreateMaps("nvi", 'RSetwd',        'rd', ':call RSetWD()')
-
-" Only .Rrst files use these functions:
-call RCreateMaps("nvi", 'RKnit',        'kn', ':call RKnit()')
-call RCreateMaps("nvi", 'RMakePDFK',    'kp', ':call RMakePDFrrst()')
-call RCreateMaps("nvi", 'RMakeHTML',    'kh', ':call RMakeHTMLrrst("html")')
-call RCreateMaps("nvi", 'RMakeODT',     'ko', ':call RMakeHTMLrrst("odt")')
-call RCreateMaps("nvi", 'RIndent',      'si', ':call RrstToggleIndentSty()')
-call RCreateMaps("ni",  'RSendChunk',   'cc', ':call b:SendChunkToR("silent", "stay")')
-call RCreateMaps("ni",  'RESendChunk',  'ce', ':call b:SendChunkToR("echo", "stay")')
-call RCreateMaps("ni",  'RDSendChunk',  'cd', ':call b:SendChunkToR("silent", "down")')
-call RCreateMaps("ni",  'REDSendChunk', 'ca', ':call b:SendChunkToR("echo", "down")')
-nmap  gn :call b:NextRChunk()
-nmap  gN :call b:PreviousRChunk()
-
-" Menu R
-if has("gui_running")
-    call MakeRMenu()
+if has("gui_win32") && !exists("b:browsefilter")
+  let b:browsefilter = "R Source Files (*.R *.Rnw *.Rd *.Rmd *.Rrst)\t*.R;*.Rnw;*.Rd;*.Rmd;*.Rrst\n" .
+        \ "All Files (*.*)\t*.*\n"
 endif
 
-let g:rplugin_has_rst2pdf = 0
-
-call RSourceOtherScripts()
-
-let &cpo = s:cpo_save
-unlet s:cpo_save
-
 if exists('b:undo_ftplugin')
-  let b:undo_ftplugin .= "|setl cms< com< fo< flp< isk< | unlet! b:IsInRCode b:SourceLines b:PreviousRChunk b:NextRChunk b:SendChunkToR"
+  let b:undo_ftplugin .= " | setl cms< com< fo< flp< isk< | unlet! b:browsefilter"
 else
-  let b:undo_ftplugin = "setl cms< com< fo< flp< isk< | unlet! b:IsInRCode b:SourceLines b:PreviousRChunk b:NextRChunk b:SendChunkToR"
+  let b:undo_ftplugin = "setl cms< com< fo< flp< isk< | unlet! b:browsefilter"
 endif
 
+let &cpo = s:cpo_save
+unlet s:cpo_save
diff --git a/ftplugin/rrst_rplugin.vim b/ftplugin/rrst_rplugin.vim
new file mode 100644
index 0000000..88025f1
--- /dev/null
+++ b/ftplugin/rrst_rplugin.vim
@@ -0,0 +1,192 @@
+
+if exists("g:disable_r_ftplugin")
+    finish
+endif
+
+" Source scripts common to R, Rrst, Rnoweb, Rhelp and Rdoc:
+runtime r-plugin/common_global.vim
+if exists("g:rplugin_failed")
+    finish
+endif
+
+" Some buffer variables common to R, Rrst, Rnoweb, Rhelp and Rdoc need to be 
+" defined after the global ones:
+runtime r-plugin/common_buffer.vim
+
+function! RrstIsInRCode(vrb)
+    let chunkline = search("^\\.\\. {r", "bncW")
+    let docline = search("^\\.\\. \\.\\.", "bncW")
+    if chunkline > docline && chunkline != line(".")
+        return 1
+    else
+        if a:vrb
+            call RWarningMsg("Not inside an R code chunk.")
+        endif
+        return 0
+    endif
+endfunction
+
+function! RrstPreviousChunk() range
+    let rg = range(a:firstline, a:lastline)
+    let chunk = len(rg)
+    for var in range(1, chunk)
+        let curline = line(".")
+        if RrstIsInRCode(0)
+            let i = search("^\\.\\. {r", "bnW")
+            if i != 0
+                call cursor(i-1, 1)
+            endif
+        endif
+        let i = search("^\\.\\. {r", "bnW")
+        if i == 0
+            call cursor(curline, 1)
+            call RWarningMsg("There is no previous R code chunk to go.")
+            return
+        else
+            call cursor(i+1, 1)
+        endif
+    endfor
+    return
+endfunction
+
+function! RrstNextChunk() range
+    let rg = range(a:firstline, a:lastline)
+    let chunk = len(rg)
+    for var in range(1, chunk)
+        let i = search("^\\.\\. {r", "nW")
+        if i == 0
+            call RWarningMsg("There is no next R code chunk to go.")
+            return
+        else
+            call cursor(i+1, 1)
+        endif
+    endfor
+    return
+endfunction
+
+function! RMakeHTMLrrst(t)
+    call RSetWD()
+    update
+    if g:rplugin_has_rst2pdf == 0
+        if executable("rst2pdf")
+            let g:rplugin_has_rst2pdf = 1
+        else
+            call RWarningMsg("Is 'rst2pdf' application installed? Cannot convert into HTML/ODT: 'rst2pdf' executable not found.")
+            return
+        endif
+    endif
+
+    let rcmd = 'require(knitr)'
+    if g:vimrplugin_strict_rst
+        let rcmd = rcmd . '; render_rst(strict=TRUE)'
+    endif
+    let rcmd = rcmd . '; knit("' . expand("%:t") . '")'
+    
+    if a:t == "odt"
+        let rcmd = rcmd . '; system("rst2odt ' . expand("%:r:t") . ".rst " . expand("%:r:t") . '.odt")'
+    else
+        let rcmd = rcmd . '; system("rst2html ' . expand("%:r:t") . ".rst " . expand("%:r:t") . '.html")'
+    endif
+
+    if g:vimrplugin_openhtml && a:t == "html"
+        let rcmd = rcmd . '; browseURL("' . expand("%:r:t") . '.html")'
+    endif
+    call g:SendCmdToR(rcmd)
+endfunction
+
+function! RMakePDFrrst()
+    if g:rplugin_vimcomport == 0
+        exe "Py DiscoverVimComPort()"
+        if g:rplugin_vimcomport == 0
+            call RWarningMsg("The vimcom package is required to make and open the PDF.")
+        endif
+    endif
+    update
+    call RSetWD()
+    if g:rplugin_has_rst2pdf == 0
+        if exists("g:vimrplugin_rst2pdfpath") && executable(g:vimrplugin_rst2pdfpath)
+            let g:rplugin_has_rst2pdf = 1
+        elseif executable("rst2pdf")
+            let g:rplugin_has_rst2pdf = 1
+        else
+            call RWarningMsg("Is 'rst2pdf' application installed? Cannot convert into PDF: 'rst2pdf' executable not found.")
+            return
+        endif
+    endif
+
+    let pdfcmd = "vim.interlace.rrst('" . expand("%:t") . "'"
+    if exists("g:vimrplugin_rrstcompiler")
+        let pdfcmd = pdfcmd . ", compiler='" . g:vimrplugin_rrstcompiler . "'"
+    endif
+    if exists("g:vimrplugin_knitargs")
+        let pdfcmd = pdfcmd . ", " . g:vimrplugin_knitargs
+    endif
+    if exists("g:vimrplugin_rst2pdfpath")
+        let pdfcmd = pdfcmd . ", rst2pdfpath='" . g:vimrplugin_rst2pdfpath . "'"
+    endif
+    if exists("g:vimrplugin_rst2pdfargs")
+        let pdfcmd = pdfcmd . ", " . g:vimrplugin_rst2pdfargs
+    endif
+    let pdfcmd = pdfcmd . ")"
+    let ok = g:SendCmdToR(pdfcmd)
+    if ok == 0
+        return
+    endif
+endfunction  
+
+" Send Rrst chunk to R
+function! SendRrstChunkToR(e, m)
+    if RrstIsInRCode(0) == 0
+        call RWarningMsg("Not inside an R code chunk.")
+        return
+    endif
+    let chunkline = search("^\\.\\. {r", "bncW") + 1
+    let docline = search("^\\.\\. \\.\\.", "ncW") - 1
+    let lines = getline(chunkline, docline)
+    let ok = RSourceLines(lines, a:e)
+    if ok == 0
+        return
+    endif
+    if a:m == "down"
+        call RrstNextChunk()
+    endif  
+endfunction
+
+let b:IsInRCode = function("RrstIsInRCode")
+let b:PreviousRChunk = function("RrstPreviousChunk")
+let b:NextRChunk = function("RrstNextChunk")
+let b:SendChunkToR = function("SendRrstChunkToR")
+let b:SourceLines = function("RSourceLines")
+
+"==========================================================================
+" Key bindings and menu items
+
+call RCreateStartMaps()
+call RCreateEditMaps()
+call RCreateSendMaps()
+call RControlMaps()
+call RCreateMaps("nvi", 'RSetwd',        'rd', ':call RSetWD()')
+
+" Only .Rrst files use these functions:
+call RCreateMaps("nvi", 'RKnit',        'kn', ':call RKnit()')
+call RCreateMaps("nvi", 'RMakePDFK',    'kp', ':call RMakePDFrrst()')
+call RCreateMaps("nvi", 'RMakeHTML',    'kh', ':call RMakeHTMLrrst("html")')
+call RCreateMaps("nvi", 'RMakeODT',     'ko', ':call RMakeHTMLrrst("odt")')
+call RCreateMaps("nvi", 'RIndent',      'si', ':call RrstToggleIndentSty()')
+call RCreateMaps("ni",  'RSendChunk',   'cc', ':call b:SendChunkToR("silent", "stay")')
+call RCreateMaps("ni",  'RESendChunk',  'ce', ':call b:SendChunkToR("echo", "stay")')
+call RCreateMaps("ni",  'RDSendChunk',  'cd', ':call b:SendChunkToR("silent", "down")')
+call RCreateMaps("ni",  'REDSendChunk', 'ca', ':call b:SendChunkToR("echo", "down")')
+nmap  gn :call b:NextRChunk()
+nmap  gN :call b:PreviousRChunk()
+
+" Menu R
+if has("gui_running")
+    call MakeRMenu()
+endif
+
+let g:rplugin_has_rst2pdf = 0
+
+call RSourceOtherScripts()
+
+let b:undo_ftplugin .= " | unlet! b:IsInRCode b:SourceLines b:PreviousRChunk b:NextRChunk b:SendChunkToR"
diff --git a/list_for_vimball b/list_for_vimball
index c7956cd..fc264ba 100644
--- a/list_for_vimball
+++ b/list_for_vimball
@@ -2,12 +2,17 @@ autoload/rcomplete.vim
 doc/r-plugin.txt
 ftdetect/r.vim
 ftplugin/r.vim
+ftplugin/r_rplugin.vim
 ftplugin/rbrowser.vim
 ftplugin/rdoc.vim
 ftplugin/rhelp.vim
+ftplugin/rhelp_rplugin.vim
 ftplugin/rmd.vim
+ftplugin/rmd_rplugin.vim
 ftplugin/rnoweb.vim
+ftplugin/rnoweb_rplugin.vim
 ftplugin/rrst.vim
+ftplugin/rrst_rplugin.vim
 indent/r.vim
 indent/rhelp.vim
 indent/rmd.vim

From ed465e4f9516da2ec0b39ce5026342a51d4753ae Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Mon, 24 Feb 2014 21:08:38 -0300
Subject: [PATCH 0613/1050] Delete deprecated code.

---
 r-plugin/common_global.vim | 19 -------------------
 1 file changed, 19 deletions(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 9c80ce1..a774a92 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -3027,9 +3027,6 @@ command -nargs=? -complete=customlist,RLisObjs Rhelp :call RAskHelp()
 command -nargs=? -complete=dir RSourceDir :call RSourceDirectory()
 command RpluginConfig :runtime r-plugin/vimrconfig.vim
 
-" TODO: Delete these two commands (Nov 2013):
-command RUpdateObjList :call RWarningMsg("This command is deprecated. Now the list of objects is automatically updated by the R package vimcom.plus.")
-command -nargs=? RAddLibToList :call RWarningMsg("This command is deprecated. Now the list of objects is automatically updated by the R package vimcom.plus.")
 
 "==========================================================================
 " Global variables
@@ -3366,27 +3363,11 @@ if g:rplugin_home != g:rplugin_uservimfiles
     endif
 endif
 
-" If there is no functions.vim, copy the default one
-if !filereadable(g:rplugin_uservimfiles . "/r-plugin/functions.vim")
-    if filereadable("/usr/share/vim/addons/r-plugin/functions.vim")
-        let ffile = readfile("/usr/share/vim/addons/r-plugin/functions.vim")
-        call writefile(ffile, g:rplugin_uservimfiles . "/r-plugin/functions.vim")
-        unlet ffile
-    else
-        if g:rplugin_home != g:rplugin_uservimfiles && filereadable(g:rplugin_home . "/r-plugin/functions.vim")
-            let ffile = readfile(g:rplugin_home . "/r-plugin/functions.vim")
-            call writefile(ffile, g:rplugin_uservimfiles . "/r-plugin/functions.vim")
-            unlet ffile
-        endif
-    endif
-endif
-
 " Minimum width for the Object Browser
 if g:vimrplugin_objbr_w < 10
     let g:vimrplugin_objbr_w = 10
 endif
 
-
 " Control the menu 'R' and the tool bar buttons
 if !exists("g:rplugin_hasmenu")
     let g:rplugin_hasmenu = 0

From 520e5d7528ec6f415d586acd1add0d8c50b57bf3 Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Mon, 24 Feb 2014 21:09:02 -0300
Subject: [PATCH 0614/1050] Add r-plugin/functions.vim to released packages.

---
 Makefile         | 1 +
 list_for_vimball | 1 +
 2 files changed, 2 insertions(+)

diff --git a/Makefile b/Makefile
index 2060c77..58ec27c 100644
--- a/Makefile
+++ b/Makefile
@@ -81,6 +81,7 @@ deb:
 	  - r-plugin/global_r_plugin.vim\n\
 	  - r-plugin/tex_indent.vim\n\
 	  - r-plugin/vimrconfig.vim\n\
+	  - r-plugin/functions.vim\n\
 	  - syntax/r.vim\n\
 	  - syntax/rdoc.vim\n\
 	  - syntax/rout.vim\n\
diff --git a/list_for_vimball b/list_for_vimball
index fc264ba..954f887 100644
--- a/list_for_vimball
+++ b/list_for_vimball
@@ -27,6 +27,7 @@ r-plugin/tex_indent.vim
 r-plugin/vimcom.py
 r-plugin/vimrconfig.vim
 r-plugin/windows.py
+r-plugin/functions.vim
 syntax/r.vim
 syntax/rbrowser.vim
 syntax/rdoc.vim

From 4c0f02506183615d36e0f8a9930ccb44d8b96fb6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?David=20B=C3=BCrgin?= <676c7473@gmail.com>
Date: Fri, 28 Feb 2014 12:41:42 +0100
Subject: [PATCH 0615/1050] Improved ftplugin settings for comments

---
 ftplugin/r.vim | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ftplugin/r.vim b/ftplugin/r.vim
index 514710e..527e5d3 100644
--- a/ftplugin/r.vim
+++ b/ftplugin/r.vim
@@ -16,8 +16,8 @@ set cpo&vim
 
 setlocal iskeyword=@,48-57,_,.
 setlocal formatoptions-=t
-setlocal commentstring=#%s
-setlocal comments=b:#,b:##,b:###,b:#'
+setlocal commentstring=#\ %s
+setlocal comments=:#,:##,:###,:#'
 
 if has("gui_win32") && !exists("b:browsefilter")
   let b:browsefilter = "R Source Files (*.R)\t*.R\n" .

From 26dafdf5bdcb789d160df15ae7185574ff23040f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?David=20B=C3=BCrgin?= <676c7473@gmail.com>
Date: Sat, 1 Mar 2014 16:08:06 +0100
Subject: [PATCH 0616/1050] Improved comments settings in ftplugin

---
 ftplugin/r.vim | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ftplugin/r.vim b/ftplugin/r.vim
index 527e5d3..43b208b 100644
--- a/ftplugin/r.vim
+++ b/ftplugin/r.vim
@@ -17,7 +17,7 @@ set cpo&vim
 setlocal iskeyword=@,48-57,_,.
 setlocal formatoptions-=t
 setlocal commentstring=#\ %s
-setlocal comments=:#,:##,:###,:#'
+setlocal comments=:#',:###,:##,:#
 
 if has("gui_win32") && !exists("b:browsefilter")
   let b:browsefilter = "R Source Files (*.R)\t*.R\n" .

From 771151ed74a1d3f88dec65e1a88af5f18804ced4 Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Sat, 1 Mar 2014 14:31:33 -0300
Subject: [PATCH 0617/1050] Update.

---
 doc/r-plugin.txt | 100 +++++++++++++++++++++--------------------------
 1 file changed, 45 insertions(+), 55 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 8ee208d..5e11ad3 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -120,7 +120,7 @@ Before installing the plugin, you should install its dependencies:
 
    vimcom.plus = 0.9-93: http://www.lepem.ufc.br/jaa/vimcom.plus.html
 
-   Tmux >= 1.5:   http://tmux.sourceforge.net
+   Tmux >= 1.8:   http://tmux.sourceforge.net
                   Tmux is necessary to send commands from Vim to R Console.
 
    Suggests:~
@@ -253,7 +253,7 @@ Note: If you need too install the plugin in a non default directory, do
 `:UseVimball` `[path]`. In this case, the configuration of Vim's 'runtimepath'
 must be done before the command "filetype on" in both the system and the user
 |vimrc| files, otherwise, you would have to create a symbolic link to
-`path/ftdetect/r.vim` into `~/.vim/ftdetect/r.vim`.
+`path/ftdetect/r.vim` into `~/vimfiles/ftdetect/r.vim`.
 
 Start GVim again and edit an R script. You can right click a .R file and
 choose "Edit with Vim" or create a new one with the Normal mode command:
@@ -738,9 +738,9 @@ Vim by typing:
 <
 Using the `tvim` function, the Tmux session is finished when you quits Vim.
 That is, the main advantage of using `tvim` is that you do not have to type
-`tmux` before and `exit` after the edition of the file. Moreover, the
-`tvim` command also pass the |--servername| argument to Vim, which is required
-update of the Object Browser and functions highlight.
+`tmux` before and `exit` after the edition of the file. Moreover, the `tvim`
+command also pass the |--servername| argument to Vim, which is required to
+update the Object Browser and functions highlight.
 
 If you are going to run Vim inside Tmux, than you should create your
 ~/.tmux.conf if it does not exist yet. You may put the lines below in your
@@ -805,7 +805,7 @@ terminal emulator:
 <
 Note: Because  was configured as the Tmux escape character, it will not
 be passed to applications running under Tmux. To send  to either R or Vim
-you have to type a.
+you have to type .
 
 
 4.8.3 Copying and pasting~
@@ -934,7 +934,7 @@ not inherit from Vim the environment variables VIMRPLUGIN_TMPDIR,
 VIMRPLUGIN_HOME, VIMEDITOR_SVRNM and VIMINSTANCEID. The first one is the path
 used by the R package vimcom to save temporary files used by the Vim-R-plugin
 to: perform omnicompletion, show R documentation in a Vim buffer, and update
-the Object Browser. The latter is used by the Vim-R-plugin to know that it is
+the Object Browser. The last one is used by the Vim-R-plugin to know that it is
 not connecting to an R instance initiated by another Vim instance. If you use
 Vim to start R, but then closes Vim, the VIMINSTANCEID variable in R will
 become outdated. Additionally, the Vim-R-plugin sets the value of its internal
@@ -1024,7 +1024,7 @@ is running:
 |vimrplugin_ca_ck|             Add ^A^K to the beginning of commands
 |vimrplugin_openpdf|           Open PDF after processing rnoweb file
 |vimrplugin_openpdf_quietly|   Open PDF quietly
-|vimrplugin_openhtml|          Open PDF quietly
+|vimrplugin_openhtml|          Open HTML after processing either Rrst or Rmd
 |vimrplugin_strict_rst|        Code style for generated rst files
 |vimrplugin_insert_mode_cmds|  Allow R commands in insert mode
 |vimrplugin_allnames|          Show names which begin with a dot
@@ -1109,8 +1109,8 @@ Note: If you are using Vim in a terminal emulator, you have to put in your
 <
 where `^[` is obtained by pressing CTRL-V CTRL-[ in Insert mode.
 
-Note: You can't map , as StatET does because only alphabetic letters can
-be mapped in combination with the CTRL key.
+Note: You can't map , as StatET does because in Vim only alphabetic
+letters can be mapped in combination with the CTRL key.
 
 To completely disable this feature, put in your |vimrc|:
 >
@@ -1131,7 +1131,7 @@ browser's default width by setting the value of |vimrplugin_objbr_w| in your
 The Object Browser will always be created by splitting the Vim script window
 if you are running either GVim or Vim not inside a Tmux session. However, if
 running Vim in a terminal emulator inside a Tmux session, the Object Browser
-will be created in a independent Vim instance in a Tmux panel beside the R
+will be created in an independent Vim instance in a Tmux panel beside the R
 Console. Valid values for the Object Browser placement are "script" or
 "console" and "right" or "left" separated by a comma. Examples:
 >
@@ -1171,7 +1171,7 @@ document.
 The valid values of vimrplugin_vimpager are:
 
    "tab"       : Show the help document in a new tab. If there is already a
-                 tab with an R help document, use it.
+                 tab with an R help document tab, use it.
                  This is the default.
    "vertical"  : Split the window vertically if the editor width is large
                  enough; otherwise, split the window horizontally and attempt
@@ -1302,7 +1302,7 @@ put in your |vimrc|:
    let vimrplugin_notmuxconf = 1
 <
 If you opted for using your own configuration file, the plugin will write a
-minimum configuration which will set the value of two environment variables
+minimum configuration which will set the value of four environment variables
 required for the communication with R and then source your own configuration
 file (~/.tmux.conf).
 
@@ -1369,11 +1369,12 @@ Example:
 6.19. LaTeX command~
 							 *vimrplugin_latexcmd*
 						       *vimrplugin_sweaveargs*
-On Windows, the plugin calls `tools::texi2pdf()` to build the pdf from the
-generated .tex file. On Linux/Unix, by default, Vim calls `latexmk` `-pdf` to
-produce a pdf document from the .tex file produced by either `Sweave()` or
-`knit()` command. If `latexmk` is not installed, it calls `pdflatex`. You can
-use the option vimrplugin_latexcmd to change this behavior. Example:
+On Windows, the vimcom.plus package calls `tools::texi2dvi()` to build the pdf
+from the generated .tex file. On Linux/Unix, by default, it calls
+`latexmk` `-pdf` to produce a pdf document from the .tex file produced by
+either `Sweave()` or `knit()` command. If `latexmk` is not installed, it calls
+`pdflatex`. You can use the option vimrplugin_latexcmd to change this
+behavior. Example:
 >
    let vimrplugin_latexcmd = "latex"
 <
@@ -1383,7 +1384,7 @@ vimrplugin_sweaveargs variable.
 
 6.20. Never unmake the R menu~
 						*vimrplugin_never_unmake_menu*
-Use this option if you want that the menu item R is not deleted when you
+Use this option if you want that the "R" menu item is not deleted when you
 change from one buffer to another, for example, when going from an .R file to
 a .txt one:
 >
@@ -1416,7 +1417,7 @@ Emacs:
 6.22. Add ^A^K to the beginning of commands~
 							    *vimrplugin_ca_ck*
 When one types  in the R Console the cursor goes to the beginning of the
-line and one types  the characters to the right of the cursor are
+line and when one types  the characters to the right of the cursor are
 deleted. This is useful to avoid characters left on the R Console being mixed
 with commands sent by Vim. However, sending  may be problematic if using
 Tmux. The Vim-R-plugin will add  to every command if you put
@@ -1557,7 +1558,7 @@ do omnicompletion, put in your |vimrc|:
 <
 The preview window is not shown by default because it is more convenient to
 run  to complete the function arguments. The preview window
-will be shown only if "preview" is included in your 'completeopt'.
+will be shown only if "preview" is also included in your 'completeopt'.
 
 
 ==============================================================================
@@ -1681,25 +1682,14 @@ command.
 
 For example, if your cursor is sitting on top of the object called gender and
 you call the RAction function, with an argument such as levels, Vim will pass
-the command `levels(gender)` to R, which will show you the levels of the object
-gender.
-
-To make it even easier to use this function, you could write a custom key
-binding that would allow you to rapidly get the levels of the object under
-your cursor. Add the following to your |vimrc| to have an easy way to pass R
-the levels command:
+the command `levels(gender)` to R, which will show you the levels of the
+object gender. To make it even easier to use this and other functions, you
+could write custom key bindings in your |vimrc|, as in the examples below:
 >
    map  rk :call RAction("levels")
    map  t :call RAction("tail")
    map  h :call RAction("head")
 <
-Then if you type rk R will receive the command
->
-   levels(myObject)
-<
-You should replace rk with the key binding that you want to use
-and "levels" with the R function that you want to call.
-
 If the command that you want to send does not require an R object as argument,
 you can create a shortcut to it by following the example:
 >
@@ -1712,14 +1702,14 @@ See also: |vimrplugin_source|.
 							      *r-plugin-files*
 8. License and files~
 
-This program is free software; you can redistribute it and/or modify it under
-the terms of the GNU General Public License as published by the Free Software
-Foundation; either version 2 of the License, or (at your option) any later
-version.
+The Vim-R-plugin is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 2 of the License, or (at your option) any
+later version.
 
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+The Vim-R-plugin is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
 details.
 
 A copy of the GNU General Public License is available at
@@ -1776,7 +1766,7 @@ directory after the installation:
 9.1. Is it possible to stop R from within Vim?~
 
 Sorry, it is not possible. The plugin can only send the `quit()` command. If you
-want to stop R, you have to press ^C into R's terminal emulator.
+want to stop R, you have to press ^C into R's Console.
 
 
 9.2. Html help and custom pager~
@@ -1794,20 +1784,20 @@ and in your |vimrc| (see |vimrplugin_vimpager|):
 							  *r-plugin-showmarks*
 Vim allows you to put several marks (bookmarks) in buffers. The most commonly
 used marks are the lowercase alphabet letters. If the cursor is between any
-two marks, the plugin will send the lines between them to R. If the cursor is
-above the first mark, the plugin will send from the beginning of the file to
-the mark. If the cursor is below the last mark, the plugin will send from the
-mark to the end of the file. The mark above the cursor is included and the
-mark below is excluded from the block to be sent to R. To create a mark, press
-m in Normal mode.
+two marks, the plugin will send the lines between them to R if you press
+bb. If the cursor is above the first mark, the plugin will send
+from the beginning of the file to the mark. If the cursor is below the last
+mark, the plugin will send from the mark to the end of the file. The mark
+above the cursor is included and the mark below is excluded from the block to
+be sent to R. To create a mark, press m in Normal mode.
 
 We recommended the use of ShowMarks plugin which show what lines have marks
 defined. The plugin is available at:
 
    http://www.vim.org/scripts/script.php?script_id=152
 
-This plugin makes it possible to visually manage your marks. You may want to
-add the following two lines to your |vimrc| to customize ShowMarks behavior:
+You may want to add the following two lines to your |vimrc| to customize
+ShowMarks behavior:
 >
    let marksCloseWhenSelected = 0
    let showmarks_include = "abcdefghijklmnopqrstuvwxyz"
@@ -1987,11 +1977,11 @@ this goal:
 
 9.12. Automatic line breaks~
 
-By default, Vim breaks lines when you are typing if you reach the column
-defined by the 'textwidth' option. If you prefer that Vim does not break the R
-code automatically, breaking only comment lines, put in your |vimrc|:
+By default, while editing R code, Vim does not break lines when you are typing
+if you reach the column defined by the 'textwidth' option. If you prefer that
+Vim breaks the R code automatically put in your |vimrc|:
 >
-   autocmd FileType r setlocal formatoptions=cq
+   autocmd FileType r setlocal formatoptions+=t
 <
 
 9.13. Vim with 256 colors in a terminal emulator (Linux/Unix only)~

From 476ac7bf9f3436972c22996041b8b71787e8fe25 Mon Sep 17 00:00:00 2001
From: Michael Lerch 
Date: Sat, 1 Mar 2014 22:16:20 -0700
Subject: [PATCH 0618/1050] allow for custom executable

---
 r-plugin/global_r_plugin.vim | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/r-plugin/global_r_plugin.vim b/r-plugin/global_r_plugin.vim
index 364c68b..9d5c979 100644
--- a/r-plugin/global_r_plugin.vim
+++ b/r-plugin/global_r_plugin.vim
@@ -38,7 +38,16 @@ endfunction
 
 function SetExeCmd()
     runtime r-plugin/common_buffer.vim
-    if &filetype == "julia"
+    if exists("g:vimrplugin_exe") && exists("g:vimrplugin_quit")
+        let b:rplugin_R = g:vimrplugin_exe
+        if exists("g:vimrplugin_args")
+            let b:rplugin_r_args = g:vimrplugin_args
+        else
+            let b:rplugin_r_args = " "
+        endif
+        let b:quit_command = g:vimrplugin_quit
+        let b:SourceLines = function("SourceNotDefined")
+    elseif &filetype == "julia"
         let b:rplugin_R = "julia"
         let b:rplugin_r_args = " "
         let b:quit_command = "quit()"

From 861889bda13934b28a3d7d0196c5eacf226e4be1 Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Sun, 2 Mar 2014 08:07:57 -0300
Subject: [PATCH 0619/1050] Update the global_r_plugin.vim usage.

---
 doc/r-plugin.txt | 29 +++++++++++++++++------------
 1 file changed, 17 insertions(+), 12 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 5e11ad3..d304f47 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -173,8 +173,7 @@ installation). You should, then, quit Vim.
 Note: If you need too install the plugin in a non default directory, do
 `:UseVimball` `[path]`. In this case, the configuration of Vim's 'runtimepath'
 must be done before the command "filetype on" in both the system and the user
-|vimrc| files, otherwise, you would have to create a symbolic link to
-`path/ftdetect/r.vim` into `~/.vim/ftdetect/r.vim`.
+|vimrc| files, otherwise, some file types might not be correctly recognized.
 
 Start Vim again and edit an R script. Type rf to start R and run
 the command below to get help configuring ~/.Rprofile, ~/.vimrc, ~/.tmux.conf,
@@ -252,8 +251,7 @@ installation). You should, then, quit Vim.
 Note: If you need too install the plugin in a non default directory, do
 `:UseVimball` `[path]`. In this case, the configuration of Vim's 'runtimepath'
 must be done before the command "filetype on" in both the system and the user
-|vimrc| files, otherwise, you would have to create a symbolic link to
-`path/ftdetect/r.vim` into `~/vimfiles/ftdetect/r.vim`.
+|vimrc| files, otherwise, some file types might not be correctly recognized.
 
 Start GVim again and edit an R script. You can right click a .R file and
 choose "Edit with Vim" or create a new one with the Normal mode command:
@@ -2055,17 +2053,24 @@ on top" or a similar option provided by your desktop manager.
 9.17. Turn the R-plugin into a global plugin (Linux/Unix only)~
 							     *r-plugin-global*
 The Vim-R-plugin is a file type plugin. If you want its functionality
-available for all file types, then go to your ~/.vim/plugin directory and
-create a symbolic link to ~/.vim/r-plugin/global_r_plugin.vim. That is, type
-the following in a terminal emulator:
+available for all file types, then put in your |vimrc|:
 >
-   cd ~/.vim/plugin/
-   ln -s ../r-plugin/global_r_plugin.vim
+   source path/to/Vim-R-plugin/r-plugin/global_r_plugin.vim
 <
 You will then be able to type rf to start and rq to
-quit different command line interpreters (Julia, Python, Haskell, Ruby and
-Lisp) and d, l, ss, bb, etc to send code to the interpreter.
-
+quit different command line interpreters and d, l, ss, bb, etc to
+send code to the interpreter. If you want support for a language other than
+Julia, Python, Haskell, Ruby and Lisp, you have to set the values of
+vimrplugin_exe and vimrplugin_quit as the example below does for Octave:
+>
+   let vimrplugin_exe = "octave"
+   let vimrplugin_quit = "quit"
+<
+If you use yet another interpreter, you will want to put the commands above in
+a Vim autocommand:
+>
+   autocmd BufNewFile,BufRead *.m let vimrplugin_exe = "octave" | let vimrplugin_quit = "quit"
+<
 
 9.18. Disable syntax highlight of R functions~
 

From ac7fdb767a39afbae34d763b8888cb4167cdd7c1 Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Thu, 6 Mar 2014 10:23:53 -0300
Subject: [PATCH 0620/1050] Avoid E341 (Internal error: lalloc(0, )). The E341
 was happening with filetypes that include R (Rnoweb, Rmd, Rrst, Rhelp, and
 Rdoc) if the user had quickly sent to R two commands that load libraries. The
 second command sent to R would make the Vim-R-plugin run the Vim filetype
 command again before the first one has been processed.

---
 r-plugin/common_global.vim | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index a774a92..99aa847 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -1932,6 +1932,10 @@ function RFillLibList()
         call RUpdateFunSyntax(0)
         if &filetype != "r"
             silent exe "set filetype=" . &filetype
+            " Avoid E341 (Erro interno: lalloc(0, ))
+            if mode() == "n"
+                call feedkeys(":\")
+            endif
         endif
     endif
 endfunction

From 91fa4fbc673d3f306a75de22c06e6f868d3585c8 Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Thu, 6 Mar 2014 14:38:18 -0300
Subject: [PATCH 0621/1050] Require Vim >= 7.4 to run the Vim-R-plugin.

---
 r-plugin/common_global.vim | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 99aa847..af1ea88 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -64,6 +64,12 @@ function RWarningMsgInp(wmsg)
     let &shortmess = savedsm
 endfunction
 
+if v:version < 704
+    call RWarningMsgInp("The Vim-R-plugin requires Vim >= 7.4.")
+    let g:rplugin_failed = 1
+    finish
+endif
+
 " Set default value of some variables:
 function RSetDefaultValue(var, val)
     if !exists(a:var)

From 63683bf2b42de8df7ee71e92d0d0776ee41afd2a Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Fri, 7 Mar 2014 08:29:17 -0300
Subject: [PATCH 0622/1050] Delete old no longer needed code.

---
 r-plugin/common_global.vim | 36 +++---------------------------------
 1 file changed, 3 insertions(+), 33 deletions(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index af1ea88..7778fff 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -1948,12 +1948,6 @@ endfunction
 
 function SetRTextWidth()
     if !bufloaded(s:rdoctitle) || g:vimrplugin_newsize == 1
-        " Bug fix for Vim < 7.2.318
-        if !(has("win32") || has("win64"))
-            let curlang = v:lang
-            language C
-        endif
-
         let g:vimrplugin_newsize = 0
 
         " s:vimpager is used to calculate the width of the R help documentation
@@ -1992,9 +1986,6 @@ function SetRTextWidth()
         let htw = printf("%f", htwf)
         let g:rplugin_htw = substitute(htw, "\\..*", "", "")
         let g:rplugin_htw = g:rplugin_htw - (&number || &relativenumber) * &numberwidth
-        if !(has("win32") || has("win64"))
-            exe "language " . curlang
-        endif
     endif
 endfunction
 
@@ -3100,7 +3091,8 @@ endif
 
 " Old name of vimrplugin_assign option
 if exists("g:vimrplugin_underscore")
-    let g:vimrplugin_assign = g:vimrplugin_underscore
+    " 07/mar/2014:
+    call RWarningMsgInp("The option vimrplugin_underscore is deprecated. Use vimrplugin_assign instead.")
 endif
 
 " Variables whose default value is fixed
@@ -3163,18 +3155,13 @@ endfor
 unlet objbrplace
 unlet obpllen
 
-
-
-" python has priority over python3
+" python3 has priority over python
 if has("python3")
     command! -nargs=+ Py :py3 
     command! -nargs=+ PyFile :py3file 
 elseif has("python")
     command! -nargs=+ Py :py 
     command! -nargs=+ PyFile :pyfile 
-elseif has("python3")
-    command! -nargs=+ Py :py3 
-    command! -nargs=+ PyFile :py3file 
 else
     command! -nargs=+ Py :
     command! -nargs=+ PyFile :
@@ -3461,15 +3448,11 @@ autocmd BufLeave * if exists("b:rsource") | call delete(b:rsource) | endif
 
 let g:rplugin_firstbuffer = expand("%:p")
 let g:rplugin_running_objbr = 0
-let g:rplugin_has_new_lib = 0
-let g:rplugin_has_new_obj = 0
 let g:rplugin_ob_warn_shown = 0
 let g:rplugin_vimcomport = 0
 let g:rplugin_vimcom_pkg = "vimcom"
 let g:rplugin_lastrpl = ""
-let g:rplugin_ob_busy = 0
 let g:rplugin_hasRSFbutton = 0
-let g:rplugin_errlist = []
 let g:rplugin_tmuxsname = substitute("vimrplugin-" . g:rplugin_userlogin . localtime() . g:rplugin_firstbuffer, '\W', '', 'g')
 
 " If this is the Object Browser running in a Tmux pane, $VIMINSTANCEID is
@@ -3506,16 +3489,3 @@ else
     let g:rplugin_has_icons = len(globpath(&rtp, "bitmaps/RStart.png")) > 0
 endif
 
-" Compatibility with old versions (August 2013):
-if exists("g:vimrplugin_tmux")
-    call RWarningMsg("The option vimrplugin_tmux is deprecated and will be ignored.")
-endif
-if exists("g:vimrplugin_noscreenrc")
-    call RWarningMsg("The option vimrplugin_noscreenrc is deprecated and will be ignored.")
-endif
-if exists("g:vimrplugin_screenplugin")
-    call RWarningMsg("The option vimrplugin_screenplugin is deprecated and will be ignored.")
-endif
-if exists("g:vimrplugin_screenvsplit")
-    call RWarningMsg("The option vimrplugin_screenvsplit is deprecated. Please use vimrplugin_vsplit instead.")
-endif

From a772ac589729ed8b938ead8d0d9da15e0e940330 Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Sun, 9 Mar 2014 09:56:53 -0300
Subject: [PATCH 0623/1050] Do syntax sync on beginning of "Examples" section.

---
 syntax/rhelp.vim | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/syntax/rhelp.vim b/syntax/rhelp.vim
index 70eb16f..7ba5bd9 100644
--- a/syntax/rhelp.vim
+++ b/syntax/rhelp.vim
@@ -2,7 +2,7 @@
 " Language:    R Help File
 " Maintainer: Jakson Aquino 
 " Former Maintainer: Johannes Ranke 
-" Last Change: Sat Nov 09, 2013  07:29PM
+" Last Change: Sat Mar 08, 2014  10:03PM
 " Remarks:     - Includes R syntax highlighting in the appropriate
 "                sections if an r.vim file is in the same directory or in the
 "                default debian location.
@@ -210,6 +210,8 @@ syn match rhelpBraceError /[)}]/ contained
 syn match rhelpCurlyError /[)\]]/ contained
 syn match rhelpParenError /[\]}]/ contained
 
+syntax sync match rhelpSyncRcode grouphere rhelpRcode "\\examples{"
+
 " Define the default highlighting {{{1
 " For version 5.7 and earlier: only when not done already
 " For version 5.8 and later: only when an item doesn't have highlighting yet

From 10526a54595d5cd150260548e37889e3f9e10911 Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Sun, 9 Mar 2014 09:59:09 -0300
Subject: [PATCH 0624/1050] Highlight R code in "Usage" section.

---
 ftplugin/rdoc.vim | 29 ++++++++++++++++++++++++++---
 syntax/rdoc.vim   |  6 +++---
 2 files changed, 29 insertions(+), 6 deletions(-)

diff --git a/ftplugin/rdoc.vim b/ftplugin/rdoc.vim
index 48832f3..1bfa940 100644
--- a/ftplugin/rdoc.vim
+++ b/ftplugin/rdoc.vim
@@ -1,7 +1,7 @@
 " Vim filetype plugin file
 " Language: R Documentation (generated by the Vim-R-plugin)
 " Maintainer: Jakson Alves de Aquino 
-" Last Change:	Sun Feb 23, 2014  10:10AM
+" Last Change:	Sat Mar 08, 2014  11:57PM
 
 
 " Only do this when not yet done for this buffer
@@ -33,11 +33,34 @@ function! FixRdoc()
         " of the first argument
         call setline(i, substitute(getline(i), "^Arguments:", "Arguments: ", ""))
     endfor
+
     let has_ex = search("^Examples:$")
     if has_ex
-        let lnr = line("$") + 1
-        call setline(lnr, '###')
+        if getline("$") !~ "^###$"
+            let lnr = line("$") + 1
+            call setline(lnr, '###')
+        endif
+    endif
+
+    " Add a tab character at the end of the Usage section to mark its end.
+    call cursor(1, 1)
+    let ii = search("^Usage:$")
+    if ii
+        let doclength = line("$")
+        let ii += 2
+        let lin = getline(ii)
+        while lin !~ "^[A-Z].*:" && ii < doclength
+            let ii += 1
+            let lin = getline(ii)
+        endwhile
+        if ii < doclength
+            let ii -= 1
+            if getline(ii) =~ "^ *$"
+                call setline(ii, "\t")
+            endif
+        endif
     endif
+
     normal! gg
 
     " Clear undo history
diff --git a/syntax/rdoc.vim b/syntax/rdoc.vim
index 7efaeeb..c121ecd 100644
--- a/syntax/rdoc.vim
+++ b/syntax/rdoc.vim
@@ -31,14 +31,14 @@ syn region rdocPackage start="^[A-Za-z]\S*::" end="[\s\r]" contains=rdocPackName
 syn match rdocPackName "^[A-Za-z][A-Za-z0-9\.]*" contained
 syn match rdocFuncName "::[A-Za-z0-9\.\-_]*" contained
 
-syn match rdocArgItems "\n\n.\{-}:" contains=rdocArg contained transparent
-
 syn region rdocArgReg matchgroup=rdocArgTitle start="^Arguments:" end="^[A-Z].*:$" contains=rdocArgItems,rdocArgTitle,rdocPackage,rdocFuncName,rdocStringS keepend transparent
+syn match rdocArgItems "\n\n.\{-}:" contains=rdocArg contained transparent
 syn match rdocArg "\([A-Z]\|[a-z]\|[0-9]\|\.\|_\)*" contained
 
-
 syn include @rdocR syntax/r.vim
 syn region rdocExample matchgroup=rdocExTitle start="^Examples:$" matchgroup=rdocExEnd end='^###$' contains=@rdocR keepend
+syn region rdocUsage matchgroup=rdocTitle start="^Usage:$" matchgroup=NONE end='^\t' contains=@rdocR
+
 
 " Define the default highlighting.
 "hi def link rdocArgReg Statement

From 209ad87774a58d742232242b7f15cd50c6cc4389 Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Sun, 9 Mar 2014 10:00:49 -0300
Subject: [PATCH 0625/1050] Don't try to highlight functions of "datasets".

---
 r-plugin/functions.vim | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/r-plugin/functions.vim b/r-plugin/functions.vim
index ffff15d..23fa475 100644
--- a/r-plugin/functions.vim
+++ b/r-plugin/functions.vim
@@ -3,12 +3,13 @@
 " functions should be highlighted even if R is not running. By default, the
 " functions of packages loaded by R --vanilla are highlighted.
 if !exists("g:vimrplugin_permanent_libs")
-    let g:vimrplugin_permanent_libs = "base,stats,graphics,grDevices,utils,datasets,methods"
+    let g:vimrplugin_permanent_libs = "base,stats,graphics,grDevices,utils,methods"
 endif
 
-" Store the names R package whose functions were already added to syntax
-" highlight to avoid sourcing them repeatedly.
-let b:rplugin_funls = []
+" Store the names of R package whose functions were already added to syntax
+" highlight to avoid sourcing them repeatedly. Initialize the list with two
+" libraries that don't have any visible function.
+let b:rplugin_funls = ["datasets", "setwidth"]
 
 " The function RUpdateFunSyntax() is called by the Vim-R-plugin whenever the
 " user loads a new package in R. The function should be defined only once.

From f51427f80f4d2e05a6cda731f84a29278ed38f41 Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Sat, 15 Mar 2014 23:02:52 -0300
Subject: [PATCH 0626/1050] Open pdf only once if vimrplugin_openpdf = 1. Now,
 the values of vimrplugin_openpdf mean: 0 = Don't open the pdf. 1 = Open only
 once (the first time that pdflatex is run). 2 = Always open the pdf.

---
 ftplugin/rnoweb_rplugin.vim | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/ftplugin/rnoweb_rplugin.vim b/ftplugin/rnoweb_rplugin.vim
index 0393cfe..10b22cf 100644
--- a/ftplugin/rnoweb_rplugin.vim
+++ b/ftplugin/rnoweb_rplugin.vim
@@ -104,6 +104,14 @@ function! RMakePDF(bibtex, knit)
 
     if g:vimrplugin_openpdf == 0
         let pdfcmd = pdfcmd . ", view = FALSE"
+    else
+        if g:vimrplugin_openpdf == 1
+            if b:pdf_opened == 0
+                let b:pdf_opened = 1
+            else
+                let pdfcmd = pdfcmd . ", view = FALSE"
+            endif
+        endif
     endif
 
     if g:vimrplugin_openpdf_quietly
@@ -213,6 +221,8 @@ let b:SendChunkToR = function("RnwSendChunkToR")
 " global one:
 let b:SourceLines = function("RSourceLines")
 
+let b:pdf_opened = 0
+
 
 "==========================================================================
 " Key bindings and menu items

From 8bd6663f48655880365b9df2fb0f9841c6d4cbb0 Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Sat, 15 Mar 2014 23:05:54 -0300
Subject: [PATCH 0627/1050] Do "syn sync" command in Rdoc.

---
 ftplugin/rdoc.vim | 26 +++++++++++++++++++++++---
 syntax/rdoc.vim   |  7 ++++++-
 2 files changed, 29 insertions(+), 4 deletions(-)

diff --git a/ftplugin/rdoc.vim b/ftplugin/rdoc.vim
index 1bfa940..733f664 100644
--- a/ftplugin/rdoc.vim
+++ b/ftplugin/rdoc.vim
@@ -1,7 +1,7 @@
 " Vim filetype plugin file
 " Language: R Documentation (generated by the Vim-R-plugin)
 " Maintainer: Jakson Alves de Aquino 
-" Last Change:	Sat Mar 08, 2014  11:57PM
+" Last Change:	Mon Mar 10, 2014  08:27AM
 
 
 " Only do this when not yet done for this buffer
@@ -34,14 +34,34 @@ function! FixRdoc()
         call setline(i, substitute(getline(i), "^Arguments:", "Arguments: ", ""))
     endfor
 
-    let has_ex = search("^Examples:$")
-    if has_ex
+    " Mark the end of Examples
+    let ii = search("^Examples:$")
+    if ii
         if getline("$") !~ "^###$"
             let lnr = line("$") + 1
             call setline(lnr, '###')
         endif
     endif
 
+    " Add a tab character at the end of the Arguments section to mark its end.
+    call cursor(1, 1)
+    let ii = search("^Arguments: $")
+    if ii
+        let doclength = line("$")
+        let ii += 2
+        let lin = getline(ii)
+        while lin !~ "^[A-Z].*:$" && ii < doclength
+            let ii += 1
+            let lin = getline(ii)
+        endwhile
+        if ii < doclength
+            let ii -= 1
+            if getline(ii) =~ "^$"
+                call setline(ii, "\t")
+            endif
+        endif
+    endif
+
     " Add a tab character at the end of the Usage section to mark its end.
     call cursor(1, 1)
     let ii = search("^Usage:$")
diff --git a/syntax/rdoc.vim b/syntax/rdoc.vim
index c121ecd..65e4b29 100644
--- a/syntax/rdoc.vim
+++ b/syntax/rdoc.vim
@@ -31,7 +31,7 @@ syn region rdocPackage start="^[A-Za-z]\S*::" end="[\s\r]" contains=rdocPackName
 syn match rdocPackName "^[A-Za-z][A-Za-z0-9\.]*" contained
 syn match rdocFuncName "::[A-Za-z0-9\.\-_]*" contained
 
-syn region rdocArgReg matchgroup=rdocArgTitle start="^Arguments:" end="^[A-Z].*:$" contains=rdocArgItems,rdocArgTitle,rdocPackage,rdocFuncName,rdocStringS keepend transparent
+syn region rdocArgReg matchgroup=rdocArgTitle start="^Arguments:" matchgroup=NONE end="^\t" contains=rdocArgItems,rdocArgTitle,rdocPackage,rdocFuncName,rdocStringS keepend transparent
 syn match rdocArgItems "\n\n.\{-}:" contains=rdocArg contained transparent
 syn match rdocArg "\([A-Z]\|[a-z]\|[0-9]\|\.\|_\)*" contained
 
@@ -39,6 +39,11 @@ syn include @rdocR syntax/r.vim
 syn region rdocExample matchgroup=rdocExTitle start="^Examples:$" matchgroup=rdocExEnd end='^###$' contains=@rdocR keepend
 syn region rdocUsage matchgroup=rdocTitle start="^Usage:$" matchgroup=NONE end='^\t' contains=@rdocR
 
+syn sync match rdocSyncExample grouphere rdocExample "^Examples:$"
+syn sync match rdocSyncUsage grouphere rdocUsage "^Usage:$"
+syn sync match rdocSyncArg grouphere rdocArgReg "^Arguments:"
+syn sync match rdocSyncNONE grouphere NONE "^\t$"
+
 
 " Define the default highlighting.
 "hi def link rdocArgReg Statement

From c0caf913f7116ac4d32858c33d202a7295f51289 Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Sat, 15 Mar 2014 23:07:04 -0300
Subject: [PATCH 0628/1050] Update: the next release will be 1.0.

---
 Makefile         |  2 +-
 README.md        |  4 ++--
 doc/r-plugin.txt | 25 ++++++++++++++++++-------
 3 files changed, 21 insertions(+), 10 deletions(-)

diff --git a/Makefile b/Makefile
index 58ec27c..f46d447 100644
--- a/Makefile
+++ b/Makefile
@@ -22,7 +22,7 @@
 
 
 PLUGINHOME=`pwd`
-PLUGINVERSION=0.9.9.9
+PLUGINVERSION=1.0
 DEBIANTIME=`date -R`
 PLUGINRELEASEDATE=`date +"%Y-%m-%d"`
 VIM2HTML=/usr/local/share/vim/vim74/doc/vim2html.pl 
diff --git a/README.md b/README.md
index 7ef4218..027e757 100644
--- a/README.md
+++ b/README.md
@@ -3,7 +3,7 @@
 This is the development code of Vim-R-plugin. You may want to adjust Vim's
 **runtimepath** in your **~/.vimrc** as in the example below:
 
-> set runtimepath=~/Vim-R-plugin,~/.vim,$VIMRUNTIME,~/.vim/after
+    set runtimepath=~/Vim-R-plugin,~/.vim,$VIMRUNTIME,~/.vim/after
 
 Stable versions are released at
 http://www.vim.org/scripts/script.php?script_id=2628
@@ -11,4 +11,4 @@ http://www.vim.org/scripts/script.php?script_id=2628
 Please, read the file *doc/r-plugin.txt* for usage details.
 
 If you decide to use this version, you will also need the development version
-of vimcom: https://github.com/jalvesaq/VimCom
+of vimcom.plus: https://github.com/jalvesaq/VimCom
diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index d304f47..b0e963c 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -5,7 +5,7 @@
 Authors: Jakson A. Aquino   
          Jose Claudio Faria 
 
-Version: 0.9.9.9
+Version: 1.0
 For Vim version 7.4
 
  1. Overview                                    |r-plugin-overview|
@@ -281,7 +281,8 @@ If you want to uninstall the plugin, do
 
 3.3. Troubleshooting (if the plugin doesn't work)~
 
-Note: The  is '\' by default.
+Note: The  is '\' by default, but if you have run the
+:RpluginConfig  command the  may have been changed to ','.
 
 The plugin is a |file-type| plugin. It will be active only if you are editing
 a .R, .Rnw, .Rd, Rmd, or Rrst file. The menu items will not be visible and the
@@ -331,7 +332,8 @@ bar.
 
 4.1. Key bindings~
 
-Note: The  is '\' by default.
+Note: The  is '\' by default, but if you have run the
+:RpluginConfig  command the  may have been changed to ','.
 
 Note: It is recommended the use of different keys for  and
  to avoid clashes between filetype plugins and general plugins
@@ -1235,7 +1237,7 @@ and available for omnicompletion even if R is not running. By default, only
 the functions of vanilla R are always highlighted. Below is the default value
 of vimrplugin_permanent_libs:
 >
-   let vimrplugin_permanent_libs = "base,stats,graphics,grDevices,utils,datasets,methods"
+   let vimrplugin_permanent_libs = "base,stats,graphics,grDevices,utils,methods"
 <
 
 6.10. More colorful syntax highlight of .Rout files~
@@ -1428,8 +1430,13 @@ in your |vimrc|:
 							  *vimrplugin_openpdf*
 						  *vimrplugin_openpdf_quietly*
 							 *vimrplugin_openhtml*
-The plugin will try to open automatically the pdf file generated by pdflatex,
-after either `Sweave()` or `knit()`, if you put in your |vimrc|:
+The plugin can automatically open the pdf file generated by pdflatex, after
+either `Sweave()` or `knit()`. This behavior is controlled by the variable
+|vimrplugin_openpdf| whose value may be 0 (do not open the pdf), 1 (open only
+the first time that pdflatex is called) or a number higher than 1 (always
+open the pdf). For example, if you want that the pdf application is started
+automatically but do not want the terminal (or GVim) losing focus every time
+that you generate the pdf, you should put in put in your |vimrc|:
 >
    let vimrplugin_openpdf = 1
 <
@@ -2339,7 +2346,11 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details.
 							       *r-plugin-news*
 10. News~
 
-0.9.9.9 (2014-02-23)
+1.0 (2014-03-07)
+
+ * Minor bug fixes.
+
+0.9.9.9 (2014-02-01)
 
  * Minor bug fixes.
  

From fe89003f678f56604ac890191f3728eb424fae41 Mon Sep 17 00:00:00 2001
From: Sebastian Gibb 
Date: Sun, 23 Mar 2014 13:48:54 +0000
Subject: [PATCH 0629/1050] add SendLineToRAndInsertOutput

---
 r-plugin/common_global.vim | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 7778fff..fd5ad2e 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -1234,6 +1234,26 @@ function RInsert(cmd)
     endif
 endfunction
 
+function SendLineToRAndInsertOutput ()
+  let line = getline(".")
+  call RInsert("print(" . line . ")")
+  if g:rplugin_lastrpl == "R is busy." || g:rplugin_lastrpl == "UNKNOWN" || g:rplugin_lastrpl =~ "^Error" || g:rplugin_lastrpl == "INVALID" || g:rplugin_lastrpl == "ERROR" || g:rplugin_lastrpl == "EMPTY" || g:rplugin_lastrpl == "No reply"
+    return
+  else
+    " comment the output
+    let lastLine = line("$")
+    let line = getline(".")
+    let i = line(".")
+    call cursor(i, 1)
+    while strlen(line) > 0 && i <= lastLine
+      call RSimpleCommentLine("normal", "c")
+      let i = line(".") + 1
+      call cursor(i, 1)
+      let line = substitute(getline("."), '^\s*', "", "")
+    endwhile
+  endif
+endfunction
+
 " Function to send commands
 " return 0 on failure and 1 on success
 function SendCmdToR_fake(cmd)
@@ -2598,6 +2618,7 @@ function MakeRMenu()
     menu R.Send.-Sep6- 
     call RCreateMenuItem("ni0", 'Send.Line', 'RSendLine', 'l', ':call SendLineToR("stay")')
     call RCreateMenuItem("ni0", 'Send.Line\ (and\ down)', 'RDSendLine', 'd', ':call SendLineToR("down")')
+    call RCreateMenuItem("ni0", 'Send.Line\ (and\ insert\ output)', 'RDSendLineAndInsertOutput', 'lo', ':call SendLineToRAndInsertOutput()')
     call RCreateMenuItem("i", 'Send.Line\ (and\ new\ one)', 'RSendLAndOpenNewOne', 'q', ':call SendLineToR("newline")')
     call RCreateMenuItem("n", 'Send.Left\ part\ of\ line\ (cur)', 'RNLeftPart', 'r', ':call RSendPartOfLine("left", 0)')
     call RCreateMenuItem("n", 'Send.Right\ part\ of\ line\ (cur)', 'RNRightPart', 'r', ':call RSendPartOfLine("right", 0)')
@@ -2925,6 +2946,7 @@ function RCreateSendMaps()
     "-------------------------------------
     call RCreateMaps("ni", 'RSendLine', 'l', ':call SendLineToR("stay")')
     call RCreateMaps('ni0', 'RDSendLine', 'd', ':call SendLineToR("down")')
+    call RCreateMaps('ni0', 'RDSendLineAndInsertOutput', 'lo', ':call SendLineToRAndInsertOutput()')
     call RCreateMaps('i', 'RSendLAndOpenNewOne', 'q', ':call SendLineToR("newline")')
     nmap r :call RSendPartOfLine("left", 0)
     nmap r :call RSendPartOfLine("right", 0)

From 22132179e729633f908c97549a108d7846243357 Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Sun, 23 Mar 2014 12:47:33 -0300
Subject: [PATCH 0630/1050] Change SendLineToRAndInsertOutput shortcut to \o.

---
 doc/r-plugin.txt           | 9 ++++++++-
 r-plugin/common_global.vim | 6 +++---
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index b0e963c..68611fe 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -393,6 +393,7 @@ Send
   . Line (and new one)                                  \q
   . Left part of line (cur)                       \r
   . Right part of line (cur)                     \r
+  . Line (evaluate and insert the output as comment)    \o
 -----------------------------------------------------------
 
 Command
@@ -1616,6 +1617,7 @@ RD, "cursor down"; RED, both "echo" and "down"):
    RNRightPart
    RILeftPart
    RIRightPart
+   RDSendLineAndInsertOutput
 
    Send code to R console~
    RSendSelection
@@ -2346,7 +2348,12 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details.
 							       *r-plugin-news*
 10. News~
 
-1.0 (2014-03-07)
+1.0 (2014-03-23)
+
+ * vimrplugin_openpdf now accepts three values: 0, 1 and 2.
+
+ * New command \o sends evaluates line in R and inserts the output in the
+   script.
 
  * Minor bug fixes.
 
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index fd5ad2e..bb2d96a 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -1234,7 +1234,7 @@ function RInsert(cmd)
     endif
 endfunction
 
-function SendLineToRAndInsertOutput ()
+function SendLineToRAndInsertOutput()
   let line = getline(".")
   call RInsert("print(" . line . ")")
   if g:rplugin_lastrpl == "R is busy." || g:rplugin_lastrpl == "UNKNOWN" || g:rplugin_lastrpl =~ "^Error" || g:rplugin_lastrpl == "INVALID" || g:rplugin_lastrpl == "ERROR" || g:rplugin_lastrpl == "EMPTY" || g:rplugin_lastrpl == "No reply"
@@ -2618,7 +2618,7 @@ function MakeRMenu()
     menu R.Send.-Sep6- 
     call RCreateMenuItem("ni0", 'Send.Line', 'RSendLine', 'l', ':call SendLineToR("stay")')
     call RCreateMenuItem("ni0", 'Send.Line\ (and\ down)', 'RDSendLine', 'd', ':call SendLineToR("down")')
-    call RCreateMenuItem("ni0", 'Send.Line\ (and\ insert\ output)', 'RDSendLineAndInsertOutput', 'lo', ':call SendLineToRAndInsertOutput()')
+    call RCreateMenuItem("ni0", 'Send.Line\ (and\ insert\ output)', 'RDSendLineAndInsertOutput', 'o', ':call SendLineToRAndInsertOutput()')
     call RCreateMenuItem("i", 'Send.Line\ (and\ new\ one)', 'RSendLAndOpenNewOne', 'q', ':call SendLineToR("newline")')
     call RCreateMenuItem("n", 'Send.Left\ part\ of\ line\ (cur)', 'RNLeftPart', 'r', ':call RSendPartOfLine("left", 0)')
     call RCreateMenuItem("n", 'Send.Right\ part\ of\ line\ (cur)', 'RNRightPart', 'r', ':call RSendPartOfLine("right", 0)')
@@ -2946,7 +2946,7 @@ function RCreateSendMaps()
     "-------------------------------------
     call RCreateMaps("ni", 'RSendLine', 'l', ':call SendLineToR("stay")')
     call RCreateMaps('ni0', 'RDSendLine', 'd', ':call SendLineToR("down")')
-    call RCreateMaps('ni0', 'RDSendLineAndInsertOutput', 'lo', ':call SendLineToRAndInsertOutput()')
+    call RCreateMaps('ni0', 'RDSendLineAndInsertOutput', 'o', ':call SendLineToRAndInsertOutput()')
     call RCreateMaps('i', 'RSendLAndOpenNewOne', 'q', ':call SendLineToR("newline")')
     nmap r :call RSendPartOfLine("left", 0)
     nmap r :call RSendPartOfLine("right", 0)

From 6f08b17e2bfac8b95ab16d85364cedd7a0a34feb Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Sun, 23 Mar 2014 12:50:19 -0300
Subject: [PATCH 0631/1050] Avoid "modifiable is off" error in rdoc.

---
 ftplugin/rdoc.vim | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/ftplugin/rdoc.vim b/ftplugin/rdoc.vim
index 733f664..531cebf 100644
--- a/ftplugin/rdoc.vim
+++ b/ftplugin/rdoc.vim
@@ -1,7 +1,7 @@
 " Vim filetype plugin file
 " Language: R Documentation (generated by the Vim-R-plugin)
 " Maintainer: Jakson Alves de Aquino 
-" Last Change:	Mon Mar 10, 2014  08:27AM
+" Last Change:	Sat Mar 22, 2014  09:26PM
 
 
 " Only do this when not yet done for this buffer
@@ -26,6 +26,8 @@ setlocal iskeyword=@,48-57,_,.
 
 " Prepare R documentation output to be displayed by Vim
 function! FixRdoc()
+    let save_modf = &modifiable
+    set modifiable
     let lnr = line("$")
     for i in range(1, lnr)
         call setline(i, substitute(getline(i), "_\010", "", "g"))
@@ -81,6 +83,7 @@ function! FixRdoc()
         endif
     endif
 
+    let &modifiable = save_modf
     normal! gg
 
     " Clear undo history

From d58684d09402cccb713da4b7665f49878bc4f44d Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Wed, 26 Mar 2014 19:07:33 -0300
Subject: [PATCH 0632/1050] Add "syntax sync" to syntax/rmd.vim.

---
 syntax/rmd.vim | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/syntax/rmd.vim b/syntax/rmd.vim
index ac31fba..487d04e 100644
--- a/syntax/rmd.vim
+++ b/syntax/rmd.vim
@@ -1,6 +1,6 @@
 " markdown Text with R statements
 " Language: markdown with R code chunks
-" Last Change: Sat Nov 09, 2013  07:28PM
+" Last Change: Wed Mar 26, 2014  06:52PM
 "
 " CONFIGURATION:
 "   To highlight chunk headers as R code, put in your vimrc:
@@ -74,6 +74,8 @@ if rmdIsPandoc == 0
     hi def link rmdLaTeXRegDelim Special
 endif
 
+syn sync match rmdSyncChunk grouphere rmdChunk "^[ \t]*``` *{r"
+
 hi def link rmdChunkDelim Special
 hi def link rmdBeginInline Special
 hi def link rmdEndInline Special

From db9eeb0cd05c36f07a18b361ed66ab6573301681 Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Fri, 28 Mar 2014 21:45:00 -0300
Subject: [PATCH 0633/1050] Use "syntax enable" instead of "syntax on".

---
 r-plugin/vimrconfig.vim | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/r-plugin/vimrconfig.vim b/r-plugin/vimrconfig.vim
index abbf17f..67a6e61 100644
--- a/r-plugin/vimrconfig.vim
+++ b/r-plugin/vimrconfig.vim
@@ -235,8 +235,8 @@ function! RConfigVimrc()
     if RFindString(vlines, 'set\s*nocompatible') == 0 && RFindString(vlines, 'set\s*nocp') == 0
         let vlines += ['set nocompatible']
     endif
-    if RFindString(vlines, 'syntax\s*on') == 0
-        let vlines += ['syntax on']
+    if RFindString(vlines, 'syntax\s*on') == 0 && RFindString(vlines, 'syntax\s*enable') == 0
+        let vlines += ['syntax enable']
     endif
     if RFindString(vlines, 'filet.* plugin on') == 0
         let vlines += ['filetype plugin on']

From ee6a07be0e68c189bc08a881fb2775dcecd2840a Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Sun, 30 Mar 2014 21:06:15 -0300
Subject: [PATCH 0634/1050] Comment only output when inserting it. The function
 SendLineToRAndInsertOutput() was commenting every non empty line and not only
 the lines just inserted by Rinsert.

---
 r-plugin/common_global.vim | 31 ++++++++++++++-----------------
 1 file changed, 14 insertions(+), 17 deletions(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index bb2d96a..26dfc65 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -1235,23 +1235,20 @@ function RInsert(cmd)
 endfunction
 
 function SendLineToRAndInsertOutput()
-  let line = getline(".")
-  call RInsert("print(" . line . ")")
-  if g:rplugin_lastrpl == "R is busy." || g:rplugin_lastrpl == "UNKNOWN" || g:rplugin_lastrpl =~ "^Error" || g:rplugin_lastrpl == "INVALID" || g:rplugin_lastrpl == "ERROR" || g:rplugin_lastrpl == "EMPTY" || g:rplugin_lastrpl == "No reply"
-    return
-  else
-    " comment the output
-    let lastLine = line("$")
-    let line = getline(".")
-    let i = line(".")
-    call cursor(i, 1)
-    while strlen(line) > 0 && i <= lastLine
-      call RSimpleCommentLine("normal", "c")
-      let i = line(".") + 1
-      call cursor(i, 1)
-      let line = substitute(getline("."), '^\s*', "", "")
-    endwhile
-  endif
+    let lin = getline(".")
+    call RInsert("print(" . lin . ")")
+    if g:rplugin_lastrpl == "R is busy." || g:rplugin_lastrpl == "UNKNOWN" || g:rplugin_lastrpl =~ "^Error" || g:rplugin_lastrpl == "INVALID" || g:rplugin_lastrpl == "ERROR" || g:rplugin_lastrpl == "EMPTY" || g:rplugin_lastrpl == "No reply"
+        return
+    else
+        let curpos = getpos(".")
+        " comment the output
+        let ilines = readfile(g:rplugin_esc_tmpdir . "/Rinsert")
+        for iln in ilines
+            call RSimpleCommentLine("normal", "c")
+            normal! j
+        endfor
+        call setpos(".", curpos)
+    endif
 endfunction
 
 " Function to send commands

From 1b6b712c66cc2704d81332fa5fb51bb5b83af95e Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Sun, 30 Mar 2014 21:43:17 -0300
Subject: [PATCH 0635/1050] Make rdocArgItems more precise.

---
 syntax/rdoc.vim | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/syntax/rdoc.vim b/syntax/rdoc.vim
index 65e4b29..15ec3b8 100644
--- a/syntax/rdoc.vim
+++ b/syntax/rdoc.vim
@@ -32,7 +32,7 @@ syn match rdocPackName "^[A-Za-z][A-Za-z0-9\.]*" contained
 syn match rdocFuncName "::[A-Za-z0-9\.\-_]*" contained
 
 syn region rdocArgReg matchgroup=rdocArgTitle start="^Arguments:" matchgroup=NONE end="^\t" contains=rdocArgItems,rdocArgTitle,rdocPackage,rdocFuncName,rdocStringS keepend transparent
-syn match rdocArgItems "\n\n.\{-}:" contains=rdocArg contained transparent
+syn match rdocArgItems "\n\n\s*\([A-Z]\|[a-z]\|[0-9]\|\.\|_\)*:" contains=rdocArg contained transparent
 syn match rdocArg "\([A-Z]\|[a-z]\|[0-9]\|\.\|_\)*" contained
 
 syn include @rdocR syntax/r.vim

From 7509895c290c7946ac6ae75e4768497c0622f462 Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Mon, 31 Mar 2014 19:33:21 -0300
Subject: [PATCH 0636/1050] Try again to avoid E341 (Internal error, lalloc).

---
 r-plugin/common_buffer.vim |  7 +++++++
 r-plugin/common_global.vim | 21 +++++++++++++++++----
 2 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/r-plugin/common_buffer.vim b/r-plugin/common_buffer.vim
index a7f8528..2c00899 100644
--- a/r-plugin/common_buffer.vim
+++ b/r-plugin/common_buffer.vim
@@ -72,4 +72,11 @@ if !exists("g:SendCmdToR")
     let g:SendCmdToR = function('SendCmdToR_fake')
 endif
 
+if &filetype != "r"
+    autocmd CursorMoved  call RCheckLibList()
+    if g:vimrplugin_insert_mode_cmds == 1
+        autocmd CursorMovedI  call RCheckLibList()
+    endif
+endif
+
 
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 26dfc65..71c66e7 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -1930,9 +1930,25 @@ function RAddToLibList(nlib, verbose)
     endif
 endfunction
 
+function RCheckLibList()
+    if g:rplugin_newliblist
+        call RealRFillLibList()
+        let g:rplugin_newliblist = 0
+    endif
+endfunction
+
 " This function is called by the R package vimcom.plus whenever a library is
 " loaded.
 function RFillLibList()
+    if &filetype == "r"
+        call RealRFillLibList()
+    else
+        " Avoid E341 (Internal error: lalloc(0, ))
+        let g:rplugin_newliblist = 1
+    endif
+endfunction
+
+function RealRFillLibList()
     " Update the list of objects for omnicompletion
     if filereadable($VIMRPLUGIN_TMPDIR . "/libnames_" . $VIMINSTANCEID)
         let newls = readfile($VIMRPLUGIN_TMPDIR . "/libnames_" . $VIMINSTANCEID)
@@ -1955,10 +1971,6 @@ function RFillLibList()
         call RUpdateFunSyntax(0)
         if &filetype != "r"
             silent exe "set filetype=" . &filetype
-            " Avoid E341 (Erro interno: lalloc(0, ))
-            if mode() == "n"
-                call feedkeys(":\")
-            endif
         endif
     endif
 endfunction
@@ -3467,6 +3479,7 @@ autocmd BufLeave * if exists("b:rsource") | call delete(b:rsource) | endif
 
 let g:rplugin_firstbuffer = expand("%:p")
 let g:rplugin_running_objbr = 0
+let g:rplugin_newliblist = 0
 let g:rplugin_ob_warn_shown = 0
 let g:rplugin_vimcomport = 0
 let g:rplugin_vimcom_pkg = "vimcom"

From a93a778d1013837e4ab74355809f8b2ebf422914 Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Wed, 2 Apr 2014 09:43:47 -0300
Subject: [PATCH 0637/1050] Don't show empty Libraries.

---
 ftplugin/rbrowser.vim | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/ftplugin/rbrowser.vim b/ftplugin/rbrowser.vim
index 74f36f6..de685af 100644
--- a/ftplugin/rbrowser.vim
+++ b/ftplugin/rbrowser.vim
@@ -1,7 +1,7 @@
 " Vim filetype plugin file
 " Language: R Browser (generated by the Vim-R-plugin)
 " Maintainer: Jakson Alves de Aquino 
-" Last Change:	Sun Feb 23, 2014  10:09AM
+" Last Change:	Wed Apr 02, 2014  09:43AM
 
 
 " Only do this when not yet done for this buffer
@@ -57,6 +57,12 @@ function! UpdateOB(what)
     endif
     let g:rplugin_upobcnt = 1
 
+    if wht == "libraries" && !filereadable($VIMRPLUGIN_TMPDIR . "/liblist_" . $VIMINSTANCEID)
+        " The liblist_ file will not exist if no command was evaluated in R
+        " Console after the Object Browser was started.
+        Py SendToVimCom("\004Libraries [UpdateOB]")
+    endif
+
     let g:rplugin_switchedbuf = 0
     if $TMUX_PANE == ""
         redir => s:bufl
@@ -373,3 +379,4 @@ call RSourceOtherScripts()
 let &cpo = s:cpo_save
 unlet s:cpo_save
 
+" vim: sw=4

From aa963be79a16605c9066ad65319a91c80b2e5938 Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Wed, 2 Apr 2014 17:34:53 -0300
Subject: [PATCH 0638/1050] Update .GlobalEnv and Libraries at once.

---
 ftplugin/rbrowser.vim      | 8 +-------
 r-plugin/common_global.vim | 7 +++----
 2 files changed, 4 insertions(+), 11 deletions(-)

diff --git a/ftplugin/rbrowser.vim b/ftplugin/rbrowser.vim
index de685af..614fc0e 100644
--- a/ftplugin/rbrowser.vim
+++ b/ftplugin/rbrowser.vim
@@ -1,7 +1,7 @@
 " Vim filetype plugin file
 " Language: R Browser (generated by the Vim-R-plugin)
 " Maintainer: Jakson Alves de Aquino 
-" Last Change:	Wed Apr 02, 2014  09:43AM
+" Last Change:	Wed Apr 02, 2014  09:55AM
 
 
 " Only do this when not yet done for this buffer
@@ -57,12 +57,6 @@ function! UpdateOB(what)
     endif
     let g:rplugin_upobcnt = 1
 
-    if wht == "libraries" && !filereadable($VIMRPLUGIN_TMPDIR . "/liblist_" . $VIMINSTANCEID)
-        " The liblist_ file will not exist if no command was evaluated in R
-        " Console after the Object Browser was started.
-        Py SendToVimCom("\004Libraries [UpdateOB]")
-    endif
-
     let g:rplugin_switchedbuf = 0
     if $TMUX_PANE == ""
         redir => s:bufl
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 71c66e7..e952ccc 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -925,9 +925,8 @@ function StartObjBrowser_Tmux()
                 \ 'if has("clientserver") && v:servername != ""',
                 \ "   exe 'Py SendToVimCom(" . '"\007' . "' . v:servername . '" . '")' . "'",
                 \ 'endif',
-                \ 'Py SendToVimCom("\003GlobalEnv [OB init]")',
+                \ 'Py SendToVimCom("\001Update OB [OB init TMUX]")',
                 \ 'sleep 50m',
-                \ 'Py SendToVimCom("\004Libraries [OB init]")',
                 \ 'if v:servername == ""',
                 \ '    sleep 100m',
                 \ '    call UpdateOB("GlobalEnv")',
@@ -1052,8 +1051,8 @@ function StartObjBrowser_Vim()
         unlet g:tmp_tmuxsname
         unlet g:tmp_curbufname
         exe "PyFile " . substitute(g:rplugin_home, " ", '\\ ', "g") . "/r-plugin/vimcom.py"
-        Py SendToVimCom("\003GlobalEnv [StartObjBrowser_Vim]")
-        Py SendToVimCom("\004Libraries [StartObjBrowser_Vim]")
+        Py SendToVimCom("\001Update OB [OB init GVIM]")
+        sleep 50m
         call UpdateOB("GlobalEnv")
     endif
     if wmsg != ""

From f3c089fc272d3ad36aaab4654393d05840fe3466 Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Wed, 2 Apr 2014 17:35:23 -0300
Subject: [PATCH 0639/1050] Require vimcom.plus 1.0-0.

---
 doc/r-plugin.txt   | 6 +++---
 r-plugin/vimcom.py | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 68611fe..f3af5af 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -118,7 +118,7 @@ Before installing the plugin, you should install its dependencies:
 
    R >= 3.0.0: http://www.r-project.org/
 
-   vimcom.plus = 0.9-93: http://www.lepem.ufc.br/jaa/vimcom.plus.html
+   vimcom.plus = 1.0-0: http://www.lepem.ufc.br/jaa/vimcom.plus.html
 
    Tmux >= 1.8:   http://tmux.sourceforge.net
                   Tmux is necessary to send commands from Vim to R Console.
@@ -212,7 +212,7 @@ dependencies:
 
     * R's version must be >= 3.0.0: http://www.r-project.org/
 
-    * vimcom.plus = 0.9-93: http://www.lepem.ufc.br/jaa/vimcom.plus.html
+    * vimcom.plus = 1.0-0: http://www.lepem.ufc.br/jaa/vimcom.plus.html
       
       Note: If you cannot build vimcom.plus yourself, you will want to
       download and install the zip file.
@@ -2348,7 +2348,7 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details.
 							       *r-plugin-news*
 10. News~
 
-1.0 (2014-03-23)
+1.0 (2014-04-02)
 
  * vimrplugin_openpdf now accepts three values: 0, 1 and 2.
 
diff --git a/r-plugin/vimcom.py b/r-plugin/vimcom.py
index 7512809..bb11635 100644
--- a/r-plugin/vimcom.py
+++ b/r-plugin/vimcom.py
@@ -54,8 +54,8 @@ def DiscoverVimComPort():
     else:
         vim.command("let g:rplugin_vimcomport = " + str(VimComPort))
         PortWarn = False
-        if repl.find("0.9-93") != 0:
-            vim.command("call RWarningMsg('This version of Vim-R-plugin requires vimcom.plus (or vimcom) 0.9-93.')")
+        if repl.find("1.0-0") != 0:
+            vim.command("call RWarningMsg('This version of Vim-R-plugin requires vimcom.plus (or vimcom) 1.0-0.')")
             vim.command("sleep 1")
     return(VimComPort)
 

From a6d06ef25ab2e274ac175d7294f46c624eec3f7a Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Thu, 3 Apr 2014 14:17:12 -0300
Subject: [PATCH 0640/1050] Improve vimcom related code.

---
 r-plugin/common_global.vim | 8 +-------
 r-plugin/vimcom.py         | 6 +++---
 2 files changed, 4 insertions(+), 10 deletions(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index e952ccc..afc752e 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -874,6 +874,7 @@ endfunction
 
 function ResetVimComPort()
     Py VimComPort = 0
+    let g:rplugin_vimcomport = 0
 endfunction
 
 function StartObjBrowser_Tmux()
@@ -920,7 +921,6 @@ function StartObjBrowser_Tmux()
                 \ 'set shortmess=atI',
                 \ 'set rulerformat=%3(%l%)',
                 \ 'set noruler',
-                \ 'exe "PyFile " . substitute(g:rplugin_home, " ", '. "'\\\\ '" . ', "g") . "/r-plugin/vimcom.py"',
                 \ 'let g:SendCmdToR = function("SendCmdToR_TmuxSplit")',
                 \ 'if has("clientserver") && v:servername != ""',
                 \ "   exe 'Py SendToVimCom(" . '"\007' . "' . v:servername . '" . '")' . "'",
@@ -1050,7 +1050,6 @@ function StartObjBrowser_Vim()
         unlet g:tmp_objbrtitle
         unlet g:tmp_tmuxsname
         unlet g:tmp_curbufname
-        exe "PyFile " . substitute(g:rplugin_home, " ", '\\ ', "g") . "/r-plugin/vimcom.py"
         Py SendToVimCom("\001Update OB [OB init GVIM]")
         sleep 50m
         call UpdateOB("GlobalEnv")
@@ -1094,11 +1093,6 @@ function RObjBrowser()
             call StartObjBrowser_Vim()
         endif
     endif
-    if exists("*UpdateOB")
-        Py SendToVimCom("\003GlobalEnv [RObjBrowser()]")
-        Py SendToVimCom("\004Libraries [RObjBrowser()]")
-        call UpdateOB("both")
-    endif
     let g:rplugin_running_objbr = 0
     return
 endfunction
diff --git a/r-plugin/vimcom.py b/r-plugin/vimcom.py
index bb11635..7c395ed 100644
--- a/r-plugin/vimcom.py
+++ b/r-plugin/vimcom.py
@@ -30,10 +30,10 @@ def DiscoverVimComPort():
                 sock.settimeout(0.1)
                 sock.connect(sa)
                 if sys.hexversion < 0x03000000:
-                    sock.send("\002What port?")
+                    sock.send("\002What port [Python 2]?")
                     repl = sock.recv(1024)
                 else:
-                    sock.send("\002What port?".encode())
+                    sock.send("\002What port [Python 3]?".encode())
                     repl = sock.recv(1024).decode()
                 sock.close()
                 if repl.find(correct_repl):
@@ -89,7 +89,7 @@ def SendToVimCom(aString):
     if received is None:
         vim.command("let g:rplugin_lastrpl = 'NOANSWER'")
         VimComPort = 0
-        DiscoverVimComPort()
+        vim.command("let g:rplugin_vimcomport = 0")
     else:
         received = received.replace("'", "' . \"'\" . '")
         vim.command("let g:rplugin_lastrpl = '" + received + "'")

From 7bf860595c3188d33ca220ab0b6c82f16e5ba53c Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Fri, 4 Apr 2014 12:48:13 -0300
Subject: [PATCH 0641/1050] Wait for vimcom.plus loading.

---
 doc/r-plugin.txt           | 26 +++++++++++++-
 r-plugin/common_global.vim | 74 ++++++++++++++++++++++++++++++++++----
 2 files changed, 93 insertions(+), 7 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index f3af5af..d7558e7 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -1033,6 +1033,7 @@ is running:
 |vimrplugin_source|            Source additional scripts
 |vimrplugin_restart|           Restart R if it is already running
 |vimrplugin_show_args|         Show extra information during omnicompletion
+|vimrplugin_vimcom_wait|       Time to wait for vimcom.plus loading
 
 
 6.1. Terminal emulator (Linux/Unix only)~
@@ -1567,6 +1568,27 @@ run  to complete the function arguments. The preview window
 will be shown only if "preview" is also included in your 'completeopt'.
 
 
+6.30. Time to wait for vimcom.plus loading~
+						      *vimrplugin_vimcom_wait*
+The Vim-R-plugin waits 5000 milliseconds for vimcom.plus (or vimcom) package
+to be loaded during R startup. It then checks whether you are using the
+correct version of vimcom.plus. On Unix, it also sends a message to R update
+the list of uploaded libraries and, then, immediately updates the syntax
+highlighting of function names. If 5000 milliseconds is not enough to your R
+startup, then set a higher value for the variable in your |vimrc|. Example:
+>
+   let vimrplugin_vimcom_wait = 10000
+<
+Note: You should have the line  `library(vimcom.plus)`  in your Rprofile. The
+Vim command  :RpluginConfig  adds that line for you.
+
+If you do not want to install the vimcom.plus (or vimcom) package, then put in
+your |vimrc|:
+>
+   let vimrplugin_vimcom_wait = -1
+<
+
+
 ==============================================================================
 						       *r-plugin-key-bindings*
 7. Custom key bindings~
@@ -2348,13 +2370,15 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details.
 							       *r-plugin-news*
 10. News~
 
-1.0 (2014-04-02)
+1.0 (2014-04-04)
 
  * vimrplugin_openpdf now accepts three values: 0, 1 and 2.
 
  * New command \o sends evaluates line in R and inserts the output in the
    script.
 
+ * New option: vimrplugin_vimcom_wait.
+
  * Minor bug fixes.
 
 0.9.9.9 (2014-02-01)
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index afc752e..0fa0fc8 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -616,6 +616,9 @@ function StartR_TmuxSplit(rcmd)
         let g:vimrplugin_ca_ck = ca_ck
     endif
     let g:rplugin_last_rcmd = a:rcmd
+    if WaitVimComStart()
+        Py SendToVimCom("\001Update OB [StartR]")
+    endif
 endfunction
 
 
@@ -695,6 +698,9 @@ function StartR_ExternalTerm(rcmd)
         let $TMUX = tmuxenv
     endif
     let g:SendCmdToR = function('SendCmdToR_Term')
+    if WaitVimComStart()
+        Py SendToVimCom("\001Update OB [StartR]")
+    endif
 endfunction
 
 function StartR_Windows()
@@ -710,6 +716,7 @@ function StartR_Windows()
     Py StartRPy()
     lcd -
     let g:SendCmdToR = function('SendCmdToR_Windows')
+    call WaitVimComStart()
 endfunction
 
 function StartR_OSX()
@@ -732,6 +739,9 @@ function StartR_OSX()
     endif
     lcd -
     let g:SendCmdToR = function('SendCmdToR_OSX')
+    if WaitVimComStart()
+        Py SendToVimCom("\001Update OB [StartR]")
+    endif
 endfunction
 
 function IsSendCmdToRFake()
@@ -800,7 +810,10 @@ function StartR(whatr)
                 let g:vimrplugin_ca_ck = ca_ck
                 if IsExternalOBRunning()
                     call VimExprToOB('ResetVimComPort()')
-                    call WaitVimComStart()
+                    if WaitVimComStart()
+                        sleep 100m
+                        call g:SendCmdToR("\014")
+                    endif
                     exe 'Py SendToVimCom("\007' . g:rplugin_obsname . '")'
                     Py SendToVimCom("\003.GlobalEnv [Restarting R]")
                     Py SendToVimCom("\004Libraries [Restarting()]")
@@ -850,15 +863,52 @@ function StartR(whatr)
 endfunction
 
 function WaitVimComStart()
+    if g:vimrplugin_vimcom_wait < 0
+        return 0
+    endif
     sleep 300m
     let ii = 0
-    while !filereadable($VIMRPLUGIN_TMPDIR . "/vimcom_running") && ii < 20
-        let ii = ii + 1
+    let waitmsg = 0
+    while !filereadable($VIMRPLUGIN_TMPDIR . "/vimcom_running") && ii < g:vimrplugin_vimcom_wait
+        let ii = ii + 200
+        if ii == 1000
+            echo "Waiting vimcom.plus loading..."
+            let waitmsg = 1
+        endif
         sleep 200m
     endwhile
-    if filereadable($VIMRPLUGIN_TMPDIR . "/vimcom_running") && g:rplugin_tmuxwasfirst
-        sleep 100m
-        call g:SendCmdToR("\014")
+    if waitmsg
+        echon "\r                              "
+        redraw
+    endif
+    if filereadable($VIMRPLUGIN_TMPDIR . "/vimcom_running")
+        let vr = readfile($VIMRPLUGIN_TMPDIR . "/vimcom_running")
+        if vr[0] =~ "vimcom.plus"
+            let g:rplugin_vimcom_pkg = "vimcom.plus"
+        else
+            let g:rplugin_vimcom_pkg = "vimcom"
+        endif
+        if vr[2] == $VIMINSTANCEID
+            let g:rplugin_vimcom_version = vr[1]
+            if g:rplugin_vimcom_version != "1.0-0"
+                if g:rplugin_vimcom_pkg == "vimcom.plus"
+                    call RWarningMsg('This version of Vim-R-plugin requires vimcom.plus 1.0-0.')
+                else
+                    call RWarningMsg('This version of Vim-R-plugin requires vimcom.plus (or vimcom) 1.0-0.')
+                endif
+                sleep 1
+            endif
+        else
+            let g:rplugin_vimcom_version = 0
+            call RWarningMsg("Vim-R-plugin and vimcom.plus IDs don't match.")
+            sleep 1
+        endif
+        call delete($VIMRPLUGIN_TMPDIR . "/vimcom_running")
+        return 1
+    else
+        call RWarningMsg("The package vimcom.plus wasn't loaded yet.")
+        sleep 300m
+        return 0
     endif
 endfunction
 
@@ -1002,6 +1052,15 @@ function StartObjBrowser_Tmux()
 endfunction
 
 function StartObjBrowser_Vim()
+    if has("win32") || has("win64")
+	" The vimcom.plus server will stop working if starting the Object
+	" Browser is the first thing the user does.
+	if !exists("g:rplugin_liblist_filled")
+	    call RWarningMsg("Please, try again after sending at least one line of code to the R Console.!")
+	    return
+	endif
+    endif
+
     let wmsg = ""
     if v:servername == ""
         if g:rplugin_ob_warn_shown == 0
@@ -1966,6 +2025,7 @@ function RealRFillLibList()
             silent exe "set filetype=" . &filetype
         endif
     endif
+    let g:rplugin_liblist_filled = 1
 endfunction
 
 function SetRTextWidth()
@@ -3145,6 +3205,7 @@ call RSetDefaultValue("g:vimrplugin_editor_w",         66)
 call RSetDefaultValue("g:vimrplugin_help_w",           46)
 call RSetDefaultValue("g:vimrplugin_objbr_w",          40)
 call RSetDefaultValue("g:vimrplugin_external_ob",       0)
+call RSetDefaultValue("g:vimrplugin_vimcom_wait",    5000)
 call RSetDefaultValue("g:vimrplugin_show_args",         0)
 call RSetDefaultValue("g:vimrplugin_never_unmake_menu", 0)
 call RSetDefaultValue("g:vimrplugin_insert_mode_cmds",  1)
@@ -3476,6 +3537,7 @@ let g:rplugin_newliblist = 0
 let g:rplugin_ob_warn_shown = 0
 let g:rplugin_vimcomport = 0
 let g:rplugin_vimcom_pkg = "vimcom"
+let g:rplugin_vimcom_version = 0
 let g:rplugin_lastrpl = ""
 let g:rplugin_hasRSFbutton = 0
 let g:rplugin_tmuxsname = substitute("vimrplugin-" . g:rplugin_userlogin . localtime() . g:rplugin_firstbuffer, '\W', '', 'g')

From 6533f1fceffc309c52d2e74bd411cad32ad5540c Mon Sep 17 00:00:00 2001
From: Yukun Lin 
Date: Tue, 15 Apr 2014 21:54:48 -0700
Subject: [PATCH 0642/1050] handle space in path in function RAddToFunList

---
 r-plugin/functions.vim | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/r-plugin/functions.vim b/r-plugin/functions.vim
index 23fa475..c1ea8d1 100644
--- a/r-plugin/functions.vim
+++ b/r-plugin/functions.vim
@@ -32,7 +32,7 @@ function RAddToFunList(lib, verbose)
     let fnf = split(globpath(&rtp, 'r-plugin/objlist/fun_' . a:lib . '_*'), "\n")
 
     if len(fnf) == 1
-        silent exe "source " . fnf[0]
+        silent exe "source " . substitute(fnf[0], ' ', '\\ ', "g")
         let b:rplugin_funls += [a:lib]
     elseif a:verbose && len(fnf) == 0
         echohl WarningMsg

From 742c3fd6765d719036213ec33a421a48d7a39004 Mon Sep 17 00:00:00 2001
From: Yukun Lin 
Date: Wed, 16 Apr 2014 04:55:05 -0700
Subject: [PATCH 0643/1050] escape space in g:rplugin_home

---
 r-plugin/common_global.vim | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 0fa0fc8..073ba03 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -576,7 +576,7 @@ endfunction
 function StartR_TmuxSplit(rcmd)
     let g:rplugin_vim_pane = TmuxActivePane()
     call system("tmux set-environment -g VIMRPLUGIN_TMPDIR " . g:rplugin_esc_tmpdir)
-    call system("tmux set-environment -g VIMRPLUGIN_HOME " . g:rplugin_home)
+    call system("tmux set-environment -g VIMRPLUGIN_HOME " . substitute(g:rplugin_home, ' ', '\\ ', "g"))
     call system("tmux set-environment -g VIM_PANE " . g:rplugin_vim_pane)
     if v:servername != ""
         call system("tmux set-environment VIMEDITOR_SVRNM " . v:servername)
@@ -631,7 +631,7 @@ function StartR_ExternalTerm(rcmd)
     " Create a custom tmux.conf
     let cnflines = [
                 \ 'set-environment -g VIMRPLUGIN_TMPDIR ' . g:rplugin_esc_tmpdir,
-                \ 'set-environment -g VIMRPLUGIN_HOME ' . g:rplugin_home,
+                \ 'set-environment -g VIMRPLUGIN_HOME ' . substitute(g:rplugin_home, ' ', '\\ ', "g"),
                 \ 'set-environment VIMINSTANCEID ' . $VIMINSTANCEID ]
     if v:servername != ""
         let cnflines = cnflines + [ 'set-environment VIMEDITOR_SVRNM ' . v:servername ]
@@ -661,7 +661,7 @@ function StartR_ExternalTerm(rcmd)
 	endif
 
     call system('export VIMRPLUGIN_TMPDIR=' . $VIMRPLUGIN_TMPDIR)
-    call system('export VIMRPLUGIN_HOME=' . g:rplugin_home)
+    call system('export VIMRPLUGIN_HOME=' . substitute(g:rplugin_home, ' ', '\\ ', "g"))
     call system('export VIMINSTANCEID=' . $VIMINSTANCEID)
     if v:servername != ""
         call system('export VIMEDITOR_SVRNM=' . v:servername)
@@ -3157,7 +3157,7 @@ if has("win32") || has("win64")
     endif
 endif
 
-let $VIMRPLUGIN_HOME = g:rplugin_home
+let $VIMRPLUGIN_HOME = substitute(g:rplugin_home, ' ', '\\ ', "g")
 if v:servername != ""
     let $VIMEDITOR_SVRNM = v:servername
 endif

From 0f7aff7444d400e43b427c59a4ccf70146d88bcf Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Wed, 16 Apr 2014 22:27:32 -0300
Subject: [PATCH 0644/1050] Handle space in temporary directory path.

---
 r-plugin/common_global.vim | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 073ba03..c05688c 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -575,8 +575,8 @@ endfunction
 
 function StartR_TmuxSplit(rcmd)
     let g:rplugin_vim_pane = TmuxActivePane()
-    call system("tmux set-environment -g VIMRPLUGIN_TMPDIR " . g:rplugin_esc_tmpdir)
-    call system("tmux set-environment -g VIMRPLUGIN_HOME " . substitute(g:rplugin_home, ' ', '\\ ', "g"))
+    call system("tmux set-environment -g VIMRPLUGIN_TMPDIR '" . $VIMRPLUGIN_TMPDIR . "'")
+    call system("tmux set-environment -g VIMRPLUGIN_HOME '" . g:rplugin_home . "'")
     call system("tmux set-environment -g VIM_PANE " . g:rplugin_vim_pane)
     if v:servername != ""
         call system("tmux set-environment VIMEDITOR_SVRNM " . v:servername)
@@ -630,8 +630,8 @@ function StartR_ExternalTerm(rcmd)
 
     " Create a custom tmux.conf
     let cnflines = [
-                \ 'set-environment -g VIMRPLUGIN_TMPDIR ' . g:rplugin_esc_tmpdir,
-                \ 'set-environment -g VIMRPLUGIN_HOME ' . substitute(g:rplugin_home, ' ', '\\ ', "g"),
+                \ 'set-environment -g VIMRPLUGIN_TMPDIR "' . $VIMRPLUGIN_TMPDIR . '"',
+                \ 'set-environment -g VIMRPLUGIN_HOME "' . g:rplugin_home . '"',
                 \ 'set-environment VIMINSTANCEID ' . $VIMINSTANCEID ]
     if v:servername != ""
         let cnflines = cnflines + [ 'set-environment VIMEDITOR_SVRNM ' . v:servername ]

From f1c3631af2fab47c884d26fe988072fc2c305ff1 Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Tue, 22 Apr 2014 23:12:31 -0300
Subject: [PATCH 0645/1050] Update. Add paragraph on the need of clientserver
 for omni completion.

---
 doc/r-plugin.txt | 73 +++++++++++++++++++++++++-----------------------
 1 file changed, 38 insertions(+), 35 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index d7558e7..df974bb 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -299,8 +299,8 @@ you may prefer to install the Debian package available at:
    http://www.lepem.ufc.br/jaa/vim-r-plugin.html
 
 Did you see the message "VimCom port not found"? This means that R is not
-running, the vimcom.plus (or vimcom) package is not installed (or is installed
-but is not loaded), or R was not started by Vim.
+running, the vimcom.plus package is not installed (or is installed but is not
+loaded), or R was not started by Vim.
 
 
 3.4. Optional steps~
@@ -600,6 +600,12 @@ complete the name of a data.frame, the columns are not shown. But when the
 data.frame name is already complete, and you have inserted the '$' symbol,
 omni completion will show the column names.
 
+Only the names of objects in .GlobalEnv and in loaded libraries are completed,
+and the |clientserver| feature is required to get the list of loaded libraries
+automatically updated. If Vim is running without the |clientserver| feature,
+only objects of libraries listed in |vimrplugin_permanent_libs| will have
+their names completed.
+
 Vim uses one file to store the names of .GlobalEnv objects and a list of files
 for all other objects. The .GlobalEnv list is stored in the
 /tmp/r-plugin-yourlogin directory and is deleted when you quits Vim. The other
@@ -631,14 +637,14 @@ Windows and X11 interprocess communication systems while MacVim is a Cocoa
 application.
 
 In the .GlobalEnv view, if an object has the attribute "label", it will also
-be displayed. Please, see the R help for package vimcom.plus (or vimcom) for
-some options to control the Object Browser behavior. In the Object Browser
-window, while in Normal mode, you can either press  or double click
-(GVim only) over a data.frame or list to show/hide its elements (not if
-viewing the content of loaded libraries). If you are running R in an
-environment where the string UTF-8 is part of either LC_MESSAGES or LC_ALL
-variables, unicode line drawing characters will be used to draw lines in the
-Object Browser. This is the case of most Linux distributions.
+be displayed. Please, see the R help for package vimcom.plus for some options
+to control the Object Browser behavior. In the Object Browser window, while in
+Normal mode, you can either press  or double click (GVim only) over a
+data.frame or list to show/hide its elements (not if viewing the content of
+loaded libraries). If you are running R in an environment where the string
+UTF-8 is part of either LC_MESSAGES or LC_ALL variables, unicode line drawing
+characters will be used to draw lines in the Object Browser. This is the case
+of most Linux distributions.
 
 In the Libraries view, you can either double click or press  over a
 library to see its objects. In the Object Browser, the libraries have the
@@ -913,17 +919,16 @@ indent the code below:
 
 5.5. Wrong message that "R is busy" (Windows only)~
 
-On Windows, when code is sent from Vim to R Console, the vimcom (or
-vimcom.plus) library sets the value of the internal variable `r_is_busy` to 1.
-The value is set back to 0 when any code is successfully evaluated. If you
-send invalid code to R, there will be no successful evaluation of code and,
-thus, the value of `r_is_busy` will remain set to 1. Then, if you try to
-update the object browser, see the R documentation for any function, or do
-other tasks that require the hidden evaluation of code by R, the vimcom
-library will refuse to do the tasks to avoid any risk of corrupting R's
-memory. It will tell Vim that "R is busy" and Vim will display this message.
-Everything should work as expected again after any valid code is executed in
-the R Console.
+On Windows, when code is sent from Vim to R Console, the vimcom.plus library
+sets the value of the internal variable `r_is_busy` to 1. The value is set
+back to 0 when any code is successfully evaluated. If you send invalid code to
+R, there will be no successful evaluation of code and, thus, the value of
+`r_is_busy` will remain set to 1. Then, if you try to update the object
+browser, see the R documentation for any function, or do other tasks that
+require the hidden evaluation of code by R, the vimcom.plus library will
+refuse to do the tasks to avoid any risk of corrupting R's memory. It will
+tell Vim that "R is busy" and Vim will display this message. Everything should
+work as expected again after any valid code is executed in the R Console.
 
 
 5.6. R must be started by Vim~
@@ -933,7 +938,7 @@ through the rf command because the plugin was designed to connect
 each Vim instance with its own R instance. If you start R before Vim, it will
 not inherit from Vim the environment variables VIMRPLUGIN_TMPDIR,
 VIMRPLUGIN_HOME, VIMEDITOR_SVRNM and VIMINSTANCEID. The first one is the path
-used by the R package vimcom to save temporary files used by the Vim-R-plugin
+used by the R package vimcom.plus to save temporary files used by the Vim-R-plugin
 to: perform omnicompletion, show R documentation in a Vim buffer, and update
 the Object Browser. The last one is used by the Vim-R-plugin to know that it is
 not connecting to an R instance initiated by another Vim instance. If you use
@@ -955,9 +960,9 @@ procedures are necessary for all cases):
 <
    In R do:
 >
-   detach("package:vimcom.plus", unload = TRUE) # or vimcom
+   detach("package:vimcom.plus", unload = TRUE)
    Sys.setenv(VIMRPLUGIN_TMPDIR="T") # where "T" is what Vim has echoed
-   library(vimcom.plus)              # or vimcom
+   library(vimcom.plus)
    Sys.setenv(VIMINSTANCEID="I")     # where "I" is what Vim has echoed
    Sys.setenv(VIMEDITOR_SVRNM"="S")  # where "S" is what Vim has echoed
    Sys.setenv(VIMRPLUGIN_HOME"="H")  # where "H" is what Vim has echoed
@@ -1570,20 +1575,20 @@ will be shown only if "preview" is also included in your 'completeopt'.
 
 6.30. Time to wait for vimcom.plus loading~
 						      *vimrplugin_vimcom_wait*
-The Vim-R-plugin waits 5000 milliseconds for vimcom.plus (or vimcom) package
-to be loaded during R startup. It then checks whether you are using the
-correct version of vimcom.plus. On Unix, it also sends a message to R update
-the list of uploaded libraries and, then, immediately updates the syntax
-highlighting of function names. If 5000 milliseconds is not enough to your R
-startup, then set a higher value for the variable in your |vimrc|. Example:
+The Vim-R-plugin waits 5000 milliseconds for vimcom.plus package to be loaded
+during R startup. It then checks whether you are using the correct version of
+vimcom.plus. On Unix, it also sends a message to R update the list of uploaded
+libraries and, then, immediately updates the syntax highlighting of function
+names. If 5000 milliseconds is not enough to your R startup, then set a higher
+value for the variable in your |vimrc|. Example:
 >
    let vimrplugin_vimcom_wait = 10000
 <
 Note: You should have the line  `library(vimcom.plus)`  in your Rprofile. The
 Vim command  :RpluginConfig  adds that line for you.
 
-If you do not want to install the vimcom.plus (or vimcom) package, then put in
-your |vimrc|:
+If you do not want to install the vimcom.plus package, then put in your
+|vimrc|:
 >
    let vimrplugin_vimcom_wait = -1
 <
@@ -2270,8 +2275,6 @@ please read this document from the beginning.
        # Load the vimcom.plus library only if R was started by Vim:
        if(Sys.getenv("VIMRPLUGIN_TMPDIR") != ""){
            library(vimcom.plus)
-           # If you can't install the vimcom.plus package, do:
-           # library(vimcom)
            # See R documentation on Vim buffer even if asking for help in R Console:
            if(Sys.getenv("VIM_PANE") != "")
                options(help_type = "text", pager = vim.pager)
@@ -2370,7 +2373,7 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details.
 							       *r-plugin-news*
 10. News~
 
-1.0 (2014-04-04)
+1.0 (2014-04-22)
 
  * vimrplugin_openpdf now accepts three values: 0, 1 and 2.
 

From eb80213ca96f77d248585e5ee8abfb4bb8fc245b Mon Sep 17 00:00:00 2001
From: Sebastian Gibb 
Date: Thu, 24 Apr 2014 14:53:49 +0100
Subject: [PATCH 0646/1050] fix roxygen noRd keyword

---
 syntax/r.vim | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/syntax/r.vim b/syntax/r.vim
index 7f0c783..683b7ed 100644
--- a/syntax/r.vim
+++ b/syntax/r.vim
@@ -38,7 +38,7 @@ syn match rOKeyword contained "@\(param\|return\|name\|rdname\|examples\|include
 syn match rOKeyword contained "@\(S3method\|TODO\|aliases\|alias\|assignee\|author\|callGraphDepth\|callGraph\)"
 syn match rOKeyword contained "@\(callGraphPrimitives\|concept\|exportClass\|exportMethod\|exportPattern\|export\|formals\)"
 syn match rOKeyword contained "@\(format\|importClassesFrom\|importFrom\|importMethodsFrom\|import\|keywords\)"
-syn match rOKeyword contained "@\(method\|nord\|note\|references\|seealso\|setClass\|slot\|source\|title\|usage\)"
+syn match rOKeyword contained "@\(method\|noRd\|note\|references\|seealso\|setClass\|slot\|source\|title\|usage\)"
 syn match rOComment contains=@Spell,rOKeyword "#'.*"
 
 

From 559937250c8e04495d009303def2462c743447d5 Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Sat, 26 Apr 2014 06:58:10 -0300
Subject: [PATCH 0647/1050] Set the value of rplugin_R if not defined yet.

---
 ftplugin/r_rplugin.vim | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/ftplugin/r_rplugin.vim b/ftplugin/r_rplugin.vim
index 737bf21..9e1378f 100644
--- a/ftplugin/r_rplugin.vim
+++ b/ftplugin/r_rplugin.vim
@@ -22,6 +22,10 @@ function! ShowRout()
         call delete(routfile)
     endif
 
+    if !exists("b:rplugin_R")
+        call SetRPath()
+    endif
+
     " if not silent, the user will have to type 
     silent update
     if has("win32") || has("win64")

From 6a3a354757896c8b1a481061acb528a77bfa018a Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Tue, 29 Apr 2014 23:03:46 -0300
Subject: [PATCH 0648/1050] Update error message.

---
 autoload/rcomplete.vim | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/autoload/rcomplete.vim b/autoload/rcomplete.vim
index 0d659d6..a3a8ea7 100644
--- a/autoload/rcomplete.vim
+++ b/autoload/rcomplete.vim
@@ -25,7 +25,7 @@ fun! rcomplete#CompleteR(findstart, base)
     endif
 
     if len(g:rplugin_liblist) == 0
-        call add(res, {'word': a:base, 'menu': " [ List is empty. Run  :RUpdateObjList ]"})
+        call add(res, {'word': a:base, 'menu': " [ List is empty. Did you load vimcom.plus package? ]"})
     endif
 
     let flines = g:rplugin_liblist + g:rplugin_globalenvlines

From 3672889b2e9c6321fa91479a3f9322fe75a497cd Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Thu, 1 May 2014 12:34:41 -0300
Subject: [PATCH 0649/1050] Detail information about bugs affecting MacVim.

---
 doc/r-plugin.txt | 40 ++++++++++++++++++++++++++++++++--------
 1 file changed, 32 insertions(+), 8 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index df974bb..898be9e 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -115,6 +115,8 @@ Before installing the plugin, you should install its dependencies:
    Vim >= 7.4: http://www.vim.org/download.php
                In addition to the most commonly used features, the plugin
                requires: |+python| or |+python3|, |+clientserver| and |+conceal|. 
+	       Note: If you use Mac OS X, read about the bugs that affect
+	       MacVim: |r-plugin-macvim|.
 
    R >= 3.0.0: http://www.r-project.org/
 
@@ -584,6 +586,9 @@ highlighted only if their libraries are loaded by R (but see
 Note: If you have too many loaded packages Vim may be unable to load the list
 of functions for syntax highlight.
 
+Note: If you use Mac OS X, read about the bugs that affect MacVim:
+|r-plugin-macvim|.
+
 
 4.4. Omni completion~
 
@@ -602,9 +607,9 @@ omni completion will show the column names.
 
 Only the names of objects in .GlobalEnv and in loaded libraries are completed,
 and the |clientserver| feature is required to get the list of loaded libraries
-automatically updated. If Vim is running without the |clientserver| feature,
-only objects of libraries listed in |vimrplugin_permanent_libs| will have
-their names completed.
+automatically updated. If either R is not running or Vim is running without
+the |clientserver| feature, only objects of libraries listed in
+|vimrplugin_permanent_libs| will have their names completed.
 
 Vim uses one file to store the names of .GlobalEnv objects and a list of files
 for all other objects. The .GlobalEnv list is stored in the
@@ -612,6 +617,9 @@ for all other objects. The .GlobalEnv list is stored in the
 files are stored in ~/.vim/r-plugin/objlist/ and remain available until you
 manually delete them.
 
+Note: If you use Mac OS X, read about the bugs that affect MacVim:
+|r-plugin-macvim|.
+
 
 4.5. The Object Browser~
 
@@ -631,10 +639,8 @@ have to explicitly start the server with the argument |--servername|.  To
 avoid having to type this argument every time that you start Vim, please look
 at the example in |r-plugin-bash-setup|.
 
-Note: On Mac OS X the Object Browser will not be automatically updated if you
-are using MacVim because the R package vimcom.plus has support only for
-Windows and X11 interprocess communication systems while MacVim is a Cocoa
-application.
+Note: If you use Mac OS X, read about the bugs that affect MacVim:
+|r-plugin-macvim|.
 
 In the .GlobalEnv view, if an object has the attribute "label", it will also
 be displayed. Please, see the R help for package vimcom.plus for some options
@@ -992,6 +998,21 @@ is running:
    let SendCmdToR = function('SendCmdToR_Windows')
 <
 
+5.7. Bugs that affect MacVim~
+							     *r-plugin-macvim*
+The R package vimcom.plus has support only for Windows and X11 interprocess
+communication systems while MacVim is a Cocoa application, that is,
+vimcom.plus is unable to send messages to MacVim. For the Vim-R-plugin,
+running MacVim is equivalent to running Vim without the |clientserver|
+feature, and the result are the following bugs:
+
+   * The Object Browser is not automatically updated.
+
+   * Syntax highlight of function names are not automatically updated when you
+     load a new R package and the omnicompletion may not work. For a
+     workaround, see |vimrplugin_permanent_libs|.
+
+
 ==============================================================================
 							    *r-plugin-options*
 6. Options~
@@ -1246,6 +1267,9 @@ of vimrplugin_permanent_libs:
 >
    let vimrplugin_permanent_libs = "base,stats,graphics,grDevices,utils,methods"
 <
+You may also want to define the value of vimrplugin_permanent_libs if you are
+running Vim without the |clientserver| feature.
+
 
 6.10. More colorful syntax highlight of .Rout files~
 						   *vimrplugin_routmorecolors*
@@ -2373,7 +2397,7 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details.
 							       *r-plugin-news*
 10. News~
 
-1.0 (2014-04-22)
+1.0 (2014-05-01)
 
  * vimrplugin_openpdf now accepts three values: 0, 1 and 2.
 

From ae9eb32a6f8555c20bf3ddff7794b1a35e55c047 Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Thu, 1 May 2014 13:40:03 -0300
Subject: [PATCH 0650/1050] Don't set the value of $VIMEDITOR_SVRNM in MacVim.

---
 r-plugin/common_global.vim | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index c05688c..e6240db 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -578,7 +578,7 @@ function StartR_TmuxSplit(rcmd)
     call system("tmux set-environment -g VIMRPLUGIN_TMPDIR '" . $VIMRPLUGIN_TMPDIR . "'")
     call system("tmux set-environment -g VIMRPLUGIN_HOME '" . g:rplugin_home . "'")
     call system("tmux set-environment -g VIM_PANE " . g:rplugin_vim_pane)
-    if v:servername != ""
+    if v:servername != "" && !has("gui_macvim")
         call system("tmux set-environment VIMEDITOR_SVRNM " . v:servername)
     endif
     call system("tmux set-environment VIMINSTANCEID " . $VIMINSTANCEID)
@@ -633,7 +633,7 @@ function StartR_ExternalTerm(rcmd)
                 \ 'set-environment -g VIMRPLUGIN_TMPDIR "' . $VIMRPLUGIN_TMPDIR . '"',
                 \ 'set-environment -g VIMRPLUGIN_HOME "' . g:rplugin_home . '"',
                 \ 'set-environment VIMINSTANCEID ' . $VIMINSTANCEID ]
-    if v:servername != ""
+    if v:servername != "" && !has("gui_macvim")
         let cnflines = cnflines + [ 'set-environment VIMEDITOR_SVRNM ' . v:servername ]
     endif
     if g:vimrplugin_notmuxconf
@@ -663,7 +663,7 @@ function StartR_ExternalTerm(rcmd)
     call system('export VIMRPLUGIN_TMPDIR=' . $VIMRPLUGIN_TMPDIR)
     call system('export VIMRPLUGIN_HOME=' . substitute(g:rplugin_home, ' ', '\\ ', "g"))
     call system('export VIMINSTANCEID=' . $VIMINSTANCEID)
-    if v:servername != ""
+    if v:servername != "" && !has("gui_macvim")
         call system('export VIMEDITOR_SVRNM=' . v:servername)
     endif
     " Start the terminal emulator even if inside a Tmux session
@@ -881,6 +881,7 @@ function WaitVimComStart()
         echon "\r                              "
         redraw
     endif
+    sleep 100m
     if filereadable($VIMRPLUGIN_TMPDIR . "/vimcom_running")
         let vr = readfile($VIMRPLUGIN_TMPDIR . "/vimcom_running")
         if vr[0] =~ "vimcom.plus"
@@ -3158,7 +3159,7 @@ if has("win32") || has("win64")
 endif
 
 let $VIMRPLUGIN_HOME = substitute(g:rplugin_home, ' ', '\\ ', "g")
-if v:servername != ""
+if v:servername != "" && !has("gui_macvim")
     let $VIMEDITOR_SVRNM = v:servername
 endif
 

From a55d9361048de2adce78497615baaf43480a1dc8 Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Sat, 3 May 2014 13:31:24 -0300
Subject: [PATCH 0651/1050] More information about Mac OS X problems.

---
 doc/r-plugin.txt | 30 +++++++++++++++++-------------
 1 file changed, 17 insertions(+), 13 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 898be9e..9d72f53 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -115,8 +115,8 @@ Before installing the plugin, you should install its dependencies:
    Vim >= 7.4: http://www.vim.org/download.php
                In addition to the most commonly used features, the plugin
                requires: |+python| or |+python3|, |+clientserver| and |+conceal|. 
-	       Note: If you use Mac OS X, read about the bugs that affect
-	       MacVim: |r-plugin-macvim|.
+	       Note: If you use Mac OS X, read about the bugs that affect it:
+	       |r-plugin-mac|.
 
    R >= 3.0.0: http://www.r-project.org/
 
@@ -586,8 +586,7 @@ highlighted only if their libraries are loaded by R (but see
 Note: If you have too many loaded packages Vim may be unable to load the list
 of functions for syntax highlight.
 
-Note: If you use Mac OS X, read about the bugs that affect MacVim:
-|r-plugin-macvim|.
+Note: If you use Mac OS X, read about the bugs that affect it: |r-plugin-mac|.
 
 
 4.4. Omni completion~
@@ -617,8 +616,7 @@ for all other objects. The .GlobalEnv list is stored in the
 files are stored in ~/.vim/r-plugin/objlist/ and remain available until you
 manually delete them.
 
-Note: If you use Mac OS X, read about the bugs that affect MacVim:
-|r-plugin-macvim|.
+Note: If you use Mac OS X, read about the bugs that affect it: |r-plugin-mac|.
 
 
 4.5. The Object Browser~
@@ -639,8 +637,7 @@ have to explicitly start the server with the argument |--servername|.  To
 avoid having to type this argument every time that you start Vim, please look
 at the example in |r-plugin-bash-setup|.
 
-Note: If you use Mac OS X, read about the bugs that affect MacVim:
-|r-plugin-macvim|.
+Note: If you use Mac OS X, read about the bugs that affect it: |r-plugin-mac|.
 
 In the .GlobalEnv view, if an object has the attribute "label", it will also
 be displayed. Please, see the R help for package vimcom.plus for some options
@@ -998,13 +995,13 @@ is running:
    let SendCmdToR = function('SendCmdToR_Windows')
 <
 
-5.7. Bugs that affect MacVim~
-							     *r-plugin-macvim*
+5.7. Bugs that affect Mac OS X~
+								*r-plugin-mac*
 The R package vimcom.plus has support only for Windows and X11 interprocess
 communication systems while MacVim is a Cocoa application, that is,
-vimcom.plus is unable to send messages to MacVim. For the Vim-R-plugin,
-running MacVim is equivalent to running Vim without the |clientserver|
-feature, and the result are the following bugs:
+vimcom.plus is unable to send messages to MacVim. For vimcom.plus, running
+MacVim is equivalent to running Vim without the |clientserver| feature, and
+the result are the following bugs:
 
    * The Object Browser is not automatically updated.
 
@@ -1012,6 +1009,13 @@ feature, and the result are the following bugs:
      load a new R package and the omnicompletion may not work. For a
      workaround, see |vimrplugin_permanent_libs|.
 
+To get omnicompletion, syntax highlight of function names and the Object
+Browser working properly, in addition to using Vim built with X11 support, and
+not MacVim, you also have to install XQuartz server (X11.app).
+
+If you need to access an Unix remote machine through ssh, X11 forwarding must
+be enabled in the remote machine.
+
 
 ==============================================================================
 							    *r-plugin-options*

From 196a99d3016757718f593469fa86ceaf637c3235 Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Sat, 3 May 2014 13:53:44 -0300
Subject: [PATCH 0652/1050] Note on how to use ssh properly.

---
 doc/r-plugin.txt | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 9d72f53..da80c5c 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -838,7 +838,15 @@ support in Tmux. You will be able to toggle mouse support on and off by typing
 <
 
 4.8.2 Remote access~
-
+							     *r-plugin-remote*
+If you need to access Vim in a remote Unix machine through ssh, you must
+enable X11 Forwarding in the server to get omnicompletion, syntax highlight of
+function names and the Object Browser working properly. Then, you should pass
+either the `-X` or the `-Y` argument to ssh, as in the examples below:
+>
+    ssh -X yourlogin@remote.address
+    ssh -Y yourlogin@remote.address
+<
 With Tmux, you can detach the Vim-R session and reattach it latter. This is
 useful if you plan to begin the use the Vim-R-plugin in a machine and latter
 move to another computer and access remotely your previous Vim-R session.
@@ -1013,8 +1021,7 @@ To get omnicompletion, syntax highlight of function names and the Object
 Browser working properly, in addition to using Vim built with X11 support, and
 not MacVim, you also have to install XQuartz server (X11.app).
 
-If you need to access an Unix remote machine through ssh, X11 forwarding must
-be enabled in the remote machine.
+See also: |r-plugin-remote|.
 
 
 ==============================================================================

From 83fedf9b45ca9c20c3452c68e284e0dd8849b045 Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Sat, 3 May 2014 20:32:24 -0300
Subject: [PATCH 0653/1050] TERM=screen-256color if R in external terminal.

---
 r-plugin/common_global.vim | 1 +
 1 file changed, 1 insertion(+)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index e6240db..f5d8ac7 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -645,6 +645,7 @@ function StartR_ExternalTerm(rcmd)
                     \ 'bind-key C-a send-prefix',
                     \ 'set-window-option -g mode-keys vi',
                     \ 'set -g status off',
+                    \ 'set -g default-terminal "screen-256color"',
                     \ "set -g terminal-overrides 'xterm*:smcup@:rmcup@'" ]
         if g:vimrplugin_external_ob || !has("gui_running")
             call extend(cnflines, ['set -g mode-mouse on', 'set -g mouse-select-pane on', 'set -g mouse-resize-pane on'])

From 4169b37f809a73054f6270627f3ac0b03b9f5cb3 Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Sat, 3 May 2014 20:40:33 -0300
Subject: [PATCH 0654/1050] Don't add setOutputColors256() to ~/.Rprofile.

---
 r-plugin/vimrconfig.vim | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/r-plugin/vimrconfig.vim b/r-plugin/vimrconfig.vim
index 67a6e61..63c99ed 100644
--- a/r-plugin/vimrconfig.vim
+++ b/r-plugin/vimrconfig.vim
@@ -80,13 +80,10 @@ function! RConfigRprofile()
                             \ "        options(editor = '" . 'gvim -f -c "set ft=r"' . "')",
                             \ '    else',
                             \ "        options(editor = '" . 'vim -c "set ft=r"' . "')",
+                            \ '    # Choose the colors for R output among 256 options.',
+                            \ '    # You should run show256Colors() and help(setOutputColors256) to',
+                            \ '    # know how to change the colors according to your taste.',
                             \ '    library(colorout)',
-                            \ '    if(Sys.getenv("TERM") != "linux" && Sys.getenv("TERM") != ""){',
-                            \ '        # Choose the colors for R output among 256 options.',
-                            \ '        # You should run show256Colors() and help(setOutputColors256) to',
-                            \ '        # know how to change the colors according to your taste:',
-                            \ '        setOutputColors256(verbose = FALSE)',
-                            \ '    }',
                             \ '    library(setwidth)']
             endif
             let rpflines += ['    library(vimcom.plus)']

From bbe9d773d4e1b4ab5001f44a6ac948ff8e399dce Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Sat, 3 May 2014 21:20:56 -0300
Subject: [PATCH 0655/1050] Add .gitignore.

---
 .gitignore | 4 ++++
 1 file changed, 4 insertions(+)
 create mode 100644 .gitignore

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..7569868
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,4 @@
+doc/tags
+r-plugin/objlist/omnils_*
+r-plugin/objlist/fun_*
+r-plugin/tmp*

From 6d718cef86d7e9dcd46237df42c6dfc4c177ec56 Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Sat, 3 May 2014 22:17:27 -0300
Subject: [PATCH 0656/1050] Use command to send line to knit child document.

---
 doc/r-plugin.txt           |  5 +++++
 r-plugin/common_global.vim | 27 +++++++++++++++++++++++++++
 2 files changed, 32 insertions(+)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index da80c5c..818323a 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -479,6 +479,11 @@ you want to see what lines are being sourced when sending a selection of
 lines, you should do either se or sa instead of
 ss.
 
+If the cursor is over the header of an R chunk with the `child` option (from
+Rnoweb, RMarkdown or RreStructuredText document), and you use one of the
+commands that send a single line of code to R, then the plugin will send to R
+the command to knit the child document.
+
 After the commands that send, sweave or knit the current buffer, Vim will save
 the current buffer if it has any pending changes before performing the tasks.
 After ao, Vim will run "R CMD BATCH --no-restore --no-save" on
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index f5d8ac7..0ae0a21 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -1705,6 +1705,21 @@ function SendFHChunkToR()
     call b:SourceLines(codelines, "silent")
 endfunction
 
+function KnitChild(line, godown)
+    let nline = substitute(a:line, '.*child *= *', "", "")
+    let cfile = substitute(nline, nline[0], "", "")
+    let cfile = substitute(cfile, nline[0] . '.*', "", "")
+    if filereadable(cfile)
+        let ok = g:SendCmdToR("require(knitr); knit('" . cfile . "')")
+        if a:godown =~ "down"
+            call cursor(line(".")+1, 1)
+            call GoDown()
+        endif
+    else
+        call RWarningMsg("File not found: '" . cfile . "'")
+    endif
+endfunction
+
 " Send current line to R.
 function SendLineToR(godown)
     let line = getline(".")
@@ -1722,6 +1737,10 @@ function SendLineToR(godown)
             endif
             return
         endif
+        if line =~ "^<<.*child *= *"
+            call KnitChild(line, a:godown)
+            return
+        endif
         if RnwIsInRCode(1) == 0
             return
         endif
@@ -1734,6 +1753,10 @@ function SendLineToR(godown)
             endif
             return
         endif
+        if line =~ "^```.*child *= *"
+            call KnitChild(line, a:godown)
+            return
+        endif
         let line = substitute(line, "^\\`\\`\\?", "", "")
         if RmdIsInRCode(1) == 0
             return
@@ -1747,6 +1770,10 @@ function SendLineToR(godown)
             endif
             return
         endif
+        if line =~ "^\.\. {r.*child *= *"
+            call KnitChild(line, a:godown)
+            return
+        endif
         let line = substitute(line, "^\\.\\. \\?", "", "")
         if RrstIsInRCode(1) == 0
             return

From d87bf32f823757892fb3f727c403f5545da9667f Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Sat, 3 May 2014 22:26:42 -0300
Subject: [PATCH 0657/1050] Update "Known bugs".

---
 doc/r-plugin.txt | 54 +++++++++++++++++++++++++++---------------------
 1 file changed, 31 insertions(+), 23 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 818323a..637c06a 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -932,8 +932,16 @@ indent the code below:
             paste(labels, seq_along(levels), sep = "")
     class(x) <- c(if(ordered) "ordered", "factor")
 <
+See: https://github.com/jcfaria/Vim-R-plugin/issues/77
 
-5.5. Wrong message that "R is busy" (Windows only)~
+
+5.5. Functions are not always correctly sent to R~
+
+The plugin is only capable of recognizing functions defined using the <-
+operator. See: https://github.com/jcfaria/Vim-R-plugin/issues/94
+
+
+5.6. Wrong message that "R is busy" (Windows only)~
 
 On Windows, when code is sent from Vim to R Console, the vimcom.plus library
 sets the value of the internal variable `r_is_busy` to 1. The value is set
@@ -947,7 +955,28 @@ tell Vim that "R is busy" and Vim will display this message. Everything should
 work as expected again after any valid code is executed in the R Console.
 
 
-5.6. R must be started by Vim~
+5.7. Bugs that affect Mac OS X~
+								*r-plugin-mac*
+The R package vimcom.plus has support only for Windows and X11 interprocess
+communication systems while MacVim is a Cocoa application, that is,
+vimcom.plus is unable to send messages to MacVim. For vimcom.plus, running
+MacVim is equivalent to running Vim without the |clientserver| feature, and
+the result are the following bugs:
+
+   * The Object Browser is not automatically updated.
+
+   * Syntax highlight of function names are not automatically updated when you
+     load a new R package and the omnicompletion may not work. For a
+     workaround, see |vimrplugin_permanent_libs|.
+
+To get omnicompletion, syntax highlight of function names and the Object
+Browser working properly, in addition to using Vim built with X11 support, and
+not MacVim, you also have to install XQuartz server (X11.app).
+
+See also: |r-plugin-remote|.
+
+
+5.8. R must be started by Vim~
 
 The communication between Vim and R will work only if R was started by Vim
 through the rf command because the plugin was designed to connect
@@ -1008,27 +1037,6 @@ is running:
    let SendCmdToR = function('SendCmdToR_Windows')
 <
 
-5.7. Bugs that affect Mac OS X~
-								*r-plugin-mac*
-The R package vimcom.plus has support only for Windows and X11 interprocess
-communication systems while MacVim is a Cocoa application, that is,
-vimcom.plus is unable to send messages to MacVim. For vimcom.plus, running
-MacVim is equivalent to running Vim without the |clientserver| feature, and
-the result are the following bugs:
-
-   * The Object Browser is not automatically updated.
-
-   * Syntax highlight of function names are not automatically updated when you
-     load a new R package and the omnicompletion may not work. For a
-     workaround, see |vimrplugin_permanent_libs|.
-
-To get omnicompletion, syntax highlight of function names and the Object
-Browser working properly, in addition to using Vim built with X11 support, and
-not MacVim, you also have to install XQuartz server (X11.app).
-
-See also: |r-plugin-remote|.
-
-
 ==============================================================================
 							    *r-plugin-options*
 6. Options~

From f0b3a2793a15fae91a8463e337e3b138ae2d2ace Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Sun, 4 May 2014 11:07:47 -0300
Subject: [PATCH 0658/1050] Check list of libs even without X Server.

---
 doc/r-plugin.txt           | 45 ++++++++++++++++++++++----------------
 r-plugin/common_buffer.vim | 15 +++++++++----
 r-plugin/common_global.vim |  7 ++++++
 3 files changed, 44 insertions(+), 23 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 637c06a..029d380 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -115,8 +115,8 @@ Before installing the plugin, you should install its dependencies:
    Vim >= 7.4: http://www.vim.org/download.php
                In addition to the most commonly used features, the plugin
                requires: |+python| or |+python3|, |+clientserver| and |+conceal|. 
-	       Note: If you use Mac OS X, read about the bugs that affect it:
-	       |r-plugin-mac|.
+	       Note: If you use either Mac OS X, read about the bugs that affect it:
+	       |r-plugin-nox|.
 
    R >= 3.0.0: http://www.r-project.org/
 
@@ -184,8 +184,8 @@ and ~/.bashrc (the  is `\` by default):
    :RpluginConfig
 <
 The above command will guide you through the final configuration steps, but
-if you prefer to configure everything by yourself, please, read the section
-|r-plugin-quick-setup|.
+if you prefer to configure everything by yourself, please, read the sections
+|r-plugin-nox| and |r-plugin-quick-setup|.
 
 If you start either GVim or Vim in a terminal emulator the plugin will start R
 in a external terminal emulator. If you start Vim inside of a Tmux session,
@@ -591,7 +591,7 @@ highlighted only if their libraries are loaded by R (but see
 Note: If you have too many loaded packages Vim may be unable to load the list
 of functions for syntax highlight.
 
-Note: If you use Mac OS X, read about the bugs that affect it: |r-plugin-mac|.
+Note: If you use Mac OS X, read about the bugs that affect it: |r-plugin-nox|.
 
 
 4.4. Omni completion~
@@ -621,7 +621,7 @@ for all other objects. The .GlobalEnv list is stored in the
 files are stored in ~/.vim/r-plugin/objlist/ and remain available until you
 manually delete them.
 
-Note: If you use Mac OS X, read about the bugs that affect it: |r-plugin-mac|.
+Note: If you use Mac OS X, read about the bugs that affect it: |r-plugin-nox|.
 
 
 4.5. The Object Browser~
@@ -642,7 +642,7 @@ have to explicitly start the server with the argument |--servername|.  To
 avoid having to type this argument every time that you start Vim, please look
 at the example in |r-plugin-bash-setup|.
 
-Note: If you use Mac OS X, read about the bugs that affect it: |r-plugin-mac|.
+Note: If you use Mac OS X, read about the bugs that affect it: |r-plugin-nox|.
 
 In the .GlobalEnv view, if an object has the attribute "label", it will also
 be displayed. Please, see the R help for package vimcom.plus for some options
@@ -955,23 +955,30 @@ tell Vim that "R is busy" and Vim will display this message. Everything should
 work as expected again after any valid code is executed in the R Console.
 
 
-5.7. Bugs that affect Mac OS X~
-								*r-plugin-mac*
-The R package vimcom.plus has support only for Windows and X11 interprocess
-communication systems while MacVim is a Cocoa application, that is,
-vimcom.plus is unable to send messages to MacVim. For vimcom.plus, running
-MacVim is equivalent to running Vim without the |clientserver| feature, and
-the result are the following bugs:
+5.7. Bugs that affect Mac OS X and Linux Console~
+								*r-plugin-nox*
+If you either run Vim in the Linux Console or start Vim in a terminal emulator
+without the command line argument |--servername|, Vim will not receive remote
+messages. The R package vimcom.plus has support only for Windows and X11
+interprocess communication systems while MacVim is a Cocoa application, that
+is, vimcom.plus is unable to send messages to MacVim too. For vimcom.plus,
+running MacVim is equivalent to running Vim without the |clientserver|
+feature.
 
-   * The Object Browser is not automatically updated.
+When Vim cannot receive messages, the result is:
 
-   * Syntax highlight of function names are not automatically updated when you
-     load a new R package and the omnicompletion may not work. For a
-     workaround, see |vimrplugin_permanent_libs|.
+   * The Object Browser is not automatically updated. You have to do
+     ro to update it manually.
+
+   * Syntax highlight of function names and the list of objects for
+     omnicompletion are not immediately updated after you load a new R
+     package. They are updated only after the |CursorHold| event is triggered,
+     that is, after you stay 'updatetime' milliseconds in Normal mode doing
+     nothing. For a workaround, see |vimrplugin_permanent_libs|.
 
 To get omnicompletion, syntax highlight of function names and the Object
 Browser working properly, in addition to using Vim built with X11 support, and
-not MacVim, you also have to install XQuartz server (X11.app).
+not MacVim, on Mac OS X, you also have to install XQuartz server (X11.app).
 
 See also: |r-plugin-remote|.
 
diff --git a/r-plugin/common_buffer.vim b/r-plugin/common_buffer.vim
index 2c00899..14f9d7b 100644
--- a/r-plugin/common_buffer.vim
+++ b/r-plugin/common_buffer.vim
@@ -72,11 +72,18 @@ if !exists("g:SendCmdToR")
     let g:SendCmdToR = function('SendCmdToR_fake')
 endif
 
-if &filetype != "r"
-    autocmd CursorMoved  call RCheckLibList()
-    if g:vimrplugin_insert_mode_cmds == 1
-        autocmd CursorMovedI  call RCheckLibList()
+if &filetype != "rbrowser"
+    if v:servername == "" || has("gui_macvim")
+        autocmd CursorHold  call RCheckLibListFile()
+    else
+        if &filetype != "r"
+            autocmd CursorMoved  call RCheckLibList()
+            if g:vimrplugin_insert_mode_cmds == 1
+                autocmd CursorMovedI  call RCheckLibList()
+            endif
+        endif
     endif
 endif
 
 
+
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 0ae0a21..07eac13 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -2018,6 +2018,13 @@ function RCheckLibList()
     endif
 endfunction
 
+function RCheckLibListFile()
+    if filereadable($VIMRPLUGIN_TMPDIR . "/libnames_" . $VIMINSTANCEID)
+        call RealRFillLibList()
+        call delete($VIMRPLUGIN_TMPDIR . "/libnames_" . $VIMINSTANCEID)
+    endif
+endfunction
+
 " This function is called by the R package vimcom.plus whenever a library is
 " loaded.
 function RFillLibList()

From 887b664eb872c0ee3893843d6a61200e183ed916 Mon Sep 17 00:00:00 2001
From: Michael Lerch 
Date: Sun, 4 May 2014 14:38:55 -0600
Subject: [PATCH 0659/1050] prevent generation of markup of knit child files

related to #93
---
 r-plugin/common_global.vim | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 07eac13..1057cc8 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -1710,7 +1710,7 @@ function KnitChild(line, godown)
     let cfile = substitute(nline, nline[0], "", "")
     let cfile = substitute(cfile, nline[0] . '.*', "", "")
     if filereadable(cfile)
-        let ok = g:SendCmdToR("require(knitr); knit('" . cfile . "')")
+        let ok = g:SendCmdToR("require(knitr); knit('" . cfile . "', output=tempfile())")
         if a:godown =~ "down"
             call cursor(line(".")+1, 1)
             call GoDown()

From 422062ed8ea7ba178c58754758e9acfc10617d58 Mon Sep 17 00:00:00 2001
From: Johannes Ranke 
Date: Tue, 6 May 2014 16:09:30 +0200
Subject: [PATCH 0660/1050] Added a note about setting the path to R on Windows

---
 doc/r-plugin.txt | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index df974bb..d6bec51 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -265,7 +265,13 @@ Please, click on the menu bar
    Start/Close
    Start R (default)
 <
-and, finally, click on the menu bar
+If R does not start and you get an error message instead, you may want to 
+set the path to your Rgui.exe in your |vimrc|, for example (please adapt to
+your installation)
+
+   let vimrplugin_r_path = 'C:\Program Files\R\R-3.1.0\bin\i386'
+
+Finally, click on the menu bar
 >
    R
    Configure (Vim-R)

From dd47d714520bad4db70f4d45c629d855c3c263e0 Mon Sep 17 00:00:00 2001
From: Johannes Ranke 
Date: Tue, 6 May 2014 16:18:06 +0200
Subject: [PATCH 0661/1050] Fix markup

---
 doc/r-plugin.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index cfeeb26..7d96841 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -270,9 +270,9 @@ Please, click on the menu bar
 If R does not start and you get an error message instead, you may want to 
 set the path to your Rgui.exe in your |vimrc|, for example (please adapt to
 your installation)
-
+>
    let vimrplugin_r_path = 'C:\Program Files\R\R-3.1.0\bin\i386'
-
+<
 Finally, click on the menu bar
 >
    R

From a468d47bd7d27ed16b1fcfa8955863aee8e11106 Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Tue, 6 May 2014 11:28:41 -0300
Subject: [PATCH 0662/1050] Check whether Rgui.exe is readable.

---
 r-plugin/common_global.vim | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 1057cc8..63ca1bc 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -3413,7 +3413,7 @@ if has("win32") || has("win64")
         finish
     endif
     if !exists("g:rplugin_rpathadded")
-        if exists("g:vimrplugin_r_path") && isdirectory(g:vimrplugin_r_path)
+        if exists("g:vimrplugin_r_path") && isdirectory(g:vimrplugin_r_path) && filereadable(g:vimrplugin_r_path . "\\Rgui.exe")
             let $PATH = g:vimrplugin_r_path . ";" . $PATH
             let g:rplugin_Rgui = g:vimrplugin_r_path . "\\Rgui.exe"
         else

From 920d2802517c76d3d0e57a8e67997b877468a96e Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Tue, 6 May 2014 11:29:52 -0300
Subject: [PATCH 0663/1050] Simplify Rprofile and bashrc configuration.

---
 r-plugin/vimrconfig.vim | 33 ++++++++++++++-------------------
 1 file changed, 14 insertions(+), 19 deletions(-)

diff --git a/r-plugin/vimrconfig.vim b/r-plugin/vimrconfig.vim
index 63c99ed..2e3c2ab 100644
--- a/r-plugin/vimrconfig.vim
+++ b/r-plugin/vimrconfig.vim
@@ -80,9 +80,7 @@ function! RConfigRprofile()
                             \ "        options(editor = '" . 'gvim -f -c "set ft=r"' . "')",
                             \ '    else',
                             \ "        options(editor = '" . 'vim -c "set ft=r"' . "')",
-                            \ '    # Choose the colors for R output among 256 options.',
-                            \ '    # You should run show256Colors() and help(setOutputColors256) to',
-                            \ '    # know how to change the colors according to your taste.',
+                            \ '    # See ?setOutputColors256 to know how to customize R output colors',
                             \ '    library(colorout)',
                             \ '    library(setwidth)']
             endif
@@ -419,34 +417,31 @@ function! RConfigBash()
                 let blines += ['# Change the TERM environment variable (to get 256 colors) and make Vim',
                             \ '# connecting to X Server even if running in a terminal emulator (to get',
                             \ '# dynamic update of syntax highlight and Object Browser):',
-                            \ 'if [ "x$DISPLAY" != "x" ]',
+                            \ 'if [ "$TERM" = "xterm" ] || [ "$TERM" = "xterm-256color" ]',
                             \ 'then',
+                            \ '    export TERM=xterm-256color',
                             \ '    export HAS_256_COLORS=yes',
-                            \ '    alias tmux="tmux -2"',
-                            \ '    if [ "$TERM" = "xterm" ]',
-                            \ '    then',
-                            \ '        export TERM=xterm-256color',
-                            \ '    fi',
+                            \ 'fi',
+                            \ 'if [ "$TERM" = "screen" ] && [ "$HAS_256_COLORS" = "yes" ]',
+                            \ 'then',
+                            \ '    export TERM=screen-256color',
+                            \ 'fi',
+                            \ 'if [ "x$DISPLAY" != "x" ]',
+                            \ 'then',
                             \ '    alias vim="vim --servername VIM"',
-                            \ '    if [ "$TERM" == "xterm" ] || [ "$TERM" == "xterm-256color" ]',
+                            \ '    if [ "$HAS_256_COLORS" = "yes" ]',
                             \ '    then',
-                            \ '        function tvim(){ tmux -2 new-session "TERM=screen-256color vim --servername VIM $@" ; }',
+                            \ '        function tvim(){ tmux new-session "TERM=screen-256color vim --servername VIM $@" ; }',
                             \ '    else',
                             \ '        function tvim(){ tmux new-session "vim --servername VIM $@" ; }',
                             \ '    fi',
                             \ 'else',
-                            \ '    if [ "$TERM" == "xterm" ] || [ "$TERM" == "xterm-256color" ]',
+                            \ '    if [ "$HAS_256_COLORS" = "yes" ]',
                             \ '    then',
-                            \ '        export HAS_256_COLORS=yes',
-                            \ '        alias tmux="tmux -2"',
-                            \ '        function tvim(){ tmux -2 new-session "TERM=screen-256color vim $@" ; }',
+                            \ '        function tvim(){ tmux new-session "TERM=screen-256color vim $@" ; }',
                             \ '    else',
                             \ '        function tvim(){ tmux new-session "vim $@" ; }',
                             \ '    fi',
-                            \ 'fi',
-                            \ 'if [ "$TERM" = "screen" ] && [ "$HAS_256_COLORS" = "yes" ]',
-                            \ 'then',
-                            \ '    export TERM=screen-256color',
                             \ 'fi' ]
                 call writefile(blines, $HOME . "/.bashrc")
                 if !has("gui_running")

From bbf41b7187eea6bee9649445bc9059243ebe2e42 Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Tue, 6 May 2014 23:29:36 -0300
Subject: [PATCH 0664/1050] Warn if vimrplugin_r_path isn't a directory.

---
 r-plugin/common_global.vim | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 63ca1bc..b758d91 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -2034,6 +2034,7 @@ function RFillLibList()
         " Avoid E341 (Internal error: lalloc(0, ))
         let g:rplugin_newliblist = 1
     endif
+    return "OK"
 endfunction
 
 function RealRFillLibList()
@@ -3413,7 +3414,17 @@ if has("win32") || has("win64")
         finish
     endif
     if !exists("g:rplugin_rpathadded")
-        if exists("g:vimrplugin_r_path") && isdirectory(g:vimrplugin_r_path) && filereadable(g:vimrplugin_r_path . "\\Rgui.exe")
+        if exists("g:vimrplugin_r_path")
+            if !isdirectory(g:vimrplugin_r_path)
+                call RWarningMsgInp("vimrplugin_r_path must be a directory (check your vimrc)")
+                let g:rplugin_failed = 1
+                finish
+            endif
+            if !filereadable(g:vimrplugin_r_path . "\\Rgui.exe")
+                call RWarningMsgInp('File "' . g:vimrplugin_r_path . '\Rgui.exe" is unreadable (check vimrplugin_r_path in your vimrc).')
+                let g:rplugin_failed = 1
+                finish
+            endif
             let $PATH = g:vimrplugin_r_path . ";" . $PATH
             let g:rplugin_Rgui = g:vimrplugin_r_path . "\\Rgui.exe"
         else

From 5827b31c1fe2a6d8bb79fd9b7785080ed679cdc8 Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Wed, 7 May 2014 07:46:29 -0300
Subject: [PATCH 0665/1050] Output knitr child document to /dev/null.

---
 r-plugin/common_global.vim | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index b758d91..88ecc69 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -1710,7 +1710,7 @@ function KnitChild(line, godown)
     let cfile = substitute(nline, nline[0], "", "")
     let cfile = substitute(cfile, nline[0] . '.*', "", "")
     if filereadable(cfile)
-        let ok = g:SendCmdToR("require(knitr); knit('" . cfile . "', output=tempfile())")
+        let ok = g:SendCmdToR("require(knitr); knit('" . cfile . "', output=" . g:rplugin_null . ")")
         if a:godown =~ "down"
             call cursor(line(".")+1, 1)
             call GoDown()
@@ -3572,6 +3572,14 @@ if exists("g:vimrplugin_term_cmd")
     let g:rplugin_termcmd = g:vimrplugin_term_cmd
 endif
 
+if filewritable('/dev/null')
+    let g:rplugin_null = "'/dev/null'"
+elseif has("win32") && filewritable('NUL')
+    let g:rplugin_null = "'NUL'"
+else
+    let g:rplugin_null = 'tempfile()'
+endif
+
 autocmd BufEnter * call RBufEnter()
 if &filetype != "rbrowser"
     autocmd VimLeave * call RVimLeave()

From 91eba66c7040b3ca3c99272a0d4651ee32dc6d8b Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Wed, 7 May 2014 11:21:36 -0300
Subject: [PATCH 0666/1050] Fix %whatever% operator pattern.

---
 syntax/r.vim | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/syntax/r.vim b/syntax/r.vim
index 683b7ed..62c0cf1 100644
--- a/syntax/r.vim
+++ b/syntax/r.vim
@@ -3,7 +3,7 @@
 " Maintainer:	      Jakson Aquino 
 " Former Maintainers: Vaidotas Zemlys 
 " 		      Tom Payne 
-" Last Change:	      Sun Feb 23, 2014  08:53AM
+" Last Change:	      Wed May 07, 2014  11:18AM
 " Filenames:	      *.R *.r *.Rhistory *.Rt
 " 
 " NOTE: The highlighting of R functions is defined in the
@@ -120,7 +120,7 @@ if &filetype != "rmd" && &filetype != "rrst"
 else
     syn match rOperator    "[|!<>^~`/:]"
 endif
-syn match rOperator    "%\{2}\|%\S*%"
+syn match rOperator    "%\{2}\|%\S\{-}%"
 syn match rOpError  '\*\{3}'
 syn match rOpError  '//'
 syn match rOpError  '&&&'

From 9ff5df8de7129752ba7420cbfce1789fac2a9dfd Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Wed, 7 May 2014 23:17:03 -0300
Subject: [PATCH 0667/1050] Export $TERM if has 256 colors. The next version of
 colorout package will default to 256 colors if the TERM environment variable
 includes the string "256".

---
 r-plugin/common_global.vim | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 88ecc69..ff65927 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -578,6 +578,9 @@ function StartR_TmuxSplit(rcmd)
     call system("tmux set-environment -g VIMRPLUGIN_TMPDIR '" . $VIMRPLUGIN_TMPDIR . "'")
     call system("tmux set-environment -g VIMRPLUGIN_HOME '" . g:rplugin_home . "'")
     call system("tmux set-environment -g VIM_PANE " . g:rplugin_vim_pane)
+    if &t_Co == 256
+        call system('tmux set -g default-terminal "' . $TERM . '"')
+    endif
     if v:servername != "" && !has("gui_macvim")
         call system("tmux set-environment VIMEDITOR_SVRNM " . v:servername)
     endif

From 723ca5a054cd67c906ba1ed3d1dfd64e4973ac29 Mon Sep 17 00:00:00 2001
From: Keith Hughitt 
Date: Thu, 8 May 2014 00:21:35 -0400
Subject: [PATCH 0668/1050] Added support for executing child chunks when
 knitting up to current line

---
 r-plugin/common_global.vim | 23 +++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index ff65927..f5f38b2 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -1679,12 +1679,15 @@ function SendFHChunkToR()
     if &filetype == "rnoweb"
         let begchk = "^<<.*>>=\$"
         let endchk = "^@"
+        let chdchk = "^<<.*child *= *"
     elseif &filetype == "rmd"
         let begchk = "^[ \t]*```[ ]*{r"
         let endchk = "^[ \t]*```$"
+        let chdchk = "^```.*child *= *"
     elseif &filetype == "rrst"
         let begchk = "^\\.\\. {r"
         let endchk = "^\\.\\. \\.\\."
+        let chdchk = "^\.\. {r.*child *= *"
     else
         " Should never happen
         call RWarningMsg('Strange filetype (SendFHChunkToR): "' . &filetype '"')
@@ -1696,11 +1699,23 @@ function SendFHChunkToR()
     let idx = 1
     while idx < here
         if curbuf[idx] =~ begchk
-            let idx += 1
-            while curbuf[idx] !~ endchk && idx < here
-                let codelines += [curbuf[idx]]
+            " Child R chunk
+            if curbuf[idx] =~ chdchk
+                " First run everything up to child chunk and reset buffer
+                call b:SourceLines(codelines, "silent")
+                let codelines = []
+
+                " Next run child chunk and continue
+                call KnitChild(curbuf[idx], 'stay')
                 let idx += 1
-            endwhile
+            " Regular R chunk
+            else
+                let idx += 1
+                while curbuf[idx] !~ endchk && idx < here
+                    let codelines += [curbuf[idx]]
+                    let idx += 1
+                endwhile
+            endif
         else
             let idx += 1
         endif

From 633d3524946a24576b490e1d6123f1ea1868ea54 Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Fri, 9 May 2014 10:17:34 -0300
Subject: [PATCH 0669/1050] Don't add lines that must be at the top of vimrc.
 The following lines will not be added by  :RpluginConfig  because they must
 be at the top or near the very top of the vimrc:    set nocompatible   
 syntax enable    filetype plugin on    filetype indent on

---
 doc/r-plugin.txt        |  5 +++--
 r-plugin/vimrconfig.vim | 13 -------------
 2 files changed, 3 insertions(+), 15 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 7d96841..c1fb35b 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -148,7 +148,8 @@ Before installing the plugin, you should install its dependencies:
    documentation.
    
 You need to activate plugins and indentation according to 'filetype'. You
-should have at least the following options in your |vimrc|:
+should have at least the following options at the top or at near the very top
+of your |vimrc|:
 >
    set nocompatible
    syntax enable
@@ -2434,7 +2435,7 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details.
 							       *r-plugin-news*
 10. News~
 
-1.0 (2014-05-01)
+1.0 (2014-05-09)
 
  * vimrplugin_openpdf now accepts three values: 0, 1 and 2.
 
diff --git a/r-plugin/vimrconfig.vim b/r-plugin/vimrconfig.vim
index 2e3c2ab..63e5a76 100644
--- a/r-plugin/vimrconfig.vim
+++ b/r-plugin/vimrconfig.vim
@@ -227,19 +227,6 @@ function! RConfigVimrc()
         let vlines += ['" Lines added by the Vim-R-plugin command :RpluginConfig:']
     endif
 
-    if RFindString(vlines, 'set\s*nocompatible') == 0 && RFindString(vlines, 'set\s*nocp') == 0
-        let vlines += ['set nocompatible']
-    endif
-    if RFindString(vlines, 'syntax\s*on') == 0 && RFindString(vlines, 'syntax\s*enable') == 0
-        let vlines += ['syntax enable']
-    endif
-    if RFindString(vlines, 'filet.* plugin on') == 0
-        let vlines += ['filetype plugin on']
-    endif
-    if RFindString(vlines, 'filet.* indent on') == 0
-        let vlines += ['filetype indent on']
-    endif
-
     if RFindString(vlines, "maplocalleader") == 0
         redraw
         echo " "

From b3095b9fdb082224a8392e69d26bbc6b2023d829 Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Fri, 9 May 2014 13:41:54 -0300
Subject: [PATCH 0670/1050] Set 'iskeyword' after including LaTeX syntax.

---
 syntax/rmd.vim | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/syntax/rmd.vim b/syntax/rmd.vim
index 487d04e..90874f4 100644
--- a/syntax/rmd.vim
+++ b/syntax/rmd.vim
@@ -1,6 +1,6 @@
 " markdown Text with R statements
 " Language: markdown with R code chunks
-" Last Change: Wed Mar 26, 2014  06:52PM
+" Last Change: Fri May 09, 2014  01:40PM
 "
 " CONFIGURATION:
 "   To highlight chunk headers as R code, put in your vimrc:
@@ -32,8 +32,6 @@ if exists("b:current_syntax")
     unlet b:current_syntax
 endif
 
-setlocal iskeyword=@,48-57,_,.
-
 if exists("g:rmd_syn_hl_chunk")
     " highlight R code inside chunk header
     syntax match rmdChunkDelim "^[ \t]*```{r" contained
@@ -74,6 +72,8 @@ if rmdIsPandoc == 0
     hi def link rmdLaTeXRegDelim Special
 endif
 
+setlocal iskeyword=@,48-57,_,.
+
 syn sync match rmdSyncChunk grouphere rmdChunk "^[ \t]*``` *{r"
 
 hi def link rmdChunkDelim Special

From bf4a837d1c96426cbaf07543c098800a4b5b332c Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Fri, 9 May 2014 14:49:38 -0300
Subject: [PATCH 0671/1050] Put back config lines. Even GVim on Windows needs
 these lines to have the plugin enabled.

---
 r-plugin/vimrconfig.vim | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/r-plugin/vimrconfig.vim b/r-plugin/vimrconfig.vim
index 63e5a76..2e3c2ab 100644
--- a/r-plugin/vimrconfig.vim
+++ b/r-plugin/vimrconfig.vim
@@ -227,6 +227,19 @@ function! RConfigVimrc()
         let vlines += ['" Lines added by the Vim-R-plugin command :RpluginConfig:']
     endif
 
+    if RFindString(vlines, 'set\s*nocompatible') == 0 && RFindString(vlines, 'set\s*nocp') == 0
+        let vlines += ['set nocompatible']
+    endif
+    if RFindString(vlines, 'syntax\s*on') == 0 && RFindString(vlines, 'syntax\s*enable') == 0
+        let vlines += ['syntax enable']
+    endif
+    if RFindString(vlines, 'filet.* plugin on') == 0
+        let vlines += ['filetype plugin on']
+    endif
+    if RFindString(vlines, 'filet.* indent on') == 0
+        let vlines += ['filetype indent on']
+    endif
+
     if RFindString(vlines, "maplocalleader") == 0
         redraw
         echo " "

From 7f80ccb97b73b4996232fbddd7352ca915a7fff1 Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Wed, 14 May 2014 09:09:34 -0300
Subject: [PATCH 0672/1050] Fix menu when global_r_plugin.vim is used.

---
 doc/r-plugin.txt             | 11 ++++++++---
 r-plugin/global_r_plugin.vim |  2 +-
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index c1fb35b..9a37f2c 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -1453,9 +1453,9 @@ vimrplugin_sweaveargs variable.
 
 6.20. Never unmake the R menu~
 						*vimrplugin_never_unmake_menu*
-Use this option if you want that the "R" menu item is not deleted when you
-change from one buffer to another, for example, when going from an .R file to
-a .txt one:
+Use this option if you want that the "R" menu item in GVim is not deleted when
+you change from one buffer to another, for example, when going from an .R file
+to a .txt one:
 >
    let vimrplugin_never_unmake_menu = 1
 <
@@ -2169,6 +2169,11 @@ a Vim autocommand:
 >
    autocmd BufNewFile,BufRead *.m let vimrplugin_exe = "octave" | let vimrplugin_quit = "quit"
 <
+If you use GVim, you may also want to set |vimrplugin_never_unmake_menu| in
+your |vimrc|:
+>
+   let vimrplugin_never_unmake_menu = 1
+<
 
 9.18. Disable syntax highlight of R functions~
 
diff --git a/r-plugin/global_r_plugin.vim b/r-plugin/global_r_plugin.vim
index 9d5c979..8ec33f0 100644
--- a/r-plugin/global_r_plugin.vim
+++ b/r-plugin/global_r_plugin.vim
@@ -17,7 +17,7 @@ call RCreateSendMaps()
 call RControlMaps()
 
 " Menu R
-if has("gui_running")
+if g:vimrplugin_never_unmake_menu && has("gui_running")
     call MakeRMenu()
 endif
 

From d5f2d69d0ff57b9b87ca9874ab742f7604593372 Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Wed, 14 May 2014 23:23:22 -0300
Subject: [PATCH 0673/1050] Tip on how to properly build Vim on Mac OS X.
 Thanks to Fong Chun Chan for discovering the correct way of installing Vim
 through homebrew.

---
 doc/r-plugin.txt | 57 ++++++++++++++++++++++++++++++++----------------
 1 file changed, 38 insertions(+), 19 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 9a37f2c..692006a 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -146,7 +146,7 @@ Before installing the plugin, you should install its dependencies:
    GNU/Linux distributions and other Unix variants. Unfortunately their
    installation instructions vary widely and are beyond the scope of this
    documentation.
-   
+
 You need to activate plugins and indentation according to 'filetype'. You
 should have at least the following options at the top or at near the very top
 of your |vimrc|:
@@ -216,7 +216,7 @@ dependencies:
     * R's version must be >= 3.0.0: http://www.r-project.org/
 
     * vimcom.plus = 1.0-0: http://www.lepem.ufc.br/jaa/vimcom.plus.html
-      
+
       Note: If you cannot build vimcom.plus yourself, you will want to
       download and install the zip file.
 
@@ -239,7 +239,7 @@ dependencies:
 Now, download the latest version of `Vim-R-plugin.vmb` from
 
     http://www.vim.org/scripts/script.php?script_id=2628
-    
+
 and open the directory where you have downloaded it, right click on it and
 choose "Edit with Vim".
 >
@@ -851,24 +851,38 @@ support in Tmux. You will be able to toggle mouse support on and off by typing
 
 4.8.2 Remote access~
 							     *r-plugin-remote*
-If you need to access Vim in a remote Unix machine through ssh, you must
-enable X11 Forwarding in the server to get omnicompletion, syntax highlight of
-function names and the Object Browser working properly. Then, you should pass
-either the `-X` or the `-Y` argument to ssh, as in the examples below:
+If you need to access Vim in a remote Unix machine through ssh, and if you
+want to get omnicompletion, syntax highlight of function names and the Object
+Browser working properly, then you have to:
+
+   - Enable X11 Forwarding in the remote machine.
+
+   - Have Vim in the remote machine compiled with |clientserver| feature.
+
+   - Have the X Server running in the local machine.
+
+   - Pass either the `-X` or the `-Y` argument to ssh, as in the examples
+     below:
 >
-    ssh -X yourlogin@remote.address
-    ssh -Y yourlogin@remote.address
+     ssh -X yourlogin@remote.address
+     ssh -Y yourlogin@remote.address
 <
-With Tmux, you can detach the Vim-R session and reattach it latter. This is
-useful if you plan to begin the use the Vim-R-plugin in a machine and latter
-move to another computer and access remotely your previous Vim-R session.
-Below is the step-by-step procedure to run the Vim-R remotely:
+   - Start Tmux and, then, Vim with the |--servername| argument:
+>
+     tmux
+     vim --servername VIM script.R
+<
+With Tmux, you can detach the Vim-R session and reattach it latter (but the
+connection with the XServer could be lost in the process). This is useful if
+you plan to begin the use the Vim-R-plugin in a machine and latter move to
+another computer and access remotely your previous Vim-R session. Below is the
+step-by-step procedure to run the Vim-R remotely:
 
   - Start Tmux:
       tmux
 
   - Start Vim:
-      vim the_script.R
+      vim script.R
 
   - Use Vim to start an R session:
       rf
@@ -983,10 +997,15 @@ When Vim cannot receive messages, the result is:
      that is, after you stay 'updatetime' milliseconds in Normal mode doing
      nothing. For a workaround, see |vimrplugin_permanent_libs|.
 
-To get omnicompletion, syntax highlight of function names and the Object
-Browser working properly, in addition to using Vim built with X11 support, and
-not MacVim, on Mac OS X, you also have to install XQuartz server (X11.app).
-
+On Mac OS X, to get omnicompletion, syntax highlight of function names and the
+Object Browser working properly, in addition to using Vim built with X11
+support, and not MacVim, you also have to install XQuartz server (X11.app).
+A user reported success with the following procedure:
+>
+   brew install vim --with-client-server
+   tmux
+   /usr/local/Cellar/vim/7.4.273/bin/vim --servername VIM r_script.R
+<
 See also: |r-plugin-remote|.
 
 
@@ -2454,7 +2473,7 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details.
 0.9.9.9 (2014-02-01)
 
  * Minor bug fixes.
- 
+
  * Delete temporary files on VimLeave event.
 
  * Support to R package slidify (thanks to Michael Lerch).

From ba479617c9eff2ab4396fd55260932d22611f115 Mon Sep 17 00:00:00 2001
From: Michael Lerch 
Date: Tue, 20 May 2014 15:06:19 -0600
Subject: [PATCH 0674/1050] Option to use Vim wd as R wd

---
 doc/r-plugin.txt           |  9 +++++++++
 r-plugin/common_global.vim | 20 +++++++++++++++-----
 2 files changed, 24 insertions(+), 5 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 692006a..dd01002 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -1117,6 +1117,7 @@ is running:
 |vimrplugin_restart|           Restart R if it is already running
 |vimrplugin_show_args|         Show extra information during omnicompletion
 |vimrplugin_vimcom_wait|       Time to wait for vimcom.plus loading
+|vimrplugin_vim_wd|            Start R in working directory of Vim
 
 
 6.1. Terminal emulator (Linux/Unix only)~
@@ -1674,6 +1675,14 @@ If you do not want to install the vimcom.plus package, then put in your
    let vimrplugin_vimcom_wait = -1
 <
 
+6.31 Start R in working directory of Vim
+						      *vimrplugin_vim_wd*
+The Vim-R-plugin starts R such R's working directory contains the file in the
+current vim buffer.  If you want R's working directory to be the same as Vim's
+working directory, put in your vimrc:
+>
+    let vimrplugin_vim_wd = 1
+<
 
 ==============================================================================
 						       *r-plugin-key-bindings*
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index f5f38b2..d3aebbe 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -718,7 +718,9 @@ function StartR_Windows()
         endif
     endif
     Py StartRPy()
-    lcd -
+    if !exists("g:vimrplugin_vim_wd") || g:vimrplugin_vim_wd == 0
+        lcd -
+    endif
     let g:SendCmdToR = function('SendCmdToR_Windows')
     call WaitVimComStart()
 endfunction
@@ -741,7 +743,9 @@ function StartR_OSX()
     if v:shell_error
         call RWarningMsg(rlog)
     endif
-    lcd -
+    if !exists("g:vimrplugin_vim_wd") || g:vimrplugin_vim_wd == 0
+        lcd -
+    endif
     let g:SendCmdToR = function('SendCmdToR_OSX')
     if WaitVimComStart()
         Py SendToVimCom("\001Update OB [StartR]")
@@ -773,7 +777,9 @@ function StartR(whatr)
     endif
 
     " Change to buffer's directory before starting R
-    lcd %:p:h
+    if !exists("g:vimrplugin_vim_wd") || g:vimrplugin_vim_wd == 0
+        lcd %:p:h
+    endif
 
     if a:whatr =~ "vanilla"
         let b:rplugin_r_args = "--vanilla"
@@ -797,7 +803,9 @@ function StartR(whatr)
 
     if g:vimrplugin_only_in_tmux && $TMUX_PANE == ""
         call RWarningMsg("Not inside Tmux.")
-        lcd -
+        if !exists("g:vimrplugin_vim_wd") || g:vimrplugin_vim_wd == 0
+            lcd -
+        endif
         return
     endif
 
@@ -862,7 +870,9 @@ function StartR(whatr)
     endif
 
     " Go back to original directory:
-    lcd -
+    if !exists("g:vimrplugin_vim_wd") || g:vimrplugin_vim_wd == 0
+        lcd -
+    endif
     echon
 endfunction
 

From d463c43698f7ce33997bae552bb92f832961badd Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Wed, 21 May 2014 08:20:50 -0300
Subject: [PATCH 0675/1050] Minor change in documentation.

---
 doc/r-plugin.txt | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index dd01002..493f5cc 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -115,7 +115,7 @@ Before installing the plugin, you should install its dependencies:
    Vim >= 7.4: http://www.vim.org/download.php
                In addition to the most commonly used features, the plugin
                requires: |+python| or |+python3|, |+clientserver| and |+conceal|. 
-	       Note: If you use either Mac OS X, read about the bugs that affect it:
+	       Note: If you use Mac OS X, read about the bugs that affect it:
 	       |r-plugin-nox|.
 
    R >= 3.0.0: http://www.r-project.org/
@@ -136,8 +136,8 @@ Before installing the plugin, you should install its dependencies:
                   whenever the terminal is resized.
 
    ncurses-term:  http://invisible-island.net/ncurses
-                  Might be useful if you want support for 256 colors at the
-                  terminal emulator.
+		  Might be necessary if you want support for 256 colors at the
+		  terminal emulator.
 
    latexmk:       Automate the compilation of LaTeX documents.
                   See examples in |vimrplugin_latexcmd|.
@@ -2472,7 +2472,7 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details.
 
  * vimrplugin_openpdf now accepts three values: 0, 1 and 2.
 
- * New command \o sends evaluates line in R and inserts the output in the
+ * New command \o evaluates current line in R and inserts the output in the
    script.
 
  * New option: vimrplugin_vimcom_wait.

From 3a6e589049e54fa881200c6caeb6db2005fcd9a4 Mon Sep 17 00:00:00 2001
From: Tommaso Leonardi - farm 
Date: Wed, 21 May 2014 17:04:43 +0100
Subject: [PATCH 0676/1050] $VIMRPLUGIN_TMPDIR is preferentially created in
 $TMPDIR

---
 r-plugin/common_global.vim | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index d3aebbe..c6a1385 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -3227,11 +3227,14 @@ if v:servername != "" && !has("gui_macvim")
     let $VIMEDITOR_SVRNM = v:servername
 endif
 
-if isdirectory("/tmp")
+if isdirectory($TMPDIR)
+    let $VIMRPLUGIN_TMPDIR = $TMPDIR . "/r-plugin-" . g:rplugin_userlogin
+elseif isdirectory("/tmp")
     let $VIMRPLUGIN_TMPDIR = "/tmp/r-plugin-" . g:rplugin_userlogin
 else
     let $VIMRPLUGIN_TMPDIR = g:rplugin_uservimfiles . "/r-plugin/tmp"
 endif
+
 let g:rplugin_esc_tmpdir = substitute($VIMRPLUGIN_TMPDIR, ' ', '\\ ', 'g')
 
 if !isdirectory($VIMRPLUGIN_TMPDIR)

From db4574f024bcf6c88ce1de52cd47c3f2ec0979ce Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Fri, 23 May 2014 20:51:39 -0300
Subject: [PATCH 0677/1050] Recognize label error in Object Browser.

---
 syntax/rbrowser.vim | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/syntax/rbrowser.vim b/syntax/rbrowser.vim
index 2e0d9b6..8468f64 100644
--- a/syntax/rbrowser.vim
+++ b/syntax/rbrowser.vim
@@ -46,6 +46,7 @@ if &encoding != "utf-8"
 endif
 
 syn match rbrowserTab contained "\t"
+syn match rbrowserErr /Error: label isn't "character"./
 if has("conceal")
     syn match rbrowserDelim contained /'#\|"#\|(#\|\[#\|{#\|%#\|##\|<#\|=#/ conceal
 else
@@ -64,6 +65,7 @@ hi def link rbrowserFunction	Function
 hi def link rbrowserS4  	Statement
 hi def link rbrowserUnknown	Normal
 hi def link rbrowserWarn	WarningMsg
+hi def link rbrowserErr 	ErrorMsg
 hi def link rbrowserTreePart	Comment
 hi def link rbrowserDelim	Ignore
 hi def link rbrowserTab		Ignore

From 8b8e690ec7c17ec5af6bf74c4c13533efc5e1c39 Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Sat, 24 May 2014 08:16:01 -0300
Subject: [PATCH 0678/1050] Use default tmp dirs (:h tempfile) on Windows too.

---
 r-plugin/common_global.vim | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index c6a1385..b880aed 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -3227,12 +3227,22 @@ if v:servername != "" && !has("gui_macvim")
     let $VIMEDITOR_SVRNM = v:servername
 endif
 
-if isdirectory($TMPDIR)
-    let $VIMRPLUGIN_TMPDIR = $TMPDIR . "/r-plugin-" . g:rplugin_userlogin
-elseif isdirectory("/tmp")
-    let $VIMRPLUGIN_TMPDIR = "/tmp/r-plugin-" . g:rplugin_userlogin
+if has("win32") || has("win64")
+    if isdirectory($TMP)
+        let $VIMRPLUGIN_TMPDIR = $TMP . "/r-plugin-" . g:rplugin_userlogin
+    elseif isdirectory($TEMP)
+        let $VIMRPLUGIN_TMPDIR = $TEMP . "/r-plugin-" . g:rplugin_userlogin
+    else
+        let $VIMRPLUGIN_TMPDIR = g:rplugin_uservimfiles . "/r-plugin/tmp"
+    endif
 else
-    let $VIMRPLUGIN_TMPDIR = g:rplugin_uservimfiles . "/r-plugin/tmp"
+    if isdirectory($TMPDIR)
+        let $VIMRPLUGIN_TMPDIR = $TMPDIR . "/r-plugin-" . g:rplugin_userlogin
+    elseif isdirectory("/tmp")
+        let $VIMRPLUGIN_TMPDIR = "/tmp/r-plugin-" . g:rplugin_userlogin
+    else
+        let $VIMRPLUGIN_TMPDIR = g:rplugin_uservimfiles . "/r-plugin/tmp"
+    endif
 endif
 
 let g:rplugin_esc_tmpdir = substitute($VIMRPLUGIN_TMPDIR, ' ', '\\ ', 'g')

From aae0f46393a2d9f8a4367c375088ba330decc893 Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Sat, 24 May 2014 09:53:19 -0300
Subject: [PATCH 0679/1050] Fix vimrplugin_vim_wd with external terminals.

---
 r-plugin/common_global.vim | 35 ++++++++++++++++++++++++++---------
 1 file changed, 26 insertions(+), 9 deletions(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index b880aed..2c4a95d 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -718,7 +718,7 @@ function StartR_Windows()
         endif
     endif
     Py StartRPy()
-    if !exists("g:vimrplugin_vim_wd") || g:vimrplugin_vim_wd == 0
+    if g:vimrplugin_vim_wd == 0
         lcd -
     endif
     let g:SendCmdToR = function('SendCmdToR_Windows')
@@ -743,7 +743,7 @@ function StartR_OSX()
     if v:shell_error
         call RWarningMsg(rlog)
     endif
-    if !exists("g:vimrplugin_vim_wd") || g:vimrplugin_vim_wd == 0
+    if g:vimrplugin_vim_wd == 0
         lcd -
     endif
     let g:SendCmdToR = function('SendCmdToR_OSX')
@@ -777,7 +777,7 @@ function StartR(whatr)
     endif
 
     " Change to buffer's directory before starting R
-    if !exists("g:vimrplugin_vim_wd") || g:vimrplugin_vim_wd == 0
+    if g:vimrplugin_vim_wd == 0
         lcd %:p:h
     endif
 
@@ -803,7 +803,7 @@ function StartR(whatr)
 
     if g:vimrplugin_only_in_tmux && $TMUX_PANE == ""
         call RWarningMsg("Not inside Tmux.")
-        if !exists("g:vimrplugin_vim_wd") || g:vimrplugin_vim_wd == 0
+        if g:vimrplugin_vim_wd == 0
             lcd -
         endif
         return
@@ -870,7 +870,7 @@ function StartR(whatr)
     endif
 
     " Go back to original directory:
-    if !exists("g:vimrplugin_vim_wd") || g:vimrplugin_vim_wd == 0
+    if g:vimrplugin_vim_wd == 0
         lcd -
     endif
     echon
@@ -3270,6 +3270,7 @@ call RSetDefaultValue("g:vimrplugin_openpdf_quietly",   0)
 call RSetDefaultValue("g:vimrplugin_openhtml",          0)
 call RSetDefaultValue("g:vimrplugin_i386",              0)
 call RSetDefaultValue("g:vimrplugin_Rterm",             0)
+call RSetDefaultValue("g:vimrplugin_vim_wd",            0)
 call RSetDefaultValue("g:vimrplugin_restart",           0)
 call RSetDefaultValue("g:vimrplugin_vsplit",            0)
 call RSetDefaultValue("g:vimrplugin_rconsole_width",   -1)
@@ -3584,15 +3585,27 @@ let g:rplugin_termcmd = g:vimrplugin_term . " -e"
 
 if g:vimrplugin_term == "gnome-terminal" || g:vimrplugin_term == "xfce4-terminal" || g:vimrplugin_term == "terminal" || g:vimrplugin_term == "lxterminal"
     " Cannot set gnome-terminal icon: http://bugzilla.gnome.org/show_bug.cgi?id=126081
-    let g:rplugin_termcmd = g:vimrplugin_term . " --working-directory='" . expand("%:p:h") . "' --title R -e"
+    if g:vimrplugin_vim_wd
+        let g:rplugin_termcmd = g:vimrplugin_term . " --title R -e"
+    else
+        let g:rplugin_termcmd = g:vimrplugin_term . " --working-directory='" . expand("%:p:h") . "' --title R -e"
+    endif
 endif
 
 if g:vimrplugin_term == "terminator"
-    let g:rplugin_termcmd = "terminator --working-directory='" . expand("%:p:h") . "' --title R -x"
+    if g:vimrplugin_vim_wd
+        let g:rplugin_termcmd = "terminator --title R -x"
+    else
+        let g:rplugin_termcmd = "terminator --working-directory='" . expand("%:p:h") . "' --title R -x"
+    endif
 endif
 
 if g:vimrplugin_term == "konsole"
-    let g:rplugin_termcmd = "konsole --workdir '" . expand("%:p:h") . "' --icon " . g:rplugin_home . "/bitmaps/ricon.png -e"
+    if g:vimrplugin_vim_wd
+        let g:rplugin_termcmd = "konsole --icon " . g:rplugin_home . "/bitmaps/ricon.png -e"
+    else
+        let g:rplugin_termcmd = "konsole --workdir '" . expand("%:p:h") . "' --icon " . g:rplugin_home . "/bitmaps/ricon.png -e"
+    endif
 endif
 
 if g:vimrplugin_term == "Eterm"
@@ -3601,7 +3614,11 @@ endif
 
 if g:vimrplugin_term == "roxterm"
     " Cannot set icon: http://bugzilla.gnome.org/show_bug.cgi?id=126081
-    let g:rplugin_termcmd = "roxterm --directory='" . expand("%:p:h") . "' --title R -e"
+    if g:vimrplugin_vim_wd
+        let g:rplugin_termcmd = "roxterm --title R -e"
+    else
+        let g:rplugin_termcmd = "roxterm --directory='" . expand("%:p:h") . "' --title R -e"
+    endif
 endif
 
 if g:vimrplugin_term == "xterm" || g:vimrplugin_term == "uxterm"

From 1346fc9b1656a1dc70818c1f424427c104a3c7c9 Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Sat, 24 May 2014 09:54:43 -0300
Subject: [PATCH 0680/1050] Update doc.

---
 doc/r-plugin.txt | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 493f5cc..7ed9702 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -1675,14 +1675,16 @@ If you do not want to install the vimcom.plus package, then put in your
    let vimrplugin_vimcom_wait = -1
 <
 
-6.31 Start R in working directory of Vim
-						      *vimrplugin_vim_wd*
-The Vim-R-plugin starts R such R's working directory contains the file in the
-current vim buffer.  If you want R's working directory to be the same as Vim's
-working directory, put in your vimrc:
+6.31 Start R in working directory of Vim~
+							   *vimrplugin_vim_wd*
+The Vim-R-plugin starts R in the directory where the current buffer is. If you
+want R's working directory to be the same as Vim's working directory, put in
+your |vimrc|:
 >
     let vimrplugin_vim_wd = 1
 <
+This option is useful only for those who did not enable 'autochdir'.
+
 
 ==============================================================================
 						       *r-plugin-key-bindings*
@@ -2468,14 +2470,14 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details.
 							       *r-plugin-news*
 10. News~
 
-1.0 (2014-05-09)
+1.0 (2014-05-24)
 
  * vimrplugin_openpdf now accepts three values: 0, 1 and 2.
 
  * New command \o evaluates current line in R and inserts the output in the
    script.
 
- * New option: vimrplugin_vimcom_wait.
+ * New options: vimrplugin_vimcom_wait and vimrplugin_vim_wd.
 
  * Minor bug fixes.
 

From 5ebca2217badc001b1f99155c4448594c8d9ad3f Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Sat, 24 May 2014 10:14:12 -0300
Subject: [PATCH 0681/1050] Improve r-plugin-nox section.

---
 doc/r-plugin.txt | 24 +++++++++++++++++++-----
 1 file changed, 19 insertions(+), 5 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 7ed9702..ab5f556 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -980,12 +980,21 @@ work as expected again after any valid code is executed in the R Console.
 								*r-plugin-nox*
 If you either run Vim in the Linux Console or start Vim in a terminal emulator
 without the command line argument |--servername|, Vim will not receive remote
-messages. The R package vimcom.plus has support only for Windows and X11
-interprocess communication systems while MacVim is a Cocoa application, that
-is, vimcom.plus is unable to send messages to MacVim too. For vimcom.plus,
-running MacVim is equivalent to running Vim without the |clientserver|
-feature.
+messages and the vimcom.plus package will display the following message:
 
+   vimcom.plus: Vim's servername is unknown.
+                Please, in Vim, enter Normal mode and type:
+	        :h r-plugin-nox
+
+To avoid this message, you should either start vim with the |--servername|
+argument, as below:
+>
+   vim --servername VIM script.R
+<
+Or put in your ~/.Rprofile:
+>
+   options(vimcom.verbose = -1)
+<
 When Vim cannot receive messages, the result is:
 
    * The Object Browser is not automatically updated. You have to do
@@ -997,6 +1006,11 @@ When Vim cannot receive messages, the result is:
      that is, after you stay 'updatetime' milliseconds in Normal mode doing
      nothing. For a workaround, see |vimrplugin_permanent_libs|.
 
+The R package vimcom.plus has support only for Windows and X11 interprocess
+communication systems while MacVim is a Cocoa application, that is,
+vimcom.plus is unable to send messages to MacVim too. For vimcom.plus, running
+MacVim is equivalent to running Vim without the |clientserver| feature.
+
 On Mac OS X, to get omnicompletion, syntax highlight of function names and the
 Object Browser working properly, in addition to using Vim built with X11
 support, and not MacVim, you also have to install XQuartz server (X11.app).

From 096a19a64e81bde12fe81491321aef8881b9e835 Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Thu, 29 May 2014 11:43:25 -0300
Subject: [PATCH 0682/1050] Set special VIMEDITOR_SVRNM for MacVim.

---
 r-plugin/common_global.vim | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 2c4a95d..b71d837 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -581,8 +581,8 @@ function StartR_TmuxSplit(rcmd)
     if &t_Co == 256
         call system('tmux set -g default-terminal "' . $TERM . '"')
     endif
-    if v:servername != "" && !has("gui_macvim")
-        call system("tmux set-environment VIMEDITOR_SVRNM " . v:servername)
+    if v:servername != ""
+        call system("tmux set-environment VIMEDITOR_SVRNM " . $VIMEDITOR_SVRNM)
     endif
     call system("tmux set-environment VIMINSTANCEID " . $VIMINSTANCEID)
     let tcmd = "tmux split-window "
@@ -636,8 +636,8 @@ function StartR_ExternalTerm(rcmd)
                 \ 'set-environment -g VIMRPLUGIN_TMPDIR "' . $VIMRPLUGIN_TMPDIR . '"',
                 \ 'set-environment -g VIMRPLUGIN_HOME "' . g:rplugin_home . '"',
                 \ 'set-environment VIMINSTANCEID ' . $VIMINSTANCEID ]
-    if v:servername != "" && !has("gui_macvim")
-        let cnflines = cnflines + [ 'set-environment VIMEDITOR_SVRNM ' . v:servername ]
+    if v:servername != ""
+        let cnflines = cnflines + [ 'set-environment VIMEDITOR_SVRNM ' . $VIMEDITOR_SVRNM ]
     endif
     if g:vimrplugin_notmuxconf
         let cnflines = cnflines + [ 'source-file ~/.tmux.conf' ]
@@ -667,8 +667,8 @@ function StartR_ExternalTerm(rcmd)
     call system('export VIMRPLUGIN_TMPDIR=' . $VIMRPLUGIN_TMPDIR)
     call system('export VIMRPLUGIN_HOME=' . substitute(g:rplugin_home, ' ', '\\ ', "g"))
     call system('export VIMINSTANCEID=' . $VIMINSTANCEID)
-    if v:servername != "" && !has("gui_macvim")
-        call system('export VIMEDITOR_SVRNM=' . v:servername)
+    if v:servername != ""
+        call system('export VIMEDITOR_SVRNM=' . $VIMEDITOR_SVRNM)
     endif
     " Start the terminal emulator even if inside a Tmux session
     if $TMUX != ""
@@ -3223,8 +3223,12 @@ if has("win32") || has("win64")
 endif
 
 let $VIMRPLUGIN_HOME = substitute(g:rplugin_home, ' ', '\\ ', "g")
-if v:servername != "" && !has("gui_macvim")
-    let $VIMEDITOR_SVRNM = v:servername
+if has("gui_macvim")
+    let $VIMEDITOR_SVRNM = "Mac\002Vim"
+else
+    if v:servername != ""
+        let $VIMEDITOR_SVRNM = v:servername
+    endif
 endif
 
 if has("win32") || has("win64")

From 4d12b9898e5d59f3655a6296c42edfb4b81476eb Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Thu, 29 May 2014 11:44:51 -0300
Subject: [PATCH 0683/1050] Improve documentation on Vim's clientserver.

---
 doc/r-plugin.txt | 46 +++++++++++++++++++++++-----------------------
 1 file changed, 23 insertions(+), 23 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index ab5f556..eb197f5 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -598,8 +598,6 @@ highlighted only if their libraries are loaded by R (but see
 Note: If you have too many loaded packages Vim may be unable to load the list
 of functions for syntax highlight.
 
-Note: If you use Mac OS X, read about the bugs that affect it: |r-plugin-nox|.
-
 
 4.4. Omni completion~
 
@@ -628,8 +626,6 @@ for all other objects. The .GlobalEnv list is stored in the
 files are stored in ~/.vim/r-plugin/objlist/ and remain available until you
 manually delete them.
 
-Note: If you use Mac OS X, read about the bugs that affect it: |r-plugin-nox|.
-
 
 4.5. The Object Browser~
 
@@ -641,16 +637,6 @@ in .GlobalEnv and the currently loaded libraries. The Object Browser requires
 the |+clientserver| feature to be automatically updated and the |+conceal|
 feature to correctly align list items.
 
-Note: On Linux you may find Vim binaries without the |clientserver| feature if
-you install packages such as vim-nox on Debian/Ubuntu or vim-enhanced on
-Fedora/Red Hat. If you want to use Vim in a terminal emulator in Fedora/Red
-Hat, you may want to create a symbolic link to "gvim" named "vim". You still
-have to explicitly start the server with the argument |--servername|.  To
-avoid having to type this argument every time that you start Vim, please look
-at the example in |r-plugin-bash-setup|.
-
-Note: If you use Mac OS X, read about the bugs that affect it: |r-plugin-nox|.
-
 In the .GlobalEnv view, if an object has the attribute "label", it will also
 be displayed. Please, see the R help for package vimcom.plus for some options
 to control the Object Browser behavior. In the Object Browser window, while in
@@ -976,22 +962,30 @@ tell Vim that "R is busy" and Vim will display this message. Everything should
 work as expected again after any valid code is executed in the R Console.
 
 
-5.7. Bugs that affect Mac OS X and Linux Console~
+5.7. Bugs that affect Mac OS X, Linux Console and ...~
 								*r-plugin-nox*
-If you either run Vim in the Linux Console or start Vim in a terminal emulator
-without the command line argument |--servername|, Vim will not receive remote
-messages and the vimcom.plus package will display the following message:
+If you use MacVim, run Vim in the Linux Console or start Vim in a terminal
+emulator without the command line argument |--servername|, Vim will not
+receive remote messages and the vimcom.plus package will display one of the
+following messages:
+
+   vimcom.plus: Are you running MacVim?
+                MacVim isn't fully supported by vimcom.plus.
+
+   vimcom.plus: There is no X Server running.
 
    vimcom.plus: Vim's servername is unknown.
-                Please, in Vim, enter Normal mode and type:
-	        :h r-plugin-nox
 
-To avoid this message, you should either start vim with the |--servername|
-argument, as below:
+To avoid the message, you should start vim with the |--servername| argument,
+as below:
 >
    vim --servername VIM script.R
 <
-Or put in your ~/.Rprofile:
+To avoid having to type this argument every time that you start Vim, please
+either run `:RpluginConfig` or look at the example in |r-plugin-bash-setup|.
+
+If the |--servername| argument does not work in your case, you can put the
+following line in your ~/.Rprofile to suppress the message:
 >
    options(vimcom.verbose = -1)
 <
@@ -1006,6 +1000,12 @@ When Vim cannot receive messages, the result is:
      that is, after you stay 'updatetime' milliseconds in Normal mode doing
      nothing. For a workaround, see |vimrplugin_permanent_libs|.
 
+On Linux you may find Vim binaries without the |clientserver| feature if
+you install packages such as vim-nox on Debian/Ubuntu or vim-enhanced on
+Fedora/Red Hat. If you want to use Vim in a terminal emulator in Fedora/Red
+Hat, you may want to create a symbolic link to "gvim" named "vim". You still
+have to explicitly start the server with the argument |--servername|.
+
 The R package vimcom.plus has support only for Windows and X11 interprocess
 communication systems while MacVim is a Cocoa application, that is,
 vimcom.plus is unable to send messages to MacVim too. For vimcom.plus, running

From a5c405109d0dc120884f74dd83d5363c1cd24a57 Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Mon, 2 Jun 2014 17:11:51 -0300
Subject: [PATCH 0684/1050] Put colorout & setwidth in Rprofile if installed.
 To avoid R errors while sourcing Rprofile, don't add the lines
 `library(colorout)` and `library(setwidth)` if these packages aren't
 installed.

---
 r-plugin/vimrconfig.vim | 34 +++++++++++++++++++++++++---------
 1 file changed, 25 insertions(+), 9 deletions(-)

diff --git a/r-plugin/vimrconfig.vim b/r-plugin/vimrconfig.vim
index 2e3c2ab..7ccdc47 100644
--- a/r-plugin/vimrconfig.vim
+++ b/r-plugin/vimrconfig.vim
@@ -36,6 +36,14 @@ function! RConfigRprofile()
                 \ '        stop("HOME environment variable not set.")',
                 \ '    } else {',
                 \ '        .rpf <- paste0(Sys.getenv("HOME"), "/.Rprofile")',
+                \ '        if(length(find.package("colorout", quiet = TRUE)) > 0)',
+                \ '            .rpf <- c(.rpf, "HasColorout")',
+                \ '        else',
+                \ '            .rpf <- c(.rpf, "NoColorout")',
+                \ '        if(length(find.package("setwidth", quiet = TRUE)) > 0)',
+                \ '            .rpf <- c(.rpf, "HasSetwidth")',
+                \ '        else',
+                \ '            .rpf <- c(.rpf, "NoSetwidth")',
                 \ '    }',
                 \ '}',
                 \ 'writeLines(.rpf, con = paste0(Sys.getenv("VIMRPLUGIN_TMPDIR"), "/configR_result"))',
@@ -46,10 +54,10 @@ function! RConfigRprofile()
         sleep 2
     endif
     if filereadable($VIMRPLUGIN_TMPDIR . "/configR_result")
-        let res = readfile($VIMRPLUGIN_TMPDIR . "/configR_result")
+        let resp = readfile($VIMRPLUGIN_TMPDIR . "/configR_result")
         call delete($VIMRPLUGIN_TMPDIR . "/configR_result")
-        if filereadable(res[0])
-            let rpflines = readfile(res[0])
+        if filereadable(resp[0])
+            let rpflines = readfile(resp[0])
         else
             let rpflines = []
         endif
@@ -80,9 +88,17 @@ function! RConfigRprofile()
                             \ "        options(editor = '" . 'gvim -f -c "set ft=r"' . "')",
                             \ '    else',
                             \ "        options(editor = '" . 'vim -c "set ft=r"' . "')",
-                            \ '    # See ?setOutputColors256 to know how to customize R output colors',
-                            \ '    library(colorout)',
-                            \ '    library(setwidth)']
+                            \ '    # See ?setOutputColors256 to know how to customize R output colors']
+                if len(resp) > 1 && resp[1] == "HasColorout"
+                    let rpflines += ['    library(colorout)']
+                else
+                    let rpflines += ['    # library(colorout)']
+                endif
+                if len(resp) > 2 && resp[2] == "HasSetwidth"
+                    let rpflines += ['    library(setwidth)']
+                else
+                    let rpflines += ['    # library(setwidth)']
+                endif
             endif
             let rpflines += ['    library(vimcom.plus)']
 
@@ -137,7 +153,7 @@ function! RConfigRprofile()
             endif
 
             let rpflines += ["}"]
-            call writefile(rpflines, res[0])
+            call writefile(rpflines, resp[0])
             redraw
             echo " "
             echohl WarningMsg
@@ -150,14 +166,14 @@ function! RConfigRprofile()
             let what = input("Do you want to see your .Rprofile now? [y/N]: ")
             echohl Normal
             if RGetYesOrNo(what)
-                silent exe "tabnew " . res[0]
+                silent exe "tabnew " . resp[0]
             endif
         else
             echohl Question
             let what = input("Do you want to see your .Rprofile along with tips on how to\nconfigure it? [y/N]: ")
             echohl Normal
             if RGetYesOrNo(what)
-                silent exe "tabnew " . res[0]
+                silent exe "tabnew " . resp[0]
                 silent help r-plugin-R-setup
             endif
         endif

From 8b381e5d0b14bb40def86234c5acc38500866740 Mon Sep 17 00:00:00 2001
From: Michael Lerch 
Date: Mon, 2 Jun 2014 22:21:31 -0600
Subject: [PATCH 0685/1050] Copy open pdf details from rnw to rmd

---
 ftplugin/rmd_rplugin.vim | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/ftplugin/rmd_rplugin.vim b/ftplugin/rmd_rplugin.vim
index d18c4af..665b95d 100644
--- a/ftplugin/rmd_rplugin.vim
+++ b/ftplugin/rmd_rplugin.vim
@@ -132,6 +132,17 @@ function! RMakePDFrmd(t)
     if exists("g:vimrplugin_pandoc_args")
         let pdfcmd = pdfcmd . ", pandoc_args = '" . g:vimrplugin_pandoc_args . "'"
     endif
+    if g:vimrplugin_openpdf == 0
+        let pdfcmd = pdfcmd . ", view = FALSE"
+    else
+        if g:vimrplugin_openpdf == 1
+            if b:pdf_opened == 0
+                let b:pdf_opened = 1
+            else
+                let pdfcmd = pdfcmd . ", view = FALSE"
+            endif
+        endif
+    endif
     let pdfcmd = pdfcmd . ")"
     call g:SendCmdToR(pdfcmd)
 endfunction  

From 1252364356473afd6d92717a9c3167a34fb09711 Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Wed, 4 Jun 2014 10:54:15 -0300
Subject: [PATCH 0686/1050] Always set VIMEDITOR_SVRNM environment variable.

---
 r-plugin/common_global.vim | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index b71d837..717ea58 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -581,9 +581,7 @@ function StartR_TmuxSplit(rcmd)
     if &t_Co == 256
         call system('tmux set -g default-terminal "' . $TERM . '"')
     endif
-    if v:servername != ""
-        call system("tmux set-environment VIMEDITOR_SVRNM " . $VIMEDITOR_SVRNM)
-    endif
+    call system("tmux set-environment VIMEDITOR_SVRNM " . $VIMEDITOR_SVRNM)
     call system("tmux set-environment VIMINSTANCEID " . $VIMINSTANCEID)
     let tcmd = "tmux split-window "
     if g:vimrplugin_vsplit
@@ -635,10 +633,8 @@ function StartR_ExternalTerm(rcmd)
     let cnflines = [
                 \ 'set-environment -g VIMRPLUGIN_TMPDIR "' . $VIMRPLUGIN_TMPDIR . '"',
                 \ 'set-environment -g VIMRPLUGIN_HOME "' . g:rplugin_home . '"',
-                \ 'set-environment VIMINSTANCEID ' . $VIMINSTANCEID ]
-    if v:servername != ""
-        let cnflines = cnflines + [ 'set-environment VIMEDITOR_SVRNM ' . $VIMEDITOR_SVRNM ]
-    endif
+                \ 'set-environment VIMINSTANCEID ' . $VIMINSTANCEID ,
+                \ 'set-environment VIMEDITOR_SVRNM ' . $VIMEDITOR_SVRNM ]
     if g:vimrplugin_notmuxconf
         let cnflines = cnflines + [ 'source-file ~/.tmux.conf' ]
     else
@@ -667,9 +663,7 @@ function StartR_ExternalTerm(rcmd)
     call system('export VIMRPLUGIN_TMPDIR=' . $VIMRPLUGIN_TMPDIR)
     call system('export VIMRPLUGIN_HOME=' . substitute(g:rplugin_home, ' ', '\\ ', "g"))
     call system('export VIMINSTANCEID=' . $VIMINSTANCEID)
-    if v:servername != ""
-        call system('export VIMEDITOR_SVRNM=' . $VIMEDITOR_SVRNM)
-    endif
+    call system('export VIMEDITOR_SVRNM=' . $VIMEDITOR_SVRNM)
     " Start the terminal emulator even if inside a Tmux session
     if $TMUX != ""
         let tmuxenv = $TMUX
@@ -3226,7 +3220,9 @@ let $VIMRPLUGIN_HOME = substitute(g:rplugin_home, ' ', '\\ ', "g")
 if has("gui_macvim")
     let $VIMEDITOR_SVRNM = "Mac\002Vim"
 else
-    if v:servername != ""
+    if v:servername == ""
+        let $VIMEDITOR_SVRNM = "NoServerName"
+    else
         let $VIMEDITOR_SVRNM = v:servername
     endif
 endif

From 7cde9d4959d4652962c21b05b1d81abcd0e145f5 Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Wed, 4 Jun 2014 13:16:52 -0300
Subject: [PATCH 0687/1050] Identify Neovim in VIMEDITOR_SVRNM.

---
 r-plugin/common_global.vim | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 717ea58..25ef2c7 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -3218,13 +3218,13 @@ endif
 
 let $VIMRPLUGIN_HOME = substitute(g:rplugin_home, ' ', '\\ ', "g")
 if has("gui_macvim")
-    let $VIMEDITOR_SVRNM = "Mac\002Vim"
+    let $VIMEDITOR_SVRNM = "MacVim"
+elseif has("neovim")
+    let $VIMEDITOR_SVRNM = "NeoVim"
+elseif v:servername == ""
+    let $VIMEDITOR_SVRNM = "NoServerName"
 else
-    if v:servername == ""
-        let $VIMEDITOR_SVRNM = "NoServerName"
-    else
-        let $VIMEDITOR_SVRNM = v:servername
-    endif
+    let $VIMEDITOR_SVRNM = v:servername
 endif
 
 if has("win32") || has("win64")

From 988ca538f2b71b1317e1dd9ecbbfc45aa1b1d488 Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Fri, 6 Jun 2014 23:32:53 -0300
Subject: [PATCH 0688/1050] Update knitr options.

---
 r-plugin/common_global.vim | 41 ++++++++++++++++++++++++++------------
 1 file changed, 28 insertions(+), 13 deletions(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 25ef2c7..9bf76c0 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -170,19 +170,34 @@ function! CompleteChunkOptions()
     else
         let newbase = '^' . substitute(base, "\\$$", "", "")
     endif
-    let ktopt = ["animation.fun=;hook_ffmpeg_html", "aniopts=;'controls.loop'", "autodep=;FALSE", "background=;'#F7F7F7'",
-                \ "cache.path=;'cache/'", "cache.vars=; ", "cache=;FALSE", "child=; ", "comment=;'##'",
-                \ "dependson=;''", "dev.args=; ", "dev=; ", "dpi=;72", "echo=;TRUE",
-                \ "engine=;'R'", "error=;TRUE", "eval=;TRUE", "external=;TRUE",
-                \ "fig.align=;'left|right|center'", "fig.cap=;''", "fig.env=;'figure'",
-                \ "fig.ext=; ", "fig.height=;7", "fig.keep=;'high|none|all|first|last'",
-                \ "fig.lp=;'fig:'", "fig.path=; ", "fig.pos=;''", "fig.scap=;''", "fig.subcap=; ",
-                \ "fig.show=;'asis|hold|animate|hide'", "fig.width=;7", "highlight=;TRUE",
-                \ "include=;TRUE", "interval=;1", "message=;TRUE", "opts.label=;''",
-                \ "out.extra=; ", "out.height=;'7in'", "out.width=;'7in'",
-                \ "prompt=;FALSE", "purl=;TRUE", "ref.label=; ", "resize.height=; ",
-                \ "resize.width=; ", "results=;'markup|asis|hold|hide'", "sanitize=;FALSE",
-                \ "size=;'normalsize'", "split=;FALSE", "tidy=;TRUE", "tidy.opts=; ", "warning=;TRUE"]
+
+    let ktopt = ["eval=;TRUE", "echo=;TRUE", "results=;'markup|asis|hold|hide'",
+                \ "warning=;TRUE", "error=;TRUE", "message=;TRUE", "split=;FALSE",
+                \ "include=;TRUE", "strip.white=;TRUE", "tidy=;FALSE", "tidy.opts=; ",
+                \ "prompt=;FALSE", "comment=;'##'", "highlight=;TRUE", "background=;'#F7F7F7'",
+                \ "cache=;FALSE", "cache.path=;'cache/'", "cache.vars=; ",
+                \ "cache.lazy=;TRUE", "cache.comments=; ", "dependson=;''",
+                \ "autodep=;FALSE", "fig.path=; ", "fig.keep=;'high|none|all|first|last'",
+                \ "fig.show=;'asis|hold|animate|hide'", "dev=; ", "dev.args=; ",
+                \ "fig.ext=; ", "dpi=;72", "fig.width=;7", "fig.height=;7",
+                \ "out.width=;'7in'", "out.height=;'7in'", "out.extra=; ",
+                \ "resize.width=; ", "resize.height=; ", "fig.align=;'left|right|center'",
+                \ "fig.env=;'figure'", "fig.cap=;''", "fig.scap=;''", "fig.lp=;'fig:'",
+                \ "fig.pos=;''", "fig.subcap=; ", "fig.process=; ", "interval=;1",
+                \ "aniopts=;'controls.loop'", "code=; ", "ref.label=; ",
+                \ "child=; ", "engine=;'R'", "opts.label=;''", "purl=;TRUE",
+                \ 'R.options=; ']
+    if &filetype == "rnoweb"
+        let ktopt += ["external=;TRUE", "sanitize=;FALSE", "size=;'normalsize'"]
+    endif
+    if &filetype == "rmd" || &filetype == "rrst"
+        let ktopt += ["fig.retina=;1"]
+        if &filetype == "rmd"
+            let ktopt += ["collapse=;FALSE"]
+        endif
+    endif
+    call sort(ktopt)
+
     for kopt in ktopt
       if kopt =~ newbase
         let tmp1 = split(kopt, ";")

From ee319fe559025bcbe628a0bfb61b35ab2505d86d Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Sat, 7 Jun 2014 00:04:48 -0300
Subject: [PATCH 0689/1050] More specific message when v:servername undefined.

---
 r-plugin/common_global.vim | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 9bf76c0..7793f5f 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -3236,8 +3236,12 @@ if has("gui_macvim")
     let $VIMEDITOR_SVRNM = "MacVim"
 elseif has("neovim")
     let $VIMEDITOR_SVRNM = "NeoVim"
+elseif !has("clientserver")
+    let $VIMEDITOR_SVRNM = "NoClientServer"
 elseif v:servername == ""
-    let $VIMEDITOR_SVRNM = "NoServerName"
+    if $DISPLAY != ""
+        let $VIMEDITOR_SVRNM = "NoServerName"
+    endif
 else
     let $VIMEDITOR_SVRNM = v:servername
 endif

From 653171cafa08895b7af7852408667eb21389e9c5 Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Sat, 7 Jun 2014 09:37:39 -0300
Subject: [PATCH 0690/1050] Set value of VIMEDITOR_SVRNM inside StartR().

---
 r-plugin/common_global.vim | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 7793f5f..af7814b 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -775,6 +775,16 @@ endfunction
 
 " Start R
 function StartR(whatr)
+    if $VIMEDITOR_SVRNM == ""
+        if v:servername == ""
+            if $DISPLAY != ""
+                let $VIMEDITOR_SVRNM = "NoServerName"
+            endif
+        else
+            let $VIMEDITOR_SVRNM = v:servername
+        endif
+    endif
+
     call writefile([], $VIMRPLUGIN_TMPDIR . "/globenv_" . $VIMINSTANCEID)
     call writefile([], $VIMRPLUGIN_TMPDIR . "/liblist_" . $VIMINSTANCEID)
     if filereadable($VIMRPLUGIN_TMPDIR . "/libnames_" . $VIMINSTANCEID)
@@ -3238,12 +3248,6 @@ elseif has("neovim")
     let $VIMEDITOR_SVRNM = "NeoVim"
 elseif !has("clientserver")
     let $VIMEDITOR_SVRNM = "NoClientServer"
-elseif v:servername == ""
-    if $DISPLAY != ""
-        let $VIMEDITOR_SVRNM = "NoServerName"
-    endif
-else
-    let $VIMEDITOR_SVRNM = v:servername
 endif
 
 if has("win32") || has("win64")

From 9d77fdf13420b8b29cee984826193449a4a95f59 Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Sat, 7 Jun 2014 10:15:43 -0300
Subject: [PATCH 0691/1050] Update.

---
 doc/r-plugin.txt | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index eb197f5..4357339 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -184,9 +184,9 @@ and ~/.bashrc (the  is `\` by default):
 >
    :RpluginConfig
 <
-The above command will guide you through the final configuration steps, but
-if you prefer to configure everything by yourself, please, read the sections
-|r-plugin-nox| and |r-plugin-quick-setup|.
+The above command will guide you through the final configuration steps if you
+answer `y` to all questions, but if you prefer to configure everything by
+yourself, please, read the sections |r-plugin-nox| and |r-plugin-quick-setup|.
 
 If you start either GVim or Vim in a terminal emulator the plugin will start R
 in a external terminal emulator. If you start Vim inside of a Tmux session,
@@ -279,7 +279,8 @@ Finally, click on the menu bar
    R
    Configure (Vim-R)
 <
-The above command will guide you through the final configuration steps.
+The above command will guide you through the final configuration steps if you
+answer `y` to all questions.
 
 You may have to adjust the value of |vimrplugin_sleeptime|.
 
@@ -969,12 +970,12 @@ emulator without the command line argument |--servername|, Vim will not
 receive remote messages and the vimcom.plus package will display one of the
 following messages:
 
-   vimcom.plus: Are you running MacVim?
-                MacVim isn't fully supported by vimcom.plus.
-
-   vimcom.plus: There is no X Server running.
-
-   vimcom.plus: Vim's servername is unknown.
+   MacVim isn't fully supported by vimcom.plus.
+   NeoVim isn't fully supported by vimcom.plus.
+   Vim was built without the 'clientserver' feature.
+   Did you pass the --servername argument to Vim?
+   There is no X Server running.
+   Vim's servername is unknown.
 
 To avoid the message, you should start vim with the |--servername| argument,
 as below:
@@ -2484,7 +2485,7 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details.
 							       *r-plugin-news*
 10. News~
 
-1.0 (2014-05-24)
+1.0 (2014-06-07)
 
  * vimrplugin_openpdf now accepts three values: 0, 1 and 2.
 

From 14328fc996a32ae47c30c01cda78c1d49665f713 Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Sun, 8 Jun 2014 08:40:49 -0300
Subject: [PATCH 0692/1050] Use "Neovim" instead of "NeoVim".

---
 r-plugin/common_global.vim | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index af7814b..10fd18f 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -3245,7 +3245,7 @@ let $VIMRPLUGIN_HOME = substitute(g:rplugin_home, ' ', '\\ ', "g")
 if has("gui_macvim")
     let $VIMEDITOR_SVRNM = "MacVim"
 elseif has("neovim")
-    let $VIMEDITOR_SVRNM = "NeoVim"
+    let $VIMEDITOR_SVRNM = "Neovim"
 elseif !has("clientserver")
     let $VIMEDITOR_SVRNM = "NoClientServer"
 endif

From 02d51060a17a58bcb6d2bfeb50a1cff359198022 Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Mon, 9 Jun 2014 02:12:25 -0300
Subject: [PATCH 0693/1050] Enable messages from Neovim to vimcom.plus. The
 Vim-R-plugin now can send messages to R if running in Neovim. Current known
 bugs affecting Neovim:   - Omnicompletion and completion of function
 arguments don't display     the pop up menu with the list of completions.   -
 Multiline messages don't display completely. Only the last line is     shown.
 The vimcom.plus package still cannot send messages to Neovim. It can only
 reply to messages received from Neovim.

---
 ftplugin/rbrowser.vim      |   8 +-
 r-plugin/common_global.vim | 191 ++++++++++++++++++++++++-------------
 2 files changed, 127 insertions(+), 72 deletions(-)

diff --git a/ftplugin/rbrowser.vim b/ftplugin/rbrowser.vim
index 614fc0e..5040767 100644
--- a/ftplugin/rbrowser.vim
+++ b/ftplugin/rbrowser.vim
@@ -1,7 +1,7 @@
 " Vim filetype plugin file
 " Language: R Browser (generated by the Vim-R-plugin)
 " Maintainer: Jakson Alves de Aquino 
-" Last Change:	Wed Apr 02, 2014  09:55AM
+" Last Change:	Sun Jun 08, 2014  08:38PM
 
 
 " Only do this when not yet done for this buffer
@@ -121,7 +121,7 @@ function! RBrowserDoubleClick()
     " Toggle state of list or data.frame: open X closed
     let key = RBrowserGetName(0, 1)
     if g:rplugin_curview == "GlobalEnv"
-        exe 'Py SendToVimCom("' . "\005" . key . '")'
+        call g:SendToVimCom("\005" . key)
         if g:rplugin_lastrpl == "R is busy."
             call RWarningMsg("R is busy.")
         endif
@@ -130,7 +130,7 @@ function! RBrowserDoubleClick()
         if key !~ "^package:"
             let key = "package:" . RBGetPkgName() . '-' . key
         endif
-        exe 'Py SendToVimCom("' . "\005" . key . '")'
+        call g:SendToVimCom("\005" . key)
         if g:rplugin_lastrpl == "R is busy."
             call RWarningMsg("R is busy.")
         endif
@@ -344,7 +344,7 @@ endif
 au BufEnter  stopinsert
 
 if $TMUX_PANE == ""
-    au BufUnload  Py SendToVimCom("\x08Stop updating info [OB BufUnload].")
+    au BufUnload  call g:SendToVimCom("\x08Stop updating info [OB BufUnload].")
 else
     au BufUnload  call ObBrBufUnload()
     " Fix problems caused by some plugins
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 10fd18f..bcc7687 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -145,7 +145,11 @@ function RCheckVimCom(msg)
         return 1
     endif
     if g:rplugin_vimcomport == 0
-        Py DiscoverVimComPort()
+        if has("neovim")
+            call jobwrite(g:rplugin_job, "DiscoverVimComPort\n")
+        else
+            Py DiscoverVimComPort()
+        endif
     endif
     if g:rplugin_vimcomport && g:rplugin_vimcom_pkg == "vimcom"
 	call RWarningMsg("The R package vimcom.plus is required to " . a:msg)
@@ -212,7 +216,7 @@ function RCompleteArgs()
     let line = getline(".")
     if (&filetype == "rnoweb" && line =~ "^<<.*>>=$") || (&filetype == "rmd" && line =~ "^``` *{r.*}$") || (&filetype == "rrst" && line =~ "^.. {r.*}$") || (&filetype == "r" && line =~ "^#\+")
         call CompleteChunkOptions()
-      return ''
+        return ''
     endif
     let lnum = line(".")
     let cpos = getpos(".")
@@ -262,18 +266,18 @@ function RCompleteArgs()
             " If R is running, use it
             call delete($VIMRPLUGIN_TMPDIR . "/eval_reply")
             if classfor == ""
-                exe 'Py SendToVimCom("' . g:rplugin_vimcom_pkg . ':::vim.args(' . "'" . rkeyword0 . "', '" . argkey . "')" . '")'
+                call g:SendToVimCom(g:rplugin_vimcom_pkg . ':::vim.args("' . rkeyword0 . '", "' . argkey . '")')
             else
-                exe 'Py SendToVimCom("' . g:rplugin_vimcom_pkg . ':::vim.args(' . "'" . rkeyword0 . "', '" . argkey . "', classfor = " . classfor . ")" . '")'
+                call g:SendToVimCom(g:rplugin_vimcom_pkg . ':::vim.args("' . rkeyword0 . '", "' . argkey . '", classfor = ' . classfor . ')')
             endif
             if g:rplugin_vimcomport > 0
-                let g:rplugin_lastrpl = ReadEvalReply()
-                if g:rplugin_lastrpl != "NOT_EXISTS" && g:rplugin_lastrpl != "NO_ARGS" && g:rplugin_lastrpl != "R is busy." && g:rplugin_lastrpl != "NOANSWER" && g:rplugin_lastrpl != "INVALID" && g:rplugin_lastrpl != "" && g:rplugin_lastrpl != "No reply"
+                let g:rplugin_lastev = ReadEvalReply()
+                if g:rplugin_lastev != "NOT_EXISTS" && g:rplugin_lastev != "NO_ARGS" && g:rplugin_lastev != "R is busy." && g:rplugin_lastev != "NOANSWER" && g:rplugin_lastev != "INVALID" && g:rplugin_lastev != "" && g:rplugin_lastev != "No reply"
                     let args = []
-                    if g:rplugin_lastrpl[0] == "\x04" && len(split(g:rplugin_lastrpl, "\x04")) == 1
+                    if g:rplugin_lastev[0] == "\x04" && len(split(g:rplugin_lastev, "\x04")) == 1
                         return ''
                     endif
-                    let tmp0 = split(g:rplugin_lastrpl, "\x04")
+                    let tmp0 = split(g:rplugin_lastev, "\x04")
                     let tmp = split(tmp0[0], "\x09")
                     if(len(tmp) > 0)
                         for id in range(len(tmp))
@@ -633,7 +637,7 @@ function StartR_TmuxSplit(rcmd)
     endif
     let g:rplugin_last_rcmd = a:rcmd
     if WaitVimComStart()
-        Py SendToVimCom("\001Update OB [StartR]")
+        call g:SendToVimCom("\001Update OB [StartR]")
     endif
 endfunction
 
@@ -712,7 +716,7 @@ function StartR_ExternalTerm(rcmd)
     endif
     let g:SendCmdToR = function('SendCmdToR_Term')
     if WaitVimComStart()
-        Py SendToVimCom("\001Update OB [StartR]")
+        call g:SendToVimCom("\001Update OB [StartR]")
     endif
 endfunction
 
@@ -726,10 +730,13 @@ function StartR_Windows()
             return
         endif
     endif
+    let vrph = $VIMRPLUGIN_HOME
+    let $VIMRPLUGIN_HOME = substitute($VIMRPLUGIN_HOME, "\\\\ ", " ", "g")
     Py StartRPy()
     if g:vimrplugin_vim_wd == 0
         lcd -
     endif
+    let $VIMRPLUGIN_HOME = vrph
     let g:SendCmdToR = function('SendCmdToR_Windows')
     call WaitVimComStart()
 endfunction
@@ -757,7 +764,7 @@ function StartR_OSX()
     endif
     let g:SendCmdToR = function('SendCmdToR_OSX')
     if WaitVimComStart()
-        Py SendToVimCom("\001Update OB [StartR]")
+        call g:SendToVimCom("\001Update OB [StartR]")
     endif
 endfunction
 
@@ -845,9 +852,9 @@ function StartR(whatr)
                         sleep 100m
                         call g:SendCmdToR("\014")
                     endif
-                    exe 'Py SendToVimCom("\007' . g:rplugin_obsname . '")'
-                    Py SendToVimCom("\003.GlobalEnv [Restarting R]")
-                    Py SendToVimCom("\004Libraries [Restarting()]")
+                    call g:SendToVimCom("\007" . g:rplugin_obsname)
+                    call g:SendToVimCom("\003.GlobalEnv [Restarting R]")
+                    call g:SendToVimCom("\004Libraries [Restarting()]")
                     " vimcom automatically update the libraries view, but not
                     " the GlobalEnv one because vimcom_count_objects() returns 0.
                     call VimExprToOB('UpdateOB("GlobalEnv")')
@@ -879,9 +886,9 @@ function StartR(whatr)
         call StartR_ExternalTerm(rcmd)
         if g:vimrplugin_restart && bufloaded(b:objbrtitle)
             call WaitVimComStart()
-            exe 'Py SendToVimCom("\007' . v:servername . '")'
-            Py SendToVimCom("\003.GlobalEnv [Restarting R]")
-            Py SendToVimCom("\004Libraries [Restarting()]")
+            call g:SendToVimCom("\007" . v:servername)
+            call g:SendToVimCom("\003.GlobalEnv [Restarting R]")
+            call g:SendToVimCom("\004Libraries [Restarting()]")
             if exists("*UpdateOB")
                 call UpdateOB("GlobalEnv")
             endif
@@ -970,9 +977,9 @@ function StartObjBrowser_Tmux()
 
     " Don't start the Object Browser if it already exists
     if IsExternalOBRunning()
-        Py SendToVimCom("\003GlobalEnv [OB StartObjBrowser_Tmux]")
+        call g:SendToVimCom("\003GlobalEnv [OB StartObjBrowser_Tmux]")
         sleep 50m
-        Py SendToVimCom("\004Libraries [OB StartObjBrowser_Tmux]")
+        call g:SendToVimCom("\004Libraries [OB StartObjBrowser_Tmux]")
         sleep 50m
         if $DISPLAY == "" && exists("g:rplugin_ob_pane")
             let slog = system("tmux set-buffer ':silent call UpdateOB(\"both\")\:\' && tmux paste-buffer -t " . g:rplugin_ob_pane . " && tmux select-pane -t " . g:rplugin_ob_pane)
@@ -1007,9 +1014,9 @@ function StartObjBrowser_Tmux()
                 \ 'set noruler',
                 \ 'let g:SendCmdToR = function("SendCmdToR_TmuxSplit")',
                 \ 'if has("clientserver") && v:servername != ""',
-                \ "   exe 'Py SendToVimCom(" . '"\007' . "' . v:servername . '" . '")' . "'",
+                \ '   call g:SendToVimCom("\007" . v:servername)',
                 \ 'endif',
-                \ 'Py SendToVimCom("\001Update OB [OB init TMUX]")',
+                \ 'call g:SendToVimCom("\001Update OB [OB init TMUX]")',
                 \ 'sleep 50m',
                 \ 'if v:servername == ""',
                 \ '    sleep 100m',
@@ -1110,7 +1117,7 @@ function StartObjBrowser_Vim()
         endif
         let g:rplugin_ob_warn_shown = 1
     else
-        exe 'Py SendToVimCom("\007' . v:servername . '")'
+        call g:SendToVimCom("\007" . v:servername)
     endif
 
     " Either load or reload the Object Browser
@@ -1143,7 +1150,7 @@ function StartObjBrowser_Vim()
         unlet g:tmp_objbrtitle
         unlet g:tmp_tmuxsname
         unlet g:tmp_curbufname
-        Py SendToVimCom("\001Update OB [OB init GVIM]")
+        call g:SendToVimCom("\001Update OB [OB init GVIM]")
         sleep 50m
         call UpdateOB("GlobalEnv")
     endif
@@ -1155,7 +1162,7 @@ endfunction
 
 " Open an Object Browser window
 function RObjBrowser()
-    if !has("python") && !has("python3")
+    if !has("python") && !has("python3") && !has("neovim")
         call RWarningMsg("Python support is required to run the Object Browser.")
         return
     endif
@@ -1191,7 +1198,7 @@ function RObjBrowser()
 endfunction
 
 function VimExprToOB(msg)
-    if serverlist() =~ "\\<" . g:rplugin_obsname . "\n"
+    if !has("neovim") && serverlist() =~ "\\<" . g:rplugin_obsname . "\n"
         return remote_expr(g:rplugin_obsname, a:msg)
     endif
     return "Vim server not found"
@@ -1223,7 +1230,7 @@ function RBrowserOpenCloseLists(status)
 
     " Avoid possibly freezing cross messages between Vim and R
     if exists("g:rplugin_curview") && v:servername != ""
-        Py SendToVimCom("\x08Stop updating info [RBrowserOpenCloseLists()]")
+        call g:SendToVimCom("\x08Stop updating info [RBrowserOpenCloseLists()]")
         let stt = a:status
     else
         let stt = a:status + 2
@@ -1237,7 +1244,7 @@ function RBrowserOpenCloseLists(status)
         let switchedbuf = 1
     endif
 
-    exe 'Py SendToVimCom("' . "\006" . stt . '")'
+    call g:SendToVimCom("\006" . stt)
 
     if g:rplugin_lastrpl == "R is busy."
         call RWarningMsg("R is busy.")
@@ -1250,17 +1257,21 @@ function RBrowserOpenCloseLists(status)
     if exists("g:rplugin_curview")
         call UpdateOB("both")
         if v:servername != ""
-            exe 'Py SendToVimCom("\007' . v:servername . '")'
+            call g:SendToVimCom("\007" . v:servername)
         endif
     elseif IsExternalOBRunning()
         call VimExprToOB('UpdateOB("GlobalEnv")')
-        exe 'Py SendToVimCom("\007' . g:rplugin_obsname . '")'
+        call g:SendToVimCom("\007" . g:rplugin_obsname)
     endif
 endfunction
 
 function RFormatCode() range
     if g:rplugin_vimcomport == 0
-        exe "Py DiscoverVimComPort()"
+        if has("neovim")
+            call jobwrite(g:rplugin_job, "DiscoverVimComPort\n")
+        else
+            Py DiscoverVimComPort()
+        endif
         if g:rplugin_vimcomport == 0
             return
         endif
@@ -1283,10 +1294,10 @@ function RFormatCode() range
         let wco = 180
     endif
     call delete($VIMRPLUGIN_TMPDIR . "/eval_reply")
-    exe "Py SendToVimCom('formatR::tidy.source(\"" . $VIMRPLUGIN_TMPDIR . "/unformatted_code" . "\", file = \"" . $VIMRPLUGIN_TMPDIR . "/formatted_code\", width.cutoff = " . wco . ")')"
-    let g:rplugin_lastrpl = ReadEvalReply()
-    if g:rplugin_lastrpl == "R is busy." || g:rplugin_lastrpl == "UNKNOWN" || g:rplugin_lastrpl =~ "^Error" || g:rplugin_lastrpl == "INVALID" || g:rplugin_lastrpl == "ERROR" || g:rplugin_lastrpl == "EMPTY" || g:rplugin_lastrpl == "No reply"
-        call RWarningMsg(g:rplugin_lastrpl)
+    call g:SendToVimCom('formatR::tidy.source("' . $VIMRPLUGIN_TMPDIR . '/unformatted_code", file = "' . $VIMRPLUGIN_TMPDIR . '/formatted_code", width.cutoff = ' . wco . ')')
+    let g:rplugin_lastev = ReadEvalReply()
+    if g:rplugin_lastev == "R is busy." || g:rplugin_lastev == "UNKNOWN" || g:rplugin_lastev =~ "^Error" || g:rplugin_lastev == "INVALID" || g:rplugin_lastev == "ERROR" || g:rplugin_lastev == "EMPTY" || g:rplugin_lastev == "No reply"
+        call RWarningMsg(g:rplugin_lastev)
         return
     endif
     let lns = readfile($VIMRPLUGIN_TMPDIR . "/formatted_code")
@@ -1297,7 +1308,11 @@ endfunction
 
 function RInsert(cmd)
     if g:rplugin_vimcomport == 0
-        exe "Py DiscoverVimComPort()"
+        if has("neovim")
+            call jobwrite(g:rplugin_job, "DiscoverVimComPort\n")
+        else
+            Py DiscoverVimComPort()
+        endif
         if g:rplugin_vimcomport == 0
             return
         endif
@@ -1311,10 +1326,10 @@ function RInsert(cmd)
 
     call delete($VIMRPLUGIN_TMPDIR . "/eval_reply")
     call delete($VIMRPLUGIN_TMPDIR . "/Rinsert")
-    exe "Py SendToVimCom('capture.output(" . a:cmd . ', file = "' . $VIMRPLUGIN_TMPDIR . "/Rinsert" . '")' . "')"
-    let g:rplugin_lastrpl = ReadEvalReply()
-    if g:rplugin_lastrpl == "R is busy." || g:rplugin_lastrpl == "UNKNOWN" || g:rplugin_lastrpl =~ "^Error" || g:rplugin_lastrpl == "INVALID" || g:rplugin_lastrpl == "ERROR" || g:rplugin_lastrpl == "EMPTY" || g:rplugin_lastrpl == "No reply"
-        call RWarningMsg(g:rplugin_lastrpl)
+    call g:SendToVimCom('capture.output(' . a:cmd . ', file = "' . $VIMRPLUGIN_TMPDIR . '/Rinsert")')
+    let g:rplugin_lastev = ReadEvalReply()
+    if g:rplugin_lastev == "R is busy." || g:rplugin_lastev == "UNKNOWN" || g:rplugin_lastev =~ "^Error" || g:rplugin_lastev == "INVALID" || g:rplugin_lastev == "ERROR" || g:rplugin_lastev == "EMPTY" || g:rplugin_lastev == "No reply"
+        call RWarningMsg(g:rplugin_lastev)
     else
         silent exe "read " . g:rplugin_esc_tmpdir . "/Rinsert"
     endif
@@ -1988,19 +2003,19 @@ function BuildROmniList()
     let omnilistcmd = omnilistcmd . ')'
 
     call delete($VIMRPLUGIN_TMPDIR . "/vimbol_finished")
-        call delete($VIMRPLUGIN_TMPDIR . "/eval_reply")
-        exe "Py SendToVimCom('" . omnilistcmd . "')"
-        if g:rplugin_vimcomport == 0
-            sleep 500m
-            return
-        endif
-        let g:rplugin_lastrpl = ReadEvalReply()
-        if g:rplugin_lastrpl == "R is busy." || g:rplugin_lastrpl == "No reply"
-            call RWarningMsg(g:rplugin_lastrpl)
-            sleep 800m
-            return
-        endif
-        sleep 20m
+    call delete($VIMRPLUGIN_TMPDIR . "/eval_reply")
+    call g:SendToVimCom(omnilistcmd)
+    if g:rplugin_vimcomport == 0
+        sleep 500m
+        return
+    endif
+    let g:rplugin_lastev = ReadEvalReply()
+    if g:rplugin_lastev == "R is busy." || g:rplugin_lastev == "No reply"
+        call RWarningMsg(g:rplugin_lastev)
+        sleep 800m
+        return
+    endif
+    sleep 20m
     let ii = 0
     while !filereadable($VIMRPLUGIN_TMPDIR . "/vimbol_finished") && ii < 5
         let ii += 1
@@ -2243,7 +2258,7 @@ endfunction
 " Show R's help doc in Vim's buffer
 " (based  on pydoc plugin)
 function ShowRDoc(rkeyword, package, getclass)
-    if !has("python") && !has("python3")
+    if !has("python") && !has("python3") && !has("neovim")
         call RWarningMsg("Python support is required to see R documentation on Vim.")
         return
     endif
@@ -2288,33 +2303,35 @@ function ShowRDoc(rkeyword, package, getclass)
 
     call SetRTextWidth()
 
-    let g:rplugin_lastrpl = "R did not reply."
     call delete($VIMRPLUGIN_TMPDIR . "/eval_reply")
     if classfor == "" && a:package == ""
-        exe 'Py SendToVimCom("vim.help(' . "'" . a:rkeyword . "', " . g:rplugin_htw . 'L)")'
+        call g:SendToVimCom('vim.help("' . a:rkeyword . '", ' . g:rplugin_htw . 'L)')
     elseif a:package != ""
-        exe 'Py SendToVimCom("vim.help(' . "'" . a:rkeyword . "', " . g:rplugin_htw . "L, package='" . a:package  . "')". '")'
+        call g:SendToVimCom('vim.help("' . a:rkeyword . '", ' . g:rplugin_htw . 'L, package="' . a:package  . '")')
     else
         let classfor = substitute(classfor, '\\', "", "g")
         let classfor = substitute(classfor, '"', '\\"', "g")
-        exe 'Py SendToVimCom("vim.help(' . "'" . a:rkeyword . "', " . g:rplugin_htw . "L, " . classfor . ")". '")'
+        call g:SendToVimCom('vim.help("' . a:rkeyword . '", ' . g:rplugin_htw . 'L, ' . classfor . ')')
     endif
-    let g:rplugin_lastrpl = ReadEvalReply()
-    if g:rplugin_lastrpl != "VIMHELP"
-        if g:rplugin_lastrpl =~ "^MULTILIB"
-            echo "The topic '" . a:rkeyword . "' was found in more than one library:"
-            let libs = split(g:rplugin_lastrpl)
+    let g:rplugin_lastev = ReadEvalReply()
+    if g:rplugin_lastev != "VIMHELP"
+        if g:rplugin_lastev =~ "^MULTILIB"
+            let msg = "The topic '" . a:rkeyword . "' was found in more than one library:\n"
+            let libs = split(g:rplugin_lastev)
             for idx in range(1, len(libs) - 1)
-                echo idx . " : " . libs[idx]
+                let msg .= idx . " : " . libs[idx] . "\n"
             endfor
-            let chn = input("Please, select one of them: ")
+            redraw
+            let chn = input(msg . "Please, select one of them: ")
             if chn > 0 && chn < len(libs)
                 call delete($VIMRPLUGIN_TMPDIR . "/eval_reply")
-                exe 'Py SendToVimCom("vim.help(' . "'" . a:rkeyword . "', " . g:rplugin_htw . "L, package='" . libs[chn] . "')" . '")'
-                let g:rplugin_lastrpl = ReadEvalReply()
+                call g:SendToVimCom('vim.help("' . a:rkeyword . '", ' . g:rplugin_htw . 'L, package="' . libs[chn] . '")')
+                let g:rplugin_lastev = ReadEvalReply()
+            else
+                return
             endif
         else
-            call RWarningMsg(g:rplugin_lastrpl)
+            call RWarningMsg(g:rplugin_lastev)
             return
         endif
     endif
@@ -3258,6 +3275,7 @@ if has("win32") || has("win64")
     else
         let $VIMRPLUGIN_TMPDIR = g:rplugin_uservimfiles . "/r-plugin/tmp"
     endif
+    let $VIMRPLUGIN_TMPDIR = substitute($VIMRPLUGIN_TMPDIR, "\\", "/", "g")
 else
     if isdirectory($TMPDIR)
         let $VIMRPLUGIN_TMPDIR = $TMPDIR . "/r-plugin-" . g:rplugin_userlogin
@@ -3342,6 +3360,30 @@ endfor
 unlet objbrplace
 unlet obpllen
 
+function RJobEvent()
+    if v:job_data[1] == 'stdout'
+        let cmd = substitute(v:job_data[2], "\n$", "", "")
+        exe cmd
+        let g:last_job_output = cmd
+    elseif v:job_data[1] == 'stderr'
+        let str = 'neovim.py error: ' . v:job_data[2]
+        call RWarningMsg(str)
+    else
+        let g:rplugin_job = 0
+    endif
+endfunction
+
+function SendToVimCom_Vim(cmd)
+    exe "Py SendToVimCom('" . a:cmd . "')"
+endfunction
+
+function SendToVimCom_Neovim(cmd)
+    let g:nvimcom_py_Input = a:cmd
+    call jobwrite(g:rplugin_job, "SendToVimCom " . a:cmd . "\n")
+endfunction
+
+let g:SendToVimCom = function("SendToVimCom_Vim")
+
 " python3 has priority over python
 if has("python3")
     command! -nargs=+ Py :py3 
@@ -3349,12 +3391,13 @@ if has("python3")
 elseif has("python")
     command! -nargs=+ Py :py 
     command! -nargs=+ PyFile :pyfile 
+elseif has("neovim")
+    let g:SendToVimCom = function("SendToVimCom_Neovim")
 else
     command! -nargs=+ Py :
     command! -nargs=+ PyFile :
 endif
 
-exe "PyFile " . substitute(g:rplugin_home, " ", '\\ ', "g") . "/r-plugin/vimcom.py"
 
 " ^K (\013) cleans from cursor to the right and ^U (\025) cleans from cursor
 " to the left. However, ^U causes a beep if there is nothing to clean. The
@@ -3675,6 +3718,7 @@ let g:rplugin_vimcomport = 0
 let g:rplugin_vimcom_pkg = "vimcom"
 let g:rplugin_vimcom_version = 0
 let g:rplugin_lastrpl = ""
+let g:rplugin_lastev = ""
 let g:rplugin_hasRSFbutton = 0
 let g:rplugin_tmuxsname = substitute("vimrplugin-" . g:rplugin_userlogin . localtime() . g:rplugin_firstbuffer, '\W', '', 'g')
 
@@ -3694,6 +3738,17 @@ if &filetype != "rbrowser"
     call writefile([], $VIMRPLUGIN_TMPDIR . "/GlobalEnvList_" . $VIMINSTANCEID)
 endif
 
+if has("neovim")
+    if executable("python")
+        let g:rplugin_job = jobstart('vimcom', 'python', [g:rplugin_home . '/r-plugin/nvimcom.py'])
+        autocmd JobActivity vimcom call RJobEvent()
+    else
+        call RWarningMsgInp("Python executable not found.")
+    endif
+else
+    exe "PyFile " . substitute(g:rplugin_home, " ", '\\ ', "g") . "/r-plugin/vimcom.py"
+endif
+
 call SetRPath()
 
 " Keeps the names object list in memory to avoid the need of reading the files

From f9ff82ca16f4f3a8dc961787307e13c05a6875de Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Mon, 9 Jun 2014 02:20:05 -0300
Subject: [PATCH 0694/1050] Update.

---
 doc/r-plugin.txt | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 4357339..7113473 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -971,7 +971,7 @@ receive remote messages and the vimcom.plus package will display one of the
 following messages:
 
    MacVim isn't fully supported by vimcom.plus.
-   NeoVim isn't fully supported by vimcom.plus.
+   Neovim isn't fully supported by vimcom.plus.
    Vim was built without the 'clientserver' feature.
    Did you pass the --servername argument to Vim?
    There is no X Server running.
@@ -1021,6 +1021,8 @@ A user reported success with the following procedure:
    tmux
    /usr/local/Cellar/vim/7.4.273/bin/vim --servername VIM r_script.R
 <
+Neovim msgpack API is not supported by vimcom.plus yet.
+
 See also: |r-plugin-remote|.
 
 
@@ -1990,16 +1992,17 @@ Vim can jump to a function definition if it finds a "tags" file with the
 information about the place where the function is defined. To generate the
 tags file, use the R function `rtags()`, which will build an Emacs tags file.
 If Vim was compiled with the feature |emacs_tags|, it will be able to read the
-tags file. Otherwise, you can use the function `etags2ctags()` from the script
-located at ~/.vim/r-plugin/etags2ctags.R to convert the Emacs tags file into a
-Vim's one. To jump to a function definition, put the cursor over the function
-name and hit CTRL-]. Please, read |tagsrch.txt| for details on how to use tags
-files, specially the section |tags-option|.
+tags file. Otherwise, you can use the vimcom.plus function `etags2ctags()` to
+convert the Emacs tags file into a Vim's one. To jump to a function
+definition, put the cursor over the function name and hit CTRL-]. Please, read
+|tagsrch.txt| for details on how to use tags files, specially the section
+|tags-option|.
 
 You could, for example, download and unpack R's source code, start R inside
 the ~/.vim directory and do the following command:
 >
    rtags(path = "/path/to/R/source/code", recursive = TRUE, ofile = "RTAGS")
+   etags2ctags("RTAGS", "Rtags")
 <
 Then, you would quit R and do the following command in the terminal emulator:
 >
@@ -2007,10 +2010,10 @@ Then, you would quit R and do the following command in the terminal emulator:
 <
 Finally, you would put the following in your |vimrc|, inside an |autocmd-group|:
 >
-   autocmd FileType r set tags+=~/.vim/RTAGS,~/.vim/RsrcTags
-   autocmd FileType rnoweb set tags+=~/.vim/RTAGS,~/.vim/RsrcTags
+   autocmd FileType r set tags+=~/.vim/Rtags,~/.vim/RsrcTags
+   autocmd FileType rnoweb set tags+=~/.vim/Rtags,~/.vim/RsrcTags
 <
-Note: While defining the autocmd, the RTAGS path must be put before RsrcTags.
+Note: While defining the autocmd, the Rtags path must be put before RsrcTags.
 
 Example on how to test whether your setup is ok:
 
@@ -2485,7 +2488,7 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details.
 							       *r-plugin-news*
 10. News~
 
-1.0 (2014-06-07)
+1.0 (2014-06-09)
 
  * vimrplugin_openpdf now accepts three values: 0, 1 and 2.
 

From 943a2b7527dd340751588a7b2f92f52a40e731b4 Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Mon, 9 Jun 2014 02:20:32 -0300
Subject: [PATCH 0695/1050] On Windows, only load vimcom.plus if TMPDIR is set.

---
 r-plugin/vimrconfig.vim | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/r-plugin/vimrconfig.vim b/r-plugin/vimrconfig.vim
index 7ccdc47..88d71bf 100644
--- a/r-plugin/vimrconfig.vim
+++ b/r-plugin/vimrconfig.vim
@@ -100,7 +100,12 @@ function! RConfigRprofile()
                     let rpflines += ['    # library(setwidth)']
                 endif
             endif
-            let rpflines += ['    library(vimcom.plus)']
+            if has("win32") || has("win64")
+                let rpflines += ['    if(Sys.getenv("VIMRPLUGIN_TMPDIR") != "")',
+                            \ '        library(vimcom.plus)']
+            else
+                let rpflines += ['    library(vimcom.plus)']
+            endif
 
             if !(has("win32") || has("win64"))
                 redraw

From e205e8b56de3d295975f75ee603ee62ff7fc71b3 Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Mon, 9 Jun 2014 03:08:52 -0300
Subject: [PATCH 0696/1050] New file: nvimcom.py (Neovim messages to R).

---
 r-plugin/nvimcom.py | 114 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 114 insertions(+)
 create mode 100644 r-plugin/nvimcom.py

diff --git a/r-plugin/nvimcom.py b/r-plugin/nvimcom.py
new file mode 100644
index 0000000..b114d1f
--- /dev/null
+++ b/r-plugin/nvimcom.py
@@ -0,0 +1,114 @@
+
+import sys
+import socket
+import os
+import re
+
+VimComPort = 0
+PortWarn = False
+VimComFamily = None
+VimComPkg = "vimcom"
+
+def DiscoverVimComPort():
+    global PortWarn
+    global VimComPort
+    global VimComFamily
+    global VimComPkg
+    HOST = "localhost"
+    VimComPort = 9998
+    repl = "NOTHING"
+    correct_repl = os.getenv("VIMINSTANCEID")
+    if correct_repl is None:
+        print "call RWarningMsg('VIMINSTANCEID not found by nvimcom.py.')\n"
+        sys.stdout.flush()
+        return
+
+    while repl.find(correct_repl) < 0 and VimComPort < 10050:
+        VimComPort = VimComPort + 1
+        for res in socket.getaddrinfo(HOST, VimComPort, socket.AF_UNSPEC, socket.SOCK_DGRAM):
+            af, socktype, proto, canonname, sa = res
+            try:
+                sock = socket.socket(af, socktype, proto)
+                sock.settimeout(0.1)
+                sock.connect(sa)
+                if sys.hexversion < 0x03000000:
+                    sock.send("\002What port [Python 2]?")
+                    repl = sock.recv(1024)
+                else:
+                    sock.send("\002What port [Python 3]?".encode())
+                    repl = sock.recv(1024).decode()
+                sock.close()
+                if repl.find(correct_repl):
+                    VimComFamily = af
+                    if repl.find(" vimcom.plus ") > -1:
+                        VimComPkg = "vimcom.plus"
+                    break
+            except:
+                sock = None
+                continue
+
+    if VimComPort >= 10050:
+        VimComPort = 0
+        if not PortWarn:
+            PortWarn = True
+            print "let g:rplugin_vimcomport = 0\n"
+            sys.stdout.flush()
+            print "call RWarningMsg('VimCom port not found.')\n"
+            sys.stdout.flush()
+        return
+    else:
+        print "let g:rplugin_vimcomport = " + str(VimComPort) + "\n"
+        sys.stdout.flush()
+        PortWarn = False
+        if repl.find("1.0-0") != 0:
+            print "call RWarningMsg('This version of Vim-R-plugin requires vimcom.plus (or vimcom) 1.0-0.')\n"
+            sys.stdout.flush()
+        return
+
+
+def SendToVimCom(aString):
+    HOST = "localhost"
+    global VimComPort
+    global VimComFamily
+    if VimComPort == 0:
+        DiscoverVimComPort()
+        if VimComPort == 0:
+            return "NoPort"
+    received = None
+
+    sock = socket.socket(VimComFamily, socket.SOCK_DGRAM)
+    sock.settimeout(3.0)
+
+    try:
+        sock.connect((HOST, VimComPort))
+        if sys.hexversion < 0x03000000:
+            sock.send(aString)
+            received = sock.recv(5012)
+        else:
+            sock.send(aString.encode())
+            received = sock.recv(5012).decode()
+    except:
+        pass
+    finally:
+        sock.close()
+
+    if received is None:
+        VimComPort = 0
+        return "NOANSWER"
+    else:
+        received = received.replace("'", "' . \"'\" . '")
+        return received
+
+while True:
+    line = raw_input()
+    if line.find("SendToVimCom") != -1:
+        line = line.replace("SendToVimCom ", "")
+        rpl = SendToVimCom(line)
+        print "let g:rplugin_lastrpl = '" + rpl + "'\n"
+    else:
+        if line.find("DiscoverVimComPort") != -1:
+            DiscoverVimComPort()
+        else:
+            print "call RWarningMsg('nvimcom.py: Unknown command: '" + line + "'.\n"
+    sys.stdout.flush()
+

From 58515747ac6657c8a606a2bd1fe52af26331d343 Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Wed, 11 Jun 2014 21:01:04 -0300
Subject: [PATCH 0697/1050] Fully support neovim.

---
 autoload/rcomplete.vim     | 138 +++++++++----
 doc/r-plugin.txt           |  10 +-
 ftplugin/rbrowser.vim      |   2 +-
 r-plugin/common_buffer.vim |  18 +-
 r-plugin/common_global.vim | 408 +++++++++++++++++++++++--------------
 r-plugin/nvimcom.py        |   3 +-
 r-plugin/nvimserver.py     |  67 ++++++
 7 files changed, 430 insertions(+), 216 deletions(-)
 create mode 100644 r-plugin/nvimserver.py

diff --git a/autoload/rcomplete.vim b/autoload/rcomplete.vim
index a3a8ea7..436e371 100644
--- a/autoload/rcomplete.vim
+++ b/autoload/rcomplete.vim
@@ -3,55 +3,109 @@
 " Maintainer:  Jakson Alves de Aquino 
 "
 
-fun! rcomplete#CompleteR(findstart, base)
-  if &filetype == "rnoweb" && RnwIsInRCode(0) == 0 && exists("*LatexBox_Complete")
-      let texbegin = LatexBox_Complete(a:findstart, a:base)
-      return texbegin
-  endif
-  if a:findstart
-    let line = getline('.')
-    let start = col('.') - 1
-    while start > 0 && (line[start - 1] =~ '\w' || line[start - 1] =~ '\.' || line[start - 1] =~ '\$')
-      let start -= 1
-    endwhile
-    return start
-  else
-    if string(g:SendCmdToR) != "function('SendCmdToR_fake')"
-      call BuildROmniList()
+" Tell R to create a list of objects file listing all currently available
+" objects in its environment. The file is necessary for omni completion.
+function BuildROmniList()
+    if string(g:SendCmdToR) == "function('SendCmdToR_fake')"
+        return
     endif
-    let res = []
-    if strlen(a:base) == 0
-      return res
+    if has("win32") || has("win64") && g:rplugin_vimcom_pkg == "vimcom"
+        if !exists("g:rplugin_vimcom_omni_warn")
+            let g:rplugin_vimcom_omni_warn = 1
+            if RCheckVimCom("complete the names of objects from R's workspace.")
+                sleep 2
+                return
+            endif
+        else
+            return
+        endif
     endif
 
-    if len(g:rplugin_liblist) == 0
-        call add(res, {'word': a:base, 'menu': " [ List is empty. Did you load vimcom.plus package? ]"})
+    let omnilistcmd = 'vim.bol("' . $VIMRPLUGIN_TMPDIR . "/GlobalEnvList_" . $VIMINSTANCEID . '"'
+    if g:vimrplugin_allnames == 1
+        let omnilistcmd = omnilistcmd . ', allnames = TRUE'
     endif
+    let omnilistcmd = omnilistcmd . ')'
 
-    let flines = g:rplugin_liblist + g:rplugin_globalenvlines
-    " The char '$' at the end of 'a:base' is treated as end of line, and
-    " the pattern is never found in 'line'.
-    let newbase = '^' . substitute(a:base, "\\$$", "", "")
-    for line in flines
-      if line =~ newbase
-        " Skip cols of data frames unless the user is really looking for them.
-        if a:base !~ '\$' && line =~ '\$'
-            continue
+    call delete($VIMRPLUGIN_TMPDIR . "/vimbol_finished")
+    call delete($VIMRPLUGIN_TMPDIR . "/eval_reply")
+    if has("neovim")
+        call g:SendToVimCom("I\002" . omnilistcmd)
+    else
+        call g:SendToVimCom(omnilistcmd)
+    endif
+    if g:rplugin_vimcomport == 0
+        sleep 500m
+        return
+    endif
+    let g:rplugin_lastev = ReadEvalReply()
+    if g:rplugin_lastev == "R is busy." || g:rplugin_lastev == "No reply"
+        call RWarningMsg(g:rplugin_lastev)
+        sleep 800m
+        return
+    endif
+    sleep 20m
+    let ii = 0
+    while !filereadable($VIMRPLUGIN_TMPDIR . "/vimbol_finished") && ii < 5
+        let ii += 1
+        sleep
+    endwhile
+    echon "\r               "
+    if ii == 5
+        call RWarningMsg("No longer waiting...")
+        return
+    endif
+
+    let g:rplugin_globalenvlines = readfile($VIMRPLUGIN_TMPDIR . "/GlobalEnvList_" . $VIMINSTANCEID)
+endfunction
+
+fun! rcomplete#CompleteR(findstart, base)
+    if &filetype == "rnoweb" && RnwIsInRCode(0) == 0 && exists("*LatexBox_Complete")
+        let texbegin = LatexBox_Complete(a:findstart, a:base)
+        return texbegin
+    endif
+    if a:findstart
+        let line = getline('.')
+        let start = col('.') - 1
+        while start > 0 && (line[start - 1] =~ '\w' || line[start - 1] =~ '\.' || line[start - 1] =~ '\$')
+            let start -= 1
+        endwhile
+        return start
+    else
+        call BuildROmniList()
+        let resp = []
+        if strlen(a:base) == 0
+            return resp
         endif
-        let tmp1 = split(line, "\x06", 1)
-        if g:vimrplugin_show_args
-            let info = tmp1[4]
-            let info = substitute(info, "\t", ", ", "g")
-            let info = substitute(info, "\x07", " = ", "g")
-            let tmp2 = {'word': tmp1[0], 'menu': tmp1[1] . ' ' . tmp1[3], 'info': info}
-        else
-            let tmp2 = {'word': tmp1[0], 'menu': tmp1[1] . ' ' . tmp1[3]}
+
+        if len(g:rplugin_liblist) == 0
+            call add(resp, {'word': a:base, 'menu': " [ List is empty. Did you load vimcom.plus package? ]"})
         endif
-	call add(res, tmp2)
-      endif
-    endfor
 
-    return res
-  endif
+        let flines = g:rplugin_liblist + g:rplugin_globalenvlines
+        " The char '$' at the end of 'a:base' is treated as end of line, and
+        " the pattern is never found in 'line'.
+        let newbase = '^' . substitute(a:base, "\\$$", "", "")
+        for line in flines
+            if line =~ newbase
+                " Skip cols of data frames unless the user is really looking for them.
+                if a:base !~ '\$' && line =~ '\$'
+                    continue
+                endif
+                let tmp1 = split(line, "\x06", 1)
+                if g:vimrplugin_show_args
+                    let info = tmp1[4]
+                    let info = substitute(info, "\t", ", ", "g")
+                    let info = substitute(info, "\x07", " = ", "g")
+                    let tmp2 = {'word': tmp1[0], 'menu': tmp1[1] . ' ' . tmp1[3], 'info': info}
+                else
+                    let tmp2 = {'word': tmp1[0], 'menu': tmp1[1] . ' ' . tmp1[3]}
+                endif
+                call add(resp, tmp2)
+            endif
+        endfor
+
+        return resp
+    endif
 endfun
 
diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 7113473..f4b492d 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -971,7 +971,6 @@ receive remote messages and the vimcom.plus package will display one of the
 following messages:
 
    MacVim isn't fully supported by vimcom.plus.
-   Neovim isn't fully supported by vimcom.plus.
    Vim was built without the 'clientserver' feature.
    Did you pass the --servername argument to Vim?
    There is no X Server running.
@@ -1021,8 +1020,6 @@ A user reported success with the following procedure:
    tmux
    /usr/local/Cellar/vim/7.4.273/bin/vim --servername VIM r_script.R
 <
-Neovim msgpack API is not supported by vimcom.plus yet.
-
 See also: |r-plugin-remote|.
 
 
@@ -1999,7 +1996,7 @@ definition, put the cursor over the function name and hit CTRL-]. Please, read
 |tags-option|.
 
 You could, for example, download and unpack R's source code, start R inside
-the ~/.vim directory and do the following command:
+the ~/.vim directory and do the following commands:
 >
    rtags(path = "/path/to/R/source/code", recursive = TRUE, ofile = "RTAGS")
    etags2ctags("RTAGS", "Rtags")
@@ -2008,7 +2005,8 @@ Then, you would quit R and do the following command in the terminal emulator:
 >
    ctags --languages=C,Fortran,Java,Tcl -R -f RsrcTags /path/to/R/source/code
 <
-Finally, you would put the following in your |vimrc|, inside an |autocmd-group|:
+Finally, you would put the following in your |vimrc|, optionally inside an
+|autocmd-group|:
 >
    autocmd FileType r set tags+=~/.vim/Rtags,~/.vim/RsrcTags
    autocmd FileType rnoweb set tags+=~/.vim/Rtags,~/.vim/RsrcTags
@@ -2488,7 +2486,7 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details.
 							       *r-plugin-news*
 10. News~
 
-1.0 (2014-06-09)
+1.0 (2014-06-11)
 
  * vimrplugin_openpdf now accepts three values: 0, 1 and 2.
 
diff --git a/ftplugin/rbrowser.vim b/ftplugin/rbrowser.vim
index 5040767..564f4b3 100644
--- a/ftplugin/rbrowser.vim
+++ b/ftplugin/rbrowser.vim
@@ -1,7 +1,7 @@
 " Vim filetype plugin file
 " Language: R Browser (generated by the Vim-R-plugin)
 " Maintainer: Jakson Alves de Aquino 
-" Last Change:	Sun Jun 08, 2014  08:38PM
+" Last Change:	Mon Jun 09, 2014  11:02PM
 
 
 " Only do this when not yet done for this buffer
diff --git a/r-plugin/common_buffer.vim b/r-plugin/common_buffer.vim
index 14f9d7b..8a4095e 100644
--- a/r-plugin/common_buffer.vim
+++ b/r-plugin/common_buffer.vim
@@ -72,14 +72,16 @@ if !exists("g:SendCmdToR")
     let g:SendCmdToR = function('SendCmdToR_fake')
 endif
 
-if &filetype != "rbrowser"
-    if v:servername == "" || has("gui_macvim")
-        autocmd CursorHold  call RCheckLibListFile()
-    else
-        if &filetype != "r"
-            autocmd CursorMoved  call RCheckLibList()
-            if g:vimrplugin_insert_mode_cmds == 1
-                autocmd CursorMovedI  call RCheckLibList()
+if !has("neovim")
+    if &filetype != "rbrowser"
+        if v:servername == "" || has("gui_macvim")
+            autocmd CursorHold  call RCheckLibListFile()
+        else
+            if &filetype != "r"
+                autocmd CursorMoved  call RCheckLibList()
+                if g:vimrplugin_insert_mode_cmds == 1
+                    autocmd CursorMovedI  call RCheckLibList()
+                endif
             endif
         endif
     endif
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index bcc7687..fd8698f 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -146,7 +146,7 @@ function RCheckVimCom(msg)
     endif
     if g:rplugin_vimcomport == 0
         if has("neovim")
-            call jobwrite(g:rplugin_job, "DiscoverVimComPort\n")
+            call jobwrite(g:rplugin_clt_job, "DiscoverVimComPort\n")
         else
             Py DiscoverVimComPort()
         endif
@@ -218,6 +218,7 @@ function RCompleteArgs()
         call CompleteChunkOptions()
         return ''
     endif
+
     let lnum = line(".")
     let cpos = getpos(".")
     let idx = cpos[2] - 2
@@ -235,10 +236,7 @@ function RCompleteArgs()
         let argkey = strpart(line, idx1, idx2 - idx1 + 1)
         let idx2 = cpos[2] - strlen(argkey)
     endif
-    if string(g:SendCmdToR) != "function('SendCmdToR_fake')"
-      call BuildROmniList()
-    endif
-    let flines = g:rplugin_globalenvlines + g:rplugin_liblist
+
     let np = 1
     let nl = 0
 
@@ -264,45 +262,54 @@ function RCompleteArgs()
             call cursor(cpos[1], cpos[2])
 
             " If R is running, use it
-            call delete($VIMRPLUGIN_TMPDIR . "/eval_reply")
-            if classfor == ""
-                call g:SendToVimCom(g:rplugin_vimcom_pkg . ':::vim.args("' . rkeyword0 . '", "' . argkey . '")')
-            else
-                call g:SendToVimCom(g:rplugin_vimcom_pkg . ':::vim.args("' . rkeyword0 . '", "' . argkey . '", classfor = ' . classfor . ')')
-            endif
-            if g:rplugin_vimcomport > 0
-                let g:rplugin_lastev = ReadEvalReply()
-                if g:rplugin_lastev != "NOT_EXISTS" && g:rplugin_lastev != "NO_ARGS" && g:rplugin_lastev != "R is busy." && g:rplugin_lastev != "NOANSWER" && g:rplugin_lastev != "INVALID" && g:rplugin_lastev != "" && g:rplugin_lastev != "No reply"
-                    let args = []
-                    if g:rplugin_lastev[0] == "\x04" && len(split(g:rplugin_lastev, "\x04")) == 1
-                        return ''
-                    endif
-                    let tmp0 = split(g:rplugin_lastev, "\x04")
-                    let tmp = split(tmp0[0], "\x09")
-                    if(len(tmp) > 0)
-                        for id in range(len(tmp))
-                            let tmp2 = split(tmp[id], "\x07")
-                            if tmp2[0] == '...'
-                                let tmp3 = tmp2[0]
-                            else
-                                let tmp3 = tmp2[0] . " = "
-                            endif
-                            if len(tmp2) > 1
-                                call add(args,  {'word': tmp3, 'menu': tmp2[1]})
-                            else
-                                call add(args,  {'word': tmp3, 'menu': ' '})
+            if string(g:SendCmdToR) != "function('SendCmdToR_fake')"
+                call delete($VIMRPLUGIN_TMPDIR . "/eval_reply")
+                if has("neovim")
+                    let beginmsg = "I\002" . g:rplugin_vimcom_pkg . ':::vim.args("'
+                else
+                    let beginmsg = g:rplugin_vimcom_pkg . ':::vim.args("'
+                endif
+                if classfor == ""
+                    call g:SendToVimCom(beginmsg . rkeyword0 . '", "' . argkey . '")')
+                else
+                    call g:SendToVimCom(beginmsg . rkeyword0 . '", "' . argkey . '", classfor = ' . classfor . ')')
+                endif
+
+                if g:rplugin_vimcomport > 0
+                    let g:rplugin_lastev = ReadEvalReply()
+                    if g:rplugin_lastev != "NOT_EXISTS" && g:rplugin_lastev != "NO_ARGS" && g:rplugin_lastev != "R is busy." && g:rplugin_lastev != "NOANSWER" && g:rplugin_lastev != "INVALID" && g:rplugin_lastev != "" && g:rplugin_lastev != "No reply"
+                        let args = []
+                        if g:rplugin_lastev[0] == "\x04" && len(split(g:rplugin_lastev, "\x04")) == 1
+                            return ''
+                        endif
+                        let tmp0 = split(g:rplugin_lastev, "\x04")
+                        let tmp = split(tmp0[0], "\x09")
+                        if(len(tmp) > 0)
+                            for id in range(len(tmp))
+                                let tmp2 = split(tmp[id], "\x07")
+                                if tmp2[0] == '...'
+                                    let tmp3 = tmp2[0]
+                                else
+                                    let tmp3 = tmp2[0] . " = "
+                                endif
+                                if len(tmp2) > 1
+                                    call add(args,  {'word': tmp3, 'menu': tmp2[1]})
+                                else
+                                    call add(args,  {'word': tmp3, 'menu': ' '})
+                                endif
+                            endfor
+                            if len(args) > 0 && len(tmp0) > 1
+                                call add(args, {'word': ' ', 'menu': tmp0[1]})
                             endif
-                        endfor
-                        if len(args) > 0 && len(tmp0) > 1
-                            call add(args, {'word': ' ', 'menu': tmp0[1]})
+                            call complete(idx2, args)
                         endif
-                        call complete(idx2, args)
+                        return ''
                     endif
-                    return ''
                 endif
             endif
 
             " If R isn't running, use the prebuilt list of objects
+            let flines = g:rplugin_globalenvlines + g:rplugin_liblist
             for omniL in flines
                 if omniL =~ rkeyword && omniL =~ "\x06function\x06function\x06"
                     let tmp1 = split(omniL, "\x06")
@@ -782,14 +789,16 @@ endfunction
 
 " Start R
 function StartR(whatr)
-    if $VIMEDITOR_SVRNM == ""
-        if v:servername == ""
-            if $DISPLAY != ""
-                let $VIMEDITOR_SVRNM = "NoServerName"
-            endif
-        else
-            let $VIMEDITOR_SVRNM = v:servername
-        endif
+    if has("gui_macvim")
+        let $VIMEDITOR_SVRNM = "MacVim"
+    elseif has("neovim")
+        let $VIMEDITOR_SVRNM = "Neovim_" . g:rplugin_myport
+    elseif !has("clientserver")
+        let $VIMEDITOR_SVRNM = "NoClientServer"
+    elseif v:servername == ""
+        let $VIMEDITOR_SVRNM = "NoServerName"
+    else
+        let $VIMEDITOR_SVRNM = v:servername
     endif
 
     call writefile([], $VIMRPLUGIN_TMPDIR . "/globenv_" . $VIMINSTANCEID)
@@ -847,17 +856,21 @@ function StartR(whatr)
                 call g:SendCmdToR(g:rplugin_last_rcmd)
                 let g:vimrplugin_ca_ck = ca_ck
                 if IsExternalOBRunning()
-                    call VimExprToOB('ResetVimComPort()')
                     if WaitVimComStart()
                         sleep 100m
                         call g:SendCmdToR("\014")
                     endif
-                    call g:SendToVimCom("\007" . g:rplugin_obsname)
+                    call VimExprToOB('ResetVimComPort()')
+                    if !has("neovim")
+                        call g:SendToVimCom("\007" . g:rplugin_obsname)
+                    endif
                     call g:SendToVimCom("\003.GlobalEnv [Restarting R]")
                     call g:SendToVimCom("\004Libraries [Restarting()]")
                     " vimcom automatically update the libraries view, but not
                     " the GlobalEnv one because vimcom_count_objects() returns 0.
-                    call VimExprToOB('UpdateOB("GlobalEnv")')
+                    if !has("neovim")
+                        call VimExprToOB('UpdateOB("GlobalEnv")')
+                    endif
                 endif
                 return
             elseif IsSendCmdToRFake()
@@ -886,7 +899,11 @@ function StartR(whatr)
         call StartR_ExternalTerm(rcmd)
         if g:vimrplugin_restart && bufloaded(b:objbrtitle)
             call WaitVimComStart()
-            call g:SendToVimCom("\007" . v:servername)
+            if has("neovim")
+                call g:SendToVimCom("\007" . g:rplugin_myport)
+            else
+                call g:SendToVimCom("\007" . v:servername)
+            endif
             call g:SendToVimCom("\003.GlobalEnv [Restarting R]")
             call g:SendToVimCom("\004Libraries [Restarting()]")
             if exists("*UpdateOB")
@@ -964,7 +981,11 @@ function IsExternalOBRunning()
 endfunction
 
 function ResetVimComPort()
-    Py VimComPort = 0
+    if has("neovim")
+        call jobwrite(g:rplugin_clt_job, "DiscoverVimComPort\n")
+    else
+        Py VimComPort = 0
+    endif
     let g:rplugin_vimcomport = 0
 endfunction
 
@@ -975,12 +996,13 @@ function StartObjBrowser_Tmux()
         return
     endif
 
+    call g:SendToVimCom("\003GlobalEnv [OB StartObjBrowser_Tmux]")
+    sleep 50m
+    call g:SendToVimCom("\004Libraries [OB StartObjBrowser_Tmux]")
+    sleep 50m
+
     " Don't start the Object Browser if it already exists
     if IsExternalOBRunning()
-        call g:SendToVimCom("\003GlobalEnv [OB StartObjBrowser_Tmux]")
-        sleep 50m
-        call g:SendToVimCom("\004Libraries [OB StartObjBrowser_Tmux]")
-        sleep 50m
         if $DISPLAY == "" && exists("g:rplugin_ob_pane")
             let slog = system("tmux set-buffer ':silent call UpdateOB(\"both\")\:\' && tmux paste-buffer -t " . g:rplugin_ob_pane . " && tmux select-pane -t " . g:rplugin_ob_pane)
             if v:shell_error
@@ -993,10 +1015,14 @@ function StartObjBrowser_Tmux()
     let objbrowserfile = $VIMRPLUGIN_TMPDIR . "/objbrowserInit"
     let tmxs = " "
 
-    if v:servername == ""
-        let myservername = '""'
+    if has("neovim")
+        let myservername = g:rplugin_myport
     else
-        let myservername = '"' . v:servername . '"'
+        if v:servername == ""
+            let myservername = '""'
+        else
+            let myservername = '"' . v:servername . '"'
+        endif
     endif
 
     call writefile([
@@ -1014,12 +1040,10 @@ function StartObjBrowser_Tmux()
                 \ 'set noruler',
                 \ 'let g:SendCmdToR = function("SendCmdToR_TmuxSplit")',
                 \ 'if has("clientserver") && v:servername != ""',
-                \ '   call g:SendToVimCom("\007" . v:servername)',
+                \ '    call g:SendToVimCom("\007" . v:servername)',
                 \ 'endif',
-                \ 'call g:SendToVimCom("\001Update OB [OB init TMUX]")',
-                \ 'sleep 50m',
-                \ 'if v:servername == ""',
-                \ '    sleep 100m',
+                \ 'if !has("neovim")',
+                \ '    sleep 150m',
                 \ '    call UpdateOB("GlobalEnv")',
                 \ 'endif'], objbrowserfile)
 
@@ -1053,7 +1077,12 @@ function StartObjBrowser_Tmux()
         let obsname = " "
     endif
 
-    let cmd = "tmux split-window -h -l " . panewidth . " -t " . obpane . ' "vim ' . obsname . " -c 'source " . substitute(objbrowserfile, ' ', '\\ ', 'g') . "'" . '"'
+    if has("neovim")
+        let vimname = "nvim"
+    else
+        let vimname = "vim"
+    endif
+    let cmd = "tmux split-window -h -l " . panewidth . " -t " . obpane . ' "' . vimname . ' ' . obsname . " -c 'source " . substitute(objbrowserfile, ' ', '\\ ', 'g') . "'" . '"'
     let rlog = system(cmd)
     if v:shell_error
         let rlog = substitute(rlog, '\n', ' ', 'g')
@@ -1078,11 +1107,11 @@ function StartObjBrowser_Tmux()
         endif
     endif
     if g:rplugin_ob_warn_shown == 0
-        if !has("clientserver")
+        if !has("clientserver") && !has("neovim")
             call RWarningMsg("The +clientserver feature is required to automatically update the Object Browser.")
             sleep 200m
         else
-            if $DISPLAY == ""
+            if $DISPLAY == "" && !has("neovim")
                 call RWarningMsg("The X Window system is required to automatically update the Object Browser.")
                 sleep 200m
             endif
@@ -1103,7 +1132,7 @@ function StartObjBrowser_Vim()
     endif
 
     let wmsg = ""
-    if v:servername == ""
+    if v:servername == "" && !has("neovim")
         if g:rplugin_ob_warn_shown == 0
             if !has("clientserver")
                 let wmsg = "The +clientserver feature is required to automatically update the Object Browser."
@@ -1117,7 +1146,11 @@ function StartObjBrowser_Vim()
         endif
         let g:rplugin_ob_warn_shown = 1
     else
-        call g:SendToVimCom("\007" . v:servername)
+        if has("neovim")
+            call g:SendToVimCom("\007" . g:rplugin_myport)
+        else
+            call g:SendToVimCom("\007" . v:servername)
+        endif
     endif
 
     " Either load or reload the Object Browser
@@ -1200,23 +1233,24 @@ endfunction
 function VimExprToOB(msg)
     if !has("neovim") && serverlist() =~ "\\<" . g:rplugin_obsname . "\n"
         return remote_expr(g:rplugin_obsname, a:msg)
+    else
+        if IsExternalOBRunning()
+            let slog = system("tmux set-buffer ':call " . a:msg . "\' && tmux paste-buffer -t " . g:rplugin_ob_pane)
+            if v:shell_error
+                call RWarningMsg(slog)
+            endif
+            return "NoVimServer"
+        endif
+        return "NoOBRunning"
     endif
-    return "Vim server not found"
 endfunction
 
-function RBrowserOpenCloseLists(status)
+function RBrOpenCloseLs_Vim(status)
     if a:status == 1
         if exists("g:rplugin_curview")
             let curview = g:rplugin_curview
         else
-            if IsExternalOBRunning()
-                let curview = VimExprToOB('g:rplugin_curview')
-                if curview == "Vim server not found"
-                    return
-                endif
-            else
-                let curview = "GlobalEnv"
-            endif
+            let curview = "GlobalEnv"
         endif
         if curview == "libraries"
             echohl WarningMsg
@@ -1230,7 +1264,7 @@ function RBrowserOpenCloseLists(status)
 
     " Avoid possibly freezing cross messages between Vim and R
     if exists("g:rplugin_curview") && v:servername != ""
-        call g:SendToVimCom("\x08Stop updating info [RBrowserOpenCloseLists()]")
+        call g:SendToVimCom("\x08Stop updating info [RBrOpenCloseLs()]")
         let stt = a:status
     else
         let stt = a:status + 2
@@ -1259,16 +1293,67 @@ function RBrowserOpenCloseLists(status)
         if v:servername != ""
             call g:SendToVimCom("\007" . v:servername)
         endif
-    elseif IsExternalOBRunning()
-        call VimExprToOB('UpdateOB("GlobalEnv")')
-        call g:SendToVimCom("\007" . g:rplugin_obsname)
+    endif
+endfunction
+
+function RBrOpenCloseLs_TmuxVim(status)
+    if a:status == 1
+        if IsExternalOBRunning() && has("clientserver") && $DISPLAY != "" && serverlist() =~ "\\<" . g:rplugin_obsname . "\n"
+            let curview = remote_expr(g:rplugin_obsname, 'g:rplugin_curview')
+            if curview == "libraries"
+                echohl WarningMsg
+                echon "GlobalEnv command only."
+                sleep 1
+                echohl Normal
+                normal! :
+                return
+            endif
+        endif
+    endif
+
+    call g:SendToVimCom("\006" . a:status)
+
+    if g:rplugin_lastrpl == "R is busy."
+        call RWarningMsg("R is busy.")
+    endif
+endfunction
+
+function RBrOpenCloseLs_TmuxNeovim(status)
+    " TODO: Discover real value of curview
+    let curview = "GlobalEnv"
+
+    if a:status == 1 && curview == "libraries"
+        if curview == "libraries"
+            echohl WarningMsg
+            echon "GlobalEnv command only."
+            sleep 1
+            echohl Normal
+            normal! :
+            return
+        endif
+    endif
+    call g:SendToVimCom("\006" . a:status)
+endfunction
+
+function RBrOpenCloseLs_TmuxOB(status)
+    if a:status == 1 && g:rplugin_curview == "libraries"
+        echohl WarningMsg
+        echon "GlobalEnv command only."
+        sleep 1
+        echohl Normal
+        normal! :
+        return
+    endif
+    call g:SendToVimCom("\006" . a:status)
+    if !has("neovim") && v:servername == ""
+        call UpdateOB("both")
     endif
 endfunction
 
 function RFormatCode() range
     if g:rplugin_vimcomport == 0
         if has("neovim")
-            call jobwrite(g:rplugin_job, "DiscoverVimComPort\n")
+            call jobwrite(g:rplugin_clt_job, "DiscoverVimComPort\n")
         else
             Py DiscoverVimComPort()
         endif
@@ -1294,7 +1379,11 @@ function RFormatCode() range
         let wco = 180
     endif
     call delete($VIMRPLUGIN_TMPDIR . "/eval_reply")
-    call g:SendToVimCom('formatR::tidy.source("' . $VIMRPLUGIN_TMPDIR . '/unformatted_code", file = "' . $VIMRPLUGIN_TMPDIR . '/formatted_code", width.cutoff = ' . wco . ')')
+    if has("neovim")
+        call g:SendToVimCom("I\002" . 'formatR::tidy.source("' . $VIMRPLUGIN_TMPDIR . '/unformatted_code", file = "' . $VIMRPLUGIN_TMPDIR . '/formatted_code", width.cutoff = ' . wco . ')')
+    else
+        call g:SendToVimCom('formatR::tidy.source("' . $VIMRPLUGIN_TMPDIR . '/unformatted_code", file = "' . $VIMRPLUGIN_TMPDIR . '/formatted_code", width.cutoff = ' . wco . ')')
+    endif
     let g:rplugin_lastev = ReadEvalReply()
     if g:rplugin_lastev == "R is busy." || g:rplugin_lastev == "UNKNOWN" || g:rplugin_lastev =~ "^Error" || g:rplugin_lastev == "INVALID" || g:rplugin_lastev == "ERROR" || g:rplugin_lastev == "EMPTY" || g:rplugin_lastev == "No reply"
         call RWarningMsg(g:rplugin_lastev)
@@ -1309,7 +1398,7 @@ endfunction
 function RInsert(cmd)
     if g:rplugin_vimcomport == 0
         if has("neovim")
-            call jobwrite(g:rplugin_job, "DiscoverVimComPort\n")
+            call jobwrite(g:rplugin_clt_job, "DiscoverVimComPort\n")
         else
             Py DiscoverVimComPort()
         endif
@@ -1980,57 +2069,6 @@ function! RKnit()
     call g:SendCmdToR('require(knitr); knit("' . expand("%:t") . '")')
 endfunction
 
-" Tell R to create a list of objects file listing all currently available
-" objects in its environment. The file is necessary for omni completion.
-function BuildROmniList()
-
-    if has("win32") || has("win64") && g:rplugin_vimcom_pkg == "vimcom"
-	if !exists("g:rplugin_vimcom_omni_warn")
-	    let g:rplugin_vimcom_omni_warn = 1
-            if RCheckVimCom("complete the names of objects from R's workspace.")
-                sleep 2
-                return
-            endif
-        else
-            return
-	endif
-    endif
-
-    let omnilistcmd = 'vim.bol("' . $VIMRPLUGIN_TMPDIR . "/GlobalEnvList_" . $VIMINSTANCEID . '"'
-    if g:vimrplugin_allnames == 1
-        let omnilistcmd = omnilistcmd . ', allnames = TRUE'
-    endif
-    let omnilistcmd = omnilistcmd . ')'
-
-    call delete($VIMRPLUGIN_TMPDIR . "/vimbol_finished")
-    call delete($VIMRPLUGIN_TMPDIR . "/eval_reply")
-    call g:SendToVimCom(omnilistcmd)
-    if g:rplugin_vimcomport == 0
-        sleep 500m
-        return
-    endif
-    let g:rplugin_lastev = ReadEvalReply()
-    if g:rplugin_lastev == "R is busy." || g:rplugin_lastev == "No reply"
-        call RWarningMsg(g:rplugin_lastev)
-        sleep 800m
-        return
-    endif
-    sleep 20m
-    let ii = 0
-    while !filereadable($VIMRPLUGIN_TMPDIR . "/vimbol_finished") && ii < 5
-        let ii += 1
-        sleep
-    endwhile
-    echon "\r               "
-    if ii == 5
-        call RWarningMsg("No longer waiting...")
-        return
-    endif
-
-    let g:rplugin_globalenvlines = readfile($VIMRPLUGIN_TMPDIR . "/GlobalEnvList_" . $VIMINSTANCEID)
-    echon
-endfunction
-
 function RRemoveFromLibls(nlib)
     let idx = 0
     for lib in g:rplugin_libls
@@ -2090,7 +2128,7 @@ endfunction
 " This function is called by the R package vimcom.plus whenever a library is
 " loaded.
 function RFillLibList()
-    if &filetype == "r"
+    if &filetype == "r" || has("neovim")
         call RealRFillLibList()
     else
         " Avoid E341 (Internal error: lalloc(0, ))
@@ -2305,14 +2343,21 @@ function ShowRDoc(rkeyword, package, getclass)
 
     call delete($VIMRPLUGIN_TMPDIR . "/eval_reply")
     if classfor == "" && a:package == ""
-        call g:SendToVimCom('vim.help("' . a:rkeyword . '", ' . g:rplugin_htw . 'L)')
+        let rcmd = 'vim.help("' . a:rkeyword . '", ' . g:rplugin_htw . 'L)'
     elseif a:package != ""
-        call g:SendToVimCom('vim.help("' . a:rkeyword . '", ' . g:rplugin_htw . 'L, package="' . a:package  . '")')
+        let rcmd = 'vim.help("' . a:rkeyword . '", ' . g:rplugin_htw . 'L, package="' . a:package  . '")'
     else
         let classfor = substitute(classfor, '\\', "", "g")
         let classfor = substitute(classfor, '"', '\\"', "g")
-        call g:SendToVimCom('vim.help("' . a:rkeyword . '", ' . g:rplugin_htw . 'L, ' . classfor . ')')
+        let rcmd = 'vim.help("' . a:rkeyword . '", ' . g:rplugin_htw . 'L, ' . classfor . ')'
     endif
+
+    if has("neovim")
+        call g:SendToVimCom("I\002" . rcmd)
+    else
+        call g:SendToVimCom(rcmd)
+    endif
+
     let g:rplugin_lastev = ReadEvalReply()
     if g:rplugin_lastev != "VIMHELP"
         if g:rplugin_lastev =~ "^MULTILIB"
@@ -2391,6 +2436,7 @@ function ShowRDoc(rkeyword, package, getclass)
     redraw
 endfunction
 
+
 function RLisObjs(arglead, cmdline, curpos)
     let lob = []
     let rkeyword = '^' . a:arglead
@@ -2462,7 +2508,7 @@ function RAction(rcmd)
                         if g:rplugin_vim_pane == "none"
                             call RWarningMsg("Cmd not available.")
                         else
-                            if g:rplugin_editor_sname == ""
+                            if g:rplugin_editor_sname == "" || has("neovim")
                                 let slog = system("tmux set-buffer '" . "\\" . ':call ShowRDoc("' . rkeyword . '", "' . pkg . '", 0)' . "\' && tmux paste-buffer -t " . g:rplugin_vim_pane . " && tmux select-pane -t " . g:rplugin_vim_pane)
                                 if v:shell_error
                                     call RWarningMsg(slog)
@@ -2614,8 +2660,8 @@ endfunction
 
 function RBrowserMenu()
     call RCreateMenuItem("nvi", 'Object\ browser.Show/Update', 'RUpdateObjBrowser', 'ro', ':call RObjBrowser()')
-    call RCreateMenuItem("nvi", 'Object\ browser.Expand\ (all\ lists)', 'ROpenLists', 'r=', ':call RBrowserOpenCloseLists(1)')
-    call RCreateMenuItem("nvi", 'Object\ browser.Collapse\ (all\ lists)', 'RCloseLists', 'r-', ':call RBrowserOpenCloseLists(0)')
+    call RCreateMenuItem("nvi", 'Object\ browser.Expand\ (all\ lists)', 'ROpenLists', 'r=', ':call g:RBrOpenCloseLs(1)')
+    call RCreateMenuItem("nvi", 'Object\ browser.Collapse\ (all\ lists)', 'RCloseLists', 'r-', ':call g:RBrOpenCloseLs(0)')
     if &filetype == "rbrowser"
         imenu  R.Object\ browser.Toggle\ (cur)Enter :call RBrowserDoubleClick()
         nmenu  R.Object\ browser.Toggle\ (cur)Enter :call RBrowserDoubleClick()
@@ -2673,8 +2719,8 @@ function RControlMaps()
     " Build list of objects for omni completion
     "-------------------------------------
     call RCreateMaps("nvi", 'RUpdateObjBrowser', 'ro', ':call RObjBrowser()')
-    call RCreateMaps("nvi", 'ROpenLists',        'r=', ':call RBrowserOpenCloseLists(1)')
-    call RCreateMaps("nvi", 'RCloseLists',       'r-', ':call RBrowserOpenCloseLists(0)')
+    call RCreateMaps("nvi", 'ROpenLists',        'r=', ':call g:RBrOpenCloseLs(1)')
+    call RCreateMaps("nvi", 'RCloseLists',       'r-', ':call g:RBrOpenCloseLs(0)')
 endfunction
 
 
@@ -3259,13 +3305,6 @@ if has("win32") || has("win64")
 endif
 
 let $VIMRPLUGIN_HOME = substitute(g:rplugin_home, ' ', '\\ ', "g")
-if has("gui_macvim")
-    let $VIMEDITOR_SVRNM = "MacVim"
-elseif has("neovim")
-    let $VIMEDITOR_SVRNM = "Neovim"
-elseif !has("clientserver")
-    let $VIMEDITOR_SVRNM = "NoClientServer"
-endif
 
 if has("win32") || has("win64")
     if isdirectory($TMP)
@@ -3360,16 +3399,45 @@ endfor
 unlet objbrplace
 unlet obpllen
 
-function RJobEvent()
+function RSetMyPort(p)
+    let g:rplugin_myport = a:p
+    if &filetype == "rbrowser"
+        call g:SendToVimCom("\007" . a:p)
+        call g:SendToVimCom("\001Update OB [RSetMyPort]")
+    endif
+endfunction
+
+function SendObjPortToVimCom(p)
+    call g:SendToVimCom("\007" . a:p)
+endfunction
+
+function RClientEvent()
     if v:job_data[1] == 'stdout'
         let cmd = substitute(v:job_data[2], "\n$", "", "")
         exe cmd
-        let g:last_job_output = cmd
+        let g:last_clt_output = cmd
     elseif v:job_data[1] == 'stderr'
-        let str = 'neovim.py error: ' . v:job_data[2]
+        let str = 'nvimcom.py error: ' . v:job_data[2]
         call RWarningMsg(str)
     else
-        let g:rplugin_job = 0
+        let g:rplugin_clt_job = 0
+    endif
+endfunction
+
+function RServerEvent()
+    if v:job_data[1] == 'stdout'
+        let cmd = substitute(v:job_data[2], "\n$", "", "")
+        let g:last_svr_output = cmd
+        if cmd =~ "^call " || cmd  =~ "^let "
+            exe cmd
+        elseif len(cmd) > 0
+            exe "call " . cmd
+        endif
+    elseif v:job_data[1] == 'stderr'
+        let str = 'nvimserver.py error: ' . v:job_data[2]
+        call RWarningMsg(str)
+    else
+        let g:rplugin_svr_job = 0
     endif
 endfunction
 
@@ -3379,7 +3447,7 @@ endfunction
 
 function SendToVimCom_Neovim(cmd)
     let g:nvimcom_py_Input = a:cmd
-    call jobwrite(g:rplugin_job, "SendToVimCom " . a:cmd . "\n")
+    call jobwrite(g:rplugin_clt_job, "SendToVimCom " . a:cmd . "\n")
 endfunction
 
 let g:SendToVimCom = function("SendToVimCom_Vim")
@@ -3392,6 +3460,7 @@ elseif has("python")
     command! -nargs=+ Py :py 
     command! -nargs=+ PyFile :pyfile 
 elseif has("neovim")
+    command! -nargs=+ Py :call RWarningMsg("Py command not implemented yet: '" .  . "'")
     let g:SendToVimCom = function("SendToVimCom_Neovim")
 else
     command! -nargs=+ Py :
@@ -3448,6 +3517,23 @@ else
 endif
 
 
+" ========================================================================
+" Set function open/close lists in Object Browser
+
+if g:rplugin_tmuxwasfirst
+    if &filetype == "rbrowser"
+        let g:RBrOpenCloseLs = function("RBrOpenCloseLs_TmuxOB")
+    else
+        if has("neovim")
+            let g:RBrOpenCloseLs = function("RBrOpenCloseLs_TmuxNeovim")
+        else
+            let g:RBrOpenCloseLs = function("RBrOpenCloseLs_TmuxVim")
+        endif
+    endif
+else
+    let g:RBrOpenCloseLs = function("RBrOpenCloseLs_Vim")
+endif
+
 " ========================================================================
 
 if g:vimrplugin_external_ob == 1
@@ -3714,6 +3800,7 @@ let g:rplugin_firstbuffer = expand("%:p")
 let g:rplugin_running_objbr = 0
 let g:rplugin_newliblist = 0
 let g:rplugin_ob_warn_shown = 0
+let g:rplugin_myport = 0
 let g:rplugin_vimcomport = 0
 let g:rplugin_vimcom_pkg = "vimcom"
 let g:rplugin_vimcom_version = 0
@@ -3740,8 +3827,13 @@ endif
 
 if has("neovim")
     if executable("python")
-        let g:rplugin_job = jobstart('vimcom', 'python', [g:rplugin_home . '/r-plugin/nvimcom.py'])
-        autocmd JobActivity vimcom call RJobEvent()
+        if &filetype == "rbrowser"
+            let $THIS_IS_ObjBrowser = "yes"
+        endif
+        let g:rplugin_clt_job = jobstart('vimcom', 'python', [g:rplugin_home . '/r-plugin/nvimcom.py'])
+        let g:rplugin_svr_job = jobstart('udpsvr', 'python', [g:rplugin_home . '/r-plugin/nvimserver.py'])
+        autocmd JobActivity vimcom call RClientEvent()
+        autocmd JobActivity udpsvr call RServerEvent()
     else
         call RWarningMsgInp("Python executable not found.")
     endif
diff --git a/r-plugin/nvimcom.py b/r-plugin/nvimcom.py
index b114d1f..6b3b0f6 100644
--- a/r-plugin/nvimcom.py
+++ b/r-plugin/nvimcom.py
@@ -104,7 +104,8 @@ def SendToVimCom(aString):
     if line.find("SendToVimCom") != -1:
         line = line.replace("SendToVimCom ", "")
         rpl = SendToVimCom(line)
-        print "let g:rplugin_lastrpl = '" + rpl + "'\n"
+        if not line.find("I\002") == 0:
+            print "let g:rplugin_lastrpl = '" + rpl + "'\n"
     else:
         if line.find("DiscoverVimComPort") != -1:
             DiscoverVimComPort()
diff --git a/r-plugin/nvimserver.py b/r-plugin/nvimserver.py
new file mode 100644
index 0000000..9b1c5ea
--- /dev/null
+++ b/r-plugin/nvimserver.py
@@ -0,0 +1,67 @@
+import sys
+import socket
+import re
+import os
+
+def NeovimServer():
+    sock = None
+    FinishNow = False
+    UDP_IP = "127.0.0.1"
+    MyPort = 1899
+
+    while True and MyPort < 1999:
+        try:
+            MyPort += 1
+            sock = socket.socket( socket.AF_INET, socket.SOCK_DGRAM )
+            sock.bind( (UDP_IP,MyPort) )
+        except:
+            continue
+        else:
+            break
+
+    if sock == None:
+        MyPort = 0
+        print "RWarningMsg('Could not bind to any port.')\n"
+        sys.stdout.flush()
+        return
+    else:
+        print "RSetMyPort(" + str(MyPort) + ")\n"
+        sys.stdout.flush()
+
+    while FinishNow == False:
+        try:
+            data, addr = sock.recvfrom( 1024 ) # buffer size is 1024 bytes
+            if re.match("EXPR ", data):
+                print re.sub("^EXPR ", "", data) + "\n"
+                sys.stdout.flush()
+            else:
+                if data != "":
+                    print "RWarningMsg('Strange string received: " + '"' + data + '"' + "')\n"
+                    sys.stdout.flush()
+
+        except Exception as errmsg:
+            print "RWarningMsg('Server failed to read data: " + str(errmsg) + "')\n"
+            sys.stdout.flush()
+            MyPort = 0
+            try:
+                sock.shutdown(socket.SHUT_RD)
+            except:
+                pass
+            sock.close()
+            return
+        try:
+            sock.shutdown(socket.SHUT_RD)
+        except:
+            pass
+        sock.close()
+        if FinishNow == False:
+            try:
+                sock = socket.socket( socket.AF_INET, socket.SOCK_DGRAM )
+                sock.bind( (UDP_IP,MyPort) )
+            except Exception as errmsg:
+                print "let g:rplugin_myport = 0 | call RWarningMsg('" + str(errmsg) + "')\n"
+                sys.stdout.flush()
+                pass
+
+NeovimServer()
+

From 4090c4aecb2c6b3cc92293cbd03e7b9443b1df0e Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Wed, 11 Jun 2014 21:49:09 -0300
Subject: [PATCH 0698/1050] Switch the binary codes that identify actions.
 Reduce the number of binary codes sent to vimcom.plus and reorganize them.

---
 ftplugin/rbrowser.vim      |  8 +++---
 r-plugin/common_global.vim | 50 +++++++++++++++++++-------------------
 r-plugin/nvimcom.py        |  4 +--
 r-plugin/vimcom.py         |  4 +--
 r-plugin/windows.py        |  4 +--
 5 files changed, 35 insertions(+), 35 deletions(-)

diff --git a/ftplugin/rbrowser.vim b/ftplugin/rbrowser.vim
index 564f4b3..be7fb89 100644
--- a/ftplugin/rbrowser.vim
+++ b/ftplugin/rbrowser.vim
@@ -1,7 +1,7 @@
 " Vim filetype plugin file
 " Language: R Browser (generated by the Vim-R-plugin)
 " Maintainer: Jakson Alves de Aquino 
-" Last Change:	Mon Jun 09, 2014  11:02PM
+" Last Change:	Wed Jun 11, 2014  09:34PM
 
 
 " Only do this when not yet done for this buffer
@@ -121,7 +121,7 @@ function! RBrowserDoubleClick()
     " Toggle state of list or data.frame: open X closed
     let key = RBrowserGetName(0, 1)
     if g:rplugin_curview == "GlobalEnv"
-        call g:SendToVimCom("\005" . key)
+        call g:SendToVimCom("\006" . key)
         if g:rplugin_lastrpl == "R is busy."
             call RWarningMsg("R is busy.")
         endif
@@ -130,7 +130,7 @@ function! RBrowserDoubleClick()
         if key !~ "^package:"
             let key = "package:" . RBGetPkgName() . '-' . key
         endif
-        call g:SendToVimCom("\005" . key)
+        call g:SendToVimCom("\006" . key)
         if g:rplugin_lastrpl == "R is busy."
             call RWarningMsg("R is busy.")
         endif
@@ -344,7 +344,7 @@ endif
 au BufEnter  stopinsert
 
 if $TMUX_PANE == ""
-    au BufUnload  call g:SendToVimCom("\x08Stop updating info [OB BufUnload].")
+    au BufUnload  call g:SendToVimCom("\004Stop updating info [OB BufUnload].")
 else
     au BufUnload  call ObBrBufUnload()
     " Fix problems caused by some plugins
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index fd8698f..2b8f6eb 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -644,7 +644,7 @@ function StartR_TmuxSplit(rcmd)
     endif
     let g:rplugin_last_rcmd = a:rcmd
     if WaitVimComStart()
-        call g:SendToVimCom("\001Update OB [StartR]")
+        call g:SendToVimCom("\005B Update OB [StartR]")
     endif
 endfunction
 
@@ -723,7 +723,7 @@ function StartR_ExternalTerm(rcmd)
     endif
     let g:SendCmdToR = function('SendCmdToR_Term')
     if WaitVimComStart()
-        call g:SendToVimCom("\001Update OB [StartR]")
+        call g:SendToVimCom("\005B Update OB [StartR]")
     endif
 endfunction
 
@@ -771,7 +771,7 @@ function StartR_OSX()
     endif
     let g:SendCmdToR = function('SendCmdToR_OSX')
     if WaitVimComStart()
-        call g:SendToVimCom("\001Update OB [StartR]")
+        call g:SendToVimCom("\005B Update OB [StartR]")
     endif
 endfunction
 
@@ -862,10 +862,10 @@ function StartR(whatr)
                     endif
                     call VimExprToOB('ResetVimComPort()')
                     if !has("neovim")
-                        call g:SendToVimCom("\007" . g:rplugin_obsname)
+                        call g:SendToVimCom("\002" . g:rplugin_obsname)
                     endif
-                    call g:SendToVimCom("\003.GlobalEnv [Restarting R]")
-                    call g:SendToVimCom("\004Libraries [Restarting()]")
+                    call g:SendToVimCom("\005G .GlobalEnv [Restarting R]")
+                    call g:SendToVimCom("\005L Libraries [Restarting()]")
                     " vimcom automatically update the libraries view, but not
                     " the GlobalEnv one because vimcom_count_objects() returns 0.
                     if !has("neovim")
@@ -900,12 +900,12 @@ function StartR(whatr)
         if g:vimrplugin_restart && bufloaded(b:objbrtitle)
             call WaitVimComStart()
             if has("neovim")
-                call g:SendToVimCom("\007" . g:rplugin_myport)
+                call g:SendToVimCom("\002" . g:rplugin_myport)
             else
-                call g:SendToVimCom("\007" . v:servername)
+                call g:SendToVimCom("\002" . v:servername)
             endif
-            call g:SendToVimCom("\003.GlobalEnv [Restarting R]")
-            call g:SendToVimCom("\004Libraries [Restarting()]")
+            call g:SendToVimCom("\005G .GlobalEnv [Restarting R]")
+            call g:SendToVimCom("\005L Libraries [Restarting()]")
             if exists("*UpdateOB")
                 call UpdateOB("GlobalEnv")
             endif
@@ -996,9 +996,9 @@ function StartObjBrowser_Tmux()
         return
     endif
 
-    call g:SendToVimCom("\003GlobalEnv [OB StartObjBrowser_Tmux]")
+    call g:SendToVimCom("\005G GlobalEnv [OB StartObjBrowser_Tmux]")
     sleep 50m
-    call g:SendToVimCom("\004Libraries [OB StartObjBrowser_Tmux]")
+    call g:SendToVimCom("\005L Libraries [OB StartObjBrowser_Tmux]")
     sleep 50m
 
     " Don't start the Object Browser if it already exists
@@ -1040,7 +1040,7 @@ function StartObjBrowser_Tmux()
                 \ 'set noruler',
                 \ 'let g:SendCmdToR = function("SendCmdToR_TmuxSplit")',
                 \ 'if has("clientserver") && v:servername != ""',
-                \ '    call g:SendToVimCom("\007" . v:servername)',
+                \ '    call g:SendToVimCom("\002" . v:servername)',
                 \ 'endif',
                 \ 'if !has("neovim")',
                 \ '    sleep 150m',
@@ -1147,9 +1147,9 @@ function StartObjBrowser_Vim()
         let g:rplugin_ob_warn_shown = 1
     else
         if has("neovim")
-            call g:SendToVimCom("\007" . g:rplugin_myport)
+            call g:SendToVimCom("\002" . g:rplugin_myport)
         else
-            call g:SendToVimCom("\007" . v:servername)
+            call g:SendToVimCom("\002" . v:servername)
         endif
     endif
 
@@ -1183,7 +1183,7 @@ function StartObjBrowser_Vim()
         unlet g:tmp_objbrtitle
         unlet g:tmp_tmuxsname
         unlet g:tmp_curbufname
-        call g:SendToVimCom("\001Update OB [OB init GVIM]")
+        call g:SendToVimCom("\005B Update OB [OB init GVIM]")
         sleep 50m
         call UpdateOB("GlobalEnv")
     endif
@@ -1264,7 +1264,7 @@ function RBrOpenCloseLs_Vim(status)
 
     " Avoid possibly freezing cross messages between Vim and R
     if exists("g:rplugin_curview") && v:servername != ""
-        call g:SendToVimCom("\x08Stop updating info [RBrOpenCloseLs()]")
+        call g:SendToVimCom("\005Stop updating info [RBrOpenCloseLs()]")
         let stt = a:status
     else
         let stt = a:status + 2
@@ -1278,7 +1278,7 @@ function RBrOpenCloseLs_Vim(status)
         let switchedbuf = 1
     endif
 
-    call g:SendToVimCom("\006" . stt)
+    call g:SendToVimCom("\007" . stt)
 
     if g:rplugin_lastrpl == "R is busy."
         call RWarningMsg("R is busy.")
@@ -1291,7 +1291,7 @@ function RBrOpenCloseLs_Vim(status)
     if exists("g:rplugin_curview")
         call UpdateOB("both")
         if v:servername != ""
-            call g:SendToVimCom("\007" . v:servername)
+            call g:SendToVimCom("\002" . v:servername)
         endif
     endif
 endfunction
@@ -1311,7 +1311,7 @@ function RBrOpenCloseLs_TmuxVim(status)
         endif
     endif
 
-    call g:SendToVimCom("\006" . a:status)
+    call g:SendToVimCom("\007" . a:status)
 
     if g:rplugin_lastrpl == "R is busy."
         call RWarningMsg("R is busy.")
@@ -1332,7 +1332,7 @@ function RBrOpenCloseLs_TmuxNeovim(status)
             return
         endif
     endif
-    call g:SendToVimCom("\006" . a:status)
+    call g:SendToVimCom("\007" . a:status)
 endfunction
 
 function RBrOpenCloseLs_TmuxOB(status)
@@ -1344,7 +1344,7 @@ function RBrOpenCloseLs_TmuxOB(status)
         normal! :
         return
     endif
-    call g:SendToVimCom("\006" . a:status)
+    call g:SendToVimCom("\007" . a:status)
     if !has("neovim") && v:servername == ""
         call UpdateOB("both")
     endif
@@ -3402,13 +3402,13 @@ unlet obpllen
 function RSetMyPort(p)
     let g:rplugin_myport = a:p
     if &filetype == "rbrowser"
-        call g:SendToVimCom("\007" . a:p)
-        call g:SendToVimCom("\001Update OB [RSetMyPort]")
+        call g:SendToVimCom("\002" . a:p)
+        call g:SendToVimCom("\005B Update OB [RSetMyPort]")
     endif
 endfunction
 
 function SendObjPortToVimCom(p)
-    call g:SendToVimCom("\007" . a:p)
+    call g:SendToVimCom("\002" . a:p)
 endfunction
 
 function RClientEvent()
diff --git a/r-plugin/nvimcom.py b/r-plugin/nvimcom.py
index 6b3b0f6..8df1bc4 100644
--- a/r-plugin/nvimcom.py
+++ b/r-plugin/nvimcom.py
@@ -32,10 +32,10 @@ def DiscoverVimComPort():
                 sock.settimeout(0.1)
                 sock.connect(sa)
                 if sys.hexversion < 0x03000000:
-                    sock.send("\002What port [Python 2]?")
+                    sock.send("\001What port [Python 2]?")
                     repl = sock.recv(1024)
                 else:
-                    sock.send("\002What port [Python 3]?".encode())
+                    sock.send("\001What port [Python 3]?".encode())
                     repl = sock.recv(1024).decode()
                 sock.close()
                 if repl.find(correct_repl):
diff --git a/r-plugin/vimcom.py b/r-plugin/vimcom.py
index 7c395ed..cf67e46 100644
--- a/r-plugin/vimcom.py
+++ b/r-plugin/vimcom.py
@@ -30,10 +30,10 @@ def DiscoverVimComPort():
                 sock.settimeout(0.1)
                 sock.connect(sa)
                 if sys.hexversion < 0x03000000:
-                    sock.send("\002What port [Python 2]?")
+                    sock.send("\001What port [Python 2]?")
                     repl = sock.recv(1024)
                 else:
-                    sock.send("\002What port [Python 3]?".encode())
+                    sock.send("\001What port [Python 3]?".encode())
                     repl = sock.recv(1024).decode()
                 sock.close()
                 if repl.find(correct_repl):
diff --git a/r-plugin/windows.py b/r-plugin/windows.py
index c0ef9b8..6b99015 100644
--- a/r-plugin/windows.py
+++ b/r-plugin/windows.py
@@ -70,7 +70,7 @@ def FindRConsole():
 def SendToRConsole(aString):
     global RConsole
     global Rterm
-    SendToVimCom("\x09Set R as busy [SendToRConsole()]")
+    SendToVimCom("\003Set R as busy [SendToRConsole()]")
     if sys.hexversion < 0x03000000:
         finalString = aString.decode("latin-1") + "\n"
     else:
@@ -121,7 +121,7 @@ def RaiseRConsole():
 def SendQuitMsg(aString):
     global RConsole
     global Rterm
-    SendToVimCom("\x09Set R as busy [SendQuitMsg()]")
+    SendToVimCom("\003Set R as busy [SendQuitMsg()]")
     if sys.hexversion < 0x03000000:
         finalString = aString.decode("latin-1") + "\n"
     else:

From 0107f514b42c4686bda70c6647aa94352f238a25 Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Thu, 12 Jun 2014 11:38:25 -0300
Subject: [PATCH 0699/1050] Require vimcom.plus version _a1 (alpha 1). To make
 it easier for people using the development version of Vim-R-plugin to know
 when it's necessary to update vimcom.plus, I'm appending an alpha number to
 vimcom.plus version, so, the plugin will warn when there is a version
 mismatch.

---
 r-plugin/common_global.vim | 8 ++------
 r-plugin/nvimcom.py        | 8 ++------
 r-plugin/vimcom.py         | 6 ++----
 3 files changed, 6 insertions(+), 16 deletions(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 2b8f6eb..066d688 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -948,12 +948,8 @@ function WaitVimComStart()
         endif
         if vr[2] == $VIMINSTANCEID
             let g:rplugin_vimcom_version = vr[1]
-            if g:rplugin_vimcom_version != "1.0-0"
-                if g:rplugin_vimcom_pkg == "vimcom.plus"
-                    call RWarningMsg('This version of Vim-R-plugin requires vimcom.plus 1.0-0.')
-                else
-                    call RWarningMsg('This version of Vim-R-plugin requires vimcom.plus (or vimcom) 1.0-0.')
-                endif
+            if g:rplugin_vimcom_version != "1.0-0_a1"
+                call RWarningMsg('This version of Vim-R-plugin requires vimcom.plus 1.0-0_a1.')
                 sleep 1
             endif
         else
diff --git a/r-plugin/nvimcom.py b/r-plugin/nvimcom.py
index 8df1bc4..51fab52 100644
--- a/r-plugin/nvimcom.py
+++ b/r-plugin/nvimcom.py
@@ -7,13 +7,11 @@
 VimComPort = 0
 PortWarn = False
 VimComFamily = None
-VimComPkg = "vimcom"
 
 def DiscoverVimComPort():
     global PortWarn
     global VimComPort
     global VimComFamily
-    global VimComPkg
     HOST = "localhost"
     VimComPort = 9998
     repl = "NOTHING"
@@ -40,8 +38,6 @@ def DiscoverVimComPort():
                 sock.close()
                 if repl.find(correct_repl):
                     VimComFamily = af
-                    if repl.find(" vimcom.plus ") > -1:
-                        VimComPkg = "vimcom.plus"
                     break
             except:
                 sock = None
@@ -60,8 +56,8 @@ def DiscoverVimComPort():
         print "let g:rplugin_vimcomport = " + str(VimComPort) + "\n"
         sys.stdout.flush()
         PortWarn = False
-        if repl.find("1.0-0") != 0:
-            print "call RWarningMsg('This version of Vim-R-plugin requires vimcom.plus (or vimcom) 1.0-0.')\n"
+        if repl.find("1.0-0_a1") != 0:
+            print "call RWarningMsg('This version of Vim-R-plugin requires vimcom.plus 1.0-0_a1.')\n"
             sys.stdout.flush()
         return
 
diff --git a/r-plugin/vimcom.py b/r-plugin/vimcom.py
index cf67e46..3eaab11 100644
--- a/r-plugin/vimcom.py
+++ b/r-plugin/vimcom.py
@@ -38,8 +38,6 @@ def DiscoverVimComPort():
                 sock.close()
                 if repl.find(correct_repl):
                     VimComFamily = af
-                    if repl.find(" vimcom.plus ") > -1:
-                        vim.command("let g:rplugin_vimcom_pkg = 'vimcom.plus'")
                     break
             except:
                 sock = None
@@ -54,8 +52,8 @@ def DiscoverVimComPort():
     else:
         vim.command("let g:rplugin_vimcomport = " + str(VimComPort))
         PortWarn = False
-        if repl.find("1.0-0") != 0:
-            vim.command("call RWarningMsg('This version of Vim-R-plugin requires vimcom.plus (or vimcom) 1.0-0.')")
+        if repl.find("1.0-0_a1") != 0:
+            vim.command("call RWarningMsg('This version of Vim-R-plugin requires vimcom.plus 1.0-0_a1.')")
             vim.command("sleep 1")
     return(VimComPort)
 

From c31562d6fe19a87546ee049a1eae50e3ab6e43af Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Thu, 12 Jun 2014 14:34:24 -0300
Subject: [PATCH 0700/1050] Doc update: Neovim does not require --servername.

---
 doc/r-plugin.txt | 34 +++++++++++++++++++++++++++++++++-
 1 file changed, 33 insertions(+), 1 deletion(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index f4b492d..f8c5416 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -115,6 +115,11 @@ Before installing the plugin, you should install its dependencies:
    Vim >= 7.4: http://www.vim.org/download.php
                In addition to the most commonly used features, the plugin
                requires: |+python| or |+python3|, |+clientserver| and |+conceal|. 
+
+	       Note: If you use Neovim, |+python|, |+python3| and
+	       |+clientserver| features are not required, but the python
+	       executable must be in your PATH.
+
 	       Note: If you use Mac OS X, read about the bugs that affect it:
 	       |r-plugin-nox|.
 
@@ -735,6 +740,8 @@ other for Tmux. Then, it's useful (but not required) to know some Tmux
 commands. After you finished editing the file, you have to type `exit` to quit
 the Tmux session.
 
+Note: Neovim does not require the --servername VIM argument.
+
 
 4.8.1 tvim~
 							       *r-plugin-tvim*
@@ -838,6 +845,9 @@ support in Tmux. You will be able to toggle mouse support on and off by typing
 
 4.8.2 Remote access~
 							     *r-plugin-remote*
+Note: Neovim does not require the --servername VIM argument. Thus, you also do
+not need to enable the X11 Forwarding for omnicompletion, etc.
+
 If you need to access Vim in a remote Unix machine through ssh, and if you
 want to get omnicompletion, syntax highlight of function names and the Object
 Browser working properly, then you have to:
@@ -965,6 +975,8 @@ work as expected again after any valid code is executed in the R Console.
 
 5.7. Bugs that affect Mac OS X, Linux Console and ...~
 								*r-plugin-nox*
+Note: The bug described in this section does not affect Neovim.
+
 If you use MacVim, run Vim in the Linux Console or start Vim in a terminal
 emulator without the command line argument |--servername|, Vim will not
 receive remote messages and the vimcom.plus package will display one of the
@@ -2313,7 +2325,7 @@ please read this document from the beginning.
    endif
 <
 							 *r-plugin-bash-setup*
-   ~/.bashrc:~
+   ~/.bashrc for Vim:~
 >
    # Change the TERM environment variable (to get 256 colors) and make Vim
    # connecting to X Server even if running in a terminal emulator (to get
@@ -2343,6 +2355,26 @@ please read this document from the beginning.
    fi
 <
 
+   ~/.bashrc for Neovim:~
+>
+   # Change the TERM environment variable (to get 256 colors):
+   if [ "x$DISPLAY" != "x" ]
+   then
+       if [ "screen" = "$TERM" ]
+       then
+           export TERM=screen-256color
+       else
+           export TERM=xterm-256color
+       fi
+   fi
+   if [ "x$TERM" == "xxterm" ] || [ "x$TERM" == "xxterm-256color" ]
+   then
+       function tvim(){ tmux -2 new-session "TERM=screen-256color nvim $@" ; }
+   else
+       function tvim(){ tmux new-session "nvim $@" ; }
+   fi
+<
+
 							 *r-plugin-tmux-setup*
    ~/.tmux.conf:~
 >

From 194169283eaf968305ef3633aa68707fcb1a11d9 Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Thu, 12 Jun 2014 17:45:36 -0300
Subject: [PATCH 0701/1050] Different options in bash and Rprofile for Neovim.

---
 r-plugin/vimrconfig.vim | 117 ++++++++++++++++++++++++----------------
 1 file changed, 70 insertions(+), 47 deletions(-)

diff --git a/r-plugin/vimrconfig.vim b/r-plugin/vimrconfig.vim
index 88d71bf..7d4d7fc 100644
--- a/r-plugin/vimrconfig.vim
+++ b/r-plugin/vimrconfig.vim
@@ -1,4 +1,3 @@
-
 function! RFindString(lll, sss)
     for line in a:lll
         if line =~ a:sss
@@ -87,7 +86,7 @@ function! RConfigRprofile()
                 let rpflines += ['    if(nchar(Sys.getenv("DISPLAY")) > 1)',
                             \ "        options(editor = '" . 'gvim -f -c "set ft=r"' . "')",
                             \ '    else',
-                            \ "        options(editor = '" . 'vim -c "set ft=r"' . "')",
+                            \ "        options(editor = '" . s:vimprog . ' -c "set ft=r"' . "')",
                             \ '    # See ?setOutputColors256 to know how to customize R output colors']
                 if len(resp) > 1 && resp[1] == "HasColorout"
                     let rpflines += ['    library(colorout)']
@@ -118,7 +117,7 @@ function! RConfigRprofile()
                     let rpflines += ['    # See R documentation on Vim buffer even if asking for help in R Console:']
                     if ($PATH =~ "\\~/bin" || $PATH =~ expand("~/bin")) && filewritable(expand("~/bin")) == 2 && !filereadable(expand("~/bin/vimrpager"))
                         call writefile(['#!/bin/sh',
-                                    \ 'cat | vim -c "set ft=rdoc" -'], expand("~/bin/vimrpager"))
+                                    \ 'cat | ' . s:vimprog . ' -c "set ft=rdoc" -'], expand("~/bin/vimrpager"))
                         call system("chmod +x " . expand("~/bin/vimrpager"))
                         let rpflines += ['    options(help_type = "text", pager = "' . expand("~/bin/vimrpager") . '")']
                     endif
@@ -196,20 +195,19 @@ endfunction
 " Configure vimrc
 function! RConfigVimrc()
     if has("win32") || has("win64")
-        if filereadable($HOME . "/_vimrc")
-            let uvimrc = $HOME . "/_vimrc"
-        elseif filereadable($HOME . "/vimfiles/vimrc")
+        let uvimrc = $HOME . "/_vimrc"
+        if !filereadable(uvimrc) && filereadable($HOME . "/vimfiles/vimrc")
             let uvimrc = $HOME . "/vimfiles/vimrc"
-        else
-            let uvimrc = $HOME . "/_vimrc"
+        endif
+    elseif has("neovim")
+        let uvimrc = $HOME . "/.nvimrc"
+        if !filereadable(uvimrc) && filereadable($HOME . "/.nvim/nvimrc")
+            let uvimrc = $HOME . "/.nvim/nvimrc"
         endif
     else
-        if filereadable($HOME . "/.vimrc")
-            let uvimrc = $HOME . "/.vimrc"
-        elseif filereadable($HOME . "/.vim/vimrc")
+        let uvimrc = $HOME . "/.vimrc"
+        if !filereadable(uvimrc) && filereadable($HOME . "/.vim/vimrc")
             let uvimrc = $HOME . "/.vim/vimrc"
-        else
-            let uvimrc = $HOME . "/.vimrc"
         endif
     endif
 
@@ -248,9 +246,6 @@ function! RConfigVimrc()
         let vlines += ['" Lines added by the Vim-R-plugin command :RpluginConfig:']
     endif
 
-    if RFindString(vlines, 'set\s*nocompatible') == 0 && RFindString(vlines, 'set\s*nocp') == 0
-        let vlines += ['set nocompatible']
-    endif
     if RFindString(vlines, 'syntax\s*on') == 0 && RFindString(vlines, 'syntax\s*enable') == 0
         let vlines += ['syntax enable']
     endif
@@ -423,8 +418,10 @@ function! RConfigBash()
             echo "but we have to configure the TERM environment variable for that."
             echo "Instead of starting Tmux and then starting Vim, we can configure"
             echo "Bash to start both at once with the 'tvim' command."
-            echo "The serverclient feature must be enabled for automatic update of the"
-            echo "Object Browser and syntax highlight of function names."
+            if !has("neovim")
+                echo "The 'clientserver' feature must be enabled for automatic update of"
+                echo "the Object Browser and syntax highlight of function names."
+            endif
             echohl Question
             let what = input("Do you want that all these features are added to your .bashrc? [y/N]: ")
             echohl Normal
@@ -435,35 +432,55 @@ function! RConfigBash()
                 else
                     let blines += ['# Lines added by the Vim-R-plugin command :RpluginConfig:']
                 endif
-                let blines += ['# Change the TERM environment variable (to get 256 colors) and make Vim',
-                            \ '# connecting to X Server even if running in a terminal emulator (to get',
-                            \ '# dynamic update of syntax highlight and Object Browser):',
-                            \ 'if [ "$TERM" = "xterm" ] || [ "$TERM" = "xterm-256color" ]',
-                            \ 'then',
-                            \ '    export TERM=xterm-256color',
-                            \ '    export HAS_256_COLORS=yes',
-                            \ 'fi',
-                            \ 'if [ "$TERM" = "screen" ] && [ "$HAS_256_COLORS" = "yes" ]',
-                            \ 'then',
-                            \ '    export TERM=screen-256color',
-                            \ 'fi',
-                            \ 'if [ "x$DISPLAY" != "x" ]',
-                            \ 'then',
-                            \ '    alias vim="vim --servername VIM"',
-                            \ '    if [ "$HAS_256_COLORS" = "yes" ]',
-                            \ '    then',
-                            \ '        function tvim(){ tmux new-session "TERM=screen-256color vim --servername VIM $@" ; }',
-                            \ '    else',
-                            \ '        function tvim(){ tmux new-session "vim --servername VIM $@" ; }',
-                            \ '    fi',
-                            \ 'else',
-                            \ '    if [ "$HAS_256_COLORS" = "yes" ]',
-                            \ '    then',
-                            \ '        function tvim(){ tmux new-session "TERM=screen-256color vim $@" ; }',
-                            \ '    else',
-                            \ '        function tvim(){ tmux new-session "vim $@" ; }',
-                            \ '    fi',
-                            \ 'fi' ]
+                if has("neovim")
+                    let blines += ['# Change the TERM environment variable (to get 256 colors) and creates',
+                                \ '# a function to run Tmux and Neovim at once:',
+                                \ 'if [ "$TERM" = "xterm" ] || [ "$TERM" = "xterm-256color" ]',
+                                \ 'then',
+                                \ '    export TERM=xterm-256color',
+                                \ '    export HAS_256_COLORS=yes',
+                                \ 'fi',
+                                \ 'if [ "$TERM" = "screen" ] && [ "$HAS_256_COLORS" = "yes" ]',
+                                \ 'then',
+                                \ '    export TERM=screen-256color',
+                                \ 'fi',
+                                \ 'if [ "$HAS_256_COLORS" = "yes" ]',
+                                \ 'then',
+                                \ '    function tvim(){ tmux new-session "TERM=screen-256color nvim $@" ; }',
+                                \ 'else',
+                                \ '    function tvim(){ tmux new-session "nvim $@" ; }',
+                                \ 'fi' ]
+                else
+                    let blines += ['# Change the TERM environment variable (to get 256 colors) and make Vim',
+                                \ '# connecting to X Server even if running in a terminal emulator (to get',
+                                \ '# dynamic update of syntax highlight and Object Browser):',
+                                \ 'if [ "$TERM" = "xterm" ] || [ "$TERM" = "xterm-256color" ]',
+                                \ 'then',
+                                \ '    export TERM=xterm-256color',
+                                \ '    export HAS_256_COLORS=yes',
+                                \ 'fi',
+                                \ 'if [ "$TERM" = "screen" ] && [ "$HAS_256_COLORS" = "yes" ]',
+                                \ 'then',
+                                \ '    export TERM=screen-256color',
+                                \ 'fi',
+                                \ 'if [ "x$DISPLAY" != "x" ]',
+                                \ 'then',
+                                \ '    alias vim="vim --servername VIM"',
+                                \ '    if [ "$HAS_256_COLORS" = "yes" ]',
+                                \ '    then',
+                                \ '        function tvim(){ tmux new-session "TERM=screen-256color vim --servername VIM $@" ; }',
+                                \ '    else',
+                                \ '        function tvim(){ tmux new-session "vim --servername VIM $@" ; }',
+                                \ '    fi',
+                                \ 'else',
+                                \ '    if [ "$HAS_256_COLORS" = "yes" ]',
+                                \ '    then',
+                                \ '        function tvim(){ tmux new-session "TERM=screen-256color vim $@" ; }',
+                                \ '    else',
+                                \ '        function tvim(){ tmux new-session "vim $@" ; }',
+                                \ '    fi',
+                                \ 'fi' ]
+                endif
                 call writefile(blines, $HOME . "/.bashrc")
                 if !has("gui_running")
                     redraw
@@ -539,6 +556,12 @@ function! RConfigTmux()
 endfunction
 
 function! RConfigVimR()
+    if has("neovim")
+        let s:vimprog = "nvim"
+    else
+        let s:vimprog = "vim"
+    endif
+    exe "helptags " . g:rplugin_uservimfiles . "/doc"
     if string(g:SendCmdToR) == "function('SendCmdToR_fake')"
         if hasmapto("RStart", "n")
             let cmd = RNMapCmd("RStart")

From 4b6826c1ee4bd9b79f6b1a6f93120e9119b90daf Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Thu, 12 Jun 2014 20:14:33 -0300
Subject: [PATCH 0702/1050] Update vimcom version.

---
 r-plugin/nvimcom.py | 10 +++++-----
 r-plugin/vimcom.py  | 10 +++++-----
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/r-plugin/nvimcom.py b/r-plugin/nvimcom.py
index 51fab52..644b2e5 100644
--- a/r-plugin/nvimcom.py
+++ b/r-plugin/nvimcom.py
@@ -13,7 +13,7 @@ def DiscoverVimComPort():
     global VimComPort
     global VimComFamily
     HOST = "localhost"
-    VimComPort = 9998
+    VimComPort = 10000
     repl = "NOTHING"
     correct_repl = os.getenv("VIMINSTANCEID")
     if correct_repl is None:
@@ -21,7 +21,7 @@ def DiscoverVimComPort():
         sys.stdout.flush()
         return
 
-    while repl.find(correct_repl) < 0 and VimComPort < 10050:
+    while repl.find(correct_repl) < 0 and VimComPort < 10049:
         VimComPort = VimComPort + 1
         for res in socket.getaddrinfo(HOST, VimComPort, socket.AF_UNSPEC, socket.SOCK_DGRAM):
             af, socktype, proto, canonname, sa = res
@@ -43,7 +43,7 @@ def DiscoverVimComPort():
                 sock = None
                 continue
 
-    if VimComPort >= 10050:
+    if VimComPort >= 10049:
         VimComPort = 0
         if not PortWarn:
             PortWarn = True
@@ -56,8 +56,8 @@ def DiscoverVimComPort():
         print "let g:rplugin_vimcomport = " + str(VimComPort) + "\n"
         sys.stdout.flush()
         PortWarn = False
-        if repl.find("1.0-0_a1") != 0:
-            print "call RWarningMsg('This version of Vim-R-plugin requires vimcom.plus 1.0-0_a1.')\n"
+        if repl.find("1.0-0_a2") != 0:
+            print "call RWarningMsg('This version of Vim-R-plugin requires vimcom.plus 1.0-0_a2.')\n"
             sys.stdout.flush()
         return
 
diff --git a/r-plugin/vimcom.py b/r-plugin/vimcom.py
index 3eaab11..01f7ba5 100644
--- a/r-plugin/vimcom.py
+++ b/r-plugin/vimcom.py
@@ -12,7 +12,7 @@ def DiscoverVimComPort():
     global VimComPort
     global VimComFamily
     HOST = "localhost"
-    VimComPort = 9998
+    VimComPort = 10000
     repl = "NOTHING"
     correct_repl = vim.eval("$VIMINSTANCEID")
     if correct_repl is None:
@@ -21,7 +21,7 @@ def DiscoverVimComPort():
             vim.command("call RWarningMsg('VIMINSTANCEID not found.')")
             return
 
-    while repl.find(correct_repl) < 0 and VimComPort < 10050:
+    while repl.find(correct_repl) < 0 and VimComPort < 10049:
         VimComPort = VimComPort + 1
         for res in socket.getaddrinfo(HOST, VimComPort, socket.AF_UNSPEC, socket.SOCK_DGRAM):
             af, socktype, proto, canonname, sa = res
@@ -43,7 +43,7 @@ def DiscoverVimComPort():
                 sock = None
                 continue
 
-    if VimComPort >= 10050:
+    if VimComPort >= 10049:
         VimComPort = 0
         vim.command("let g:rplugin_vimcomport = 0")
         if not PortWarn:
@@ -52,8 +52,8 @@ def DiscoverVimComPort():
     else:
         vim.command("let g:rplugin_vimcomport = " + str(VimComPort))
         PortWarn = False
-        if repl.find("1.0-0_a1") != 0:
-            vim.command("call RWarningMsg('This version of Vim-R-plugin requires vimcom.plus 1.0-0_a1.')")
+        if repl.find("1.0-0_a2") != 0:
+            vim.command("call RWarningMsg('This version of Vim-R-plugin requires vimcom.plus 1.0-0_a2.')")
             vim.command("sleep 1")
     return(VimComPort)
 

From cf76e6d927c4f187f57b0d6e7bf56f050fad143e Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Thu, 12 Jun 2014 20:15:10 -0300
Subject: [PATCH 0703/1050] Use a time to check if vimcom.plus is loaded. This
 new feature is available only for Neovim.

---
 doc/r-plugin.txt           |  5 +++
 r-plugin/common_global.vim | 66 +++++++++++++++++++++++++++++++++-----
 r-plugin/timer.sh          |  9 ++++++
 3 files changed, 72 insertions(+), 8 deletions(-)
 create mode 100755 r-plugin/timer.sh

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index f8c5416..f8eb03a 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -1695,6 +1695,11 @@ value for the variable in your |vimrc|. Example:
 Note: You should have the line  `library(vimcom.plus)`  in your Rprofile. The
 Vim command  :RpluginConfig  adds that line for you.
 
+The plugin has a different behavior with Neovim: it receives a message from
+vimcom.plus as soon as it is loaded and warns if the package was not loaded
+after 15 seconds of sending the command to start R. If you need more than 15
+seconds, change the value of vimrplugin_vimcom_wait.
+
 If you do not want to install the vimcom.plus package, then put in your
 |vimrc|:
 >
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 066d688..36f8918 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -803,9 +803,7 @@ function StartR(whatr)
 
     call writefile([], $VIMRPLUGIN_TMPDIR . "/globenv_" . $VIMINSTANCEID)
     call writefile([], $VIMRPLUGIN_TMPDIR . "/liblist_" . $VIMINSTANCEID)
-    if filereadable($VIMRPLUGIN_TMPDIR . "/libnames_" . $VIMINSTANCEID)
-        call delete($VIMRPLUGIN_TMPDIR . "/libnames_" . $VIMINSTANCEID)
-    endif
+    call delete($VIMRPLUGIN_TMPDIR . "/libnames_" . $VIMINSTANCEID)
 
     if !exists("b:rplugin_R")
         call SetRPath()
@@ -919,9 +917,54 @@ function StartR(whatr)
     echon
 endfunction
 
+function ReceiveVimComStartMsg(msg)
+    let vmsg = split(a:msg)
+    if len(vmsg) == 4
+        if vmsg[0] == "vimcom"
+            let g:rplugin_vimcom_pkg = "vimcom"
+        elseif vmsg[0] == "vimcom.plus"
+            let g:rplugin_vimcom_pkg = "vimcom.plus"
+        else
+            call RWarningMsg("Invalid package name: " . vmsg[0])
+        endif
+        if vmsg[1] != "1.0-0_a2"
+            call RWarningMsg('This version of Vim-R-plugin requires vimcom.plus 1.0-0_a2.')
+        endif
+        if vmsg[2] != $VIMINSTANCEID
+            call RWarningMsg("Invalid ID: " . vmsg[2] . " [Correct = " . $VIMINSTANCEID . "]")
+        endif
+        if vmsg[3] > "10000" && vmsg[3] < "10049"
+            let g:rplugin_vimcomport = vmsg[3]
+            " Give vimcom some time to complete its startup process
+            sleep 20m
+        else
+            call RWarningMsg("Invalid vimcom.plus port: " . vmsg[2])
+        endif
+    endif
+endfunction
+
+function NoLongerWaitVimCom()
+    if filereadable($VIMRPLUGIN_TMPDIR . "/vimcom_running")
+        call delete($VIMRPLUGIN_TMPDIR . "/vimcom_running")
+    else
+        call RWarningMsg("The package vimcom.plus wasn't loaded yet.")
+    endif
+endfunction
+
+" Neovim don't need this function:
 function WaitVimComStart()
-    if g:vimrplugin_vimcom_wait < 0
-        return 0
+    if has("neovim")
+        if executable(g:rplugin_home . "/r-plugin/timer.sh")
+            let wjob = jobstart('waitvc', g:rplugin_home . '/r-plugin/timer.sh', [string(g:vimrplugin_vimcom_wait / 1000), 'call NoLongerWaitVimCom()'])
+            autocmd JobActivity waitvc call RServerEvent()
+        else
+            call RWarningMsg("File '" . g:rplugin_home . "/r-plugin/timer.sh" . "' not found.")
+        endif
+        return
+    else
+        if g:vimrplugin_vimcom_wait < 0
+            return 0
+        endif
     endif
     sleep 300m
     let ii = 0
@@ -948,8 +991,8 @@ function WaitVimComStart()
         endif
         if vr[2] == $VIMINSTANCEID
             let g:rplugin_vimcom_version = vr[1]
-            if g:rplugin_vimcom_version != "1.0-0_a1"
-                call RWarningMsg('This version of Vim-R-plugin requires vimcom.plus 1.0-0_a1.')
+            if g:rplugin_vimcom_version != "1.0-0_a2"
+                call RWarningMsg('This version of Vim-R-plugin requires vimcom.plus 1.0-0_a2.')
                 sleep 1
             endif
         else
@@ -2055,7 +2098,10 @@ function RQuit(how)
     call delete($VIMRPLUGIN_TMPDIR . "/liblist_" . $VIMINSTANCEID)
     call delete($VIMRPLUGIN_TMPDIR . "/libnames_" . $VIMINSTANCEID)
     call delete($VIMRPLUGIN_TMPDIR . "/GlobalEnvList_" . $VIMINSTANCEID)
+    call delete($VIMRPLUGIN_TMPDIR . "/vimcom_running")
     let g:SendCmdToR = function('SendCmdToR_fake')
+    let g:rplugin_vimcomport = 0
+    let g:rplugin_vimcom_pkg = "vimcom"
 endfunction
 
 " knit the current buffer content
@@ -3360,7 +3406,11 @@ call RSetDefaultValue("g:vimrplugin_editor_w",         66)
 call RSetDefaultValue("g:vimrplugin_help_w",           46)
 call RSetDefaultValue("g:vimrplugin_objbr_w",          40)
 call RSetDefaultValue("g:vimrplugin_external_ob",       0)
-call RSetDefaultValue("g:vimrplugin_vimcom_wait",    5000)
+if has("neovim")
+    call RSetDefaultValue("g:vimrplugin_vimcom_wait", 15000)
+else
+    call RSetDefaultValue("g:vimrplugin_vimcom_wait", 5000)
+endif
 call RSetDefaultValue("g:vimrplugin_show_args",         0)
 call RSetDefaultValue("g:vimrplugin_never_unmake_menu", 0)
 call RSetDefaultValue("g:vimrplugin_insert_mode_cmds",  1)
diff --git a/r-plugin/timer.sh b/r-plugin/timer.sh
new file mode 100755
index 0000000..bbf06b7
--- /dev/null
+++ b/r-plugin/timer.sh
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+for i in $(seq 1 $1)
+do
+    sleep 1
+done
+
+echo $2
+

From bda440559f435f61180c1aaf5a21b8c68fc864fa Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Sat, 14 Jun 2014 11:03:46 -0300
Subject: [PATCH 0704/1050] New option: vimrplugin_tmux_title.

---
 doc/r-plugin.txt           | 34 ++++++++++++++++++++++++++++++----
 r-plugin/common_global.vim |  7 +++++++
 r-plugin/vimrconfig.vim    |  1 +
 3 files changed, 38 insertions(+), 4 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index f8eb03a..b5b87df 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -1120,9 +1120,11 @@ is running:
 |vimrplugin_routnotab|         Show output of R CMD BATCH in new window
 |vimrplugin_indent_commented|  Indent lines commented with the \xx command
 |vimrplugin_sleeptime|         Delay while sending commands in MS Windows
+|vimrplugin_notmuxconf|        Don't use a specially built Tmux config file
 |vimrplugin_rconsole_height|   The number of lines of R Console (Tmux split)
 |vimrplugin_vsplit|            Make Tmux split the window vertically
 |vimrplugin_rconsole_width|    The number of columns of R Console (Tmux split)
+|vimrplugin_tmux_title|        Set Tmux window title to "VimR"
 |vimrplugin_applescript|       Use osascript in Mac OS X
 |vimrplugin_listmethods|       Do `vim.list.args()` instead of `args()`
 |vimrplugin_specialplot|       Do `vim.plot()` instead of `plot()`
@@ -1143,7 +1145,7 @@ is running:
 |vimrplugin_restart|           Restart R if it is already running
 |vimrplugin_show_args|         Show extra information during omnicompletion
 |vimrplugin_vimcom_wait|       Time to wait for vimcom.plus loading
-|vimrplugin_vim_wd|            Start R in working directory of Vim
+|vimrplugin_vim_wd|            Start R in Vim's working directory
 
 
 6.1. Terminal emulator (Linux/Unix only)~
@@ -1426,6 +1428,7 @@ file (~/.tmux.conf).
 						  *vimrplugin_rconsole_height*
 							   *vimrplugin_vsplit*
 						   *vimrplugin_rconsole_width*
+						       *vimrplugin_tmux_title*
 These three options are valid only when Vim is started inside a Tmux session.
 In this case, when you type rf, the terminal will be split in two
 regions and R will run in one of them. By default, the Vim-R-plugin will tell
@@ -1443,6 +1446,16 @@ In this case, you can choose the initial number of columns of R Console:
 >
    let vimrplugin_rconsole_width = 15
 <
+Tmux automatically renames window titles to the command currently running. The
+Vim-R-plugin sets the title of the window where Vim and R are running to
+"VimR". This title will be visible only if Tmux status bar is "on", and it is
+useful only if you have created new windows with the c command. You
+can change the value of vimrplugin_tmux_title to either set a different title
+or let Tmux set the title automatically. Examples:
+>
+   let vimrplugin_tmux_title = "Vim-R"
+   let vimrplugin_tmux_title = "automatic"
+<
 
 6.16. Integration with AppleScript (OS X only)~
 							*vimrplugin_applescript*
@@ -2386,12 +2399,22 @@ please read this document from the beginning.
    set-option -g prefix C-a
    unbind-key C-b
    bind-key C-a send-prefix
+   # Set "status on" if you usually create new Tmux windows
    set -g status off
-   set-window-option -g mode-keys vi
    set -g terminal-overrides 'xterm*:smcup@:rmcup@'
    set -g mode-mouse on
    set -g mouse-select-pane on
    set -g mouse-resize-pane on
+   # Act more like vim:
+   set-window-option -g mode-keys vi
+   bind h select-pane -L
+   bind j select-pane -D
+   bind k select-pane -U
+   bind l select-pane -R
+   unbind p
+   bind p paste-buffer
+   bind -t vi-copy v begin-selection
+   bind -t vi-copy y copy-selection
 <
 
 							    *r-plugin-R-setup*
@@ -2523,14 +2546,17 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details.
 							       *r-plugin-news*
 10. News~
 
-1.0 (2014-06-11)
+1.0 (2014-06-14)
+
+ * Neovim support.
 
  * vimrplugin_openpdf now accepts three values: 0, 1 and 2.
 
  * New command \o evaluates current line in R and inserts the output in the
    script.
 
- * New options: vimrplugin_vimcom_wait and vimrplugin_vim_wd.
+ * New options: vimrplugin_vimcom_wait, vimrplugin_vim_wd, and
+   vimrplugin_tmux_title.
 
  * Minor bug fixes.
 
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 36f8918..6aba815 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -643,6 +643,9 @@ function StartR_TmuxSplit(rcmd)
         let g:vimrplugin_ca_ck = ca_ck
     endif
     let g:rplugin_last_rcmd = a:rcmd
+    if g:vimrplugin_tmux_title != "automatic" && g:vimrplugin_tmux_title != ""
+        call system("tmux rename-window " . g:vimrplugin_tmux_title)
+    endif
     if WaitVimComStart()
         call g:SendToVimCom("\005B Update OB [StartR]")
     endif
@@ -2102,6 +2105,9 @@ function RQuit(how)
     let g:SendCmdToR = function('SendCmdToR_fake')
     let g:rplugin_vimcomport = 0
     let g:rplugin_vimcom_pkg = "vimcom"
+    if g:rplugin_tmuxwasfirst && g:vimrplugin_tmux_title != "automatic" && g:vimrplugin_tmux_title != ""
+        call system("tmux set automatic-rename on")
+    endif
 endfunction
 
 " knit the current buffer content
@@ -3397,6 +3403,7 @@ call RSetDefaultValue("g:vimrplugin_restart",           0)
 call RSetDefaultValue("g:vimrplugin_vsplit",            0)
 call RSetDefaultValue("g:vimrplugin_rconsole_width",   -1)
 call RSetDefaultValue("g:vimrplugin_rconsole_height",  15)
+call RSetDefaultValue("g:vimrplugin_tmux_title", "'VimR'")
 call RSetDefaultValue("g:vimrplugin_listmethods",       0)
 call RSetDefaultValue("g:vimrplugin_specialplot",       0)
 call RSetDefaultValue("g:vimrplugin_notmuxconf",        0)
diff --git a/r-plugin/vimrconfig.vim b/r-plugin/vimrconfig.vim
index 7d4d7fc..6eadc7c 100644
--- a/r-plugin/vimrconfig.vim
+++ b/r-plugin/vimrconfig.vim
@@ -535,6 +535,7 @@ function! RConfigTmux()
             let tlines += ["set-option -g prefix C-a",
                         \ "unbind-key C-b",
                         \ "bind-key C-a send-prefix",
+                        \ '# Set "status on" if you usually create new Tmux windows',
                         \ "set -g status off",
                         \ "set-window-option -g mode-keys vi",
                         \ "set -g terminal-overrides 'xterm*:smcup@:rmcup@'",

From 2ad4bcea7c5d8d0b878973222d1c06ebf0b3f47f Mon Sep 17 00:00:00 2001
From: Keith Hughitt 
Date: Mon, 16 Jun 2014 13:40:32 -0400
Subject: [PATCH 0705/1050] URxvt support

---
 doc/r-plugin.txt           |  2 +-
 r-plugin/common_global.vim | 12 +++++++++++-
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 7d96841..83e8601 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -1108,7 +1108,7 @@ list:
     3. xfce4-terminal,
     4. iterm,
     5. Eterm,
-    6. rxvt,
+    6. (u)rxvt,
     7. aterm,
     8. roxterm,
     9. terminator,
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index f5f38b2..a9d60a0 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -650,6 +650,12 @@ function StartR_ExternalTerm(rcmd)
                     \ 'set -g status off',
                     \ 'set -g default-terminal "screen-256color"',
                     \ "set -g terminal-overrides 'xterm*:smcup@:rmcup@'" ]
+
+        if g:vimrplugin_term == "rxvt" || g:vimrplugin_term == "urxvt"
+            let cnflines = cnflines + [
+                    \ "set -g terminal-overrides 'rxvt*:smcup@:rmcup@'" ]
+        endif
+
         if g:vimrplugin_external_ob || !has("gui_running")
             call extend(cnflines, ['set -g mode-mouse on', 'set -g mouse-select-pane on', 'set -g mouse-resize-pane on'])
         endif
@@ -3529,7 +3535,7 @@ if has("win32") || has("win64") || g:vimrplugin_applescript || $DISPLAY == "" ||
     " No external terminal emulator will be called, so any value is good
     let g:vimrplugin_term = "xterm"
 else
-    let s:terminals = ['gnome-terminal', 'konsole', 'xfce4-terminal', 'terminal', 'Eterm', 'rxvt', 'aterm', 'roxterm', 'terminator', 'lxterminal', 'xterm']
+    let s:terminals = ['gnome-terminal', 'konsole', 'xfce4-terminal', 'terminal', 'Eterm', 'rxvt', 'urxvt', 'aterm', 'roxterm', 'terminator', 'lxterminal', 'xterm']
     if has('mac')
         let s:terminals = ['iTerm', 'Terminal', 'Terminal.app'] + s:terminals
     endif
@@ -3585,6 +3591,10 @@ if g:vimrplugin_term == "xterm" || g:vimrplugin_term == "uxterm"
     let g:rplugin_termcmd = g:vimrplugin_term . " -xrm '*iconPixmap: " . g:rplugin_home . "/bitmaps/ricon.xbm' -e"
 endif
 
+if g:vimrplugin_term == "rxvt" || g:vimrplugin_term == "urxvt"
+    let g:rplugin_termcmd = g:vimrplugin_term . " -cd '" . expand("%:p:h") . "' -title R -xrm '*iconPixmap: " . g:rplugin_home . "/bitmaps/ricon.xbm' -e"
+endif
+
 " Override default settings:
 if exists("g:vimrplugin_term_cmd")
     let g:rplugin_termcmd = g:vimrplugin_term_cmd

From 05f4bc4ea5b779db3be9ff6966fd8684f16a8ca6 Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Tue, 17 Jun 2014 18:52:35 -0300
Subject: [PATCH 0706/1050] Add tags to roxygen (thanks to berndbischl).

---
 syntax/r.vim | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/syntax/r.vim b/syntax/r.vim
index 62c0cf1..8d3edff 100644
--- a/syntax/r.vim
+++ b/syntax/r.vim
@@ -3,7 +3,7 @@
 " Maintainer:	      Jakson Aquino 
 " Former Maintainers: Vaidotas Zemlys 
 " 		      Tom Payne 
-" Last Change:	      Wed May 07, 2014  11:18AM
+" Last Change:	      Tue Jun 17, 2014  06:52PM
 " Filenames:	      *.R *.r *.Rhistory *.Rt
 " 
 " NOTE: The highlighting of R functions is defined in the
@@ -39,6 +39,7 @@ syn match rOKeyword contained "@\(S3method\|TODO\|aliases\|alias\|assignee\|auth
 syn match rOKeyword contained "@\(callGraphPrimitives\|concept\|exportClass\|exportMethod\|exportPattern\|export\|formals\)"
 syn match rOKeyword contained "@\(format\|importClassesFrom\|importFrom\|importMethodsFrom\|import\|keywords\)"
 syn match rOKeyword contained "@\(method\|noRd\|note\|references\|seealso\|setClass\|slot\|source\|title\|usage\)"
+syn match rOKeyword contained "@\(family\|template\|templateVar\|description\|details\|inheritsParams\)"
 syn match rOComment contains=@Spell,rOKeyword "#'.*"
 
 

From 8736daf84bd1682c72cedff91c646284f00a0f0a Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Fri, 20 Jun 2014 10:06:34 -0300
Subject: [PATCH 0707/1050] Add nvimcom.py and nvimserver.py to list of files.

---
 doc/r-plugin.txt | 2 ++
 list_for_vimball | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index d6e88a0..7e3e562 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -1919,6 +1919,8 @@ directory after the installation:
    syntax/rbrowser.vim
    doc/r-plugin.txt
    r-plugin/vimcom.py
+   r-plugin/nvimcom.py
+   r-plugin/nvimserver.py
    r-plugin/global_r_plugin.vim
    r-plugin/windows.py
    r-plugin/objlist/README
diff --git a/list_for_vimball b/list_for_vimball
index 954f887..1a08e87 100644
--- a/list_for_vimball
+++ b/list_for_vimball
@@ -24,6 +24,8 @@ r-plugin/global_r_plugin.vim
 r-plugin/objlist/README
 r-plugin/r.snippets
 r-plugin/tex_indent.vim
+r-plugin/nvimcom.py
+r-plugin/nvimserver.py
 r-plugin/vimcom.py
 r-plugin/vimrconfig.vim
 r-plugin/windows.py

From 6df52cec2994e5f3f532c977f5181399c8f89b21 Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Tue, 24 Jun 2014 00:26:11 -0300
Subject: [PATCH 0708/1050] Check if has "neovim" before DiscoverVimComPort.

---
 ftplugin/rmd_rplugin.vim    | 6 +++++-
 ftplugin/rnoweb_rplugin.vim | 6 +++++-
 ftplugin/rrst_rplugin.vim   | 6 +++++-
 3 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/ftplugin/rmd_rplugin.vim b/ftplugin/rmd_rplugin.vim
index 665b95d..19adbf5 100644
--- a/ftplugin/rmd_rplugin.vim
+++ b/ftplugin/rmd_rplugin.vim
@@ -103,7 +103,11 @@ endfunction
 
 function! RMakePDFrmd(t)
     if g:rplugin_vimcomport == 0
-        exe "Py DiscoverVimComPort()"
+        if has("neovim")
+            call jobwrite(g:rplugin_clt_job, "DiscoverVimComPort\n")
+        else
+            Py DiscoverVimComPort()
+        endif
         if g:rplugin_vimcomport == 0
             call RWarningMsg("The vimcom package is required to make and open the PDF.")
         endif
diff --git a/ftplugin/rnoweb_rplugin.vim b/ftplugin/rnoweb_rplugin.vim
index 10b22cf..987b4ac 100644
--- a/ftplugin/rnoweb_rplugin.vim
+++ b/ftplugin/rnoweb_rplugin.vim
@@ -77,7 +77,11 @@ endfunction
 " Sweave and compile the current buffer content
 function! RMakePDF(bibtex, knit)
     if g:rplugin_vimcomport == 0
-        exe "Py DiscoverVimComPort()"
+        if has("neovim")
+            call jobwrite(g:rplugin_clt_job, "DiscoverVimComPort\n")
+        else
+            Py DiscoverVimComPort()
+        endif
         if g:rplugin_vimcomport == 0
             call RWarningMsg("The vimcom package is required to make and open the PDF.")
         endif
diff --git a/ftplugin/rrst_rplugin.vim b/ftplugin/rrst_rplugin.vim
index 88025f1..0ad3fd4 100644
--- a/ftplugin/rrst_rplugin.vim
+++ b/ftplugin/rrst_rplugin.vim
@@ -96,7 +96,11 @@ endfunction
 
 function! RMakePDFrrst()
     if g:rplugin_vimcomport == 0
-        exe "Py DiscoverVimComPort()"
+        if has("neovim")
+            call jobwrite(g:rplugin_clt_job, "DiscoverVimComPort\n")
+        else
+            Py DiscoverVimComPort()
+        endif
         if g:rplugin_vimcomport == 0
             call RWarningMsg("The vimcom package is required to make and open the PDF.")
         endif

From fcdabe751b2109678f466561a999693248c35e4a Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Tue, 24 Jun 2014 00:27:21 -0300
Subject: [PATCH 0709/1050] Add nvimcom.py and nvimserver.py to Makefile.

---
 Makefile | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index f46d447..88da4e2 100644
--- a/Makefile
+++ b/Makefile
@@ -78,6 +78,8 @@ deb:
 	  - r-plugin/common_buffer.vim\n\
 	  - r-plugin/common_global.vim\n\
 	  - r-plugin/vimcom.py\n\
+	  - r-plugin/nvimcom.py\n
+	  - r-plugin/nvimserver.py\n
 	  - r-plugin/global_r_plugin.vim\n\
 	  - r-plugin/tex_indent.vim\n\
 	  - r-plugin/vimrconfig.vim\n\
@@ -91,7 +93,7 @@ deb:
 	  - syntax/rbrowser.vim\n\
 	" > /tmp/vim-r-plugin-tmp/usr/share/vim/registry/vim-r-plugin.yaml
 	# Create the copyright
-	echo "Copyright (C) 2011 Jakson Aquino\n\
+	echo "Copyright (C) 2011-2014 Jakson Aquino\n\
 	\n\
 	License: GPLv2+\n\
 	\n\
@@ -128,7 +130,7 @@ deb:
 	Architecture: all\n\
 	Maintainer: Jakson Alves de Aquino \n\
 	Installed-Size: $(INSTALLEDSIZE)\n\
-	Depends: vim | vim-gtk | vim-gnome, tmux (>= 1.5), ncurses-term, vim-addon-manager, r-base-core\n\
+	Depends: vim | vim-gtk | vim-gnome, tmux (>= 1.8), ncurses-term, vim-addon-manager, r-base-core\n\
 	Enhances: vim\n\
 	Section: text\n\
 	Priority: extra\n\

From b52d22f3b1706af082aae79d025ba6f37cab1ea1 Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Thu, 26 Jun 2014 14:39:51 -0300
Subject: [PATCH 0710/1050] Make smaller VIMINSTANCE and TmuxSession IDs.

---
 r-plugin/common_global.vim | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 09a2fe0..5b47e0f 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -653,7 +653,7 @@ endfunction
 
 
 function StartR_ExternalTerm(rcmd)
-    if $DISPLAY == ""
+    if $DISPLAY == "" && !has("gui_macvim")
         call RWarningMsg("Start 'tmux' before Vim. The X Window system is required to run R in an external terminal.")
         return
     endif
@@ -1051,7 +1051,7 @@ function StartObjBrowser_Tmux()
 
     " Don't start the Object Browser if it already exists
     if IsExternalOBRunning()
-        if $DISPLAY == "" && exists("g:rplugin_ob_pane")
+        if !has("neovim") && (has("gui_macvim") || $DISPLAY == "") && exists("g:rplugin_ob_pane")
             let slog = system("tmux set-buffer ':silent call UpdateOB(\"both\")\:\' && tmux paste-buffer -t " . g:rplugin_ob_pane . " && tmux select-pane -t " . g:rplugin_ob_pane)
             if v:shell_error
                 call RWarningMsg(slog)
@@ -1194,7 +1194,10 @@ function StartObjBrowser_Vim()
         endif
         let g:rplugin_ob_warn_shown = 1
     else
-        if has("neovim")
+        if has("gui_macvim")
+            let wmsg ="MacVim cannot automatically updated the Object Browser."
+            let g:rplugin_ob_warn_shown = 1
+        elseif has("neovim")
             call g:SendToVimCom("\002" . g:rplugin_myport)
         else
             call g:SendToVimCom("\002" . v:servername)
@@ -3870,12 +3873,15 @@ let g:rplugin_vimcom_version = 0
 let g:rplugin_lastrpl = ""
 let g:rplugin_lastev = ""
 let g:rplugin_hasRSFbutton = 0
-let g:rplugin_tmuxsname = substitute("vimrplugin-" . g:rplugin_userlogin . localtime() . g:rplugin_firstbuffer, '\W', '', 'g')
+let g:rplugin_tmuxsname = "VimR-" . substitute(localtime(), '.*\(...\)', '\1', '')
 
 " If this is the Object Browser running in a Tmux pane, $VIMINSTANCEID is
 " already defined and shouldn't be changed
 if $VIMINSTANCEID == ""
-    let $VIMINSTANCEID = substitute(g:rplugin_firstbuffer . localtime(), '\W', '', 'g')
+    let $VIMINSTANCEID = substitute(g:rplugin_firstbuffer, '\W', '', 'g') . substitute(localtime(), '.*\(...\)', '\1', '')
+    if strlen($VIMINSTANCEID) > 64
+        let $VIMINSTANCEID = substitute($VIMINSTANCEID, '.*\(...............................................................\)', '\1', '')
+    endif
 endif
 
 let g:rplugin_obsname = toupper(substitute(substitute(expand("%:r"), '\W', '', 'g'), "_", "", "g"))

From 597599e5ed6c9dcf0d4f8dbebecd0fefec344486 Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Sat, 28 Jun 2014 09:41:34 -0300
Subject: [PATCH 0711/1050] Complete names of installed libraries. If the
 function being completed is either require() or library(), and if the
 argument being completed is the first one, return the names of installed
 packages. (Based on code written by Michael Lerch).

---
 doc/r-plugin.txt           |  4 +++-
 r-plugin/common_global.vim | 43 ++++++++++++++++++++++++++++++--------
 r-plugin/nvimcom.py        |  4 ++--
 r-plugin/vimcom.py         |  4 ++--
 4 files changed, 41 insertions(+), 14 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 7e3e562..88f3631 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -545,7 +545,9 @@ Vim-R-plugin usage). Otherwise, the pop up menu for completion of function
 arguments will include an additional line with the name of the library where
 the function is (if the function name can be found in more than one library)
 and the function method (if what is being shown are the arguments of a method
-and not of the function itself).
+and not of the function itself). For library() and require(), when completing
+the first argument, the popup list shows the names of installed packages, but
+only if R is running.
 
 To get help on an R topic, type in Vim (Normal mode):
 >
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 5b47e0f..728d104 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -212,6 +212,20 @@ function! CompleteChunkOptions()
     call complete(idx1 + 1, rr)
 endfunction
 
+function IsFirstRArg(lnum, cpos)
+    let line = getline(a:lnum)
+    let ii = a:cpos[2] - 2
+    let cchar = line[ii]
+    while ii > 0 && cchar != '('
+        let cchar = line[ii]
+        if cchar == ','
+            return 0
+        endif
+        let ii -= 1
+    endwhile
+    return 1
+endfunction
+
 function RCompleteArgs()
     let line = getline(".")
     if (&filetype == "rnoweb" && line =~ "^<<.*>>=$") || (&filetype == "rmd" && line =~ "^``` *{r.*}$") || (&filetype == "rrst" && line =~ "^.. {r.*}$") || (&filetype == "r" && line =~ "^#\+")
@@ -265,15 +279,26 @@ function RCompleteArgs()
             if string(g:SendCmdToR) != "function('SendCmdToR_fake')"
                 call delete($VIMRPLUGIN_TMPDIR . "/eval_reply")
                 if has("neovim")
-                    let beginmsg = "I\002" . g:rplugin_vimcom_pkg . ':::vim.args("'
+                    let msg = "I\002" . g:rplugin_vimcom_pkg . ':::vim.args("'
                 else
-                    let beginmsg = g:rplugin_vimcom_pkg . ':::vim.args("'
+                    let msg = g:rplugin_vimcom_pkg . ':::vim.args("'
                 endif
                 if classfor == ""
-                    call g:SendToVimCom(beginmsg . rkeyword0 . '", "' . argkey . '")')
+                    let msg = msg . rkeyword0 . '", "' . argkey . '"'
+                else
+                    let msg = msg . rkeyword0 . '", "' . argkey . '", classfor = ' . classfor
+                endif
+                if rkeyword0 == "library" || rkeyword0 == "require"
+                    let isfirst = IsFirstRArg(lnum, cpos)
+                else
+                    let isfirst = 0
+                endif
+                if isfirst
+                    let msg = msg . ', firstLibArg = TRUE)'
                 else
-                    call g:SendToVimCom(beginmsg . rkeyword0 . '", "' . argkey . '", classfor = ' . classfor . ')')
+                    let msg = msg . ')'
                 endif
+                call g:SendToVimCom(msg)
 
                 if g:rplugin_vimcomport > 0
                     let g:rplugin_lastev = ReadEvalReply()
@@ -287,7 +312,7 @@ function RCompleteArgs()
                         if(len(tmp) > 0)
                             for id in range(len(tmp))
                                 let tmp2 = split(tmp[id], "\x07")
-                                if tmp2[0] == '...'
+                                if tmp2[0] == '...' || isfirst
                                     let tmp3 = tmp2[0]
                                 else
                                     let tmp3 = tmp2[0] . " = "
@@ -936,8 +961,8 @@ function ReceiveVimComStartMsg(msg)
         else
             call RWarningMsg("Invalid package name: " . vmsg[0])
         endif
-        if vmsg[1] != "1.0-0_a2"
-            call RWarningMsg('This version of Vim-R-plugin requires vimcom.plus 1.0-0_a2.')
+        if vmsg[1] != "1.0-0_a3"
+            call RWarningMsg('This version of Vim-R-plugin requires vimcom.plus 1.0-0_a3.')
         endif
         if vmsg[2] != $VIMINSTANCEID
             call RWarningMsg("Invalid ID: " . vmsg[2] . " [Correct = " . $VIMINSTANCEID . "]")
@@ -1000,8 +1025,8 @@ function WaitVimComStart()
         endif
         if vr[2] == $VIMINSTANCEID
             let g:rplugin_vimcom_version = vr[1]
-            if g:rplugin_vimcom_version != "1.0-0_a2"
-                call RWarningMsg('This version of Vim-R-plugin requires vimcom.plus 1.0-0_a2.')
+            if g:rplugin_vimcom_version != "1.0-0_a3"
+                call RWarningMsg('This version of Vim-R-plugin requires vimcom.plus 1.0-0_a3.')
                 sleep 1
             endif
         else
diff --git a/r-plugin/nvimcom.py b/r-plugin/nvimcom.py
index 644b2e5..2177b7f 100644
--- a/r-plugin/nvimcom.py
+++ b/r-plugin/nvimcom.py
@@ -56,8 +56,8 @@ def DiscoverVimComPort():
         print "let g:rplugin_vimcomport = " + str(VimComPort) + "\n"
         sys.stdout.flush()
         PortWarn = False
-        if repl.find("1.0-0_a2") != 0:
-            print "call RWarningMsg('This version of Vim-R-plugin requires vimcom.plus 1.0-0_a2.')\n"
+        if repl.find("1.0-0_a3") != 0:
+            print "call RWarningMsg('This version of Vim-R-plugin requires vimcom.plus 1.0-0_a3.')\n"
             sys.stdout.flush()
         return
 
diff --git a/r-plugin/vimcom.py b/r-plugin/vimcom.py
index 01f7ba5..06fa8bf 100644
--- a/r-plugin/vimcom.py
+++ b/r-plugin/vimcom.py
@@ -52,8 +52,8 @@ def DiscoverVimComPort():
     else:
         vim.command("let g:rplugin_vimcomport = " + str(VimComPort))
         PortWarn = False
-        if repl.find("1.0-0_a2") != 0:
-            vim.command("call RWarningMsg('This version of Vim-R-plugin requires vimcom.plus 1.0-0_a2.')")
+        if repl.find("1.0-0_a3") != 0:
+            vim.command("call RWarningMsg('This version of Vim-R-plugin requires vimcom.plus 1.0-0_a3.')")
             vim.command("sleep 1")
     return(VimComPort)
 

From 20a8bfcc9db72ccdce133842959f9da77f54a84c Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Sun, 29 Jun 2014 11:37:55 -0300
Subject: [PATCH 0712/1050] Add timer.sh to list_for_vimball and Makefile.

---
 Makefile         | 1 +
 list_for_vimball | 1 +
 2 files changed, 2 insertions(+)

diff --git a/Makefile b/Makefile
index 88da4e2..34ab6d4 100644
--- a/Makefile
+++ b/Makefile
@@ -80,6 +80,7 @@ deb:
 	  - r-plugin/vimcom.py\n\
 	  - r-plugin/nvimcom.py\n
 	  - r-plugin/nvimserver.py\n
+	  - r-plugin/timer.sh\n
 	  - r-plugin/global_r_plugin.vim\n\
 	  - r-plugin/tex_indent.vim\n\
 	  - r-plugin/vimrconfig.vim\n\
diff --git a/list_for_vimball b/list_for_vimball
index 1a08e87..077cafe 100644
--- a/list_for_vimball
+++ b/list_for_vimball
@@ -26,6 +26,7 @@ r-plugin/r.snippets
 r-plugin/tex_indent.vim
 r-plugin/nvimcom.py
 r-plugin/nvimserver.py
+r-plugin/timer.sh
 r-plugin/vimcom.py
 r-plugin/vimrconfig.vim
 r-plugin/windows.py

From 011b64af986bf47306a6be3e48906a1683de9629 Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Sun, 29 Jun 2014 11:50:31 -0300
Subject: [PATCH 0713/1050] Simplify timer.sh.

---
 r-plugin/timer.sh | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/r-plugin/timer.sh b/r-plugin/timer.sh
index bbf06b7..104cf1b 100755
--- a/r-plugin/timer.sh
+++ b/r-plugin/timer.sh
@@ -1,9 +1,5 @@
 #!/bin/sh
 
-for i in $(seq 1 $1)
-do
-    sleep 1
-done
-
+sleep $1
 echo $2
 

From b563e8cb4ecd7b13f6d7830850509f1cc0bfc0b5 Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Sun, 29 Jun 2014 21:58:41 -0300
Subject: [PATCH 0714/1050] Add backslash to indicate string continuation.

---
 Makefile | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index 34ab6d4..8ac1feb 100644
--- a/Makefile
+++ b/Makefile
@@ -78,9 +78,9 @@ deb:
 	  - r-plugin/common_buffer.vim\n\
 	  - r-plugin/common_global.vim\n\
 	  - r-plugin/vimcom.py\n\
-	  - r-plugin/nvimcom.py\n
-	  - r-plugin/nvimserver.py\n
-	  - r-plugin/timer.sh\n
+	  - r-plugin/nvimcom.py\n\
+	  - r-plugin/nvimserver.py\n\
+	  - r-plugin/timer.sh\n\
 	  - r-plugin/global_r_plugin.vim\n\
 	  - r-plugin/tex_indent.vim\n\
 	  - r-plugin/vimrconfig.vim\n\

From cf27fd92673258898c15555e1c8a808515854999 Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Sun, 29 Jun 2014 21:59:12 -0300
Subject: [PATCH 0715/1050] Don't require that timer.sh be executable.

---
 r-plugin/common_global.vim | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 728d104..1799855 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -988,8 +988,8 @@ endfunction
 " Neovim don't need this function:
 function WaitVimComStart()
     if has("neovim")
-        if executable(g:rplugin_home . "/r-plugin/timer.sh")
-            let wjob = jobstart('waitvc', g:rplugin_home . '/r-plugin/timer.sh', [string(g:vimrplugin_vimcom_wait / 1000), 'call NoLongerWaitVimCom()'])
+        if filereadable(g:rplugin_home . "/r-plugin/timer.sh")
+            let wjob = jobstart('waitvc', "sh", [g:rplugin_home . '/r-plugin/timer.sh', string(g:vimrplugin_vimcom_wait / 1000), 'call NoLongerWaitVimCom()'])
             autocmd JobActivity waitvc call RServerEvent()
         else
             call RWarningMsg("File '" . g:rplugin_home . "/r-plugin/timer.sh" . "' not found.")

From 1451518db033c071067e7975ecec778353848764 Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Mon, 30 Jun 2014 20:23:32 -0300
Subject: [PATCH 0716/1050] Change vimcom.plus name back to "vimcom". The
 existence of two packages -- vimcom and vimcom.plus -- is causing confusion
 among users because vimcom miss some important features. Now there will be
 only one package and it will have the original name: vimcom. I will request
 the removal of vimcom from CRAN as soon as the version of Vim-R-plugin is
 released.

---
 README.md                  |  2 +-
 autoload/rcomplete.vim     |  2 +-
 doc/r-plugin.txt           | 55 +++++++++++++++++++------------------
 r-plugin/common_global.vim | 56 +++++++++++++++++++++++---------------
 r-plugin/nvimcom.py        |  4 +--
 r-plugin/objlist/README    |  2 +-
 r-plugin/vimcom.py         |  4 +--
 r-plugin/vimrconfig.vim    |  4 +--
 8 files changed, 72 insertions(+), 57 deletions(-)

diff --git a/README.md b/README.md
index 027e757..1a3dab6 100644
--- a/README.md
+++ b/README.md
@@ -11,4 +11,4 @@ http://www.vim.org/scripts/script.php?script_id=2628
 Please, read the file *doc/r-plugin.txt* for usage details.
 
 If you decide to use this version, you will also need the development version
-of vimcom.plus: https://github.com/jalvesaq/VimCom
+of vimcom: https://github.com/jalvesaq/VimCom
diff --git a/autoload/rcomplete.vim b/autoload/rcomplete.vim
index 436e371..c29967c 100644
--- a/autoload/rcomplete.vim
+++ b/autoload/rcomplete.vim
@@ -79,7 +79,7 @@ fun! rcomplete#CompleteR(findstart, base)
         endif
 
         if len(g:rplugin_liblist) == 0
-            call add(resp, {'word': a:base, 'menu': " [ List is empty. Did you load vimcom.plus package? ]"})
+            call add(resp, {'word': a:base, 'menu': " [ List is empty. Did you load vimcom package? ]"})
         endif
 
         let flines = g:rplugin_liblist + g:rplugin_globalenvlines
diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 88f3631..b3f3607 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -125,7 +125,7 @@ Before installing the plugin, you should install its dependencies:
 
    R >= 3.0.0: http://www.r-project.org/
 
-   vimcom.plus = 1.0-0: http://www.lepem.ufc.br/jaa/vimcom.plus.html
+   vimcom = 1.0-0: http://www.lepem.ufc.br/jaa/vimcom.html
 
    Tmux >= 1.8:   http://tmux.sourceforge.net
                   Tmux is necessary to send commands from Vim to R Console.
@@ -220,9 +220,9 @@ dependencies:
 
     * R's version must be >= 3.0.0: http://www.r-project.org/
 
-    * vimcom.plus = 1.0-0: http://www.lepem.ufc.br/jaa/vimcom.plus.html
+    * vimcom = 1.0-0: http://www.lepem.ufc.br/jaa/vimcom.html
 
-      Note: If you cannot build vimcom.plus yourself, you will want to
+      Note: If you cannot build vimcom yourself, you will want to
       download and install the zip file.
 
     * Vim's version must be >= 7.4: http://www.vim.org/download.php
@@ -314,7 +314,7 @@ you may prefer to install the Debian package available at:
    http://www.lepem.ufc.br/jaa/vim-r-plugin.html
 
 Did you see the message "VimCom port not found"? This means that R is not
-running, the vimcom.plus package is not installed (or is installed but is not
+running, the vimcom package is not installed (or is installed but is not
 loaded), or R was not started by Vim.
 
 
@@ -646,7 +646,7 @@ the |+clientserver| feature to be automatically updated and the |+conceal|
 feature to correctly align list items.
 
 In the .GlobalEnv view, if an object has the attribute "label", it will also
-be displayed. Please, see the R help for package vimcom.plus for some options
+be displayed. Please, see the R help for package vimcom for some options
 to control the Object Browser behavior. In the Object Browser window, while in
 Normal mode, you can either press  or double click (GVim only) over a
 data.frame or list to show/hide its elements (not if viewing the content of
@@ -963,13 +963,13 @@ operator. See: https://github.com/jcfaria/Vim-R-plugin/issues/94
 
 5.6. Wrong message that "R is busy" (Windows only)~
 
-On Windows, when code is sent from Vim to R Console, the vimcom.plus library
+On Windows, when code is sent from Vim to R Console, the vimcom library
 sets the value of the internal variable `r_is_busy` to 1. The value is set
 back to 0 when any code is successfully evaluated. If you send invalid code to
 R, there will be no successful evaluation of code and, thus, the value of
 `r_is_busy` will remain set to 1. Then, if you try to update the object
 browser, see the R documentation for any function, or do other tasks that
-require the hidden evaluation of code by R, the vimcom.plus library will
+require the hidden evaluation of code by R, the vimcom library will
 refuse to do the tasks to avoid any risk of corrupting R's memory. It will
 tell Vim that "R is busy" and Vim will display this message. Everything should
 work as expected again after any valid code is executed in the R Console.
@@ -981,10 +981,10 @@ Note: The bug described in this section does not affect Neovim.
 
 If you use MacVim, run Vim in the Linux Console or start Vim in a terminal
 emulator without the command line argument |--servername|, Vim will not
-receive remote messages and the vimcom.plus package will display one of the
+receive remote messages and the vimcom package will display one of the
 following messages:
 
-   MacVim isn't fully supported by vimcom.plus.
+   MacVim isn't fully supported by vimcom.
    Vim was built without the 'clientserver' feature.
    Did you pass the --servername argument to Vim?
    There is no X Server running.
@@ -1020,9 +1020,9 @@ Fedora/Red Hat. If you want to use Vim in a terminal emulator in Fedora/Red
 Hat, you may want to create a symbolic link to "gvim" named "vim". You still
 have to explicitly start the server with the argument |--servername|.
 
-The R package vimcom.plus has support only for Windows and X11 interprocess
+The R package vimcom has support only for Windows and X11 interprocess
 communication systems while MacVim is a Cocoa application, that is,
-vimcom.plus is unable to send messages to MacVim too. For vimcom.plus, running
+vimcom is unable to send messages to MacVim too. For vimcom, running
 MacVim is equivalent to running Vim without the |clientserver| feature.
 
 On Mac OS X, to get omnicompletion, syntax highlight of function names and the
@@ -1044,7 +1044,7 @@ through the rf command because the plugin was designed to connect
 each Vim instance with its own R instance. If you start R before Vim, it will
 not inherit from Vim the environment variables VIMRPLUGIN_TMPDIR,
 VIMRPLUGIN_HOME, VIMEDITOR_SVRNM and VIMINSTANCEID. The first one is the path
-used by the R package vimcom.plus to save temporary files used by the Vim-R-plugin
+used by the R package vimcom to save temporary files used by the Vim-R-plugin
 to: perform omnicompletion, show R documentation in a Vim buffer, and update
 the Object Browser. The last one is used by the Vim-R-plugin to know that it is
 not connecting to an R instance initiated by another Vim instance. If you use
@@ -1066,9 +1066,9 @@ procedures are necessary for all cases):
 <
    In R do:
 >
-   detach("package:vimcom.plus", unload = TRUE)
+   detach("package:vimcom", unload = TRUE)
    Sys.setenv(VIMRPLUGIN_TMPDIR="T") # where "T" is what Vim has echoed
-   library(vimcom.plus)
+   library(vimcom)
    Sys.setenv(VIMINSTANCEID="I")     # where "I" is what Vim has echoed
    Sys.setenv(VIMEDITOR_SVRNM"="S")  # where "S" is what Vim has echoed
    Sys.setenv(VIMRPLUGIN_HOME"="H")  # where "H" is what Vim has echoed
@@ -1146,7 +1146,7 @@ is running:
 |vimrplugin_source|            Source additional scripts
 |vimrplugin_restart|           Restart R if it is already running
 |vimrplugin_show_args|         Show extra information during omnicompletion
-|vimrplugin_vimcom_wait|       Time to wait for vimcom.plus loading
+|vimrplugin_vimcom_wait|       Time to wait for vimcom loading
 |vimrplugin_vim_wd|            Start R in Vim's working directory
 
 
@@ -1499,7 +1499,7 @@ Example:
 6.19. LaTeX command~
 							 *vimrplugin_latexcmd*
 						       *vimrplugin_sweaveargs*
-On Windows, the vimcom.plus package calls `tools::texi2dvi()` to build the pdf
+On Windows, the vimcom package calls `tools::texi2dvi()` to build the pdf
 from the generated .tex file. On Linux/Unix, by default, it calls
 `latexmk` `-pdf` to produce a pdf document from the .tex file produced by
 either `Sweave()` or `knit()` command. If `latexmk` is not installed, it calls
@@ -1696,26 +1696,26 @@ run  to complete the function arguments. The preview window
 will be shown only if "preview" is also included in your 'completeopt'.
 
 
-6.30. Time to wait for vimcom.plus loading~
+6.30. Time to wait for vimcom loading~
 						      *vimrplugin_vimcom_wait*
-The Vim-R-plugin waits 5000 milliseconds for vimcom.plus package to be loaded
+The Vim-R-plugin waits 5000 milliseconds for vimcom package to be loaded
 during R startup. It then checks whether you are using the correct version of
-vimcom.plus. On Unix, it also sends a message to R update the list of uploaded
+vimcom. On Unix, it also sends a message to R update the list of uploaded
 libraries and, then, immediately updates the syntax highlighting of function
 names. If 5000 milliseconds is not enough to your R startup, then set a higher
 value for the variable in your |vimrc|. Example:
 >
    let vimrplugin_vimcom_wait = 10000
 <
-Note: You should have the line  `library(vimcom.plus)`  in your Rprofile. The
+Note: You should have the line  `library(vimcom)`  in your Rprofile. The
 Vim command  :RpluginConfig  adds that line for you.
 
 The plugin has a different behavior with Neovim: it receives a message from
-vimcom.plus as soon as it is loaded and warns if the package was not loaded
+vimcom as soon as it is loaded and warns if the package was not loaded
 after 15 seconds of sending the command to start R. If you need more than 15
 seconds, change the value of vimrplugin_vimcom_wait.
 
-If you do not want to install the vimcom.plus package, then put in your
+If you do not want to install the vimcom package, then put in your
 |vimrc|:
 >
    let vimrplugin_vimcom_wait = -1
@@ -2023,7 +2023,7 @@ Vim can jump to a function definition if it finds a "tags" file with the
 information about the place where the function is defined. To generate the
 tags file, use the R function `rtags()`, which will build an Emacs tags file.
 If Vim was compiled with the feature |emacs_tags|, it will be able to read the
-tags file. Otherwise, you can use the vimcom.plus function `etags2ctags()` to
+tags file. Otherwise, you can use the vimcom function `etags2ctags()` to
 convert the Emacs tags file into a Vim's one. To jump to a function
 definition, put the cursor over the function name and hit CTRL-]. Please, read
 |tagsrch.txt| for details on how to use tags files, specially the section
@@ -2449,9 +2449,9 @@ please read this document from the beginning.
        }
        # Load the setwidth library:
        library(setwidth)
-       # Load the vimcom.plus library only if R was started by Vim:
+       # Load the vimcom library only if R was started by Vim:
        if(Sys.getenv("VIMRPLUGIN_TMPDIR") != ""){
-           library(vimcom.plus)
+           library(vimcom)
            # See R documentation on Vim buffer even if asking for help in R Console:
            if(Sys.getenv("VIM_PANE") != "")
                options(help_type = "text", pager = vim.pager)
@@ -2550,7 +2550,10 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details.
 							       *r-plugin-news*
 10. News~
 
-1.0 (2014-06-14)
+1.0 (2014-06-30)
+
+ * The package now depends on vimcom (which is fully featured and is no longer
+   on CRAN).
 
  * Neovim support.
 
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 1799855..99773ab 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -51,13 +51,8 @@ function RWarningMsgInp(wmsg)
     let savedsm = &shortmess
     set shortmess-=T
     echohl WarningMsg
-    echomsg a:wmsg
+    call input(a:wmsg . " [Press  to continue] ")
     echohl Normal
-    " The message disappears if starting to edit an empty buffer
-    if line("$") == 1 && strlen(getline("$")) == 0
-        sleep 2
-    endif
-    call input("[Press  to continue] ")
     if savedlz == 0
         set nolazyredraw
     endif
@@ -152,7 +147,7 @@ function RCheckVimCom(msg)
         endif
     endif
     if g:rplugin_vimcomport && g:rplugin_vimcom_pkg == "vimcom"
-	call RWarningMsg("The R package vimcom.plus is required to " . a:msg)
+	call RWarningMsg("The R package vimcom is required to " . a:msg)
         return 1
     endif
     return 0
@@ -956,13 +951,13 @@ function ReceiveVimComStartMsg(msg)
     if len(vmsg) == 4
         if vmsg[0] == "vimcom"
             let g:rplugin_vimcom_pkg = "vimcom"
-        elseif vmsg[0] == "vimcom.plus"
-            let g:rplugin_vimcom_pkg = "vimcom.plus"
+        elseif vmsg[0] == "vimcom"
+            let g:rplugin_vimcom_pkg = "vimcom"
         else
             call RWarningMsg("Invalid package name: " . vmsg[0])
         endif
-        if vmsg[1] != "1.0-0_a3"
-            call RWarningMsg('This version of Vim-R-plugin requires vimcom.plus 1.0-0_a3.')
+        if vmsg[1] != "1.0-0_a4"
+            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.0-0_a4.')
         endif
         if vmsg[2] != $VIMINSTANCEID
             call RWarningMsg("Invalid ID: " . vmsg[2] . " [Correct = " . $VIMINSTANCEID . "]")
@@ -972,7 +967,7 @@ function ReceiveVimComStartMsg(msg)
             " Give vimcom some time to complete its startup process
             sleep 20m
         else
-            call RWarningMsg("Invalid vimcom.plus port: " . vmsg[2])
+            call RWarningMsg("Invalid vimcom port: " . vmsg[2])
         endif
     endif
 endfunction
@@ -981,7 +976,7 @@ function NoLongerWaitVimCom()
     if filereadable($VIMRPLUGIN_TMPDIR . "/vimcom_running")
         call delete($VIMRPLUGIN_TMPDIR . "/vimcom_running")
     else
-        call RWarningMsg("The package vimcom.plus wasn't loaded yet.")
+        call RWarningMsg("The package vimcom wasn't loaded yet.")
     endif
 endfunction
 
@@ -1006,7 +1001,7 @@ function WaitVimComStart()
     while !filereadable($VIMRPLUGIN_TMPDIR . "/vimcom_running") && ii < g:vimrplugin_vimcom_wait
         let ii = ii + 200
         if ii == 1000
-            echo "Waiting vimcom.plus loading..."
+            echo "Waiting vimcom loading..."
             let waitmsg = 1
         endif
         sleep 200m
@@ -1018,26 +1013,26 @@ function WaitVimComStart()
     sleep 100m
     if filereadable($VIMRPLUGIN_TMPDIR . "/vimcom_running")
         let vr = readfile($VIMRPLUGIN_TMPDIR . "/vimcom_running")
-        if vr[0] =~ "vimcom.plus"
-            let g:rplugin_vimcom_pkg = "vimcom.plus"
+        if vr[0] =~ "vimcom"
+            let g:rplugin_vimcom_pkg = "vimcom"
         else
             let g:rplugin_vimcom_pkg = "vimcom"
         endif
         if vr[2] == $VIMINSTANCEID
             let g:rplugin_vimcom_version = vr[1]
-            if g:rplugin_vimcom_version != "1.0-0_a3"
-                call RWarningMsg('This version of Vim-R-plugin requires vimcom.plus 1.0-0_a3.')
+            if g:rplugin_vimcom_version != "1.0-0_a4"
+                call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.0-0_a4.')
                 sleep 1
             endif
         else
             let g:rplugin_vimcom_version = 0
-            call RWarningMsg("Vim-R-plugin and vimcom.plus IDs don't match.")
+            call RWarningMsg("Vim-R-plugin and vimcom IDs don't match.")
             sleep 1
         endif
         call delete($VIMRPLUGIN_TMPDIR . "/vimcom_running")
         return 1
     else
-        call RWarningMsg("The package vimcom.plus wasn't loaded yet.")
+        call RWarningMsg("The package vimcom wasn't loaded yet.")
         sleep 300m
         return 0
     endif
@@ -1196,7 +1191,7 @@ endfunction
 
 function StartObjBrowser_Vim()
     if has("win32") || has("win64")
-	" The vimcom.plus server will stop working if starting the Object
+	" The vimcom server will stop working if starting the Object
 	" Browser is the first thing the user does.
 	if !exists("g:rplugin_liblist_filled")
 	    call RWarningMsg("Please, try again after sending at least one line of code to the R Console.!")
@@ -2207,7 +2202,7 @@ function RCheckLibListFile()
     endif
 endfunction
 
-" This function is called by the R package vimcom.plus whenever a library is
+" This function is called by the R package vimcom whenever a library is
 " loaded.
 function RFillLibList()
     if &filetype == "r" || has("neovim")
@@ -3953,3 +3948,20 @@ else
     let g:rplugin_has_icons = len(globpath(&rtp, "bitmaps/RStart.png")) > 0
 endif
 
+" Check whether the user has the vimcom.plus string in the Rprofile
+if filereadable(expand("~/.Rprofile"))
+    let s:rpf = expand("~/.Rprofile")
+elseif filereadable(expand("~/Documents/.Rprofile"))
+    let s:rpf = expand("~/Documents/.Rprofile")
+endif
+if exists("s:rpf")
+    let s:rplines = readfile(s:rpf)
+    for line in s:rplines
+        if line =~ "library\.*vimcom.plus" || line =~ "require.*vimcom\.plus"
+            call RWarningMsgInp('The string "vimcom.plus" was found in "' . s:rpf . '". However, the package "vimcom.plus" no longer exists, and you should rename it to "vimcom" in your Rprofile.')
+            break
+        endif
+    endfor
+    unlet s:rpf
+endif
+
diff --git a/r-plugin/nvimcom.py b/r-plugin/nvimcom.py
index 2177b7f..34b045f 100644
--- a/r-plugin/nvimcom.py
+++ b/r-plugin/nvimcom.py
@@ -56,8 +56,8 @@ def DiscoverVimComPort():
         print "let g:rplugin_vimcomport = " + str(VimComPort) + "\n"
         sys.stdout.flush()
         PortWarn = False
-        if repl.find("1.0-0_a3") != 0:
-            print "call RWarningMsg('This version of Vim-R-plugin requires vimcom.plus 1.0-0_a3.')\n"
+        if repl.find("1.0-0_a4") != 0:
+            print "call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.0-0_a4.')\n"
             sys.stdout.flush()
         return
 
diff --git a/r-plugin/objlist/README b/r-plugin/objlist/README
index a0bee4e..e92d250 100644
--- a/r-plugin/objlist/README
+++ b/r-plugin/objlist/README
@@ -1,5 +1,5 @@
 The omnils_ and fun_ files in this directory are generated by Vim-R-plugin and
-vimcom.plus and are used for omni completion and syntax highlight.
+vimcom and are used for omni completion and syntax highlight.
 
 You should manually delete files corresponding to libraries that you no longer
 use.
diff --git a/r-plugin/vimcom.py b/r-plugin/vimcom.py
index 06fa8bf..11bea6b 100644
--- a/r-plugin/vimcom.py
+++ b/r-plugin/vimcom.py
@@ -52,8 +52,8 @@ def DiscoverVimComPort():
     else:
         vim.command("let g:rplugin_vimcomport = " + str(VimComPort))
         PortWarn = False
-        if repl.find("1.0-0_a3") != 0:
-            vim.command("call RWarningMsg('This version of Vim-R-plugin requires vimcom.plus 1.0-0_a3.')")
+        if repl.find("1.0-0_a4") != 0:
+            vim.command("call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.0-0_a4.')")
             vim.command("sleep 1")
     return(VimComPort)
 
diff --git a/r-plugin/vimrconfig.vim b/r-plugin/vimrconfig.vim
index 6eadc7c..d4454ab 100644
--- a/r-plugin/vimrconfig.vim
+++ b/r-plugin/vimrconfig.vim
@@ -101,9 +101,9 @@ function! RConfigRprofile()
             endif
             if has("win32") || has("win64")
                 let rpflines += ['    if(Sys.getenv("VIMRPLUGIN_TMPDIR") != "")',
-                            \ '        library(vimcom.plus)']
+                            \ '        library(vimcom)']
             else
-                let rpflines += ['    library(vimcom.plus)']
+                let rpflines += ['    library(vimcom)']
             endif
 
             if !(has("win32") || has("win64"))

From 7fe06f62b10307d04e8af673c1d76105559f9359 Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Mon, 30 Jun 2014 21:09:44 -0300
Subject: [PATCH 0717/1050] No longer check whether the package is vimcom.
 Because there is no vimcom.plus anymore, there is no need to check whether
 the package is vimcom or vimcom.plus.

---
 autoload/rcomplete.vim     | 11 -------
 r-plugin/common_global.vim | 65 ++------------------------------------
 2 files changed, 3 insertions(+), 73 deletions(-)

diff --git a/autoload/rcomplete.vim b/autoload/rcomplete.vim
index c29967c..48c22d9 100644
--- a/autoload/rcomplete.vim
+++ b/autoload/rcomplete.vim
@@ -9,17 +9,6 @@ function BuildROmniList()
     if string(g:SendCmdToR) == "function('SendCmdToR_fake')"
         return
     endif
-    if has("win32") || has("win64") && g:rplugin_vimcom_pkg == "vimcom"
-        if !exists("g:rplugin_vimcom_omni_warn")
-            let g:rplugin_vimcom_omni_warn = 1
-            if RCheckVimCom("complete the names of objects from R's workspace.")
-                sleep 2
-                return
-            endif
-        else
-            return
-        endif
-    endif
 
     let omnilistcmd = 'vim.bol("' . $VIMRPLUGIN_TMPDIR . "/GlobalEnvList_" . $VIMINSTANCEID . '"'
     if g:vimrplugin_allnames == 1
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 99773ab..5a5ebf2 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -135,24 +135,6 @@ function! ReadEvalReply()
     return reply
 endfunction
 
-function RCheckVimCom(msg)
-    if exists("g:rplugin_vimcom_checked")
-        return 1
-    endif
-    if g:rplugin_vimcomport == 0
-        if has("neovim")
-            call jobwrite(g:rplugin_clt_job, "DiscoverVimComPort\n")
-        else
-            Py DiscoverVimComPort()
-        endif
-    endif
-    if g:rplugin_vimcomport && g:rplugin_vimcom_pkg == "vimcom"
-	call RWarningMsg("The R package vimcom is required to " . a:msg)
-        return 1
-    endif
-    return 0
-endfunction
-
 function! CompleteChunkOptions()
     let cline = getline(".")
     let cpos = getpos(".")
@@ -249,12 +231,6 @@ function RCompleteArgs()
     let np = 1
     let nl = 0
 
-    if has("win32") || has("win64") && g:rplugin_vimcom_pkg == "vimcom"
-        if RCheckVimCom("complete function arguments.")
-            return
-        endif
-    endif
-
     while np != 0 && nl < 10
         if line[idx] == '('
             let np -= 1
@@ -274,9 +250,9 @@ function RCompleteArgs()
             if string(g:SendCmdToR) != "function('SendCmdToR_fake')"
                 call delete($VIMRPLUGIN_TMPDIR . "/eval_reply")
                 if has("neovim")
-                    let msg = "I\002" . g:rplugin_vimcom_pkg . ':::vim.args("'
+                    let msg = "I\002" . 'vimcom:::vim.args("'
                 else
-                    let msg = g:rplugin_vimcom_pkg . ':::vim.args("'
+                    let msg = 'vimcom:::vim.args("'
                 endif
                 if classfor == ""
                     let msg = msg . rkeyword0 . '", "' . argkey . '"'
@@ -949,11 +925,7 @@ endfunction
 function ReceiveVimComStartMsg(msg)
     let vmsg = split(a:msg)
     if len(vmsg) == 4
-        if vmsg[0] == "vimcom"
-            let g:rplugin_vimcom_pkg = "vimcom"
-        elseif vmsg[0] == "vimcom"
-            let g:rplugin_vimcom_pkg = "vimcom"
-        else
+        if vmsg[0] != "vimcom"
             call RWarningMsg("Invalid package name: " . vmsg[0])
         endif
         if vmsg[1] != "1.0-0_a4"
@@ -1013,11 +985,6 @@ function WaitVimComStart()
     sleep 100m
     if filereadable($VIMRPLUGIN_TMPDIR . "/vimcom_running")
         let vr = readfile($VIMRPLUGIN_TMPDIR . "/vimcom_running")
-        if vr[0] =~ "vimcom"
-            let g:rplugin_vimcom_pkg = "vimcom"
-        else
-            let g:rplugin_vimcom_pkg = "vimcom"
-        endif
         if vr[2] == $VIMINSTANCEID
             let g:rplugin_vimcom_version = vr[1]
             if g:rplugin_vimcom_version != "1.0-0_a4"
@@ -1277,12 +1244,6 @@ function RObjBrowser()
         return
     endif
 
-    if has("win32") || has("win64") && g:rplugin_vimcom_pkg == "vimcom"
-        if RCheckVimCom("run the Object Browser on Windows.")
-            return
-        endif
-    endif
-
     if g:rplugin_running_objbr == 1
         " Called twice due to BufEnter event
         return
@@ -1433,12 +1394,6 @@ function RFormatCode() range
         endif
     endif
 
-    if has("win32") || has("win64") && g:rplugin_vimcom_pkg == "vimcom"
-        if RCheckVimCom("run :Rformat.")
-            return
-        endif
-    endif
-
     let lns = getline(a:firstline, a:lastline)
     call writefile(lns, $VIMRPLUGIN_TMPDIR . "/unformatted_code")
     let wco = &textwidth
@@ -1478,12 +1433,6 @@ function RInsert(cmd)
         endif
     endif
 
-    if has("win32") || has("win64") && g:rplugin_vimcom_pkg == "vimcom"
-        if RCheckVimCom("run :Rinsert.")
-            return
-        endif
-    endif
-
     call delete($VIMRPLUGIN_TMPDIR . "/eval_reply")
     call delete($VIMRPLUGIN_TMPDIR . "/Rinsert")
     call g:SendToVimCom('capture.output(' . a:cmd . ', file = "' . $VIMRPLUGIN_TMPDIR . '/Rinsert")')
@@ -2133,7 +2082,6 @@ function RQuit(how)
     call delete($VIMRPLUGIN_TMPDIR . "/vimcom_running")
     let g:SendCmdToR = function('SendCmdToR_fake')
     let g:rplugin_vimcomport = 0
-    let g:rplugin_vimcom_pkg = "vimcom"
     if g:rplugin_tmuxwasfirst && g:vimrplugin_tmux_title != "automatic" && g:vimrplugin_tmux_title != ""
         call system("tmux set automatic-rename on")
     endif
@@ -2378,12 +2326,6 @@ function ShowRDoc(rkeyword, package, getclass)
         return
     endif
 
-    if (has("win32") || has("win64")) && g:rplugin_vimcom_pkg == "vimcom"
-        if RCheckVimCom("see R help on Vim buffer.")
-            return
-        endif
-    endif
-
     if filewritable(g:rplugin_docfile)
         call delete(g:rplugin_docfile)
     endif
@@ -3888,7 +3830,6 @@ let g:rplugin_newliblist = 0
 let g:rplugin_ob_warn_shown = 0
 let g:rplugin_myport = 0
 let g:rplugin_vimcomport = 0
-let g:rplugin_vimcom_pkg = "vimcom"
 let g:rplugin_vimcom_version = 0
 let g:rplugin_lastrpl = ""
 let g:rplugin_lastev = ""

From f30cf21f9e066c0d3267a8f5d3c3e4289aa90737 Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Wed, 2 Jul 2014 14:18:15 -0300
Subject: [PATCH 0718/1050] Version 1.0.

---
 doc/r-plugin.txt           | 2 +-
 r-plugin/common_global.vim | 8 ++++----
 r-plugin/nvimcom.py        | 4 ++--
 r-plugin/vimcom.py         | 4 ++--
 4 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index b3f3607..6785a64 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -2550,7 +2550,7 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details.
 							       *r-plugin-news*
 10. News~
 
-1.0 (2014-06-30)
+1.0 (2014-07-02)
 
  * The package now depends on vimcom (which is fully featured and is no longer
    on CRAN).
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 5a5ebf2..2256a8b 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -928,8 +928,8 @@ function ReceiveVimComStartMsg(msg)
         if vmsg[0] != "vimcom"
             call RWarningMsg("Invalid package name: " . vmsg[0])
         endif
-        if vmsg[1] != "1.0-0_a4"
-            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.0-0_a4.')
+        if vmsg[1] != "1.0-0"
+            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.0-0.')
         endif
         if vmsg[2] != $VIMINSTANCEID
             call RWarningMsg("Invalid ID: " . vmsg[2] . " [Correct = " . $VIMINSTANCEID . "]")
@@ -987,8 +987,8 @@ function WaitVimComStart()
         let vr = readfile($VIMRPLUGIN_TMPDIR . "/vimcom_running")
         if vr[2] == $VIMINSTANCEID
             let g:rplugin_vimcom_version = vr[1]
-            if g:rplugin_vimcom_version != "1.0-0_a4"
-                call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.0-0_a4.')
+            if g:rplugin_vimcom_version != "1.0-0"
+                call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.0-0.')
                 sleep 1
             endif
         else
diff --git a/r-plugin/nvimcom.py b/r-plugin/nvimcom.py
index 34b045f..afc925b 100644
--- a/r-plugin/nvimcom.py
+++ b/r-plugin/nvimcom.py
@@ -56,8 +56,8 @@ def DiscoverVimComPort():
         print "let g:rplugin_vimcomport = " + str(VimComPort) + "\n"
         sys.stdout.flush()
         PortWarn = False
-        if repl.find("1.0-0_a4") != 0:
-            print "call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.0-0_a4.')\n"
+        if repl.find("1.0-0") != 0:
+            print "call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.0-0.')\n"
             sys.stdout.flush()
         return
 
diff --git a/r-plugin/vimcom.py b/r-plugin/vimcom.py
index 11bea6b..6559bc0 100644
--- a/r-plugin/vimcom.py
+++ b/r-plugin/vimcom.py
@@ -52,8 +52,8 @@ def DiscoverVimComPort():
     else:
         vim.command("let g:rplugin_vimcomport = " + str(VimComPort))
         PortWarn = False
-        if repl.find("1.0-0_a4") != 0:
-            vim.command("call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.0-0_a4.')")
+        if repl.find("1.0-0") != 0:
+            vim.command("call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.0-0.')")
             vim.command("sleep 1")
     return(VimComPort)
 

From aac9b9f941da55e13ae2ed5c1c1f2b829e3aca22 Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Fri, 4 Jul 2014 09:40:46 -0300
Subject: [PATCH 0719/1050] Always set the correct value of $VIMINSTANCEID. Fix
 issue #106.

---
 r-plugin/common_global.vim | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 2256a8b..aa2e293 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -1047,6 +1047,10 @@ function StartObjBrowser_Tmux()
         return
     endif
 
+    " The $VIMINSTANCEID may have been reset by another Vim instance in the
+    " same Tmux session:
+    call system("tmux set-environment VIMINSTANCEID " . $VIMINSTANCEID)
+
     let objbrowserfile = $VIMRPLUGIN_TMPDIR . "/objbrowserInit"
     let tmxs = " "
 
@@ -3838,7 +3842,11 @@ let g:rplugin_tmuxsname = "VimR-" . substitute(localtime(), '.*\(...\)', '\1', '
 
 " If this is the Object Browser running in a Tmux pane, $VIMINSTANCEID is
 " already defined and shouldn't be changed
-if $VIMINSTANCEID == ""
+if &filetype == "rbrowser"
+    if $VIMINSTANCEID == ""
+        call RWarningMsgInp("VIMINSTANCEID is undefined")
+    endif
+else
     let $VIMINSTANCEID = substitute(g:rplugin_firstbuffer, '\W', '', 'g') . substitute(localtime(), '.*\(...\)', '\1', '')
     if strlen($VIMINSTANCEID) > 64
         let $VIMINSTANCEID = substitute($VIMINSTANCEID, '.*\(...............................................................\)', '\1', '')

From 4dcebf3819bbdcdeb7f54a509d9c153f84917fdc Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Sun, 6 Jul 2014 09:17:12 -0300
Subject: [PATCH 0720/1050] Set VIMINTANCEID after OB start up.

---
 r-plugin/common_global.vim | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index aa2e293..a929412 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -1047,10 +1047,6 @@ function StartObjBrowser_Tmux()
         return
     endif
 
-    " The $VIMINSTANCEID may have been reset by another Vim instance in the
-    " same Tmux session:
-    call system("tmux set-environment VIMINSTANCEID " . $VIMINSTANCEID)
-
     let objbrowserfile = $VIMRPLUGIN_TMPDIR . "/objbrowserInit"
     let tmxs = " "
 
@@ -1069,6 +1065,7 @@ function StartObjBrowser_Tmux()
                 \ 'let g:rplugin_vim_pane = "' . g:rplugin_vim_pane . '"',
                 \ 'let g:rplugin_rconsole_pane = "' . g:rplugin_rconsole_pane . '"',
                 \ 'let b:objbrtitle = "' . b:objbrtitle . '"',
+                \ 'let $VIMINSTANCEID = "' . $VIMINSTANCEID . '"',
                 \ 'let showmarks_enable = 0',
                 \ 'let g:rplugin_tmuxsname = "' . g:rplugin_tmuxsname . '"',
                 \ 'let b:rscript_buffer = "' . bufname("%") . '"',

From a5aa3f33efa644fca506756bdb4d86efd93ce545 Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Mon, 7 Jul 2014 22:44:47 -0300
Subject: [PATCH 0721/1050] Add tip on global shortcut like Windows hotkeys.

---
 Makefile         |  2 +-
 doc/r-plugin.txt | 21 ++++++++++++++++++++-
 2 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 8ac1feb..edd33b2 100644
--- a/Makefile
+++ b/Makefile
@@ -22,7 +22,7 @@
 
 
 PLUGINHOME=`pwd`
-PLUGINVERSION=1.0
+PLUGINVERSION=1.0.1
 DEBIANTIME=`date -R`
 PLUGINRELEASEDATE=`date +"%Y-%m-%d"`
 VIM2HTML=/usr/local/share/vim/vim74/doc/vim2html.pl 
diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 6785a64..9b22171 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -5,7 +5,7 @@
 Authors: Jakson A. Aquino   
          Jose Claudio Faria 
 
-Version: 1.0
+Version: 1.0.1
 For Vim version 7.4
 
  1. Overview                                    |r-plugin-overview|
@@ -2006,6 +2006,21 @@ You may also want to remap :
 
    http://stackoverflow.com/questions/2269005/how-can-i-change-the-keybinding-used-to-autocomplete-in-vim
 
+You can also use Vim's 'clientserver' feature to send remote messages to Vim.
+For example, if you want a keyboard shortcut that sends to Vim the command to
+send the current line to R and go down to the next line of code, then use your
+desktop configuration tools to create a global shortcut to the following
+command:
+>
+   vim --remote-expr 'SendLineToR("down")'
+<
+The command above will work properly only if there is a single Vim instance
+running. Otherwise, the |--servername| argument would have to be used to send
+the message to the correct Vim instance. If the command works properly, you
+will be able to send lines of code from Vim to R even if the window
+currently focused is not the Vim's window (either the terminal emulator where
+Vim is running or GVim).
+
 
 9.6. Remap the ~
 							*r-plugin-localleader*
@@ -2550,6 +2565,10 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details.
 							       *r-plugin-news*
 10. News~
 
+1.0.1 (2014-07-07)
+
+ * Minor bug fixes.
+
 1.0 (2014-07-02)
 
  * The package now depends on vimcom (which is fully featured and is no longer

From 34b4021fc91e9695710f0b638ded7018a74a25c1 Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Wed, 9 Jul 2014 22:09:53 -0300
Subject: [PATCH 0722/1050] Update tip on global_r_plugin.vim

---
 doc/r-plugin.txt | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 9b22171..abf74e5 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -2248,20 +2248,16 @@ on top" or a similar option provided by your desktop manager.
 The Vim-R-plugin is a file type plugin. If you want its functionality
 available for all file types, then put in your |vimrc|:
 >
-   source path/to/Vim-R-plugin/r-plugin/global_r_plugin.vim
+   runtime r-plugin/global_r_plugin.vim
 <
 You will then be able to type rf to start and rq to
 quit different command line interpreters and d, l, ss, bb, etc to
 send code to the interpreter. If you want support for a language other than
 Julia, Python, Haskell, Ruby and Lisp, you have to set the values of
-vimrplugin_exe and vimrplugin_quit as the example below does for Octave:
->
-   let vimrplugin_exe = "octave"
-   let vimrplugin_quit = "quit"
-<
-If you use yet another interpreter, you will want to put the commands above in
-a Vim autocommand:
+vimrplugin_exe and vimrplugin_quit in two Vim auto commands in your |vimrc|,
+BEFORE the `runtime` command above. Example:
 >
+   autocmd FileType matlab let vimrplugin_exe = "octave" | let vimrplugin_quit = "quit"
    autocmd BufNewFile,BufRead *.m let vimrplugin_exe = "octave" | let vimrplugin_quit = "quit"
 <
 If you use GVim, you may also want to set |vimrplugin_never_unmake_menu| in

From 87a02c7afe94b8d73dc08adb6186aedc63bb4537 Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Thu, 10 Jul 2014 13:27:33 -0300
Subject: [PATCH 0723/1050] Add syntax sync to syntax/r.vim.

---
 syntax/r.vim | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/syntax/r.vim b/syntax/r.vim
index 8d3edff..0caeded 100644
--- a/syntax/r.vim
+++ b/syntax/r.vim
@@ -3,9 +3,9 @@
 " Maintainer:	      Jakson Aquino 
 " Former Maintainers: Vaidotas Zemlys 
 " 		      Tom Payne 
-" Last Change:	      Tue Jun 17, 2014  06:52PM
+" Last Change:	      Thu Jul 10, 2014  01:27PM
 " Filenames:	      *.R *.r *.Rhistory *.Rt
-" 
+"
 " NOTE: The highlighting of R functions is defined in the
 " r-plugin/functions.vim, which is part of vim-r-plugin2:
 " http://www.vim.org/scripts/script.php?script_id=2628
@@ -79,12 +79,12 @@ syn keyword rRepeat      for in repeat while
 syn keyword rConstant T F LETTERS letters month.abb month.name pi
 syn keyword rConstant R.version.string
 
-syn keyword rNumber   NA_integer_ NA_real_ NA_complex_ NA_character_ 
+syn keyword rNumber   NA_integer_ NA_real_ NA_complex_ NA_character_
 
 " Constants
 syn keyword rConstant NULL
 syn keyword rBoolean  FALSE TRUE
-syn keyword rNumber   NA Inf NaN 
+syn keyword rNumber   NA Inf NaN
 
 " integer
 syn match rInteger "\<\d\+L"
@@ -93,7 +93,7 @@ syn match rInteger "\<\d\+[Ee]+\=\d\+L"
 
 " number with no fractional part or exponent
 syn match rNumber "\<\d\+\>"
-" hexadecimal number 
+" hexadecimal number
 syn match rNumber "\<0x\([0-9]\|[a-f]\|[A-F]\)\+"
 
 " floating point number with integer and fractional parts and optional exponent
@@ -171,7 +171,7 @@ if &filetype == "rhelp"
 endif
 
 " Type
-syn keyword rType array category character complex double function integer list logical matrix numeric vector data.frame 
+syn keyword rType array category character complex double function integer list logical matrix numeric vector data.frame
 
 " Name of object with spaces
 if &filetype != "rmd" && &filetype != "rrst"
@@ -179,11 +179,17 @@ if &filetype != "rmd" && &filetype != "rrst"
 endif
 
 if &filetype == "rhelp"
-    syn match rhPreProc "^#ifdef.*" 
-    syn match rhPreProc "^#endif.*" 
+    syn match rhPreProc "^#ifdef.*"
+    syn match rhPreProc "^#endif.*"
     syn match rhSection "\\dontrun\>"
 endif
 
+if exists("r_syn_minlines")
+    exe "syn sync minlines=" . r_syn_minlines
+else
+    syn sync minlines=40
+endif
+
 " Define the default highlighting.
 hi def link rArrow       Statement	
 hi def link rBoolean     Boolean

From ad6df92b1a5b12bc0562caac33d505a11f8b1fd5 Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Thu, 10 Jul 2014 19:05:06 -0300
Subject: [PATCH 0724/1050] Use 'indentexpr' defined by sourced scripts. After
 sourcing either LaTeX or R indenting scripts, use as indent function whatever
 function was defined as 'indentexpr' by the script instead of relying on any
 fix name.

---
 indent/rhelp.vim  |  6 +++---
 indent/rmd.vim    | 10 +++++-----
 indent/rnoweb.vim | 19 ++++++++-----------
 indent/rrst.vim   | 10 +++++-----
 4 files changed, 21 insertions(+), 24 deletions(-)

diff --git a/indent/rhelp.vim b/indent/rhelp.vim
index 0441a02..3d4aeef 100644
--- a/indent/rhelp.vim
+++ b/indent/rhelp.vim
@@ -1,8 +1,7 @@
 " Vim indent file
 " Language:	R Documentation (Help), *.Rd
 " Author:	Jakson Alves de Aquino 
-" URL:		http://www.vim.org/scripts/script.php?script_id=2628
-" Last Change:	Fri Feb 15, 2013  09:46PM
+" Last Change:	Thu Jul 10, 2014  06:50PM
 
 
 " Only load this indent file when no other was loaded.
@@ -10,6 +9,7 @@ if exists("b:did_indent")
     finish
 endif
 runtime indent/r.vim
+let s:RIndent = function(substitute(&indentexpr, "()", "", ""))
 let b:did_indent = 1
 
 setlocal indentkeys=0{,0},:,!^F,o,O,e
@@ -102,7 +102,7 @@ function GetCorrectRHelpIndent()
     let lastsection = search('^\\[a-z]*{', "bncW")
     let secname = getline(lastsection)
     if secname =~ '^\\usage{' || secname =~ '^\\examples{' || secname =~ '^\\dontshow{' || secname =~ '^\\dontrun{' || secname =~ '^\\donttest{' || secname =~ '^\\testonly{' || secname =~ '^\\method{.*}{.*}('
-        return GetRIndent()
+        return s:RIndent()
     else
         return GetRHelpIndent()
     endif
diff --git a/indent/rmd.vim b/indent/rmd.vim
index 9b586fb..56c661d 100644
--- a/indent/rmd.vim
+++ b/indent/rmd.vim
@@ -1,8 +1,7 @@
 " Vim indent file
 " Language:	Rmd
 " Author:	Jakson Alves de Aquino 
-" URL:		http://www.vim.org/scripts/script.php?script_id=2628
-" Last Change:	Fri Feb 15, 2013  09:46PM
+" Last Change:	Thu Jul 10, 2014  06:58PM
 
 
 " Only load this indent file when no other was loaded.
@@ -10,6 +9,7 @@ if exists("b:did_indent")
   finish
 endif
 runtime indent/r.vim
+let s:RIndent = function(substitute(&indentexpr, "()", "", ""))
 let b:did_indent = 1
 
 setlocal indentkeys=0{,0},:,!^F,o,O,e
@@ -34,12 +34,12 @@ endfunction
 
 function GetRmdIndent()
     if getline(".") =~ '^```{r .*}$' || getline(".") =~ '^```$'
-	return 0
+       return 0
     endif
     if search('^```{r', "bncW") > search('^```$', "bncW")
-	return GetRIndent()
+       return s:RIndent()
     else
-	return GetMdIndent()
+       return GetMdIndent()
     endif
 endfunction
 
diff --git a/indent/rnoweb.vim b/indent/rnoweb.vim
index 4dcd996..357d83b 100644
--- a/indent/rnoweb.vim
+++ b/indent/rnoweb.vim
@@ -1,22 +1,20 @@
 " Vim indent file
 " Language:	Rnoweb
 " Author:	Jakson Alves de Aquino 
-" URL:		http://www.vim.org/scripts/script.php?script_id=2628
-" Last Change:	Fri Feb 15, 2013  09:47PM
+" Last Change:	Thu Jul 10, 2014  06:56PM
 
 
 " Only load this indent file when no other was loaded.
 if exists("b:did_indent")
   finish
 endif
-runtime indent/r.vim
+runtime indent/tex.vim
+let s:TeXIndent = function(substitute(&indentexpr, "()", "", ""))
 unlet b:did_indent
-runtime r-plugin/tex_indent.vim
+runtime indent/r.vim
+let s:RIndent = function(substitute(&indentexpr, "()", "", ""))
 let b:did_indent = 1
 
-
-
-
 setlocal indentkeys=0{,0},!^F,o,O,e,},=\bibitem,=\item
 setlocal indentexpr=GetRnowebIndent()
 
@@ -26,12 +24,11 @@ endif
 
 function GetRnowebIndent()
     if getline(".") =~ "^<<.*>>=$"
-	return 0
+       return 0
     endif
     if search("^<<", "bncW") > search("^@", "bncW")
-	return GetRIndent()
-    else
-	return GetTeXIndent2()
+       return s:RIndent()
     endif
+    return s:TeXIndent()
 endfunction
 
diff --git a/indent/rrst.vim b/indent/rrst.vim
index a26cca2..9a54157 100644
--- a/indent/rrst.vim
+++ b/indent/rrst.vim
@@ -1,8 +1,7 @@
 " Vim indent file
 " Language:	Rrst
 " Author:	Jakson Alves de Aquino 
-" URL:		http://www.vim.org/scripts/script.php?script_id=2628
-" Last Change:	Fri Feb 15, 2013  09:47PM
+" Last Change:	Thu Jul 10, 2014  07:01PM
 
 
 " Only load this indent file when no other was loaded.
@@ -10,6 +9,7 @@ if exists("b:did_indent")
   finish
 endif
 runtime indent/r.vim
+let s:RIndent = function(substitute(&indentexpr, "()", "", ""))
 let b:did_indent = 1
 
 setlocal indentkeys=0{,0},:,!^F,o,O,e
@@ -34,12 +34,12 @@ endfunction
 
 function GetRrstIndent()
     if getline(".") =~ '^\.\. {r .*}$' || getline(".") =~ '^\.\. \.\.$'
-	return 0
+       return 0
     endif
     if search('^\.\. {r', "bncW") > search('^\.\. \.\.$', "bncW")
-	return GetRIndent()
+       return s:RIndent()
     else
-	return GetRstIndent()
+       return GetRstIndent()
     endif
 endfunction
 

From a94838aefde3f7cdfd79db232aa877300e560643 Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Thu, 10 Jul 2014 19:14:02 -0300
Subject: [PATCH 0725/1050] Change 'shiftwidth' to 2. Prepare Vim scripts from
 indent, syntax and ftplugin directories to become official Vim runtime files,
 which have two spaces as 'shiftwidth'.

---
 ftplugin/rhelp.vim  |   6 +-
 ftplugin/rmd.vim    |   6 +-
 ftplugin/rnoweb.vim |   6 +-
 ftplugin/rrst.vim   |   6 +-
 indent/r.vim        | 763 ++++++++++++++++++++++----------------------
 indent/rhelp.vim    | 146 ++++-----
 indent/rmd.vim      |  39 +--
 indent/rnoweb.vim   |  17 +-
 indent/rrst.vim     |  39 +--
 syntax/r.vim        |  56 ++--
 syntax/rhelp.vim    |  72 ++---
 syntax/rmd.vim      |  68 ++--
 syntax/rrst.vim     |  16 +-
 13 files changed, 624 insertions(+), 616 deletions(-)

diff --git a/ftplugin/rhelp.vim b/ftplugin/rhelp.vim
index e765060..9b72fb4 100644
--- a/ftplugin/rhelp.vim
+++ b/ftplugin/rhelp.vim
@@ -1,11 +1,11 @@
 " Vim filetype plugin file
 " Language: R help file
 " Maintainer: Jakson Alves de Aquino 
-" Last Change:	Sun Feb 23, 2014  04:06PM
+" Last Change:	Wed Jul 09, 2014  06:23PM
 
 " Only do this when not yet done for this buffer
 if exists("b:did_ftplugin")
-    finish
+  finish
 endif
 
 " Don't load another plugin for this buffer
@@ -25,3 +25,5 @@ let b:undo_ftplugin = "setl isk< | unlet! b:browsefilter"
 
 let &cpo = s:cpo_save
 unlet s:cpo_save
+
+" vim: sw=2
diff --git a/ftplugin/rmd.vim b/ftplugin/rmd.vim
index fcc8b8a..55723ff 100644
--- a/ftplugin/rmd.vim
+++ b/ftplugin/rmd.vim
@@ -1,12 +1,12 @@
 " Vim filetype plugin file
 " Language: R help file
 " Maintainer: Jakson Alves de Aquino 
-" Last Change:	Sun Feb 23, 2014  04:06PM
+" Last Change:	Wed Jul 09, 2014  06:23PM
 " Original work by Alex Zvoleff (adjusted for rmd by Michel Kuhlmann)
 
 " Only do this when not yet done for this buffer
 if exists("b:did_ftplugin")
-    finish
+  finish
 endif
 
 runtime! ftplugin/html.vim ftplugin/html_*.vim ftplugin/html/*.vim
@@ -39,3 +39,5 @@ endif
 
 let &cpo = s:cpo_save
 unlet s:cpo_save
+
+" vim: sw=2
diff --git a/ftplugin/rnoweb.vim b/ftplugin/rnoweb.vim
index fe57ae7..baf53d0 100644
--- a/ftplugin/rnoweb.vim
+++ b/ftplugin/rnoweb.vim
@@ -1,11 +1,11 @@
 " Vim filetype plugin file
 " Language: Rnoweb
 " Maintainer: Jakson Alves de Aquino 
-" Last Change:	Sun Feb 23, 2014  04:06PM
+" Last Change:	Wed Jul 09, 2014  06:23PM
 
 " Only do this when not yet done for this buffer
 if exists("b:did_ftplugin")
-    finish
+  finish
 endif
 
 let s:cpo_save = &cpo
@@ -36,3 +36,5 @@ endif
 
 let &cpo = s:cpo_save
 unlet s:cpo_save
+
+" vim: sw=2
diff --git a/ftplugin/rrst.vim b/ftplugin/rrst.vim
index f9a0c17..8140169 100644
--- a/ftplugin/rrst.vim
+++ b/ftplugin/rrst.vim
@@ -1,12 +1,12 @@
 " Vim filetype plugin file
 " Language: reStructuredText documentation format with R code
 " Maintainer: Jakson Alves de Aquino 
-" Last Change:	Sun Feb 23, 2014  04:07PM
+" Last Change:	Wed Jul 09, 2014  06:23PM
 " Original work by Alex Zvoleff
 
 " Only do this when not yet done for this buffer
 if exists("b:did_ftplugin")
-    finish
+  finish
 endif
 
 " Don't load another plugin for this buffer
@@ -33,3 +33,5 @@ endif
 
 let &cpo = s:cpo_save
 unlet s:cpo_save
+
+" vim: sw=2
diff --git a/indent/r.vim b/indent/r.vim
index 55d6fb4..301ce16 100644
--- a/indent/r.vim
+++ b/indent/r.vim
@@ -1,13 +1,12 @@
 " Vim indent file
 " Language:	R
 " Author:	Jakson Alves de Aquino 
-" URL:		http://www.vim.org/scripts/script.php?script_id=2628
-" Last Change:	Fri Feb 15, 2013  08:06PM
+" Last Change:	Thu Jul 10, 2014  07:11PM
 
 
 " Only load this indent file when no other was loaded.
 if exists("b:did_indent")
-    finish
+  finish
 endif
 let b:did_indent = 1
 
@@ -16,478 +15,476 @@ setlocal indentexpr=GetRIndent()
 
 " Only define the function once.
 if exists("*GetRIndent")
-    finish
+  finish
 endif
 
 " Options to make the indentation more similar to Emacs/ESS:
 if !exists("g:r_indent_align_args")
-    let g:r_indent_align_args = 1
+  let g:r_indent_align_args = 1
 endif
 if !exists("g:r_indent_ess_comments")
-    let g:r_indent_ess_comments = 0
+  let g:r_indent_ess_comments = 0
 endif
 if !exists("g:r_indent_comment_column")
-    let g:r_indent_comment_column = 40
+  let g:r_indent_comment_column = 40
 endif
 if ! exists("g:r_indent_ess_compatible")
-    let g:r_indent_ess_compatible = 0
+  let g:r_indent_ess_compatible = 0
 endif
 
 function s:RDelete_quotes(line)
-    let i = 0
-    let j = 0
-    let line1 = ""
-    let llen = strlen(a:line)
-    while i < llen
-        if a:line[i] == '"'
-            let i += 1
-            let line1 = line1 . 's'
-            while !(a:line[i] == '"' && ((i > 1 && a:line[i-1] == '\' && a:line[i-2] == '\') || a:line[i-1] != '\')) && i < llen
-                let i += 1
-            endwhile
-            if a:line[i] == '"'
-                let i += 1
-            endif
-        else
-            if a:line[i] == "'"
-                let i += 1
-                let line1 = line1 . 's'
-                while !(a:line[i] == "'" && ((i > 1 && a:line[i-1] == '\' && a:line[i-2] == '\') || a:line[i-1] != '\')) && i < llen
-                    let i += 1
-                endwhile
-                if a:line[i] == "'"
-                    let i += 1
-                endif
-            else
-                if a:line[i] == "`"
-                    let i += 1
-                    let line1 = line1 . 's'
-                    while a:line[i] != "`" && i < llen
-                        let i += 1
-                    endwhile
-                    if a:line[i] == "`"
-                        let i += 1
-                    endif
-                endif
-            endif
+  let i = 0
+  let j = 0
+  let line1 = ""
+  let llen = strlen(a:line)
+  while i < llen
+    if a:line[i] == '"'
+      let i += 1
+      let line1 = line1 . 's'
+      while !(a:line[i] == '"' && ((i > 1 && a:line[i-1] == '\' && a:line[i-2] == '\') || a:line[i-1] != '\')) && i < llen
+        let i += 1
+      endwhile
+      if a:line[i] == '"'
+        let i += 1
+      endif
+    else
+      if a:line[i] == "'"
+        let i += 1
+        let line1 = line1 . 's'
+        while !(a:line[i] == "'" && ((i > 1 && a:line[i-1] == '\' && a:line[i-2] == '\') || a:line[i-1] != '\')) && i < llen
+          let i += 1
+        endwhile
+        if a:line[i] == "'"
+          let i += 1
         endif
-        if i == llen
-            break
+      else
+        if a:line[i] == "`"
+          let i += 1
+          let line1 = line1 . 's'
+          while a:line[i] != "`" && i < llen
+            let i += 1
+          endwhile
+          if a:line[i] == "`"
+            let i += 1
+          endif
         endif
-        let line1 = line1 . a:line[i]
-        let j += 1
-        let i += 1
-    endwhile
-    return line1
+      endif
+    endif
+    if i == llen
+      break
+    endif
+    let line1 = line1 . a:line[i]
+    let j += 1
+    let i += 1
+  endwhile
+  return line1
 endfunction
 
 " Convert foo(bar()) int foo()
 function s:RDelete_parens(line)
-    if s:Get_paren_balance(a:line, "(", ")") != 0
-        return a:line
-    endif
-    let i = 0
-    let j = 0
-    let line1 = ""
-    let llen = strlen(a:line)
-    while i < llen
-        let line1 = line1 . a:line[i]
-        if a:line[i] == '('
-            let nop = 1
-            while nop > 0 && i < llen
-                let i += 1
-                if a:line[i] == ')'
-                    let nop -= 1
-                else
-                    if a:line[i] == '('
-                        let nop += 1 
-                    endif
-                endif
-            endwhile
-            let line1 = line1 . a:line[i]
-        endif
+  if s:Get_paren_balance(a:line, "(", ")") != 0
+    return a:line
+  endif
+  let i = 0
+  let j = 0
+  let line1 = ""
+  let llen = strlen(a:line)
+  while i < llen
+    let line1 = line1 . a:line[i]
+    if a:line[i] == '('
+      let nop = 1
+      while nop > 0 && i < llen
         let i += 1
-    endwhile
-    return line1
+        if a:line[i] == ')'
+          let nop -= 1
+        else
+          if a:line[i] == '('
+            let nop += 1
+          endif
+        endif
+      endwhile
+      let line1 = line1 . a:line[i]
+    endif
+    let i += 1
+  endwhile
+  return line1
 endfunction
 
 function! s:Get_paren_balance(line, o, c)
-    let line2 = substitute(a:line, a:o, "", "g")
-    let openp = strlen(a:line) - strlen(line2)
-    let line3 = substitute(line2, a:c, "", "g")
-    let closep = strlen(line2) - strlen(line3)
-    return openp - closep
+  let line2 = substitute(a:line, a:o, "", "g")
+  let openp = strlen(a:line) - strlen(line2)
+  let line3 = substitute(line2, a:c, "", "g")
+  let closep = strlen(line2) - strlen(line3)
+  return openp - closep
 endfunction
 
 function! s:Get_matching_brace(linenr, o, c, delbrace)
-    let line = SanitizeRLine(getline(a:linenr))
-    if a:delbrace == 1
-        let line = substitute(line, '{$', "", "")
-    endif
-    let pb = s:Get_paren_balance(line, a:o, a:c)
-    let i = a:linenr
-    while pb != 0 && i > 1
-        let i -= 1
-        let pb += s:Get_paren_balance(SanitizeRLine(getline(i)), a:o, a:c)
-    endwhile
-    return i
+  let line = SanitizeRLine(getline(a:linenr))
+  if a:delbrace == 1
+    let line = substitute(line, '{$', "", "")
+  endif
+  let pb = s:Get_paren_balance(line, a:o, a:c)
+  let i = a:linenr
+  while pb != 0 && i > 1
+    let i -= 1
+    let pb += s:Get_paren_balance(SanitizeRLine(getline(i)), a:o, a:c)
+  endwhile
+  return i
 endfunction
 
 " This function is buggy because there 'if's without 'else'
 " It must be rewritten relying more on indentation
 function! s:Get_matching_if(linenr, delif)
-"    let filenm = expand("%")
-"    call writefile([filenm], "/tmp/matching_if_" . a:linenr)
-    let line = SanitizeRLine(getline(a:linenr))
-    if a:delif
-        let line = substitute(line, "if", "", "g")
-    endif
-    let elsenr = 0
-    let i = a:linenr
-    let ifhere = 0
-    while i > 0
-        let line2 = substitute(line, '\', "xxx", "g")
-        let elsenr += strlen(line) - strlen(line2)
-        if line =~ '.*\s*if\s*()' || line =~ '.*\s*if\s*()'
-            let elsenr -= 1
-            if elsenr == 0
-                let ifhere = i
-                break
-            endif
-        endif
-        let i -= 1
-        let line = SanitizeRLine(getline(i))
-    endwhile
-    if ifhere
-        return ifhere
-    else
-        return a:linenr
+  let line = SanitizeRLine(getline(a:linenr))
+  if a:delif
+    let line = substitute(line, "if", "", "g")
+  endif
+  let elsenr = 0
+  let i = a:linenr
+  let ifhere = 0
+  while i > 0
+    let line2 = substitute(line, '\', "xxx", "g")
+    let elsenr += strlen(line) - strlen(line2)
+    if line =~ '.*\s*if\s*()' || line =~ '.*\s*if\s*()'
+      let elsenr -= 1
+      if elsenr == 0
+        let ifhere = i
+        break
+      endif
     endif
+    let i -= 1
+    let line = SanitizeRLine(getline(i))
+  endwhile
+  if ifhere
+    return ifhere
+  else
+    return a:linenr
+  endif
 endfunction
 
 function! s:Get_last_paren_idx(line, o, c, pb)
-    let blc = a:pb
-    let line = substitute(a:line, '\t', s:curtabstop, "g")
-    let theidx = -1
-    let llen = strlen(line)
-    let idx = 0
-    while idx < llen
-        if line[idx] == a:o
-            let blc -= 1
-            if blc == 0
-                let theidx = idx
-            endif
-        else
-            if line[idx] == a:c
-                let blc += 1
-            endif
-        endif
-        let idx += 1
-    endwhile
-    return theidx + 1
+  let blc = a:pb
+  let line = substitute(a:line, '\t', s:curtabstop, "g")
+  let theidx = -1
+  let llen = strlen(line)
+  let idx = 0
+  while idx < llen
+    if line[idx] == a:o
+      let blc -= 1
+      if blc == 0
+        let theidx = idx
+      endif
+    else
+      if line[idx] == a:c
+        let blc += 1
+      endif
+    endif
+    let idx += 1
+  endwhile
+  return theidx + 1
 endfunction
 
 " Get previous relevant line. Search back until getting a line that isn't
 " comment or blank
 function s:Get_prev_line(lineno)
-    let lnum = a:lineno - 1
+  let lnum = a:lineno - 1
+  let data = getline( lnum )
+  while lnum > 0 && (data =~ '^\s*#' || data =~ '^\s*$')
+    let lnum = lnum - 1
     let data = getline( lnum )
-    while lnum > 0 && (data =~ '^\s*#' || data =~ '^\s*$')
-        let lnum = lnum - 1
-        let data = getline( lnum )
-    endwhile
-    return lnum
+  endwhile
+  return lnum
 endfunction
 
 " This function is also used by r-plugin/common_global.vim
 " Delete from '#' to the end of the line, unless the '#' is inside a string.
 function SanitizeRLine(line)
-    let newline = s:RDelete_quotes(a:line)
-    let newline = s:RDelete_parens(newline)
-    let newline = substitute(newline, '#.*', "", "")
-    let newline = substitute(newline, '\s*$', "", "")
-    return newline
+  let newline = s:RDelete_quotes(a:line)
+  let newline = s:RDelete_parens(newline)
+  let newline = substitute(newline, '#.*', "", "")
+  let newline = substitute(newline, '\s*$', "", "")
+  return newline
 endfunction
 
 function GetRIndent()
 
-    let clnum = line(".")    " current line
+  let clnum = line(".")    " current line
 
-    let cline = getline(clnum)
-    if cline =~ '^\s*#'
-        if g:r_indent_ess_comments == 1
-            if cline =~ '^\s*###'
-                return 0
-            endif
-            if cline !~ '^\s*##'
-                return g:r_indent_comment_column
-            endif
-        endif
+  let cline = getline(clnum)
+  if cline =~ '^\s*#'
+    if g:r_indent_ess_comments == 1
+      if cline =~ '^\s*###'
+        return 0
+      endif
+      if cline !~ '^\s*##'
+        return g:r_indent_comment_column
+      endif
     endif
-
-    let cline = SanitizeRLine(cline)
-
-    if cline =~ '^\s*}' || cline =~ '^\s*}\s*)$'
-        let indline = s:Get_matching_brace(clnum, '{', '}', 1)
-        if indline > 0 && indline != clnum
-            let iline = SanitizeRLine(getline(indline))
-            if s:Get_paren_balance(iline, "(", ")") == 0 || iline =~ '(\s*{$'
-                return indent(indline)
-            else
-                let indline = s:Get_matching_brace(indline, '(', ')', 1)
-                return indent(indline)
-            endif
-        endif
+  endif
+
+  let cline = SanitizeRLine(cline)
+
+  if cline =~ '^\s*}' || cline =~ '^\s*}\s*)$'
+    let indline = s:Get_matching_brace(clnum, '{', '}', 1)
+    if indline > 0 && indline != clnum
+      let iline = SanitizeRLine(getline(indline))
+      if s:Get_paren_balance(iline, "(", ")") == 0 || iline =~ '(\s*{$'
+        return indent(indline)
+      else
+        let indline = s:Get_matching_brace(indline, '(', ')', 1)
+        return indent(indline)
+      endif
     endif
+  endif
 
-    " Find the first non blank line above the current line
-    let lnum = s:Get_prev_line(clnum)
-    " Hit the start of the file, use zero indent.
-    if lnum == 0
-        return 0
-    endif
+  " Find the first non blank line above the current line
+  let lnum = s:Get_prev_line(clnum)
+  " Hit the start of the file, use zero indent.
+  if lnum == 0
+    return 0
+  endif
 
-    let line = SanitizeRLine(getline(lnum))
+  let line = SanitizeRLine(getline(lnum))
 
-    if &filetype == "rhelp"
-        if cline =~ '^\\dontshow{' || cline =~ '^\\dontrun{' || cline =~ '^\\donttest{' || cline =~ '^\\testonly{'
-            return 0
-        endif
-        if line =~ '^\\examples{' || line =~ '^\\usage{' || line =~ '^\\dontshow{' || line =~ '^\\dontrun{' || line =~ '^\\donttest{' || line =~ '^\\testonly{'
-            return 0
-        endif
-        if line =~ '^\\method{.*}{.*}(.*'
-            let line = substitute(line, '^\\method{\(.*\)}{.*}', '\1', "")
-        endif
+  if &filetype == "rhelp"
+    if cline =~ '^\\dontshow{' || cline =~ '^\\dontrun{' || cline =~ '^\\donttest{' || cline =~ '^\\testonly{'
+      return 0
     endif
-
-    if cline =~ '^\s*{'
-        if g:r_indent_ess_compatible && line =~ ')$'
-            let nlnum = lnum
-            let nline = line
-            while s:Get_paren_balance(nline, '(', ')') < 0
-                let nlnum = s:Get_prev_line(nlnum)
-                let nline = SanitizeRLine(getline(nlnum)) . nline
-            endwhile
-            if nline =~ '^\s*function\s*(' && indent(nlnum) == &sw
-                return 0
-            endif
-        endif
-        if s:Get_paren_balance(line, "(", ")") == 0
-            return indent(lnum)
-        endif
+    if line =~ '^\\examples{' || line =~ '^\\usage{' || line =~ '^\\dontshow{' || line =~ '^\\dontrun{' || line =~ '^\\donttest{' || line =~ '^\\testonly{'
+      return 0
     endif
-
-    " line is an incomplete command:
-    if line =~ '\<\(if\|while\|for\|function\)\s*()$' || line =~ '\]$' || cline =~ '^\s*[,&|\-\*+<>]')
-            return indent(lnum)
-        endif
+  let pb = s:Get_paren_balance(line, '(', ')')
 
-        if pb > 0
-            if &filetype == "rhelp"
-                let ind = s:Get_last_paren_idx(line, '(', ')', pb)
-            else
-                let ind = s:Get_last_paren_idx(getline(lnum), '(', ')', pb)
-            endif
-            return ind
-        endif
+  if line =~ '^\s*{$' || line =~ '(\s*{' || (pb == 0 && (line =~ '{$' || line =~ '(\s*{$'))
+    return indent(lnum) + &sw
+  endif
 
-        if pb < 0 && line =~ '.*[,&|\-\*+<>]$'
-            let lnum = s:Get_prev_line(lnum)
-            while pb < 1 && lnum > 0
-                let line = SanitizeRLine(getline(lnum))
-                let line = substitute(line, '\t', s:curtabstop, "g")
-                let ind = strlen(line)
-                while ind > 0
-                    if line[ind] == ')'
-                        let pb -= 1
-                    else
-                        if line[ind] == '('
-                            let pb += 1
-                        endif
-                    endif
-                    if pb == 1
-                        return ind + 1
-                    endif
-                    let ind -= 1
-                endwhile
-                let lnum -= 1
-            endwhile
-            return 0
-        endif
+  let bb = s:Get_paren_balance(line, '[', ']')
 
-        if bb > 0
-            let ind = s:Get_last_paren_idx(getline(lnum), '[', ']', bb)
-            return ind
-        endif
+  let s:curtabstop = repeat(' ', &tabstop)
+  if g:r_indent_align_args == 1
+
+    if pb == 0 && bb == 0 && (line =~ '.*[,&|\-\*+<>]$' || cline =~ '^\s*[,&|\-\*+<>]')
+      return indent(lnum)
     endif
 
-    let post_block = 0
-    if line =~ '}$'
-        let lnum = s:Get_matching_brace(lnum, '{', '}', 0)
-        let line = SanitizeRLine(getline(lnum))
-        if lnum > 0 && line =~ '^\s*{'
-            let lnum = s:Get_prev_line(lnum)
-            let line = SanitizeRLine(getline(lnum))
-        endif
-        let pb = s:Get_paren_balance(line, '(', ')')
-        let post_block = 1
+    if pb > 0
+      if &filetype == "rhelp"
+        let ind = s:Get_last_paren_idx(line, '(', ')', pb)
+      else
+        let ind = s:Get_last_paren_idx(getline(lnum), '(', ')', pb)
+      endif
+      return ind
     endif
 
-    let post_fun = 0
-    if pb < 0 && line !~ ')\s*[,&|\-\*+<>]$'
-        let post_fun = 1
-        while pb < 0 && lnum > 0
-            let lnum -= 1
-            let linepiece = SanitizeRLine(getline(lnum))
-            let pb += s:Get_paren_balance(linepiece, "(", ")")
-            let line = linepiece . line
+    if pb < 0 && line =~ '.*[,&|\-\*+<>]$'
+      let lnum = s:Get_prev_line(lnum)
+      while pb < 1 && lnum > 0
+        let line = SanitizeRLine(getline(lnum))
+        let line = substitute(line, '\t', s:curtabstop, "g")
+        let ind = strlen(line)
+        while ind > 0
+          if line[ind] == ')'
+            let pb -= 1
+          else
+            if line[ind] == '('
+              let pb += 1
+            endif
+          endif
+          if pb == 1
+            return ind + 1
+          endif
+          let ind -= 1
         endwhile
-        if line =~ '{$' && post_block == 0
-            return indent(lnum) + &sw
-        endif
+        let lnum -= 1
+      endwhile
+      return 0
+    endif
 
-        " Now we can do some tests again
-        if cline =~ '^\s*{'
-            return indent(lnum)
-        endif
-        if post_block == 0
-            let newl = SanitizeRLine(line)
-            if newl =~ '\<\(if\|while\|for\|function\)\s*()$' || newl =~ '\ 0
+      let ind = s:Get_last_paren_idx(getline(lnum), '[', ']', bb)
+      return ind
     endif
+  endif
 
-    if cline =~ '^\s*else'
-        if line =~ '<-\s*if\s*()'
-            return indent(lnum) + &sw
-        else
-            if line =~ '\ 0 && line =~ '^\s*{'
+      let lnum = s:Get_prev_line(lnum)
+      let line = SanitizeRLine(getline(lnum))
+    endif
+    let pb = s:Get_paren_balance(line, '(', ')')
+    let post_block = 1
+  endif
+
+  let post_fun = 0
+  if pb < 0 && line !~ ')\s*[,&|\-\*+<>]$'
+    let post_fun = 1
+    while pb < 0 && lnum > 0
+      let lnum -= 1
+      let linepiece = SanitizeRLine(getline(lnum))
+      let pb += s:Get_paren_balance(linepiece, "(", ")")
+      let line = linepiece . line
+    endwhile
+    if line =~ '{$' && post_block == 0
+      return indent(lnum) + &sw
     endif
 
-    if bb < 0 && line =~ '.*]'
-        while bb < 0 && lnum > 0
-            let lnum -= 1
-            let linepiece = SanitizeRLine(getline(lnum))
-            let bb += s:Get_paren_balance(linepiece, "[", "]")
-            let line = linepiece . line
-        endwhile
-        let line = s:RDelete_parens(line)
+    " Now we can do some tests again
+    if cline =~ '^\s*{'
+      return indent(lnum)
     endif
+    if post_block == 0
+      let newl = SanitizeRLine(line)
+      if newl =~ '\<\(if\|while\|for\|function\)\s*()$' || newl =~ '\ 0
+  if cline =~ '^\s*else'
+    if line =~ '<-\s*if\s*()'
+      return indent(lnum) + &sw
+    else
+      if line =~ '\ 0
+      let lnum -= 1
+      let linepiece = SanitizeRLine(getline(lnum))
+      let bb += s:Get_paren_balance(linepiece, "[", "]")
+      let line = linepiece . line
+    endwhile
+    let line = s:RDelete_parens(line)
+  endif
+
+  let plnum = s:Get_prev_line(lnum)
+  let ppost_else = 0
+  if plnum > 0
+    let pline = SanitizeRLine(getline(plnum))
+    let ppost_block = 0
+    if pline =~ '}$'
+      let ppost_block = 1
+      let plnum = s:Get_matching_brace(plnum, '{', '}', 0)
+      let pline = SanitizeRLine(getline(plnum))
+      if pline =~ '^\s*{$' && plnum > 0
+        let plnum = s:Get_prev_line(plnum)
         let pline = SanitizeRLine(getline(plnum))
-        let ppost_block = 0
-        if pline =~ '}$'
-            let ppost_block = 1
-            let plnum = s:Get_matching_brace(plnum, '{', '}', 0)
-            let pline = SanitizeRLine(getline(plnum))
-            if pline =~ '^\s*{$' && plnum > 0
-                let plnum = s:Get_prev_line(plnum)
-                let pline = SanitizeRLine(getline(plnum))
-            endif
-        endif
+      endif
+    endif
 
-        if pline =~ 'else$'
-            let ppost_else = 1
-            let plnum = s:Get_matching_if(plnum, 0)
-            let pline = SanitizeRLine(getline(plnum))
-        endif
+    if pline =~ 'else$'
+      let ppost_else = 1
+      let plnum = s:Get_matching_if(plnum, 0)
+      let pline = SanitizeRLine(getline(plnum))
+    endif
 
-        if pline =~ '^\s*else\s*if\s*('
-            let pplnum = s:Get_prev_line(plnum)
-            let ppline = SanitizeRLine(getline(pplnum))
-            while ppline =~ '^\s*else\s*if\s*(' || ppline =~ '^\s*if\s*()\s*\S$'
-                let plnum = pplnum
-                let pline = ppline
-                let pplnum = s:Get_prev_line(plnum)
-                let ppline = SanitizeRLine(getline(pplnum))
-            endwhile
-            while ppline =~ '\<\(if\|while\|for\|function\)\s*()$' || ppline =~ '\ 0
-                let plnum -= 1
-                let linepiece = SanitizeRLine(getline(plnum))
-                let ppb += s:Get_paren_balance(linepiece, "(", ")")
-                let pline = linepiece . pline
-            endwhile
-            let pline = s:RDelete_parens(pline)
-        endif
+    let ppb = s:Get_paren_balance(pline, '(', ')')
+    if ppb < 0 && (pline =~ ')\s*{$' || pline =~ ')$')
+      while ppb < 0 && plnum > 0
+        let plnum -= 1
+        let linepiece = SanitizeRLine(getline(plnum))
+        let ppb += s:Get_paren_balance(linepiece, "(", ")")
+        let pline = linepiece . pline
+      endwhile
+      let pline = s:RDelete_parens(pline)
     endif
+  endif
 
-    let ind = indent(lnum)
-    let pind = indent(plnum)
+  let ind = indent(lnum)
+  let pind = indent(plnum)
 
-    if g:r_indent_align_args == 0 && pb != 0
-        let ind += pb * &sw
-        return ind
-    endif
+  if g:r_indent_align_args == 0 && pb != 0
+    let ind += pb * &sw
+    return ind
+  endif
 
-    if g:r_indent_align_args == 0 && bb != 0
-        let ind += bb * &sw
-        return ind
-    endif
+  if g:r_indent_align_args == 0 && bb != 0
+    let ind += bb * &sw
+    return ind
+  endif
 
-    if ind == pind || (ind == (pind  + &sw) && pline =~ '{$' && ppost_else == 0)
-        return ind
-    endif
+  if ind == pind || (ind == (pind  + &sw) && pline =~ '{$' && ppost_else == 0)
+    return ind
+  endif
+
+  let pline = getline(plnum)
+  let pbb = s:Get_paren_balance(pline, '[', ']')
 
+  while pind < ind && plnum > 0 && ppb == 0 && pbb == 0
+    let ind = pind
+    let plnum = s:Get_prev_line(plnum)
     let pline = getline(plnum)
+    let ppb = s:Get_paren_balance(pline, '(', ')')
     let pbb = s:Get_paren_balance(pline, '[', ']')
-
-    while pind < ind && plnum > 0 && ppb == 0 && pbb == 0
-        let ind = pind
-        let plnum = s:Get_prev_line(plnum)
-        let pline = getline(plnum)
-        let ppb = s:Get_paren_balance(pline, '(', ')')
-        let pbb = s:Get_paren_balance(pline, '[', ']')
-        while pline =~ '^\s*else'
-            let plnum = s:Get_matching_if(plnum, 1)
-            let pline = getline(plnum)
-            let ppb = s:Get_paren_balance(pline, '(', ')')
-            let pbb = s:Get_paren_balance(pline, '[', ']')
-        endwhile
-        let pind = indent(plnum)
-        if ind == (pind  + &sw) && pline =~ '{$'
-            return ind
-        endif
+    while pline =~ '^\s*else'
+      let plnum = s:Get_matching_if(plnum, 1)
+      let pline = getline(plnum)
+      let ppb = s:Get_paren_balance(pline, '(', ')')
+      let pbb = s:Get_paren_balance(pline, '[', ']')
     endwhile
+    let pind = indent(plnum)
+    if ind == (pind  + &sw) && pline =~ '{$'
+      return ind
+    endif
+  endwhile
 
-    return ind
+  return ind
 
 endfunction
 
-" vim: sw=4
+" vim: sw=2
diff --git a/indent/rhelp.vim b/indent/rhelp.vim
index 3d4aeef..c4b6f34 100644
--- a/indent/rhelp.vim
+++ b/indent/rhelp.vim
@@ -1,12 +1,12 @@
 " Vim indent file
 " Language:	R Documentation (Help), *.Rd
 " Author:	Jakson Alves de Aquino 
-" Last Change:	Thu Jul 10, 2014  06:50PM
+" Last Change:	Thu Jul 10, 2014  07:10PM
 
 
 " Only load this indent file when no other was loaded.
 if exists("b:did_indent")
-    finish
+  finish
 endif
 runtime indent/r.vim
 let s:RIndent = function(substitute(&indentexpr, "()", "", ""))
@@ -17,7 +17,7 @@ setlocal indentexpr=GetRHelpIndent()
 
 " Only define the function once.
 if exists("*GetRHelpIndent")
-    finish
+  finish
 endif
 
 setlocal noautoindent
@@ -29,83 +29,83 @@ setlocal indentkeys=0{,0},:,!^F,o,O,e
 setlocal indentexpr=GetCorrectRHelpIndent()
 
 function s:SanitizeRHelpLine(line)
-    let newline = substitute(a:line, '\\\\', "x", "g")
-    let newline = substitute(newline, '\\{', "x", "g")
-    let newline = substitute(newline, '\\}', "x", "g")
-    let newline = substitute(newline, '\\%', "x", "g")
-    let newline = substitute(newline, '%.*', "", "")
-    let newline = substitute(newline, '\s*$', "", "")
-    return newline
+  let newline = substitute(a:line, '\\\\', "x", "g")
+  let newline = substitute(newline, '\\{', "x", "g")
+  let newline = substitute(newline, '\\}', "x", "g")
+  let newline = substitute(newline, '\\%', "x", "g")
+  let newline = substitute(newline, '%.*', "", "")
+  let newline = substitute(newline, '\s*$', "", "")
+  return newline
 endfunction
 
 function GetRHelpIndent()
 
-    let clnum = line(".")    " current line
-    if clnum == 1
-        return 0
-    endif
-    let cline = getline(clnum)
-
-    if cline =~ '^\s*}\s*$'
-        let i = clnum
-        let bb = -1
-        while bb != 0 && i > 1
-            let i -= 1
-            let line = s:SanitizeRHelpLine(getline(i))
-            let line2 = substitute(line, "{", "", "g")
-            let openb = strlen(line) - strlen(line2)
-            let line3 = substitute(line2, "}", "", "g")
-            let closeb = strlen(line2) - strlen(line3)
-            let bb += openb - closeb
-        endwhile
-        return indent(i)
-    endif
-
-    if cline =~ '^\s*#ifdef\>' || cline =~ '^\s*#endif\>'
-        return 0
-    endif
-
-    let lnum = clnum - 1
-    let line = getline(lnum)
-    if line =~ '^\s*#ifdef\>' || line =~ '^\s*#endif\>'
-        let lnum -= 1
-        let line = getline(lnum)
-    endif
-    while lnum > 1 && (line =~ '^\s*$' || line =~ '^#ifdef' || line =~ '^#endif')
-        let lnum -= 1
-        let line = getline(lnum)
+  let clnum = line(".")    " current line
+  if clnum == 1
+    return 0
+  endif
+  let cline = getline(clnum)
+
+  if cline =~ '^\s*}\s*$'
+    let i = clnum
+    let bb = -1
+    while bb != 0 && i > 1
+      let i -= 1
+      let line = s:SanitizeRHelpLine(getline(i))
+      let line2 = substitute(line, "{", "", "g")
+      let openb = strlen(line) - strlen(line2)
+      let line3 = substitute(line2, "}", "", "g")
+      let closeb = strlen(line2) - strlen(line3)
+      let bb += openb - closeb
     endwhile
-    if lnum == 1
-        return 0
-    endif
-    let line = s:SanitizeRHelpLine(line)
-    let line2 = substitute(line, "{", "", "g")
-    let openb = strlen(line) - strlen(line2)
-    let line3 = substitute(line2, "}", "", "g")
-    let closeb = strlen(line2) - strlen(line3)
-    let bb = openb - closeb
-
-    let ind = indent(lnum) + (bb * &sw)
-
-    if line =~ '^\s*}\s*$'
-        let ind = indent(lnum)
-    endif
-
-    if ind < 0
-        return 0
-    endif
-
-    return ind
+    return indent(i)
+  endif
+
+  if cline =~ '^\s*#ifdef\>' || cline =~ '^\s*#endif\>'
+    return 0
+  endif
+
+  let lnum = clnum - 1
+  let line = getline(lnum)
+  if line =~ '^\s*#ifdef\>' || line =~ '^\s*#endif\>'
+    let lnum -= 1
+    let line = getline(lnum)
+  endif
+  while lnum > 1 && (line =~ '^\s*$' || line =~ '^#ifdef' || line =~ '^#endif')
+    let lnum -= 1
+    let line = getline(lnum)
+  endwhile
+  if lnum == 1
+    return 0
+  endif
+  let line = s:SanitizeRHelpLine(line)
+  let line2 = substitute(line, "{", "", "g")
+  let openb = strlen(line) - strlen(line2)
+  let line3 = substitute(line2, "}", "", "g")
+  let closeb = strlen(line2) - strlen(line3)
+  let bb = openb - closeb
+
+  let ind = indent(lnum) + (bb * &sw)
+
+  if line =~ '^\s*}\s*$'
+    let ind = indent(lnum)
+  endif
+
+  if ind < 0
+    return 0
+  endif
+
+  return ind
 endfunction
 
 function GetCorrectRHelpIndent()
-    let lastsection = search('^\\[a-z]*{', "bncW")
-    let secname = getline(lastsection)
-    if secname =~ '^\\usage{' || secname =~ '^\\examples{' || secname =~ '^\\dontshow{' || secname =~ '^\\dontrun{' || secname =~ '^\\donttest{' || secname =~ '^\\testonly{' || secname =~ '^\\method{.*}{.*}('
-        return s:RIndent()
-    else
-        return GetRHelpIndent()
-    endif
+  let lastsection = search('^\\[a-z]*{', "bncW")
+  let secname = getline(lastsection)
+  if secname =~ '^\\usage{' || secname =~ '^\\examples{' || secname =~ '^\\dontshow{' || secname =~ '^\\dontrun{' || secname =~ '^\\donttest{' || secname =~ '^\\testonly{' || secname =~ '^\\method{.*}{.*}('
+    return s:RIndent()
+  else
+    return GetRHelpIndent()
+  endif
 endfunction
 
-" vim: sw=4
+" vim: sw=2
diff --git a/indent/rmd.vim b/indent/rmd.vim
index 56c661d..78be795 100644
--- a/indent/rmd.vim
+++ b/indent/rmd.vim
@@ -1,7 +1,7 @@
 " Vim indent file
 " Language:	Rmd
 " Author:	Jakson Alves de Aquino 
-" Last Change:	Thu Jul 10, 2014  06:58PM
+" Last Change:	Thu Jul 10, 2014  07:11PM
 
 
 " Only load this indent file when no other was loaded.
@@ -20,26 +20,27 @@ if exists("*GetRmdIndent")
 endif
 
 function GetMdIndent()
-    let pline = getline(v:lnum - 1)
-    let cline = getline(v:lnum)
-    if prevnonblank(v:lnum - 1) < v:lnum - 1 || cline =~ '^\s*[-\+\*]\s' || cline =~ '^\s*\d\+\.\s\+'
-        return indent(v:lnum)
-    elseif pline =~ '^\s*[-\+\*]\s'
-        return indent(v:lnum - 1) + 2
-    elseif pline =~ '^\s*\d\+\.\s\+'
-        return indent(v:lnum - 1) + 3
-    endif
-    return indent(prevnonblank(v:lnum - 1))
+  let pline = getline(v:lnum - 1)
+  let cline = getline(v:lnum)
+  if prevnonblank(v:lnum - 1) < v:lnum - 1 || cline =~ '^\s*[-\+\*]\s' || cline =~ '^\s*\d\+\.\s\+'
+    return indent(v:lnum)
+  elseif pline =~ '^\s*[-\+\*]\s'
+    return indent(v:lnum - 1) + 2
+  elseif pline =~ '^\s*\d\+\.\s\+'
+    return indent(v:lnum - 1) + 3
+  endif
+  return indent(prevnonblank(v:lnum - 1))
 endfunction
 
 function GetRmdIndent()
-    if getline(".") =~ '^```{r .*}$' || getline(".") =~ '^```$'
-       return 0
-    endif
-    if search('^```{r', "bncW") > search('^```$', "bncW")
-       return s:RIndent()
-    else
-       return GetMdIndent()
-    endif
+  if getline(".") =~ '^```{r .*}$' || getline(".") =~ '^```$'
+    return 0
+  endif
+  if search('^```{r', "bncW") > search('^```$', "bncW")
+    return s:RIndent()
+  else
+    return GetMdIndent()
+  endif
 endfunction
 
+" vim: sw=2
diff --git a/indent/rnoweb.vim b/indent/rnoweb.vim
index 357d83b..1b83e5d 100644
--- a/indent/rnoweb.vim
+++ b/indent/rnoweb.vim
@@ -1,7 +1,7 @@
 " Vim indent file
 " Language:	Rnoweb
 " Author:	Jakson Alves de Aquino 
-" Last Change:	Thu Jul 10, 2014  06:56PM
+" Last Change:	Thu Jul 10, 2014  07:11PM
 
 
 " Only load this indent file when no other was loaded.
@@ -23,12 +23,13 @@ if exists("*GetRnowebIndent")
 endif
 
 function GetRnowebIndent()
-    if getline(".") =~ "^<<.*>>=$"
-       return 0
-    endif
-    if search("^<<", "bncW") > search("^@", "bncW")
-       return s:RIndent()
-    endif
-    return s:TeXIndent()
+  if getline(".") =~ "^<<.*>>=$"
+    return 0
+  endif
+  if search("^<<", "bncW") > search("^@", "bncW")
+    return s:RIndent()
+  endif
+  return s:TeXIndent()
 endfunction
 
+" vim: sw=2
diff --git a/indent/rrst.vim b/indent/rrst.vim
index 9a54157..7b8ca09 100644
--- a/indent/rrst.vim
+++ b/indent/rrst.vim
@@ -1,7 +1,7 @@
 " Vim indent file
 " Language:	Rrst
 " Author:	Jakson Alves de Aquino 
-" Last Change:	Thu Jul 10, 2014  07:01PM
+" Last Change:	Thu Jul 10, 2014  07:11PM
 
 
 " Only load this indent file when no other was loaded.
@@ -20,26 +20,27 @@ if exists("*GetRrstIndent")
 endif
 
 function GetRstIndent()
-    let pline = getline(v:lnum - 1)
-    let cline = getline(v:lnum)
-    if prevnonblank(v:lnum - 1) < v:lnum - 1 || cline =~ '^\s*[-\+\*]\s' || cline =~ '^\s*\d\+\.\s\+'
-        return indent(v:lnum)
-    elseif pline =~ '^\s*[-\+\*]\s'
-        return indent(v:lnum - 1) + 2
-    elseif pline =~ '^\s*\d\+\.\s\+'
-        return indent(v:lnum - 1) + 3
-    endif
-    return indent(prevnonblank(v:lnum - 1))
+  let pline = getline(v:lnum - 1)
+  let cline = getline(v:lnum)
+  if prevnonblank(v:lnum - 1) < v:lnum - 1 || cline =~ '^\s*[-\+\*]\s' || cline =~ '^\s*\d\+\.\s\+'
+    return indent(v:lnum)
+  elseif pline =~ '^\s*[-\+\*]\s'
+    return indent(v:lnum - 1) + 2
+  elseif pline =~ '^\s*\d\+\.\s\+'
+    return indent(v:lnum - 1) + 3
+  endif
+  return indent(prevnonblank(v:lnum - 1))
 endfunction
 
 function GetRrstIndent()
-    if getline(".") =~ '^\.\. {r .*}$' || getline(".") =~ '^\.\. \.\.$'
-       return 0
-    endif
-    if search('^\.\. {r', "bncW") > search('^\.\. \.\.$', "bncW")
-       return s:RIndent()
-    else
-       return GetRstIndent()
-    endif
+  if getline(".") =~ '^\.\. {r .*}$' || getline(".") =~ '^\.\. \.\.$'
+    return 0
+  endif
+  if search('^\.\. {r', "bncW") > search('^\.\. \.\.$', "bncW")
+    return s:RIndent()
+  else
+    return GetRstIndent()
+  endif
 endfunction
 
+" vim: sw=2
diff --git a/syntax/r.vim b/syntax/r.vim
index 0caeded..15acccb 100644
--- a/syntax/r.vim
+++ b/syntax/r.vim
@@ -3,7 +3,7 @@
 " Maintainer:	      Jakson Aquino 
 " Former Maintainers: Vaidotas Zemlys 
 " 		      Tom Payne 
-" Last Change:	      Thu Jul 10, 2014  01:27PM
+" Last Change:	      Thu Jul 10, 2014  06:45PM
 " Filenames:	      *.R *.r *.Rhistory *.Rt
 "
 " NOTE: The highlighting of R functions is defined in the
@@ -18,13 +18,13 @@
 " Some lines of code were borrowed from Zhuojun Chen.
 
 if exists("b:current_syntax")
-    finish
+  finish
 endif
 
 setlocal iskeyword=@,48-57,_,.
 
 if exists("g:r_syntax_folding")
-    setlocal foldmethod=syntax
+  setlocal foldmethod=syntax
 endif
 
 syn case match
@@ -44,15 +44,15 @@ syn match rOComment contains=@Spell,rOKeyword "#'.*"
 
 
 if &filetype == "rhelp"
-    " string enclosed in double quotes
-    syn region rString contains=rSpecial,@Spell start=/"/ skip=/\\\\\|\\"/ end=/"/
-    " string enclosed in single quotes
-    syn region rString contains=rSpecial,@Spell start=/'/ skip=/\\\\\|\\'/ end=/'/
+  " string enclosed in double quotes
+  syn region rString contains=rSpecial,@Spell start=/"/ skip=/\\\\\|\\"/ end=/"/
+  " string enclosed in single quotes
+  syn region rString contains=rSpecial,@Spell start=/'/ skip=/\\\\\|\\'/ end=/'/
 else
-    " string enclosed in double quotes
-    syn region rString contains=rSpecial,rStrError,@Spell start=/"/ skip=/\\\\\|\\"/ end=/"/
-    " string enclosed in single quotes
-    syn region rString contains=rSpecial,rStrError,@Spell start=/'/ skip=/\\\\\|\\'/ end=/'/
+  " string enclosed in double quotes
+  syn region rString contains=rSpecial,rStrError,@Spell start=/"/ skip=/\\\\\|\\"/ end=/"/
+  " string enclosed in single quotes
+  syn region rString contains=rSpecial,rStrError,@Spell start=/'/ skip=/\\\\\|\\'/ end=/'/
 endif
 
 syn match rStrError display contained "\\."
@@ -117,9 +117,9 @@ syn match rOperator    '\*'
 syn match rOperator    '+'
 syn match rOperator    '='
 if &filetype != "rmd" && &filetype != "rrst"
-    syn match rOperator    "[|!<>^~/:]"
+  syn match rOperator    "[|!<>^~/:]"
 else
-    syn match rOperator    "[|!<>^~`/:]"
+  syn match rOperator    "[|!<>^~`/:]"
 endif
 syn match rOperator    "%\{2}\|%\S\{-}%"
 syn match rOpError  '\*\{3}'
@@ -137,13 +137,13 @@ syn match rDelimiter "[,;:]"
 
 " Error
 if exists("g:r_syntax_folding")
-    syn region rRegion matchgroup=Delimiter start=/(/ matchgroup=Delimiter end=/)/ transparent contains=ALLBUT,rError,rBraceError,rCurlyError fold
-    syn region rRegion matchgroup=Delimiter start=/{/ matchgroup=Delimiter end=/}/ transparent contains=ALLBUT,rError,rBraceError,rParenError fold
-    syn region rRegion matchgroup=Delimiter start=/\[/ matchgroup=Delimiter end=/]/ transparent contains=ALLBUT,rError,rCurlyError,rParenError fold
+  syn region rRegion matchgroup=Delimiter start=/(/ matchgroup=Delimiter end=/)/ transparent contains=ALLBUT,rError,rBraceError,rCurlyError fold
+  syn region rRegion matchgroup=Delimiter start=/{/ matchgroup=Delimiter end=/}/ transparent contains=ALLBUT,rError,rBraceError,rParenError fold
+  syn region rRegion matchgroup=Delimiter start=/\[/ matchgroup=Delimiter end=/]/ transparent contains=ALLBUT,rError,rCurlyError,rParenError fold
 else
-    syn region rRegion matchgroup=Delimiter start=/(/ matchgroup=Delimiter end=/)/ transparent contains=ALLBUT,rError,rBraceError,rCurlyError
-    syn region rRegion matchgroup=Delimiter start=/{/ matchgroup=Delimiter end=/}/ transparent contains=ALLBUT,rError,rBraceError,rParenError
-    syn region rRegion matchgroup=Delimiter start=/\[/ matchgroup=Delimiter end=/]/ transparent contains=ALLBUT,rError,rCurlyError,rParenError
+  syn region rRegion matchgroup=Delimiter start=/(/ matchgroup=Delimiter end=/)/ transparent contains=ALLBUT,rError,rBraceError,rCurlyError
+  syn region rRegion matchgroup=Delimiter start=/{/ matchgroup=Delimiter end=/}/ transparent contains=ALLBUT,rError,rBraceError,rParenError
+  syn region rRegion matchgroup=Delimiter start=/\[/ matchgroup=Delimiter end=/]/ transparent contains=ALLBUT,rError,rCurlyError,rParenError
 endif
 
 syn match rError      "[)\]}]"
@@ -166,8 +166,8 @@ syn match rLstElmt "@[a-zA-Z0-9\\._]*" contains=rDollar
 syn keyword rPreProc     library require attach detach source
 
 if &filetype == "rhelp"
-    syn match rHelpIdent '\\method'
-    syn match rHelpIdent '\\S4method'
+  syn match rHelpIdent '\\method'
+  syn match rHelpIdent '\\S4method'
 endif
 
 " Type
@@ -175,19 +175,19 @@ syn keyword rType array category character complex double function integer list
 
 " Name of object with spaces
 if &filetype != "rmd" && &filetype != "rrst"
-    syn region rNameWSpace start="`" end="`"
+  syn region rNameWSpace start="`" end="`"
 endif
 
 if &filetype == "rhelp"
-    syn match rhPreProc "^#ifdef.*"
-    syn match rhPreProc "^#endif.*"
-    syn match rhSection "\\dontrun\>"
+  syn match rhPreProc "^#ifdef.*"
+  syn match rhPreProc "^#endif.*"
+  syn match rhSection "\\dontrun\>"
 endif
 
 if exists("r_syn_minlines")
-    exe "syn sync minlines=" . r_syn_minlines
+  exe "syn sync minlines=" . r_syn_minlines
 else
-    syn sync minlines=40
+  syn sync minlines=40
 endif
 
 " Define the default highlighting.
@@ -227,4 +227,4 @@ hi def link rOKeyword    Title
 
 let b:current_syntax="r"
 
-" vim: ts=8 sw=4
+" vim: ts=8 sw=2
diff --git a/syntax/rhelp.vim b/syntax/rhelp.vim
index 7ba5bd9..32c91ad 100644
--- a/syntax/rhelp.vim
+++ b/syntax/rhelp.vim
@@ -2,7 +2,7 @@
 " Language:    R Help File
 " Maintainer: Jakson Aquino 
 " Former Maintainer: Johannes Ranke 
-" Last Change: Sat Mar 08, 2014  10:03PM
+" Last Change: Wed Jul 09, 2014  10:28PM
 " Remarks:     - Includes R syntax highlighting in the appropriate
 "                sections if an r.vim file is in the same directory or in the
 "                default debian location.
@@ -16,9 +16,9 @@
 " For version 5.x: Clear all syntax items
 " For version 6.x and 7.x: Quit when a syntax file was already loaded
 if version < 600 
-    syntax clear
+  syntax clear
 elseif exists("b:current_syntax")
-    finish
+  finish
 endif 
 
 setlocal iskeyword=@,48-57,_,.
@@ -53,9 +53,9 @@ syn region rhelpRcode matchgroup=Delimiter start="\\synopsis{" matchgroup=Delimi
 syn region rhelpRcode matchgroup=Delimiter start="\\special{" matchgroup=Delimiter transparent end="}" contains=@R
 
 if v:version > 703
-    syn region rhelpRcode matchgroup=Delimiter start="\\code{" skip='\\\@1 703
-    syn region rhelpVerbatim matchgroup=rhelpType start="\\samp{" skip='\\\@1= 508 || !exists("did_rhelp_syntax_inits")
-    if version < 508
-        let did_rhelp_syntax_inits = 1
-        command -nargs=+ HiLink hi link 
-    else
-        command -nargs=+ HiLink hi def link 
-    endif
-    HiLink rhelpVerbatim    String
-    HiLink rhelpDelimiter   Delimiter
-    HiLink rhelpIdentifier  Identifier
-    HiLink rhelpString      String
-    HiLink rhelpCodeSpecial Special
-    HiLink rhelpKeyword     Keyword
-    HiLink rhelpDots        Keyword
-    HiLink rhelpLink        Underlined
-    HiLink rhelpType        Type
-    HiLink rhelpSection     PreCondit
-    HiLink rhelpError       Error
-    HiLink rhelpBraceError  Error
-    HiLink rhelpCurlyError  Error
-    HiLink rhelpParenError  Error
-    HiLink rhelpPreProc     PreProc
-    HiLink rhelpDelimiter   Delimiter
-    HiLink rhelpComment     Comment
-    HiLink rhelpRComment    Comment
-    HiLink rhelpSpecialChar SpecialChar
-    delcommand HiLink
+  if version < 508
+    let did_rhelp_syntax_inits = 1
+    command -nargs=+ HiLink hi link 
+  else
+    command -nargs=+ HiLink hi def link 
+  endif
+  HiLink rhelpVerbatim    String
+  HiLink rhelpDelimiter   Delimiter
+  HiLink rhelpIdentifier  Identifier
+  HiLink rhelpString      String
+  HiLink rhelpCodeSpecial Special
+  HiLink rhelpKeyword     Keyword
+  HiLink rhelpDots        Keyword
+  HiLink rhelpLink        Underlined
+  HiLink rhelpType        Type
+  HiLink rhelpSection     PreCondit
+  HiLink rhelpError       Error
+  HiLink rhelpBraceError  Error
+  HiLink rhelpCurlyError  Error
+  HiLink rhelpParenError  Error
+  HiLink rhelpPreProc     PreProc
+  HiLink rhelpDelimiter   Delimiter
+  HiLink rhelpComment     Comment
+  HiLink rhelpRComment    Comment
+  HiLink rhelpSpecialChar SpecialChar
+  delcommand HiLink
 endif 
 
 let   b:current_syntax = "rhelp"
 
-" vim: foldmethod=marker sw=4
+" vim: foldmethod=marker sw=2
diff --git a/syntax/rmd.vim b/syntax/rmd.vim
index 90874f4..6f1b847 100644
--- a/syntax/rmd.vim
+++ b/syntax/rmd.vim
@@ -1,6 +1,6 @@
 " markdown Text with R statements
 " Language: markdown with R code chunks
-" Last Change: Fri May 09, 2014  01:40PM
+" Last Change: Wed Jul 09, 2014  10:29PM
 "
 " CONFIGURATION:
 "   To highlight chunk headers as R code, put in your vimrc:
@@ -8,36 +8,36 @@
 
 " for portability
 if version < 600
-    syntax clear
+  syntax clear
 elseif exists("b:current_syntax")
-    finish
+  finish
 endif
 
 " load all of pandoc info
 runtime syntax/pandoc.vim
 if exists("b:current_syntax")
-    let rmdIsPandoc = 1
-    unlet b:current_syntax
+  let rmdIsPandoc = 1
+  unlet b:current_syntax
 else
-    let rmdIsPandoc = 0
-    runtime syntax/markdown.vim
-    if exists("b:current_syntax")
-        unlet b:current_syntax
-    endif
+  let rmdIsPandoc = 0
+  runtime syntax/markdown.vim
+  if exists("b:current_syntax")
+    unlet b:current_syntax
+  endif
 endif
 
 " load all of the r syntax highlighting rules into @R
 syntax include @R syntax/r.vim
 if exists("b:current_syntax")
-    unlet b:current_syntax
+  unlet b:current_syntax
 endif
 
 if exists("g:rmd_syn_hl_chunk")
-    " highlight R code inside chunk header
-    syntax match rmdChunkDelim "^[ \t]*```{r" contained
-    syntax match rmdChunkDelim "}$" contained
+  " highlight R code inside chunk header
+  syntax match rmdChunkDelim "^[ \t]*```{r" contained
+  syntax match rmdChunkDelim "}$" contained
 else
-    syntax match rmdChunkDelim "^[ \t]*```{r.*}$" contained
+  syntax match rmdChunkDelim "^[ \t]*```{r.*}$" contained
 endif
 syntax match rmdChunkDelim "^[ \t]*```$" contained
 syntax region rmdChunk start="^[ \t]*``` *{r.*}$" end="^[ \t]*```$" contains=@R,rmdChunkDelim keepend fold
@@ -52,24 +52,24 @@ syntax match rmdSlidifySpecial "\*\*\*"
 
 
 if rmdIsPandoc == 0
-    syn match rmdBlockQuote /^\s*>.*\n\(.*\n\@"	contains=@texMathZoneGroup
-    " Region
-    syntax match rmdLaTeXRegDelim "\$\$" contained
-    syntax match rmdLaTeXRegDelim "\$\$latex$" contained
-    syntax region rmdLaTeXRegion start="^\$\$" skip="\\\$" end="\$\$$" contains=@LaTeX,rmdLaTeXSt,rmdLaTeXRegDelim keepend
-    syntax region rmdLaTeXRegion2 start="^\\\[" end="\\\]" contains=@LaTeX,rmdLaTeXSt,rmdLaTeXRegDelim keepend
-    hi def link rmdLaTeXSt Statement
-    hi def link rmdLaTeXInlDelim Special
-    hi def link rmdLaTeXRegDelim Special
+  syn match rmdBlockQuote /^\s*>.*\n\(.*\n\@"	contains=@texMathZoneGroup
+  " Region
+  syntax match rmdLaTeXRegDelim "\$\$" contained
+  syntax match rmdLaTeXRegDelim "\$\$latex$" contained
+  syntax region rmdLaTeXRegion start="^\$\$" skip="\\\$" end="\$\$$" contains=@LaTeX,rmdLaTeXSt,rmdLaTeXRegDelim keepend
+  syntax region rmdLaTeXRegion2 start="^\\\[" end="\\\]" contains=@LaTeX,rmdLaTeXSt,rmdLaTeXRegDelim keepend
+  hi def link rmdLaTeXSt Statement
+  hi def link rmdLaTeXInlDelim Special
+  hi def link rmdLaTeXRegDelim Special
 endif
 
 setlocal iskeyword=@,48-57,_,.
@@ -84,4 +84,4 @@ hi def link rmdSlidifySpecial Special
 
 let b:current_syntax = "rmd"
 
-" vim: ts=8 sw=4
+" vim: ts=8 sw=2
diff --git a/syntax/rrst.vim b/syntax/rrst.vim
index 7247407..4667b3a 100644
--- a/syntax/rrst.vim
+++ b/syntax/rrst.vim
@@ -1,7 +1,7 @@
 " reStructured Text with R statements
 " Language: reST with R code chunks
 " Maintainer: Alex Zvoleff, azvoleff@mail.sdsu.edu
-" Last Change: Sat Nov 09, 2013  07:28PM
+" Last Change: Wed Jul 09, 2014  10:29PM
 "
 " CONFIGURATION:
 "   To highlight chunk headers as R code, put in your vimrc:
@@ -9,9 +9,9 @@
 
 " for portability
 if version < 600
-    syntax clear
+  syntax clear
 elseif exists("b:current_syntax")
-    finish
+  finish
 endif
 
 " load all of the rst info
@@ -25,11 +25,11 @@ setlocal iskeyword=@,48-57,_,.
 
 " highlight R chunks
 if exists("g:rrst_syn_hl_chunk")
-    " highlight R code inside chunk header
-    syntax match rrstChunkDelim "^\.\. {r" contained
-    syntax match rrstChunkDelim "}$" contained
+  " highlight R code inside chunk header
+  syntax match rrstChunkDelim "^\.\. {r" contained
+  syntax match rrstChunkDelim "}$" contained
 else
-    syntax match rrstChunkDelim "^\.\. {r .*}$" contained
+  syntax match rrstChunkDelim "^\.\. {r .*}$" contained
 endif
 syntax match rrstChunkDelim "^\.\. \.\.$" contained
 syntax region rrstChunk start="^\.\. {r.*}$" end="^\.\. \.\.$" contains=@R,rrstChunkDelim keepend transparent fold
@@ -44,4 +44,4 @@ hi def link rrstInlineDelim Special
 
 let b:current_syntax = "rrst"
 
-" vim: ts=8 sw=4
+" vim: ts=8 sw=2

From a9975902ecdab4b155dc9b6a8e5ca05502bba92f Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Thu, 10 Jul 2014 19:21:11 -0300
Subject: [PATCH 0726/1050] Delete no longer used r-plugin/tex_indent.vim.

---
 Makefile                |   1 -
 doc/r-plugin.txt        |   3 +-
 list_for_vimball        |   1 -
 r-plugin/tex_indent.vim | 185 ----------------------------------------
 4 files changed, 1 insertion(+), 189 deletions(-)
 delete mode 100644 r-plugin/tex_indent.vim

diff --git a/Makefile b/Makefile
index edd33b2..7d35886 100644
--- a/Makefile
+++ b/Makefile
@@ -82,7 +82,6 @@ deb:
 	  - r-plugin/nvimserver.py\n\
 	  - r-plugin/timer.sh\n\
 	  - r-plugin/global_r_plugin.vim\n\
-	  - r-plugin/tex_indent.vim\n\
 	  - r-plugin/vimrconfig.vim\n\
 	  - r-plugin/functions.vim\n\
 	  - syntax/r.vim\n\
diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index abf74e5..742939e 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -1926,7 +1926,6 @@ directory after the installation:
    r-plugin/global_r_plugin.vim
    r-plugin/windows.py
    r-plugin/objlist/README
-   r-plugin/tex_indent.vim
    r-plugin/r.snippets
    r-plugin/common_buffer.vim
    r-plugin/common_global.vim
@@ -2561,7 +2560,7 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details.
 							       *r-plugin-news*
 10. News~
 
-1.0.1 (2014-07-07)
+1.0.1 (2014-07-10)
 
  * Minor bug fixes.
 
diff --git a/list_for_vimball b/list_for_vimball
index 077cafe..60eb428 100644
--- a/list_for_vimball
+++ b/list_for_vimball
@@ -23,7 +23,6 @@ r-plugin/common_global.vim
 r-plugin/global_r_plugin.vim
 r-plugin/objlist/README
 r-plugin/r.snippets
-r-plugin/tex_indent.vim
 r-plugin/nvimcom.py
 r-plugin/nvimserver.py
 r-plugin/timer.sh
diff --git a/r-plugin/tex_indent.vim b/r-plugin/tex_indent.vim
deleted file mode 100644
index 23c1704..0000000
--- a/r-plugin/tex_indent.vim
+++ /dev/null
@@ -1,185 +0,0 @@
-" Downloaded from: http://www.vim.org/scripts/script.php?script_id=218
-"
-" Vim indent file
-" Language:     LaTeX
-" Maintainer:   Johannes Tanzler 
-" Created:      Sat, 16 Feb 2002 16:50:19 +0100
-" Last Change:	Wed Feb 09, 2011  01:36PM
-" Last Update:  18th feb 2002, by LH :
-"               (*) better support for the option
-"               (*) use some regex instead of several '||'.
-"               Oct 9th, 2003, by JT:
-"               (*) don't change indentation of lines starting with '%'
-"               2005/06/15, Moshe Kaminsky 
-"               (*) New variables:
-"                   g:tex_items, g:tex_itemize_env, g:tex_noindent_env
-" Version: 0.4
-
-" Changed by Jakson Aquino to deal with R code chunks in rnoweb files.
-
-" Options: {{{
-"
-" To set the following options (ok, currently it's just one), add a line like
-"   let g:tex_indent_items = 1
-" to your ~/.vimrc.
-"
-" * g:tex_indent_items
-"
-"   If this variable is set, item-environments are indented like Emacs does
-"   it, i.e., continuation lines are indented with a shiftwidth.
-"   
-"   NOTE: I've already set the variable below; delete the corresponding line
-"   if you don't like this behaviour.
-"
-"   Per default, it is unset.
-"   
-"              set                                unset
-"   ----------------------------------------------------------------
-"       \begin{itemize}                      \begin{itemize}  
-"         \item blablabla                      \item blablabla
-"           bla bla bla                        bla bla bla  
-"         \item blablabla                      \item blablabla
-"           bla bla bla                        bla bla bla  
-"       \end{itemize}                        \end{itemize}    
-"
-"
-" * g:tex_items
-"
-"   A list of tokens to be considered as commands for the beginning of an item 
-"   command. The tokens should be separated with '\|'. The initial '\' should 
-"   be escaped. The default is '\\bibitem\|\\item'.
-"
-" * g:tex_itemize_env
-" 
-"   A list of environment names, separated with '\|', where the items (item 
-"   commands matching g:tex_items) may appear. The default is 
-"   'itemize\|description\|enumerate\|thebibliography'.
-"
-" * g:tex_noindent_env
-"
-"   A list of environment names. separated with '\|', where no indentation is 
-"   required. The default is 'document\|verbatim'.
-"
-" }}} 
-
-if exists("b:did_indent") | finish
-endif
-let b:did_indent = 1
-
-" Delete the next line to avoid the special indention of items
-if !exists("g:tex_indent_items")
-  let g:tex_indent_items = 1
-endif
-if g:tex_indent_items
-  if !exists("g:tex_itemize_env")
-    let g:tex_itemize_env = 'itemize\|description\|enumerate\|thebibliography'
-  endif
-  if !exists('g:tex_items')
-    let g:tex_items = '\\bibitem\|\\item' 
-  endif
-else
-  let g:tex_items = ''
-endif
-
-if !exists("g:tex_noindent_env")
-  let g:tex_noindent_env = 'document\|verbatim'
-endif
-
-setlocal indentexpr=GetTeXIndent2()
-setlocal nolisp
-setlocal nosmartindent
-setlocal autoindent
-exec 'setlocal indentkeys+=}' . substitute(g:tex_items, '^\|\(\\|\)', ',=', 'g')
-let g:tex_items = '^\s*' . g:tex_items
-
-
-" Only define the function once
-if exists("*GetTeXIndent2")
-  finish
-endif
-
-
-
-function GetTeXIndent2()
-
-  " Find a non-blank line above the current line.
-  let lnum = prevnonblank(v:lnum - 1)
-
-  " Skip R code chunk if the file type is rnoweb
-  if &filetype == "rnoweb" && getline(lnum) =~ "^@$"
-    let lnum = search("^<<.*>>=$", "bnW") - 1
-    if lnum < 0
-      let lnum = 0
-    endif
-  endif
-
-  " At the start of the file use zero indent.
-  if lnum == 0 | return 0 
-  endif
-
-  let ind = indent(lnum)
-  let line = getline(lnum)             " last line
-  let cline = getline(v:lnum)          " current line
-
-  " Ignore comments
-  if cline =~ '^\s*%'
-      return ind
-  endif
-  while lnum > 0 && (line =~ '^\s*%' || line =~ '^\s*$')
-      let lnum -= 1
-      let line = getline(lnum)
-  endwhile
-
-
-
-  " Add a 'shiftwidth' after beginning of environments.
-  " Don't add it for \begin{document} and \begin{verbatim}
-  ""if line =~ '^\s*\\begin{\(.*\)}'  && line !~ 'verbatim' 
-  " LH modification : \begin does not always start a line
-  if line =~ '\\begin{.*}'  && line !~ g:tex_noindent_env
-
-    let ind = ind + &sw
-
-    if g:tex_indent_items
-      " Add another sw for item-environments
-      if line =~ g:tex_itemize_env
-        let ind = ind + &sw
-      endif
-    endif
-  endif
-
-  
-  " Subtract a 'shiftwidth' when an environment ends
-  if cline =~ '^\s*\\end' && cline !~ g:tex_noindent_env
-
-    if g:tex_indent_items
-      " Remove another sw for item-environments
-      if cline =~ g:tex_itemize_env
-        let ind = ind - &sw
-      endif
-    endif
-
-    let ind = ind - &sw
-  endif
-
-  
-  " Special treatment for 'item'
-  " ----------------------------
-  
-  if g:tex_indent_items
-
-    " '\item' or '\bibitem' itself:
-    if cline =~ g:tex_items
-      let ind = ind - &sw
-    endif
-
-    " lines following to '\item' are intented once again:
-    if line =~ g:tex_items
-      let ind = ind + &sw
-    endif
-
-  endif
-
-  return ind
-endfunction
-

From 935944746b380f0f79bb253a1ccd4945910a2f87 Mon Sep 17 00:00:00 2001
From: Vince Buffalo 
Date: Tue, 15 Jul 2014 00:38:28 -0700
Subject: [PATCH 0727/1050] added dynlib as keyword

---
 syntax/r.vim | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/syntax/r.vim b/syntax/r.vim
index 15acccb..57b00dd 100644
--- a/syntax/r.vim
+++ b/syntax/r.vim
@@ -37,7 +37,7 @@ syn match rComment contains=@Spell,rCommentTodo "#.*"
 syn match rOKeyword contained "@\(param\|return\|name\|rdname\|examples\|include\|docType\)"
 syn match rOKeyword contained "@\(S3method\|TODO\|aliases\|alias\|assignee\|author\|callGraphDepth\|callGraph\)"
 syn match rOKeyword contained "@\(callGraphPrimitives\|concept\|exportClass\|exportMethod\|exportPattern\|export\|formals\)"
-syn match rOKeyword contained "@\(format\|importClassesFrom\|importFrom\|importMethodsFrom\|import\|keywords\)"
+syn match rOKeyword contained "@\(format\|importClassesFrom\|importFrom\|importMethodsFrom\|import\|keywords\|useDynLib\)"
 syn match rOKeyword contained "@\(method\|noRd\|note\|references\|seealso\|setClass\|slot\|source\|title\|usage\)"
 syn match rOKeyword contained "@\(family\|template\|templateVar\|description\|details\|inheritsParams\)"
 syn match rOComment contains=@Spell,rOKeyword "#'.*"

From dfca5634a8359e77d9c08139258fdc4ba6379488 Mon Sep 17 00:00:00 2001
From: Michael Lerch 
Date: Tue, 15 Jul 2014 22:12:36 -0600
Subject: [PATCH 0728/1050] Check if line is end of code chunk in rmd

---
 r-plugin/common_global.vim | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index a929412..0834a2e 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -1806,6 +1806,9 @@ function SendParagraphToR(e, m)
         if &filetype == "rnoweb" && line =~ "^@$"
             let j -= 1
             break
+        elseif &filetype == "rmd" && line =~ "^[ \t]*```$"
+            let j -= 1
+            break
         endif
         if line =~ '^\s*$'
             break

From 104df42bcabcf65fa2f8de530a03f52de20be21f Mon Sep 17 00:00:00 2001
From: Michael Lerch 
Date: Wed, 23 Jul 2014 08:55:09 -0600
Subject: [PATCH 0729/1050] Don't set help files to nomodifiable.

---
 r-plugin/common_global.vim | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 0834a2e..296d2e6 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -2455,7 +2455,8 @@ function ShowRDoc(rkeyword, package, getclass)
     normal! gg
     let @@ = save_unnamed_reg
     setlocal nomodified
-    setlocal nomodifiable
+    setlocal modifiable
+    setlocal readonly
     redraw
 endfunction
 

From 2871c55b3f2a230f6d3285d642ea23ac58aadb8c Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Sun, 3 Aug 2014 13:44:36 -0300
Subject: [PATCH 0730/1050] Don't set doc buffer as readonly. Avoid warnings
 when the user starts editing an R documentation buffer.

---
 ftplugin/rdoc.vim          | 5 +----
 r-plugin/common_global.vim | 2 --
 2 files changed, 1 insertion(+), 6 deletions(-)

diff --git a/ftplugin/rdoc.vim b/ftplugin/rdoc.vim
index 531cebf..addf008 100644
--- a/ftplugin/rdoc.vim
+++ b/ftplugin/rdoc.vim
@@ -1,7 +1,7 @@
 " Vim filetype plugin file
 " Language: R Documentation (generated by the Vim-R-plugin)
 " Maintainer: Jakson Alves de Aquino 
-" Last Change:	Sat Mar 22, 2014  09:26PM
+" Last Change:	Sun Aug 03, 2014  01:41PM
 
 
 " Only do this when not yet done for this buffer
@@ -26,8 +26,6 @@ setlocal iskeyword=@,48-57,_,.
 
 " Prepare R documentation output to be displayed by Vim
 function! FixRdoc()
-    let save_modf = &modifiable
-    set modifiable
     let lnr = line("$")
     for i in range(1, lnr)
         call setline(i, substitute(getline(i), "_\010", "", "g"))
@@ -83,7 +81,6 @@ function! FixRdoc()
         endif
     endif
 
-    let &modifiable = save_modf
     normal! gg
 
     " Clear undo history
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 296d2e6..34a7d48 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -2455,8 +2455,6 @@ function ShowRDoc(rkeyword, package, getclass)
     normal! gg
     let @@ = save_unnamed_reg
     setlocal nomodified
-    setlocal modifiable
-    setlocal readonly
     redraw
 endfunction
 

From e18c15972a2ebb8ded9b85745da44657be6b474e Mon Sep 17 00:00:00 2001
From: jakson 
Date: Tue, 5 Aug 2014 23:03:49 -0300
Subject: [PATCH 0731/1050] New key binding "ge" go to Examples in R docs.

---
 ftplugin/rdoc.vim | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/ftplugin/rdoc.vim b/ftplugin/rdoc.vim
index addf008..25a647e 100644
--- a/ftplugin/rdoc.vim
+++ b/ftplugin/rdoc.vim
@@ -1,7 +1,7 @@
 " Vim filetype plugin file
 " Language: R Documentation (generated by the Vim-R-plugin)
 " Maintainer: Jakson Alves de Aquino 
-" Last Change:	Sun Aug 03, 2014  01:41PM
+" Last Change:	Tue Aug 05, 2014  11:01PM
 
 
 " Only do this when not yet done for this buffer
@@ -119,6 +119,18 @@ endif
 
 call RSourceOtherScripts()
 
+function RDocExSection()
+    let ii = search("^Examples:$", "nW")
+    if ii == 0
+        call RWarningMsg("No example section below.")
+        return
+    else
+        call cursor(ii+1, 1)
+    endif
+endfunction
+
+nmap  ge :call RDocExSection()
+
 setlocal bufhidden=wipe
 setlocal noswapfile
 set buftype=nofile

From 42cb3d0fbe2347012b55eb67211e6989e672ec63 Mon Sep 17 00:00:00 2001
From: Jakson Aquino 
Date: Sat, 9 Aug 2014 14:29:33 -0300
Subject: [PATCH 0732/1050] Add ! to ftplugin/rdoc function.

---
 ftplugin/rdoc.vim | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ftplugin/rdoc.vim b/ftplugin/rdoc.vim
index 25a647e..bb768bc 100644
--- a/ftplugin/rdoc.vim
+++ b/ftplugin/rdoc.vim
@@ -1,7 +1,7 @@
 " Vim filetype plugin file
 " Language: R Documentation (generated by the Vim-R-plugin)
 " Maintainer: Jakson Alves de Aquino 
-" Last Change:	Tue Aug 05, 2014  11:01PM
+" Last Change:	Sat Aug 09, 2014  02:29PM
 
 
 " Only do this when not yet done for this buffer
@@ -119,7 +119,7 @@ endif
 
 call RSourceOtherScripts()
 
-function RDocExSection()
+function! RDocExSection()
     let ii = search("^Examples:$", "nW")
     if ii == 0
         call RWarningMsg("No example section below.")

From 96fec1a033ca390610a6ca633d743159354f0e15 Mon Sep 17 00:00:00 2001
From: Michael Lerch 
Date: Wed, 13 Aug 2014 15:11:44 -0600
Subject: [PATCH 0733/1050] New option: vimrplugin_user_maps_only

The plugin creates a lot of key mappings.  When turned off (default
value) the plugin continues to create the mappings.  When turned on,
then the only mappings that are created are those explicitly set by the
user.
---
 doc/r-plugin.txt           | 1 +
 r-plugin/common_global.vim | 7 ++++---
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 742939e..3203c26 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -1148,6 +1148,7 @@ is running:
 |vimrplugin_show_args|         Show extra information during omnicompletion
 |vimrplugin_vimcom_wait|       Time to wait for vimcom loading
 |vimrplugin_vim_wd|            Start R in Vim's working directory
+vimrplugin_user_maps_only    Only set user specified keybindings
 
 
 6.1. Terminal emulator (Linux/Unix only)~
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 34a7d48..4ec9368 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -2766,21 +2766,21 @@ function RCreateMaps(type, plug, combo, target)
     if a:type =~ "n"
         if hasmapto(a:plug, "n")
             exec 'noremap  ' . a:plug . ' ' . tg
-        else
+        elseif g:vimrplugin_user_maps_only == 0
             exec 'noremap  ' . a:combo . ' ' . tg
         endif
     endif
     if a:type =~ "v"
         if hasmapto(a:plug, "v")
             exec 'vnoremap  ' . a:plug . ' ' . tg
-        else
+        elseif g:vimrplugin_user_maps_only == 0
             exec 'vnoremap  ' . a:combo . ' ' . tg
         endif
     endif
     if g:vimrplugin_insert_mode_cmds == 1 && a:type =~ "i"
         if hasmapto(a:plug, "i")
             exec 'inoremap  ' . a:plug . ' ' . tg . il
-        else
+        elseif g:vimrplugin_user_maps_only == 0
             exec 'inoremap  ' . a:combo . ' ' . tg . il
         endif
     endif
@@ -3401,6 +3401,7 @@ call RSetDefaultValue("g:vimrplugin_rcomment_string", "'# '")
 call RSetDefaultValue("g:vimrplugin_vimpager",        "'tab'")
 call RSetDefaultValue("g:vimrplugin_objbr_place",     "'script,right'")
 call RSetDefaultValue("g:vimrplugin_permanent_libs",  "'base,stats,graphics,grDevices,utils,datasets,methods'")
+call RSetDefaultValue("g:vimrplugin_user_maps_only", 0)
 
 if executable("latexmk")
     call RSetDefaultValue("g:vimrplugin_latexcmd", "'latexmk -pdf'")

From 03ea294cded354f348b78c94b0367bfd67880cd6 Mon Sep 17 00:00:00 2001
From: Michael Lerch 
Date: Wed, 13 Aug 2014 15:44:59 -0600
Subject: [PATCH 0734/1050] Update help doc for vimrplugin_user_maps_only

---
 doc/r-plugin.txt | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 3203c26..54f51d0 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -1148,7 +1148,7 @@ is running:
 |vimrplugin_show_args|         Show extra information during omnicompletion
 |vimrplugin_vimcom_wait|       Time to wait for vimcom loading
 |vimrplugin_vim_wd|            Start R in Vim's working directory
-vimrplugin_user_maps_only    Only set user specified keybindings
+|vimrplugin_user_maps_only|    Only set user specified key bindings
 
 
 6.1. Terminal emulator (Linux/Unix only)~
@@ -1733,6 +1733,16 @@ your |vimrc|:
 This option is useful only for those who did not enable 'autochdir'.
 
 
+6.32 Only set key bindings that are user specified
+						  *vimrplugin_user_maps_only*
+The Vim-R-plugin sets many default key bindings.  The user can set custom
+key bindings (|r-plugin-key-bindings|).  If you wish the Vim-R-plugin to only
+set those key-bindings specified by the user, put in your vimrc:
+>
+    let vimrplugin_user_maps_only = 1
+<
+
+
 ==============================================================================
 						       *r-plugin-key-bindings*
 7. Custom key bindings~

From 2adfb3ccfb74e797b8f0c390b33cb3c94e56a93b Mon Sep 17 00:00:00 2001
From: Michael Lerch 
Date: Wed, 20 Aug 2014 10:04:52 -0600
Subject: [PATCH 0735/1050] Don't source functions multiple times

Fixes #117
---
 r-plugin/global_r_plugin.vim | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/r-plugin/global_r_plugin.vim b/r-plugin/global_r_plugin.vim
index 8ec33f0..d5f304a 100644
--- a/r-plugin/global_r_plugin.vim
+++ b/r-plugin/global_r_plugin.vim
@@ -23,6 +23,11 @@ endif
 
 call RSourceOtherScripts()
 
+if exists("g:rplugin_did_sourcelines")
+    finish
+endif
+let g:rplugin_did_sourcelines = 1
+
 function SourceNotDefined(lines, e)
     echohl WarningMsg
     echo 'The function to source "' . &filetype . '" lines is not defined.'

From a01932451383034b1dc701a0296036c53d56734a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Daniel=20Kvasni=C4=8Dka?=
 
Date: Thu, 21 Aug 2014 14:10:11 +0200
Subject: [PATCH 0736/1050] Checking that b:undo_ftplugin exists before
 appending to it

This plugin expects b:undo_ftplugin to exists which is not always the case. I made a very simple fix and it's very well possible that it can be written more succintly and idiomatically - but it worked for me :)
---
 ftplugin/r_rplugin.vim | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/ftplugin/r_rplugin.vim b/ftplugin/r_rplugin.vim
index 9e1378f..a73ac14 100644
--- a/ftplugin/r_rplugin.vim
+++ b/ftplugin/r_rplugin.vim
@@ -97,5 +97,8 @@ endif
 
 call RSourceOtherScripts()
 
-
-let b:undo_ftplugin .= " | unlet! b:IsInRCode b:SourceLines"
+if exists("b:undo_ftplugin")
+    let b:undo_ftplugin .= " | unlet! b:IsInRCode b:SourceLines"
+else
+    let b:undo_ftplugin = "unlet! b:IsInRCode b:SourceLines"   
+endif

From 4c23bef33157de4aa06641fb10fd7a9be4c3491b Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Thu, 28 Aug 2014 17:07:49 -0400
Subject: [PATCH 0737/1050] Update information about vimrplugin_show_args.

---
 doc/r-plugin.txt | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 54f51d0..c28f8db 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -612,9 +612,9 @@ of functions for syntax highlight.
 Vim can automatically complete the names of R objects when CTRL-X CTRL-O is
 pressed in insert mode (see |omni-completion| for details). Omni completion
 shows in a pop up menu the name of the object, its class and its environment
-(most frequently, its package name). If the object is a function, its
-arguments are shown in a separate window (see 'completeopt' if you want to
-disable the preview window).
+(most frequently, its package name). If the object is a function, the plugin
+can also show the function arguments in a separate preview window (this
+feature is disabled by default: see |vimrplugin_show_args|).
 
 If a data.frame is found, while building the list of objects, the columns in
 the data.frame are added to the list. When you try to use omni completion to

From dbfdf87e283c1d2465bf9ee777e0e776bcfe0bf5 Mon Sep 17 00:00:00 2001
From: Michael Lerch 
Date: Sat, 30 Aug 2014 17:12:55 -0600
Subject: [PATCH 0738/1050] Switch to rmarkdown for rmd files

rmarkdown essentially is a wrapper for knitr and pandoc
---
 doc/r-plugin.txt           |  2 +
 ftplugin/rmd_rplugin.vim   | 97 +++++++++++++-------------------------
 r-plugin/common_global.vim |  8 ++--
 3 files changed, 38 insertions(+), 69 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index c28f8db..faca6b6 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -1844,6 +1844,8 @@ RD, "cursor down"; RED, both "echo" and "down"):
    RMakePDF   (Sweave)
    RMakePDFK  (Knitr)
    RMakePDFKb (.Rmd, beamer)
+   RMakeRmd   (rmarkdown default)
+   RMakeAll   (rmarkdown all in yaml)
    ROpenPDF
    RSpinFile
    RMakeSlides (Slidify)
diff --git a/ftplugin/rmd_rplugin.vim b/ftplugin/rmd_rplugin.vim
index 19adbf5..aee1c74 100644
--- a/ftplugin/rmd_rplugin.vim
+++ b/ftplugin/rmd_rplugin.vim
@@ -65,27 +65,43 @@ function! RmdNextChunk() range
     return
 endfunction
 
-function! RMakeHTMLrmd(t)
+function! RMakeRmd(t)
     call RSetWD()
     update
-    let rcmd = 'require(knitr); knit2html("' . expand("%:t") . '")'
+
+    let rcmd = 'require(rmarkdown); render("' . expand("%:t") . '"'
     if a:t == "odt"
+        let rcmd = rcmd . ', "html_document"'
+    elseif a:t == "html"
+        let rcmd = rcmd . ', "html_document"'
+    elseif a:t == "pdf"
+        let rcmd = rcmd . ', "pdf_document"'
+    elseif a:t == "beamer"
+        let rcmd = rcmd . ', "beamer_presentation"'
+    elseif a:t == "all"
+        let rcmd = rcmd . ', "all"'
+    endif
+
+    let rcmd = rcmd . ')'
+
+    if g:vimrplugin_openhtml && a:t == "html"
+        let rcmd = rcmd . '; browseURL("' . expand("%:r:t") . '.html")'
+    elseif g:vimrplugin_openpdf && (a:t == "pdf" || a:t == "beamer")
+        let rcmd = rcmd . '; vim.openpdf("' . expand("%r:t") . '.pdf")'
+    elseif a:t == "odt"
         if g:rplugin_has_soffice == 0
             if has("win32") || has("win64")
-                let soffbin = "soffice.exe"
+                let g:rplugin_soffbin = "soffice.exe"
             else
-                let soffbin = "soffice"
+                let g:rplugin_soffbin = "soffice"
             endif
-            if executable(soffbin)
+            if executable(g:rplugin_soffbin)
                 let g:rplugin_has_soffice = 1
             else
-                call RWarningMsg("Is Libre Office installed? Cannot convert into ODT: '" . soffbin . "' not found.")
+                call RWarningMsg("Is Libre Office installed? Cannot convert into ODT: '" . g:rplugin_soffbin . "' not found.")
             endif
         endif
-        let rcmd = rcmd . '; system("' . soffbin . ' --invisible --convert-to odt ' . expand("%:r:t") . '.html")'
-    endif
-    if g:vimrplugin_openhtml && a:t == "html"
-        let rcmd = rcmd . '; browseURL("' . expand("%:r:t") . '.html")'
+        let rcmd = rcmd . '; system("' . g:rplugin_soffbin . ' --invisible --convert-to odt ' . expand("%:r:t") . '.html")'
     endif
     call g:SendCmdToR(rcmd)
 endfunction
@@ -100,57 +116,6 @@ function! RMakeSlidesrmd()
     call g:SendCmdToR(rcmd)
 endfunction
 
-
-function! RMakePDFrmd(t)
-    if g:rplugin_vimcomport == 0
-        if has("neovim")
-            call jobwrite(g:rplugin_clt_job, "DiscoverVimComPort\n")
-        else
-            Py DiscoverVimComPort()
-        endif
-        if g:rplugin_vimcomport == 0
-            call RWarningMsg("The vimcom package is required to make and open the PDF.")
-        endif
-    endif
-    if g:rplugin_has_pandoc == 0
-        if executable("pandoc")
-            let g:rplugin_has_pandoc = 1
-        else
-            call RWarningMsg("Cannot convert into PDF: 'pandoc' not found.")
-            return
-        endif
-    endif
-    call RSetWD()
-    update
-    let pdfcmd = "vim.interlace.rmd('" . expand("%:t") . "'"
-    let pdfcmd = pdfcmd . ", pdfout = '" . a:t  . "'"
-    if exists("g:vimrplugin_rmdcompiler")
-        let pdfcmd = pdfcmd . ", compiler='" . g:vimrplugin_rmdcompiler . "'"
-    endif
-    if exists("g:vimrplugin_knitargs")
-        let pdfcmd = pdfcmd . ", " . g:vimrplugin_knitargs
-    endif
-    if exists("g:vimrplugin_rmd2pdfpath")
-        pdfcmd = pdfcmd . ", rmd2pdfpath='" . g:vimrplugin_rmd2pdf_path . "'"
-    endif
-    if exists("g:vimrplugin_pandoc_args")
-        let pdfcmd = pdfcmd . ", pandoc_args = '" . g:vimrplugin_pandoc_args . "'"
-    endif
-    if g:vimrplugin_openpdf == 0
-        let pdfcmd = pdfcmd . ", view = FALSE"
-    else
-        if g:vimrplugin_openpdf == 1
-            if b:pdf_opened == 0
-                let b:pdf_opened = 1
-            else
-                let pdfcmd = pdfcmd . ", view = FALSE"
-            endif
-        endif
-    endif
-    let pdfcmd = pdfcmd . ")"
-    call g:SendCmdToR(pdfcmd)
-endfunction  
-
 " Send Rmd chunk to R
 function! SendRmdChunkToR(e, m)
     if RmdIsInRCode(0) == 0
@@ -186,11 +151,13 @@ call RCreateMaps("nvi", 'RSetwd',        'rd', ':call RSetWD()')
 
 " Only .Rmd files use these functions:
 call RCreateMaps("nvi", 'RKnit',        'kn', ':call RKnit()')
-call RCreateMaps("nvi", 'RMakePDFK',    'kp', ':call RMakePDFrmd("latex")')
-call RCreateMaps("nvi", 'RMakePDFKb',   'kl', ':call RMakePDFrmd("beamer")')
-call RCreateMaps("nvi", 'RMakeHTML',    'kh', ':call RMakeHTMLrmd("html")')
+call RCreateMaps("nvi", 'RMakeRmd',     'kr', ':call RMakeRmd("default")')
+call RCreateMaps("nvi", 'RMakeAll',     'ka', ':call RMakeRmd("all")')
+call RCreateMaps("nvi", 'RMakePDFK',    'kp', ':call RMakeRmd("pdf")')
+call RCreateMaps("nvi", 'RMakePDFKb',   'kl', ':call RMakeRmd("beamer")')
+call RCreateMaps("nvi", 'RMakeHTML',    'kh', ':call RMakeRmd("html")')
 call RCreateMaps("nvi", 'RMakeSlides',  'sl', ':call RMakeSlidesrmd()')
-call RCreateMaps("nvi", 'RMakeODT',     'ko', ':call RMakeHTMLrmd("odt")')
+call RCreateMaps("nvi", 'RMakeODT',     'ko', ':call RMakeRmd("odt")')
 call RCreateMaps("ni",  'RSendChunk',   'cc', ':call b:SendChunkToR("silent", "stay")')
 call RCreateMaps("ni",  'RESendChunk',  'ce', ':call b:SendChunkToR("echo", "stay")')
 call RCreateMaps("ni",  'RDSendChunk',  'cd', ':call b:SendChunkToR("silent", "down")')
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 4ec9368..967120c 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -2888,10 +2888,10 @@ function MakeRMenu()
             endif
         endif
         if &filetype == "rmd" || g:vimrplugin_never_unmake_menu
-            call RCreateMenuItem("nvi", 'Command.Knit\ and\ PDF\ (cur\ file)', 'RMakePDFK', 'kp', ':call RMakePDFrmd("latex")')
-            call RCreateMenuItem("nvi", 'Command.Knit\ and\ Beamer\ PDF\ (cur\ file)', 'RMakePDFKb', 'kl', ':call RMakePDFrmd("beamer")')
-            call RCreateMenuItem("nvi", 'Command.Knit\ and\ HTML\ (cur\ file)', 'RMakeHTML', 'kh', ':call RMakeHTMLrmd("html")')
-            call RCreateMenuItem("nvi", 'Command.Knit\ and\ ODT\ (cur\ file)', 'RMakeODT', 'ko', ':call RMakeHTMLrmd("odt")')
+            call RCreateMenuItem("nvi", 'Command.Knit\ and\ PDF\ (cur\ file)', 'RMakePDFK', 'kp', ':call RMakeRmd("pdf")')
+            call RCreateMenuItem("nvi", 'Command.Knit\ and\ Beamer\ PDF\ (cur\ file)', 'RMakePDFKb', 'kl', ':call RMakeRmd("beamer")')
+            call RCreateMenuItem("nvi", 'Command.Knit\ and\ HTML\ (cur\ file)', 'RMakeHTML', 'kh', ':call RMakeRmd("html")')
+            call RCreateMenuItem("nvi", 'Command.Knit\ and\ ODT\ (cur\ file)', 'RMakeODT', 'ko', ':call RMakeRmd("odt")')
             call RCreateMenuItem("nvi", 'Command.Slidify\ (cur\ file)', 'RMakeSlides', 'sl', ':call RMakeSlidesrmd()')
         endif
         if &filetype == "rrst" || g:vimrplugin_never_unmake_menu

From 91c221340721ac8e8e88df58d8cdaac89aa14824 Mon Sep 17 00:00:00 2001
From: Michael Lerch 
Date: Sat, 30 Aug 2014 17:29:58 -0600
Subject: [PATCH 0739/1050] Remove slidify support.

I am suggesting getting rid of slidify support because a) creating html
slides is easy enough with rmarkdown, b) development on the slidify
package seems to be slowing down, and c) adding support is easy enough
for the user to define their own RAction() call.

Also, this makes the code base cleaner with just a single vim function
responsible for all rmd markup.
---
 doc/r-plugin.txt           |  2 --
 ftplugin/rmd_rplugin.vim   | 11 -----------
 r-plugin/common_global.vim |  1 -
 3 files changed, 14 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index faca6b6..c8a9206 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -442,7 +442,6 @@ Command
   . Knit and HTML (cur file, verbose) (only .Rmd)      \kh
   . Knit and PDF (cur file, verbose) (Windows)         \kv
   . Spin (cur file) (only .R)                          \ks
-  . Slidify (cur file) (only .Rmd)                     \sl
   --------------------------------------------------------
   . Open PDF (cur file)                                \op
   --------------------------------------------------------
@@ -1848,7 +1847,6 @@ RD, "cursor down"; RED, both "echo" and "down"):
    RMakeAll   (rmarkdown all in yaml)
    ROpenPDF
    RSpinFile
-   RMakeSlides (Slidify)
 
    Object browser~
    RUpdateObjBrowser
diff --git a/ftplugin/rmd_rplugin.vim b/ftplugin/rmd_rplugin.vim
index aee1c74..9adcb33 100644
--- a/ftplugin/rmd_rplugin.vim
+++ b/ftplugin/rmd_rplugin.vim
@@ -106,16 +106,6 @@ function! RMakeRmd(t)
     call g:SendCmdToR(rcmd)
 endfunction
 
-function! RMakeSlidesrmd()
-    call RSetWD()
-    update
-    let rcmd = 'require(slidify); slidify("' . expand("%:t") . '")'
-    if g:vimrplugin_openhtml
-        let rcmd = rcmd . '; browseURL("' . expand("%:r:t") . '.html")'
-    endif
-    call g:SendCmdToR(rcmd)
-endfunction
-
 " Send Rmd chunk to R
 function! SendRmdChunkToR(e, m)
     if RmdIsInRCode(0) == 0
@@ -156,7 +146,6 @@ call RCreateMaps("nvi", 'RMakeAll',     'ka', ':call RMakeRmd("all")')
 call RCreateMaps("nvi", 'RMakePDFK',    'kp', ':call RMakeRmd("pdf")')
 call RCreateMaps("nvi", 'RMakePDFKb',   'kl', ':call RMakeRmd("beamer")')
 call RCreateMaps("nvi", 'RMakeHTML',    'kh', ':call RMakeRmd("html")')
-call RCreateMaps("nvi", 'RMakeSlides',  'sl', ':call RMakeSlidesrmd()')
 call RCreateMaps("nvi", 'RMakeODT',     'ko', ':call RMakeRmd("odt")')
 call RCreateMaps("ni",  'RSendChunk',   'cc', ':call b:SendChunkToR("silent", "stay")')
 call RCreateMaps("ni",  'RESendChunk',  'ce', ':call b:SendChunkToR("echo", "stay")')
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 967120c..b38f75d 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -2892,7 +2892,6 @@ function MakeRMenu()
             call RCreateMenuItem("nvi", 'Command.Knit\ and\ Beamer\ PDF\ (cur\ file)', 'RMakePDFKb', 'kl', ':call RMakeRmd("beamer")')
             call RCreateMenuItem("nvi", 'Command.Knit\ and\ HTML\ (cur\ file)', 'RMakeHTML', 'kh', ':call RMakeRmd("html")')
             call RCreateMenuItem("nvi", 'Command.Knit\ and\ ODT\ (cur\ file)', 'RMakeODT', 'ko', ':call RMakeRmd("odt")')
-            call RCreateMenuItem("nvi", 'Command.Slidify\ (cur\ file)', 'RMakeSlides', 'sl', ':call RMakeSlidesrmd()')
         endif
         if &filetype == "rrst" || g:vimrplugin_never_unmake_menu
             call RCreateMenuItem("nvi", 'Command.Knit\ and\ PDF\ (cur\ file)', 'RMakePDFK', 'kp', ':call RMakePDFrrst()')

From 329ab766ad6d41fd59d2c060df69a8fc319b6851 Mon Sep 17 00:00:00 2001
From: Michael Lerch 
Date: Sun, 14 Sep 2014 13:12:57 -0600
Subject: [PATCH 0740/1050] Find indented code chunks.

In Rmd, code chunks can be preceded by white space.
---
 indent/rmd.vim | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/indent/rmd.vim b/indent/rmd.vim
index 78be795..9a8a3cb 100644
--- a/indent/rmd.vim
+++ b/indent/rmd.vim
@@ -33,10 +33,10 @@ function GetMdIndent()
 endfunction
 
 function GetRmdIndent()
-  if getline(".") =~ '^```{r .*}$' || getline(".") =~ '^```$'
+  if getline(".") =~ '^[ \t]*```{r .*}$' || getline(".") =~ '^[ \t]*```$'
     return 0
   endif
-  if search('^```{r', "bncW") > search('^```$', "bncW")
+  if search('^[ \t]*```{r', "bncW") > search('^[ \t]*```$', "bncW")
     return s:RIndent()
   else
     return GetMdIndent()

From aa80bd6296e43b8c103d7f2ca3f8b7e6ffbd9187 Mon Sep 17 00:00:00 2001
From: Harold Pimentel 
Date: Sat, 20 Sep 2014 16:04:58 -0700
Subject: [PATCH 0741/1050] g:vimrplugin_assign = 2 swap precedence of '_' and
 '<-'

---
 r-plugin/common_global.vim | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index b38f75d..0b67fa8 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -78,7 +78,7 @@ function ReplaceUnderS()
     else
         let j = col(".")
         let s = getline(".")
-        if g:vimrplugin_assign_map == "_" && j > 3 && s[j-3] == "<" && s[j-2] == "-" && s[j-1] == " "
+        if g:vimrplugin_assign == 1 && g:vimrplugin_assign_map == "_" && j > 3 && s[j-3] == "<" && s[j-2] == "-" && s[j-1] == " "
             let save_unnamed_reg = @@
             exe "normal! 3h3xr_"
             let @@ = save_unnamed_reg
@@ -97,6 +97,19 @@ function ReplaceUnderS()
                         let isString = 0
                     endif
                 endif
+            else
+                if g:vimrplugin_assign == 2
+                    if s[j-1] != "_" && !(j > 3 && s[j-3] == "<" && s[j-2] == "-" && s[j-1] == " ")
+                        let isString = 1
+                    elseif j > 3 && s[j-3] == "<" && s[j-2] == "-" && s[j-1] == " "
+                        let save_unnamed_reg = @@
+                        exe "normal! 3h3xr_a_"
+                        let @@ = save_unnamed_reg
+                        return
+                    else
+                        exe "normal! 1x"
+                    endif
+                endif
             endif
         endif
     endif
@@ -2924,7 +2937,7 @@ function MakeRMenu()
     " Edit
     "----------------------------------------------------------------------------
     if &filetype == "r" || &filetype == "rnoweb" || &filetype == "rrst" || &filetype == "rhelp" || g:vimrplugin_never_unmake_menu
-        if g:vimrplugin_assign == 1
+        if g:vimrplugin_assign == 1 || g:vimrplugin_assign == 2
             silent exe 'imenu  R.Edit.Insert\ \"\ <-\ \"' . g:vimrplugin_assign_map . ' :call ReplaceUnderS()a'
         endif
         imenu  R.Edit.Complete\ object\ name^X^O 
@@ -3129,7 +3142,7 @@ function RCreateEditMaps()
     call RCreateMaps("ni", 'RRightComment',   ';', ':call MovePosRCodeComment("normal")')
     call RCreateMaps("v", 'RRightComment',    ';', ':call MovePosRCodeComment("selection")')
     " Replace 'underline' with '<-'
-    if g:vimrplugin_assign == 1
+    if g:vimrplugin_assign == 1 || g:vimrplugin_assign == 2
         silent exe 'imap  ' . g:vimrplugin_assign_map . ' :call ReplaceUnderS()a'
     endif
     if hasmapto("RCompleteArgs", "i")

From 9c97ac002bdc2502dcd613b832222d9a527e82cb Mon Sep 17 00:00:00 2001
From: Harold Pimentel 
Date: Sat, 20 Sep 2014 16:17:30 -0700
Subject: [PATCH 0742/1050] bugfix: insert '_' after a rString or rSpecial

---
 r-plugin/common_global.vim | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 0b67fa8..29f4281 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -93,7 +93,7 @@ function ReplaceUnderS()
                 let isString = 1
                 if s[j-1] == '"' || s[j-1] == "'"
                     let synName = synIDattr(synID(line("."), j-2, 1), "name")
-                    if synName == "rString" || synName == "rSpecial"
+                    if (synName == "rString" || synName == "rSpecial") && g:vimrplugin_assign == 1
                         let isString = 0
                     endif
                 endif

From 01ce6c4656a0749d3a5e1fe22991bb6017424452 Mon Sep 17 00:00:00 2001
From: Harold Pimentel 
Date: Sat, 20 Sep 2014 16:21:38 -0700
Subject: [PATCH 0743/1050] short circuit to behave same way as prev bugfix

---
 r-plugin/common_global.vim | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 29f4281..6ba213b 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -91,9 +91,9 @@ function ReplaceUnderS()
         else
             if synName == "rString"
                 let isString = 1
-                if s[j-1] == '"' || s[j-1] == "'"
+                if s[j-1] == '"' || s[j-1] == "'" && g:vimrplugin_assign == 1
                     let synName = synIDattr(synID(line("."), j-2, 1), "name")
-                    if (synName == "rString" || synName == "rSpecial") && g:vimrplugin_assign == 1
+                    if (synName == "rString" || synName == "rSpecial")
                         let isString = 0
                     endif
                 endif

From 217e2056dcb0633656b3c0b0f063128c108847b9 Mon Sep 17 00:00:00 2001
From: Harold Pimentel 
Date: Sat, 20 Sep 2014 16:22:31 -0700
Subject: [PATCH 0744/1050] cleanup to match master on if statement

---
 r-plugin/common_global.vim | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 6ba213b..cadd0bd 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -93,7 +93,7 @@ function ReplaceUnderS()
                 let isString = 1
                 if s[j-1] == '"' || s[j-1] == "'" && g:vimrplugin_assign == 1
                     let synName = synIDattr(synID(line("."), j-2, 1), "name")
-                    if (synName == "rString" || synName == "rSpecial")
+                    if synName == "rString" || synName == "rSpecial"
                         let isString = 0
                     endif
                 endif

From 034587ba76f9ee5b51c4a4848d8caa63e3310535 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sat, 20 Sep 2014 20:41:07 -0400
Subject: [PATCH 0745/1050] vimrplugin_assign now accepts values 0, 1 and 2.

---
 doc/r-plugin.txt | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index c8a9206..0a4ead2 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -1205,13 +1205,13 @@ it.
 						      *vimrplugin_rnowebchunk*
 						       *vimrplugin_assign_map*
 							   *vimrplugin_assign*
-In Rnoweb files, a '<' is replaced with '<<>>=\n@'. To disable this feature,
+In Rnoweb files, a `<` is replaced with `<<>>=\n@`. To disable this feature,
 put in your |vimrc|:
 >
    let vimrplugin_rnowebchunk = 0
 <
-While editing R code, '_' is replaced with ' <- '. If want to bind other keys
-to be replaced by ' <- ', set the value of |vimrplugin_assign_map| in your
+While editing R code, `_` is replaced with `<-`. If want to bind other keys
+to be replaced by `<-`, set the value of |vimrplugin_assign_map| in your
 |vimrc|, as in the example below which emulates RStudio behavior (may only
 works on GVim):
 >
@@ -1232,6 +1232,9 @@ To completely disable this feature, put in your |vimrc|:
 >
    let vimrplugin_assign = 0
 <
+If you need to type many object names with underscores, you may want to change
+the value vimrplugin_assign to 2. Then, you will have to type two `_` to get
+them converted into `<-`.
 
 6.4. Object Browser options~
 						      *vimrplugin_objbr_place*
@@ -2571,10 +2574,12 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details.
 							       *r-plugin-news*
 10. News~
 
-1.0.1 (2014-07-10)
+1.0.1 (2014-09-20)
 
  * Minor bug fixes.
 
+ * The option vimrplugin_assign now accepts the values 0, 1 and 2.
+
 1.0 (2014-07-02)
 
  * The package now depends on vimcom (which is fully featured and is no longer

From f642dc93497685f01bc4a97b2099d915d7a13304 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sun, 21 Sep 2014 09:11:23 -0400
Subject: [PATCH 0746/1050] Note on problematic mappings.

---
 doc/r-plugin.txt | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 0a4ead2..ffd216b 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -2019,6 +2019,13 @@ You may also want to remap :
 
    http://stackoverflow.com/questions/2269005/how-can-i-change-the-keybinding-used-to-autocomplete-in-vim
 
+Note: Not all mappings work in all versions of Vim. Some mappings may not work
+on GVim on Windows, and others may not work on Vim running in a terminal
+emulator or in Linux Console. The use of ,  and  keys in
+mappings are particularly problematic. See:
+
+   https://github.com/jcfaria/Vim-R-plugin/issues/111
+
 You can also use Vim's 'clientserver' feature to send remote messages to Vim.
 For example, if you want a keyboard shortcut that sends to Vim the command to
 send the current line to R and go down to the next line of code, then use your
@@ -2574,7 +2581,7 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details.
 							       *r-plugin-news*
 10. News~
 
-1.0.1 (2014-09-20)
+1.0.1 (2014-09-21)
 
  * Minor bug fixes.
 

From 4c77af7c3ce93c8711e73a981ed48c2d208a8aa5 Mon Sep 17 00:00:00 2001
From: Harold Pimentel 
Date: Sun, 21 Sep 2014 08:23:24 -0700
Subject: [PATCH 0747/1050] bugfix for when inserting <- in the middle of line

---
 r-plugin/common_global.vim | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index cadd0bd..afc6115 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -107,7 +107,14 @@ function ReplaceUnderS()
                         let @@ = save_unnamed_reg
                         return
                     else
-                        exe "normal! 1x"
+                        if s[j+1] == $
+                            exe "normal! 1x"
+                        else
+                            let save_unnamed_reg = @@
+                            exe "normal! 1xi <- "
+                            let @@ = save_unnamed_reg
+                            return
+                        endif
                     endif
                 endif
             endif

From 73ddf85500ba1e9df8d927a2bc50bac0f31e5950 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sun, 21 Sep 2014 15:17:39 -0400
Subject: [PATCH 0748/1050] Minor bug fix.

---
 r-plugin/common_global.vim | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index afc6115..203311b 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -107,7 +107,7 @@ function ReplaceUnderS()
                         let @@ = save_unnamed_reg
                         return
                     else
-                        if s[j+1] == $
+                        if j == len(getline("."))
                             exe "normal! 1x"
                         else
                             let save_unnamed_reg = @@

From a5ad1200fca94aa8aca7468c81f1a08e2258aa1b Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sun, 21 Sep 2014 16:06:39 -0400
Subject: [PATCH 0749/1050] Improve minor bug fix.

---
 r-plugin/common_global.vim | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 203311b..fd1c374 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -107,7 +107,7 @@ function ReplaceUnderS()
                         let @@ = save_unnamed_reg
                         return
                     else
-                        if j == len(getline("."))
+                        if j == len(s)
                             exe "normal! 1x"
                         else
                             let save_unnamed_reg = @@

From 86169c49b2ca5b1d73e0ddf34e4c78e375e67616 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Mon, 22 Sep 2014 08:02:33 -0400
Subject: [PATCH 0750/1050] Always recover saved register.

---
 r-plugin/common_global.vim | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index fd1c374..a2c9741 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -76,10 +76,10 @@ function ReplaceUnderS()
     if &filetype != "r" && b:IsInRCode(0) == 0
         let isString = 1
     else
+        let save_unnamed_reg = @@
         let j = col(".")
         let s = getline(".")
         if g:vimrplugin_assign == 1 && g:vimrplugin_assign_map == "_" && j > 3 && s[j-3] == "<" && s[j-2] == "-" && s[j-1] == " "
-            let save_unnamed_reg = @@
             exe "normal! 3h3xr_"
             let @@ = save_unnamed_reg
             return
@@ -102,15 +102,14 @@ function ReplaceUnderS()
                     if s[j-1] != "_" && !(j > 3 && s[j-3] == "<" && s[j-2] == "-" && s[j-1] == " ")
                         let isString = 1
                     elseif j > 3 && s[j-3] == "<" && s[j-2] == "-" && s[j-1] == " "
-                        let save_unnamed_reg = @@
                         exe "normal! 3h3xr_a_"
                         let @@ = save_unnamed_reg
                         return
                     else
                         if j == len(s)
                             exe "normal! 1x"
+                            let @@ = save_unnamed_reg
                         else
-                            let save_unnamed_reg = @@
                             exe "normal! 1xi <- "
                             let @@ = save_unnamed_reg
                             return

From 48d404c510a1afaf138568496c4caadf3c891c25 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Wed, 24 Sep 2014 09:13:47 -0400
Subject: [PATCH 0751/1050] Make URLs clickable in r-plugin.html.

---
 Makefile | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Makefile b/Makefile
index 7d35886..6f88d44 100644
--- a/Makefile
+++ b/Makefile
@@ -181,6 +181,7 @@ htmldoc:
 	    sed -i -e 's/||/<\/code>/g' r-plugin.html ;\
 	    sed -i -e 's/`//g' r-plugin.html ;\
+	    sed -i -e 's/\( *\)\(http\S*\)/\1\2<\/a>/' r-plugin.html ;\
 	    sed -i -e 's/<\/pre>
/  --------------------------------------------------------\n/' r-plugin.html ;\
 	    mv r-plugin.html vim-stylesheet.css /tmp )
 

From 07d0e3b58c855e439ee1aaf4fd541ce2c2b72db9 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Thu, 2 Oct 2014 13:59:16 -0400
Subject: [PATCH 0752/1050] Make the value of VIMINSTANCEID random.

---
 r-plugin/common_global.vim | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index a2c9741..004e814 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -3865,10 +3865,19 @@ if &filetype == "rbrowser"
         call RWarningMsgInp("VIMINSTANCEID is undefined")
     endif
 else
-    let $VIMINSTANCEID = substitute(g:rplugin_firstbuffer, '\W', '', 'g') . substitute(localtime(), '.*\(...\)', '\1', '')
+    if !has("neovim")
+        Py import random
+        Py import vim
+        Py vim.command("let g:rplugin_random = '" + str(random.randrange(0, 1000000000)) + "'")
+    endif
+    if !exists("g:rplugin_random")
+        let g:rplugin_random = substitute(localtime(), '.*\(...\)', '\1', '')
+    endif
+    let $VIMINSTANCEID = substitute(g:rplugin_firstbuffer, '\W', '', 'g') . g:rplugin_random
     if strlen($VIMINSTANCEID) > 64
         let $VIMINSTANCEID = substitute($VIMINSTANCEID, '.*\(...............................................................\)', '\1', '')
     endif
+    unlet g:rplugin_random
 endif
 
 let g:rplugin_obsname = toupper(substitute(substitute(expand("%:r"), '\W', '', 'g'), "_", "", "g"))

From 5eea616964cf261346d5f1e1c383954779f43e07 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Thu, 2 Oct 2014 15:27:20 -0400
Subject: [PATCH 0753/1050] Prefix VIMINSTANCEID to code to be evaluated.

---
 autoload/rcomplete.vim     |  4 ++--
 r-plugin/common_global.vim | 14 +++++++-------
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/autoload/rcomplete.vim b/autoload/rcomplete.vim
index 48c22d9..7ed2490 100644
--- a/autoload/rcomplete.vim
+++ b/autoload/rcomplete.vim
@@ -19,9 +19,9 @@ function BuildROmniList()
     call delete($VIMRPLUGIN_TMPDIR . "/vimbol_finished")
     call delete($VIMRPLUGIN_TMPDIR . "/eval_reply")
     if has("neovim")
-        call g:SendToVimCom("I\002" . omnilistcmd)
+        call g:SendToVimCom('\x08' . $VIMINSTANCEID . "I\002" . omnilistcmd)
     else
-        call g:SendToVimCom(omnilistcmd)
+        call g:SendToVimCom('\x08' . $VIMINSTANCEID . omnilistcmd)
     endif
     if g:rplugin_vimcomport == 0
         sleep 500m
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 004e814..0e79932 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -288,7 +288,7 @@ function RCompleteArgs()
                 else
                     let msg = msg . ')'
                 endif
-                call g:SendToVimCom(msg)
+                call g:SendToVimCom('\x08' . $VIMINSTANCEID . msg)
 
                 if g:rplugin_vimcomport > 0
                     let g:rplugin_lastev = ReadEvalReply()
@@ -1426,9 +1426,9 @@ function RFormatCode() range
     endif
     call delete($VIMRPLUGIN_TMPDIR . "/eval_reply")
     if has("neovim")
-        call g:SendToVimCom("I\002" . 'formatR::tidy.source("' . $VIMRPLUGIN_TMPDIR . '/unformatted_code", file = "' . $VIMRPLUGIN_TMPDIR . '/formatted_code", width.cutoff = ' . wco . ')')
+        call g:SendToVimCom('\x08' . $VIMINSTANCEID . "I\002" . 'formatR::tidy.source("' . $VIMRPLUGIN_TMPDIR . '/unformatted_code", file = "' . $VIMRPLUGIN_TMPDIR . '/formatted_code", width.cutoff = ' . wco . ')')
     else
-        call g:SendToVimCom('formatR::tidy.source("' . $VIMRPLUGIN_TMPDIR . '/unformatted_code", file = "' . $VIMRPLUGIN_TMPDIR . '/formatted_code", width.cutoff = ' . wco . ')')
+        call g:SendToVimCom('\x08' . $VIMINSTANCEID . 'formatR::tidy.source("' . $VIMRPLUGIN_TMPDIR . '/unformatted_code", file = "' . $VIMRPLUGIN_TMPDIR . '/formatted_code", width.cutoff = ' . wco . ')')
     endif
     let g:rplugin_lastev = ReadEvalReply()
     if g:rplugin_lastev == "R is busy." || g:rplugin_lastev == "UNKNOWN" || g:rplugin_lastev =~ "^Error" || g:rplugin_lastev == "INVALID" || g:rplugin_lastev == "ERROR" || g:rplugin_lastev == "EMPTY" || g:rplugin_lastev == "No reply"
@@ -1455,7 +1455,7 @@ function RInsert(cmd)
 
     call delete($VIMRPLUGIN_TMPDIR . "/eval_reply")
     call delete($VIMRPLUGIN_TMPDIR . "/Rinsert")
-    call g:SendToVimCom('capture.output(' . a:cmd . ', file = "' . $VIMRPLUGIN_TMPDIR . '/Rinsert")')
+    call g:SendToVimCom('\x08' . $VIMINSTANCEID . 'capture.output(' . a:cmd . ', file = "' . $VIMRPLUGIN_TMPDIR . '/Rinsert")')
     let g:rplugin_lastev = ReadEvalReply()
     if g:rplugin_lastev == "R is busy." || g:rplugin_lastev == "UNKNOWN" || g:rplugin_lastev =~ "^Error" || g:rplugin_lastev == "INVALID" || g:rplugin_lastev == "ERROR" || g:rplugin_lastev == "EMPTY" || g:rplugin_lastev == "No reply"
         call RWarningMsg(g:rplugin_lastev)
@@ -2395,9 +2395,9 @@ function ShowRDoc(rkeyword, package, getclass)
     endif
 
     if has("neovim")
-        call g:SendToVimCom("I\002" . rcmd)
+        call g:SendToVimCom('\x08' . $VIMINSTANCEID . "I\002" . rcmd)
     else
-        call g:SendToVimCom(rcmd)
+        call g:SendToVimCom('\x08' . $VIMINSTANCEID . rcmd)
     endif
 
     let g:rplugin_lastev = ReadEvalReply()
@@ -2412,7 +2412,7 @@ function ShowRDoc(rkeyword, package, getclass)
             let chn = input(msg . "Please, select one of them: ")
             if chn > 0 && chn < len(libs)
                 call delete($VIMRPLUGIN_TMPDIR . "/eval_reply")
-                call g:SendToVimCom('vim.help("' . a:rkeyword . '", ' . g:rplugin_htw . 'L, package="' . libs[chn] . '")')
+                call g:SendToVimCom('\x08' . $VIMINSTANCEID . 'vim.help("' . a:rkeyword . '", ' . g:rplugin_htw . 'L, package="' . libs[chn] . '")')
                 let g:rplugin_lastev = ReadEvalReply()
             else
                 return

From 0c0b80f1e2f756bf098c64ea125ac0a4a3ef1794 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Thu, 2 Oct 2014 16:01:39 -0400
Subject: [PATCH 0754/1050] Send VIMINSTANCEID to vimcom. Instead of getting
 VIMINSTANCEID as reply, send it to vimcom while checking the port number.

---
 r-plugin/vimcom.py | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/r-plugin/vimcom.py b/r-plugin/vimcom.py
index 6559bc0..f8d97fe 100644
--- a/r-plugin/vimcom.py
+++ b/r-plugin/vimcom.py
@@ -14,14 +14,14 @@ def DiscoverVimComPort():
     HOST = "localhost"
     VimComPort = 10000
     repl = "NOTHING"
-    correct_repl = vim.eval("$VIMINSTANCEID")
-    if correct_repl is None:
-        correct_repl = os.getenv("VIMINSTANCEID")
-        if correct_repl is None:
+    vii = vim.eval("$VIMINSTANCEID")
+    if vii is None:
+        vii = os.getenv("VIMINSTANCEID")
+        if vii is None:
             vim.command("call RWarningMsg('VIMINSTANCEID not found.')")
             return
 
-    while repl.find(correct_repl) < 0 and VimComPort < 10049:
+    while repl.find("Correct_VIMINSTANCEID") < 0 and VimComPort < 10049:
         VimComPort = VimComPort + 1
         for res in socket.getaddrinfo(HOST, VimComPort, socket.AF_UNSPEC, socket.SOCK_DGRAM):
             af, socktype, proto, canonname, sa = res
@@ -30,13 +30,13 @@ def DiscoverVimComPort():
                 sock.settimeout(0.1)
                 sock.connect(sa)
                 if sys.hexversion < 0x03000000:
-                    sock.send("\001What port [Python 2]?")
+                    sock.send("\001" + vii + " What port [Python 2]?")
                     repl = sock.recv(1024)
                 else:
-                    sock.send("\001What port [Python 3]?".encode())
+                    sock.send("\001" + vii + " What port [Python 3]?".encode())
                     repl = sock.recv(1024).decode()
                 sock.close()
-                if repl.find(correct_repl):
+                if repl.find("Correct_VIMINSTANCEID"):
                     VimComFamily = af
                     break
             except:

From f408b5c3910662c7066d287feac779747ed9bda3 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Thu, 2 Oct 2014 16:17:46 -0400
Subject: [PATCH 0755/1050] Use os.urandom instead of random.randrange.

---
 r-plugin/common_global.vim | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 0e79932..8f56bee 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -3866,9 +3866,10 @@ if &filetype == "rbrowser"
     endif
 else
     if !has("neovim")
-        Py import random
+        Py import os
+        Py import base64
         Py import vim
-        Py vim.command("let g:rplugin_random = '" + str(random.randrange(0, 1000000000)) + "'")
+        Py vim.command("let g:rplugin_random = '" + base64.b64encode(os.urandom(16)).decode() + "'")
     endif
     if !exists("g:rplugin_random")
         let g:rplugin_random = substitute(localtime(), '.*\(...\)', '\1', '')

From 486a954cbaa5f842f426408eba87093e6dca040b Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Thu, 2 Oct 2014 17:04:40 -0400
Subject: [PATCH 0756/1050] Check if vimcom knows the secret.

---
 r-plugin/common_global.vim | 34 +++++++++-------------------------
 r-plugin/vimcom.py         | 18 ++++++++++++------
 2 files changed, 21 insertions(+), 31 deletions(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 8f56bee..9d8a2d5 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -624,6 +624,7 @@ function StartR_TmuxSplit(rcmd)
     endif
     call system("tmux set-environment VIMEDITOR_SVRNM " . $VIMEDITOR_SVRNM)
     call system("tmux set-environment VIMINSTANCEID " . $VIMINSTANCEID)
+    call system("tmux set-environment VIMRPLUGINSECRET " . $VIMRPLUGINSECRET)
     let tcmd = "tmux split-window "
     if g:vimrplugin_vsplit
         if g:vimrplugin_rconsole_width == -1
@@ -678,6 +679,7 @@ function StartR_ExternalTerm(rcmd)
                 \ 'set-environment -g VIMRPLUGIN_TMPDIR "' . $VIMRPLUGIN_TMPDIR . '"',
                 \ 'set-environment -g VIMRPLUGIN_HOME "' . g:rplugin_home . '"',
                 \ 'set-environment VIMINSTANCEID ' . $VIMINSTANCEID ,
+                \ 'set-environment VIMRPLUGINSECRET ' . $VIMRPLUGINSECRET ,
                 \ 'set-environment VIMEDITOR_SVRNM ' . $VIMEDITOR_SVRNM ]
     if g:vimrplugin_notmuxconf
         let cnflines = cnflines + [ 'source-file ~/.tmux.conf' ]
@@ -700,19 +702,21 @@ function StartR_ExternalTerm(rcmd)
             call extend(cnflines, ['set -g mode-mouse on', 'set -g mouse-select-pane on', 'set -g mouse-resize-pane on'])
         endif
     endif
-    call extend(cnflines, ['set-environment VIMINSTANCEID "' . $VIMINSTANCEID . '"'])
+    call extend(cnflines, ['set-environment VIMINSTANCEID "' . $VIMINSTANCEID . '"',
+                \ 'set-environment VIMRPLUGINSECRET "' . $VIMRPLUGINSECRET . '"'])
     call writefile(cnflines, s:tmxcnf)
 	
 	let is_bash = system('echo $BASH')
 	if v:shell_error || len(is_bash) == 0 || empty(matchstr(tolower(is_bash),'undefined variable')) == 0
 		let rcmd = a:rcmd
 	else
-		let rcmd = "VIMINSTANCEID=" . $VIMINSTANCEID . " " . a:rcmd
+		let rcmd = "VIMINSTANCEID=" . $VIMINSTANCEID . " VIMRPLUGINSECRET=" . $VIMRPLUGINSECRET . " " . a:rcmd
 	endif
 
     call system('export VIMRPLUGIN_TMPDIR=' . $VIMRPLUGIN_TMPDIR)
     call system('export VIMRPLUGIN_HOME=' . substitute(g:rplugin_home, ' ', '\\ ', "g"))
     call system('export VIMINSTANCEID=' . $VIMINSTANCEID)
+    call system('export VIMRPLUGINSECRET=' . $VIMRPLUGINSECRET)
     call system('export VIMEDITOR_SVRNM=' . $VIMEDITOR_SVRNM)
     " Start the terminal emulator even if inside a Tmux session
     if $TMUX != ""
@@ -941,28 +945,6 @@ function StartR(whatr)
     echon
 endfunction
 
-function ReceiveVimComStartMsg(msg)
-    let vmsg = split(a:msg)
-    if len(vmsg) == 4
-        if vmsg[0] != "vimcom"
-            call RWarningMsg("Invalid package name: " . vmsg[0])
-        endif
-        if vmsg[1] != "1.0-0"
-            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.0-0.')
-        endif
-        if vmsg[2] != $VIMINSTANCEID
-            call RWarningMsg("Invalid ID: " . vmsg[2] . " [Correct = " . $VIMINSTANCEID . "]")
-        endif
-        if vmsg[3] > "10000" && vmsg[3] < "10049"
-            let g:rplugin_vimcomport = vmsg[3]
-            " Give vimcom some time to complete its startup process
-            sleep 20m
-        else
-            call RWarningMsg("Invalid vimcom port: " . vmsg[2])
-        endif
-    endif
-endfunction
-
 function NoLongerWaitVimCom()
     if filereadable($VIMRPLUGIN_TMPDIR . "/vimcom_running")
         call delete($VIMRPLUGIN_TMPDIR . "/vimcom_running")
@@ -3870,11 +3852,13 @@ else
         Py import base64
         Py import vim
         Py vim.command("let g:rplugin_random = '" + base64.b64encode(os.urandom(16)).decode() + "'")
+        let $VIMRPLUGINSECRET = substitute(g:rplugin_random, '\W', '', 'g')
+        Py vim.command("let g:rplugin_random = '" + base64.b64encode(os.urandom(16)).decode() + "'")
     endif
     if !exists("g:rplugin_random")
         let g:rplugin_random = substitute(localtime(), '.*\(...\)', '\1', '')
     endif
-    let $VIMINSTANCEID = substitute(g:rplugin_firstbuffer, '\W', '', 'g') . g:rplugin_random
+    let $VIMINSTANCEID = substitute(g:rplugin_firstbuffer . g:rplugin_random, '\W', '', 'g')
     if strlen($VIMINSTANCEID) > 64
         let $VIMINSTANCEID = substitute($VIMINSTANCEID, '.*\(...............................................................\)', '\1', '')
     endif
diff --git a/r-plugin/vimcom.py b/r-plugin/vimcom.py
index f8d97fe..89e879c 100644
--- a/r-plugin/vimcom.py
+++ b/r-plugin/vimcom.py
@@ -4,7 +4,7 @@
 import os
 import re
 VimComPort = 0
-PortWarn = False
+PortWarn = 0
 VimComFamily = None
 
 def DiscoverVimComPort():
@@ -20,8 +20,14 @@ def DiscoverVimComPort():
         if vii is None:
             vim.command("call RWarningMsg('VIMINSTANCEID not found.')")
             return
+    scrt = vim.eval("$VIMRPLUGINSECRET")
+    if scrt is None:
+        scrt = os.getenv("VIMRPLUGINSECRET")
+        if scrt is None:
+            vim.command("call RWarningMsg('VIMRPLUGINSECRET not found.')")
+            return
 
-    while repl.find("Correct_VIMINSTANCEID") < 0 and VimComPort < 10049:
+    while repl.find(scrt) < 0 and VimComPort < 10049:
         VimComPort = VimComPort + 1
         for res in socket.getaddrinfo(HOST, VimComPort, socket.AF_UNSPEC, socket.SOCK_DGRAM):
             af, socktype, proto, canonname, sa = res
@@ -36,7 +42,7 @@ def DiscoverVimComPort():
                     sock.send("\001" + vii + " What port [Python 3]?".encode())
                     repl = sock.recv(1024).decode()
                 sock.close()
-                if repl.find("Correct_VIMINSTANCEID"):
+                if repl.find(scrt):
                     VimComFamily = af
                     break
             except:
@@ -46,12 +52,12 @@ def DiscoverVimComPort():
     if VimComPort >= 10049:
         VimComPort = 0
         vim.command("let g:rplugin_vimcomport = 0")
-        if not PortWarn:
+        if PortWarn < 2:
             vim.command("call RWarningMsg('VimCom port not found.')")
-        PortWarn = True
+        PortWarn = PortWarn + 1
     else:
         vim.command("let g:rplugin_vimcomport = " + str(VimComPort))
-        PortWarn = False
+        PortWarn = 0
         if repl.find("1.0-0") != 0:
             vim.command("call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.0-0.')")
             vim.command("sleep 1")

From 147b78c579093765e71d7ac23650141bdeb4966a Mon Sep 17 00:00:00 2001
From: Michael Lerch 
Date: Thu, 2 Oct 2014 18:05:06 -0600
Subject: [PATCH 0757/1050] Check for neovim is now has("nvim")

---
 autoload/rcomplete.vim      |  2 +-
 ftplugin/rnoweb_rplugin.vim |  2 +-
 ftplugin/rrst_rplugin.vim   |  2 +-
 r-plugin/common_buffer.vim  |  2 +-
 r-plugin/common_global.vim  | 60 ++++++++++++++++++-------------------
 r-plugin/vimrconfig.vim     |  8 ++---
 6 files changed, 38 insertions(+), 38 deletions(-)

diff --git a/autoload/rcomplete.vim b/autoload/rcomplete.vim
index 7ed2490..c76c262 100644
--- a/autoload/rcomplete.vim
+++ b/autoload/rcomplete.vim
@@ -18,7 +18,7 @@ function BuildROmniList()
 
     call delete($VIMRPLUGIN_TMPDIR . "/vimbol_finished")
     call delete($VIMRPLUGIN_TMPDIR . "/eval_reply")
-    if has("neovim")
+    if has("nvim")
         call g:SendToVimCom('\x08' . $VIMINSTANCEID . "I\002" . omnilistcmd)
     else
         call g:SendToVimCom('\x08' . $VIMINSTANCEID . omnilistcmd)
diff --git a/ftplugin/rnoweb_rplugin.vim b/ftplugin/rnoweb_rplugin.vim
index 987b4ac..ff0b19f 100644
--- a/ftplugin/rnoweb_rplugin.vim
+++ b/ftplugin/rnoweb_rplugin.vim
@@ -77,7 +77,7 @@ endfunction
 " Sweave and compile the current buffer content
 function! RMakePDF(bibtex, knit)
     if g:rplugin_vimcomport == 0
-        if has("neovim")
+        if has("nvim")
             call jobwrite(g:rplugin_clt_job, "DiscoverVimComPort\n")
         else
             Py DiscoverVimComPort()
diff --git a/ftplugin/rrst_rplugin.vim b/ftplugin/rrst_rplugin.vim
index 0ad3fd4..8c5cbbd 100644
--- a/ftplugin/rrst_rplugin.vim
+++ b/ftplugin/rrst_rplugin.vim
@@ -96,7 +96,7 @@ endfunction
 
 function! RMakePDFrrst()
     if g:rplugin_vimcomport == 0
-        if has("neovim")
+        if has("nvim")
             call jobwrite(g:rplugin_clt_job, "DiscoverVimComPort\n")
         else
             Py DiscoverVimComPort()
diff --git a/r-plugin/common_buffer.vim b/r-plugin/common_buffer.vim
index 8a4095e..4413b0f 100644
--- a/r-plugin/common_buffer.vim
+++ b/r-plugin/common_buffer.vim
@@ -72,7 +72,7 @@ if !exists("g:SendCmdToR")
     let g:SendCmdToR = function('SendCmdToR_fake')
 endif
 
-if !has("neovim")
+if !has("nvim")
     if &filetype != "rbrowser"
         if v:servername == "" || has("gui_macvim")
             autocmd CursorHold  call RCheckLibListFile()
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 9d8a2d5..4cb5c2a 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -268,7 +268,7 @@ function RCompleteArgs()
             " If R is running, use it
             if string(g:SendCmdToR) != "function('SendCmdToR_fake')"
                 call delete($VIMRPLUGIN_TMPDIR . "/eval_reply")
-                if has("neovim")
+                if has("nvim")
                     let msg = "I\002" . 'vimcom:::vim.args("'
                 else
                     let msg = 'vimcom:::vim.args("'
@@ -819,7 +819,7 @@ endfunction
 function StartR(whatr)
     if has("gui_macvim")
         let $VIMEDITOR_SVRNM = "MacVim"
-    elseif has("neovim")
+    elseif has("nvim")
         let $VIMEDITOR_SVRNM = "Neovim_" . g:rplugin_myport
     elseif !has("clientserver")
         let $VIMEDITOR_SVRNM = "NoClientServer"
@@ -887,14 +887,14 @@ function StartR(whatr)
                         call g:SendCmdToR("\014")
                     endif
                     call VimExprToOB('ResetVimComPort()')
-                    if !has("neovim")
+                    if !has("nvim")
                         call g:SendToVimCom("\002" . g:rplugin_obsname)
                     endif
                     call g:SendToVimCom("\005G .GlobalEnv [Restarting R]")
                     call g:SendToVimCom("\005L Libraries [Restarting()]")
                     " vimcom automatically update the libraries view, but not
                     " the GlobalEnv one because vimcom_count_objects() returns 0.
-                    if !has("neovim")
+                    if !has("nvim")
                         call VimExprToOB('UpdateOB("GlobalEnv")')
                     endif
                 endif
@@ -925,7 +925,7 @@ function StartR(whatr)
         call StartR_ExternalTerm(rcmd)
         if g:vimrplugin_restart && bufloaded(b:objbrtitle)
             call WaitVimComStart()
-            if has("neovim")
+            if has("nvim")
                 call g:SendToVimCom("\002" . g:rplugin_myport)
             else
                 call g:SendToVimCom("\002" . v:servername)
@@ -955,7 +955,7 @@ endfunction
 
 " Neovim don't need this function:
 function WaitVimComStart()
-    if has("neovim")
+    if has("nvim")
         if filereadable(g:rplugin_home . "/r-plugin/timer.sh")
             let wjob = jobstart('waitvc', "sh", [g:rplugin_home . '/r-plugin/timer.sh', string(g:vimrplugin_vimcom_wait / 1000), 'call NoLongerWaitVimCom()'])
             autocmd JobActivity waitvc call RServerEvent()
@@ -1017,7 +1017,7 @@ function IsExternalOBRunning()
 endfunction
 
 function ResetVimComPort()
-    if has("neovim")
+    if has("nvim")
         call jobwrite(g:rplugin_clt_job, "DiscoverVimComPort\n")
     else
         Py VimComPort = 0
@@ -1039,7 +1039,7 @@ function StartObjBrowser_Tmux()
 
     " Don't start the Object Browser if it already exists
     if IsExternalOBRunning()
-        if !has("neovim") && (has("gui_macvim") || $DISPLAY == "") && exists("g:rplugin_ob_pane")
+        if !has("nvim") && (has("gui_macvim") || $DISPLAY == "") && exists("g:rplugin_ob_pane")
             let slog = system("tmux set-buffer ':silent call UpdateOB(\"both\")\:\' && tmux paste-buffer -t " . g:rplugin_ob_pane . " && tmux select-pane -t " . g:rplugin_ob_pane)
             if v:shell_error
                 call RWarningMsg(slog)
@@ -1051,7 +1051,7 @@ function StartObjBrowser_Tmux()
     let objbrowserfile = $VIMRPLUGIN_TMPDIR . "/objbrowserInit"
     let tmxs = " "
 
-    if has("neovim")
+    if has("nvim")
         let myservername = g:rplugin_myport
     else
         if v:servername == ""
@@ -1079,7 +1079,7 @@ function StartObjBrowser_Tmux()
                 \ 'if has("clientserver") && v:servername != ""',
                 \ '    call g:SendToVimCom("\002" . v:servername)',
                 \ 'endif',
-                \ 'if !has("neovim")',
+                \ 'if !has("nvim")',
                 \ '    sleep 150m',
                 \ '    call UpdateOB("GlobalEnv")',
                 \ 'endif'], objbrowserfile)
@@ -1114,7 +1114,7 @@ function StartObjBrowser_Tmux()
         let obsname = " "
     endif
 
-    if has("neovim")
+    if has("nvim")
         let vimname = "nvim"
     else
         let vimname = "vim"
@@ -1144,11 +1144,11 @@ function StartObjBrowser_Tmux()
         endif
     endif
     if g:rplugin_ob_warn_shown == 0
-        if !has("clientserver") && !has("neovim")
+        if !has("clientserver") && !has("nvim")
             call RWarningMsg("The +clientserver feature is required to automatically update the Object Browser.")
             sleep 200m
         else
-            if $DISPLAY == "" && !has("neovim")
+            if $DISPLAY == "" && !has("nvim")
                 call RWarningMsg("The X Window system is required to automatically update the Object Browser.")
                 sleep 200m
             endif
@@ -1169,7 +1169,7 @@ function StartObjBrowser_Vim()
     endif
 
     let wmsg = ""
-    if v:servername == "" && !has("neovim")
+    if v:servername == "" && !has("nvim")
         if g:rplugin_ob_warn_shown == 0
             if !has("clientserver")
                 let wmsg = "The +clientserver feature is required to automatically update the Object Browser."
@@ -1186,7 +1186,7 @@ function StartObjBrowser_Vim()
         if has("gui_macvim")
             let wmsg ="MacVim cannot automatically updated the Object Browser."
             let g:rplugin_ob_warn_shown = 1
-        elseif has("neovim")
+        elseif has("nvim")
             call g:SendToVimCom("\002" . g:rplugin_myport)
         else
             call g:SendToVimCom("\002" . v:servername)
@@ -1235,7 +1235,7 @@ endfunction
 
 " Open an Object Browser window
 function RObjBrowser()
-    if !has("python") && !has("python3") && !has("neovim")
+    if !has("python") && !has("python3") && !has("nvim")
         call RWarningMsg("Python support is required to run the Object Browser.")
         return
     endif
@@ -1265,7 +1265,7 @@ function RObjBrowser()
 endfunction
 
 function VimExprToOB(msg)
-    if !has("neovim") && serverlist() =~ "\\<" . g:rplugin_obsname . "\n"
+    if !has("nvim") && serverlist() =~ "\\<" . g:rplugin_obsname . "\n"
         return remote_expr(g:rplugin_obsname, a:msg)
     else
         if IsExternalOBRunning()
@@ -1379,14 +1379,14 @@ function RBrOpenCloseLs_TmuxOB(status)
         return
     endif
     call g:SendToVimCom("\007" . a:status)
-    if !has("neovim") && v:servername == ""
+    if !has("nvim") && v:servername == ""
         call UpdateOB("both")
     endif
 endfunction
 
 function RFormatCode() range
     if g:rplugin_vimcomport == 0
-        if has("neovim")
+        if has("nvim")
             call jobwrite(g:rplugin_clt_job, "DiscoverVimComPort\n")
         else
             Py DiscoverVimComPort()
@@ -1407,7 +1407,7 @@ function RFormatCode() range
         let wco = 180
     endif
     call delete($VIMRPLUGIN_TMPDIR . "/eval_reply")
-    if has("neovim")
+    if has("nvim")
         call g:SendToVimCom('\x08' . $VIMINSTANCEID . "I\002" . 'formatR::tidy.source("' . $VIMRPLUGIN_TMPDIR . '/unformatted_code", file = "' . $VIMRPLUGIN_TMPDIR . '/formatted_code", width.cutoff = ' . wco . ')')
     else
         call g:SendToVimCom('\x08' . $VIMINSTANCEID . 'formatR::tidy.source("' . $VIMRPLUGIN_TMPDIR . '/unformatted_code", file = "' . $VIMRPLUGIN_TMPDIR . '/formatted_code", width.cutoff = ' . wco . ')')
@@ -1425,7 +1425,7 @@ endfunction
 
 function RInsert(cmd)
     if g:rplugin_vimcomport == 0
-        if has("neovim")
+        if has("nvim")
             call jobwrite(g:rplugin_clt_job, "DiscoverVimComPort\n")
         else
             Py DiscoverVimComPort()
@@ -2158,7 +2158,7 @@ endfunction
 " This function is called by the R package vimcom whenever a library is
 " loaded.
 function RFillLibList()
-    if &filetype == "r" || has("neovim")
+    if &filetype == "r" || has("nvim")
         call RealRFillLibList()
     else
         " Avoid E341 (Internal error: lalloc(0, ))
@@ -2326,7 +2326,7 @@ endfunction
 " Show R's help doc in Vim's buffer
 " (based  on pydoc plugin)
 function ShowRDoc(rkeyword, package, getclass)
-    if !has("python") && !has("python3") && !has("neovim")
+    if !has("python") && !has("python3") && !has("nvim")
         call RWarningMsg("Python support is required to see R documentation on Vim.")
         return
     endif
@@ -2376,7 +2376,7 @@ function ShowRDoc(rkeyword, package, getclass)
         let rcmd = 'vim.help("' . a:rkeyword . '", ' . g:rplugin_htw . 'L, ' . classfor . ')'
     endif
 
-    if has("neovim")
+    if has("nvim")
         call g:SendToVimCom('\x08' . $VIMINSTANCEID . "I\002" . rcmd)
     else
         call g:SendToVimCom('\x08' . $VIMINSTANCEID . rcmd)
@@ -2531,7 +2531,7 @@ function RAction(rcmd)
                         if g:rplugin_vim_pane == "none"
                             call RWarningMsg("Cmd not available.")
                         else
-                            if g:rplugin_editor_sname == "" || has("neovim")
+                            if g:rplugin_editor_sname == "" || has("nvim")
                                 let slog = system("tmux set-buffer '" . "\\" . ':call ShowRDoc("' . rkeyword . '", "' . pkg . '", 0)' . "\' && tmux paste-buffer -t " . g:rplugin_vim_pane . " && tmux select-pane -t " . g:rplugin_vim_pane)
                                 if v:shell_error
                                     call RWarningMsg(slog)
@@ -3387,7 +3387,7 @@ call RSetDefaultValue("g:vimrplugin_editor_w",         66)
 call RSetDefaultValue("g:vimrplugin_help_w",           46)
 call RSetDefaultValue("g:vimrplugin_objbr_w",          40)
 call RSetDefaultValue("g:vimrplugin_external_ob",       0)
-if has("neovim")
+if has("nvim")
     call RSetDefaultValue("g:vimrplugin_vimcom_wait", 15000)
 else
     call RSetDefaultValue("g:vimrplugin_vimcom_wait", 5000)
@@ -3487,7 +3487,7 @@ if has("python3")
 elseif has("python")
     command! -nargs=+ Py :py 
     command! -nargs=+ PyFile :pyfile 
-elseif has("neovim")
+elseif has("nvim")
     command! -nargs=+ Py :call RWarningMsg("Py command not implemented yet: '" .  . "'")
     let g:SendToVimCom = function("SendToVimCom_Neovim")
 else
@@ -3552,7 +3552,7 @@ if g:rplugin_tmuxwasfirst
     if &filetype == "rbrowser"
         let g:RBrOpenCloseLs = function("RBrOpenCloseLs_TmuxOB")
     else
-        if has("neovim")
+        if has("nvim")
             let g:RBrOpenCloseLs = function("RBrOpenCloseLs_TmuxNeovim")
         else
             let g:RBrOpenCloseLs = function("RBrOpenCloseLs_TmuxVim")
@@ -3847,7 +3847,7 @@ if &filetype == "rbrowser"
         call RWarningMsgInp("VIMINSTANCEID is undefined")
     endif
 else
-    if !has("neovim")
+    if !has("nvim")
         Py import os
         Py import base64
         Py import vim
@@ -3875,7 +3875,7 @@ if &filetype != "rbrowser"
     call writefile([], $VIMRPLUGIN_TMPDIR . "/GlobalEnvList_" . $VIMINSTANCEID)
 endif
 
-if has("neovim")
+if has("nvim")
     if executable("python")
         if &filetype == "rbrowser"
             let $THIS_IS_ObjBrowser = "yes"
diff --git a/r-plugin/vimrconfig.vim b/r-plugin/vimrconfig.vim
index d4454ab..30d4ffa 100644
--- a/r-plugin/vimrconfig.vim
+++ b/r-plugin/vimrconfig.vim
@@ -199,7 +199,7 @@ function! RConfigVimrc()
         if !filereadable(uvimrc) && filereadable($HOME . "/vimfiles/vimrc")
             let uvimrc = $HOME . "/vimfiles/vimrc"
         endif
-    elseif has("neovim")
+    elseif has("nvim")
         let uvimrc = $HOME . "/.nvimrc"
         if !filereadable(uvimrc) && filereadable($HOME . "/.nvim/nvimrc")
             let uvimrc = $HOME . "/.nvim/nvimrc"
@@ -418,7 +418,7 @@ function! RConfigBash()
             echo "but we have to configure the TERM environment variable for that."
             echo "Instead of starting Tmux and then starting Vim, we can configure"
             echo "Bash to start both at once with the 'tvim' command."
-            if !has("neovim")
+            if !has("nvim")
                 echo "The 'clientserver' feature must be enabled for automatic update of"
                 echo "the Object Browser and syntax highlight of function names."
             endif
@@ -432,7 +432,7 @@ function! RConfigBash()
                 else
                     let blines += ['# Lines added by the Vim-R-plugin command :RpluginConfig:']
                 endif
-                if has("neovim")
+                if has("nvim")
                     let blines += ['# Change the TERM environment variable (to get 256 colors) and creates',
                                 \ '# a function to run Tmux and Neovim at once:',
                                 \ 'if [ "$TERM" = "xterm" ] || [ "$TERM" = "xterm-256color" ]',
@@ -557,7 +557,7 @@ function! RConfigTmux()
 endfunction
 
 function! RConfigVimR()
-    if has("neovim")
+    if has("nvim")
         let s:vimprog = "nvim"
     else
         let s:vimprog = "vim"

From 7703341fb84741225068978c03b8b19492127ab1 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Thu, 2 Oct 2014 20:58:11 -0400
Subject: [PATCH 0758/1050] Test if has Python (and not neovim).

---
 r-plugin/common_global.vim | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 4cb5c2a..86229d5 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -3847,7 +3847,7 @@ if &filetype == "rbrowser"
         call RWarningMsgInp("VIMINSTANCEID is undefined")
     endif
 else
-    if !has("nvim")
+    if has("python") || has("python3")
         Py import os
         Py import base64
         Py import vim
@@ -3856,7 +3856,8 @@ else
         Py vim.command("let g:rplugin_random = '" + base64.b64encode(os.urandom(16)).decode() + "'")
     endif
     if !exists("g:rplugin_random")
-        let g:rplugin_random = substitute(localtime(), '.*\(...\)', '\1', '')
+        let $VIMRPLUGINSECRET = substitute(strftime("%c"), '\W', '', 'g')
+        let g:rplugin_random = localtime()
     endif
     let $VIMINSTANCEID = substitute(g:rplugin_firstbuffer . g:rplugin_random, '\W', '', 'g')
     if strlen($VIMINSTANCEID) > 64

From 09aaa08ed2922db98fa8593a34c702924cf2a1fd Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Thu, 2 Oct 2014 21:11:01 -0400
Subject: [PATCH 0759/1050] Do "echo $RANDOM" if necessary.

---
 r-plugin/common_global.vim | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 86229d5..5fe2d1e 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -3856,8 +3856,16 @@ else
         Py vim.command("let g:rplugin_random = '" + base64.b64encode(os.urandom(16)).decode() + "'")
     endif
     if !exists("g:rplugin_random")
-        let $VIMRPLUGINSECRET = substitute(strftime("%c"), '\W', '', 'g')
-        let g:rplugin_random = localtime()
+        if !has("win32") && !has("win64") && !has("gui_win32") && !has("gui_win64")
+            let g:rplugin_random = system("echo $RANDOM")
+        endif
+        if exists("g:rplugin_random")
+            let $VIMRPLUGINSECRET = substitute(g:rplugin_random, '\W', '', 'g')
+            let g:rplugin_random = system("echo $RANDOM")
+        else
+            let $VIMRPLUGINSECRET = substitute(strftime("%c"), '\W', '', 'g')
+            let g:rplugin_random = localtime()
+        endif
     endif
     let $VIMINSTANCEID = substitute(g:rplugin_firstbuffer . g:rplugin_random, '\W', '', 'g')
     if strlen($VIMINSTANCEID) > 64

From 6a372231271b40255c7b9bfb6c364a541e962817 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Fri, 3 Oct 2014 21:10:27 -0400
Subject: [PATCH 0760/1050] Put ReceiveVimComStartMsg back for neovim.

---
 r-plugin/common_global.vim | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 5fe2d1e..55ec3a5 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -945,6 +945,28 @@ function StartR(whatr)
     echon
 endfunction
 
+function ReceiveVimComStartMsg(msg)
+    let vmsg = split(a:msg)
+    if len(vmsg) == 4
+        if vmsg[0] != "vimcom"
+            call RWarningMsg("Invalid package name: " . vmsg[0])
+        endif
+        if vmsg[1] != "1.0-0"
+            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.0-0.')
+        endif
+        if vmsg[2] != $VIMINSTANCEID
+            call RWarningMsg("Invalid ID: " . vmsg[2] . " [Correct = " . $VIMINSTANCEID . "]")
+        endif
+        if vmsg[3] > "10000" && vmsg[3] < "10049"
+            let g:rplugin_vimcomport = vmsg[3]
+            " Give vimcom some time to complete its startup process
+            sleep 20m
+        else
+            call RWarningMsg("Invalid vimcom port: " . vmsg[2])
+        endif
+    endif
+endfunction
+
 function NoLongerWaitVimCom()
     if filereadable($VIMRPLUGIN_TMPDIR . "/vimcom_running")
         call delete($VIMRPLUGIN_TMPDIR . "/vimcom_running")

From 5baae8bf9d22a71296e7f1dd24ea370352dd8f68 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Fri, 3 Oct 2014 22:09:19 -0400
Subject: [PATCH 0761/1050] Update nvicom.py to match vimcom.py.

---
 r-plugin/nvimcom.py | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/r-plugin/nvimcom.py b/r-plugin/nvimcom.py
index afc925b..791acc2 100644
--- a/r-plugin/nvimcom.py
+++ b/r-plugin/nvimcom.py
@@ -5,7 +5,7 @@
 import re
 
 VimComPort = 0
-PortWarn = False
+PortWarn = 0
 VimComFamily = None
 
 def DiscoverVimComPort():
@@ -15,13 +15,18 @@ def DiscoverVimComPort():
     HOST = "localhost"
     VimComPort = 10000
     repl = "NOTHING"
-    correct_repl = os.getenv("VIMINSTANCEID")
-    if correct_repl is None:
+    vii = os.getenv("VIMINSTANCEID")
+    if vii is None:
         print "call RWarningMsg('VIMINSTANCEID not found by nvimcom.py.')\n"
         sys.stdout.flush()
         return
+    scrt = os.getenv("VIMRPLUGINSECRET")
+    if scrt is None:
+        print "call RWarningMsg('VIMRPLUGINSECRET not found by nvimcom.py.')\n"
+        sys.stdout.flush()
+        return
 
-    while repl.find(correct_repl) < 0 and VimComPort < 10049:
+    while repl.find(scrt) < 0 and VimComPort < 10049:
         VimComPort = VimComPort + 1
         for res in socket.getaddrinfo(HOST, VimComPort, socket.AF_UNSPEC, socket.SOCK_DGRAM):
             af, socktype, proto, canonname, sa = res
@@ -30,13 +35,13 @@ def DiscoverVimComPort():
                 sock.settimeout(0.1)
                 sock.connect(sa)
                 if sys.hexversion < 0x03000000:
-                    sock.send("\001What port [Python 2]?")
+                    sock.send("\001" + vii + " What port [Python 2]?")
                     repl = sock.recv(1024)
                 else:
-                    sock.send("\001What port [Python 3]?".encode())
+                    sock.send("\001" + vii + " What port [Python 3]?".encode())
                     repl = sock.recv(1024).decode()
                 sock.close()
-                if repl.find(correct_repl):
+                if repl.find(scrt):
                     VimComFamily = af
                     break
             except:

From e165995fb94b1ea28d5c47511eaabcb36e47efa4 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Fri, 3 Oct 2014 22:10:19 -0400
Subject: [PATCH 0762/1050] Replace jobwrite with jobsend. Also replace '\x08'
 with "\x08".

---
 autoload/rcomplete.vim      |  4 ++--
 ftplugin/rnoweb_rplugin.vim |  2 +-
 ftplugin/rrst_rplugin.vim   |  2 +-
 r-plugin/common_global.vim  | 22 +++++++++++-----------
 4 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/autoload/rcomplete.vim b/autoload/rcomplete.vim
index c76c262..227ad47 100644
--- a/autoload/rcomplete.vim
+++ b/autoload/rcomplete.vim
@@ -19,9 +19,9 @@ function BuildROmniList()
     call delete($VIMRPLUGIN_TMPDIR . "/vimbol_finished")
     call delete($VIMRPLUGIN_TMPDIR . "/eval_reply")
     if has("nvim")
-        call g:SendToVimCom('\x08' . $VIMINSTANCEID . "I\002" . omnilistcmd)
+        call g:SendToVimCom("\x08" . $VIMINSTANCEID . "I\002" . omnilistcmd)
     else
-        call g:SendToVimCom('\x08' . $VIMINSTANCEID . omnilistcmd)
+        call g:SendToVimCom("\x08" . $VIMINSTANCEID . omnilistcmd)
     endif
     if g:rplugin_vimcomport == 0
         sleep 500m
diff --git a/ftplugin/rnoweb_rplugin.vim b/ftplugin/rnoweb_rplugin.vim
index ff0b19f..f0f226c 100644
--- a/ftplugin/rnoweb_rplugin.vim
+++ b/ftplugin/rnoweb_rplugin.vim
@@ -78,7 +78,7 @@ endfunction
 function! RMakePDF(bibtex, knit)
     if g:rplugin_vimcomport == 0
         if has("nvim")
-            call jobwrite(g:rplugin_clt_job, "DiscoverVimComPort\n")
+            call jobsend(g:rplugin_clt_job, "DiscoverVimComPort\n")
         else
             Py DiscoverVimComPort()
         endif
diff --git a/ftplugin/rrst_rplugin.vim b/ftplugin/rrst_rplugin.vim
index 8c5cbbd..caed6b0 100644
--- a/ftplugin/rrst_rplugin.vim
+++ b/ftplugin/rrst_rplugin.vim
@@ -97,7 +97,7 @@ endfunction
 function! RMakePDFrrst()
     if g:rplugin_vimcomport == 0
         if has("nvim")
-            call jobwrite(g:rplugin_clt_job, "DiscoverVimComPort\n")
+            call jobsend(g:rplugin_clt_job, "DiscoverVimComPort\n")
         else
             Py DiscoverVimComPort()
         endif
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 55ec3a5..f36650c 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -288,7 +288,7 @@ function RCompleteArgs()
                 else
                     let msg = msg . ')'
                 endif
-                call g:SendToVimCom('\x08' . $VIMINSTANCEID . msg)
+                call g:SendToVimCom("\x08" . $VIMINSTANCEID . msg)
 
                 if g:rplugin_vimcomport > 0
                     let g:rplugin_lastev = ReadEvalReply()
@@ -1040,7 +1040,7 @@ endfunction
 
 function ResetVimComPort()
     if has("nvim")
-        call jobwrite(g:rplugin_clt_job, "DiscoverVimComPort\n")
+        call jobsend(g:rplugin_clt_job, "DiscoverVimComPort\n")
     else
         Py VimComPort = 0
     endif
@@ -1409,7 +1409,7 @@ endfunction
 function RFormatCode() range
     if g:rplugin_vimcomport == 0
         if has("nvim")
-            call jobwrite(g:rplugin_clt_job, "DiscoverVimComPort\n")
+            call jobsend(g:rplugin_clt_job, "DiscoverVimComPort\n")
         else
             Py DiscoverVimComPort()
         endif
@@ -1430,9 +1430,9 @@ function RFormatCode() range
     endif
     call delete($VIMRPLUGIN_TMPDIR . "/eval_reply")
     if has("nvim")
-        call g:SendToVimCom('\x08' . $VIMINSTANCEID . "I\002" . 'formatR::tidy.source("' . $VIMRPLUGIN_TMPDIR . '/unformatted_code", file = "' . $VIMRPLUGIN_TMPDIR . '/formatted_code", width.cutoff = ' . wco . ')')
+        call g:SendToVimCom("\x08" . $VIMINSTANCEID . "I\002" . 'formatR::tidy.source("' . $VIMRPLUGIN_TMPDIR . '/unformatted_code", file = "' . $VIMRPLUGIN_TMPDIR . '/formatted_code", width.cutoff = ' . wco . ')')
     else
-        call g:SendToVimCom('\x08' . $VIMINSTANCEID . 'formatR::tidy.source("' . $VIMRPLUGIN_TMPDIR . '/unformatted_code", file = "' . $VIMRPLUGIN_TMPDIR . '/formatted_code", width.cutoff = ' . wco . ')')
+        call g:SendToVimCom("\x08" . $VIMINSTANCEID . 'formatR::tidy.source("' . $VIMRPLUGIN_TMPDIR . '/unformatted_code", file = "' . $VIMRPLUGIN_TMPDIR . '/formatted_code", width.cutoff = ' . wco . ')')
     endif
     let g:rplugin_lastev = ReadEvalReply()
     if g:rplugin_lastev == "R is busy." || g:rplugin_lastev == "UNKNOWN" || g:rplugin_lastev =~ "^Error" || g:rplugin_lastev == "INVALID" || g:rplugin_lastev == "ERROR" || g:rplugin_lastev == "EMPTY" || g:rplugin_lastev == "No reply"
@@ -1448,7 +1448,7 @@ endfunction
 function RInsert(cmd)
     if g:rplugin_vimcomport == 0
         if has("nvim")
-            call jobwrite(g:rplugin_clt_job, "DiscoverVimComPort\n")
+            call jobsend(g:rplugin_clt_job, "DiscoverVimComPort\n")
         else
             Py DiscoverVimComPort()
         endif
@@ -1459,7 +1459,7 @@ function RInsert(cmd)
 
     call delete($VIMRPLUGIN_TMPDIR . "/eval_reply")
     call delete($VIMRPLUGIN_TMPDIR . "/Rinsert")
-    call g:SendToVimCom('\x08' . $VIMINSTANCEID . 'capture.output(' . a:cmd . ', file = "' . $VIMRPLUGIN_TMPDIR . '/Rinsert")')
+    call g:SendToVimCom("\x08" . $VIMINSTANCEID . 'capture.output(' . a:cmd . ', file = "' . $VIMRPLUGIN_TMPDIR . '/Rinsert")')
     let g:rplugin_lastev = ReadEvalReply()
     if g:rplugin_lastev == "R is busy." || g:rplugin_lastev == "UNKNOWN" || g:rplugin_lastev =~ "^Error" || g:rplugin_lastev == "INVALID" || g:rplugin_lastev == "ERROR" || g:rplugin_lastev == "EMPTY" || g:rplugin_lastev == "No reply"
         call RWarningMsg(g:rplugin_lastev)
@@ -2399,9 +2399,9 @@ function ShowRDoc(rkeyword, package, getclass)
     endif
 
     if has("nvim")
-        call g:SendToVimCom('\x08' . $VIMINSTANCEID . "I\002" . rcmd)
+        call g:SendToVimCom("\x08" . $VIMINSTANCEID . "I\002" . rcmd)
     else
-        call g:SendToVimCom('\x08' . $VIMINSTANCEID . rcmd)
+        call g:SendToVimCom("\x08" . $VIMINSTANCEID . rcmd)
     endif
 
     let g:rplugin_lastev = ReadEvalReply()
@@ -2416,7 +2416,7 @@ function ShowRDoc(rkeyword, package, getclass)
             let chn = input(msg . "Please, select one of them: ")
             if chn > 0 && chn < len(libs)
                 call delete($VIMRPLUGIN_TMPDIR . "/eval_reply")
-                call g:SendToVimCom('\x08' . $VIMINSTANCEID . 'vim.help("' . a:rkeyword . '", ' . g:rplugin_htw . 'L, package="' . libs[chn] . '")')
+                call g:SendToVimCom("\x08" . $VIMINSTANCEID . 'vim.help("' . a:rkeyword . '", ' . g:rplugin_htw . 'L, package="' . libs[chn] . '")')
                 let g:rplugin_lastev = ReadEvalReply()
             else
                 return
@@ -3497,7 +3497,7 @@ endfunction
 
 function SendToVimCom_Neovim(cmd)
     let g:nvimcom_py_Input = a:cmd
-    call jobwrite(g:rplugin_clt_job, "SendToVimCom " . a:cmd . "\n")
+    call jobsend(g:rplugin_clt_job, "SendToVimCom " . a:cmd . "\n")
 endfunction
 
 let g:SendToVimCom = function("SendToVimCom_Vim")

From 627f0a2467bec7a4a6566d2676e7d2539366ace3 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sat, 4 Oct 2014 12:08:02 -0400
Subject: [PATCH 0763/1050] Improvements in Tmux environment setting. - Do not
 use system commands with VIMINSTANCEID and VIMRPLUGINSECRET as   arguments
 because other users monitoring running processes could see   their values.
 Instead, either use tmux source-file or add the   environment variables
 before the command.

---
 r-plugin/common_global.vim | 62 ++++++++++----------------------------
 1 file changed, 16 insertions(+), 46 deletions(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index f36650c..26a4a9b 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -616,15 +616,18 @@ endfunction
 
 function StartR_TmuxSplit(rcmd)
     let g:rplugin_vim_pane = TmuxActivePane()
-    call system("tmux set-environment -g VIMRPLUGIN_TMPDIR '" . $VIMRPLUGIN_TMPDIR . "'")
-    call system("tmux set-environment -g VIMRPLUGIN_HOME '" . g:rplugin_home . "'")
-    call system("tmux set-environment -g VIM_PANE " . g:rplugin_vim_pane)
+    let tmuxconf = ['set-environment VIMRPLUGIN_TMPDIR "' . $VIMRPLUGIN_TMPDIR . '"',
+                \ 'set-environment VIMRPLUGIN_HOME "' . g:rplugin_home . '"',
+                \ 'set-environment VIM_PANE ' . g:rplugin_vim_pane ,
+                \ 'set-environment VIMEDITOR_SVRNM ' . $VIMEDITOR_SVRNM ,
+                \ 'set-environment VIMINSTANCEID ' . $VIMINSTANCEID ,
+                \ 'set-environment VIMRPLUGINSECRET ' . $VIMRPLUGINSECRET ]
     if &t_Co == 256
-        call system('tmux set -g default-terminal "' . $TERM . '"')
+        call extend(tmuxconf, ['set -g default-terminal "' . $TERM . '"'])
     endif
-    call system("tmux set-environment VIMEDITOR_SVRNM " . $VIMEDITOR_SVRNM)
-    call system("tmux set-environment VIMINSTANCEID " . $VIMINSTANCEID)
-    call system("tmux set-environment VIMRPLUGINSECRET " . $VIMRPLUGINSECRET)
+    call writefile(tmuxconf, $VIMRPLUGIN_TMPDIR . "/tmux" . $VIMINSTANCEID . ".conf")
+    call system("tmux source-file '" . $VIMRPLUGIN_TMPDIR . "/tmux" . $VIMINSTANCEID . ".conf" . "'")
+    call delete($VIMRPLUGIN_TMPDIR . "/tmux" . $VIMINSTANCEID . ".conf")
     let tcmd = "tmux split-window "
     if g:vimrplugin_vsplit
         if g:vimrplugin_rconsole_width == -1
@@ -674,18 +677,11 @@ function StartR_ExternalTerm(rcmd)
         return
     endif
 
-    " Create a custom tmux.conf
-    let cnflines = [
-                \ 'set-environment -g VIMRPLUGIN_TMPDIR "' . $VIMRPLUGIN_TMPDIR . '"',
-                \ 'set-environment -g VIMRPLUGIN_HOME "' . g:rplugin_home . '"',
-                \ 'set-environment VIMINSTANCEID ' . $VIMINSTANCEID ,
-                \ 'set-environment VIMRPLUGINSECRET ' . $VIMRPLUGINSECRET ,
-                \ 'set-environment VIMEDITOR_SVRNM ' . $VIMEDITOR_SVRNM ]
     if g:vimrplugin_notmuxconf
-        let cnflines = cnflines + [ 'source-file ~/.tmux.conf' ]
+        let tmuxcnf = ' '
     else
-        let cnflines = cnflines + [
-                    \ 'set-option -g prefix C-a',
+        " Create a custom tmux.conf
+        let cnflines = ['set-option -g prefix C-a',
                     \ 'unbind-key C-b',
                     \ 'bind-key C-a send-prefix',
                     \ 'set-window-option -g mode-keys vi',
@@ -701,30 +697,11 @@ function StartR_ExternalTerm(rcmd)
         if g:vimrplugin_external_ob || !has("gui_running")
             call extend(cnflines, ['set -g mode-mouse on', 'set -g mouse-select-pane on', 'set -g mouse-resize-pane on'])
         endif
+        call writefile(cnflines, $VIMRPLUGIN_TMPDIR . "/tmux.conf")
+        let tmuxcnf = '-f "' . $VIMRPLUGIN_TMPDIR . "/tmux.conf" . '"'
     endif
-    call extend(cnflines, ['set-environment VIMINSTANCEID "' . $VIMINSTANCEID . '"',
-                \ 'set-environment VIMRPLUGINSECRET "' . $VIMRPLUGINSECRET . '"'])
-    call writefile(cnflines, s:tmxcnf)
-	
-	let is_bash = system('echo $BASH')
-	if v:shell_error || len(is_bash) == 0 || empty(matchstr(tolower(is_bash),'undefined variable')) == 0
-		let rcmd = a:rcmd
-	else
-		let rcmd = "VIMINSTANCEID=" . $VIMINSTANCEID . " VIMRPLUGINSECRET=" . $VIMRPLUGINSECRET . " " . a:rcmd
-	endif
 
-    call system('export VIMRPLUGIN_TMPDIR=' . $VIMRPLUGIN_TMPDIR)
-    call system('export VIMRPLUGIN_HOME=' . substitute(g:rplugin_home, ' ', '\\ ', "g"))
-    call system('export VIMINSTANCEID=' . $VIMINSTANCEID)
-    call system('export VIMRPLUGINSECRET=' . $VIMRPLUGINSECRET)
-    call system('export VIMEDITOR_SVRNM=' . $VIMEDITOR_SVRNM)
-    " Start the terminal emulator even if inside a Tmux session
-    if $TMUX != ""
-        let tmuxenv = $TMUX
-        let $TMUX = ""
-        call system('tmux set-option -ga update-environment " TMUX_PANE VIMRPLUGIN_TMPDIR VIMINSTANCEID"')
-    endif
-    let tmuxcnf = '-f "' . s:tmxcnf . '"'
+    let rcmd = 'VIMRPLUGIN_TMPDIR="' . $VIMRPLUGIN_TMPDIR . '" VIMRPLUGIN_HOME="' . $VIMRPLUGIN_HOME . '" VIMINSTANCEID="' . $VIMINSTANCEID . '" VIMRPLUGINSECRET="' . $VIMRPLUGINSECRET . '" VIMEDITOR_SVRNM="' . $VIMEDITOR_SVRNM . '" ' . a:rcmd
 
     call system("tmux has-session -t " . g:rplugin_tmuxsname)
     if v:shell_error
@@ -746,9 +723,6 @@ function StartR_ExternalTerm(rcmd)
         call RWarningMsg(rlog)
         return
     endif
-    if exists("tmuxenv")
-        let $TMUX = tmuxenv
-    endif
     let g:SendCmdToR = function('SendCmdToR_Term')
     if WaitVimComStart()
         call g:SendToVimCom("\005B Update OB [StartR]")
@@ -3613,10 +3587,6 @@ if !has("win32") && !has("win64") && !has("gui_win32") && !has("gui_win64") && g
         finish
     endif
     unlet s:tmuxversion
-
-    " To get 256 colors you have to set the $TERM environment variable to
-    " xterm-256color. See   :h r-plugin-tips
-    let s:tmxcnf = $VIMRPLUGIN_TMPDIR . "/tmux.conf"
 endif
 
 " Start with an empty list of objects in the workspace

From 7135897fc0acc0913425644596439fdaf5020bf2 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sat, 4 Oct 2014 14:25:25 -0400
Subject: [PATCH 0764/1050] Send SIGWINCH to Neovim when starting Ob. Browser.

---
 r-plugin/common_global.vim | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 26a4a9b..0c749d9 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -1075,7 +1075,9 @@ function StartObjBrowser_Tmux()
                 \ 'if has("clientserver") && v:servername != ""',
                 \ '    call g:SendToVimCom("\002" . v:servername)',
                 \ 'endif',
-                \ 'if !has("nvim")',
+                \ 'if has("nvim")',
+                \ '    call system("kill -s SIGWINCH ' . getpid() . '")',
+                \ 'else',
                 \ '    sleep 150m',
                 \ '    call UpdateOB("GlobalEnv")',
                 \ 'endif'], objbrowserfile)

From c38810161910aff275a47ec71d82501b0ec81a0e Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sat, 4 Oct 2014 16:13:57 -0400
Subject: [PATCH 0765/1050] Change the way that replies are ignored by nvim.

---
 autoload/rcomplete.vim     |  6 +-----
 r-plugin/common_global.vim | 35 ++++++++++++++---------------------
 r-plugin/nvimcom.py        |  7 ++++++-
 3 files changed, 21 insertions(+), 27 deletions(-)

diff --git a/autoload/rcomplete.vim b/autoload/rcomplete.vim
index 227ad47..351ff85 100644
--- a/autoload/rcomplete.vim
+++ b/autoload/rcomplete.vim
@@ -18,11 +18,7 @@ function BuildROmniList()
 
     call delete($VIMRPLUGIN_TMPDIR . "/vimbol_finished")
     call delete($VIMRPLUGIN_TMPDIR . "/eval_reply")
-    if has("nvim")
-        call g:SendToVimCom("\x08" . $VIMINSTANCEID . "I\002" . omnilistcmd)
-    else
-        call g:SendToVimCom("\x08" . $VIMINSTANCEID . omnilistcmd)
-    endif
+    call g:SendToVimCom("\x08" . $VIMINSTANCEID . omnilistcmd, "I")
     if g:rplugin_vimcomport == 0
         sleep 500m
         return
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 0c749d9..f0026de 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -268,11 +268,7 @@ function RCompleteArgs()
             " If R is running, use it
             if string(g:SendCmdToR) != "function('SendCmdToR_fake')"
                 call delete($VIMRPLUGIN_TMPDIR . "/eval_reply")
-                if has("nvim")
-                    let msg = "I\002" . 'vimcom:::vim.args("'
-                else
-                    let msg = 'vimcom:::vim.args("'
-                endif
+                let msg = 'vimcom:::vim.args("'
                 if classfor == ""
                     let msg = msg . rkeyword0 . '", "' . argkey . '"'
                 else
@@ -288,7 +284,7 @@ function RCompleteArgs()
                 else
                     let msg = msg . ')'
                 endif
-                call g:SendToVimCom("\x08" . $VIMINSTANCEID . msg)
+                call g:SendToVimCom("\x08" . $VIMINSTANCEID . msg, "I")
 
                 if g:rplugin_vimcomport > 0
                     let g:rplugin_lastev = ReadEvalReply()
@@ -1405,11 +1401,7 @@ function RFormatCode() range
         let wco = 180
     endif
     call delete($VIMRPLUGIN_TMPDIR . "/eval_reply")
-    if has("nvim")
-        call g:SendToVimCom("\x08" . $VIMINSTANCEID . "I\002" . 'formatR::tidy.source("' . $VIMRPLUGIN_TMPDIR . '/unformatted_code", file = "' . $VIMRPLUGIN_TMPDIR . '/formatted_code", width.cutoff = ' . wco . ')')
-    else
-        call g:SendToVimCom("\x08" . $VIMINSTANCEID . 'formatR::tidy.source("' . $VIMRPLUGIN_TMPDIR . '/unformatted_code", file = "' . $VIMRPLUGIN_TMPDIR . '/formatted_code", width.cutoff = ' . wco . ')')
-    endif
+    call g:SendToVimCom("\x08" . $VIMINSTANCEID . 'formatR::tidy.source("' . $VIMRPLUGIN_TMPDIR . '/unformatted_code", file = "' . $VIMRPLUGIN_TMPDIR . '/formatted_code", width.cutoff = ' . wco . ')', "I")
     let g:rplugin_lastev = ReadEvalReply()
     if g:rplugin_lastev == "R is busy." || g:rplugin_lastev == "UNKNOWN" || g:rplugin_lastev =~ "^Error" || g:rplugin_lastev == "INVALID" || g:rplugin_lastev == "ERROR" || g:rplugin_lastev == "EMPTY" || g:rplugin_lastev == "No reply"
         call RWarningMsg(g:rplugin_lastev)
@@ -2374,11 +2366,7 @@ function ShowRDoc(rkeyword, package, getclass)
         let rcmd = 'vim.help("' . a:rkeyword . '", ' . g:rplugin_htw . 'L, ' . classfor . ')'
     endif
 
-    if has("nvim")
-        call g:SendToVimCom("\x08" . $VIMINSTANCEID . "I\002" . rcmd)
-    else
-        call g:SendToVimCom("\x08" . $VIMINSTANCEID . rcmd)
-    endif
+    call g:SendToVimCom("\x08" . $VIMINSTANCEID . rcmd, "I")
 
     let g:rplugin_lastev = ReadEvalReply()
     if g:rplugin_lastev != "VIMHELP"
@@ -3467,13 +3455,18 @@ function RServerEvent()
     endif
 endfunction
 
-function SendToVimCom_Vim(cmd)
-    exe "Py SendToVimCom('" . a:cmd . "')"
+function SendToVimCom_Vim(...)
+    exe "Py SendToVimCom('" . a:1 . "')"
 endfunction
 
-function SendToVimCom_Neovim(cmd)
-    let g:nvimcom_py_Input = a:cmd
-    call jobsend(g:rplugin_clt_job, "SendToVimCom " . a:cmd . "\n")
+function SendToVimCom_Neovim(...)
+    let g:nvimcom_py_Input = a:1
+    if a:0 == 2 && a:2 == "I"
+        " Ignore reply due to https://github.com/neovim/neovim/issues/834
+        call jobsend(g:rplugin_clt_job, "SendToVimCom I\002" . a:1 . "\n")
+    else
+        call jobsend(g:rplugin_clt_job, "SendToVimCom " . a:1 . "\n")
+    endif
 endfunction
 
 let g:SendToVimCom = function("SendToVimCom_Vim")
diff --git a/r-plugin/nvimcom.py b/r-plugin/nvimcom.py
index 791acc2..8aed05e 100644
--- a/r-plugin/nvimcom.py
+++ b/r-plugin/nvimcom.py
@@ -104,8 +104,13 @@ def SendToVimCom(aString):
     line = raw_input()
     if line.find("SendToVimCom") != -1:
         line = line.replace("SendToVimCom ", "")
+        if line.find("I\002") != -1:
+            line = line.replace("I\002", "")
+            printreply = False
+        else:
+            printreply = True
         rpl = SendToVimCom(line)
-        if not line.find("I\002") == 0:
+        if printreply:
             print "let g:rplugin_lastrpl = '" + rpl + "'\n"
     else:
         if line.find("DiscoverVimComPort") != -1:

From dd6d4ae138d9a16764ef39b513141367a0514bf2 Mon Sep 17 00:00:00 2001
From: Michael Lerch 
Date: Tue, 7 Oct 2014 21:37:56 -0600
Subject: [PATCH 0766/1050] Unreplace of assign_map should be to
 g:vimrplugin_assign_map

Behavior was not correct in the case that vimrplugin_assign_map is set
to something other than "_".  "Un"replacing vimrplugin_assign_map was
using "_" instead of the vimrplugin_assign_map string.
---
 r-plugin/common_global.vim | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index f0026de..36b72dc 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -120,7 +120,7 @@ function ReplaceUnderS()
         endif
     endif
     if isString
-        exe "normal! a_"
+        exe "normal! a" . g:vimrplugin_assign_map
     else
         exe "normal! a <- "
     endif

From 5765cb9d6d3e3a2ed3fecd95431f6af221f1b2d0 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Thu, 9 Oct 2014 11:27:41 -0400
Subject: [PATCH 0767/1050] Support for SyncTeX (Evince and Okular)

---
 doc/r-plugin.txt                    | 114 ++++++++++++++++++--
 ftplugin/rnoweb_rplugin.vim         | 161 +++++++++++++++++++++++++++-
 r-plugin/common_global.vim          |  64 +++++++++--
 r-plugin/synctex_evince_backward.py | 148 +++++++++++++++++++++++++
 r-plugin/synctex_evince_forward.py  | 154 ++++++++++++++++++++++++++
 5 files changed, 621 insertions(+), 20 deletions(-)
 create mode 100644 r-plugin/synctex_evince_backward.py
 create mode 100644 r-plugin/synctex_evince_forward.py

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index ffd216b..b1783b2 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -86,6 +86,7 @@ Vim-R-plugin (see |vimrplugin_source|).
       - Send commands with the object under cursor as argument.
       - Call R's `help()` with the object under cursor as argument.
       - Syntax highlighting of the Object Browser.
+  * SyncTeX support on Linux.
   * Most of the plugin's behavior is customizable.
 
 For screenshots see: http://www.lepem.ufc.br/jaa/vim-r-plugin.html
@@ -130,6 +131,10 @@ Before installing the plugin, you should install its dependencies:
    Tmux >= 1.8:   http://tmux.sourceforge.net
                   Tmux is necessary to send commands from Vim to R Console.
 
+   wmctrl:     http://tomas.styblo.name/wmctrl/
+               Required for SyncTeX support in Rnoweb files.
+
+
    Suggests:~
 
    colorout:      http://www.lepem.ufc.br/jaa/colorout.html
@@ -444,6 +449,7 @@ Command
   . Spin (cur file) (only .R)                          \ks
   --------------------------------------------------------
   . Open PDF (cur file)                                \op
+  . Search forward (SyncTeX)                           \gp
   --------------------------------------------------------
   . Build tags file (cur dir)                  :RBuildTags
 -----------------------------------------------------------
@@ -742,6 +748,7 @@ commands. After you finished editing the file, you have to type `exit` to quit
 the Tmux session.
 
 Note: Neovim does not require the --servername VIM argument.
+Note: Starting GVim within a Tmux session is not supported.
 
 
 4.8.1 tvim~
@@ -974,7 +981,13 @@ tell Vim that "R is busy" and Vim will display this message. Everything should
 work as expected again after any valid code is executed in the R Console.
 
 
-5.7. Bugs that affect Mac OS X, Linux Console and ...~
+5.7. SyncTeX support is a Linux only feature~
+
+There is no SyncTeX support for Windows and Mac OS X. If you can write the
+code, please, do it.
+
+
+5.8. Bugs that affect Mac OS X, Linux Console and ...~
 								*r-plugin-nox*
 Note: The bug described in this section does not affect Neovim.
 
@@ -1036,7 +1049,7 @@ A user reported success with the following procedure:
 See also: |r-plugin-remote|.
 
 
-5.8. R must be started by Vim~
+5.9. R must be started by Vim~
 
 The communication between Vim and R will work only if R was started by Vim
 through the rf command because the plugin was designed to connect
@@ -1148,6 +1161,7 @@ is running:
 |vimrplugin_vimcom_wait|       Time to wait for vimcom loading
 |vimrplugin_vim_wd|            Start R in Vim's working directory
 |vimrplugin_user_maps_only|    Only set user specified key bindings
+|SyncTeX|                      Options for SyncTeX
 
 
 6.1. Terminal emulator (Linux/Unix only)~
@@ -1504,10 +1518,12 @@ Example:
 						       *vimrplugin_sweaveargs*
 On Windows, the vimcom package calls `tools::texi2dvi()` to build the pdf
 from the generated .tex file. On Linux/Unix, by default, it calls
-`latexmk` `-pdf` to produce a pdf document from the .tex file produced by
-either `Sweave()` or `knit()` command. If `latexmk` is not installed, it calls
-`pdflatex`. You can use the option vimrplugin_latexcmd to change this
-behavior. Example:
+>
+   latexmk -pdflatex="pdflatex -file-line-error -synctex=1" -pdf 
+<
+to produce a pdf document from the .tex file produced by either `Sweave()` or
+`knit()` command. If `latexmk` is not installed, it calls `pdflatex`. You can
+use the option vimrplugin_latexcmd to change this behavior. Example:
 >
    let vimrplugin_latexcmd = "latex"
 <
@@ -1744,6 +1760,91 @@ set those key-bindings specified by the user, put in your vimrc:
     let vimrplugin_user_maps_only = 1
 <
 
+6.32 SyncTeX support (Linux only)~
+								     *SyncTeX*
+SyncTeX is a set of communication systems used by some PDF viewers and by some
+text editors which allow users to jump from a specific line in the text editor
+to the corresponding line in the PDF viewer and vice-versa. The Vim-R-plugin
+has support for Evince and Okular SyncTeX systems.
+
+The application `wmctrl` is required to raise both the PDF viewer and Vim
+windows. Limitation: the Vim-R-plugin may raise the wrong terminal window or
+GVim window if there is more than one open.
+
+
+6.32.1 Evince configuration~
+
+If you run either GVim or Vim in Gnome Terminal, no configuration is required.
+If you run Vim in another terminal emulator, you have to set the value of
+|vimrplugin_vim_window|, as explained below.
+
+Note: If Evince is not started yet when you try to jump to the PDF document
+for the first time, it will start, but will not jump to desired line.
+
+
+6.32.2 Okular configuration~
+
+You have to configure Okular to call Vim during backward searches.
+In Okular, click in:
+>
+   Settings
+   Configure Okular
+   Editor
+   Dropdown menu: Custom Text Editor
+         Command: vim --remote-expr "SyncTeX_backward('%f', %l)"
+
+In the command above, replace `vim` with `gvim` if you use GVim.
+
+If Evince is not installed in your system, the Vim-R-plugin will automatically
+use Okular as the PDF viewer. Otherwise, you have to set the value of
+|vimrplugin_synctex| to "okular".
+
+If you run Vim (and not GVim) and are not using Konsole as the terminal
+emulator, you have to set the value of |vimrplugin_vim_window|, as explained
+below.
+
+Note: If the PDF document is already open the first time that you jump to it,
+and if Okular was not started with the `--unique` argument, another instance
+of Okular will be started.
+
+Note: Neovim has issues in the search forward (from Neovim to Okular).
+
+
+6.32.3 Configuring the PDF editor and Vim's window title~
+							  *vimrplugin_synctex*
+						       *vimrplugin_vim_window*
+If SyncTeX does not work (see above), you may try to set in your |vimrc| the
+values of vimrplugin_synctex and vimrplugin_vim_window.
+
+The valid values for vimrplugin_synctex are "evince" and "okular".
+
+To know the correct value of vimrplugin_vim_window, type in the terminal
+emulator:
+>
+   wmctrl -xl
+<
+This command will list the windows currently running under the X Window
+system. You must set the value of vimrplugin_vim_window as a string that is
+part of the title of the window where Vim is running ("GVim", "Terminal",
+"Konsole", "yourlogin", "vim", etc).
+
+Example of |vimrc| configuration:
+>
+   let vimrplugin_synctex = "okular"
+   let vimrplugin_vim_window = "XTerm"
+<
+To completely disable SyncTeX support, put in your |vimrc|:
+>
+   let vimrplugin_synctex = "none"
+<
+
+6.32.4 Support for Sumatra (Windows) and Skim (Mac OS X)~
+
+Both Sumatra and Skim have support for SyncTeX, but the Vim-R-plugin is not
+ready to communicate with them. If you can, please write the necessary code to
+support anyone of them and submit a push request on github:
+https://github.com/jcfaria/Vim-R-plugin
+
 
 ==============================================================================
 						       *r-plugin-key-bindings*
@@ -1849,6 +1950,7 @@ RD, "cursor down"; RED, both "echo" and "down"):
    RMakeRmd   (rmarkdown default)
    RMakeAll   (rmarkdown all in yaml)
    ROpenPDF
+   RSyncFor   (SyncTeX search forward)
    RSpinFile
 
    Object browser~
diff --git a/ftplugin/rnoweb_rplugin.vim b/ftplugin/rnoweb_rplugin.vim
index f0f226c..bf1d114 100644
--- a/ftplugin/rnoweb_rplugin.vim
+++ b/ftplugin/rnoweb_rplugin.vim
@@ -74,6 +74,17 @@ function! RnwNextChunk() range
     return
 endfunction
 
+" knit the current buffer content
+function! RKnitRnw()
+    update
+    call RSetWD()
+    if g:vimrplugin_synctex == "none"
+        call g:SendCmdToR('vim.interlace.rnoweb("' . expand("%:t") . '", buildpdf = FALSE, synctex = FALSE)')
+    else
+        call g:SendCmdToR('vim.interlace.rnoweb("' . expand("%:t") . '", buildpdf = FALSE)')
+    endif
+endfunction
+
 " Sweave and compile the current buffer content
 function! RMakePDF(bibtex, knit)
     if g:rplugin_vimcomport == 0
@@ -90,14 +101,22 @@ function! RMakePDF(bibtex, knit)
     call RSetWD()
     let pdfcmd = "vim.interlace.rnoweb('" . expand("%:t") . "'"
 
-    if a:knit
-        let pdfcmd = pdfcmd . ', knit = TRUE'
+    if a:knit == 0
+        let pdfcmd = pdfcmd . ', knit = FALSE'
     endif
 
-    if g:vimrplugin_latexcmd != "pdflatex"
+    if g:rplugin_has_latexmk == 0
+        let pdfcmd = pdfcmd . ', latexmk = FALSE'
+    endif
+
+    if g:vimrplugin_latexcmd != "default"
         let pdfcmd = pdfcmd . ", latexcmd = '" . g:vimrplugin_latexcmd . "'"
     endif
 
+    if g:vimrplugin_synctex == "none"
+        let pdfcmd = pdfcmd . ", synctex = FALSE"
+    endif
+
     if a:bibtex == "bibtex"
         let pdfcmd = pdfcmd . ", bibtex = TRUE"
     endif
@@ -241,7 +260,7 @@ call RCreateMaps("nvi", 'RSetwd',        'rd', ':call RSetWD()')
 call RCreateMaps("nvi", 'RSweave',      'sw', ':call RSweave()')
 call RCreateMaps("nvi", 'RMakePDF',     'sp', ':call RMakePDF("nobib", 0)')
 call RCreateMaps("nvi", 'RBibTeX',      'sb', ':call RMakePDF("bibtex", 0)')
-call RCreateMaps("nvi", 'RKnit',        'kn', ':call RKnit()')
+call RCreateMaps("nvi", 'RKnit',        'kn', ':call RKnitRnw()')
 call RCreateMaps("nvi", 'RMakePDFK',    'kp', ':call RMakePDF("nobib", 1)')
 call RCreateMaps("nvi", 'RBibTeXK',     'kb', ':call RMakePDF("bibtex", 1)')
 call RCreateMaps("nvi", 'ROpenPDF',     'op', ':call ROpenPDF()')
@@ -258,6 +277,140 @@ if has("gui_running")
     call MakeRMenu()
 endif
 
+"==========================================================================
+" SyncTeX support:
+
+function! SyncTeX_backward(fname, ln)
+    let g:lastfname = [a:fname, a:ln]
+    let basenm = substitute(a:fname, "\....$", "", "") " Delete extension
+    let basenm = substitute(basenm, 'file://', '', '') " Evince
+    let basenm = substitute(basenm, '/\./', '/', '')   " Okular
+    if filereadable(basenm . "-concordance.tex")
+        let conc = join(readfile(basenm . "-concordance.tex"), "")
+        let rnwf = substitute(basenm, '\(.*\)/.*', '\1/', '') . substitute(conc, '\\Sconcordance{concordance:.\{-}:\(.*\):%.*', '\1', "g")
+        let conc = substitute(conc, '\\Sconcordance{.*:%', "", "g")
+        let conc = substitute(conc, "%", " ", "g")
+        let conc = substitute(conc, "}", "", "")
+        let concl = split(conc)
+
+        " See http://www.stats.uwo.ca/faculty/murdoch/9864/Sweave.pdf page 25
+        let idx = 0
+        let maxidx = len(concl) - 2
+        let texln = concl[0]
+        let rnwln = 1
+        let eureka = 0
+        while rnwln < a:ln && idx < maxidx && eureka == 0
+            let idx += 1
+            let lnrange = range(1, concl[idx])
+            let idx += 1
+            for iii in lnrange
+                let rnwln += concl[idx]
+                let texln += 1
+                if texln >= a:ln
+                    let eureka = 1
+                    break
+                endif
+            endfor
+        endwhile
+    else
+        if filereadable(basenm . "Rnw") || filereadable(basenm . "rnw")
+            call RWarningMsg('SyncTeX [Vim-R-plugin]: "' . basenm . '-concordance.tex" not found.')
+            return
+        endif
+        " Jump to LaTeX source since there is no Rnoweb file
+        let rnwf = a:fname
+        let rnwln = a:ln
+    endif
+
+    if bufname("%") != rnwf
+        if bufloaded(rnwf)
+            let savesb = &switchbuf
+            set switchbuf=useopen,usetab
+            exe "sb " . rnwf
+            exe "set switchbuf=" . savesb
+        else
+            exe "tabnew " . rnwf
+        endif
+    endif
+    exe rnwln
+    redraw
+    if g:rplugin_has_wmctrl
+        call system("wmctrl -xa " . g:vimrplugin_vim_window)
+    endif
+endfunction
+
+function! SyncTeX_forward(fname, ln)
+    let basenm = substitute(a:fname, "\....$", "", "")
+    if filereadable(basenm . "-concordance.tex")
+        let conc = join(readfile(basenm . "-concordance.tex"), "")
+        let conc = substitute(conc, '\\Sconcordance{.*:%', "", "g")
+        let conc = substitute(conc, "%", " ", "g")
+        let conc = substitute(conc, "}", "", "")
+        let concl = split(conc)
+        let idx = 0
+        let maxidx = len(concl) - 2
+        let texln = concl[0]
+        let rnwln = 1
+        let eureka = 0
+        while rnwln < a:ln && idx < maxidx && eureka == 0
+            let idx += 1
+            let lnrange = range(1, concl[idx])
+            let idx += 1
+            for iii in lnrange
+                let rnwln += concl[idx]
+                let texln += 1
+                if rnwln >= a:ln
+                    let eureka = 1
+                    break
+                endif
+            endfor
+        endwhile
+    else
+        if &filetype == "rnoweb"
+            call RWarningMsg('SyncTeX [Vim-R-plugin]: "' . basenm . '-concordance.tex" not found.')
+            return
+        elseif &filetype == "tex"
+            " No conversion needed
+            let texln = a:ln
+        else
+            return
+        endif
+    endif
+    if g:vimrplugin_synctex == "okular"
+        call system("okular --unique " . expand("%:r") . ".pdf#src:" . texln . expand("%:p:h") . "/./" . expand("%:r") . ".tex &")
+    elseif g:vimrplugin_synctex == "evince"
+        call system("python " . g:rplugin_home . "/r-plugin/synctex_evince_forward.py " . expand("%:r") . ".pdf " . texln . " " . expand("%:r") . ".tex &")
+        if g:rplugin_has_wmctrl
+            call system("wmctrl -a '" . expand("%:t:r") . ".pdf'")
+        endif
+    else
+        call RWarningMsg('SyncTeX support for "' . g:vimrplugin_synctex . '" not implemented yet.')
+    endif
+endfunction
+
+function! SyncTeX_SetPID(pid)
+    let g:rplugin_synctexpid = a:pid
+endfunction
+
+function! Kill_SyncTeX()
+    if g:rplugin_synctexpid
+        call system("kill " . g:rplugin_synctexpid)
+    endif
+endfunction
+
+function! Handle_SyncTeX_backward()
+    if v:job_data[1] == 'stdout'
+      let g:lastjobdata = v:job_data[2]
+        let fname = substitute(v:job_data[2], '|.*', '', '') 
+        let ln = substitute(v:job_data[2], '.*|\([0-9]*\).*', '\1', '')
+        call SyncTeX_backward(fname, ln)
+    elseif v:job_data[1] == 'stderr'
+        call RWarningMsg(v:job_data[2])
+    else
+        let g:rplugin_stx_job = 0
+    endif
+endfunction
+
 call RSourceOtherScripts()
 
 let b:undo_ftplugin .= " | unlet! b:IsInRCode b:SourceLines b:PreviousRChunk b:NextRChunk b:SendChunkToR"
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 36b72dc..2cf516e 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -2865,7 +2865,11 @@ function MakeRMenu()
             endif
         endif
         menu R.Command.-Sep6- 
-        call RCreateMenuItem("nvi", 'Command.Knit\ (cur\ file)', 'RKnit', 'kn', ':call RKnit()')
+        if &filetype == "rnoweb"
+            call RCreateMenuItem("nvi", 'Command.Knit\ (cur\ file)', 'RKnit', 'kn', ':call RKnitRnw()')
+        else
+            call RCreateMenuItem("nvi", 'Command.Knit\ (cur\ file)', 'RKnit', 'kn', ':call RKnit()')
+        endif
         if &filetype == "rnoweb" || g:vimrplugin_never_unmake_menu
             call RCreateMenuItem("nvi", 'Command.Knit\ and\ PDF\ (cur\ file)', 'RMakePDFK', 'kp', ':call RMakePDF("nobib", 1)')
             if has("win32") || has("win64")
@@ -2887,12 +2891,9 @@ function MakeRMenu()
         endif
         menu R.Command.-Sep61- 
         call RCreateMenuItem("nvi", 'Command.Open\ PDF\ (cur\ file)', 'ROpenPDF', 'op', ':call ROpenPDF()')
-    endif
-    "-------------------------------
-    if &filetype == "rrst" || g:vimrplugin_never_unmake_menu
-        menu R.Command.-Sep5- 
-        call RCreateMenuItem("nvi", 'Command.Knit\ (cur\ file)', 'RKnit', 'kn', ':call RKnit()')
-        call RCreateMenuItem("nvi", 'Command.Knit\ and\ PDF\ (cur\ file)', 'RMakePDF', 'kp', ':call RMakePDF("nobib")')
+        if ($DISPLAY != "" && g:vimrplugin_synctex != "none" && &filetype == "rnoweb") || g:vimrplugin_never_unmake_menu
+            call RCreateMenuItem("nvi", 'Command.Search\ forward\ (SyncTeX)', 'RSyncFor', 'op', ':call ROpenPDF()')
+        endif
     endif
     "-------------------------------
     if &filetype == "r" || g:vimrplugin_never_unmake_menu
@@ -3388,13 +3389,52 @@ call RSetDefaultValue("g:vimrplugin_vimpager",        "'tab'")
 call RSetDefaultValue("g:vimrplugin_objbr_place",     "'script,right'")
 call RSetDefaultValue("g:vimrplugin_permanent_libs",  "'base,stats,graphics,grDevices,utils,datasets,methods'")
 call RSetDefaultValue("g:vimrplugin_user_maps_only", 0)
+call RSetDefaultValue("g:vimrplugin_latexcmd", "'default'")
 
-if executable("latexmk")
-    call RSetDefaultValue("g:vimrplugin_latexcmd", "'latexmk -pdf'")
+" SyncTeX options
+let g:rplugin_has_wmctrl = 0
+let g:rplugin_synctexpid = 0
+
+" Try to guess what PDF viewer is used:
+if executable("evince")
+    call RSetDefaultValue("g:vimrplugin_synctex", "'evince'")
+elseif executable("okular")
+    call RSetDefaultValue("g:vimrplugin_synctex", "'okular'")
+else
+    call RSetDefaultValue("g:vimrplugin_synctex", "'none'")
+endif
+let g:vimrplugin_synctex = tolower(g:vimrplugin_synctex)
+
+" Try to guess the title of the window where Vim is running:
+if has("gui_running")
+    call RSetDefaultValue("g:vimrplugin_vim_window", "'GVim'")
+elseif g:vimrplugin_synctex == "evince"
+    call RSetDefaultValue("g:vimrplugin_vim_window", "'Terminal'")
+elseif g:vimrplugin_synctex == "okular"
+    call RSetDefaultValue("g:vimrplugin_vim_window", "'Konsole'")
 else
-    call RSetDefaultValue("g:vimrplugin_latexcmd", "'pdflatex'")
+    call RSetDefaultValue("g:vimrplugin_vim_window", "'term'")
 endif
 
+if $DISPLAY != "" && g:vimrplugin_synctex != "none"
+    if executable("wmctrl")
+        let g:rplugin_has_wmctrl = 1
+    endif
+    if g:vimrplugin_synctex == "evince"
+        if has("nvim")
+            let g:rplugin_stx_job = jobstart("synctex", "python", [g:rplugin_home . "/r-plugin/synctex_evince_backward.py", expand("%:r") . ".pdf", "nvim"])
+            autocmd JobActivity synctex call Handle_SyncTeX_backward()
+        else
+            if v:servername != ""
+                autocmd VimLeave * call Kill_SyncTeX()
+                call system("python " . g:rplugin_home . "/r-plugin/synctex_evince_backward.py '" . expand("%:r") . ".pdf' " . v:servername . " &")
+            endif
+        endif
+    endif
+    call RCreateMaps("ni", 'RSyncFor',        'gp', ':call SyncTeX_forward(bufname("%"), line("."))')
+endif
+
+
 " Look for invalid options
 let objbrplace = split(g:vimrplugin_objbr_place, ",")
 let obpllen = len(objbrplace) - 1
@@ -3584,6 +3624,10 @@ if !has("win32") && !has("win64") && !has("gui_win32") && !has("gui_win64") && g
     unlet s:tmuxversion
 endif
 
+if executable("latexmk")
+    let g:rplugin_has_latexmk = 1
+endif
+
 " Start with an empty list of objects in the workspace
 let g:rplugin_globalenvlines = []
 
diff --git a/r-plugin/synctex_evince_backward.py b/r-plugin/synctex_evince_backward.py
new file mode 100644
index 0000000..7a7375c
--- /dev/null
+++ b/r-plugin/synctex_evince_backward.py
@@ -0,0 +1,148 @@
+
+# The code in this files is borrowed from Gedit Synctex plugin.
+#
+# Copyright (C) 2010 Jose Aliste
+#
+# This program is free software; you can redistribute it and/or modify it under
+# the terms of the GNU General Public Licence as published by the Free Software
+# Foundation; either version 2 of the Licence, or (at your option) any later
+# version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE.  See the GNU General Public Licence for more
+# details.
+#
+# You should have received a copy of the GNU General Public Licence along with
+# this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
+# Street, Fifth Floor, Boston, MA  02110-1301, USA
+
+import dbus, subprocess, time
+import dbus.mainloop.glib, sys, os, logging
+from gi.repository import GObject
+
+RUNNING, CLOSED = range(2)
+
+EV_DAEMON_PATH = "/org/gnome/evince/Daemon"
+EV_DAEMON_NAME = "org.gnome.evince.Daemon"
+EV_DAEMON_IFACE = "org.gnome.evince.Daemon"
+
+EVINCE_PATH = "/org/gnome/evince/Evince"
+EVINCE_IFACE = "org.gnome.evince.Application"
+
+EV_WINDOW_IFACE = "org.gnome.evince.Window"
+
+class EvinceWindowProxy:
+    """A DBUS proxy for an Evince Window."""
+    daemon = None
+    bus = None
+
+    def __init__(self, uri, spawn = False, logger = None):
+        self._log = logger
+        self.uri = uri
+        self.spawn = spawn
+        self.status = CLOSED
+        self.dbus_name = ''
+        self._handler = None
+        try:
+            if EvinceWindowProxy.bus is None:
+                EvinceWindowProxy.bus = dbus.SessionBus()
+
+            if EvinceWindowProxy.daemon is None:
+                EvinceWindowProxy.daemon = EvinceWindowProxy.bus.get_object(EV_DAEMON_NAME,
+                                                EV_DAEMON_PATH,
+                                                follow_name_owner_changes=True)
+            EvinceWindowProxy.bus.add_signal_receiver(self._on_doc_loaded, signal_name="DocumentLoaded", 
+                                                      dbus_interface = EV_WINDOW_IFACE, 
+                                                      sender_keyword='sender')
+            self._get_dbus_name(False)
+
+        except dbus.DBusException:
+            if self._log:
+                self._log.debug("Could not connect to the Evince Daemon")
+                loop.quit()
+
+    def _on_doc_loaded(self, uri, **keyargs):
+        if uri == self.uri and self._handler is None:
+            self.handle_find_document_reply(keyargs['sender'])
+        
+    def _get_dbus_name(self, spawn):
+        EvinceWindowProxy.daemon.FindDocument(self.uri,spawn,
+                     reply_handler=self.handle_find_document_reply,
+                     error_handler=self.handle_find_document_error,
+                     dbus_interface = EV_DAEMON_IFACE)
+
+    def handle_find_document_error(self, error):
+        if self._log:
+            self._log.debug("FindDocument DBus call has failed")
+
+    def handle_find_document_reply(self, evince_name):
+        if self._handler is not None:
+            handler = self._handler
+        else:
+            handler = self.handle_get_window_list_reply
+        if evince_name != '':
+            self.dbus_name = evince_name
+            self.status = RUNNING
+            self.evince = EvinceWindowProxy.bus.get_object(self.dbus_name, EVINCE_PATH)
+            self.evince.GetWindowList(dbus_interface = EVINCE_IFACE,
+                          reply_handler = handler,
+                          error_handler = self.handle_get_window_list_error)
+
+    def handle_get_window_list_error (self, e):
+        if self._log:
+            self._log.debug("GetWindowList DBus call has failed")
+
+    def handle_get_window_list_reply (self, window_list):
+        if len(window_list) > 0:
+            window_obj = EvinceWindowProxy.bus.get_object(self.dbus_name, window_list[0])
+            self.window = dbus.Interface(window_obj,EV_WINDOW_IFACE)
+            self.window.connect_to_signal("Closed", self.on_window_close)
+            self.window.connect_to_signal("SyncSource", self.on_sync_source)
+        else:
+            #That should never happen. 
+            if self._log:
+                self._log.debug("GetWindowList returned empty list")
+
+    def on_window_close(self):
+        self.window = None
+        self.status = CLOSED
+
+    def on_sync_source(self, input_file, source_link, timestamp):
+        if vimnm == "nvim":
+            print input_file + "|" + str(source_link[0]) + "\n"
+            sys.stdout.flush()
+        else:
+            os.system(vimexec + ' --servername ' + vimnm + ' --remote-expr "' + "SyncTeX_backward('" + input_file + "', " + str(source_link[0]) + ')"')
+
+
+path_output = os.getcwd() + '/' + sys.argv[1]
+if not os.path.isfile(path_output):
+    print "Error file not found: " + path_output
+
+vimnm = sys.argv[2]
+if vimnm != "nvim":
+    if vimnm.find("GVIM") == 0:
+        vimexec = "gvim"
+    else:
+        vimexec = "vim"
+    time.sleep(1)
+    os.system(vimexec + ' --servername ' + vimnm + ' --remote-expr "SyncTeX_SetPID(' + str(os.getpid()) + ')"')
+
+
+dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
+logger = logging.getLogger("evince_dbus")
+logger.setLevel(logging.DEBUG)
+ch = logging.StreamHandler()
+ch.setLevel(logging.DEBUG)
+
+formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
+
+ch.setFormatter(formatter)
+
+logger.addHandler(ch)    
+a = EvinceWindowProxy('file://' + path_output, True,logger=logger)
+
+loop = GObject.MainLoop()
+loop.run() 
+
diff --git a/r-plugin/synctex_evince_forward.py b/r-plugin/synctex_evince_forward.py
new file mode 100644
index 0000000..4f6cd53
--- /dev/null
+++ b/r-plugin/synctex_evince_forward.py
@@ -0,0 +1,154 @@
+
+# The code in this files is borrowed from Gedit Synctex plugin.
+#
+# Copyright (C) 2010 Jose Aliste
+#
+# This program is free software; you can redistribute it and/or modify it under
+# the terms of the GNU General Public Licence as published by the Free Software
+# Foundation; either version 2 of the Licence, or (at your option) any later
+# version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE.  See the GNU General Public Licence for more
+# details.
+#
+# You should have received a copy of the GNU General Public Licence along with
+# this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
+# Street, Fifth Floor, Boston, MA  02110-1301, USA
+
+import dbus, subprocess, time
+import dbus.mainloop.glib, sys, os, logging
+from gi.repository import GObject
+
+RUNNING, CLOSED = range(2)
+
+EV_DAEMON_PATH = "/org/gnome/evince/Daemon"
+EV_DAEMON_NAME = "org.gnome.evince.Daemon"
+EV_DAEMON_IFACE = "org.gnome.evince.Daemon"
+
+EVINCE_PATH = "/org/gnome/evince/Evince"
+EVINCE_IFACE = "org.gnome.evince.Application"
+
+EV_WINDOW_IFACE = "org.gnome.evince.Window"
+
+
+
+class EvinceWindowProxy:
+    """A DBUS proxy for an Evince Window."""
+    daemon = None
+    bus = None
+
+    def __init__(self, uri, spawn = False, logger = None):
+        self._log = logger
+        self.uri = uri
+        self.spawn = spawn
+        self.status = CLOSED
+        self.source_handler = None
+        self.dbus_name = ''
+        self._handler = None
+        try:
+            if EvinceWindowProxy.bus is None:
+                EvinceWindowProxy.bus = dbus.SessionBus()
+
+            if EvinceWindowProxy.daemon is None:
+                EvinceWindowProxy.daemon = EvinceWindowProxy.bus.get_object(EV_DAEMON_NAME,
+                                                EV_DAEMON_PATH,
+                                                follow_name_owner_changes=True)
+            EvinceWindowProxy.bus.add_signal_receiver(self._on_doc_loaded, signal_name="DocumentLoaded", 
+                                                      dbus_interface = EV_WINDOW_IFACE, 
+                                                      sender_keyword='sender')
+            self._get_dbus_name(False)
+
+        except dbus.DBusException:
+            if self._log:
+                self._log.debug("Could not connect to the Evince Daemon")
+
+    def _on_doc_loaded(self, uri, **keyargs):
+        if uri == self.uri and self._handler is None:
+            self.handle_find_document_reply(keyargs['sender'])
+        
+    def _get_dbus_name(self, spawn):
+        EvinceWindowProxy.daemon.FindDocument(self.uri,spawn,
+                     reply_handler=self.handle_find_document_reply,
+                     error_handler=self.handle_find_document_error,
+                     dbus_interface = EV_DAEMON_IFACE)
+
+    def handle_find_document_error(self, error):
+        if self._log:
+            self._log.debug("FindDocument DBus call has failed")
+
+    def handle_find_document_reply(self, evince_name):
+        if self._handler is not None:
+            handler = self._handler
+        else:
+            handler = self.handle_get_window_list_reply
+        if evince_name != '':
+            self.dbus_name = evince_name
+            self.status = RUNNING
+            self.evince = EvinceWindowProxy.bus.get_object(self.dbus_name, EVINCE_PATH)
+            self.evince.GetWindowList(dbus_interface = EVINCE_IFACE,
+                          reply_handler = handler,
+                          error_handler = self.handle_get_window_list_error)
+
+    def handle_get_window_list_error (self, e):
+        if self._log:
+            self._log.debug("GetWindowList DBus call has failed")
+
+    def handle_get_window_list_reply (self, window_list):
+        if len(window_list) > 0:
+            window_obj = EvinceWindowProxy.bus.get_object(self.dbus_name, window_list[0])
+            self.window = dbus.Interface(window_obj,EV_WINDOW_IFACE)
+        else:
+            #That should never happen. 
+            if self._log:
+                self._log.debug("GetWindowList returned empty list")
+
+
+    def SyncView(self, input_file, data, time):
+        if self.status == CLOSED:
+            if self.spawn:
+                self._tmp_syncview = [input_file, data, time];
+                self._handler = self._syncview_handler
+                self._get_dbus_name(True)
+        else:
+            self.window.SyncView(input_file, data, time,  dbus_interface = "org.gnome.evince.Window")
+
+    def _syncview_handler(self, window_list):
+        self.handle_get_window_list_reply(window_list)
+
+        if self.status == CLOSED: 
+            return False
+        self.window.SyncView(self._tmp_syncview[0],self._tmp_syncview[1], self._tmp_syncview[2], dbus_interface="org.gnome.evince.Window")
+        del self._tmp_syncview
+        self._handler = None
+        return True
+
+path_output  = os.getcwd() + '/' + sys.argv[1]
+line_number = int(sys.argv[2])
+path_input   = os.getcwd() + '/' + sys.argv[3]
+
+if not os.path.isfile(path_output):
+    print_usage()
+
+dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
+logger = logging.getLogger("evince_dbus")
+logger.setLevel(logging.DEBUG)
+ch = logging.StreamHandler()
+ch.setLevel(logging.DEBUG)
+
+formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
+
+ch.setFormatter(formatter)
+
+logger.addHandler(ch)    
+a = EvinceWindowProxy('file://' + path_output, True,logger=logger)
+
+def sync_view(ev_window, path_input, line_number):
+    ev_window.SyncView(path_input, (line_number, 1), 0)
+    loop.quit()
+
+GObject.timeout_add(400, sync_view, a, path_input, line_number)
+loop = GObject.MainLoop()
+loop.run() 
+

From 1d1eddf4767a62a2be5a613fb02c2eacd863acc9 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Thu, 9 Oct 2014 13:01:04 -0400
Subject: [PATCH 0768/1050] Support backward search from Okular to Neovim.

---
 doc/r-plugin.txt                    | 26 ++++++++++++++++++++++++--
 ftplugin/rnoweb_rplugin.vim         |  8 +++++---
 r-plugin/common_global.vim          |  5 +++++
 r-plugin/synctex_okular_backward.sh |  6 ++++++
 4 files changed, 40 insertions(+), 5 deletions(-)
 create mode 100644 r-plugin/synctex_okular_backward.sh

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index b1783b2..2d13fe3 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -1807,7 +1807,26 @@ Note: If the PDF document is already open the first time that you jump to it,
 and if Okular was not started with the `--unique` argument, another instance
 of Okular will be started.
 
-Note: Neovim has issues in the search forward (from Neovim to Okular).
+Note: If you are using Neovim, the configuration of Okular backward search
+requires additional steps because Neovim does not have the argument
+`--remote-expr`:
+
+   - Copy the file synctex_okular_backward.sh from the Vim-R-plugin directory
+     to your path (for example, ~/bin or /usr/local/bin).
+
+   - Turn the file executable. In the terminal, go to the directory where you
+     have copied the file and do:
+>
+     chmod +x synctex_okular_backward.sh
+<
+   - Edit the file synctex_okular_backward.sh and replace the string
+     "yourlogin" with your actual login name. Adjust the directory used by the
+     Vim-R-plugin as temporary directory if necessary.
+
+   - In Okular, put the following in the Custom Editor Command field:
+>
+     synctex_okular_backward.sh '%f' %l
+<
 
 
 6.32.3 Configuring the PDF editor and Vim's window title~
@@ -2045,6 +2064,9 @@ directory after the installation:
    r-plugin/r.snippets
    r-plugin/common_buffer.vim
    r-plugin/common_global.vim
+   r-plugin/synctex_evince_backward.py
+   r-plugin/synctex_evince_forward.py
+   r-plugin/synctex_okular_backward.sh
    r-plugin/vimrconfig.vim
 
 
@@ -2683,7 +2705,7 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details.
 							       *r-plugin-news*
 10. News~
 
-1.0.1 (2014-09-21)
+1.0.1 (2014-10-09)
 
  * Minor bug fixes.
 
diff --git a/ftplugin/rnoweb_rplugin.vim b/ftplugin/rnoweb_rplugin.vim
index bf1d114..3fdb1a3 100644
--- a/ftplugin/rnoweb_rplugin.vim
+++ b/ftplugin/rnoweb_rplugin.vim
@@ -281,7 +281,6 @@ endif
 " SyncTeX support:
 
 function! SyncTeX_backward(fname, ln)
-    let g:lastfname = [a:fname, a:ln]
     let basenm = substitute(a:fname, "\....$", "", "") " Delete extension
     let basenm = substitute(basenm, 'file://', '', '') " Evince
     let basenm = substitute(basenm, '/\./', '/', '')   " Okular
@@ -377,7 +376,7 @@ function! SyncTeX_forward(fname, ln)
         endif
     endif
     if g:vimrplugin_synctex == "okular"
-        call system("okular --unique " . expand("%:r") . ".pdf#src:" . texln . expand("%:p:h") . "/./" . expand("%:r") . ".tex &")
+        call system("okular --unique " . expand("%:r") . ".pdf#src:" . texln . expand("%:p:h") . "/./" . expand("%:r") . ".tex 2> /dev/null >/dev/null &")
     elseif g:vimrplugin_synctex == "evince"
         call system("python " . g:rplugin_home . "/r-plugin/synctex_evince_forward.py " . expand("%:r") . ".pdf " . texln . " " . expand("%:r") . ".tex &")
         if g:rplugin_has_wmctrl
@@ -400,8 +399,11 @@ endfunction
 
 function! Handle_SyncTeX_backward()
     if v:job_data[1] == 'stdout'
-      let g:lastjobdata = v:job_data[2]
+        let g:lastjobdata = v:job_data[2]
         let fname = substitute(v:job_data[2], '|.*', '', '') 
+        if g:vimrplugin_synctex == "okular"
+            let fname = substitute(fname, '/\./', '/', '')
+        endif
         let ln = substitute(v:job_data[2], '.*|\([0-9]*\).*', '\1', '')
         call SyncTeX_backward(fname, ln)
     elseif v:job_data[1] == 'stderr'
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 2cf516e..11e7f1c 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -3430,6 +3430,11 @@ if $DISPLAY != "" && g:vimrplugin_synctex != "none"
                 call system("python " . g:rplugin_home . "/r-plugin/synctex_evince_backward.py '" . expand("%:r") . ".pdf' " . v:servername . " &")
             endif
         endif
+    elseif g:vimrplugin_synctex == "okular" && has("nvim")
+        call writefile([], $VIMRPLUGIN_TMPDIR . "/okular_search")
+        let g:rplugin_stx_job = jobstart("synctex", "tail", ["-f", $VIMRPLUGIN_TMPDIR . "/okular_search"])
+        autocmd JobActivity synctex call Handle_SyncTeX_backward()
+        autocmd VimLeave * call delete($VIMRPLUGIN_TMPDIR . "/okular_search")
     endif
     call RCreateMaps("ni", 'RSyncFor',        'gp', ':call SyncTeX_forward(bufname("%"), line("."))')
 endif
diff --git a/r-plugin/synctex_okular_backward.sh b/r-plugin/synctex_okular_backward.sh
new file mode 100644
index 0000000..9a98b48
--- /dev/null
+++ b/r-plugin/synctex_okular_backward.sh
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# This script is required to do backward search from Okular to Neovim
+
+echo "$1|$2" >> /tmp/r-plugin-yourlogin/okular_search
+

From 723b391d21c4234e66a8836f2dcd9ad999022062 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Thu, 9 Oct 2014 13:02:00 -0400
Subject: [PATCH 0769/1050] Update.

---
 Makefile         | 3 +++
 list_for_vimball | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/Makefile b/Makefile
index 6f88d44..d01bebe 100644
--- a/Makefile
+++ b/Makefile
@@ -81,6 +81,9 @@ deb:
 	  - r-plugin/nvimcom.py\n\
 	  - r-plugin/nvimserver.py\n\
 	  - r-plugin/timer.sh\n\
+	  - r-plugin/synctex_evince_backward.py\n\
+	  - r-plugin/synctex_evince_forward.py\n\
+	  - r-plugin/synctex_okular_backward.sh\n\
 	  - r-plugin/global_r_plugin.vim\n\
 	  - r-plugin/vimrconfig.vim\n\
 	  - r-plugin/functions.vim\n\
diff --git a/list_for_vimball b/list_for_vimball
index 60eb428..eb695b6 100644
--- a/list_for_vimball
+++ b/list_for_vimball
@@ -26,6 +26,9 @@ r-plugin/r.snippets
 r-plugin/nvimcom.py
 r-plugin/nvimserver.py
 r-plugin/timer.sh
+r-plugin/synctex_evince_backward.py
+r-plugin/synctex_evince_forward.py
+r-plugin/synctex_okular_backward.sh
 r-plugin/vimcom.py
 r-plugin/vimrconfig.vim
 r-plugin/windows.py

From 5214b8595a1e08cfd59d236411bfe70556244167 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Mon, 13 Oct 2014 14:07:35 -0400
Subject: [PATCH 0770/1050] Use :mode to update Neovim window size.

---
 r-plugin/common_global.vim | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 11e7f1c..808aa14 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -664,6 +664,10 @@ function StartR_TmuxSplit(rcmd)
     if WaitVimComStart()
         call g:SendToVimCom("\005B Update OB [StartR]")
     endif
+    if has("nvim")
+        " Force Neovim to update the window size
+        mode
+    endif
 endfunction
 
 
@@ -954,7 +958,7 @@ function WaitVimComStart()
         else
             call RWarningMsg("File '" . g:rplugin_home . "/r-plugin/timer.sh" . "' not found.")
         endif
-        return
+        return 0
     else
         if g:vimrplugin_vimcom_wait < 0
             return 0
@@ -1071,9 +1075,7 @@ function StartObjBrowser_Tmux()
                 \ 'if has("clientserver") && v:servername != ""',
                 \ '    call g:SendToVimCom("\002" . v:servername)',
                 \ 'endif',
-                \ 'if has("nvim")',
-                \ '    call system("kill -s SIGWINCH ' . getpid() . '")',
-                \ 'else',
+                \ 'if !has("nvim")',
                 \ '    sleep 150m',
                 \ '    call UpdateOB("GlobalEnv")',
                 \ 'endif'], objbrowserfile)
@@ -1149,6 +1151,10 @@ function StartObjBrowser_Tmux()
         endif
         let g:rplugin_ob_warn_shown = 1
     endif
+    if has("nvim")
+        " Force Neovim to update the window size
+        mode
+    endif
     return
 endfunction
 
@@ -2080,6 +2086,10 @@ function RQuit(how)
     if g:rplugin_tmuxwasfirst && g:vimrplugin_tmux_title != "automatic" && g:vimrplugin_tmux_title != ""
         call system("tmux set automatic-rename on")
     endif
+    if has("nvim")
+        " Force Neovim to update the window size
+        mode
+    endif
 endfunction
 
 " knit the current buffer content

From d5c9b7c32e2d1dfd94a5fc27d2c8f28a3d935d03 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Mon, 13 Oct 2014 22:29:31 -0400
Subject: [PATCH 0771/1050] Rename VIMRPLUGINSECRET into VIMRPLUGIN_SECRET.
 Reason: to keep the consistence with other variable names which have an
 underscore.

---
 r-plugin/common_global.vim | 10 +++++-----
 r-plugin/nvimcom.py        |  4 ++--
 r-plugin/vimcom.py         |  6 +++---
 3 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 808aa14..583ba82 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -617,7 +617,7 @@ function StartR_TmuxSplit(rcmd)
                 \ 'set-environment VIM_PANE ' . g:rplugin_vim_pane ,
                 \ 'set-environment VIMEDITOR_SVRNM ' . $VIMEDITOR_SVRNM ,
                 \ 'set-environment VIMINSTANCEID ' . $VIMINSTANCEID ,
-                \ 'set-environment VIMRPLUGINSECRET ' . $VIMRPLUGINSECRET ]
+                \ 'set-environment VIMRPLUGIN_SECRET ' . $VIMRPLUGIN_SECRET ]
     if &t_Co == 256
         call extend(tmuxconf, ['set -g default-terminal "' . $TERM . '"'])
     endif
@@ -701,7 +701,7 @@ function StartR_ExternalTerm(rcmd)
         let tmuxcnf = '-f "' . $VIMRPLUGIN_TMPDIR . "/tmux.conf" . '"'
     endif
 
-    let rcmd = 'VIMRPLUGIN_TMPDIR="' . $VIMRPLUGIN_TMPDIR . '" VIMRPLUGIN_HOME="' . $VIMRPLUGIN_HOME . '" VIMINSTANCEID="' . $VIMINSTANCEID . '" VIMRPLUGINSECRET="' . $VIMRPLUGINSECRET . '" VIMEDITOR_SVRNM="' . $VIMEDITOR_SVRNM . '" ' . a:rcmd
+    let rcmd = 'VIMRPLUGIN_TMPDIR="' . $VIMRPLUGIN_TMPDIR . '" VIMRPLUGIN_HOME="' . $VIMRPLUGIN_HOME . '" VIMINSTANCEID="' . $VIMINSTANCEID . '" VIMRPLUGIN_SECRET="' . $VIMRPLUGIN_SECRET . '" VIMEDITOR_SVRNM="' . $VIMEDITOR_SVRNM . '" ' . a:rcmd
 
     call system("tmux has-session -t " . g:rplugin_tmuxsname)
     if v:shell_error
@@ -3898,7 +3898,7 @@ else
         Py import base64
         Py import vim
         Py vim.command("let g:rplugin_random = '" + base64.b64encode(os.urandom(16)).decode() + "'")
-        let $VIMRPLUGINSECRET = substitute(g:rplugin_random, '\W', '', 'g')
+        let $VIMRPLUGIN_SECRET = substitute(g:rplugin_random, '\W', '', 'g')
         Py vim.command("let g:rplugin_random = '" + base64.b64encode(os.urandom(16)).decode() + "'")
     endif
     if !exists("g:rplugin_random")
@@ -3906,10 +3906,10 @@ else
             let g:rplugin_random = system("echo $RANDOM")
         endif
         if exists("g:rplugin_random")
-            let $VIMRPLUGINSECRET = substitute(g:rplugin_random, '\W', '', 'g')
+            let $VIMRPLUGIN_SECRET = substitute(g:rplugin_random, '\W', '', 'g')
             let g:rplugin_random = system("echo $RANDOM")
         else
-            let $VIMRPLUGINSECRET = substitute(strftime("%c"), '\W', '', 'g')
+            let $VIMRPLUGIN_SECRET = substitute(strftime("%c"), '\W', '', 'g')
             let g:rplugin_random = localtime()
         endif
     endif
diff --git a/r-plugin/nvimcom.py b/r-plugin/nvimcom.py
index 8aed05e..63f85e1 100644
--- a/r-plugin/nvimcom.py
+++ b/r-plugin/nvimcom.py
@@ -20,9 +20,9 @@ def DiscoverVimComPort():
         print "call RWarningMsg('VIMINSTANCEID not found by nvimcom.py.')\n"
         sys.stdout.flush()
         return
-    scrt = os.getenv("VIMRPLUGINSECRET")
+    scrt = os.getenv("VIMRPLUGIN_SECRET")
     if scrt is None:
-        print "call RWarningMsg('VIMRPLUGINSECRET not found by nvimcom.py.')\n"
+        print "call RWarningMsg('VIMRPLUGIN_SECRET not found by nvimcom.py.')\n"
         sys.stdout.flush()
         return
 
diff --git a/r-plugin/vimcom.py b/r-plugin/vimcom.py
index 89e879c..5100683 100644
--- a/r-plugin/vimcom.py
+++ b/r-plugin/vimcom.py
@@ -20,11 +20,11 @@ def DiscoverVimComPort():
         if vii is None:
             vim.command("call RWarningMsg('VIMINSTANCEID not found.')")
             return
-    scrt = vim.eval("$VIMRPLUGINSECRET")
+    scrt = vim.eval("$VIMRPLUGIN_SECRET")
     if scrt is None:
-        scrt = os.getenv("VIMRPLUGINSECRET")
+        scrt = os.getenv("VIMRPLUGIN_SECRET")
         if scrt is None:
-            vim.command("call RWarningMsg('VIMRPLUGINSECRET not found.')")
+            vim.command("call RWarningMsg('VIMRPLUGIN_SECRET not found.')")
             return
 
     while repl.find(scrt) < 0 and VimComPort < 10049:

From 30fba00ba654488434a2632d95c1d5f92b0cb260 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Mon, 13 Oct 2014 22:31:09 -0400
Subject: [PATCH 0772/1050] Check the value of VIMRPLUGIN_SECRET for safety.

---
 r-plugin/nvimserver.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/r-plugin/nvimserver.py b/r-plugin/nvimserver.py
index 9b1c5ea..7a8b308 100644
--- a/r-plugin/nvimserver.py
+++ b/r-plugin/nvimserver.py
@@ -8,6 +8,7 @@ def NeovimServer():
     FinishNow = False
     UDP_IP = "127.0.0.1"
     MyPort = 1899
+    VimSecret = os.getenv("VIMRPLUGIN_SECRET")
 
     while True and MyPort < 1999:
         try:
@@ -31,8 +32,8 @@ def NeovimServer():
     while FinishNow == False:
         try:
             data, addr = sock.recvfrom( 1024 ) # buffer size is 1024 bytes
-            if re.match("EXPR ", data):
-                print re.sub("^EXPR ", "", data) + "\n"
+            if re.match(VimSecret, data):
+                print re.sub(VimSecret, "", data) + "\n"
                 sys.stdout.flush()
             else:
                 if data != "":

From c927cad8573451569f42ccbcf7d931bba8221528 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Mon, 13 Oct 2014 22:50:23 -0400
Subject: [PATCH 0773/1050] Minor improvements in documentation of SyncTeX.

---
 doc/r-plugin.txt | 32 ++++++++++++++++++++------------
 1 file changed, 20 insertions(+), 12 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 2d13fe3..a3ea104 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -585,12 +585,12 @@ outside the range 20-180. Se R help on `tidy.source` for details on how to
 control the function behavior.
 
 
-4.2. Edition of rnoweb files~
+4.2. Edition of Rnoweb files~
 
 In Rnoweb files (.Rnw), when the cursor is over the `@` character, which
 finishes an R chunk, the sending of all commands to R is suspended and the
 shortcut to send the current line makes the cursor to jump to the next chunk.
-While editing rnoweb files, the following commands are available in Normal
+While editing Rnoweb files, the following commands are available in Normal
 mode:
 
    [count]gn : go to the next chunk of R code
@@ -600,6 +600,13 @@ The commands cc, ce, cd and ca send the current chunk of R code
 to R Console. The command ch sends the R code from the first
 chunk up to the current line.
 
+The commands kn builds the .tex file from the Rnoweb one using
+the knitr package and kp compiles the pdf. On Linux, if using
+either Evince or Okular, you can jump from the Rnoweb file to the PDF with the
+command jp. To jump from a specific location in the PDF to the
+corresponding line in the Rnoweb, in Evince you should press ,
+and in Okular  (see |SyncTeX| for configuration details).
+
 
 4.3. Omni completion and the highlighting of functions~
 
@@ -982,9 +989,12 @@ work as expected again after any valid code is executed in the R Console.
 
 
 5.7. SyncTeX support is a Linux only feature~
-
-There is no SyncTeX support for Windows and Mac OS X. If you can write the
-code, please, do it.
+						  *SyncTeX-win*  *SyncTeX-mac*
+There is no SyncTeX support for Windows and Mac OS X. Both Sumatra (Windows)
+and Skim (Mac OS X) have support for SyncTeX, but the Vim-R-plugin is not
+ready to communicate with them. If you can, please write the necessary code to
+support anyone of them and submit a push request on github:
+https://github.com/jcfaria/Vim-R-plugin
 
 
 5.8. Bugs that affect Mac OS X, Linux Console and ...~
@@ -1521,7 +1531,7 @@ from the generated .tex file. On Linux/Unix, by default, it calls
 >
    latexmk -pdflatex="pdflatex -file-line-error -synctex=1" -pdf 
 <
-to produce a pdf document from the .tex file produced by either `Sweave()` or
+to produce a pdf document from the .tex file generated by either `Sweave()` or
 `knit()` command. If `latexmk` is not installed, it calls `pdflatex`. You can
 use the option vimrplugin_latexcmd to change this behavior. Example:
 >
@@ -1857,12 +1867,8 @@ To completely disable SyncTeX support, put in your |vimrc|:
    let vimrplugin_synctex = "none"
 <
 
-6.32.4 Support for Sumatra (Windows) and Skim (Mac OS X)~
-
-Both Sumatra and Skim have support for SyncTeX, but the Vim-R-plugin is not
-ready to communicate with them. If you can, please write the necessary code to
-support anyone of them and submit a push request on github:
-https://github.com/jcfaria/Vim-R-plugin
+There is no support for Windows and Mac OS X. See |SyncTeX-win| and
+|SyncTeX-mac|.
 
 
 ==============================================================================
@@ -2711,6 +2717,8 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details.
 
  * The option vimrplugin_assign now accepts the values 0, 1 and 2.
 
+ * SyncTeX support (Evince and Okular)
+
 1.0 (2014-07-02)
 
  * The package now depends on vimcom (which is fully featured and is no longer

From 18a4f1ddebb36215d5dead2a04095aca3e2a9b07 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Tue, 14 Oct 2014 15:50:39 -0400
Subject: [PATCH 0774/1050] Add wmctrl and latexmk as deb pkg dependencies.

---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index d01bebe..bb40c2b 100644
--- a/Makefile
+++ b/Makefile
@@ -133,7 +133,7 @@ deb:
 	Architecture: all\n\
 	Maintainer: Jakson Alves de Aquino \n\
 	Installed-Size: $(INSTALLEDSIZE)\n\
-	Depends: vim | vim-gtk | vim-gnome, tmux (>= 1.8), ncurses-term, vim-addon-manager, r-base-core\n\
+	Depends: vim | vim-gtk | vim-gnome, tmux (>= 1.8), ncurses-term, wmctrl, latexmk, vim-addon-manager, r-base-core\n\
 	Enhances: vim\n\
 	Section: text\n\
 	Priority: extra\n\

From 1023083835be3f3686942d2adf6a765c51ae5b87 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Wed, 15 Oct 2014 21:52:30 -0400
Subject: [PATCH 0775/1050] Require vimcom 1.0-1.

---
 r-plugin/common_global.vim | 18 ++++++++++--------
 r-plugin/nvimcom.py        |  4 ++--
 r-plugin/vimcom.py         |  4 ++--
 3 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 583ba82..7dd7268 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -925,8 +925,8 @@ function ReceiveVimComStartMsg(msg)
         if vmsg[0] != "vimcom"
             call RWarningMsg("Invalid package name: " . vmsg[0])
         endif
-        if vmsg[1] != "1.0-0"
-            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.0-0.')
+        if vmsg[1] != "1.0-1"
+            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.0-1.')
         endif
         if vmsg[2] != $VIMINSTANCEID
             call RWarningMsg("Invalid ID: " . vmsg[2] . " [Correct = " . $VIMINSTANCEID . "]")
@@ -984,8 +984,8 @@ function WaitVimComStart()
         let vr = readfile($VIMRPLUGIN_TMPDIR . "/vimcom_running")
         if vr[2] == $VIMINSTANCEID
             let g:rplugin_vimcom_version = vr[1]
-            if g:rplugin_vimcom_version != "1.0-0"
-                call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.0-0.')
+            if g:rplugin_vimcom_version != "1.0-1"
+                call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.0-1.')
                 sleep 1
             endif
         else
@@ -2088,6 +2088,7 @@ function RQuit(how)
     endif
     if has("nvim")
         " Force Neovim to update the window size
+        sleep 500m
         mode
     endif
 endfunction
@@ -3524,7 +3525,11 @@ function SendToVimCom_Neovim(...)
     endif
 endfunction
 
-let g:SendToVimCom = function("SendToVimCom_Vim")
+if has("nvim")
+    let g:SendToVimCom = function("SendToVimCom_Neovim")
+else
+    let g:SendToVimCom = function("SendToVimCom_Vim")
+endif
 
 " python3 has priority over python
 if has("python3")
@@ -3533,9 +3538,6 @@ if has("python3")
 elseif has("python")
     command! -nargs=+ Py :py 
     command! -nargs=+ PyFile :pyfile 
-elseif has("nvim")
-    command! -nargs=+ Py :call RWarningMsg("Py command not implemented yet: '" .  . "'")
-    let g:SendToVimCom = function("SendToVimCom_Neovim")
 else
     command! -nargs=+ Py :
     command! -nargs=+ PyFile :
diff --git a/r-plugin/nvimcom.py b/r-plugin/nvimcom.py
index 63f85e1..13930b8 100644
--- a/r-plugin/nvimcom.py
+++ b/r-plugin/nvimcom.py
@@ -61,8 +61,8 @@ def DiscoverVimComPort():
         print "let g:rplugin_vimcomport = " + str(VimComPort) + "\n"
         sys.stdout.flush()
         PortWarn = False
-        if repl.find("1.0-0") != 0:
-            print "call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.0-0.')\n"
+        if repl.find("1.0-1") != 0:
+            print "call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.0-1.')\n"
             sys.stdout.flush()
         return
 
diff --git a/r-plugin/vimcom.py b/r-plugin/vimcom.py
index 5100683..cde2c26 100644
--- a/r-plugin/vimcom.py
+++ b/r-plugin/vimcom.py
@@ -58,8 +58,8 @@ def DiscoverVimComPort():
     else:
         vim.command("let g:rplugin_vimcomport = " + str(VimComPort))
         PortWarn = 0
-        if repl.find("1.0-0") != 0:
-            vim.command("call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.0-0.')")
+        if repl.find("1.0-1") != 0:
+            vim.command("call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.0-1.')")
             vim.command("sleep 1")
     return(VimComPort)
 

From 9290dd2d68ef7b800334bddca2ae9e26431d8dea Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Thu, 16 Oct 2014 07:07:42 -0400
Subject: [PATCH 0776/1050] Set all local variables before exiting.

---
 indent/rhelp.vim | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/indent/rhelp.vim b/indent/rhelp.vim
index c4b6f34..3b37128 100644
--- a/indent/rhelp.vim
+++ b/indent/rhelp.vim
@@ -1,7 +1,7 @@
 " Vim indent file
 " Language:	R Documentation (Help), *.Rd
 " Author:	Jakson Alves de Aquino 
-" Last Change:	Thu Jul 10, 2014  07:10PM
+" Last Change:	Thu Oct 16, 2014  07:07AM
 
 
 " Only load this indent file when no other was loaded.
@@ -12,22 +12,18 @@ runtime indent/r.vim
 let s:RIndent = function(substitute(&indentexpr, "()", "", ""))
 let b:did_indent = 1
 
-setlocal indentkeys=0{,0},:,!^F,o,O,e
-setlocal indentexpr=GetRHelpIndent()
-
-" Only define the function once.
-if exists("*GetRHelpIndent")
-  finish
-endif
-
 setlocal noautoindent
 setlocal nocindent
 setlocal nosmartindent
 setlocal nolisp
-
 setlocal indentkeys=0{,0},:,!^F,o,O,e
 setlocal indentexpr=GetCorrectRHelpIndent()
 
+" Only define the functions once.
+if exists("*GetRHelpIndent")
+  finish
+endif
+
 function s:SanitizeRHelpLine(line)
   let newline = substitute(a:line, '\\\\', "x", "g")
   let newline = substitute(newline, '\\{', "x", "g")

From 3defced7b802f344ca8ebdefd5db4ac0d85de636 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Thu, 16 Oct 2014 18:16:45 -0400
Subject: [PATCH 0777/1050] Move SyncTeX code to ftplugin/rnoweb_rplugin.vim.

---
 ftplugin/rnoweb_rplugin.vim | 35 +++++++++++++++++++++++++++++------
 r-plugin/common_global.vim  | 34 ++++++----------------------------
 2 files changed, 35 insertions(+), 34 deletions(-)

diff --git a/ftplugin/rnoweb_rplugin.vim b/ftplugin/rnoweb_rplugin.vim
index 3fdb1a3..4e1a01c 100644
--- a/ftplugin/rnoweb_rplugin.vim
+++ b/ftplugin/rnoweb_rplugin.vim
@@ -269,6 +269,7 @@ call RCreateMaps("ni",  'RSendChunk',   'cc', ':call b:SendChunkToR("silen
 call RCreateMaps("ni",  'RESendChunk',  'ce', ':call b:SendChunkToR("echo", "stay")')
 call RCreateMaps("ni",  'RDSendChunk',  'cd', ':call b:SendChunkToR("silent", "down")')
 call RCreateMaps("ni",  'REDSendChunk', 'ca', ':call b:SendChunkToR("echo", "down")')
+call RCreateMaps("ni",  'RSyncFor',     'gp', ':call SyncTeX_forward(bufname("%"), line("."))')
 nmap  gn :call RnwNextChunk()
 nmap  gN :call RnwPreviousChunk()
 
@@ -387,19 +388,39 @@ function! SyncTeX_forward(fname, ln)
     endif
 endfunction
 
-function! SyncTeX_SetPID(pid)
-    let g:rplugin_synctexpid = a:pid
+function! SyncTeX_SetPID(spid)
+    exe 'autocmd VimLeave * call system("kill ' . a:spid . '")'
 endfunction
 
-function! Kill_SyncTeX()
-    if g:rplugin_synctexpid
-        call system("kill " . g:rplugin_synctexpid)
+function! Run_SyncTeX()
+    if $DISPLAY == "" || g:vimrplugin_synctex == "none" || exists("b:did_synctex")
+        return
+    endif
+    let b:did_synctex = 1
+
+    if executable("wmctrl")
+        let g:rplugin_has_wmctrl = 1
+    endif
+    if g:vimrplugin_synctex == "evince"
+        if has("nvim")
+            let g:rplugin_stx_job = jobstart("synctex", "python", [g:rplugin_home . "/r-plugin/synctex_evince_backward.py", expand("%:r") . ".pdf", "nvim"])
+            autocmd JobActivity synctex call Handle_SyncTeX_backward()
+        else
+            if v:servername != ""
+                call system("python " . g:rplugin_home . "/r-plugin/synctex_evince_backward.py '" . expand("%:r") . ".pdf' " . v:servername . " &")
+            endif
+        endif
+    elseif g:vimrplugin_synctex == "okular" && has("nvim") && !exists("g:rplugin_okular_search")
+        let g:rplugin_okular_search = 1
+        call writefile([], $VIMRPLUGIN_TMPDIR . "/okular_search")
+        let g:rplugin_stx_job = jobstart("synctex", "tail", ["-f", $VIMRPLUGIN_TMPDIR . "/okular_search"])
+        autocmd JobActivity synctex call Handle_SyncTeX_backward()
+        autocmd VimLeave * call delete($VIMRPLUGIN_TMPDIR . "/okular_search")
     endif
 endfunction
 
 function! Handle_SyncTeX_backward()
     if v:job_data[1] == 'stdout'
-        let g:lastjobdata = v:job_data[2]
         let fname = substitute(v:job_data[2], '|.*', '', '') 
         if g:vimrplugin_synctex == "okular"
             let fname = substitute(fname, '/\./', '/', '')
@@ -413,6 +434,8 @@ function! Handle_SyncTeX_backward()
     endif
 endfunction
 
+call Run_SyncTeX()
+
 call RSourceOtherScripts()
 
 let b:undo_ftplugin .= " | unlet! b:IsInRCode b:SourceLines b:PreviousRChunk b:NextRChunk b:SendChunkToR"
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 7dd7268..933ddae 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -3402,10 +3402,6 @@ call RSetDefaultValue("g:vimrplugin_permanent_libs",  "'base,stats,graphics,grDe
 call RSetDefaultValue("g:vimrplugin_user_maps_only", 0)
 call RSetDefaultValue("g:vimrplugin_latexcmd", "'default'")
 
-" SyncTeX options
-let g:rplugin_has_wmctrl = 0
-let g:rplugin_synctexpid = 0
-
 " Try to guess what PDF viewer is used:
 if executable("evince")
     call RSetDefaultValue("g:vimrplugin_synctex", "'evince'")
@@ -3427,30 +3423,6 @@ else
     call RSetDefaultValue("g:vimrplugin_vim_window", "'term'")
 endif
 
-if $DISPLAY != "" && g:vimrplugin_synctex != "none"
-    if executable("wmctrl")
-        let g:rplugin_has_wmctrl = 1
-    endif
-    if g:vimrplugin_synctex == "evince"
-        if has("nvim")
-            let g:rplugin_stx_job = jobstart("synctex", "python", [g:rplugin_home . "/r-plugin/synctex_evince_backward.py", expand("%:r") . ".pdf", "nvim"])
-            autocmd JobActivity synctex call Handle_SyncTeX_backward()
-        else
-            if v:servername != ""
-                autocmd VimLeave * call Kill_SyncTeX()
-                call system("python " . g:rplugin_home . "/r-plugin/synctex_evince_backward.py '" . expand("%:r") . ".pdf' " . v:servername . " &")
-            endif
-        endif
-    elseif g:vimrplugin_synctex == "okular" && has("nvim")
-        call writefile([], $VIMRPLUGIN_TMPDIR . "/okular_search")
-        let g:rplugin_stx_job = jobstart("synctex", "tail", ["-f", $VIMRPLUGIN_TMPDIR . "/okular_search"])
-        autocmd JobActivity synctex call Handle_SyncTeX_backward()
-        autocmd VimLeave * call delete($VIMRPLUGIN_TMPDIR . "/okular_search")
-    endif
-    call RCreateMaps("ni", 'RSyncFor',        'gp', ':call SyncTeX_forward(bufname("%"), line("."))')
-endif
-
-
 " Look for invalid options
 let objbrplace = split(g:vimrplugin_objbr_place, ",")
 let obpllen = len(objbrplace) - 1
@@ -3888,6 +3860,12 @@ let g:rplugin_lastev = ""
 let g:rplugin_hasRSFbutton = 0
 let g:rplugin_tmuxsname = "VimR-" . substitute(localtime(), '.*\(...\)', '\1', '')
 
+" SyncTeX options
+let g:rplugin_has_wmctrl = 0
+let g:rplugin_synctexpid = 0
+let g:rplugin_stx_job = 0
+
+
 " If this is the Object Browser running in a Tmux pane, $VIMINSTANCEID is
 " already defined and shouldn't be changed
 if &filetype == "rbrowser"

From 01925452c33fe57df7f05d64a8f960721d911d88 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Thu, 16 Oct 2014 19:30:09 -0400
Subject: [PATCH 0778/1050] SyncTeX note: Lack of support for child documents.

---
 doc/r-plugin.txt | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index a3ea104..1fdde24 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -605,7 +605,8 @@ the knitr package and kp compiles the pdf. On Linux, if using
 either Evince or Okular, you can jump from the Rnoweb file to the PDF with the
 command jp. To jump from a specific location in the PDF to the
 corresponding line in the Rnoweb, in Evince you should press ,
-and in Okular  (see |SyncTeX| for configuration details).
+and in Okular  (see |r-plugin-SyncTeX| for configuration
+details).
 
 
 4.3. Omni completion and the highlighting of functions~
@@ -989,7 +990,7 @@ work as expected again after any valid code is executed in the R Console.
 
 
 5.7. SyncTeX support is a Linux only feature~
-						  *SyncTeX-win*  *SyncTeX-mac*
+				*r-plugin-SyncTeX-win*  *r-plugin-SyncTeX-mac*
 There is no SyncTeX support for Windows and Mac OS X. Both Sumatra (Windows)
 and Skim (Mac OS X) have support for SyncTeX, but the Vim-R-plugin is not
 ready to communicate with them. If you can, please write the necessary code to
@@ -1171,7 +1172,7 @@ is running:
 |vimrplugin_vimcom_wait|       Time to wait for vimcom loading
 |vimrplugin_vim_wd|            Start R in Vim's working directory
 |vimrplugin_user_maps_only|    Only set user specified key bindings
-|SyncTeX|                      Options for SyncTeX
+|r-plugin-SyncTeX|             Options for SyncTeX
 
 
 6.1. Terminal emulator (Linux/Unix only)~
@@ -1771,7 +1772,7 @@ set those key-bindings specified by the user, put in your vimrc:
 <
 
 6.32 SyncTeX support (Linux only)~
-								     *SyncTeX*
+							    *r-plugin-SyncTeX*
 SyncTeX is a set of communication systems used by some PDF viewers and by some
 text editors which allow users to jump from a specific line in the text editor
 to the corresponding line in the PDF viewer and vice-versa. The Vim-R-plugin
@@ -1781,6 +1782,8 @@ The application `wmctrl` is required to raise both the PDF viewer and Vim
 windows. Limitation: the Vim-R-plugin may raise the wrong terminal window or
 GVim window if there is more than one open.
 
+Note: The Vim-R-plugin does not support Rnoweb master documents that have
+child documents.
 
 6.32.1 Evince configuration~
 
@@ -1867,8 +1870,8 @@ To completely disable SyncTeX support, put in your |vimrc|:
    let vimrplugin_synctex = "none"
 <
 
-There is no support for Windows and Mac OS X. See |SyncTeX-win| and
-|SyncTeX-mac|.
+There is no support for Windows and Mac OS X. See |r-plugin-SyncTeX-win| and
+|r-plugin-SyncTeX-mac|.
 
 
 ==============================================================================
@@ -2711,7 +2714,7 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details.
 							       *r-plugin-news*
 10. News~
 
-1.0.1 (2014-10-09)
+1.0.1 (2014-10-16)
 
  * Minor bug fixes.
 

From 3be2eb28c8cf9d9072c4f4ea31c7a4e8cc3cb5f0 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Fri, 17 Oct 2014 10:04:15 -0400
Subject: [PATCH 0779/1050] Fix alignment of \method in rhelp.

---
 indent/r.vim | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/indent/r.vim b/indent/r.vim
index 301ce16..993637b 100644
--- a/indent/r.vim
+++ b/indent/r.vim
@@ -1,7 +1,7 @@
 " Vim indent file
 " Language:	R
 " Author:	Jakson Alves de Aquino 
-" Last Change:	Thu Jul 10, 2014  07:11PM
+" Last Change:	Fri Oct 17, 2014  10:02AM
 
 
 " Only load this indent file when no other was loaded.
@@ -203,6 +203,9 @@ function SanitizeRLine(line)
   let newline = s:RDelete_parens(newline)
   let newline = substitute(newline, '#.*', "", "")
   let newline = substitute(newline, '\s*$', "", "")
+  if &filetype == "rhelp" && newline =~ '^\\method{.*}{.*}(.*'
+    let newline = substitute(newline, '^\\method{\(.*\)}{.*}', '\1', "")
+  endif
   return newline
 endfunction
 
@@ -253,9 +256,6 @@ function GetRIndent()
     if line =~ '^\\examples{' || line =~ '^\\usage{' || line =~ '^\\dontshow{' || line =~ '^\\dontrun{' || line =~ '^\\donttest{' || line =~ '^\\testonly{'
       return 0
     endif
-    if line =~ '^\\method{.*}{.*}(.*'
-      let line = substitute(line, '^\\method{\(.*\)}{.*}', '\1', "")
-    endif
   endif
 
   if cline =~ '^\s*{'

From 1f895b0aaf42f267fd6a81516d5f87eae09d0c70 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Fri, 17 Oct 2014 18:28:19 -0400
Subject: [PATCH 0780/1050] Add forward search from child Rnoweb to PDF.

---
 doc/r-plugin.txt            | 15 ++++--
 ftplugin/rnoweb_rplugin.vim | 92 +++++++++++++++++++++++--------------
 2 files changed, 69 insertions(+), 38 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 1fdde24..11f64c4 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -1782,8 +1782,17 @@ The application `wmctrl` is required to raise both the PDF viewer and Vim
 windows. Limitation: the Vim-R-plugin may raise the wrong terminal window or
 GVim window if there is more than one open.
 
-Note: The Vim-R-plugin does not support Rnoweb master documents that have
-child documents.
+If you work with a master document and child subdocuments, each child
+subdocument should have the following line:
+>
+   % !Rnw root = master.Rnw
+<
+where `master.Rnw` must be replace with the name of the actual master
+document.
+
+Note: The Vim-R-plugin only supports Rnoweb documents processed by knitr with
+the command kn or kp.
+
 
 6.32.1 Evince configuration~
 
@@ -2714,7 +2723,7 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details.
 							       *r-plugin-news*
 10. News~
 
-1.0.1 (2014-10-16)
+1.0.1 (2014-10-17)
 
  * Minor bug fixes.
 
diff --git a/ftplugin/rnoweb_rplugin.vim b/ftplugin/rnoweb_rplugin.vim
index 4e1a01c..8bfc7bd 100644
--- a/ftplugin/rnoweb_rplugin.vim
+++ b/ftplugin/rnoweb_rplugin.vim
@@ -269,7 +269,7 @@ call RCreateMaps("ni",  'RSendChunk',   'cc', ':call b:SendChunkToR("silen
 call RCreateMaps("ni",  'RESendChunk',  'ce', ':call b:SendChunkToR("echo", "stay")')
 call RCreateMaps("ni",  'RDSendChunk',  'cd', ':call b:SendChunkToR("silent", "down")')
 call RCreateMaps("ni",  'REDSendChunk', 'ca', ':call b:SendChunkToR("echo", "down")')
-call RCreateMaps("ni",  'RSyncFor',     'gp', ':call SyncTeX_forward(bufname("%"), line("."))')
+call RCreateMaps("ni",  'RSyncFor',     'gp', ':call SyncTeX_forward()')
 nmap  gn :call RnwNextChunk()
 nmap  gN :call RnwPreviousChunk()
 
@@ -339,49 +339,71 @@ function! SyncTeX_backward(fname, ln)
     endif
 endfunction
 
-function! SyncTeX_forward(fname, ln)
-    let basenm = substitute(a:fname, "\....$", "", "")
+function! SyncTeX_forward()
+    let basenm = expand("%:t:r")
+    let lnum = 0
+
     if filereadable(basenm . "-concordance.tex")
-        let conc = join(readfile(basenm . "-concordance.tex"), "")
-        let conc = substitute(conc, '\\Sconcordance{.*:%', "", "g")
-        let conc = substitute(conc, "%", " ", "g")
-        let conc = substitute(conc, "}", "", "")
-        let concl = split(conc)
-        let idx = 0
-        let maxidx = len(concl) - 2
-        let texln = concl[0]
-        let rnwln = 1
-        let eureka = 0
-        while rnwln < a:ln && idx < maxidx && eureka == 0
-            let idx += 1
-            let lnrange = range(1, concl[idx])
-            let idx += 1
-            for iii in lnrange
-                let rnwln += concl[idx]
-                let texln += 1
-                if rnwln >= a:ln
-                    let eureka = 1
-                    break
-                endif
-            endfor
-        endwhile
+        let lnum = line(".")
     else
-        if &filetype == "rnoweb"
-            call RWarningMsg('SyncTeX [Vim-R-plugin]: "' . basenm . '-concordance.tex" not found.')
-            return
-        elseif &filetype == "tex"
-            " No conversion needed
-            let texln = a:ln
+        let ischild = search('% *!Rnw *root *=', 'bwn')
+        if ischild
+            let mfile = substitute(getline(ischild), '.*% *!Rnw *root *= *\(.*\) *', '\1', '')
+            let basenm = substitute(mfile, "\....$", "", "")
+            if filereadable(basenm . "-concordance.tex")
+                let mlines = readfile(mfile)
+                for ii in range(len(mlines))
+                    if mlines[ii] =~ '<<.*child *= *["' . "']" . bufname("%") . '["' . "']"
+                        let lnum = ii + 1
+                        break
+                    endif
+                endfor
+                if lnum == 0
+                    call RWarningMsg('Could not find "child=' . bufname("%") . '" in ' . mfile . '.')
+                    return
+                endif
+            else
+                call RWarningMsg('SyncTeX [Vim-R-plugin]: "' . basenm . '-concordance.tex" not found.')
+                return
+            endif
         else
+            call RWarningMsg('SyncTeX [Vim-R-plugin]: "' . basenm . '-concordance.tex" not found.')
             return
         endif
     endif
+
+    let conc = join(readfile(basenm . "-concordance.tex"), "")
+    let conc = substitute(conc, '\\Sconcordance{.*:%', "", "g")
+    let conc = substitute(conc, "%", " ", "g")
+    let conc = substitute(conc, "}", "", "")
+    let concl = split(conc)
+    let idx = 0
+    let maxidx = len(concl) - 2
+    let texln = concl[0]
+    let rnwln = 1
+    let eureka = 0
+    while rnwln < lnum && idx < maxidx && eureka == 0
+        let idx += 1
+        let lnrange = range(1, concl[idx])
+        let idx += 1
+        for iii in lnrange
+            let rnwln += concl[idx]
+            let texln += 1
+            if rnwln >= lnum
+                let eureka = 1
+                break
+            endif
+        endfor
+    endwhile
+
+    let g:last_calc = [lnum, rnwln, texln]
+
     if g:vimrplugin_synctex == "okular"
-        call system("okular --unique " . expand("%:r") . ".pdf#src:" . texln . expand("%:p:h") . "/./" . expand("%:r") . ".tex 2> /dev/null >/dev/null &")
+        call system("okular --unique " . basenm . ".pdf#src:" . texln . expand("%:p:h") . "/./" . basenm . ".tex 2> /dev/null >/dev/null &")
     elseif g:vimrplugin_synctex == "evince"
-        call system("python " . g:rplugin_home . "/r-plugin/synctex_evince_forward.py " . expand("%:r") . ".pdf " . texln . " " . expand("%:r") . ".tex &")
+        call system("python " . g:rplugin_home . "/r-plugin/synctex_evince_forward.py " . basenm . ".pdf " . texln . " " . basenm . ".tex &")
         if g:rplugin_has_wmctrl
-            call system("wmctrl -a '" . expand("%:t:r") . ".pdf'")
+            call system("wmctrl -a '" . basenm . ".pdf'")
         endif
     else
         call RWarningMsg('SyncTeX support for "' . g:vimrplugin_synctex . '" not implemented yet.')

From 8546d8e2820ff727c9bf5aa7c73b8144e260f2c8 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sat, 18 Oct 2014 20:33:53 -0400
Subject: [PATCH 0781/1050] Support Sweave SyncTeX.

---
 doc/r-plugin.txt            |  39 +++++----
 ftplugin/rnoweb_rplugin.vim | 152 +++++++++++++++++++++++-------------
 2 files changed, 121 insertions(+), 70 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 11f64c4..118eadc 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -601,12 +601,15 @@ to R Console. The command ch sends the R code from the first
 chunk up to the current line.
 
 The commands kn builds the .tex file from the Rnoweb one using
-the knitr package and kp compiles the pdf. On Linux, if using
-either Evince or Okular, you can jump from the Rnoweb file to the PDF with the
-command jp. To jump from a specific location in the PDF to the
-corresponding line in the Rnoweb, in Evince you should press ,
-and in Okular  (see |r-plugin-SyncTeX| for configuration
-details).
+the knitr package and kp compiles the pdf; for Sweave, the
+commands are, respectively sw and sp. On Linux, if
+using either Evince or Okular, you can jump from the Rnoweb file to the PDF
+with the command gp. To jump from a specific location in the PDF
+to the corresponding line in the Rnoweb, in Evince you should press
+, and in Okular . No configuration is required if
+you use Evince, Gnome-Terminal and the knitr package, and work with single
+file Rnoweb documents. Otherwise, see |r-plugin-SyncTeX| for configuration
+details.
 
 
 4.3. Omni completion and the highlighting of functions~
@@ -1782,26 +1785,33 @@ The application `wmctrl` is required to raise both the PDF viewer and Vim
 windows. Limitation: the Vim-R-plugin may raise the wrong terminal window or
 GVim window if there is more than one open.
 
+No configuration is required if you use Evince, Gnome-Terminal, the knitr
+package, and single file Rnoweb documents. Otherwise, keep reading...
+
+If you use `Sweave()` rather than `knit()`, you must put in your Rnoweb
+document:
+>
+   \SweaveOpts{concordance=TRUE}
+<
 If you work with a master document and child subdocuments, each child
-subdocument should have the following line:
+subdocument should include the following line:
 >
    % !Rnw root = master.Rnw
 <
-where `master.Rnw` must be replace with the name of the actual master
+where `master.Rnw` must be replaced with the name of the actual master
 document.
 
-Note: The Vim-R-plugin only supports Rnoweb documents processed by knitr with
-the command kn or kp.
-
 
 6.32.1 Evince configuration~
 
-If you run either GVim or Vim in Gnome Terminal, no configuration is required.
+If you have Evince installed, the Vim-R-plugin assumes that you are using it
+to view PDF documents and that you run either GVim or Vim in Gnome-Terminal.
 If you run Vim in another terminal emulator, you have to set the value of
 |vimrplugin_vim_window|, as explained below.
 
 Note: If Evince is not started yet when you try to jump to the PDF document
-for the first time, it will start, but will not jump to desired line.
+for the first time, it will start, but will not jump to desired line; you have
+to press gp again.
 
 
 6.32.2 Okular configuration~
@@ -1821,7 +1831,8 @@ If Evince is not installed in your system, the Vim-R-plugin will automatically
 use Okular as the PDF viewer. Otherwise, you have to set the value of
 |vimrplugin_synctex| to "okular".
 
-If you run Vim (and not GVim) and are not using Konsole as the terminal
+If the Vim-R-plugin is set to use Okular as the PDF viewer, it assumes that
+you run either GVim or Vim in Konsole. If you run Vim in another terminal
 emulator, you have to set the value of |vimrplugin_vim_window|, as explained
 below.
 
diff --git a/ftplugin/rnoweb_rplugin.vim b/ftplugin/rnoweb_rplugin.vim
index 8bfc7bd..3dace30 100644
--- a/ftplugin/rnoweb_rplugin.vim
+++ b/ftplugin/rnoweb_rplugin.vim
@@ -174,11 +174,14 @@ endfunction
 function! RSweave()
     update
     call RSetWD()
+    let scmd = 'vim.interlace.rnoweb("' . expand("%:t") . '", knit = FALSE, buildpdf = FALSE'
     if exists("g:vimrplugin_sweaveargs")
-        call g:SendCmdToR('Sweave("' . expand("%:t") . '", ' . g:vimrplugin_sweaveargs . ')')
-    else
-        call g:SendCmdToR('Sweave("' . expand("%:t") . '")')
+        let scmd .= ', ' . g:vimrplugin_sweaveargs
+    endif
+    if g:vimrplugin_synctex == "none"
+        let scmd .= ", synctex = FALSE"
     endif
+    call g:SendCmdToR(scmd . ')')
 endfunction
 
 function! ROpenPDF()
@@ -281,47 +284,85 @@ endif
 "==========================================================================
 " SyncTeX support:
 
-function! SyncTeX_backward(fname, ln)
-    let basenm = substitute(a:fname, "\....$", "", "") " Delete extension
-    let basenm = substitute(basenm, 'file://', '', '') " Evince
-    let basenm = substitute(basenm, '/\./', '/', '')   " Okular
-    if filereadable(basenm . "-concordance.tex")
-        let conc = join(readfile(basenm . "-concordance.tex"), "")
-        let rnwf = substitute(basenm, '\(.*\)/.*', '\1/', '') . substitute(conc, '\\Sconcordance{concordance:.\{-}:\(.*\):%.*', '\1', "g")
-        let conc = substitute(conc, '\\Sconcordance{.*:%', "", "g")
-        let conc = substitute(conc, "%", " ", "g")
-        let conc = substitute(conc, "}", "", "")
-        let concl = split(conc)
-
-        " See http://www.stats.uwo.ca/faculty/murdoch/9864/Sweave.pdf page 25
-        let idx = 0
-        let maxidx = len(concl) - 2
-        let texln = concl[0]
-        let rnwln = 1
-        let eureka = 0
-        while rnwln < a:ln && idx < maxidx && eureka == 0
-            let idx += 1
-            let lnrange = range(1, concl[idx])
+" See http://www.stats.uwo.ca/faculty/murdoch/9864/Sweave.pdf page 25
+function! SyncTeX_readconc(basenm)
+    let texidx = 0
+    let rnwidx = 0
+    let ntexln = len(readfile(a:basenm . ".tex"))
+    let lstexln = range(1, ntexln)
+    let lsrnwf = range(1, ntexln)
+    let lsrnwl = range(1, ntexln)
+    let conc = readfile(a:basenm . "-concordance.tex")
+    let idx = 0
+    let maxidx = len(conc)
+    while idx < maxidx && texidx < ntexln && conc[idx] =~ "Sconcordance"
+        let texf = substitute(conc[idx], '\\Sconcordance{concordance:\(.\{-}\):.*', '\1', "g")
+        let rnwf = substitute(conc[idx], '\\Sconcordance{concordance:.\{-}:\(.\{-}\):.*', '\1', "g")
+        let idx += 1
+        let concnum = ""
+        while idx < maxidx && conc[idx] !~ "Sconcordance"
+            let concnum = concnum . conc[idx]
             let idx += 1
+        endwhile
+        let concnum = substitute(concnum, '%', '', 'g')
+        let concnum = substitute(concnum, '}', '', '')
+        let concl = split(concnum)
+        let ii = 0
+        let maxii = len(concl) - 2
+        let rnwl = str2nr(concl[0])
+        let lsrnwl[texidx] = rnwl
+        let lsrnwf[texidx] = rnwf
+        let texidx += 1
+        while ii < maxii && texidx < ntexln
+            let ii += 1
+            let lnrange = range(1, concl[ii])
+            let ii += 1
             for iii in lnrange
-                let rnwln += concl[idx]
-                let texln += 1
-                if texln >= a:ln
-                    let eureka = 1
+                if  texidx >= ntexln
                     break
                 endif
+                let rnwl += concl[ii]
+                let lsrnwl[texidx] = rnwl
+                let lsrnwf[texidx] = rnwf
+                let texidx += 1
             endfor
         endwhile
+    endwhile
+    return {"texlnum": lstexln, "rnwfile": lsrnwf, "rnwline": lsrnwl}
+endfunction
+
+function! SyncTeX_backward(fname, ln)
+    let basenm = substitute(a:fname, "\....$", "", "") " Delete extension
+    let basenm = substitute(basenm, 'file://', '', '') " Evince
+    let basenm = substitute(basenm, '/\./', '/', '')   " Okular
+    if filereadable(basenm . "-concordance.tex")
+        let concdata = SyncTeX_readconc(basenm)
+        let texlnum = concdata["texlnum"]
+        let rnwfile = concdata["rnwfile"]
+        let rnwline = concdata["rnwline"]
+        let rnwln = 0
+        for ii in range(len(texlnum))
+            if texlnum[ii] >= a:ln
+                let rnwf = rnwfile[ii]
+                let rnwln = rnwline[ii]
+                break
+            endif
+        endfor
+        if rnwln == 0
+            call RWarningMsg("Could not find Rnoweb source line.")
+            return
+        endif
     else
-        if filereadable(basenm . "Rnw") || filereadable(basenm . "rnw")
+        if filereadable(basenm . ".Rnw") || filereadable(basenm . ".rnw")
             call RWarningMsg('SyncTeX [Vim-R-plugin]: "' . basenm . '-concordance.tex" not found.')
             return
+        else
+            call RWarningMsg('Could not find "' . basenm . '.Rnw".')
         endif
-        " Jump to LaTeX source since there is no Rnoweb file
-        let rnwf = a:fname
-        let rnwln = a:ln
     endif
 
+    let rnwf = substitute(rnwf, '.*/', '', '')
+
     if bufname("%") != rnwf
         if bufloaded(rnwf)
             let savesb = &switchbuf
@@ -342,6 +383,7 @@ endfunction
 function! SyncTeX_forward()
     let basenm = expand("%:t:r")
     let lnum = 0
+    let rnwf = bufname("%")
 
     if filereadable(basenm . "-concordance.tex")
         let lnum = line(".")
@@ -353,8 +395,15 @@ function! SyncTeX_forward()
             if filereadable(basenm . "-concordance.tex")
                 let mlines = readfile(mfile)
                 for ii in range(len(mlines))
+                    " Sweave has detailed child information
+                    if mlines[ii] =~ 'SweaveInput.*' . bufname("%")
+                        let lnum = line(".")
+                        break
+                    endif
+                    " Knitr does not include detailed child information
                     if mlines[ii] =~ '<<.*child *= *["' . "']" . bufname("%") . '["' . "']"
                         let lnum = ii + 1
+                        let rnwf = mfile
                         break
                     endif
                 endfor
@@ -372,31 +421,22 @@ function! SyncTeX_forward()
         endif
     endif
 
-    let conc = join(readfile(basenm . "-concordance.tex"), "")
-    let conc = substitute(conc, '\\Sconcordance{.*:%', "", "g")
-    let conc = substitute(conc, "%", " ", "g")
-    let conc = substitute(conc, "}", "", "")
-    let concl = split(conc)
-    let idx = 0
-    let maxidx = len(concl) - 2
-    let texln = concl[0]
-    let rnwln = 1
-    let eureka = 0
-    while rnwln < lnum && idx < maxidx && eureka == 0
-        let idx += 1
-        let lnrange = range(1, concl[idx])
-        let idx += 1
-        for iii in lnrange
-            let rnwln += concl[idx]
-            let texln += 1
-            if rnwln >= lnum
-                let eureka = 1
-                break
-            endif
-        endfor
-    endwhile
+    let concdata = SyncTeX_readconc(basenm)
+    let texlnum = concdata["texlnum"]
+    let rnwfile = concdata["rnwfile"]
+    let rnwline = concdata["rnwline"]
+    let texln = 0
+    for ii in range(len(texlnum))
+        if rnwfile[ii] =~ rnwf && rnwline[ii] >= lnum
+            let texln = texlnum[ii]
+            break
+        endif
+    endfor
 
-    let g:last_calc = [lnum, rnwln, texln]
+    if texln == 0
+        call RWarningMsg("Error: did not find LaTeX line.")
+        return
+    endif
 
     if g:vimrplugin_synctex == "okular"
         call system("okular --unique " . basenm . ".pdf#src:" . texln . expand("%:p:h") . "/./" . basenm . ".tex 2> /dev/null >/dev/null &")

From 6f4b4773b916ac10a354806d525844c94a2266c4 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sat, 18 Oct 2014 20:35:06 -0400
Subject: [PATCH 0782/1050] Minor changes. Fix search forward shortcut in GVim
 menu. Add note about modifications to evince scripts.

---
 r-plugin/common_global.vim          | 2 +-
 r-plugin/synctex_evince_backward.py | 2 ++
 r-plugin/synctex_evince_forward.py  | 2 ++
 3 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 933ddae..2278d3f 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -2903,7 +2903,7 @@ function MakeRMenu()
         menu R.Command.-Sep61- 
         call RCreateMenuItem("nvi", 'Command.Open\ PDF\ (cur\ file)', 'ROpenPDF', 'op', ':call ROpenPDF()')
         if ($DISPLAY != "" && g:vimrplugin_synctex != "none" && &filetype == "rnoweb") || g:vimrplugin_never_unmake_menu
-            call RCreateMenuItem("nvi", 'Command.Search\ forward\ (SyncTeX)', 'RSyncFor', 'op', ':call ROpenPDF()')
+            call RCreateMenuItem("nvi", 'Command.Search\ forward\ (SyncTeX)', 'RSyncFor', 'gp', ':call ROpenPDF()')
         endif
     endif
     "-------------------------------
diff --git a/r-plugin/synctex_evince_backward.py b/r-plugin/synctex_evince_backward.py
index 7a7375c..6c28495 100644
--- a/r-plugin/synctex_evince_backward.py
+++ b/r-plugin/synctex_evince_backward.py
@@ -17,6 +17,8 @@
 # this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
 # Street, Fifth Floor, Boston, MA  02110-1301, USA
 
+# Modified to Vim-R-plugin by Jakson Aquino
+
 import dbus, subprocess, time
 import dbus.mainloop.glib, sys, os, logging
 from gi.repository import GObject
diff --git a/r-plugin/synctex_evince_forward.py b/r-plugin/synctex_evince_forward.py
index 4f6cd53..791de3f 100644
--- a/r-plugin/synctex_evince_forward.py
+++ b/r-plugin/synctex_evince_forward.py
@@ -17,6 +17,8 @@
 # this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
 # Street, Fifth Floor, Boston, MA  02110-1301, USA
 
+# Modified to Vim-R-plugin by Jakson Aquino
+
 import dbus, subprocess, time
 import dbus.mainloop.glib, sys, os, logging
 from gi.repository import GObject

From 112ac1e9dc193c185182e8cdb577092652e0ad6c Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sat, 18 Oct 2014 21:47:05 -0400
Subject: [PATCH 0783/1050] Do not change working directory. Do not change
 working directory while processing Rnoweb files:
 https://github.com/jcfaria/Vim-R-plugin/issues/131 Also update vimcom version
 since it was necessary to change it too.

---
 ftplugin/r_rplugin.vim      |  3 +--
 ftplugin/rnoweb_rplugin.vim | 11 ++++-------
 ftplugin/rrst_rplugin.vim   |  2 +-
 r-plugin/common_global.vim  | 11 +++++------
 r-plugin/nvimcom.py         |  4 ++--
 r-plugin/vimcom.py          |  4 ++--
 6 files changed, 15 insertions(+), 20 deletions(-)

diff --git a/ftplugin/r_rplugin.vim b/ftplugin/r_rplugin.vim
index a73ac14..07b7998 100644
--- a/ftplugin/r_rplugin.vim
+++ b/ftplugin/r_rplugin.vim
@@ -55,8 +55,7 @@ endfunction
 " Convert R script into Rmd, md and, then, html.
 function! RSpin()
     update
-    call RSetWD()
-    call g:SendCmdToR('require(knitr); spin("' . expand("%:t") . '")')
+    call g:SendCmdToR('require(knitr); .vim_oldwd <- getwd(); setwd("' . expand("%:p:h") . '"); spin("' . expand("%:t") . '"); setwd(.vim_oldwd); rm(.vim_oldwd)')
 endfunction
 
 " Default IsInRCode function when the plugin is used as a global plugin
diff --git a/ftplugin/rnoweb_rplugin.vim b/ftplugin/rnoweb_rplugin.vim
index 3dace30..94cedaf 100644
--- a/ftplugin/rnoweb_rplugin.vim
+++ b/ftplugin/rnoweb_rplugin.vim
@@ -77,11 +77,10 @@ endfunction
 " knit the current buffer content
 function! RKnitRnw()
     update
-    call RSetWD()
     if g:vimrplugin_synctex == "none"
-        call g:SendCmdToR('vim.interlace.rnoweb("' . expand("%:t") . '", buildpdf = FALSE, synctex = FALSE)')
+        call g:SendCmdToR('vim.interlace.rnoweb("' . expand("%:t") . '", rnwdir = "' . expand("%:p:h") . '", buildpdf = FALSE, synctex = FALSE)')
     else
-        call g:SendCmdToR('vim.interlace.rnoweb("' . expand("%:t") . '", buildpdf = FALSE)')
+        call g:SendCmdToR('vim.interlace.rnoweb("' . expand("%:t") . '", rnwdir = "' . expand("%:p:h") . '", buildpdf = FALSE)')
     endif
 endfunction
 
@@ -98,8 +97,7 @@ function! RMakePDF(bibtex, knit)
         endif
     endif
     update
-    call RSetWD()
-    let pdfcmd = "vim.interlace.rnoweb('" . expand("%:t") . "'"
+    let pdfcmd = 'vim.interlace.rnoweb("' . expand("%:t") . '", rnwdir = "' . expand("%:p:h") . '"'
 
     if a:knit == 0
         let pdfcmd = pdfcmd . ', knit = FALSE'
@@ -173,8 +171,7 @@ endfunction
 " Sweave the current buffer content
 function! RSweave()
     update
-    call RSetWD()
-    let scmd = 'vim.interlace.rnoweb("' . expand("%:t") . '", knit = FALSE, buildpdf = FALSE'
+    let scmd = 'vim.interlace.rnoweb("' . expand("%:t") . '", rnwdir = "' . expand("%:p:h") . '", knit = FALSE, buildpdf = FALSE'
     if exists("g:vimrplugin_sweaveargs")
         let scmd .= ', ' . g:vimrplugin_sweaveargs
     endif
diff --git a/ftplugin/rrst_rplugin.vim b/ftplugin/rrst_rplugin.vim
index caed6b0..2bb4cc4 100644
--- a/ftplugin/rrst_rplugin.vim
+++ b/ftplugin/rrst_rplugin.vim
@@ -118,7 +118,7 @@ function! RMakePDFrrst()
         endif
     endif
 
-    let pdfcmd = "vim.interlace.rrst('" . expand("%:t") . "'"
+    let pdfcmd = 'vim.interlace.rrst("' . expand("%:t") . '", rrstdir = "' . expand("%:p:h") . '"'
     if exists("g:vimrplugin_rrstcompiler")
         let pdfcmd = pdfcmd . ", compiler='" . g:vimrplugin_rrstcompiler . "'"
     endif
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 2278d3f..9ab16f3 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -925,8 +925,8 @@ function ReceiveVimComStartMsg(msg)
         if vmsg[0] != "vimcom"
             call RWarningMsg("Invalid package name: " . vmsg[0])
         endif
-        if vmsg[1] != "1.0-1"
-            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.0-1.')
+        if vmsg[1] != "1.0-2"
+            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.0-2.')
         endif
         if vmsg[2] != $VIMINSTANCEID
             call RWarningMsg("Invalid ID: " . vmsg[2] . " [Correct = " . $VIMINSTANCEID . "]")
@@ -984,8 +984,8 @@ function WaitVimComStart()
         let vr = readfile($VIMRPLUGIN_TMPDIR . "/vimcom_running")
         if vr[2] == $VIMINSTANCEID
             let g:rplugin_vimcom_version = vr[1]
-            if g:rplugin_vimcom_version != "1.0-1"
-                call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.0-1.')
+            if g:rplugin_vimcom_version != "1.0-2"
+                call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.0-2.')
                 sleep 1
             endif
         else
@@ -2096,8 +2096,7 @@ endfunction
 " knit the current buffer content
 function! RKnit()
     update
-    call RSetWD()
-    call g:SendCmdToR('require(knitr); knit("' . expand("%:t") . '")')
+    call g:SendCmdToR('require(knitr); .vim_oldwd <- getwd(); setwd("' . expand("%:p:h") . '"); knit("' . expand("%:t") . '"); setwd(.vim_oldwd); rm(.vim_oldwd)')
 endfunction
 
 function RRemoveFromLibls(nlib)
diff --git a/r-plugin/nvimcom.py b/r-plugin/nvimcom.py
index 13930b8..5c9158c 100644
--- a/r-plugin/nvimcom.py
+++ b/r-plugin/nvimcom.py
@@ -61,8 +61,8 @@ def DiscoverVimComPort():
         print "let g:rplugin_vimcomport = " + str(VimComPort) + "\n"
         sys.stdout.flush()
         PortWarn = False
-        if repl.find("1.0-1") != 0:
-            print "call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.0-1.')\n"
+        if repl.find("1.0-2") != 0:
+            print "call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.0-2.')\n"
             sys.stdout.flush()
         return
 
diff --git a/r-plugin/vimcom.py b/r-plugin/vimcom.py
index cde2c26..3328e21 100644
--- a/r-plugin/vimcom.py
+++ b/r-plugin/vimcom.py
@@ -58,8 +58,8 @@ def DiscoverVimComPort():
     else:
         vim.command("let g:rplugin_vimcomport = " + str(VimComPort))
         PortWarn = 0
-        if repl.find("1.0-1") != 0:
-            vim.command("call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.0-1.')")
+        if repl.find("1.0-2") != 0:
+            vim.command("call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.0-2.')")
             vim.command("sleep 1")
     return(VimComPort)
 

From 4a634936aaf8c8850ddf2b5d6b0713719a38091d Mon Sep 17 00:00:00 2001
From: Michael Lerch 
Date: Sat, 18 Oct 2014 20:49:34 -0600
Subject: [PATCH 0784/1050] Also move to correct dir after knitting rmd files

---
 ftplugin/rmd_rplugin.vim | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/ftplugin/rmd_rplugin.vim b/ftplugin/rmd_rplugin.vim
index 9adcb33..f62c940 100644
--- a/ftplugin/rmd_rplugin.vim
+++ b/ftplugin/rmd_rplugin.vim
@@ -66,9 +66,10 @@ function! RmdNextChunk() range
 endfunction
 
 function! RMakeRmd(t)
-    call RSetWD()
     update
 
+    call g:SendCmdToR('.vim_oldwd <- getwd(); setwd("' . expand("%:p:h") . '")')
+
     let rcmd = 'require(rmarkdown); render("' . expand("%:t") . '"'
     if a:t == "odt"
         let rcmd = rcmd . ', "html_document"'
@@ -104,6 +105,7 @@ function! RMakeRmd(t)
         let rcmd = rcmd . '; system("' . g:rplugin_soffbin . ' --invisible --convert-to odt ' . expand("%:r:t") . '.html")'
     endif
     call g:SendCmdToR(rcmd)
+    call g:SendCmdToR('setwd(.vim_oldwd); rm(.vim_oldwd)')
 endfunction
 
 " Send Rmd chunk to R

From 3e5d19cde25f234ad8225f3ed37c53ccc4a89a6c Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sun, 19 Oct 2014 19:27:07 -0400
Subject: [PATCH 0785/1050] Support forward search in Skim (untested code).

---
 ftplugin/rnoweb_rplugin.vim | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/ftplugin/rnoweb_rplugin.vim b/ftplugin/rnoweb_rplugin.vim
index 94cedaf..4d756de 100644
--- a/ftplugin/rnoweb_rplugin.vim
+++ b/ftplugin/rnoweb_rplugin.vim
@@ -438,10 +438,13 @@ function! SyncTeX_forward()
     if g:vimrplugin_synctex == "okular"
         call system("okular --unique " . basenm . ".pdf#src:" . texln . expand("%:p:h") . "/./" . basenm . ".tex 2> /dev/null >/dev/null &")
     elseif g:vimrplugin_synctex == "evince"
-        call system("python " . g:rplugin_home . "/r-plugin/synctex_evince_forward.py " . basenm . ".pdf " . texln . " " . basenm . ".tex &")
+        call system("python " . g:rplugin_home . "/r-plugin/synctex_evince_forward.py " . basenm . ".pdf " . texln . " " . basenm . ".tex 2> /dev/null >/dev/null &")
         if g:rplugin_has_wmctrl
             call system("wmctrl -a '" . basenm . ".pdf'")
         endif
+    elseif g:vimrplugin_synctex = "skim"
+        " This command is based on Skim wiki (not tested)
+        call system("/Applications/Skim.app/Contents/SharedSupport/displayline " . texln . " '" . basenm . ".pdf' 2> /dev/null >/dev/null &")
     else
         call RWarningMsg('SyncTeX support for "' . g:vimrplugin_synctex . '" not implemented yet.')
     endif

From 778efd31944d34723c06396d07929968eb4e9a26 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Tue, 21 Oct 2014 10:10:08 -0400
Subject: [PATCH 0786/1050] Update doc.

---
 doc/r-plugin.txt | 49 +++++++++++++++++++++++++-----------------------
 1 file changed, 26 insertions(+), 23 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 118eadc..779c553 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -859,7 +859,7 @@ capturing the text selected by the mouse. The solution is to disable mouse
 support in Tmux. You will be able to toggle mouse support on and off by typing
 m if you add the following line to your ~/.tmux.conf:
 >
-   bind m run-shell '( if [ "mode-mouse on" = "$(tmux show-window-option | grep mode-mouse)" ]; then toggle=off; else toggle=on; fi; tmux display-message "mouse $toggle"; tmux set-option -w mode-mouse $toggle ; for cmd in mouse-select-pane mouse-resize-pane mouse-select-window; do tmux set-option -g $cmd $toggle ; done;) > /dev/null 2>&1'
+   bind m run-shell '( if [ "mode-mouse off" = "$(tmux show-window-option mode-mouse)" ]; then toggle=on; else toggle=off; fi; tmux display-message "mouse $toggle"; tmux set-option -w mode-mouse $toggle ; for cmd in mouse-select-pane mouse-resize-pane mouse-select-window; do tmux set-option -g $cmd $toggle ; done;) > /dev/null 2>&1'
 <
 
 4.8.2 Remote access~
@@ -974,7 +974,7 @@ See: https://github.com/jcfaria/Vim-R-plugin/issues/77
 
 5.5. Functions are not always correctly sent to R~
 
-The plugin is only capable of recognizing functions defined using the <-
+The plugin is only capable of recognizing functions defined using the `<-`
 operator. See: https://github.com/jcfaria/Vim-R-plugin/issues/94
 
 
@@ -1067,37 +1067,40 @@ See also: |r-plugin-remote|.
 
 The communication between Vim and R will work only if R was started by Vim
 through the rf command because the plugin was designed to connect
-each Vim instance with its own R instance. If you start R before Vim, it will
-not inherit from Vim the environment variables VIMRPLUGIN_TMPDIR,
-VIMRPLUGIN_HOME, VIMEDITOR_SVRNM and VIMINSTANCEID. The first one is the path
-used by the R package vimcom to save temporary files used by the Vim-R-plugin
-to: perform omnicompletion, show R documentation in a Vim buffer, and update
-the Object Browser. The last one is used by the Vim-R-plugin to know that it is
-not connecting to an R instance initiated by another Vim instance. If you use
-Vim to start R, but then closes Vim, the VIMINSTANCEID variable in R will
-become outdated. Additionally, the Vim-R-plugin sets the value of its internal
-variable SendCmdToR from SendCmdToR_fake to the appropriate value when R is
-successfully started. It is possible to set the values of all these variables
-manually, but, as you can see below, it is not practical to do so. If you have
-either started R before Vim or closed Vim and opened it again and really want
-full communication between Vim and R, you can try the following (not all
-procedures are necessary for all cases):
+each Vim instance with its own R instance.
+
+If you start R before Vim, it will not inherit from Vim the environment
+variables VIMRPLUGIN_TMPDIR, VIMRPLUGIN_HOME, VIMEDITOR_SVRNM, VIMINSTANCEID,
+and VIMRPLUGIN_SECRET. The first one is the path used by the R package vimcom
+to save temporary files used by the Vim-R-plugin to: perform omnicompletion,
+show R documentation in a Vim buffer, and update the Object Browser. The two
+last ones are used by the Vim-R-plugin and by vimcom to know that the
+connections are valid. If you use Vim to start R, but then closes Vim, some
+variables will become outdated. Additionally, the Vim-R-plugin sets the value
+of its internal variable SendCmdToR from SendCmdToR_fake to the appropriate
+value when R is successfully started. It is possible to set the values of all
+those variables manually, but, as you can see below, it is not practical to do
+so. If you have either started R before Vim or closed Vim and opened it again
+and really want full communication between Vim and R, you can try the
+following (not all procedures are necessary for all cases):
 
    In Normal mode Vim do:
 >
    :echo $VIMRPLUGIN_TMPDIR
    :echo $VIMINSTANCEID
+   :echo $VIMRPLUGIN_SECRET
    :echo $VIMEDITOR_SVRNM
    :echo $VIMRPLUGIN_HOME
 <
    In R do:
 >
    detach("package:vimcom", unload = TRUE)
-   Sys.setenv(VIMRPLUGIN_TMPDIR="T") # where "T" is what Vim has echoed
+   Sys.setenv(VIMRPLUGIN_TMPDIR="T")  # where "T" is what Vim has echoed
+   Sys.setenv(VIMINSTANCEID="I")      # where "I" is what Vim has echoed
+   Sys.setenv(VIMRPLUGIN_SECRET"="S") # where "S" is what Vim has echoed
+   Sys.setenv(VIMEDITOR_SVRNM"="N")   # where "N" is what Vim has echoed
+   Sys.setenv(VIMRPLUGIN_HOME"="H")   # where "H" is what Vim has echoed
    library(vimcom)
-   Sys.setenv(VIMINSTANCEID="I")     # where "I" is what Vim has echoed
-   Sys.setenv(VIMEDITOR_SVRNM"="S")  # where "S" is what Vim has echoed
-   Sys.setenv(VIMRPLUGIN_HOME"="H")  # where "H" is what Vim has echoed
 <
 If you are running R in a terminal emulator (Linux/Unix) Vim still needs to
 know the name of Tmux session and Tmux pane where R is running.
@@ -1794,7 +1797,7 @@ document:
    \SweaveOpts{concordance=TRUE}
 <
 If you work with a master document and child subdocuments, each child
-subdocument should include the following line:
+subdocument (TeX and Rnoweb alike) should include the following line:
 >
    % !Rnw root = master.Rnw
 <
@@ -2734,7 +2737,7 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details.
 							       *r-plugin-news*
 10. News~
 
-1.0.1 (2014-10-17)
+1.0.1 (2014-10-20)
 
  * Minor bug fixes.
 

From 583d7fec6922b4c16fe56214238f85cbc7d0fe0c Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Tue, 21 Oct 2014 10:11:21 -0400
Subject: [PATCH 0787/1050] Support SyncTeX with subdirectory documents.

---
 ftplugin/rnoweb_rplugin.vim        | 97 +++++++++++++++++++++++++-----
 r-plugin/synctex_evince_forward.py |  3 -
 2 files changed, 82 insertions(+), 18 deletions(-)

diff --git a/ftplugin/rnoweb_rplugin.vim b/ftplugin/rnoweb_rplugin.vim
index 4d756de..b70f909 100644
--- a/ftplugin/rnoweb_rplugin.vim
+++ b/ftplugin/rnoweb_rplugin.vim
@@ -281,6 +281,31 @@ endif
 "==========================================================================
 " SyncTeX support:
 
+function! SyncTeX_GetMaster()
+    if filereadable(expand("%:t:r") . "-concordance.tex")
+        return [expand("%:t:r"), "."]
+    endif
+
+    let ischild = search('% *!Rnw *root *=', 'bwn')
+    if ischild
+        let mfile = substitute(getline(ischild), '.*% *!Rnw *root *= *\(.*\) *', '\1', '')
+        if mfile =~ "/"
+            let mdir = substitute(mfile, '\(.*\)/.*', '\1', '')
+            let mfile = substitute(mfile, '.*/', '', '')
+            if mdir == '..'
+                let mdir = expand("%:p:h:h")
+            endif
+        else
+            let mdir = "."
+        endif
+        let basenm = substitute(mfile, '\....$', '', '')
+        return [basenm, mdir]
+    endif
+
+    " Maybe this buffer is a master Rnoweb not compiled yet.
+    return [expand("%:t:r"), "."]
+endfunction
+
 " See http://www.stats.uwo.ca/faculty/murdoch/9864/Sweave.pdf page 25
 function! SyncTeX_readconc(basenm)
     let texidx = 0
@@ -329,9 +354,14 @@ function! SyncTeX_readconc(basenm)
 endfunction
 
 function! SyncTeX_backward(fname, ln)
-    let basenm = substitute(a:fname, "\....$", "", "") " Delete extension
-    let basenm = substitute(basenm, 'file://', '', '') " Evince
-    let basenm = substitute(basenm, '/\./', '/', '')   " Okular
+    let flnm = substitute(a:fname, 'file://', '', '') " Evince
+    let flnm = substitute(flnm, '/\./', '/', '')      " Okular
+    let basenm = substitute(flnm, "\....$", "", "")   " Delete extension
+    if basenm =~ "/"
+        let basedir = substitute(basenm, '\(.*\)/.*', '\1', '')
+    else
+        let basedir = '.'
+    endif
     if filereadable(basenm . "-concordance.tex")
         let concdata = SyncTeX_readconc(basenm)
         let texlnum = concdata["texlnum"]
@@ -353,21 +383,37 @@ function! SyncTeX_backward(fname, ln)
         if filereadable(basenm . ".Rnw") || filereadable(basenm . ".rnw")
             call RWarningMsg('SyncTeX [Vim-R-plugin]: "' . basenm . '-concordance.tex" not found.')
             return
+        elseif filereadable(flnm)
+            let rnwf = flnm
+            let rnwln = a:ln
         else
-            call RWarningMsg('Could not find "' . basenm . '.Rnw".')
+            call RWarningMsg("Could not find '" . basenm . ".Rnw'.")
         endif
     endif
 
-    let rnwf = substitute(rnwf, '.*/', '', '')
+    let rnwbn = substitute(rnwf, '.*/', '', '')
+    let rnwf = substitute(rnwf, '^\./', '', '')
 
-    if bufname("%") != rnwf
-        if bufloaded(rnwf)
+    if bufname("%") != rnwbn
+        if bufloaded(basedir . '/' . rnwf)
+            let savesb = &switchbuf
+            set switchbuf=useopen,usetab
+            exe "sb " . basedir . '/' . rnwf
+            exe "set switchbuf=" . savesb
+        elseif bufloaded(rnwf)
             let savesb = &switchbuf
             set switchbuf=useopen,usetab
             exe "sb " . rnwf
             exe "set switchbuf=" . savesb
         else
-            exe "tabnew " . rnwf
+            if filereadable(basedir . '/' . rnwf)
+                exe "tabnew " . basedir . '/' . rnwf
+            elseif filereadable(rnwf)
+                exe "tabnew " . rnwf
+            else
+                call RWarningMsg('Could not find either "' . rnwbn . ' or "' . rnwf . '" in "' . basedir . '".')
+                return
+            endif
         endif
     endif
     exe rnwln
@@ -378,6 +424,9 @@ function! SyncTeX_backward(fname, ln)
 endfunction
 
 function! SyncTeX_forward()
+    if expand("%:p") =~ ' '
+        call RWarningMsg('SyncTeX will not work because there is empty space in this file path: "' . expand("%:p") . '"')
+    endif
     let basenm = expand("%:t:r")
     let lnum = 0
     let rnwf = bufname("%")
@@ -388,7 +437,7 @@ function! SyncTeX_forward()
         let ischild = search('% *!Rnw *root *=', 'bwn')
         if ischild
             let mfile = substitute(getline(ischild), '.*% *!Rnw *root *= *\(.*\) *', '\1', '')
-            let basenm = substitute(mfile, "\....$", "", "")
+            let basenm = substitute(mfile, '\....$', '', '')
             if filereadable(basenm . "-concordance.tex")
                 let mlines = readfile(mfile)
                 for ii in range(len(mlines))
@@ -398,9 +447,9 @@ function! SyncTeX_forward()
                         break
                     endif
                     " Knitr does not include detailed child information
-                    if mlines[ii] =~ '<<.*child *= *["' . "']" . bufname("%") . '["' . "']"
+                    if mlines[ii] =~ '<<.*child *=.*' . bufname("%") . '["' . "']"
                         let lnum = ii + 1
-                        let rnwf = mfile
+                        let rnwf = substitute(mfile, '.*/', '', '')
                         break
                     endif
                 endfor
@@ -409,7 +458,7 @@ function! SyncTeX_forward()
                     return
                 endif
             else
-                call RWarningMsg('SyncTeX [Vim-R-plugin]: "' . basenm . '-concordance.tex" not found.')
+                call RWarningMsg('Vim-R-plugin [SyncTeX]: "' . basenm . '-concordance.tex" not found.')
                 return
             endif
         else
@@ -434,11 +483,18 @@ function! SyncTeX_forward()
         call RWarningMsg("Error: did not find LaTeX line.")
         return
     endif
+    if basenm =~ '/'
+        let basedir = substitute(basenm, '\(.*\)/.*', '\1', '')
+        let basenm = substitute(basenm, '.*/', '', '')
+        exe "cd " . basedir
+    else
+        let basedir = ''
+    endif
 
     if g:vimrplugin_synctex == "okular"
         call system("okular --unique " . basenm . ".pdf#src:" . texln . expand("%:p:h") . "/./" . basenm . ".tex 2> /dev/null >/dev/null &")
     elseif g:vimrplugin_synctex == "evince"
-        call system("python " . g:rplugin_home . "/r-plugin/synctex_evince_forward.py " . basenm . ".pdf " . texln . " " . basenm . ".tex 2> /dev/null >/dev/null &")
+        call system("python " . g:rplugin_home . "/r-plugin/synctex_evince_forward.py " . basenm . ".pdf " . texln . " '" . basenm . ".tex' 2> /dev/null >/dev/null &")
         if g:rplugin_has_wmctrl
             call system("wmctrl -a '" . basenm . ".pdf'")
         endif
@@ -448,6 +504,9 @@ function! SyncTeX_forward()
     else
         call RWarningMsg('SyncTeX support for "' . g:vimrplugin_synctex . '" not implemented yet.')
     endif
+    if basedir != ''
+        cd -
+    endif
 endfunction
 
 function! SyncTeX_SetPID(spid)
@@ -463,15 +522,23 @@ function! Run_SyncTeX()
     if executable("wmctrl")
         let g:rplugin_has_wmctrl = 1
     endif
+
     if g:vimrplugin_synctex == "evince"
+        let [basenm, basedir] = SyncTeX_GetMaster()
+        if basedir != '.'
+            exe "cd " . basedir
+        endif
         if has("nvim")
-            let g:rplugin_stx_job = jobstart("synctex", "python", [g:rplugin_home . "/r-plugin/synctex_evince_backward.py", expand("%:r") . ".pdf", "nvim"])
+            let g:rplugin_stx_job = jobstart("synctex", "python", [g:rplugin_home . "/r-plugin/synctex_evince_backward.py", basenm . ".pdf", "nvim"])
             autocmd JobActivity synctex call Handle_SyncTeX_backward()
         else
             if v:servername != ""
-                call system("python " . g:rplugin_home . "/r-plugin/synctex_evince_backward.py '" . expand("%:r") . ".pdf' " . v:servername . " &")
+                call system("python " . g:rplugin_home . "/r-plugin/synctex_evince_backward.py '" . basenm . ".pdf' " . v:servername . " &")
             endif
         endif
+        if basedir != '.'
+            cd -
+        endif
     elseif g:vimrplugin_synctex == "okular" && has("nvim") && !exists("g:rplugin_okular_search")
         let g:rplugin_okular_search = 1
         call writefile([], $VIMRPLUGIN_TMPDIR . "/okular_search")
diff --git a/r-plugin/synctex_evince_forward.py b/r-plugin/synctex_evince_forward.py
index 791de3f..b19afa9 100644
--- a/r-plugin/synctex_evince_forward.py
+++ b/r-plugin/synctex_evince_forward.py
@@ -130,9 +130,6 @@ def _syncview_handler(self, window_list):
 line_number = int(sys.argv[2])
 path_input   = os.getcwd() + '/' + sys.argv[3]
 
-if not os.path.isfile(path_output):
-    print_usage()
-
 dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
 logger = logging.getLogger("evince_dbus")
 logger.setLevel(logging.DEBUG)

From 64d7a0c42af76b6fd3caa4b2fce8c645072542cd Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Fri, 24 Oct 2014 17:06:48 -0400
Subject: [PATCH 0788/1050] Add support to Zathura (>= 0.3.1) SyncTeX system.

---
 doc/r-plugin.txt            | 31 +++++++++++++++++++++----------
 ftplugin/rnoweb_rplugin.vim | 19 +++++++++++++++++++
 r-plugin/vimcom.py          | 11 +++++++++++
 3 files changed, 51 insertions(+), 10 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 779c553..58aabc7 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -603,13 +603,13 @@ chunk up to the current line.
 The commands kn builds the .tex file from the Rnoweb one using
 the knitr package and kp compiles the pdf; for Sweave, the
 commands are, respectively sw and sp. On Linux, if
-using either Evince or Okular, you can jump from the Rnoweb file to the PDF
+using Evince, Okular or Zathura, you can jump from the Rnoweb file to the PDF
 with the command gp. To jump from a specific location in the PDF
-to the corresponding line in the Rnoweb, in Evince you should press
-, and in Okular . No configuration is required if
-you use Evince, Gnome-Terminal and the knitr package, and work with single
-file Rnoweb documents. Otherwise, see |r-plugin-SyncTeX| for configuration
-details.
+to the corresponding line in the Rnoweb, in either Evince or Zathura you
+should press , and in Okular . No configuration is
+required if you use Evince, Gnome-Terminal and the knitr package, and work
+with single file Rnoweb documents. Otherwise, see |r-plugin-SyncTeX| for
+configuration details.
 
 
 4.3. Omni completion and the highlighting of functions~
@@ -1782,7 +1782,7 @@ set those key-bindings specified by the user, put in your vimrc:
 SyncTeX is a set of communication systems used by some PDF viewers and by some
 text editors which allow users to jump from a specific line in the text editor
 to the corresponding line in the PDF viewer and vice-versa. The Vim-R-plugin
-has support for Evince and Okular SyncTeX systems.
+has support for Evince, Zathura and Okular SyncTeX systems.
 
 The application `wmctrl` is required to raise both the PDF viewer and Vim
 windows. Limitation: the Vim-R-plugin may raise the wrong terminal window or
@@ -1802,7 +1802,8 @@ subdocument (TeX and Rnoweb alike) should include the following line:
    % !Rnw root = master.Rnw
 <
 where `master.Rnw` must be replaced with the name of the actual master
-document.
+document. Note, however, that the knitr package (version 1.7) has no SyncTeX
+support for child documents.
 
 
 6.32.1 Evince configuration~
@@ -1864,6 +1865,16 @@ requires additional steps because Neovim does not have the argument
      synctex_okular_backward.sh '%f' %l
 <
 
+6.32.1 Zathura configuration~
+
+Zathura (version >= 0.3.1) is also supported. If the terminal emulator is not
+raised during backward search (from PDF to Vim), you have to set the value of
+|vimrplugin_vim_window|, as explained below.
+
+Note: If Zathura is not started yet when you try to jump to the PDF document
+for the first time, it will start, but will not jump to desired line; you have
+to press gp again.
+
 
 6.32.3 Configuring the PDF editor and Vim's window title~
 							  *vimrplugin_synctex*
@@ -2737,13 +2748,13 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details.
 							       *r-plugin-news*
 10. News~
 
-1.0.1 (2014-10-20)
+1.0.1 (2014-10-24)
 
  * Minor bug fixes.
 
  * The option vimrplugin_assign now accepts the values 0, 1 and 2.
 
- * SyncTeX support (Evince and Okular)
+ * SyncTeX support (Evince, Okular and Zathura)
 
 1.0 (2014-07-02)
 
diff --git a/ftplugin/rnoweb_rplugin.vim b/ftplugin/rnoweb_rplugin.vim
index b70f909..8450df5 100644
--- a/ftplugin/rnoweb_rplugin.vim
+++ b/ftplugin/rnoweb_rplugin.vim
@@ -498,6 +498,20 @@ function! SyncTeX_forward()
         if g:rplugin_has_wmctrl
             call system("wmctrl -a '" . basenm . ".pdf'")
         endif
+    elseif g:vimrplugin_synctex == "zathura"
+        if g:rplugin_zathura_pid[basenm] == 0
+            exe "Py Start_Zathura('" . basenm . "', '" . v:servername . "')"
+        elseif g:rplugin_zathura_pid[basenm]
+            let result = system("zathura --synctex-forward=" . texln . ":1:" . basenm . ".tex --synctex-pid=" . g:rplugin_zathura_pid[basenm] . " " . basenm . ".pdf")
+            if v:shell_error
+                " Maybe Zathura was closed.
+                let g:rplugin_zathura_pid[basenm] = 0
+                exe "Py Start_Zathura('" . basenm . "', '" . v:servername . "')"
+            endif
+            if g:rplugin_has_wmctrl
+                call system("wmctrl -a '" . basenm . ".pdf'")
+            endif
+        endif
     elseif g:vimrplugin_synctex = "skim"
         " This command is based on Skim wiki (not tested)
         call system("/Applications/Skim.app/Contents/SharedSupport/displayline " . texln . " '" . basenm . ".pdf' 2> /dev/null >/dev/null &")
@@ -563,6 +577,11 @@ function! Handle_SyncTeX_backward()
     endif
 endfunction
 
+if !exists("g:rplugin_zathura_pid")
+    let g:rplugin_zathura_pid = {}
+endif
+let g:rplugin_zathura_pid[expand("%:r")] = 0
+
 call Run_SyncTeX()
 
 call RSourceOtherScripts()
diff --git a/r-plugin/vimcom.py b/r-plugin/vimcom.py
index 3328e21..d8cf1e9 100644
--- a/r-plugin/vimcom.py
+++ b/r-plugin/vimcom.py
@@ -3,6 +3,7 @@
 import vim
 import os
 import re
+import subprocess
 VimComPort = 0
 PortWarn = 0
 VimComFamily = None
@@ -98,3 +99,13 @@ def SendToVimCom(aString):
         received = received.replace("'", "' . \"'\" . '")
         vim.command("let g:rplugin_lastrpl = '" + received + "'")
 
+
+def Start_Zathura(basenm, sname):
+    a1 = '--synctex-editor-command'
+    a2 = 'vim --servername ' + sname + " --remote-expr SyncTeX_backward(\\'%{input}\\',%{line})"
+    a3 = basenm + ".pdf"
+    #zpid = os.spawnlp(os.P_NOWAIT, "zathura", "zathura", a1, a2, a3)
+    FNULL = open(os.devnull, 'w')
+    zpid = subprocess.Popen(["zathura", a1, a2, a3], stdout = FNULL, stderr = FNULL).pid
+    vim.command("let g:rplugin_zathura_pid['" + basenm + "'] = " + str(zpid))
+

From c4e5a9896f1ebdd1854d3ce57a7716edb4101b2c Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sat, 25 Oct 2014 13:53:34 -0400
Subject: [PATCH 0789/1050] No longer use R to open the PDF from Rnoweb. To get
 a better control of the PDF viewer, use Vim to open the PDF generated by
 either Rnoweb or Rmd. Changes:   - The option vimrplugin_openpdf_quietly was
 deprecated.   - New option: vimrplugin_pdfviewer.   - The meaning of
 vimrplugin_synctex was changed.

---
 doc/r-plugin.txt            |  37 ++++------
 ftplugin/rmd_rplugin.vim    |   4 +-
 ftplugin/rnoweb_rplugin.vim | 105 +++++++--------------------
 r-plugin/common_global.vim  | 140 ++++++++++++++++++++++++++++--------
 r-plugin/nvimcom.py         |   4 +-
 r-plugin/vimcom.py          |   5 +-
 6 files changed, 158 insertions(+), 137 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 58aabc7..408281b 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -1165,8 +1165,8 @@ is running:
 |vimrplugin_never_unmake_menu| Do not unmake the menu when switching buffers
 |vimrplugin_map_r|             Use 'r' to send lines and selected text
 |vimrplugin_ca_ck|             Add ^A^K to the beginning of commands
+|vimrplugin_pdfviewer|         PDF application used to open PDF documents
 |vimrplugin_openpdf|           Open PDF after processing rnoweb file
-|vimrplugin_openpdf_quietly|   Open PDF quietly
 |vimrplugin_openhtml|          Open HTML after processing either Rrst or Rmd
 |vimrplugin_strict_rst|        Code style for generated rst files
 |vimrplugin_insert_mode_cmds|  Allow R commands in insert mode
@@ -1593,8 +1593,8 @@ in your |vimrc|:
 <
 
 6.23. Open PDF after processing rnoweb, rmd or rrst files~
+							*vimrplugin_pdfviewer*
 							  *vimrplugin_openpdf*
-						  *vimrplugin_openpdf_quietly*
 							 *vimrplugin_openhtml*
 The plugin can automatically open the pdf file generated by pdflatex, after
 either `Sweave()` or `knit()`. This behavior is controlled by the variable
@@ -1615,20 +1615,10 @@ the X server) you may want to put in your |vimrc|:
 <
 Note: If the pdf is already open, some pdf readers will automatically update
 the pdf; others will lock the pdf file and prevent R from successfully
-compiling it again.
-
-The application used to open the pdf may not be the same when the pdf is open
-by R (when vimrplugin_openpdf = 1) and when you open it manually with
-op key binding. If you are using Linux/Unix, you can change the
-pdf reader by setting the value of the environment variable $R_PDFVIEWER. This
-will affect both Vim and R.
-
-On Linux/Unix, when vimrplugin_openpdf = 1, the application used to open the
-pdf may be quite verbose, printing many lines of useless diagnostic messages
-in the R Console. Put the following in your |vimrc| to inhibit these messages
-(and all useful error messages):
+compiling it again. You can change the value of vimrplugin_pdfviewer in your
+|vimrc| to define what PDF viewer will be called. Example:
 >
-   let vimrplugin_openpdf_quietly = 1
+   let vimrplugin_pdfviewer = "zathura"
 <
 If editing an Rmd file, you can produce the html result with kh.
 The html file will be automatically opened if you put the following in your
@@ -1833,7 +1823,7 @@ In the command above, replace `vim` with `gvim` if you use GVim.
 
 If Evince is not installed in your system, the Vim-R-plugin will automatically
 use Okular as the PDF viewer. Otherwise, you have to set the value of
-|vimrplugin_synctex| to "okular".
+|vimrplugin_pdfviewer| to "okular".
 
 If the Vim-R-plugin is set to use Okular as the PDF viewer, it assumes that
 you run either GVim or Vim in Konsole. If you run Vim in another terminal
@@ -1878,11 +1868,12 @@ to press gp again.
 
 6.32.3 Configuring the PDF editor and Vim's window title~
 							  *vimrplugin_synctex*
+							*vimrplugin_pdfviewer*
 						       *vimrplugin_vim_window*
 If SyncTeX does not work (see above), you may try to set in your |vimrc| the
-values of vimrplugin_synctex and vimrplugin_vim_window.
+values of vimrplugin_pdfviewer and vimrplugin_vim_window.
 
-The valid values for vimrplugin_synctex are "evince" and "okular".
+The valid values for vimrplugin_pdfviewer are "evince" and "okular".
 
 To know the correct value of vimrplugin_vim_window, type in the terminal
 emulator:
@@ -1896,12 +1887,12 @@ part of the title of the window where Vim is running ("GVim", "Terminal",
 
 Example of |vimrc| configuration:
 >
-   let vimrplugin_synctex = "okular"
+   let vimrplugin_pdfviewer = "okular"
    let vimrplugin_vim_window = "XTerm"
 <
 To completely disable SyncTeX support, put in your |vimrc|:
 >
-   let vimrplugin_synctex = "none"
+   let vimrplugin_synctex = 0
 <
 
 There is no support for Windows and Mac OS X. See |r-plugin-SyncTeX-win| and
@@ -2748,13 +2739,15 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details.
 							       *r-plugin-news*
 10. News~
 
-1.0.1 (2014-10-24)
+1.0.1 (2014-10-25)
 
  * Minor bug fixes.
 
  * The option vimrplugin_assign now accepts the values 0, 1 and 2.
 
- * SyncTeX support (Evince, Okular and Zathura)
+ * SyncTeX support (Evince, Okular and Zathura):
+   - New options: vimrplugin_synctex and vimrplugin_pdfviewer.
+   - Deprecated option: vimrplugin_openpdf_quietly
 
 1.0 (2014-07-02)
 
diff --git a/ftplugin/rmd_rplugin.vim b/ftplugin/rmd_rplugin.vim
index f62c940..cba4054 100644
--- a/ftplugin/rmd_rplugin.vim
+++ b/ftplugin/rmd_rplugin.vim
@@ -88,7 +88,7 @@ function! RMakeRmd(t)
     if g:vimrplugin_openhtml && a:t == "html"
         let rcmd = rcmd . '; browseURL("' . expand("%:r:t") . '.html")'
     elseif g:vimrplugin_openpdf && (a:t == "pdf" || a:t == "beamer")
-        let rcmd = rcmd . '; vim.openpdf("' . expand("%r:t") . '.pdf")'
+        call ROpenPDF(expand("%r:t") . '.pdf')
     elseif a:t == "odt"
         if g:rplugin_has_soffice == 0
             if has("win32") || has("win64")
@@ -164,6 +164,8 @@ endif
 let g:rplugin_has_pandoc = 0
 let g:rplugin_has_soffice = 0
 
+call RSetPDFViewer()
+
 call RSourceOtherScripts()
 
 
diff --git a/ftplugin/rnoweb_rplugin.vim b/ftplugin/rnoweb_rplugin.vim
index 8450df5..df08b94 100644
--- a/ftplugin/rnoweb_rplugin.vim
+++ b/ftplugin/rnoweb_rplugin.vim
@@ -77,7 +77,7 @@ endfunction
 " knit the current buffer content
 function! RKnitRnw()
     update
-    if g:vimrplugin_synctex == "none"
+    if g:vimrplugin_synctex == 0
         call g:SendCmdToR('vim.interlace.rnoweb("' . expand("%:t") . '", rnwdir = "' . expand("%:p:h") . '", buildpdf = FALSE, synctex = FALSE)')
     else
         call g:SendCmdToR('vim.interlace.rnoweb("' . expand("%:t") . '", rnwdir = "' . expand("%:p:h") . '", buildpdf = FALSE)')
@@ -111,7 +111,7 @@ function! RMakePDF(bibtex, knit)
         let pdfcmd = pdfcmd . ", latexcmd = '" . g:vimrplugin_latexcmd . "'"
     endif
 
-    if g:vimrplugin_synctex == "none"
+    if g:vimrplugin_synctex == 0
         let pdfcmd = pdfcmd . ", synctex = FALSE"
     endif
 
@@ -135,10 +135,6 @@ function! RMakePDF(bibtex, knit)
         endif
     endif
 
-    if g:vimrplugin_openpdf_quietly
-        let pdfcmd = pdfcmd . ", pdfquiet = TRUE"
-    endif
-
     if a:knit == 0 && exists("g:vimrplugin_sweaveargs")
         let pdfcmd = pdfcmd . ", " . g:vimrplugin_sweaveargs
     endif
@@ -175,59 +171,12 @@ function! RSweave()
     if exists("g:vimrplugin_sweaveargs")
         let scmd .= ', ' . g:vimrplugin_sweaveargs
     endif
-    if g:vimrplugin_synctex == "none"
+    if g:vimrplugin_synctex == 0
         let scmd .= ", synctex = FALSE"
     endif
     call g:SendCmdToR(scmd . ')')
 endfunction
 
-function! ROpenPDF()
-    if has("win32") || has("win64")
-        exe 'Py OpenPDF("' . expand("%:t:r") . '.pdf")'
-        return
-    endif
-
-    if !exists("g:rplugin_pdfviewer")
-        let g:rplugin_pdfviewer = "none"
-        if has("gui_macvim") || has("gui_mac") || has("mac") || has("macunix")
-            if $R_PDFVIEWER == ""
-                let pdfvl = ["open"]
-            else
-                let pdfvl = [$R_PDFVIEWER, "open"]
-            endif
-        else
-            if $R_PDFVIEWER == ""
-                let pdfvl = ["xdg-open"]
-            else
-                let pdfvl = [$R_PDFVIEWER, "xdg-open"]
-            endif
-        endif
-        " List from R configure script:
-        let pdfvl += ["evince", "okular", "xpdf", "gv", "gnome-gv", "ggv", "kpdf", "gpdf", "kghostview,", "acroread", "acroread4"]
-        for prog in pdfvl
-            if executable(prog)
-                let g:rplugin_pdfviewer = prog
-                break
-            endif
-        endfor
-    endif
-
-    if g:rplugin_pdfviewer == "none"
-        if g:vimrplugin_openpdf_quietly
-            call g:SendCmdToR('vim.openpdf("' . expand("%:p:r") . ".pdf" . '", TRUE)')
-        else
-            call g:SendCmdToR('vim.openpdf("' . expand("%:p:r") . ".pdf" . '")')
-        endif
-    else
-        let openlog = system(g:rplugin_pdfviewer . " '" . expand("%:p:r") . ".pdf" . "'")
-        if v:shell_error
-            let rlog = substitute(openlog, "\n", " ", "g")
-            let rlog = substitute(openlog, "\r", " ", "g")
-            call RWarningMsg(openlog)
-        endif
-    endif
-endfunction
-
 if g:vimrplugin_rnowebchunk == 1
     " Write code chunk in rnoweb files
     imap  < :call RWriteChunk()a
@@ -263,7 +212,7 @@ call RCreateMaps("nvi", 'RBibTeX',      'sb', ':call RMakePDF("bibtex", 0)
 call RCreateMaps("nvi", 'RKnit',        'kn', ':call RKnitRnw()')
 call RCreateMaps("nvi", 'RMakePDFK',    'kp', ':call RMakePDF("nobib", 1)')
 call RCreateMaps("nvi", 'RBibTeXK',     'kb', ':call RMakePDF("bibtex", 1)')
-call RCreateMaps("nvi", 'ROpenPDF',     'op', ':call ROpenPDF()')
+call RCreateMaps("nvi", 'ROpenPDF',     'op', ':call ROpenPDF("Get Master")')
 call RCreateMaps("nvi", 'RIndent',      'si', ':call RnwToggleIndentSty()')
 call RCreateMaps("ni",  'RSendChunk',   'cc', ':call b:SendChunkToR("silent", "stay")')
 call RCreateMaps("ni",  'RESendChunk',  'ce', ':call b:SendChunkToR("echo", "stay")')
@@ -354,6 +303,7 @@ function! SyncTeX_readconc(basenm)
 endfunction
 
 function! SyncTeX_backward(fname, ln)
+    let g:last_backward = [a:fname, a:ln]
     let flnm = substitute(a:fname, 'file://', '', '') " Evince
     let flnm = substitute(flnm, '/\./', '/', '')      " Okular
     let basenm = substitute(flnm, "\....$", "", "")   " Delete extension
@@ -491,32 +441,30 @@ function! SyncTeX_forward()
         let basedir = ''
     endif
 
-    if g:vimrplugin_synctex == "okular"
+    if g:rplugin_pdfviewer == "okular"
         call system("okular --unique " . basenm . ".pdf#src:" . texln . expand("%:p:h") . "/./" . basenm . ".tex 2> /dev/null >/dev/null &")
-    elseif g:vimrplugin_synctex == "evince"
+    elseif g:rplugin_pdfviewer == "evince"
         call system("python " . g:rplugin_home . "/r-plugin/synctex_evince_forward.py " . basenm . ".pdf " . texln . " '" . basenm . ".tex' 2> /dev/null >/dev/null &")
         if g:rplugin_has_wmctrl
             call system("wmctrl -a '" . basenm . ".pdf'")
         endif
-    elseif g:vimrplugin_synctex == "zathura"
-        if g:rplugin_zathura_pid[basenm] == 0
-            exe "Py Start_Zathura('" . basenm . "', '" . v:servername . "')"
-        elseif g:rplugin_zathura_pid[basenm]
+    elseif g:rplugin_pdfviewer == "zathura"
+        if system("wmctrl -xl") =~ 'Zathura.*' . basenm . '.pdf' && g:rplugin_zathura_pid[basenm] != 0
             let result = system("zathura --synctex-forward=" . texln . ":1:" . basenm . ".tex --synctex-pid=" . g:rplugin_zathura_pid[basenm] . " " . basenm . ".pdf")
             if v:shell_error
-                " Maybe Zathura was closed.
                 let g:rplugin_zathura_pid[basenm] = 0
-                exe "Py Start_Zathura('" . basenm . "', '" . v:servername . "')"
-            endif
-            if g:rplugin_has_wmctrl
-                call system("wmctrl -a '" . basenm . ".pdf'")
+                call RWarningMsg(result)
             endif
+        else
+            let g:rplugin_zathura_pid[basenm] = 0
+            exe "Py Start_Zathura('" . basenm . "', '" . v:servername . "')"
         endif
-    elseif g:vimrplugin_synctex = "skim"
+        call system("wmctrl -a '" . basenm . ".pdf'")
+    elseif g:rplugin_pdfviewer == "skim"
         " This command is based on Skim wiki (not tested)
         call system("/Applications/Skim.app/Contents/SharedSupport/displayline " . texln . " '" . basenm . ".pdf' 2> /dev/null >/dev/null &")
     else
-        call RWarningMsg('SyncTeX support for "' . g:vimrplugin_synctex . '" not implemented yet.')
+        call RWarningMsg('SyncTeX support for "' . g:rplugin_pdfviewer . '" not implemented.')
     endif
     if basedir != ''
         cd -
@@ -528,16 +476,12 @@ function! SyncTeX_SetPID(spid)
 endfunction
 
 function! Run_SyncTeX()
-    if $DISPLAY == "" || g:vimrplugin_synctex == "none" || exists("b:did_synctex")
+    if $DISPLAY == "" || g:rplugin_pdfviewer == "none" || exists("b:did_synctex")
         return
     endif
     let b:did_synctex = 1
 
-    if executable("wmctrl")
-        let g:rplugin_has_wmctrl = 1
-    endif
-
-    if g:vimrplugin_synctex == "evince"
+    if g:rplugin_pdfviewer == "evince"
         let [basenm, basedir] = SyncTeX_GetMaster()
         if basedir != '.'
             exe "cd " . basedir
@@ -553,7 +497,7 @@ function! Run_SyncTeX()
         if basedir != '.'
             cd -
         endif
-    elseif g:vimrplugin_synctex == "okular" && has("nvim") && !exists("g:rplugin_okular_search")
+    elseif g:rplugin_pdfviewer == "okular" && has("nvim") && !exists("g:rplugin_okular_search")
         let g:rplugin_okular_search = 1
         call writefile([], $VIMRPLUGIN_TMPDIR . "/okular_search")
         let g:rplugin_stx_job = jobstart("synctex", "tail", ["-f", $VIMRPLUGIN_TMPDIR . "/okular_search"])
@@ -565,7 +509,7 @@ endfunction
 function! Handle_SyncTeX_backward()
     if v:job_data[1] == 'stdout'
         let fname = substitute(v:job_data[2], '|.*', '', '') 
-        if g:vimrplugin_synctex == "okular"
+        if g:rplugin_pdfviewer == "okular"
             let fname = substitute(fname, '/\./', '/', '')
         endif
         let ln = substitute(v:job_data[2], '.*|\([0-9]*\).*', '\1', '')
@@ -577,12 +521,13 @@ function! Handle_SyncTeX_backward()
     endif
 endfunction
 
-if !exists("g:rplugin_zathura_pid")
-    let g:rplugin_zathura_pid = {}
-endif
+let g:rplugin_zathura_pid = {}
 let g:rplugin_zathura_pid[expand("%:r")] = 0
 
-call Run_SyncTeX()
+call RSetPDFViewer()
+if g:rplugin_pdfviewer != "none"
+    call Run_SyncTeX()
+endif
 
 call RSourceOtherScripts()
 
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 9ab16f3..70928c0 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -925,8 +925,8 @@ function ReceiveVimComStartMsg(msg)
         if vmsg[0] != "vimcom"
             call RWarningMsg("Invalid package name: " . vmsg[0])
         endif
-        if vmsg[1] != "1.0-2"
-            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.0-2.')
+        if vmsg[1] != "1.0-3"
+            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.0-3.')
         endif
         if vmsg[2] != $VIMINSTANCEID
             call RWarningMsg("Invalid ID: " . vmsg[2] . " [Correct = " . $VIMINSTANCEID . "]")
@@ -984,8 +984,8 @@ function WaitVimComStart()
         let vr = readfile($VIMRPLUGIN_TMPDIR . "/vimcom_running")
         if vr[2] == $VIMINSTANCEID
             let g:rplugin_vimcom_version = vr[1]
-            if g:rplugin_vimcom_version != "1.0-2"
-                call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.0-2.')
+            if g:rplugin_vimcom_version != "1.0-3"
+                call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.0-3.')
                 sleep 1
             endif
         else
@@ -2455,6 +2455,102 @@ function ShowRDoc(rkeyword, package, getclass)
     redraw
 endfunction
 
+function RSetPDFViewer()
+    if exists("g:vimrplugin_pdfviewer") && g:vimrplugin_pdfviewer != "none"
+        let g:rplugin_pdfviewer = tolower(g:vimrplugin_pdfviewer)
+    else
+        " Try to guess what PDF viewer is used:
+        if executable("evince")
+            let g:rplugin_pdfviewer = "evince"
+        elseif executable("okular")
+            let g:rplugin_pdfviewer = "okular"
+        else
+            let g:rplugin_pdfviewer = "none"
+            if has("gui_macvim") || has("gui_mac") || has("mac") || has("macunix")
+                if $R_PDFVIEWER == ""
+                    let pdfvl = ["open"]
+                else
+                    let pdfvl = [$R_PDFVIEWER, "open"]
+                endif
+            else
+                if $R_PDFVIEWER == ""
+                    let pdfvl = ["xdg-open"]
+                else
+                    let pdfvl = [$R_PDFVIEWER, "xdg-open"]
+                endif
+            endif
+            " List from R configure script:
+            let pdfvl += ["evince", "okular", "zathura", "xpdf", "gv", "gnome-gv", "ggv", "kpdf", "gpdf", "kghostview,", "acroread", "acroread4"]
+            for prog in pdfvl
+                if executable(prog)
+                    let g:rplugin_pdfviewer = prog
+                    break
+                endif
+            endfor
+        endif
+    endif
+
+    if executable("wmctrl")
+        let g:rplugin_has_wmctrl = 1
+    else
+        let g:rplugin_has_wmctrl = 0
+    endif
+
+    if g:rplugin_pdfviewer == "zathura" && g:rplugin_has_wmctrl == 0
+        let g:rplugin_pdfviewer = "none"
+        call RWarningMsgInp("The application wmctrl must be installed to use Zathura as PDF viewer.")
+    endif
+
+    " Try to guess the title of the window where Vim is running:
+    if has("gui_running")
+        call RSetDefaultValue("g:vimrplugin_vim_window", "'GVim'")
+    elseif g:rplugin_pdfviewer == "evince"
+        call RSetDefaultValue("g:vimrplugin_vim_window", "'Terminal'")
+    elseif g:rplugin_pdfviewer == "okular"
+        call RSetDefaultValue("g:vimrplugin_vim_window", "'Konsole'")
+    else
+        call RSetDefaultValue("g:vimrplugin_vim_window", "'term'")
+    endif
+
+endfunction
+
+function ROpenPDF(path)
+    if a:path == "Get Master"
+        let tmpvar = SyncTeX_GetMaster()
+        let pdfpath = tmpvar[1] . '/' . tmpvar[0] . '.pdf'
+    else
+        let pdfpath = a:path
+    endif
+    let basenm = substitute(substitute(pdfpath, '.*/', '', ''), '\.pdf$', '', '')
+
+    if has("win32") || has("win64")
+        exe 'Py OpenPDF("' . pdfpath . '")'
+        return
+    endif
+
+    if g:rplugin_pdfviewer == "none"
+        call RWarningMsg("Could not find a PDF viewer, and vimrplugin_pdfviewer is not defined.")
+    else
+        if g:rplugin_pdfviewer == "okular"
+            let pcmd = "okular --unique '" .  pdfpath . "' 2>/dev/null >/dev/null &"
+        elseif g:rplugin_pdfviewer == "zathura"
+            if system("wmctrl -xl") =~ 'Zathura.*' . basenm . '.pdf' && g:rplugin_zathura_pid[basenm] != 0
+                call system("wmctrl -a '" . basenm . ".pdf'")
+            else
+                let g:rplugin_zathura_pid[basenm] = 0
+                exe "Py Start_Zathura('" . basenm . "', '" . v:servername . "')"
+            endif
+            return
+        else
+            let pcmd = g:rplugin_pdfviewer . " '" . pdfpath . "' 2>/dev/null >/dev/null &"
+        endif
+        call system(pcmd)
+        if g:rplugin_has_wmctrl
+            call system("wmctrl -a '" . basenm . ".pdf'")
+        endif
+    endif
+endfunction
+
 
 function RLisObjs(arglead, cmdline, curpos)
     let lob = []
@@ -2900,9 +2996,9 @@ function MakeRMenu()
             call RCreateMenuItem("nvi", 'Command.Knit\ and\ ODT\ (cur\ file)', 'RMakeODT', 'ko', ':call RMakeHTMLrrst("odt")')
         endif
         menu R.Command.-Sep61- 
-        call RCreateMenuItem("nvi", 'Command.Open\ PDF\ (cur\ file)', 'ROpenPDF', 'op', ':call ROpenPDF()')
-        if ($DISPLAY != "" && g:vimrplugin_synctex != "none" && &filetype == "rnoweb") || g:vimrplugin_never_unmake_menu
-            call RCreateMenuItem("nvi", 'Command.Search\ forward\ (SyncTeX)', 'RSyncFor', 'gp', ':call ROpenPDF()')
+        call RCreateMenuItem("nvi", 'Command.Open\ PDF\ (cur\ file)', 'ROpenPDF', 'op', ':call ROpenPDF("Get Master")')
+        if ($DISPLAY != "" && g:vimrplugin_synctex && &filetype == "rnoweb") || g:vimrplugin_never_unmake_menu
+            call RCreateMenuItem("nvi", 'Command.Search\ forward\ (SyncTeX)', 'RSyncFor', 'gp', ':call ROpenPDF("Get Master")')
         endif
     endif
     "-------------------------------
@@ -3356,6 +3452,11 @@ if exists("g:vimrplugin_underscore")
     call RWarningMsgInp("The option vimrplugin_underscore is deprecated. Use vimrplugin_assign instead.")
 endif
 
+if exists("g:vimrplugin_openpdf_quietly")
+    " 25/oct/2014
+    call RWarningMsgInp("The option vimrplugin_openpdf_quietly is deprecated.")
+endif
+
 " Variables whose default value is fixed
 call RSetDefaultValue("g:vimrplugin_map_r",             0)
 call RSetDefaultValue("g:vimrplugin_allnames",          0)
@@ -3365,7 +3466,7 @@ call RSetDefaultValue("g:vimrplugin_assign_map",    "'_'")
 call RSetDefaultValue("g:vimrplugin_rnowebchunk",       1)
 call RSetDefaultValue("g:vimrplugin_strict_rst",        1)
 call RSetDefaultValue("g:vimrplugin_openpdf",           0)
-call RSetDefaultValue("g:vimrplugin_openpdf_quietly",   0)
+call RSetDefaultValue("g:vimrplugin_synctex",           1)
 call RSetDefaultValue("g:vimrplugin_openhtml",          0)
 call RSetDefaultValue("g:vimrplugin_i386",              0)
 call RSetDefaultValue("g:vimrplugin_Rterm",             0)
@@ -3401,27 +3502,6 @@ call RSetDefaultValue("g:vimrplugin_permanent_libs",  "'base,stats,graphics,grDe
 call RSetDefaultValue("g:vimrplugin_user_maps_only", 0)
 call RSetDefaultValue("g:vimrplugin_latexcmd", "'default'")
 
-" Try to guess what PDF viewer is used:
-if executable("evince")
-    call RSetDefaultValue("g:vimrplugin_synctex", "'evince'")
-elseif executable("okular")
-    call RSetDefaultValue("g:vimrplugin_synctex", "'okular'")
-else
-    call RSetDefaultValue("g:vimrplugin_synctex", "'none'")
-endif
-let g:vimrplugin_synctex = tolower(g:vimrplugin_synctex)
-
-" Try to guess the title of the window where Vim is running:
-if has("gui_running")
-    call RSetDefaultValue("g:vimrplugin_vim_window", "'GVim'")
-elseif g:vimrplugin_synctex == "evince"
-    call RSetDefaultValue("g:vimrplugin_vim_window", "'Terminal'")
-elseif g:vimrplugin_synctex == "okular"
-    call RSetDefaultValue("g:vimrplugin_vim_window", "'Konsole'")
-else
-    call RSetDefaultValue("g:vimrplugin_vim_window", "'term'")
-endif
-
 " Look for invalid options
 let objbrplace = split(g:vimrplugin_objbr_place, ",")
 let obpllen = len(objbrplace) - 1
@@ -3614,6 +3694,8 @@ endif
 
 if executable("latexmk")
     let g:rplugin_has_latexmk = 1
+else
+    let g:rplugin_has_latexmk = 0
 endif
 
 " Start with an empty list of objects in the workspace
diff --git a/r-plugin/nvimcom.py b/r-plugin/nvimcom.py
index 5c9158c..fd05121 100644
--- a/r-plugin/nvimcom.py
+++ b/r-plugin/nvimcom.py
@@ -61,8 +61,8 @@ def DiscoverVimComPort():
         print "let g:rplugin_vimcomport = " + str(VimComPort) + "\n"
         sys.stdout.flush()
         PortWarn = False
-        if repl.find("1.0-2") != 0:
-            print "call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.0-2.')\n"
+        if repl.find("1.0-3") != 0:
+            print "call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.0-3.')\n"
             sys.stdout.flush()
         return
 
diff --git a/r-plugin/vimcom.py b/r-plugin/vimcom.py
index d8cf1e9..a6217fe 100644
--- a/r-plugin/vimcom.py
+++ b/r-plugin/vimcom.py
@@ -59,8 +59,8 @@ def DiscoverVimComPort():
     else:
         vim.command("let g:rplugin_vimcomport = " + str(VimComPort))
         PortWarn = 0
-        if repl.find("1.0-2") != 0:
-            vim.command("call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.0-2.')")
+        if repl.find("1.0-3") != 0:
+            vim.command("call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.0-3.')")
             vim.command("sleep 1")
     return(VimComPort)
 
@@ -104,7 +104,6 @@ def Start_Zathura(basenm, sname):
     a1 = '--synctex-editor-command'
     a2 = 'vim --servername ' + sname + " --remote-expr SyncTeX_backward(\\'%{input}\\',%{line})"
     a3 = basenm + ".pdf"
-    #zpid = os.spawnlp(os.P_NOWAIT, "zathura", "zathura", a1, a2, a3)
     FNULL = open(os.devnull, 'w')
     zpid = subprocess.Popen(["zathura", a1, a2, a3], stdout = FNULL, stderr = FNULL).pid
     vim.command("let g:rplugin_zathura_pid['" + basenm + "'] = " + str(zpid))

From 68fd7f4b72a66ea8486f5d58d31ad356a787eb4c Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sat, 25 Oct 2014 20:21:25 -0400
Subject: [PATCH 0790/1050] Warn of possible reasons for problems in SyncTeX.

---
 ftplugin/rnoweb_rplugin.vim | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/ftplugin/rnoweb_rplugin.vim b/ftplugin/rnoweb_rplugin.vim
index df08b94..a9a625c 100644
--- a/ftplugin/rnoweb_rplugin.vim
+++ b/ftplugin/rnoweb_rplugin.vim
@@ -441,6 +441,18 @@ function! SyncTeX_forward()
         let basedir = ''
     endif
 
+    if !filereadable(basenm . ".pdf")
+        call RWarningMsg('SyncTeX forward cannot be done because the file "' . basenm . '.pdf" is missing.')
+        return
+    endif
+    if !filereadable(basenm . ".synctex.gz")
+        call RWarningMsg('SyncTeX forward cannot be done because the file "' . basenm . '.synctex.gz" is missing.')
+        if g:vimrplugin_latexcmd != "default" && g:vimrplugin_latexcmd !~ "synctex"
+            call RWarningMsg('Note: The string "-synctex=1" is not in your vimrplugin_latexcmd. Please check your vimrc.')
+        endif
+        return
+    endif
+
     if g:rplugin_pdfviewer == "okular"
         call system("okular --unique " . basenm . ".pdf#src:" . texln . expand("%:p:h") . "/./" . basenm . ".tex 2> /dev/null >/dev/null &")
     elseif g:rplugin_pdfviewer == "evince"

From e8ec637aed8d43b9049f281c008243114d74d6c6 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sun, 26 Oct 2014 20:15:37 -0400
Subject: [PATCH 0791/1050] Add r-plugin/rmd.snippets to list_for_vimball.

---
 list_for_vimball | 1 +
 1 file changed, 1 insertion(+)

diff --git a/list_for_vimball b/list_for_vimball
index eb695b6..eefe7da 100644
--- a/list_for_vimball
+++ b/list_for_vimball
@@ -23,6 +23,7 @@ r-plugin/common_global.vim
 r-plugin/global_r_plugin.vim
 r-plugin/objlist/README
 r-plugin/r.snippets
+r-plugin/rmd.snippets
 r-plugin/nvimcom.py
 r-plugin/nvimserver.py
 r-plugin/timer.sh

From 958295b3773b1d3ccfcf44ff81c1852b66b38d25 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sun, 26 Oct 2014 20:26:23 -0400
Subject: [PATCH 0792/1050] Improve SyncTeX support for Zathura.

---
 doc/r-plugin.txt                    | 22 ++++++++++--------
 ftplugin/rnoweb_rplugin.vim         | 36 +++++++++++++++++++++--------
 r-plugin/common_global.vim          | 25 +++++++++++++++++++-
 r-plugin/synctex_okular_backward.sh |  2 +-
 4 files changed, 64 insertions(+), 21 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 408281b..1180075 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -867,6 +867,12 @@ support in Tmux. You will be able to toggle mouse support on and off by typing
 Note: Neovim does not require the --servername VIM argument. Thus, you also do
 not need to enable the X11 Forwarding for omnicompletion, etc.
 
+You can not send commands from a local Vim to an remote R, but you can access
+the remote machine through ssh and run Tmux, Vim and R in the remote machine.
+Tmux should not be running in the local machine because some environment
+variables could pass from the local to the remote Tmux and make the plugin
+confuse.
+
 If you need to access Vim in a remote Unix machine through ssh, and if you
 want to get omnicompletion, syntax highlight of function names and the Object
 Browser working properly, then you have to:
@@ -1846,16 +1852,12 @@ requires additional steps because Neovim does not have the argument
 >
      chmod +x synctex_okular_backward.sh
 <
-   - Edit the file synctex_okular_backward.sh and replace the string
-     "yourlogin" with your actual login name. Adjust the directory used by the
-     Vim-R-plugin as temporary directory if necessary.
-
    - In Okular, put the following in the Custom Editor Command field:
 >
      synctex_okular_backward.sh '%f' %l
 <
 
-6.32.1 Zathura configuration~
+6.32.3 Zathura configuration~
 
 Zathura (version >= 0.3.1) is also supported. If the terminal emulator is not
 raised during backward search (from PDF to Vim), you have to set the value of
@@ -1866,14 +1868,14 @@ for the first time, it will start, but will not jump to desired line; you have
 to press gp again.
 
 
-6.32.3 Configuring the PDF editor and Vim's window title~
+6.32.4 Configuring the PDF editor and Vim's window title~
 							  *vimrplugin_synctex*
-							*vimrplugin_pdfviewer*
 						       *vimrplugin_vim_window*
 If SyncTeX does not work (see above), you may try to set in your |vimrc| the
-values of vimrplugin_pdfviewer and vimrplugin_vim_window.
+values of |vimrplugin_pdfviewer| and vimrplugin_vim_window.
 
-The valid values for vimrplugin_pdfviewer are "evince" and "okular".
+The valid values for |vimrplugin_pdfviewer| are "evince", "okular" and
+"zathura".
 
 To know the correct value of vimrplugin_vim_window, type in the terminal
 emulator:
@@ -2739,7 +2741,7 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details.
 							       *r-plugin-news*
 10. News~
 
-1.0.1 (2014-10-25)
+1.0.1 (2014-10-26)
 
  * Minor bug fixes.
 
diff --git a/ftplugin/rnoweb_rplugin.vim b/ftplugin/rnoweb_rplugin.vim
index a9a625c..3ace59f 100644
--- a/ftplugin/rnoweb_rplugin.vim
+++ b/ftplugin/rnoweb_rplugin.vim
@@ -469,7 +469,11 @@ function! SyncTeX_forward()
             endif
         else
             let g:rplugin_zathura_pid[basenm] = 0
-            exe "Py Start_Zathura('" . basenm . "', '" . v:servername . "')"
+            if has("nvim")
+                call RStart_Zathura(basenm)
+            else
+                exe "Py Start_Zathura('" . basenm . "', '" . v:servername . "')"
+            endif
         endif
         call system("wmctrl -a '" . basenm . ".pdf'")
     elseif g:rplugin_pdfviewer == "skim"
@@ -509,12 +513,12 @@ function! Run_SyncTeX()
         if basedir != '.'
             cd -
         endif
-    elseif g:rplugin_pdfviewer == "okular" && has("nvim") && !exists("g:rplugin_okular_search")
-        let g:rplugin_okular_search = 1
-        call writefile([], $VIMRPLUGIN_TMPDIR . "/okular_search")
-        let g:rplugin_stx_job = jobstart("synctex", "tail", ["-f", $VIMRPLUGIN_TMPDIR . "/okular_search"])
+    elseif has("nvim") && (g:rplugin_pdfviewer == "okular" || g:rplugin_pdfviewer == "zathura") && !exists("g:rplugin_tail_follow")
+        let g:rplugin_tail_follow = 1
+        call writefile([], $VIMRPLUGIN_TMPDIR . "/" . g:rplugin_pdfviewer . "_search")
+        let g:rplugin_stx_job = jobstart("synctex", "tail", ["-f", $VIMRPLUGIN_TMPDIR . "/" . g:rplugin_pdfviewer . "_search"])
         autocmd JobActivity synctex call Handle_SyncTeX_backward()
-        autocmd VimLeave * call delete($VIMRPLUGIN_TMPDIR . "/okular_search")
+        autocmd VimLeave * call delete($VIMRPLUGIN_TMPDIR . "/" . g:rplugin_pdfviewer . "_search") | call delete($VIMRPLUGIN_TMPDIR . "/synctex_back.sh")
     endif
 endfunction
 
@@ -533,11 +537,25 @@ function! Handle_SyncTeX_backward()
     endif
 endfunction
 
-let g:rplugin_zathura_pid = {}
-let g:rplugin_zathura_pid[expand("%:r")] = 0
-
 call RSetPDFViewer()
 if g:rplugin_pdfviewer != "none"
+    if g:rplugin_pdfviewer == "zathura"
+        let s:this_master = SyncTeX_GetMaster()[0]
+        let s:key_list = keys(g:rplugin_zathura_pid)
+        let s:has_key = 0
+        for kk in s:key_list
+            if kk == s:this_master
+                let s:has_key = 1
+                break
+            endif
+        endfor
+        if s:has_key == 0
+            let g:rplugin_zathura_pid[s:this_master] = 0
+        endif
+        unlet s:this_master
+        unlet s:key_list
+        unlet s:has_key
+    endif
     call Run_SyncTeX()
 endif
 
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 70928c0..2b88195 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -2514,6 +2514,24 @@ function RSetPDFViewer()
 
 endfunction
 
+function RStart_Zathura(basenm)
+    let shcode = ['#!/bin/sh', 'echo "$1|$2" >> "' . $VIMRPLUGIN_TMPDIR . '/zathura_search"']
+    call writefile(shcode, $VIMRPLUGIN_TMPDIR . "/synctex_back.sh")
+    let pycode = ["import subprocess",
+                \ "import os",
+                \ "FNULL = open(os.devnull, 'w')",
+                \ "a1 = '--synctex-editor-command'",
+                \ "a2 = 'sh " . $VIMRPLUGIN_TMPDIR . "/synctex_back.sh %{input} %{line}'",
+                \ "a3 = '" . a:basenm . ".pdf'",
+                \ "zpid = subprocess.Popen(['zathura', a1, a2, a3], stdout = FNULL, stderr = FNULL).pid",
+                \ "print str(zpid)" ]
+    call writefile(pycode, $VIMRPLUGIN_TMPDIR . "/start_zathura.py")
+    let pid = system("python '" . $VIMRPLUGIN_TMPDIR . "/start_zathura.py" . "'")
+    let pid = substitute(pid, '\n', '', '')
+    let g:rplugin_zathura_pid[a:basenm] = pid
+    call delete($VIMRPLUGIN_TMPDIR . "/start_zathura.py")
+endfunction
+
 function ROpenPDF(path)
     if a:path == "Get Master"
         let tmpvar = SyncTeX_GetMaster()
@@ -2538,7 +2556,11 @@ function ROpenPDF(path)
                 call system("wmctrl -a '" . basenm . ".pdf'")
             else
                 let g:rplugin_zathura_pid[basenm] = 0
-                exe "Py Start_Zathura('" . basenm . "', '" . v:servername . "')"
+                if has("nvim")
+                    call RStart_Zathura(basenm)
+                else
+                    exe "Py Start_Zathura('" . basenm . "', '" . v:servername . "')"
+                endif
             endif
             return
         else
@@ -3945,6 +3967,7 @@ let g:rplugin_tmuxsname = "VimR-" . substitute(localtime(), '.*\(...\)', '\1', '
 let g:rplugin_has_wmctrl = 0
 let g:rplugin_synctexpid = 0
 let g:rplugin_stx_job = 0
+let g:rplugin_zathura_pid = {}
 
 
 " If this is the Object Browser running in a Tmux pane, $VIMINSTANCEID is
diff --git a/r-plugin/synctex_okular_backward.sh b/r-plugin/synctex_okular_backward.sh
index 9a98b48..0b83714 100644
--- a/r-plugin/synctex_okular_backward.sh
+++ b/r-plugin/synctex_okular_backward.sh
@@ -2,5 +2,5 @@
 
 # This script is required to do backward search from Okular to Neovim
 
-echo "$1|$2" >> /tmp/r-plugin-yourlogin/okular_search
+echo "$1|$2" >> "$VIMRPLUGIN_TMPDIR/okular_search"
 

From 0d0f324f639b7f4c8e6b8e9f3be9e20cae9ac7d3 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Mon, 27 Oct 2014 10:33:52 -0400
Subject: [PATCH 0793/1050] Make SyncTeX work when 'noautochdir'.

---
 ftplugin/rnoweb_rplugin.vim | 24 +++++++++++++++++++-----
 r-plugin/common_global.vim  | 16 ++++++++++++----
 r-plugin/nvimcom.py         |  4 ++--
 r-plugin/vimcom.py          |  4 ++--
 4 files changed, 35 insertions(+), 13 deletions(-)

diff --git a/ftplugin/rnoweb_rplugin.vim b/ftplugin/rnoweb_rplugin.vim
index 3ace59f..b9f85f4 100644
--- a/ftplugin/rnoweb_rplugin.vim
+++ b/ftplugin/rnoweb_rplugin.vim
@@ -303,7 +303,6 @@ function! SyncTeX_readconc(basenm)
 endfunction
 
 function! SyncTeX_backward(fname, ln)
-    let g:last_backward = [a:fname, a:ln]
     let flnm = substitute(a:fname, 'file://', '', '') " Evince
     let flnm = substitute(flnm, '/\./', '/', '')      " Okular
     let basenm = substitute(flnm, "\....$", "", "")   " Delete extension
@@ -379,7 +378,12 @@ function! SyncTeX_forward()
     endif
     let basenm = expand("%:t:r")
     let lnum = 0
-    let rnwf = bufname("%")
+    let rnwf = expand("%:t")
+
+    let olddir = getcwd()
+    if olddir != expand("%:p:h")
+        exe "cd " . expand("%:p:h")
+    endif
 
     if filereadable(basenm . "-concordance.tex")
         let lnum = line(".")
@@ -405,14 +409,17 @@ function! SyncTeX_forward()
                 endfor
                 if lnum == 0
                     call RWarningMsg('Could not find "child=' . bufname("%") . '" in ' . mfile . '.')
+                    exe "cd " . olddir
                     return
                 endif
             else
                 call RWarningMsg('Vim-R-plugin [SyncTeX]: "' . basenm . '-concordance.tex" not found.')
+                exe "cd " . olddir
                 return
             endif
         else
             call RWarningMsg('SyncTeX [Vim-R-plugin]: "' . basenm . '-concordance.tex" not found.')
+            exe "cd " . olddir
             return
         endif
     endif
@@ -431,6 +438,7 @@ function! SyncTeX_forward()
 
     if texln == 0
         call RWarningMsg("Error: did not find LaTeX line.")
+        exe "cd " . olddir
         return
     endif
     if basenm =~ '/'
@@ -443,6 +451,7 @@ function! SyncTeX_forward()
 
     if !filereadable(basenm . ".pdf")
         call RWarningMsg('SyncTeX forward cannot be done because the file "' . basenm . '.pdf" is missing.')
+        exe "cd " . olddir
         return
     endif
     if !filereadable(basenm . ".synctex.gz")
@@ -450,6 +459,7 @@ function! SyncTeX_forward()
         if g:vimrplugin_latexcmd != "default" && g:vimrplugin_latexcmd !~ "synctex"
             call RWarningMsg('Note: The string "-synctex=1" is not in your vimrplugin_latexcmd. Please check your vimrc.')
         endif
+        exe "cd " . olddir
         return
     endif
 
@@ -482,9 +492,7 @@ function! SyncTeX_forward()
     else
         call RWarningMsg('SyncTeX support for "' . g:rplugin_pdfviewer . '" not implemented.')
     endif
-    if basedir != ''
-        cd -
-    endif
+    exe "cd " . olddir
 endfunction
 
 function! SyncTeX_SetPID(spid)
@@ -497,6 +505,11 @@ function! Run_SyncTeX()
     endif
     let b:did_synctex = 1
 
+    let olddir = getcwd()
+    if olddir != expand("%:p:h")
+        exe "cd " . expand("%:p:h")
+    endif
+
     if g:rplugin_pdfviewer == "evince"
         let [basenm, basedir] = SyncTeX_GetMaster()
         if basedir != '.'
@@ -520,6 +533,7 @@ function! Run_SyncTeX()
         autocmd JobActivity synctex call Handle_SyncTeX_backward()
         autocmd VimLeave * call delete($VIMRPLUGIN_TMPDIR . "/" . g:rplugin_pdfviewer . "_search") | call delete($VIMRPLUGIN_TMPDIR . "/synctex_back.sh")
     endif
+    exe "cd " . olddir
 endfunction
 
 function! Handle_SyncTeX_backward()
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 2b88195..717d6a5 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -925,8 +925,8 @@ function ReceiveVimComStartMsg(msg)
         if vmsg[0] != "vimcom"
             call RWarningMsg("Invalid package name: " . vmsg[0])
         endif
-        if vmsg[1] != "1.0-3"
-            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.0-3.')
+        if vmsg[1] != "1.0-4"
+            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.0-4.')
         endif
         if vmsg[2] != $VIMINSTANCEID
             call RWarningMsg("Invalid ID: " . vmsg[2] . " [Correct = " . $VIMINSTANCEID . "]")
@@ -984,8 +984,8 @@ function WaitVimComStart()
         let vr = readfile($VIMRPLUGIN_TMPDIR . "/vimcom_running")
         if vr[2] == $VIMINSTANCEID
             let g:rplugin_vimcom_version = vr[1]
-            if g:rplugin_vimcom_version != "1.0-3"
-                call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.0-3.')
+            if g:rplugin_vimcom_version != "1.0-4"
+                call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.0-4.')
                 sleep 1
             endif
         else
@@ -2541,8 +2541,14 @@ function ROpenPDF(path)
     endif
     let basenm = substitute(substitute(pdfpath, '.*/', '', ''), '\.pdf$', '', '')
 
+    let olddir = getcwd()
+    if olddir != expand("%:p:h")
+        exe "cd " . expand("%:p:h")
+    endif
+
     if has("win32") || has("win64")
         exe 'Py OpenPDF("' . pdfpath . '")'
+        exe "cd " . olddir
         return
     endif
 
@@ -2562,6 +2568,7 @@ function ROpenPDF(path)
                     exe "Py Start_Zathura('" . basenm . "', '" . v:servername . "')"
                 endif
             endif
+            exe "cd " . olddir
             return
         else
             let pcmd = g:rplugin_pdfviewer . " '" . pdfpath . "' 2>/dev/null >/dev/null &"
@@ -2571,6 +2578,7 @@ function ROpenPDF(path)
             call system("wmctrl -a '" . basenm . ".pdf'")
         endif
     endif
+    exe "cd " . olddir
 endfunction
 
 
diff --git a/r-plugin/nvimcom.py b/r-plugin/nvimcom.py
index fd05121..ca670de 100644
--- a/r-plugin/nvimcom.py
+++ b/r-plugin/nvimcom.py
@@ -61,8 +61,8 @@ def DiscoverVimComPort():
         print "let g:rplugin_vimcomport = " + str(VimComPort) + "\n"
         sys.stdout.flush()
         PortWarn = False
-        if repl.find("1.0-3") != 0:
-            print "call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.0-3.')\n"
+        if repl.find("1.0-4") != 0:
+            print "call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.0-4.')\n"
             sys.stdout.flush()
         return
 
diff --git a/r-plugin/vimcom.py b/r-plugin/vimcom.py
index a6217fe..9f7e440 100644
--- a/r-plugin/vimcom.py
+++ b/r-plugin/vimcom.py
@@ -59,8 +59,8 @@ def DiscoverVimComPort():
     else:
         vim.command("let g:rplugin_vimcomport = " + str(VimComPort))
         PortWarn = 0
-        if repl.find("1.0-3") != 0:
-            vim.command("call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.0-3.')")
+        if repl.find("1.0-4") != 0:
+            vim.command("call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.0-4.')")
             vim.command("sleep 1")
     return(VimComPort)
 

From 54aaac812ac61e7bb665ff2a4335cdafd09f9f07 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Mon, 27 Oct 2014 21:17:44 -0400
Subject: [PATCH 0794/1050] Suggestion to use knitr option cache.lazy=FALSE.

---
 doc/r-plugin.txt | 28 ++++++++++++++++++----------
 1 file changed, 18 insertions(+), 10 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 1180075..4135ebd 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -867,11 +867,11 @@ support in Tmux. You will be able to toggle mouse support on and off by typing
 Note: Neovim does not require the --servername VIM argument. Thus, you also do
 not need to enable the X11 Forwarding for omnicompletion, etc.
 
-You can not send commands from a local Vim to an remote R, but you can access
-the remote machine through ssh and run Tmux, Vim and R in the remote machine.
-Tmux should not be running in the local machine because some environment
-variables could pass from the local to the remote Tmux and make the plugin
-confuse.
+The Vim-R-plugin can not send commands from a local Vim to a remote R, but
+you can access the remote machine through ssh and run Tmux, Vim and R in the
+remote machine. Tmux should not be running in the local machine because some
+environment variables could pass from the local to the remote Tmux and make
+the plugin confuse.
 
 If you need to access Vim in a remote Unix machine through ssh, and if you
 want to get omnicompletion, syntax highlight of function names and the Object
@@ -984,7 +984,15 @@ The plugin is only capable of recognizing functions defined using the `<-`
 operator. See: https://github.com/jcfaria/Vim-R-plugin/issues/94
 
 
-5.6. Wrong message that "R is busy" (Windows only)~
+5.6. Objects Browser does not support knitr cache=TRUE~
+
+When processing Rnoweb documents with the knitr package, if the chunk option
+`cache` is `TRUE`, the Object Browser will not be able to detect the classes
+of objects because knitr uses R's lazy load feature. The workaround for this
+issue is to define the chunk option `cache.lazy=FALSE`.
+
+
+5.7. Wrong message that "R is busy" (Windows only)~
 
 On Windows, when code is sent from Vim to R Console, the vimcom library
 sets the value of the internal variable `r_is_busy` to 1. The value is set
@@ -998,7 +1006,7 @@ tell Vim that "R is busy" and Vim will display this message. Everything should
 work as expected again after any valid code is executed in the R Console.
 
 
-5.7. SyncTeX support is a Linux only feature~
+5.8. SyncTeX support is a Linux only feature~
 				*r-plugin-SyncTeX-win*  *r-plugin-SyncTeX-mac*
 There is no SyncTeX support for Windows and Mac OS X. Both Sumatra (Windows)
 and Skim (Mac OS X) have support for SyncTeX, but the Vim-R-plugin is not
@@ -1007,7 +1015,7 @@ support anyone of them and submit a push request on github:
 https://github.com/jcfaria/Vim-R-plugin
 
 
-5.8. Bugs that affect Mac OS X, Linux Console and ...~
+5.9. Bugs that affect Mac OS X, Linux Console and ...~
 								*r-plugin-nox*
 Note: The bug described in this section does not affect Neovim.
 
@@ -1069,7 +1077,7 @@ A user reported success with the following procedure:
 See also: |r-plugin-remote|.
 
 
-5.9. R must be started by Vim~
+5.10. R must be started by Vim~
 
 The communication between Vim and R will work only if R was started by Vim
 through the rf command because the plugin was designed to connect
@@ -2748,7 +2756,7 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details.
  * The option vimrplugin_assign now accepts the values 0, 1 and 2.
 
  * SyncTeX support (Evince, Okular and Zathura):
-   - New options: vimrplugin_synctex and vimrplugin_pdfviewer.
+   - New options: vimrplugin_synctex and vimrplugin_vim_window.
    - Deprecated option: vimrplugin_openpdf_quietly
 
 1.0 (2014-07-02)

From fb604e3a7966e9886b097464dce5db662b8b5580 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Wed, 29 Oct 2014 09:50:42 -0400
Subject: [PATCH 0795/1050] Make SyncTeX work with spaces in path.

---
 ftplugin/rnoweb_rplugin.vim | 43 +++++++++++++++++--------------------
 r-plugin/common_global.vim  |  8 +++----
 2 files changed, 24 insertions(+), 27 deletions(-)

diff --git a/ftplugin/rnoweb_rplugin.vim b/ftplugin/rnoweb_rplugin.vim
index b9f85f4..d717e77 100644
--- a/ftplugin/rnoweb_rplugin.vim
+++ b/ftplugin/rnoweb_rplugin.vim
@@ -347,18 +347,18 @@ function! SyncTeX_backward(fname, ln)
         if bufloaded(basedir . '/' . rnwf)
             let savesb = &switchbuf
             set switchbuf=useopen,usetab
-            exe "sb " . basedir . '/' . rnwf
+            exe "sb " . substitute(basedir . '/' . rnwf, ' ', '\\ ', 'g')
             exe "set switchbuf=" . savesb
         elseif bufloaded(rnwf)
             let savesb = &switchbuf
             set switchbuf=useopen,usetab
-            exe "sb " . rnwf
+            exe "sb " . substitute(rnwf, ' ', '\\ ', 'g')
             exe "set switchbuf=" . savesb
         else
             if filereadable(basedir . '/' . rnwf)
-                exe "tabnew " . basedir . '/' . rnwf
+                exe "tabnew " . substitute(basedir . '/' . rnwf, ' ', '\\ ', 'g')
             elseif filereadable(rnwf)
-                exe "tabnew " . rnwf
+                exe "tabnew " . substitute(rnwf, ' ', '\\ ', 'g')
             else
                 call RWarningMsg('Could not find either "' . rnwbn . ' or "' . rnwf . '" in "' . basedir . '".')
                 return
@@ -373,16 +373,13 @@ function! SyncTeX_backward(fname, ln)
 endfunction
 
 function! SyncTeX_forward()
-    if expand("%:p") =~ ' '
-        call RWarningMsg('SyncTeX will not work because there is empty space in this file path: "' . expand("%:p") . '"')
-    endif
     let basenm = expand("%:t:r")
     let lnum = 0
     let rnwf = expand("%:t")
 
     let olddir = getcwd()
     if olddir != expand("%:p:h")
-        exe "cd " . expand("%:p:h")
+        exe "cd " . substitute(expand("%:p:h"), ' ', '\\ ', 'g')
     endif
 
     if filereadable(basenm . "-concordance.tex")
@@ -409,17 +406,17 @@ function! SyncTeX_forward()
                 endfor
                 if lnum == 0
                     call RWarningMsg('Could not find "child=' . bufname("%") . '" in ' . mfile . '.')
-                    exe "cd " . olddir
+                    exe "cd " . substitute(olddir, ' ', '\\ ', 'g')
                     return
                 endif
             else
                 call RWarningMsg('Vim-R-plugin [SyncTeX]: "' . basenm . '-concordance.tex" not found.')
-                exe "cd " . olddir
+                exe "cd " . substitute(olddir, ' ', '\\ ', 'g')
                 return
             endif
         else
             call RWarningMsg('SyncTeX [Vim-R-plugin]: "' . basenm . '-concordance.tex" not found.')
-            exe "cd " . olddir
+            exe "cd " . substitute(olddir, ' ', '\\ ', 'g')
             return
         endif
     endif
@@ -438,20 +435,20 @@ function! SyncTeX_forward()
 
     if texln == 0
         call RWarningMsg("Error: did not find LaTeX line.")
-        exe "cd " . olddir
+        exe "cd " . substitute(olddir, ' ', '\\ ', 'g')
         return
     endif
     if basenm =~ '/'
         let basedir = substitute(basenm, '\(.*\)/.*', '\1', '')
         let basenm = substitute(basenm, '.*/', '', '')
-        exe "cd " . basedir
+        exe "cd " . substitute(basedir, ' ', '\\ ', 'g')
     else
         let basedir = ''
     endif
 
     if !filereadable(basenm . ".pdf")
         call RWarningMsg('SyncTeX forward cannot be done because the file "' . basenm . '.pdf" is missing.')
-        exe "cd " . olddir
+        exe "cd " . substitute(olddir, ' ', '\\ ', 'g')
         return
     endif
     if !filereadable(basenm . ".synctex.gz")
@@ -459,7 +456,7 @@ function! SyncTeX_forward()
         if g:vimrplugin_latexcmd != "default" && g:vimrplugin_latexcmd !~ "synctex"
             call RWarningMsg('Note: The string "-synctex=1" is not in your vimrplugin_latexcmd. Please check your vimrc.')
         endif
-        exe "cd " . olddir
+        exe "cd " . substitute(olddir, ' ', '\\ ', 'g')
         return
     endif
 
@@ -492,7 +489,7 @@ function! SyncTeX_forward()
     else
         call RWarningMsg('SyncTeX support for "' . g:rplugin_pdfviewer . '" not implemented.')
     endif
-    exe "cd " . olddir
+    exe "cd " . substitute(olddir, ' ', '\\ ', 'g')
 endfunction
 
 function! SyncTeX_SetPID(spid)
@@ -507,17 +504,17 @@ function! Run_SyncTeX()
 
     let olddir = getcwd()
     if olddir != expand("%:p:h")
-        exe "cd " . expand("%:p:h")
+        exe "cd " . substitute(expand("%:p:h"), ' ', '\\ ', 'g')
     endif
 
     if g:rplugin_pdfviewer == "evince"
         let [basenm, basedir] = SyncTeX_GetMaster()
         if basedir != '.'
-            exe "cd " . basedir
+            exe "cd " . substitute(basedir, ' ', '\\ ', 'g')
         endif
         if has("nvim")
-            let g:rplugin_stx_job = jobstart("synctex", "python", [g:rplugin_home . "/r-plugin/synctex_evince_backward.py", basenm . ".pdf", "nvim"])
-            autocmd JobActivity synctex call Handle_SyncTeX_backward()
+            let g:rplugin_stx_job = jobstart("RnwSyncTeX", "python", [g:rplugin_home . "/r-plugin/synctex_evince_backward.py", basenm . ".pdf", "nvim"])
+            autocmd JobActivity RnwSyncTeX call Handle_SyncTeX_backward()
         else
             if v:servername != ""
                 call system("python " . g:rplugin_home . "/r-plugin/synctex_evince_backward.py '" . basenm . ".pdf' " . v:servername . " &")
@@ -529,11 +526,11 @@ function! Run_SyncTeX()
     elseif has("nvim") && (g:rplugin_pdfviewer == "okular" || g:rplugin_pdfviewer == "zathura") && !exists("g:rplugin_tail_follow")
         let g:rplugin_tail_follow = 1
         call writefile([], $VIMRPLUGIN_TMPDIR . "/" . g:rplugin_pdfviewer . "_search")
-        let g:rplugin_stx_job = jobstart("synctex", "tail", ["-f", $VIMRPLUGIN_TMPDIR . "/" . g:rplugin_pdfviewer . "_search"])
-        autocmd JobActivity synctex call Handle_SyncTeX_backward()
+        let g:rplugin_stx_job = jobstart("RnwSyncTeX", "tail", ["-f", $VIMRPLUGIN_TMPDIR . "/" . g:rplugin_pdfviewer . "_search"])
+        autocmd JobActivity RnwSyncTeX call Handle_SyncTeX_backward()
         autocmd VimLeave * call delete($VIMRPLUGIN_TMPDIR . "/" . g:rplugin_pdfviewer . "_search") | call delete($VIMRPLUGIN_TMPDIR . "/synctex_back.sh")
     endif
-    exe "cd " . olddir
+    exe "cd " . substitute(olddir, ' ', '\\ ', 'g')
 endfunction
 
 function! Handle_SyncTeX_backward()
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 717d6a5..a90a140 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -2543,12 +2543,12 @@ function ROpenPDF(path)
 
     let olddir = getcwd()
     if olddir != expand("%:p:h")
-        exe "cd " . expand("%:p:h")
+        exe "cd " . substitute(expand("%:p:h"), ' ', '\\ ', 'g')
     endif
 
     if has("win32") || has("win64")
         exe 'Py OpenPDF("' . pdfpath . '")'
-        exe "cd " . olddir
+        exe "cd " . substitute(olddir, ' ', '\\ ', 'g')
         return
     endif
 
@@ -2568,7 +2568,7 @@ function ROpenPDF(path)
                     exe "Py Start_Zathura('" . basenm . "', '" . v:servername . "')"
                 endif
             endif
-            exe "cd " . olddir
+            exe "cd " . substitute(olddir, ' ', '\\ ', 'g')
             return
         else
             let pcmd = g:rplugin_pdfviewer . " '" . pdfpath . "' 2>/dev/null >/dev/null &"
@@ -2578,7 +2578,7 @@ function ROpenPDF(path)
             call system("wmctrl -a '" . basenm . ".pdf'")
         endif
     endif
-    exe "cd " . olddir
+    exe "cd " . substitute(olddir, ' ', '\\ ', 'g')
 endfunction
 
 

From 1fde8fc63cafd4ec9aab32159deb88ddb72fe5c8 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Wed, 29 Oct 2014 19:36:57 -0400
Subject: [PATCH 0796/1050] Improve help document layout.

---
 doc/r-plugin.txt | 294 +++++++++++++++++++++++++++++++++++------------
 1 file changed, 218 insertions(+), 76 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 4135ebd..91af429 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -1,4 +1,4 @@
-*r-plugin.txt*                                                      *vim-r-plugin*
+*r-plugin.txt*                                                  *vim-r-plugin*
 				 Vim-R-plugin~
 			     Plugin to work with R~
 
@@ -102,6 +102,7 @@ The installation instructions are split in four sections:
    3. Troubleshooting
    4. Optional steps
 
+------------------------------------------------------------------------------
 3.1. Instructions for Unix (Linux, OS X, etc.)~
 
 If you are using Windows, jump to section 3.2.
@@ -115,7 +116,7 @@ Before installing the plugin, you should install its dependencies:
 
    Vim >= 7.4: http://www.vim.org/download.php
                In addition to the most commonly used features, the plugin
-               requires: |+python| or |+python3|, |+clientserver| and |+conceal|. 
+               requires: |+python| or |+python3|, |+clientserver| and |+conceal|.
 
 	       Note: If you use Neovim, |+python|, |+python3| and
 	       |+clientserver| features are not required, but the python
@@ -218,6 +219,7 @@ If you want to uninstall the plugin, do
    :RmVimball Vim-R-plugin
 <
 
+------------------------------------------------------------------------------
 3.2. Instructions for Windows ~
 
 Before installing the plugin, you should install several external
@@ -234,11 +236,11 @@ dependencies:
 
     * Python 2.7.6 (32 bit):
       http://www.python.org/ftp/python/2.7.6/python-2.7.6.msi
-      Do not choose the X86-64 version because it will not work. 
+      Do not choose the X86-64 version because it will not work.
 
     * pywin32:
       http://sourceforge.net/projects/pywin32/files/pywin32/Build%20218/pywin32-218.win32-py2.7.exe/download
-			     
+
       Note: The above versions of Python and pywin32 are known to work with
       the official GVim 7.4 binary. The default download may not match the
       Python version Vim was linked against: then you have to "View all files"
@@ -278,7 +280,7 @@ Please, click on the menu bar
    Start/Close
    Start R (default)
 <
-If R does not start and you get an error message instead, you may want to 
+If R does not start and you get an error message instead, you may want to
 set the path to your Rgui.exe in your |vimrc|, for example (please adapt to
 your installation)
 >
@@ -299,6 +301,7 @@ If you want to uninstall the plugin, do
    :RmVimball Vim-R-plugin
 <
 
+------------------------------------------------------------------------------
 3.3. Troubleshooting (if the plugin doesn't work)~
 
 Note: The  is '\' by default, but if you have run the
@@ -323,6 +326,7 @@ running, the vimcom package is not installed (or is installed but is not
 loaded), or R was not started by Vim.
 
 
+------------------------------------------------------------------------------
 3.4. Optional steps~
 
 3.4.1 Customize the plugin~
@@ -331,6 +335,7 @@ Please, read the section |r-plugin-options|. Emacs/ESS users should read the
 section Indenting setup (|r-plugin-indenting|) of this document.
 
 
+------------------------------------------------------------------------------
 3.4.2 Install additional plugins~
 
 You may be interested in installing additional general plugins to get
@@ -340,6 +345,7 @@ edit Rnoweb files, you may want to try LaTeX-Box for omnicompletion of LaTeX
 code (see |r-plugin-latex-box| for details).
 
 
+------------------------------------------------------------------------------
 3.4.3 Add buttons to GVim~
 
 Please read |r-plugin-toolbar| if you want to add R buttons to GVim's tool
@@ -585,6 +591,7 @@ outside the range 20-180. Se R help on `tidy.source` for details on how to
 control the function behavior.
 
 
+------------------------------------------------------------------------------
 4.2. Edition of Rnoweb files~
 
 In Rnoweb files (.Rnw), when the cursor is over the `@` character, which
@@ -612,6 +619,7 @@ with single file Rnoweb documents. Otherwise, see |r-plugin-SyncTeX| for
 configuration details.
 
 
+------------------------------------------------------------------------------
 4.3. Omni completion and the highlighting of functions~
 
 The plugin adds some features to the default syntax highlight of R code. One
@@ -623,6 +631,7 @@ Note: If you have too many loaded packages Vim may be unable to load the list
 of functions for syntax highlight.
 
 
+------------------------------------------------------------------------------
 4.4. Omni completion~
 
 Vim can automatically complete the names of R objects when CTRL-X CTRL-O is
@@ -651,6 +660,7 @@ files are stored in ~/.vim/r-plugin/objlist/ and remain available until you
 manually delete them.
 
 
+------------------------------------------------------------------------------
 4.5. The Object Browser~
 
 You have to do ro to either start or updated the Object Browser.
@@ -691,6 +701,7 @@ One limitation is that objects made available by the command `data()` may not
 have their classes recognized in the GlobalEnv view.
 
 
+------------------------------------------------------------------------------
 4.6. Commenting and uncommenting lines~
 
 You can toggle the state of a line as either commented or uncommented by
@@ -729,8 +740,10 @@ Tip: You can use Vim substitution command `:%s/#.*//` to delete all comments
 in a buffer (see |:s| and |pattern-overview|).
 
 
-4.7. Build a tags file to jump to function definitions~
+------------------------------------------------------------------------------
 								 *:RBuildTags*
+4.7. Build a tags file to jump to function definitions~
+
 Vim can jump to functions defined in other files if you press CTRL-] over the
 name of a function, but it needs a tags file to be able to find the function
 definition (see |tags-and-searches|). The command  :RBuildTags  calls the R
@@ -740,8 +753,10 @@ referencing source code located in other directories, including the entire R
 source code.
 
 
-4.8. Tmux usage~
+------------------------------------------------------------------------------
 							       *r-plugin-tmux*
+4.8. Tmux usage~
+
 When running either GVim or Vim in a terminal emulator (Linux/Unix only), the
 Vim-R-plugin will use Tmux to start R in a separate terminal emulator. R will
 be running inside a Tmux session, but you will hardly notice any difference
@@ -762,8 +777,10 @@ Note: Neovim does not require the --servername VIM argument.
 Note: Starting GVim within a Tmux session is not supported.
 
 
-4.8.1 tvim~
+------------------------------------------------------------------------------
 							       *r-plugin-tvim*
+4.8.1 tvim~
+
 If, as recommended, you always prefer to run Tmux before running Vim you could
 create a Bash function called `tvim` (please, see the ~/.bashrc example at
 |r-plugin-quick-setup|). Then you will be able to start a Tmux session running
@@ -791,6 +808,7 @@ If you are going to run Vim inside Tmux, than you should create your
     set -g mouse-resize-pane on
 <
 
+------------------------------------------------------------------------------
 4.8.2 Key bindings and mouse support~
 
 The Tmux configuration file suggested above configures Tmux to use vi key
@@ -843,6 +861,7 @@ be passed to applications running under Tmux. To send  to either R or Vim
 you have to type .
 
 
+------------------------------------------------------------------------------
 4.8.3 Copying and pasting~
 
 You do not need to copy code from Vim to R because you can use the plugin's
@@ -862,8 +881,10 @@ support in Tmux. You will be able to toggle mouse support on and off by typing
    bind m run-shell '( if [ "mode-mouse off" = "$(tmux show-window-option mode-mouse)" ]; then toggle=on; else toggle=off; fi; tmux display-message "mouse $toggle"; tmux set-option -w mode-mouse $toggle ; for cmd in mouse-select-pane mouse-resize-pane mouse-select-window; do tmux set-option -g $cmd $toggle ; done;) > /dev/null 2>&1'
 <
 
-4.8.2 Remote access~
+------------------------------------------------------------------------------
 							     *r-plugin-remote*
+4.8.2 Remote access~
+
 Note: Neovim does not require the --servername VIM argument. Thus, you also do
 not need to enable the X11 Forwarding for omnicompletion, etc.
 
@@ -928,6 +949,7 @@ missing features; others would be very time consuming to fix without breaking
 anything.
 
 
+------------------------------------------------------------------------------
 5.1. R's source() issues~
 
 The R's `source()` function of base package prints an extra new line between
@@ -938,6 +960,7 @@ errors in the code sent to R. Details:
    https://stat.ethz.ch/pipermail/r-devel/2012-December/065352.html
 
 
+------------------------------------------------------------------------------
 5.2. The clipboard's content is lost (Windows only)~
 
 On Windows, the plugin copies the command that will be sent to R into the
@@ -945,6 +968,7 @@ clipboard. Thus, if you have anything in the clipboard it will be lost while
 using the plugin.
 
 
+------------------------------------------------------------------------------
 5.3. The menu may not reflect some of your custom key bindings~
 
 If you have created a custom key binding for the Vim-R-plugin, the menu in
@@ -952,6 +976,7 @@ GVim will not always reflect the correct key binding if it is not the same for
 Normal, Visual and Insert modes.
 
 
+------------------------------------------------------------------------------
 5.4. Syntactically correct code may be wrongly indented~
 
 If the Vim-R-plugin indents your code wrongly you may get the correct
@@ -978,12 +1003,14 @@ indent the code below:
 See: https://github.com/jcfaria/Vim-R-plugin/issues/77
 
 
+------------------------------------------------------------------------------
 5.5. Functions are not always correctly sent to R~
 
 The plugin is only capable of recognizing functions defined using the `<-`
 operator. See: https://github.com/jcfaria/Vim-R-plugin/issues/94
 
 
+------------------------------------------------------------------------------
 5.6. Objects Browser does not support knitr cache=TRUE~
 
 When processing Rnoweb documents with the knitr package, if the chunk option
@@ -992,6 +1019,7 @@ of objects because knitr uses R's lazy load feature. The workaround for this
 issue is to define the chunk option `cache.lazy=FALSE`.
 
 
+------------------------------------------------------------------------------
 5.7. Wrong message that "R is busy" (Windows only)~
 
 On Windows, when code is sent from Vim to R Console, the vimcom library
@@ -1006,8 +1034,11 @@ tell Vim that "R is busy" and Vim will display this message. Everything should
 work as expected again after any valid code is executed in the R Console.
 
 
+------------------------------------------------------------------------------
+							*r-plugin-SyncTeX-win*
+							*r-plugin-SyncTeX-mac*
 5.8. SyncTeX support is a Linux only feature~
-				*r-plugin-SyncTeX-win*  *r-plugin-SyncTeX-mac*
+
 There is no SyncTeX support for Windows and Mac OS X. Both Sumatra (Windows)
 and Skim (Mac OS X) have support for SyncTeX, but the Vim-R-plugin is not
 ready to communicate with them. If you can, please write the necessary code to
@@ -1015,8 +1046,10 @@ support anyone of them and submit a push request on github:
 https://github.com/jcfaria/Vim-R-plugin
 
 
-5.9. Bugs that affect Mac OS X, Linux Console and ...~
+------------------------------------------------------------------------------
 								*r-plugin-nox*
+5.9. Bugs that affect Mac OS X, Linux Console and ...~
+
 Note: The bug described in this section does not affect Neovim.
 
 If you use MacVim, run Vim in the Linux Console or start Vim in a terminal
@@ -1077,6 +1110,7 @@ A user reported success with the following procedure:
 See also: |r-plugin-remote|.
 
 
+------------------------------------------------------------------------------
 5.10. R must be started by Vim~
 
 The communication between Vim and R will work only if R was started by Vim
@@ -1195,8 +1229,10 @@ is running:
 |r-plugin-SyncTeX|             Options for SyncTeX
 
 
-6.1. Terminal emulator (Linux/Unix only)~
+------------------------------------------------------------------------------
 							     *vimrplugin_term*
+6.1. Terminal emulator (Linux/Unix only)~
+
 The plugin uses the first terminal emulator that it finds in the following
 list:
     1. gnome-terminal,
@@ -1229,8 +1265,10 @@ Please, look at the manual of your terminal emulator to know how to call it.
 The last argument must be the one which precedes the command to be executed.
 
 
+------------------------------------------------------------------------------
+							    *vimrplugin_Rterm*
 6.2. Use Rterm.exe on Windows~
-							      *vimrplugin_Rterm*
+
 If you rather prefer to use Rterm.exe than Rgui.exe, you have to set both the
 "Quick Edit Mode" and the "Insert mode" on either the Windows 7 PowerShell or
 the Windows XP Command Prompt (click on the title bar and choose
@@ -1246,10 +1284,12 @@ Mode" on either PowerShell or Command Prompt and to send a "Right click" to
 it.
 
 
-6.3. Assignment operator and Rnoweb completion of code block~
+------------------------------------------------------------------------------
 						      *vimrplugin_rnowebchunk*
-						       *vimrplugin_assign_map*
-							   *vimrplugin_assign*
+	                                              *vimrplugin_assign_map*
+                                                      *vimrplugin_assign*
+6.3. Assignment operator and Rnoweb completion of code block~
+
 In Rnoweb files, a `<` is replaced with `<<>>=\n@`. To disable this feature,
 put in your |vimrc|:
 >
@@ -1281,10 +1321,12 @@ If you need to type many object names with underscores, you may want to change
 the value vimrplugin_assign to 2. Then, you will have to type two `_` to get
 them converted into `<-`.
 
-6.4. Object Browser options~
+------------------------------------------------------------------------------
 						      *vimrplugin_objbr_place*
-							  *vimrplugin_objbr_w*
+						      *vimrplugin_objbr_w*
 						      *vimrplugin_external_ob*
+6.4. Object Browser options~
+
 By default, the object browser will be created with 40 columns. The minimum
 width of the Object Browser window is 9 columns. You can change the object
 browser's default width by setting the value of |vimrplugin_objbr_w| in your
@@ -1308,10 +1350,12 @@ external terminal emulator. In this case, the command rh will not
 work on the Object Browser (you will see the message "Cmd not available").
 
 
-6.5. Vim as pager for R help~
+------------------------------------------------------------------------------
 							 *vimrplugin_vimpager*
 							 *vimrplugin_editor_w*
-							   *vimrplugin_help_w*
+							 *vimrplugin_help_w*
+6.5. Vim as pager for R help~
+
 6.5.1. Quick setup~
 
 If you do not want to see R documentation in a Vim's buffer, put in your
@@ -1325,6 +1369,7 @@ Vim in the right way. You can, for example, create a file named
 `~/bin/vimrpager` to do that (see |r-plugin-quick-setup|).
 
 
+------------------------------------------------------------------------------
 6.5.2. Details and other options:~
 
 The plugin key bindings will remain active in the documentation buffer, and,
@@ -1355,16 +1400,20 @@ values to some variables in your |vimrc|, as in the example:
    let vimrplugin_editor_h = 60
 <
 
-6.6. Use 32 bit version of R (Windows and Mac OS X only)~
+------------------------------------------------------------------------------
 							     *vimrplugin_i386*
+6.6. Use 32 bit version of R (Windows and Mac OS X only)~
+
 If you are using a 64 bit Windows or a 64 bit Mac OS X, but prefer to run the
 32 bit version of R, put in your |vimrc|:
 >
    let vimrplugin_i386 = 1
 <
 
-6.7. R path~
+------------------------------------------------------------------------------
 							   *vimrplugin_r_path*
+6.7. R path~
+
 Vim will run the first R executable in the path. You can set an alternative R
 path in your |vimrc| as in the examples:
 >
@@ -1379,8 +1428,10 @@ Example:
    autocmd BufReadPre ~/old* let vimrplugin_r_path='~/app/R-2.8.1/bin'
 <
 
-6.8. Arguments to R~
+------------------------------------------------------------------------------
 							   *vimrplugin_r_args*
+6.8. Arguments to R~
+
 Set this option in your |vimrc| if you want to pass command line arguments to
 R at the startup. Example:
 >
@@ -1391,8 +1442,10 @@ default value is "--sdi", but you may change it to "--mdi" if you do not like
 the SDI style of the graphical user interface.
 
 
-6.9. Omnicompletion and syntax highlight of R functions~
+------------------------------------------------------------------------------
 						   *vimrplugin_permanent_libs*
+6.9. Omnicompletion and syntax highlight of R functions~
+
 The list of functions to be highlighted and the list of objects for
 omnicompletion are built dynamically as the libraries are loaded by R.
 However, you can set the value of vimrplugin_permanent_libs if you want that
@@ -1407,8 +1460,10 @@ You may also want to define the value of vimrplugin_permanent_libs if you are
 running Vim without the |clientserver| feature.
 
 
-6.10. More colorful syntax highlight of .Rout files~
+------------------------------------------------------------------------------
 						   *vimrplugin_routmorecolors*
+6.10. More colorful syntax highlight of .Rout files~
+
 By default, the R commands in .Rout files are highlighted with the color of
 comments, and only the output of commands has some of its elements highlighted
 (numbers, strings, index of vectors, warnings and errors).
@@ -1419,8 +1474,10 @@ scripts, put the following in your |vimrc|:
    let vimrplugin_routmorecolors = 1
 <
 
-6.11. How to automatically open the .Rout file~
+------------------------------------------------------------------------------
 							*vimrplugin_routnotab*
+6.11. How to automatically open the .Rout file~
+
 After the command ao, Vim will save the current buffer if it has
 any pending changes, run `R CMD BATCH --no-restore --no-save` on the current
 file and show the resulting .Rout file in a new tab. If you prefer that the
@@ -1429,9 +1486,11 @@ file is open in a new split window, put in your |vimrc|:
    let vimrplugin_routnotab = 1
 <
 
-6.12. Indent commented lines~
+------------------------------------------------------------------------------
 						 *vimrplugin_indent_commented*
-						       *r_indent_ess_comments*
+                                                 *r_indent_ess_comments*
+6.12. Indent commented lines~
+
 You can type xx to comment out a line or selected lines. If the
 line already starts with a comment string, it will be removed. After adding
 the comment string, the line will be reindented by default. To turn off the
@@ -1450,8 +1509,10 @@ table below (see |r-plugin-indenting|):
                  0                        1                ###
 <
 
-6.13. Sleep time (Windows only)~
+------------------------------------------------------------------------------
 							*vimrplugin_sleeptime*
+6.13. Sleep time (Windows only)~
+
 The plugin gives to R a small amount of time to process the paste command. The
 default value is 0.2 second, but you should experiment different values. The
 example show how to adjust the value of sleeptime in your |vimrc|:
@@ -1459,8 +1520,10 @@ example show how to adjust the value of sleeptime in your |vimrc|:
    let vimrplugin_sleeptime = 0.1
 <
 
-6.14. Tmux configuration (Linux/Unix only)~
+------------------------------------------------------------------------------
 						       *vimrplugin_notmuxconf*
+6.14. Tmux configuration (Linux/Unix only)~
+
 
 GVim (or Vim running R in an external terminal emulator) runs Tmux with a
 specially built configuration file. If you want to use your own ~/.tmux.conf,
@@ -1474,11 +1537,13 @@ required for the communication with R and then source your own configuration
 file (~/.tmux.conf).
 
 
-6.15. Integration with Tmux (Linux/Unix only)~
+------------------------------------------------------------------------------
 						  *vimrplugin_rconsole_height*
-							   *vimrplugin_vsplit*
-						   *vimrplugin_rconsole_width*
-						       *vimrplugin_tmux_title*
+                                                  *vimrplugin_vsplit*
+			                          *vimrplugin_rconsole_width*
+                                                  *vimrplugin_tmux_title*
+6.15. Integration with Tmux (Linux/Unix only)~
+
 These three options are valid only when Vim is started inside a Tmux session.
 In this case, when you type rf, the terminal will be split in two
 regions and R will run in one of them. By default, the Vim-R-plugin will tell
@@ -1507,8 +1572,10 @@ or let Tmux set the title automatically. Examples:
    let vimrplugin_tmux_title = "automatic"
 <
 
+------------------------------------------------------------------------------
+                                                      *vimrplugin_applescript*
 6.16. Integration with AppleScript (OS X only)~
-							*vimrplugin_applescript*
+
 In Mac OS X, the plugin will try to send commands to R gui using AppleScript.
 If you prefer either to run R and Vim in the same terminal emulator split in
 two regions (Vim and R) or to run R in an external terminal emulator, put in
@@ -1520,9 +1587,11 @@ If Vim is running inside Tmux, the terminal will be split in two regions.
 Otherwise, R will start in an external terminal emulator.
 
 
-6.17. Special R functions~
+------------------------------------------------------------------------------
 						      *vimrplugin_listmethods*
-						      *vimrplugin_specialplot*
+                                                      *vimrplugin_specialplot*
+6.17. Special R functions~
+
 The R function `args()` lists the arguments of a function, but not the arguments
 of its methods. If you want that the plugin calls the function
 `vim.list.args()` after ra, you have to add to your |vimrc|:
@@ -1536,21 +1605,25 @@ after rg if you put the following line in your |vimrc|:
    let vimrplugin_specialplot = 1
 <
 
-6.18. maxdeparse~
+------------------------------------------------------------------------------
 						       *vimrplugin_maxdeparse*
+6.18. maxdeparse~
+
 You can set the argument maxdeparse to be passed to R's `source()` function.
 Example:
 >
    let vimrplugin_maxdeparse = 300
 <
 
-6.19. LaTeX command~
-							 *vimrplugin_latexcmd*
+------------------------------------------------------------------------------
 						       *vimrplugin_sweaveargs*
+						       *vimrplugin_latexcmd*
+6.19. LaTeX command~
+
 On Windows, the vimcom package calls `tools::texi2dvi()` to build the pdf
 from the generated .tex file. On Linux/Unix, by default, it calls
 >
-   latexmk -pdflatex="pdflatex -file-line-error -synctex=1" -pdf 
+   latexmk -pdflatex="pdflatex -file-line-error -synctex=1" -pdf
 <
 to produce a pdf document from the .tex file generated by either `Sweave()` or
 `knit()` command. If `latexmk` is not installed, it calls `pdflatex`. You can
@@ -1562,8 +1635,10 @@ If you want to pass arguments do the `Sweave()` function, set the value of the
 vimrplugin_sweaveargs variable.
 
 
-6.20. Never unmake the R menu~
+------------------------------------------------------------------------------
 						*vimrplugin_never_unmake_menu*
+6.20. Never unmake the R menu~
+
 Use this option if you want that the "R" menu item in GVim is not deleted when
 you change from one buffer to another, for example, when going from an .R file
 to a .txt one:
@@ -1576,8 +1651,10 @@ the buttons also are created at the plugin startup and kept while you go to
 different file type buffers.
 
 
-6.21. Map 'r'~
+------------------------------------------------------------------------------
 							    *vimrplugin_map_r*
+6.21. Map 'r'~
+
 If the variable |vimrplugin_map_r| exists, the plugin will map the letter 'r'
 to send lines to R when there are visually selected lines, for compatibility
 with the original plugin. To activate this option, insert the following into
@@ -1594,8 +1671,10 @@ Emacs:
    set tabstop=8
 <
 
-6.22. Add ^A^K to the beginning of commands~
+------------------------------------------------------------------------------
 							    *vimrplugin_ca_ck*
+6.22. Add ^A^K to the beginning of commands~
+
 When one types  in the R Console the cursor goes to the beginning of the
 line and when one types  the characters to the right of the cursor are
 deleted. This is useful to avoid characters left on the R Console being mixed
@@ -1606,10 +1685,12 @@ in your |vimrc|:
    let vimrplugin_ca_ck = 1
 <
 
+------------------------------------------------------------------------------
+	                                                *vimrplugin_pdfviewer*
+                                                        *vimrplugin_openpdf*
+                                                        *vimrplugin_openhtml*
 6.23. Open PDF after processing rnoweb, rmd or rrst files~
-							*vimrplugin_pdfviewer*
-							  *vimrplugin_openpdf*
-							 *vimrplugin_openhtml*
+
 The plugin can automatically open the pdf file generated by pdflatex, after
 either `Sweave()` or `knit()`. This behavior is controlled by the variable
 |vimrplugin_openpdf| whose value may be 0 (do not open the pdf), 1 (open only
@@ -1641,11 +1722,13 @@ The html file will be automatically opened if you put the following in your
    let vimrplugin_openhtml = 1
 <
 
+------------------------------------------------------------------------------
+                                                     *vimrplugin_rrstcompiler*
+			                             *vimrplugin_strict_rst*
+                                                     *vimrplugin_rst2pdfpath*
+			                             *vimrplugin_rst2pdfargs*
 6.24. Support to RreStructuredText file~
-						       *vimrplugin_strict_rst*
-						      *vimrplugin_rst2pdfpath*
-						      *vimrplugin_rst2pdfargs*
-						     *vimrplugin_rrstcompiler*
+
 By default, the Vim-R-plugin sends the command `render_rst(strict=TRUE)` to R
 before using R's `knit()` function to convert an Rrst file into an rst one. If
 you prefer the non strict rst code, put the following in your |vimrc|:
@@ -1658,8 +1741,10 @@ function knit2pdf), and vimrplugin_rst2pdfargs (further arguments to be passed
 to R function knit2pdf).
 
 
-6.25. Allow R commands in insert mode~
+------------------------------------------------------------------------------
 						 *vimrplugin_insert_mode_cmds*
+6.25. Allow R commands in insert mode~
+
 Vim-R commands are designed to work in insert mode as well as normal mode.
 However, depending on your , this can make it very difficult to
 write R packages or Sweave files.  For example, if  is set to the
@@ -1675,9 +1760,11 @@ The default value is 1, for consistency with earlier versions.
 See also: |r-plugin-localleader|.
 
 
-6.26. Show/remove hidden objects~
+------------------------------------------------------------------------------
 							 *vimrplugin_allnames*
 							 *vimrplugin_rmhidden*
+6.26. Show/remove hidden objects~
+
 Hidden objects are not included in the list of objects for omni completion. If
 you prefer to include them, put in your |vimrc|:
 >
@@ -1689,8 +1776,10 @@ you prefer to remove only visible objects, put in your |vimrc|:
    let g:vimrplugin_rmhidden = 0
 <
 
-6.27. Source additional scripts~
+------------------------------------------------------------------------------
 							   *vimrplugin_source*
+6.27. Source additional scripts~
+
 This variable should contain a comma separated list of Vim scripts to be
 sourced by the Vim-R-plugin. These scripts may provide additional
 functionality and/or change the behavior of the Vim-R-plugin. If you have such
@@ -1708,8 +1797,10 @@ features:
    https://github.com/jalvesaq/screenR
 
 
-6.28. Restart R if it is already running (Linux/Unix only)~
+------------------------------------------------------------------------------
 							  *vimrplugin_restart*
+6.28. Restart R if it is already running (Linux/Unix only)~
+
 When R is already running and you type one of the commands to start R before
 you have done rq, the Vim-R-plugin does one of the following:
 (a) If R is in an external terminal emulator, the terminal is closed, a new
@@ -1724,8 +1815,10 @@ do rf, rv or rc, then, put in your
    let vimrplugin_restart = 1
 <
 
-6.29. Show extra information during omnicompletion~
+------------------------------------------------------------------------------
 							*vimrplugin_show_args*
+6.29. Show extra information during omnicompletion~
+
 If you want that Vim shows a preview window with the function arguments as you
 do omnicompletion, put in your |vimrc|:
 >
@@ -1736,8 +1829,10 @@ run  to complete the function arguments. The preview window
 will be shown only if "preview" is also included in your 'completeopt'.
 
 
-6.30. Time to wait for vimcom loading~
+------------------------------------------------------------------------------
 						      *vimrplugin_vimcom_wait*
+6.30. Time to wait for vimcom loading~
+
 The Vim-R-plugin waits 5000 milliseconds for vimcom package to be loaded
 during R startup. It then checks whether you are using the correct version of
 vimcom. On Unix, it also sends a message to R update the list of uploaded
@@ -1761,8 +1856,10 @@ If you do not want to install the vimcom package, then put in your
    let vimrplugin_vimcom_wait = -1
 <
 
-6.31 Start R in working directory of Vim~
+------------------------------------------------------------------------------
 							   *vimrplugin_vim_wd*
+6.31 Start R in working directory of Vim~
+
 The Vim-R-plugin starts R in the directory where the current buffer is. If you
 want R's working directory to be the same as Vim's working directory, put in
 your |vimrc|:
@@ -1773,7 +1870,7 @@ This option is useful only for those who did not enable 'autochdir'.
 
 
 6.32 Only set key bindings that are user specified
-						  *vimrplugin_user_maps_only*
+						   *vimrplugin_user_maps_only*
 The Vim-R-plugin sets many default key bindings.  The user can set custom
 key bindings (|r-plugin-key-bindings|).  If you wish the Vim-R-plugin to only
 set those key-bindings specified by the user, put in your vimrc:
@@ -1781,8 +1878,10 @@ set those key-bindings specified by the user, put in your vimrc:
     let vimrplugin_user_maps_only = 1
 <
 
-6.32 SyncTeX support (Linux only)~
+------------------------------------------------------------------------------
 							    *r-plugin-SyncTeX*
+6.32 SyncTeX support (Linux only)~
+
 SyncTeX is a set of communication systems used by some PDF viewers and by some
 text editors which allow users to jump from a specific line in the text editor
 to the corresponding line in the PDF viewer and vice-versa. The Vim-R-plugin
@@ -1810,6 +1909,7 @@ document. Note, however, that the knitr package (version 1.7) has no SyncTeX
 support for child documents.
 
 
+------------------------------------------------------------------------------
 6.32.1 Evince configuration~
 
 If you have Evince installed, the Vim-R-plugin assumes that you are using it
@@ -1822,6 +1922,7 @@ for the first time, it will start, but will not jump to desired line; you have
 to press gp again.
 
 
+------------------------------------------------------------------------------
 6.32.2 Okular configuration~
 
 You have to configure Okular to call Vim during backward searches.
@@ -1865,6 +1966,7 @@ requires additional steps because Neovim does not have the argument
      synctex_okular_backward.sh '%f' %l
 <
 
+------------------------------------------------------------------------------
 6.32.3 Zathura configuration~
 
 Zathura (version >= 0.3.1) is also supported. If the terminal emulator is not
@@ -1876,9 +1978,11 @@ for the first time, it will start, but will not jump to desired line; you have
 to press gp again.
 
 
+------------------------------------------------------------------------------
+                                                       *vimrplugin_vim_window*
+				                       *vimrplugin_synctex*
 6.32.4 Configuring the PDF editor and Vim's window title~
-							  *vimrplugin_synctex*
-						       *vimrplugin_vim_window*
+
 If SyncTeX does not work (see above), you may try to set in your |vimrc| the
 values of |vimrplugin_pdfviewer| and vimrplugin_vim_window.
 
@@ -2124,6 +2228,7 @@ Sorry, it is not possible. The plugin can only send the `quit()` command. If you
 want to stop R, you have to press ^C into R's Console.
 
 
+------------------------------------------------------------------------------
 9.2. Html help and custom pager~
 
 If you prefer to see help pages in an html browser, put in your ~/.Rprofile:
@@ -2135,8 +2240,10 @@ and in your |vimrc| (see |vimrplugin_vimpager|):
    let vimrplugin_vimpager = "no"
 <
 
-9.3. How do marked blocks work?~
+------------------------------------------------------------------------------
 							  *r-plugin-showmarks*
+9.3. How do marked blocks work?~
+
 Vim allows you to put several marks (bookmarks) in buffers. The most commonly
 used marks are the lowercase alphabet letters. If the cursor is between any
 two marks, the plugin will send the lines between them to R if you press
@@ -2158,8 +2265,10 @@ ShowMarks behavior:
    let showmarks_include = "abcdefghijklmnopqrstuvwxyz"
 <
 
-9.4. Use snipMate~
+------------------------------------------------------------------------------
 							   *r-plugin-snippets*
+9.4. Use snipMate~
+
 You probably will want to use the snipMate plugin to insert snippets of code
 in your R script. The plugin may be downloaded from:
 
@@ -2174,8 +2283,10 @@ tex.snippets and r.snippets. If you edit R documentation, you may want to
 create an rhelp.snippets
 
 
-9.5. Easier key bindings for most used commands~
+------------------------------------------------------------------------------
 							   *r-plugin-bindings*
+9.5. Easier key bindings for most used commands~
+
 The most used commands from Vim-R-plugin probably are "Send line" and "Send
 selection". You may find it a good idea to map them to the space bar in your
 |vimrc| (suggestion made by Iago Mosqueira):
@@ -2210,8 +2321,10 @@ currently focused is not the Vim's window (either the terminal emulator where
 Vim is running or GVim).
 
 
-9.6. Remap the ~
+------------------------------------------------------------------------------
 							*r-plugin-localleader*
+9.6. Remap the ~
+
 People writing Rnoweb documents may find it better to use a comma or other key
 as the  instead of the default backslash (see |maplocalleader|).
 For example, to change the  to a comma, put at the beginning of
@@ -2220,8 +2333,10 @@ your |vimrc| (before any mapping command):
    let maplocalleader = ","
 <
 
-9.7. Use a tags file to jump to function definitions~
+------------------------------------------------------------------------------
 							   *r-plugin-tagsfile*
+9.7. Use a tags file to jump to function definitions~
+
 Vim can jump to a function definition if it finds a "tags" file with the
 information about the place where the function is defined. To generate the
 tags file, use the R function `rtags()`, which will build an Emacs tags file.
@@ -2258,8 +2373,10 @@ Example on how to test whether your setup is ok:
    4. Press CTRL-] over "do_mapply" (Vim sould jump to "mapply.c").
 
 
-9.8. Indenting setup~
+------------------------------------------------------------------------------
 							  *r-plugin-indenting*
+9.8. Indenting setup~
+
 Note: In Normal mode, type |==| to indent the current line and gg=G to format
 the entire buffer (see |gg|, |=| and |G| for details). These are Vim commands;
 they are not specific to R code.
@@ -2309,8 +2426,10 @@ Notes: (1) Not all code indented by Emacs/ESS will be indented by the
            in indent/r.vim. That is why it is documented in this section.
 
 
-9.9. Folding setup~
+------------------------------------------------------------------------------
 							    *r-plugin-folding*
+9.9. Folding setup~
+
 Vim has several methods of folding text (see |fold-methods| and
 |fold-commands|). To enable the syntax method of folding for R files, put in
 your |vimrc|:
@@ -2334,6 +2453,7 @@ line where the statement immediately above started. Of course someone may
 develop a better algorithm in the future.
 
 
+------------------------------------------------------------------------------
 9.10. Highlight chunk header as R code~
 
 By default, Vim will highlight chunk headers of RMarkdown and
@@ -2345,6 +2465,7 @@ them as such. You can do this by putting in your |vimrc|:
    let rmd_syn_hl_chunk = 1
 <
 
+------------------------------------------------------------------------------
 9.11. Automatically close parenthesis~
 
 Some people want Vim automatically inserting a closing parenthesis, bracket or
@@ -2354,6 +2475,7 @@ this goal:
    http://vim.wikia.com/wiki/Automatically_append_closing_characters
 
 
+------------------------------------------------------------------------------
 9.12. Automatic line breaks~
 
 By default, while editing R code, Vim does not break lines when you are typing
@@ -2363,6 +2485,7 @@ Vim breaks the R code automatically put in your |vimrc|:
    autocmd FileType r setlocal formatoptions+=t
 <
 
+------------------------------------------------------------------------------
 9.13. Vim with 256 colors in a terminal emulator (Linux/Unix only)~
 
 If you want 256 colors support in Vim, install the package ncurses-term. Then
@@ -2380,6 +2503,7 @@ download and copy them to ~/.vim/colors. You may use the command
 |vimrc|.
 
 
+------------------------------------------------------------------------------
 9.14. Run your Makefile from within R~
 
 Do you have many Rnoweb files included in a master tex or Rnoweb file and use
@@ -2389,8 +2513,10 @@ line in your |vimrc|:
    nmap sm :update:call g:SendCmdToR('system("make")')
 <
 
-9.15. Edit your ~/.Rprofile~
+------------------------------------------------------------------------------
 							   *r-plugin-Rprofile*
+9.15. Edit your ~/.Rprofile~
+
 You may want to edit your ~/.Rprofile in addition to considering the
 suggestions of |r-plugin-R-setup| you may also want to put the following
 lines in your .Rprofile if you are using Linux:
@@ -2413,6 +2539,7 @@ graphical device in Vim, we can at least make it always visible over the
 terminal emulator or the GVim window.
 
 
+------------------------------------------------------------------------------
 9.16. Debugging R functions~
 
 The Vim-R-Plugin does not have debugging facilities, but you may want to use
@@ -2431,8 +2558,10 @@ useful tip is to click on the title bar of the debug window and choose "Always
 on top" or a similar option provided by your desktop manager.
 
 
-9.17. Turn the R-plugin into a global plugin (Linux/Unix only)~
+------------------------------------------------------------------------------
 							     *r-plugin-global*
+9.17. Turn the R-plugin into a global plugin (Linux/Unix only)~
+
 The Vim-R-plugin is a file type plugin. If you want its functionality
 available for all file types, then put in your |vimrc|:
 >
@@ -2454,6 +2583,7 @@ your |vimrc|:
    let vimrplugin_never_unmake_menu = 1
 <
 
+------------------------------------------------------------------------------
 9.18. Disable syntax highlight of R functions~
 
 If you want to disable the syntax highlight of R functions put in your
@@ -2462,8 +2592,10 @@ If you want to disable the syntax highlight of R functions put in your
    autocmd Syntax * syntax clear rFunction
 <
 
-9.19. Tips for knitr users~
+------------------------------------------------------------------------------
 							      *r-plugin-knitr*
+9.19. Tips for knitr users~
+
 If you are using knitr with option cache=TRUE, you may want from time to time
 to delete all objects in R workspace and all files in the cache directory. If
 you want to use kr in Normal mode for this, put in your |vimrc|:
@@ -2478,8 +2610,10 @@ them in your vimrc. For example
 will produce a german document with a table of contents.
 
 
-9.20. Integration with LaTeX-Box~
+------------------------------------------------------------------------------
 							  *r-plugin-latex-box*
+9.20. Integration with LaTeX-Box~
+
 LaTeX-Box does not automatically recognize Rnoweb files as a valid LaTeX file.
 You have to tell LaTeX-BoX that the .tex file compiled by either `knitr()` or
 `Sweave()` is the main LaTeX file. You can do this in two ways. Suppose that
@@ -2499,8 +2633,10 @@ omnicompletion. Please, read LaTeX-Box documentation for more information.
 See also: |vimrplugin_latexcmd|.
 
 
-9.21. Quick setup for the Vim-R-plugin on Linux/Unix environment~
+------------------------------------------------------------------------------
 							*r-plugin-quick-setup*
+9.21. Quick setup for the Vim-R-plugin on Linux/Unix environment~
+
 Please, look at section |r-plugin-options| if you want information about the
 Vim-r-plugin customization.
 
@@ -2701,8 +2837,10 @@ Finally, if you want to use vi key bindings in Bash:
    set keymap vi
 <
 
-9.22. Python versions~
+------------------------------------------------------------------------------
 							     *r-plugin-python*
+9.22. Python versions~
+
 Are you using Windows and need to use a specific version of either Python or
 pywin32? The official Vim is 32 bit and, thus, Python must be 32 bit too.
 However, Vim and R run as independent processes, that is, you may have 32 bit
@@ -2724,8 +2862,10 @@ discover this information manually:
     * pywin32: http://sourceforge.net/projects/pywin32/
 
 
-9.23. Add tool bar icons and hide unused buttons~
+------------------------------------------------------------------------------
 							    *r-plugin-toolbar*
+9.23. Add tool bar icons and hide unused buttons~
+
 If you want to add some R buttons to GVim tool bar download the zip file
 http://www.lepem.ufc.br/jaa/bitmaps.zip and unpack it at either ~/.vim
 (Unix/Linux/Mac OS X) or ~/vimfiles (Windows). You may not see the buttons
@@ -2736,6 +2876,8 @@ below to know how to hide buttons on the toolbar:
    http://vim.wikia.com/wiki/Hide_toolbar_or_menus_to_see_more_text
 
 
+------------------------------------------------------------------------------
+
 9.24. Integration with GNU Screen, screen plugin, Conque Shell or VimShell~
 
 The plugin used to be able to use GNU Screen (through screen plugin), Conque

From ce904952c2f9b5b7f3d25d9ef8f37fb10cafa095 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sat, 1 Nov 2014 12:30:08 -0400
Subject: [PATCH 0797/1050] Note about knitr limitations regarding SyncTeX.

---
 doc/r-plugin.txt | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 91af429..8da3113 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -1905,8 +1905,17 @@ subdocument (TeX and Rnoweb alike) should include the following line:
    % !Rnw root = master.Rnw
 <
 where `master.Rnw` must be replaced with the name of the actual master
-document. Note, however, that the knitr package (version 1.7) has no SyncTeX
-support for child documents.
+document.
+
+Note: The current knitr package (version 1.7) has at least two limitations:
+
+   - It has no SyncTeX support for child documents. The correspondence data
+     point to lines right below child chunks in the master document and not to
+     somewhere in the child documents themselves.
+
+   - It only starts registering the concordance after the first chunk. So, it
+     is recommended that you put the first chunk of R code just after the
+     `\begin{document}` command.
 
 
 ------------------------------------------------------------------------------

From 0b620d4a8a8abff16e84a7e4bec4b0dfe91068bf Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sat, 1 Nov 2014 20:46:19 -0400
Subject: [PATCH 0798/1050] Use dbus-send to SyncTeX forward Zathura.

---
 ftplugin/rnoweb_rplugin.vim |  6 +++++-
 r-plugin/common_global.vim  | 14 +++++++++++---
 2 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/ftplugin/rnoweb_rplugin.vim b/ftplugin/rnoweb_rplugin.vim
index d717e77..dc1685a 100644
--- a/ftplugin/rnoweb_rplugin.vim
+++ b/ftplugin/rnoweb_rplugin.vim
@@ -469,7 +469,11 @@ function! SyncTeX_forward()
         endif
     elseif g:rplugin_pdfviewer == "zathura"
         if system("wmctrl -xl") =~ 'Zathura.*' . basenm . '.pdf' && g:rplugin_zathura_pid[basenm] != 0
-            let result = system("zathura --synctex-forward=" . texln . ":1:" . basenm . ".tex --synctex-pid=" . g:rplugin_zathura_pid[basenm] . " " . basenm . ".pdf")
+            if g:rplugin_has_dbussend
+                let result = system('dbus-send --print-reply --session --dest=org.pwmt.zathura.PID-' . g:rplugin_zathura_pid[basenm] . ' /org/pwmt/zathura org.pwmt.zathura.SynctexView string:"' . basenm . '.tex' . '" uint32:' . texln . ' uint32:1')
+            else
+                let result = system("zathura --synctex-forward=" . texln . ":1:" . basenm . ".tex --synctex-pid=" . g:rplugin_zathura_pid[basenm] . " " . basenm . ".pdf")
+            endif
             if v:shell_error
                 let g:rplugin_zathura_pid[basenm] = 0
                 call RWarningMsg(result)
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index a90a140..7629cd9 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -2496,9 +2496,17 @@ function RSetPDFViewer()
         let g:rplugin_has_wmctrl = 0
     endif
 
-    if g:rplugin_pdfviewer == "zathura" && g:rplugin_has_wmctrl == 0
-        let g:rplugin_pdfviewer = "none"
-        call RWarningMsgInp("The application wmctrl must be installed to use Zathura as PDF viewer.")
+    if g:rplugin_pdfviewer == "zathura"
+        if g:rplugin_has_wmctrl == 0
+            let g:rplugin_pdfviewer = "none"
+            call RWarningMsgInp("The application wmctrl must be installed to use Zathura as PDF viewer.")
+        else
+            if executable("dbus-send")
+                let g:rplugin_has_dbussend = 1
+            else
+                let g:rplugin_has_dbussend = 0
+            endif
+        endif
     endif
 
     " Try to guess the title of the window where Vim is running:

From f5e65cd6b1ea24f1228c9be94d6c78140ef99c74 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sat, 1 Nov 2014 22:00:23 -0400
Subject: [PATCH 0799/1050] Require vimcom 1.0-5.

---
 r-plugin/common_global.vim | 8 ++++----
 r-plugin/nvimcom.py        | 4 ++--
 r-plugin/vimcom.py         | 4 ++--
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 7629cd9..ffea3c9 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -925,8 +925,8 @@ function ReceiveVimComStartMsg(msg)
         if vmsg[0] != "vimcom"
             call RWarningMsg("Invalid package name: " . vmsg[0])
         endif
-        if vmsg[1] != "1.0-4"
-            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.0-4.')
+        if vmsg[1] != "1.0-5"
+            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.0-5.')
         endif
         if vmsg[2] != $VIMINSTANCEID
             call RWarningMsg("Invalid ID: " . vmsg[2] . " [Correct = " . $VIMINSTANCEID . "]")
@@ -984,8 +984,8 @@ function WaitVimComStart()
         let vr = readfile($VIMRPLUGIN_TMPDIR . "/vimcom_running")
         if vr[2] == $VIMINSTANCEID
             let g:rplugin_vimcom_version = vr[1]
-            if g:rplugin_vimcom_version != "1.0-4"
-                call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.0-4.')
+            if g:rplugin_vimcom_version != "1.0-5"
+                call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.0-5.')
                 sleep 1
             endif
         else
diff --git a/r-plugin/nvimcom.py b/r-plugin/nvimcom.py
index ca670de..566a3d2 100644
--- a/r-plugin/nvimcom.py
+++ b/r-plugin/nvimcom.py
@@ -61,8 +61,8 @@ def DiscoverVimComPort():
         print "let g:rplugin_vimcomport = " + str(VimComPort) + "\n"
         sys.stdout.flush()
         PortWarn = False
-        if repl.find("1.0-4") != 0:
-            print "call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.0-4.')\n"
+        if repl.find("1.0-5") != 0:
+            print "call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.0-5.')\n"
             sys.stdout.flush()
         return
 
diff --git a/r-plugin/vimcom.py b/r-plugin/vimcom.py
index 9f7e440..9bd203b 100644
--- a/r-plugin/vimcom.py
+++ b/r-plugin/vimcom.py
@@ -59,8 +59,8 @@ def DiscoverVimComPort():
     else:
         vim.command("let g:rplugin_vimcomport = " + str(VimComPort))
         PortWarn = 0
-        if repl.find("1.0-4") != 0:
-            vim.command("call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.0-4.')")
+        if repl.find("1.0-5") != 0:
+            vim.command("call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.0-5.')")
             vim.command("sleep 1")
     return(VimComPort)
 

From 44f4efb89bc37550ba63deef8739b92f6a7f0843 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sun, 2 Nov 2014 10:20:18 -0500
Subject: [PATCH 0800/1050] Add R script with sample code to be indented. If
 you want to improve the indent/r.vim script, I suggest that you check your
 new algorithm with this sample R code.

---
 r-plugin/indent_test.R | 605 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 605 insertions(+)
 create mode 100644 r-plugin/indent_test.R

diff --git a/r-plugin/indent_test.R b/r-plugin/indent_test.R
new file mode 100644
index 0000000..5359b0d
--- /dev/null
+++ b/r-plugin/indent_test.R
@@ -0,0 +1,605 @@
+## This is a nonsense code indented in a way that I think is correct.
+## Both Vim-R-plugin and Emacs/ESS make (different) mistakes when indenting it.
+## The following options are in the ~/.vimrc:
+##
+## set expandtab
+## set shiftwidth=4
+## let r_indent_ess_comments = 1
+## let r_indent_align_args = 1
+##
+## and the following is in the ~/.emacs
+##
+## (add-hook 'ess-mode-hook
+##                   (lambda ()
+##                         (ess-set-style 'C++)))
+##
+## If you want to improve the indent/r.vim script, you may want to test your new
+## indentation algorithm with this R script: Make a copy of this file, open it
+## with Vim, do gg=G, quit and use vimdiff to see what is wrong.
+
+
+for(i in 1:10){
+    if(T){
+        a <- 1:10
+    }
+    else {
+        a <- 2:11
+        b <- 2:10
+    }
+}
+
+if(T)
+
+    sim
+
+acabou
+
+x <- DT[really_long_row_subsetting_variable,
+        really_long_column_subsetting_variable,
+        by = really_long_by_statement]
+
+
+asas
+if(T)
+    asas
+asas
+asas
+asas
+
+lkdlks
+if(T)
+                                        # comment
+    andada
+ksldks
+kslksd
+
+if (!(attr in urls))
+    value = escape_txt_chars(value)
+## more commented code here.
+
+while(T) {
+    lskdlsks
+}
+
+if(FALSE){
+}
+
+ff <- "hist"
+mm <- methods(ff)
+l <- length(mm)
+for(i in 1:l){
+    if(exists(mm[i])){
+        arglist <- formals(mm[i])
+        if(nothing('ksjs#asq')) # ls()
+            a <- b
+        k <- length(arglist)
+        if(k > 0){
+            argnames <- names(arglist)
+            for(j in 1:k)
+                cat(ff, mm[i], argnames[j], "\n")
+        }
+        vcov <- if(length(coef))
+            solve(oout$he)
+        else
+            matrix(numeric(0L), 0L, 0L)
+        vcov <-
+            if(length(coef))
+                solve(oout$he)
+            else
+                matrix(numeric(0L), 0L, 0L)
+        xxx
+        www
+    }
+}
+
+if(T)
+{
+    lskdlsks
+    kdlsks
+
+    maes <- subset(b, (age < 40) & (sex == "Female") &
+                   ((condfam == "Reference person") | (condfam == "Spouse")) &
+                   (tipom > 0), select = c("uf", "sex", "age", "fam.cond", "col",
+                                           "school", "urban", "income", "fam.income",
+                                           "tipom", "peso"))
+
+    maes$tipom <- factor(maes$tipom, levels = c(1, 2), labels = c("Casada", "Solteira"))
+    label(maes$tipom) <- "Tipo de mãe"
+                                        # Comment here
+
+    if(T)
+        a <- b
+    else
+        c <- d
+    fim()
+    comeco
+}
+
+while(T)
+{
+    if(T){
+
+                                        # Another comment here
+        kdlskd
+    } else {
+        dksldk
+        iwd <- as.integer(substr(fmt, Iind + 1, regexpr('[\\.\\)]', fmt) - 1))
+        iwd <- as.integer(substr(fmt, Iind + 1, regexpr("\\.\\", fmt) - 1))
+        iwd <- as.integer(substr(fmt, Iind + 1, regexpr('[\\.\\(]', fmt) - 1))
+        sklsdk
+    }
+}
+
+if(nothing){
+    if(everything)
+    {
+        a <- b
+}}
+
+x <- a
+for(i1 in lista1)
+    for(i2 in lista2)
+        for(i3 in lista3)
+            for(i4 in lista4)
+                cat(i1, i2, i3, i4, "\n")
+
+for(i1 in lista1)
+    for(i2 in lista2)
+        for(i3 in lista3)
+            for(i4 in lista4)
+                cat(i1, i2, i3, i4, "\n")
+
+if(T)
+{
+    if (is.environment(object))
+    {
+        ls()
+    }
+    else
+    {
+        ls()
+    }
+}
+
+if(nothing('ksjs#asq')) ls()
+a <- b
+
+if(inherits(pfit, "try#error")) return(NA)
+else {
+    zz <- 2*(pfit@min - fitted@min)
+    a <- b
+}
+
+nothing <- function(x)
+{
+    if(x == "everything")
+        x <- "nothing"
+    x
+}
+
+if (T)
+{
+    if(T)
+        for(i  in 1:2)
+        {
+            cat(i, "\n")
+        }
+    x
+}
+
+if(F)
+{
+    if(T)
+        for(i in 1:2){
+            x <- 1
+        }
+    x
+}
+
+                                        # The code below will be wrongly indented:
+
+latlon.format <- function(lat, lon, digits=max(6, getOption("digits") - 1))
+{
+    n <- length(lon)
+    rval <- vector("character", n)
+    if (!is.numeric(lat) || !is.numeric(lon))
+        return ("(non-numeric lat or lon)")
+    for (i in 1:n) {
+        if (is.na(lat[i]) || is.na(lon[i]))
+            rval[i] <- ""
+        else
+            rval[i] <- paste(format(abs(lat[i]), digits=digits),
+                             if (lat[i] > 0) "N  " else "S  ",
+                             format(abs(lon[i]), digits=digits),
+                             if (lon[i] > 0) "E" else "W",
+                             sep="")
+        n <- lon
+    }
+    rval
+}
+
+                                        # indent-test-dk-01.R
+if (type == "fill") {
+    land <- c("#FBC784","#F1C37A","#E6B670","#DCA865","#D19A5C",
+              "#C79652","#BD9248","#B38E3E","#A98A34")
+    water <- c("#E1FCF7","#BFF2EC","#A0E8E4","#83DEDE","#68CDD4",
+               "#4FBBC9","#38A7BF","#2292B5","#0F7CAB")
+} else {
+    land <- c("#FBC784","#F1C37A","#E6B670","#DCA865","#D19A5C",
+              "#C79652","#BD9248","#B38E3E","#A98A34")
+    water <- c("#A4FCE3","#72EFE9","#4FE3ED","#47DCF2","#46D7F6",
+               "#3FC0DF","#3FC0DF","#3BB7D3","#36A5C3","#3194B4",
+               "#2A7CA4","#205081","#16255E","#100C2F")
+}
+
+lon.format <- function(lon, digits=max(6, getOption("digits") - 1))
+{
+    n <- length(lon)
+    if (n < 1) return("")
+    rval <- vector("character", n)
+    for (i in 1:n)
+        if (is.na(lon[i]))
+            rval[i] <-  ""
+        else
+            rval[i] <- paste(format(abs(lon[i]), digits=digits),
+                             if (lon[i] > 0) "E" else "S",
+                             sep="")
+    rval
+}
+
+structure(do.something(name = name, exit = NULL, handler = handler,
+                       description = description, test = test,
+                       interactive = interactive),
+          class = "restart")
+
+## store info for loading name space for loadingNamespaceInfo to read
+"__LoadingNamespaceInfo__" <- list(libname = package.lib,
+                                   pkgname = package)
+
+if(any(missingMethods))
+    stop(gettextf("in '%s' methods for export not found: %s",
+                  package,
+                  paste(expMethods[missingMethods],
+                        collapse = ", ")),
+         domain = NA)
+
+if(www){
+    if(R_version_built_under < "2.10.0")
+        stop(gettextf("package '%s' was built before R 2.10.0: please re-install it",
+                      basename(pkgpath)), call. = FALSE, domain = NA)
+    ## we need to ensure that S4 dispatch is on now if the package
+    ## will require it, or the exports will be incomplete.
+    dependsMethods <- "methods" %in% names(pkgInfo$Depends)
+    if(dependsMethods) loadNamespace("methods")
+}
+
+makeRestart <- function(name = "",
+                        handler = function(...) NULL,
+                        description = "",
+                        test = function(c) TRUE,
+                        interactive = NULL) {
+    structure(list(name = name, exit = NULL, handler = handler,
+                   description = description, test = test,
+                   interactive = interactive),
+              class = "restart")
+}
+
+sapply(seq_along(symNames),
+       function(i) {
+           ## could vectorize this outside of the loop
+           ## and assign to different variable to
+           ## maintain the original names.
+           varName <- names(symNames)[i]
+           origVarName <- symNames[i]
+           if(exists(varName, envir = env))
+               warning("failed to assign NativeSymbolInfo for ",
+                       origVarName,
+                       ifelse(origVarName != varName,
+                              paste(" to", varName), ""),
+                       " since ", varName,
+                       " is already defined in the ", package,
+                       " namespace")
+           else
+               assign(varName, symbols[[origVarName]],
+                      envir = env)
+
+       })
+
+if(xx == aa &&
+   yy == bb)
+    cat(xx, yy)
+cat(aa, bb)
+
+something <- function()
+{
+    if (file.exists(nsFile))
+        directives <- if (!is.na(enc) &&
+                          ! Sys.getlocale("LC_CTYPE") %in% c("C", "POSIX")) {
+            con <- file(nsFile, encoding=enc)
+            on.exit(close(con))
+            parse(con)
+        } else parse(nsFile)
+    else if (mustExist)
+        stop(gettextf("package '%s' has no NAMESPACE file", package),
+             domain = NA)
+    x
+}
+
+print.difftime <- function(x, digits = getOption("digits"), ...)
+{
+    if(is.array(x) || length(x) > 1L) {
+        cat("Time differences in ", attr(x, "units"), "\n", sep="")
+        y <- unclass(x); attr(y, "units") <- NULL
+        print(y)
+    }
+    else
+        cat("Time difference of ", format(unclass(x), digits=digits), " ",
+            attr(x, "units"), "\n", sep="")
+
+    invisible(x)
+}
+
+print.difftime <- function(x, digits = getOption("digits"), ...)
+{
+    if(is.array(x) || length(x) > 1L) {
+        cat("Time differences in ", attr(x, "units"), "\n", sep="")
+        y <- unclass(x); attr(y, "units") <- NULL
+        print(y)
+    } else
+        cat("Time difference of ", format(unclass(x), digits=digits), " ",
+            attr(x, "units"), "\n", sep="")
+
+    invisible(x)
+}
+
+namespaceImport <- function(self, ...)
+    for (ns in list(...)) namespaceImportFrom(self, asNamespace(ns))
+
+x
+
+as.function.default <- function (x, envir = parent.frame(), ...)
+    if (is.function(x)) x else .Internal(as.function.default(x, envir))
+
+as.array <- function(x, ...)
+    UseMethod("as.array")
+
+bquote <- function(expr, where=parent.frame())
+{
+    unquote <- function(e)
+        if (length(e) <= 1L) e
+        else if (e[[1L]] == as.name(".")) eval(e[[2L]], where)
+        else if (is.pairlist(e)) as.pairlist(lapply(e,unquote))
+        else as.call(lapply(e,unquote))
+
+    unquote(substitute(expr))
+}
+
+bquote <- function(expr, where=parent.frame())
+{
+    unquote <- function(e)
+        if (length(e) <= 1L) e else
+            if (e[[1L]] == as.name(".")) eval(e[[2L]], where) else
+                if (is.pairlist(e)) as.pairlist(lapply(e,unquote)) else
+                    as.call(lapply(e,unquote))
+
+    unquote(substitute(expr))
+}
+
+for (i in 1:num.stations) {
+    thetime <- stn.time[select[1]] # e. g. 2222
+    time[i] <- as.numeric(as.POSIXct(paste(substr(thedate,1,4),
+                                           " ",
+                                           substr(thetime,1,2),
+                                           ":",
+                                           substr(thetime,3,4),
+                                           ":00",sep=""),tz="UTC")) - trefn
+    stn[i] <- sub("^ *", "", station.id[select[1]])
+    lat[i] <- latitude[select[1]]
+}
+
+bquote <-
+    function(expr, where=parent.frame())
+    {
+        unquote <- function(e)
+            if (length(e) <= 1L) e else
+                if (e[[1L]] == as.name(".")) eval(e[[2L]], where) else
+                    if (is.pairlist(e)) as.pairlist(lapply(e,unquote)) else
+                        as.call(lapply(e,unquote))
+
+        unquote(substitute(expr))
+    }
+
+attr.all.equal <- function(target, current,
+                           check.attributes = TRUE,
+                           check.names = TRUE, ...)
+{
+    ##--- "all.equal(.)" for attributes ---
+    ##---  Auxiliary in all.equal(.) methods --- return NULL or character()
+    msg <- NULL
+    if(mode(target) != mode(current))
+        msg <- paste("Modes: ", mode(target), ", ", mode(current), sep = "")
+    cat(msg)
+}
+
+"::" <- function(pkg, name) {
+    pkg <- as.character(substitute(pkg))
+    name <- as.character(substitute(name))
+    ns <- tryCatch(asNamespace(pkg), hasNoNamespaceError = function(e) NULL)
+    if (is.null(ns)) {
+        pos <- match(paste("package", pkg, sep=":"), search(), 0L)
+        if (pos == 0)
+            stop(gettextf("package %s has no name space and is not on the search path"), sQuote(pkg), domain = NA)
+        get(name, pos = pos, inherits = FALSE)
+    }
+    else getExportedValue(pkg, name)
+}
+
+topenv <- function(envir = parent.frame(),
+                   matchThisEnv = getOption("topLevelEnvironment")) {
+    while (! identical(envir, emptyenv())) {
+        nm <- attributes(envir)[["names", exact = TRUE]]
+        if ((is.character(nm) && length(grep("^package:" , nm))) ||
+            ## matchThisEnv is used in sys.source
+            identical(envir, matchThisEnv) ||
+            identical(envir, .GlobalEnv) ||
+            identical(envir, baseenv()) ||
+            .Internal(isNamespaceEnv(envir)) ||
+            ## packages except base and those with a separate namespace have .packageName
+            exists(".packageName", envir = envir, inherits = FALSE))
+            return(envir)
+        else envir <- parent.env(envir)
+    }
+    return(.GlobalEnv)
+}
+
+nsInfoFilePath <- file.path(pkgpath, "Meta", "nsInfo.rds")
+nsInfo <- if(file.exists(nsInfoFilePath)) .readRDS(nsInfoFilePath)
+    else parseNamespaceFile(package, package.lib, mustExist = FALSE)
+
+pkgInfoFP <- file.path(pkgpath, "Meta", "package.rds")
+
+foo <- function(){
+    xxx
+    .knownS3Generics <- local({
+
+        ## include the S3 group generics here
+        baseGenerics <- c("Math", "Ops", "Summary", "Complex",
+                          "as.character", "as.data.frame", "as.environment", "as.matrix", "as.vector",
+                          "cbind", "labels", "print", "rbind", "rep", "seq", "seq.int",
+                          "solve", "summary", "t")
+
+        utilsGenerics <- c("edit", "str")
+    })
+    xxx
+    tt <- try({
+        ns <- loadNamespace(package, c(which.lib.loc, lib.loc),
+                            keep.source = keep.source)
+        dataPath <- file.path(which.lib.loc, package, "data")
+        env <- attachNamespace(ns, pos = pos,
+                               dataPath = dataPath, deps)
+    })
+    xxx
+}
+
+foo <- function(){
+    xxx
+    paths <- c(paths,
+               dirs[file.info(dirs)$isdir &
+                    file.exists(file.path(dirs,
+                                          "DESCRIPTION"))])
+    xxx
+    if(nzchar(r_arch)
+       ## back-compatibility fix: remove before 2.12.0
+       ## && (.Platform$OS.type != "windows" || r_arch != "i386")
+       && file.exists(file.path(pkgpath, "libs"))
+       && !file.exists(file.path(pkgpath, "libs", r_arch)))
+        stop(gettextf("package '%s' is not installed for 'arch=%s'",
+                      pkgname, r_arch),
+             call. = FALSE, domain = NA)
+    xxx
+    if(!package %in% c("datasets", "grDevices", "graphics", "methods",
+                       "splines", "stats", "stats4", "tcltk", "tools",
+                       "utils") &&
+       isTRUE(getOption("checkPackageLicense", FALSE)))
+        checkLicense(package, pkgInfo, pkgpath)
+    xxx
+    res <- .Fortran("dqrdc2",
+                    qr=x,
+                    n,
+                    n,
+                    p,
+                    as.double(tol),
+                    rank=integer(1L),
+                    qraux = double(p),
+                    pivot = as.integer(1L:p),
+                    double(2*p),
+                    PACKAGE="base")[c(1,6,7,8)]# c("qr", "rank", "qraux", "pivot")
+    if(!is.null(cn <- colnames(x)))
+        colnames(res$qr) <- cn[res$pivot]
+    class(res) <- "qr"
+    res
+}
+
+test <- this('the function works',
+             {
+                 x <- 0
+             })
+
+############################################################################
+## indent/r.vim starts to make mistakes here
+
+test <- this('the function works', {
+                 x <- 0
+             })
+
+data.frame <- function(..., row.names = NULL, check.rows = FALSE, check.names = TRUE,
+                       stringsAsFactors = default.stringsAsFactors())
+{
+    data.row.names <-
+        if(check.rows && is.null(row.names))
+            function(current, new, i) {
+                if(is.character(current)) new <- as.character(new)
+                stop(gettextf("mismatch of row names in arguments of 'data.frame\', item %d", i), domain = NA)
+            }
+        else function(current, new, i) {
+            if(is.null(current)) {
+                if(anyDuplicated(new)) {
+                    warning("some row.names duplicated: ",
+                            paste(which(duplicated(new)), collapse=","),
+                            " --> row.names NOT used")
+                    current
+                } else new
+            } else current
+        }
+    xxx
+}
+
+
+foo <- function(){
+    xxx
+    if (ismat) for (i in seq_len(differences)) r <- r[i1, , drop = FALSE] -
+       r[-nrow(r):-(nrow(r) - lag + 1), , drop = FALSE]
+    else for (i in seq_len(differences))
+       r <- r[i1] - r[-length(r):-(length(r) - lag + 1L)]
+    r
+    if(is.null(width)) width <- 0L
+    else if(width < 0L) { flag <- "-"; width <- -width }
+    format.default(x, width=width,
+                   justify = if(flag=="-") "left" else "right")
+    xxx
+}
+
+try <- function(expr, silent = FALSE) {
+    if(file == "") file <- stdin()
+    else {
+        if (isTRUE(keep.source))
+            srcfile <- srcfile(file, encoding = encoding)
+        file <- file(file, "r", encoding = encoding)
+    }
+    xxx
+    tryCatch(expr, error = function(e) {
+                 call <- conditionCall(e)
+                 xxx
+             },
+             xxx)
+    xxx
+    levels(f) <- ## nl == nL or 1
+        if (nl == nL) as.character(labels)
+        else paste(labels, seq_along(levels), sep="")
+    class(f) <- c(if(ordered)"ordered", "factor")
+    f
+}
+
+x <- 1 + 2 + 3 +
+    4 + 5
+x <- 1 - 2 - 3 -
+    4 - 5
+x <- 1 * 2 * 3 *
+    4 * 5
+x <- 1 / 2 / 3 /
+    4 / 5
+
+cat("The End\n")
+
+
+## vim: expandtab sw=4 cursorcolumn

From 4b3abb8a31417b69cc5d1854f34849bc9fb6d835 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sun, 2 Nov 2014 11:00:15 -0500
Subject: [PATCH 0801/1050] Fix minor indent bug.

---
 indent/r.vim           | 8 ++++++--
 r-plugin/indent_test.R | 6 +++---
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/indent/r.vim b/indent/r.vim
index 993637b..c996535 100644
--- a/indent/r.vim
+++ b/indent/r.vim
@@ -1,7 +1,7 @@
 " Vim indent file
 " Language:	R
 " Author:	Jakson Alves de Aquino 
-" Last Change:	Fri Oct 17, 2014  10:02AM
+" Last Change:	Sun Nov 02, 2014  10:55AM
 
 
 " Only load this indent file when no other was loaded.
@@ -288,9 +288,13 @@ function GetRIndent()
     return indent(lnum) + &sw
   endif
 
+  let s:curtabstop = repeat(' ', &tabstop)
+  if pb > 0 && line =~ '{$'
+    return s:Get_last_paren_idx(line, '(', ')', pb) + &sw
+  endif
+
   let bb = s:Get_paren_balance(line, '[', ']')
 
-  let s:curtabstop = repeat(' ', &tabstop)
   if g:r_indent_align_args == 1
 
     if pb == 0 && bb == 0 && (line =~ '.*[,&|\-\*+<>]$' || cline =~ '^\s*[,&|\-\*+<>]')
diff --git a/r-plugin/indent_test.R b/r-plugin/indent_test.R
index 5359b0d..6a7b495 100644
--- a/r-plugin/indent_test.R
+++ b/r-plugin/indent_test.R
@@ -525,13 +525,13 @@ test <- this('the function works',
                  x <- 0
              })
 
-############################################################################
-## indent/r.vim starts to make mistakes here
-
 test <- this('the function works', {
                  x <- 0
              })
 
+############################################################################
+## indent/r.vim starts to make mistakes here
+
 data.frame <- function(..., row.names = NULL, check.rows = FALSE, check.names = TRUE,
                        stringsAsFactors = default.stringsAsFactors())
 {

From ccd6898ff49d267d2586774b5d2cd889fb3174a5 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sun, 2 Nov 2014 13:32:46 -0500
Subject: [PATCH 0802/1050] Fix minor bug in indent/r.vim.

---
 indent/r.vim           |  3 ++-
 r-plugin/indent_test.R | 13 ++++++++++++-
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/indent/r.vim b/indent/r.vim
index c996535..fd18c0b 100644
--- a/indent/r.vim
+++ b/indent/r.vim
@@ -1,7 +1,7 @@
 " Vim indent file
 " Language:	R
 " Author:	Jakson Alves de Aquino 
-" Last Change:	Sun Nov 02, 2014  10:55AM
+" Last Change:	Sun Nov 02, 2014  01:25PM
 
 
 " Only load this indent file when no other was loaded.
@@ -389,6 +389,7 @@ function GetRIndent()
     endif
   endif
 
+  let bb = s:Get_paren_balance(line, '[', ']')
   if bb < 0 && line =~ '.*]'
     while bb < 0 && lnum > 0
       let lnum -= 1
diff --git a/r-plugin/indent_test.R b/r-plugin/indent_test.R
index 6a7b495..1d1a09e 100644
--- a/r-plugin/indent_test.R
+++ b/r-plugin/indent_test.R
@@ -520,6 +520,12 @@ foo <- function(){
     res
 }
 
+if(TRUE){
+    x <- xx[, c("abc", "bdc", "cde", "def", "efg", "fgh", "ghi", "hij", "ijk",
+                "jkl", "klm", "lmn", "mno", "nop")]
+    x <- NULL
+}
+
 test <- this('the function works',
              {
                  x <- 0
@@ -532,6 +538,12 @@ test <- this('the function works', {
 ############################################################################
 ## indent/r.vim starts to make mistakes here
 
+test <- this('the function works',
+             {
+                 x <- 0
+             }
+            )
+
 data.frame <- function(..., row.names = NULL, check.rows = FALSE, check.names = TRUE,
                        stringsAsFactors = default.stringsAsFactors())
 {
@@ -601,5 +613,4 @@ x <- 1 / 2 / 3 /
 
 cat("The End\n")
 
-
 ## vim: expandtab sw=4 cursorcolumn

From e17e54f4df1a4b6348ac770cefe94cb47d9ced32 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Mon, 3 Nov 2014 09:41:14 -0500
Subject: [PATCH 0803/1050] Update r-plugin/indent_test.R.

---
 r-plugin/indent_test.R | 26 ++++++++++++++++++++++----
 1 file changed, 22 insertions(+), 4 deletions(-)

diff --git a/r-plugin/indent_test.R b/r-plugin/indent_test.R
index 1d1a09e..0b2da97 100644
--- a/r-plugin/indent_test.R
+++ b/r-plugin/indent_test.R
@@ -196,8 +196,6 @@ if(F)
     x
 }
 
-                                        # The code below will be wrongly indented:
-
 latlon.format <- function(lat, lon, digits=max(6, getOption("digits") - 1))
 {
     n <- length(lon)
@@ -535,6 +533,15 @@ test <- this('the function works', {
                  x <- 0
              })
 
+test_that('the function works',
+          {
+              x <- 0
+          })
+
+test_that('the function works', {
+              x <- 0
+          })
+
 ############################################################################
 ## indent/r.vim starts to make mistakes here
 
@@ -544,6 +551,17 @@ test <- this('the function works',
              }
             )
 
+that('the function works', {
+         x <- 0
+     })
+
+test_that('my unit test', {
+              if (some <- condition)
+                  result
+              else
+                  other <- result
+          })
+
 data.frame <- function(..., row.names = NULL, check.rows = FALSE, check.names = TRUE,
                        stringsAsFactors = default.stringsAsFactors())
 {
@@ -570,9 +588,9 @@ data.frame <- function(..., row.names = NULL, check.rows = FALSE, check.names =
 foo <- function(){
     xxx
     if (ismat) for (i in seq_len(differences)) r <- r[i1, , drop = FALSE] -
-       r[-nrow(r):-(nrow(r) - lag + 1), , drop = FALSE]
+        r[-nrow(r):-(nrow(r) - lag + 1), , drop = FALSE]
     else for (i in seq_len(differences))
-       r <- r[i1] - r[-length(r):-(length(r) - lag + 1L)]
+        r <- r[i1] - r[-length(r):-(length(r) - lag + 1L)]
     r
     if(is.null(width)) width <- 0L
     else if(width < 0L) { flag <- "-"; width <- -width }

From 58c3c8eefdf3cd1f8ebe6b7bae23ae1dd2bb09d1 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Mon, 3 Nov 2014 09:41:57 -0500
Subject: [PATCH 0804/1050] Add r-plugin/indent_test_noalign.R.

---
 r-plugin/indent_test_noalign.R | 629 +++++++++++++++++++++++++++++++++
 1 file changed, 629 insertions(+)
 create mode 100644 r-plugin/indent_test_noalign.R

diff --git a/r-plugin/indent_test_noalign.R b/r-plugin/indent_test_noalign.R
new file mode 100644
index 0000000..35c4819
--- /dev/null
+++ b/r-plugin/indent_test_noalign.R
@@ -0,0 +1,629 @@
+## This is a nonsense code indented in a way that I think is correct.
+## The following options are in the ~/.vimrc:
+##
+## set expandtab
+## set shiftwidth=4
+## let r_indent_ess_comments = 0
+## let r_indent_align_args = 0
+##
+## If you want to improve the indent/r.vim script, you may want to test your new
+## indentation algorithm with this R script: Make a copy of this file, open it
+## with Vim, do gg=G, quit and use vimdiff to see what is wrong.
+
+
+for(i in 1:10){
+    if(T){
+        a <- 1:10
+    }
+    else {
+        a <- 2:11
+        b <- 2:10
+    }
+}
+
+if(T)
+
+    sim
+
+acabou
+
+x <- DT[really_long_row_subsetting_variable,
+    really_long_column_subsetting_variable,
+    by = really_long_by_statement]
+
+
+asas
+if(T)
+    asas
+asas
+asas
+asas
+
+lkdlks
+if(T)
+    # comment
+    andada
+ksldks
+kslksd
+
+if (!(attr in urls))
+    value = escape_txt_chars(value)
+## more commented code here.
+
+while(T) {
+    lskdlsks
+}
+
+if(FALSE){
+}
+
+ff <- "hist"
+mm <- methods(ff)
+l <- length(mm)
+for(i in 1:l){
+    if(exists(mm[i])){
+        arglist <- formals(mm[i])
+        if(nothing('ksjs#asq')) # ls()
+            a <- b
+        k <- length(arglist)
+        if(k > 0){
+            argnames <- names(arglist)
+            for(j in 1:k)
+                cat(ff, mm[i], argnames[j], "\n")
+        }
+        vcov <- if(length(coef))
+            solve(oout$he)
+        else
+            matrix(numeric(0L), 0L, 0L)
+        vcov <-
+            if(length(coef))
+                solve(oout$he)
+            else
+                matrix(numeric(0L), 0L, 0L)
+        xxx
+        www
+    }
+}
+
+if(T)
+{
+    lskdlsks
+    kdlsks
+
+    maes <- subset(b, (age < 40) & (sex == "Female") &
+        ((condfam == "Reference person") | (condfam == "Spouse")) &
+        (tipom > 0), select = c("uf", "sex", "age", "fam.cond", "col",
+            "school", "urban", "income", "fam.income",
+            "tipom", "peso"))
+
+    maes$tipom <- factor(maes$tipom, levels = c(1, 2), labels = c("Casada", "Solteira"))
+    label(maes$tipom) <- "Tipo de mãe"
+    # Comment here
+
+    if(T)
+        a <- b
+    else
+        c <- d
+    fim()
+    comeco
+}
+
+while(T)
+{
+    if(T){
+
+        # Another comment here
+        kdlskd
+    } else {
+        dksldk
+        iwd <- as.integer(substr(fmt, Iind + 1, regexpr('[\\.\\)]', fmt) - 1))
+        iwd <- as.integer(substr(fmt, Iind + 1, regexpr("\\.\\", fmt) - 1))
+        iwd <- as.integer(substr(fmt, Iind + 1, regexpr('[\\.\\(]', fmt) - 1))
+        sklsdk
+    }
+}
+
+if(nothing){
+    if(everything)
+    {
+        a <- b
+}}
+
+x <- a
+for(i1 in lista1)
+    for(i2 in lista2)
+        for(i3 in lista3)
+            for(i4 in lista4)
+                cat(i1, i2, i3, i4, "\n")
+
+for(i1 in lista1)
+    for(i2 in lista2)
+        for(i3 in lista3)
+            for(i4 in lista4)
+                cat(i1, i2, i3, i4, "\n")
+
+if(T)
+{
+    if (is.environment(object))
+    {
+        ls()
+    }
+    else
+    {
+        ls()
+    }
+}
+
+if(nothing('ksjs#asq')) ls()
+a <- b
+
+if(inherits(pfit, "try#error")) return(NA)
+else {
+    zz <- 2*(pfit@min - fitted@min)
+    a <- b
+}
+
+nothing <- function(x)
+{
+    if(x == "everything")
+        x <- "nothing"
+    x
+}
+
+if (T)
+{
+    if(T)
+        for(i  in 1:2)
+        {
+            cat(i, "\n")
+        }
+    x
+}
+
+if(F)
+{
+    if(T)
+        for(i in 1:2){
+            x <- 1
+        }
+    x
+}
+
+latlon.format <- function(lat, lon, digits=max(6, getOption("digits") - 1))
+{
+    n <- length(lon)
+    rval <- vector("character", n)
+    if (!is.numeric(lat) || !is.numeric(lon))
+        return ("(non-numeric lat or lon)")
+    for (i in 1:n) {
+        if (is.na(lat[i]) || is.na(lon[i]))
+            rval[i] <- ""
+        else
+            rval[i] <- paste(format(abs(lat[i]), digits=digits),
+                if (lat[i] > 0) "N  " else "S  ",
+                format(abs(lon[i]), digits=digits),
+                if (lon[i] > 0) "E" else "W",
+                sep="")
+        n <- lon
+    }
+    rval
+}
+
+# indent-test-dk-01.R
+if (type == "fill") {
+    land <- c("#FBC784","#F1C37A","#E6B670","#DCA865","#D19A5C",
+        "#C79652","#BD9248","#B38E3E","#A98A34")
+    water <- c("#E1FCF7","#BFF2EC","#A0E8E4","#83DEDE","#68CDD4",
+        "#4FBBC9","#38A7BF","#2292B5","#0F7CAB")
+} else {
+    land <- c("#FBC784","#F1C37A","#E6B670","#DCA865","#D19A5C",
+        "#C79652","#BD9248","#B38E3E","#A98A34")
+    water <- c("#A4FCE3","#72EFE9","#4FE3ED","#47DCF2","#46D7F6",
+        "#3FC0DF","#3FC0DF","#3BB7D3","#36A5C3","#3194B4",
+        "#2A7CA4","#205081","#16255E","#100C2F")
+}
+
+lon.format <- function(lon, digits=max(6, getOption("digits") - 1))
+{
+    n <- length(lon)
+    if (n < 1) return("")
+    rval <- vector("character", n)
+    for (i in 1:n)
+        if (is.na(lon[i]))
+            rval[i] <-  ""
+        else
+            rval[i] <- paste(format(abs(lon[i]), digits=digits),
+                if (lon[i] > 0) "E" else "S",
+                sep="")
+    rval
+}
+
+structure(do.something(name = name, exit = NULL, handler = handler,
+        description = description, test = test,
+        interactive = interactive),
+    class = "restart")
+
+## store info for loading name space for loadingNamespaceInfo to read
+"__LoadingNamespaceInfo__" <- list(libname = package.lib,
+    pkgname = package)
+
+if(any(missingMethods))
+    stop(gettextf("in '%s' methods for export not found: %s",
+            package,
+            paste(expMethods[missingMethods],
+                collapse = ", ")),
+        domain = NA)
+
+if(www){
+    if(R_version_built_under < "2.10.0")
+        stop(gettextf("package '%s' was built before R 2.10.0: please re-install it",
+                basename(pkgpath)), call. = FALSE, domain = NA)
+    ## we need to ensure that S4 dispatch is on now if the package
+    ## will require it, or the exports will be incomplete.
+    dependsMethods <- "methods" %in% names(pkgInfo$Depends)
+    if(dependsMethods) loadNamespace("methods")
+}
+
+makeRestart <- function(name = "",
+    handler = function(...) NULL,
+    description = "",
+    test = function(c) TRUE,
+    interactive = NULL) {
+    structure(list(name = name, exit = NULL, handler = handler,
+            description = description, test = test,
+            interactive = interactive),
+        class = "restart")
+}
+
+sapply(seq_along(symNames),
+    function(i) {
+        ## could vectorize this outside of the loop
+        ## and assign to different variable to
+        ## maintain the original names.
+        varName <- names(symNames)[i]
+        origVarName <- symNames[i]
+        if(exists(varName, envir = env))
+            warning("failed to assign NativeSymbolInfo for ",
+                origVarName,
+                ifelse(origVarName != varName,
+                    paste(" to", varName), ""),
+                " since ", varName,
+                " is already defined in the ", package,
+                " namespace")
+        else
+            assign(varName, symbols[[origVarName]],
+                envir = env)
+
+    })
+
+if(xx == aa &&
+    yy == bb)
+    cat(xx, yy)
+cat(aa, bb)
+
+something <- function()
+{
+    if (file.exists(nsFile))
+        directives <- if (!is.na(enc) &&
+            ! Sys.getlocale("LC_CTYPE") %in% c("C", "POSIX")) {
+            con <- file(nsFile, encoding=enc)
+            on.exit(close(con))
+            parse(con)
+        } else parse(nsFile)
+    else if (mustExist)
+        stop(gettextf("package '%s' has no NAMESPACE file", package),
+            domain = NA)
+    x
+}
+
+print.difftime <- function(x, digits = getOption("digits"), ...)
+{
+    if(is.array(x) || length(x) > 1L) {
+        cat("Time differences in ", attr(x, "units"), "\n", sep="")
+        y <- unclass(x); attr(y, "units") <- NULL
+        print(y)
+    }
+    else
+        cat("Time difference of ", format(unclass(x), digits=digits), " ",
+            attr(x, "units"), "\n", sep="")
+
+    invisible(x)
+}
+
+print.difftime <- function(x, digits = getOption("digits"), ...)
+{
+    if(is.array(x) || length(x) > 1L) {
+        cat("Time differences in ", attr(x, "units"), "\n", sep="")
+        y <- unclass(x); attr(y, "units") <- NULL
+        print(y)
+    } else
+        cat("Time difference of ", format(unclass(x), digits=digits), " ",
+            attr(x, "units"), "\n", sep="")
+
+    invisible(x)
+}
+
+namespaceImport <- function(self, ...)
+    for (ns in list(...)) namespaceImportFrom(self, asNamespace(ns))
+
+x
+
+as.function.default <- function (x, envir = parent.frame(), ...)
+    if (is.function(x)) x else .Internal(as.function.default(x, envir))
+
+as.array <- function(x, ...)
+    UseMethod("as.array")
+
+bquote <- function(expr, where=parent.frame())
+{
+    unquote <- function(e)
+        if (length(e) <= 1L) e
+        else if (e[[1L]] == as.name(".")) eval(e[[2L]], where)
+        else if (is.pairlist(e)) as.pairlist(lapply(e,unquote))
+        else as.call(lapply(e,unquote))
+
+    unquote(substitute(expr))
+}
+
+bquote <- function(expr, where=parent.frame())
+{
+    unquote <- function(e)
+        if (length(e) <= 1L) e else
+            if (e[[1L]] == as.name(".")) eval(e[[2L]], where) else
+                if (is.pairlist(e)) as.pairlist(lapply(e,unquote)) else
+                    as.call(lapply(e,unquote))
+
+    unquote(substitute(expr))
+}
+
+for (i in 1:num.stations) {
+    thetime <- stn.time[select[1]] # e. g. 2222
+    time[i] <- as.numeric(as.POSIXct(paste(substr(thedate,1,4),
+                " ",
+                substr(thetime,1,2),
+                ":",
+                substr(thetime,3,4),
+                ":00",sep=""),tz="UTC")) - trefn
+    stn[i] <- sub("^ *", "", station.id[select[1]])
+    lat[i] <- latitude[select[1]]
+}
+
+bquote <-
+    function(expr, where=parent.frame())
+    {
+        unquote <- function(e)
+            if (length(e) <= 1L) e else
+                if (e[[1L]] == as.name(".")) eval(e[[2L]], where) else
+                    if (is.pairlist(e)) as.pairlist(lapply(e,unquote)) else
+                        as.call(lapply(e,unquote))
+
+        unquote(substitute(expr))
+    }
+
+attr.all.equal <- function(target, current,
+    check.attributes = TRUE,
+    check.names = TRUE, ...)
+{
+    ##--- "all.equal(.)" for attributes ---
+    ##---  Auxiliary in all.equal(.) methods --- return NULL or character()
+    msg <- NULL
+    if(mode(target) != mode(current))
+        msg <- paste("Modes: ", mode(target), ", ", mode(current), sep = "")
+    cat(msg)
+}
+
+"::" <- function(pkg, name) {
+    pkg <- as.character(substitute(pkg))
+    name <- as.character(substitute(name))
+    ns <- tryCatch(asNamespace(pkg), hasNoNamespaceError = function(e) NULL)
+    if (is.null(ns)) {
+        pos <- match(paste("package", pkg, sep=":"), search(), 0L)
+        if (pos == 0)
+            stop(gettextf("package %s has no name space and is not on the search path"), sQuote(pkg), domain = NA)
+        get(name, pos = pos, inherits = FALSE)
+    }
+    else getExportedValue(pkg, name)
+}
+
+topenv <- function(envir = parent.frame(),
+    matchThisEnv = getOption("topLevelEnvironment")) {
+    while (! identical(envir, emptyenv())) {
+        nm <- attributes(envir)[["names", exact = TRUE]]
+        if ((is.character(nm) && length(grep("^package:" , nm))) ||
+            ## matchThisEnv is used in sys.source
+            identical(envir, matchThisEnv) ||
+            identical(envir, .GlobalEnv) ||
+            identical(envir, baseenv()) ||
+            .Internal(isNamespaceEnv(envir)) ||
+            ## packages except base and those with a separate namespace have .packageName
+            exists(".packageName", envir = envir, inherits = FALSE))
+            return(envir)
+        else envir <- parent.env(envir)
+    }
+    return(.GlobalEnv)
+}
+
+nsInfoFilePath <- file.path(pkgpath, "Meta", "nsInfo.rds")
+nsInfo <- if(file.exists(nsInfoFilePath)) .readRDS(nsInfoFilePath)
+    else parseNamespaceFile(package, package.lib, mustExist = FALSE)
+
+pkgInfoFP <- file.path(pkgpath, "Meta", "package.rds")
+
+foo <- function(){
+    xxx
+    .knownS3Generics <- local({
+
+        ## include the S3 group generics here
+        baseGenerics <- c("Math", "Ops", "Summary", "Complex",
+            "as.character", "as.data.frame", "as.environment", "as.matrix", "as.vector",
+            "cbind", "labels", "print", "rbind", "rep", "seq", "seq.int",
+            "solve", "summary", "t")
+
+        utilsGenerics <- c("edit", "str")
+    })
+    xxx
+    tt <- try({
+        ns <- loadNamespace(package, c(which.lib.loc, lib.loc),
+            keep.source = keep.source)
+        dataPath <- file.path(which.lib.loc, package, "data")
+        env <- attachNamespace(ns, pos = pos,
+            dataPath = dataPath, deps)
+    })
+    xxx
+}
+
+foo <- function(){
+    xxx
+    paths <- c(paths,
+        dirs[file.info(dirs)$isdir &
+            file.exists(file.path(dirs,
+                    "DESCRIPTION"))])
+    xxx
+    if(nzchar(r_arch)
+        ## back-compatibility fix: remove before 2.12.0
+        ## && (.Platform$OS.type != "windows" || r_arch != "i386")
+        && file.exists(file.path(pkgpath, "libs"))
+        && !file.exists(file.path(pkgpath, "libs", r_arch)))
+        stop(gettextf("package '%s' is not installed for 'arch=%s'",
+                pkgname, r_arch),
+            call. = FALSE, domain = NA)
+    xxx
+    if(!package %in% c("datasets", "grDevices", "graphics", "methods",
+            "splines", "stats", "stats4", "tcltk", "tools",
+            "utils") &&
+        isTRUE(getOption("checkPackageLicense", FALSE)))
+        checkLicense(package, pkgInfo, pkgpath)
+    xxx
+    res <- .Fortran("dqrdc2",
+        qr=x,
+        n,
+        n,
+        p,
+        as.double(tol),
+        rank=integer(1L),
+        qraux = double(p),
+        pivot = as.integer(1L:p),
+        double(2*p),
+        PACKAGE="base")[c(1,6,7,8)]# c("qr", "rank", "qraux", "pivot")
+    if(!is.null(cn <- colnames(x)))
+        colnames(res$qr) <- cn[res$pivot]
+    class(res) <- "qr"
+    res
+}
+
+if(TRUE){
+    x <- xx[, c("abc", "bdc", "cde", "def", "efg", "fgh", "ghi", "hij", "ijk",
+        "jkl", "klm", "lmn", "mno", "nop")]
+    x <- NULL
+}
+
+test <- this('the function works',
+    {
+        x <- 0
+    })
+
+test <- this('the function works', {
+                 x <- 0
+    })
+
+test_that('the function works',
+    {
+        x <- 0
+    })
+
+test_that('the function works', {
+              x <- 0
+    })
+
+############################################################################
+## indent/r.vim starts to make mistakes here
+
+test <- this('the function works',
+    {
+        x <- 0
+    }
+)
+
+that('the function works', {
+         x <- 0
+    }
+)
+
+test_that('my unit test', {
+              if (some <- condition)
+                  result
+              else
+                  other <- result
+    }
+)
+
+data.frame <- function(..., row.names = NULL, check.rows = FALSE, check.names = TRUE,
+    stringsAsFactors = default.stringsAsFactors())
+{
+    data.row.names <-
+        if(check.rows && is.null(row.names))
+            function(current, new, i) {
+                if(is.character(current)) new <- as.character(new)
+                stop(gettextf("mismatch of row names in arguments of 'data.frame\', item %d", i), domain = NA)
+            }
+        else function(current, new, i) {
+            if(is.null(current)) {
+                if(anyDuplicated(new)) {
+                    warning("some row.names duplicated: ",
+                        paste(which(duplicated(new)), collapse=","),
+                        " --> row.names NOT used")
+                    current
+                } else new
+            } else current
+        }
+    xxx
+}
+
+
+foo <- function(){
+    xxx
+    if (ismat) for (i in seq_len(differences)) r <- r[i1, , drop = FALSE] -
+        r[-nrow(r):-(nrow(r) - lag + 1), , drop = FALSE]
+    else for (i in seq_len(differences))
+        r <- r[i1] - r[-length(r):-(length(r) - lag + 1L)]
+    r
+    if(is.null(width)) width <- 0L
+    else if(width < 0L) { flag <- "-"; width <- -width }
+    format.default(x, width=width,
+        justify = if(flag=="-") "left" else "right")
+    xxx
+}
+
+try <- function(expr, silent = FALSE) {
+    if(file == "") file <- stdin()
+    else {
+        if (isTRUE(keep.source))
+            srcfile <- srcfile(file, encoding = encoding)
+        file <- file(file, "r", encoding = encoding)
+    }
+    xxx
+    tryCatch(expr, error = function(e) {
+            call <- conditionCall(e)
+            xxx
+        },
+        xxx)
+    xxx
+    levels(f) <- ## nl == nL or 1
+        if (nl == nL) as.character(labels)
+        else paste(labels, seq_along(levels), sep="")
+    class(f) <- c(if(ordered)"ordered", "factor")
+    f
+}
+
+x <- 1 + 2 + 3 +
+    4 + 5
+x <- 1 - 2 - 3 -
+    4 - 5
+x <- 1 * 2 * 3 *
+    4 * 5
+x <- 1 / 2 / 3 /
+    4 / 5
+
+cat("The End\n")
+
+## vim: expandtab sw=4 cursorcolumn

From 139900faf0c5fa7fad99e050ee3552da1e636c10 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Mon, 3 Nov 2014 09:43:12 -0500
Subject: [PATCH 0805/1050] Calculate the value of bb only if necessary.

---
 indent/r.vim | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/indent/r.vim b/indent/r.vim
index fd18c0b..f45f9cd 100644
--- a/indent/r.vim
+++ b/indent/r.vim
@@ -1,7 +1,7 @@
 " Vim indent file
 " Language:	R
 " Author:	Jakson Alves de Aquino 
-" Last Change:	Sun Nov 02, 2014  01:25PM
+" Last Change:	Sun Nov 02, 2014  01:56PM
 
 
 " Only load this indent file when no other was loaded.
@@ -293,9 +293,8 @@ function GetRIndent()
     return s:Get_last_paren_idx(line, '(', ')', pb) + &sw
   endif
 
-  let bb = s:Get_paren_balance(line, '[', ']')
-
   if g:r_indent_align_args == 1
+    let bb = s:Get_paren_balance(line, '[', ']')
 
     if pb == 0 && bb == 0 && (line =~ '.*[,&|\-\*+<>]$' || cline =~ '^\s*[,&|\-\*+<>]')
       return indent(lnum)

From d7fecdd650ce332e0789448aa26bbc0896f7516f Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Mon, 3 Nov 2014 09:44:25 -0500
Subject: [PATCH 0806/1050] Add translation for language "da".

---
 syntax/rout.vim | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/syntax/rout.vim b/syntax/rout.vim
index 9b928a6..1dd607c 100644
--- a/syntax/rout.vim
+++ b/syntax/rout.vim
@@ -1,7 +1,7 @@
 " Vim syntax file
 " Language:    R output Files
 " Maintainer:  Jakson Aquino 
-" Last Change: Sat Nov 09, 2013  07:29PM
+" Last Change: Sun Nov 02, 2014  08:47PM
 "
 
 " Version Clears: {{{1
@@ -71,6 +71,11 @@ syn match routIndex /^\s*\[\d\+\]/
 syn match routError "^Error.*"
 syn match routWarn "^Warning.*"
 
+if v:lang =~ "^da"
+    syn match routError	"^Fejl.*"
+    syn match routWarn	"^Advarsel.*"
+endif
+
 if v:lang =~ "^de"
     syn match routError	"^Fehler.*"
     syn match routWarn	"^Warnung.*"

From 90cc4e83d1c564b2e67f2336ed34318af202d64b Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Mon, 3 Nov 2014 10:15:04 -0500
Subject: [PATCH 0807/1050] Fix the expected indentation of some lines.

---
 r-plugin/indent_test_noalign.R | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/r-plugin/indent_test_noalign.R b/r-plugin/indent_test_noalign.R
index 35c4819..a51030d 100644
--- a/r-plugin/indent_test_noalign.R
+++ b/r-plugin/indent_test_noalign.R
@@ -522,22 +522,22 @@ test <- this('the function works',
         x <- 0
     })
 
-test <- this('the function works', {
-                 x <- 0
-    })
-
 test_that('the function works',
     {
         x <- 0
     })
 
-test_that('the function works', {
-              x <- 0
-    })
-
 ############################################################################
 ## indent/r.vim starts to make mistakes here
 
+test <- this('the function works', {
+        x <- 0
+    })
+
+test_that('the function works', {
+        x <- 0
+    })
+
 test <- this('the function works',
     {
         x <- 0
@@ -545,15 +545,15 @@ test <- this('the function works',
 )
 
 that('the function works', {
-         x <- 0
+        x <- 0
     }
 )
 
 test_that('my unit test', {
-              if (some <- condition)
-                  result
-              else
-                  other <- result
+        if (some <- condition)
+            result
+        else
+             other <- result
     }
 )
 

From 4fe9861b68fbdbdde51eda1d5f855fd5f673c6c9 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Mon, 3 Nov 2014 11:31:09 -0500
Subject: [PATCH 0808/1050] Minor change.

---
 indent/r.vim | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/indent/r.vim b/indent/r.vim
index f45f9cd..39f037c 100644
--- a/indent/r.vim
+++ b/indent/r.vim
@@ -1,7 +1,7 @@
 " Vim indent file
 " Language:	R
 " Author:	Jakson Alves de Aquino 
-" Last Change:	Sun Nov 02, 2014  01:56PM
+" Last Change:	Mon Nov 03, 2014  11:29AM
 
 
 " Only load this indent file when no other was loaded.
@@ -289,11 +289,12 @@ function GetRIndent()
   endif
 
   let s:curtabstop = repeat(' ', &tabstop)
-  if pb > 0 && line =~ '{$'
-    return s:Get_last_paren_idx(line, '(', ')', pb) + &sw
-  endif
 
   if g:r_indent_align_args == 1
+    if pb > 0 && line =~ '{$'
+      return s:Get_last_paren_idx(line, '(', ')', pb) + &sw
+    endif
+
     let bb = s:Get_paren_balance(line, '[', ']')
 
     if pb == 0 && bb == 0 && (line =~ '.*[,&|\-\*+<>]$' || cline =~ '^\s*[,&|\-\*+<>]')

From 5ef5138a77ef614e7584e6eb2f7f5b82169a3296 Mon Sep 17 00:00:00 2001
From: Michel 
Date: Tue, 4 Nov 2014 11:40:13 +0100
Subject: [PATCH 0809/1050] fixed typo for roxygen docs

---
 syntax/r.vim | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/syntax/r.vim b/syntax/r.vim
index 57b00dd..6f88b9a 100644
--- a/syntax/r.vim
+++ b/syntax/r.vim
@@ -39,7 +39,7 @@ syn match rOKeyword contained "@\(S3method\|TODO\|aliases\|alias\|assignee\|auth
 syn match rOKeyword contained "@\(callGraphPrimitives\|concept\|exportClass\|exportMethod\|exportPattern\|export\|formals\)"
 syn match rOKeyword contained "@\(format\|importClassesFrom\|importFrom\|importMethodsFrom\|import\|keywords\|useDynLib\)"
 syn match rOKeyword contained "@\(method\|noRd\|note\|references\|seealso\|setClass\|slot\|source\|title\|usage\)"
-syn match rOKeyword contained "@\(family\|template\|templateVar\|description\|details\|inheritsParams\)"
+syn match rOKeyword contained "@\(family\|template\|templateVar\|description\|details\|inheritParams\)"
 syn match rOComment contains=@Spell,rOKeyword "#'.*"
 
 

From bd590899ba154cedc66748f26bcfdece150deef7 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Tue, 4 Nov 2014 22:52:36 -0500
Subject: [PATCH 0810/1050] Make adjustments in python code. Use
 sys.stdout.write() and sys.stderr.write() instead of print because print in
 Python 3 has a different syntax from Python 2. Don't use Python module
 'logging'. Avoid the use :python command because it may not work well with
 Neovim.

---
 ftplugin/rnoweb_rplugin.vim         | 17 +++++++++-
 r-plugin/common_global.vim          | 52 ++++++++++++++---------------
 r-plugin/nvimcom.py                 | 28 ++++++++--------
 r-plugin/nvimserver.py              | 18 +++++-----
 r-plugin/synctex_evince_backward.py | 39 ++++++++--------------
 5 files changed, 79 insertions(+), 75 deletions(-)

diff --git a/ftplugin/rnoweb_rplugin.vim b/ftplugin/rnoweb_rplugin.vim
index dc1685a..a93a9ff 100644
--- a/ftplugin/rnoweb_rplugin.vim
+++ b/ftplugin/rnoweb_rplugin.vim
@@ -463,7 +463,12 @@ function! SyncTeX_forward()
     if g:rplugin_pdfviewer == "okular"
         call system("okular --unique " . basenm . ".pdf#src:" . texln . expand("%:p:h") . "/./" . basenm . ".tex 2> /dev/null >/dev/null &")
     elseif g:rplugin_pdfviewer == "evince"
-        call system("python " . g:rplugin_home . "/r-plugin/synctex_evince_forward.py " . basenm . ".pdf " . texln . " '" . basenm . ".tex' 2> /dev/null >/dev/null &")
+        if has("nvim")
+            call jobstart("RnwSyncFor", "python", [g:rplugin_home . "/r-plugin/synctex_evince_forward.py",  basenm . ".pdf", string(texln), basenm . ".tex"])
+            autocmd JobActivity RnwSyncFor call Handle_SyncTeX_forward()
+        else
+            call system("python " . g:rplugin_home . "/r-plugin/synctex_evince_forward.py " . basenm . ".pdf " . texln . " '" . basenm . ".tex' 2> /dev/null >/dev/null &")
+        endif
         if g:rplugin_has_wmctrl
             call system("wmctrl -a '" . basenm . ".pdf'")
         endif
@@ -537,6 +542,16 @@ function! Run_SyncTeX()
     exe "cd " . substitute(olddir, ' ', '\\ ', 'g')
 endfunction
 
+function! Handle_SyncTeX_forward()
+    if v:job_data[1] == 'stdout'
+        call RWarningMsg("SyncTeX forward [1]: " . v:job_data[2])
+    elseif v:job_data[1] == 'stderr'
+        call RWarningMsg(v:job_data[2])
+    else
+        let g:rplugin_stx_job = 0
+    endif
+endfunction
+
 function! Handle_SyncTeX_backward()
     if v:job_data[1] == 'stdout'
         let fname = substitute(v:job_data[2], '|.*', '', '') 
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index ffea3c9..30d99fb 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -1407,7 +1407,7 @@ function RFormatCode() range
         let wco = 180
     endif
     call delete($VIMRPLUGIN_TMPDIR . "/eval_reply")
-    call g:SendToVimCom("\x08" . $VIMINSTANCEID . 'formatR::tidy.source("' . $VIMRPLUGIN_TMPDIR . '/unformatted_code", file = "' . $VIMRPLUGIN_TMPDIR . '/formatted_code", width.cutoff = ' . wco . ')', "I")
+    call g:SendToVimCom("\x08" . $VIMINSTANCEID . 'formatR::tidy_source("' . $VIMRPLUGIN_TMPDIR . '/unformatted_code", file = "' . $VIMRPLUGIN_TMPDIR . '/formatted_code", width.cutoff = ' . wco . ')', "I")
     let g:rplugin_lastev = ReadEvalReply()
     if g:rplugin_lastev == "R is busy." || g:rplugin_lastev == "UNKNOWN" || g:rplugin_lastev =~ "^Error" || g:rplugin_lastev == "INVALID" || g:rplugin_lastev == "ERROR" || g:rplugin_lastev == "EMPTY" || g:rplugin_lastev == "No reply"
         call RWarningMsg(g:rplugin_lastev)
@@ -2443,6 +2443,7 @@ function ShowRDoc(rkeyword, package, getclass)
     let b:objbrtitle = g:tmp_objbrtitle
     let g:rplugin_tmuxsname = g:tmp_tmuxsname
     unlet g:tmp_objbrtitle
+    unlet g:tmp_tmuxsname
 
     let save_unnamed_reg = @@
     sil normal! ggdG
@@ -3574,7 +3575,6 @@ function RClientEvent()
     if v:job_data[1] == 'stdout'
         let cmd = substitute(v:job_data[2], "\n$", "", "")
         exe cmd
-        let g:last_clt_output = cmd
     elseif v:job_data[1] == 'stderr'
         let str = 'nvimcom.py error: ' . v:job_data[2]
         call RWarningMsg(str)
@@ -3586,7 +3586,6 @@ endfunction
 function RServerEvent()
     if v:job_data[1] == 'stdout'
         let cmd = substitute(v:job_data[2], "\n$", "", "")
-        let g:last_svr_output = cmd
         if cmd =~ "^call " || cmd  =~ "^let "
             exe cmd
         elseif len(cmd) > 0
@@ -3605,7 +3604,6 @@ function SendToVimCom_Vim(...)
 endfunction
 
 function SendToVimCom_Neovim(...)
-    let g:nvimcom_py_Input = a:1
     if a:0 == 2 && a:2 == "I"
         " Ignore reply due to https://github.com/neovim/neovim/issues/834
         call jobsend(g:rplugin_clt_job, "SendToVimCom I\002" . a:1 . "\n")
@@ -3985,6 +3983,28 @@ let g:rplugin_synctexpid = 0
 let g:rplugin_stx_job = 0
 let g:rplugin_zathura_pid = {}
 
+function GetRandomNumber()
+    if executable("python")
+        let pycode = ["import os",
+                    \ "import base64",
+                    \ "import sys",
+                    \ "sys.stdout.write(base64.b64encode(os.urandom(16)).decode())" ]
+        call writefile(pycode, $VIMRPLUGIN_TMPDIR . "/getRandomNumber.py")
+        let randnum = system("python " . $VIMRPLUGIN_TMPDIR . "/getRandomNumber.py")
+    elseif has("python") || has("python3")
+        Py import os
+        Py import base64
+        Py import vim
+        Py vim.command("let g:rplugin_random = '" + base64.b64encode(os.urandom(16)).decode() + "'")
+        let randnum = g:rplugin_random
+        unlet g:rplugin_random
+    elseif !has("win32") && !has("win64") && !has("gui_win32") && !has("gui_win64")
+        let randnum = system("echo $RANDOM")
+    else
+        let randnum = localtime()
+    endif
+    return substitute(randnum, '\W', '', 'g')
+endfunction
 
 " If this is the Object Browser running in a Tmux pane, $VIMINSTANCEID is
 " already defined and shouldn't be changed
@@ -3993,31 +4013,11 @@ if &filetype == "rbrowser"
         call RWarningMsgInp("VIMINSTANCEID is undefined")
     endif
 else
-    if has("python") || has("python3")
-        Py import os
-        Py import base64
-        Py import vim
-        Py vim.command("let g:rplugin_random = '" + base64.b64encode(os.urandom(16)).decode() + "'")
-        let $VIMRPLUGIN_SECRET = substitute(g:rplugin_random, '\W', '', 'g')
-        Py vim.command("let g:rplugin_random = '" + base64.b64encode(os.urandom(16)).decode() + "'")
-    endif
-    if !exists("g:rplugin_random")
-        if !has("win32") && !has("win64") && !has("gui_win32") && !has("gui_win64")
-            let g:rplugin_random = system("echo $RANDOM")
-        endif
-        if exists("g:rplugin_random")
-            let $VIMRPLUGIN_SECRET = substitute(g:rplugin_random, '\W', '', 'g')
-            let g:rplugin_random = system("echo $RANDOM")
-        else
-            let $VIMRPLUGIN_SECRET = substitute(strftime("%c"), '\W', '', 'g')
-            let g:rplugin_random = localtime()
-        endif
-    endif
-    let $VIMINSTANCEID = substitute(g:rplugin_firstbuffer . g:rplugin_random, '\W', '', 'g')
+    let $VIMRPLUGIN_SECRET = GetRandomNumber()
+    let $VIMINSTANCEID = substitute(g:rplugin_firstbuffer . GetRandomNumber(), '\W', '', 'g')
     if strlen($VIMINSTANCEID) > 64
         let $VIMINSTANCEID = substitute($VIMINSTANCEID, '.*\(...............................................................\)', '\1', '')
     endif
-    unlet g:rplugin_random
 endif
 
 let g:rplugin_obsname = toupper(substitute(substitute(expand("%:r"), '\W', '', 'g'), "_", "", "g"))
diff --git a/r-plugin/nvimcom.py b/r-plugin/nvimcom.py
index 566a3d2..04ac40b 100644
--- a/r-plugin/nvimcom.py
+++ b/r-plugin/nvimcom.py
@@ -17,13 +17,13 @@ def DiscoverVimComPort():
     repl = "NOTHING"
     vii = os.getenv("VIMINSTANCEID")
     if vii is None:
-        print "call RWarningMsg('VIMINSTANCEID not found by nvimcom.py.')\n"
-        sys.stdout.flush()
+        sys.stderr.write("VIMINSTANCEID not found.")
+        sys.stderr.flush()
         return
     scrt = os.getenv("VIMRPLUGIN_SECRET")
     if scrt is None:
-        print "call RWarningMsg('VIMRPLUGIN_SECRET not found by nvimcom.py.')\n"
-        sys.stdout.flush()
+        sys.stderr.write("VIMRPLUGIN_SECRET not found")
+        sys.stderr.flush()
         return
 
     while repl.find(scrt) < 0 and VimComPort < 10049:
@@ -52,18 +52,18 @@ def DiscoverVimComPort():
         VimComPort = 0
         if not PortWarn:
             PortWarn = True
-            print "let g:rplugin_vimcomport = 0\n"
-            sys.stdout.flush()
-            print "call RWarningMsg('VimCom port not found.')\n"
+            sys.stdout.write("let g:rplugin_vimcomport = 0\n")
             sys.stdout.flush()
+            sys.stderr.write("VimCom port not found.")
+            sys.stderr.flush()
         return
     else:
-        print "let g:rplugin_vimcomport = " + str(VimComPort) + "\n"
+        sys.stdout.write("let g:rplugin_vimcomport = " + str(VimComPort) + "\n")
         sys.stdout.flush()
         PortWarn = False
         if repl.find("1.0-5") != 0:
-            print "call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.0-5.')\n"
-            sys.stdout.flush()
+            sys.stderr.write("This version of Vim-R-plugin requires vimcom 1.0-5.")
+            sys.stderr.flush()
         return
 
 
@@ -111,11 +111,13 @@ def SendToVimCom(aString):
             printreply = True
         rpl = SendToVimCom(line)
         if printreply:
-            print "let g:rplugin_lastrpl = '" + rpl + "'\n"
+            sys.stdout.write("let g:rplugin_lastrpl = '" + rpl + "'\n")
+            sys.stdout.flush()
     else:
         if line.find("DiscoverVimComPort") != -1:
             DiscoverVimComPort()
         else:
-            print "call RWarningMsg('nvimcom.py: Unknown command: '" + line + "'.\n"
-    sys.stdout.flush()
+            sys.stderr.write("Unknown command: '" + line + "'.")
+            sys.stderr.flush()
+
 
diff --git a/r-plugin/nvimserver.py b/r-plugin/nvimserver.py
index 7a8b308..43408a7 100644
--- a/r-plugin/nvimserver.py
+++ b/r-plugin/nvimserver.py
@@ -22,27 +22,27 @@ def NeovimServer():
 
     if sock == None:
         MyPort = 0
-        print "RWarningMsg('Could not bind to any port.')\n"
-        sys.stdout.flush()
+        sys.stderr.write("Could not bind to any port.")
+        sys.stderr.flush()
         return
     else:
-        print "RSetMyPort(" + str(MyPort) + ")\n"
+        sys.stdout.write("RSetMyPort(" + str(MyPort) + ")\n")
         sys.stdout.flush()
 
     while FinishNow == False:
         try:
             data, addr = sock.recvfrom( 1024 ) # buffer size is 1024 bytes
             if re.match(VimSecret, data):
-                print re.sub(VimSecret, "", data) + "\n"
+                sys.stdout.write(re.sub(VimSecret, "", data) + "\n")
                 sys.stdout.flush()
             else:
                 if data != "":
-                    print "RWarningMsg('Strange string received: " + '"' + data + '"' + "')\n"
-                    sys.stdout.flush()
+                    sys.stderr.write('Strange string received: "' + data + '"')
+                    sys.stderr.flush()
 
         except Exception as errmsg:
-            print "RWarningMsg('Server failed to read data: " + str(errmsg) + "')\n"
-            sys.stdout.flush()
+            sys.stderr.write('Server failed to read data: "' + str(errmsg) + '"')
+            sys.stderr.flush()
             MyPort = 0
             try:
                 sock.shutdown(socket.SHUT_RD)
@@ -60,7 +60,7 @@ def NeovimServer():
                 sock = socket.socket( socket.AF_INET, socket.SOCK_DGRAM )
                 sock.bind( (UDP_IP,MyPort) )
             except Exception as errmsg:
-                print "let g:rplugin_myport = 0 | call RWarningMsg('" + str(errmsg) + "')\n"
+                sys.stdout.write("let g:rplugin_myport = 0 | call RWarningMsg('" + str(errmsg) + "')\n")
                 sys.stdout.flush()
                 pass
 
diff --git a/r-plugin/synctex_evince_backward.py b/r-plugin/synctex_evince_backward.py
index 6c28495..d51116b 100644
--- a/r-plugin/synctex_evince_backward.py
+++ b/r-plugin/synctex_evince_backward.py
@@ -20,7 +20,7 @@
 # Modified to Vim-R-plugin by Jakson Aquino
 
 import dbus, subprocess, time
-import dbus.mainloop.glib, sys, os, logging
+import dbus.mainloop.glib, sys, os, signal
 from gi.repository import GObject
 
 RUNNING, CLOSED = range(2)
@@ -39,8 +39,7 @@ class EvinceWindowProxy:
     daemon = None
     bus = None
 
-    def __init__(self, uri, spawn = False, logger = None):
-        self._log = logger
+    def __init__(self, uri, spawn = False):
         self.uri = uri
         self.spawn = spawn
         self.status = CLOSED
@@ -60,9 +59,9 @@ def __init__(self, uri, spawn = False, logger = None):
             self._get_dbus_name(False)
 
         except dbus.DBusException:
-            if self._log:
-                self._log.debug("Could not connect to the Evince Daemon")
-                loop.quit()
+            sys.stderr.write("Could not connect to the Evince Daemon")
+            sys.stderr.flush()
+            loop.quit()
 
     def _on_doc_loaded(self, uri, **keyargs):
         if uri == self.uri and self._handler is None:
@@ -75,8 +74,8 @@ def _get_dbus_name(self, spawn):
                      dbus_interface = EV_DAEMON_IFACE)
 
     def handle_find_document_error(self, error):
-        if self._log:
-            self._log.debug("FindDocument DBus call has failed")
+        sys.stderr.write("FindDocument DBus call has failed")
+        sys.stderr.flush()
 
     def handle_find_document_reply(self, evince_name):
         if self._handler is not None:
@@ -92,8 +91,8 @@ def handle_find_document_reply(self, evince_name):
                           error_handler = self.handle_get_window_list_error)
 
     def handle_get_window_list_error (self, e):
-        if self._log:
-            self._log.debug("GetWindowList DBus call has failed")
+        sys.stderr.write("GetWindowList DBus call has failed")
+        sys.stderr.flush()
 
     def handle_get_window_list_reply (self, window_list):
         if len(window_list) > 0:
@@ -103,8 +102,8 @@ def handle_get_window_list_reply (self, window_list):
             self.window.connect_to_signal("SyncSource", self.on_sync_source)
         else:
             #That should never happen. 
-            if self._log:
-                self._log.debug("GetWindowList returned empty list")
+            sys.stderr.write("GetWindowList returned empty list")
+            sys.stderr.flush()
 
     def on_window_close(self):
         self.window = None
@@ -112,15 +111,12 @@ def on_window_close(self):
 
     def on_sync_source(self, input_file, source_link, timestamp):
         if vimnm == "nvim":
-            print input_file + "|" + str(source_link[0]) + "\n"
+            sys.stdout.write(input_file + "|" + str(source_link[0]) + "\n")
             sys.stdout.flush()
         else:
             os.system(vimexec + ' --servername ' + vimnm + ' --remote-expr "' + "SyncTeX_backward('" + input_file + "', " + str(source_link[0]) + ')"')
 
-
 path_output = os.getcwd() + '/' + sys.argv[1]
-if not os.path.isfile(path_output):
-    print "Error file not found: " + path_output
 
 vimnm = sys.argv[2]
 if vimnm != "nvim":
@@ -133,17 +129,8 @@ def on_sync_source(self, input_file, source_link, timestamp):
 
 
 dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
-logger = logging.getLogger("evince_dbus")
-logger.setLevel(logging.DEBUG)
-ch = logging.StreamHandler()
-ch.setLevel(logging.DEBUG)
-
-formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
-
-ch.setFormatter(formatter)
 
-logger.addHandler(ch)    
-a = EvinceWindowProxy('file://' + path_output, True,logger=logger)
+a = EvinceWindowProxy('file://' + path_output, True)
 
 loop = GObject.MainLoop()
 loop.run() 

From 51b67b7da8e1701a49399f645a3fa0f006b7845c Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Tue, 4 Nov 2014 22:56:00 -0500
Subject: [PATCH 0811/1050] Make adjustments in Python code. Add missing file
 in last commit.

---
 r-plugin/synctex_evince_forward.py | 32 ++++++++++--------------------
 1 file changed, 11 insertions(+), 21 deletions(-)

diff --git a/r-plugin/synctex_evince_forward.py b/r-plugin/synctex_evince_forward.py
index b19afa9..ee4fc35 100644
--- a/r-plugin/synctex_evince_forward.py
+++ b/r-plugin/synctex_evince_forward.py
@@ -20,7 +20,7 @@
 # Modified to Vim-R-plugin by Jakson Aquino
 
 import dbus, subprocess, time
-import dbus.mainloop.glib, sys, os, logging
+import dbus.mainloop.glib, sys, os
 from gi.repository import GObject
 
 RUNNING, CLOSED = range(2)
@@ -41,8 +41,7 @@ class EvinceWindowProxy:
     daemon = None
     bus = None
 
-    def __init__(self, uri, spawn = False, logger = None):
-        self._log = logger
+    def __init__(self, uri, spawn = False):
         self.uri = uri
         self.spawn = spawn
         self.status = CLOSED
@@ -63,8 +62,8 @@ def __init__(self, uri, spawn = False, logger = None):
             self._get_dbus_name(False)
 
         except dbus.DBusException:
-            if self._log:
-                self._log.debug("Could not connect to the Evince Daemon")
+            sys.stderr.write("Could not connect to the Evince Daemon")
+            sys.stderr.flush()
 
     def _on_doc_loaded(self, uri, **keyargs):
         if uri == self.uri and self._handler is None:
@@ -77,8 +76,8 @@ def _get_dbus_name(self, spawn):
                      dbus_interface = EV_DAEMON_IFACE)
 
     def handle_find_document_error(self, error):
-        if self._log:
-            self._log.debug("FindDocument DBus call has failed")
+        sys.stderr.write("FindDocument DBus call has failed")
+        sys.stderr.flush()
 
     def handle_find_document_reply(self, evince_name):
         if self._handler is not None:
@@ -94,8 +93,8 @@ def handle_find_document_reply(self, evince_name):
                           error_handler = self.handle_get_window_list_error)
 
     def handle_get_window_list_error (self, e):
-        if self._log:
-            self._log.debug("GetWindowList DBus call has failed")
+        sys.stderr.write("GetWindowList DBus call has failed")
+        sys.stderr.flush()
 
     def handle_get_window_list_reply (self, window_list):
         if len(window_list) > 0:
@@ -103,8 +102,8 @@ def handle_get_window_list_reply (self, window_list):
             self.window = dbus.Interface(window_obj,EV_WINDOW_IFACE)
         else:
             #That should never happen. 
-            if self._log:
-                self._log.debug("GetWindowList returned empty list")
+            sys.stderr.write("GetWindowList returned empty list")
+            sys.stderr.flush()
 
 
     def SyncView(self, input_file, data, time):
@@ -131,17 +130,8 @@ def _syncview_handler(self, window_list):
 path_input   = os.getcwd() + '/' + sys.argv[3]
 
 dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
-logger = logging.getLogger("evince_dbus")
-logger.setLevel(logging.DEBUG)
-ch = logging.StreamHandler()
-ch.setLevel(logging.DEBUG)
 
-formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
-
-ch.setFormatter(formatter)
-
-logger.addHandler(ch)    
-a = EvinceWindowProxy('file://' + path_output, True,logger=logger)
+a = EvinceWindowProxy('file://' + path_output, True)
 
 def sync_view(ev_window, path_input, line_number):
     ev_window.SyncView(path_input, (line_number, 1), 0)

From 9c344be6156f7d62ad6320cc12f8ee53782f1bc7 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Wed, 5 Nov 2014 10:51:43 -0500
Subject: [PATCH 0812/1050] New command: gt Do gt to
 jump from the Rnoweb source to the corresponding line in the LaTeX output (in
 SyncTeX is working).

---
 ftplugin/rnoweb_rplugin.vim | 74 +++++++++++++++++++++++--------------
 r-plugin/common_global.vim  |  3 +-
 2 files changed, 49 insertions(+), 28 deletions(-)

diff --git a/ftplugin/rnoweb_rplugin.vim b/ftplugin/rnoweb_rplugin.vim
index a93a9ff..4a4fcc0 100644
--- a/ftplugin/rnoweb_rplugin.vim
+++ b/ftplugin/rnoweb_rplugin.vim
@@ -212,13 +212,14 @@ call RCreateMaps("nvi", 'RBibTeX',      'sb', ':call RMakePDF("bibtex", 0)
 call RCreateMaps("nvi", 'RKnit',        'kn', ':call RKnitRnw()')
 call RCreateMaps("nvi", 'RMakePDFK',    'kp', ':call RMakePDF("nobib", 1)')
 call RCreateMaps("nvi", 'RBibTeXK',     'kb', ':call RMakePDF("bibtex", 1)')
-call RCreateMaps("nvi", 'ROpenPDF',     'op', ':call ROpenPDF("Get Master")')
 call RCreateMaps("nvi", 'RIndent',      'si', ':call RnwToggleIndentSty()')
 call RCreateMaps("ni",  'RSendChunk',   'cc', ':call b:SendChunkToR("silent", "stay")')
 call RCreateMaps("ni",  'RESendChunk',  'ce', ':call b:SendChunkToR("echo", "stay")')
 call RCreateMaps("ni",  'RDSendChunk',  'cd', ':call b:SendChunkToR("silent", "down")')
 call RCreateMaps("ni",  'REDSendChunk', 'ca', ':call b:SendChunkToR("echo", "down")')
+call RCreateMaps("nvi", 'ROpenPDF',     'op', ':call ROpenPDF("Get Master")')
 call RCreateMaps("ni",  'RSyncFor',     'gp', ':call SyncTeX_forward()')
+call RCreateMaps("ni",  'RSyncFor',     'gt', ':call SyncTeX_forward(1)')
 nmap  gn :call RnwNextChunk()
 nmap  gN :call RnwPreviousChunk()
 
@@ -302,6 +303,34 @@ function! SyncTeX_readconc(basenm)
     return {"texlnum": lstexln, "rnwfile": lsrnwf, "rnwline": lsrnwl}
 endfunction
 
+function! GoToBuf(rnwbn, rnwf, basedir, rnwln)
+    if bufname("%") != a:rnwbn
+        if bufloaded(a:basedir . '/' . a:rnwf)
+            let savesb = &switchbuf
+            set switchbuf=useopen,usetab
+            exe "sb " . substitute(a:basedir . '/' . a:rnwf, ' ', '\\ ', 'g')
+            exe "set switchbuf=" . savesb
+        elseif bufloaded(a:rnwf)
+            let savesb = &switchbuf
+            set switchbuf=useopen,usetab
+            exe "sb " . substitute(a:rnwf, ' ', '\\ ', 'g')
+            exe "set switchbuf=" . savesb
+        else
+            if filereadable(a:basedir . '/' . a:rnwf)
+                exe "tabnew " . substitute(a:basedir . '/' . a:rnwf, ' ', '\\ ', 'g')
+            elseif filereadable(a:rnwf)
+                exe "tabnew " . substitute(a:rnwf, ' ', '\\ ', 'g')
+            else
+                call RWarningMsg('Could not find either "' . a:rnwbn . ' or "' . a:rnwf . '" in "' . a:basedir . '".')
+                return 0
+            endif
+        endif
+    endif
+    exe a:rnwln
+    redraw
+    return 1
+endfunction
+
 function! SyncTeX_backward(fname, ln)
     let flnm = substitute(a:fname, 'file://', '', '') " Evince
     let flnm = substitute(flnm, '/\./', '/', '')      " Okular
@@ -312,6 +341,10 @@ function! SyncTeX_backward(fname, ln)
         let basedir = '.'
     endif
     if filereadable(basenm . "-concordance.tex")
+        if !filereadable(basenm . ".tex")
+            call RWarningMsg('SyncTeX [Vim-R-plugin]: "' . basenm . '.tex" not found.')
+            return
+        endif
         let concdata = SyncTeX_readconc(basenm)
         let texlnum = concdata["texlnum"]
         let rnwfile = concdata["rnwfile"]
@@ -343,36 +376,12 @@ function! SyncTeX_backward(fname, ln)
     let rnwbn = substitute(rnwf, '.*/', '', '')
     let rnwf = substitute(rnwf, '^\./', '', '')
 
-    if bufname("%") != rnwbn
-        if bufloaded(basedir . '/' . rnwf)
-            let savesb = &switchbuf
-            set switchbuf=useopen,usetab
-            exe "sb " . substitute(basedir . '/' . rnwf, ' ', '\\ ', 'g')
-            exe "set switchbuf=" . savesb
-        elseif bufloaded(rnwf)
-            let savesb = &switchbuf
-            set switchbuf=useopen,usetab
-            exe "sb " . substitute(rnwf, ' ', '\\ ', 'g')
-            exe "set switchbuf=" . savesb
-        else
-            if filereadable(basedir . '/' . rnwf)
-                exe "tabnew " . substitute(basedir . '/' . rnwf, ' ', '\\ ', 'g')
-            elseif filereadable(rnwf)
-                exe "tabnew " . substitute(rnwf, ' ', '\\ ', 'g')
-            else
-                call RWarningMsg('Could not find either "' . rnwbn . ' or "' . rnwf . '" in "' . basedir . '".')
-                return
-            endif
-        endif
-    endif
-    exe rnwln
-    redraw
-    if g:rplugin_has_wmctrl
+    if GoToBuf(rnwbn, rnwf, basedir, rnwln) && g:rplugin_has_wmctrl
         call system("wmctrl -xa " . g:vimrplugin_vim_window)
     endif
 endfunction
 
-function! SyncTeX_forward()
+function! SyncTeX_forward(...)
     let basenm = expand("%:t:r")
     let lnum = 0
     let rnwf = expand("%:t")
@@ -421,6 +430,11 @@ function! SyncTeX_forward()
         endif
     endif
 
+    if !filereadable(basenm . ".tex")
+        call RWarningMsg('"' . basenm . '.tex" not found.')
+        exe "cd " . substitute(olddir, ' ', '\\ ', 'g')
+        return
+    endif
     let concdata = SyncTeX_readconc(basenm)
     let texlnum = concdata["texlnum"]
     let rnwfile = concdata["rnwfile"]
@@ -446,6 +460,12 @@ function! SyncTeX_forward()
         let basedir = ''
     endif
 
+    if a:0 && a:1
+        call GoToBuf(basenm . ".tex", basenm . ".tex", basedir, texln)
+        exe "cd " . substitute(olddir, ' ', '\\ ', 'g')
+        return
+    endif
+
     if !filereadable(basenm . ".pdf")
         call RWarningMsg('SyncTeX forward cannot be done because the file "' . basenm . '.pdf" is missing.')
         exe "cd " . substitute(olddir, ' ', '\\ ', 'g')
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 30d99fb..d1f6721 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -3037,7 +3037,8 @@ function MakeRMenu()
         menu R.Command.-Sep61- 
         call RCreateMenuItem("nvi", 'Command.Open\ PDF\ (cur\ file)', 'ROpenPDF', 'op', ':call ROpenPDF("Get Master")')
         if ($DISPLAY != "" && g:vimrplugin_synctex && &filetype == "rnoweb") || g:vimrplugin_never_unmake_menu
-            call RCreateMenuItem("nvi", 'Command.Search\ forward\ (SyncTeX)', 'RSyncFor', 'gp', ':call ROpenPDF("Get Master")')
+            call RCreateMenuItem("nvi", 'Command.Search\ forward\ (SyncTeX)', 'RSyncFor', 'gp', ':call SyncTeX_forward()')
+            call RCreateMenuItem("nvi", 'Command.Go\ to\ LaTeX\ (SyncTeX)', 'RSyncTex', 'gt', ':call SyncTeX_forward(1)')
         endif
     endif
     "-------------------------------

From 85dc2be9eb7c3e901c973ccbf9e292c7b47b4b22 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Wed, 5 Nov 2014 13:28:27 -0500
Subject: [PATCH 0813/1050] Fixed issue #124 (patch by Keith Hughitt).

---
 r-plugin/common_global.vim | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index d1f6721..94470f0 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -1850,7 +1850,7 @@ function SendFHChunkToR()
     let codelines = []
     let here = line(".")
     let curbuf = getline(1, "$")
-    let idx = 1
+    let idx = 0
     while idx < here
         if curbuf[idx] =~ begchk
             " Child R chunk

From 2bcd353844d10178b54f349e11c5b550087315c0 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Wed, 5 Nov 2014 15:26:57 -0500
Subject: [PATCH 0814/1050] Do not check twice if python is executable.

---
 r-plugin/common_global.vim | 30 ++++++++++++++++++------------
 1 file changed, 18 insertions(+), 12 deletions(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 94470f0..f26499d 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -3984,14 +3984,20 @@ let g:rplugin_synctexpid = 0
 let g:rplugin_stx_job = 0
 let g:rplugin_zathura_pid = {}
 
-function GetRandomNumber()
-    if executable("python")
-        let pycode = ["import os",
-                    \ "import base64",
-                    \ "import sys",
-                    \ "sys.stdout.write(base64.b64encode(os.urandom(16)).decode())" ]
+let g:rplugin_py_exec = "none"
+if executable("python")
+    let g:rplugin_py_exec = "python"
+elseif executable("python3")
+    let g:rplugin_py_exec = "python3"
+endif
+
+function GetRandomNumber(width)
+    if g:rplugin_py_exec != "none"
+        let pycode = ["import os, sys, base64",
+                    \ "sys.stdout.write(base64.b64encode(os.urandom(" . a:width . ")).decode())" ]
         call writefile(pycode, $VIMRPLUGIN_TMPDIR . "/getRandomNumber.py")
-        let randnum = system("python " . $VIMRPLUGIN_TMPDIR . "/getRandomNumber.py")
+        let randnum = system(g:rplugin_py_exec . " " . $VIMRPLUGIN_TMPDIR . "/getRandomNumber.py")
+        call delete($VIMRPLUGIN_TMPDIR . "/getRandomNumber.py")
     elseif has("python") || has("python3")
         Py import os
         Py import base64
@@ -4014,8 +4020,8 @@ if &filetype == "rbrowser"
         call RWarningMsgInp("VIMINSTANCEID is undefined")
     endif
 else
-    let $VIMRPLUGIN_SECRET = GetRandomNumber()
-    let $VIMINSTANCEID = substitute(g:rplugin_firstbuffer . GetRandomNumber(), '\W', '', 'g')
+    let $VIMRPLUGIN_SECRET = GetRandomNumber(16)
+    let $VIMINSTANCEID = substitute(g:rplugin_firstbuffer . GetRandomNumber(16), '\W', '', 'g')
     if strlen($VIMINSTANCEID) > 64
         let $VIMINSTANCEID = substitute($VIMINSTANCEID, '.*\(...............................................................\)', '\1', '')
     endif
@@ -4032,12 +4038,12 @@ if &filetype != "rbrowser"
 endif
 
 if has("nvim")
-    if executable("python")
+    if g:rplugin_py_exec != "none"
         if &filetype == "rbrowser"
             let $THIS_IS_ObjBrowser = "yes"
         endif
-        let g:rplugin_clt_job = jobstart('vimcom', 'python', [g:rplugin_home . '/r-plugin/nvimcom.py'])
-        let g:rplugin_svr_job = jobstart('udpsvr', 'python', [g:rplugin_home . '/r-plugin/nvimserver.py'])
+        let g:rplugin_clt_job = jobstart('vimcom', g:rplugin_py_exec, [g:rplugin_home . '/r-plugin/nvimcom.py'])
+        let g:rplugin_svr_job = jobstart('udpsvr', g:rplugin_py_exec, [g:rplugin_home . '/r-plugin/nvimserver.py'])
         autocmd JobActivity vimcom call RClientEvent()
         autocmd JobActivity udpsvr call RServerEvent()
     else

From fa724313a868ef226dc6af6294fd1bcd4100ae5c Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sat, 8 Nov 2014 15:02:32 -0500
Subject: [PATCH 0815/1050] Move Rmd weave code to vimcom.

---
 ftplugin/rmd_rplugin.vim   | 56 ++++++++++++++------------------------
 r-plugin/common_global.vim |  8 +++---
 r-plugin/nvimcom.py        |  4 +--
 r-plugin/vimcom.py         |  4 +--
 4 files changed, 28 insertions(+), 44 deletions(-)

diff --git a/ftplugin/rmd_rplugin.vim b/ftplugin/rmd_rplugin.vim
index cba4054..592be54 100644
--- a/ftplugin/rmd_rplugin.vim
+++ b/ftplugin/rmd_rplugin.vim
@@ -68,44 +68,28 @@ endfunction
 function! RMakeRmd(t)
     update
 
-    call g:SendCmdToR('.vim_oldwd <- getwd(); setwd("' . expand("%:p:h") . '")')
-
-    let rcmd = 'require(rmarkdown); render("' . expand("%:t") . '"'
     if a:t == "odt"
-        let rcmd = rcmd . ', "html_document"'
-    elseif a:t == "html"
-        let rcmd = rcmd . ', "html_document"'
-    elseif a:t == "pdf"
-        let rcmd = rcmd . ', "pdf_document"'
-    elseif a:t == "beamer"
-        let rcmd = rcmd . ', "beamer_presentation"'
-    elseif a:t == "all"
-        let rcmd = rcmd . ', "all"'
+        if has("win32") || has("win64")
+            let g:rplugin_soffbin = "soffice.exe"
+        else
+            let g:rplugin_soffbin = "soffice"
+        endif
+        if !executable(g:rplugin_soffbin)
+            call RWarningMsg("Is Libre Office installed? Cannot convert into ODT: '" . g:rplugin_soffbin . "' not found.")
+            return
+        endif
     endif
 
-    let rcmd = rcmd . ')'
-
-    if g:vimrplugin_openhtml && a:t == "html"
-        let rcmd = rcmd . '; browseURL("' . expand("%:r:t") . '.html")'
-    elseif g:vimrplugin_openpdf && (a:t == "pdf" || a:t == "beamer")
-        call ROpenPDF(expand("%r:t") . '.pdf')
-    elseif a:t == "odt"
-        if g:rplugin_has_soffice == 0
-            if has("win32") || has("win64")
-                let g:rplugin_soffbin = "soffice.exe"
-            else
-                let g:rplugin_soffbin = "soffice"
-            endif
-            if executable(g:rplugin_soffbin)
-                let g:rplugin_has_soffice = 1
-            else
-                call RWarningMsg("Is Libre Office installed? Cannot convert into ODT: '" . g:rplugin_soffbin . "' not found.")
-            endif
-        endif
-        let rcmd = rcmd . '; system("' . g:rplugin_soffbin . ' --invisible --convert-to odt ' . expand("%:r:t") . '.html")'
+    if a:t == "default"
+        let rcmd = 'vim.interlace.rmd("' . expand("%:t") . '", rmddir = "' . expand("%:p:h") . '"'
+    else
+        let rcmd = 'vim.interlace.rmd("' . expand("%:t") . '", outform = "' . a:t .'", rmddir = "' . expand("%:p:h") . '"'
+    endif
+    if (g:vimrplugin_openhtml  == 0 && a:t == "html_document") || (g:vimrplugin_openpdf == 0 && (a:t == "pdf_document" || a:t == "beamer_presentation"))
+        let rcmd .= ", view = FALSE"
     endif
+    let rcmd = rcmd . ')'
     call g:SendCmdToR(rcmd)
-    call g:SendCmdToR('setwd(.vim_oldwd); rm(.vim_oldwd)')
 endfunction
 
 " Send Rmd chunk to R
@@ -145,9 +129,9 @@ call RCreateMaps("nvi", 'RSetwd',        'rd', ':call RSetWD()')
 call RCreateMaps("nvi", 'RKnit',        'kn', ':call RKnit()')
 call RCreateMaps("nvi", 'RMakeRmd',     'kr', ':call RMakeRmd("default")')
 call RCreateMaps("nvi", 'RMakeAll',     'ka', ':call RMakeRmd("all")')
-call RCreateMaps("nvi", 'RMakePDFK',    'kp', ':call RMakeRmd("pdf")')
-call RCreateMaps("nvi", 'RMakePDFKb',   'kl', ':call RMakeRmd("beamer")')
-call RCreateMaps("nvi", 'RMakeHTML',    'kh', ':call RMakeRmd("html")')
+call RCreateMaps("nvi", 'RMakePDFK',    'kp', ':call RMakeRmd("pdf_document")')
+call RCreateMaps("nvi", 'RMakePDFKb',   'kl', ':call RMakeRmd("beamer_presentation")')
+call RCreateMaps("nvi", 'RMakeHTML',    'kh', ':call RMakeRmd("html_document")')
 call RCreateMaps("nvi", 'RMakeODT',     'ko', ':call RMakeRmd("odt")')
 call RCreateMaps("ni",  'RSendChunk',   'cc', ':call b:SendChunkToR("silent", "stay")')
 call RCreateMaps("ni",  'RESendChunk',  'ce', ':call b:SendChunkToR("echo", "stay")')
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index f26499d..89084d5 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -925,8 +925,8 @@ function ReceiveVimComStartMsg(msg)
         if vmsg[0] != "vimcom"
             call RWarningMsg("Invalid package name: " . vmsg[0])
         endif
-        if vmsg[1] != "1.0-5"
-            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.0-5.')
+        if vmsg[1] != "1.0-6"
+            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.0-6.')
         endif
         if vmsg[2] != $VIMINSTANCEID
             call RWarningMsg("Invalid ID: " . vmsg[2] . " [Correct = " . $VIMINSTANCEID . "]")
@@ -984,8 +984,8 @@ function WaitVimComStart()
         let vr = readfile($VIMRPLUGIN_TMPDIR . "/vimcom_running")
         if vr[2] == $VIMINSTANCEID
             let g:rplugin_vimcom_version = vr[1]
-            if g:rplugin_vimcom_version != "1.0-5"
-                call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.0-5.')
+            if g:rplugin_vimcom_version != "1.0-6"
+                call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.0-6.')
                 sleep 1
             endif
         else
diff --git a/r-plugin/nvimcom.py b/r-plugin/nvimcom.py
index 04ac40b..0af474e 100644
--- a/r-plugin/nvimcom.py
+++ b/r-plugin/nvimcom.py
@@ -61,8 +61,8 @@ def DiscoverVimComPort():
         sys.stdout.write("let g:rplugin_vimcomport = " + str(VimComPort) + "\n")
         sys.stdout.flush()
         PortWarn = False
-        if repl.find("1.0-5") != 0:
-            sys.stderr.write("This version of Vim-R-plugin requires vimcom 1.0-5.")
+        if repl.find("1.0-6") != 0:
+            sys.stderr.write("This version of Vim-R-plugin requires vimcom 1.0-6.")
             sys.stderr.flush()
         return
 
diff --git a/r-plugin/vimcom.py b/r-plugin/vimcom.py
index 9bd203b..e52b5a7 100644
--- a/r-plugin/vimcom.py
+++ b/r-plugin/vimcom.py
@@ -59,8 +59,8 @@ def DiscoverVimComPort():
     else:
         vim.command("let g:rplugin_vimcomport = " + str(VimComPort))
         PortWarn = 0
-        if repl.find("1.0-5") != 0:
-            vim.command("call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.0-5.')")
+        if repl.find("1.0-6") != 0:
+            vim.command("call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.0-6.')")
             vim.command("sleep 1")
     return(VimComPort)
 

From 3434954cd0e78702abb985b7f1c9c6a55ee7a9c7 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sun, 9 Nov 2014 22:06:25 -0500
Subject: [PATCH 0816/1050] Update documentation.

---
 doc/r-plugin.txt | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 8da3113..505354c 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -456,6 +456,7 @@ Command
   --------------------------------------------------------
   . Open PDF (cur file)                                \op
   . Search forward (SyncTeX)                           \gp
+  . Go to LaTeX (SyncTeX)                              \gt
   --------------------------------------------------------
   . Build tags file (cur dir)                  :RBuildTags
 -----------------------------------------------------------
@@ -584,10 +585,10 @@ Vim:
 <
 The output inserted by  :Rinsert  is limited to 5012 characters.
 
-The command  :Rformat  calls the function `tidy.source()` of formatR package
+The command  :Rformat  calls the function `tidy_source()` of formatR package
 to format either the entire buffer or the selected lines. The value of the
 `width.cutoff` argument is set to the buffer's 'textwidth' if it is not
-outside the range 20-180. Se R help on `tidy.source` for details on how to
+outside the range 20-180. Se R help on `tidy_source` for details on how to
 control the function behavior.
 
 
@@ -1000,7 +1001,10 @@ indent the code below:
             paste(labels, seq_along(levels), sep = "")
     class(x) <- c(if(ordered) "ordered", "factor")
 <
-See: https://github.com/jcfaria/Vim-R-plugin/issues/77
+See also:
+
+    https://github.com/jcfaria/Vim-R-plugin/issues/77
+    https://github.com/jcfaria/Vim-R-plugin/blob/master/r-plugin/indent_test.R
 
 
 ------------------------------------------------------------------------------
@@ -1627,9 +1631,10 @@ from the generated .tex file. On Linux/Unix, by default, it calls
 <
 to produce a pdf document from the .tex file generated by either `Sweave()` or
 `knit()` command. If `latexmk` is not installed, it calls `pdflatex`. You can
-use the option vimrplugin_latexcmd to change this behavior. Example:
+use the option vimrplugin_latexcmd to change this behavior. Examples:
 >
    let vimrplugin_latexcmd = "latex"
+   let vimrplugin_latexcmd = 'latexmk -pdf -pdflatex="xelatex %O -synctex=1 %S"'
 <
 If you want to pass arguments do the `Sweave()` function, set the value of the
 vimrplugin_sweaveargs variable.
@@ -2127,6 +2132,7 @@ RD, "cursor down"; RED, both "echo" and "down"):
    RMakeAll   (rmarkdown all in yaml)
    ROpenPDF
    RSyncFor   (SyncTeX search forward)
+   RGoToTeX   (Got to LaTeX output)
    RSpinFile
 
    Object browser~

From f89be09498bec50f97db48d8c9e8fcee46db1a27 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sun, 9 Nov 2014 22:08:19 -0500
Subject: [PATCH 0817/1050] Use only one JobActivity handler for Neovim.

---
 ftplugin/rnoweb_rplugin.vim         | 45 ++++++----------------
 r-plugin/common_global.vim          | 60 ++++++++++++++---------------
 r-plugin/nvimcom.py                 |  4 +-
 r-plugin/nvimserver.py              |  2 +-
 r-plugin/synctex_okular_backward.sh |  2 +-
 r-plugin/vimcom.py                  |  4 +-
 6 files changed, 47 insertions(+), 70 deletions(-)

diff --git a/ftplugin/rnoweb_rplugin.vim b/ftplugin/rnoweb_rplugin.vim
index 4a4fcc0..08ac8bf 100644
--- a/ftplugin/rnoweb_rplugin.vim
+++ b/ftplugin/rnoweb_rplugin.vim
@@ -219,7 +219,7 @@ call RCreateMaps("ni",  'RDSendChunk',  'cd', ':call b:SendChunkToR("silen
 call RCreateMaps("ni",  'REDSendChunk', 'ca', ':call b:SendChunkToR("echo", "down")')
 call RCreateMaps("nvi", 'ROpenPDF',     'op', ':call ROpenPDF("Get Master")')
 call RCreateMaps("ni",  'RSyncFor',     'gp', ':call SyncTeX_forward()')
-call RCreateMaps("ni",  'RSyncFor',     'gt', ':call SyncTeX_forward(1)')
+call RCreateMaps("ni",  'RGoToTeX',     'gt', ':call SyncTeX_forward(1)')
 nmap  gn :call RnwNextChunk()
 nmap  gN :call RnwPreviousChunk()
 
@@ -386,6 +386,10 @@ function! SyncTeX_forward(...)
     let lnum = 0
     let rnwf = expand("%:t")
 
+    if g:rplugin_pdfviewer == "evince" && expand("%:p") =~ " "
+        call RWarningMsg('SyncTeX may not work because there is space in the file path "' . expand("%:p") . '".')
+    endif
+
     let olddir = getcwd()
     if olddir != expand("%:p:h")
         exe "cd " . substitute(expand("%:p:h"), ' ', '\\ ', 'g')
@@ -481,13 +485,13 @@ function! SyncTeX_forward(...)
     endif
 
     if g:rplugin_pdfviewer == "okular"
-        call system("okular --unique " . basenm . ".pdf#src:" . texln . expand("%:p:h") . "/./" . basenm . ".tex 2> /dev/null >/dev/null &")
+        call system("okular --unique " . basenm . ".pdf#src:" . texln . substitute(expand("%:p:h"), ' ', '\\ ', 'g') . "/./" . substitute(basenm, ' ', '\\ ', 'g') . ".tex 2> /dev/null >/dev/null &")
     elseif g:rplugin_pdfviewer == "evince"
         if has("nvim")
             call jobstart("RnwSyncFor", "python", [g:rplugin_home . "/r-plugin/synctex_evince_forward.py",  basenm . ".pdf", string(texln), basenm . ".tex"])
-            autocmd JobActivity RnwSyncFor call Handle_SyncTeX_forward()
+            autocmd JobActivity RnwSyncFor call ROnJobActivity()
         else
-            call system("python " . g:rplugin_home . "/r-plugin/synctex_evince_forward.py " . basenm . ".pdf " . texln . " '" . basenm . ".tex' 2> /dev/null >/dev/null &")
+            call system("python " . g:rplugin_home . "/r-plugin/synctex_evince_forward.py '" . basenm . ".pdf' " . texln . " '" . basenm . ".tex' 2> /dev/null >/dev/null &")
         endif
         if g:rplugin_has_wmctrl
             call system("wmctrl -a '" . basenm . ".pdf'")
@@ -542,8 +546,8 @@ function! Run_SyncTeX()
             exe "cd " . substitute(basedir, ' ', '\\ ', 'g')
         endif
         if has("nvim")
-            let g:rplugin_stx_job = jobstart("RnwSyncTeX", "python", [g:rplugin_home . "/r-plugin/synctex_evince_backward.py", basenm . ".pdf", "nvim"])
-            autocmd JobActivity RnwSyncTeX call Handle_SyncTeX_backward()
+            call jobstart("RnwSyncTeX", "python", [g:rplugin_home . "/r-plugin/synctex_evince_backward.py", basenm . ".pdf", "nvim"])
+            autocmd JobActivity RnwSyncTeX call ROnJobActivity()
         else
             if v:servername != ""
                 call system("python " . g:rplugin_home . "/r-plugin/synctex_evince_backward.py '" . basenm . ".pdf' " . v:servername . " &")
@@ -555,38 +559,13 @@ function! Run_SyncTeX()
     elseif has("nvim") && (g:rplugin_pdfviewer == "okular" || g:rplugin_pdfviewer == "zathura") && !exists("g:rplugin_tail_follow")
         let g:rplugin_tail_follow = 1
         call writefile([], $VIMRPLUGIN_TMPDIR . "/" . g:rplugin_pdfviewer . "_search")
-        let g:rplugin_stx_job = jobstart("RnwSyncTeX", "tail", ["-f", $VIMRPLUGIN_TMPDIR . "/" . g:rplugin_pdfviewer . "_search"])
-        autocmd JobActivity RnwSyncTeX call Handle_SyncTeX_backward()
+        call jobstart("RnwSyncTeX", "tail", ["-f", $VIMRPLUGIN_TMPDIR . "/" . g:rplugin_pdfviewer . "_search"])
+        autocmd JobActivity RnwSyncTeX call ROnJobActivity()
         autocmd VimLeave * call delete($VIMRPLUGIN_TMPDIR . "/" . g:rplugin_pdfviewer . "_search") | call delete($VIMRPLUGIN_TMPDIR . "/synctex_back.sh")
     endif
     exe "cd " . substitute(olddir, ' ', '\\ ', 'g')
 endfunction
 
-function! Handle_SyncTeX_forward()
-    if v:job_data[1] == 'stdout'
-        call RWarningMsg("SyncTeX forward [1]: " . v:job_data[2])
-    elseif v:job_data[1] == 'stderr'
-        call RWarningMsg(v:job_data[2])
-    else
-        let g:rplugin_stx_job = 0
-    endif
-endfunction
-
-function! Handle_SyncTeX_backward()
-    if v:job_data[1] == 'stdout'
-        let fname = substitute(v:job_data[2], '|.*', '', '') 
-        if g:rplugin_pdfviewer == "okular"
-            let fname = substitute(fname, '/\./', '/', '')
-        endif
-        let ln = substitute(v:job_data[2], '.*|\([0-9]*\).*', '\1', '')
-        call SyncTeX_backward(fname, ln)
-    elseif v:job_data[1] == 'stderr'
-        call RWarningMsg(v:job_data[2])
-    else
-        let g:rplugin_stx_job = 0
-    endif
-endfunction
-
 call RSetPDFViewer()
 if g:rplugin_pdfviewer != "none"
     if g:rplugin_pdfviewer == "zathura"
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 89084d5..d6d3a3e 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -925,8 +925,8 @@ function ReceiveVimComStartMsg(msg)
         if vmsg[0] != "vimcom"
             call RWarningMsg("Invalid package name: " . vmsg[0])
         endif
-        if vmsg[1] != "1.0-6"
-            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.0-6.')
+        if vmsg[1] != "1.0-7"
+            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.0-7.')
         endif
         if vmsg[2] != $VIMINSTANCEID
             call RWarningMsg("Invalid ID: " . vmsg[2] . " [Correct = " . $VIMINSTANCEID . "]")
@@ -954,7 +954,7 @@ function WaitVimComStart()
     if has("nvim")
         if filereadable(g:rplugin_home . "/r-plugin/timer.sh")
             let wjob = jobstart('waitvc', "sh", [g:rplugin_home . '/r-plugin/timer.sh', string(g:vimrplugin_vimcom_wait / 1000), 'call NoLongerWaitVimCom()'])
-            autocmd JobActivity waitvc call RServerEvent()
+            autocmd JobActivity waitvc call ROnJobActivity()
         else
             call RWarningMsg("File '" . g:rplugin_home . "/r-plugin/timer.sh" . "' not found.")
         endif
@@ -984,8 +984,8 @@ function WaitVimComStart()
         let vr = readfile($VIMRPLUGIN_TMPDIR . "/vimcom_running")
         if vr[2] == $VIMINSTANCEID
             let g:rplugin_vimcom_version = vr[1]
-            if g:rplugin_vimcom_version != "1.0-6"
-                call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.0-6.')
+            if g:rplugin_vimcom_version != "1.0-7"
+                call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.0-7.')
                 sleep 1
             endif
         else
@@ -2524,7 +2524,7 @@ function RSetPDFViewer()
 endfunction
 
 function RStart_Zathura(basenm)
-    let shcode = ['#!/bin/sh', 'echo "$1|$2" >> "' . $VIMRPLUGIN_TMPDIR . '/zathura_search"']
+    let shcode = ['#!/bin/sh', 'echo "call SyncTeX_backward(' . "'$1'" . ', $2)" >> "' . $VIMRPLUGIN_TMPDIR . '/zathura_search"']
     call writefile(shcode, $VIMRPLUGIN_TMPDIR . "/synctex_back.sh")
     let pycode = ["import subprocess",
                 \ "import os",
@@ -3572,31 +3572,29 @@ function SendObjPortToVimCom(p)
     call g:SendToVimCom("\002" . a:p)
 endfunction
 
-function RClientEvent()
-    if v:job_data[1] == 'stdout'
-        let cmd = substitute(v:job_data[2], "\n$", "", "")
-        exe cmd
-    elseif v:job_data[1] == 'stderr'
-        let str = 'nvimcom.py error: ' . v:job_data[2]
-        call RWarningMsg(str)
-    else
-        let g:rplugin_clt_job = 0
-    endif
-endfunction
-
-function RServerEvent()
-    if v:job_data[1] == 'stdout'
-        let cmd = substitute(v:job_data[2], "\n$", "", "")
-        if cmd =~ "^call " || cmd  =~ "^let "
-            exe cmd
-        elseif len(cmd) > 0
-            exe "call " . cmd
+function ROnJobActivity()
+    let g:last_job_data = v:job_data
+    if v:job_data[1] == 'exit'
+        if v:job_data[0] == g:rplugin_stx_job
+            let g:rplugin_stx_job = 0
+        elseif v:job_data[0] == g:rplugin_svr_job
+            let g:rplugin_svr_job = 0
+        elseif v:job_data[0] == g:rplugin_stx_job
+            let g:rplugin_stx_job = 0
         endif
-    elseif v:job_data[1] == 'stderr'
-        let str = 'nvimserver.py error: ' . v:job_data[2]
-        call RWarningMsg(str)
     else
-        let g:rplugin_svr_job = 0
+        if v:job_data[1] == 'stdout'
+            for idx in range(0, len(v:job_data[2]) - 1)
+                let cmd = v:job_data[2][idx]
+                if cmd =~ "^call " || cmd  =~ "^let "
+                    exe cmd
+                else
+                    call RWarningMsg("[JobActivity] Unknown command: " . cmd)
+                endif
+            endfor
+        elseif v:job_data[1] == 'stderr'
+            call RWarningMsg('JobActivity error: ' . join(v:job_data[2]))
+        endif
     endif
 endfunction
 
@@ -4044,8 +4042,8 @@ if has("nvim")
         endif
         let g:rplugin_clt_job = jobstart('vimcom', g:rplugin_py_exec, [g:rplugin_home . '/r-plugin/nvimcom.py'])
         let g:rplugin_svr_job = jobstart('udpsvr', g:rplugin_py_exec, [g:rplugin_home . '/r-plugin/nvimserver.py'])
-        autocmd JobActivity vimcom call RClientEvent()
-        autocmd JobActivity udpsvr call RServerEvent()
+        autocmd JobActivity vimcom call ROnJobActivity()
+        autocmd JobActivity udpsvr call ROnJobActivity()
     else
         call RWarningMsgInp("Python executable not found.")
     endif
diff --git a/r-plugin/nvimcom.py b/r-plugin/nvimcom.py
index 0af474e..366ecc5 100644
--- a/r-plugin/nvimcom.py
+++ b/r-plugin/nvimcom.py
@@ -61,8 +61,8 @@ def DiscoverVimComPort():
         sys.stdout.write("let g:rplugin_vimcomport = " + str(VimComPort) + "\n")
         sys.stdout.flush()
         PortWarn = False
-        if repl.find("1.0-6") != 0:
-            sys.stderr.write("This version of Vim-R-plugin requires vimcom 1.0-6.")
+        if repl.find("1.0-7") != 0:
+            sys.stderr.write("This version of Vim-R-plugin requires vimcom 1.0-7.")
             sys.stderr.flush()
         return
 
diff --git a/r-plugin/nvimserver.py b/r-plugin/nvimserver.py
index 43408a7..5132f7a 100644
--- a/r-plugin/nvimserver.py
+++ b/r-plugin/nvimserver.py
@@ -26,7 +26,7 @@ def NeovimServer():
         sys.stderr.flush()
         return
     else:
-        sys.stdout.write("RSetMyPort(" + str(MyPort) + ")\n")
+        sys.stdout.write("call RSetMyPort(" + str(MyPort) + ")\n")
         sys.stdout.flush()
 
     while FinishNow == False:
diff --git a/r-plugin/synctex_okular_backward.sh b/r-plugin/synctex_okular_backward.sh
index 0b83714..926386d 100644
--- a/r-plugin/synctex_okular_backward.sh
+++ b/r-plugin/synctex_okular_backward.sh
@@ -2,5 +2,5 @@
 
 # This script is required to do backward search from Okular to Neovim
 
-echo "$1|$2" >> "$VIMRPLUGIN_TMPDIR/okular_search"
+echo "call SyncTeX_backward('$1', $2)" >> "$VIMRPLUGIN_TMPDIR/okular_search"
 
diff --git a/r-plugin/vimcom.py b/r-plugin/vimcom.py
index e52b5a7..4182fcc 100644
--- a/r-plugin/vimcom.py
+++ b/r-plugin/vimcom.py
@@ -59,8 +59,8 @@ def DiscoverVimComPort():
     else:
         vim.command("let g:rplugin_vimcomport = " + str(VimComPort))
         PortWarn = 0
-        if repl.find("1.0-6") != 0:
-            vim.command("call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.0-6.')")
+        if repl.find("1.0-7") != 0:
+            vim.command("call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.0-7.')")
             vim.command("sleep 1")
     return(VimComPort)
 

From f5976b913f784bb6f70aa5873512d94e543abfa8 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Mon, 10 Nov 2014 12:08:47 -0500
Subject: [PATCH 0818/1050] Don't keep rplugin_svr_job since it's never used.

---
 r-plugin/common_global.vim | 35 ++++++++++++-----------------------
 1 file changed, 12 insertions(+), 23 deletions(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index d6d3a3e..ebe17e2 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -3574,27 +3574,17 @@ endfunction
 
 function ROnJobActivity()
     let g:last_job_data = v:job_data
-    if v:job_data[1] == 'exit'
-        if v:job_data[0] == g:rplugin_stx_job
-            let g:rplugin_stx_job = 0
-        elseif v:job_data[0] == g:rplugin_svr_job
-            let g:rplugin_svr_job = 0
-        elseif v:job_data[0] == g:rplugin_stx_job
-            let g:rplugin_stx_job = 0
-        endif
-    else
-        if v:job_data[1] == 'stdout'
-            for idx in range(0, len(v:job_data[2]) - 1)
-                let cmd = v:job_data[2][idx]
-                if cmd =~ "^call " || cmd  =~ "^let "
-                    exe cmd
-                else
-                    call RWarningMsg("[JobActivity] Unknown command: " . cmd)
-                endif
-            endfor
-        elseif v:job_data[1] == 'stderr'
-            call RWarningMsg('JobActivity error: ' . join(v:job_data[2]))
-        endif
+    if v:job_data[1] == 'stdout'
+        for idx in range(0, len(v:job_data[2]) - 1)
+            let cmd = v:job_data[2][idx]
+            if cmd =~ "^call " || cmd  =~ "^let "
+                exe cmd
+            else
+                call RWarningMsg("[JobActivity] Unknown command: " . cmd)
+            endif
+        endfor
+    elseif v:job_data[1] == 'stderr'
+        call RWarningMsg('JobActivity error: ' . join(v:job_data[2]))
     endif
 endfunction
 
@@ -3979,7 +3969,6 @@ let g:rplugin_tmuxsname = "VimR-" . substitute(localtime(), '.*\(...\)', '\1', '
 " SyncTeX options
 let g:rplugin_has_wmctrl = 0
 let g:rplugin_synctexpid = 0
-let g:rplugin_stx_job = 0
 let g:rplugin_zathura_pid = {}
 
 let g:rplugin_py_exec = "none"
@@ -4041,7 +4030,7 @@ if has("nvim")
             let $THIS_IS_ObjBrowser = "yes"
         endif
         let g:rplugin_clt_job = jobstart('vimcom', g:rplugin_py_exec, [g:rplugin_home . '/r-plugin/nvimcom.py'])
-        let g:rplugin_svr_job = jobstart('udpsvr', g:rplugin_py_exec, [g:rplugin_home . '/r-plugin/nvimserver.py'])
+        call jobstart('udpsvr', g:rplugin_py_exec, [g:rplugin_home . '/r-plugin/nvimserver.py'])
         autocmd JobActivity vimcom call ROnJobActivity()
         autocmd JobActivity udpsvr call ROnJobActivity()
     else

From b4fd72bff228c1975b5e6535f1b717fc0b597abd Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Mon, 10 Nov 2014 12:32:19 -0500
Subject: [PATCH 0819/1050] Delete timer.sh.

---
 Makefile                   | 1 -
 list_for_vimball           | 1 -
 r-plugin/common_global.vim | 8 ++------
 r-plugin/timer.sh          | 5 -----
 4 files changed, 2 insertions(+), 13 deletions(-)
 delete mode 100755 r-plugin/timer.sh

diff --git a/Makefile b/Makefile
index bb40c2b..460f692 100644
--- a/Makefile
+++ b/Makefile
@@ -80,7 +80,6 @@ deb:
 	  - r-plugin/vimcom.py\n\
 	  - r-plugin/nvimcom.py\n\
 	  - r-plugin/nvimserver.py\n\
-	  - r-plugin/timer.sh\n\
 	  - r-plugin/synctex_evince_backward.py\n\
 	  - r-plugin/synctex_evince_forward.py\n\
 	  - r-plugin/synctex_okular_backward.sh\n\
diff --git a/list_for_vimball b/list_for_vimball
index eefe7da..1653875 100644
--- a/list_for_vimball
+++ b/list_for_vimball
@@ -26,7 +26,6 @@ r-plugin/r.snippets
 r-plugin/rmd.snippets
 r-plugin/nvimcom.py
 r-plugin/nvimserver.py
-r-plugin/timer.sh
 r-plugin/synctex_evince_backward.py
 r-plugin/synctex_evince_forward.py
 r-plugin/synctex_okular_backward.sh
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index ebe17e2..7fa7471 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -952,12 +952,8 @@ endfunction
 " Neovim don't need this function:
 function WaitVimComStart()
     if has("nvim")
-        if filereadable(g:rplugin_home . "/r-plugin/timer.sh")
-            let wjob = jobstart('waitvc', "sh", [g:rplugin_home . '/r-plugin/timer.sh', string(g:vimrplugin_vimcom_wait / 1000), 'call NoLongerWaitVimCom()'])
-            autocmd JobActivity waitvc call ROnJobActivity()
-        else
-            call RWarningMsg("File '" . g:rplugin_home . "/r-plugin/timer.sh" . "' not found.")
-        endif
+        call jobstart('waitvc', "sh", ['-c', 'sleep ' . string(g:vimrplugin_vimcom_wait / 1000) . '; echo "call NoLongerWaitVimCom()"'])
+        autocmd JobActivity waitvc call ROnJobActivity()
         return 0
     else
         if g:vimrplugin_vimcom_wait < 0
diff --git a/r-plugin/timer.sh b/r-plugin/timer.sh
deleted file mode 100755
index 104cf1b..0000000
--- a/r-plugin/timer.sh
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/sh
-
-sleep $1
-echo $2
-

From 950bcd1e8aad39130d09642a868d0fbfd8c944e4 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Tue, 11 Nov 2014 19:12:35 -0500
Subject: [PATCH 0820/1050] Support for Sumatra SyncTeX (not tested).

---
 ftplugin/rnoweb_rplugin.vim |  2 ++
 r-plugin/common_global.vim  |  4 +++-
 r-plugin/windows.py         | 18 ++++++++++++++++++
 3 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/ftplugin/rnoweb_rplugin.vim b/ftplugin/rnoweb_rplugin.vim
index 08ac8bf..8fe8292 100644
--- a/ftplugin/rnoweb_rplugin.vim
+++ b/ftplugin/rnoweb_rplugin.vim
@@ -516,6 +516,8 @@ function! SyncTeX_forward(...)
             endif
         endif
         call system("wmctrl -a '" . basenm . ".pdf'")
+    elseif g:rplugin_pdfviewer == "sumatra"
+        Py OpenSumatra(basenm . ".pdf", substitute(expand("%:p:h"), ' ', '\\ ', 'g') . "/" . basenm . ".tex", texln)
     elseif g:rplugin_pdfviewer == "skim"
         " This command is based on Skim wiki (not tested)
         call system("/Applications/Skim.app/Contents/SharedSupport/displayline " . texln . " '" . basenm . ".pdf' 2> /dev/null >/dev/null &")
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 7fa7471..89269ed 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -2551,7 +2551,7 @@ function ROpenPDF(path)
         exe "cd " . substitute(expand("%:p:h"), ' ', '\\ ', 'g')
     endif
 
-    if has("win32") || has("win64")
+    if (has("win32") || has("win64")) && g:rplugin_pdfviewer == "none"
         exe 'Py OpenPDF("' . pdfpath . '")'
         exe "cd " . substitute(olddir, ' ', '\\ ', 'g')
         return
@@ -2575,6 +2575,8 @@ function ROpenPDF(path)
             endif
             exe "cd " . substitute(olddir, ' ', '\\ ', 'g')
             return
+        elseif g:rplugin_pdfviewer == "sumatra"
+            call system('SumatraPDF -inverse-search "gvim --servername ' . v:servername . " --remote-expr SyncTeX_backward(\\'%{input}\\',%{line})" . '"')
         else
             let pcmd = g:rplugin_pdfviewer . " '" . pdfpath . "' 2>/dev/null >/dev/null &"
         endif
diff --git a/r-plugin/windows.py b/r-plugin/windows.py
index 6b99015..a4aba69 100644
--- a/r-plugin/windows.py
+++ b/r-plugin/windows.py
@@ -12,6 +12,8 @@
     import win32com.client
     import win32con
     import win32gui
+    import win32ui
+    import dde
 except ImportError:
     import platform
     myPyVersion = platform.python_version()
@@ -227,4 +229,20 @@ def OpenPDF(fn):
         vim.command("call RWarningMsg('" + errstr + "')")
         pass
 
+# The code below is adapted from fwdsumatra.py:
+# Copyright: Julien Cornebise
+# Date: February 20, 2009
+# Description: This file calls ForwardSearch DDE function of SumatraPDF
+def OpenSumatra(pdf, tex, line):
+    # Convert backslashes to slashes, for Unix-style calling from vimlatex
+    pdf = pdf.replace("/", "\\")
+    # Connect to SumatraPDF
+    server = dde.CreateServer()
+    server.Create("LatexSuite")
+    conversation = dde.CreateConversation(server)
+    conversation.ConnectTo("SUMATRA", "control")
+    # Build the DDE call
+    execString='[ForwardSearch("'+pdf+'","'+tex+'",'+line+',0,0,1)'
+    # Call !
+    conversation.Exec(execString)
 

From be842b3531c53075343b11cd4c0fd406d9ceb90a Mon Sep 17 00:00:00 2001
From: Frans van Dunne 
Date: Wed, 12 Nov 2014 15:26:47 -0500
Subject: [PATCH 0821/1050] Fixed miniscule type.

---
 doc/r-plugin.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 505354c..25047d0 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -1302,7 +1302,7 @@ put in your |vimrc|:
 While editing R code, `_` is replaced with `<-`. If want to bind other keys
 to be replaced by `<-`, set the value of |vimrplugin_assign_map| in your
 |vimrc|, as in the example below which emulates RStudio behavior (may only
-works on GVim):
+work on GVim):
 >
    let vimrplugin_assign_map = ""
 <

From b76a3ee94459705af7ebad4c387fcb87a5ae23c2 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Thu, 13 Nov 2014 17:52:50 -0500
Subject: [PATCH 0822/1050] Comment out Python code related with Sumatra.

---
 r-plugin/windows.py | 36 ++++++++++++++++++------------------
 1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/r-plugin/windows.py b/r-plugin/windows.py
index a4aba69..140d568 100644
--- a/r-plugin/windows.py
+++ b/r-plugin/windows.py
@@ -12,8 +12,8 @@
     import win32com.client
     import win32con
     import win32gui
-    import win32ui
-    import dde
+    # import win32ui
+    # import dde
 except ImportError:
     import platform
     myPyVersion = platform.python_version()
@@ -229,20 +229,20 @@ def OpenPDF(fn):
         vim.command("call RWarningMsg('" + errstr + "')")
         pass
 
-# The code below is adapted from fwdsumatra.py:
-# Copyright: Julien Cornebise
-# Date: February 20, 2009
-# Description: This file calls ForwardSearch DDE function of SumatraPDF
-def OpenSumatra(pdf, tex, line):
-    # Convert backslashes to slashes, for Unix-style calling from vimlatex
-    pdf = pdf.replace("/", "\\")
-    # Connect to SumatraPDF
-    server = dde.CreateServer()
-    server.Create("LatexSuite")
-    conversation = dde.CreateConversation(server)
-    conversation.ConnectTo("SUMATRA", "control")
-    # Build the DDE call
-    execString='[ForwardSearch("'+pdf+'","'+tex+'",'+line+',0,0,1)'
-    # Call !
-    conversation.Exec(execString)
+# # The code below is adapted from fwdsumatra.py:
+# # Copyright: Julien Cornebise
+# # Date: February 20, 2009
+# # Description: This file calls ForwardSearch DDE function of SumatraPDF
+# def OpenSumatra(pdf, tex, line):
+#     # Convert backslashes to slashes, for Unix-style calling from vimlatex
+#     pdf = pdf.replace("/", "\\")
+#     # Connect to SumatraPDF
+#     server = dde.CreateServer()
+#     server.Create("LatexSuite")
+#     conversation = dde.CreateConversation(server)
+#     conversation.ConnectTo("SUMATRA", "control")
+#     # Build the DDE call
+#     execString='[ForwardSearch("'+pdf+'","'+tex+'",'+line+',0,0,1)'
+#     # Call !
+#     conversation.Exec(execString)
 

From aba86bc6b88ae5cbc45cc3e059ea634c6c738dea Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Thu, 13 Nov 2014 21:55:59 -0500
Subject: [PATCH 0823/1050] Minor code optimization.

---
 ftplugin/rdoc.vim | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/ftplugin/rdoc.vim b/ftplugin/rdoc.vim
index bb768bc..709bb92 100644
--- a/ftplugin/rdoc.vim
+++ b/ftplugin/rdoc.vim
@@ -1,7 +1,7 @@
 " Vim filetype plugin file
 " Language: R Documentation (generated by the Vim-R-plugin)
 " Maintainer: Jakson Alves de Aquino 
-" Last Change:	Sat Aug 09, 2014  02:29PM
+" Last Change:	Thu Nov 13, 2014  08:11AM
 
 
 " Only do this when not yet done for this buffer
@@ -27,15 +27,12 @@ setlocal iskeyword=@,48-57,_,.
 " Prepare R documentation output to be displayed by Vim
 function! FixRdoc()
     let lnr = line("$")
-    for i in range(1, lnr)
-        call setline(i, substitute(getline(i), "_\010", "", "g"))
-        " A space after 'Arguments:' is necessary for correct syntax highlight
-        " of the first argument
-        call setline(i, substitute(getline(i), "^Arguments:", "Arguments: ", ""))
+    for ii in range(1, lnr)
+        call setline(ii, substitute(getline(ii), "_\010", "", "g"))
     endfor
 
     " Mark the end of Examples
-    let ii = search("^Examples:$")
+    let ii = search("^Examples:$", "nw")
     if ii
         if getline("$") !~ "^###$"
             let lnr = line("$") + 1
@@ -44,9 +41,11 @@ function! FixRdoc()
     endif
 
     " Add a tab character at the end of the Arguments section to mark its end.
-    call cursor(1, 1)
-    let ii = search("^Arguments: $")
+    let ii = search("^Arguments:$", "nw")
     if ii
+        " A space after 'Arguments:' is necessary for correct syntax highlight
+        " of the first argument
+        call setline(ii, "Arguments: ")
         let doclength = line("$")
         let ii += 2
         let lin = getline(ii)
@@ -63,8 +62,7 @@ function! FixRdoc()
     endif
 
     " Add a tab character at the end of the Usage section to mark its end.
-    call cursor(1, 1)
-    let ii = search("^Usage:$")
+    let ii = search("^Usage:$", "nw")
     if ii
         let doclength = line("$")
         let ii += 2
@@ -141,3 +139,4 @@ autocmd FileType rdoc call FixRdoc()
 let &cpo = s:cpo_save
 unlet s:cpo_save
 
+" vim: sw=4

From fa31af79769b7d647dd6b36a1c611a684efe1f03 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Thu, 13 Nov 2014 22:07:21 -0500
Subject: [PATCH 0824/1050] Version 1.1. Note: not tested on Microsoft Windows.

---
 Makefile                            |  2 +-
 doc/r-plugin.txt                    | 20 +++++++++++++-------
 r-plugin/common_global.vim          |  8 ++++----
 r-plugin/nvimcom.py                 |  4 ++--
 r-plugin/synctex_evince_backward.py |  2 +-
 r-plugin/vimcom.py                  |  4 ++--
 6 files changed, 23 insertions(+), 17 deletions(-)

diff --git a/Makefile b/Makefile
index 460f692..3827244 100644
--- a/Makefile
+++ b/Makefile
@@ -22,7 +22,7 @@
 
 
 PLUGINHOME=`pwd`
-PLUGINVERSION=1.0.1
+PLUGINVERSION=1.1
 DEBIANTIME=`date -R`
 PLUGINRELEASEDATE=`date +"%Y-%m-%d"`
 VIM2HTML=/usr/local/share/vim/vim74/doc/vim2html.pl 
diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 25047d0..29529f9 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -5,7 +5,7 @@
 Authors: Jakson A. Aquino   
          Jose Claudio Faria 
 
-Version: 1.0.1
+Version: 1.1
 For Vim version 7.4
 
  1. Overview                                    |r-plugin-overview|
@@ -127,7 +127,7 @@ Before installing the plugin, you should install its dependencies:
 
    R >= 3.0.0: http://www.r-project.org/
 
-   vimcom = 1.0-0: http://www.lepem.ufc.br/jaa/vimcom.html
+   vimcom = 1.1-0: http://www.lepem.ufc.br/jaa/vimcom.html
 
    Tmux >= 1.8:   http://tmux.sourceforge.net
                   Tmux is necessary to send commands from Vim to R Console.
@@ -222,12 +222,15 @@ If you want to uninstall the plugin, do
 ------------------------------------------------------------------------------
 3.2. Instructions for Windows ~
 
+Note: This version was not tested on Windows. If it does not work well in your
+system, please try version 1.0.
+
 Before installing the plugin, you should install several external
 dependencies:
 
     * R's version must be >= 3.0.0: http://www.r-project.org/
 
-    * vimcom = 1.0-0: http://www.lepem.ufc.br/jaa/vimcom.html
+    * vimcom = 1.1-0: http://www.lepem.ufc.br/jaa/vimcom.html
 
       Note: If you cannot build vimcom yourself, you will want to
       download and install the zip file.
@@ -1299,8 +1302,8 @@ put in your |vimrc|:
 >
    let vimrplugin_rnowebchunk = 0
 <
-While editing R code, `_` is replaced with `<-`. If want to bind other keys
-to be replaced by `<-`, set the value of |vimrplugin_assign_map| in your
+While editing R code, `_` is replaced with `<-`. If you want to bind other
+keys to be replaced by `<-`, set the value of |vimrplugin_assign_map| in your
 |vimrc|, as in the example below which emulates RStudio behavior (may only
 work on GVim):
 >
@@ -1916,7 +1919,8 @@ Note: The current knitr package (version 1.7) has at least two limitations:
 
    - It has no SyncTeX support for child documents. The correspondence data
      point to lines right below child chunks in the master document and not to
-     somewhere in the child documents themselves.
+     somewhere in the child documents themselves. See:
+     https://github.com/yihui/knitr/issues/225
 
    - It only starts registering the concordance after the first chunk. So, it
      is recommended that you put the first chunk of R code just after the
@@ -2906,7 +2910,9 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details.
 							       *r-plugin-news*
 10. News~
 
-1.0.1 (2014-10-26)
+1.1 (2014-11-13)
+
+ * Version update for Linux/Unix only. May not work on Windows or Mac.
 
  * Minor bug fixes.
 
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 89269ed..b45f9c7 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -925,8 +925,8 @@ function ReceiveVimComStartMsg(msg)
         if vmsg[0] != "vimcom"
             call RWarningMsg("Invalid package name: " . vmsg[0])
         endif
-        if vmsg[1] != "1.0-7"
-            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.0-7.')
+        if vmsg[1] != "1.1-0"
+            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.1-0.')
         endif
         if vmsg[2] != $VIMINSTANCEID
             call RWarningMsg("Invalid ID: " . vmsg[2] . " [Correct = " . $VIMINSTANCEID . "]")
@@ -980,8 +980,8 @@ function WaitVimComStart()
         let vr = readfile($VIMRPLUGIN_TMPDIR . "/vimcom_running")
         if vr[2] == $VIMINSTANCEID
             let g:rplugin_vimcom_version = vr[1]
-            if g:rplugin_vimcom_version != "1.0-7"
-                call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.0-7.')
+            if g:rplugin_vimcom_version != "1.1-0"
+                call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.1-0.')
                 sleep 1
             endif
         else
diff --git a/r-plugin/nvimcom.py b/r-plugin/nvimcom.py
index 366ecc5..c468cb9 100644
--- a/r-plugin/nvimcom.py
+++ b/r-plugin/nvimcom.py
@@ -61,8 +61,8 @@ def DiscoverVimComPort():
         sys.stdout.write("let g:rplugin_vimcomport = " + str(VimComPort) + "\n")
         sys.stdout.flush()
         PortWarn = False
-        if repl.find("1.0-7") != 0:
-            sys.stderr.write("This version of Vim-R-plugin requires vimcom 1.0-7.")
+        if repl.find("1.1-0") != 0:
+            sys.stderr.write("This version of Vim-R-plugin requires vimcom 1.1-0.")
             sys.stderr.flush()
         return
 
diff --git a/r-plugin/synctex_evince_backward.py b/r-plugin/synctex_evince_backward.py
index d51116b..bd3cd69 100644
--- a/r-plugin/synctex_evince_backward.py
+++ b/r-plugin/synctex_evince_backward.py
@@ -111,7 +111,7 @@ def on_window_close(self):
 
     def on_sync_source(self, input_file, source_link, timestamp):
         if vimnm == "nvim":
-            sys.stdout.write(input_file + "|" + str(source_link[0]) + "\n")
+            sys.stdout.write("call SyncTeX_backward('" + input_file + "', " + str(source_link[0]) + ")\n")
             sys.stdout.flush()
         else:
             os.system(vimexec + ' --servername ' + vimnm + ' --remote-expr "' + "SyncTeX_backward('" + input_file + "', " + str(source_link[0]) + ')"')
diff --git a/r-plugin/vimcom.py b/r-plugin/vimcom.py
index 4182fcc..2b7451b 100644
--- a/r-plugin/vimcom.py
+++ b/r-plugin/vimcom.py
@@ -59,8 +59,8 @@ def DiscoverVimComPort():
     else:
         vim.command("let g:rplugin_vimcomport = " + str(VimComPort))
         PortWarn = 0
-        if repl.find("1.0-7") != 0:
-            vim.command("call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.0-7.')")
+        if repl.find("1.1-0") != 0:
+            vim.command("call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.1-0.')")
             vim.command("sleep 1")
     return(VimComPort)
 

From 4ac2f947f47831f9e1178b31b8b0e737c6b5c16c Mon Sep 17 00:00:00 2001
From: Michael Lerch 
Date: Fri, 14 Nov 2014 10:19:13 -0700
Subject: [PATCH 0825/1050] Add variable for rmarkdown environment

---
 doc/r-plugin.txt           | 49 ++++++++++++++++++++++++--------------
 ftplugin/rmd_rplugin.vim   |  2 +-
 r-plugin/common_global.vim |  1 +
 3 files changed, 33 insertions(+), 19 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 29529f9..d83238b 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -1217,6 +1217,7 @@ is running:
 |vimrplugin_maxdeparse|        Argument to R `source()` function
 |vimrplugin_latexcmd|          Command to run on .tex files
 |vimrplugin_sweaveargs|        Arguments do `Sweave()`
+|vimrplugin_rmd_environment|   Environment in which to save evaluated rmd code
 |vimrplugin_never_unmake_menu| Do not unmake the menu when switching buffers
 |vimrplugin_map_r|             Use 'r' to send lines and selected text
 |vimrplugin_ca_ck|             Add ^A^K to the beginning of commands
@@ -1642,10 +1643,22 @@ use the option vimrplugin_latexcmd to change this behavior. Examples:
 If you want to pass arguments do the `Sweave()` function, set the value of the
 vimrplugin_sweaveargs variable.
 
+------------------------------------------------------------------------------
+						*vimrplugin_rmd_environment*
+6.20. Rmd environment~
+
+When rendering an Rmd file, the code can be evaluated (and saved) in a
+specified environment.  The default value is `.GlobalEnv` which makes the
+objects stored in the Rmd file available on the R console.  If you do not want
+the  objects stored in the Rmd file to be available in the global environment,
+you can set
+>
+    let vimrplugin_rmd_environment = "new.env()"
+<
 
 ------------------------------------------------------------------------------
 						*vimrplugin_never_unmake_menu*
-6.20. Never unmake the R menu~
+6.21. Never unmake the R menu~
 
 Use this option if you want that the "R" menu item in GVim is not deleted when
 you change from one buffer to another, for example, when going from an .R file
@@ -1661,7 +1674,7 @@ different file type buffers.
 
 ------------------------------------------------------------------------------
 							    *vimrplugin_map_r*
-6.21. Map 'r'~
+6.22. Map 'r'~
 
 If the variable |vimrplugin_map_r| exists, the plugin will map the letter 'r'
 to send lines to R when there are visually selected lines, for compatibility
@@ -1681,7 +1694,7 @@ Emacs:
 
 ------------------------------------------------------------------------------
 							    *vimrplugin_ca_ck*
-6.22. Add ^A^K to the beginning of commands~
+6.23. Add ^A^K to the beginning of commands~
 
 When one types  in the R Console the cursor goes to the beginning of the
 line and when one types  the characters to the right of the cursor are
@@ -1697,7 +1710,7 @@ in your |vimrc|:
 	                                                *vimrplugin_pdfviewer*
                                                         *vimrplugin_openpdf*
                                                         *vimrplugin_openhtml*
-6.23. Open PDF after processing rnoweb, rmd or rrst files~
+6.24. Open PDF after processing rnoweb, rmd or rrst files~
 
 The plugin can automatically open the pdf file generated by pdflatex, after
 either `Sweave()` or `knit()`. This behavior is controlled by the variable
@@ -1735,7 +1748,7 @@ The html file will be automatically opened if you put the following in your
 			                             *vimrplugin_strict_rst*
                                                      *vimrplugin_rst2pdfpath*
 			                             *vimrplugin_rst2pdfargs*
-6.24. Support to RreStructuredText file~
+6.25. Support to RreStructuredText file~
 
 By default, the Vim-R-plugin sends the command `render_rst(strict=TRUE)` to R
 before using R's `knit()` function to convert an Rrst file into an rst one. If
@@ -1751,7 +1764,7 @@ to R function knit2pdf).
 
 ------------------------------------------------------------------------------
 						 *vimrplugin_insert_mode_cmds*
-6.25. Allow R commands in insert mode~
+6.26. Allow R commands in insert mode~
 
 Vim-R commands are designed to work in insert mode as well as normal mode.
 However, depending on your , this can make it very difficult to
@@ -1771,7 +1784,7 @@ See also: |r-plugin-localleader|.
 ------------------------------------------------------------------------------
 							 *vimrplugin_allnames*
 							 *vimrplugin_rmhidden*
-6.26. Show/remove hidden objects~
+6.27. Show/remove hidden objects~
 
 Hidden objects are not included in the list of objects for omni completion. If
 you prefer to include them, put in your |vimrc|:
@@ -1786,7 +1799,7 @@ you prefer to remove only visible objects, put in your |vimrc|:
 
 ------------------------------------------------------------------------------
 							   *vimrplugin_source*
-6.27. Source additional scripts~
+6.28. Source additional scripts~
 
 This variable should contain a comma separated list of Vim scripts to be
 sourced by the Vim-R-plugin. These scripts may provide additional
@@ -1807,7 +1820,7 @@ features:
 
 ------------------------------------------------------------------------------
 							  *vimrplugin_restart*
-6.28. Restart R if it is already running (Linux/Unix only)~
+6.29. Restart R if it is already running (Linux/Unix only)~
 
 When R is already running and you type one of the commands to start R before
 you have done rq, the Vim-R-plugin does one of the following:
@@ -1825,7 +1838,7 @@ do rf, rv or rc, then, put in your
 
 ------------------------------------------------------------------------------
 							*vimrplugin_show_args*
-6.29. Show extra information during omnicompletion~
+6.30. Show extra information during omnicompletion~
 
 If you want that Vim shows a preview window with the function arguments as you
 do omnicompletion, put in your |vimrc|:
@@ -1839,7 +1852,7 @@ will be shown only if "preview" is also included in your 'completeopt'.
 
 ------------------------------------------------------------------------------
 						      *vimrplugin_vimcom_wait*
-6.30. Time to wait for vimcom loading~
+6.31. Time to wait for vimcom loading~
 
 The Vim-R-plugin waits 5000 milliseconds for vimcom package to be loaded
 during R startup. It then checks whether you are using the correct version of
@@ -1866,7 +1879,7 @@ If you do not want to install the vimcom package, then put in your
 
 ------------------------------------------------------------------------------
 							   *vimrplugin_vim_wd*
-6.31 Start R in working directory of Vim~
+6.32 Start R in working directory of Vim~
 
 The Vim-R-plugin starts R in the directory where the current buffer is. If you
 want R's working directory to be the same as Vim's working directory, put in
@@ -1877,7 +1890,7 @@ your |vimrc|:
 This option is useful only for those who did not enable 'autochdir'.
 
 
-6.32 Only set key bindings that are user specified
+6.33 Only set key bindings that are user specified
 						   *vimrplugin_user_maps_only*
 The Vim-R-plugin sets many default key bindings.  The user can set custom
 key bindings (|r-plugin-key-bindings|).  If you wish the Vim-R-plugin to only
@@ -1888,7 +1901,7 @@ set those key-bindings specified by the user, put in your vimrc:
 
 ------------------------------------------------------------------------------
 							    *r-plugin-SyncTeX*
-6.32 SyncTeX support (Linux only)~
+6.34 SyncTeX support (Linux only)~
 
 SyncTeX is a set of communication systems used by some PDF viewers and by some
 text editors which allow users to jump from a specific line in the text editor
@@ -1928,7 +1941,7 @@ Note: The current knitr package (version 1.7) has at least two limitations:
 
 
 ------------------------------------------------------------------------------
-6.32.1 Evince configuration~
+6.34.1 Evince configuration~
 
 If you have Evince installed, the Vim-R-plugin assumes that you are using it
 to view PDF documents and that you run either GVim or Vim in Gnome-Terminal.
@@ -1941,7 +1954,7 @@ to press gp again.
 
 
 ------------------------------------------------------------------------------
-6.32.2 Okular configuration~
+6.34.2 Okular configuration~
 
 You have to configure Okular to call Vim during backward searches.
 In Okular, click in:
@@ -1985,7 +1998,7 @@ requires additional steps because Neovim does not have the argument
 <
 
 ------------------------------------------------------------------------------
-6.32.3 Zathura configuration~
+6.34.3 Zathura configuration~
 
 Zathura (version >= 0.3.1) is also supported. If the terminal emulator is not
 raised during backward search (from PDF to Vim), you have to set the value of
@@ -1999,7 +2012,7 @@ to press gp again.
 ------------------------------------------------------------------------------
                                                        *vimrplugin_vim_window*
 				                       *vimrplugin_synctex*
-6.32.4 Configuring the PDF editor and Vim's window title~
+6.34.4 Configuring the PDF editor and Vim's window title~
 
 If SyncTeX does not work (see above), you may try to set in your |vimrc| the
 values of |vimrplugin_pdfviewer| and vimrplugin_vim_window.
diff --git a/ftplugin/rmd_rplugin.vim b/ftplugin/rmd_rplugin.vim
index 592be54..3224ef3 100644
--- a/ftplugin/rmd_rplugin.vim
+++ b/ftplugin/rmd_rplugin.vim
@@ -88,7 +88,7 @@ function! RMakeRmd(t)
     if (g:vimrplugin_openhtml  == 0 && a:t == "html_document") || (g:vimrplugin_openpdf == 0 && (a:t == "pdf_document" || a:t == "beamer_presentation"))
         let rcmd .= ", view = FALSE"
     endif
-    let rcmd = rcmd . ')'
+    let rcmd = rcmd . ', envir = ' . g:vimrplugin_rmd_environment . ')'
     call g:SendCmdToR(rcmd)
 endfunction
 
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index b45f9c7..71645c4 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -3539,6 +3539,7 @@ call RSetDefaultValue("g:vimrplugin_objbr_place",     "'script,right'")
 call RSetDefaultValue("g:vimrplugin_permanent_libs",  "'base,stats,graphics,grDevices,utils,datasets,methods'")
 call RSetDefaultValue("g:vimrplugin_user_maps_only", 0)
 call RSetDefaultValue("g:vimrplugin_latexcmd", "'default'")
+call RSetDefaultValue("g:vimrplugin_rmd_environment", "'.GlobalEnv'")
 
 " Look for invalid options
 let objbrplace = split(g:vimrplugin_objbr_place, ",")

From 8d9abd326fca3fb12e8211d7309f986bd54e7293 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sun, 16 Nov 2014 12:58:31 -0500
Subject: [PATCH 0826/1050] Fix bugs in code for Python 3.

---
 r-plugin/nvimcom.py    | 6 +++---
 r-plugin/nvimserver.py | 6 +++++-
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/r-plugin/nvimcom.py b/r-plugin/nvimcom.py
index c468cb9..6c47038 100644
--- a/r-plugin/nvimcom.py
+++ b/r-plugin/nvimcom.py
@@ -50,10 +50,10 @@ def DiscoverVimComPort():
 
     if VimComPort >= 10049:
         VimComPort = 0
+        sys.stdout.write("let g:rplugin_vimcomport = 0\n")
+        sys.stdout.flush()
         if not PortWarn:
             PortWarn = True
-            sys.stdout.write("let g:rplugin_vimcomport = 0\n")
-            sys.stdout.flush()
             sys.stderr.write("VimCom port not found.")
             sys.stderr.flush()
         return
@@ -101,7 +101,7 @@ def SendToVimCom(aString):
         return received
 
 while True:
-    line = raw_input()
+    line = sys.stdin.readline()
     if line.find("SendToVimCom") != -1:
         line = line.replace("SendToVimCom ", "")
         if line.find("I\002") != -1:
diff --git a/r-plugin/nvimserver.py b/r-plugin/nvimserver.py
index 5132f7a..2044df2 100644
--- a/r-plugin/nvimserver.py
+++ b/r-plugin/nvimserver.py
@@ -31,7 +31,11 @@ def NeovimServer():
 
     while FinishNow == False:
         try:
-            data, addr = sock.recvfrom( 1024 ) # buffer size is 1024 bytes
+            if sys.hexversion >= 0x03000000:
+                bdata, addr = sock.recvfrom( 1024 ) # buffer size is 1024 bytes
+                data = bdata.decode()
+            else:
+                data, addr = sock.recvfrom( 1024 ) # buffer size is 1024 bytes
             if re.match(VimSecret, data):
                 sys.stdout.write(re.sub(VimSecret, "", data) + "\n")
                 sys.stdout.flush()

From 825682ee1489fe46e76c58c4e098148547cff876 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sun, 16 Nov 2014 13:48:58 -0500
Subject: [PATCH 0827/1050] Fix bugs affecting Python3. Also make Neovim run
 Python3 jobs by default.

---
 r-plugin/common_global.vim | 6 +++---
 r-plugin/nvimcom.py        | 4 +++-
 r-plugin/vimcom.py         | 4 +++-
 3 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 71645c4..d2987f2 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -3971,10 +3971,10 @@ let g:rplugin_synctexpid = 0
 let g:rplugin_zathura_pid = {}
 
 let g:rplugin_py_exec = "none"
-if executable("python")
-    let g:rplugin_py_exec = "python"
-elseif executable("python3")
+if executable("python3")
     let g:rplugin_py_exec = "python3"
+elseif executable("python")
+    let g:rplugin_py_exec = "python"
 endif
 
 function GetRandomNumber(width)
diff --git a/r-plugin/nvimcom.py b/r-plugin/nvimcom.py
index 6c47038..5e986ad 100644
--- a/r-plugin/nvimcom.py
+++ b/r-plugin/nvimcom.py
@@ -38,7 +38,9 @@ def DiscoverVimComPort():
                     sock.send("\001" + vii + " What port [Python 2]?")
                     repl = sock.recv(1024)
                 else:
-                    sock.send("\001" + vii + " What port [Python 3]?".encode())
+                    msg = "\001" + vii + " What port [Python 3]?"
+                    msg = msg.encode()
+                    sock.send(msg)
                     repl = sock.recv(1024).decode()
                 sock.close()
                 if repl.find(scrt):
diff --git a/r-plugin/vimcom.py b/r-plugin/vimcom.py
index 2b7451b..37ef216 100644
--- a/r-plugin/vimcom.py
+++ b/r-plugin/vimcom.py
@@ -40,7 +40,9 @@ def DiscoverVimComPort():
                     sock.send("\001" + vii + " What port [Python 2]?")
                     repl = sock.recv(1024)
                 else:
-                    sock.send("\001" + vii + " What port [Python 3]?".encode())
+                    msg = "\001" + vii + " What port [Python 3]?"
+                    msg = msg.encode()
+                    sock.send(msg)
                     repl = sock.recv(1024).decode()
                 sock.close()
                 if repl.find(scrt):

From 925c0131fa2c8283cfbeb7f1ba0d5e740d01933c Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Mon, 17 Nov 2014 15:36:02 -0500
Subject: [PATCH 0828/1050] Use AF_INET.

---
 r-plugin/nvimcom.py | 2 +-
 r-plugin/vimcom.py  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/r-plugin/nvimcom.py b/r-plugin/nvimcom.py
index 5e986ad..d90c609 100644
--- a/r-plugin/nvimcom.py
+++ b/r-plugin/nvimcom.py
@@ -28,7 +28,7 @@ def DiscoverVimComPort():
 
     while repl.find(scrt) < 0 and VimComPort < 10049:
         VimComPort = VimComPort + 1
-        for res in socket.getaddrinfo(HOST, VimComPort, socket.AF_UNSPEC, socket.SOCK_DGRAM):
+        for res in socket.getaddrinfo(HOST, VimComPort, socket.AF_INET, socket.SOCK_DGRAM):
             af, socktype, proto, canonname, sa = res
             try:
                 sock = socket.socket(af, socktype, proto)
diff --git a/r-plugin/vimcom.py b/r-plugin/vimcom.py
index 37ef216..6f9f91d 100644
--- a/r-plugin/vimcom.py
+++ b/r-plugin/vimcom.py
@@ -30,7 +30,7 @@ def DiscoverVimComPort():
 
     while repl.find(scrt) < 0 and VimComPort < 10049:
         VimComPort = VimComPort + 1
-        for res in socket.getaddrinfo(HOST, VimComPort, socket.AF_UNSPEC, socket.SOCK_DGRAM):
+        for res in socket.getaddrinfo(HOST, VimComPort, socket.AF_INET, socket.SOCK_DGRAM):
             af, socktype, proto, canonname, sa = res
             try:
                 sock = socket.socket(af, socktype, proto)

From 4fd4d10d819e753f1209e3edc9493dbce451b5c7 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Mon, 17 Nov 2014 15:45:20 -0500
Subject: [PATCH 0829/1050] Rename _tmuxwasfirst to _do_tmux_split. It may be
 desirable do not split the Tmux window even if running Vim inside Tmux.

---
 ftplugin/rbrowser.vim      |  7 +++----
 r-plugin/common_global.vim | 21 ++++++++++-----------
 2 files changed, 13 insertions(+), 15 deletions(-)

diff --git a/ftplugin/rbrowser.vim b/ftplugin/rbrowser.vim
index be7fb89..65fa5f1 100644
--- a/ftplugin/rbrowser.vim
+++ b/ftplugin/rbrowser.vim
@@ -1,7 +1,7 @@
 " Vim filetype plugin file
 " Language: R Browser (generated by the Vim-R-plugin)
 " Maintainer: Jakson Alves de Aquino 
-" Last Change:	Wed Jun 11, 2014  09:34PM
+" Last Change:	Mon Nov 17, 2014  03:44PM
 
 
 " Only do this when not yet done for this buffer
@@ -41,7 +41,6 @@ endif
 " Current view of the object browser: .GlobalEnv X loaded libraries
 let g:rplugin_curview = "GlobalEnv"
 
-
 function! UpdateOB(what)
     if a:what == "both"
         let wht = g:rplugin_curview
@@ -58,7 +57,7 @@ function! UpdateOB(what)
     let g:rplugin_upobcnt = 1
 
     let g:rplugin_switchedbuf = 0
-    if $TMUX_PANE == ""
+    if g:rplugin_do_tmux_split == 0
         redir => s:bufl
         silent buffers
         redir END
@@ -343,7 +342,7 @@ endif
 
 au BufEnter  stopinsert
 
-if $TMUX_PANE == ""
+if g:rplugin_do_tmux_split == 0
     au BufUnload  call g:SendToVimCom("\004Stop updating info [OB BufUnload].")
 else
     au BufUnload  call ObBrBufUnload()
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index d2987f2..7237dcf 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -846,7 +846,7 @@ function StartR(whatr)
 
     " R was already started. Should restart it or warn?
     if string(g:SendCmdToR) != "function('SendCmdToR_fake')"
-        if g:rplugin_tmuxwasfirst
+        if g:rplugin_do_tmux_split
             if g:vimrplugin_restart
                 call g:SendCmdToR('quit(save = "no")')
                 sleep 100m
@@ -890,7 +890,7 @@ function StartR(whatr)
         let rcmd = b:rplugin_R . " " . b:rplugin_r_args
     endif
 
-    if g:rplugin_tmuxwasfirst
+    if g:rplugin_do_tmux_split
         call StartR_TmuxSplit(rcmd)
     else
         if g:vimrplugin_restart && bufloaded(b:objbrtitle)
@@ -1250,7 +1250,7 @@ function RObjBrowser()
     let g:rplugin_running_objbr = 1
 
     if !b:rplugin_extern_ob
-        if g:rplugin_tmuxwasfirst
+        if g:rplugin_do_tmux_split
             call StartObjBrowser_Tmux()
         else
             call StartObjBrowser_Vim()
@@ -2051,7 +2051,7 @@ function RQuit(how)
         exe "Py SendQuitMsg('" . qcmd . "')"
     else
         call g:SendCmdToR(qcmd)
-        if g:rplugin_tmuxwasfirst
+        if g:rplugin_do_tmux_split
             if a:how == "save"
                 sleep 200m
             endif
@@ -2079,7 +2079,7 @@ function RQuit(how)
     call delete($VIMRPLUGIN_TMPDIR . "/vimcom_running")
     let g:SendCmdToR = function('SendCmdToR_fake')
     let g:rplugin_vimcomport = 0
-    if g:rplugin_tmuxwasfirst && g:vimrplugin_tmux_title != "automatic" && g:vimrplugin_tmux_title != ""
+    if g:rplugin_do_tmux_split && g:vimrplugin_tmux_title != "automatic" && g:vimrplugin_tmux_title != ""
         call system("tmux set automatic-rename on")
     endif
     if has("nvim")
@@ -3630,7 +3630,7 @@ call RSetDefaultValue("g:vimrplugin_ca_ck", 0)
 " Set default mean of communication with R
 
 if has('gui_running')
-    let g:rplugin_tmuxwasfirst = 0
+    let g:rplugin_do_tmux_split = 0
 endif
 
 if has("win32") || has("win64")
@@ -3660,18 +3660,18 @@ if g:vimrplugin_applescript
 endif
 
 if $TMUX != ""
-    let g:rplugin_tmuxwasfirst = 1
+    let g:rplugin_do_tmux_split = 1
     let g:vimrplugin_applescript = 0
 else
     let g:vimrplugin_external_ob = 0
-    let g:rplugin_tmuxwasfirst = 0
+    let g:rplugin_do_tmux_split = 0
 endif
 
 
 " ========================================================================
 " Set function open/close lists in Object Browser
 
-if g:rplugin_tmuxwasfirst
+if g:rplugin_do_tmux_split
     if &filetype == "rbrowser"
         let g:RBrOpenCloseLs = function("RBrOpenCloseLs_TmuxOB")
     else
@@ -3854,7 +3854,7 @@ let s:all_marks = "abcdefghijklmnopqrstuvwxyz"
 
 
 " Choose a terminal (code adapted from screen.vim)
-if has("win32") || has("win64") || g:vimrplugin_applescript || $DISPLAY == "" || g:rplugin_tmuxwasfirst
+if has("win32") || has("win64") || g:vimrplugin_applescript || $DISPLAY == "" || g:rplugin_do_tmux_split
     " No external terminal emulator will be called, so any value is good
     let g:vimrplugin_term = "xterm"
 else
@@ -3951,7 +3951,6 @@ autocmd BufEnter * call RBufEnter()
 if &filetype != "rbrowser"
     autocmd VimLeave * call RVimLeave()
 endif
-autocmd BufLeave * if exists("b:rsource") | call delete(b:rsource) | endif
 
 let g:rplugin_firstbuffer = expand("%:p")
 let g:rplugin_running_objbr = 0

From 27db9b2c185a78b61a1eec4732c5c38d43c1f3e5 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Mon, 17 Nov 2014 16:10:15 -0500
Subject: [PATCH 0830/1050] Require vimcom 1.1-0-dev1.

---
 r-plugin/common_global.vim | 8 ++++----
 r-plugin/nvimcom.py        | 4 ++--
 r-plugin/vimcom.py         | 4 ++--
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 7237dcf..c625152 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -925,8 +925,8 @@ function ReceiveVimComStartMsg(msg)
         if vmsg[0] != "vimcom"
             call RWarningMsg("Invalid package name: " . vmsg[0])
         endif
-        if vmsg[1] != "1.1-0"
-            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.1-0.')
+        if vmsg[1] != "1.1-0-dev1"
+            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.1-0-dev1.')
         endif
         if vmsg[2] != $VIMINSTANCEID
             call RWarningMsg("Invalid ID: " . vmsg[2] . " [Correct = " . $VIMINSTANCEID . "]")
@@ -980,8 +980,8 @@ function WaitVimComStart()
         let vr = readfile($VIMRPLUGIN_TMPDIR . "/vimcom_running")
         if vr[2] == $VIMINSTANCEID
             let g:rplugin_vimcom_version = vr[1]
-            if g:rplugin_vimcom_version != "1.1-0"
-                call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.1-0.')
+            if g:rplugin_vimcom_version != "1.1-0-dev1"
+                call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.1-0-dev1.')
                 sleep 1
             endif
         else
diff --git a/r-plugin/nvimcom.py b/r-plugin/nvimcom.py
index d90c609..1d00928 100644
--- a/r-plugin/nvimcom.py
+++ b/r-plugin/nvimcom.py
@@ -63,8 +63,8 @@ def DiscoverVimComPort():
         sys.stdout.write("let g:rplugin_vimcomport = " + str(VimComPort) + "\n")
         sys.stdout.flush()
         PortWarn = False
-        if repl.find("1.1-0") != 0:
-            sys.stderr.write("This version of Vim-R-plugin requires vimcom 1.1-0.")
+        if repl.find("1.1-0-dev1") != 0:
+            sys.stderr.write("This version of Vim-R-plugin requires vimcom 1.1-0-dev1.")
             sys.stderr.flush()
         return
 
diff --git a/r-plugin/vimcom.py b/r-plugin/vimcom.py
index 6f9f91d..3b45b55 100644
--- a/r-plugin/vimcom.py
+++ b/r-plugin/vimcom.py
@@ -61,8 +61,8 @@ def DiscoverVimComPort():
     else:
         vim.command("let g:rplugin_vimcomport = " + str(VimComPort))
         PortWarn = 0
-        if repl.find("1.1-0") != 0:
-            vim.command("call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.1-0.')")
+        if repl.find("1.1-0-dev1") != 0:
+            vim.command("call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.1-0-dev1.')")
             vim.command("sleep 1")
     return(VimComPort)
 

From 26e9f90e210673e347e88432e51badf2eda778cf Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Mon, 17 Nov 2014 22:13:34 -0500
Subject: [PATCH 0831/1050] Remove Neovim specific Python scripts. Now the
 client and server applications ran by Neovim are provided by the vimcom
 package. The vimcom port number is saved in a file and, thus, the function
 DiscoverVimComPort is no longer necessary and was deleted.

---
 Makefile                   |   2 -
 list_for_vimball           |   2 -
 r-plugin/common_global.vim | 122 +++++++++++++++++-------------------
 r-plugin/nvimcom.py        | 125 -------------------------------------
 r-plugin/nvimserver.py     |  72 ---------------------
 r-plugin/vimcom.py         |  75 +---------------------
 6 files changed, 60 insertions(+), 338 deletions(-)
 delete mode 100644 r-plugin/nvimcom.py
 delete mode 100644 r-plugin/nvimserver.py

diff --git a/Makefile b/Makefile
index 3827244..a3c6c7e 100644
--- a/Makefile
+++ b/Makefile
@@ -78,8 +78,6 @@ deb:
 	  - r-plugin/common_buffer.vim\n\
 	  - r-plugin/common_global.vim\n\
 	  - r-plugin/vimcom.py\n\
-	  - r-plugin/nvimcom.py\n\
-	  - r-plugin/nvimserver.py\n\
 	  - r-plugin/synctex_evince_backward.py\n\
 	  - r-plugin/synctex_evince_forward.py\n\
 	  - r-plugin/synctex_okular_backward.sh\n\
diff --git a/list_for_vimball b/list_for_vimball
index 1653875..4150bbd 100644
--- a/list_for_vimball
+++ b/list_for_vimball
@@ -24,8 +24,6 @@ r-plugin/global_r_plugin.vim
 r-plugin/objlist/README
 r-plugin/r.snippets
 r-plugin/rmd.snippets
-r-plugin/nvimcom.py
-r-plugin/nvimserver.py
 r-plugin/synctex_evince_backward.py
 r-plugin/synctex_evince_forward.py
 r-plugin/synctex_okular_backward.sh
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index c625152..2830065 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -850,7 +850,7 @@ function StartR(whatr)
             if g:vimrplugin_restart
                 call g:SendCmdToR('quit(save = "no")')
                 sleep 100m
-                call delete($VIMRPLUGIN_TMPDIR . "/vimcom_running")
+                call delete($VIMRPLUGIN_TMPDIR . "/vimcom_running_" . $VIMINSTANCEID)
                 let ca_ck = g:vimrplugin_ca_ck
                 let g:vimrplugin_ca_ck = 0
                 call g:SendCmdToR(g:rplugin_last_rcmd)
@@ -894,7 +894,7 @@ function StartR(whatr)
         call StartR_TmuxSplit(rcmd)
     else
         if g:vimrplugin_restart && bufloaded(b:objbrtitle)
-            call delete($VIMRPLUGIN_TMPDIR . "/vimcom_running")
+            call delete($VIMRPLUGIN_TMPDIR . "/vimcom_running_" . $VIMINSTANCEID)
         endif
         call StartR_ExternalTerm(rcmd)
         if g:vimrplugin_restart && bufloaded(b:objbrtitle)
@@ -919,51 +919,24 @@ function StartR(whatr)
     echon
 endfunction
 
-function ReceiveVimComStartMsg(msg)
-    let vmsg = split(a:msg)
-    if len(vmsg) == 4
-        if vmsg[0] != "vimcom"
-            call RWarningMsg("Invalid package name: " . vmsg[0])
-        endif
-        if vmsg[1] != "1.1-0-dev1"
-            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.1-0-dev1.')
-        endif
-        if vmsg[2] != $VIMINSTANCEID
-            call RWarningMsg("Invalid ID: " . vmsg[2] . " [Correct = " . $VIMINSTANCEID . "]")
-        endif
-        if vmsg[3] > "10000" && vmsg[3] < "10049"
-            let g:rplugin_vimcomport = vmsg[3]
-            " Give vimcom some time to complete its startup process
-            sleep 20m
-        else
-            call RWarningMsg("Invalid vimcom port: " . vmsg[2])
-        endif
-    endif
-endfunction
-
-function NoLongerWaitVimCom()
-    if filereadable($VIMRPLUGIN_TMPDIR . "/vimcom_running")
-        call delete($VIMRPLUGIN_TMPDIR . "/vimcom_running")
+function RSetNeovimPort(p)
+    let g:rplugin_myport = a:p
+    if &filetype == "rbrowser" && g:rplugin_do_tmux_split
+        call g:SendToVimCom("\002" . a:p)
     else
-        call RWarningMsg("The package vimcom wasn't loaded yet.")
+        call g:SendToVimCom("\001" . a:p)
     endif
 endfunction
 
 " Neovim don't need this function:
 function WaitVimComStart()
-    if has("nvim")
-        call jobstart('waitvc', "sh", ['-c', 'sleep ' . string(g:vimrplugin_vimcom_wait / 1000) . '; echo "call NoLongerWaitVimCom()"'])
-        autocmd JobActivity waitvc call ROnJobActivity()
+    if g:vimrplugin_vimcom_wait < 0
         return 0
-    else
-        if g:vimrplugin_vimcom_wait < 0
-            return 0
-        endif
     endif
     sleep 300m
     let ii = 0
     let waitmsg = 0
-    while !filereadable($VIMRPLUGIN_TMPDIR . "/vimcom_running") && ii < g:vimrplugin_vimcom_wait
+    while !filereadable($VIMRPLUGIN_TMPDIR . "/vimcom_running_" . $VIMINSTANCEID) && ii < g:vimrplugin_vimcom_wait
         let ii = ii + 200
         if ii == 1000
             echo "Waiting vimcom loading..."
@@ -976,20 +949,34 @@ function WaitVimComStart()
         redraw
     endif
     sleep 100m
-    if filereadable($VIMRPLUGIN_TMPDIR . "/vimcom_running")
-        let vr = readfile($VIMRPLUGIN_TMPDIR . "/vimcom_running")
-        if vr[2] == $VIMINSTANCEID
-            let g:rplugin_vimcom_version = vr[1]
-            if g:rplugin_vimcom_version != "1.1-0-dev1"
-                call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.1-0-dev1.')
-                sleep 1
-            endif
-        else
-            let g:rplugin_vimcom_version = 0
-            call RWarningMsg("Vim-R-plugin and vimcom IDs don't match.")
+    if filereadable($VIMRPLUGIN_TMPDIR . "/vimcom_running_" . $VIMINSTANCEID)
+        let vr = readfile($VIMRPLUGIN_TMPDIR . "/vimcom_running_" . $VIMINSTANCEID)
+        let g:rplugin_vimcom_version = vr[0]
+        if g:rplugin_vimcom_version != "1.1-0-dev2"
+            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.1-0-dev2.')
             sleep 1
         endif
-        call delete($VIMRPLUGIN_TMPDIR . "/vimcom_running")
+        let g:rplugin_vimcom_home = vr[1]
+        let g:rplugin_vimcomport = vr[2]
+        if has("nvim")
+            if g:rplugin_clt_job
+                call jobstop(g:rplugin_clt_job)
+                let g:rplugin_clt_job = 0
+            endif
+            if filereadable(g:rplugin_vimcom_home . "/bin/nvimclient")
+                let g:rplugin_clt_job = jobstart('vimcom', g:rplugin_vimcom_home . "/bin/nvimclient", [g:rplugin_vimcomport])
+                autocmd JobActivity vimcom call ROnJobActivity()
+            else
+                call RWarningMsg('Application "' . g:rplugin_vimcom_home . "/bin/nvimclient" . '" not found.")
+            endif
+            if filereadable(g:rplugin_vimcom_home . "/bin/nvimserver") && !exists("g:rplugin_srv_job")
+                let g:rplugin_srv_job = jobstart('udpsvr', g:rplugin_vimcom_home . "/bin/nvimserver")
+                autocmd JobActivity udpsvr call ROnJobActivity()
+            else
+                call RWarningMsg('Application "' . g:rplugin_vimcom_home . "/bin/nvimserver" . '" not found.")
+            endif
+        endif
+        call delete($VIMRPLUGIN_TMPDIR . "/vimcom_running_" . $VIMINSTANCEID)
         return 1
     else
         call RWarningMsg("The package vimcom wasn't loaded yet.")
@@ -1068,10 +1055,15 @@ function StartObjBrowser_Tmux()
                 \ 'set rulerformat=%3(%l%)',
                 \ 'set noruler',
                 \ 'let g:SendCmdToR = function("SendCmdToR_TmuxSplit")',
-                \ 'if has("clientserver") && v:servername != ""',
-                \ '    call g:SendToVimCom("\002" . v:servername)',
-                \ 'endif',
-                \ 'if !has("nvim")',
+                \ 'if has("nvim")',
+                \ '    let g:rplugin_clt_job = jobstart("vimcom", "' . g:rplugin_vimcom_home . "/bin/nvimclient" . '", ["' . g:rplugin_vimcomport . '"])',
+                \ '    let g:rplugin_srv_job = jobstart("udpsvr", "' . g:rplugin_vimcom_home . "/bin/nvimserver" . '")',
+                \ '    autocmd JobActivity udpsvr call ROnJobActivity()',
+                \ 'else',
+                \ '    if has("clientserver") && v:servername != ""',
+                \ '        let g:rplugin_vimcomport = ' . g:rplugin_vimcomport,
+                \ '        call g:SendToVimCom("\002" . v:servername)',
+                \ '    endif',
                 \ '    sleep 150m',
                 \ '    call UpdateOB("GlobalEnv")',
                 \ 'endif'], objbrowserfile)
@@ -2076,7 +2068,7 @@ function RQuit(how)
     call delete($VIMRPLUGIN_TMPDIR . "/liblist_" . $VIMINSTANCEID)
     call delete($VIMRPLUGIN_TMPDIR . "/libnames_" . $VIMINSTANCEID)
     call delete($VIMRPLUGIN_TMPDIR . "/GlobalEnvList_" . $VIMINSTANCEID)
-    call delete($VIMRPLUGIN_TMPDIR . "/vimcom_running")
+    call delete($VIMRPLUGIN_TMPDIR . "/vimcom_running_" . $VIMINSTANCEID)
     let g:SendCmdToR = function('SendCmdToR_fake')
     let g:rplugin_vimcomport = 0
     if g:rplugin_do_tmux_split && g:vimrplugin_tmux_title != "automatic" && g:vimrplugin_tmux_title != ""
@@ -3370,7 +3362,7 @@ function RVimLeave()
     call delete($VIMRPLUGIN_TMPDIR . "/tmux.conf")
     call delete($VIMRPLUGIN_TMPDIR . "/unformatted_code")
     call delete($VIMRPLUGIN_TMPDIR . "/vimbol_finished")
-    call delete($VIMRPLUGIN_TMPDIR . "/vimcom_running")
+    call delete($VIMRPLUGIN_TMPDIR . "/vimcom_running_" . $VIMINSTANCEID)
 endfunction
 
 function SetRPath()
@@ -3572,7 +3564,6 @@ function SendObjPortToVimCom(p)
 endfunction
 
 function ROnJobActivity()
-    let g:last_job_data = v:job_data
     if v:job_data[1] == 'stdout'
         for idx in range(0, len(v:job_data[2]) - 1)
             let cmd = v:job_data[2][idx]
@@ -3588,16 +3579,19 @@ function ROnJobActivity()
 endfunction
 
 function SendToVimCom_Vim(...)
-    exe "Py SendToVimCom('" . a:1 . "')"
+    if g:rplugin_vimcomport == 0
+        call RWarningMsg("VimCom port is unknown.")
+        return
+    endif
+    exe "Py SendToVimCom('" . a:1 . "', " . g:rplugin_vimcomport . ")"
 endfunction
 
 function SendToVimCom_Neovim(...)
-    if a:0 == 2 && a:2 == "I"
-        " Ignore reply due to https://github.com/neovim/neovim/issues/834
-        call jobsend(g:rplugin_clt_job, "SendToVimCom I\002" . a:1 . "\n")
-    else
-        call jobsend(g:rplugin_clt_job, "SendToVimCom " . a:1 . "\n")
+    if g:rplugin_clt_job == 0
+        call RWarningMsg("VimCom client not runing.")
+        return
     endif
+    call jobsend(g:rplugin_clt_job, a:1 . "\n")
 endfunction
 
 if has("nvim")
@@ -3956,8 +3950,10 @@ let g:rplugin_firstbuffer = expand("%:p")
 let g:rplugin_running_objbr = 0
 let g:rplugin_newliblist = 0
 let g:rplugin_ob_warn_shown = 0
+let g:rplugin_clt_job = 0
 let g:rplugin_myport = 0
 let g:rplugin_vimcomport = 0
+let g:rplugin_vimcom_home = ""
 let g:rplugin_vimcom_version = 0
 let g:rplugin_lastrpl = ""
 let g:rplugin_lastev = ""
@@ -4027,10 +4023,6 @@ if has("nvim")
         if &filetype == "rbrowser"
             let $THIS_IS_ObjBrowser = "yes"
         endif
-        let g:rplugin_clt_job = jobstart('vimcom', g:rplugin_py_exec, [g:rplugin_home . '/r-plugin/nvimcom.py'])
-        call jobstart('udpsvr', g:rplugin_py_exec, [g:rplugin_home . '/r-plugin/nvimserver.py'])
-        autocmd JobActivity vimcom call ROnJobActivity()
-        autocmd JobActivity udpsvr call ROnJobActivity()
     else
         call RWarningMsgInp("Python executable not found.")
     endif
diff --git a/r-plugin/nvimcom.py b/r-plugin/nvimcom.py
deleted file mode 100644
index 1d00928..0000000
--- a/r-plugin/nvimcom.py
+++ /dev/null
@@ -1,125 +0,0 @@
-
-import sys
-import socket
-import os
-import re
-
-VimComPort = 0
-PortWarn = 0
-VimComFamily = None
-
-def DiscoverVimComPort():
-    global PortWarn
-    global VimComPort
-    global VimComFamily
-    HOST = "localhost"
-    VimComPort = 10000
-    repl = "NOTHING"
-    vii = os.getenv("VIMINSTANCEID")
-    if vii is None:
-        sys.stderr.write("VIMINSTANCEID not found.")
-        sys.stderr.flush()
-        return
-    scrt = os.getenv("VIMRPLUGIN_SECRET")
-    if scrt is None:
-        sys.stderr.write("VIMRPLUGIN_SECRET not found")
-        sys.stderr.flush()
-        return
-
-    while repl.find(scrt) < 0 and VimComPort < 10049:
-        VimComPort = VimComPort + 1
-        for res in socket.getaddrinfo(HOST, VimComPort, socket.AF_INET, socket.SOCK_DGRAM):
-            af, socktype, proto, canonname, sa = res
-            try:
-                sock = socket.socket(af, socktype, proto)
-                sock.settimeout(0.1)
-                sock.connect(sa)
-                if sys.hexversion < 0x03000000:
-                    sock.send("\001" + vii + " What port [Python 2]?")
-                    repl = sock.recv(1024)
-                else:
-                    msg = "\001" + vii + " What port [Python 3]?"
-                    msg = msg.encode()
-                    sock.send(msg)
-                    repl = sock.recv(1024).decode()
-                sock.close()
-                if repl.find(scrt):
-                    VimComFamily = af
-                    break
-            except:
-                sock = None
-                continue
-
-    if VimComPort >= 10049:
-        VimComPort = 0
-        sys.stdout.write("let g:rplugin_vimcomport = 0\n")
-        sys.stdout.flush()
-        if not PortWarn:
-            PortWarn = True
-            sys.stderr.write("VimCom port not found.")
-            sys.stderr.flush()
-        return
-    else:
-        sys.stdout.write("let g:rplugin_vimcomport = " + str(VimComPort) + "\n")
-        sys.stdout.flush()
-        PortWarn = False
-        if repl.find("1.1-0-dev1") != 0:
-            sys.stderr.write("This version of Vim-R-plugin requires vimcom 1.1-0-dev1.")
-            sys.stderr.flush()
-        return
-
-
-def SendToVimCom(aString):
-    HOST = "localhost"
-    global VimComPort
-    global VimComFamily
-    if VimComPort == 0:
-        DiscoverVimComPort()
-        if VimComPort == 0:
-            return "NoPort"
-    received = None
-
-    sock = socket.socket(VimComFamily, socket.SOCK_DGRAM)
-    sock.settimeout(3.0)
-
-    try:
-        sock.connect((HOST, VimComPort))
-        if sys.hexversion < 0x03000000:
-            sock.send(aString)
-            received = sock.recv(5012)
-        else:
-            sock.send(aString.encode())
-            received = sock.recv(5012).decode()
-    except:
-        pass
-    finally:
-        sock.close()
-
-    if received is None:
-        VimComPort = 0
-        return "NOANSWER"
-    else:
-        received = received.replace("'", "' . \"'\" . '")
-        return received
-
-while True:
-    line = sys.stdin.readline()
-    if line.find("SendToVimCom") != -1:
-        line = line.replace("SendToVimCom ", "")
-        if line.find("I\002") != -1:
-            line = line.replace("I\002", "")
-            printreply = False
-        else:
-            printreply = True
-        rpl = SendToVimCom(line)
-        if printreply:
-            sys.stdout.write("let g:rplugin_lastrpl = '" + rpl + "'\n")
-            sys.stdout.flush()
-    else:
-        if line.find("DiscoverVimComPort") != -1:
-            DiscoverVimComPort()
-        else:
-            sys.stderr.write("Unknown command: '" + line + "'.")
-            sys.stderr.flush()
-
-
diff --git a/r-plugin/nvimserver.py b/r-plugin/nvimserver.py
deleted file mode 100644
index 2044df2..0000000
--- a/r-plugin/nvimserver.py
+++ /dev/null
@@ -1,72 +0,0 @@
-import sys
-import socket
-import re
-import os
-
-def NeovimServer():
-    sock = None
-    FinishNow = False
-    UDP_IP = "127.0.0.1"
-    MyPort = 1899
-    VimSecret = os.getenv("VIMRPLUGIN_SECRET")
-
-    while True and MyPort < 1999:
-        try:
-            MyPort += 1
-            sock = socket.socket( socket.AF_INET, socket.SOCK_DGRAM )
-            sock.bind( (UDP_IP,MyPort) )
-        except:
-            continue
-        else:
-            break
-
-    if sock == None:
-        MyPort = 0
-        sys.stderr.write("Could not bind to any port.")
-        sys.stderr.flush()
-        return
-    else:
-        sys.stdout.write("call RSetMyPort(" + str(MyPort) + ")\n")
-        sys.stdout.flush()
-
-    while FinishNow == False:
-        try:
-            if sys.hexversion >= 0x03000000:
-                bdata, addr = sock.recvfrom( 1024 ) # buffer size is 1024 bytes
-                data = bdata.decode()
-            else:
-                data, addr = sock.recvfrom( 1024 ) # buffer size is 1024 bytes
-            if re.match(VimSecret, data):
-                sys.stdout.write(re.sub(VimSecret, "", data) + "\n")
-                sys.stdout.flush()
-            else:
-                if data != "":
-                    sys.stderr.write('Strange string received: "' + data + '"')
-                    sys.stderr.flush()
-
-        except Exception as errmsg:
-            sys.stderr.write('Server failed to read data: "' + str(errmsg) + '"')
-            sys.stderr.flush()
-            MyPort = 0
-            try:
-                sock.shutdown(socket.SHUT_RD)
-            except:
-                pass
-            sock.close()
-            return
-        try:
-            sock.shutdown(socket.SHUT_RD)
-        except:
-            pass
-        sock.close()
-        if FinishNow == False:
-            try:
-                sock = socket.socket( socket.AF_INET, socket.SOCK_DGRAM )
-                sock.bind( (UDP_IP,MyPort) )
-            except Exception as errmsg:
-                sys.stdout.write("let g:rplugin_myport = 0 | call RWarningMsg('" + str(errmsg) + "')\n")
-                sys.stdout.flush()
-                pass
-
-NeovimServer()
-
diff --git a/r-plugin/vimcom.py b/r-plugin/vimcom.py
index 3b45b55..aa4e84e 100644
--- a/r-plugin/vimcom.py
+++ b/r-plugin/vimcom.py
@@ -4,84 +4,15 @@
 import os
 import re
 import subprocess
-VimComPort = 0
-PortWarn = 0
-VimComFamily = None
 
-def DiscoverVimComPort():
-    global PortWarn
-    global VimComPort
-    global VimComFamily
-    HOST = "localhost"
-    VimComPort = 10000
-    repl = "NOTHING"
-    vii = vim.eval("$VIMINSTANCEID")
-    if vii is None:
-        vii = os.getenv("VIMINSTANCEID")
-        if vii is None:
-            vim.command("call RWarningMsg('VIMINSTANCEID not found.')")
-            return
-    scrt = vim.eval("$VIMRPLUGIN_SECRET")
-    if scrt is None:
-        scrt = os.getenv("VIMRPLUGIN_SECRET")
-        if scrt is None:
-            vim.command("call RWarningMsg('VIMRPLUGIN_SECRET not found.')")
-            return
-
-    while repl.find(scrt) < 0 and VimComPort < 10049:
-        VimComPort = VimComPort + 1
-        for res in socket.getaddrinfo(HOST, VimComPort, socket.AF_INET, socket.SOCK_DGRAM):
-            af, socktype, proto, canonname, sa = res
-            try:
-                sock = socket.socket(af, socktype, proto)
-                sock.settimeout(0.1)
-                sock.connect(sa)
-                if sys.hexversion < 0x03000000:
-                    sock.send("\001" + vii + " What port [Python 2]?")
-                    repl = sock.recv(1024)
-                else:
-                    msg = "\001" + vii + " What port [Python 3]?"
-                    msg = msg.encode()
-                    sock.send(msg)
-                    repl = sock.recv(1024).decode()
-                sock.close()
-                if repl.find(scrt):
-                    VimComFamily = af
-                    break
-            except:
-                sock = None
-                continue
-
-    if VimComPort >= 10049:
-        VimComPort = 0
-        vim.command("let g:rplugin_vimcomport = 0")
-        if PortWarn < 2:
-            vim.command("call RWarningMsg('VimCom port not found.')")
-        PortWarn = PortWarn + 1
-    else:
-        vim.command("let g:rplugin_vimcomport = " + str(VimComPort))
-        PortWarn = 0
-        if repl.find("1.1-0-dev1") != 0:
-            vim.command("call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.1-0-dev1.')")
-            vim.command("sleep 1")
-    return(VimComPort)
-
-
-def SendToVimCom(aString):
-    HOST = "localhost"
-    global VimComPort
-    global VimComFamily
-    if VimComPort == 0:
-        VimComPort = DiscoverVimComPort()
-        if VimComPort == 0:
-            return
+def SendToVimCom(aString, VimComPort):
     received = None
 
-    sock = socket.socket(VimComFamily, socket.SOCK_DGRAM)
+    sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
     sock.settimeout(3.0)
 
     try:
-        sock.connect((HOST, VimComPort))
+        sock.connect(("localhost", VimComPort))
         if sys.hexversion < 0x03000000:
             sock.send(aString)
             received = sock.recv(5012)

From 934594f40e0b260e45116bee9c7102edd3bb35f2 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Mon, 17 Nov 2014 23:17:46 -0500
Subject: [PATCH 0832/1050] New option: vimrplugin_r_in_buffer. New
 experimental feature to test Neovim.

---
 doc/r-plugin.txt           |  39 ++++++++++---
 r-plugin/common_global.vim | 117 +++++++++++++++++++++++++++++++++++--
 2 files changed, 144 insertions(+), 12 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index d83238b..4490b35 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -5,7 +5,7 @@
 Authors: Jakson A. Aquino   
          Jose Claudio Faria 
 
-Version: 1.1
+Version: 1.1.1
 For Vim version 7.4
 
  1. Overview                                    |r-plugin-overview|
@@ -184,7 +184,7 @@ Press  and the plugin will be installed (because the plugin has many
 files, you have to press the space bar a few times to finish the
 installation). You should, then, quit Vim.
 
-Note: If you need too install the plugin in a non default directory, do
+Note: If you need to install the plugin in a non default directory, do
 `:UseVimball` `[path]`. In this case, the configuration of Vim's 'runtimepath'
 must be done before the command "filetype on" in both the system and the user
 |vimrc| files, otherwise, some file types might not be correctly recognized.
@@ -266,7 +266,7 @@ Press  and the plugin will be installed (because the plugin has many
 files, you have to press the space bar a few times to finish the
 installation). You should, then, quit Vim.
 
-Note: If you need too install the plugin in a non default directory, do
+Note: If you need to install the plugin in a non default directory, do
 `:UseVimball` `[path]`. In this case, the configuration of Vim's 'runtimepath'
 must be done before the command "filetype on" in both the system and the user
 |vimrc| files, otherwise, some file types might not be correctly recognized.
@@ -1189,6 +1189,7 @@ is running:
 |vimrplugin_term|              External terminal to be used
 |vimrplugin_term_cmd|          Complete command to open an external terminal
 |vimrplugin_Rterm|             On Windows, use Rterm.exe
+|vimrplugin_r_in_buffer|       Run R in Neovim buffer
 |vimrplugin_assign|            Convert '_' into ' <- '
 |vimrplugin_assign_map|        Choose what to convert into ' <- '
 |vimrplugin_rnowebchunk|       Convert '<' into '<<>>=\n@' in Rnoweb files
@@ -1292,6 +1293,26 @@ Mode" on either PowerShell or Command Prompt and to send a "Right click" to
 it.
 
 
+------------------------------------------------------------------------------
+						      *vimrplugin_r_in_buffer*
+6.3. Run R in Neovim buffer (experimental feature)~
+
+If you are running Neovim and want to try this experimental feature, put in
+your |vimrc|:
+>
+   let vimrplugin_r_in_buffer = 1
+<
+R will run as a Neovim job (see |job-control|) and the output will be
+displayed in a buffer. In addition to sending code from the R script buffer to
+R, you can also press  in Normal mode to open an R
+scratch buffer to type commands that want to see evaluated by R but do not
+want in your final script because in the scratch buffer omnicompletion and
+syntax highlight will be active.
+
+Note: This is an experimental feature to test Neovim capabilities and may be
+removed in the future.
+
+
 ------------------------------------------------------------------------------
 						      *vimrplugin_rnowebchunk*
 	                                              *vimrplugin_assign_map*
@@ -1644,7 +1665,7 @@ If you want to pass arguments do the `Sweave()` function, set the value of the
 vimrplugin_sweaveargs variable.
 
 ------------------------------------------------------------------------------
-						*vimrplugin_rmd_environment*
+						  *vimrplugin_rmd_environment*
 6.20. Rmd environment~
 
 When rendering an Rmd file, the code can be evaluated (and saved) in a
@@ -1890,8 +1911,10 @@ your |vimrc|:
 This option is useful only for those who did not enable 'autochdir'.
 
 
-6.33 Only set key bindings that are user specified
+------------------------------------------------------------------------------
 						   *vimrplugin_user_maps_only*
+6.33 Only set key bindings that are user specified~
+
 The Vim-R-plugin sets many default key bindings.  The user can set custom
 key bindings (|r-plugin-key-bindings|).  If you wish the Vim-R-plugin to only
 set those key-bindings specified by the user, put in your vimrc:
@@ -2236,8 +2259,6 @@ directory after the installation:
    syntax/rbrowser.vim
    doc/r-plugin.txt
    r-plugin/vimcom.py
-   r-plugin/nvimcom.py
-   r-plugin/nvimserver.py
    r-plugin/global_r_plugin.vim
    r-plugin/windows.py
    r-plugin/objlist/README
@@ -2923,6 +2944,10 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details.
 							       *r-plugin-news*
 10. News~
 
+1.1.1 (2014-11-17)
+
+ * New option (Neovim only): vimrplugin_r_in_buffer.
+
 1.1 (2014-11-13)
 
  * Version update for Linux/Unix only. May not work on Windows or Mac.
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 2830065..612f9f4 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -777,6 +777,45 @@ function StartR_OSX()
     endif
 endfunction
 
+function! StartR_Neovim()
+    if string(g:SendCmdToR) != "function('SendCmdToR_fake')"
+        return
+    endif
+    let g:rplugin_do_tmux_split = 0
+
+    let g:SendCmdToR = function('SendCmdToR_Neovim')
+
+    let vimrplugin_vimpager = "vertical"
+
+    let edbuf = bufname("%")
+    set switchbuf=useopen
+    vsplit R_Output
+    let b:winwidth = 0
+    set filetype=rout
+    setlocal noswapfile
+    set buftype=nofile
+    syn region routStdErr start='^: ' end="$" contains=routConceal
+    syn region routError start='^: .*Error.*' end='^>' contains=routConceal
+    syn region routWarn start='^: .*Warn.*' end='^>' contains=routConceal
+    syn match routConceal '^: ' conceal contained
+    hi def link routStdErr Function
+    hi def link routError ErrorMsg
+    hi def link routWarn WarningMsg
+    hi def link routConceal Ignore
+    setlocal conceallevel=2
+    imap   :call EnterRCmd()o
+    exe "sbuffer " . edbuf
+
+    nmap  :call OpenRScratch()
+
+    let savedterm = $TERM
+    let $TERM="NeovimTerm"
+    let g:rjob = jobstart("test", 'R', ['--no-readline', '--slave', '--interactive'])
+    autocmd JobActivity test call GetRActivity()
+    exe 'let $TERM="' . savedterm . '"'
+    call WaitVimComStart()
+endfunction
+
 function IsSendCmdToRFake()
     if string(g:SendCmdToR) != "function('SendCmdToR_fake')"
 	if exists("g:maplocalleader")
@@ -826,6 +865,11 @@ function StartR(whatr)
         endif
     endif
 
+    if g:vimrplugin_r_in_buffer
+        call StartR_Neovim()
+        return
+    endif
+
     if g:vimrplugin_applescript
         call StartR_OSX()
         return
@@ -919,6 +963,59 @@ function StartR(whatr)
     echon
 endfunction
 
+function GetRActivity()
+    if v:job_data[1] == 'stdout' || v:job_data[1] == 'stderr'
+        for lin in v:job_data[2]
+            let edbuf = bufname("%")
+            sbuffer R_Output
+            if v:job_data[1] == 'stderr'
+                let lin = ': ' . lin
+            endif
+            call append(line("$"), lin)
+            if edbuf == "R_Output"
+                call append(line("$"), "")
+            endif
+            call cursor("$", 1)
+            exe "sbuffer " . edbuf
+        endfor
+    else
+        call RWarningMsg("R finished")
+    endif
+endfunction
+
+function SendCmdToR_Neovim(rcmd)
+    let edbuf = bufname("%")
+    sbuffer R_Output
+    if winwidth(0) != b:winwidth
+        let b:winwidth = winwidth(0)
+        call g:SendToVimCom("\x08" . $VIMINSTANCEID . "options(width=" . b:winwidth . ")", "I")
+    endif
+    call append(line("$"), "> " . a:rcmd)
+    call cursor("$", 1)
+    exe "sbuffer " . edbuf
+    let ok = jobsend(g:rjob, a:rcmd . "\n")
+    return ok
+endfunction
+
+function EnterRCmd()
+    if line(".") != line("$")
+        return
+    endif
+    let lin = getline(".")
+    call setline(".", "")
+    call SendCmdToR_Neovim(lin)
+endfunction
+
+function OpenRScratch()
+    below 6split R_Scratch
+    set filetype=r
+    setlocal noswapfile
+    set buftype=nofile
+    nmap   :quit
+    nmap  q :quit
+    startinsert
+endfunction
+
 function RSetNeovimPort(p)
     let g:rplugin_myport = a:p
     if &filetype == "rbrowser" && g:rplugin_do_tmux_split
@@ -2074,10 +2171,14 @@ function RQuit(how)
     if g:rplugin_do_tmux_split && g:vimrplugin_tmux_title != "automatic" && g:vimrplugin_tmux_title != ""
         call system("tmux set automatic-rename on")
     endif
-    if has("nvim")
-        " Force Neovim to update the window size
-        sleep 500m
-        mode
+    if has("nvim") 
+        if g:rplugin_do_tmux_split
+            " Force Neovim to update the window size
+            sleep 500m
+            mode
+        elseif g:vimrplugin_r_in_buffer
+            bunload R_Output
+        endif
     endif
 endfunction
 
@@ -3517,7 +3618,9 @@ call RSetDefaultValue("g:vimrplugin_objbr_w",          40)
 call RSetDefaultValue("g:vimrplugin_external_ob",       0)
 if has("nvim")
     call RSetDefaultValue("g:vimrplugin_vimcom_wait", 15000)
+    call RSetDefaultValue("g:vimrplugin_r_in_buffer",     0)
 else
+    let g:vimrplugin_r_in_buffer = 0
     call RSetDefaultValue("g:vimrplugin_vimcom_wait", 5000)
 endif
 call RSetDefaultValue("g:vimrplugin_show_args",         0)
@@ -3526,7 +3629,11 @@ call RSetDefaultValue("g:vimrplugin_insert_mode_cmds",  1)
 call RSetDefaultValue("g:vimrplugin_indent_commented",  1)
 call RSetDefaultValue("g:vimrplugin_source",         "''")
 call RSetDefaultValue("g:vimrplugin_rcomment_string", "'# '")
-call RSetDefaultValue("g:vimrplugin_vimpager",        "'tab'")
+if g:vimrplugin_r_in_buffer
+    call RSetDefaultValue("g:vimrplugin_vimpager", "'vertical'")
+else
+    call RSetDefaultValue("g:vimrplugin_vimpager",      "'tab'")
+endif
 call RSetDefaultValue("g:vimrplugin_objbr_place",     "'script,right'")
 call RSetDefaultValue("g:vimrplugin_permanent_libs",  "'base,stats,graphics,grDevices,utils,datasets,methods'")
 call RSetDefaultValue("g:vimrplugin_user_maps_only", 0)

From 5006893ad02b6746b6fa369e8d8ca9931842cc68 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Tue, 18 Nov 2014 08:57:33 -0500
Subject: [PATCH 0833/1050] Improvements in R in Neovim buffer.

---
 doc/r-plugin.txt           |  6 ++++--
 r-plugin/common_global.vim | 29 +++++++++++++++++++++++++----
 2 files changed, 29 insertions(+), 6 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 4490b35..e8252ae 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -1306,8 +1306,10 @@ R will run as a Neovim job (see |job-control|) and the output will be
 displayed in a buffer. In addition to sending code from the R script buffer to
 R, you can also press  in Normal mode to open an R
 scratch buffer to type commands that want to see evaluated by R but do not
-want in your final script because in the scratch buffer omnicompletion and
-syntax highlight will be active.
+want in your final script. Syntax highlight and omnicompletion will be
+available in the scratch buffer. If the cursor is in the last line of the
+R_Output buffer and Neovim is in Insert mode, an  will submit the line
+to R evaluation.
 
 Note: This is an experimental feature to test Neovim capabilities and may be
 removed in the future.
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 612f9f4..358be18 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -789,7 +789,19 @@ function! StartR_Neovim()
 
     let edbuf = bufname("%")
     set switchbuf=useopen
-    vsplit R_Output
+    if g:vimrplugin_vsplit
+        if g:vimrplugin_rconsole_width > 16 && g:vimrplugin_rconsole_width < (winwidth(0) - 16)
+            exe "belowright " . g:vimrplugin_rconsole_width . "vsplit R_Output"
+        else
+            belowright vsplit R_Output
+        endif
+    else
+        if g:vimrplugin_rconsole_height > 6 && g:vimrplugin_rconsole_height < (winheight(0) - 6)
+            exe "belowright " . g:vimrplugin_rconsole_height . "split R_Output"
+        else
+            belowright split R_Output
+        endif
+    endif
     let b:winwidth = 0
     set filetype=rout
     setlocal noswapfile
@@ -804,13 +816,14 @@ function! StartR_Neovim()
     hi def link routConceal Ignore
     setlocal conceallevel=2
     imap   :call EnterRCmd()o
+    call cursor("$", 1)
     exe "sbuffer " . edbuf
 
     nmap  :call OpenRScratch()
 
     let savedterm = $TERM
     let $TERM="NeovimTerm"
-    let g:rjob = jobstart("test", 'R', ['--no-readline', '--slave', '--interactive'])
+    let g:rplugin_rjob = jobstart("test", 'R', ['--no-readline', '--slave', '--interactive'])
     autocmd JobActivity test call GetRActivity()
     exe 'let $TERM="' . savedterm . '"'
     call WaitVimComStart()
@@ -979,7 +992,15 @@ function GetRActivity()
             exe "sbuffer " . edbuf
         endfor
     else
-        call RWarningMsg("R finished")
+        let g:rplugin_rjob = 0
+        let g:SendCmdToR = function('SendCmdToR_fake')
+        if bufname("%") == "R_Output"
+            call append("$", ':    ---  R Finished  ---')
+            call cursor("$", 25)
+        endif
+        if mode() == "n"
+            call RWarningMsg("R finished")
+        endif
     endif
 endfunction
 
@@ -993,7 +1014,7 @@ function SendCmdToR_Neovim(rcmd)
     call append(line("$"), "> " . a:rcmd)
     call cursor("$", 1)
     exe "sbuffer " . edbuf
-    let ok = jobsend(g:rjob, a:rcmd . "\n")
+    let ok = jobsend(g:rplugin_rjob, a:rcmd . "\n")
     return ok
 endfunction
 

From d7cb41cc21b03bf5abfa89d48a9d784a1a4ba2ce Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sat, 22 Nov 2014 10:07:36 -0500
Subject: [PATCH 0834/1050] Fix directory path in Windows.

---
 ftplugin/rmd_rplugin.vim    | 10 +++++++---
 ftplugin/rnoweb_rplugin.vim | 24 ++++++++++++++++++------
 ftplugin/rrst_rplugin.vim   | 14 +++++++++-----
 r-plugin/common_global.vim  |  8 +++++---
 4 files changed, 39 insertions(+), 17 deletions(-)

diff --git a/ftplugin/rmd_rplugin.vim b/ftplugin/rmd_rplugin.vim
index 3224ef3..8925924 100644
--- a/ftplugin/rmd_rplugin.vim
+++ b/ftplugin/rmd_rplugin.vim
@@ -80,10 +80,14 @@ function! RMakeRmd(t)
         endif
     endif
 
+    let rmddir = expand("%:p:h")
+    if has("win32") || has("win64")
+        let rnwdif = substitute(rnwdir, '\\', '/', 'g')
+    endif
     if a:t == "default"
-        let rcmd = 'vim.interlace.rmd("' . expand("%:t") . '", rmddir = "' . expand("%:p:h") . '"'
+        let rcmd = 'vim.interlace.rmd("' . expand("%:t") . '", rmddir = "' . rmdir . '"'
     else
-        let rcmd = 'vim.interlace.rmd("' . expand("%:t") . '", outform = "' . a:t .'", rmddir = "' . expand("%:p:h") . '"'
+        let rcmd = 'vim.interlace.rmd("' . expand("%:t") . '", outform = "' . a:t .'", rmddir = "' . rmdir . '"'
     endif
     if (g:vimrplugin_openhtml  == 0 && a:t == "html_document") || (g:vimrplugin_openpdf == 0 && (a:t == "pdf_document" || a:t == "beamer_presentation"))
         let rcmd .= ", view = FALSE"
@@ -107,7 +111,7 @@ function! SendRmdChunkToR(e, m)
     endif
     if a:m == "down"
         call RmdNextChunk()
-    endif  
+    endif
 endfunction
 
 let b:IsInRCode = function("RmdIsInRCode")
diff --git a/ftplugin/rnoweb_rplugin.vim b/ftplugin/rnoweb_rplugin.vim
index 8fe8292..3556e45 100644
--- a/ftplugin/rnoweb_rplugin.vim
+++ b/ftplugin/rnoweb_rplugin.vim
@@ -77,10 +77,14 @@ endfunction
 " knit the current buffer content
 function! RKnitRnw()
     update
+    let rnwdir = expand("%:p:h")
+    if has("win32") || has("win64")
+        let rnwdif = substitute(rnwdir, '\\', '/', 'g')
+    endif
     if g:vimrplugin_synctex == 0
-        call g:SendCmdToR('vim.interlace.rnoweb("' . expand("%:t") . '", rnwdir = "' . expand("%:p:h") . '", buildpdf = FALSE, synctex = FALSE)')
+        call g:SendCmdToR('vim.interlace.rnoweb("' . expand("%:t") . '", rnwdir = "' . rnwdir . '", buildpdf = FALSE, synctex = FALSE)')
     else
-        call g:SendCmdToR('vim.interlace.rnoweb("' . expand("%:t") . '", rnwdir = "' . expand("%:p:h") . '", buildpdf = FALSE)')
+        call g:SendCmdToR('vim.interlace.rnoweb("' . expand("%:t") . '", rnwdir = "' . rnwdir . '", buildpdf = FALSE)')
     endif
 endfunction
 
@@ -97,7 +101,11 @@ function! RMakePDF(bibtex, knit)
         endif
     endif
     update
-    let pdfcmd = 'vim.interlace.rnoweb("' . expand("%:t") . '", rnwdir = "' . expand("%:p:h") . '"'
+    let rnwdir = expand("%:p:h")
+    if has("win32") || has("win64")
+        let rnwdif = substitute(rnwdir, '\\', '/', 'g')
+    endif
+    let pdfcmd = 'vim.interlace.rnoweb("' . expand("%:t") . '", rnwdir = "' . rnwdir . '"'
 
     if a:knit == 0
         let pdfcmd = pdfcmd . ', knit = FALSE'
@@ -144,7 +152,7 @@ function! RMakePDF(bibtex, knit)
     if ok == 0
         return
     endif
-endfunction  
+endfunction
 
 " Send Sweave chunk to R
 function! RnwSendChunkToR(e, m)
@@ -161,13 +169,17 @@ function! RnwSendChunkToR(e, m)
     endif
     if a:m == "down"
         call RnwNextChunk()
-    endif  
+    endif
 endfunction
 
 " Sweave the current buffer content
 function! RSweave()
     update
-    let scmd = 'vim.interlace.rnoweb("' . expand("%:t") . '", rnwdir = "' . expand("%:p:h") . '", knit = FALSE, buildpdf = FALSE'
+    let rnwdir = expand("%:p:h")
+    if has("win32") || has("win64")
+        let rnwdif = substitute(rnwdir, '\\', '/', 'g')
+    endif
+    let scmd = 'vim.interlace.rnoweb("' . expand("%:t") . '", rnwdir = "' . rnwdir . '", knit = FALSE, buildpdf = FALSE'
     if exists("g:vimrplugin_sweaveargs")
         let scmd .= ', ' . g:vimrplugin_sweaveargs
     endif
diff --git a/ftplugin/rrst_rplugin.vim b/ftplugin/rrst_rplugin.vim
index 2bb4cc4..443a8aa 100644
--- a/ftplugin/rrst_rplugin.vim
+++ b/ftplugin/rrst_rplugin.vim
@@ -9,7 +9,7 @@ if exists("g:rplugin_failed")
     finish
 endif
 
-" Some buffer variables common to R, Rrst, Rnoweb, Rhelp and Rdoc need to be 
+" Some buffer variables common to R, Rrst, Rnoweb, Rhelp and Rdoc need to be
 " defined after the global ones:
 runtime r-plugin/common_buffer.vim
 
@@ -81,7 +81,7 @@ function! RMakeHTMLrrst(t)
         let rcmd = rcmd . '; render_rst(strict=TRUE)'
     endif
     let rcmd = rcmd . '; knit("' . expand("%:t") . '")'
-    
+
     if a:t == "odt"
         let rcmd = rcmd . '; system("rst2odt ' . expand("%:r:t") . ".rst " . expand("%:r:t") . '.odt")'
     else
@@ -118,7 +118,11 @@ function! RMakePDFrrst()
         endif
     endif
 
-    let pdfcmd = 'vim.interlace.rrst("' . expand("%:t") . '", rrstdir = "' . expand("%:p:h") . '"'
+    let rrstdir = expand("%:p:h")
+    if has("win32") || has("win64")
+        let rnwdif = substitute(rnwdir, '\\', '/', 'g')
+    endif
+    let pdfcmd = 'vim.interlace.rrst("' . expand("%:t") . '", rrstdir = "' . rrstdir . '"'
     if exists("g:vimrplugin_rrstcompiler")
         let pdfcmd = pdfcmd . ", compiler='" . g:vimrplugin_rrstcompiler . "'"
     endif
@@ -136,7 +140,7 @@ function! RMakePDFrrst()
     if ok == 0
         return
     endif
-endfunction  
+endfunction
 
 " Send Rrst chunk to R
 function! SendRrstChunkToR(e, m)
@@ -153,7 +157,7 @@ function! SendRrstChunkToR(e, m)
     endif
     if a:m == "down"
         call RrstNextChunk()
-    endif  
+    endif
 endfunction
 
 let b:IsInRCode = function("RrstIsInRCode")
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 358be18..40a4a7a 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -785,8 +785,6 @@ function! StartR_Neovim()
 
     let g:SendCmdToR = function('SendCmdToR_Neovim')
 
-    let vimrplugin_vimpager = "vertical"
-
     let edbuf = bufname("%")
     set switchbuf=useopen
     if g:vimrplugin_vsplit
@@ -2206,7 +2204,11 @@ endfunction
 " knit the current buffer content
 function! RKnit()
     update
-    call g:SendCmdToR('require(knitr); .vim_oldwd <- getwd(); setwd("' . expand("%:p:h") . '"); knit("' . expand("%:t") . '"); setwd(.vim_oldwd); rm(.vim_oldwd)')
+    if has("win32") || has("win64")
+        call g:SendCmdToR('require(knitr); .vim_oldwd <- getwd(); setwd("' . substitute(expand("%:p:h"), '\\', '/', 'g') . '"); knit("' . expand("%:t") . '"); setwd(.vim_oldwd); rm(.vim_oldwd)')
+    else
+        call g:SendCmdToR('require(knitr); .vim_oldwd <- getwd(); setwd("' . expand("%:p:h") . '"); knit("' . expand("%:t") . '"); setwd(.vim_oldwd); rm(.vim_oldwd)')
+    endif
 endfunction
 
 function RRemoveFromLibls(nlib)

From fb1e4fd83d5802e98529d3d19a68ddce89da40ae Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sun, 23 Nov 2014 10:18:42 -0500
Subject: [PATCH 0835/1050] Fix names of local variables.

---
 ftplugin/rmd_rplugin.vim    | 2 +-
 ftplugin/rnoweb_rplugin.vim | 6 +++---
 ftplugin/rrst_rplugin.vim   | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/ftplugin/rmd_rplugin.vim b/ftplugin/rmd_rplugin.vim
index 8925924..8a8a908 100644
--- a/ftplugin/rmd_rplugin.vim
+++ b/ftplugin/rmd_rplugin.vim
@@ -82,7 +82,7 @@ function! RMakeRmd(t)
 
     let rmddir = expand("%:p:h")
     if has("win32") || has("win64")
-        let rnwdif = substitute(rnwdir, '\\', '/', 'g')
+        let rmddir = substitute(rnwdir, '\\', '/', 'g')
     endif
     if a:t == "default"
         let rcmd = 'vim.interlace.rmd("' . expand("%:t") . '", rmddir = "' . rmdir . '"'
diff --git a/ftplugin/rnoweb_rplugin.vim b/ftplugin/rnoweb_rplugin.vim
index 3556e45..2babff4 100644
--- a/ftplugin/rnoweb_rplugin.vim
+++ b/ftplugin/rnoweb_rplugin.vim
@@ -79,7 +79,7 @@ function! RKnitRnw()
     update
     let rnwdir = expand("%:p:h")
     if has("win32") || has("win64")
-        let rnwdif = substitute(rnwdir, '\\', '/', 'g')
+        let rnwdir = substitute(rnwdir, '\\', '/', 'g')
     endif
     if g:vimrplugin_synctex == 0
         call g:SendCmdToR('vim.interlace.rnoweb("' . expand("%:t") . '", rnwdir = "' . rnwdir . '", buildpdf = FALSE, synctex = FALSE)')
@@ -103,7 +103,7 @@ function! RMakePDF(bibtex, knit)
     update
     let rnwdir = expand("%:p:h")
     if has("win32") || has("win64")
-        let rnwdif = substitute(rnwdir, '\\', '/', 'g')
+        let rnwdir = substitute(rnwdir, '\\', '/', 'g')
     endif
     let pdfcmd = 'vim.interlace.rnoweb("' . expand("%:t") . '", rnwdir = "' . rnwdir . '"'
 
@@ -177,7 +177,7 @@ function! RSweave()
     update
     let rnwdir = expand("%:p:h")
     if has("win32") || has("win64")
-        let rnwdif = substitute(rnwdir, '\\', '/', 'g')
+        let rnwdir = substitute(rnwdir, '\\', '/', 'g')
     endif
     let scmd = 'vim.interlace.rnoweb("' . expand("%:t") . '", rnwdir = "' . rnwdir . '", knit = FALSE, buildpdf = FALSE'
     if exists("g:vimrplugin_sweaveargs")
diff --git a/ftplugin/rrst_rplugin.vim b/ftplugin/rrst_rplugin.vim
index 443a8aa..477e2be 100644
--- a/ftplugin/rrst_rplugin.vim
+++ b/ftplugin/rrst_rplugin.vim
@@ -120,7 +120,7 @@ function! RMakePDFrrst()
 
     let rrstdir = expand("%:p:h")
     if has("win32") || has("win64")
-        let rnwdif = substitute(rnwdir, '\\', '/', 'g')
+        let rrstdir = substitute(rrstdir, '\\', '/', 'g')
     endif
     let pdfcmd = 'vim.interlace.rrst("' . expand("%:t") . '", rrstdir = "' . rrstdir . '"'
     if exists("g:vimrplugin_rrstcompiler")

From 56da1b8c9242929e64bf7bf8fdf4d09c0b3d272e Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sun, 23 Nov 2014 16:34:07 -0500
Subject: [PATCH 0836/1050] Improve colors of R output (filetype=rout).

---
 doc/r-plugin.txt           |  55 ++++++++---
 r-plugin/common_global.vim |  42 +++++----
 syntax/rout.vim            | 183 ++++++++++++++++++++++++++++++-------
 3 files changed, 216 insertions(+), 64 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index e8252ae..845ac38 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -1297,22 +1297,55 @@ it.
 						      *vimrplugin_r_in_buffer*
 6.3. Run R in Neovim buffer (experimental feature)~
 
+Note: This is an experimental feature to test Neovim capabilities and may be
+removed in the future.
+
 If you are running Neovim and want to try this experimental feature, put in
 your |vimrc|:
 >
    let vimrplugin_r_in_buffer = 1
 <
-R will run as a Neovim job (see |job-control|) and the output will be
-displayed in a buffer. In addition to sending code from the R script buffer to
-R, you can also press  in Normal mode to open an R
-scratch buffer to type commands that want to see evaluated by R but do not
-want in your final script. Syntax highlight and omnicompletion will be
-available in the scratch buffer. If the cursor is in the last line of the
-R_Output buffer and Neovim is in Insert mode, an  will submit the line
-to R evaluation.
+R will run as a Neovim job and the output will be displayed in a buffer. In
+addition to sending code from the R script buffer to R, you can also press
+ in Normal mode to open an R scratch buffer to type
+commands that want to see evaluated by R but do not want in your final script.
+Syntax highlight and omnicompletion will be available in the scratch buffer.
+If the cursor is in the last line of the R_Output buffer and Neovim is in
+Insert mode, an  will submit the line to R evaluation.
+
+You can set the foreground colors of R output in your |vimrc| when you are
+running Neovim in a terminal emulator. The example below is for a terminal
+emulator that supports 256 colors (see |highlight-ctermfg|):
+>
+   if &t_Co == 256
+       let rout_color_input = 247
+       let rout_color_normal = 39
+       let rout_color_number = 51
+       let rout_color_integer = 51
+       let rout_color_float = 51
+       let rout_color_complex = 51
+       let rout_color_negnum = 183
+       let rout_color_negfloat = 183
+       let rout_color_date = 43
+       let rout_color_bool = 75
+       let rout_color_constant = 75
+       let rout_color_string = 79
+       let rout_color_stderr = 33
+       let rout_color_error = 15
+       let rout_color_warn = 1
+       let rout_color_index = 186
+   endif
+<
+To know what number corresponds to your preferred color (among the 256
+possibilities), hover you mouser pointer over the table of colors at the end
+of http://www.lepem.ufc.br/jaa/colorout.html
 
-Note: This is an experimental feature to test Neovim capabilities and may be
-removed in the future.
+If you prefer that R output is highlighted using you current |:colorscheme|,
+put in your vimrc:
+>
+   let rout_follow_colorscheme = 1
+<
+Note: See |job-control| if you want to know more about Neovim jobs.
 
 
 ------------------------------------------------------------------------------
@@ -2946,7 +2979,7 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details.
 							       *r-plugin-news*
 10. News~
 
-1.1.1 (2014-11-17)
+1.1.1 (2014-11-22)
 
  * New option (Neovim only): vimrplugin_r_in_buffer.
 
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 40a4a7a..68bb941 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -803,16 +803,8 @@ function! StartR_Neovim()
     let b:winwidth = 0
     set filetype=rout
     setlocal noswapfile
+    setlocal bufhidden=hide
     set buftype=nofile
-    syn region routStdErr start='^: ' end="$" contains=routConceal
-    syn region routError start='^: .*Error.*' end='^>' contains=routConceal
-    syn region routWarn start='^: .*Warn.*' end='^>' contains=routConceal
-    syn match routConceal '^: ' conceal contained
-    hi def link routStdErr Function
-    hi def link routError ErrorMsg
-    hi def link routWarn WarningMsg
-    hi def link routConceal Ignore
-    setlocal conceallevel=2
     imap   :call EnterRCmd()o
     call cursor("$", 1)
     exe "sbuffer " . edbuf
@@ -821,8 +813,7 @@ function! StartR_Neovim()
 
     let savedterm = $TERM
     let $TERM="NeovimTerm"
-    let g:rplugin_rjob = jobstart("test", 'R', ['--no-readline', '--slave', '--interactive'])
-    autocmd JobActivity test call GetRActivity()
+    let g:rplugin_rjob = jobstart("Rjob", 'R', ['--no-readline', '--slave', '--interactive'])
     exe 'let $TERM="' . savedterm . '"'
     call WaitVimComStart()
 endfunction
@@ -976,9 +967,15 @@ endfunction
 
 function GetRActivity()
     if v:job_data[1] == 'stdout' || v:job_data[1] == 'stderr'
+        let edbuf = bufname("%")
+        sbuffer R_Output
         for lin in v:job_data[2]
-            let edbuf = bufname("%")
-            sbuffer R_Output
+            if lin =~ ".\x0d."
+                let lin = substitute(lin, ".*\x0d", "", "g")
+            endif
+            if lin =~ "\x0d$"
+                let lin = substitute(lin, "\x0d$", "", "g")
+            endif
             if v:job_data[1] == 'stderr'
                 let lin = ': ' . lin
             endif
@@ -986,15 +983,17 @@ function GetRActivity()
             if edbuf == "R_Output"
                 call append(line("$"), "")
             endif
-            call cursor("$", 1)
-            exe "sbuffer " . edbuf
         endfor
+        call cursor("$", 1)
+        exe "sbuffer " . edbuf
     else
         let g:rplugin_rjob = 0
         let g:SendCmdToR = function('SendCmdToR_fake')
         if bufname("%") == "R_Output"
             call append("$", ':    ---  R Finished  ---')
-            call cursor("$", 25)
+            call append("$", "")
+            sleep 500m
+            quit
         endif
         if mode() == "n"
             call RWarningMsg("R finished")
@@ -1085,11 +1084,13 @@ function WaitVimComStart()
             else
                 call RWarningMsg('Application "' . g:rplugin_vimcom_home . "/bin/nvimclient" . '" not found.")
             endif
-            if filereadable(g:rplugin_vimcom_home . "/bin/nvimserver") && !exists("g:rplugin_srv_job")
-                let g:rplugin_srv_job = jobstart('udpsvr', g:rplugin_vimcom_home . "/bin/nvimserver")
-                autocmd JobActivity udpsvr call ROnJobActivity()
+            if filereadable(g:rplugin_vimcom_home . "/bin/nvimserver")
+                if !exists("g:rplugin_srv_job")
+                    let g:rplugin_srv_job = jobstart('udpsvr', g:rplugin_vimcom_home . "/bin/nvimserver")
+                    autocmd JobActivity udpsvr call ROnJobActivity()
+                endif
             else
-                call RWarningMsg('Application "' . g:rplugin_vimcom_home . "/bin/nvimserver" . '" not found.")
+                call RWarningMsg('Application "' . g:rplugin_vimcom_home . "/bin/nvimserver" . '" not found.')
             endif
         endif
         call delete($VIMRPLUGIN_TMPDIR . "/vimcom_running_" . $VIMINSTANCEID)
@@ -3654,6 +3655,7 @@ call RSetDefaultValue("g:vimrplugin_source",         "''")
 call RSetDefaultValue("g:vimrplugin_rcomment_string", "'# '")
 if g:vimrplugin_r_in_buffer
     call RSetDefaultValue("g:vimrplugin_vimpager", "'vertical'")
+    autocmd JobActivity Rjob call GetRActivity()
 else
     call RSetDefaultValue("g:vimrplugin_vimpager",      "'tab'")
 endif
diff --git a/syntax/rout.vim b/syntax/rout.vim
index 1dd607c..41a257f 100644
--- a/syntax/rout.vim
+++ b/syntax/rout.vim
@@ -1,7 +1,7 @@
 " Vim syntax file
 " Language:    R output Files
 " Maintainer:  Jakson Aquino 
-" Last Change: Sun Nov 02, 2014  08:47PM
+" Last Change: Sun Nov 23, 2014  04:27PM
 "
 
 " Version Clears: {{{1
@@ -14,56 +14,73 @@ elseif exists("b:current_syntax")
 endif 
 
 setlocal iskeyword=@,48-57,_,.
+setlocal conceallevel=2
 
 syn case match
 
+" Normal text
+syn match routNormal "."
+
 " Strings
 syn region routString start=/"/ skip=/\\\\\|\\"/ end=/"/ end=/$/
 
 " Constants
-syn keyword rConstant NULL
-syn keyword rBoolean  FALSE TRUE
-syn keyword rNumber   NA Inf NaN 
+syn keyword routConst  NULL NA
+syn keyword routBool   FALSE TRUE
+syn keyword routNumber Inf NaN
+syn match routConst "\"
 
 " integer
-syn match rInteger "\<\d\+L"
-syn match rInteger "\<0x\([0-9]\|[a-f]\|[A-F]\)\+L"
-syn match rInteger "\<\d\+[Ee]+\=\d\+L"
+syn match routInteger "\<\d\+L"
+syn match routInteger "\<0x\([0-9]\|[a-f]\|[A-F]\)\+L"
+syn match routInteger "\<\d\+[Ee]+\=\d\+L"
 
 " number with no fractional part or exponent
-syn match rNumber "\<\d\+\>"
+syn match routNumber "\<\d\+\>"
+syn match routNegNum "-\<\d\+\>"
 " hexadecimal number 
-syn match rNumber "\<0x\([0-9]\|[a-f]\|[A-F]\)\+"
+syn match routNumber "\<0x\([0-9]\|[a-f]\|[A-F]\)\+"
 
 " floating point number with integer and fractional parts and optional exponent
-syn match rFloat "\<\d\+\.\d*\([Ee][-+]\=\d\+\)\="
+syn match routFloat "\<\d\+\.\d*\([Ee][-+]\=\d\+\)\="
+syn match routNegFlt "-\<\d\+\.\d*\([Ee][-+]\=\d\+\)\="
 " floating point number with no integer part and optional exponent
-syn match rFloat "\<\.\d\+\([Ee][-+]\=\d\+\)\="
+syn match routFloat "\<\.\d\+\([Ee][-+]\=\d\+\)\="
+syn match routNegFlt "-\<\.\d\+\([Ee][-+]\=\d\+\)\="
 " floating point number with no fractional part and optional exponent
-syn match rFloat "\<\d\+[Ee][-+]\=\d\+"
+syn match routFloat "\<\d\+[Ee][-+]\=\d\+"
+syn match routNegFlt "-\<\d\+[Ee][-+]\=\d\+"
 
 " complex number
-syn match rComplex "\<\d\+i"
-syn match rComplex "\<\d\++\d\+i"
-syn match rComplex "\<0x\([0-9]\|[a-f]\|[A-F]\)\+i"
-syn match rComplex "\<\d\+\.\d*\([Ee][-+]\=\d\+\)\=i"
-syn match rComplex "\<\.\d\+\([Ee][-+]\=\d\+\)\=i"
-syn match rComplex "\<\d\+[Ee][-+]\=\d\+i"
+syn match routComplex "\<\d\+i"
+syn match routComplex "\<\d\++\d\+i"
+syn match routComplex "\<0x\([0-9]\|[a-f]\|[A-F]\)\+i"
+syn match routComplex "\<\d\+\.\d*\([Ee][-+]\=\d\+\)\=i"
+syn match routComplex "\<\.\d\+\([Ee][-+]\=\d\+\)\=i"
+syn match routComplex "\<\d\+[Ee][-+]\=\d\+i"
+
+" dates
+syn match routDate "[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][-0-9]"
 
 if !exists("g:vimrplugin_routmorecolors")
     let g:vimrplugin_routmorecolors = 0
 endif
 
-if g:vimrplugin_routmorecolors == 1
+if g:vimrplugin_routmorecolors
     syn include @routR syntax/r.vim
     syn region routColoredR start="^> " end='$' contains=@routR keepend
     syn region routColoredR start="^+ " end='$' contains=@routR keepend
 else
-    " Comment
-    syn match routComment /^> .*/
-    syn match routComment /^+ .*/
+    " Input
+    syn match routInput /^> .*/
+    syn match routInput /^+ .*/
 endif
 
+syn region routStdErr start='^: ' end="$" contains=routConceal
+syn region routError start='^: .*Error.*' end='^>' contains=routConceal
+syn region routWarn start='^: .*Warn.*' end='^>' contains=routConceal
+syn match routConceal '^: ' conceal contained
+
 " Index of vectors
 syn match routIndex /^\s*\[\d\+\]/
 
@@ -123,18 +140,118 @@ endif
 
 " Define the default highlighting.
 if g:vimrplugin_routmorecolors == 0
-    hi def link routComment	Comment
+    hi def link routInput	Comment
+endif
+
+if exists("g:rout_follow_colorscheme") && g:rout_follow_colorscheme
+    " Default when following :colorscheme
+    hi def link routNormal	Normal
+    hi def link routNumber	Number
+    hi def link routInteger	Number
+    hi def link routFloat	Float
+    hi def link routComplex	Number
+    hi def link routNegNum	Number
+    hi def link routNegFlt	Float
+    hi def link routDate	Number
+    hi def link routBool	Boolean
+    hi def link routConst	Constant
+    hi def link routString	String
+    hi def link routError	Error
+    hi def link routWarn	WarningMsg
+    hi def link routIndex	Special
+    hi def link routStdErr	Function
+    hi def link routError	ErrorMsg
+    hi def link routWarn	WarningMsg
+    hi def link routConceal	Ignore
+else
+    if &t_Co == 256
+        " Defalt 256 colors scheme for R output:
+        hi routInput	ctermfg=247
+        hi routNormal	ctermfg=40
+        hi routNumber	ctermfg=214
+        hi routInteger	ctermfg=214
+        hi routFloat	ctermfg=214
+        hi routComplex	ctermfg=214
+        hi routNegNum	ctermfg=209
+        hi routNegFlt	ctermfg=209
+        hi routDate	ctermfg=179
+        hi routBool	ctermfg=35
+        hi routConst	ctermfg=35
+        hi routString	ctermfg=85
+        hi routStdErr	ctermfg=117
+        hi routError	ctermfg=15 ctermbg=1
+        hi routWarn	ctermfg=1
+        hi routIndex	ctermfg=186
+    else
+        " Defalt 16 colors scheme for R output:
+        hi routInput	ctermfg=gray
+        hi routNormal	ctermfg=darkgreen
+        hi routNumber	ctermfg=darkyellow
+        hi routInteger	ctermfg=darkyellow
+        hi routFloat	ctermfg=darkyellow
+        hi routComplex	ctermfg=darkyellow
+        hi routNegNum	ctermfg=darkyellow
+        hi routNegFlt	ctermfg=darkyellow
+        hi routDate	ctermfg=darkyellow
+        hi routBool	ctermfg=magenta
+        hi routConst	ctermfg=magenta
+        hi routString	ctermfg=darkcyan
+        hi routStdErr	ctermfg=cyan
+        hi routError	ctermfg=white ctermbg=red
+        hi routWarn	ctermfg=red
+        hi routIndex	ctermfg=darkgreen
+    endif
+
+    " Change colors under user request:
+    if exists("g:rout_color_input")
+        exe "hi routInput ctermfg=" . g:rout_color_input
+    endif
+    if exists("g:rout_color_normal")
+        exe "hi routNormal ctermfg=" . g:rout_color_normal
+    endif
+    if exists("g:rout_color_number")
+        exe "hi routNumber ctermfg=" . g:rout_color_number
+    endif
+    if exists("g:rout_color_integer")
+        exe "hi routInteger ctermfg=" . g:rout_color_integer
+    endif
+    if exists("g:rout_color_float")
+        exe "hi routFloat ctermfg=" . g:rout_color_float
+    endif
+    if exists("g:rout_color_complex")
+        exe "hi routComplex ctermfg=" . g:rout_color_complex
+    endif
+    if exists("g:rout_color_negnum")
+        exe "hi routNegNum ctermfg=" . g:rout_color_negnum
+    endif
+    if exists("g:rout_color_negfloat")
+        exe "hi routNegFlt ctermfg=" . g:rout_color_negfloat
+    endif
+    if exists("g:rout_color_date")
+        exe "hi routDate ctermfg=" . g:rout_color_date
+    endif
+    if exists("g:rout_color_bool")
+        exe "hi routBool ctermfg=" . g:rout_color_bool
+    endif
+    if exists("g:rout_color_constant")
+        exe "hi routConst ctermfg=" . g:rout_color_constant
+    endif
+    if exists("g:rout_color_string")
+        exe "hi routString ctermfg=" . g:rout_color_string
+    endif
+    if exists("g:rout_color_stderr")
+        exe "hi routStdErr ctermfg=" . g:rout_color_stderr
+    endif
+    if exists("g:rout_color_error")
+        exe "hi routError ctermfg=" . g:rout_color_error
+    endif
+    if exists("g:rout_color_warn")
+        exe "hi routWarn ctermfg=" . g:rout_color_warn
+    endif
+    if exists("g:rout_color_index")
+        exe "hi routIndex ctermfg=" . g:rout_color_index
+    endif
 endif
-hi def link rNumber	Number
-hi def link rComplex	Number
-hi def link rInteger	Number
-hi def link rBoolean	Boolean
-hi def link rConstant	Constant
-hi def link rFloat	Float
-hi def link routString	String
-hi def link routError	Error
-hi def link routWarn	WarningMsg
-hi def link routIndex	Special
 
 let   b:current_syntax = "rout"
 

From 8aa49a825ec5c9c072f3883f3fc35d907438fffc Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sun, 23 Nov 2014 20:06:07 -0500
Subject: [PATCH 0837/1050] Avoid has("python") when has("nvim").

---
 r-plugin/common_global.vim | 66 +++++++++++++++++++++-----------------
 1 file changed, 36 insertions(+), 30 deletions(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 68bb941..4e1cdc1 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -789,15 +789,15 @@ function! StartR_Neovim()
     set switchbuf=useopen
     if g:vimrplugin_vsplit
         if g:vimrplugin_rconsole_width > 16 && g:vimrplugin_rconsole_width < (winwidth(0) - 16)
-            exe "belowright " . g:vimrplugin_rconsole_width . "vsplit R_Output"
+            silent exe "belowright " . g:vimrplugin_rconsole_width . "vsplit R_Output"
         else
-            belowright vsplit R_Output
+            silent belowright vsplit R_Output
         endif
     else
         if g:vimrplugin_rconsole_height > 6 && g:vimrplugin_rconsole_height < (winheight(0) - 6)
-            exe "belowright " . g:vimrplugin_rconsole_height . "split R_Output"
+            silent exe "belowright " . g:vimrplugin_rconsole_height . "split R_Output"
         else
-            belowright split R_Output
+            silent belowright split R_Output
         endif
     endif
     let b:winwidth = 0
@@ -1340,9 +1340,11 @@ endfunction
 
 " Open an Object Browser window
 function RObjBrowser()
-    if !has("python") && !has("python3") && !has("nvim")
-        call RWarningMsg("Python support is required to run the Object Browser.")
-        return
+    if !has("nvim")
+        if !has("python") && !has("python3")
+            call RWarningMsg("Python support is required to run the Object Browser.")
+            return
+        endif
     endif
 
     " Only opens the Object Browser if R is running
@@ -2104,7 +2106,15 @@ function RClearConsole()
     if (has("win32") || has("win64"))
         Py RClearConsolePy()
     else
-        call g:SendCmdToR("\014")
+        if g:vimrplugin_r_in_buffer
+            let edbuf = bufname("%")
+            sbuffer R_Output
+            call cursor("$", 1)
+            normal! zt
+            exe "sbuffer " . edbuf
+        else
+            call g:SendCmdToR("\014")
+        endif
     endif
 endfunction
 
@@ -2439,9 +2449,11 @@ endfunction
 " Show R's help doc in Vim's buffer
 " (based  on pydoc plugin)
 function ShowRDoc(rkeyword, package, getclass)
-    if !has("python") && !has("python3") && !has("nvim")
-        call RWarningMsg("Python support is required to see R documentation on Vim.")
-        return
+    if !has("nvim")
+        if !has("python") && !has("python3")
+            call RWarningMsg("Python support is required to see R documentation on Vim.")
+            return
+        endif
     endif
 
     if filewritable(g:rplugin_docfile)
@@ -3732,16 +3744,18 @@ else
     let g:SendToVimCom = function("SendToVimCom_Vim")
 endif
 
-" python3 has priority over python
-if has("python3")
-    command! -nargs=+ Py :py3 
-    command! -nargs=+ PyFile :py3file 
-elseif has("python")
-    command! -nargs=+ Py :py 
-    command! -nargs=+ PyFile :pyfile 
-else
-    command! -nargs=+ Py :
-    command! -nargs=+ PyFile :
+if !has("nvim")
+    " python3 has priority over python
+    if has("python3")
+        command! -nargs=+ Py :py3 
+        command! -nargs=+ PyFile :py3file 
+    elseif has("python")
+        command! -nargs=+ Py :py 
+        command! -nargs=+ PyFile :pyfile 
+    else
+        command! -nargs=+ Py :
+        command! -nargs=+ PyFile :
+    endif
 endif
 
 
@@ -4150,15 +4164,7 @@ if &filetype != "rbrowser"
     call writefile([], $VIMRPLUGIN_TMPDIR . "/GlobalEnvList_" . $VIMINSTANCEID)
 endif
 
-if has("nvim")
-    if g:rplugin_py_exec != "none"
-        if &filetype == "rbrowser"
-            let $THIS_IS_ObjBrowser = "yes"
-        endif
-    else
-        call RWarningMsgInp("Python executable not found.")
-    endif
-else
+if !has("nvim")
     exe "PyFile " . substitute(g:rplugin_home, " ", '\\ ', "g") . "/r-plugin/vimcom.py"
 endif
 

From 833d5acf7ff509d36110a7962d454ed42033fae0 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sun, 23 Nov 2014 22:01:47 -0500
Subject: [PATCH 0838/1050] Require vimcom 1.1-0dev3.

---
 r-plugin/common_global.vim | 35 ++++++++++++++++++++++++++---------
 1 file changed, 26 insertions(+), 9 deletions(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 4e1cdc1..25d0610 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -786,6 +786,8 @@ function! StartR_Neovim()
     let g:SendCmdToR = function('SendCmdToR_Neovim')
 
     let edbuf = bufname("%")
+    let g:tmp_objbrtitle = b:objbrtitle
+    let g:tmp_curbufname = bufname("%")
     set switchbuf=useopen
     if g:vimrplugin_vsplit
         if g:vimrplugin_rconsole_width > 16 && g:vimrplugin_rconsole_width < (winwidth(0) - 16)
@@ -805,6 +807,10 @@ function! StartR_Neovim()
     setlocal noswapfile
     setlocal bufhidden=hide
     set buftype=nofile
+    let b:objbrtitle = g:tmp_objbrtitle
+    let b:rscript_buffer = g:tmp_curbufname
+    unlet g:tmp_objbrtitle
+    unlet g:tmp_curbufname
     imap   :call EnterRCmd()o
     call cursor("$", 1)
     exe "sbuffer " . edbuf
@@ -1067,8 +1073,8 @@ function WaitVimComStart()
     if filereadable($VIMRPLUGIN_TMPDIR . "/vimcom_running_" . $VIMINSTANCEID)
         let vr = readfile($VIMRPLUGIN_TMPDIR . "/vimcom_running_" . $VIMINSTANCEID)
         let g:rplugin_vimcom_version = vr[0]
-        if g:rplugin_vimcom_version != "1.1-0-dev2"
-            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.1-0-dev2.')
+        if g:rplugin_vimcom_version != "1.1-0-dev3"
+            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.1-0-dev3.')
             sleep 1
         endif
         let g:rplugin_vimcom_home = vr[1]
@@ -1078,22 +1084,32 @@ function WaitVimComStart()
                 call jobstop(g:rplugin_clt_job)
                 let g:rplugin_clt_job = 0
             endif
-            if filereadable(g:rplugin_vimcom_home . "/bin/nvimclient")
-                let g:rplugin_clt_job = jobstart('vimcom', g:rplugin_vimcom_home . "/bin/nvimclient", [g:rplugin_vimcomport])
+            if has("win32") || has("win64")
+                let nvc = g:rplugin_vimcom_home . "/bin/nvimclient.exe"
+                let nvs = g:rplugin_vimcom_home . "/bin/nvimserver.exe"
+            else
+                let nvc = g:rplugin_vimcom_home . "/bin/nvimclient"
+                let nvs = g:rplugin_vimcom_home . "/bin/nvimserver"
+            endif
+            if filereadable(nvc)
+                let g:rplugin_clt_job = jobstart('vimcom', nvc, [g:rplugin_vimcomport])
                 autocmd JobActivity vimcom call ROnJobActivity()
             else
-                call RWarningMsg('Application "' . g:rplugin_vimcom_home . "/bin/nvimclient" . '" not found.")
+                call RWarningMsg('Application "' . nvc . '" not found.")
             endif
-            if filereadable(g:rplugin_vimcom_home . "/bin/nvimserver")
+            if filereadable(nvs)
                 if !exists("g:rplugin_srv_job")
-                    let g:rplugin_srv_job = jobstart('udpsvr', g:rplugin_vimcom_home . "/bin/nvimserver")
+                    let g:rplugin_srv_job = jobstart('udpsvr', nvs)
                     autocmd JobActivity udpsvr call ROnJobActivity()
                 endif
             else
-                call RWarningMsg('Application "' . g:rplugin_vimcom_home . "/bin/nvimserver" . '" not found.')
+                call RWarningMsg('Application "' . nvs . '" not found.')
             endif
         endif
         call delete($VIMRPLUGIN_TMPDIR . "/vimcom_running_" . $VIMINSTANCEID)
+        if has("nvim") && g:vimrplugin_vimpager != "no"
+            call g:SendToVimCom("\x08" . $VIMINSTANCEID . "options(pager = vimcom:::vim.hmsg)", "I")
+        endif
         return 1
     else
         call RWarningMsg("The package vimcom wasn't loaded yet.")
@@ -2461,7 +2477,7 @@ function ShowRDoc(rkeyword, package, getclass)
     endif
 
     let classfor = ""
-    if bufname("%") =~ "Object_Browser"
+    if bufname("%") =~ "Object_Browser" || bufname("%") == "R_Output"
         let savesb = &switchbuf
         set switchbuf=useopen,usetab
         exe "sb " . b:rscript_buffer
@@ -2579,6 +2595,7 @@ function ShowRDoc(rkeyword, package, getclass)
     let @@ = save_unnamed_reg
     setlocal nomodified
     redraw
+    stopinsert
 endfunction
 
 function RSetPDFViewer()

From ae11ca9c34938b3e541433ddd75199c978ae821b Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sun, 23 Nov 2014 23:32:01 -0500
Subject: [PATCH 0839/1050] Don't use Python to find R path.

---
 r-plugin/common_global.vim | 47 ++++++++++++++++++--------------------
 r-plugin/windows.py        | 47 --------------------------------------
 2 files changed, 22 insertions(+), 72 deletions(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 25d0610..8cdd612 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -3932,35 +3932,32 @@ if has("win32") || has("win64")
             let $PATH = g:vimrplugin_r_path . ";" . $PATH
             let g:rplugin_Rgui = g:vimrplugin_r_path . "\\Rgui.exe"
         else
-            Py GetRPath()
-            if exists("s:rinstallpath")
-                if s:rinstallpath == "Key not found"
-                    call RWarningMsgInp("Could not find R key in Windows Registry. Please, either install R or set the value of 'vimrplugin_r_path'.")
-                    let g:rplugin_failed = 1
-                    finish
-                endif
-                if s:rinstallpath == "Path not found"
-                    call RWarningMsgInp("Could not find R path in Windows Registry. Please, either install R or set the value of 'vimrplugin_r_path'.")
-                    let g:rplugin_failed = 1
-                    finish
+            let rip = filter(split(system('reg.exe QUERY "HKLM\SOFTWARE\R-core\R" /s'), "\n"), 'v:val =~ ".*InstallPath.*REG_SZ"')
+            if len(rip) > 0
+                let s:rinstallpath = substitute(rip[0], "InstallPath.*REG_SZ *", "", "")
+            endif
+
+            if !exists("s:rinstallpath")
+                call RWarningMsgInp("Could not find R path in Windows Registry. If you have already installed R, please, set the value of 'vimrplugin_r_path'.")
+                let g:rplugin_failed = 1
+                finish
+            endif
+            if isdirectory(s:rinstallpath . '\bin\i386')
+                if !isdirectory(s:rinstallpath . '\bin\x64')
+                    let g:vimrplugin_i386 = 1
                 endif
-                if isdirectory(s:rinstallpath . '\bin\i386')
-                    if !isdirectory(s:rinstallpath . '\bin\x64')
-                        let g:vimrplugin_i386 = 1
-                    endif
-                    if g:vimrplugin_i386
-                        let $PATH = s:rinstallpath . '\bin\i386;' . $PATH
-                        let g:rplugin_Rgui = s:rinstallpath . '\bin\i386\Rgui.exe'
-                    else
-                        let $PATH = s:rinstallpath . '\bin\x64;' . $PATH
-                        let g:rplugin_Rgui = s:rinstallpath . '\bin\x64\Rgui.exe'
-                    endif
+                if g:vimrplugin_i386
+                    let $PATH = s:rinstallpath . '\bin\i386;' . $PATH
+                    let g:rplugin_Rgui = s:rinstallpath . '\bin\i386\Rgui.exe'
                 else
-                    let $PATH = s:rinstallpath . '\bin;' . $PATH
-                    let g:rplugin_Rgui = s:rinstallpath . '\bin\Rgui.exe'
+                    let $PATH = s:rinstallpath . '\bin\x64;' . $PATH
+                    let g:rplugin_Rgui = s:rinstallpath . '\bin\x64\Rgui.exe'
                 endif
-                unlet s:rinstallpath
+            else
+                let $PATH = s:rinstallpath . '\bin;' . $PATH
+                let g:rplugin_Rgui = s:rinstallpath . '\bin\Rgui.exe'
             endif
+            unlet s:rinstallpath
         endif
         let g:rplugin_rpathadded = 1
     endif
diff --git a/r-plugin/windows.py b/r-plugin/windows.py
index 140d568..cbc9e59 100644
--- a/r-plugin/windows.py
+++ b/r-plugin/windows.py
@@ -12,8 +12,6 @@
     import win32com.client
     import win32con
     import win32gui
-    # import win32ui
-    # import dde
 except ImportError:
     import platform
     myPyVersion = platform.python_version()
@@ -147,34 +145,6 @@ def SendQuitMsg(aString):
         RightClick()
         RConsole = 0
 
-def GetRPath():
-    keyName = "SOFTWARE\\R-core\\R"
-    kHandle = None
-    try:
-        kHandle = win32api.RegOpenKeyEx(win32con.HKEY_LOCAL_MACHINE, keyName, 0, win32con.KEY_READ)
-        rVersion, reserved, kclass, lastwrite = win32api.RegEnumKeyEx(kHandle)[-1]
-        win32api.RegCloseKey(kHandle)
-        kHandle = None
-        keyName = keyName + "\\" + rVersion
-        kHandle = win32api.RegOpenKeyEx(win32con.HKEY_LOCAL_MACHINE, keyName, 0, win32con.KEY_READ)
-    except:
-        try:
-            kHandle = win32api.RegOpenKeyEx(win32con.HKEY_CURRENT_USER, keyName, 0, win32con.KEY_READ)
-            rVersion, reserved, kclass, lastwrite = win32api.RegEnumKeyEx(kHandle)[-1]
-            win32api.RegCloseKey(kHandle)
-            kHandle = None
-            keyName = keyName + "\\" + rVersion
-            kHandle = win32api.RegOpenKeyEx(win32con.HKEY_CURRENT_USER, keyName, 0, win32con.KEY_READ)
-        except:
-            vim.command("let s:rinstallpath =  'Key not found'")
-    if kHandle:
-        (kname, rpath, vtype) = win32api.RegEnumValue(kHandle, 0)
-        win32api.RegCloseKey(kHandle)
-        if kname == 'InstallPath':
-            vim.command("let s:rinstallpath = '" + rpath + "'")
-        else:
-            vim.command("let s:rinstallpath =  'Path not found'")
-
 def StartRPy():
     global Rterm
     if vim.eval("g:vimrplugin_Rterm") == "1":
@@ -229,20 +199,3 @@ def OpenPDF(fn):
         vim.command("call RWarningMsg('" + errstr + "')")
         pass
 
-# # The code below is adapted from fwdsumatra.py:
-# # Copyright: Julien Cornebise
-# # Date: February 20, 2009
-# # Description: This file calls ForwardSearch DDE function of SumatraPDF
-# def OpenSumatra(pdf, tex, line):
-#     # Convert backslashes to slashes, for Unix-style calling from vimlatex
-#     pdf = pdf.replace("/", "\\")
-#     # Connect to SumatraPDF
-#     server = dde.CreateServer()
-#     server.Create("LatexSuite")
-#     conversation = dde.CreateConversation(server)
-#     conversation.ConnectTo("SUMATRA", "control")
-#     # Build the DDE call
-#     execString='[ForwardSearch("'+pdf+'","'+tex+'",'+line+',0,0,1)'
-#     # Call !
-#     conversation.Exec(execString)
-

From be042cdfb3c8de382f6da3f0ab9b3f59ba569179 Mon Sep 17 00:00:00 2001
From: Michael Lerch 
Date: Mon, 24 Nov 2014 08:43:47 -0700
Subject: [PATCH 0840/1050] Fix small typo

rmdir should be rmddir
---
 ftplugin/rmd_rplugin.vim | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ftplugin/rmd_rplugin.vim b/ftplugin/rmd_rplugin.vim
index 8a8a908..37e9b09 100644
--- a/ftplugin/rmd_rplugin.vim
+++ b/ftplugin/rmd_rplugin.vim
@@ -85,9 +85,9 @@ function! RMakeRmd(t)
         let rmddir = substitute(rnwdir, '\\', '/', 'g')
     endif
     if a:t == "default"
-        let rcmd = 'vim.interlace.rmd("' . expand("%:t") . '", rmddir = "' . rmdir . '"'
+        let rcmd = 'vim.interlace.rmd("' . expand("%:t") . '", rmddir = "' . rmddir . '"'
     else
-        let rcmd = 'vim.interlace.rmd("' . expand("%:t") . '", outform = "' . a:t .'", rmddir = "' . rmdir . '"'
+        let rcmd = 'vim.interlace.rmd("' . expand("%:t") . '", outform = "' . a:t .'", rmddir = "' . rmddir . '"'
     endif
     if (g:vimrplugin_openhtml  == 0 && a:t == "html_document") || (g:vimrplugin_openpdf == 0 && (a:t == "pdf_document" || a:t == "beamer_presentation"))
         let rcmd .= ", view = FALSE"

From 8d7cd98e8d756a22ec5a74e532405805cd3708ac Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Mon, 24 Nov 2014 16:04:08 -0500
Subject: [PATCH 0841/1050] Move Python code to vimcom (translated into C).

---
 Makefile                    |   6 +-
 doc/r-plugin.txt            |  60 ++---------
 ftplugin/rnoweb_rplugin.vim |  16 +--
 ftplugin/rrst_rplugin.vim   |   9 +-
 list_for_vimball            |   2 -
 r-plugin/common_global.vim  | 183 ++++++++++++--------------------
 r-plugin/vimcom.py          |  43 --------
 r-plugin/windows.py         | 201 ------------------------------------
 8 files changed, 80 insertions(+), 440 deletions(-)
 delete mode 100644 r-plugin/vimcom.py
 delete mode 100644 r-plugin/windows.py

diff --git a/Makefile b/Makefile
index a3c6c7e..d620de0 100644
--- a/Makefile
+++ b/Makefile
@@ -22,7 +22,7 @@
 
 
 PLUGINHOME=`pwd`
-PLUGINVERSION=1.1
+PLUGINVERSION=1.1.1
 DEBIANTIME=`date -R`
 PLUGINRELEASEDATE=`date +"%Y-%m-%d"`
 VIM2HTML=/usr/local/share/vim/vim74/doc/vim2html.pl 
@@ -77,7 +77,6 @@ deb:
 	  - indent/rrst.vim\n\
 	  - r-plugin/common_buffer.vim\n\
 	  - r-plugin/common_global.vim\n\
-	  - r-plugin/vimcom.py\n\
 	  - r-plugin/synctex_evince_backward.py\n\
 	  - r-plugin/synctex_evince_forward.py\n\
 	  - r-plugin/synctex_okular_backward.sh\n\
@@ -117,9 +116,6 @@ deb:
 	" > /tmp/vim-r-plugin-tmp/usr/share/doc/vim-r-plugin/copyright
 	# Unpack the plugin
 	vim -c 'set nomore' -c 'let g:vimball_home="/tmp/vim-r-plugin-tmp/usr/share/vim/addons"' -c "so %" -c "q" /tmp/Vim-R-plugin.vmb
-	# Delete file unnecessary in a Debian system
-	(cd /tmp/vim-r-plugin-tmp/usr/share/vim/addons ;\
-	    rm r-plugin/windows.py )
 	# Create the DEBIAN directory
 	( cd /tmp/vim-r-plugin-tmp ;\
 	    mkdir DEBIAN ;\
diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 845ac38..20c8f21 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -116,11 +116,10 @@ Before installing the plugin, you should install its dependencies:
 
    Vim >= 7.4: http://www.vim.org/download.php
                In addition to the most commonly used features, the plugin
-               requires: |+python| or |+python3|, |+clientserver| and |+conceal|.
+               requires: |+clientserver| and |+conceal|.
 
-	       Note: If you use Neovim, |+python|, |+python3| and
-	       |+clientserver| features are not required, but the python
-	       executable must be in your PATH.
+	       Note: If you use Neovim, the |+clientserver| feature is not
+	       required.
 
 	       Note: If you use Mac OS X, read about the bugs that affect it:
 	       |r-plugin-nox|.
@@ -237,20 +236,6 @@ dependencies:
 
     * Vim's version must be >= 7.4: http://www.vim.org/download.php
 
-    * Python 2.7.6 (32 bit):
-      http://www.python.org/ftp/python/2.7.6/python-2.7.6.msi
-      Do not choose the X86-64 version because it will not work.
-
-    * pywin32:
-      http://sourceforge.net/projects/pywin32/files/pywin32/Build%20218/pywin32-218.win32-py2.7.exe/download
-
-      Note: The above versions of Python and pywin32 are known to work with
-      the official GVim 7.4 binary. The default download may not match the
-      Python version Vim was linked against: then you have to "View all files"
-      on the download page to find the file that matches exactly the above
-      versions. Please, read |r-plugin-python| if you need to use different
-      versions.
-
 Now, download the latest version of `Vim-R-plugin.vmb` from
 
     http://www.vim.org/scripts/script.php?script_id=2628
@@ -1445,10 +1430,11 @@ The valid values of vimrplugin_vimpager are:
 
    "tab"       : Show the help document in a new tab. If there is already a
                  tab with an R help document tab, use it.
-                 This is the default.
+                 This is the default if vimrplugin_r_in_buffer = 0.
    "vertical"  : Split the window vertically if the editor width is large
                  enough; otherwise, split the window horizontally and attempt
                  to set the window height to at least 20 lines.
+                 This is the default if vimrplugin_r_in_buffer = 1.
    "horizontal": Split the window horizontally.
    "tabnew"    : Show the help document in a new tab.
    "no"        : Do not show R documentation in Vim.
@@ -2293,9 +2279,7 @@ directory after the installation:
    syntax/rdoc.vim
    syntax/rbrowser.vim
    doc/r-plugin.txt
-   r-plugin/vimcom.py
    r-plugin/global_r_plugin.vim
-   r-plugin/windows.py
    r-plugin/objlist/README
    r-plugin/r.snippets
    r-plugin/common_buffer.vim
@@ -2925,34 +2909,9 @@ Finally, if you want to use vi key bindings in Bash:
    set keymap vi
 <
 
-------------------------------------------------------------------------------
-							     *r-plugin-python*
-9.22. Python versions~
-
-Are you using Windows and need to use a specific version of either Python or
-pywin32? The official Vim is 32 bit and, thus, Python must be 32 bit too.
-However, Vim and R run as independent processes, that is, you may have 32 bit
-Vim sending commands to 64 bit R. Be careful to download the correct Python
-version because Vim needs a specific version of Python DLL. For example, the
-official Vim 7.4 for Windows needs either Python 2.7 or 3.2. If Python was not
-installed or was not found, the Vim-R-plugin will output information about
-what Python version Vim was compiled against. Do the following if you want to
-discover this information manually:
-
-   1. Type  :version  in Vim (normal mode).
-
-   2. Look for a string like -DDYNAMIC_PYTHON_DLL="python27.dll".
-
-   3. Install the Python version which corresponds to the version which Vim
-   was linked against. In the example of step 2 (python27.dll) the required
-   Python version is 2.7.x.
-
-    * pywin32: http://sourceforge.net/projects/pywin32/
-
-
 ------------------------------------------------------------------------------
 							    *r-plugin-toolbar*
-9.23. Add tool bar icons and hide unused buttons~
+9.22. Add tool bar icons and hide unused buttons~
 
 If you want to add some R buttons to GVim tool bar download the zip file
 http://www.lepem.ufc.br/jaa/bitmaps.zip and unpack it at either ~/.vim
@@ -2966,23 +2925,26 @@ below to know how to hide buttons on the toolbar:
 
 ------------------------------------------------------------------------------
 
-9.24. Integration with GNU Screen, screen plugin, Conque Shell or VimShell~
+9.23. Integration with GNU Screen, screen plugin, Conque Shell or VimShell~
 
 The plugin used to be able to use GNU Screen (through screen plugin), Conque
 Shell or VimShell to send commands to R. This integration was removed on
 August 20, 2013. People wanting this integration back into the plugin may want
 to use the old Vim-R-plugin code as a starting point to create scripts to be
 sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details.
+See also |vimrplugin_r_in_buffer|.
 
 
 ==============================================================================
 							       *r-plugin-news*
 10. News~
 
-1.1.1 (2014-11-22)
+1.1.1 (2014-11-24)
 
  * New option (Neovim only): vimrplugin_r_in_buffer.
 
+ * No longer requires +python feature.
+
 1.1 (2014-11-13)
 
  * Version update for Linux/Unix only. May not work on Windows or Mac.
diff --git a/ftplugin/rnoweb_rplugin.vim b/ftplugin/rnoweb_rplugin.vim
index 2babff4..d5f5597 100644
--- a/ftplugin/rnoweb_rplugin.vim
+++ b/ftplugin/rnoweb_rplugin.vim
@@ -91,14 +91,7 @@ endfunction
 " Sweave and compile the current buffer content
 function! RMakePDF(bibtex, knit)
     if g:rplugin_vimcomport == 0
-        if has("nvim")
-            call jobsend(g:rplugin_clt_job, "DiscoverVimComPort\n")
-        else
-            Py DiscoverVimComPort()
-        endif
-        if g:rplugin_vimcomport == 0
-            call RWarningMsg("The vimcom package is required to make and open the PDF.")
-        endif
+        call RWarningMsg("The vimcom package is required to make and open the PDF.")
     endif
     update
     let rnwdir = expand("%:p:h")
@@ -521,15 +514,12 @@ function! SyncTeX_forward(...)
             endif
         else
             let g:rplugin_zathura_pid[basenm] = 0
-            if has("nvim")
-                call RStart_Zathura(basenm)
-            else
-                exe "Py Start_Zathura('" . basenm . "', '" . v:servername . "')"
+            call RStart_Zathura(basenm)
             endif
         endif
         call system("wmctrl -a '" . basenm . ".pdf'")
     elseif g:rplugin_pdfviewer == "sumatra"
-        Py OpenSumatra(basenm . ".pdf", substitute(expand("%:p:h"), ' ', '\\ ', 'g') . "/" . basenm . ".tex", texln)
+        call RWarningMsg("Support for Sumatra not implemented yet.")
     elseif g:rplugin_pdfviewer == "skim"
         " This command is based on Skim wiki (not tested)
         call system("/Applications/Skim.app/Contents/SharedSupport/displayline " . texln . " '" . basenm . ".pdf' 2> /dev/null >/dev/null &")
diff --git a/ftplugin/rrst_rplugin.vim b/ftplugin/rrst_rplugin.vim
index 477e2be..7748a5a 100644
--- a/ftplugin/rrst_rplugin.vim
+++ b/ftplugin/rrst_rplugin.vim
@@ -96,14 +96,7 @@ endfunction
 
 function! RMakePDFrrst()
     if g:rplugin_vimcomport == 0
-        if has("nvim")
-            call jobsend(g:rplugin_clt_job, "DiscoverVimComPort\n")
-        else
-            Py DiscoverVimComPort()
-        endif
-        if g:rplugin_vimcomport == 0
-            call RWarningMsg("The vimcom package is required to make and open the PDF.")
-        endif
+        call RWarningMsg("The vimcom package is required to make and open the PDF.")
     endif
     update
     call RSetWD()
diff --git a/list_for_vimball b/list_for_vimball
index 4150bbd..a487712 100644
--- a/list_for_vimball
+++ b/list_for_vimball
@@ -27,9 +27,7 @@ r-plugin/rmd.snippets
 r-plugin/synctex_evince_backward.py
 r-plugin/synctex_evince_forward.py
 r-plugin/synctex_okular_backward.sh
-r-plugin/vimcom.py
 r-plugin/vimrconfig.vim
-r-plugin/windows.py
 r-plugin/functions.vim
 syntax/r.vim
 syntax/rbrowser.vim
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 8cdd612..a0677ca 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -731,17 +731,24 @@ endfunction
 
 function StartR_Windows()
     if string(g:SendCmdToR) != "function('SendCmdToR_fake')"
-        Py FindRConsole()
-        Py vim.command("let g:rplugin_rconsole_hndl = " + str(RConsole))
-        if g:rplugin_rconsole_hndl != 0
-            call RWarningMsg("There is already a window called '" . g:rplugin_R_window_ttl . "'.")
-            unlet g:rplugin_R_window_ttl
+        let repl = libcall(g:rplugin_vimcom_lib, "FindRConsole", 'R Console')
+        if repl == "NotFound"
+            let g:SendCmdToR = function('SendCmdToR_fake')
+            call RWarningMsg('There is already a window called "R Console".')
             return
         endif
     endif
     let vrph = $VIMRPLUGIN_HOME
     let $VIMRPLUGIN_HOME = substitute($VIMRPLUGIN_HOME, "\\\\ ", " ", "g")
-    Py StartRPy()
+
+    let rcmd = g:rplugin_Rgui
+    if g:vimrplugin_Rterm
+        let rcmd = substitute(rcmd, "Rgui", "Rterm", "")
+    endif
+    let rcmd = '"' . rcmd . '" ' . g:vimrplugin_r_args
+
+    silent exe "!start " . rcmd
+
     if g:vimrplugin_vim_wd == 0
         lcd -
     endif
@@ -1073,11 +1080,18 @@ function WaitVimComStart()
     if filereadable($VIMRPLUGIN_TMPDIR . "/vimcom_running_" . $VIMINSTANCEID)
         let vr = readfile($VIMRPLUGIN_TMPDIR . "/vimcom_running_" . $VIMINSTANCEID)
         let g:rplugin_vimcom_version = vr[0]
-        if g:rplugin_vimcom_version != "1.1-0-dev3"
-            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.1-0-dev3.')
+        if g:rplugin_vimcom_version != "1.1-0-dev4"
+            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.1-0-dev4.')
             sleep 1
         endif
         let g:rplugin_vimcom_home = vr[1]
+        if has("win32")
+            let g:rplugin_vimcom_lib = g:rplugin_vimcom_home . "/libs/i386/vimcom.dll"
+        elseif has("win64")
+            let g:rplugin_vimcom_lib = g:rplugin_vimcom_home . "/libs/x64/vimcom.dll"
+        else
+            let g:rplugin_vimcom_lib = g:rplugin_vimcom_home . "/libs/vimcom.so"
+        endif
         let g:rplugin_vimcomport = vr[2]
         if has("nvim")
             if g:rplugin_clt_job
@@ -1129,11 +1143,6 @@ function IsExternalOBRunning()
 endfunction
 
 function ResetVimComPort()
-    if has("nvim")
-        call jobsend(g:rplugin_clt_job, "DiscoverVimComPort\n")
-    else
-        Py VimComPort = 0
-    endif
     let g:rplugin_vimcomport = 0
 endfunction
 
@@ -1177,12 +1186,13 @@ function StartObjBrowser_Tmux()
                 \ 'let g:rplugin_editor_sname = ' . myservername,
                 \ 'let g:rplugin_vim_pane = "' . g:rplugin_vim_pane . '"',
                 \ 'let g:rplugin_rconsole_pane = "' . g:rplugin_rconsole_pane . '"',
-                \ 'let b:objbrtitle = "' . b:objbrtitle . '"',
                 \ 'let $VIMINSTANCEID = "' . $VIMINSTANCEID . '"',
                 \ 'let showmarks_enable = 0',
                 \ 'let g:rplugin_tmuxsname = "' . g:rplugin_tmuxsname . '"',
                 \ 'let b:rscript_buffer = "' . bufname("%") . '"',
                 \ 'set filetype=rbrowser',
+                \ 'let g:rplugin_vimcom_home = "' . g:rplugin_vimcom_home . '"',
+                \ 'let b:objbrtitle = "' . b:objbrtitle . '"',
                 \ 'let b:rplugin_extern_ob = 1',
                 \ 'set shortmess=atI',
                 \ 'set rulerformat=%3(%l%)',
@@ -1356,13 +1366,6 @@ endfunction
 
 " Open an Object Browser window
 function RObjBrowser()
-    if !has("nvim")
-        if !has("python") && !has("python3")
-            call RWarningMsg("Python support is required to run the Object Browser.")
-            return
-        endif
-    endif
-
     " Only opens the Object Browser if R is running
     if string(g:SendCmdToR) == "function('SendCmdToR_fake')"
         call RWarningMsg("The Object Browser can be opened only if R is running.")
@@ -1509,14 +1512,7 @@ endfunction
 
 function RFormatCode() range
     if g:rplugin_vimcomport == 0
-        if has("nvim")
-            call jobsend(g:rplugin_clt_job, "DiscoverVimComPort\n")
-        else
-            Py DiscoverVimComPort()
-        endif
-        if g:rplugin_vimcomport == 0
-            return
-        endif
+        return
     endif
 
     let lns = getline(a:firstline, a:lastline)
@@ -1544,14 +1540,7 @@ endfunction
 
 function RInsert(cmd)
     if g:rplugin_vimcomport == 0
-        if has("nvim")
-            call jobsend(g:rplugin_clt_job, "DiscoverVimComPort\n")
-        else
-            Py DiscoverVimComPort()
-        endif
-        if g:rplugin_vimcomport == 0
-            return
-        endif
+        return
     endif
 
     call delete($VIMRPLUGIN_TMPDIR . "/eval_reply")
@@ -1626,7 +1615,7 @@ function SendCmdToR_Windows(cmd)
     for i in range(0, slen)
         let str = str . printf("\\x%02X", char2nr(cmd[i]))
     endfor
-    exe "Py" . " SendToRConsole(b'" . str . "')"
+    let repl = libcall(g:rplugin_vimcom_lib, "SendToRConsole", str)
     return 1
 endfunction
 
@@ -2120,7 +2109,14 @@ endfunction
 " Clear the console screen
 function RClearConsole()
     if (has("win32") || has("win64"))
-        Py RClearConsolePy()
+        if g:vimrplugin_Rterm
+            let repl = libcall(g:rplugin_vimcom_lib, "RClearConsole()", "Rterm")
+        else
+            let repl = libcall(g:rplugin_vimcom_lib, "RClearConsole()", "Rgui")
+        endif
+        if repl != "OK"
+            call RWarningMsg(repl)
+        endif
     else
         if g:vimrplugin_r_in_buffer
             let edbuf = bufname("%")
@@ -2183,7 +2179,7 @@ function RQuit(how)
     endif
 
     if has("win32") || has("win64")
-        exe "Py SendQuitMsg('" . qcmd . "')"
+        let repl = libcall(g:rplugin_vimcom_lib, "SendQuitMsg", qcmd)
     else
         call g:SendCmdToR(qcmd)
         if g:rplugin_do_tmux_split
@@ -2465,13 +2461,6 @@ endfunction
 " Show R's help doc in Vim's buffer
 " (based  on pydoc plugin)
 function ShowRDoc(rkeyword, package, getclass)
-    if !has("nvim")
-        if !has("python") && !has("python3")
-            call RWarningMsg("Python support is required to see R documentation on Vim.")
-            return
-        endif
-    endif
-
     if filewritable(g:rplugin_docfile)
         call delete(g:rplugin_docfile)
     endif
@@ -2666,19 +2655,24 @@ function RSetPDFViewer()
 endfunction
 
 function RStart_Zathura(basenm)
-    let shcode = ['#!/bin/sh', 'echo "call SyncTeX_backward(' . "'$1'" . ', $2)" >> "' . $VIMRPLUGIN_TMPDIR . '/zathura_search"']
-    call writefile(shcode, $VIMRPLUGIN_TMPDIR . "/synctex_back.sh")
+    if has("nvim")
+        let shcode = ['#!/bin/sh', 'echo "call SyncTeX_backward(' . "'$1'" . ', $2)" >> "' . $VIMRPLUGIN_TMPDIR . '/zathura_search"']
+        call writefile(shcode, $VIMRPLUGIN_TMPDIR . "/synctex_back.sh")
+        let a2 = "a2 = 'sh " . $VIMRPLUGIN_TMPDIR . "/synctex_back.sh %{input} %{line}'",
+    else
+        let a2 = 'a2 = "vim --servername ' . v:servername . " --remote-expr \\\"SyncTeX_backward('%{input}',%{line})\\\"" . '"'
+    endif
     let pycode = ["import subprocess",
                 \ "import os",
+                \ "import sys",
                 \ "FNULL = open(os.devnull, 'w')",
                 \ "a1 = '--synctex-editor-command'",
-                \ "a2 = 'sh " . $VIMRPLUGIN_TMPDIR . "/synctex_back.sh %{input} %{line}'",
+                \ a2,
                 \ "a3 = '" . a:basenm . ".pdf'",
                 \ "zpid = subprocess.Popen(['zathura', a1, a2, a3], stdout = FNULL, stderr = FNULL).pid",
-                \ "print str(zpid)" ]
+                \ "sys.stdout.write(str(zpid))" ]
     call writefile(pycode, $VIMRPLUGIN_TMPDIR . "/start_zathura.py")
     let pid = system("python '" . $VIMRPLUGIN_TMPDIR . "/start_zathura.py" . "'")
-    let pid = substitute(pid, '\n', '', '')
     let g:rplugin_zathura_pid[a:basenm] = pid
     call delete($VIMRPLUGIN_TMPDIR . "/start_zathura.py")
 endfunction
@@ -2698,7 +2692,10 @@ function ROpenPDF(path)
     endif
 
     if (has("win32") || has("win64")) && g:rplugin_pdfviewer == "none"
-        exe 'Py OpenPDF("' . pdfpath . '")'
+        let repl = libcall(g:rplugin_vimcom_lib, 'OpenPDF', pdfpath)
+        if repl != "OK"
+            call RWarningMsg(repl)
+        endif
         exe "cd " . substitute(olddir, ' ', '\\ ', 'g')
         return
     endif
@@ -2713,11 +2710,7 @@ function ROpenPDF(path)
                 call system("wmctrl -a '" . basenm . ".pdf'")
             else
                 let g:rplugin_zathura_pid[basenm] = 0
-                if has("nvim")
-                    call RStart_Zathura(basenm)
-                else
-                    exe "Py Start_Zathura('" . basenm . "', '" . v:servername . "')"
-                endif
+                call RStart_Zathura(basenm)
             endif
             exe "cd " . substitute(olddir, ' ', '\\ ', 'g')
             return
@@ -3583,7 +3576,15 @@ endif
 " From changelog.vim, with bug fixed by "Si" ("i5ivem")
 " Windows logins can include domain, e.g: 'DOMAIN\Username', need to remove
 " the backslash from this as otherwise cause file path problems.
-let g:rplugin_userlogin = substitute(system('whoami'), "\\", "-", "")
+if executable("whoami")
+    let g:rplugin_userlogin = substitute(system('whoami'), "\\", "-", "")
+elseif $USER != ""
+    let g:rplugin_userlogin = $USER
+else
+    call RWarningMsgInp("Could not determine user name.")
+    let g:rplugin_failed = 1
+    finish
+endif
 
 if v:shell_error
     let g:rplugin_userlogin = 'unknown'
@@ -3744,7 +3745,10 @@ function SendToVimCom_Vim(...)
         call RWarningMsg("VimCom port is unknown.")
         return
     endif
-    exe "Py SendToVimCom('" . a:1 . "', " . g:rplugin_vimcomport . ")"
+    let repl = libcall(g:rplugin_vimcom_lib, "SendToVimCom", g:rplugin_vimcomport . " " . a:1)
+    if repl != "OK"
+        call RWarningMsg(repl)
+    endif
 endfunction
 
 function SendToVimCom_Neovim(...)
@@ -3761,20 +3765,6 @@ else
     let g:SendToVimCom = function("SendToVimCom_Vim")
 endif
 
-if !has("nvim")
-    " python3 has priority over python
-    if has("python3")
-        command! -nargs=+ Py :py3 
-        command! -nargs=+ PyFile :py3file 
-    elseif has("python")
-        command! -nargs=+ Py :py 
-        command! -nargs=+ PyFile :pyfile 
-    else
-        command! -nargs=+ Py :
-        command! -nargs=+ PyFile :
-    endif
-endif
-
 
 " ^K (\013) cleans from cursor to the right and ^U (\025) cleans from cursor
 " to the left. However, ^U causes a beep if there is nothing to clean. The
@@ -3883,40 +3873,6 @@ endif
 let g:rplugin_globalenvlines = []
 
 if has("win32") || has("win64")
-
-    if !has("python") && !has("python3")
-        redir => s:vimversion
-        silent version
-        redir END
-        let s:haspy2 = stridx(s:vimversion, '+python ')
-        if s:haspy2 < 0
-            let s:haspy2 = stridx(s:vimversion, '+python/dyn')
-        endif
-        let s:haspy3 = stridx(s:vimversion, '+python3')
-        if s:haspy2 > 0 || s:haspy3 > 0
-            let s:pyver = ""
-            if s:haspy2 > 0 && s:haspy3 > 0
-                let s:pyver = " (" . substitute(s:vimversion, '.*\(python2.\.dll\).*', '\1', '') . ", "
-                let s:pyver = s:pyver . substitute(s:vimversion, '.*\(python3.\.dll\).*', '\1', '') . ")"
-            elseif s:haspy3 > 0 && s:haspy2 < 0
-                let s:pyver = " (" . substitute(s:vimversion, '.*\(python3.\.dll\).*', '\1', '') . ")"
-            elseif s:haspy2 > 0 && s:haspy3 < 0
-                let s:pyver = " (" . substitute(s:vimversion, '.*\(python2.\.dll\).*', '\1', '') . ")"
-            endif
-            let s:xx = substitute(s:vimversion, '.*\([0-9][0-9]-bit\).*', '\1', "")
-            call RWarningMsgInp("This version of Vim was compiled against Python" . s:pyver . ", but Python was not found. Please, install " . s:xx . " Python from www.python.org.")
-        else
-            call RWarningMsgInp("This version of Vim was not compiled with Python support.")
-        endif
-        let g:rplugin_failed = 1
-        finish
-    endif
-    let rplugin_pywin32 = 1
-    exe "PyFile " . substitute(g:rplugin_home, " ", '\\ ', "g") . '\r-plugin\windows.py'
-    if rplugin_pywin32 == 0
-        let g:rplugin_failed = 1
-        finish
-    endif
     if !exists("g:rplugin_rpathadded")
         if exists("g:vimrplugin_r_path")
             if !isdirectory(g:vimrplugin_r_path)
@@ -4139,13 +4095,6 @@ function GetRandomNumber(width)
         call writefile(pycode, $VIMRPLUGIN_TMPDIR . "/getRandomNumber.py")
         let randnum = system(g:rplugin_py_exec . " " . $VIMRPLUGIN_TMPDIR . "/getRandomNumber.py")
         call delete($VIMRPLUGIN_TMPDIR . "/getRandomNumber.py")
-    elseif has("python") || has("python3")
-        Py import os
-        Py import base64
-        Py import vim
-        Py vim.command("let g:rplugin_random = '" + base64.b64encode(os.urandom(16)).decode() + "'")
-        let randnum = g:rplugin_random
-        unlet g:rplugin_random
     elseif !has("win32") && !has("win64") && !has("gui_win32") && !has("gui_win64")
         let randnum = system("echo $RANDOM")
     else
@@ -4178,10 +4127,6 @@ if &filetype != "rbrowser"
     call writefile([], $VIMRPLUGIN_TMPDIR . "/GlobalEnvList_" . $VIMINSTANCEID)
 endif
 
-if !has("nvim")
-    exe "PyFile " . substitute(g:rplugin_home, " ", '\\ ', "g") . "/r-plugin/vimcom.py"
-endif
-
 call SetRPath()
 
 " Keeps the names object list in memory to avoid the need of reading the files
diff --git a/r-plugin/vimcom.py b/r-plugin/vimcom.py
deleted file mode 100644
index aa4e84e..0000000
--- a/r-plugin/vimcom.py
+++ /dev/null
@@ -1,43 +0,0 @@
-
-import socket
-import vim
-import os
-import re
-import subprocess
-
-def SendToVimCom(aString, VimComPort):
-    received = None
-
-    sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
-    sock.settimeout(3.0)
-
-    try:
-        sock.connect(("localhost", VimComPort))
-        if sys.hexversion < 0x03000000:
-            sock.send(aString)
-            received = sock.recv(5012)
-        else:
-            sock.send(aString.encode())
-            received = sock.recv(5012).decode()
-    except:
-        pass
-    finally:
-        sock.close()
-
-    if received is None:
-        vim.command("let g:rplugin_lastrpl = 'NOANSWER'")
-        VimComPort = 0
-        vim.command("let g:rplugin_vimcomport = 0")
-    else:
-        received = received.replace("'", "' . \"'\" . '")
-        vim.command("let g:rplugin_lastrpl = '" + received + "'")
-
-
-def Start_Zathura(basenm, sname):
-    a1 = '--synctex-editor-command'
-    a2 = 'vim --servername ' + sname + " --remote-expr SyncTeX_backward(\\'%{input}\\',%{line})"
-    a3 = basenm + ".pdf"
-    FNULL = open(os.devnull, 'w')
-    zpid = subprocess.Popen(["zathura", a1, a2, a3], stdout = FNULL, stderr = FNULL).pid
-    vim.command("let g:rplugin_zathura_pid['" + basenm + "'] = " + str(zpid))
-
diff --git a/r-plugin/windows.py b/r-plugin/windows.py
deleted file mode 100644
index cbc9e59..0000000
--- a/r-plugin/windows.py
+++ /dev/null
@@ -1,201 +0,0 @@
-
-import os
-import string
-import time
-import vim
-RConsole = 0
-Rterm = False
-
-try:
-    import win32api
-    import win32clipboard
-    import win32com.client
-    import win32con
-    import win32gui
-except ImportError:
-    import platform
-    myPyVersion = platform.python_version()
-    myArch = platform.architecture()
-    vim.command("call RWarningMsgInp('Please install PyWin32. The Python version being used is: " + myPyVersion + " (" + myArch[0] + ")')")
-    vim.command("let rplugin_pywin32 = 0")
-
-def RightClick():
-    global RConsole
-    myHandle = win32gui.GetForegroundWindow()
-    RaiseRConsole()
-    time.sleep(0.05)
-    lParam = (100 << 16) | 100
-    win32gui.SendMessage(RConsole, win32con.WM_RBUTTONDOWN, 0, lParam)
-    win32gui.SendMessage(RConsole, win32con.WM_RBUTTONUP, 0, lParam)
-    time.sleep(0.05)
-    try:
-        win32gui.SetForegroundWindow(myHandle)
-    except:
-        vim.command("call RWarningMsg('Could not put itself on foreground.')")
-
-def CntrlV():
-    global RConsole
-    win32api.keybd_event(0x11, 0, 0, 0)
-    try:
-        win32api.PostMessage(RConsole, 0x100, 0x56, 0x002F0001)
-    except:
-        vim.command("call RWarningMsg('R Console window not found [1].')")
-        RConsole = 0
-        pass
-    if RConsole:
-        time.sleep(0.05)
-        try:
-            win32api.PostMessage(RConsole, 0x101, 0x56, 0xC02F0001)
-        except:
-            vim.command("call RWarningMsg('R Console window not found [2].')")
-            pass
-    win32api.keybd_event(0x11, 0, 2, 0)
-
-def FindRConsole():
-    global RConsole
-    Rttl = vim.eval("g:vimrplugin_R_window_title")
-    Rtitle = Rttl
-    RConsole = win32gui.FindWindow(None, Rtitle)
-    if RConsole == 0:
-        Rtitle = Rttl + " (64-bit)"
-        RConsole = win32gui.FindWindow(None, Rtitle)
-        if RConsole == 0:
-            Rtitle = Rttl + " (32-bit)"
-            RConsole = win32gui.FindWindow(None, Rtitle)
-            if RConsole == 0:
-                vim.command("call RWarningMsg('Could not find R Console.')")
-    if RConsole:
-        vim.command("let g:rplugin_R_window_ttl = '" + Rtitle + "'")
-
-def SendToRConsole(aString):
-    global RConsole
-    global Rterm
-    SendToVimCom("\003Set R as busy [SendToRConsole()]")
-    if sys.hexversion < 0x03000000:
-        finalString = aString.decode("latin-1") + "\n"
-    else:
-        finalString = aString
-    win32clipboard.OpenClipboard(0)
-    win32clipboard.EmptyClipboard()
-    win32clipboard.SetClipboardText(finalString)
-    win32clipboard.CloseClipboard()
-    if RConsole == 0:
-        FindRConsole()
-    if RConsole:
-        if Rterm:
-            RightClick()
-        else:
-            CntrlV()
-
-def RClearConsolePy():
-    global RConsole
-    global Rterm
-    if Rterm:
-        return
-    if RConsole == 0:
-        FindRConsole()
-    if RConsole:
-        win32api.keybd_event(0x11, 0, 0, 0)
-        try:
-            win32api.PostMessage(RConsole, 0x100, 0x4C, 0x002F0001)
-        except:
-            vim.command("call RWarningMsg('R Console window not found [1].')")
-            RConsole = 0
-            pass
-        if RConsole:
-            time.sleep(0.05)
-            try:
-                win32api.PostMessage(RConsole, 0x101, 0x4C, 0xC02F0001)
-            except:
-                vim.command("call RWarningMsg('R Console window not found [2].')")
-                pass
-        win32api.keybd_event(0x11, 0, 2, 0)
-
-def RaiseRConsole():
-    global RConsole
-    FindRConsole()
-    if RConsole:
-        win32gui.SetForegroundWindow(RConsole)
-        time.sleep(0.1)
-
-def SendQuitMsg(aString):
-    global RConsole
-    global Rterm
-    SendToVimCom("\003Set R as busy [SendQuitMsg()]")
-    if sys.hexversion < 0x03000000:
-        finalString = aString.decode("latin-1") + "\n"
-    else:
-        finalString = aString + "\n"
-    win32clipboard.OpenClipboard(0)
-    win32clipboard.EmptyClipboard()
-    win32clipboard.SetClipboardText(finalString)
-    win32clipboard.CloseClipboard()
-    sleepTime = float(vim.eval("g:vimrplugin_sleeptime"))
-    RaiseRConsole()
-    if RConsole and not Rterm:
-        time.sleep(sleepTime)
-        win32api.keybd_event(win32con.VK_CONTROL, 0, 0, 0)
-        win32api.keybd_event(ord('V'), 0, win32con.KEYEVENTF_EXTENDEDKEY | 0, 0)
-        time.sleep(0.05)
-        win32api.keybd_event(ord('V'), 0, win32con.KEYEVENTF_EXTENDEDKEY | win32con.KEYEVENTF_KEYUP, 0)
-        win32api.keybd_event(win32con.VK_CONTROL, 0, win32con.KEYEVENTF_KEYUP, 0)
-        time.sleep(0.05)
-        RConsole = 0
-    if RConsole and Rterm:
-        RightClick()
-        RConsole = 0
-
-def StartRPy():
-    global Rterm
-    if vim.eval("g:vimrplugin_Rterm") == "1":
-        Rterm = True
-    else:
-        Rterm = False
-    rpath = vim.eval("g:rplugin_Rgui")
-    rpath = rpath.replace("\\", "\\\\")
-    rargs = ['"' + rpath + '"']
-    r_args = vim.eval("b:rplugin_r_args")
-    if r_args != " ":
-        r_args = r_args.split(' ')
-        i = 0
-        alen = len(r_args)
-        while i < alen:
-            rargs.append(r_args[i])
-            i = i + 1
-
-    kHandle = None
-    keyName = "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders"
-    try:
-        kHandle = win32api.RegOpenKeyEx(win32con.HKEY_CURRENT_USER, keyName, 0, win32con.KEY_READ)
-    except:
-        vim.command("RWarningMsg('Personal folder not found in registry')")
-
-    if kHandle:
-        i = 0
-        folder = "none"
-        while folder != "Personal":
-            try:
-                (folder, fpath, vtype) = win32api.RegEnumValue(kHandle, i)
-            except:
-                break
-            i = i + 1
-        win32api.RegCloseKey(kHandle)
-        if folder == "Personal":
-            rargs.append('HOME="' + fpath + '"')
-        else:
-            vim.command("RWarningMsg('Personal folder not found in registry')")
-
-    if os.path.isfile(rpath):
-        os.spawnv(os.P_NOWAIT, rpath, rargs)
-    else:
-        vim.command("echoerr 'File ' . g:rplugin_Rgui . ' not found.'")
-
-def OpenPDF(fn):
-    try:
-        os.startfile(fn)
-    except Exception as errmsg:
-        errstr = str(errmsg)
-        errstr = errstr.replace("'", '"')
-        vim.command("call RWarningMsg('" + errstr + "')")
-        pass
-

From 21e0b88f88e403ec3ada837403dd1516883b1d2b Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Mon, 24 Nov 2014 16:09:49 -0500
Subject: [PATCH 0842/1050] Minor bug fix.

---
 r-plugin/common_global.vim | 1 +
 1 file changed, 1 insertion(+)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index a0677ca..c7f9e85 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -1192,6 +1192,7 @@ function StartObjBrowser_Tmux()
                 \ 'let b:rscript_buffer = "' . bufname("%") . '"',
                 \ 'set filetype=rbrowser',
                 \ 'let g:rplugin_vimcom_home = "' . g:rplugin_vimcom_home . '"',
+                \ 'let g:rplugin_vimcom_lib = "' . g:rplugin_vimcom_lib . '"',
                 \ 'let b:objbrtitle = "' . b:objbrtitle . '"',
                 \ 'let b:rplugin_extern_ob = 1',
                 \ 'set shortmess=atI',

From 09eba92f0a6440d87f8308947236ab42e210b178 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Mon, 24 Nov 2014 22:57:15 -0500
Subject: [PATCH 0843/1050] Bug fixes in R start on Windows. Also: elimination
 of vimrplugin_sleeptime option.

---
 doc/r-plugin.txt           | 75 +++++++++++++++++---------------------
 r-plugin/common_global.vim | 27 ++++++++++----
 2 files changed, 54 insertions(+), 48 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 20c8f21..845c045 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -229,7 +229,7 @@ dependencies:
 
     * R's version must be >= 3.0.0: http://www.r-project.org/
 
-    * vimcom = 1.1-0: http://www.lepem.ufc.br/jaa/vimcom.html
+    * vimcom = 1.2-0: http://www.lepem.ufc.br/jaa/vimcom.html
 
       Note: If you cannot build vimcom yourself, you will want to
       download and install the zip file.
@@ -256,6 +256,11 @@ Note: If you need to install the plugin in a non default directory, do
 must be done before the command "filetype on" in both the system and the user
 |vimrc| files, otherwise, some file types might not be correctly recognized.
 
+Add the following lines to your `Rprofile`:
+>
+   if(Sys.getenv("VIMRPLUGIN_TMPDIR") != "")
+       library(vimcom)
+<
 Start GVim again and edit an R script. You can right click a .R file and
 choose "Edit with Vim" or create a new one with the Normal mode command:
 >
@@ -282,8 +287,6 @@ Finally, click on the menu bar
 The above command will guide you through the final configuration steps if you
 answer `y` to all questions.
 
-You may have to adjust the value of |vimrplugin_sleeptime|.
-
 If you want to uninstall the plugin, do
 >
    :RmVimball Vim-R-plugin
@@ -1191,7 +1194,6 @@ is running:
 |vimrplugin_routmorecolors|    More syntax highlighting in R output
 |vimrplugin_routnotab|         Show output of R CMD BATCH in new window
 |vimrplugin_indent_commented|  Indent lines commented with the \xx command
-|vimrplugin_sleeptime|         Delay while sending commands in MS Windows
 |vimrplugin_notmuxconf|        Don't use a specially built Tmux config file
 |vimrplugin_rconsole_height|   The number of lines of R Console (Tmux split)
 |vimrplugin_vsplit|            Make Tmux split the window vertically
@@ -1468,7 +1470,7 @@ Vim will run the first R executable in the path. You can set an alternative R
 path in your |vimrc| as in the examples:
 >
    let vimrplugin_r_path = "/path/to/my/preferred/R/version/bin"
-   let vimrplugin_r_path = "C:\\Program Files\\R\\R-3.0.1\\bin\\i386"
+   let vimrplugin_r_path = "C:\\Program Files\\R\\R-3.1.2\\bin\\i386"
 <
 On Windows, Vim will try to find the R install path in the Windows Registry.
 
@@ -1559,20 +1561,9 @@ table below (see |r-plugin-indenting|):
                  0                        1                ###
 <
 
-------------------------------------------------------------------------------
-							*vimrplugin_sleeptime*
-6.13. Sleep time (Windows only)~
-
-The plugin gives to R a small amount of time to process the paste command. The
-default value is 0.2 second, but you should experiment different values. The
-example show how to adjust the value of sleeptime in your |vimrc|:
->
-   let vimrplugin_sleeptime = 0.1
-<
-
 ------------------------------------------------------------------------------
 						       *vimrplugin_notmuxconf*
-6.14. Tmux configuration (Linux/Unix only)~
+6.13. Tmux configuration (Linux/Unix only)~
 
 
 GVim (or Vim running R in an external terminal emulator) runs Tmux with a
@@ -1592,7 +1583,7 @@ file (~/.tmux.conf).
                                                   *vimrplugin_vsplit*
 			                          *vimrplugin_rconsole_width*
                                                   *vimrplugin_tmux_title*
-6.15. Integration with Tmux (Linux/Unix only)~
+6.14. Integration with Tmux (Linux/Unix only)~
 
 These three options are valid only when Vim is started inside a Tmux session.
 In this case, when you type rf, the terminal will be split in two
@@ -1624,7 +1615,7 @@ or let Tmux set the title automatically. Examples:
 
 ------------------------------------------------------------------------------
                                                       *vimrplugin_applescript*
-6.16. Integration with AppleScript (OS X only)~
+6.15. Integration with AppleScript (OS X only)~
 
 In Mac OS X, the plugin will try to send commands to R gui using AppleScript.
 If you prefer either to run R and Vim in the same terminal emulator split in
@@ -1640,7 +1631,7 @@ Otherwise, R will start in an external terminal emulator.
 ------------------------------------------------------------------------------
 						      *vimrplugin_listmethods*
                                                       *vimrplugin_specialplot*
-6.17. Special R functions~
+6.16. Special R functions~
 
 The R function `args()` lists the arguments of a function, but not the arguments
 of its methods. If you want that the plugin calls the function
@@ -1657,7 +1648,7 @@ after rg if you put the following line in your |vimrc|:
 
 ------------------------------------------------------------------------------
 						       *vimrplugin_maxdeparse*
-6.18. maxdeparse~
+6.17. maxdeparse~
 
 You can set the argument maxdeparse to be passed to R's `source()` function.
 Example:
@@ -1668,7 +1659,7 @@ Example:
 ------------------------------------------------------------------------------
 						       *vimrplugin_sweaveargs*
 						       *vimrplugin_latexcmd*
-6.19. LaTeX command~
+6.18. LaTeX command~
 
 On Windows, the vimcom package calls `tools::texi2dvi()` to build the pdf
 from the generated .tex file. On Linux/Unix, by default, it calls
@@ -1687,7 +1678,7 @@ vimrplugin_sweaveargs variable.
 
 ------------------------------------------------------------------------------
 						  *vimrplugin_rmd_environment*
-6.20. Rmd environment~
+6.19. Rmd environment~
 
 When rendering an Rmd file, the code can be evaluated (and saved) in a
 specified environment.  The default value is `.GlobalEnv` which makes the
@@ -1700,7 +1691,7 @@ you can set
 
 ------------------------------------------------------------------------------
 						*vimrplugin_never_unmake_menu*
-6.21. Never unmake the R menu~
+6.20. Never unmake the R menu~
 
 Use this option if you want that the "R" menu item in GVim is not deleted when
 you change from one buffer to another, for example, when going from an .R file
@@ -1716,7 +1707,7 @@ different file type buffers.
 
 ------------------------------------------------------------------------------
 							    *vimrplugin_map_r*
-6.22. Map 'r'~
+6.21. Map 'r'~
 
 If the variable |vimrplugin_map_r| exists, the plugin will map the letter 'r'
 to send lines to R when there are visually selected lines, for compatibility
@@ -1736,7 +1727,7 @@ Emacs:
 
 ------------------------------------------------------------------------------
 							    *vimrplugin_ca_ck*
-6.23. Add ^A^K to the beginning of commands~
+6.22. Add ^A^K to the beginning of commands~
 
 When one types  in the R Console the cursor goes to the beginning of the
 line and when one types  the characters to the right of the cursor are
@@ -1752,7 +1743,7 @@ in your |vimrc|:
 	                                                *vimrplugin_pdfviewer*
                                                         *vimrplugin_openpdf*
                                                         *vimrplugin_openhtml*
-6.24. Open PDF after processing rnoweb, rmd or rrst files~
+6.23. Open PDF after processing rnoweb, rmd or rrst files~
 
 The plugin can automatically open the pdf file generated by pdflatex, after
 either `Sweave()` or `knit()`. This behavior is controlled by the variable
@@ -1790,7 +1781,7 @@ The html file will be automatically opened if you put the following in your
 			                             *vimrplugin_strict_rst*
                                                      *vimrplugin_rst2pdfpath*
 			                             *vimrplugin_rst2pdfargs*
-6.25. Support to RreStructuredText file~
+6.24. Support to RreStructuredText file~
 
 By default, the Vim-R-plugin sends the command `render_rst(strict=TRUE)` to R
 before using R's `knit()` function to convert an Rrst file into an rst one. If
@@ -1806,7 +1797,7 @@ to R function knit2pdf).
 
 ------------------------------------------------------------------------------
 						 *vimrplugin_insert_mode_cmds*
-6.26. Allow R commands in insert mode~
+6.25. Allow R commands in insert mode~
 
 Vim-R commands are designed to work in insert mode as well as normal mode.
 However, depending on your , this can make it very difficult to
@@ -1826,7 +1817,7 @@ See also: |r-plugin-localleader|.
 ------------------------------------------------------------------------------
 							 *vimrplugin_allnames*
 							 *vimrplugin_rmhidden*
-6.27. Show/remove hidden objects~
+6.26. Show/remove hidden objects~
 
 Hidden objects are not included in the list of objects for omni completion. If
 you prefer to include them, put in your |vimrc|:
@@ -1841,7 +1832,7 @@ you prefer to remove only visible objects, put in your |vimrc|:
 
 ------------------------------------------------------------------------------
 							   *vimrplugin_source*
-6.28. Source additional scripts~
+6.27. Source additional scripts~
 
 This variable should contain a comma separated list of Vim scripts to be
 sourced by the Vim-R-plugin. These scripts may provide additional
@@ -1862,7 +1853,7 @@ features:
 
 ------------------------------------------------------------------------------
 							  *vimrplugin_restart*
-6.29. Restart R if it is already running (Linux/Unix only)~
+6.28. Restart R if it is already running (Linux/Unix only)~
 
 When R is already running and you type one of the commands to start R before
 you have done rq, the Vim-R-plugin does one of the following:
@@ -1880,7 +1871,7 @@ do rf, rv or rc, then, put in your
 
 ------------------------------------------------------------------------------
 							*vimrplugin_show_args*
-6.30. Show extra information during omnicompletion~
+6.29. Show extra information during omnicompletion~
 
 If you want that Vim shows a preview window with the function arguments as you
 do omnicompletion, put in your |vimrc|:
@@ -1894,7 +1885,7 @@ will be shown only if "preview" is also included in your 'completeopt'.
 
 ------------------------------------------------------------------------------
 						      *vimrplugin_vimcom_wait*
-6.31. Time to wait for vimcom loading~
+6.30. Time to wait for vimcom loading~
 
 The Vim-R-plugin waits 5000 milliseconds for vimcom package to be loaded
 during R startup. It then checks whether you are using the correct version of
@@ -1921,7 +1912,7 @@ If you do not want to install the vimcom package, then put in your
 
 ------------------------------------------------------------------------------
 							   *vimrplugin_vim_wd*
-6.32 Start R in working directory of Vim~
+6.31 Start R in working directory of Vim~
 
 The Vim-R-plugin starts R in the directory where the current buffer is. If you
 want R's working directory to be the same as Vim's working directory, put in
@@ -1934,7 +1925,7 @@ This option is useful only for those who did not enable 'autochdir'.
 
 ------------------------------------------------------------------------------
 						   *vimrplugin_user_maps_only*
-6.33 Only set key bindings that are user specified~
+6.32 Only set key bindings that are user specified~
 
 The Vim-R-plugin sets many default key bindings.  The user can set custom
 key bindings (|r-plugin-key-bindings|).  If you wish the Vim-R-plugin to only
@@ -1945,7 +1936,7 @@ set those key-bindings specified by the user, put in your vimrc:
 
 ------------------------------------------------------------------------------
 							    *r-plugin-SyncTeX*
-6.34 SyncTeX support (Linux only)~
+6.33 SyncTeX support (Linux only)~
 
 SyncTeX is a set of communication systems used by some PDF viewers and by some
 text editors which allow users to jump from a specific line in the text editor
@@ -1985,7 +1976,7 @@ Note: The current knitr package (version 1.7) has at least two limitations:
 
 
 ------------------------------------------------------------------------------
-6.34.1 Evince configuration~
+6.33.1 Evince configuration~
 
 If you have Evince installed, the Vim-R-plugin assumes that you are using it
 to view PDF documents and that you run either GVim or Vim in Gnome-Terminal.
@@ -1998,7 +1989,7 @@ to press gp again.
 
 
 ------------------------------------------------------------------------------
-6.34.2 Okular configuration~
+6.33.2 Okular configuration~
 
 You have to configure Okular to call Vim during backward searches.
 In Okular, click in:
@@ -2042,7 +2033,7 @@ requires additional steps because Neovim does not have the argument
 <
 
 ------------------------------------------------------------------------------
-6.34.3 Zathura configuration~
+6.33.3 Zathura configuration~
 
 Zathura (version >= 0.3.1) is also supported. If the terminal emulator is not
 raised during backward search (from PDF to Vim), you have to set the value of
@@ -2056,7 +2047,7 @@ to press gp again.
 ------------------------------------------------------------------------------
                                                        *vimrplugin_vim_window*
 				                       *vimrplugin_synctex*
-6.34.4 Configuring the PDF editor and Vim's window title~
+6.33.4 Configuring the PDF editor and Vim's window title~
 
 If SyncTeX does not work (see above), you may try to set in your |vimrc| the
 values of |vimrplugin_pdfviewer| and vimrplugin_vim_window.
@@ -2945,6 +2936,8 @@ See also |vimrplugin_r_in_buffer|.
 
  * No longer requires +python feature.
 
+ * Removed option vimrplugin_sleeptime.
+
 1.1 (2014-11-13)
 
  * Version update for Linux/Unix only. May not work on Windows or Mac.
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index c7f9e85..b009e05 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -741,6 +741,21 @@ function StartR_Windows()
     let vrph = $VIMRPLUGIN_HOME
     let $VIMRPLUGIN_HOME = substitute($VIMRPLUGIN_HOME, "\\\\ ", " ", "g")
 
+    if !executable(g:rplugin_Rgui)
+        call RWarningMsg('R executable "' . g:rplugin_Rgui . '" not found.')
+        return
+    endif
+
+    " R and Vim use different values for the $HOME variable.
+    let saved_home = $HOME
+    let prs = system('reg.exe QUERY "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v "Personal"')
+    if len(prs) > 0
+        let prs = substitute(prs, '.*REG_SZ\s*', '', '')
+        let prs = substitute(prs, '\n', '', 'g')
+        let prs = substitute(prs, '\s*$', '', 'g')
+        let $HOME = prs
+    endif
+
     let rcmd = g:rplugin_Rgui
     if g:vimrplugin_Rterm
         let rcmd = substitute(rcmd, "Rgui", "Rterm", "")
@@ -749,6 +764,8 @@ function StartR_Windows()
 
     silent exe "!start " . rcmd
 
+    let $HOME = saved_home
+
     if g:vimrplugin_vim_wd == 0
         lcd -
     endif
@@ -1080,8 +1097,8 @@ function WaitVimComStart()
     if filereadable($VIMRPLUGIN_TMPDIR . "/vimcom_running_" . $VIMINSTANCEID)
         let vr = readfile($VIMRPLUGIN_TMPDIR . "/vimcom_running_" . $VIMINSTANCEID)
         let g:rplugin_vimcom_version = vr[0]
-        if g:rplugin_vimcom_version != "1.1-0-dev4"
-            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.1-0-dev4.')
+        if g:rplugin_vimcom_version != "1.1.5"
+            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.1.5.')
             sleep 1
         endif
         let g:rplugin_vimcom_home = vr[1]
@@ -3252,7 +3269,6 @@ function MakeRMenu()
     endif
     if has("gui_win32") || has("gui_win64")
         amenu R.Help\ (plugin).Options.Use\ 32\ bit\ version\ of\ R :help vimrplugin_i386
-        amenu R.Help\ (plugin).Options.Sleep\ time :help vimrplugin_sleeptime
     endif
     amenu R.Help\ (plugin).Options.R\ path :help vimrplugin_r_path
     amenu R.Help\ (plugin).Options.Arguments\ to\ R :help vimrplugin_r_args
@@ -3891,7 +3907,7 @@ if has("win32") || has("win64")
         else
             let rip = filter(split(system('reg.exe QUERY "HKLM\SOFTWARE\R-core\R" /s'), "\n"), 'v:val =~ ".*InstallPath.*REG_SZ"')
             if len(rip) > 0
-                let s:rinstallpath = substitute(rip[0], "InstallPath.*REG_SZ *", "", "")
+                let s:rinstallpath = substitute(rip[0], "InstallPath.*REG_SZ\s*", "", "")
             endif
 
             if !exists("s:rinstallpath")
@@ -3926,9 +3942,6 @@ if has("win32") || has("win64")
     if !exists("g:vimrplugin_r_args")
         let g:vimrplugin_r_args = "--sdi"
     endif
-    if !exists("g:vimrplugin_sleeptime")
-        let g:vimrplugin_sleeptime = 0.02
-    endif
     if g:vimrplugin_Rterm
         let g:rplugin_Rgui = substitute(g:rplugin_Rgui, "Rgui", "Rterm", "")
     endif

From 27fe9380e4e762cf2b111e57c41975bae86c5a69 Mon Sep 17 00:00:00 2001
From: Frans van Dunne 
Date: Wed, 26 Nov 2014 08:36:35 -0500
Subject: [PATCH 0844/1050] Spell check of first 1000 lines

---
 doc/r-plugin.txt | 84 ++++++++++++++++++++++++------------------------
 1 file changed, 42 insertions(+), 42 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 25047d0..532786b 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -107,8 +107,8 @@ The installation instructions are split in four sections:
 
 If you are using Windows, jump to section 3.2.
 
-If you are an unexperienced Vim user, start a terminal emulator and type in
-it: `vimtutor`
+If you are an inexperienced Vim user, start a terminal emulator and type:
+`vimtutor`
 
 Before installing the plugin, you should install its dependencies:
 
@@ -498,18 +498,17 @@ The plugin commands that send code to R Console are the most commonly used. If
 the code to be sent to R has a single line it is sent directly to R Console,
 but if it has more than one line (a selection of lines, a block of lines
 between two marks, a paragraph etc) the lines are written to a file and the
-plugin sends to R the command to source the file. You should type quickly
-d to send to R Console the line currently under the cursor. If
-you want to see what lines are being sourced when sending a selection of
-lines, you should do either se or sa instead of
-ss.
+plugin sends to R the command to source the file. To send to R Console the
+line currently under the cursor you should type d. If you want to
+see what lines are being sourced when sending a selection of lines, you can
+use either se or sa instead of ss.
 
 If the cursor is over the header of an R chunk with the `child` option (from
 Rnoweb, RMarkdown or RreStructuredText document), and you use one of the
 commands that send a single line of code to R, then the plugin will send to R
 the command to knit the child document.
 
-After the commands that send, sweave or knit the current buffer, Vim will save
+After the commands that send sweave or knit the current buffer, Vim will save
 the current buffer if it has any pending changes before performing the tasks.
 After ao, Vim will run "R CMD BATCH --no-restore --no-save" on
 the current file and show the resulting .Rout file in a new tab. Please see
@@ -664,10 +663,10 @@ manually delete them.
 ------------------------------------------------------------------------------
 4.5. The Object Browser~
 
-You have to do ro to either start or updated the Object Browser.
+You have to do ro to either start or update the Object Browser.
 The Object Browser has two views: .GlobalEnv and Libraries. If you either
 press  or double click (GVim or Vim with 'mouse' set to "a") on the
-first line of the Object Browser it will toggle the view between the objects
+first line of the Object Browser, you will toggle the view between the objects
 in .GlobalEnv and the currently loaded libraries. The Object Browser requires
 the |+clientserver| feature to be automatically updated and the |+conceal|
 feature to correctly align list items.
@@ -682,9 +681,9 @@ UTF-8 is part of either LC_MESSAGES or LC_ALL variables, unicode line drawing
 characters will be used to draw lines in the Object Browser. This is the case
 of most Linux distributions.
 
-In the Libraries view, you can either double click or press  over a
-library to see its objects. In the Object Browser, the libraries have the
-color defined by the PreProc highlighting group, and the other objects have
+In the Libraries view, you can either double click or press  on a
+library name to see its objects. In the Object Browser the libraries have the
+color defined by the PreProc highlighting group. The other objects have
 their colors defined by the return value of some R functions. Each line in the
 table below shows a highlighting group and the corresponding R function (if
 any) used to classify the objects:
@@ -789,11 +788,11 @@ Vim by typing:
 >
    tvim filename.R
 <
-Using the `tvim` function, the Tmux session is finished when you quits Vim.
+Using the `tvim` function, the Tmux session is finished when you quit Vim.
 That is, the main advantage of using `tvim` is that you do not have to type
-`tmux` before and `exit` after the edition of the file. Moreover, the `tvim`
-command also pass the |--servername| argument to Vim, which is required to
-update the Object Browser and functions highlight.
+`tmux` before and `exit` after editing the file. Moreover, the `tvim` command
+also passes the |--servername| argument to Vim, which is required to update the
+Object Browser and functions highlight.
 
 If you are going to run Vim inside Tmux, than you should create your
 ~/.tmux.conf if it does not exist yet. You may put the lines below in your
@@ -821,8 +820,8 @@ copy/scroll back mode (see below).
 
 The configuration script also sets  as the Tmux escape character (the
 default is ), that is, you have to type  before typing a Tmux
-command. Below are the most useful key bindings to use Tmux with the above
-tmux.conf:
+command. Below are the most useful key bindings for Tmux with the tmux.conf
+shown above in section 4.8.1.
 
     arrow keys : Move the cursor to the Tmux panel above, below, at the
                       right or at the left of the current one.
@@ -889,11 +888,11 @@ support in Tmux. You will be able to toggle mouse support on and off by typing
 Note: Neovim does not require the --servername VIM argument. Thus, you also do
 not need to enable the X11 Forwarding for omnicompletion, etc.
 
-The Vim-R-plugin can not send commands from a local Vim to a remote R, but
-you can access the remote machine through ssh and run Tmux, Vim and R in the
+The Vim-R-plugin can not send commands from a local Vim to a remote R, but you
+can access the remote machine through ssh and run Tmux, Vim and R in the
 remote machine. Tmux should not be running in the local machine because some
-environment variables could pass from the local to the remote Tmux and make
-the plugin confuse.
+environment variables could pass from the local to the remote Tmux and confuse
+the plugin.
 
 If you need to access Vim in a remote Unix machine through ssh, and if you
 want to get omnicompletion, syntax highlight of function names and the Object
@@ -916,10 +915,10 @@ Browser working properly, then you have to:
      tmux
      vim --servername VIM script.R
 <
-With Tmux, you can detach the Vim-R session and reattach it latter (but the
+With Tmux, you can detach the Vim-R session and reattach it later (but the
 connection with the XServer could be lost in the process). This is useful if
-you plan to begin the use the Vim-R-plugin in a machine and latter move to
-another computer and access remotely your previous Vim-R session. Below is the
+you plan to begin the use the Vim-R-plugin in a machine and later move to
+another computer and access your previous Vim-R session remotely. Below is the
 step-by-step procedure to run the Vim-R remotely:
 
   - Start Tmux:
@@ -935,8 +934,9 @@ step-by-step procedure to run the Vim-R remotely:
     The command will be d if you have not set  as the escape
     character in your ~/.tmux.conf.
 
-  - Some time latter (even if accessing the machine remotely) reattach the
+  - Some time later (even if accessing the machine remotely) reattach the
     Tmux session:
+      
       tmux attach
 
 
@@ -944,19 +944,18 @@ step-by-step procedure to run the Vim-R remotely:
 							 *r-plugin-known-bugs*
 5. Known bugs and workarounds~
 
-The bugs that are known to exist but that will not be fixed are listed in this
-section. Some of them can not be fixed because they depend on either R or Vim
-missing features; others would be very time consuming to fix without breaking
-anything.
+Known bugs that will not be fixed are listed in this section. Some of them can
+not be fixed because they depend on missing features in either R or Vim;
+others would be very time consuming to fix without breaking anything.
 
 
 ------------------------------------------------------------------------------
 5.1. R's source() issues~
 
-The R's `source()` function of base package prints an extra new line between
-commands if the option echo = TRUE, and error and warning messages are printed
-only after the entire code is sourced, which makes it more difficult to find
-errors in the code sent to R. Details:
+The R's `source()` function of the base package prints an extra new line
+between commands if the option echo = TRUE, and error and warning messages are
+printed only after the entire code is sourced. This makes it more difficult to
+find errors in the code sent to R. Details:
 
    https://stat.ethz.ch/pipermail/r-devel/2012-December/065352.html
 
@@ -981,8 +980,8 @@ Normal, Visual and Insert modes.
 5.4. Syntactically correct code may be wrongly indented~
 
 If the Vim-R-plugin indents your code wrongly you may get the correct
-indentation by adding braces and line breaks to it. For example, try to
-indent the code below:
+indentation by adding braces and line breaks to it. For example, try to indent
+the code below:
 >
     # This code will be wrongly indented:
 
@@ -1030,8 +1029,8 @@ On Windows, when code is sent from Vim to R Console, the vimcom library
 sets the value of the internal variable `r_is_busy` to 1. The value is set
 back to 0 when any code is successfully evaluated. If you send invalid code to
 R, there will be no successful evaluation of code and, thus, the value of
-`r_is_busy` will remain set to 1. Then, if you try to update the object
-browser, see the R documentation for any function, or do other tasks that
+`r_is_busy` will remain set to 1. If you then try to update the Object
+Browser, see the R documentation for any function, or do other tasks that
 require the hidden evaluation of code by R, the vimcom library will
 refuse to do the tasks to avoid any risk of corrupting R's memory. It will
 tell Vim that "R is busy" and Vim will display this message. Everything should
@@ -1047,7 +1046,8 @@ There is no SyncTeX support for Windows and Mac OS X. Both Sumatra (Windows)
 and Skim (Mac OS X) have support for SyncTeX, but the Vim-R-plugin is not
 ready to communicate with them. If you can, please write the necessary code to
 support anyone of them and submit a push request on github:
-https://github.com/jcfaria/Vim-R-plugin
+
+    https://github.com/jcfaria/Vim-R-plugin
 
 
 ------------------------------------------------------------------------------
@@ -1331,7 +1331,7 @@ them converted into `<-`.
 						      *vimrplugin_external_ob*
 6.4. Object Browser options~
 
-By default, the object browser will be created with 40 columns. The minimum
+By default, the Object Browser will be created with 40 columns. The minimum
 width of the Object Browser window is 9 columns. You can change the object
 browser's default width by setting the value of |vimrplugin_objbr_w| in your
 |vimrc|, as below:
@@ -3115,7 +3115,7 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details.
 110222 (2011-02-22)
  * Added syntax/rhelp.vim.
  * New command for rnoweb files: BibTeX current file (\sb).
- * New commands for the object browser: open visible lists (\r=) and close
+ * New commands for the Object Browser: open visible lists (\r=) and close
    visible lists (\r-).
  * Reorganization of the GUI menu.
 

From 2becc448c718c523df41c5c9779de13274f0a4f7 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Wed, 26 Nov 2014 09:11:25 -0500
Subject: [PATCH 0845/1050] Minor bug fixes.

---
 ftplugin/rnoweb_rplugin.vim |  1 -
 r-plugin/common_global.vim  | 28 ++++++++++++++++------------
 2 files changed, 16 insertions(+), 13 deletions(-)

diff --git a/ftplugin/rnoweb_rplugin.vim b/ftplugin/rnoweb_rplugin.vim
index d5f5597..7aa50dd 100644
--- a/ftplugin/rnoweb_rplugin.vim
+++ b/ftplugin/rnoweb_rplugin.vim
@@ -515,7 +515,6 @@ function! SyncTeX_forward(...)
         else
             let g:rplugin_zathura_pid[basenm] = 0
             call RStart_Zathura(basenm)
-            endif
         endif
         call system("wmctrl -a '" . basenm . ".pdf'")
     elseif g:rplugin_pdfviewer == "sumatra"
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index b009e05..be3ba0f 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -1097,19 +1097,12 @@ function WaitVimComStart()
     if filereadable($VIMRPLUGIN_TMPDIR . "/vimcom_running_" . $VIMINSTANCEID)
         let vr = readfile($VIMRPLUGIN_TMPDIR . "/vimcom_running_" . $VIMINSTANCEID)
         let g:rplugin_vimcom_version = vr[0]
+        let g:rplugin_vimcom_home = vr[1]
+        let g:rplugin_vimcomport = vr[2]
         if g:rplugin_vimcom_version != "1.1.5"
             call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.1.5.')
             sleep 1
         endif
-        let g:rplugin_vimcom_home = vr[1]
-        if has("win32")
-            let g:rplugin_vimcom_lib = g:rplugin_vimcom_home . "/libs/i386/vimcom.dll"
-        elseif has("win64")
-            let g:rplugin_vimcom_lib = g:rplugin_vimcom_home . "/libs/x64/vimcom.dll"
-        else
-            let g:rplugin_vimcom_lib = g:rplugin_vimcom_home . "/libs/vimcom.so"
-        endif
-        let g:rplugin_vimcomport = vr[2]
         if has("nvim")
             if g:rplugin_clt_job
                 call jobstop(g:rplugin_clt_job)
@@ -1136,6 +1129,17 @@ function WaitVimComStart()
             else
                 call RWarningMsg('Application "' . nvs . '" not found.')
             endif
+        else
+            if has("win32")
+                let g:rplugin_vimcom_lib = g:rplugin_vimcom_home . "/libs/i386/vimcom.dll"
+            elseif has("win64")
+                let g:rplugin_vimcom_lib = g:rplugin_vimcom_home . "/libs/x64/vimcom.dll"
+            else
+                let g:rplugin_vimcom_lib = g:rplugin_vimcom_home . "/libs/vimcom.so"
+            endif
+            if !filereadable(g:rplugin_vimcom_lib)
+                call RWarningMsg('Could not find "' . g:rplugin_vimcom_lib . '".')
+            endif
         endif
         call delete($VIMRPLUGIN_TMPDIR . "/vimcom_running_" . $VIMINSTANCEID)
         if has("nvim") && g:vimrplugin_vimpager != "no"
@@ -1742,7 +1746,7 @@ function SendFileToR(e)
 endfunction
 
 " Send block to R
-" Adapted of the plugin marksbrowser
+" Adapted from marksbrowser plugin
 " Function to get the marks which the cursor is between
 function SendMBlockToR(e, m)
     if &filetype != "r" && b:IsInRCode(1) == 0
@@ -2676,7 +2680,7 @@ function RStart_Zathura(basenm)
     if has("nvim")
         let shcode = ['#!/bin/sh', 'echo "call SyncTeX_backward(' . "'$1'" . ', $2)" >> "' . $VIMRPLUGIN_TMPDIR . '/zathura_search"']
         call writefile(shcode, $VIMRPLUGIN_TMPDIR . "/synctex_back.sh")
-        let a2 = "a2 = 'sh " . $VIMRPLUGIN_TMPDIR . "/synctex_back.sh %{input} %{line}'",
+        let a2 = "a2 = 'sh " . $VIMRPLUGIN_TMPDIR . "/synctex_back.sh %{input} %{line}'"
     else
         let a2 = 'a2 = "vim --servername ' . v:servername . " --remote-expr \\\"SyncTeX_backward('%{input}',%{line})\\\"" . '"'
     endif
@@ -3770,7 +3774,7 @@ endfunction
 
 function SendToVimCom_Neovim(...)
     if g:rplugin_clt_job == 0
-        call RWarningMsg("VimCom client not runing.")
+        call RWarningMsg("VimCom client not running.")
         return
     endif
     call jobsend(g:rplugin_clt_job, a:1 . "\n")

From ac889a309ad0815baf2fe707d42db60fd16e2279 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Wed, 26 Nov 2014 09:12:52 -0500
Subject: [PATCH 0846/1050] Change color of routIndex.

---
 syntax/rout.vim | 17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)

diff --git a/syntax/rout.vim b/syntax/rout.vim
index 41a257f..edcd7f8 100644
--- a/syntax/rout.vim
+++ b/syntax/rout.vim
@@ -1,20 +1,15 @@
 " Vim syntax file
 " Language:    R output Files
 " Maintainer:  Jakson Aquino 
-" Last Change: Sun Nov 23, 2014  04:27PM
-"
-
-" Version Clears: {{{1
-" For version 5.x: Clear all syntax items
-" For version 6.x and 7.x: Quit when a syntax file was already loaded
-if version < 600 
-    syntax clear
-elseif exists("b:current_syntax")
+
+
+if exists("b:current_syntax")
     finish
 endif 
 
 setlocal iskeyword=@,48-57,_,.
-setlocal conceallevel=2
+setlocal conceallevel=3
+set concealcursor="n"
 
 syn case match
 
@@ -181,7 +176,7 @@ else
         hi routStdErr	ctermfg=117
         hi routError	ctermfg=15 ctermbg=1
         hi routWarn	ctermfg=1
-        hi routIndex	ctermfg=186
+        hi routIndex	ctermfg=109
     else
         " Defalt 16 colors scheme for R output:
         hi routInput	ctermfg=gray

From f548ee7ba94786e7c3775bad8935b5469e01edad Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Wed, 26 Nov 2014 12:20:27 -0500
Subject: [PATCH 0847/1050] Add omnicompletion to R_Output buffer.

---
 doc/r-plugin.txt           | 20 ++++++++++++--------
 r-plugin/common_global.vim |  6 ++++++
 2 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 845c045..c127c36 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -1292,13 +1292,17 @@ your |vimrc|:
 >
    let vimrplugin_r_in_buffer = 1
 <
-R will run as a Neovim job and the output will be displayed in a buffer. In
-addition to sending code from the R script buffer to R, you can also press
- in Normal mode to open an R scratch buffer to type
-commands that want to see evaluated by R but do not want in your final script.
-Syntax highlight and omnicompletion will be available in the scratch buffer.
-If the cursor is in the last line of the R_Output buffer and Neovim is in
-Insert mode, an  will submit the line to R evaluation.
+R will run as a Neovim job and the output will be displayed in a buffer. If
+the cursor is in the last line of the R_Output buffer and Neovim is in Insert
+mode, an  will submit the line to R evaluation. You can use 
+to complete names of objects and  to complete the names of function
+arguments.
+
+Whether you are in the R script buffer or in the R_Output buffer, you can also
+press  in Normal mode to open an R scratch buffer to
+type commands that you want to see evaluated by R but do not want in your
+final script. The keys  and  are mapped in Normal mode to quit the
+scratch buffer.
 
 You can set the foreground colors of R output in your |vimrc| when you are
 running Neovim in a terminal emulator. The example below is for a terminal
@@ -2930,7 +2934,7 @@ See also |vimrplugin_r_in_buffer|.
 							       *r-plugin-news*
 10. News~
 
-1.1.1 (2014-11-24)
+1.1.1 (2014-11-26)
 
  * New option (Neovim only): vimrplugin_r_in_buffer.
 
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index be3ba0f..3e1930c 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -831,6 +831,12 @@ function! StartR_Neovim()
     setlocal noswapfile
     setlocal bufhidden=hide
     set buftype=nofile
+    set omnifunc=rcomplete#CompleteR
+    if hasmapto("RCompleteArgs", "i")
+        imap  RCompleteArgs =RCompleteArgs()
+    else
+        imap   =RCompleteArgs()
+    endif
     let b:objbrtitle = g:tmp_objbrtitle
     let b:rscript_buffer = g:tmp_curbufname
     unlet g:tmp_objbrtitle

From eed07a966eac463a544def62dc275e0955e7fd21 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Fri, 28 Nov 2014 08:27:56 -0500
Subject: [PATCH 0848/1050] Improve conceal syntax in rout.

---
 syntax/rout.vim | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/syntax/rout.vim b/syntax/rout.vim
index edcd7f8..0c3f62c 100644
--- a/syntax/rout.vim
+++ b/syntax/rout.vim
@@ -8,8 +8,6 @@ if exists("b:current_syntax")
 endif 
 
 setlocal iskeyword=@,48-57,_,.
-setlocal conceallevel=3
-set concealcursor="n"
 
 syn case match
 
@@ -71,10 +69,18 @@ else
     syn match routInput /^+ .*/
 endif
 
-syn region routStdErr start='^: ' end="$" contains=routConceal
-syn region routError start='^: .*Error.*' end='^>' contains=routConceal
-syn region routWarn start='^: .*Warn.*' end='^>' contains=routConceal
-syn match routConceal '^: ' conceal contained
+if has("conceal")
+    setlocal conceallevel=3
+    set concealcursor=n
+    syn match routConceal '^: ' conceal contained
+    syn region routStdErr start='^: ' end="$" contains=routConceal
+    syn region routError start='^: .*Error.*' end='^>' contains=routConceal
+    syn region routWarn start='^: .*Warn.*' end='^>' contains=routConceal
+else
+    syn region routStdErr start='^: ' end="$"
+    syn region routError start='^: .*Error.*' end='^>'
+    syn region routWarn start='^: .*Warn.*' end='^>'
+endif
 
 " Index of vectors
 syn match routIndex /^\s*\[\d\+\]/
@@ -138,6 +144,7 @@ if g:vimrplugin_routmorecolors == 0
     hi def link routInput	Comment
 endif
 
+hi def link routConceal	Ignore
 if exists("g:rout_follow_colorscheme") && g:rout_follow_colorscheme
     " Default when following :colorscheme
     hi def link routNormal	Normal
@@ -157,7 +164,6 @@ if exists("g:rout_follow_colorscheme") && g:rout_follow_colorscheme
     hi def link routStdErr	Function
     hi def link routError	ErrorMsg
     hi def link routWarn	WarningMsg
-    hi def link routConceal	Ignore
 else
     if &t_Co == 256
         " Defalt 256 colors scheme for R output:

From 7d660e7c8a5c3763508ae3724e922e9a48307a2f Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Fri, 28 Nov 2014 08:28:47 -0500
Subject: [PATCH 0849/1050] Map q to :q in rdoc.

---
 ftplugin/rdoc.vim | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/ftplugin/rdoc.vim b/ftplugin/rdoc.vim
index 709bb92..4e5d563 100644
--- a/ftplugin/rdoc.vim
+++ b/ftplugin/rdoc.vim
@@ -1,7 +1,7 @@
 " Vim filetype plugin file
 " Language: R Documentation (generated by the Vim-R-plugin)
 " Maintainer: Jakson Alves de Aquino 
-" Last Change:	Thu Nov 13, 2014  08:11AM
+" Last Change:	Thu Nov 27, 2014  12:08PM
 
 
 " Only do this when not yet done for this buffer
@@ -128,6 +128,7 @@ function! RDocExSection()
 endfunction
 
 nmap  ge :call RDocExSection()
+nmap  q :q
 
 setlocal bufhidden=wipe
 setlocal noswapfile

From d2324d5b535c7dd74e96b7506759846bf76b7ee2 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Fri, 28 Nov 2014 08:30:03 -0500
Subject: [PATCH 0850/1050] Add prompt to R_Output.

---
 r-plugin/common_global.vim | 75 ++++++++++++++++++++++++--------------
 1 file changed, 48 insertions(+), 27 deletions(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 3e1930c..26e0fbd 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -841,7 +841,7 @@ function! StartR_Neovim()
     let b:rscript_buffer = g:tmp_curbufname
     unlet g:tmp_objbrtitle
     unlet g:tmp_curbufname
-    imap   :call EnterRCmd()o
+    imap   :call EnterRCmd()A
     call cursor("$", 1)
     exe "sbuffer " . edbuf
 
@@ -849,7 +849,7 @@ function! StartR_Neovim()
 
     let savedterm = $TERM
     let $TERM="NeovimTerm"
-    let g:rplugin_rjob = jobstart("Rjob", 'R', ['--no-readline', '--slave', '--interactive'])
+    let g:rplugin_rjob = jobstart("Rjob", 'R', ['--no-readline', '--interactive'])
     exe 'let $TERM="' . savedterm . '"'
     call WaitVimComStart()
 endfunction
@@ -1004,7 +1004,12 @@ endfunction
 function GetRActivity()
     if v:job_data[1] == 'stdout' || v:job_data[1] == 'stderr'
         let edbuf = bufname("%")
-        sbuffer R_Output
+        if edbuf == "R_Output"
+            let isrout = 1
+        else
+            let isrout = 0
+            sbuffer R_Output
+        endif
         for lin in v:job_data[2]
             if lin =~ ".\x0d."
                 let lin = substitute(lin, ".*\x0d", "", "g")
@@ -1015,13 +1020,22 @@ function GetRActivity()
             if v:job_data[1] == 'stderr'
                 let lin = ': ' . lin
             endif
-            call append(line("$"), lin)
-            if edbuf == "R_Output"
-                call append(line("$"), "")
+            if lin != "#<#"
+                if lin == "#>#"
+                    call append(line("$"), "> ")
+                    call cursor("$", 2)
+                    if isrout
+                        startinsert!
+                    endif
+                else
+                    call append(line("$"), lin)
+                    call cursor("$", 1)
+                endif
             endif
         endfor
-        call cursor("$", 1)
-        exe "sbuffer " . edbuf
+        if !isrout
+            exe "sbuffer " . edbuf
+        endif
     else
         let g:rplugin_rjob = 0
         let g:SendCmdToR = function('SendCmdToR_fake')
@@ -1038,25 +1052,34 @@ function GetRActivity()
 endfunction
 
 function SendCmdToR_Neovim(rcmd)
-    let edbuf = bufname("%")
+    let curbuf = bufname("%")
     sbuffer R_Output
     if winwidth(0) != b:winwidth
         let b:winwidth = winwidth(0)
         call g:SendToVimCom("\x08" . $VIMINSTANCEID . "options(width=" . b:winwidth . ")", "I")
     endif
-    call append(line("$"), "> " . a:rcmd)
-    call cursor("$", 1)
-    exe "sbuffer " . edbuf
+    if getline("$") == "> "
+        call setline(line("$"), "> " . a:rcmd)
+    else
+        call append(line("$"), "> " . a:rcmd)
+    endif
+    exe "sbuffer " . curbuf
     let ok = jobsend(g:rplugin_rjob, a:rcmd . "\n")
     return ok
 endfunction
 
 function EnterRCmd()
     if line(".") != line("$")
+        call append(".", "")
+        call cursor(line(".")+1, 1)
         return
     endif
-    let lin = getline(".")
-    call setline(".", "")
+    " First delete only the less than sign because the user may have manually
+    " deleted the space:
+    let lin = substitute(getline("."), '^>', '', '')
+    " Now delete one space in the beginning, if there any:
+    let lin = substitute(lin, '^ ', '', '')
+    call setline(line("."), "> ")
     call SendCmdToR_Neovim(lin)
 endfunction
 
@@ -1079,7 +1102,6 @@ function RSetNeovimPort(p)
     endif
 endfunction
 
-" Neovim don't need this function:
 function WaitVimComStart()
     if g:vimrplugin_vimcom_wait < 0
         return 0
@@ -1105,8 +1127,8 @@ function WaitVimComStart()
         let g:rplugin_vimcom_version = vr[0]
         let g:rplugin_vimcom_home = vr[1]
         let g:rplugin_vimcomport = vr[2]
-        if g:rplugin_vimcom_version != "1.1.5"
-            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.1.5.')
+        if g:rplugin_vimcom_version != "1.1.6"
+            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.1.6.')
             sleep 1
         endif
         if has("nvim")
@@ -1135,17 +1157,16 @@ function WaitVimComStart()
             else
                 call RWarningMsg('Application "' . nvs . '" not found.')
             endif
+        endif
+        if has("win32")
+            let g:rplugin_vimcom_lib = g:rplugin_vimcom_home . "/libs/i386/vimcom.dll"
+        elseif has("win64")
+            let g:rplugin_vimcom_lib = g:rplugin_vimcom_home . "/libs/x64/vimcom.dll"
         else
-            if has("win32")
-                let g:rplugin_vimcom_lib = g:rplugin_vimcom_home . "/libs/i386/vimcom.dll"
-            elseif has("win64")
-                let g:rplugin_vimcom_lib = g:rplugin_vimcom_home . "/libs/x64/vimcom.dll"
-            else
-                let g:rplugin_vimcom_lib = g:rplugin_vimcom_home . "/libs/vimcom.so"
-            endif
-            if !filereadable(g:rplugin_vimcom_lib)
-                call RWarningMsg('Could not find "' . g:rplugin_vimcom_lib . '".')
-            endif
+            let g:rplugin_vimcom_lib = g:rplugin_vimcom_home . "/libs/vimcom.so"
+        endif
+        if !filereadable(g:rplugin_vimcom_lib)
+            call RWarningMsg('Could not find "' . g:rplugin_vimcom_lib . '".')
         endif
         call delete($VIMRPLUGIN_TMPDIR . "/vimcom_running_" . $VIMINSTANCEID)
         if has("nvim") && g:vimrplugin_vimpager != "no"

From 52afe3d8817da17efa144717522fd57d75b555e7 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Fri, 28 Nov 2014 08:45:09 -0500
Subject: [PATCH 0851/1050] Update documentation.

---
 doc/r-plugin.txt | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index c127c36..76135ee 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -561,7 +561,8 @@ trigger the autocompletion of R objects names or hit CTRL-D to list the
 possible completions (see |cmdline-completion| for details on the various ways
 of getting command-line completion). The list of objects used for
 completion is the same available for omnicompletion (see
-|vimrplugin_permanent_libs|).
+|vimrplugin_permanent_libs|). You may close the R documentation buffer by
+simply pressing `q`.
 
 You can source all .R files in a directory with the Normal mode command
 :RSourceDir, which accepts an optional argument (the directory to be sourced).
@@ -1336,7 +1337,10 @@ put in your vimrc:
 >
    let rout_follow_colorscheme = 1
 <
-Note: See |job-control| if you want to know more about Neovim jobs.
+Note: The Vim-R-plugin relies on special values of `options("continue")` and
+`options("prompt")` set by the vimcom package to recognize the end of output
+and add the prompt symbol. If you need to change either of these two options,
+please, open an issue at https://github.com/jcfaria/Vim-R-plugin/issues
 
 
 ------------------------------------------------------------------------------

From 84b0b68d36f1a8a3b24010870525fc17136be0ea Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sat, 29 Nov 2014 21:53:59 -0500
Subject: [PATCH 0852/1050] Add new capabilities to Neovim buffer running R.
 Better emulation of Console capabilities:   - Autocompletion:  and
    - Cicle through history:  and    - Complete previous
 command:    - See history of commands:  :Rhistory   - Stop R:   or
 :RStop

---
 doc/r-plugin.txt           |  36 +++++++++----
 r-plugin/common_global.vim | 103 +++++++++++++++++++++++++++++++++++--
 2 files changed, 125 insertions(+), 14 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 76135ee..b065926 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -372,6 +372,7 @@ Start/Close
   . Start R (custom)                                   \rc
   --------------------------------------------------------
   . Close R (no save)                                  \rq
+  . Stop R                                          :RStop
 -----------------------------------------------------------
 
 Send
@@ -1286,7 +1287,7 @@ it.
 6.3. Run R in Neovim buffer (experimental feature)~
 
 Note: This is an experimental feature to test Neovim capabilities and may be
-removed in the future.
+removed in the future. See bugs at the end of this section.
 
 If you are running Neovim and want to try this experimental feature, put in
 your |vimrc|:
@@ -1295,9 +1296,11 @@ your |vimrc|:
 <
 R will run as a Neovim job and the output will be displayed in a buffer. If
 the cursor is in the last line of the R_Output buffer and Neovim is in Insert
-mode, an  will submit the line to R evaluation. You can use 
-to complete names of objects and  to complete the names of function
-arguments.
+mode, an  will submit the line to R evaluation,  will
+complete names of objects,  will complete the names of function
+arguments, and  and  will cycle through the history of sent
+commands. Finally, if you type part of a previously issued command, you can
+press  to complete the line from the history.
 
 Whether you are in the R script buffer or in the R_Output buffer, you can also
 press  in Normal mode to open an R scratch buffer to
@@ -1305,6 +1308,10 @@ type commands that you want to see evaluated by R but do not want in your
 final script. The keys  and  are mapped in Normal mode to quit the
 scratch buffer.
 
+The R command `history()` will not work, but you can do `:Rhistory` in Neovim
+to open a buffer with the history of commands in a new tab. Commands starting
+with the string "base::source" are not added to the history.
+
 You can set the foreground colors of R output in your |vimrc| when you are
 running Neovim in a terminal emulator. The example below is for a terminal
 emulator that supports 256 colors (see |highlight-ctermfg|):
@@ -1341,8 +1348,17 @@ Note: The Vim-R-plugin relies on special values of `options("continue")` and
 `options("prompt")` set by the vimcom package to recognize the end of output
 and add the prompt symbol. If you need to change either of these two options,
 please, open an issue at https://github.com/jcfaria/Vim-R-plugin/issues
+because it would be possible to add options to customize them.
 
-
+Note: Output that does not end in a newline character does not generate
+JobActivity and therefore is shown only after an output with a newline. That
+is, if R asks for user input, the question will not be shown. For example,
+this will not work:
+>
+   par(ask=TRUE)
+   plot(1,1)
+<
+The plugin relies 
 ------------------------------------------------------------------------------
 						      *vimrplugin_rnowebchunk*
 	                                              *vimrplugin_assign_map*
@@ -2295,8 +2311,8 @@ directory after the installation:
 
 9.1. Is it possible to stop R from within Vim?~
 
-Sorry, it is not possible. The plugin can only send the `quit()` command. If you
-want to stop R, you have to press ^C into R's Console.
+Yes. In Normal mode do `:RStop` and Vim will send SIGINT to R which is the
+same signal sent when you press CTRL-C into R's Console.
 
 
 ------------------------------------------------------------------------------
@@ -2938,9 +2954,11 @@ See also |vimrplugin_r_in_buffer|.
 							       *r-plugin-news*
 10. News~
 
-1.1.1 (2014-11-26)
+1.1.1 (2014-11-29)
+
+ * New option (Neovim only): vimrplugin_r_in_buffer and :Rhistory.
 
- * New option (Neovim only): vimrplugin_r_in_buffer.
+ * New command: :RStop.
 
  * No longer requires +python feature.
 
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 26e0fbd..ee47dc9 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -734,6 +734,7 @@ function StartR_Windows()
         let repl = libcall(g:rplugin_vimcom_lib, "FindRConsole", 'R Console')
         if repl == "NotFound"
             let g:SendCmdToR = function('SendCmdToR_fake')
+            let g:rplugin_r_pid = 0
             call RWarningMsg('There is already a window called "R Console".')
             return
         endif
@@ -842,6 +843,10 @@ function! StartR_Neovim()
     unlet g:tmp_objbrtitle
     unlet g:tmp_curbufname
     imap   :call EnterRCmd()A
+    imap   :RStopa
+    imap   :call RConsoleArrow("up")A
+    imap   :call RConsoleArrow("down")A
+    imap   =CompleteFromHistory()
     call cursor("$", 1)
     exe "sbuffer " . edbuf
 
@@ -1038,6 +1043,7 @@ function GetRActivity()
         endif
     else
         let g:rplugin_rjob = 0
+        let g:rplugin_r_pid = 0
         let g:SendCmdToR = function('SendCmdToR_fake')
         if bufname("%") == "R_Output"
             call append("$", ':    ---  R Finished  ---')
@@ -1051,6 +1057,37 @@ function GetRActivity()
     endif
 endfunction
 
+function CompleteFromHistory()
+    if line(".") != line("$")
+        return
+    endif
+
+    let key = substitute(getline("."), '^>', '', '')
+    let key = substitute(key, '^ ', '', '')
+    let key = substitute(key, '^\s*\(.*\)\s*', '\1', '')
+    let histlin = [key]
+    call setline(".", "> ")
+    for lin in g:rplugin_rhistory
+        if lin =~ key
+            let histlin += [lin]
+        endif
+    endfor
+    call complete(3, histlin)
+    return ''
+endfunction
+
+function ShowRhistory()
+    tabnew R_history
+    call setline(".", g:rplugin_rhistory)
+    set ft=r
+endfunction
+
+function AddToRHistory(rcmd)
+    let g:rplugin_rhist_pos += 1
+    let g:rplugin_dyn_rhist_pos = g:rplugin_rhist_pos
+    let g:rplugin_rhistory += [a:rcmd]
+endfunction
+
 function SendCmdToR_Neovim(rcmd)
     let curbuf = bufname("%")
     sbuffer R_Output
@@ -1063,11 +1100,51 @@ function SendCmdToR_Neovim(rcmd)
     else
         call append(line("$"), "> " . a:rcmd)
     endif
+    let g:rplugin_addedtohist = 0
+    if a:rcmd !~ '^base::source('
+        call AddToRHistory(a:rcmd)
+    endif
     exe "sbuffer " . curbuf
     let ok = jobsend(g:rplugin_rjob, a:rcmd . "\n")
     return ok
 endfunction
 
+" Send SIGINT to R
+function StopR()
+    if g:rplugin_r_pid
+        call system("kill -s SIGINT " . g:rplugin_r_pid)
+    endif
+endfunction
+
+function RConsoleArrow(dir)
+    if line(".") != line("$")
+        return
+    endif
+
+    " Check if current last typed line of R_Output is already in history
+    if g:rplugin_addedtohist == 0
+        let lin = substitute(getline("."), '^>', '', '')
+        let lin = substitute(lin, '^ ', '', '')
+        call AddToRHistory(lin)
+        let g:rplugin_addedtohist = 1
+    endif
+
+    if a:dir == "down"
+        let g:rplugin_dyn_rhist_pos += 1
+        if g:rplugin_dyn_rhist_pos > g:rplugin_rhist_pos
+            let g:rplugin_dyn_rhist_pos -= 1
+            return
+        endif
+    else
+        let g:rplugin_dyn_rhist_pos -= 1
+        if g:rplugin_dyn_rhist_pos < 0
+            let g:rplugin_dyn_rhist_pos = 0
+            return
+        endif
+    endif
+    call setline(".", "> " . g:rplugin_rhistory[g:rplugin_dyn_rhist_pos])
+endfunction
+    
 function EnterRCmd()
     if line(".") != line("$")
         call append(".", "")
@@ -1127,8 +1204,9 @@ function WaitVimComStart()
         let g:rplugin_vimcom_version = vr[0]
         let g:rplugin_vimcom_home = vr[1]
         let g:rplugin_vimcomport = vr[2]
-        if g:rplugin_vimcom_version != "1.1.6"
-            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.1.6.')
+        let g:rplugin_r_pid = vr[3]
+        if g:rplugin_vimcom_version != "1.1.7"
+            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.1.7.')
             sleep 1
         endif
         if has("nvim")
@@ -1136,9 +1214,12 @@ function WaitVimComStart()
                 call jobstop(g:rplugin_clt_job)
                 let g:rplugin_clt_job = 0
             endif
-            if has("win32") || has("win64")
-                let nvc = g:rplugin_vimcom_home . "/bin/nvimclient.exe"
-                let nvs = g:rplugin_vimcom_home . "/bin/nvimserver.exe"
+            if has("win64")
+                let nvc = g:rplugin_vimcom_home . "/bin/x64/nvimclient.exe"
+                let nvs = g:rplugin_vimcom_home . "/bin/x64/nvimserver.exe"
+            elseif has("win32")
+                let nvc = g:rplugin_vimcom_home . "/bin/i386/nvimclient.exe"
+                let nvs = g:rplugin_vimcom_home . "/bin/i386/nvimserver.exe"
             else
                 let nvc = g:rplugin_vimcom_home . "/bin/nvimclient"
                 let nvs = g:rplugin_vimcom_home . "/bin/nvimserver"
@@ -1646,6 +1727,7 @@ function SendCmdToR_TmuxSplit(cmd)
         let rlog = substitute(rlog, "\r", " ", "g")
         call RWarningMsg(rlog)
         let g:SendCmdToR = function('SendCmdToR_fake')
+        let g:rplugin_r_pid = 0
         return 0
     endif
     return 1
@@ -1706,6 +1788,7 @@ function SendCmdToR_Term(cmd)
         let rlog = substitute(rlog, '\r', ' ', 'g')
         call RWarningMsg(rlog)
         let g:SendCmdToR = function('SendCmdToR_fake')
+        let g:rplugin_r_pid = 0
         return 0
     endif
     return 1
@@ -2258,6 +2341,7 @@ function RQuit(how)
     call delete($VIMRPLUGIN_TMPDIR . "/GlobalEnvList_" . $VIMINSTANCEID)
     call delete($VIMRPLUGIN_TMPDIR . "/vimcom_running_" . $VIMINSTANCEID)
     let g:SendCmdToR = function('SendCmdToR_fake')
+    let g:rplugin_r_pid = 0
     let g:rplugin_vimcomport = 0
     if g:rplugin_do_tmux_split && g:vimrplugin_tmux_title != "automatic" && g:vimrplugin_tmux_title != ""
         call system("tmux set automatic-rename on")
@@ -3121,6 +3205,9 @@ function MakeRMenu()
     "-------------------------------
     menu R.Start/Close.-Sep1- 
     call RCreateMenuItem("nvi", 'Start/Close.Close\ R\ (no\ save)', 'RClose', 'rq', ":call RQuit('no')")
+    menu R.Start/Close.-Sep2- 
+
+    nmenu  R.Start/Close.Stop\ R:RStop :RStop
 
     "----------------------------------------------------------------------------
     " Send
@@ -3598,6 +3685,8 @@ command RBuildTags :call g:SendCmdToR('rtags(ofile = "TAGS")')
 command -nargs=? -complete=customlist,RLisObjs Rhelp :call RAskHelp()
 command -nargs=? -complete=dir RSourceDir :call RSourceDirectory()
 command RpluginConfig :runtime r-plugin/vimrconfig.vim
+command RStop :call StopR()
+command Rhistory :call ShowRhistory()
 
 
 "==========================================================================
@@ -3732,6 +3821,9 @@ call RSetDefaultValue("g:vimrplugin_indent_commented",  1)
 call RSetDefaultValue("g:vimrplugin_source",         "''")
 call RSetDefaultValue("g:vimrplugin_rcomment_string", "'# '")
 if g:vimrplugin_r_in_buffer
+    let g:rplugin_rhistory = [ ]
+    let g:rplugin_rhist_pos = -1
+    let g:rplugin_addedtohist = 0
     call RSetDefaultValue("g:vimrplugin_vimpager", "'vertical'")
     autocmd JobActivity Rjob call GetRActivity()
 else
@@ -4112,6 +4204,7 @@ let g:rplugin_running_objbr = 0
 let g:rplugin_newliblist = 0
 let g:rplugin_ob_warn_shown = 0
 let g:rplugin_clt_job = 0
+let g:rplugin_r_pid = 0
 let g:rplugin_myport = 0
 let g:rplugin_vimcomport = 0
 let g:rplugin_vimcom_home = ""

From b243fb7f57425c4fa8fa447aee93129600527378 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sun, 30 Nov 2014 21:52:45 -0500
Subject: [PATCH 0853/1050] Implement callback function for edit().

---
 r-plugin/common_global.vim | 36 +++++++++++++++++++++++-------------
 1 file changed, 23 insertions(+), 13 deletions(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index ee47dc9..af5cb6d 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -735,6 +735,7 @@ function StartR_Windows()
         if repl == "NotFound"
             let g:SendCmdToR = function('SendCmdToR_fake')
             let g:rplugin_r_pid = 0
+        else
             call RWarningMsg('There is already a window called "R Console".')
             return
         endif
@@ -831,6 +832,7 @@ function! StartR_Neovim()
     set filetype=rout
     setlocal noswapfile
     setlocal bufhidden=hide
+    setlocal formatoptions=
     set buftype=nofile
     set omnifunc=rcomplete#CompleteR
     if hasmapto("RCompleteArgs", "i")
@@ -1076,6 +1078,20 @@ function CompleteFromHistory()
     return ''
 endfunction
 
+" To be called by edit() in R running in Neovim buffer.
+function ShowRObject(fname)
+    call RWarningMsg("ShowRObject not implemented yet: '" . a:fname . "'")
+    let fcont = readfile(a:fname)
+    let s:finalA = $VIMRPLUGIN_TMPDIR . "/vimcom_edit_" . $VIMINSTANCEID . "_A"
+    let finalB = $VIMRPLUGIN_TMPDIR . "/vimcom_edit_" . $VIMINSTANCEID . "_B"
+    let finalB = substitute(finalB, ' ', '\\ ', 'g')
+    exe "tabnew " . finalB
+    call setline(".", fcont)
+    set ft=r
+    stopinsert
+    autocmd BufUnload  call delete(s:finalA) | unlet s:finalA | startinsert
+endfunction
+
 function ShowRhistory()
     tabnew R_history
     call setline(".", g:rplugin_rhistory)
@@ -1100,6 +1116,7 @@ function SendCmdToR_Neovim(rcmd)
     else
         call append(line("$"), "> " . a:rcmd)
     endif
+    call cursor("$", 1)
     let g:rplugin_addedtohist = 0
     if a:rcmd !~ '^base::source('
         call AddToRHistory(a:rcmd)
@@ -1205,8 +1222,8 @@ function WaitVimComStart()
         let g:rplugin_vimcom_home = vr[1]
         let g:rplugin_vimcomport = vr[2]
         let g:rplugin_r_pid = vr[3]
-        if g:rplugin_vimcom_version != "1.1.7"
-            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.1.7.')
+        if g:rplugin_vimcom_version != "1.1.8"
+            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.1.8.')
             sleep 1
         endif
         if has("nvim")
@@ -1735,18 +1752,11 @@ endfunction
 
 function SendCmdToR_Windows(cmd)
     if g:vimrplugin_ca_ck
-        let cmd = "\001" . "\013" . a:cmd
+        let cmd = "\001" . "\013" . a:cmd . "\n"
     else
-        let cmd = a:cmd
+        let cmd = a:cmd . "\n"
     endif
-
-    let cmd = cmd . "\n"
-    let slen = len(cmd)
-    let str = ""
-    for i in range(0, slen)
-        let str = str . printf("\\x%02X", char2nr(cmd[i]))
-    endfor
-    let repl = libcall(g:rplugin_vimcom_lib, "SendToRConsole", str)
+    let repl = libcall(g:rplugin_vimcom_lib, "SendToRConsole", cmd)
     return 1
 endfunction
 
@@ -2311,7 +2321,7 @@ function RQuit(how)
     endif
 
     if has("win32") || has("win64")
-        let repl = libcall(g:rplugin_vimcom_lib, "SendQuitMsg", qcmd)
+        let repl = libcall(g:rplugin_vimcom_lib, "SendQuitMsg", qcmd . "\n")
     else
         call g:SendCmdToR(qcmd)
         if g:rplugin_do_tmux_split

From 2390ca0f5f74495e78ff7453485ec2c4d4e2d780 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Wed, 3 Dec 2014 23:44:59 -0500
Subject: [PATCH 0854/1050] Minor bug fix in rout syntax highlighting.

---
 syntax/rout.vim | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/syntax/rout.vim b/syntax/rout.vim
index 0c3f62c..b395668 100644
--- a/syntax/rout.vim
+++ b/syntax/rout.vim
@@ -74,12 +74,12 @@ if has("conceal")
     set concealcursor=n
     syn match routConceal '^: ' conceal contained
     syn region routStdErr start='^: ' end="$" contains=routConceal
-    syn region routError start='^: .*Error.*' end='^>' contains=routConceal
-    syn region routWarn start='^: .*Warn.*' end='^>' contains=routConceal
+    syn region routError start='^: .*Error.*' end='\n:\@!' contains=routConceal
+    syn region routWarn start='^: .*Warn.*' end='\n:\@!' contains=routConceal
 else
     syn region routStdErr start='^: ' end="$"
-    syn region routError start='^: .*Error.*' end='^>'
-    syn region routWarn start='^: .*Warn.*' end='^>'
+    syn region routError start='^: .*Error.*' end='\n:\@!'
+    syn region routWarn start='^: .*Warn.*' end='\n:\@!'
 endif
 
 " Index of vectors

From 558a56b8701897a4f12f8ad9f1334ed872439017 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Wed, 3 Dec 2014 23:59:09 -0500
Subject: [PATCH 0855/1050] Adapt to changes in vimcom.  - View R documentation
 in Vim even if the help is requested in R Console.  - Don't export the names
 of function that are not called in the R Console.

---
 autoload/rcomplete.vim     |   2 +-
 doc/r-plugin.txt           |  90 +++++-----------------
 r-plugin/common_global.vim | 154 +++++++++++++++++++------------------
 3 files changed, 99 insertions(+), 147 deletions(-)

diff --git a/autoload/rcomplete.vim b/autoload/rcomplete.vim
index 351ff85..669d98c 100644
--- a/autoload/rcomplete.vim
+++ b/autoload/rcomplete.vim
@@ -10,7 +10,7 @@ function BuildROmniList()
         return
     endif
 
-    let omnilistcmd = 'vim.bol("' . $VIMRPLUGIN_TMPDIR . "/GlobalEnvList_" . $VIMINSTANCEID . '"'
+    let omnilistcmd = 'vimcom:::vim.bol("' . $VIMRPLUGIN_TMPDIR . "/GlobalEnvList_" . $VIMINSTANCEID . '"'
     if g:vimrplugin_allnames == 1
         let omnilistcmd = omnilistcmd . ', allnames = TRUE'
     endif
diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index b065926..4326013 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -261,6 +261,11 @@ Add the following lines to your `Rprofile`:
    if(Sys.getenv("VIMRPLUGIN_TMPDIR") != "")
        library(vimcom)
 <
+Note: If you do not know where your .Rprofile is, do the following command to
+open it:
+>
+   edit(file = "~/.Rprofile")
+<
 Start GVim again and edit an R script. You can right click a .R file and
 choose "Edit with Vim" or create a new one with the Normal mode command:
 >
@@ -1438,11 +1443,12 @@ If you do not want to see R documentation in a Vim's buffer, put in your
 >
    let vimrplugin_vimpager = "no"
 <
-If you want to use Vim to see R documentation even when looking for help in
-the R console, you have to create a shell script in your path that will call
-Vim in the right way. You can, for example, create a file named
-`~/bin/vimrpager` to do that (see |r-plugin-quick-setup|).
-
+And put in your .Rprofile:
+>
+   options(vimcom.vimpager = FALSE)
+<
+If you want to see R documentation in Vim, but are not satisfied with the way
+it works, please, read the subsection 6.5.2 below.
 
 ------------------------------------------------------------------------------
 6.5.2. Details and other options:~
@@ -1913,26 +1919,14 @@ will be shown only if "preview" is also included in your 'completeopt'.
 
 The Vim-R-plugin waits 5000 milliseconds for vimcom package to be loaded
 during R startup. It then checks whether you are using the correct version of
-vimcom. On Unix, it also sends a message to R update the list of uploaded
-libraries and, then, immediately updates the syntax highlighting of function
-names. If 5000 milliseconds is not enough to your R startup, then set a higher
-value for the variable in your |vimrc|. Example:
+vimcom. If 5000 milliseconds is not enough to your R startup, then set a
+higher value for the variable in your |vimrc|. Example:
 >
    let vimrplugin_vimcom_wait = 10000
 <
 Note: You should have the line  `library(vimcom)`  in your Rprofile. The
 Vim command  :RpluginConfig  adds that line for you.
 
-The plugin has a different behavior with Neovim: it receives a message from
-vimcom as soon as it is loaded and warns if the package was not loaded
-after 15 seconds of sending the command to start R. If you need more than 15
-seconds, change the value of vimrplugin_vimcom_wait.
-
-If you do not want to install the vimcom package, then put in your
-|vimrc|:
->
-   let vimrplugin_vimcom_wait = -1
-<
 
 ------------------------------------------------------------------------------
 							   *vimrplugin_vim_wd*
@@ -2847,14 +2841,13 @@ please read this document from the beginning.
    ~/.Rprofile~
 >
    if(interactive()){
-       # Get startup messages of three packages and set Vim as R pager:
+       # Get startup messages of three packages:
        options(setwidth.verbose = 1,
                colorout.verbose = 1,
-               vimcom.verbose = 1,
-               pager = "vimrpager")
+               vimcom.verbose = 1)
        # Use the text based web browser w3m to navigate through R docs:
-       if(Sys.getenv("TMUX") != "")
-           options(browser="~/bin/vimrw3mbrowser",
+       if(Sys.getenv("TMUX") != "" && Sys.getenv("DISPLAY") == "")
+	   options(browser = function(u) system(paste0("tmux new-window 'w3m ", u, "'")),
                    help_type = "html")
        # Use either Vim or GVim as text editor for R:
        if(nchar(Sys.getenv("DISPLAY")) > 1)
@@ -2863,59 +2856,14 @@ please read this document from the beginning.
            options(editor = 'vim -c "set ft=r"')
        # Load the colorout library:
        library(colorout)
-       if(Sys.getenv("TERM") != "linux" && Sys.getenv("TERM") != ""){
-           # Choose the colors for R output among 256 options.
-           # You should run show256Colors() and help(setOutputColors256) to
-           # know how to change the colors according to your taste:
-           setOutputColors256(verbose = FALSE)
-       }
        # Load the setwidth library:
        library(setwidth)
        # Load the vimcom library only if R was started by Vim:
-       if(Sys.getenv("VIMRPLUGIN_TMPDIR") != ""){
+       if(Sys.getenv("VIMRPLUGIN_TMPDIR") != "")
            library(vimcom)
-           # See R documentation on Vim buffer even if asking for help in R Console:
-           if(Sys.getenv("VIM_PANE") != "")
-               options(help_type = "text", pager = vim.pager)
-       }
    }
 <
 
-   ~/bin/vimrpager~
->
-   #!/bin/sh
-   # I don't know the reason, but we can't pipe the output directly to Vim.
-   # So we need this script to use 'cat' as intermediary.
-   cat | vim -c 'set ft=rdoc' -
-<
-
-   ~/bin/vimrw3mbrowser~
->
-   #!/bin/sh
-   NCOLS=$(tput cols)
-   if [ "$NCOLS" -gt "140" ]
-   then
-       if [ "x$VIM_PANE" = "x" ]
-       then
-           tmux split-window -h "w3m $1 && exit"
-       else
-           tmux split-window -h -t $VIM_PANE "w3m $1 && exit"
-       fi
-   else
-       tmux new-window "w3m $1 && exit"
-   fi
-<
-
-NOTES: 1. The `~/bin` diretory must be in your PATH.
-       2. To use the `vimrw3mbrower` script the web browser w3m must be
-          installed.
-       3. You have to change `~/bin/vimrpager` and `~/bin/vimrw3mbrowser`
-          permissions to make them executable:
->
-   chmod +x ~/bin/vimrpager
-   chmod +x ~/bin/vimrw3mbrowser
-<
-
 Finally, if you want to use vi key bindings in Bash:
 
    ~/.inputrc~
@@ -2954,7 +2902,7 @@ See also |vimrplugin_r_in_buffer|.
 							       *r-plugin-news*
 10. News~
 
-1.1.1 (2014-11-29)
+1.1.1 (2014-12-01)
 
  * New option (Neovim only): vimrplugin_r_in_buffer and :Rhistory.
 
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index af5cb6d..e338a8c 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -127,31 +127,30 @@ function ReplaceUnderS()
 endfunction
 
 function! ReadEvalReply()
-    let reply = "No reply"
+    let reply = ["No reply"]
     let haswaitwarn = 0
     let ii = 0
     while ii < 20
         sleep 100m
         if filereadable($VIMRPLUGIN_TMPDIR . "/eval_reply")
-            let tmp = readfile($VIMRPLUGIN_TMPDIR . "/eval_reply")
-            if len(tmp) > 0
-                let reply = tmp[0]
+            let reply = readfile($VIMRPLUGIN_TMPDIR . "/eval_reply")
+            if len(reply) > 0
                 break
             endif
         endif
         let ii += 1
         if ii == 2
             echohl WarningMsg
-            echon "\rWaiting for reply"
+            echon "\rWaiting..."
             echohl Normal
             let haswaitwarn = 1
         endif
     endwhile
     if haswaitwarn
-        echon "\r                 "
+        echon "\r              "
         redraw
     endif
-    return reply
+    return reply[0]
 endfunction
 
 function! CompleteChunkOptions()
@@ -619,7 +618,7 @@ function StartR_TmuxSplit(rcmd)
                 \ 'set-environment VIMINSTANCEID ' . $VIMINSTANCEID ,
                 \ 'set-environment VIMRPLUGIN_SECRET ' . $VIMRPLUGIN_SECRET ]
     if &t_Co == 256
-        call extend(tmuxconf, ['set -g default-terminal "' . $TERM . '"'])
+        call extend(tmuxconf, ['set default-terminal "' . $TERM . '"'])
     endif
     call writefile(tmuxconf, $VIMRPLUGIN_TMPDIR . "/tmux" . $VIMINSTANCEID . ".conf")
     call system("tmux source-file '" . $VIMRPLUGIN_TMPDIR . "/tmux" . $VIMINSTANCEID . ".conf" . "'")
@@ -681,21 +680,21 @@ function StartR_ExternalTerm(rcmd)
         let tmuxcnf = ' '
     else
         " Create a custom tmux.conf
-        let cnflines = ['set-option -g prefix C-a',
+        let cnflines = ['set-option prefix C-a',
                     \ 'unbind-key C-b',
                     \ 'bind-key C-a send-prefix',
-                    \ 'set-window-option -g mode-keys vi',
-                    \ 'set -g status off',
-                    \ 'set -g default-terminal "screen-256color"',
-                    \ "set -g terminal-overrides 'xterm*:smcup@:rmcup@'" ]
+                    \ 'set-window-option mode-keys vi',
+                    \ 'set status off',
+                    \ 'set default-terminal "screen-256color"',
+                    \ "set terminal-overrides 'xterm*:smcup@:rmcup@'" ]
 
         if g:vimrplugin_term == "rxvt" || g:vimrplugin_term == "urxvt"
             let cnflines = cnflines + [
-                    \ "set -g terminal-overrides 'rxvt*:smcup@:rmcup@'" ]
+                    \ "set terminal-overrides 'rxvt*:smcup@:rmcup@'" ]
         endif
 
         if g:vimrplugin_external_ob || !has("gui_running")
-            call extend(cnflines, ['set -g mode-mouse on', 'set -g mouse-select-pane on', 'set -g mouse-resize-pane on'])
+            call extend(cnflines, ['set mode-mouse on', 'set mouse-select-pane on', 'set mouse-resize-pane on'])
         endif
         call writefile(cnflines, $VIMRPLUGIN_TMPDIR . "/tmux.conf")
         let tmuxcnf = '-f "' . $VIMRPLUGIN_TMPDIR . "/tmux.conf" . '"'
@@ -1197,24 +1196,20 @@ function RSetNeovimPort(p)
 endfunction
 
 function WaitVimComStart()
-    if g:vimrplugin_vimcom_wait < 0
-        return 0
+    if g:vimrplugin_vimcom_wait < 300
+        g:vimrplugin_vimcom_wait = 300
     endif
+    redraw
+    echo "Waiting vimcom loading..."
     sleep 300m
-    let ii = 0
+    let ii = 300
     let waitmsg = 0
     while !filereadable($VIMRPLUGIN_TMPDIR . "/vimcom_running_" . $VIMINSTANCEID) && ii < g:vimrplugin_vimcom_wait
         let ii = ii + 200
-        if ii == 1000
-            echo "Waiting vimcom loading..."
-            let waitmsg = 1
-        endif
         sleep 200m
     endwhile
-    if waitmsg
-        echon "\r                              "
-        redraw
-    endif
+    echon "\r                              "
+    redraw
     sleep 100m
     if filereadable($VIMRPLUGIN_TMPDIR . "/vimcom_running_" . $VIMINSTANCEID)
         let vr = readfile($VIMRPLUGIN_TMPDIR . "/vimcom_running_" . $VIMINSTANCEID)
@@ -1222,8 +1217,8 @@ function WaitVimComStart()
         let g:rplugin_vimcom_home = vr[1]
         let g:rplugin_vimcomport = vr[2]
         let g:rplugin_r_pid = vr[3]
-        if g:rplugin_vimcom_version != "1.1.8"
-            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.1.8.')
+        if g:rplugin_vimcom_version != "1.1.9"
+            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.1.9.')
             sleep 1
         endif
         if has("nvim")
@@ -1267,13 +1262,10 @@ function WaitVimComStart()
             call RWarningMsg('Could not find "' . g:rplugin_vimcom_lib . '".')
         endif
         call delete($VIMRPLUGIN_TMPDIR . "/vimcom_running_" . $VIMINSTANCEID)
-        if has("nvim") && g:vimrplugin_vimpager != "no"
-            call g:SendToVimCom("\x08" . $VIMINSTANCEID . "options(pager = vimcom:::vim.hmsg)", "I")
-        endif
         return 1
     else
         call RWarningMsg("The package vimcom wasn't loaded yet.")
-        sleep 300m
+        sleep 500m
         return 0
     endif
 endfunction
@@ -2210,7 +2202,7 @@ function SendLineToR(godown)
         if getline(1) =~ '^The topic'
             let topic = substitute(line, '.*::', '', "")
             let package = substitute(line, '::.*', '', "")
-            call ShowRDoc(topic, package, 1)
+            call AskRDoc(topic, package, 1)
             return
         endif
         if RdocIsInRCode(1) == 0
@@ -2473,7 +2465,18 @@ function RealRFillLibList()
     let g:rplugin_liblist_filled = 1
 endfunction
 
-function SetRTextWidth()
+function SetRTextWidth(rkeyword)
+    if g:vimrplugin_vimpager == "tabnew"
+        let s:rdoctitle = a:rkeyword . "\\ (help)"
+    else
+        let s:tnr = tabpagenr()
+        if g:vimrplugin_vimpager != "tab" && s:tnr > 1
+            let s:rdoctitle = "R_doc" . s:tnr
+        else
+            let s:rdoctitle = "R_doc"
+        endif
+        unlet s:tnr
+    endif
     if !bufloaded(s:rdoctitle) || g:vimrplugin_newsize == 1
         let g:vimrplugin_newsize = 0
 
@@ -2603,7 +2606,7 @@ endfunction
 
 " Show R's help doc in Vim's buffer
 " (based  on pydoc plugin)
-function ShowRDoc(rkeyword, package, getclass)
+function AskRDoc(rkeyword, package, getclass)
     if filewritable(g:rplugin_docfile)
         call delete(g:rplugin_docfile)
     endif
@@ -2624,53 +2627,55 @@ function ShowRDoc(rkeyword, package, getclass)
         let classfor = "eval(expression(" . classfor . "))"
     endif
 
-    if g:vimrplugin_vimpager == "tabnew"
-        let s:rdoctitle = a:rkeyword . "\\ (help)"
-    else
-        let s:tnr = tabpagenr()
-        if g:vimrplugin_vimpager != "tab" && s:tnr > 1
-            let s:rdoctitle = "R_doc" . s:tnr
-        else
-            let s:rdoctitle = "R_doc"
-        endif
-        unlet s:tnr
-    endif
-
-    call SetRTextWidth()
+    call SetRTextWidth(a:rkeyword)
 
     call delete($VIMRPLUGIN_TMPDIR . "/eval_reply")
     if classfor == "" && a:package == ""
-        let rcmd = 'vim.help("' . a:rkeyword . '", ' . g:rplugin_htw . 'L)'
+        let rcmd = 'vimcom:::vim.help("' . a:rkeyword . '", ' . g:rplugin_htw . 'L)'
     elseif a:package != ""
-        let rcmd = 'vim.help("' . a:rkeyword . '", ' . g:rplugin_htw . 'L, package="' . a:package  . '")'
+        let rcmd = 'vimcom:::vim.help("' . a:rkeyword . '", ' . g:rplugin_htw . 'L, package="' . a:package  . '")'
     else
         let classfor = substitute(classfor, '\\', "", "g")
         let classfor = substitute(classfor, '"', '\\"', "g")
-        let rcmd = 'vim.help("' . a:rkeyword . '", ' . g:rplugin_htw . 'L, ' . classfor . ')'
+        let rcmd = 'vimcom:::vim.help("' . a:rkeyword . '", ' . g:rplugin_htw . 'L, ' . classfor . ')'
     endif
 
     call g:SendToVimCom("\x08" . $VIMINSTANCEID . rcmd, "I")
+    call ShowRDoc(a:rkeyword, 0)
+endfunction
 
-    let g:rplugin_lastev = ReadEvalReply()
-    if g:rplugin_lastev != "VIMHELP"
-        if g:rplugin_lastev =~ "^MULTILIB"
-            let msg = "The topic '" . a:rkeyword . "' was found in more than one library:\n"
-            let libs = split(g:rplugin_lastev)
-            for idx in range(1, len(libs) - 1)
-                let msg .= idx . " : " . libs[idx] . "\n"
-            endfor
-            redraw
-            let chn = input(msg . "Please, select one of them: ")
-            if chn > 0 && chn < len(libs)
-                call delete($VIMRPLUGIN_TMPDIR . "/eval_reply")
-                call g:SendToVimCom("\x08" . $VIMINSTANCEID . 'vim.help("' . a:rkeyword . '", ' . g:rplugin_htw . 'L, package="' . libs[chn] . '")')
-                let g:rplugin_lastev = ReadEvalReply()
+" This function may be called by vimcom
+function ShowRDoc(rkeyword, fromvimcom)
+    if a:fromvimcom
+        if bufname("%") =~ "Object_Browser" || bufname("%") == "R_Output"
+            let savesb = &switchbuf
+            set switchbuf=useopen,usetab
+            exe "sb " . b:rscript_buffer
+            exe "set switchbuf=" . savesb
+        endif
+        call SetRTextWidth(a:rkeyword)
+    else
+        let g:rplugin_lastev = ReadEvalReply()
+        if g:rplugin_lastev != "VIMHELP"
+            if g:rplugin_lastev =~ "^MULTILIB"
+                let msg = "The topic '" . a:rkeyword . "' was found in more than one library:\n"
+                let libs = split(g:rplugin_lastev)
+                for idx in range(1, len(libs) - 1)
+                    let msg .= idx . " : " . libs[idx] . "\n"
+                endfor
+                redraw
+                let chn = input(msg . "Please, select one of them: ")
+                if chn > 0 && chn < len(libs)
+                    call delete($VIMRPLUGIN_TMPDIR . "/eval_reply")
+                    call g:SendToVimCom("\x08" . $VIMINSTANCEID . 'vimcom:::vim.help("' . a:rkeyword . '", ' . g:rplugin_htw . 'L, package="' . libs[chn] . '")')
+                    let g:rplugin_lastev = ReadEvalReply()
+                else
+                    return
+                endif
             else
+                call RWarningMsg(g:rplugin_lastev)
                 return
             endif
-        else
-            call RWarningMsg(g:rplugin_lastev)
-            return
         endif
     endif
 
@@ -2901,7 +2906,7 @@ function RAskHelp(...)
         return
     endif
     if g:vimrplugin_vimpager != "no"
-        call ShowRDoc(a:1, "", 0)
+        call AskRDoc(a:1, "", 0)
     else
         call g:SendCmdToR("help(" . a:1. ")")
     endif
@@ -2943,20 +2948,20 @@ function RAction(rcmd)
                             call RWarningMsg("Cmd not available.")
                         else
                             if g:rplugin_editor_sname == "" || has("nvim")
-                                let slog = system("tmux set-buffer '" . "\\" . ':call ShowRDoc("' . rkeyword . '", "' . pkg . '", 0)' . "\' && tmux paste-buffer -t " . g:rplugin_vim_pane . " && tmux select-pane -t " . g:rplugin_vim_pane)
+                                let slog = system("tmux set-buffer '" . "\\" . ':call AskRDoc("' . rkeyword . '", "' . pkg . '", 0)' . "\' && tmux paste-buffer -t " . g:rplugin_vim_pane . " && tmux select-pane -t " . g:rplugin_vim_pane)
                                 if v:shell_error
                                     call RWarningMsg(slog)
                                 endif
                             else
-                                silent exe 'call remote_expr("' . g:rplugin_editor_sname . '", ' . "'ShowRDoc(" . '"' . rkeyword . '", "' . pkg . '", 0)' . "')"
+                                silent exe 'call remote_expr("' . g:rplugin_editor_sname . '", ' . "'AskRDoc(" . '"' . rkeyword . '", "' . pkg . '", 0)' . "')"
                             endif
                         endif
                     else
-                        call ShowRDoc(rkeyword, pkg, 0)
+                        call AskRDoc(rkeyword, pkg, 0)
                     endif
                     return
                 endif
-                call ShowRDoc(rkeyword, "", 1)
+                call AskRDoc(rkeyword, "", 1)
             endif
             return
         endif
@@ -3818,12 +3823,11 @@ call RSetDefaultValue("g:vimrplugin_help_w",           46)
 call RSetDefaultValue("g:vimrplugin_objbr_w",          40)
 call RSetDefaultValue("g:vimrplugin_external_ob",       0)
 if has("nvim")
-    call RSetDefaultValue("g:vimrplugin_vimcom_wait", 15000)
     call RSetDefaultValue("g:vimrplugin_r_in_buffer",     0)
 else
     let g:vimrplugin_r_in_buffer = 0
-    call RSetDefaultValue("g:vimrplugin_vimcom_wait", 5000)
 endif
+call RSetDefaultValue("g:vimrplugin_vimcom_wait",    5000)
 call RSetDefaultValue("g:vimrplugin_show_args",         0)
 call RSetDefaultValue("g:vimrplugin_never_unmake_menu", 0)
 call RSetDefaultValue("g:vimrplugin_insert_mode_cmds",  1)

From 8836704fb5eac1624ab2de842e7171ef23cc4a7c Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Thu, 4 Dec 2014 01:22:15 -0500
Subject: [PATCH 0856/1050] Only call Run_SyncTeX if vimrplugin_synctex = 1.

---
 ftplugin/rnoweb_rplugin.vim | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/ftplugin/rnoweb_rplugin.vim b/ftplugin/rnoweb_rplugin.vim
index 7aa50dd..9001fe2 100644
--- a/ftplugin/rnoweb_rplugin.vim
+++ b/ftplugin/rnoweb_rplugin.vim
@@ -223,8 +223,10 @@ call RCreateMaps("ni",  'RESendChunk',  'ce', ':call b:SendChunkToR("echo"
 call RCreateMaps("ni",  'RDSendChunk',  'cd', ':call b:SendChunkToR("silent", "down")')
 call RCreateMaps("ni",  'REDSendChunk', 'ca', ':call b:SendChunkToR("echo", "down")')
 call RCreateMaps("nvi", 'ROpenPDF',     'op', ':call ROpenPDF("Get Master")')
-call RCreateMaps("ni",  'RSyncFor',     'gp', ':call SyncTeX_forward()')
-call RCreateMaps("ni",  'RGoToTeX',     'gt', ':call SyncTeX_forward(1)')
+if g:vimrplugin_synctex
+    call RCreateMaps("ni",  'RSyncFor',     'gp', ':call SyncTeX_forward()')
+    call RCreateMaps("ni",  'RGoToTeX',     'gt', ':call SyncTeX_forward(1)')
+endif
 nmap  gn :call RnwNextChunk()
 nmap  gN :call RnwPreviousChunk()
 
@@ -588,7 +590,9 @@ if g:rplugin_pdfviewer != "none"
         unlet s:key_list
         unlet s:has_key
     endif
-    call Run_SyncTeX()
+    if g:vimrplugin_synctex
+        call Run_SyncTeX()
+    endif
 endif
 
 call RSourceOtherScripts()

From a52b16e11c159938799a47f06dd2f7d5ee788816 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Thu, 4 Dec 2014 01:38:07 -0500
Subject: [PATCH 0857/1050] Add -g option to tmux commands again. Starting in
 an external terminal gives errors without the -g option.

---
 r-plugin/common_global.vim | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index e338a8c..b7e3dd9 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -680,13 +680,13 @@ function StartR_ExternalTerm(rcmd)
         let tmuxcnf = ' '
     else
         " Create a custom tmux.conf
-        let cnflines = ['set-option prefix C-a',
+        let cnflines = ['set-option -g prefix C-a',
                     \ 'unbind-key C-b',
                     \ 'bind-key C-a send-prefix',
-                    \ 'set-window-option mode-keys vi',
-                    \ 'set status off',
-                    \ 'set default-terminal "screen-256color"',
-                    \ "set terminal-overrides 'xterm*:smcup@:rmcup@'" ]
+                    \ 'set-window-option -g mode-keys vi',
+                    \ 'set -g status off',
+                    \ 'set -g default-terminal "screen-256color"',
+                    \ "set -g terminal-overrides 'xterm*:smcup@:rmcup@'" ]
 
         if g:vimrplugin_term == "rxvt" || g:vimrplugin_term == "urxvt"
             let cnflines = cnflines + [

From 25f45edae4b355242fb9c5250210d7699e6b3795 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Thu, 4 Dec 2014 15:20:37 -0500
Subject: [PATCH 0858/1050] Add function to clean knitr cache directory.

---
 ftplugin/rnoweb_rplugin.vim | 46 +++++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)

diff --git a/ftplugin/rnoweb_rplugin.vim b/ftplugin/rnoweb_rplugin.vim
index 9001fe2..8cf2807 100644
--- a/ftplugin/rnoweb_rplugin.vim
+++ b/ftplugin/rnoweb_rplugin.vim
@@ -74,6 +74,49 @@ function! RnwNextChunk() range
     return
 endfunction
 
+
+" Because this function delete files, it will not be documented.
+" If you want to try it, put in your vimrc:
+"
+" let vimrplugin_rm_knit_cache = 1
+"
+" If don't want to answer the question about deleting files, and
+" if you trust this code more than I do, put in your vimrc:
+"
+" let vimrplugin_ask_rm_knitr_cache = 0
+"
+" Note that if you have the string "cache.path=" in more than one place only
+" the first one above the cursor position will be found. The path must be
+" surrounded by quotes; if it's an R object, it will not be recognized.
+function! RKnitRmCache()
+    let lnum = search('\\s*=', 'bnwc')
+    if lnum == 0
+        let pathdir = "cache"
+    else
+        let pathregexpr = '.*\\s*=\s*[' . "'" . '"]\(.\{-}\)[' . "'" . '"].*'
+        let pathdir = substitute(getline(lnum), pathregexpr, '\1', '')
+        if pathdir !~ '/$'
+            let pathdir .= '/'
+        endif
+    endif
+    if exists("g:vimrplugin_ask_rm_knitr_cache") && g:vimrplugin_ask_rm_knitr_cache == 0
+        let cleandir = 1
+    else
+        call inputsave()
+        let answer = input('Delete all files from "' . pathdir . '"? [y/n]: ')
+        call inputrestore()
+        if answer == "y"
+            let cleandir = 1
+        else
+            let cleandir = 0
+        endif
+    endif
+    normal! :
+    if cleandir
+        call g:SendCmdToR('rm(list=ls(all.names=TRUE)); unlink("' . pathdir . '*")')
+    endif
+endfunction
+
 " knit the current buffer content
 function! RKnitRnw()
     update
@@ -214,6 +257,9 @@ call RCreateMaps("nvi", 'RSetwd',        'rd', ':call RSetWD()')
 call RCreateMaps("nvi", 'RSweave',      'sw', ':call RSweave()')
 call RCreateMaps("nvi", 'RMakePDF',     'sp', ':call RMakePDF("nobib", 0)')
 call RCreateMaps("nvi", 'RBibTeX',      'sb', ':call RMakePDF("bibtex", 0)')
+if exists("g:vimrplugin_rm_knit_cache") && g:vimrplugin_rm_knit_cache == 1
+    call RCreateMaps("nvi", 'RKnitRmCache', 'kr', ':call RKnitRmCache()')
+endif
 call RCreateMaps("nvi", 'RKnit',        'kn', ':call RKnitRnw()')
 call RCreateMaps("nvi", 'RMakePDFK',    'kp', ':call RMakePDF("nobib", 1)')
 call RCreateMaps("nvi", 'RBibTeXK',     'kb', ':call RMakePDF("bibtex", 1)')

From 63f3f1efc1b522e97822b598f9de298df5ac70db Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Thu, 4 Dec 2014 23:09:00 -0500
Subject: [PATCH 0859/1050] Syntax highlight: distinguish between = and ==.

---
 syntax/r.vim | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/syntax/r.vim b/syntax/r.vim
index 6f88b9a..475532c 100644
--- a/syntax/r.vim
+++ b/syntax/r.vim
@@ -3,7 +3,7 @@
 " Maintainer:	      Jakson Aquino 
 " Former Maintainers: Vaidotas Zemlys 
 " 		      Tom Payne 
-" Last Change:	      Thu Jul 10, 2014  06:45PM
+" Last Change:	      Thu Dec 04, 2014  11:07PM
 " Filenames:	      *.R *.r *.Rhistory *.Rt
 "
 " NOTE: The highlighting of R functions is defined in the
@@ -111,17 +111,19 @@ syn match rComplex "\<\d\+\.\d*\([Ee][-+]\=\d\+\)\=i"
 syn match rComplex "\<\.\d\+\([Ee][-+]\=\d\+\)\=i"
 syn match rComplex "\<\d\+[Ee][-+]\=\d\+i"
 
+syn match rAssign    '='
 syn match rOperator    "&"
 syn match rOperator    '-'
 syn match rOperator    '\*'
 syn match rOperator    '+'
-syn match rOperator    '='
 if &filetype != "rmd" && &filetype != "rrst"
   syn match rOperator    "[|!<>^~/:]"
 else
   syn match rOperator    "[|!<>^~`/:]"
 endif
 syn match rOperator    "%\{2}\|%\S\{-}%"
+syn match rOperator '\([!><]\)\@<=='
+syn match rOperator '=='
 syn match rOpError  '\*\{3}'
 syn match rOpError  '//'
 syn match rOpError  '&&&'
@@ -129,8 +131,8 @@ syn match rOpError  '|||'
 syn match rOpError  '<<'
 syn match rOpError  '>>'
 
-syn match rArrow "<\{1,2}-"
-syn match rArrow "->\{1,2}"
+syn match rAssign "<\{1,2}-"
+syn match rAssign "->\{1,2}"
 
 " Special
 syn match rDelimiter "[,;:]"
@@ -191,7 +193,7 @@ else
 endif
 
 " Define the default highlighting.
-hi def link rArrow       Statement	
+hi def link rAssign      Statement
 hi def link rBoolean     Boolean
 hi def link rBraceError  Error
 hi def link rComment     Comment
@@ -210,7 +212,7 @@ hi def link rHelpIdent   Identifier
 hi def link rhPreProc    PreProc
 hi def link rhSection    PreCondit
 hi def link rInteger     Number
-hi def link rLstElmt	 Normal
+hi def link rLstElmt     Normal
 hi def link rNameWSpace  Normal
 hi def link rNumber      Number
 hi def link rOperator    Operator

From aa76403e86626921610bf23cb4078f7b9683f874 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Fri, 5 Dec 2014 22:51:50 -0500
Subject: [PATCH 0860/1050] Add debug code for Windows.

---
 r-plugin/common_global.vim | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index b7e3dd9..dbf254f 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -260,7 +260,7 @@ function RCompleteArgs()
             let rkeyword0 = RGetKeyWord()
             let classfor = RGetClassFor(rkeyword0)
             let classfor = substitute(classfor, '\\', "", "g")
-            let classfor = substitute(classfor, '"', '\\"', "g")
+            let classfor = substitute(classfor, '\(.\)"\(.\)', '\1\\"\2', "g")
             let rkeyword = '^' . rkeyword0 . "\x06"
             call cursor(cpos[1], cpos[2])
 
@@ -751,6 +751,7 @@ function StartR_Windows()
     let saved_home = $HOME
     let prs = system('reg.exe QUERY "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v "Personal"')
     if len(prs) > 0
+        let g:rdebug_reg_personal = prs
         let prs = substitute(prs, '.*REG_SZ\s*', '', '')
         let prs = substitute(prs, '\n', '', 'g')
         let prs = substitute(prs, '\s*$', '', 'g')
@@ -2636,7 +2637,7 @@ function AskRDoc(rkeyword, package, getclass)
         let rcmd = 'vimcom:::vim.help("' . a:rkeyword . '", ' . g:rplugin_htw . 'L, package="' . a:package  . '")'
     else
         let classfor = substitute(classfor, '\\', "", "g")
-        let classfor = substitute(classfor, '"', '\\"', "g")
+        let classfor = substitute(classfor, '\(.\)"\(.\)', '\1\\"\2', "g")
         let rcmd = 'vimcom:::vim.help("' . a:rkeyword . '", ' . g:rplugin_htw . 'L, ' . classfor . ')'
     endif
 
@@ -2848,6 +2849,11 @@ function ROpenPDF(path)
         return
     endif
 
+    if !filereadable(basenm . ".pdf")
+        call RWarningMsg('File not found: "' . basenm . '.pdf".')
+        exe "cd " . substitute(olddir, ' ', '\\ ', 'g')
+        return
+    endif
     if g:rplugin_pdfviewer == "none"
         call RWarningMsg("Could not find a PDF viewer, and vimrplugin_pdfviewer is not defined.")
     else
@@ -4044,7 +4050,11 @@ if has("win32") || has("win64")
         else
             let rip = filter(split(system('reg.exe QUERY "HKLM\SOFTWARE\R-core\R" /s'), "\n"), 'v:val =~ ".*InstallPath.*REG_SZ"')
             if len(rip) > 0
-                let s:rinstallpath = substitute(rip[0], "InstallPath.*REG_SZ\s*", "", "")
+                let g:rdebug_reg_rpath_1 = rip
+                let s:rinstallpath = substitute(rip[0], '.*InstallPath.*REG_SZ\s*', '', '')
+                let s:rinstallpath = substitute(s:rinstallpath, '\n', '', 'g')
+                let s:rinstallpath = substitute(s:rinstallpath, '\s*$', '', 'g')
+                let g:rdebug_reg_rpath_2 = s:rinstallpath
             endif
 
             if !exists("s:rinstallpath")

From 14654bfc1b724fb00c6182940fec8fffc8ab07a4 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sat, 6 Dec 2014 12:47:06 -0500
Subject: [PATCH 0861/1050] On Windows, avoid the need to call SetRPath().

---
 r-plugin/common_global.vim | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index dbf254f..e28672b 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -744,6 +744,12 @@ function StartR_Windows()
 
     if !executable(g:rplugin_Rgui)
         call RWarningMsg('R executable "' . g:rplugin_Rgui . '" not found.')
+        if exists("g:rdebug_reg_rpath_1")
+            call RWarningMsg('DEBUG message 1: >>' . g:rdebug_reg_rpath_1 . '<<')
+        endif
+        if exists("g:rdebug_reg_rpath_1")
+            call RWarningMsg('DEBUG message 2: >>' . g:rdebug_reg_rpath_2 . '<<')
+        endif
         return
     endif
 
@@ -4033,6 +4039,11 @@ endif
 let g:rplugin_globalenvlines = []
 
 if has("win32") || has("win64")
+    if g:vimrplugin_Rterm
+        let b:rplugin_R = "Rgui.exe"
+    else
+        let b:rplugin_R = "Rterm.exe"
+    endif
     if !exists("g:rplugin_rpathadded")
         if exists("g:vimrplugin_r_path")
             if !isdirectory(g:vimrplugin_r_path)
@@ -4049,8 +4060,8 @@ if has("win32") || has("win64")
             let g:rplugin_Rgui = g:vimrplugin_r_path . "\\Rgui.exe"
         else
             let rip = filter(split(system('reg.exe QUERY "HKLM\SOFTWARE\R-core\R" /s'), "\n"), 'v:val =~ ".*InstallPath.*REG_SZ"')
+            let g:rdebug_reg_rpath_1 = rip
             if len(rip) > 0
-                let g:rdebug_reg_rpath_1 = rip
                 let s:rinstallpath = substitute(rip[0], '.*InstallPath.*REG_SZ\s*', '', '')
                 let s:rinstallpath = substitute(s:rinstallpath, '\n', '', 'g')
                 let s:rinstallpath = substitute(s:rinstallpath, '\s*$', '', 'g')
@@ -4081,9 +4092,6 @@ if has("win32") || has("win64")
         endif
         let g:rplugin_rpathadded = 1
     endif
-    if !exists("b:rplugin_R")
-        let b:rplugin_R = "Rgui.exe"
-    endif
     let g:vimrplugin_term_cmd = "none"
     let g:vimrplugin_term = "none"
     if !exists("g:vimrplugin_r_args")

From 64b51d638b3005dd7077711095489c362df5e115 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sat, 6 Dec 2014 19:16:24 -0500
Subject: [PATCH 0862/1050] Force use of R 32bit on Windows if GVim is 32bit.

---
 r-plugin/common_global.vim | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index e28672b..a8585c0 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -3817,7 +3817,6 @@ call RSetDefaultValue("g:vimrplugin_strict_rst",        1)
 call RSetDefaultValue("g:vimrplugin_openpdf",           0)
 call RSetDefaultValue("g:vimrplugin_synctex",           1)
 call RSetDefaultValue("g:vimrplugin_openhtml",          0)
-call RSetDefaultValue("g:vimrplugin_i386",              0)
 call RSetDefaultValue("g:vimrplugin_Rterm",             0)
 call RSetDefaultValue("g:vimrplugin_vim_wd",            0)
 call RSetDefaultValue("g:vimrplugin_restart",           0)
@@ -3834,8 +3833,13 @@ call RSetDefaultValue("g:vimrplugin_editor_w",         66)
 call RSetDefaultValue("g:vimrplugin_help_w",           46)
 call RSetDefaultValue("g:vimrplugin_objbr_w",          40)
 call RSetDefaultValue("g:vimrplugin_external_ob",       0)
+if has("win32") && !has("win64") && !has("nvim")
+    let g:vimrplugin_i386 = 1
+else
+    call RSetDefaultValue("g:vimrplugin_i386",          0)
+endif
 if has("nvim")
-    call RSetDefaultValue("g:vimrplugin_r_in_buffer",     0)
+    call RSetDefaultValue("g:vimrplugin_r_in_buffer",   0)
 else
     let g:vimrplugin_r_in_buffer = 0
 endif

From e8c139b27d7d35dfb965431789dd9a5c4be4ab54 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sun, 7 Dec 2014 17:55:01 -0500
Subject: [PATCH 0863/1050] Don't block Neovim while waiting R CMD BATCH

---
 ftplugin/r_rplugin.vim | 75 ++++++++++++++++++++++++++++++++++++------
 1 file changed, 65 insertions(+), 10 deletions(-)

diff --git a/ftplugin/r_rplugin.vim b/ftplugin/r_rplugin.vim
index 07b7998..d8bdbac 100644
--- a/ftplugin/r_rplugin.vim
+++ b/ftplugin/r_rplugin.vim
@@ -13,13 +13,26 @@ endif
 " need be defined after the global ones:
 runtime r-plugin/common_buffer.vim
 
+function! RCmdBatchJob()
+    if v:job_data[1] == 'stdout'
+        echo join(v:job_data[2])
+    elseif v:job_data[1] == 'stderr'
+        call RWarningMsg(join(v:job_data[2]))
+    else
+        if v:job_data[0] == b:RCmdBatchID
+            let b:RCmdBatchID = -2
+        endif
+        call OpenRout(1)
+    endif
+endfunction
+
 " Run R CMD BATCH on current file and load the resulting .Rout in a split
 " window
 function! ShowRout()
-    let routfile = expand("%:r") . ".Rout"
-    if bufloaded(routfile)
-        exe "bunload " . routfile
-        call delete(routfile)
+    let b:routfile = expand("%:r") . ".Rout"
+    if bufloaded(b:routfile)
+        exe "bunload " . b:routfile
+        call delete(b:routfile)
     endif
 
     if !exists("b:rplugin_R")
@@ -28,27 +41,61 @@ function! ShowRout()
 
     " if not silent, the user will have to type 
     silent update
+
+    if has("nvim")
+        if b:RCmdBatchID != -2
+            call RWarningMsg("There is R CMD BATCH job running already.")
+            return
+        endif
+        if has("win32") || has("win64")
+            let b:RCmdBatchID = jobstart("RCmdBatch", 'Rcmd.exe', ['BATCH', '--no-restore', '--no-save',  expand("%"), b:routfile])
+        else
+            let b:RCmdBatchID = jobstart("RCmdBatch", b:rplugin_R, ['CMD', 'BATCH', '--no-restore', '--no-save', expand("%"), b:routfile])
+        endif
+        if b:RCmdBatchID == 0
+            call RWarningMsg("The job table is full.")
+        elseif b:RCmdBatchID == -1
+            call RWarningMsg("Failed to execute R.")
+        endif
+        echomsg 'R CMD BATCH job is running.'
+        return
+    endif
+
     if has("win32") || has("win64")
-        let rcmd = 'Rcmd.exe BATCH --no-restore --no-save "' . expand("%") . '" "' . routfile . '"'
+        let rcmd = 'Rcmd.exe BATCH --no-restore --no-save "' . expand("%") . '" "' . b:routfile . '"'
     else
-        let rcmd = b:rplugin_R . " CMD BATCH --no-restore --no-save '" . expand("%") . "' '" . routfile . "'"
+        let rcmd = b:rplugin_R . " CMD BATCH --no-restore --no-save '" . expand("%") . "' '" . b:routfile . "'"
     endif
+
     echo "Please wait for: " . rcmd
     let rlog = system(rcmd)
     if v:shell_error && rlog != ""
         call RWarningMsg('Error: "' . rlog . '"')
         sleep 1
     endif
+    call OpenRout(0)
+    return
+endfunction
 
-    if filereadable(routfile)
+function! OpenRout(goback)
+    if filereadable(b:routfile)
+        let curpos = getcurpos()
         if g:vimrplugin_routnotab == 1
-            exe "split " . routfile
+            exe "split " . b:routfile
         else
-            exe "tabnew " . routfile
+            exe "tabnew " . b:routfile
         endif
         set filetype=rout
+        if a:goback
+            if g:vimrplugin_routnotab == 1
+                exe "normal! \p"
+            else
+                normal! gT
+            endif
+            call setpos(".", curpos)
+        endif
     else
-        call RWarningMsg("The file '" . routfile . "' is not readable.")
+        call RWarningMsg("The file '" . b:routfile . "' is not readable.")
     endif
 endfunction
 
@@ -69,6 +116,14 @@ let b:IsInRCode = function("DefaultIsInRCode")
 " global one:
 let b:SourceLines = function("RSourceLines")
 
+" job id for R CMD BATCH
+if has("nvim")
+    if !exists("b:RCmdBatchID")
+        let b:RCmdBatchID = -2
+        autocmd JobActivity RCmdBatch call RCmdBatchJob()
+    endif
+endif
+
 "==========================================================================
 " Key bindings and menu items
 

From 0f6ab24a85dcc761082800bb5c40cadc8982443e Mon Sep 17 00:00:00 2001
From: Michael Lerch 
Date: Mon, 8 Dec 2014 10:27:45 -0700
Subject: [PATCH 0864/1050] Check if map exists before trying to unmap it.

If ds is not mapped even though vim-surround is loaded (perhaps one has
custom mappings), then when the rbrowser is started an annoying error
pops up.  Check if ds mapping exists before trying to unmap it.
---
 ftplugin/rbrowser.vim | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ftplugin/rbrowser.vim b/ftplugin/rbrowser.vim
index 65fa5f1..38d62e5 100644
--- a/ftplugin/rbrowser.vim
+++ b/ftplugin/rbrowser.vim
@@ -347,7 +347,7 @@ if g:rplugin_do_tmux_split == 0
 else
     au BufUnload  call ObBrBufUnload()
     " Fix problems caused by some plugins
-    if exists("g:loaded_surround")
+    if exists("g:loaded_surround") && mapcheck("ds", "n") != ""
         nunmap ds
     endif
     if exists("g:loaded_showmarks ")

From 293e59e64ceb0ba3b77542dccdc35a6859db1ccf Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Mon, 8 Dec 2014 15:14:23 -0500
Subject: [PATCH 0865/1050] Allow the use of the old Python code to Send cmds
 To use the old Python function SendToRConsole(), put in your vimrc: let
 vimrplugin_libcall_send = 0

---
 r-plugin/common_global.vim |  62 +++++++++++++++----
 r-plugin/windows.py        | 119 +++++++++++++++++++++++++++++++++++++
 2 files changed, 171 insertions(+), 10 deletions(-)
 create mode 100644 r-plugin/windows.py

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index a8585c0..a786e15 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -134,9 +134,11 @@ function! ReadEvalReply()
         sleep 100m
         if filereadable($VIMRPLUGIN_TMPDIR . "/eval_reply")
             let reply = readfile($VIMRPLUGIN_TMPDIR . "/eval_reply")
-            if len(reply) > 0
-                break
+            if len(reply) == 0
+                call RWarningMsg("Incomplete reply")
+                let reply = ["No reply"]
             endif
+            break
         endif
         let ii += 1
         if ii == 2
@@ -728,7 +730,28 @@ function StartR_ExternalTerm(rcmd)
     endif
 endfunction
 
+function InitializePython()
+    " python3 has priority over python
+    if has("python3")
+        command! -nargs=+ Py :py3 
+        command! -nargs=+ PyFile :py3file 
+    elseif has("python")
+        command! -nargs=+ Py :py 
+        command! -nargs=+ PyFile :pyfile 
+    elseif has("nvim")
+        command! -nargs=+ Py :call RWarningMsg("Py command not implemented yet: '" .  . "'")
+        let g:SendToVimCom = function("SendToVimCom_Neovim")
+    else
+        command! -nargs=+ Py :
+        command! -nargs=+ PyFile :
+    endif
+    exe "PyFile " . substitute(g:rplugin_home, " ", '\\ ', "g") . '\r-plugin\windows.py'
+endfunction
+
 function StartR_Windows()
+    if !g:vimrplugin_libcall_send && !g:rplugin_python_initialized
+        call InitializePython()
+    endif
     if string(g:SendCmdToR) != "function('SendCmdToR_fake')"
         let repl = libcall(g:rplugin_vimcom_lib, "FindRConsole", 'R Console')
         if repl == "NotFound"
@@ -1755,7 +1778,16 @@ function SendCmdToR_Windows(cmd)
     else
         let cmd = a:cmd . "\n"
     endif
-    let repl = libcall(g:rplugin_vimcom_lib, "SendToRConsole", cmd)
+    if vimrplugin_libcall_send
+        let repl = libcall(g:rplugin_vimcom_lib, "SendToRConsole", cmd)
+    else
+        let slen = len(cmd)
+        let str = ""
+        for i in range(0, slen)
+            let str = str . printf("\\x%02X", char2nr(cmd[i]))
+        endfor
+        exe "Py" . " SendToRConsole(b'" . str . "')"
+    endif
     return 1
 endfunction
 
@@ -2250,10 +2282,14 @@ endfunction
 " Clear the console screen
 function RClearConsole()
     if (has("win32") || has("win64"))
-        if g:vimrplugin_Rterm
-            let repl = libcall(g:rplugin_vimcom_lib, "RClearConsole()", "Rterm")
+        if g:vimrplugin_libcall_send
+            if g:vimrplugin_Rterm
+                let repl = libcall(g:rplugin_vimcom_lib, "RClearConsole()", "Rterm")
+            else
+                let repl = libcall(g:rplugin_vimcom_lib, "RClearConsole()", "Rgui")
+            endif
         else
-            let repl = libcall(g:rplugin_vimcom_lib, "RClearConsole()", "Rgui")
+            Py RClearConsolePy()
         endif
         if repl != "OK"
             call RWarningMsg(repl)
@@ -3672,6 +3708,7 @@ function RVimLeave()
     call delete($VIMRPLUGIN_TMPDIR . "/unformatted_code")
     call delete($VIMRPLUGIN_TMPDIR . "/vimbol_finished")
     call delete($VIMRPLUGIN_TMPDIR . "/vimcom_running_" . $VIMINSTANCEID)
+    call delete($VIMRPLUGIN_TMPDIR . "/rconsole_hwnd_" . $VIMRPLUGIN_SECRET)
 endfunction
 
 function SetRPath()
@@ -3833,10 +3870,14 @@ call RSetDefaultValue("g:vimrplugin_editor_w",         66)
 call RSetDefaultValue("g:vimrplugin_help_w",           46)
 call RSetDefaultValue("g:vimrplugin_objbr_w",          40)
 call RSetDefaultValue("g:vimrplugin_external_ob",       0)
-if has("win32") && !has("win64") && !has("nvim")
-    let g:vimrplugin_i386 = 1
-else
-    call RSetDefaultValue("g:vimrplugin_i386",          0)
+call RSetDefaultValue("g:vimrplugin_libcall_send",      1)
+call RSetDefaultValue("g:vimrplugin_i386",              0)
+if has("win32")
+    if has("win64")
+        let g:vimrplugin_i386 = 0
+    else
+        let g:vimrplugin_i386 = 1
+    endif
 endif
 if has("nvim")
     call RSetDefaultValue("g:vimrplugin_r_in_buffer",   0)
@@ -4249,6 +4290,7 @@ let g:rplugin_lastrpl = ""
 let g:rplugin_lastev = ""
 let g:rplugin_hasRSFbutton = 0
 let g:rplugin_tmuxsname = "VimR-" . substitute(localtime(), '.*\(...\)', '\1', '')
+let g:rplugin_python_initialized = 0
 
 " SyncTeX options
 let g:rplugin_has_wmctrl = 0
diff --git a/r-plugin/windows.py b/r-plugin/windows.py
new file mode 100644
index 0000000..a0f077d
--- /dev/null
+++ b/r-plugin/windows.py
@@ -0,0 +1,119 @@
+
+import os
+import string
+import time
+import vim
+RConsole = 0
+Rterm = False
+
+try:
+    import win32api
+    import win32clipboard
+    import win32com.client
+    import win32con
+    import win32gui
+except ImportError:
+    import platform
+    myPyVersion = platform.python_version()
+    myArch = platform.architecture()
+    vim.command("call RWarningMsgInp('Please install PyWin32. The Python version being used is: " + myPyVersion + " (" + myArch[0] + ")')")
+
+def RightClick():
+    global RConsole
+    myHandle = win32gui.GetForegroundWindow()
+    RaiseRConsole()
+    time.sleep(0.05)
+    lParam = (100 << 16) | 100
+    win32gui.SendMessage(RConsole, win32con.WM_RBUTTONDOWN, 0, lParam)
+    win32gui.SendMessage(RConsole, win32con.WM_RBUTTONUP, 0, lParam)
+    time.sleep(0.05)
+    try:
+        win32gui.SetForegroundWindow(myHandle)
+    except:
+        vim.command("call RWarningMsg('Could not put itself on foreground.')")
+
+def CntrlV():
+    global RConsole
+    win32api.keybd_event(0x11, 0, 0, 0)
+    try:
+        win32api.PostMessage(RConsole, 0x100, 0x56, 0x002F0001)
+    except:
+        vim.command("call RWarningMsg('R Console window not found [1].')")
+        RConsole = 0
+        pass
+    if RConsole:
+        time.sleep(0.05)
+        try:
+            win32api.PostMessage(RConsole, 0x101, 0x56, 0xC02F0001)
+        except:
+            vim.command("call RWarningMsg('R Console window not found [2].')")
+            pass
+    win32api.keybd_event(0x11, 0, 2, 0)
+
+def FindRConsole():
+    global RConsole
+    Rttl = vim.eval("g:vimrplugin_R_window_title")
+    Rtitle = Rttl
+    RConsole = win32gui.FindWindow(None, Rtitle)
+    if RConsole == 0:
+        Rtitle = Rttl + " (64-bit)"
+        RConsole = win32gui.FindWindow(None, Rtitle)
+        if RConsole == 0:
+            Rtitle = Rttl + " (32-bit)"
+            RConsole = win32gui.FindWindow(None, Rtitle)
+            if RConsole == 0:
+                vim.command("call RWarningMsg('Could not find R Console.')")
+    if RConsole:
+        vim.command("let g:rplugin_R_window_ttl = '" + Rtitle + "'")
+
+def SendToRConsole(aString):
+    global RConsole
+    global Rterm
+    SendToVimCom("\003Set R as busy [SendToRConsole()]")
+    if sys.hexversion < 0x03000000:
+        finalString = aString.decode("latin-1") + "\n"
+    else:
+        finalString = aString
+    win32clipboard.OpenClipboard(0)
+    win32clipboard.EmptyClipboard()
+    win32clipboard.SetClipboardText(finalString)
+    win32clipboard.CloseClipboard()
+    if RConsole == 0:
+        FindRConsole()
+    if RConsole:
+        if Rterm:
+            RightClick()
+        else:
+            CntrlV()
+
+def RClearConsolePy():
+    global RConsole
+    global Rterm
+    if Rterm:
+        return
+    if RConsole == 0:
+        FindRConsole()
+    if RConsole:
+        win32api.keybd_event(0x11, 0, 0, 0)
+        try:
+            win32api.PostMessage(RConsole, 0x100, 0x4C, 0x002F0001)
+        except:
+            vim.command("call RWarningMsg('R Console window not found [1].')")
+            RConsole = 0
+            pass
+        if RConsole:
+            time.sleep(0.05)
+            try:
+                win32api.PostMessage(RConsole, 0x101, 0x4C, 0xC02F0001)
+            except:
+                vim.command("call RWarningMsg('R Console window not found [2].')")
+                pass
+        win32api.keybd_event(0x11, 0, 2, 0)
+
+def RaiseRConsole():
+    global RConsole
+    FindRConsole()
+    if RConsole:
+        win32gui.SetForegroundWindow(RConsole)
+        time.sleep(0.1)
+

From 6294ad9abf09d70dd2542c2c7b70b37365617dcc Mon Sep 17 00:00:00 2001
From: Michael Lerch 
Date: Mon, 8 Dec 2014 17:40:12 -0700
Subject: [PATCH 0866/1050] Make more mappings respect
 vimrplugin_user_maps_only

There were two that I noticed:

RSendPartOfLine:

Some infrastructure was already set up for this (RNRightPart,
RIRightPart, RNLeftPart, RILeftPart) were already mentioned in the doc
but not really set up.  I also changed the function a little.  Sending
right would send the right part including the cursor and sending left
would send the left part without the cursor.  Now they both send the
cursor.

RNextRChunk/RPreviousChunk:

These were stealing gn and gN which are actually built-in vim commands.
The RCreateMaps puts LocalLeader in front of the maps so these are now
\gn and \gN.  I considered adding another flag in a:type to not include
LocalLeader in the maps, but I decided to keep it simple.  Instead I
was going to make a note in the doc about the change of these maps
(addition of LocalLeader) and how to map without the LocalLeader (just
put the original code into ftplugin/rmd.vim), but I wasn't sure where a
good place for this would be in the doc.
---
 doc/r-plugin.txt            |  6 ++++--
 ftplugin/rmd_rplugin.vim    | 26 +++++++++++++-------------
 ftplugin/rnoweb_rplugin.vim |  4 ++--
 r-plugin/common_global.vim  | 12 +++++-------
 4 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 4326013..6102728 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -472,8 +472,8 @@ Edit
   . Uncomment (line, sel)                              \xu
   . Add/Align right comment (line, sel)                 \;
   --------------------------------------------------------
-  . Go (next R chunk)                                   gn
-  . Go (previous R chunk)                               gN
+  . Go (next R chunk)                                  \gn
+  . Go (previous R chunk)                              \gN
 -----------------------------------------------------------
 
 Object Browser
@@ -2204,6 +2204,8 @@ RD, "cursor down"; RED, both "echo" and "down"):
    RSyncFor   (SyncTeX search forward)
    RGoToTeX   (Got to LaTeX output)
    RSpinFile
+   RNextRChunk
+   RPreviousRChunk
 
    Object browser~
    RUpdateObjBrowser
diff --git a/ftplugin/rmd_rplugin.vim b/ftplugin/rmd_rplugin.vim
index 37e9b09..c20918f 100644
--- a/ftplugin/rmd_rplugin.vim
+++ b/ftplugin/rmd_rplugin.vim
@@ -130,19 +130,19 @@ call RControlMaps()
 call RCreateMaps("nvi", 'RSetwd',        'rd', ':call RSetWD()')
 
 " Only .Rmd files use these functions:
-call RCreateMaps("nvi", 'RKnit',        'kn', ':call RKnit()')
-call RCreateMaps("nvi", 'RMakeRmd',     'kr', ':call RMakeRmd("default")')
-call RCreateMaps("nvi", 'RMakeAll',     'ka', ':call RMakeRmd("all")')
-call RCreateMaps("nvi", 'RMakePDFK',    'kp', ':call RMakeRmd("pdf_document")')
-call RCreateMaps("nvi", 'RMakePDFKb',   'kl', ':call RMakeRmd("beamer_presentation")')
-call RCreateMaps("nvi", 'RMakeHTML',    'kh', ':call RMakeRmd("html_document")')
-call RCreateMaps("nvi", 'RMakeODT',     'ko', ':call RMakeRmd("odt")')
-call RCreateMaps("ni",  'RSendChunk',   'cc', ':call b:SendChunkToR("silent", "stay")')
-call RCreateMaps("ni",  'RESendChunk',  'ce', ':call b:SendChunkToR("echo", "stay")')
-call RCreateMaps("ni",  'RDSendChunk',  'cd', ':call b:SendChunkToR("silent", "down")')
-call RCreateMaps("ni",  'REDSendChunk', 'ca', ':call b:SendChunkToR("echo", "down")')
-nmap  gn :call b:NextRChunk()
-nmap  gN :call b:PreviousRChunk()
+call RCreateMaps("nvi", 'RKnit',          'kn', ':call RKnit()')
+call RCreateMaps("nvi", 'RMakeRmd',       'kr', ':call RMakeRmd("default")')
+call RCreateMaps("nvi", 'RMakeAll',       'ka', ':call RMakeRmd("all")')
+call RCreateMaps("nvi", 'RMakePDFK',      'kp', ':call RMakeRmd("pdf_document")')
+call RCreateMaps("nvi", 'RMakePDFKb',     'kl', ':call RMakeRmd("beamer_presentation")')
+call RCreateMaps("nvi", 'RMakeHTML',      'kh', ':call RMakeRmd("html_document")')
+call RCreateMaps("nvi", 'RMakeODT',       'ko', ':call RMakeRmd("odt")')
+call RCreateMaps("ni",  'RSendChunk',     'cc', ':call b:SendChunkToR("silent", "stay")')
+call RCreateMaps("ni",  'RESendChunk',    'ce', ':call b:SendChunkToR("echo", "stay")')
+call RCreateMaps("ni",  'RDSendChunk',    'cd', ':call b:SendChunkToR("silent", "down")')
+call RCreateMaps("ni",  'REDSendChunk',   'ca', ':call b:SendChunkToR("echo", "down")')
+call RCreateMaps("n",  'RNextRChunk',     'gn', ':call b:NextRChunk()')
+call RCreateMaps("n",  'RPreviousRChunk', 'gN', ':call b:PreviousRChunk()')
 
 " Menu R
 if has("gui_running")
diff --git a/ftplugin/rnoweb_rplugin.vim b/ftplugin/rnoweb_rplugin.vim
index 8cf2807..49cb8e1 100644
--- a/ftplugin/rnoweb_rplugin.vim
+++ b/ftplugin/rnoweb_rplugin.vim
@@ -273,8 +273,8 @@ if g:vimrplugin_synctex
     call RCreateMaps("ni",  'RSyncFor',     'gp', ':call SyncTeX_forward()')
     call RCreateMaps("ni",  'RGoToTeX',     'gt', ':call SyncTeX_forward(1)')
 endif
-nmap  gn :call RnwNextChunk()
-nmap  gN :call RnwPreviousChunk()
+call RCreateMaps("n",  'RNextRChunk',     'gn', ':call b:NextRChunk()')
+call RCreateMaps("n",  'RPreviousRChunk', 'gN', ':call b:PreviousRChunk()')
 
 " Menu R
 if has("gui_running")
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index a786e15..31674aa 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -2274,7 +2274,7 @@ function RSendPartOfLine(direction, correctpos)
     if a:direction == "right"
         let rcmd = strpart(lin, idx)
     else
-        let rcmd = strpart(lin, 0, idx)
+        let rcmd = strpart(lin, 0, idx + 1)
     endif
     call g:SendCmdToR(rcmd)
 endfunction
@@ -3647,12 +3647,10 @@ function RCreateSendMaps()
     call RCreateMaps('ni0', 'RDSendLine', 'd', ':call SendLineToR("down")')
     call RCreateMaps('ni0', 'RDSendLineAndInsertOutput', 'o', ':call SendLineToRAndInsertOutput()')
     call RCreateMaps('i', 'RSendLAndOpenNewOne', 'q', ':call SendLineToR("newline")')
-    nmap r :call RSendPartOfLine("left", 0)
-    nmap r :call RSendPartOfLine("right", 0)
-    if g:vimrplugin_insert_mode_cmds
-        imap  r l:call RSendPartOfLine("left", 0)i
-        imap  r l:call RSendPartOfLine("right", 0)i
-    endif
+    call RCreateMaps('n', 'RNLeftPart', 'r', ':call RSendPartOfLine("left", 0)')
+    call RCreateMaps('n', 'RNRightPart', 'r', ':call RSendPartOfLine("right", 0)')
+    call RCreateMaps('i', 'RILeftPart', 'r', 'l:call RSendPartOfLine("left", 1)')
+    call RCreateMaps('i', 'RIRightPart', 'r', 'l:call RSendPartOfLine("right", 1)')
 
     " For compatibility with Johannes Ranke's plugin
     if g:vimrplugin_map_r == 1

From 2031e26286601487e50b180cbe97b0e7c0830201 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Tue, 9 Dec 2014 11:22:26 -0500
Subject: [PATCH 0867/1050] Warn if +libcall feature is missing.

---
 r-plugin/common_global.vim | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index a786e15..64b6175 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -746,6 +746,7 @@ function InitializePython()
         command! -nargs=+ PyFile :
     endif
     exe "PyFile " . substitute(g:rplugin_home, " ", '\\ ', "g") . '\r-plugin\windows.py'
+    let g:rplugin_python_initialized = 1
 endfunction
 
 function StartR_Windows()
@@ -1292,6 +1293,11 @@ function WaitVimComStart()
             call RWarningMsg('Could not find "' . g:rplugin_vimcom_lib . '".')
         endif
         call delete($VIMRPLUGIN_TMPDIR . "/vimcom_running_" . $VIMINSTANCEID)
+
+        if !g:vimrplugin_r_in_buffer && !has("libcall")
+            call RWarningMsgInp("+libcall feature is missing: communication with R will be flawed.")
+        endif
+
         return 1
     else
         call RWarningMsg("The package vimcom wasn't loaded yet.")

From f7c77b56cf1dc4eeb063bfb156ff64c778c318ac Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Wed, 10 Dec 2014 15:40:09 -0500
Subject: [PATCH 0868/1050] Change path of vimcom library.

---
 r-plugin/common_global.vim | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index dea6dee..6c734b4 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -1248,8 +1248,8 @@ function WaitVimComStart()
         let g:rplugin_vimcom_home = vr[1]
         let g:rplugin_vimcomport = vr[2]
         let g:rplugin_r_pid = vr[3]
-        if g:rplugin_vimcom_version != "1.1.9"
-            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.1.9.')
+        if g:rplugin_vimcom_version != "1.1.10"
+            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.1.10.')
             sleep 1
         endif
         if has("nvim")
@@ -1283,14 +1283,14 @@ function WaitVimComStart()
             endif
         endif
         if has("win32")
-            let g:rplugin_vimcom_lib = g:rplugin_vimcom_home . "/libs/i386/vimcom.dll"
+            let g:rplugin_vimcom_lib = g:rplugin_vimcom_home . "/bin/i386/libvimcom.dll"
         elseif has("win64")
-            let g:rplugin_vimcom_lib = g:rplugin_vimcom_home . "/libs/x64/vimcom.dll"
+            let g:rplugin_vimcom_lib = g:rplugin_vimcom_home . "/bin/x64/libvimcom.dll"
         else
-            let g:rplugin_vimcom_lib = g:rplugin_vimcom_home . "/libs/vimcom.so"
+            let g:rplugin_vimcom_lib = g:rplugin_vimcom_home . "/bin/libvimcom.so"
         endif
         if !filereadable(g:rplugin_vimcom_lib)
-            call RWarningMsg('Could not find "' . g:rplugin_vimcom_lib . '".')
+            call RWarningMsgInp('Could not find "' . g:rplugin_vimcom_lib . '".')
         endif
         call delete($VIMRPLUGIN_TMPDIR . "/vimcom_running_" . $VIMINSTANCEID)
 
@@ -1784,7 +1784,7 @@ function SendCmdToR_Windows(cmd)
     else
         let cmd = a:cmd . "\n"
     endif
-    if vimrplugin_libcall_send
+    if g:vimrplugin_libcall_send
         let repl = libcall(g:rplugin_vimcom_lib, "SendToRConsole", cmd)
     else
         let slen = len(cmd)
@@ -2678,7 +2678,6 @@ function AskRDoc(rkeyword, package, getclass)
 
     call SetRTextWidth(a:rkeyword)
 
-    call delete($VIMRPLUGIN_TMPDIR . "/eval_reply")
     if classfor == "" && a:package == ""
         let rcmd = 'vimcom:::vim.help("' . a:rkeyword . '", ' . g:rplugin_htw . 'L)'
     elseif a:package != ""
@@ -2689,6 +2688,7 @@ function AskRDoc(rkeyword, package, getclass)
         let rcmd = 'vimcom:::vim.help("' . a:rkeyword . '", ' . g:rplugin_htw . 'L, ' . classfor . ')'
     endif
 
+    call delete($VIMRPLUGIN_TMPDIR . "/eval_reply")
     call g:SendToVimCom("\x08" . $VIMINSTANCEID . rcmd, "I")
     call ShowRDoc(a:rkeyword, 0)
 endfunction
@@ -2704,6 +2704,8 @@ function ShowRDoc(rkeyword, fromvimcom)
         endif
         call SetRTextWidth(a:rkeyword)
     else
+        " FIXME: This sleep should not be needed
+        sleep 100m
         let g:rplugin_lastev = ReadEvalReply()
         if g:rplugin_lastev != "VIMHELP"
             if g:rplugin_lastev =~ "^MULTILIB"

From 931b9664e1bd500ff1deb752cda90c2e85879992 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Wed, 10 Dec 2014 23:46:16 -0500
Subject: [PATCH 0869/1050] Unset environment variable after R startup.

---
 r-plugin/common_global.vim | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 6c734b4..fa526ba 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -1248,8 +1248,8 @@ function WaitVimComStart()
         let g:rplugin_vimcom_home = vr[1]
         let g:rplugin_vimcomport = vr[2]
         let g:rplugin_r_pid = vr[3]
-        if g:rplugin_vimcom_version != "1.1.10"
-            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.1.10.')
+        if g:rplugin_vimcom_version != "1.1.11"
+            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.1.11.')
             sleep 1
         endif
         if has("nvim")
@@ -1298,6 +1298,11 @@ function WaitVimComStart()
             call RWarningMsgInp("+libcall feature is missing: communication with R will be flawed.")
         endif
 
+        if g:rplugin_do_tmux_split
+            " Environment variables persists across Tmux windows.
+            " Leave a hint (to vimcom) that R was not started by Vim:
+            call system("tmux set-environment VIMRPLUGIN_TMPDIR None")
+        endif
         return 1
     else
         call RWarningMsg("The package vimcom wasn't loaded yet.")
@@ -3427,6 +3432,7 @@ function MakeRMenu()
         call RCreateMenuItem("v", 'Edit.Add/Align\ right\ comment\ (line,\ sel)', 'RRightComment', ';', ':call MovePosRCodeComment("selection")')
         if &filetype == "rnoweb" || &filetype == "rrst" || &filetype == "rmd" || g:vimrplugin_never_unmake_menu
             menu R.Edit.-Sep73- 
+            " TODO: Use RCreateMenuItem to make the  appear in the menu
             nmenu  R.Edit.Go\ (next\ R\ chunk)gn :call b:NextRChunk()
             nmenu  R.Edit.Go\ (previous\ R\ chunk)gN :call b:PreviousRChunk()
         endif

From d47a9c967365514e0803aec79e957a1cb943c9d6 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Thu, 11 Dec 2014 12:46:49 -0500
Subject: [PATCH 0870/1050] Finish the conversion of gn gN into \gn \gN.

---
 doc/r-plugin.txt           | 16 ++++++++++------
 ftplugin/rrst_rplugin.vim  | 22 +++++++++++-----------
 r-plugin/common_global.vim |  5 ++---
 3 files changed, 23 insertions(+), 20 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 6102728..388aa15 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -116,7 +116,7 @@ Before installing the plugin, you should install its dependencies:
 
    Vim >= 7.4: http://www.vim.org/download.php
                In addition to the most commonly used features, the plugin
-               requires: |+clientserver| and |+conceal|.
+               requires: |+libcall|, |+clientserver| and |+conceal|.
 
 	       Note: If you use Neovim, the |+clientserver| feature is not
 	       required.
@@ -599,8 +599,8 @@ shortcut to send the current line makes the cursor to jump to the next chunk.
 While editing Rnoweb files, the following commands are available in Normal
 mode:
 
-   [count]gn : go to the next chunk of R code
-   [count]gN : go to the previous chunk of R code
+   [count]gn : go to the next chunk of R code
+   [count]gN : go to the previous chunk of R code
 
 The commands cc, ce, cd and ca send the current chunk of R code
 to R Console. The command ch sends the R code from the first
@@ -1363,7 +1363,7 @@ this will not work:
    par(ask=TRUE)
    plot(1,1)
 <
-The plugin relies 
+
 ------------------------------------------------------------------------------
 						      *vimrplugin_rnowebchunk*
 	                                              *vimrplugin_assign_map*
@@ -2138,6 +2138,8 @@ RD, "cursor down"; RED, both "echo" and "down"):
    RRightComment
    RCompleteArgs
    RIndent
+   RNextRChunk
+   RPreviousRChunk
 
    Send line or part of it to R~
    RSendLine
@@ -2904,13 +2906,15 @@ See also |vimrplugin_r_in_buffer|.
 							       *r-plugin-news*
 10. News~
 
-1.1.1 (2014-12-01)
+1.1.1 (2014-12-11)
+
+ * Change commands gn and gN into gn and gN.
 
  * New option (Neovim only): vimrplugin_r_in_buffer and :Rhistory.
 
  * New command: :RStop.
 
- * No longer requires +python feature.
+ * No longer requires +python feature; requires +libcall instead.
 
  * Removed option vimrplugin_sleeptime.
 
diff --git a/ftplugin/rrst_rplugin.vim b/ftplugin/rrst_rplugin.vim
index 7748a5a..5c88fe9 100644
--- a/ftplugin/rrst_rplugin.vim
+++ b/ftplugin/rrst_rplugin.vim
@@ -169,17 +169,17 @@ call RControlMaps()
 call RCreateMaps("nvi", 'RSetwd',        'rd', ':call RSetWD()')
 
 " Only .Rrst files use these functions:
-call RCreateMaps("nvi", 'RKnit',        'kn', ':call RKnit()')
-call RCreateMaps("nvi", 'RMakePDFK',    'kp', ':call RMakePDFrrst()')
-call RCreateMaps("nvi", 'RMakeHTML',    'kh', ':call RMakeHTMLrrst("html")')
-call RCreateMaps("nvi", 'RMakeODT',     'ko', ':call RMakeHTMLrrst("odt")')
-call RCreateMaps("nvi", 'RIndent',      'si', ':call RrstToggleIndentSty()')
-call RCreateMaps("ni",  'RSendChunk',   'cc', ':call b:SendChunkToR("silent", "stay")')
-call RCreateMaps("ni",  'RESendChunk',  'ce', ':call b:SendChunkToR("echo", "stay")')
-call RCreateMaps("ni",  'RDSendChunk',  'cd', ':call b:SendChunkToR("silent", "down")')
-call RCreateMaps("ni",  'REDSendChunk', 'ca', ':call b:SendChunkToR("echo", "down")')
-nmap  gn :call b:NextRChunk()
-nmap  gN :call b:PreviousRChunk()
+call RCreateMaps("nvi", 'RKnit',          'kn', ':call RKnit()')
+call RCreateMaps("nvi", 'RMakePDFK',      'kp', ':call RMakePDFrrst()')
+call RCreateMaps("nvi", 'RMakeHTML',      'kh', ':call RMakeHTMLrrst("html")')
+call RCreateMaps("nvi", 'RMakeODT',       'ko', ':call RMakeHTMLrrst("odt")')
+call RCreateMaps("nvi", 'RIndent',        'si', ':call RrstToggleIndentSty()')
+call RCreateMaps("ni",  'RSendChunk',     'cc', ':call b:SendChunkToR("silent", "stay")')
+call RCreateMaps("ni",  'RESendChunk',    'ce', ':call b:SendChunkToR("echo", "stay")')
+call RCreateMaps("ni",  'RDSendChunk',    'cd', ':call b:SendChunkToR("silent", "down")')
+call RCreateMaps("ni",  'REDSendChunk',   'ca', ':call b:SendChunkToR("echo", "down")')
+call RCreateMaps("n",  'RNextRChunk',     'gn', ':call b:NextRChunk()')
+call RCreateMaps("n",  'RPreviousRChunk', 'gN', ':call b:PreviousRChunk()')
 
 " Menu R
 if has("gui_running")
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index fa526ba..20bb5c8 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -3432,9 +3432,8 @@ function MakeRMenu()
         call RCreateMenuItem("v", 'Edit.Add/Align\ right\ comment\ (line,\ sel)', 'RRightComment', ';', ':call MovePosRCodeComment("selection")')
         if &filetype == "rnoweb" || &filetype == "rrst" || &filetype == "rmd" || g:vimrplugin_never_unmake_menu
             menu R.Edit.-Sep73- 
-            " TODO: Use RCreateMenuItem to make the  appear in the menu
-            nmenu  R.Edit.Go\ (next\ R\ chunk)gn :call b:NextRChunk()
-            nmenu  R.Edit.Go\ (previous\ R\ chunk)gN :call b:PreviousRChunk()
+            call RCreateMenuItem("n", 'Edit.Go\ (next\ R\ chunk)', 'RNextRChunk', 'gn', ':call b:NextRChunk()')
+            call RCreateMenuItem("n", 'Edit.Go\ (previous\ R\ chunk)', '', 'gN', ':call b:PreviousRChunk()')
         endif
     endif
 

From 3e22f62da43d7f104e174cdbb56a5534860b5007 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Thu, 11 Dec 2014 12:58:54 -0500
Subject: [PATCH 0871/1050] Fix path of "cache" directory.

---
 ftplugin/rnoweb_rplugin.vim | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ftplugin/rnoweb_rplugin.vim b/ftplugin/rnoweb_rplugin.vim
index 49cb8e1..0466109 100644
--- a/ftplugin/rnoweb_rplugin.vim
+++ b/ftplugin/rnoweb_rplugin.vim
@@ -91,7 +91,7 @@ endfunction
 function! RKnitRmCache()
     let lnum = search('\\s*=', 'bnwc')
     if lnum == 0
-        let pathdir = "cache"
+        let pathdir = "cache/"
     else
         let pathregexpr = '.*\\s*=\s*[' . "'" . '"]\(.\{-}\)[' . "'" . '"].*'
         let pathdir = substitute(getline(lnum), pathregexpr, '\1', '')

From 56ee9b9629084d5924853e5a4a34adc77881346a Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sat, 13 Dec 2014 18:24:42 -0500
Subject: [PATCH 0872/1050] Get unbuffered string on R JobActivity See:
 https://github.com/neovim/neovim/pull/1584

---
 r-plugin/common_global.vim | 107 ++++++++++++++++++++++---------------
 1 file changed, 63 insertions(+), 44 deletions(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 20bb5c8..eddcada 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -886,7 +886,7 @@ function! StartR_Neovim()
 
     let savedterm = $TERM
     let $TERM="NeovimTerm"
-    let g:rplugin_rjob = jobstart("Rjob", 'R', ['--no-readline', '--interactive'])
+    let g:rplugin_rjob = jobstart("Rjob", 'R', ['--no-readline', '--interactive'], 'su')
     exe 'let $TERM="' . savedterm . '"'
     call WaitVimComStart()
 endfunction
@@ -1038,8 +1038,12 @@ function StartR(whatr)
     echon
 endfunction
 
+" For debugging
+let g:lastjobdata = []
+
 function GetRActivity()
     if v:job_data[1] == 'stdout' || v:job_data[1] == 'stderr'
+        let g:lastjobdata += [v:job_data[2]]
         let edbuf = bufname("%")
         if edbuf == "R_Output"
             let isrout = 1
@@ -1047,29 +1051,56 @@ function GetRActivity()
             let isrout = 0
             sbuffer R_Output
         endif
-        for lin in v:job_data[2]
-            if lin =~ ".\x0d."
+
+        " Newline at the beginning disappears after split(). Put it now:
+        if v:job_data[2] =~ "^\x0a"
+            call append("$", "")
+            let g:rplugin_last_r_prompt = ""
+        endif
+
+        " Fix DOS end of line
+        let outstr = substitute(v:job_data[2], "\x0d\x0a", "\x0a", "g")
+
+        let outlst = split(outstr, '\n')
+
+        let lastline = len(outlst) - 1
+        " Newline at the end disappears after split()
+        if v:job_data[2] =~ '\n$'
+            let g:rplugin_last_r_prompt = ""
+            let hasnl = 1
+        else
+            let g:rplugin_last_r_prompt = substitute(outlst[-1], ' *$', '', '')
+            let hasnl = 0
+        endif
+
+        for idx in range(len(outlst))
+            let lin = outlst[idx]
+            " Do carriage return
+            if lin =~ "\x0d"
                 let lin = substitute(lin, ".*\x0d", "", "g")
+                call setline("$", "")
             endif
-            if lin =~ "\x0d$"
-                let lin = substitute(lin, "\x0d$", "", "g")
-            endif
+
+            " Prefix ': '  for syntax highlight
             if v:job_data[1] == 'stderr'
                 let lin = ': ' . lin
             endif
-            if lin != "#<#"
-                if lin == "#>#"
-                    call append(line("$"), "> ")
-                    call cursor("$", 2)
-                    if isrout
-                        startinsert!
-                    endif
-                else
-                    call append(line("$"), lin)
-                    call cursor("$", 1)
-                endif
+
+            " Append characters to current last line
+            call setline("$", getline("$") . lin)
+
+            " Add new line
+            if idx != lastline
+                call append("$", "")
             endif
         endfor
+
+        " Add final newline
+        if hasnl
+            call append("$", "")
+        endif
+
+        call cursor("$", 999)
         if !isrout
             exe "sbuffer " . edbuf
         endif
@@ -1134,25 +1165,24 @@ function AddToRHistory(rcmd)
     let g:rplugin_rhistory += [a:rcmd]
 endfunction
 
-function SendCmdToR_Neovim(rcmd)
+function SendCmdToR_Neovim(...)
     let curbuf = bufname("%")
     sbuffer R_Output
     if winwidth(0) != b:winwidth
         let b:winwidth = winwidth(0)
         call g:SendToVimCom("\x08" . $VIMINSTANCEID . "options(width=" . b:winwidth . ")", "I")
     endif
-    if getline("$") == "> "
-        call setline(line("$"), "> " . a:rcmd)
-    else
-        call append(line("$"), "> " . a:rcmd)
+    if a:0 == 1
+        call setline("$", getline("$") . a:1)
     endif
+    call append("$", "")
     call cursor("$", 1)
     let g:rplugin_addedtohist = 0
-    if a:rcmd !~ '^base::source('
-        call AddToRHistory(a:rcmd)
+    if a:1 !~ '^base::source('
+        call AddToRHistory(a:1)
     endif
     exe "sbuffer " . curbuf
-    let ok = jobsend(g:rplugin_rjob, a:rcmd . "\n")
+    let ok = jobsend(g:rplugin_rjob, a:1 . "\n")
     return ok
 endfunction
 
@@ -1191,20 +1221,18 @@ function RConsoleArrow(dir)
     endif
     call setline(".", "> " . g:rplugin_rhistory[g:rplugin_dyn_rhist_pos])
 endfunction
-    
+
 function EnterRCmd()
     if line(".") != line("$")
         call append(".", "")
         call cursor(line(".")+1, 1)
         return
     endif
-    " First delete only the less than sign because the user may have manually
-    " deleted the space:
-    let lin = substitute(getline("."), '^>', '', '')
-    " Now delete one space in the beginning, if there any:
+    " First delete the last received prompt:
+    let lin = substitute(getline("."), '^' . g:rplugin_last_r_prompt, '', '')
+    " Now delete one space in the beginning, if there is any:
     let lin = substitute(lin, '^ ', '', '')
-    call setline(line("."), "> ")
-    call SendCmdToR_Neovim(lin)
+    call SendCmdToR_Neovim(lin, 0)
 endfunction
 
 function OpenRScratch()
@@ -2402,7 +2430,7 @@ function RQuit(how)
     if g:rplugin_do_tmux_split && g:vimrplugin_tmux_title != "automatic" && g:vimrplugin_tmux_title != ""
         call system("tmux set automatic-rename on")
     endif
-    if has("nvim") 
+    if has("nvim")
         if g:rplugin_do_tmux_split
             " Force Neovim to update the window size
             sleep 500m
@@ -2895,15 +2923,6 @@ function ROpenPDF(path)
         exe "cd " . substitute(expand("%:p:h"), ' ', '\\ ', 'g')
     endif
 
-    if (has("win32") || has("win64")) && g:rplugin_pdfviewer == "none"
-        let repl = libcall(g:rplugin_vimcom_lib, 'OpenPDF', pdfpath)
-        if repl != "OK"
-            call RWarningMsg(repl)
-        endif
-        exe "cd " . substitute(olddir, ' ', '\\ ', 'g')
-        return
-    endif
-
     if !filereadable(basenm . ".pdf")
         call RWarningMsg('File not found: "' . basenm . '.pdf".')
         exe "cd " . substitute(olddir, ' ', '\\ ', 'g')
@@ -3695,8 +3714,7 @@ function RBufEnter()
     if exists("b:rplugin_funls") && len(b:rplugin_funls) < len(g:rplugin_libls)
         call RUpdateFunSyntax(0)
         " If R code is included in another file type (like rnoweb or
-        " rhelp), the R syntax isn't automatically updated. So, we force
-        " it: 
+        " rhelp), the R syntax isn't automatically updated. So, we force it:
         silent exe "set filetype=" . &filetype
     endif
 endfunction
@@ -4299,6 +4317,7 @@ let g:rplugin_vimcom_home = ""
 let g:rplugin_vimcom_version = 0
 let g:rplugin_lastrpl = ""
 let g:rplugin_lastev = ""
+let g:rplugin_last_r_prompt = ""
 let g:rplugin_hasRSFbutton = 0
 let g:rplugin_tmuxsname = "VimR-" . substitute(localtime(), '.*\(...\)', '\1', '')
 let g:rplugin_python_initialized = 0

From 9a8d7e48b3e699a8dbf1940d84991b6b482dcc92 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sat, 13 Dec 2014 18:26:21 -0500
Subject: [PATCH 0873/1050] New highlight groups, as in colorout package

---
 syntax/rout.vim | 36 ++++++++++++++++++++++++++----------
 1 file changed, 26 insertions(+), 10 deletions(-)

diff --git a/syntax/rout.vim b/syntax/rout.vim
index b395668..ddd3709 100644
--- a/syntax/rout.vim
+++ b/syntax/rout.vim
@@ -18,10 +18,12 @@ syn match routNormal "."
 syn region routString start=/"/ skip=/\\\\\|\\"/ end=/"/ end=/$/
 
 " Constants
-syn keyword routConst  NULL NA
-syn keyword routBool   FALSE TRUE
-syn keyword routNumber Inf NaN
+syn keyword routConst  NULL NA NaN
+syn keyword routTrue   TRUE
+syn keyword routFalse  FALSE
 syn match routConst "\"
+syn match routInf "-Inf\>"
+syn match routInf "\"
 
 " integer
 syn match routInteger "\<\d\+L"
@@ -52,8 +54,10 @@ syn match routComplex "\<\d\+\.\d*\([Ee][-+]\=\d\+\)\=i"
 syn match routComplex "\<\.\d\+\([Ee][-+]\=\d\+\)\=i"
 syn match routComplex "\<\d\+[Ee][-+]\=\d\+i"
 
-" dates
-syn match routDate "[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][-0-9]"
+" dates and times
+syn match routDate "[0-9][0-9][0-9][0-9][-/][0-9][0-9][-/][0-9][-0-9]"
+syn match routDate "[0-9][0-9][-/][0-9][0-9][-/][0-9][0-9][0-9][-0-9]"
+syn match routDate "[0-9][0-9]:[0-9][0-9]:[0-9][-0-9]"
 
 if !exists("g:vimrplugin_routmorecolors")
     let g:vimrplugin_routmorecolors = 0
@@ -155,7 +159,9 @@ if exists("g:rout_follow_colorscheme") && g:rout_follow_colorscheme
     hi def link routNegNum	Number
     hi def link routNegFlt	Float
     hi def link routDate	Number
-    hi def link routBool	Boolean
+    hi def link routTrue	Boolean
+    hi def link routFalse	Boolean
+    hi def link routInf  	Number
     hi def link routConst	Constant
     hi def link routString	String
     hi def link routError	Error
@@ -176,7 +182,9 @@ else
         hi routNegNum	ctermfg=209
         hi routNegFlt	ctermfg=209
         hi routDate	ctermfg=179
-        hi routBool	ctermfg=35
+        hi routFalse	ctermfg=203
+        hi routTrue	ctermfg=78
+        hi routInf      ctermfg=39
         hi routConst	ctermfg=35
         hi routString	ctermfg=85
         hi routStdErr	ctermfg=117
@@ -194,7 +202,9 @@ else
         hi routNegNum	ctermfg=darkyellow
         hi routNegFlt	ctermfg=darkyellow
         hi routDate	ctermfg=darkyellow
-        hi routBool	ctermfg=magenta
+        hi routInf	ctermfg=darkyellow
+        hi routFalse	ctermfg=magenta
+        hi routTrue	ctermfg=darkgreen
         hi routConst	ctermfg=magenta
         hi routString	ctermfg=darkcyan
         hi routStdErr	ctermfg=cyan
@@ -231,8 +241,14 @@ else
     if exists("g:rout_color_date")
         exe "hi routDate ctermfg=" . g:rout_color_date
     endif
-    if exists("g:rout_color_bool")
-        exe "hi routBool ctermfg=" . g:rout_color_bool
+    if exists("g:rout_color_false")
+        exe "hi routFalse ctermfg=" . g:rout_color_false
+    endif
+    if exists("g:rout_color_true")
+        exe "hi routTrue ctermfg=" . g:rout_color_true
+    endif
+    if exists("g:rout_color_inf")
+        exe "hi routInf ctermfg=" . g:rout_color_inf
     endif
     if exists("g:rout_color_constant")
         exe "hi routConst ctermfg=" . g:rout_color_constant

From 6c8a538108085c7aebbfc05b89e4306322c6bc08 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sat, 13 Dec 2014 20:12:05 -0500
Subject: [PATCH 0874/1050] Split r-plugin/common_global.vim Move part of the
 code of common_global.vim to other scripts.

---
 Makefile                    |   3 +
 ftplugin/r_rplugin.vim      |  12 +-
 ftplugin/rbrowser.vim       |   3 +-
 ftplugin/rdoc.vim           |   3 +-
 ftplugin/rhelp_rplugin.vim  |   1 +
 ftplugin/rmd_rplugin.vim    |   1 +
 ftplugin/rnoweb_rplugin.vim |   1 +
 ftplugin/rrst_rplugin.vim   |   1 +
 list_for_vimball            |   5 +
 r-plugin/common_global.vim  | 874 ++----------------------------------
 r-plugin/gui_running.vim    | 311 +++++++++++++
 r-plugin/nvimbuffer.vim     | 270 +++++++++++
 r-plugin/osx.vim            |  51 +++
 r-plugin/windows.vim        | 196 ++++++++
 14 files changed, 876 insertions(+), 856 deletions(-)
 create mode 100644 r-plugin/gui_running.vim
 create mode 100644 r-plugin/nvimbuffer.vim
 create mode 100644 r-plugin/osx.vim
 create mode 100644 r-plugin/windows.vim

diff --git a/Makefile b/Makefile
index d620de0..73c3126 100644
--- a/Makefile
+++ b/Makefile
@@ -83,6 +83,9 @@ deb:
 	  - r-plugin/global_r_plugin.vim\n\
 	  - r-plugin/vimrconfig.vim\n\
 	  - r-plugin/functions.vim\n\
+	  - r-plugin/gui_running.vim
+	  - r-plugin/nvimbuffer.vim
+	  - r-plugin/osx.vim
 	  - syntax/r.vim\n\
 	  - syntax/rdoc.vim\n\
 	  - syntax/rout.vim\n\
diff --git a/ftplugin/r_rplugin.vim b/ftplugin/r_rplugin.vim
index d8bdbac..7c4f87d 100644
--- a/ftplugin/r_rplugin.vim
+++ b/ftplugin/r_rplugin.vim
@@ -67,7 +67,8 @@ function! ShowRout()
         let rcmd = b:rplugin_R . " CMD BATCH --no-restore --no-save '" . expand("%") . "' '" . b:routfile . "'"
     endif
 
-    echo "Please wait for: " . rcmd
+    echon "Please wait for: " . rcmd
+    redraw
     let rlog = system(rcmd)
     if v:shell_error && rlog != ""
         call RWarningMsg('Error: "' . rlog . '"')
@@ -86,14 +87,6 @@ function! OpenRout(goback)
             exe "tabnew " . b:routfile
         endif
         set filetype=rout
-        if a:goback
-            if g:vimrplugin_routnotab == 1
-                exe "normal! \p"
-            else
-                normal! gT
-            endif
-            call setpos(".", curpos)
-        endif
     else
         call RWarningMsg("The file '" . b:routfile . "' is not readable.")
     endif
@@ -146,6 +139,7 @@ call RCreateMaps("nvi", 'RSetwd',        'rd', ':call RSetWD()')
 
 " Menu R
 if has("gui_running")
+    runtime r-plugin/gui_running.vim
     call MakeRMenu()
 endif
 
diff --git a/ftplugin/rbrowser.vim b/ftplugin/rbrowser.vim
index 38d62e5..f1cb9d3 100644
--- a/ftplugin/rbrowser.vim
+++ b/ftplugin/rbrowser.vim
@@ -1,7 +1,7 @@
 " Vim filetype plugin file
 " Language: R Browser (generated by the Vim-R-plugin)
 " Maintainer: Jakson Alves de Aquino 
-" Last Change:	Mon Nov 17, 2014  03:44PM
+" Last Change:	Sat Dec 13, 2014  07:58PM
 
 
 " Only do this when not yet done for this buffer
@@ -336,6 +336,7 @@ setlocal winfixwidth
 setlocal bufhidden=wipe
 
 if has("gui_running")
+    runtime r-plugin/gui_running.vim
     call RControlMenu()
     call RBrowserMenu()
 endif
diff --git a/ftplugin/rdoc.vim b/ftplugin/rdoc.vim
index 4e5d563..82b2629 100644
--- a/ftplugin/rdoc.vim
+++ b/ftplugin/rdoc.vim
@@ -1,7 +1,7 @@
 " Vim filetype plugin file
 " Language: R Documentation (generated by the Vim-R-plugin)
 " Maintainer: Jakson Alves de Aquino 
-" Last Change:	Thu Nov 27, 2014  12:08PM
+" Last Change:	Sat Dec 13, 2014  07:58PM
 
 
 " Only do this when not yet done for this buffer
@@ -112,6 +112,7 @@ call RControlMaps()
 
 " Menu R
 if has("gui_running")
+    runtime r-plugin/gui_running.vim
     call MakeRMenu()
 endif
 
diff --git a/ftplugin/rhelp_rplugin.vim b/ftplugin/rhelp_rplugin.vim
index 6e184e4..d915577 100644
--- a/ftplugin/rhelp_rplugin.vim
+++ b/ftplugin/rhelp_rplugin.vim
@@ -40,6 +40,7 @@ call RCreateMaps("nvi", 'RSetwd',        'rd', ':call RSetWD()')
 
 " Menu R
 if has("gui_running")
+    runtime r-plugin/gui_running.vim
     call MakeRMenu()
 endif
 
diff --git a/ftplugin/rmd_rplugin.vim b/ftplugin/rmd_rplugin.vim
index c20918f..4855b26 100644
--- a/ftplugin/rmd_rplugin.vim
+++ b/ftplugin/rmd_rplugin.vim
@@ -146,6 +146,7 @@ call RCreateMaps("n",  'RPreviousRChunk', 'gN', ':call b:PreviousRChunk()'
 
 " Menu R
 if has("gui_running")
+    runtime r-plugin/gui_running.vim
     call MakeRMenu()
 endif
 
diff --git a/ftplugin/rnoweb_rplugin.vim b/ftplugin/rnoweb_rplugin.vim
index 0466109..cb43139 100644
--- a/ftplugin/rnoweb_rplugin.vim
+++ b/ftplugin/rnoweb_rplugin.vim
@@ -278,6 +278,7 @@ call RCreateMaps("n",  'RPreviousRChunk', 'gN', ':call b:PreviousRChunk()'
 
 " Menu R
 if has("gui_running")
+    runtime r-plugin/gui_running.vim
     call MakeRMenu()
 endif
 
diff --git a/ftplugin/rrst_rplugin.vim b/ftplugin/rrst_rplugin.vim
index 5c88fe9..854e71c 100644
--- a/ftplugin/rrst_rplugin.vim
+++ b/ftplugin/rrst_rplugin.vim
@@ -183,6 +183,7 @@ call RCreateMaps("n",  'RPreviousRChunk', 'gN', ':call b:PreviousRChunk()'
 
 " Menu R
 if has("gui_running")
+    runtime r-plugin/gui_running.vim
     call MakeRMenu()
 endif
 
diff --git a/list_for_vimball b/list_for_vimball
index a487712..4a4eaf5 100644
--- a/list_for_vimball
+++ b/list_for_vimball
@@ -29,6 +29,11 @@ r-plugin/synctex_evince_forward.py
 r-plugin/synctex_okular_backward.sh
 r-plugin/vimrconfig.vim
 r-plugin/functions.vim
+r-plugin/gui_running.vim
+r-plugin/nvimbuffer.vim
+r-plugin/osx.vim
+r-plugin/windows.py
+r-plugin/windows.vim
 syntax/r.vim
 syntax/rbrowser.vim
 syntax/rdoc.vim
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index eddcada..941442f 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -666,14 +666,17 @@ function StartR_TmuxSplit(rcmd)
         call g:SendToVimCom("\005B Update OB [StartR]")
     endif
     if has("nvim")
+        let g:RBrOpenCloseLs = function("RBrOpenCloseLs_TmuxNeovim")
         " Force Neovim to update the window size
         mode
+    else
+        let g:RBrOpenCloseLs = function("RBrOpenCloseLs_TmuxVim")
     endif
 endfunction
 
 
 function StartR_ExternalTerm(rcmd)
-    if $DISPLAY == "" && !has("gui_macvim")
+    if $DISPLAY == "" && !has("gui_macvim") && !has("nvim")
         call RWarningMsg("Start 'tmux' before Vim. The X Window system is required to run R in an external terminal.")
         return
     endif
@@ -730,167 +733,6 @@ function StartR_ExternalTerm(rcmd)
     endif
 endfunction
 
-function InitializePython()
-    " python3 has priority over python
-    if has("python3")
-        command! -nargs=+ Py :py3 
-        command! -nargs=+ PyFile :py3file 
-    elseif has("python")
-        command! -nargs=+ Py :py 
-        command! -nargs=+ PyFile :pyfile 
-    elseif has("nvim")
-        command! -nargs=+ Py :call RWarningMsg("Py command not implemented yet: '" .  . "'")
-        let g:SendToVimCom = function("SendToVimCom_Neovim")
-    else
-        command! -nargs=+ Py :
-        command! -nargs=+ PyFile :
-    endif
-    exe "PyFile " . substitute(g:rplugin_home, " ", '\\ ', "g") . '\r-plugin\windows.py'
-    let g:rplugin_python_initialized = 1
-endfunction
-
-function StartR_Windows()
-    if !g:vimrplugin_libcall_send && !g:rplugin_python_initialized
-        call InitializePython()
-    endif
-    if string(g:SendCmdToR) != "function('SendCmdToR_fake')"
-        let repl = libcall(g:rplugin_vimcom_lib, "FindRConsole", 'R Console')
-        if repl == "NotFound"
-            let g:SendCmdToR = function('SendCmdToR_fake')
-            let g:rplugin_r_pid = 0
-        else
-            call RWarningMsg('There is already a window called "R Console".')
-            return
-        endif
-    endif
-    let vrph = $VIMRPLUGIN_HOME
-    let $VIMRPLUGIN_HOME = substitute($VIMRPLUGIN_HOME, "\\\\ ", " ", "g")
-
-    if !executable(g:rplugin_Rgui)
-        call RWarningMsg('R executable "' . g:rplugin_Rgui . '" not found.')
-        if exists("g:rdebug_reg_rpath_1")
-            call RWarningMsg('DEBUG message 1: >>' . g:rdebug_reg_rpath_1 . '<<')
-        endif
-        if exists("g:rdebug_reg_rpath_1")
-            call RWarningMsg('DEBUG message 2: >>' . g:rdebug_reg_rpath_2 . '<<')
-        endif
-        return
-    endif
-
-    " R and Vim use different values for the $HOME variable.
-    let saved_home = $HOME
-    let prs = system('reg.exe QUERY "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v "Personal"')
-    if len(prs) > 0
-        let g:rdebug_reg_personal = prs
-        let prs = substitute(prs, '.*REG_SZ\s*', '', '')
-        let prs = substitute(prs, '\n', '', 'g')
-        let prs = substitute(prs, '\s*$', '', 'g')
-        let $HOME = prs
-    endif
-
-    let rcmd = g:rplugin_Rgui
-    if g:vimrplugin_Rterm
-        let rcmd = substitute(rcmd, "Rgui", "Rterm", "")
-    endif
-    let rcmd = '"' . rcmd . '" ' . g:vimrplugin_r_args
-
-    silent exe "!start " . rcmd
-
-    let $HOME = saved_home
-
-    if g:vimrplugin_vim_wd == 0
-        lcd -
-    endif
-    let $VIMRPLUGIN_HOME = vrph
-    let g:SendCmdToR = function('SendCmdToR_Windows')
-    call WaitVimComStart()
-endfunction
-
-function StartR_OSX()
-    if IsSendCmdToRFake()
-        return
-    endif
-    if g:rplugin_r64app && g:vimrplugin_i386 == 0
-        let rcmd = "/Applications/R64.app"
-    else
-        let rcmd = "/Applications/R.app"
-    endif
-    if b:rplugin_r_args != " "
-        " https://github.com/jcfaria/Vim-R-plugin/issues/63
-        " https://stat.ethz.ch/pipermail/r-sig-mac/2013-February/009978.html
-        call RWarningMsg('R.app does not support command line arguments. To pass "' . b:rplugin_r_args . '" to R, you must run it in a console. Set "vimrplugin_applescript = 0" (you may need to install XQuartz)')
-    endif
-    let rlog = system("open " . rcmd)
-    if v:shell_error
-        call RWarningMsg(rlog)
-    endif
-    if g:vimrplugin_vim_wd == 0
-        lcd -
-    endif
-    let g:SendCmdToR = function('SendCmdToR_OSX')
-    if WaitVimComStart()
-        call g:SendToVimCom("\005B Update OB [StartR]")
-    endif
-endfunction
-
-function! StartR_Neovim()
-    if string(g:SendCmdToR) != "function('SendCmdToR_fake')"
-        return
-    endif
-    let g:rplugin_do_tmux_split = 0
-
-    let g:SendCmdToR = function('SendCmdToR_Neovim')
-
-    let edbuf = bufname("%")
-    let g:tmp_objbrtitle = b:objbrtitle
-    let g:tmp_curbufname = bufname("%")
-    set switchbuf=useopen
-    if g:vimrplugin_vsplit
-        if g:vimrplugin_rconsole_width > 16 && g:vimrplugin_rconsole_width < (winwidth(0) - 16)
-            silent exe "belowright " . g:vimrplugin_rconsole_width . "vsplit R_Output"
-        else
-            silent belowright vsplit R_Output
-        endif
-    else
-        if g:vimrplugin_rconsole_height > 6 && g:vimrplugin_rconsole_height < (winheight(0) - 6)
-            silent exe "belowright " . g:vimrplugin_rconsole_height . "split R_Output"
-        else
-            silent belowright split R_Output
-        endif
-    endif
-    let b:winwidth = 0
-    set filetype=rout
-    setlocal noswapfile
-    setlocal bufhidden=hide
-    setlocal formatoptions=
-    set buftype=nofile
-    set omnifunc=rcomplete#CompleteR
-    if hasmapto("RCompleteArgs", "i")
-        imap  RCompleteArgs =RCompleteArgs()
-    else
-        imap   =RCompleteArgs()
-    endif
-    let b:objbrtitle = g:tmp_objbrtitle
-    let b:rscript_buffer = g:tmp_curbufname
-    unlet g:tmp_objbrtitle
-    unlet g:tmp_curbufname
-    imap   :call EnterRCmd()A
-    imap   :RStopa
-    imap   :call RConsoleArrow("up")A
-    imap   :call RConsoleArrow("down")A
-    imap   =CompleteFromHistory()
-    call cursor("$", 1)
-    exe "sbuffer " . edbuf
-
-    nmap  :call OpenRScratch()
-
-    let savedterm = $TERM
-    let $TERM="NeovimTerm"
-    let g:rplugin_rjob = jobstart("Rjob", 'R', ['--no-readline', '--interactive'], 'su')
-    exe 'let $TERM="' . savedterm . '"'
-    call WaitVimComStart()
-endfunction
-
 function IsSendCmdToRFake()
     if string(g:SendCmdToR) != "function('SendCmdToR_fake')"
 	if exists("g:maplocalleader")
@@ -905,10 +747,13 @@ endfunction
 
 " Start R
 function StartR(whatr)
+    let g:SendToVimCom = function("SendToVimCom_Vim")
+
     if has("gui_macvim")
         let $VIMEDITOR_SVRNM = "MacVim"
     elseif has("nvim")
         let $VIMEDITOR_SVRNM = "Neovim_" . g:rplugin_myport
+        let g:SendToVimCom = function("SendToVimCom_Neovim")
     elseif !has("clientserver")
         let $VIMEDITOR_SVRNM = "NoClientServer"
     elseif v:servername == ""
@@ -1038,107 +883,6 @@ function StartR(whatr)
     echon
 endfunction
 
-" For debugging
-let g:lastjobdata = []
-
-function GetRActivity()
-    if v:job_data[1] == 'stdout' || v:job_data[1] == 'stderr'
-        let g:lastjobdata += [v:job_data[2]]
-        let edbuf = bufname("%")
-        if edbuf == "R_Output"
-            let isrout = 1
-        else
-            let isrout = 0
-            sbuffer R_Output
-        endif
-
-        " Newline at the beginning disappears after split(). Put it now:
-        if v:job_data[2] =~ "^\x0a"
-            call append("$", "")
-            let g:rplugin_last_r_prompt = ""
-        endif
-
-        " Fix DOS end of line
-        let outstr = substitute(v:job_data[2], "\x0d\x0a", "\x0a", "g")
-
-        let outlst = split(outstr, '\n')
-
-        let lastline = len(outlst) - 1
-        " Newline at the end disappears after split()
-        if v:job_data[2] =~ '\n$'
-            let g:rplugin_last_r_prompt = ""
-            let hasnl = 1
-        else
-            let g:rplugin_last_r_prompt = substitute(outlst[-1], ' *$', '', '')
-            let hasnl = 0
-        endif
-
-        for idx in range(len(outlst))
-            let lin = outlst[idx]
-            " Do carriage return
-            if lin =~ "\x0d"
-                let lin = substitute(lin, ".*\x0d", "", "g")
-                call setline("$", "")
-            endif
-
-            " Prefix ': '  for syntax highlight
-            if v:job_data[1] == 'stderr'
-                let lin = ': ' . lin
-            endif
-
-            " Append characters to current last line
-            call setline("$", getline("$") . lin)
-
-            " Add new line
-            if idx != lastline
-                call append("$", "")
-            endif
-        endfor
-
-        " Add final newline
-        if hasnl
-            call append("$", "")
-        endif
-
-        call cursor("$", 999)
-        if !isrout
-            exe "sbuffer " . edbuf
-        endif
-    else
-        let g:rplugin_rjob = 0
-        let g:rplugin_r_pid = 0
-        let g:SendCmdToR = function('SendCmdToR_fake')
-        if bufname("%") == "R_Output"
-            call append("$", ':    ---  R Finished  ---')
-            call append("$", "")
-            sleep 500m
-            quit
-        endif
-        if mode() == "n"
-            call RWarningMsg("R finished")
-        endif
-    endif
-endfunction
-
-function CompleteFromHistory()
-    if line(".") != line("$")
-        return
-    endif
-
-    let key = substitute(getline("."), '^>', '', '')
-    let key = substitute(key, '^ ', '', '')
-    let key = substitute(key, '^\s*\(.*\)\s*', '\1', '')
-    let histlin = [key]
-    call setline(".", "> ")
-    for lin in g:rplugin_rhistory
-        if lin =~ key
-            let histlin += [lin]
-        endif
-    endfor
-    call complete(3, histlin)
-    return ''
-endfunction
-
 " To be called by edit() in R running in Neovim buffer.
 function ShowRObject(fname)
     call RWarningMsg("ShowRObject not implemented yet: '" . a:fname . "'")
@@ -1153,39 +897,6 @@ function ShowRObject(fname)
     autocmd BufUnload  call delete(s:finalA) | unlet s:finalA | startinsert
 endfunction
 
-function ShowRhistory()
-    tabnew R_history
-    call setline(".", g:rplugin_rhistory)
-    set ft=r
-endfunction
-
-function AddToRHistory(rcmd)
-    let g:rplugin_rhist_pos += 1
-    let g:rplugin_dyn_rhist_pos = g:rplugin_rhist_pos
-    let g:rplugin_rhistory += [a:rcmd]
-endfunction
-
-function SendCmdToR_Neovim(...)
-    let curbuf = bufname("%")
-    sbuffer R_Output
-    if winwidth(0) != b:winwidth
-        let b:winwidth = winwidth(0)
-        call g:SendToVimCom("\x08" . $VIMINSTANCEID . "options(width=" . b:winwidth . ")", "I")
-    endif
-    if a:0 == 1
-        call setline("$", getline("$") . a:1)
-    endif
-    call append("$", "")
-    call cursor("$", 1)
-    let g:rplugin_addedtohist = 0
-    if a:1 !~ '^base::source('
-        call AddToRHistory(a:1)
-    endif
-    exe "sbuffer " . curbuf
-    let ok = jobsend(g:rplugin_rjob, a:1 . "\n")
-    return ok
-endfunction
-
 " Send SIGINT to R
 function StopR()
     if g:rplugin_r_pid
@@ -1193,48 +904,6 @@ function StopR()
     endif
 endfunction
 
-function RConsoleArrow(dir)
-    if line(".") != line("$")
-        return
-    endif
-
-    " Check if current last typed line of R_Output is already in history
-    if g:rplugin_addedtohist == 0
-        let lin = substitute(getline("."), '^>', '', '')
-        let lin = substitute(lin, '^ ', '', '')
-        call AddToRHistory(lin)
-        let g:rplugin_addedtohist = 1
-    endif
-
-    if a:dir == "down"
-        let g:rplugin_dyn_rhist_pos += 1
-        if g:rplugin_dyn_rhist_pos > g:rplugin_rhist_pos
-            let g:rplugin_dyn_rhist_pos -= 1
-            return
-        endif
-    else
-        let g:rplugin_dyn_rhist_pos -= 1
-        if g:rplugin_dyn_rhist_pos < 0
-            let g:rplugin_dyn_rhist_pos = 0
-            return
-        endif
-    endif
-    call setline(".", "> " . g:rplugin_rhistory[g:rplugin_dyn_rhist_pos])
-endfunction
-
-function EnterRCmd()
-    if line(".") != line("$")
-        call append(".", "")
-        call cursor(line(".")+1, 1)
-        return
-    endif
-    " First delete the last received prompt:
-    let lin = substitute(getline("."), '^' . g:rplugin_last_r_prompt, '', '')
-    " Now delete one space in the beginning, if there is any:
-    let lin = substitute(lin, '^ ', '', '')
-    call SendCmdToR_Neovim(lin, 0)
-endfunction
-
 function OpenRScratch()
     below 6split R_Scratch
     set filetype=r
@@ -1245,15 +914,6 @@ function OpenRScratch()
     startinsert
 endfunction
 
-function RSetNeovimPort(p)
-    let g:rplugin_myport = a:p
-    if &filetype == "rbrowser" && g:rplugin_do_tmux_split
-        call g:SendToVimCom("\002" . a:p)
-    else
-        call g:SendToVimCom("\001" . a:p)
-    endif
-endfunction
-
 function WaitVimComStart()
     if g:vimrplugin_vimcom_wait < 300
         g:vimrplugin_vimcom_wait = 300
@@ -1322,7 +982,7 @@ function WaitVimComStart()
         endif
         call delete($VIMRPLUGIN_TMPDIR . "/vimcom_running_" . $VIMINSTANCEID)
 
-        if !g:vimrplugin_r_in_buffer && !has("libcall")
+        if !has("nvim") && !has("libcall")
             call RWarningMsgInp("+libcall feature is missing: communication with R will be flawed.")
         endif
 
@@ -1406,11 +1066,14 @@ function StartObjBrowser_Tmux()
                 \ 'set rulerformat=%3(%l%)',
                 \ 'set noruler',
                 \ 'let g:SendCmdToR = function("SendCmdToR_TmuxSplit")',
+                \ 'let g:RBrOpenCloseLs = function("RBrOpenCloseLs_TmuxOB")',
                 \ 'if has("nvim")',
+                \ '    let g:SendToVimCom = function("SendToVimCom_Neovim")',
                 \ '    let g:rplugin_clt_job = jobstart("vimcom", "' . g:rplugin_vimcom_home . "/bin/nvimclient" . '", ["' . g:rplugin_vimcomport . '"])',
                 \ '    let g:rplugin_srv_job = jobstart("udpsvr", "' . g:rplugin_vimcom_home . "/bin/nvimserver" . '")',
                 \ '    autocmd JobActivity udpsvr call ROnJobActivity()',
                 \ 'else',
+                \ '    let g:SendToVimCom = function("SendToVimCom_Vim")',
                 \ '    if has("clientserver") && v:servername != ""',
                 \ '        let g:rplugin_vimcomport = ' . g:rplugin_vimcomport,
                 \ '        call g:SendToVimCom("\002" . v:servername)',
@@ -1498,6 +1161,8 @@ function StartObjBrowser_Tmux()
 endfunction
 
 function StartObjBrowser_Vim()
+    let g:RBrOpenCloseLs = function("RBrOpenCloseLs_Vim")
+
     if has("win32") || has("win64")
 	" The vimcom server will stop working if starting the Object
 	" Browser is the first thing the user does.
@@ -1686,23 +1351,6 @@ function RBrOpenCloseLs_TmuxVim(status)
     endif
 endfunction
 
-function RBrOpenCloseLs_TmuxNeovim(status)
-    " TODO: Discover real value of curview
-    let curview = "GlobalEnv"
-
-    if a:status == 1 && curview == "libraries"
-        if curview == "libraries"
-            echohl WarningMsg
-            echon "GlobalEnv command only."
-            sleep 1
-            echohl Normal
-            normal! :
-            return
-        endif
-    endif
-    call g:SendToVimCom("\007" . a:status)
-endfunction
-
 function RBrOpenCloseLs_TmuxOB(status)
     if a:status == 1 && g:rplugin_curview == "libraries"
         echohl WarningMsg
@@ -1811,47 +1459,6 @@ function SendCmdToR_TmuxSplit(cmd)
     return 1
 endfunction
 
-function SendCmdToR_Windows(cmd)
-    if g:vimrplugin_ca_ck
-        let cmd = "\001" . "\013" . a:cmd . "\n"
-    else
-        let cmd = a:cmd . "\n"
-    endif
-    if g:vimrplugin_libcall_send
-        let repl = libcall(g:rplugin_vimcom_lib, "SendToRConsole", cmd)
-    else
-        let slen = len(cmd)
-        let str = ""
-        for i in range(0, slen)
-            let str = str . printf("\\x%02X", char2nr(cmd[i]))
-        endfor
-        exe "Py" . " SendToRConsole(b'" . str . "')"
-    endif
-    return 1
-endfunction
-
-function SendCmdToR_OSX(cmd)
-    if g:vimrplugin_ca_ck
-        let cmd = "\001" . "\013" . a:cmd
-    else
-        let cmd = a:cmd
-    endif
-
-    if g:rplugin_r64app && g:vimrplugin_i386 == 0
-        let rcmd = "R64"
-    else
-        let rcmd = "R"
-    endif
-
-    " for some reason it doesn't like "\025"
-    let cmd = a:cmd
-    let cmd = substitute(cmd, "\\", '\\\', 'g')
-    let cmd = substitute(cmd, '"', '\\"', "g")
-    let cmd = substitute(cmd, "'", "'\\\\''", "g")
-    call system("osascript -e 'tell application \"".rcmd."\" to cmd \"" . cmd . "\"'")
-    return 1
-endfunction
-
 function SendCmdToR_Term(cmd)
     if g:vimrplugin_ca_ck
         let cmd = "\001" . "\013" . a:cmd
@@ -2824,7 +2431,9 @@ function RSetPDFViewer()
         let g:rplugin_pdfviewer = tolower(g:vimrplugin_pdfviewer)
     else
         " Try to guess what PDF viewer is used:
-        if executable("evince")
+        if has("win32") || has("win64")
+            let g:rplugin_pdfviewer = "sumatra"
+        elseif executable("evince")
             let g:rplugin_pdfviewer = "evince"
         elseif executable("okular")
             let g:rplugin_pdfviewer = "okular"
@@ -2942,8 +2551,10 @@ function ROpenPDF(path)
             endif
             exe "cd " . substitute(olddir, ' ', '\\ ', 'g')
             return
-        elseif g:rplugin_pdfviewer == "sumatra"
-            call system('SumatraPDF -inverse-search "gvim --servername ' . v:servername . " --remote-expr SyncTeX_backward(\\'%{input}\\',%{line})" . '"')
+        elseif g:rplugin_pdfviewer == "sumatra" && (g:rplugin_sumatra_path != "" || FindSumatra())
+            silent exe '!start "' . g:rplugin_sumatra_path . '" -reuse-instance -inverse-search "gvim --servername ' . v:servername . " --remote-expr SyncTeX_backward('%f',%l)" . '" "' . basenm . '.pdf"'
+            exe "cd " . substitute(olddir, ' ', '\\ ', 'g')
+            return
         else
             let pcmd = g:rplugin_pdfviewer . " '" . pdfpath . "' 2>/dev/null >/dev/null &"
         endif
@@ -3283,310 +2894,6 @@ function RCreateMaps(type, plug, combo, target)
     endif
 endfunction
 
-function MakeRMenu()
-    if g:rplugin_hasmenu == 1
-        return
-    endif
-
-    " Do not translate "File":
-    menutranslate clear
-
-    "----------------------------------------------------------------------------
-    " Start/Close
-    "----------------------------------------------------------------------------
-    call RCreateMenuItem("nvi", 'Start/Close.Start\ R\ (default)', 'RStart', 'rf', ':call StartR("R")')
-    call RCreateMenuItem("nvi", 'Start/Close.Start\ R\ --vanilla', 'RVanillaStart', 'rv', ':call StartR("vanilla")')
-    call RCreateMenuItem("nvi", 'Start/Close.Start\ R\ (custom)', 'RCustomStart', 'rc', ':call StartR("custom")')
-    "-------------------------------
-    menu R.Start/Close.-Sep1- 
-    call RCreateMenuItem("nvi", 'Start/Close.Close\ R\ (no\ save)', 'RClose', 'rq', ":call RQuit('no')")
-    menu R.Start/Close.-Sep2- 
-
-    nmenu  R.Start/Close.Stop\ R:RStop :RStop
-
-    "----------------------------------------------------------------------------
-    " Send
-    "----------------------------------------------------------------------------
-    if &filetype == "r" || g:vimrplugin_never_unmake_menu
-        call RCreateMenuItem("ni", 'Send.File', 'RSendFile', 'aa', ':call SendFileToR("silent")')
-        call RCreateMenuItem("ni", 'Send.File\ (echo)', 'RESendFile', 'ae', ':call SendFileToR("echo")')
-        call RCreateMenuItem("ni", 'Send.File\ (open\ \.Rout)', 'RShowRout', 'ao', ':call ShowRout()')
-    endif
-    "-------------------------------
-    menu R.Send.-Sep1- 
-    call RCreateMenuItem("ni", 'Send.Block\ (cur)', 'RSendMBlock', 'bb', ':call SendMBlockToR("silent", "stay")')
-    call RCreateMenuItem("ni", 'Send.Block\ (cur,\ echo)', 'RESendMBlock', 'be', ':call SendMBlockToR("echo", "stay")')
-    call RCreateMenuItem("ni", 'Send.Block\ (cur,\ down)', 'RDSendMBlock', 'bd', ':call SendMBlockToR("silent", "down")')
-    call RCreateMenuItem("ni", 'Send.Block\ (cur,\ echo\ and\ down)', 'REDSendMBlock', 'ba', ':call SendMBlockToR("echo", "down")')
-    "-------------------------------
-    if &filetype == "rnoweb" || &filetype == "rmd" || &filetype == "rrst" || g:vimrplugin_never_unmake_menu
-        menu R.Send.-Sep2- 
-        call RCreateMenuItem("ni", 'Send.Chunk\ (cur)', 'RSendChunk', 'cc', ':call b:SendChunkToR("silent", "stay")')
-        call RCreateMenuItem("ni", 'Send.Chunk\ (cur,\ echo)', 'RESendChunk', 'ce', ':call b:SendChunkToR("echo", "stay")')
-        call RCreateMenuItem("ni", 'Send.Chunk\ (cur,\ down)', 'RDSendChunk', 'cd', ':call b:SendChunkToR("silent", "down")')
-        call RCreateMenuItem("ni", 'Send.Chunk\ (cur,\ echo\ and\ down)', 'REDSendChunk', 'ca', ':call b:SendChunkToR("echo", "down")')
-        call RCreateMenuItem("ni", 'Send.Chunk\ (from\ first\ to\ here)', 'RSendChunkFH', 'ch', ':call SendFHChunkToR()')
-    endif
-    "-------------------------------
-    menu R.Send.-Sep3- 
-    call RCreateMenuItem("ni", 'Send.Function\ (cur)', 'RSendFunction', 'ff', ':call SendFunctionToR("silent", "stay")')
-    call RCreateMenuItem("ni", 'Send.Function\ (cur,\ echo)', 'RESendFunction', 'fe', ':call SendFunctionToR("echo", "stay")')
-    call RCreateMenuItem("ni", 'Send.Function\ (cur\ and\ down)', 'RDSendFunction', 'fd', ':call SendFunctionToR("silent", "down")')
-    call RCreateMenuItem("ni", 'Send.Function\ (cur,\ echo\ and\ down)', 'REDSendFunction', 'fa', ':call SendFunctionToR("echo", "down")')
-    "-------------------------------
-    menu R.Send.-Sep4- 
-    call RCreateMenuItem("v", 'Send.Selection', 'RSendSelection', 'ss', ':call SendSelectionToR("silent", "stay")')
-    call RCreateMenuItem("v", 'Send.Selection\ (echo)', 'RESendSelection', 'se', ':call SendSelectionToR("echo", "stay")')
-    call RCreateMenuItem("v", 'Send.Selection\ (and\ down)', 'RDSendSelection', 'sd', ':call SendSelectionToR("silent", "down")')
-    call RCreateMenuItem("v", 'Send.Selection\ (echo\ and\ down)', 'REDSendSelection', 'sa', ':call SendSelectionToR("echo", "down")')
-    "-------------------------------
-    menu R.Send.-Sep5- 
-    call RCreateMenuItem("ni", 'Send.Paragraph', 'RSendParagraph', 'pp', ':call SendParagraphToR("silent", "stay")')
-    call RCreateMenuItem("ni", 'Send.Paragraph\ (echo)', 'RESendParagraph', 'pe', ':call SendParagraphToR("echo", "stay")')
-    call RCreateMenuItem("ni", 'Send.Paragraph\ (and\ down)', 'RDSendParagraph', 'pd', ':call SendParagraphToR("silent", "down")')
-    call RCreateMenuItem("ni", 'Send.Paragraph\ (echo\ and\ down)', 'REDSendParagraph', 'pa', ':call SendParagraphToR("echo", "down")')
-    "-------------------------------
-    menu R.Send.-Sep6- 
-    call RCreateMenuItem("ni0", 'Send.Line', 'RSendLine', 'l', ':call SendLineToR("stay")')
-    call RCreateMenuItem("ni0", 'Send.Line\ (and\ down)', 'RDSendLine', 'd', ':call SendLineToR("down")')
-    call RCreateMenuItem("ni0", 'Send.Line\ (and\ insert\ output)', 'RDSendLineAndInsertOutput', 'o', ':call SendLineToRAndInsertOutput()')
-    call RCreateMenuItem("i", 'Send.Line\ (and\ new\ one)', 'RSendLAndOpenNewOne', 'q', ':call SendLineToR("newline")')
-    call RCreateMenuItem("n", 'Send.Left\ part\ of\ line\ (cur)', 'RNLeftPart', 'r', ':call RSendPartOfLine("left", 0)')
-    call RCreateMenuItem("n", 'Send.Right\ part\ of\ line\ (cur)', 'RNRightPart', 'r', ':call RSendPartOfLine("right", 0)')
-    call RCreateMenuItem("i", 'Send.Left\ part\ of\ line\ (cur)', 'RILeftPart', 'r', 'l:call RSendPartOfLine("left", 1)')
-    call RCreateMenuItem("i", 'Send.Right\ part\ of\ line\ (cur)', 'RIRightPart', 'r', 'l:call RSendPartOfLine("right", 1)')
-
-    "----------------------------------------------------------------------------
-    " Control
-    "----------------------------------------------------------------------------
-    call RControlMenu()
-    "-------------------------------
-    menu R.Command.-Sep4- 
-    if &filetype != "rdoc"
-        call RCreateMenuItem("nvi", 'Command.Set\ working\ directory\ (cur\ file\ path)', 'RSetwd', 'rd', ':call RSetWD()')
-    endif
-    "-------------------------------
-    if &filetype == "rnoweb" || &filetype == "rmd" || &filetype == "rrst" || g:vimrplugin_never_unmake_menu
-        if &filetype == "rnoweb" || g:vimrplugin_never_unmake_menu
-            menu R.Command.-Sep5- 
-            call RCreateMenuItem("nvi", 'Command.Sweave\ (cur\ file)', 'RSweave', 'sw', ':call RSweave()')
-            call RCreateMenuItem("nvi", 'Command.Sweave\ and\ PDF\ (cur\ file)', 'RMakePDF', 'sp', ':call RMakePDF("nobib", 0)')
-            if has("win32") || has("win64")
-                call RCreateMenuItem("nvi", 'Command.Sweave\ and\ PDF\ (cur\ file,\ verbose)', 'RMakePDF', 'sv', ':call RMakePDF("verbose", 0)')
-            else
-                call RCreateMenuItem("nvi", 'Command.Sweave,\ BibTeX\ and\ PDF\ (cur\ file)', 'RBibTeX', 'sb', ':call RMakePDF("bibtex", 0)')
-            endif
-        endif
-        menu R.Command.-Sep6- 
-        if &filetype == "rnoweb"
-            call RCreateMenuItem("nvi", 'Command.Knit\ (cur\ file)', 'RKnit', 'kn', ':call RKnitRnw()')
-        else
-            call RCreateMenuItem("nvi", 'Command.Knit\ (cur\ file)', 'RKnit', 'kn', ':call RKnit()')
-        endif
-        if &filetype == "rnoweb" || g:vimrplugin_never_unmake_menu
-            call RCreateMenuItem("nvi", 'Command.Knit\ and\ PDF\ (cur\ file)', 'RMakePDFK', 'kp', ':call RMakePDF("nobib", 1)')
-            if has("win32") || has("win64")
-                call RCreateMenuItem("nvi", 'Command.Knit\ and\ PDF\ (cur\ file,\ verbose)', 'RMakePDFKv', 'kv', ':call RMakePDF("verbose", 1)')
-            else
-                call RCreateMenuItem("nvi", 'Command.Knit,\ BibTeX\ and\ PDF\ (cur\ file)', 'RBibTeXK', 'kb', ':call RMakePDF("bibtex", 1)')
-            endif
-        endif
-        if &filetype == "rmd" || g:vimrplugin_never_unmake_menu
-            call RCreateMenuItem("nvi", 'Command.Knit\ and\ PDF\ (cur\ file)', 'RMakePDFK', 'kp', ':call RMakeRmd("pdf")')
-            call RCreateMenuItem("nvi", 'Command.Knit\ and\ Beamer\ PDF\ (cur\ file)', 'RMakePDFKb', 'kl', ':call RMakeRmd("beamer")')
-            call RCreateMenuItem("nvi", 'Command.Knit\ and\ HTML\ (cur\ file)', 'RMakeHTML', 'kh', ':call RMakeRmd("html")')
-            call RCreateMenuItem("nvi", 'Command.Knit\ and\ ODT\ (cur\ file)', 'RMakeODT', 'ko', ':call RMakeRmd("odt")')
-        endif
-        if &filetype == "rrst" || g:vimrplugin_never_unmake_menu
-            call RCreateMenuItem("nvi", 'Command.Knit\ and\ PDF\ (cur\ file)', 'RMakePDFK', 'kp', ':call RMakePDFrrst()')
-            call RCreateMenuItem("nvi", 'Command.Knit\ and\ HTML\ (cur\ file)', 'RMakeHTML', 'kh', ':call RMakeHTMLrrst("html")')
-            call RCreateMenuItem("nvi", 'Command.Knit\ and\ ODT\ (cur\ file)', 'RMakeODT', 'ko', ':call RMakeHTMLrrst("odt")')
-        endif
-        menu R.Command.-Sep61- 
-        call RCreateMenuItem("nvi", 'Command.Open\ PDF\ (cur\ file)', 'ROpenPDF', 'op', ':call ROpenPDF("Get Master")')
-        if ($DISPLAY != "" && g:vimrplugin_synctex && &filetype == "rnoweb") || g:vimrplugin_never_unmake_menu
-            call RCreateMenuItem("nvi", 'Command.Search\ forward\ (SyncTeX)', 'RSyncFor', 'gp', ':call SyncTeX_forward()')
-            call RCreateMenuItem("nvi", 'Command.Go\ to\ LaTeX\ (SyncTeX)', 'RSyncTex', 'gt', ':call SyncTeX_forward(1)')
-        endif
-    endif
-    "-------------------------------
-    if &filetype == "r" || g:vimrplugin_never_unmake_menu
-        menu R.Command.-Sep71- 
-        call RCreateMenuItem("nvi", 'Command.Spin\ (cur\ file)', 'RSpinFile', 'ks', ':call RSpin()')
-    endif
-    menu R.Command.-Sep72- 
-    if &filetype == "r" || &filetype == "rnoweb" || g:vimrplugin_never_unmake_menu
-        nmenu  R.Command.Build\ tags\ file\ (cur\ dir):RBuildTags :call g:SendCmdToR('rtags(ofile = "TAGS")')
-        imenu  R.Command.Build\ tags\ file\ (cur\ dir):RBuildTags :call g:SendCmdToR('rtags(ofile = "TAGS")')a
-    endif
-
-    menu R.-Sep7- 
-
-    "----------------------------------------------------------------------------
-    " Edit
-    "----------------------------------------------------------------------------
-    if &filetype == "r" || &filetype == "rnoweb" || &filetype == "rrst" || &filetype == "rhelp" || g:vimrplugin_never_unmake_menu
-        if g:vimrplugin_assign == 1 || g:vimrplugin_assign == 2
-            silent exe 'imenu  R.Edit.Insert\ \"\ <-\ \"' . g:vimrplugin_assign_map . ' :call ReplaceUnderS()a'
-        endif
-        imenu  R.Edit.Complete\ object\ name^X^O 
-        if hasmapto("RCompleteArgs", "i")
-            let boundkey = RIMapCmd("RCompleteArgs")
-            exe "imenu  R.Edit.Complete\\ function\\ arguments" . boundkey . " " . boundkey
-        else
-            imenu  R.Edit.Complete\ function\ arguments^X^A 
-        endif
-        menu R.Edit.-Sep71- 
-        nmenu  R.Edit.Indent\ (line)== ==
-        vmenu  R.Edit.Indent\ (selected\ lines)= =
-        nmenu  R.Edit.Indent\ (whole\ buffer)gg=G gg=G
-        menu R.Edit.-Sep72- 
-        call RCreateMenuItem("ni", 'Edit.Toggle\ comment\ (line/sel)', 'RToggleComment', 'xx', ':call RComment("normal")')
-        call RCreateMenuItem("v", 'Edit.Toggle\ comment\ (line/sel)', 'RToggleComment', 'xx', ':call RComment("selection")')
-        call RCreateMenuItem("ni", 'Edit.Comment\ (line/sel)', 'RSimpleComment', 'xc', ':call RSimpleCommentLine("normal", "c")')
-        call RCreateMenuItem("v", 'Edit.Comment\ (line/sel)', 'RSimpleComment', 'xc', ':call RSimpleCommentLine("selection", "c")')
-        call RCreateMenuItem("ni", 'Edit.Uncomment\ (line/sel)', 'RSimpleUnComment', 'xu', ':call RSimpleCommentLine("normal", "u")')
-        call RCreateMenuItem("v", 'Edit.Uncomment\ (line/sel)', 'RSimpleUnComment', 'xu', ':call RSimpleCommentLine("selection", "u")')
-        call RCreateMenuItem("ni", 'Edit.Add/Align\ right\ comment\ (line,\ sel)', 'RRightComment', ';', ':call MovePosRCodeComment("normal")')
-        call RCreateMenuItem("v", 'Edit.Add/Align\ right\ comment\ (line,\ sel)', 'RRightComment', ';', ':call MovePosRCodeComment("selection")')
-        if &filetype == "rnoweb" || &filetype == "rrst" || &filetype == "rmd" || g:vimrplugin_never_unmake_menu
-            menu R.Edit.-Sep73- 
-            call RCreateMenuItem("n", 'Edit.Go\ (next\ R\ chunk)', 'RNextRChunk', 'gn', ':call b:NextRChunk()')
-            call RCreateMenuItem("n", 'Edit.Go\ (previous\ R\ chunk)', '', 'gN', ':call b:PreviousRChunk()')
-        endif
-    endif
-
-    "----------------------------------------------------------------------------
-    " Object Browser
-    "----------------------------------------------------------------------------
-    call RBrowserMenu()
-
-    "----------------------------------------------------------------------------
-    " Help
-    "----------------------------------------------------------------------------
-    menu R.-Sep8- 
-    amenu R.Help\ (plugin).Overview :help r-plugin-overview
-    amenu R.Help\ (plugin).Main\ features :help r-plugin-features
-    amenu R.Help\ (plugin).Installation :help r-plugin-installation
-    amenu R.Help\ (plugin).Use :help r-plugin-use
-    amenu R.Help\ (plugin).Known\ bugs\ and\ workarounds :help r-plugin-known-bugs
-
-    amenu R.Help\ (plugin).Options.Assignment\ operator\ and\ Rnoweb\ code :help vimrplugin_assign
-    amenu R.Help\ (plugin).Options.Object\ Browser :help vimrplugin_objbr_place
-    amenu R.Help\ (plugin).Options.Vim\ as\ pager\ for\ R\ help :help vimrplugin_vimpager
-    if !(has("gui_win32") || has("gui_win64"))
-        amenu R.Help\ (plugin).Options.Terminal\ emulator :help vimrplugin_term
-    endif
-    if has("gui_macvim") || has("gui_mac") || has("mac") || has("macunix")
-        amenu R.Help\ (plugin).Options.Integration\ with\ Apple\ Script :help vimrplugin_applescript
-    endif
-    if has("gui_win32") || has("gui_win64")
-        amenu R.Help\ (plugin).Options.Use\ 32\ bit\ version\ of\ R :help vimrplugin_i386
-    endif
-    amenu R.Help\ (plugin).Options.R\ path :help vimrplugin_r_path
-    amenu R.Help\ (plugin).Options.Arguments\ to\ R :help vimrplugin_r_args
-    amenu R.Help\ (plugin).Options.Omni\ completion\ when\ R\ not\ running :help vimrplugin_permanent_libs
-    amenu R.Help\ (plugin).Options.Syntax\ highlighting\ of\ \.Rout\ files :help vimrplugin_routmorecolors
-    amenu R.Help\ (plugin).Options.Automatically\ open\ the\ \.Rout\ file :help vimrplugin_routnotab
-    amenu R.Help\ (plugin).Options.Special\ R\ functions :help vimrplugin_listmethods
-    amenu R.Help\ (plugin).Options.Indent\ commented\ lines :help vimrplugin_indent_commented
-    amenu R.Help\ (plugin).Options.LaTeX\ command :help vimrplugin_latexcmd
-    amenu R.Help\ (plugin).Options.Never\ unmake\ the\ R\ menu :help vimrplugin_never_unmake_menu
-
-    amenu R.Help\ (plugin).Custom\ key\ bindings :help r-plugin-key-bindings
-    amenu R.Help\ (plugin).Files :help r-plugin-files
-    amenu R.Help\ (plugin).FAQ\ and\ tips.All\ tips :help r-plugin-tips
-    amenu R.Help\ (plugin).FAQ\ and\ tips.Indenting\ setup :help r-plugin-indenting
-    amenu R.Help\ (plugin).FAQ\ and\ tips.Folding\ setup :help r-plugin-folding
-    amenu R.Help\ (plugin).FAQ\ and\ tips.Remap\ LocalLeader :help r-plugin-localleader
-    amenu R.Help\ (plugin).FAQ\ and\ tips.Customize\ key\ bindings :help r-plugin-bindings
-    amenu R.Help\ (plugin).FAQ\ and\ tips.ShowMarks :help r-plugin-showmarks
-    amenu R.Help\ (plugin).FAQ\ and\ tips.SnipMate :help r-plugin-snippets
-    amenu R.Help\ (plugin).FAQ\ and\ tips.LaTeX-Box :help r-plugin-latex-box
-    amenu R.Help\ (plugin).FAQ\ and\ tips.Highlight\ marks :help r-plugin-showmarks
-    amenu R.Help\ (plugin).FAQ\ and\ tips.Global\ plugin :help r-plugin-global
-    amenu R.Help\ (plugin).FAQ\ and\ tips.Jump\ to\ function\ definitions :help r-plugin-tagsfile
-    amenu R.Help\ (plugin).News :help r-plugin-news
-
-    amenu R.Help\ (R):Rhelp :call g:SendCmdToR("help.start()")
-    amenu R.Configure\ (Vim-R):RpluginConfig :RpluginConfig
-    let g:rplugin_hasmenu = 1
-
-    "----------------------------------------------------------------------------
-    " ToolBar
-    "----------------------------------------------------------------------------
-    if g:rplugin_has_icons
-        " Buttons
-        amenu  ToolBar.RStart :call StartR("R")
-        amenu  ToolBar.RClose :call RQuit('no')
-        "---------------------------
-        if &filetype == "r" || g:vimrplugin_never_unmake_menu
-            nmenu  ToolBar.RSendFile :call SendFileToR("echo")
-            imenu  ToolBar.RSendFile :call SendFileToR("echo")
-            let g:rplugin_hasRSFbutton = 1
-        endif
-        nmenu  ToolBar.RSendBlock :call SendMBlockToR("echo", "down")
-        imenu  ToolBar.RSendBlock :call SendMBlockToR("echo", "down")
-        nmenu  ToolBar.RSendFunction :call SendFunctionToR("echo", "down")
-        imenu  ToolBar.RSendFunction :call SendFunctionToR("echo", "down")
-        vmenu  ToolBar.RSendSelection :call SendSelectionToR("echo", "down")
-        nmenu  ToolBar.RSendParagraph :call SendParagraphToR("echo", "down")
-        imenu  ToolBar.RSendParagraph :call SendParagraphToR("echo", "down")
-        nmenu  ToolBar.RSendLine :call SendLineToR("down")
-        imenu  ToolBar.RSendLine :call SendLineToR("down")
-        "---------------------------
-        nmenu  ToolBar.RListSpace :call g:SendCmdToR("ls()")
-        imenu  ToolBar.RListSpace :call g:SendCmdToR("ls()")
-        nmenu  ToolBar.RClear :call RClearConsole()
-        imenu  ToolBar.RClear :call RClearConsole()
-        nmenu  ToolBar.RClearAll :call RClearAll()
-        imenu  ToolBar.RClearAll :call RClearAll()
-
-        " Hints
-        tmenu ToolBar.RStart Start R (default)
-        tmenu ToolBar.RClose Close R (no save)
-        if &filetype == "r" || g:vimrplugin_never_unmake_menu
-            tmenu ToolBar.RSendFile Send file (echo)
-        endif
-        tmenu ToolBar.RSendBlock Send block (cur, echo and down)
-        tmenu ToolBar.RSendFunction Send function (cur, echo and down)
-        tmenu ToolBar.RSendSelection Send selection (cur, echo and down)
-        tmenu ToolBar.RSendParagraph Send paragraph (cur, echo and down)
-        tmenu ToolBar.RSendLine Send line (cur and down)
-        tmenu ToolBar.RListSpace List objects
-        tmenu ToolBar.RClear Clear the console screen
-        tmenu ToolBar.RClearAll Remove objects from workspace and clear the console screen
-        let g:rplugin_hasbuttons = 1
-    else
-        let g:rplugin_hasbuttons = 0
-    endif
-endfunction
-
-function UnMakeRMenu()
-    if g:rplugin_hasmenu == 0 || g:vimrplugin_never_unmake_menu == 1 || &previewwindow || (&buftype == "nofile" && &filetype != "rbrowser")
-        return
-    endif
-    aunmenu R
-    let g:rplugin_hasmenu = 0
-    if g:rplugin_hasbuttons
-        aunmenu ToolBar.RClearAll
-        aunmenu ToolBar.RClear
-        aunmenu ToolBar.RListSpace
-        aunmenu ToolBar.RSendLine
-        aunmenu ToolBar.RSendSelection
-        aunmenu ToolBar.RSendParagraph
-        aunmenu ToolBar.RSendFunction
-        aunmenu ToolBar.RSendBlock
-        if g:rplugin_hasRSFbutton
-            aunmenu ToolBar.RSendFile
-            let g:rplugin_hasRSFbutton = 0
-        endif
-        aunmenu ToolBar.RClose
-        aunmenu ToolBar.RStart
-        let g:rplugin_hasbuttons = 0
-    endif
-endfunction
-
 
 function SpaceForRGrDevice()
     let savesb = &switchbuf
@@ -3901,13 +3208,6 @@ call RSetDefaultValue("g:vimrplugin_objbr_w",          40)
 call RSetDefaultValue("g:vimrplugin_external_ob",       0)
 call RSetDefaultValue("g:vimrplugin_libcall_send",      1)
 call RSetDefaultValue("g:vimrplugin_i386",              0)
-if has("win32")
-    if has("win64")
-        let g:vimrplugin_i386 = 0
-    else
-        let g:vimrplugin_i386 = 1
-    endif
-endif
 if has("nvim")
     call RSetDefaultValue("g:vimrplugin_r_in_buffer",   0)
 else
@@ -3991,20 +3291,6 @@ function SendToVimCom_Vim(...)
     endif
 endfunction
 
-function SendToVimCom_Neovim(...)
-    if g:rplugin_clt_job == 0
-        call RWarningMsg("VimCom client not running.")
-        return
-    endif
-    call jobsend(g:rplugin_clt_job, a:1 . "\n")
-endfunction
-
-if has("nvim")
-    let g:SendToVimCom = function("SendToVimCom_Neovim")
-else
-    let g:SendToVimCom = function("SendToVimCom_Vim")
-endif
-
 
 " ^K (\013) cleans from cursor to the right and ^U (\025) cleans from cursor
 " to the left. However, ^U causes a beep if there is nothing to clean. The
@@ -4020,10 +3306,6 @@ if has('gui_running')
     let g:rplugin_do_tmux_split = 0
 endif
 
-if has("win32") || has("win64")
-    let g:vimrplugin_applescript = 0
-endif
-
 if has("gui_macvim") || has("gui_mac") || has("mac") || has("macunix")
     let g:rplugin_r64app = 0
     if isdirectory("/Applications/R64.app")
@@ -4055,23 +3337,6 @@ else
 endif
 
 
-" ========================================================================
-" Set function open/close lists in Object Browser
-
-if g:rplugin_do_tmux_split
-    if &filetype == "rbrowser"
-        let g:RBrOpenCloseLs = function("RBrOpenCloseLs_TmuxOB")
-    else
-        if has("nvim")
-            let g:RBrOpenCloseLs = function("RBrOpenCloseLs_TmuxNeovim")
-        else
-            let g:RBrOpenCloseLs = function("RBrOpenCloseLs_TmuxVim")
-        endif
-    endif
-else
-    let g:RBrOpenCloseLs = function("RBrOpenCloseLs_Vim")
-endif
-
 " ========================================================================
 
 if g:vimrplugin_external_ob == 1
@@ -4112,77 +3377,6 @@ endif
 " Start with an empty list of objects in the workspace
 let g:rplugin_globalenvlines = []
 
-if has("win32") || has("win64")
-    if g:vimrplugin_Rterm
-        let b:rplugin_R = "Rgui.exe"
-    else
-        let b:rplugin_R = "Rterm.exe"
-    endif
-    if !exists("g:rplugin_rpathadded")
-        if exists("g:vimrplugin_r_path")
-            if !isdirectory(g:vimrplugin_r_path)
-                call RWarningMsgInp("vimrplugin_r_path must be a directory (check your vimrc)")
-                let g:rplugin_failed = 1
-                finish
-            endif
-            if !filereadable(g:vimrplugin_r_path . "\\Rgui.exe")
-                call RWarningMsgInp('File "' . g:vimrplugin_r_path . '\Rgui.exe" is unreadable (check vimrplugin_r_path in your vimrc).')
-                let g:rplugin_failed = 1
-                finish
-            endif
-            let $PATH = g:vimrplugin_r_path . ";" . $PATH
-            let g:rplugin_Rgui = g:vimrplugin_r_path . "\\Rgui.exe"
-        else
-            let rip = filter(split(system('reg.exe QUERY "HKLM\SOFTWARE\R-core\R" /s'), "\n"), 'v:val =~ ".*InstallPath.*REG_SZ"')
-            let g:rdebug_reg_rpath_1 = rip
-            if len(rip) > 0
-                let s:rinstallpath = substitute(rip[0], '.*InstallPath.*REG_SZ\s*', '', '')
-                let s:rinstallpath = substitute(s:rinstallpath, '\n', '', 'g')
-                let s:rinstallpath = substitute(s:rinstallpath, '\s*$', '', 'g')
-                let g:rdebug_reg_rpath_2 = s:rinstallpath
-            endif
-
-            if !exists("s:rinstallpath")
-                call RWarningMsgInp("Could not find R path in Windows Registry. If you have already installed R, please, set the value of 'vimrplugin_r_path'.")
-                let g:rplugin_failed = 1
-                finish
-            endif
-            if isdirectory(s:rinstallpath . '\bin\i386')
-                if !isdirectory(s:rinstallpath . '\bin\x64')
-                    let g:vimrplugin_i386 = 1
-                endif
-                if g:vimrplugin_i386
-                    let $PATH = s:rinstallpath . '\bin\i386;' . $PATH
-                    let g:rplugin_Rgui = s:rinstallpath . '\bin\i386\Rgui.exe'
-                else
-                    let $PATH = s:rinstallpath . '\bin\x64;' . $PATH
-                    let g:rplugin_Rgui = s:rinstallpath . '\bin\x64\Rgui.exe'
-                endif
-            else
-                let $PATH = s:rinstallpath . '\bin;' . $PATH
-                let g:rplugin_Rgui = s:rinstallpath . '\bin\Rgui.exe'
-            endif
-            unlet s:rinstallpath
-        endif
-        let g:rplugin_rpathadded = 1
-    endif
-    let g:vimrplugin_term_cmd = "none"
-    let g:vimrplugin_term = "none"
-    if !exists("g:vimrplugin_r_args")
-        let g:vimrplugin_r_args = "--sdi"
-    endif
-    if g:vimrplugin_Rterm
-        let g:rplugin_Rgui = substitute(g:rplugin_Rgui, "Rgui", "Rterm", "")
-    endif
-    if !exists("g:vimrplugin_R_window_title")
-        if g:vimrplugin_Rterm
-            let g:vimrplugin_R_window_title = "Rterm"
-        else
-            let g:vimrplugin_R_window_title = "R Console"
-        endif
-    endif
-endif
-
 " Are we in a Debian package? Is the plugin running for the first time?
 let g:rplugin_omnidname = g:rplugin_uservimfiles . "/r-plugin/objlist/"
 if g:rplugin_home != g:rplugin_uservimfiles
@@ -4320,7 +3514,6 @@ let g:rplugin_lastev = ""
 let g:rplugin_last_r_prompt = ""
 let g:rplugin_hasRSFbutton = 0
 let g:rplugin_tmuxsname = "VimR-" . substitute(localtime(), '.*\(...\)', '\1', '')
-let g:rplugin_python_initialized = 0
 
 " SyncTeX options
 let g:rplugin_has_wmctrl = 0
@@ -4373,7 +3566,6 @@ if &filetype != "rbrowser"
     call writefile([], $VIMRPLUGIN_TMPDIR . "/GlobalEnvList_" . $VIMINSTANCEID)
 endif
 
-call SetRPath()
 
 " Keeps the names object list in memory to avoid the need of reading the files
 " repeatedly:
@@ -4384,27 +3576,19 @@ for lib in g:rplugin_libls
     call RAddToLibList(lib, 0)
 endfor
 
-" Check whether tool bar icons exist
 if has("win32") || has("win64")
+    runtime r-plugin/windows.vim
     let g:rplugin_has_icons = len(globpath(&rtp, "bitmaps/RStart.bmp")) > 0
 else
+    call SetRPath()
     let g:rplugin_has_icons = len(globpath(&rtp, "bitmaps/RStart.png")) > 0
 endif
-
-" Check whether the user has the vimcom.plus string in the Rprofile
-if filereadable(expand("~/.Rprofile"))
-    let s:rpf = expand("~/.Rprofile")
-elseif filereadable(expand("~/Documents/.Rprofile"))
-    let s:rpf = expand("~/Documents/.Rprofile")
+if has("gui_running")
+    runtime r-plugin/gui_running.vim
 endif
-if exists("s:rpf")
-    let s:rplines = readfile(s:rpf)
-    for line in s:rplines
-        if line =~ "library\.*vimcom.plus" || line =~ "require.*vimcom\.plus"
-            call RWarningMsgInp('The string "vimcom.plus" was found in "' . s:rpf . '". However, the package "vimcom.plus" no longer exists, and you should rename it to "vimcom" in your Rprofile.')
-            break
-        endif
-    endfor
-    unlet s:rpf
+if g:vimrplugin_applescript
+    runtime r-plugin/osx.vim
+endif
+if has("nvim")
+    runtime r-plugin/nvimbuffer.vim
 endif
-
diff --git a/r-plugin/gui_running.vim b/r-plugin/gui_running.vim
new file mode 100644
index 0000000..da34a63
--- /dev/null
+++ b/r-plugin/gui_running.vim
@@ -0,0 +1,311 @@
+" This file contains code used only if has("gui_running")
+
+if exists("g:did_r_plugin_gui_running")
+    finish
+endif
+let g:did_r_plugin_gui_running = 1
+
+function MakeRMenu()
+    if g:rplugin_hasmenu == 1
+        return
+    endif
+
+    " Do not translate "File":
+    menutranslate clear
+
+    "----------------------------------------------------------------------------
+    " Start/Close
+    "----------------------------------------------------------------------------
+    call RCreateMenuItem("nvi", 'Start/Close.Start\ R\ (default)', 'RStart', 'rf', ':call StartR("R")')
+    call RCreateMenuItem("nvi", 'Start/Close.Start\ R\ --vanilla', 'RVanillaStart', 'rv', ':call StartR("vanilla")')
+    call RCreateMenuItem("nvi", 'Start/Close.Start\ R\ (custom)', 'RCustomStart', 'rc', ':call StartR("custom")')
+    "-------------------------------
+    menu R.Start/Close.-Sep1- 
+    call RCreateMenuItem("nvi", 'Start/Close.Close\ R\ (no\ save)', 'RClose', 'rq', ":call RQuit('no')")
+    menu R.Start/Close.-Sep2- 
+
+    nmenu  R.Start/Close.Stop\ R:RStop :RStop
+
+    "----------------------------------------------------------------------------
+    " Send
+    "----------------------------------------------------------------------------
+    if &filetype == "r" || g:vimrplugin_never_unmake_menu
+        call RCreateMenuItem("ni", 'Send.File', 'RSendFile', 'aa', ':call SendFileToR("silent")')
+        call RCreateMenuItem("ni", 'Send.File\ (echo)', 'RESendFile', 'ae', ':call SendFileToR("echo")')
+        call RCreateMenuItem("ni", 'Send.File\ (open\ \.Rout)', 'RShowRout', 'ao', ':call ShowRout()')
+    endif
+    "-------------------------------
+    menu R.Send.-Sep1- 
+    call RCreateMenuItem("ni", 'Send.Block\ (cur)', 'RSendMBlock', 'bb', ':call SendMBlockToR("silent", "stay")')
+    call RCreateMenuItem("ni", 'Send.Block\ (cur,\ echo)', 'RESendMBlock', 'be', ':call SendMBlockToR("echo", "stay")')
+    call RCreateMenuItem("ni", 'Send.Block\ (cur,\ down)', 'RDSendMBlock', 'bd', ':call SendMBlockToR("silent", "down")')
+    call RCreateMenuItem("ni", 'Send.Block\ (cur,\ echo\ and\ down)', 'REDSendMBlock', 'ba', ':call SendMBlockToR("echo", "down")')
+    "-------------------------------
+    if &filetype == "rnoweb" || &filetype == "rmd" || &filetype == "rrst" || g:vimrplugin_never_unmake_menu
+        menu R.Send.-Sep2- 
+        call RCreateMenuItem("ni", 'Send.Chunk\ (cur)', 'RSendChunk', 'cc', ':call b:SendChunkToR("silent", "stay")')
+        call RCreateMenuItem("ni", 'Send.Chunk\ (cur,\ echo)', 'RESendChunk', 'ce', ':call b:SendChunkToR("echo", "stay")')
+        call RCreateMenuItem("ni", 'Send.Chunk\ (cur,\ down)', 'RDSendChunk', 'cd', ':call b:SendChunkToR("silent", "down")')
+        call RCreateMenuItem("ni", 'Send.Chunk\ (cur,\ echo\ and\ down)', 'REDSendChunk', 'ca', ':call b:SendChunkToR("echo", "down")')
+        call RCreateMenuItem("ni", 'Send.Chunk\ (from\ first\ to\ here)', 'RSendChunkFH', 'ch', ':call SendFHChunkToR()')
+    endif
+    "-------------------------------
+    menu R.Send.-Sep3- 
+    call RCreateMenuItem("ni", 'Send.Function\ (cur)', 'RSendFunction', 'ff', ':call SendFunctionToR("silent", "stay")')
+    call RCreateMenuItem("ni", 'Send.Function\ (cur,\ echo)', 'RESendFunction', 'fe', ':call SendFunctionToR("echo", "stay")')
+    call RCreateMenuItem("ni", 'Send.Function\ (cur\ and\ down)', 'RDSendFunction', 'fd', ':call SendFunctionToR("silent", "down")')
+    call RCreateMenuItem("ni", 'Send.Function\ (cur,\ echo\ and\ down)', 'REDSendFunction', 'fa', ':call SendFunctionToR("echo", "down")')
+    "-------------------------------
+    menu R.Send.-Sep4- 
+    call RCreateMenuItem("v", 'Send.Selection', 'RSendSelection', 'ss', ':call SendSelectionToR("silent", "stay")')
+    call RCreateMenuItem("v", 'Send.Selection\ (echo)', 'RESendSelection', 'se', ':call SendSelectionToR("echo", "stay")')
+    call RCreateMenuItem("v", 'Send.Selection\ (and\ down)', 'RDSendSelection', 'sd', ':call SendSelectionToR("silent", "down")')
+    call RCreateMenuItem("v", 'Send.Selection\ (echo\ and\ down)', 'REDSendSelection', 'sa', ':call SendSelectionToR("echo", "down")')
+    "-------------------------------
+    menu R.Send.-Sep5- 
+    call RCreateMenuItem("ni", 'Send.Paragraph', 'RSendParagraph', 'pp', ':call SendParagraphToR("silent", "stay")')
+    call RCreateMenuItem("ni", 'Send.Paragraph\ (echo)', 'RESendParagraph', 'pe', ':call SendParagraphToR("echo", "stay")')
+    call RCreateMenuItem("ni", 'Send.Paragraph\ (and\ down)', 'RDSendParagraph', 'pd', ':call SendParagraphToR("silent", "down")')
+    call RCreateMenuItem("ni", 'Send.Paragraph\ (echo\ and\ down)', 'REDSendParagraph', 'pa', ':call SendParagraphToR("echo", "down")')
+    "-------------------------------
+    menu R.Send.-Sep6- 
+    call RCreateMenuItem("ni0", 'Send.Line', 'RSendLine', 'l', ':call SendLineToR("stay")')
+    call RCreateMenuItem("ni0", 'Send.Line\ (and\ down)', 'RDSendLine', 'd', ':call SendLineToR("down")')
+    call RCreateMenuItem("ni0", 'Send.Line\ (and\ insert\ output)', 'RDSendLineAndInsertOutput', 'o', ':call SendLineToRAndInsertOutput()')
+    call RCreateMenuItem("i", 'Send.Line\ (and\ new\ one)', 'RSendLAndOpenNewOne', 'q', ':call SendLineToR("newline")')
+    call RCreateMenuItem("n", 'Send.Left\ part\ of\ line\ (cur)', 'RNLeftPart', 'r', ':call RSendPartOfLine("left", 0)')
+    call RCreateMenuItem("n", 'Send.Right\ part\ of\ line\ (cur)', 'RNRightPart', 'r', ':call RSendPartOfLine("right", 0)')
+    call RCreateMenuItem("i", 'Send.Left\ part\ of\ line\ (cur)', 'RILeftPart', 'r', 'l:call RSendPartOfLine("left", 1)')
+    call RCreateMenuItem("i", 'Send.Right\ part\ of\ line\ (cur)', 'RIRightPart', 'r', 'l:call RSendPartOfLine("right", 1)')
+
+    "----------------------------------------------------------------------------
+    " Control
+    "----------------------------------------------------------------------------
+    call RControlMenu()
+    "-------------------------------
+    menu R.Command.-Sep4- 
+    if &filetype != "rdoc"
+        call RCreateMenuItem("nvi", 'Command.Set\ working\ directory\ (cur\ file\ path)', 'RSetwd', 'rd', ':call RSetWD()')
+    endif
+    "-------------------------------
+    if &filetype == "rnoweb" || &filetype == "rmd" || &filetype == "rrst" || g:vimrplugin_never_unmake_menu
+        if &filetype == "rnoweb" || g:vimrplugin_never_unmake_menu
+            menu R.Command.-Sep5- 
+            call RCreateMenuItem("nvi", 'Command.Sweave\ (cur\ file)', 'RSweave', 'sw', ':call RSweave()')
+            call RCreateMenuItem("nvi", 'Command.Sweave\ and\ PDF\ (cur\ file)', 'RMakePDF', 'sp', ':call RMakePDF("nobib", 0)')
+            if has("win32") || has("win64")
+                call RCreateMenuItem("nvi", 'Command.Sweave\ and\ PDF\ (cur\ file,\ verbose)', 'RMakePDF', 'sv', ':call RMakePDF("verbose", 0)')
+            else
+                call RCreateMenuItem("nvi", 'Command.Sweave,\ BibTeX\ and\ PDF\ (cur\ file)', 'RBibTeX', 'sb', ':call RMakePDF("bibtex", 0)')
+            endif
+        endif
+        menu R.Command.-Sep6- 
+        if &filetype == "rnoweb"
+            call RCreateMenuItem("nvi", 'Command.Knit\ (cur\ file)', 'RKnit', 'kn', ':call RKnitRnw()')
+        else
+            call RCreateMenuItem("nvi", 'Command.Knit\ (cur\ file)', 'RKnit', 'kn', ':call RKnit()')
+        endif
+        if &filetype == "rnoweb" || g:vimrplugin_never_unmake_menu
+            call RCreateMenuItem("nvi", 'Command.Knit\ and\ PDF\ (cur\ file)', 'RMakePDFK', 'kp', ':call RMakePDF("nobib", 1)')
+            if has("win32") || has("win64")
+                call RCreateMenuItem("nvi", 'Command.Knit\ and\ PDF\ (cur\ file,\ verbose)', 'RMakePDFKv', 'kv', ':call RMakePDF("verbose", 1)')
+            else
+                call RCreateMenuItem("nvi", 'Command.Knit,\ BibTeX\ and\ PDF\ (cur\ file)', 'RBibTeXK', 'kb', ':call RMakePDF("bibtex", 1)')
+            endif
+        endif
+        if &filetype == "rmd" || g:vimrplugin_never_unmake_menu
+            call RCreateMenuItem("nvi", 'Command.Knit\ and\ PDF\ (cur\ file)', 'RMakePDFK', 'kp', ':call RMakeRmd("pdf")')
+            call RCreateMenuItem("nvi", 'Command.Knit\ and\ Beamer\ PDF\ (cur\ file)', 'RMakePDFKb', 'kl', ':call RMakeRmd("beamer")')
+            call RCreateMenuItem("nvi", 'Command.Knit\ and\ HTML\ (cur\ file)', 'RMakeHTML', 'kh', ':call RMakeRmd("html")')
+            call RCreateMenuItem("nvi", 'Command.Knit\ and\ ODT\ (cur\ file)', 'RMakeODT', 'ko', ':call RMakeRmd("odt")')
+        endif
+        if &filetype == "rrst" || g:vimrplugin_never_unmake_menu
+            call RCreateMenuItem("nvi", 'Command.Knit\ and\ PDF\ (cur\ file)', 'RMakePDFK', 'kp', ':call RMakePDFrrst()')
+            call RCreateMenuItem("nvi", 'Command.Knit\ and\ HTML\ (cur\ file)', 'RMakeHTML', 'kh', ':call RMakeHTMLrrst("html")')
+            call RCreateMenuItem("nvi", 'Command.Knit\ and\ ODT\ (cur\ file)', 'RMakeODT', 'ko', ':call RMakeHTMLrrst("odt")')
+        endif
+        menu R.Command.-Sep61- 
+        call RCreateMenuItem("nvi", 'Command.Open\ PDF\ (cur\ file)', 'ROpenPDF', 'op', ':call ROpenPDF("Get Master")')
+        if ($DISPLAY != "" && g:vimrplugin_synctex && &filetype == "rnoweb") || g:vimrplugin_never_unmake_menu
+            call RCreateMenuItem("nvi", 'Command.Search\ forward\ (SyncTeX)', 'RSyncFor', 'gp', ':call SyncTeX_forward()')
+            call RCreateMenuItem("nvi", 'Command.Go\ to\ LaTeX\ (SyncTeX)', 'RSyncTex', 'gt', ':call SyncTeX_forward(1)')
+        endif
+    endif
+    "-------------------------------
+    if &filetype == "r" || g:vimrplugin_never_unmake_menu
+        menu R.Command.-Sep71- 
+        call RCreateMenuItem("nvi", 'Command.Spin\ (cur\ file)', 'RSpinFile', 'ks', ':call RSpin()')
+    endif
+    menu R.Command.-Sep72- 
+    if &filetype == "r" || &filetype == "rnoweb" || g:vimrplugin_never_unmake_menu
+        nmenu  R.Command.Build\ tags\ file\ (cur\ dir):RBuildTags :call g:SendCmdToR('rtags(ofile = "TAGS")')
+        imenu  R.Command.Build\ tags\ file\ (cur\ dir):RBuildTags :call g:SendCmdToR('rtags(ofile = "TAGS")')a
+    endif
+
+    menu R.-Sep7- 
+
+    "----------------------------------------------------------------------------
+    " Edit
+    "----------------------------------------------------------------------------
+    if &filetype == "r" || &filetype == "rnoweb" || &filetype == "rrst" || &filetype == "rhelp" || g:vimrplugin_never_unmake_menu
+        if g:vimrplugin_assign == 1 || g:vimrplugin_assign == 2
+            silent exe 'imenu  R.Edit.Insert\ \"\ <-\ \"' . g:vimrplugin_assign_map . ' :call ReplaceUnderS()a'
+        endif
+        imenu  R.Edit.Complete\ object\ name^X^O 
+        if hasmapto("RCompleteArgs", "i")
+            let boundkey = RIMapCmd("RCompleteArgs")
+            exe "imenu  R.Edit.Complete\\ function\\ arguments" . boundkey . " " . boundkey
+        else
+            imenu  R.Edit.Complete\ function\ arguments^X^A 
+        endif
+        menu R.Edit.-Sep71- 
+        nmenu  R.Edit.Indent\ (line)== ==
+        vmenu  R.Edit.Indent\ (selected\ lines)= =
+        nmenu  R.Edit.Indent\ (whole\ buffer)gg=G gg=G
+        menu R.Edit.-Sep72- 
+        call RCreateMenuItem("ni", 'Edit.Toggle\ comment\ (line/sel)', 'RToggleComment', 'xx', ':call RComment("normal")')
+        call RCreateMenuItem("v", 'Edit.Toggle\ comment\ (line/sel)', 'RToggleComment', 'xx', ':call RComment("selection")')
+        call RCreateMenuItem("ni", 'Edit.Comment\ (line/sel)', 'RSimpleComment', 'xc', ':call RSimpleCommentLine("normal", "c")')
+        call RCreateMenuItem("v", 'Edit.Comment\ (line/sel)', 'RSimpleComment', 'xc', ':call RSimpleCommentLine("selection", "c")')
+        call RCreateMenuItem("ni", 'Edit.Uncomment\ (line/sel)', 'RSimpleUnComment', 'xu', ':call RSimpleCommentLine("normal", "u")')
+        call RCreateMenuItem("v", 'Edit.Uncomment\ (line/sel)', 'RSimpleUnComment', 'xu', ':call RSimpleCommentLine("selection", "u")')
+        call RCreateMenuItem("ni", 'Edit.Add/Align\ right\ comment\ (line,\ sel)', 'RRightComment', ';', ':call MovePosRCodeComment("normal")')
+        call RCreateMenuItem("v", 'Edit.Add/Align\ right\ comment\ (line,\ sel)', 'RRightComment', ';', ':call MovePosRCodeComment("selection")')
+        if &filetype == "rnoweb" || &filetype == "rrst" || &filetype == "rmd" || g:vimrplugin_never_unmake_menu
+            menu R.Edit.-Sep73- 
+            call RCreateMenuItem("n", 'Edit.Go\ (next\ R\ chunk)', 'RNextRChunk', 'gn', ':call b:NextRChunk()')
+            call RCreateMenuItem("n", 'Edit.Go\ (previous\ R\ chunk)', '', 'gN', ':call b:PreviousRChunk()')
+        endif
+    endif
+
+    "----------------------------------------------------------------------------
+    " Object Browser
+    "----------------------------------------------------------------------------
+    call RBrowserMenu()
+
+    "----------------------------------------------------------------------------
+    " Help
+    "----------------------------------------------------------------------------
+    menu R.-Sep8- 
+    amenu R.Help\ (plugin).Overview :help r-plugin-overview
+    amenu R.Help\ (plugin).Main\ features :help r-plugin-features
+    amenu R.Help\ (plugin).Installation :help r-plugin-installation
+    amenu R.Help\ (plugin).Use :help r-plugin-use
+    amenu R.Help\ (plugin).Known\ bugs\ and\ workarounds :help r-plugin-known-bugs
+
+    amenu R.Help\ (plugin).Options.Assignment\ operator\ and\ Rnoweb\ code :help vimrplugin_assign
+    amenu R.Help\ (plugin).Options.Object\ Browser :help vimrplugin_objbr_place
+    amenu R.Help\ (plugin).Options.Vim\ as\ pager\ for\ R\ help :help vimrplugin_vimpager
+    if !(has("gui_win32") || has("gui_win64"))
+        amenu R.Help\ (plugin).Options.Terminal\ emulator :help vimrplugin_term
+    endif
+    if has("gui_macvim") || has("gui_mac") || has("mac") || has("macunix")
+        amenu R.Help\ (plugin).Options.Integration\ with\ Apple\ Script :help vimrplugin_applescript
+    endif
+    if has("gui_win32") || has("gui_win64")
+        amenu R.Help\ (plugin).Options.Use\ 32\ bit\ version\ of\ R :help vimrplugin_i386
+    endif
+    amenu R.Help\ (plugin).Options.R\ path :help vimrplugin_r_path
+    amenu R.Help\ (plugin).Options.Arguments\ to\ R :help vimrplugin_r_args
+    amenu R.Help\ (plugin).Options.Omni\ completion\ when\ R\ not\ running :help vimrplugin_permanent_libs
+    amenu R.Help\ (plugin).Options.Syntax\ highlighting\ of\ \.Rout\ files :help vimrplugin_routmorecolors
+    amenu R.Help\ (plugin).Options.Automatically\ open\ the\ \.Rout\ file :help vimrplugin_routnotab
+    amenu R.Help\ (plugin).Options.Special\ R\ functions :help vimrplugin_listmethods
+    amenu R.Help\ (plugin).Options.Indent\ commented\ lines :help vimrplugin_indent_commented
+    amenu R.Help\ (plugin).Options.LaTeX\ command :help vimrplugin_latexcmd
+    amenu R.Help\ (plugin).Options.Never\ unmake\ the\ R\ menu :help vimrplugin_never_unmake_menu
+
+    amenu R.Help\ (plugin).Custom\ key\ bindings :help r-plugin-key-bindings
+    amenu R.Help\ (plugin).Files :help r-plugin-files
+    amenu R.Help\ (plugin).FAQ\ and\ tips.All\ tips :help r-plugin-tips
+    amenu R.Help\ (plugin).FAQ\ and\ tips.Indenting\ setup :help r-plugin-indenting
+    amenu R.Help\ (plugin).FAQ\ and\ tips.Folding\ setup :help r-plugin-folding
+    amenu R.Help\ (plugin).FAQ\ and\ tips.Remap\ LocalLeader :help r-plugin-localleader
+    amenu R.Help\ (plugin).FAQ\ and\ tips.Customize\ key\ bindings :help r-plugin-bindings
+    amenu R.Help\ (plugin).FAQ\ and\ tips.ShowMarks :help r-plugin-showmarks
+    amenu R.Help\ (plugin).FAQ\ and\ tips.SnipMate :help r-plugin-snippets
+    amenu R.Help\ (plugin).FAQ\ and\ tips.LaTeX-Box :help r-plugin-latex-box
+    amenu R.Help\ (plugin).FAQ\ and\ tips.Highlight\ marks :help r-plugin-showmarks
+    amenu R.Help\ (plugin).FAQ\ and\ tips.Global\ plugin :help r-plugin-global
+    amenu R.Help\ (plugin).FAQ\ and\ tips.Jump\ to\ function\ definitions :help r-plugin-tagsfile
+    amenu R.Help\ (plugin).News :help r-plugin-news
+
+    amenu R.Help\ (R):Rhelp :call g:SendCmdToR("help.start()")
+    amenu R.Configure\ (Vim-R):RpluginConfig :RpluginConfig
+    let g:rplugin_hasmenu = 1
+
+    "----------------------------------------------------------------------------
+    " ToolBar
+    "----------------------------------------------------------------------------
+    if g:rplugin_has_icons
+        " Buttons
+        amenu  ToolBar.RStart :call StartR("R")
+        amenu  ToolBar.RClose :call RQuit('no')
+        "---------------------------
+        if &filetype == "r" || g:vimrplugin_never_unmake_menu
+            nmenu  ToolBar.RSendFile :call SendFileToR("echo")
+            imenu  ToolBar.RSendFile :call SendFileToR("echo")
+            let g:rplugin_hasRSFbutton = 1
+        endif
+        nmenu  ToolBar.RSendBlock :call SendMBlockToR("echo", "down")
+        imenu  ToolBar.RSendBlock :call SendMBlockToR("echo", "down")
+        nmenu  ToolBar.RSendFunction :call SendFunctionToR("echo", "down")
+        imenu  ToolBar.RSendFunction :call SendFunctionToR("echo", "down")
+        vmenu  ToolBar.RSendSelection :call SendSelectionToR("echo", "down")
+        nmenu  ToolBar.RSendParagraph :call SendParagraphToR("echo", "down")
+        imenu  ToolBar.RSendParagraph :call SendParagraphToR("echo", "down")
+        nmenu  ToolBar.RSendLine :call SendLineToR("down")
+        imenu  ToolBar.RSendLine :call SendLineToR("down")
+        "---------------------------
+        nmenu  ToolBar.RListSpace :call g:SendCmdToR("ls()")
+        imenu  ToolBar.RListSpace :call g:SendCmdToR("ls()")
+        nmenu  ToolBar.RClear :call RClearConsole()
+        imenu  ToolBar.RClear :call RClearConsole()
+        nmenu  ToolBar.RClearAll :call RClearAll()
+        imenu  ToolBar.RClearAll :call RClearAll()
+
+        " Hints
+        tmenu ToolBar.RStart Start R (default)
+        tmenu ToolBar.RClose Close R (no save)
+        if &filetype == "r" || g:vimrplugin_never_unmake_menu
+            tmenu ToolBar.RSendFile Send file (echo)
+        endif
+        tmenu ToolBar.RSendBlock Send block (cur, echo and down)
+        tmenu ToolBar.RSendFunction Send function (cur, echo and down)
+        tmenu ToolBar.RSendSelection Send selection (cur, echo and down)
+        tmenu ToolBar.RSendParagraph Send paragraph (cur, echo and down)
+        tmenu ToolBar.RSendLine Send line (cur and down)
+        tmenu ToolBar.RListSpace List objects
+        tmenu ToolBar.RClear Clear the console screen
+        tmenu ToolBar.RClearAll Remove objects from workspace and clear the console screen
+        let g:rplugin_hasbuttons = 1
+    else
+        let g:rplugin_hasbuttons = 0
+    endif
+endfunction
+
+function UnMakeRMenu()
+    if g:rplugin_hasmenu == 0 || g:vimrplugin_never_unmake_menu == 1 || &previewwindow || (&buftype == "nofile" && &filetype != "rbrowser")
+        return
+    endif
+    aunmenu R
+    let g:rplugin_hasmenu = 0
+    if g:rplugin_hasbuttons
+        aunmenu ToolBar.RClearAll
+        aunmenu ToolBar.RClear
+        aunmenu ToolBar.RListSpace
+        aunmenu ToolBar.RSendLine
+        aunmenu ToolBar.RSendSelection
+        aunmenu ToolBar.RSendParagraph
+        aunmenu ToolBar.RSendFunction
+        aunmenu ToolBar.RSendBlock
+        if g:rplugin_hasRSFbutton
+            aunmenu ToolBar.RSendFile
+            let g:rplugin_hasRSFbutton = 0
+        endif
+        aunmenu ToolBar.RClose
+        aunmenu ToolBar.RStart
+        let g:rplugin_hasbuttons = 0
+    endif
+endfunction
+
diff --git a/r-plugin/nvimbuffer.vim b/r-plugin/nvimbuffer.vim
new file mode 100644
index 0000000..84b0322
--- /dev/null
+++ b/r-plugin/nvimbuffer.vim
@@ -0,0 +1,270 @@
+" This file contains code used only by Neovim
+
+" For debugging
+let g:lastjobdata = []
+
+function GetRActivity()
+    if v:job_data[1] == 'stdout' || v:job_data[1] == 'stderr'
+        let g:lastjobdata += [v:job_data[2]]
+        let edbuf = bufname("%")
+        if edbuf == "R_Output"
+            let isrout = 1
+        else
+            let isrout = 0
+            sbuffer R_Output
+        endif
+
+        " Newline at the beginning disappears after split(). Put it now:
+        if v:job_data[2] =~ "^\x0a"
+            call append("$", "")
+            let g:rplugin_last_r_prompt = ""
+        endif
+
+        " Fix DOS end of line
+        let outstr = substitute(v:job_data[2], "\x0d\x0a", "\x0a", "g")
+
+        let outlst = split(outstr, '\n')
+
+        let lastline = len(outlst) - 1
+        " Newline at the end disappears after split()
+        if v:job_data[2] =~ '\n$'
+            let g:rplugin_last_r_prompt = ""
+            let hasnl = 1
+        else
+            let g:rplugin_last_r_prompt = substitute(outlst[-1], ' *$', '', '')
+            let hasnl = 0
+        endif
+
+        for idx in range(len(outlst))
+            let lin = outlst[idx]
+            " Do carriage return
+            if lin =~ "\x0d"
+                let lin = substitute(lin, ".*\x0d", "", "g")
+                call setline("$", "")
+            endif
+
+            " Prefix ': '  for syntax highlight
+            if v:job_data[1] == 'stderr'
+                let lin = ': ' . lin
+            endif
+
+            " Append characters to current last line
+            call setline("$", getline("$") . lin)
+
+            " Add new line
+            if idx != lastline
+                call append("$", "")
+            endif
+        endfor
+
+        " Add final newline
+        if hasnl
+            call append("$", "")
+        endif
+
+        call cursor("$", 999)
+        if !isrout
+            exe "sbuffer " . edbuf
+        endif
+    else
+        let g:rplugin_rjob = 0
+        let g:rplugin_r_pid = 0
+        let g:SendCmdToR = function('SendCmdToR_fake')
+        if bufname("%") == "R_Output"
+            call append("$", ':    ---  R Finished  ---')
+            call append("$", "")
+            sleep 500m
+            quit
+        endif
+        if mode() == "n"
+            call RWarningMsg("R finished")
+        endif
+    endif
+endfunction
+
+function CompleteFromHistory()
+    if line(".") != line("$")
+        return
+    endif
+
+    let key = substitute(getline("."), '^>', '', '')
+    let key = substitute(key, '^ ', '', '')
+    let key = substitute(key, '^\s*\(.*\)\s*', '\1', '')
+    let histlin = [key]
+    call setline(".", "> ")
+    for lin in g:rplugin_rhistory
+        if lin =~ key
+            let histlin += [lin]
+        endif
+    endfor
+    call complete(3, histlin)
+    return ''
+endfunction
+
+function ShowRhistory()
+    tabnew R_history
+    call setline(".", g:rplugin_rhistory)
+    set ft=r
+endfunction
+
+function AddToRHistory(rcmd)
+    let g:rplugin_rhist_pos += 1
+    let g:rplugin_dyn_rhist_pos = g:rplugin_rhist_pos
+    let g:rplugin_rhistory += [a:rcmd]
+endfunction
+
+function SendCmdToR_Neovim(...)
+    let curbuf = bufname("%")
+    sbuffer R_Output
+    if winwidth(0) != b:winwidth
+        let b:winwidth = winwidth(0)
+        call g:SendToVimCom("\x08" . $VIMINSTANCEID . "options(width=" . b:winwidth . ")", "I")
+    endif
+    if a:0 == 1
+        call setline("$", getline("$") . a:1)
+    endif
+    call append("$", "")
+    call cursor("$", 1)
+    let g:rplugin_addedtohist = 0
+    if a:1 !~ '^base::source('
+        call AddToRHistory(a:1)
+    endif
+    exe "sbuffer " . curbuf
+    let ok = jobsend(g:rplugin_rjob, a:1 . "\n")
+    return ok
+endfunction
+
+function RConsoleArrow(dir)
+    if line(".") != line("$")
+        return
+    endif
+
+    " Check if current last typed line of R_Output is already in history
+    if g:rplugin_addedtohist == 0
+        let lin = substitute(getline("."), '^>', '', '')
+        let lin = substitute(lin, '^ ', '', '')
+        call AddToRHistory(lin)
+        let g:rplugin_addedtohist = 1
+    endif
+
+    if a:dir == "down"
+        let g:rplugin_dyn_rhist_pos += 1
+        if g:rplugin_dyn_rhist_pos > g:rplugin_rhist_pos
+            let g:rplugin_dyn_rhist_pos -= 1
+            return
+        endif
+    else
+        let g:rplugin_dyn_rhist_pos -= 1
+        if g:rplugin_dyn_rhist_pos < 0
+            let g:rplugin_dyn_rhist_pos = 0
+            return
+        endif
+    endif
+    call setline(".", "> " . g:rplugin_rhistory[g:rplugin_dyn_rhist_pos])
+endfunction
+
+function EnterRCmd()
+    if line(".") != line("$")
+        call append(".", "")
+        call cursor(line(".")+1, 1)
+        return
+    endif
+    " First delete the last received prompt:
+    let lin = substitute(getline("."), '^' . g:rplugin_last_r_prompt, '', '')
+    " Now delete one space in the beginning, if there is any:
+    let lin = substitute(lin, '^ ', '', '')
+    call SendCmdToR_Neovim(lin, 0)
+endfunction
+
+function RSetNeovimPort(p)
+    let g:rplugin_myport = a:p
+    if &filetype == "rbrowser" && g:rplugin_do_tmux_split
+        call g:SendToVimCom("\002" . a:p)
+    else
+        call g:SendToVimCom("\001" . a:p)
+    endif
+endfunction
+
+function StartR_Neovim()
+    if string(g:SendCmdToR) != "function('SendCmdToR_fake')"
+        return
+    endif
+    let g:rplugin_do_tmux_split = 0
+
+    let g:SendCmdToR = function('SendCmdToR_Neovim')
+
+    let edbuf = bufname("%")
+    let g:tmp_objbrtitle = b:objbrtitle
+    let g:tmp_curbufname = bufname("%")
+    set switchbuf=useopen
+    if g:vimrplugin_vsplit
+        if g:vimrplugin_rconsole_width > 16 && g:vimrplugin_rconsole_width < (winwidth(0) - 16)
+            silent exe "belowright " . g:vimrplugin_rconsole_width . "vsplit R_Output"
+        else
+            silent belowright vsplit R_Output
+        endif
+    else
+        if g:vimrplugin_rconsole_height > 6 && g:vimrplugin_rconsole_height < (winheight(0) - 6)
+            silent exe "belowright " . g:vimrplugin_rconsole_height . "split R_Output"
+        else
+            silent belowright split R_Output
+        endif
+    endif
+    let b:winwidth = 0
+    set filetype=rout
+    setlocal noswapfile
+    setlocal bufhidden=hide
+    setlocal formatoptions=
+    set buftype=nofile
+    set omnifunc=rcomplete#CompleteR
+    if hasmapto("RCompleteArgs", "i")
+        imap  RCompleteArgs =RCompleteArgs()
+    else
+        imap   =RCompleteArgs()
+    endif
+    let b:objbrtitle = g:tmp_objbrtitle
+    let b:rscript_buffer = g:tmp_curbufname
+    unlet g:tmp_objbrtitle
+    unlet g:tmp_curbufname
+    imap   :call EnterRCmd()A
+    imap   :RStopa
+    imap   :call RConsoleArrow("up")A
+    imap   :call RConsoleArrow("down")A
+    imap   =CompleteFromHistory()
+    call cursor("$", 1)
+    exe "sbuffer " . edbuf
+
+    nmap  :call OpenRScratch()
+
+    let savedterm = $TERM
+    let $TERM="NeovimTerm"
+    let g:rplugin_rjob = jobstart("Rjob", 'R', ['--no-readline', '--interactive'], 'su')
+    exe 'let $TERM="' . savedterm . '"'
+    call WaitVimComStart()
+endfunction
+
+function SendToVimCom_Neovim(...)
+    if g:rplugin_clt_job == 0
+        call RWarningMsg("VimCom client not running.")
+        return
+    endif
+    call jobsend(g:rplugin_clt_job, a:1 . "\n")
+endfunction
+
+function RBrOpenCloseLs_TmuxNeovim(status)
+    " TODO: Discover real value of curview
+    let curview = "GlobalEnv"
+
+    if a:status == 1 && curview == "libraries"
+        if curview == "libraries"
+            echohl WarningMsg
+            echon "GlobalEnv command only."
+            sleep 1
+            echohl Normal
+            normal! :
+            return
+        endif
+    endif
+    call g:SendToVimCom("\007" . a:status)
+endfunction
+
diff --git a/r-plugin/osx.vim b/r-plugin/osx.vim
new file mode 100644
index 0000000..98d8c58
--- /dev/null
+++ b/r-plugin/osx.vim
@@ -0,0 +1,51 @@
+" This file contains code used only on OS X
+
+function StartR_OSX()
+    if IsSendCmdToRFake()
+        return
+    endif
+    if g:rplugin_r64app && g:vimrplugin_i386 == 0
+        let rcmd = "/Applications/R64.app"
+    else
+        let rcmd = "/Applications/R.app"
+    endif
+    if b:rplugin_r_args != " "
+        " https://github.com/jcfaria/Vim-R-plugin/issues/63
+        " https://stat.ethz.ch/pipermail/r-sig-mac/2013-February/009978.html
+        call RWarningMsg('R.app does not support command line arguments. To pass "' . b:rplugin_r_args . '" to R, you must run it in a console. Set "vimrplugin_applescript = 0" (you may need to install XQuartz)')
+    endif
+    let rlog = system("open " . rcmd)
+    if v:shell_error
+        call RWarningMsg(rlog)
+    endif
+    if g:vimrplugin_vim_wd == 0
+        lcd -
+    endif
+    let g:SendCmdToR = function('SendCmdToR_OSX')
+    if WaitVimComStart()
+        call g:SendToVimCom("\005B Update OB [StartR]")
+    endif
+endfunction
+
+function SendCmdToR_OSX(cmd)
+    if g:vimrplugin_ca_ck
+        let cmd = "\001" . "\013" . a:cmd
+    else
+        let cmd = a:cmd
+    endif
+
+    if g:rplugin_r64app && g:vimrplugin_i386 == 0
+        let rcmd = "R64"
+    else
+        let rcmd = "R"
+    endif
+
+    " for some reason it doesn't like "\025"
+    let cmd = a:cmd
+    let cmd = substitute(cmd, "\\", '\\\', 'g')
+    let cmd = substitute(cmd, '"', '\\"', "g")
+    let cmd = substitute(cmd, "'", "'\\\\''", "g")
+    call system("osascript -e 'tell application \"".rcmd."\" to cmd \"" . cmd . "\"'")
+    return 1
+endfunction
+
diff --git a/r-plugin/windows.vim b/r-plugin/windows.vim
new file mode 100644
index 0000000..4d657b5
--- /dev/null
+++ b/r-plugin/windows.vim
@@ -0,0 +1,196 @@
+" This file contains code used only on Windows
+
+let g:rplugin_sumatra_path = ""
+let g:rplugin_python_initialized = 0
+
+" Vim and R must have the same architecture
+if has("win64")
+    let g:vimrplugin_i386 = 0
+else
+    let g:vimrplugin_i386 = 1
+endif
+
+if g:vimrplugin_Rterm
+    let b:rplugin_R = "Rgui.exe"
+else
+    let b:rplugin_R = "Rterm.exe"
+endif
+if !exists("g:rplugin_rpathadded")
+    if exists("g:vimrplugin_r_path")
+        if !isdirectory(g:vimrplugin_r_path)
+            call RWarningMsgInp("vimrplugin_r_path must be a directory (check your vimrc)")
+            let g:rplugin_failed = 1
+            finish
+        endif
+        if !filereadable(g:vimrplugin_r_path . "\\Rgui.exe")
+            call RWarningMsgInp('File "' . g:vimrplugin_r_path . '\Rgui.exe" is unreadable (check vimrplugin_r_path in your vimrc).')
+            let g:rplugin_failed = 1
+            finish
+        endif
+        let $PATH = g:vimrplugin_r_path . ";" . $PATH
+        let g:rplugin_Rgui = g:vimrplugin_r_path . "\\Rgui.exe"
+    else
+        let rip = filter(split(system('reg.exe QUERY "HKLM\SOFTWARE\R-core\R" /s'), "\n"), 'v:val =~ ".*InstallPath.*REG_SZ"')
+        let g:rdebug_reg_rpath_1 = rip
+        if len(rip) > 0
+            let s:rinstallpath = substitute(rip[0], '.*InstallPath.*REG_SZ\s*', '', '')
+            let s:rinstallpath = substitute(s:rinstallpath, '\n', '', 'g')
+            let s:rinstallpath = substitute(s:rinstallpath, '\s*$', '', 'g')
+            let g:rdebug_reg_rpath_2 = s:rinstallpath
+        endif
+
+        if !exists("s:rinstallpath")
+            call RWarningMsgInp("Could not find R path in Windows Registry. If you have already installed R, please, set the value of 'vimrplugin_r_path'.")
+            let g:rplugin_failed = 1
+            finish
+        endif
+        if isdirectory(s:rinstallpath . '\bin\i386')
+            if !isdirectory(s:rinstallpath . '\bin\x64')
+                let g:vimrplugin_i386 = 1
+            endif
+            if g:vimrplugin_i386
+                let $PATH = s:rinstallpath . '\bin\i386;' . $PATH
+                let g:rplugin_Rgui = s:rinstallpath . '\bin\i386\Rgui.exe'
+            else
+                let $PATH = s:rinstallpath . '\bin\x64;' . $PATH
+                let g:rplugin_Rgui = s:rinstallpath . '\bin\x64\Rgui.exe'
+            endif
+        else
+            let $PATH = s:rinstallpath . '\bin;' . $PATH
+            let g:rplugin_Rgui = s:rinstallpath . '\bin\Rgui.exe'
+        endif
+        unlet s:rinstallpath
+    endif
+    let g:rplugin_rpathadded = 1
+endif
+let g:vimrplugin_term_cmd = "none"
+let g:vimrplugin_term = "none"
+if !exists("g:vimrplugin_r_args")
+    let g:vimrplugin_r_args = "--sdi"
+endif
+if g:vimrplugin_Rterm
+    let g:rplugin_Rgui = substitute(g:rplugin_Rgui, "Rgui", "Rterm", "")
+endif
+
+if !exists("g:vimrplugin_R_window_title")
+    if g:vimrplugin_Rterm
+        let g:vimrplugin_R_window_title = "Rterm"
+    else
+        let g:vimrplugin_R_window_title = "R Console"
+    endif
+endif
+
+function FindSumatra()
+    let smtr = system('reg.exe QUERY "HKLM\Software\Microsoft\Windows\CurrentVersion\App Paths" /v "SumatraPDF.exe"')
+    if len(smtr) > 0
+        let g:rdebug_reg_personal = smtr
+        let smtr = substitute(smtr, '.*REG_SZ\s*', '', '')
+        let smtr = substitute(smtr, '\n', '', 'g')
+        let smtr = substitute(smtr, '\s*$', '', 'g')
+        if executable(smtr)
+            let g:rplugin_sumatra_path = smtr
+            return 1
+        else
+            call RWarningMsg('Sumatra not found: "' . smtr . '"')
+        endif
+    else
+        call RWarningMsg("SumatraPDF not found in Windows registry.")
+    endif
+    return 0
+endfunction
+
+function InitializePython()
+    " python3 has priority over python
+    if has("python3")
+        command! -nargs=+ Py :py3 
+        command! -nargs=+ PyFile :py3file 
+    elseif has("python")
+        command! -nargs=+ Py :py 
+        command! -nargs=+ PyFile :pyfile 
+    elseif has("nvim")
+        command! -nargs=+ Py :call RWarningMsg("Py command not implemented yet: '" .  . "'")
+        let g:SendToVimCom = function("SendToVimCom_Neovim")
+    else
+        command! -nargs=+ Py :
+        command! -nargs=+ PyFile :
+    endif
+    exe "PyFile " . substitute(g:rplugin_home, " ", '\\ ', "g") . '\r-plugin\windows.py'
+    let g:rplugin_python_initialized = 1
+endfunction
+
+function StartR_Windows()
+    if !g:vimrplugin_libcall_send && !g:rplugin_python_initialized
+        call InitializePython()
+    endif
+    if string(g:SendCmdToR) != "function('SendCmdToR_fake')"
+        let repl = libcall(g:rplugin_vimcom_lib, "FindRConsole", 'R Console')
+        if repl == "NotFound"
+            let g:SendCmdToR = function('SendCmdToR_fake')
+            let g:rplugin_r_pid = 0
+        else
+            call RWarningMsg('There is already a window called "R Console".')
+            return
+        endif
+    endif
+    let vrph = $VIMRPLUGIN_HOME
+    let $VIMRPLUGIN_HOME = substitute($VIMRPLUGIN_HOME, "\\\\ ", " ", "g")
+
+    if !executable(g:rplugin_Rgui)
+        call RWarningMsg('R executable "' . g:rplugin_Rgui . '" not found.')
+        if exists("g:rdebug_reg_rpath_1")
+            call RWarningMsg('DEBUG message 1: >>' . g:rdebug_reg_rpath_1 . '<<')
+        endif
+        if exists("g:rdebug_reg_rpath_1")
+            call RWarningMsg('DEBUG message 2: >>' . g:rdebug_reg_rpath_2 . '<<')
+        endif
+        return
+    endif
+
+    " R and Vim use different values for the $HOME variable.
+    let saved_home = $HOME
+    let prs = system('reg.exe QUERY "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v "Personal"')
+    if len(prs) > 0
+        let g:rdebug_reg_personal = prs
+        let prs = substitute(prs, '.*REG_SZ\s*', '', '')
+        let prs = substitute(prs, '\n', '', 'g')
+        let prs = substitute(prs, '\s*$', '', 'g')
+        let $HOME = prs
+    endif
+
+    let rcmd = g:rplugin_Rgui
+    if g:vimrplugin_Rterm
+        let rcmd = substitute(rcmd, "Rgui", "Rterm", "")
+    endif
+    let rcmd = '"' . rcmd . '" ' . g:vimrplugin_r_args
+
+    silent exe "!start " . rcmd
+
+    let $HOME = saved_home
+
+    if g:vimrplugin_vim_wd == 0
+        lcd -
+    endif
+    let $VIMRPLUGIN_HOME = vrph
+    let g:SendCmdToR = function('SendCmdToR_Windows')
+    call WaitVimComStart()
+endfunction
+
+function SendCmdToR_Windows(cmd)
+    if g:vimrplugin_ca_ck
+        let cmd = "\001" . "\013" . a:cmd . "\n"
+    else
+        let cmd = a:cmd . "\n"
+    endif
+    if g:vimrplugin_libcall_send
+        let repl = libcall(g:rplugin_vimcom_lib, "SendToRConsole", cmd)
+    else
+        let slen = len(cmd)
+        let str = ""
+        for i in range(0, slen)
+            let str = str . printf("\\x%02X", char2nr(cmd[i]))
+        endfor
+        exe "Py" . " SendToRConsole(b'" . str . "')"
+    endif
+    return 1
+endfunction
+

From 817adc02c4b95b65fd7b9f15d529070c49fc2d0f Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sat, 13 Dec 2014 21:12:54 -0500
Subject: [PATCH 0875/1050] Try to find SumatraPDF twice

---
 r-plugin/windows.vim | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/r-plugin/windows.vim b/r-plugin/windows.vim
index 4d657b5..6928887 100644
--- a/r-plugin/windows.vim
+++ b/r-plugin/windows.vim
@@ -81,6 +81,10 @@ if !exists("g:vimrplugin_R_window_title")
 endif
 
 function FindSumatra()
+    if executable($ProgramFiles . "\\SumatraPDF\\SumatraPDF.exe")
+        let g:rplugin_sumatra_path = $ProgramFiles . "\\SumatraPDF\\SumatraPDF.exe"
+        return 1
+    endif
     let smtr = system('reg.exe QUERY "HKLM\Software\Microsoft\Windows\CurrentVersion\App Paths" /v "SumatraPDF.exe"')
     if len(smtr) > 0
         let g:rdebug_reg_personal = smtr

From bb628dfb6ce0179f992733afdb34f729f5fc4263 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sat, 13 Dec 2014 21:13:38 -0500
Subject: [PATCH 0876/1050] ShowRDoc() now is called only by vimcom

---
 r-plugin/common_global.vim | 48 ++++++++------------------------------
 1 file changed, 10 insertions(+), 38 deletions(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 941442f..1762101 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -936,8 +936,8 @@ function WaitVimComStart()
         let g:rplugin_vimcom_home = vr[1]
         let g:rplugin_vimcomport = vr[2]
         let g:rplugin_r_pid = vr[3]
-        if g:rplugin_vimcom_version != "1.1.11"
-            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.1.11.')
+        if g:rplugin_vimcom_version != "1.1.12"
+            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.1.12.')
             sleep 1
         endif
         if has("nvim")
@@ -2330,45 +2330,17 @@ function AskRDoc(rkeyword, package, getclass)
 
     call delete($VIMRPLUGIN_TMPDIR . "/eval_reply")
     call g:SendToVimCom("\x08" . $VIMINSTANCEID . rcmd, "I")
-    call ShowRDoc(a:rkeyword, 0)
 endfunction
 
-" This function may be called by vimcom
-function ShowRDoc(rkeyword, fromvimcom)
-    if a:fromvimcom
-        if bufname("%") =~ "Object_Browser" || bufname("%") == "R_Output"
-            let savesb = &switchbuf
-            set switchbuf=useopen,usetab
-            exe "sb " . b:rscript_buffer
-            exe "set switchbuf=" . savesb
-        endif
-        call SetRTextWidth(a:rkeyword)
-    else
-        " FIXME: This sleep should not be needed
-        sleep 100m
-        let g:rplugin_lastev = ReadEvalReply()
-        if g:rplugin_lastev != "VIMHELP"
-            if g:rplugin_lastev =~ "^MULTILIB"
-                let msg = "The topic '" . a:rkeyword . "' was found in more than one library:\n"
-                let libs = split(g:rplugin_lastev)
-                for idx in range(1, len(libs) - 1)
-                    let msg .= idx . " : " . libs[idx] . "\n"
-                endfor
-                redraw
-                let chn = input(msg . "Please, select one of them: ")
-                if chn > 0 && chn < len(libs)
-                    call delete($VIMRPLUGIN_TMPDIR . "/eval_reply")
-                    call g:SendToVimCom("\x08" . $VIMINSTANCEID . 'vimcom:::vim.help("' . a:rkeyword . '", ' . g:rplugin_htw . 'L, package="' . libs[chn] . '")')
-                    let g:rplugin_lastev = ReadEvalReply()
-                else
-                    return
-                endif
-            else
-                call RWarningMsg(g:rplugin_lastev)
-                return
-            endif
-        endif
+" This function is called by vimcom
+function ShowRDoc(rkeyword)
+    if bufname("%") =~ "Object_Browser" || bufname("%") == "R_Output"
+        let savesb = &switchbuf
+        set switchbuf=useopen,usetab
+        exe "sb " . b:rscript_buffer
+        exe "set switchbuf=" . savesb
     endif
+    call SetRTextWidth(a:rkeyword)
 
     " Local variables that must be inherited by the rdoc buffer
     let g:tmp_tmuxsname = g:rplugin_tmuxsname

From 16ce3375e3bebc21722ba06ab42dcd633d07d9b5 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sat, 13 Dec 2014 23:28:41 -0500
Subject: [PATCH 0877/1050] Remove command :RpluginConfig The vimcom package is
 setting the value of options("pager") and looking for the presence of
 $VIMRPLUGIN_TMPDIR. I think that using Tmux all the time is better than using
 the bash function "tvim". Consequently, the configuration now is simpler.

---
 Makefile                   |   1 -
 doc/r-plugin.txt           | 329 +++++++++------------
 list_for_vimball           |   1 -
 r-plugin/common_global.vim |   1 -
 r-plugin/gui_running.vim   |   1 -
 r-plugin/vimrconfig.vim    | 591 -------------------------------------
 6 files changed, 133 insertions(+), 791 deletions(-)
 delete mode 100644 r-plugin/vimrconfig.vim

diff --git a/Makefile b/Makefile
index 73c3126..543bb32 100644
--- a/Makefile
+++ b/Makefile
@@ -81,7 +81,6 @@ deb:
 	  - r-plugin/synctex_evince_forward.py\n\
 	  - r-plugin/synctex_okular_backward.sh\n\
 	  - r-plugin/global_r_plugin.vim\n\
-	  - r-plugin/vimrconfig.vim\n\
 	  - r-plugin/functions.vim\n\
 	  - r-plugin/gui_running.vim
 	  - r-plugin/nvimbuffer.vim
diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 388aa15..7897da9 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -118,18 +118,19 @@ Before installing the plugin, you should install its dependencies:
                In addition to the most commonly used features, the plugin
                requires: |+libcall|, |+clientserver| and |+conceal|.
 
-	       Note: If you use Neovim, the |+clientserver| feature is not
-	       required.
+	       Note: If you use Neovim, the |+clientserver| and |+libcall|
+	       features are not required.
 
 	       Note: If you use Mac OS X, read about the bugs that affect it:
-	       |r-plugin-nox|.
+	       |r-plugin-nox|. The easier solution might be to use Neovim.
 
    R >= 3.0.0: http://www.r-project.org/
 
-   vimcom = 1.1-0: http://www.lepem.ufc.br/jaa/vimcom.html
+   vimcom = 1.2-0: http://www.lepem.ufc.br/jaa/vimcom.html
 
    Tmux >= 1.8:   http://tmux.sourceforge.net
                   Tmux is necessary to send commands from Vim to R Console.
+		  It is optional if you are using Neovim.
 
    wmctrl:     http://tomas.styblo.name/wmctrl/
                Required for SyncTeX support in Rnoweb files.
@@ -139,11 +140,15 @@ Before installing the plugin, you should install its dependencies:
 
    colorout:      http://www.lepem.ufc.br/jaa/colorout.html
                   Colorizes the R output.
+		  Not required if you will run R as a Neovim job. See
+		  |vimrplugin_r_in_buffer|.
 
    setwidth:      An R package that can be installed with the command
                   `install.packages("setwidth")`.
                   The library setwidth adjusts the value of `options("width")`
                   whenever the terminal is resized.
+		  Not required if you will run R as a Neovim job. See
+		  |vimrplugin_r_in_buffer|.
 
    ncurses-term:  http://invisible-island.net/ncurses
 		  Might be necessary if you want support for 256 colors at the
@@ -157,11 +162,19 @@ Before installing the plugin, you should install its dependencies:
    installation instructions vary widely and are beyond the scope of this
    documentation.
 
+Put the following lines in your `~/Rprofile`:
+>
+   if(interactive()){
+       library(colorout)
+       library(setwidth)
+       options(vimcom.verbose = 1) # optional
+       library(vimcom)
+   }
+<
 You need to activate plugins and indentation according to 'filetype'. You
 should have at least the following options at the top or at near the very top
-of your |vimrc|:
+of your |vimrc| (but below `set` `runtimepath`, if you have set it):
 >
-   set nocompatible
    syntax enable
    filetype plugin on
    filetype indent on
@@ -188,25 +201,23 @@ Note: If you need to install the plugin in a non default directory, do
 must be done before the command "filetype on" in both the system and the user
 |vimrc| files, otherwise, some file types might not be correctly recognized.
 
-Start Vim again and edit an R script. Type rf to start R and run
-the command below to get help configuring ~/.Rprofile, ~/.vimrc, ~/.tmux.conf,
-and ~/.bashrc (the  is `\` by default):
->
-   :RpluginConfig
-<
-The above command will guide you through the final configuration steps if you
-answer `y` to all questions, but if you prefer to configure everything by
-yourself, please, read the sections |r-plugin-nox| and |r-plugin-quick-setup|.
+The plugin is installed and will be activated next time that you start to edit
+an R script. But you still can improve the plugin performance if you do
+additional configuration mentioned in the paragraphs below.
 
 If you start either GVim or Vim in a terminal emulator the plugin will start R
 in a external terminal emulator. If you start Vim inside of a Tmux session,
 the plugin will split the Tmux window in two and start R in the other pane.
 
 The recommended way of running the plugin on Linux is running Vim inside a
-Tmux session. If you do not use Tmux frequently, it is recommended that you
-create a custom Bash function as explained in the section |r-plugin-tmux|,
-especially the tip |r-plugin-tvim| (the above command :RpluginConfig should do
-this for you).
+Tmux session. Please, read |r-plugin-tmux| for details.
+
+If you run Vim in a terminal emulator, it must be started with the argument
+|--servername|. Please, read the section |r-plugin-bash-setup| to know some
+tips on how to configure Bash.
+
+The Vim configuration also may be improved. See some tips at
+|r-plugin-vimrc-setup|.
 
 Note: On Mac OS X, in both Vim and GVim, the plugin will use AppleScript to
 send commands to the R Console application unless |vimrplugin_applescript| = 0.
@@ -236,6 +247,19 @@ dependencies:
 
     * Vim's version must be >= 7.4: http://www.vim.org/download.php
 
+Add the following lines to your `Rprofile`:
+>
+   options(vimcom.verbose = 1)
+   library(vimcom)
+<
+If you do not know where your .Rprofile is, do the following command in R
+Console to open it:
+>
+   edit(file = "~/.Rprofile")
+<
+You may want to improve the configuration of your |vimrc| for a better use of
+the plugin. Please, see |r-plugin-vimrc-setup|.
+
 Now, download the latest version of `Vim-R-plugin.vmb` from
 
     http://www.vim.org/scripts/script.php?script_id=2628
@@ -256,42 +280,17 @@ Note: If you need to install the plugin in a non default directory, do
 must be done before the command "filetype on" in both the system and the user
 |vimrc| files, otherwise, some file types might not be correctly recognized.
 
-Add the following lines to your `Rprofile`:
->
-   if(Sys.getenv("VIMRPLUGIN_TMPDIR") != "")
-       library(vimcom)
-<
-Note: If you do not know where your .Rprofile is, do the following command to
-open it:
->
-   edit(file = "~/.Rprofile")
-<
 Start GVim again and edit an R script. You can right click a .R file and
 choose "Edit with Vim" or create a new one with the Normal mode command:
 >
    :e example.R
 <
-To finish the installation, you have to start R to run a configuration script.
-Please, click on the menu bar
->
-   R
-   Start/Close
-   Start R (default)
-<
 If R does not start and you get an error message instead, you may want to
 set the path to your Rgui.exe in your |vimrc|, for example (please adapt to
 your installation)
 >
-   let vimrplugin_r_path = 'C:\Program Files\R\R-3.1.0\bin\i386'
-<
-Finally, click on the menu bar
->
-   R
-   Configure (Vim-R)
+   let vimrplugin_r_path = 'C:\\Program Files\\R\\R-3.1.2\\bin\\i386'
 <
-The above command will guide you through the final configuration steps if you
-answer `y` to all questions.
-
 If you want to uninstall the plugin, do
 >
    :RmVimball Vim-R-plugin
@@ -300,8 +299,7 @@ If you want to uninstall the plugin, do
 ------------------------------------------------------------------------------
 3.3. Troubleshooting (if the plugin doesn't work)~
 
-Note: The  is '\' by default, but if you have run the
-:RpluginConfig  command the  may have been changed to ','.
+Note: The  is '\' by default.
 
 The plugin is a |file-type| plugin. It will be active only if you are editing
 a .R, .Rnw, .Rd, Rmd, or Rrst file. The menu items will not be visible and the
@@ -354,8 +352,7 @@ bar.
 
 4.1. Key bindings~
 
-Note: The  is '\' by default, but if you have run the
-:RpluginConfig  command the  may have been changed to ','.
+Note: The  is '\' by default.
 
 Note: It is recommended the use of different keys for  and
  to avoid clashes between filetype plugins and general plugins
@@ -485,7 +482,6 @@ Object Browser
 
 Help (plugin)
 Help (R)                                            :Rhelp
-Configure (Vim-R)                           :RpluginConfig
 -----------------------------------------------------------
 
 Please see |r-plugin-key-bindings| to learn how to customize the key bindings
@@ -777,34 +773,35 @@ Note: Starting GVim within a Tmux session is not supported.
 
 
 ------------------------------------------------------------------------------
-							       *r-plugin-tvim*
-4.8.1 tvim~
+							 *r-plugin-tmux-setup*
+4.8.1 Tmux configuration~
 
-If, as recommended, you always prefer to run Tmux before running Vim you could
-create a Bash function called `tvim` (please, see the ~/.bashrc example at
-|r-plugin-quick-setup|). Then you will be able to start a Tmux session running
-Vim by typing:
+If, as recommended, you always prefer to run Tmux before running you have to
+create your `~/.tmux.conf` if it does not exist yet. You may put the lines
+below in your `~/.tmux.conf` as a starting point to your own configuration
+file:
 >
-   tvim filename.R
-<
-Using the `tvim` function, the Tmux session is finished when you quits Vim.
-That is, the main advantage of using `tvim` is that you do not have to type
-`tmux` before and `exit` after the edition of the file. Moreover, the `tvim`
-command also pass the |--servername| argument to Vim, which is required to
-update the Object Browser and functions highlight.
+   # Use  instead of the default  as Tmux prefix
+   set-option -g prefix C-a
+   unbind-key C-b
+   bind-key C-a send-prefix
 
-If you are going to run Vim inside Tmux, than you should create your
-~/.tmux.conf if it does not exist yet. You may put the lines below in your
-~/.tmux.conf as a starting point to your own configuration file:
->
-    set-option -g prefix C-a
-    unbind-key C-b
-    bind-key C-a send-prefix
-    set-window-option -g mode-keys vi
-    set -g terminal-overrides 'xterm*:smcup@:rmcup@'
-    set -g mode-mouse on
-    set -g mouse-select-pane on
-    set -g mouse-resize-pane on
+   # Options enable mouse support in Tmux
+   set -g terminal-overrides 'xterm*:smcup@:rmcup@'
+   set -g mode-mouse on
+   set -g mouse-select-pane on
+   set -g mouse-resize-pane on
+
+   # Act more like vim:
+   set-window-option -g mode-keys vi
+   bind h select-pane -L
+   bind j select-pane -D
+   bind k select-pane -U
+   bind l select-pane -R
+   unbind p
+   bind p paste-buffer
+   bind -t vi-copy v begin-selection
+   bind -t vi-copy y copy-selection
 <
 
 ------------------------------------------------------------------------------
@@ -1070,11 +1067,11 @@ as below:
 >
    vim --servername VIM script.R
 <
-To avoid having to type this argument every time that you start Vim, please
-either run `:RpluginConfig` or look at the example in |r-plugin-bash-setup|.
+To avoid having to type this argument every time that you start Vim, please,
+look at the example in |r-plugin-bash-setup|.
 
 If the |--servername| argument does not work in your case, you can put the
-following line in your ~/.Rprofile to suppress the message:
+following line in your `~/.Rprofile` to suppress the message:
 >
    options(vimcom.verbose = -1)
 <
@@ -1279,7 +1276,7 @@ the Windows XP Command Prompt (click on the title bar and choose
 >
    let vimrplugin_Rterm = 1
 <
-Technical details: The plugin copies the code to be sent to R to the Windows
+Technical details: The plugin copies the code to be sent to R to Windows
 clipboard and, then, sends the key strokes CTRL-V to R Console window.
 However, neither the Windows 7 PowerShell nor the Windows XP Command Prompt
 has a keyboard shortcut to "paste". The solution is to set the "Quick Edit
@@ -1291,8 +1288,8 @@ it.
 						      *vimrplugin_r_in_buffer*
 6.3. Run R in Neovim buffer (experimental feature)~
 
-Note: This is an experimental feature to test Neovim capabilities and may be
-removed in the future. See bugs at the end of this section.
+Note: This features depends on a pull request not merged yet:
+https://github.com/neovim/neovim/pull/1584
 
 If you are running Neovim and want to try this experimental feature, put in
 your |vimrc|:
@@ -1331,7 +1328,9 @@ emulator that supports 256 colors (see |highlight-ctermfg|):
        let rout_color_negnum = 183
        let rout_color_negfloat = 183
        let rout_color_date = 43
-       let rout_color_bool = 75
+       let rout_color_true = 78
+       let rout_color_false = 203
+       let rout_color_inf = 39
        let rout_color_constant = 75
        let rout_color_string = 79
        let rout_color_stderr = 33
@@ -1341,7 +1340,7 @@ emulator that supports 256 colors (see |highlight-ctermfg|):
    endif
 <
 To know what number corresponds to your preferred color (among the 256
-possibilities), hover you mouser pointer over the table of colors at the end
+possibilities), hover you mouse pointer over the table of colors at the end
 of http://www.lepem.ufc.br/jaa/colorout.html
 
 If you prefer that R output is highlighted using you current |:colorscheme|,
@@ -1349,20 +1348,6 @@ put in your vimrc:
 >
    let rout_follow_colorscheme = 1
 <
-Note: The Vim-R-plugin relies on special values of `options("continue")` and
-`options("prompt")` set by the vimcom package to recognize the end of output
-and add the prompt symbol. If you need to change either of these two options,
-please, open an issue at https://github.com/jcfaria/Vim-R-plugin/issues
-because it would be possible to add options to customize them.
-
-Note: Output that does not end in a newline character does not generate
-JobActivity and therefore is shown only after an output with a newline. That
-is, if R asks for user input, the question will not be shown. For example,
-this will not work:
->
-   par(ask=TRUE)
-   plot(1,1)
-<
 
 ------------------------------------------------------------------------------
 						      *vimrplugin_rnowebchunk*
@@ -1443,7 +1428,7 @@ If you do not want to see R documentation in a Vim's buffer, put in your
 >
    let vimrplugin_vimpager = "no"
 <
-And put in your .Rprofile:
+And put in your `~/.Rprofile`:
 >
    options(vimcom.vimpager = FALSE)
 <
@@ -1924,8 +1909,7 @@ higher value for the variable in your |vimrc|. Example:
 >
    let vimrplugin_vimcom_wait = 10000
 <
-Note: You should have the line  `library(vimcom)`  in your Rprofile. The
-Vim command  :RpluginConfig  adds that line for you.
+Note: You should have the line  `library(vimcom)`  in your `~/.Rprofile`.
 
 
 ------------------------------------------------------------------------------
@@ -2292,15 +2276,21 @@ directory after the installation:
    syntax/rdoc.vim
    syntax/rbrowser.vim
    doc/r-plugin.txt
+   r-plugin/common_buffer.vim
+   r-plugin/common_global.vim
+   r-plugin/functions.vim
    r-plugin/global_r_plugin.vim
+   r-plugin/gui_running.vim
+   r-plugin/nvimbuffer.vim
    r-plugin/objlist/README
+   r-plugin/osx.vim
    r-plugin/r.snippets
-   r-plugin/common_buffer.vim
-   r-plugin/common_global.vim
+   r-plugin/rmd.snippets
    r-plugin/synctex_evince_backward.py
    r-plugin/synctex_evince_forward.py
    r-plugin/synctex_okular_backward.sh
-   r-plugin/vimrconfig.vim
+   r-plugin/windows.py
+   r-plugin/windows.vim
 
 
 ==============================================================================
@@ -2316,7 +2306,7 @@ same signal sent when you press CTRL-C into R's Console.
 ------------------------------------------------------------------------------
 9.2. Html help and custom pager~
 
-If you prefer to see help pages in an html browser, put in your ~/.Rprofile:
+If you prefer to see help pages in an html browser, put in your `~/.Rprofile`:
 >
    options(help_type = "html")
 <
@@ -2574,7 +2564,7 @@ Vim breaks the R code automatically put in your |vimrc|:
 9.13. Vim with 256 colors in a terminal emulator (Linux/Unix only)~
 
 If you want 256 colors support in Vim, install the package ncurses-term. Then
-put in your ~/.bashrc the lines suggested at |r-plugin-bash-setup|.
+put in your `~/.bashrc` the lines suggested at |r-plugin-bash-setup|.
 Finally, put in your |vimrc|:
 >
    if &term =~ "xterm" || &term =~ "256" || $DISPLAY != ""
@@ -2602,9 +2592,9 @@ line in your |vimrc|:
 							   *r-plugin-Rprofile*
 9.15. Edit your ~/.Rprofile~
 
-You may want to edit your ~/.Rprofile in addition to considering the
+You may want to edit your `~/.Rprofile` in addition to considering the
 suggestions of |r-plugin-R-setup| you may also want to put the following
-lines in your .Rprofile if you are using Linux:
+lines in your `~/.Rprofile` if you are using Linux:
 >
    grDevices::X11.options(width = 4.5, height = 4, ypos = 0,
                           xpos = 1000, pointsize = 10)
@@ -2720,7 +2710,7 @@ See also: |vimrplugin_latexcmd|.
 
 ------------------------------------------------------------------------------
 							*r-plugin-quick-setup*
-9.21. Quick setup for the Vim-R-plugin on Linux/Unix environment~
+9.21. Suggestion of setup for the Vim-R-plugin~
 
 Please, look at section |r-plugin-options| if you want information about the
 Vim-r-plugin customization.
@@ -2729,77 +2719,77 @@ Here are some suggestions of configuration of Vim, Bash, Tmux and R. To
 understand what you are doing, and change the configuration to your taste,
 please read this document from the beginning.
 
+							*r-plugin-vimrc-setup*
    ~/.vimrc~
 >
    " Minimum required configuration:
-   set nocompatible
    syntax on
    filetype plugin on
    filetype indent on
+
    " Change Leader and LocalLeader keys:
    let maplocalleader = ","
    let mapleader = ";"
+
    " Use Ctrl+Space to do omnicompletion:
    if has("gui_running")
        inoremap  
    else
        inoremap  
    endif
+
    " Press the space bar to send lines and selection to R:
    vmap  RDSendSelection
    nmap  RDSendLine
+
    " The lines below are suggestions for Vim in general and are not
    " specific to the improvement of the Vim-R-plugin.
+
    " Highlight the last searched pattern:
    set hlsearch
+
    " Show where the next pattern is as you type it:
    set incsearch
+
    " By default, Vim indents code by 8 spaces. Most people prefer 4
    " spaces:
    set sw=4
+
    " Search "Vim colorscheme 256" in the internet and download color
    " schemes that supports 256 colors in the terminal emulator. Then,
    " uncomment the code below to set you color scheme:
    "colorscheme not_defined
+
    " Use 256 colors even if in a terminal emulator:
    if &term =~ "xterm" || &term =~ "256" || $DISPLAY != ""
        set t_Co=256
    endif
 <
-							 *r-plugin-bash-setup*
-   ~/.bashrc for Vim:~
+
+							    *r-plugin-R-setup*
+   ~/.Rprofile~
 >
-   # Change the TERM environment variable (to get 256 colors) and make Vim
-   # connecting to X Server even if running in a terminal emulator (to get
-   # dynamic update of syntax highlight and Object Browser):
-   if [ "x$DISPLAY" != "x" ]
-   then
-       if [ "screen" = "$TERM" ]
-       then
-           export TERM=screen-256color
-       else
-           export TERM=xterm-256color
-       fi
-       alias vim='vim --servername VIM'
-       if [ "x$TERM" == "xxterm" ] || [ "x$TERM" == "xxterm-256color" ]
-       then
-           function tvim(){ tmux -2 new-session "TERM=screen-256color vim --servername VIM $@" ; }
-       else
-           function tvim(){ tmux new-session "vim --servername VIM $@" ; }
-       fi
-   else
-       if [ "x$TERM" == "xxterm" ] || [ "x$TERM" == "xxterm-256color" ]
-       then
-           function tvim(){ tmux -2 new-session "TERM=screen-256color vim $@" ; }
-       else
-           function tvim(){ tmux new-session "vim $@" ; }
-       fi
-   fi
+   if(interactive()){
+       options(vimcom.verbose = 1)
+       # Load the required libraries:
+       library(colorout)
+       library(setwidth)
+       library(vimcom)
+
+       # Use the text based web browser w3m to navigate through R docs
+       # in Linux Console:
+       if(Sys.getenv("TMUX") != "" && Sys.getenv("DISPLAY") == "")
+	   options(browser = function(u) system(paste0("tmux new-window 'w3m ", u, "'")),
+                   help_type = "html")
+   }
 <
 
-   ~/.bashrc for Neovim:~
+							 *r-plugin-bash-setup*
+   ~/.bashrc for Vim and Neovim (Unix):~
 >
-   # Change the TERM environment variable (to get 256 colors):
+   # Change the TERM environment variable (to get 256 colors) and make Vim
+   # connecting to X Server even if running in a terminal emulator (many of
+   # the plugin features depend on this).
    if [ "x$DISPLAY" != "x" ]
    then
        if [ "screen" = "$TERM" ]
@@ -2808,65 +2798,10 @@ please read this document from the beginning.
        else
            export TERM=xterm-256color
        fi
-   fi
-   if [ "x$TERM" == "xxterm" ] || [ "x$TERM" == "xxterm-256color" ]
-   then
-       function tvim(){ tmux -2 new-session "TERM=screen-256color nvim $@" ; }
-   else
-       function tvim(){ tmux new-session "nvim $@" ; }
+       alias vim='vim --servername VIM'
    fi
 <
 
-							 *r-plugin-tmux-setup*
-   ~/.tmux.conf:~
->
-   set-option -g prefix C-a
-   unbind-key C-b
-   bind-key C-a send-prefix
-   # Set "status on" if you usually create new Tmux windows
-   set -g status off
-   set -g terminal-overrides 'xterm*:smcup@:rmcup@'
-   set -g mode-mouse on
-   set -g mouse-select-pane on
-   set -g mouse-resize-pane on
-   # Act more like vim:
-   set-window-option -g mode-keys vi
-   bind h select-pane -L
-   bind j select-pane -D
-   bind k select-pane -U
-   bind l select-pane -R
-   unbind p
-   bind p paste-buffer
-   bind -t vi-copy v begin-selection
-   bind -t vi-copy y copy-selection
-<
-
-							    *r-plugin-R-setup*
-   ~/.Rprofile~
->
-   if(interactive()){
-       # Get startup messages of three packages:
-       options(setwidth.verbose = 1,
-               colorout.verbose = 1,
-               vimcom.verbose = 1)
-       # Use the text based web browser w3m to navigate through R docs:
-       if(Sys.getenv("TMUX") != "" && Sys.getenv("DISPLAY") == "")
-	   options(browser = function(u) system(paste0("tmux new-window 'w3m ", u, "'")),
-                   help_type = "html")
-       # Use either Vim or GVim as text editor for R:
-       if(nchar(Sys.getenv("DISPLAY")) > 1)
-           options(editor = 'gvim -f -c "set ft=r"')
-       else
-           options(editor = 'vim -c "set ft=r"')
-       # Load the colorout library:
-       library(colorout)
-       # Load the setwidth library:
-       library(setwidth)
-       # Load the vimcom library only if R was started by Vim:
-       if(Sys.getenv("VIMRPLUGIN_TMPDIR") != "")
-           library(vimcom)
-   }
-<
 
 Finally, if you want to use vi key bindings in Bash:
 
@@ -2906,7 +2841,7 @@ See also |vimrplugin_r_in_buffer|.
 							       *r-plugin-news*
 10. News~
 
-1.1.1 (2014-12-11)
+1.1.1 (2014-12-13)
 
  * Change commands gn and gN into gn and gN.
 
@@ -2918,6 +2853,8 @@ See also |vimrplugin_r_in_buffer|.
 
  * Removed option vimrplugin_sleeptime.
 
+ * Removed command :RpluginConfig.
+
 1.1 (2014-11-13)
 
  * Version update for Linux/Unix only. May not work on Windows or Mac.
diff --git a/list_for_vimball b/list_for_vimball
index 4a4eaf5..708c565 100644
--- a/list_for_vimball
+++ b/list_for_vimball
@@ -27,7 +27,6 @@ r-plugin/rmd.snippets
 r-plugin/synctex_evince_backward.py
 r-plugin/synctex_evince_forward.py
 r-plugin/synctex_okular_backward.sh
-r-plugin/vimrconfig.vim
 r-plugin/functions.vim
 r-plugin/gui_running.vim
 r-plugin/nvimbuffer.vim
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 1762101..685a56b 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -3056,7 +3056,6 @@ command -range=% Rformat ,:call RFormatCode()
 command RBuildTags :call g:SendCmdToR('rtags(ofile = "TAGS")')
 command -nargs=? -complete=customlist,RLisObjs Rhelp :call RAskHelp()
 command -nargs=? -complete=dir RSourceDir :call RSourceDirectory()
-command RpluginConfig :runtime r-plugin/vimrconfig.vim
 command RStop :call StopR()
 command Rhistory :call ShowRhistory()
 
diff --git a/r-plugin/gui_running.vim b/r-plugin/gui_running.vim
index da34a63..5986b86 100644
--- a/r-plugin/gui_running.vim
+++ b/r-plugin/gui_running.vim
@@ -231,7 +231,6 @@ function MakeRMenu()
     amenu R.Help\ (plugin).News :help r-plugin-news
 
     amenu R.Help\ (R):Rhelp :call g:SendCmdToR("help.start()")
-    amenu R.Configure\ (Vim-R):RpluginConfig :RpluginConfig
     let g:rplugin_hasmenu = 1
 
     "----------------------------------------------------------------------------
diff --git a/r-plugin/vimrconfig.vim b/r-plugin/vimrconfig.vim
deleted file mode 100644
index 30d4ffa..0000000
--- a/r-plugin/vimrconfig.vim
+++ /dev/null
@@ -1,591 +0,0 @@
-function! RFindString(lll, sss)
-    for line in a:lll
-        if line =~ a:sss
-            return 1
-        endif
-    endfor
-    return 0
-endfunction
-
-function! RGetYesOrNo(ans)
-    if a:ans =~ "^[yY]"
-        return 1
-    elseif a:ans =~ "^[nN]" || a:ans == ""
-        return 0
-    else
-        echohl WarningMsg
-        let newans = input('Please, type "y", "n" or : ')
-        echohl Normal
-        return RGetYesOrNo(newans)
-    endif
-endfunction
-
-" Configure .Rprofile
-function! RConfigRprofile()
-    call delete($VIMRPLUGIN_TMPDIR . "/configR_result")
-    let configR = ['if(.Platform$OS.type == "windows"){',
-                \ '    .rpf <- Sys.getenv("R_PROFILE_USER")',
-                \ '    if(.rpf == ""){',
-                \ '        if(Sys.getenv("R_USER") == "")',
-                \ '            stop("R_USER environment variable not set.")',
-                \ '        .rpf <- paste0(Sys.getenv("R_USER"), "\\.Rprofile")',
-                \ '    }',
-                \ '} else {',
-                \ '    if(Sys.getenv("HOME") == ""){',
-                \ '        stop("HOME environment variable not set.")',
-                \ '    } else {',
-                \ '        .rpf <- paste0(Sys.getenv("HOME"), "/.Rprofile")',
-                \ '        if(length(find.package("colorout", quiet = TRUE)) > 0)',
-                \ '            .rpf <- c(.rpf, "HasColorout")',
-                \ '        else',
-                \ '            .rpf <- c(.rpf, "NoColorout")',
-                \ '        if(length(find.package("setwidth", quiet = TRUE)) > 0)',
-                \ '            .rpf <- c(.rpf, "HasSetwidth")',
-                \ '        else',
-                \ '            .rpf <- c(.rpf, "NoSetwidth")',
-                \ '    }',
-                \ '}',
-                \ 'writeLines(.rpf, con = paste0(Sys.getenv("VIMRPLUGIN_TMPDIR"), "/configR_result"))',
-                \ 'rm(.rpf)']
-    call RSourceLines(configR, "silent")
-    sleep 1
-    if !filereadable($VIMRPLUGIN_TMPDIR . "/configR_result")
-        sleep 2
-    endif
-    if filereadable($VIMRPLUGIN_TMPDIR . "/configR_result")
-        let resp = readfile($VIMRPLUGIN_TMPDIR . "/configR_result")
-        call delete($VIMRPLUGIN_TMPDIR . "/configR_result")
-        if filereadable(resp[0])
-            let rpflines = readfile(resp[0])
-        else
-            let rpflines = []
-        endif
-
-        let hasvimcom = 0
-        for line in rpflines
-            if line =~ "library.*vimcom" || line =~ "require.*vimcom"
-                let hasvimcom = 1
-                break
-            endif
-        endfor
-        if hasvimcom
-            echohl WarningMsg
-            echo 'The string "vimcom" was found in your .Rprofile. No change was done.'
-            echohl Normal
-        else
-            let rpflines += ['']
-            if exists("*strftime")
-                let rpflines += ['# Lines added by the Vim-R-plugin command :RpluginConfig (' . strftime("%Y-%b-%d %H:%M") . '):']
-            else
-                let rpflines += ['# Lines added by the Vim-R-plugin command :RpluginConfig:']
-            endif
-            let rpflines += ['if(interactive()){']
-            if has("win32") || has("win64")
-                let rpflines += ["    options(editor = '" . '"C:/Program Files (x86)/Vim/vim74/gvim.exe" "-c" "set filetype=r"' . "')"]
-            else
-                let rpflines += ['    if(nchar(Sys.getenv("DISPLAY")) > 1)',
-                            \ "        options(editor = '" . 'gvim -f -c "set ft=r"' . "')",
-                            \ '    else',
-                            \ "        options(editor = '" . s:vimprog . ' -c "set ft=r"' . "')",
-                            \ '    # See ?setOutputColors256 to know how to customize R output colors']
-                if len(resp) > 1 && resp[1] == "HasColorout"
-                    let rpflines += ['    library(colorout)']
-                else
-                    let rpflines += ['    # library(colorout)']
-                endif
-                if len(resp) > 2 && resp[2] == "HasSetwidth"
-                    let rpflines += ['    library(setwidth)']
-                else
-                    let rpflines += ['    # library(setwidth)']
-                endif
-            endif
-            if has("win32") || has("win64")
-                let rpflines += ['    if(Sys.getenv("VIMRPLUGIN_TMPDIR") != "")',
-                            \ '        library(vimcom)']
-            else
-                let rpflines += ['    library(vimcom)']
-            endif
-
-            if !(has("win32") || has("win64"))
-                redraw
-                echo " "
-                echo "By defalt, R uses the 'less' application to show help documents."
-                echohl Question
-                let what = input("Dou you prefer to see help documents in Vim? [y/N]: ")
-                echohl Normal
-                if RGetYesOrNo(what)
-                    let rpflines += ['    # See R documentation on Vim buffer even if asking for help in R Console:']
-                    if ($PATH =~ "\\~/bin" || $PATH =~ expand("~/bin")) && filewritable(expand("~/bin")) == 2 && !filereadable(expand("~/bin/vimrpager"))
-                        call writefile(['#!/bin/sh',
-                                    \ 'cat | ' . s:vimprog . ' -c "set ft=rdoc" -'], expand("~/bin/vimrpager"))
-                        call system("chmod +x " . expand("~/bin/vimrpager"))
-                        let rpflines += ['    options(help_type = "text", pager = "' . expand("~/bin/vimrpager") . '")']
-                    endif
-                    let rpflines += ['    if(Sys.getenv("VIM_PANE") != "")',
-                                \ '        options(pager = vim.pager)']
-                endif
-
-                if executable("w3m") && ($PATH =~ "\\~/bin" || $PATH =~ expand("~/bin")) && filewritable(expand("~/bin")) == 2 && !filereadable(expand("~/bin/vimrw3mbrowser"))
-                    redraw
-                    echo " "
-                    echo "The w3m application, a text based web browser, is installed in your system."
-                    echo "When R is running inside of a Tmux session, it can be configured to"
-                    echo "start its help system in w3m running in a Tmux pane."
-                    echohl Question
-                    let what = input("Do you want to use w3m instead of your default web browser? [y/N]: ")
-                    if RGetYesOrNo(what)
-                        call writefile(['#!/bin/sh',
-                                    \ 'NCOLS=$(tput cols)',
-                                    \ 'if [ "$NCOLS" -gt "140" ]',
-                                    \ 'then',
-                                    \ '    if [ "x$VIM_PANE" = "x" ]',
-                                    \ '    then',
-                                    \ '        tmux split-window -h "w3m $1 && exit"',
-                                    \ '    else',
-                                    \ '        tmux split-window -h -t $VIM_PANE "w3m $1 && exit"',
-                                    \ '    fi',
-                                    \ 'else',
-                                    \ '    tmux new-window "w3m $1 && exit"',
-                                    \ 'fi'], expand("~/bin/vimrw3mbrowser"))
-                        call system("chmod +x " . expand("~/bin/vimrw3mbrowser"))
-                        let rpflines += ['    # Use the text based web browser w3m to navigate through R docs:',
-                                    \ '    # Replace VIM_PANE with TMUX if you know what you are doing.',
-                                    \ '    if(Sys.getenv("VIM_PANE") != "")',
-                                    \ '        options(browser="' . expand("~/bin/vimrw3mbrowser") . '")']
-                    endif
-                endif
-            endif
-
-            let rpflines += ["}"]
-            call writefile(rpflines, resp[0])
-            redraw
-            echo " "
-            echohl WarningMsg
-            echo 'Your new .Rprofile was created.'
-            echohl Normal
-        endif
-
-        if has("win32") || has("win64") || !hasvimcom
-            echohl Question
-            let what = input("Do you want to see your .Rprofile now? [y/N]: ")
-            echohl Normal
-            if RGetYesOrNo(what)
-                silent exe "tabnew " . resp[0]
-            endif
-        else
-            echohl Question
-            let what = input("Do you want to see your .Rprofile along with tips on how to\nconfigure it? [y/N]: ")
-            echohl Normal
-            if RGetYesOrNo(what)
-                silent exe "tabnew " . resp[0]
-                silent help r-plugin-R-setup
-            endif
-        endif
-        redraw
-    else
-        redraw
-        echo " "
-        call RWarningMsg("Error: configR_result not found.")
-        sleep 1
-        return 1
-    endif
-    return 0
-endfunction
-
-" Configure vimrc
-function! RConfigVimrc()
-    if has("win32") || has("win64")
-        let uvimrc = $HOME . "/_vimrc"
-        if !filereadable(uvimrc) && filereadable($HOME . "/vimfiles/vimrc")
-            let uvimrc = $HOME . "/vimfiles/vimrc"
-        endif
-    elseif has("nvim")
-        let uvimrc = $HOME . "/.nvimrc"
-        if !filereadable(uvimrc) && filereadable($HOME . "/.nvim/nvimrc")
-            let uvimrc = $HOME . "/.nvim/nvimrc"
-        endif
-    else
-        let uvimrc = $HOME . "/.vimrc"
-        if !filereadable(uvimrc) && filereadable($HOME . "/.vim/vimrc")
-            let uvimrc = $HOME . "/.vim/vimrc"
-        endif
-    endif
-
-    if filereadable(uvimrc)
-        let hasvimrc = 1
-        echo " "
-        echohl WarningMsg
-        echo "You already have a vimrc."
-        echohl Normal
-        echohl Question
-        let what = input("Do you want to add to the bottom of your vimrc some options that\nmost users consider convenient for the Vim-R-plugin? [y/N]: ")
-        echohl Normal
-        if RGetYesOrNo(what)
-            let vlines = readfile(uvimrc)
-        else
-            redraw
-            return
-        endif
-    else
-        let hasvimrc = 0
-        echohl Question
-        let what = input("It seems that you don't have a vimrc yet. Should I create it now? [y/N]: ")
-        echohl Normal
-        if RGetYesOrNo(what)
-            let vlines = []
-        else
-            redraw
-            return
-        endif
-    endif
-
-    let vlines += ['']
-    if exists("*strftime")
-        let vlines += ['" Lines added by the Vim-R-plugin command :RpluginConfig (' . strftime("%Y-%b-%d %H:%M") . '):']
-    else
-        let vlines += ['" Lines added by the Vim-R-plugin command :RpluginConfig:']
-    endif
-
-    if RFindString(vlines, 'syntax\s*on') == 0 && RFindString(vlines, 'syntax\s*enable') == 0
-        let vlines += ['syntax enable']
-    endif
-    if RFindString(vlines, 'filet.* plugin on') == 0
-        let vlines += ['filetype plugin on']
-    endif
-    if RFindString(vlines, 'filet.* indent on') == 0
-        let vlines += ['filetype indent on']
-    endif
-
-    if RFindString(vlines, "maplocalleader") == 0
-        redraw
-        echo " "
-        if hasvimrc
-            echohl WarningMsg
-            echo "It seems that you didn't map your  to another key."
-            echohl Normal
-        endif
-        echo "By default, Vim's LocalLeader is the backslash (\\) which is problematic"
-        echo "if we are editing LaTeX or Rnoweb (R+LaTeX) files."
-        echohl Question
-        let what = input("Do you want to change the LocalLeader to a comma (,)? [y/N]: ")
-        echohl Normal
-        if RGetYesOrNo(what)
-            let vlines += ['" Change the  key:',
-                        \ 'let maplocalleader = ","']
-        endif
-    endif
-
-    if RFindString(vlines, "") == 0 && RFindString(vlines, "") == 0 && RFindString(vlines, "") == 0
-        redraw
-        echo " "
-        if hasvimrc
-            echohl WarningMsg
-            echo "It seems that you didn't create an easier map for omnicompletion yet."
-            echohl Normal
-        endif
-        echo "By default, you have to press Ctrl+X Ctrl+O to complete the names of"
-        echo "functions and other objects. This is called omnicompletion."
-        echohl Question
-        let what = input("Do you want to press Ctrl+Space to do omnicompletion?  [y/N]: ")
-        echohl Normal
-        if RGetYesOrNo(what)
-            let vlines += ['" Use Ctrl+Space to do omnicompletion:',
-                        \ 'if has("gui_running")',
-                        \ '    inoremap  ',
-                        \ 'else',
-                        \ '    inoremap  ',
-                        \ 'endif']
-        endif
-    endif
-
-    if RFindString(vlines, "RDSendLine") == 0 || RFindString(vlines, "RDSendSelection") == 0
-        redraw
-        echo " "
-        if hasvimrc
-            echohl WarningMsg
-            echo "It seems that you didn't create an easier map to"
-            echo "either send lines or send selected lines."
-            echohl Normal
-        endif
-        echo "By default, you have to press \\d to send one line of code to R"
-        echo "and \\ss to send a selection of lines."
-        echohl Question
-        let what = input("Do you prefer to press the space bar to send lines and selections\nto R Console? [y/N]: ")
-        echohl Normal
-        if RGetYesOrNo(what)
-            let vlines += ['" Press the space bar to send lines (in Normal mode) and selections to R:',
-                        \ 'vmap  RDSendSelection',
-                        \ 'nmap  RDSendLine']
-        endif
-    endif
-
-    if has("unix") && has("syntax") && RFindString(vlines, "t_Co") == 0
-        redraw
-        echo " "
-        echo "Vim is capable of displaying 256 colors in terminal emulators. However, it"
-        echo "doesn't always detect that the terminal has this feature and defaults to"
-        echo "using only 8 colors."
-        echohl Question
-        let what = input("Do you want to enable the use of 256 colors whenever possible? [y/N]: ")
-        echohl Normal
-        if RGetYesOrNo(what)
-            let vlines += ['',
-                        \ '" Force Vim to use 256 colors if running in a capable terminal emulator:',
-                        \ 'if &term =~ "xterm" || &term =~ "256" || $DISPLAY != "" || $HAS_256_COLORS == "yes"',
-                        \ '    set t_Co=256',
-                        \ 'endif']
-        endif
-    endif
-
-    if !hasvimrc
-        redraw
-        echo " "
-        echo "There are some options that most Vim users like, but that are not enabled by"
-        echo "default such as highlighting the last search pattern, incremental search"
-        echo "and setting the indentation as four spaces."
-        echohl Question
-        let what = input("Do you want these options in your vimrc? [y/N]: ")
-        echohl Normal
-        if RGetYesOrNo(what)
-            let vlines += ['',
-                        \ '" The lines below were also added by the Vim-R-plugin because you did not have',
-                        \ '" a vimrc yet in the hope that they will help you getting started with Vim:',
-                        \ '',
-                        \ '" Highlight the last searched pattern:',
-                        \ 'set hlsearch',
-                        \ '',
-                        \ '" Show where the next pattern is as you type it:',
-                        \ 'set incsearch',
-                        \ '',
-                        \ '" By default, Vim indents code by 8 spaces. Most people prefer 4 spaces:',
-                        \ 'set sw=4']
-        endif
-    endif
-
-    if RFindString(vlines, "colorscheme") == 0
-        let vlines += ['',
-                    \ '" There are hundreds of color schemes for Vim on the internet, but you can',
-                    \ '" start with color schemes already installed.',
-                    \ '" Click on GVim menu bar "Edit / Color scheme" to know the name of your',
-                    \ '" preferred color scheme, then, remove the double quote (which is a comment',
-                    \ '" character, like the # is for R language) and replace the value "not_defined"',
-                    \ '" below:',
-                    \ '"colorscheme not_defined']
-    endif
-    call writefile(vlines, uvimrc)
-
-    redraw
-    echo " "
-    echohl WarningMsg
-    echo "The changes in your vimrc will be effective"
-    echo "only after you quit Vim and start it again."
-    echohl Question
-    let what = input("Do you want to see your vimrc now? [y/N]: ")
-    echohl Normal
-    if RGetYesOrNo(what)
-        silent exe "tabnew " . uvimrc
-        normal! G
-    endif
-    redraw
-endfunction
-
-" Configure .bashrc
-function! RConfigBash()
-    if filereadable($HOME . "/.bashrc")
-        let blines = readfile($HOME . "/.bashrc")
-        let hastvim = 0
-        for line in blines
-            if line =~ "tvim"
-                let hastvim = 1
-                break
-            endif
-        endfor
-
-        redraw
-        echo " "
-        if hastvim
-            echohl WarningMsg
-            echo "Nothing was added to your ~/.bashrc because the string 'tvim' was found in it."
-            echohl Question
-            let what = input("Do you want to see your ~/.bashrc along with the plugin\ntips on how to configure Bash? [y/N]: ")
-            echohl Normal
-            if RGetYesOrNo(what)
-                silent exe "tabnew " . $HOME . "/.bashrc"
-                silent help r-plugin-bash-setup
-            endif
-        else
-            echo "Vim and Tmux can display up to 256 colors in the terminal emulator,"
-            echo "but we have to configure the TERM environment variable for that."
-            echo "Instead of starting Tmux and then starting Vim, we can configure"
-            echo "Bash to start both at once with the 'tvim' command."
-            if !has("nvim")
-                echo "The 'clientserver' feature must be enabled for automatic update of"
-                echo "the Object Browser and syntax highlight of function names."
-            endif
-            echohl Question
-            let what = input("Do you want that all these features are added to your .bashrc? [y/N]: ")
-            echohl Normal
-            if RGetYesOrNo(what)
-                let blines += ['']
-                if exists("*strftime")
-                    let blines += ['# Lines added by the Vim-R-plugin command :RpluginConfig (' . strftime("%Y-%b-%d %H:%M") . '):']
-                else
-                    let blines += ['# Lines added by the Vim-R-plugin command :RpluginConfig:']
-                endif
-                if has("nvim")
-                    let blines += ['# Change the TERM environment variable (to get 256 colors) and creates',
-                                \ '# a function to run Tmux and Neovim at once:',
-                                \ 'if [ "$TERM" = "xterm" ] || [ "$TERM" = "xterm-256color" ]',
-                                \ 'then',
-                                \ '    export TERM=xterm-256color',
-                                \ '    export HAS_256_COLORS=yes',
-                                \ 'fi',
-                                \ 'if [ "$TERM" = "screen" ] && [ "$HAS_256_COLORS" = "yes" ]',
-                                \ 'then',
-                                \ '    export TERM=screen-256color',
-                                \ 'fi',
-                                \ 'if [ "$HAS_256_COLORS" = "yes" ]',
-                                \ 'then',
-                                \ '    function tvim(){ tmux new-session "TERM=screen-256color nvim $@" ; }',
-                                \ 'else',
-                                \ '    function tvim(){ tmux new-session "nvim $@" ; }',
-                                \ 'fi' ]
-                else
-                    let blines += ['# Change the TERM environment variable (to get 256 colors) and make Vim',
-                                \ '# connecting to X Server even if running in a terminal emulator (to get',
-                                \ '# dynamic update of syntax highlight and Object Browser):',
-                                \ 'if [ "$TERM" = "xterm" ] || [ "$TERM" = "xterm-256color" ]',
-                                \ 'then',
-                                \ '    export TERM=xterm-256color',
-                                \ '    export HAS_256_COLORS=yes',
-                                \ 'fi',
-                                \ 'if [ "$TERM" = "screen" ] && [ "$HAS_256_COLORS" = "yes" ]',
-                                \ 'then',
-                                \ '    export TERM=screen-256color',
-                                \ 'fi',
-                                \ 'if [ "x$DISPLAY" != "x" ]',
-                                \ 'then',
-                                \ '    alias vim="vim --servername VIM"',
-                                \ '    if [ "$HAS_256_COLORS" = "yes" ]',
-                                \ '    then',
-                                \ '        function tvim(){ tmux new-session "TERM=screen-256color vim --servername VIM $@" ; }',
-                                \ '    else',
-                                \ '        function tvim(){ tmux new-session "vim --servername VIM $@" ; }',
-                                \ '    fi',
-                                \ 'else',
-                                \ '    if [ "$HAS_256_COLORS" = "yes" ]',
-                                \ '    then',
-                                \ '        function tvim(){ tmux new-session "TERM=screen-256color vim $@" ; }',
-                                \ '    else',
-                                \ '        function tvim(){ tmux new-session "vim $@" ; }',
-                                \ '    fi',
-                                \ 'fi' ]
-                endif
-                call writefile(blines, $HOME . "/.bashrc")
-                if !has("gui_running")
-                    redraw
-                    echo " "
-                    echohl WarningMsg
-                    echo "The changes in your bashrc will be effective"
-                    echo "only after you exit from Bash and start it again"
-                    if $DISPLAY == ""
-                        echo "(logoff and login again)."
-                    else
-                        echo "(close the terminal emulator and start it again)."
-                    endif
-                endif
-                echohl Question
-                let what = input("Do you want to see your .bashrc now? [y/N]: ")
-                echohl Normal
-                if RGetYesOrNo(what)
-                    silent exe "tabnew " . $HOME . "/.bashrc"
-                    normal! G32k
-                endif
-            endif
-        endif
-        redraw
-    endif
-endfunction
-
-function! RConfigTmux()
-    redraw
-    echo " "
-    if filereadable($HOME . "/.tmux.conf")
-        echohl WarningMsg
-        echo "You already have a .tmux.conf."
-        echohl Question
-        let what = input("Do you want to see it along with the plugin tips on how to\nconfigure Tmux? [y/N]: ")
-        echohl Normal
-        if RGetYesOrNo(what)
-            silent exe "tabnew " . $HOME . "/.tmux.conf"
-            silent help r-plugin-tmux-setup
-        endif
-        redraw
-    else
-        echohl Question
-        let what = input("You don't have a ~/.tmux.conf yet. Should I create it now? [y/N]: ")
-        echohl Normal
-        if RGetYesOrNo(what)
-            let tlines = ['']
-            if exists("*strftime")
-                let tlines += ['# Lines added by the Vim-R-plugin command :RpluginConfig (' . strftime("%Y-%b-%d %H:%M") . '):']
-            else
-                let tlines += ['# Lines added by the Vim-R-plugin command :RpluginConfig:']
-            endif
-            let tlines += ["set-option -g prefix C-a",
-                        \ "unbind-key C-b",
-                        \ "bind-key C-a send-prefix",
-                        \ '# Set "status on" if you usually create new Tmux windows',
-                        \ "set -g status off",
-                        \ "set-window-option -g mode-keys vi",
-                        \ "set -g terminal-overrides 'xterm*:smcup@:rmcup@'",
-                        \ "set -g mode-mouse on",
-                        \ "set -g mouse-select-pane on",
-                        \ "set -g mouse-resize-pane on"]
-            call writefile(tlines, $HOME . "/.tmux.conf")
-            redraw
-            echo " "
-            echohl Question
-            let what = input("Do you want to see your .tmux.conf now? [y/N]: ")
-            echohl Normal
-            if RGetYesOrNo(what)
-                silent exe "tabnew " . $HOME . "/.tmux.conf"
-            endif
-            redraw
-        endif
-    endif
-endfunction
-
-function! RConfigVimR()
-    if has("nvim")
-        let s:vimprog = "nvim"
-    else
-        let s:vimprog = "vim"
-    endif
-    exe "helptags " . g:rplugin_uservimfiles . "/doc"
-    if string(g:SendCmdToR) == "function('SendCmdToR_fake')"
-        if hasmapto("RStart", "n")
-            let cmd = RNMapCmd("RStart")
-        else
-            if exists("g:maplocalleader")
-                let cmd = g:maplocalleader . "rf"
-            else
-                let cmd = "\\rf"
-            endif
-        endif
-        call RWarningMsg("Please type  " . cmd . "  to start R before running  :RpluginConfig")
-        return
-    endif
-    if RConfigRprofile()
-        return
-    endif
-    call RConfigVimrc()
-    if has("win32") || has("win64")
-        return
-    endif
-    call RConfigTmux()
-    call RConfigBash()
-endfunction
-
-call RConfigVimR()
-

From b7965c62a693ed544289f5c921cb74977df7e89a Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sun, 14 Dec 2014 12:45:09 -0500
Subject: [PATCH 0878/1050] Support multilib message and R History Do the right
 thing again when the help for a topic is present in more than one package.
 Show R history in Vim.

---
 r-plugin/common_global.vim | 58 ++++++++++++++++++++++++++++++++++----
 1 file changed, 52 insertions(+), 6 deletions(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 685a56b..8378af8 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -936,8 +936,8 @@ function WaitVimComStart()
         let g:rplugin_vimcom_home = vr[1]
         let g:rplugin_vimcomport = vr[2]
         let g:rplugin_r_pid = vr[3]
-        if g:rplugin_vimcom_version != "1.1.12"
-            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.1.12.')
+        if g:rplugin_vimcom_version != "1.1.13"
+            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.1.13.')
             sleep 1
         endif
         if has("nvim")
@@ -2328,25 +2328,57 @@ function AskRDoc(rkeyword, package, getclass)
         let rcmd = 'vimcom:::vim.help("' . a:rkeyword . '", ' . g:rplugin_htw . 'L, ' . classfor . ')'
     endif
 
-    call delete($VIMRPLUGIN_TMPDIR . "/eval_reply")
     call g:SendToVimCom("\x08" . $VIMINSTANCEID . rcmd, "I")
 endfunction
 
 " This function is called by vimcom
 function ShowRDoc(rkeyword)
+    let rkeyw = a:rkeyword
+    if a:rkeyword =~ "^MULTILIB"
+        let msgs = split(a:rkeyword)
+        if has("nvim")
+            let msg = "The topic '" . msgs[-1] . "' was found in more than one library:\n"
+            for idx in range(1, len(msgs) - 2)
+                let msg .= idx . " : " . msgs[idx] . "\n"
+            endfor
+            redraw
+            let chn = input(msg . "Please, select one of them: ")
+            if chn > 0 && chn < (len(msgs) - 1)
+                call delete($VIMRPLUGIN_TMPDIR . "/eval_reply")
+                call g:SendToVimCom("\x08" . $VIMINSTANCEID . 'vimcom:::vim.help("' . msgs[-1] . '", ' . g:rplugin_htw . 'L, package="' . msgs[chn] . '")')
+            endif
+            return
+        else
+            " Vim cannot receive message from vimcom before replying to this message
+            let flines = ['',
+                        \ 'The topic "' . msgs[-1] . '" was found in more than one library.',
+                        \ 'Press  over one of them to see the R documentation:',
+                        \ '']
+            for idx in range(1, len(msgs) - 2)
+                let flines += [ '   ' . msgs[idx] ]
+            endfor
+            call writefile(flines, g:rplugin_docfile)
+            let rkeyw = msgs[-1]
+        endif
+    endif
+
     if bufname("%") =~ "Object_Browser" || bufname("%") == "R_Output"
         let savesb = &switchbuf
         set switchbuf=useopen,usetab
         exe "sb " . b:rscript_buffer
         exe "set switchbuf=" . savesb
     endif
-    call SetRTextWidth(a:rkeyword)
+    call SetRTextWidth(rkeyw)
 
     " Local variables that must be inherited by the rdoc buffer
     let g:tmp_tmuxsname = g:rplugin_tmuxsname
     let g:tmp_objbrtitle = b:objbrtitle
 
     let rdoccaption = substitute(s:rdoctitle, '\', '', "g")
+    if a:rkeyword =~ "R History"
+        let rdoccaption = "R_History"
+        let s:rdoctitle = "R_History"
+    endif
     if bufloaded(rdoccaption)
         let curtabnr = tabpagenr()
         let savesb = &switchbuf
@@ -2390,8 +2422,22 @@ function ShowRDoc(rkeyword)
     sil normal! ggdG
     let fcntt = readfile(g:rplugin_docfile)
     call setline(1, fcntt)
-    set filetype=rdoc
-    normal! gg
+    if a:rkeyword =~ "R History"
+        set filetype=r
+        call cursor(1, 1)
+    elseif a:rkeyword =~ "^MULTILIB"
+        syn match Special ''
+        exe 'syn match String /"' . rkeyw . '"/'
+        for idx in range(1, len(msgs) - 2)
+            exe "syn match PreProc '^   " . msgs[idx] . "'"
+        endfor
+        exe 'nmap   :call AskRDoc("' . rkeyw . '", expand(""), 0)'
+        redraw
+        call cursor(5, 4)
+    else
+        set filetype=rdoc
+        call cursor(1, 1)
+    endif
     let @@ = save_unnamed_reg
     setlocal nomodified
     redraw

From 09ec5c23260f8cbd9aebdfd0e7f7b43cc63b2419 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sun, 14 Dec 2014 15:21:30 -0500
Subject: [PATCH 0879/1050] Call to SumatraFwd() on Windows The code in the
 vimcom package is not working yet.

---
 ftplugin/rnoweb_rplugin.vim | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/ftplugin/rnoweb_rplugin.vim b/ftplugin/rnoweb_rplugin.vim
index cb43139..79e28e4 100644
--- a/ftplugin/rnoweb_rplugin.vim
+++ b/ftplugin/rnoweb_rplugin.vim
@@ -567,7 +567,17 @@ function! SyncTeX_forward(...)
         endif
         call system("wmctrl -a '" . basenm . ".pdf'")
     elseif g:rplugin_pdfviewer == "sumatra"
-        call RWarningMsg("Support for Sumatra not implemented yet.")
+        if !exists("g:rplugin_vimcom_lib")
+            call RWarningMsg("Did you start R?")
+            return
+        endif
+        let wbasenm = substitute(basenm, '/', '\\', 'g')
+        let exstr = '[ForwardSearch("' . basenm . '.pdf' . '","' . basenm . '.tex' . '",' . texln . ',0,0,1)'
+        echomsg "[DEBUG msg] Trying to sending through DDE: " . exstr
+        let repl = libcall(g:rplugin_vimcom_lib, "SumatraFwd", exstr)
+        if repl != "OK"
+            call RWarningMsg(repl)
+        endif
     elseif g:rplugin_pdfviewer == "skim"
         " This command is based on Skim wiki (not tested)
         call system("/Applications/Skim.app/Contents/SharedSupport/displayline " . texln . " '" . basenm . ".pdf' 2> /dev/null >/dev/null &")

From a2715f2af0d58cc988301f88fe16262f204b0020 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sun, 14 Dec 2014 15:45:55 -0500
Subject: [PATCH 0880/1050] Use Sumatra command line instead of DDE.

---
 ftplugin/rnoweb_rplugin.vim | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/ftplugin/rnoweb_rplugin.vim b/ftplugin/rnoweb_rplugin.vim
index 79e28e4..46d882e 100644
--- a/ftplugin/rnoweb_rplugin.vim
+++ b/ftplugin/rnoweb_rplugin.vim
@@ -567,16 +567,8 @@ function! SyncTeX_forward(...)
         endif
         call system("wmctrl -a '" . basenm . ".pdf'")
     elseif g:rplugin_pdfviewer == "sumatra"
-        if !exists("g:rplugin_vimcom_lib")
-            call RWarningMsg("Did you start R?")
-            return
-        endif
-        let wbasenm = substitute(basenm, '/', '\\', 'g')
-        let exstr = '[ForwardSearch("' . basenm . '.pdf' . '","' . basenm . '.tex' . '",' . texln . ',0,0,1)'
-        echomsg "[DEBUG msg] Trying to sending through DDE: " . exstr
-        let repl = libcall(g:rplugin_vimcom_lib, "SumatraFwd", exstr)
-        if repl != "OK"
-            call RWarningMsg(repl)
+        if g:rplugin_sumatra_path != "" || FindSumatra()
+            silent exe '!start "' . g:rplugin_sumatra_path . '" -reuse-instance -forward-search ' . basenm . '.tex ' . texln . ' -inverse-search "gvim --servername ' . v:servername . " --remote-expr SyncTeX_backward('%f',%l)" . '" "' . basenm . '.pdf"'
         endif
     elseif g:rplugin_pdfviewer == "skim"
         " This command is based on Skim wiki (not tested)

From a7b007a01387c263d0f985955490bddc2e3a86c3 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sun, 14 Dec 2014 19:41:27 -0500
Subject: [PATCH 0881/1050] Replace FindRConsole() with IsRRuning()

---
 r-plugin/windows.vim | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/r-plugin/windows.vim b/r-plugin/windows.vim
index 6928887..3d03bd9 100644
--- a/r-plugin/windows.vim
+++ b/r-plugin/windows.vim
@@ -127,13 +127,13 @@ function StartR_Windows()
         call InitializePython()
     endif
     if string(g:SendCmdToR) != "function('SendCmdToR_fake')"
-        let repl = libcall(g:rplugin_vimcom_lib, "FindRConsole", 'R Console')
-        if repl == "NotFound"
+        let repl = libcall(g:rplugin_vimcom_lib, "IsRRunning", 'No argument')
+        if repl =~ "^Yes"
+            call RWarningMsg('R is already running.')
+            return
+        else
             let g:SendCmdToR = function('SendCmdToR_fake')
             let g:rplugin_r_pid = 0
-        else
-            call RWarningMsg('There is already a window called "R Console".')
-            return
         endif
     endif
     let vrph = $VIMRPLUGIN_HOME

From 126b3f4b823c1c7463f49cbc6a4ab469f75c0342 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sun, 14 Dec 2014 20:53:05 -0500
Subject: [PATCH 0882/1050] New function: ClearRInfo()

---
 r-plugin/common_global.vim | 46 ++++++++++++++++++++------------------
 r-plugin/windows.vim       |  4 ++++
 2 files changed, 28 insertions(+), 22 deletions(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 8378af8..a6e337b 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -1452,8 +1452,7 @@ function SendCmdToR_TmuxSplit(cmd)
         let rlog = substitute(rlog, "\n", " ", "g")
         let rlog = substitute(rlog, "\r", " ", "g")
         call RWarningMsg(rlog)
-        let g:SendCmdToR = function('SendCmdToR_fake')
-        let g:rplugin_r_pid = 0
+        call ClearRInfo()
         return 0
     endif
     return 1
@@ -1474,8 +1473,7 @@ function SendCmdToR_Term(cmd)
         let rlog = substitute(rlog, '\n', ' ', 'g')
         let rlog = substitute(rlog, '\r', ' ', 'g')
         call RWarningMsg(rlog)
-        let g:SendCmdToR = function('SendCmdToR_fake')
-        let g:rplugin_r_pid = 0
+        call ClearRInfo()
         return 0
     endif
     return 1
@@ -1929,9 +1927,7 @@ endfunction
 function RClearConsole()
     if (has("win32") || has("win64"))
         if g:vimrplugin_libcall_send
-            if g:vimrplugin_Rterm
-                let repl = libcall(g:rplugin_vimcom_lib, "RClearConsole()", "Rterm")
-            else
+            if !g:vimrplugin_Rterm
                 let repl = libcall(g:rplugin_vimcom_lib, "RClearConsole()", "Rgui")
             endif
         else
@@ -1982,6 +1978,26 @@ function CloseExternalOB()
     endif
 endfunction
 
+function ClearRInfo()
+    if exists("g:rplugin_rconsole_pane")
+        unlet g:rplugin_rconsole_pane
+    endif
+
+    call delete($VIMRPLUGIN_TMPDIR . "/globenv_" . $VIMINSTANCEID)
+    call delete($VIMRPLUGIN_TMPDIR . "/liblist_" . $VIMINSTANCEID)
+    call delete($VIMRPLUGIN_TMPDIR . "/libnames_" . $VIMINSTANCEID)
+    call delete($VIMRPLUGIN_TMPDIR . "/GlobalEnvList_" . $VIMINSTANCEID)
+    call delete($VIMRPLUGIN_TMPDIR . "/vimcom_running_" . $VIMINSTANCEID)
+    call delete($VIMRPLUGIN_TMPDIR . "/rconsole_hwnd_" . $VIMRPLUGIN_SECRET)
+    let g:SendCmdToR = function('SendCmdToR_fake')
+    let g:rplugin_r_pid = 0
+    let g:rplugin_vimcomport = 0
+
+    if g:rplugin_do_tmux_split && g:vimrplugin_tmux_title != "automatic" && g:vimrplugin_tmux_title != ""
+        call system("tmux set automatic-rename on")
+    endif
+endfunction
+
 " Quit R
 function RQuit(how)
     if a:how != "restartR"
@@ -2019,24 +2035,10 @@ function RQuit(how)
     endif
 
     sleep 50m
-
     call CloseExternalOB()
 
-    if exists("g:rplugin_rconsole_pane")
-        unlet g:rplugin_rconsole_pane
-    endif
+    call ClearRInfo()
 
-    call delete($VIMRPLUGIN_TMPDIR . "/globenv_" . $VIMINSTANCEID)
-    call delete($VIMRPLUGIN_TMPDIR . "/liblist_" . $VIMINSTANCEID)
-    call delete($VIMRPLUGIN_TMPDIR . "/libnames_" . $VIMINSTANCEID)
-    call delete($VIMRPLUGIN_TMPDIR . "/GlobalEnvList_" . $VIMINSTANCEID)
-    call delete($VIMRPLUGIN_TMPDIR . "/vimcom_running_" . $VIMINSTANCEID)
-    let g:SendCmdToR = function('SendCmdToR_fake')
-    let g:rplugin_r_pid = 0
-    let g:rplugin_vimcomport = 0
-    if g:rplugin_do_tmux_split && g:vimrplugin_tmux_title != "automatic" && g:vimrplugin_tmux_title != ""
-        call system("tmux set automatic-rename on")
-    endif
     if has("nvim")
         if g:rplugin_do_tmux_split
             " Force Neovim to update the window size
diff --git a/r-plugin/windows.vim b/r-plugin/windows.vim
index 3d03bd9..e4ce8b6 100644
--- a/r-plugin/windows.vim
+++ b/r-plugin/windows.vim
@@ -187,6 +187,10 @@ function SendCmdToR_Windows(cmd)
     endif
     if g:vimrplugin_libcall_send
         let repl = libcall(g:rplugin_vimcom_lib, "SendToRConsole", cmd)
+        if repl != "OK"
+            call RWarningMsg(repl)
+            call ClearRInfo()
+        endif
     else
         let slen = len(cmd)
         let str = ""

From c95d3bde65daa42aeebad4d681c52d3c175589df Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Tue, 16 Dec 2014 16:21:19 -0500
Subject: [PATCH 0883/1050] New options: vimrplugin_compldir and
 vimrplugin_tmpdir - Move files created by R for omni completion and syntax
 highlight of R   functions to $AppData in Windows and to
 ~/.cache/Vim-R-plugin in Linux, and   let users change these directories
 paths.

- Fix bug: omnicompletion was not working when the library has their omnls_
  and fun_ files written for the first time.

- Avoid E341 (Internal error: lalloc(0, )) in a more efficient way.
---
 Makefile                    |  22 +--
 autoload/rcomplete.vim      |  14 +-
 doc/r-plugin.txt            | 150 +++++++++-------
 ftplugin/rbrowser.vim       |   5 +-
 ftplugin/rdoc.vim           |   1 -
 ftplugin/rmd_rplugin.vim    |   1 -
 ftplugin/rnoweb_rplugin.vim |   6 +-
 list_for_vimball            |   1 +
 r-plugin/common_buffer.vim  |  21 +--
 r-plugin/common_global.vim  | 329 +++++++++++-------------------------
 r-plugin/functions.vim      | 193 +++++++++++++++------
 r-plugin/gui_running.vim    |   2 +-
 r-plugin/objlist/README     |  10 +-
 r-plugin/osx.vim            |   1 +
 r-plugin/setcompldir.vim    |  27 +++
 r-plugin/windows.vim        |   3 -
 syntax/r.vim                |   4 +-
 17 files changed, 391 insertions(+), 399 deletions(-)
 create mode 100644 r-plugin/setcompldir.vim

diff --git a/Makefile b/Makefile
index 543bb32..0e82848 100644
--- a/Makefile
+++ b/Makefile
@@ -64,34 +64,34 @@ deb:
 	  - ftplugin/rdoc.vim\n\
 	  - ftplugin/rhelp.vim\n\
 	  - ftplugin/rhelp_rplugin.vim\n\
-	  - ftplugin/rnoweb.vim\n\
-	  - ftplugin/rnoweb_rplugin.vim\n\
 	  - ftplugin/rmd.vim\n\
 	  - ftplugin/rmd_rplugin.vim\n\
+	  - ftplugin/rnoweb.vim\n\
+	  - ftplugin/rnoweb_rplugin.vim\n\
 	  - ftplugin/rrst.vim\n\
 	  - ftplugin/rrst_rplugin.vim\n\
 	  - indent/r.vim\n\
-	  - indent/rnoweb.vim\n\
 	  - indent/rhelp.vim\n\
 	  - indent/rmd.vim\n\
+	  - indent/rnoweb.vim\n\
 	  - indent/rrst.vim\n\
 	  - r-plugin/common_buffer.vim\n\
 	  - r-plugin/common_global.vim\n\
+	  - r-plugin/functions.vim\n\
+	  - r-plugin/global_r_plugin.vim\n\
+	  - r-plugin/gui_running.vim\n\
+	  - r-plugin/nvimbuffer.vim\n\
+	  - r-plugin/setcompldir.vim\n\
 	  - r-plugin/synctex_evince_backward.py\n\
 	  - r-plugin/synctex_evince_forward.py\n\
 	  - r-plugin/synctex_okular_backward.sh\n\
-	  - r-plugin/global_r_plugin.vim\n\
-	  - r-plugin/functions.vim\n\
-	  - r-plugin/gui_running.vim
-	  - r-plugin/nvimbuffer.vim
-	  - r-plugin/osx.vim
 	  - syntax/r.vim\n\
+	  - syntax/rbrowser.vim\n\
 	  - syntax/rdoc.vim\n\
-	  - syntax/rout.vim\n\
+	  - syntax/rhelp.vim\n\
 	  - syntax/rmd.vim\n\
+	  - syntax/rout.vim\n\
 	  - syntax/rrst.vim\n\
-	  - syntax/rhelp.vim\n\
-	  - syntax/rbrowser.vim\n\
 	" > /tmp/vim-r-plugin-tmp/usr/share/vim/registry/vim-r-plugin.yaml
 	# Create the copyright
 	echo "Copyright (C) 2011-2014 Jakson Aquino\n\
diff --git a/autoload/rcomplete.vim b/autoload/rcomplete.vim
index 669d98c..0f80c60 100644
--- a/autoload/rcomplete.vim
+++ b/autoload/rcomplete.vim
@@ -10,14 +10,14 @@ function BuildROmniList()
         return
     endif
 
-    let omnilistcmd = 'vimcom:::vim.bol("' . $VIMRPLUGIN_TMPDIR . "/GlobalEnvList_" . $VIMINSTANCEID . '"'
+    let omnilistcmd = 'vimcom:::vim.bol("' . g:rplugin_tmpdir . "/GlobalEnvList_" . $VIMINSTANCEID . '"'
     if g:vimrplugin_allnames == 1
         let omnilistcmd = omnilistcmd . ', allnames = TRUE'
     endif
     let omnilistcmd = omnilistcmd . ')'
 
-    call delete($VIMRPLUGIN_TMPDIR . "/vimbol_finished")
-    call delete($VIMRPLUGIN_TMPDIR . "/eval_reply")
+    call delete(g:rplugin_tmpdir . "/vimbol_finished")
+    call delete(g:rplugin_tmpdir . "/eval_reply")
     call g:SendToVimCom("\x08" . $VIMINSTANCEID . omnilistcmd, "I")
     if g:rplugin_vimcomport == 0
         sleep 500m
@@ -31,7 +31,7 @@ function BuildROmniList()
     endif
     sleep 20m
     let ii = 0
-    while !filereadable($VIMRPLUGIN_TMPDIR . "/vimbol_finished") && ii < 5
+    while !filereadable(g:rplugin_tmpdir . "/vimbol_finished") && ii < 5
         let ii += 1
         sleep
     endwhile
@@ -41,7 +41,7 @@ function BuildROmniList()
         return
     endif
 
-    let g:rplugin_globalenvlines = readfile($VIMRPLUGIN_TMPDIR . "/GlobalEnvList_" . $VIMINSTANCEID)
+    let g:rplugin_globalenvlines = readfile(g:rplugin_tmpdir . "/GlobalEnvList_" . $VIMINSTANCEID)
 endfunction
 
 fun! rcomplete#CompleteR(findstart, base)
@@ -63,11 +63,11 @@ fun! rcomplete#CompleteR(findstart, base)
             return resp
         endif
 
-        if len(g:rplugin_liblist) == 0
+        if len(g:rplugin_omni_lines) == 0
             call add(resp, {'word': a:base, 'menu': " [ List is empty. Did you load vimcom package? ]"})
         endif
 
-        let flines = g:rplugin_liblist + g:rplugin_globalenvlines
+        let flines = g:rplugin_omni_lines + g:rplugin_globalenvlines
         " The char '$' at the end of 'a:base' is treated as end of line, and
         " the pattern is never found in 'line'.
         let newbase = '^' . substitute(a:base, "\\$$", "", "")
diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 7897da9..c4fc945 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -247,6 +247,8 @@ dependencies:
 
     * Vim's version must be >= 7.4: http://www.vim.org/download.php
 
+    * Sumatra PDF (only if you write Rnoweb code).
+
 Add the following lines to your `Rprofile`:
 >
    options(vimcom.verbose = 1)
@@ -544,7 +546,7 @@ CTRL-A can also be used to complete knitr chunk options if the cursor is
 inside the chunk header.
 
 If R is not running or if it is running but is busy the completion will be
-based on information from the packages listed by |vimrplugin_permanent_libs|
+based on information from the packages listed by |vimrplugin_start_libs|
 (provided that the libraries were loaded at least once during a session of
 Vim-R-plugin usage). Otherwise, the pop up menu for completion of function
 arguments will include an additional line with the name of the library where
@@ -563,7 +565,7 @@ trigger the autocompletion of R objects names or hit CTRL-D to list the
 possible completions (see |cmdline-completion| for details on the various ways
 of getting command-line completion). The list of objects used for
 completion is the same available for omnicompletion (see
-|vimrplugin_permanent_libs|). You may close the R documentation buffer by
+|vimrplugin_start_libs|). You may close the R documentation buffer by
 simply pressing `q`.
 
 You can source all .R files in a directory with the Normal mode command
@@ -620,7 +622,7 @@ configuration details.
 The plugin adds some features to the default syntax highlight of R code. One
 such feature is the highlight of R functions. However, functions are
 highlighted only if their libraries are loaded by R (but see
-|vimrplugin_permanent_libs|).
+|vimrplugin_start_libs|).
 
 Note: If you have too many loaded packages Vim may be unable to load the list
 of functions for syntax highlight.
@@ -646,13 +648,13 @@ Only the names of objects in .GlobalEnv and in loaded libraries are completed,
 and the |clientserver| feature is required to get the list of loaded libraries
 automatically updated. If either R is not running or Vim is running without
 the |clientserver| feature, only objects of libraries listed in
-|vimrplugin_permanent_libs| will have their names completed.
+|vimrplugin_start_libs| will have their names completed.
 
 Vim uses one file to store the names of .GlobalEnv objects and a list of files
-for all other objects. The .GlobalEnv list is stored in the
-/tmp/r-plugin-yourlogin directory and is deleted when you quits Vim. The other
-files are stored in ~/.vim/r-plugin/objlist/ and remain available until you
-manually delete them.
+for all other objects. The .GlobalEnv list is stored in the `$VIMRPLUGIN_TMPDIR`
+directory and is deleted when you quits Vim. The other files are stored in the
+`$VIMRPLUGIN_COMPLDIR` directory and remain available until you manually delete
+them.
 
 
 ------------------------------------------------------------------------------
@@ -1084,7 +1086,7 @@ When Vim cannot receive messages, the result is:
      omnicompletion are not immediately updated after you load a new R
      package. They are updated only after the |CursorHold| event is triggered,
      that is, after you stay 'updatetime' milliseconds in Normal mode doing
-     nothing. For a workaround, see |vimrplugin_permanent_libs|.
+     nothing. For a workaround, see |vimrplugin_start_libs|.
 
 On Linux you may find Vim binaries without the |clientserver| feature if
 you install packages such as vim-nox on Debian/Ubuntu or vim-enhanced on
@@ -1117,36 +1119,36 @@ through the rf command because the plugin was designed to connect
 each Vim instance with its own R instance.
 
 If you start R before Vim, it will not inherit from Vim the environment
-variables VIMRPLUGIN_TMPDIR, VIMRPLUGIN_HOME, VIMEDITOR_SVRNM, VIMINSTANCEID,
-and VIMRPLUGIN_SECRET. The first one is the path used by the R package vimcom
-to save temporary files used by the Vim-R-plugin to: perform omnicompletion,
-show R documentation in a Vim buffer, and update the Object Browser. The two
-last ones are used by the Vim-R-plugin and by vimcom to know that the
-connections are valid. If you use Vim to start R, but then closes Vim, some
-variables will become outdated. Additionally, the Vim-R-plugin sets the value
-of its internal variable SendCmdToR from SendCmdToR_fake to the appropriate
-value when R is successfully started. It is possible to set the values of all
-those variables manually, but, as you can see below, it is not practical to do
-so. If you have either started R before Vim or closed Vim and opened it again
-and really want full communication between Vim and R, you can try the
-following (not all procedures are necessary for all cases):
+variables VIMRPLUGIN_TMPDIR, VIMRPLUGIN_COMPLDIR, VIMEDITOR_SVRNM,
+VIMINSTANCEID, and VIMRPLUGIN_SECRET. The first one is the path used by the R
+package vimcom to save temporary files used by the Vim-R-plugin to: perform
+omnicompletion, show R documentation in a Vim buffer, and update the Object
+Browser. The two last ones are used by the Vim-R-plugin and by vimcom to know
+that the connections are valid. If you use Vim to start R, but then closes
+Vim, some variables will become outdated. Additionally, the Vim-R-plugin sets
+the value of its internal variable SendCmdToR from SendCmdToR_fake to the
+appropriate value when R is successfully started. It is possible to set the
+values of all those variables manually, but, as you can see below, it is not
+practical to do so. If you have either started R before Vim or closed Vim and
+opened it again and really want full communication between Vim and R, you can
+try the following (not all procedures are necessary for all cases):
 
    In Normal mode Vim do:
 >
-   :echo $VIMRPLUGIN_TMPDIR
+   :echo g:rplugin_tmpdir
+   :echo g:rplugin_compldir
    :echo $VIMINSTANCEID
    :echo $VIMRPLUGIN_SECRET
    :echo $VIMEDITOR_SVRNM
-   :echo $VIMRPLUGIN_HOME
 <
    In R do:
 >
    detach("package:vimcom", unload = TRUE)
-   Sys.setenv(VIMRPLUGIN_TMPDIR="T")  # where "T" is what Vim has echoed
-   Sys.setenv(VIMINSTANCEID="I")      # where "I" is what Vim has echoed
-   Sys.setenv(VIMRPLUGIN_SECRET"="S") # where "S" is what Vim has echoed
-   Sys.setenv(VIMEDITOR_SVRNM"="N")   # where "N" is what Vim has echoed
-   Sys.setenv(VIMRPLUGIN_HOME"="H")   # where "H" is what Vim has echoed
+   Sys.setenv(VIMRPLUGIN_TMPDIR="T")    # where "T" is what Vim has echoed
+   Sys.setenv(VIMINSTANCEID="I")        # where "I" is what Vim has echoed
+   Sys.setenv(VIMRPLUGIN_SECRET"="S")   # where "S" is what Vim has echoed
+   Sys.setenv(VIMEDITOR_SVRNM"="N")     # where "N" is what Vim has echoed
+   Sys.setenv(VIMRPLUGIN_COMPLDIR"="C") # where "C" is what Vim has echoed
    library(vimcom)
 <
 If you are running R in a terminal emulator (Linux/Unix) Vim still needs to
@@ -1194,7 +1196,7 @@ is running:
 |vimrplugin_i386|              Use 32 bit version of R
 |vimrplugin_r_path|            Directory where R is
 |vimrplugin_r_args|            Arguments to pass to R
-|vimrplugin_permanent_libs|    Objects for omnicompletion and syntax highlight
+|vimrplugin_start_libs|    Objects for omnicompletion and syntax highlight
 |vimrplugin_routmorecolors|    More syntax highlighting in R output
 |vimrplugin_routnotab|         Show output of R CMD BATCH in new window
 |vimrplugin_indent_commented|  Indent lines commented with the \xx command
@@ -1226,6 +1228,8 @@ is running:
 |vimrplugin_vimcom_wait|       Time to wait for vimcom loading
 |vimrplugin_vim_wd|            Start R in Vim's working directory
 |vimrplugin_user_maps_only|    Only set user specified key bindings
+|vimrplugin_tmpdir|            Where temporary files are created
+|vimrplugin_compldir|          Where lists for omnicompletion are stored
 |r-plugin-SyncTeX|             Options for SyncTeX
 
 
@@ -1510,20 +1514,20 @@ the SDI style of the graphical user interface.
 
 
 ------------------------------------------------------------------------------
-						   *vimrplugin_permanent_libs*
+						   *vimrplugin_start_libs*
 6.9. Omnicompletion and syntax highlight of R functions~
 
 The list of functions to be highlighted and the list of objects for
 omnicompletion are built dynamically as the libraries are loaded by R.
-However, you can set the value of vimrplugin_permanent_libs if you want that
+However, you can set the value of vimrplugin_start_libs if you want that
 the functions and objects of specific packages are respectively highlighted
-and available for omnicompletion even if R is not running. By default, only
-the functions of vanilla R are always highlighted. Below is the default value
-of vimrplugin_permanent_libs:
+and available for omnicompletion even if R is not running yet. By default,
+only the functions of vanilla R are always highlighted. Below is the default
+value of vimrplugin_start_libs:
 >
-   let vimrplugin_permanent_libs = "base,stats,graphics,grDevices,utils,methods"
+   let vimrplugin_start_libs = "base,stats,graphics,grDevices,utils,methods"
 <
-You may also want to define the value of vimrplugin_permanent_libs if you are
+You may also want to define the value of vimrplugin_start_libs if you are
 running Vim without the |clientserver| feature.
 
 
@@ -1936,9 +1940,28 @@ set those key-bindings specified by the user, put in your vimrc:
     let vimrplugin_user_maps_only = 1
 <
 
+------------------------------------------------------------------------------
+							   *vimrplugin_tmpdir*
+							 *vimrplugin_compldir*
+6.33 Temporary files directories~
+
+You can change the directories where temporary files are created and
+stored by setting in your |vimrc| the values of vimrplugin_tmpdir and
+vimrplugin_compldir, as in the example below:
+>
+   let vimrplugin_tmpdir = "/dev/shm/R_tmp_dir"
+   let vimrplugin_compldir = "~/.cache/Vim-R-plugin"
+<
+The default paths of these directories depend on the operating system. If you
+want to know they are, while editing an R file, do in Normal mode:
+>
+   :echo g:rplugin_tmpdir
+   :echo g:rplugin_compldir
+<
+
 ------------------------------------------------------------------------------
 							    *r-plugin-SyncTeX*
-6.33 SyncTeX support (Linux only)~
+6.34 SyncTeX support (Linux only)~
 
 SyncTeX is a set of communication systems used by some PDF viewers and by some
 text editors which allow users to jump from a specific line in the text editor
@@ -1978,7 +2001,7 @@ Note: The current knitr package (version 1.7) has at least two limitations:
 
 
 ------------------------------------------------------------------------------
-6.33.1 Evince configuration~
+6.34.1 Evince configuration~
 
 If you have Evince installed, the Vim-R-plugin assumes that you are using it
 to view PDF documents and that you run either GVim or Vim in Gnome-Terminal.
@@ -1991,7 +2014,7 @@ to press gp again.
 
 
 ------------------------------------------------------------------------------
-6.33.2 Okular configuration~
+6.34.2 Okular configuration~
 
 You have to configure Okular to call Vim during backward searches.
 In Okular, click in:
@@ -2035,7 +2058,7 @@ requires additional steps because Neovim does not have the argument
 <
 
 ------------------------------------------------------------------------------
-6.33.3 Zathura configuration~
+6.34.3 Zathura configuration~
 
 Zathura (version >= 0.3.1) is also supported. If the terminal emulator is not
 raised during backward search (from PDF to Vim), you have to set the value of
@@ -2049,7 +2072,7 @@ to press gp again.
 ------------------------------------------------------------------------------
                                                        *vimrplugin_vim_window*
 				                       *vimrplugin_synctex*
-6.33.4 Configuring the PDF editor and Vim's window title~
+6.34.4 Configuring the PDF editor and Vim's window title~
 
 If SyncTeX does not work (see above), you may try to set in your |vimrc| the
 values of |vimrplugin_pdfviewer| and vimrplugin_vim_window.
@@ -2249,13 +2272,9 @@ Charityware license.
 The following files are part of the plugin and should be in your ~/.vim
 directory after the installation:
 
-   ftdetect/r.vim
-   indent/r.vim
-   indent/rmd.vim
-   indent/rrst.vim
-   indent/rnoweb.vim
-   indent/rhelp.vim
    autoload/rcomplete.vim
+   doc/r-plugin.txt
+   ftdetect/r.vim
    ftplugin/r.vim
    ftplugin/r_rplugin.vim
    ftplugin/rbrowser.vim
@@ -2264,33 +2283,37 @@ directory after the installation:
    ftplugin/rhelp_rplugin.vim
    ftplugin/rmd.vim
    ftplugin/rmd_rplugin.vim
-   ftplugin/rrst.vim
-   ftplugin/rrst_rplugin.vim
    ftplugin/rnoweb.vim
    ftplugin/rnoweb_rplugin.vim
-   syntax/rout.vim
-   syntax/r.vim
-   syntax/rhelp.vim
-   syntax/rmd.vim
-   syntax/rrst.vim
-   syntax/rdoc.vim
-   syntax/rbrowser.vim
-   doc/r-plugin.txt
+   ftplugin/rrst.vim
+   ftplugin/rrst_rplugin.vim
+   indent/r.vim
+   indent/rhelp.vim
+   indent/rmd.vim
+   indent/rnoweb.vim
+   indent/rrst.vim
    r-plugin/common_buffer.vim
    r-plugin/common_global.vim
    r-plugin/functions.vim
    r-plugin/global_r_plugin.vim
    r-plugin/gui_running.vim
    r-plugin/nvimbuffer.vim
-   r-plugin/objlist/README
    r-plugin/osx.vim
    r-plugin/r.snippets
    r-plugin/rmd.snippets
+   r-plugin/setcompldir.vim
    r-plugin/synctex_evince_backward.py
    r-plugin/synctex_evince_forward.py
    r-plugin/synctex_okular_backward.sh
    r-plugin/windows.py
    r-plugin/windows.vim
+   syntax/r.vim
+   syntax/rbrowser.vim
+   syntax/rdoc.vim
+   syntax/rhelp.vim
+   syntax/rmd.vim
+   syntax/rout.vim
+   syntax/rrst.vim
 
 
 ==============================================================================
@@ -2777,10 +2800,9 @@ please read this document from the beginning.
        library(vimcom)
 
        # Use the text based web browser w3m to navigate through R docs
-       # in Linux Console:
+       # in Linux Console after help.start():
        if(Sys.getenv("TMUX") != "" && Sys.getenv("DISPLAY") == "")
-	   options(browser = function(u) system(paste0("tmux new-window 'w3m ", u, "'")),
-                   help_type = "html")
+	   options(browser = function(u) system(paste0("tmux new-window 'w3m ", u, "'")))
    }
 <
 
@@ -2841,7 +2863,7 @@ See also |vimrplugin_r_in_buffer|.
 							       *r-plugin-news*
 10. News~
 
-1.1.1 (2014-12-13)
+1.1.1 (2014-12-16)
 
  * Change commands gn and gN into gn and gN.
 
@@ -2855,6 +2877,8 @@ See also |vimrplugin_r_in_buffer|.
 
  * Removed command :RpluginConfig.
 
+ * Rename vimrplugin_permanent_libs into vimrplugin_start_libs
+
 1.1 (2014-11-13)
 
  * Version update for Linux/Unix only. May not work on Windows or Mac.
diff --git a/ftplugin/rbrowser.vim b/ftplugin/rbrowser.vim
index f1cb9d3..6f6cf3b 100644
--- a/ftplugin/rbrowser.vim
+++ b/ftplugin/rbrowser.vim
@@ -1,7 +1,6 @@
 " Vim filetype plugin file
 " Language: R Browser (generated by the Vim-R-plugin)
 " Maintainer: Jakson Alves de Aquino 
-" Last Change:	Sat Dec 13, 2014  07:58PM
 
 
 " Only do this when not yet done for this buffer
@@ -86,9 +85,9 @@ function! UpdateOB(what)
     sil normal! ggdG
     let @@ = save_unnamed_reg 
     if wht == "GlobalEnv"
-        let fcntt = readfile($VIMRPLUGIN_TMPDIR . "/globenv_" . $VIMINSTANCEID)
+        let fcntt = readfile(g:rplugin_tmpdir . "/globenv_" . $VIMINSTANCEID)
     else
-        let fcntt = readfile($VIMRPLUGIN_TMPDIR . "/liblist_" . $VIMINSTANCEID)
+        let fcntt = readfile(g:rplugin_tmpdir . "/liblist_" . $VIMINSTANCEID)
     endif
     call setline(1, fcntt)
     call cursor(curline, curcol)
diff --git a/ftplugin/rdoc.vim b/ftplugin/rdoc.vim
index 82b2629..60d0284 100644
--- a/ftplugin/rdoc.vim
+++ b/ftplugin/rdoc.vim
@@ -1,7 +1,6 @@
 " Vim filetype plugin file
 " Language: R Documentation (generated by the Vim-R-plugin)
 " Maintainer: Jakson Alves de Aquino 
-" Last Change:	Sat Dec 13, 2014  07:58PM
 
 
 " Only do this when not yet done for this buffer
diff --git a/ftplugin/rmd_rplugin.vim b/ftplugin/rmd_rplugin.vim
index 4855b26..3d3cc97 100644
--- a/ftplugin/rmd_rplugin.vim
+++ b/ftplugin/rmd_rplugin.vim
@@ -157,5 +157,4 @@ call RSetPDFViewer()
 
 call RSourceOtherScripts()
 
-
 let b:undo_ftplugin .= " | unlet! b:IsInRCode b:SourceLines b:PreviousRChunk b:NextRChunk b:SendChunkToR"
diff --git a/ftplugin/rnoweb_rplugin.vim b/ftplugin/rnoweb_rplugin.vim
index 46d882e..476a823 100644
--- a/ftplugin/rnoweb_rplugin.vim
+++ b/ftplugin/rnoweb_rplugin.vim
@@ -612,10 +612,10 @@ function! Run_SyncTeX()
         endif
     elseif has("nvim") && (g:rplugin_pdfviewer == "okular" || g:rplugin_pdfviewer == "zathura") && !exists("g:rplugin_tail_follow")
         let g:rplugin_tail_follow = 1
-        call writefile([], $VIMRPLUGIN_TMPDIR . "/" . g:rplugin_pdfviewer . "_search")
-        call jobstart("RnwSyncTeX", "tail", ["-f", $VIMRPLUGIN_TMPDIR . "/" . g:rplugin_pdfviewer . "_search"])
+        call writefile([], g:rplugin_tmpdir . "/" . g:rplugin_pdfviewer . "_search")
+        call jobstart("RnwSyncTeX", "tail", ["-f", g:rplugin_tmpdir . "/" . g:rplugin_pdfviewer . "_search"])
         autocmd JobActivity RnwSyncTeX call ROnJobActivity()
-        autocmd VimLeave * call delete($VIMRPLUGIN_TMPDIR . "/" . g:rplugin_pdfviewer . "_search") | call delete($VIMRPLUGIN_TMPDIR . "/synctex_back.sh")
+        autocmd VimLeave * call delete(g:rplugin_tmpdir . "/" . g:rplugin_pdfviewer . "_search") | call delete(g:rplugin_tmpdir . "/synctex_back.sh")
     endif
     exe "cd " . substitute(olddir, ' ', '\\ ', 'g')
 endfunction
diff --git a/list_for_vimball b/list_for_vimball
index 708c565..d86cc42 100644
--- a/list_for_vimball
+++ b/list_for_vimball
@@ -31,6 +31,7 @@ r-plugin/functions.vim
 r-plugin/gui_running.vim
 r-plugin/nvimbuffer.vim
 r-plugin/osx.vim
+r-plugin/setcompldir.vim
 r-plugin/windows.py
 r-plugin/windows.vim
 syntax/r.vim
diff --git a/r-plugin/common_buffer.vim b/r-plugin/common_buffer.vim
index 4413b0f..96248dd 100644
--- a/r-plugin/common_buffer.vim
+++ b/r-plugin/common_buffer.vim
@@ -49,14 +49,14 @@ endif
 let b:bname = expand("%:t")
 let b:bname = substitute(b:bname, " ", "",  "g")
 if exists("*getpid") " getpid() was introduced in Vim 7.1.142
-    let b:rsource = $VIMRPLUGIN_TMPDIR . "/Rsource-" . getpid() . "-" . b:bname
+    let b:rsource = g:rplugin_tmpdir . "/Rsource-" . getpid() . "-" . b:bname
 else
     let b:randnbr = system("echo $RANDOM")
     let b:randnbr = substitute(b:randnbr, "\n", "", "")
     if strlen(b:randnbr) == 0
         let b:randnbr = "NoRandom"
     endif
-    let b:rsource = $VIMRPLUGIN_TMPDIR . "/Rsource-" . b:randnbr . "-" . b:bname
+    let b:rsource = g:rplugin_tmpdir . "/Rsource-" . b:randnbr . "-" . b:bname
     unlet b:randnbr
 endif
 unlet b:bname
@@ -72,20 +72,3 @@ if !exists("g:SendCmdToR")
     let g:SendCmdToR = function('SendCmdToR_fake')
 endif
 
-if !has("nvim")
-    if &filetype != "rbrowser"
-        if v:servername == "" || has("gui_macvim")
-            autocmd CursorHold  call RCheckLibListFile()
-        else
-            if &filetype != "r"
-                autocmd CursorMoved  call RCheckLibList()
-                if g:vimrplugin_insert_mode_cmds == 1
-                    autocmd CursorMovedI  call RCheckLibList()
-                endif
-            endif
-        endif
-    endif
-endif
-
-
-
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index a6e337b..f331a89 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -132,8 +132,8 @@ function! ReadEvalReply()
     let ii = 0
     while ii < 20
         sleep 100m
-        if filereadable($VIMRPLUGIN_TMPDIR . "/eval_reply")
-            let reply = readfile($VIMRPLUGIN_TMPDIR . "/eval_reply")
+        if filereadable(g:rplugin_tmpdir . "/eval_reply")
+            let reply = readfile(g:rplugin_tmpdir . "/eval_reply")
             if len(reply) == 0
                 call RWarningMsg("Incomplete reply")
                 let reply = ["No reply"]
@@ -268,7 +268,7 @@ function RCompleteArgs()
 
             " If R is running, use it
             if string(g:SendCmdToR) != "function('SendCmdToR_fake')"
-                call delete($VIMRPLUGIN_TMPDIR . "/eval_reply")
+                call delete(g:rplugin_tmpdir . "/eval_reply")
                 let msg = 'vimcom:::vim.args("'
                 if classfor == ""
                     let msg = msg . rkeyword0 . '", "' . argkey . '"'
@@ -321,7 +321,7 @@ function RCompleteArgs()
             endif
 
             " If R isn't running, use the prebuilt list of objects
-            let flines = g:rplugin_globalenvlines + g:rplugin_liblist
+            let flines = g:rplugin_globalenvlines + g:rplugin_omni_lines
             for omniL in flines
                 if omniL =~ rkeyword && omniL =~ "\x06function\x06function\x06"
                     let tmp1 = split(omniL, "\x06")
@@ -613,8 +613,8 @@ endfunction
 
 function StartR_TmuxSplit(rcmd)
     let g:rplugin_vim_pane = TmuxActivePane()
-    let tmuxconf = ['set-environment VIMRPLUGIN_TMPDIR "' . $VIMRPLUGIN_TMPDIR . '"',
-                \ 'set-environment VIMRPLUGIN_HOME "' . g:rplugin_home . '"',
+    let tmuxconf = ['set-environment VIMRPLUGIN_TMPDIR "' . g:rplugin_tmpdir . '"',
+                \ 'set-environment VIMRPLUGIN_COMPLDIR "' . substitute(g:rplugin_compldir, ' ', '\\ ', "g") . '"',
                 \ 'set-environment VIM_PANE ' . g:rplugin_vim_pane ,
                 \ 'set-environment VIMEDITOR_SVRNM ' . $VIMEDITOR_SVRNM ,
                 \ 'set-environment VIMINSTANCEID ' . $VIMINSTANCEID ,
@@ -622,9 +622,9 @@ function StartR_TmuxSplit(rcmd)
     if &t_Co == 256
         call extend(tmuxconf, ['set default-terminal "' . $TERM . '"'])
     endif
-    call writefile(tmuxconf, $VIMRPLUGIN_TMPDIR . "/tmux" . $VIMINSTANCEID . ".conf")
-    call system("tmux source-file '" . $VIMRPLUGIN_TMPDIR . "/tmux" . $VIMINSTANCEID . ".conf" . "'")
-    call delete($VIMRPLUGIN_TMPDIR . "/tmux" . $VIMINSTANCEID . ".conf")
+    call writefile(tmuxconf, g:rplugin_tmpdir . "/tmux" . $VIMINSTANCEID . ".conf")
+    call system("tmux source-file '" . g:rplugin_tmpdir . "/tmux" . $VIMINSTANCEID . ".conf" . "'")
+    call delete(g:rplugin_tmpdir . "/tmux" . $VIMINSTANCEID . ".conf")
     let tcmd = "tmux split-window "
     if g:vimrplugin_vsplit
         if g:vimrplugin_rconsole_width == -1
@@ -699,13 +699,15 @@ function StartR_ExternalTerm(rcmd)
         endif
 
         if g:vimrplugin_external_ob || !has("gui_running")
-            call extend(cnflines, ['set mode-mouse on', 'set mouse-select-pane on', 'set mouse-resize-pane on'])
+            call extend(cnflines, ['set -g mode-mouse on', 'set -g mouse-select-pane on', 'set -g mouse-resize-pane on'])
         endif
-        call writefile(cnflines, $VIMRPLUGIN_TMPDIR . "/tmux.conf")
-        let tmuxcnf = '-f "' . $VIMRPLUGIN_TMPDIR . "/tmux.conf" . '"'
+        call writefile(cnflines, g:rplugin_tmpdir . "/tmux.conf")
+        let tmuxcnf = '-f "' . g:rplugin_tmpdir . "/tmux.conf" . '"'
     endif
 
-    let rcmd = 'VIMRPLUGIN_TMPDIR="' . $VIMRPLUGIN_TMPDIR . '" VIMRPLUGIN_HOME="' . $VIMRPLUGIN_HOME . '" VIMINSTANCEID="' . $VIMINSTANCEID . '" VIMRPLUGIN_SECRET="' . $VIMRPLUGIN_SECRET . '" VIMEDITOR_SVRNM="' . $VIMEDITOR_SVRNM . '" ' . a:rcmd
+    let rcmd = 'VIMRPLUGIN_TMPDIR=' . substitute(g:rplugin_tmpdir, ' ', '\\ ', 'g') . ' VIMRPLUGIN_COMPLDIR=' . substitute(g:rplugin_compldir, ' ', '\\ ', 'g') . ' VIMINSTANCEID=' . $VIMINSTANCEID . ' VIMRPLUGIN_SECRET=' . $VIMRPLUGIN_SECRET . ' VIMEDITOR_SVRNM=' . $VIMEDITOR_SVRNM . ' ' . a:rcmd
+
+    echomsg rcmd
 
     call system("tmux has-session -t " . g:rplugin_tmuxsname)
     if v:shell_error
@@ -762,9 +764,9 @@ function StartR(whatr)
         let $VIMEDITOR_SVRNM = v:servername
     endif
 
-    call writefile([], $VIMRPLUGIN_TMPDIR . "/globenv_" . $VIMINSTANCEID)
-    call writefile([], $VIMRPLUGIN_TMPDIR . "/liblist_" . $VIMINSTANCEID)
-    call delete($VIMRPLUGIN_TMPDIR . "/libnames_" . $VIMINSTANCEID)
+    call writefile([], g:rplugin_tmpdir . "/globenv_" . $VIMINSTANCEID)
+    call writefile([], g:rplugin_tmpdir . "/liblist_" . $VIMINSTANCEID)
+    call delete(g:rplugin_tmpdir . "/libnames_" . $VIMINSTANCEID)
 
     if !exists("b:rplugin_R")
         call SetRPath()
@@ -814,7 +816,7 @@ function StartR(whatr)
             if g:vimrplugin_restart
                 call g:SendCmdToR('quit(save = "no")')
                 sleep 100m
-                call delete($VIMRPLUGIN_TMPDIR . "/vimcom_running_" . $VIMINSTANCEID)
+                call delete(g:rplugin_tmpdir . "/vimcom_running_" . $VIMINSTANCEID)
                 let ca_ck = g:vimrplugin_ca_ck
                 let g:vimrplugin_ca_ck = 0
                 call g:SendCmdToR(g:rplugin_last_rcmd)
@@ -858,7 +860,7 @@ function StartR(whatr)
         call StartR_TmuxSplit(rcmd)
     else
         if g:vimrplugin_restart && bufloaded(b:objbrtitle)
-            call delete($VIMRPLUGIN_TMPDIR . "/vimcom_running_" . $VIMINSTANCEID)
+            call delete(g:rplugin_tmpdir . "/vimcom_running_" . $VIMINSTANCEID)
         endif
         call StartR_ExternalTerm(rcmd)
         if g:vimrplugin_restart && bufloaded(b:objbrtitle)
@@ -887,8 +889,8 @@ endfunction
 function ShowRObject(fname)
     call RWarningMsg("ShowRObject not implemented yet: '" . a:fname . "'")
     let fcont = readfile(a:fname)
-    let s:finalA = $VIMRPLUGIN_TMPDIR . "/vimcom_edit_" . $VIMINSTANCEID . "_A"
-    let finalB = $VIMRPLUGIN_TMPDIR . "/vimcom_edit_" . $VIMINSTANCEID . "_B"
+    let s:finalA = g:rplugin_tmpdir . "/vimcom_edit_" . $VIMINSTANCEID . "_A"
+    let finalB = g:rplugin_tmpdir . "/vimcom_edit_" . $VIMINSTANCEID . "_B"
     let finalB = substitute(finalB, ' ', '\\ ', 'g')
     exe "tabnew " . finalB
     call setline(".", fcont)
@@ -923,21 +925,21 @@ function WaitVimComStart()
     sleep 300m
     let ii = 300
     let waitmsg = 0
-    while !filereadable($VIMRPLUGIN_TMPDIR . "/vimcom_running_" . $VIMINSTANCEID) && ii < g:vimrplugin_vimcom_wait
+    while !filereadable(g:rplugin_tmpdir . "/vimcom_running_" . $VIMINSTANCEID) && ii < g:vimrplugin_vimcom_wait
         let ii = ii + 200
         sleep 200m
     endwhile
     echon "\r                              "
     redraw
     sleep 100m
-    if filereadable($VIMRPLUGIN_TMPDIR . "/vimcom_running_" . $VIMINSTANCEID)
-        let vr = readfile($VIMRPLUGIN_TMPDIR . "/vimcom_running_" . $VIMINSTANCEID)
+    if filereadable(g:rplugin_tmpdir . "/vimcom_running_" . $VIMINSTANCEID)
+        let vr = readfile(g:rplugin_tmpdir . "/vimcom_running_" . $VIMINSTANCEID)
         let g:rplugin_vimcom_version = vr[0]
         let g:rplugin_vimcom_home = vr[1]
         let g:rplugin_vimcomport = vr[2]
         let g:rplugin_r_pid = vr[3]
-        if g:rplugin_vimcom_version != "1.1.13"
-            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.1.13.')
+        if g:rplugin_vimcom_version != "1.1.14"
+            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.1.14.')
             sleep 1
         endif
         if has("nvim")
@@ -980,7 +982,7 @@ function WaitVimComStart()
         if !filereadable(g:rplugin_vimcom_lib)
             call RWarningMsgInp('Could not find "' . g:rplugin_vimcom_lib . '".')
         endif
-        call delete($VIMRPLUGIN_TMPDIR . "/vimcom_running_" . $VIMINSTANCEID)
+        call delete(g:rplugin_tmpdir . "/vimcom_running_" . $VIMINSTANCEID)
 
         if !has("nvim") && !has("libcall")
             call RWarningMsgInp("+libcall feature is missing: communication with R will be flawed.")
@@ -1036,7 +1038,7 @@ function StartObjBrowser_Tmux()
         return
     endif
 
-    let objbrowserfile = $VIMRPLUGIN_TMPDIR . "/objbrowserInit"
+    let objbrowserfile = g:rplugin_tmpdir . "/objbrowserInit"
     let tmxs = " "
 
     if has("nvim")
@@ -1166,10 +1168,10 @@ function StartObjBrowser_Vim()
     if has("win32") || has("win64")
 	" The vimcom server will stop working if starting the Object
 	" Browser is the first thing the user does.
-	if !exists("g:rplugin_liblist_filled")
-	    call RWarningMsg("Please, try again after sending at least one line of code to the R Console.!")
-	    return
-	endif
+	"if !exists("g:rplugin_liblist_filled")
+	"    call RWarningMsg("Please, try again after sending at least one line of code to the R Console.!")
+	"    return
+	"endif
     endif
 
     let wmsg = ""
@@ -1372,7 +1374,7 @@ function RFormatCode() range
     endif
 
     let lns = getline(a:firstline, a:lastline)
-    call writefile(lns, $VIMRPLUGIN_TMPDIR . "/unformatted_code")
+    call writefile(lns, g:rplugin_tmpdir . "/unformatted_code")
     let wco = &textwidth
     if wco == 0
         let wco = 78
@@ -1381,14 +1383,14 @@ function RFormatCode() range
     elseif wco > 180
         let wco = 180
     endif
-    call delete($VIMRPLUGIN_TMPDIR . "/eval_reply")
-    call g:SendToVimCom("\x08" . $VIMINSTANCEID . 'formatR::tidy_source("' . $VIMRPLUGIN_TMPDIR . '/unformatted_code", file = "' . $VIMRPLUGIN_TMPDIR . '/formatted_code", width.cutoff = ' . wco . ')', "I")
+    call delete(g:rplugin_tmpdir . "/eval_reply")
+    call g:SendToVimCom("\x08" . $VIMINSTANCEID . 'formatR::tidy_source("' . g:rplugin_tmpdir . '/unformatted_code", file = "' . g:rplugin_tmpdir . '/formatted_code", width.cutoff = ' . wco . ')', "I")
     let g:rplugin_lastev = ReadEvalReply()
     if g:rplugin_lastev == "R is busy." || g:rplugin_lastev == "UNKNOWN" || g:rplugin_lastev =~ "^Error" || g:rplugin_lastev == "INVALID" || g:rplugin_lastev == "ERROR" || g:rplugin_lastev == "EMPTY" || g:rplugin_lastev == "No reply"
         call RWarningMsg(g:rplugin_lastev)
         return
     endif
-    let lns = readfile($VIMRPLUGIN_TMPDIR . "/formatted_code")
+    let lns = readfile(g:rplugin_tmpdir . "/formatted_code")
     silent exe a:firstline . "," . a:lastline . "delete"
     call append(a:firstline - 1, lns)
     echo (a:lastline - a:firstline + 1) . " lines formatted."
@@ -1399,9 +1401,9 @@ function RInsert(cmd)
         return
     endif
 
-    call delete($VIMRPLUGIN_TMPDIR . "/eval_reply")
-    call delete($VIMRPLUGIN_TMPDIR . "/Rinsert")
-    call g:SendToVimCom("\x08" . $VIMINSTANCEID . 'capture.output(' . a:cmd . ', file = "' . $VIMRPLUGIN_TMPDIR . '/Rinsert")')
+    call delete(g:rplugin_tmpdir . "/eval_reply")
+    call delete(g:rplugin_tmpdir . "/Rinsert")
+    call g:SendToVimCom("\x08" . $VIMINSTANCEID . 'capture.output(' . a:cmd . ', file = "' . g:rplugin_tmpdir . '/Rinsert")')
     let g:rplugin_lastev = ReadEvalReply()
     if g:rplugin_lastev == "R is busy." || g:rplugin_lastev == "UNKNOWN" || g:rplugin_lastev =~ "^Error" || g:rplugin_lastev == "INVALID" || g:rplugin_lastev == "ERROR" || g:rplugin_lastev == "EMPTY" || g:rplugin_lastev == "No reply"
         call RWarningMsg(g:rplugin_lastev)
@@ -1983,12 +1985,12 @@ function ClearRInfo()
         unlet g:rplugin_rconsole_pane
     endif
 
-    call delete($VIMRPLUGIN_TMPDIR . "/globenv_" . $VIMINSTANCEID)
-    call delete($VIMRPLUGIN_TMPDIR . "/liblist_" . $VIMINSTANCEID)
-    call delete($VIMRPLUGIN_TMPDIR . "/libnames_" . $VIMINSTANCEID)
-    call delete($VIMRPLUGIN_TMPDIR . "/GlobalEnvList_" . $VIMINSTANCEID)
-    call delete($VIMRPLUGIN_TMPDIR . "/vimcom_running_" . $VIMINSTANCEID)
-    call delete($VIMRPLUGIN_TMPDIR . "/rconsole_hwnd_" . $VIMRPLUGIN_SECRET)
+    call delete(g:rplugin_tmpdir . "/globenv_" . $VIMINSTANCEID)
+    call delete(g:rplugin_tmpdir . "/liblist_" . $VIMINSTANCEID)
+    call delete(g:rplugin_tmpdir . "/libnames_" . $VIMINSTANCEID)
+    call delete(g:rplugin_tmpdir . "/GlobalEnvList_" . $VIMINSTANCEID)
+    call delete(g:rplugin_tmpdir . "/vimcom_running_" . $VIMINSTANCEID)
+    call delete(g:rplugin_tmpdir . "/rconsole_hwnd_" . $VIMRPLUGIN_SECRET)
     let g:SendCmdToR = function('SendCmdToR_fake')
     let g:rplugin_r_pid = 0
     let g:rplugin_vimcomport = 0
@@ -2060,102 +2062,6 @@ function! RKnit()
     endif
 endfunction
 
-function RRemoveFromLibls(nlib)
-    let idx = 0
-    for lib in g:rplugin_libls
-        if lib == a:nlib
-            call remove(g:rplugin_libls, idx)
-            break
-        endif
-        let idx += 1
-    endfor
-endfunction
-
-function RAddToLibList(nlib, verbose)
-    if isdirectory(g:rplugin_uservimfiles . "/r-plugin/objlist")
-        let omf = split(globpath(&rtp, 'r-plugin/objlist/omnils_' . a:nlib . '_*'), "\n")
-        if len(omf) == 1
-            let nlist = readfile(omf[0])
-
-            " List of objects for omni completion
-            let g:rplugin_liblist = g:rplugin_liblist + nlist
-
-            " List of objects for :Rhelp completion
-            for xx in nlist
-                let xxx = split(xx, "\x06")
-                if len(xxx) > 0 && xxx[0] !~ '\$'
-                    call add(s:list_of_objs, xxx[0])
-                endif
-            endfor
-        elseif a:verbose && len(omf) == 0
-            call RWarningMsg('Omnils file for "' . a:nlib . '" not found.')
-            call RRemoveFromLibls(a:nlib)
-            return
-        elseif a:verbose && len(omf) > 1
-            call RWarningMsg('There is more than one omnils file for "' . a:nlib . '".')
-            for obl in omf
-                call RWarningMsg(obl)
-            endfor
-            call RRemoveFromLibls(a:nlib)
-            return
-        endif
-    endif
-endfunction
-
-function RCheckLibList()
-    if g:rplugin_newliblist
-        call RealRFillLibList()
-        let g:rplugin_newliblist = 0
-    endif
-endfunction
-
-function RCheckLibListFile()
-    if filereadable($VIMRPLUGIN_TMPDIR . "/libnames_" . $VIMINSTANCEID)
-        call RealRFillLibList()
-        call delete($VIMRPLUGIN_TMPDIR . "/libnames_" . $VIMINSTANCEID)
-    endif
-endfunction
-
-" This function is called by the R package vimcom whenever a library is
-" loaded.
-function RFillLibList()
-    if &filetype == "r" || has("nvim")
-        call RealRFillLibList()
-    else
-        " Avoid E341 (Internal error: lalloc(0, ))
-        let g:rplugin_newliblist = 1
-    endif
-    return "OK"
-endfunction
-
-function RealRFillLibList()
-    " Update the list of objects for omnicompletion
-    if filereadable($VIMRPLUGIN_TMPDIR . "/libnames_" . $VIMINSTANCEID)
-        let newls = readfile($VIMRPLUGIN_TMPDIR . "/libnames_" . $VIMINSTANCEID)
-        for nlib in newls
-            let isold = 0
-            for olib in g:rplugin_libls
-                if nlib == olib
-                    let isold = 1
-                    break
-                endif
-            endfor
-            if isold == 0
-                let g:rplugin_libls = g:rplugin_libls + [ nlib ]
-                call RAddToLibList(nlib, 1)
-            endif
-        endfor
-    endif
-
-    if exists("*RUpdateFunSyntax")
-        call RUpdateFunSyntax(0)
-        if &filetype != "r"
-            silent exe "set filetype=" . &filetype
-        endif
-    endif
-    let g:rplugin_liblist_filled = 1
-endfunction
-
 function SetRTextWidth(rkeyword)
     if g:vimrplugin_vimpager == "tabnew"
         let s:rdoctitle = a:rkeyword . "\\ (help)"
@@ -2346,7 +2252,7 @@ function ShowRDoc(rkeyword)
             redraw
             let chn = input(msg . "Please, select one of them: ")
             if chn > 0 && chn < (len(msgs) - 1)
-                call delete($VIMRPLUGIN_TMPDIR . "/eval_reply")
+                call delete(g:rplugin_tmpdir . "/eval_reply")
                 call g:SendToVimCom("\x08" . $VIMINSTANCEID . 'vimcom:::vim.help("' . msgs[-1] . '", ' . g:rplugin_htw . 'L, package="' . msgs[chn] . '")')
             endif
             return
@@ -2517,9 +2423,9 @@ endfunction
 
 function RStart_Zathura(basenm)
     if has("nvim")
-        let shcode = ['#!/bin/sh', 'echo "call SyncTeX_backward(' . "'$1'" . ', $2)" >> "' . $VIMRPLUGIN_TMPDIR . '/zathura_search"']
-        call writefile(shcode, $VIMRPLUGIN_TMPDIR . "/synctex_back.sh")
-        let a2 = "a2 = 'sh " . $VIMRPLUGIN_TMPDIR . "/synctex_back.sh %{input} %{line}'"
+        let shcode = ['#!/bin/sh', 'echo "call SyncTeX_backward(' . "'$1'" . ', $2)" >> "' . g:rplugin_tmpdir . '/zathura_search"']
+        call writefile(shcode, g:rplugin_tmpdir . "/synctex_back.sh")
+        let a2 = "a2 = 'sh " . g:rplugin_tmpdir . "/synctex_back.sh %{input} %{line}'"
     else
         let a2 = 'a2 = "vim --servername ' . v:servername . " --remote-expr \\\"SyncTeX_backward('%{input}',%{line})\\\"" . '"'
     endif
@@ -2532,10 +2438,10 @@ function RStart_Zathura(basenm)
                 \ "a3 = '" . a:basenm . ".pdf'",
                 \ "zpid = subprocess.Popen(['zathura', a1, a2, a3], stdout = FNULL, stderr = FNULL).pid",
                 \ "sys.stdout.write(str(zpid))" ]
-    call writefile(pycode, $VIMRPLUGIN_TMPDIR . "/start_zathura.py")
-    let pid = system("python '" . $VIMRPLUGIN_TMPDIR . "/start_zathura.py" . "'")
+    call writefile(pycode, g:rplugin_tmpdir . "/start_zathura.py")
+    let pid = system("python '" . g:rplugin_tmpdir . "/start_zathura.py" . "'")
     let g:rplugin_zathura_pid[a:basenm] = pid
-    call delete($VIMRPLUGIN_TMPDIR . "/start_zathura.py")
+    call delete(g:rplugin_tmpdir . "/start_zathura.py")
 endfunction
 
 function ROpenPDF(path)
@@ -2587,17 +2493,6 @@ function ROpenPDF(path)
 endfunction
 
 
-function RLisObjs(arglead, cmdline, curpos)
-    let lob = []
-    let rkeyword = '^' . a:arglead
-    for xx in s:list_of_objs
-        if xx =~ rkeyword
-            call add(lob, xx)
-        endif
-    endfor
-    return lob
-endfunction
-
 function RSourceDirectory(...)
     if has("win32") || has("win64")
         let dir = substitute(a:1, '\\', '/', "g")
@@ -3034,16 +2929,6 @@ function RBufEnter()
             let g:rplugin_lastft = &filetype
         endif
     endif
-
-    " It would be better if we could call RUpdateFunSyntax() for all buffers
-    " immediately after a new library was loaded, but the command :bufdo
-    " temporarily disables Syntax events.
-    if exists("b:rplugin_funls") && len(b:rplugin_funls) < len(g:rplugin_libls)
-        call RUpdateFunSyntax(0)
-        " If R code is included in another file type (like rnoweb or
-        " rhelp), the R syntax isn't automatically updated. So, we force it:
-        silent exe "set filetype=" . &filetype
-    endif
 endfunction
 
 function RVimLeave()
@@ -3051,20 +2936,20 @@ function RVimLeave()
         " b:rsource only exists if the filetype of the last buffer is .R*
         call delete(b:rsource)
     endif
-    call delete($VIMRPLUGIN_TMPDIR . "/eval_reply")
-    call delete($VIMRPLUGIN_TMPDIR . "/formatted_code")
-    call delete($VIMRPLUGIN_TMPDIR . "/GlobalEnvList_" . $VIMINSTANCEID)
-    call delete($VIMRPLUGIN_TMPDIR . "/globenv_" . $VIMINSTANCEID)
-    call delete($VIMRPLUGIN_TMPDIR . "/liblist_" . $VIMINSTANCEID)
-    call delete($VIMRPLUGIN_TMPDIR . "/libnames_" . $VIMINSTANCEID)
-    call delete($VIMRPLUGIN_TMPDIR . "/objbrowserInit")
-    call delete($VIMRPLUGIN_TMPDIR . "/Rdoc")
-    call delete($VIMRPLUGIN_TMPDIR . "/Rinsert")
-    call delete($VIMRPLUGIN_TMPDIR . "/tmux.conf")
-    call delete($VIMRPLUGIN_TMPDIR . "/unformatted_code")
-    call delete($VIMRPLUGIN_TMPDIR . "/vimbol_finished")
-    call delete($VIMRPLUGIN_TMPDIR . "/vimcom_running_" . $VIMINSTANCEID)
-    call delete($VIMRPLUGIN_TMPDIR . "/rconsole_hwnd_" . $VIMRPLUGIN_SECRET)
+    call delete(g:rplugin_tmpdir . "/eval_reply")
+    call delete(g:rplugin_tmpdir . "/formatted_code")
+    call delete(g:rplugin_tmpdir . "/GlobalEnvList_" . $VIMINSTANCEID)
+    call delete(g:rplugin_tmpdir . "/globenv_" . $VIMINSTANCEID)
+    call delete(g:rplugin_tmpdir . "/liblist_" . $VIMINSTANCEID)
+    call delete(g:rplugin_tmpdir . "/libnames_" . $VIMINSTANCEID)
+    call delete(g:rplugin_tmpdir . "/objbrowserInit")
+    call delete(g:rplugin_tmpdir . "/Rdoc")
+    call delete(g:rplugin_tmpdir . "/Rinsert")
+    call delete(g:rplugin_tmpdir . "/tmux.conf")
+    call delete(g:rplugin_tmpdir . "/unformatted_code")
+    call delete(g:rplugin_tmpdir . "/vimbol_finished")
+    call delete(g:rplugin_tmpdir . "/vimcom_running_" . $VIMINSTANCEID)
+    call delete(g:rplugin_tmpdir . "/rconsole_hwnd_" . $VIMRPLUGIN_SECRET)
 endfunction
 
 function SetRPath()
@@ -3160,31 +3045,39 @@ if has("win32") || has("win64")
     endif
 endif
 
-let $VIMRPLUGIN_HOME = substitute(g:rplugin_home, ' ', '\\ ', "g")
-
-if has("win32") || has("win64")
-    if isdirectory($TMP)
-        let $VIMRPLUGIN_TMPDIR = $TMP . "/r-plugin-" . g:rplugin_userlogin
-    elseif isdirectory($TEMP)
-        let $VIMRPLUGIN_TMPDIR = $TEMP . "/r-plugin-" . g:rplugin_userlogin
-    else
-        let $VIMRPLUGIN_TMPDIR = g:rplugin_uservimfiles . "/r-plugin/tmp"
-    endif
-    let $VIMRPLUGIN_TMPDIR = substitute($VIMRPLUGIN_TMPDIR, "\\", "/", "g")
+if exists("g:vimrplugin_tmpdir")
+    let g:rplugin_tmpdir = expand(g:vimrplugin_tmpdir)
 else
-    if isdirectory($TMPDIR)
-        let $VIMRPLUGIN_TMPDIR = $TMPDIR . "/r-plugin-" . g:rplugin_userlogin
-    elseif isdirectory("/tmp")
-        let $VIMRPLUGIN_TMPDIR = "/tmp/r-plugin-" . g:rplugin_userlogin
+    if has("win32") || has("win64")
+        if isdirectory($TMP)
+            let g:rplugin_tmpdir = $TMP . "/r-plugin-" . g:rplugin_userlogin
+        elseif isdirectory($TEMP)
+            let g:rplugin_tmpdir = $TEMP . "/r-plugin-" . g:rplugin_userlogin
+        else
+            let g:rplugin_tmpdir = g:rplugin_uservimfiles . "/r-plugin/tmp"
+        endif
+        let g:rplugin_tmpdir = substitute(g:rplugin_tmpdir, "\\", "/", "g")
     else
-        let $VIMRPLUGIN_TMPDIR = g:rplugin_uservimfiles . "/r-plugin/tmp"
+        if isdirectory($TMPDIR)
+            let g:rplugin_tmpdir = $TMPDIR . "/r-plugin-" . g:rplugin_userlogin
+        elseif isdirectory("/tmp")
+            let g:rplugin_tmpdir = "/tmp/r-plugin-" . g:rplugin_userlogin
+        else
+            let g:rplugin_tmpdir = g:rplugin_uservimfiles . "/r-plugin/tmp"
+        endif
     endif
 endif
 
-let g:rplugin_esc_tmpdir = substitute($VIMRPLUGIN_TMPDIR, ' ', '\\ ', 'g')
+let $VIMRPLUGIN_TMPDIR = g:rplugin_tmpdir
+if !isdirectory(g:rplugin_tmpdir)
+    call mkdir(g:rplugin_tmpdir, "p", 0700)
+endif
 
-if !isdirectory($VIMRPLUGIN_TMPDIR)
-    call mkdir($VIMRPLUGIN_TMPDIR, "p", 0700)
+if exists("g:rplugin_compldir")
+    " syntax/r.vim was already called and a `syntax enable` may be required
+    syntax enable
+else
+    runtime r-plugin/setcompldir.vim
 endif
 
 " Old name of vimrplugin_assign option
@@ -3249,7 +3142,6 @@ else
     call RSetDefaultValue("g:vimrplugin_vimpager",      "'tab'")
 endif
 call RSetDefaultValue("g:vimrplugin_objbr_place",     "'script,right'")
-call RSetDefaultValue("g:vimrplugin_permanent_libs",  "'base,stats,graphics,grDevices,utils,datasets,methods'")
 call RSetDefaultValue("g:vimrplugin_user_maps_only", 0)
 call RSetDefaultValue("g:vimrplugin_latexcmd", "'default'")
 call RSetDefaultValue("g:vimrplugin_rmd_environment", "'.GlobalEnv'")
@@ -3396,15 +3288,6 @@ endif
 " Start with an empty list of objects in the workspace
 let g:rplugin_globalenvlines = []
 
-" Are we in a Debian package? Is the plugin running for the first time?
-let g:rplugin_omnidname = g:rplugin_uservimfiles . "/r-plugin/objlist/"
-if g:rplugin_home != g:rplugin_uservimfiles
-    " Create r-plugin directory if it doesn't exist yet:
-    if !isdirectory(g:rplugin_uservimfiles . "/r-plugin")
-        call mkdir(g:rplugin_uservimfiles . "/r-plugin", "p")
-    endif
-endif
-
 " Minimum width for the Object Browser
 if g:vimrplugin_objbr_w < 10
     let g:vimrplugin_objbr_w = 10
@@ -3550,9 +3433,9 @@ function GetRandomNumber(width)
     if g:rplugin_py_exec != "none"
         let pycode = ["import os, sys, base64",
                     \ "sys.stdout.write(base64.b64encode(os.urandom(" . a:width . ")).decode())" ]
-        call writefile(pycode, $VIMRPLUGIN_TMPDIR . "/getRandomNumber.py")
-        let randnum = system(g:rplugin_py_exec . " " . $VIMRPLUGIN_TMPDIR . "/getRandomNumber.py")
-        call delete($VIMRPLUGIN_TMPDIR . "/getRandomNumber.py")
+        call writefile(pycode, g:rplugin_tmpdir . "/getRandomNumber.py")
+        let randnum = system(g:rplugin_py_exec . ' "' . g:rplugin_tmpdir . '/getRandomNumber.py"')
+        call delete(g:rplugin_tmpdir . "/getRandomNumber.py")
     elseif !has("win32") && !has("win64") && !has("gui_win32") && !has("gui_win64")
         let randnum = system("echo $RANDOM")
     else
@@ -3577,24 +3460,14 @@ endif
 
 let g:rplugin_obsname = toupper(substitute(substitute(expand("%:r"), '\W', '', 'g'), "_", "", "g"))
 
-let g:rplugin_docfile = $VIMRPLUGIN_TMPDIR . "/Rdoc"
+let g:rplugin_docfile = g:rplugin_tmpdir . "/Rdoc"
 
 " Create an empty file to avoid errors if the user do Ctrl-X Ctrl-O before
 " starting R:
 if &filetype != "rbrowser"
-    call writefile([], $VIMRPLUGIN_TMPDIR . "/GlobalEnvList_" . $VIMINSTANCEID)
+    call writefile([], g:rplugin_tmpdir . "/GlobalEnvList_" . $VIMINSTANCEID)
 endif
 
-
-" Keeps the names object list in memory to avoid the need of reading the files
-" repeatedly:
-let g:rplugin_libls = split(g:vimrplugin_permanent_libs, ",")
-let g:rplugin_liblist = []
-let s:list_of_objs = []
-for lib in g:rplugin_libls
-    call RAddToLibList(lib, 0)
-endfor
-
 if has("win32") || has("win64")
     runtime r-plugin/windows.vim
     let g:rplugin_has_icons = len(globpath(&rtp, "bitmaps/RStart.bmp")) > 0
@@ -3611,3 +3484,7 @@ endif
 if has("nvim")
     runtime r-plugin/nvimbuffer.vim
 endif
+
+if exists("g:vimrplugin_permanent_libs")
+    call RWarningMsgInp("The option 'vimrplugin_permanent_libs' was renamed to 'vimrplugin_start_libs'. Please, rename it in your vimrc too.")
+endif
diff --git a/r-plugin/functions.vim b/r-plugin/functions.vim
index c1ea8d1..98a56fe 100644
--- a/r-plugin/functions.vim
+++ b/r-plugin/functions.vim
@@ -1,72 +1,155 @@
 
-" Users may define the value of g:vimrplugin_permanent_libs to determine what
-" functions should be highlighted even if R is not running. By default, the
-" functions of packages loaded by R --vanilla are highlighted.
-if !exists("g:vimrplugin_permanent_libs")
-    let g:vimrplugin_permanent_libs = "base,stats,graphics,grDevices,utils,methods"
+" Only source this once
+if exists("*RmFromRLibList")
+    if len(g:rplugin_lists_to_load) > 0
+        for s:lib in g:rplugin_lists_to_load
+            call SourceRFunList(s:lib)
+        endfor
+        unlet s:lib
+    endif
+    finish
 endif
 
-" Store the names of R package whose functions were already added to syntax
-" highlight to avoid sourcing them repeatedly. Initialize the list with two
-" libraries that don't have any visible function.
-let b:rplugin_funls = ["datasets", "setwidth"]
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+" Set global variables when this script is called for the first time
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 
-" The function RUpdateFunSyntax() is called by the Vim-R-plugin whenever the
-" user loads a new package in R. The function should be defined only once.
-" Thus, if it's already defined, call it and finish.
-if exists("*RUpdateFunSyntax")
-    call RUpdateFunSyntax(0)
-    finish
+" Users may define the value of g:vimrplugin_start_libs
+if !exists("g:vimrplugin_start_libs")
+    let g:vimrplugin_start_libs = "base,stats,graphics,grDevices,utils,methods"
 endif
 
-function RAddToFunList(lib, verbose)
-    " Only run once for each package:
-    for pkg in b:rplugin_funls
-        if pkg == a:lib
-            return
+let g:rplugin_lists_to_load = split(g:vimrplugin_start_libs, ",")
+let g:rplugin_debug_lists = []
+let g:rplugin_loaded_lists = []
+let g:rplugin_Rhelp_list = []
+let g:rplugin_omni_lines = []
+
+" syntax/r.vim may have being called before ftplugin/r.vim
+if !exists("g:rplugin_compldir")
+    runtime r-plugin/setcompldir.vim
+endif
+
+
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+" Function for highlighting rFunction
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+
+" Must be run for each buffer
+function SourceRFunList(lib)
+    if isdirectory(g:rplugin_compldir)
+        let fnf = split(globpath(g:rplugin_compldir, 'fun_' . a:lib . '_*'), "\n")
+        if len(fnf) == 1
+            " Highlight R functions
+            exe "source " . substitute(fnf[0], ' ', '\\ ', 'g')
+        elseif len(fnf) == 0
+            let g:rplugin_debug_lists += ['Function list for "' . a:lib . '" not found.']
+        elseif len(fnf) > 1
+            let g:rplugin_debug_lists += ['There is more than one function list for "' . a:lib . '".']
+            for obl in fnf
+                let g:rplugin_debug_lists += [obl]
+            endfor
+        endif
+    endif
+endfunction
+
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+" Omnicompletion functions
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+
+function RLisObjs(arglead, cmdline, curpos)
+    let lob = []
+    let rkeyword = '^' . a:arglead
+    for xx in g:rplugin_Rhelp_list
+        if xx =~ rkeyword
+            call add(lob, xx)
         endif
     endfor
+    return lob
+endfunction
 
-    " The fun_ files list functions of R packages and are created by the
-    " Vim-R-plugin:
-    let fnf = split(globpath(&rtp, 'r-plugin/objlist/fun_' . a:lib . '_*'), "\n")
-
-    if len(fnf) == 1
-        silent exe "source " . substitute(fnf[0], ' ', '\\ ', "g")
-        let b:rplugin_funls += [a:lib]
-    elseif a:verbose && len(fnf) == 0
-        echohl WarningMsg
-        echomsg 'Fun_ file for "' . a:lib . '" not found.'
-        echohl Normal
-        return
-    elseif a:verbose && len(fnf) > 1
-        echohl WarningMsg
-        echomsg 'There is more than one fun_ file for "' . a:lib . '":'
-        for fff in fnf
-            echomsg fff
-        endfor
-        echohl Normal
-        return
-    endif
+function RmFromRLibList(lib)
+    for idx in range(len(g:rplugin_loaded_lists))
+        if g:rplugin_loaded_lists[idx] == a:lib
+            call remove(g:rplugin_loaded_lists, idx)
+            break
+        endif
+    endfor
+    for idx in range(len(g:rplugin_lists_to_load))
+        if g:rplugin_lists_to_load[idx] == a:lib
+            call remove(g:rplugin_lists_to_load, idx)
+            break
+        endif
+    endfor
 endfunction
 
-function RUpdateFunSyntax(verbose)
-    " Do nothing if called at a buffer that doesn't include R syntax:
-    if !exists("b:rplugin_funls")
-        return
-    endif
-    if exists("g:rplugin_libls")
-        for lib in g:rplugin_libls
-            call RAddToFunList(lib, a:verbose)
-        endfor
-    else
-        if exists("g:vimrplugin_permanent_libs")
-            for lib in split(g:vimrplugin_permanent_libs, ",")
-                call RAddToFunList(lib, a:verbose)
+function AddToRLibList(lib)
+    if isdirectory(g:rplugin_compldir)
+        let omf = split(globpath(g:rplugin_compldir, 'omnils_' . a:lib . '_*'), "\n")
+        if len(omf) == 1
+            let g:rplugin_loaded_lists += [a:lib]
+
+            " List of objects for omni completion
+            let olist = readfile(omf[0])
+            let g:rplugin_omni_lines += olist
+
+            " List of objects for :Rhelp completion
+            for xx in olist
+                let xxx = split(xx, "\x06")
+                if len(xxx) > 0 && xxx[0] !~ '\$'
+                    call add(g:rplugin_Rhelp_list, xxx[0])
+                endif
             endfor
+        elseif len(omf) == 0
+            let g:rplugin_debug_lists += ['Omnils list for "' . a:lib . '" not found.']
+            call RmFromRLibList(a:lib)
+            return
+        elseif len(omf) > 1
+            let g:rplugin_debug_lists += ['There is more than one omnils and function list for "' . a:lib . '".']
+            for obl in omf
+                let g:rplugin_debug_lists += [obl]
+            endfor
+            call RmFromRLibList(a:lib)
+            return
         endif
     endif
 endfunction
 
-call RUpdateFunSyntax(0)
 
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+" Function called by vimcom
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+
+function FillRLibList()
+    " Update the list of objects for omnicompletion
+    if filereadable(g:rplugin_tmpdir . "/libnames_" . $VIMINSTANCEID)
+        let g:rplugin_lists_to_load = readfile(g:rplugin_tmpdir . "/libnames_" . $VIMINSTANCEID)
+        for lib in g:rplugin_lists_to_load
+            let isloaded = 0
+            for olib in g:rplugin_loaded_lists
+                if lib == olib
+                    let isloaded = 1
+                    break
+                endif
+            endfor
+            if isloaded == 0
+                call AddToRLibList(lib)
+            endif
+        endfor
+    endif
+    " Reload the syntax for all loaded buffers
+    syntax enable
+    " let g:rplugin_liblist_filled = 1
+endfunction
+
+
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+" Source the Syntax scripts for the first time and Load omnilists
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+
+for s:lib in g:rplugin_lists_to_load
+    call SourceRFunList(s:lib)
+    call AddToRLibList(s:lib)
+endfor
+
+unlet s:lib
diff --git a/r-plugin/gui_running.vim b/r-plugin/gui_running.vim
index 5986b86..7c727f6 100644
--- a/r-plugin/gui_running.vim
+++ b/r-plugin/gui_running.vim
@@ -207,7 +207,7 @@ function MakeRMenu()
     endif
     amenu R.Help\ (plugin).Options.R\ path :help vimrplugin_r_path
     amenu R.Help\ (plugin).Options.Arguments\ to\ R :help vimrplugin_r_args
-    amenu R.Help\ (plugin).Options.Omni\ completion\ when\ R\ not\ running :help vimrplugin_permanent_libs
+    amenu R.Help\ (plugin).Options.Omni\ completion\ when\ R\ not\ running :help vimrplugin_start_libs
     amenu R.Help\ (plugin).Options.Syntax\ highlighting\ of\ \.Rout\ files :help vimrplugin_routmorecolors
     amenu R.Help\ (plugin).Options.Automatically\ open\ the\ \.Rout\ file :help vimrplugin_routnotab
     amenu R.Help\ (plugin).Options.Special\ R\ functions :help vimrplugin_listmethods
diff --git a/r-plugin/objlist/README b/r-plugin/objlist/README
index e92d250..f4df93b 100644
--- a/r-plugin/objlist/README
+++ b/r-plugin/objlist/README
@@ -1,5 +1,7 @@
-The omnils_ and fun_ files in this directory are generated by Vim-R-plugin and
-vimcom and are used for omni completion and syntax highlight.
+The omnils_ and fun_ files in this directory are generated by Vim-R-plugin
+and vimcom and are used for omni completion and syntax highlight.
 
-You should manually delete files corresponding to libraries that you no longer
-use.
+When you load a new version of a library, their files are replaced.
+
+You should manually delete files corresponding to libraries that you no
+longer use.
diff --git a/r-plugin/osx.vim b/r-plugin/osx.vim
index 98d8c58..9b50680 100644
--- a/r-plugin/osx.vim
+++ b/r-plugin/osx.vim
@@ -9,6 +9,7 @@ function StartR_OSX()
     else
         let rcmd = "/Applications/R.app"
     endif
+
     if b:rplugin_r_args != " "
         " https://github.com/jcfaria/Vim-R-plugin/issues/63
         " https://stat.ethz.ch/pipermail/r-sig-mac/2013-February/009978.html
diff --git a/r-plugin/setcompldir.vim b/r-plugin/setcompldir.vim
new file mode 100644
index 0000000..77102f0
--- /dev/null
+++ b/r-plugin/setcompldir.vim
@@ -0,0 +1,27 @@
+
+if exists("g:vimrplugin_compldir")
+    let g:rplugin_compldir = expand(g:vimrplugin_compldir)
+elseif (has("win32") || has("win64")) && $AppData != "" && isdirectory($AppData)
+    let g:rplugin_compldir = $AppData . "\\Vim-R-plugin"
+elseif isdirectory(expand("~/.cache"))
+    let g:rplugin_compldir = expand("~/.cache/Vim-R-plugin")
+else
+    let g:rplugin_compldir = g:rplugin_uservimfiles . "/r-plugin/objlist/"
+endif
+
+" Create the directory if it doesn't exist yet
+if !isdirectory(g:rplugin_compldir)
+    call mkdir(g:rplugin_compldir, "p")
+    if !filereadable(g:rplugin_compldir . "/README")
+        let readme = ['The omnils_ and fun_ files in this directory are generated by Vim-R-plugin',
+                    \ 'and vimcom and are used for omni completion and syntax highlight.',
+                    \ '',
+                    \ 'When you load a new version of a library, their files are replaced.',
+                    \ '',
+                    \ 'You should manually delete files corresponding to libraries that you no',
+                    \ 'longer use.']
+        call writefile(readme, g:rplugin_compldir . "/README")
+    endif
+endif
+let $VIMRPLUGIN_COMPLDIR = g:rplugin_compldir
+
diff --git a/r-plugin/windows.vim b/r-plugin/windows.vim
index e4ce8b6..c66f46e 100644
--- a/r-plugin/windows.vim
+++ b/r-plugin/windows.vim
@@ -136,8 +136,6 @@ function StartR_Windows()
             let g:rplugin_r_pid = 0
         endif
     endif
-    let vrph = $VIMRPLUGIN_HOME
-    let $VIMRPLUGIN_HOME = substitute($VIMRPLUGIN_HOME, "\\\\ ", " ", "g")
 
     if !executable(g:rplugin_Rgui)
         call RWarningMsg('R executable "' . g:rplugin_Rgui . '" not found.')
@@ -174,7 +172,6 @@ function StartR_Windows()
     if g:vimrplugin_vim_wd == 0
         lcd -
     endif
-    let $VIMRPLUGIN_HOME = vrph
     let g:SendCmdToR = function('SendCmdToR_Windows')
     call WaitVimComStart()
 endfunction
diff --git a/syntax/r.vim b/syntax/r.vim
index 475532c..82ea7be 100644
--- a/syntax/r.vim
+++ b/syntax/r.vim
@@ -3,11 +3,11 @@
 " Maintainer:	      Jakson Aquino 
 " Former Maintainers: Vaidotas Zemlys 
 " 		      Tom Payne 
-" Last Change:	      Thu Dec 04, 2014  11:07PM
+" Last Change:	      Tue Dec 16, 2014  02:14PM
 " Filenames:	      *.R *.r *.Rhistory *.Rt
 "
 " NOTE: The highlighting of R functions is defined in the
-" r-plugin/functions.vim, which is part of vim-r-plugin2:
+" r-plugin/functions.vim, which is part of Vim-R-plugin:
 " http://www.vim.org/scripts/script.php?script_id=2628
 "
 " CONFIGURATION:

From 46a0f2df222b4df08c04a61999afc27247442a8c Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Tue, 16 Dec 2014 16:48:37 -0500
Subject: [PATCH 0884/1050] libvimcom.so was renamed libVimR.so

---
 r-plugin/common_global.vim | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index f331a89..6bff9d5 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -973,11 +973,11 @@ function WaitVimComStart()
             endif
         endif
         if has("win32")
-            let g:rplugin_vimcom_lib = g:rplugin_vimcom_home . "/bin/i386/libvimcom.dll"
+            let g:rplugin_vimcom_lib = g:rplugin_vimcom_home . "/bin/i386/libVimR.dll"
         elseif has("win64")
-            let g:rplugin_vimcom_lib = g:rplugin_vimcom_home . "/bin/x64/libvimcom.dll"
+            let g:rplugin_vimcom_lib = g:rplugin_vimcom_home . "/bin/x64/libVimR.dll"
         else
-            let g:rplugin_vimcom_lib = g:rplugin_vimcom_home . "/bin/libvimcom.so"
+            let g:rplugin_vimcom_lib = g:rplugin_vimcom_home . "/bin/libVimR.so"
         endif
         if !filereadable(g:rplugin_vimcom_lib)
             call RWarningMsgInp('Could not find "' . g:rplugin_vimcom_lib . '".')
@@ -3178,8 +3178,10 @@ endfunction
 
 function ROnJobActivity()
     if v:job_data[1] == 'stdout'
-        for idx in range(0, len(v:job_data[2]) - 1)
-            let cmd = v:job_data[2][idx]
+        for cmd in v:job_data[2]
+            if cmd == ""
+                continue
+            endif
             if cmd =~ "^call " || cmd  =~ "^let "
                 exe cmd
             else

From 430252a8dec1947857cc38fb5639f179a6dc95ff Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Tue, 16 Dec 2014 22:19:29 -0500
Subject: [PATCH 0885/1050] Fix ReadEvalReply(): use old code.

---
 r-plugin/common_global.vim | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 6bff9d5..dcbabe4 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -127,32 +127,31 @@ function ReplaceUnderS()
 endfunction
 
 function! ReadEvalReply()
-    let reply = ["No reply"]
+    let reply = "No reply"
     let haswaitwarn = 0
     let ii = 0
     while ii < 20
         sleep 100m
-        if filereadable(g:rplugin_tmpdir . "/eval_reply")
-            let reply = readfile(g:rplugin_tmpdir . "/eval_reply")
-            if len(reply) == 0
-                call RWarningMsg("Incomplete reply")
-                let reply = ["No reply"]
+        if filereadable($VIMRPLUGIN_TMPDIR . "/eval_reply")
+            let tmp = readfile($VIMRPLUGIN_TMPDIR . "/eval_reply")
+            if len(tmp) > 0
+                let reply = tmp[0]
+                break
             endif
-            break
         endif
         let ii += 1
         if ii == 2
             echohl WarningMsg
-            echon "\rWaiting..."
+            echon "\rWaiting for reply"
             echohl Normal
             let haswaitwarn = 1
         endif
     endwhile
     if haswaitwarn
-        echon "\r              "
+        echon "\r                 "
         redraw
     endif
-    return reply[0]
+    return reply
 endfunction
 
 function! CompleteChunkOptions()

From ec48d5b2db1bae48190777196306eba45d130706 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Thu, 18 Dec 2014 19:57:21 -0500
Subject: [PATCH 0886/1050] Replace rplugin_esc_tmpdir with rplugin_tmpdir

---
 ftplugin/rbrowser.vim      | 2 +-
 r-plugin/common_global.vim | 8 ++------
 2 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/ftplugin/rbrowser.vim b/ftplugin/rbrowser.vim
index 6f6cf3b..d564de7 100644
--- a/ftplugin/rbrowser.vim
+++ b/ftplugin/rbrowser.vim
@@ -322,7 +322,7 @@ function! ObBrBufUnload()
 endfunction
 
 function! SourceObjBrLines()
-    exe "source " . g:rplugin_esc_tmpdir . "/objbrowserInit"
+    exe "source " . substitute(g:rplugin_tmpdir, ' ', '\\ ', 'g') . "/objbrowserInit"
 endfunction
 
 nmap   :call RBrowserDoubleClick()
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index dcbabe4..f58d9aa 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -141,9 +141,7 @@ function! ReadEvalReply()
         endif
         let ii += 1
         if ii == 2
-            echohl WarningMsg
             echon "\rWaiting for reply"
-            echohl Normal
             let haswaitwarn = 1
         endif
     endwhile
@@ -706,8 +704,6 @@ function StartR_ExternalTerm(rcmd)
 
     let rcmd = 'VIMRPLUGIN_TMPDIR=' . substitute(g:rplugin_tmpdir, ' ', '\\ ', 'g') . ' VIMRPLUGIN_COMPLDIR=' . substitute(g:rplugin_compldir, ' ', '\\ ', 'g') . ' VIMINSTANCEID=' . $VIMINSTANCEID . ' VIMRPLUGIN_SECRET=' . $VIMRPLUGIN_SECRET . ' VIMEDITOR_SVRNM=' . $VIMEDITOR_SVRNM . ' ' . a:rcmd
 
-    echomsg rcmd
-
     call system("tmux has-session -t " . g:rplugin_tmuxsname)
     if v:shell_error
         if g:rplugin_termcmd =~ "gnome-terminal" || g:rplugin_termcmd =~ "xfce4-terminal" || g:rplugin_termcmd =~ "terminal" || g:rplugin_termcmd =~ "iterm"
@@ -1407,7 +1403,7 @@ function RInsert(cmd)
     if g:rplugin_lastev == "R is busy." || g:rplugin_lastev == "UNKNOWN" || g:rplugin_lastev =~ "^Error" || g:rplugin_lastev == "INVALID" || g:rplugin_lastev == "ERROR" || g:rplugin_lastev == "EMPTY" || g:rplugin_lastev == "No reply"
         call RWarningMsg(g:rplugin_lastev)
     else
-        silent exe "read " . g:rplugin_esc_tmpdir . "/Rinsert"
+        silent exe "read " . substitute(g:rplugin_tmpdir, ' ', '\\ ', 'g') . "/Rinsert"
     endif
 endfunction
 
@@ -1419,7 +1415,7 @@ function SendLineToRAndInsertOutput()
     else
         let curpos = getpos(".")
         " comment the output
-        let ilines = readfile(g:rplugin_esc_tmpdir . "/Rinsert")
+        let ilines = readfile(substitute(g:rplugin_tmpdir, ' ', '\\ ', 'g') . "/Rinsert")
         for iln in ilines
             call RSimpleCommentLine("normal", "c")
             normal! j

From 7ab4f680b703a67ff1e3b8c6af5e1792b82ea415 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Thu, 18 Dec 2014 19:58:52 -0500
Subject: [PATCH 0887/1050] Call BuildOmniList() in the first run of
 CompleteR()

---
 autoload/rcomplete.vim | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/autoload/rcomplete.vim b/autoload/rcomplete.vim
index 0f80c60..6b90cb6 100644
--- a/autoload/rcomplete.vim
+++ b/autoload/rcomplete.vim
@@ -55,9 +55,9 @@ fun! rcomplete#CompleteR(findstart, base)
         while start > 0 && (line[start - 1] =~ '\w' || line[start - 1] =~ '\.' || line[start - 1] =~ '\$')
             let start -= 1
         endwhile
+        call BuildROmniList()
         return start
     else
-        call BuildROmniList()
         let resp = []
         if strlen(a:base) == 0
             return resp

From ef1eba8ca8aa8a145c2ba2ea6d3ae9ba92d7231b Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Thu, 18 Dec 2014 21:12:02 -0500
Subject: [PATCH 0888/1050] Can't run `syntax enable` Highlighting defined in
 the vimrc is lost after `syntax enable`.

---
 r-plugin/common_buffer.vim |  6 ++++++
 r-plugin/functions.vim     | 23 ++++++++++++++++++++---
 2 files changed, 26 insertions(+), 3 deletions(-)

diff --git a/r-plugin/common_buffer.vim b/r-plugin/common_buffer.vim
index 96248dd..7b366c5 100644
--- a/r-plugin/common_buffer.vim
+++ b/r-plugin/common_buffer.vim
@@ -72,3 +72,9 @@ if !exists("g:SendCmdToR")
     let g:SendCmdToR = function('SendCmdToR_fake')
 endif
 
+" Were new libraries loaded by R?
+if !exists("b:rplugin_new_libs")
+    let b:rplugin_new_libs = 0
+endif
+autocmd CursorMoved  call RCheckLibList()
+
diff --git a/r-plugin/functions.vim b/r-plugin/functions.vim
index 98a56fe..f39453b 100644
--- a/r-plugin/functions.vim
+++ b/r-plugin/functions.vim
@@ -24,6 +24,7 @@ let g:rplugin_debug_lists = []
 let g:rplugin_loaded_lists = []
 let g:rplugin_Rhelp_list = []
 let g:rplugin_omni_lines = []
+let g:rplugin_new_libs = 0
 
 " syntax/r.vim may have being called before ftplugin/r.vim
 if !exists("g:rplugin_compldir")
@@ -137,12 +138,28 @@ function FillRLibList()
             endif
         endfor
     endif
-    " Reload the syntax for all loaded buffers
-    syntax enable
-    " let g:rplugin_liblist_filled = 1
+    " Now we need to update the syntax in all R files. There should be a
+    " better solution than setting a flag to let other buffers know that they
+    " also need to update the syntax on CursorMoved event:
+    " https://github.com/neovim/neovim/issues/901
+    let g:rplugin_new_libs = len("g:rplugin_loaded_lists")
+    silent exe 'set filetype=' . &filetype
+    let b:rplugin_new_libs = g:rplugin_new_libs
 endfunction
 
 
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+" Update the buffer syntax if necessary
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+
+function RCheckLibList()
+    if b:rplugin_new_libs == g:rplugin_new_libs
+        return
+    endif
+    silent exe 'set filetype=' . &filetype
+    let b:rplugin_new_libs = g:rplugin_new_libs
+endfunction
+
 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 " Source the Syntax scripts for the first time and Load omnilists
 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

From cb6a0eb30c1964396228db7bf21f3cab8bd8c990 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sat, 20 Dec 2014 09:08:20 -0500
Subject: [PATCH 0889/1050] Use BufEnter event to update syntax Also fix
 mistake in the use of len() function.

---
 r-plugin/common_buffer.vim | 2 +-
 r-plugin/functions.vim     | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/r-plugin/common_buffer.vim b/r-plugin/common_buffer.vim
index 7b366c5..c4f2aeb 100644
--- a/r-plugin/common_buffer.vim
+++ b/r-plugin/common_buffer.vim
@@ -76,5 +76,5 @@ endif
 if !exists("b:rplugin_new_libs")
     let b:rplugin_new_libs = 0
 endif
-autocmd CursorMoved  call RCheckLibList()
+autocmd BufEnter  call RCheckLibList()
 
diff --git a/r-plugin/functions.vim b/r-plugin/functions.vim
index f39453b..a6b50a0 100644
--- a/r-plugin/functions.vim
+++ b/r-plugin/functions.vim
@@ -142,7 +142,7 @@ function FillRLibList()
     " better solution than setting a flag to let other buffers know that they
     " also need to update the syntax on CursorMoved event:
     " https://github.com/neovim/neovim/issues/901
-    let g:rplugin_new_libs = len("g:rplugin_loaded_lists")
+    let g:rplugin_new_libs = len(g:rplugin_loaded_lists)
     silent exe 'set filetype=' . &filetype
     let b:rplugin_new_libs = g:rplugin_new_libs
 endfunction

From 7392d59b91114848fe62967b696533e6615de02a Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sat, 20 Dec 2014 23:32:44 -0500
Subject: [PATCH 0890/1050] Wait for \ao to finish in Neovim too I have made an
 attempt of avoiding Neovim freezing while R CMD BATCH was running, but if the
 user was typing something when R finished, the last typed keys would go to
 the new tab. Vim has the function feedkeys(), but in this case we need the
 opposite, whose name could be consumekeys().

---
 ftplugin/r_rplugin.vim | 46 ------------------------------------------
 1 file changed, 46 deletions(-)

diff --git a/ftplugin/r_rplugin.vim b/ftplugin/r_rplugin.vim
index 7c4f87d..f65d14e 100644
--- a/ftplugin/r_rplugin.vim
+++ b/ftplugin/r_rplugin.vim
@@ -13,19 +13,6 @@ endif
 " need be defined after the global ones:
 runtime r-plugin/common_buffer.vim
 
-function! RCmdBatchJob()
-    if v:job_data[1] == 'stdout'
-        echo join(v:job_data[2])
-    elseif v:job_data[1] == 'stderr'
-        call RWarningMsg(join(v:job_data[2]))
-    else
-        if v:job_data[0] == b:RCmdBatchID
-            let b:RCmdBatchID = -2
-        endif
-        call OpenRout(1)
-    endif
-endfunction
-
 " Run R CMD BATCH on current file and load the resulting .Rout in a split
 " window
 function! ShowRout()
@@ -42,25 +29,6 @@ function! ShowRout()
     " if not silent, the user will have to type 
     silent update
 
-    if has("nvim")
-        if b:RCmdBatchID != -2
-            call RWarningMsg("There is R CMD BATCH job running already.")
-            return
-        endif
-        if has("win32") || has("win64")
-            let b:RCmdBatchID = jobstart("RCmdBatch", 'Rcmd.exe', ['BATCH', '--no-restore', '--no-save',  expand("%"), b:routfile])
-        else
-            let b:RCmdBatchID = jobstart("RCmdBatch", b:rplugin_R, ['CMD', 'BATCH', '--no-restore', '--no-save', expand("%"), b:routfile])
-        endif
-        if b:RCmdBatchID == 0
-            call RWarningMsg("The job table is full.")
-        elseif b:RCmdBatchID == -1
-            call RWarningMsg("Failed to execute R.")
-        endif
-        echomsg 'R CMD BATCH job is running.'
-        return
-    endif
-
     if has("win32") || has("win64")
         let rcmd = 'Rcmd.exe BATCH --no-restore --no-save "' . expand("%") . '" "' . b:routfile . '"'
     else
@@ -74,13 +42,7 @@ function! ShowRout()
         call RWarningMsg('Error: "' . rlog . '"')
         sleep 1
     endif
-    call OpenRout(0)
-    return
-endfunction
-
-function! OpenRout(goback)
     if filereadable(b:routfile)
-        let curpos = getcurpos()
         if g:vimrplugin_routnotab == 1
             exe "split " . b:routfile
         else
@@ -109,14 +71,6 @@ let b:IsInRCode = function("DefaultIsInRCode")
 " global one:
 let b:SourceLines = function("RSourceLines")
 
-" job id for R CMD BATCH
-if has("nvim")
-    if !exists("b:RCmdBatchID")
-        let b:RCmdBatchID = -2
-        autocmd JobActivity RCmdBatch call RCmdBatchJob()
-    endif
-endif
-
 "==========================================================================
 " Key bindings and menu items
 

From 870f97980df52d743326c772bc48af8326b1b821 Mon Sep 17 00:00:00 2001
From: Michael Lerch 
Date: Tue, 23 Dec 2014 12:33:31 -0700
Subject: [PATCH 0891/1050] Make sure RCheckLibList() exists

Prevent error messages for non R filetypes
---
 r-plugin/common_buffer.vim | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/r-plugin/common_buffer.vim b/r-plugin/common_buffer.vim
index c4f2aeb..70482b6 100644
--- a/r-plugin/common_buffer.vim
+++ b/r-plugin/common_buffer.vim
@@ -76,5 +76,8 @@ endif
 if !exists("b:rplugin_new_libs")
     let b:rplugin_new_libs = 0
 endif
-autocmd BufEnter  call RCheckLibList()
+" When using as a global plugin for non R files, RCheckLibList will not exist
+if exists("*RCheckLibList")
+    autocmd BufEnter  call RCheckLibList()
+endif
 

From c6c0a4ccca6e52528ffd2ba3f64a76ee6b3890d3 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Wed, 24 Dec 2014 18:18:32 -0500
Subject: [PATCH 0892/1050] Set rplugin_uservimfiles in setcompldir.vim

---
 r-plugin/common_global.vim | 91 +++++++++-----------------------------
 r-plugin/setcompldir.vim   | 46 +++++++++++++++++++
 2 files changed, 68 insertions(+), 69 deletions(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index f58d9aa..752a0e3 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -2994,51 +2994,10 @@ command Rhistory :call ShowRhistory()
 "             rplugin_    for internal parameters
 "==========================================================================
 
-" g:rplugin_home should be the directory where the r-plugin files are.  For
-" users following the installation instructions it will be at ~/.vim or
-" ~/vimfiles, that is, the same value of g:rplugin_uservimfiles. However the
-" variables will have different values if the plugin is installed somewhere
-" else in the runtimepath.
-let g:rplugin_home = expand(":h:h")
-
-" g:rplugin_uservimfiles must be a writable directory. It will be g:rplugin_home
-" unless it's not writable. Then it wil be ~/.vim or ~/vimfiles.
-if filewritable(g:rplugin_home) == 2
-    let g:rplugin_uservimfiles = g:rplugin_home
-else
-    let g:rplugin_uservimfiles = split(&runtimepath, ",")[0]
-endif
-
-" From changelog.vim, with bug fixed by "Si" ("i5ivem")
-" Windows logins can include domain, e.g: 'DOMAIN\Username', need to remove
-" the backslash from this as otherwise cause file path problems.
-if executable("whoami")
-    let g:rplugin_userlogin = substitute(system('whoami'), "\\", "-", "")
-elseif $USER != ""
-    let g:rplugin_userlogin = $USER
-else
-    call RWarningMsgInp("Could not determine user name.")
-    let g:rplugin_failed = 1
-    finish
-endif
-
-if v:shell_error
-    let g:rplugin_userlogin = 'unknown'
-else
-    let newuline = stridx(g:rplugin_userlogin, "\n")
-    if newuline != -1
-        let g:rplugin_userlogin = strpart(g:rplugin_userlogin, 0, newuline)
-    endif
-    unlet newuline
+if exists("g:rplugin_compldir")
+    runtime r-plugin/setcompldir.vim
 endif
 
-if has("win32") || has("win64")
-    let g:rplugin_home = substitute(g:rplugin_home, "\\", "/", "g")
-    let g:rplugin_uservimfiles = substitute(g:rplugin_uservimfiles, "\\", "/", "g")
-    if $USERNAME != ""
-        let g:rplugin_userlogin = substitute($USERNAME, " ", "", "g")
-    endif
-endif
 
 if exists("g:vimrplugin_tmpdir")
     let g:rplugin_tmpdir = expand(g:vimrplugin_tmpdir)
@@ -3068,13 +3027,6 @@ if !isdirectory(g:rplugin_tmpdir)
     call mkdir(g:rplugin_tmpdir, "p", 0700)
 endif
 
-if exists("g:rplugin_compldir")
-    " syntax/r.vim was already called and a `syntax enable` may be required
-    syntax enable
-else
-    runtime r-plugin/setcompldir.vim
-endif
-
 " Old name of vimrplugin_assign option
 if exists("g:vimrplugin_underscore")
     " 07/mar/2014:
@@ -3300,29 +3252,30 @@ let s:all_marks = "abcdefghijklmnopqrstuvwxyz"
 
 
 " Choose a terminal (code adapted from screen.vim)
-if has("win32") || has("win64") || g:vimrplugin_applescript || $DISPLAY == "" || g:rplugin_do_tmux_split
+if exists("g:vimrplugin_term")
+    if !executable(g:vimrplugin_term)
+        call RWarningMsgInp("'" . g:vimrplugin_term . "' not found. Please change the value of 'vimrplugin_term' in your vimrc.")
+        let g:vimrplugin_term = "xterm"
+    endif
+endif
+if has("win32") || has("win64") || g:vimrplugin_applescript || g:rplugin_do_tmux_split || g:vimrplugin_r_in_buffer
     " No external terminal emulator will be called, so any value is good
     let g:vimrplugin_term = "xterm"
-else
-    let s:terminals = ['gnome-terminal', 'konsole', 'xfce4-terminal', 'terminal', 'Eterm', 'rxvt', 'urxvt', 'aterm', 'roxterm', 'terminator', 'lxterminal', 'xterm']
-    if has('mac')
-        let s:terminals = ['iTerm', 'Terminal', 'Terminal.app'] + s:terminals
+endif
+if !exists("g:vimrplugin_term")
+    let s:terminals = ['gnome-terminal', 'konsole', 'xfce4-terminal', 'terminal', 'Eterm', 'rxvt', 'urxvt', 'aterm', 'roxterm', 'terminator', 'lxterminal']
+    if has("mac") || has("macvim") || has("gui_macvim")
+        let s:terminals = ['iTerm', 'Terminal', 'Terminal.app', 'xterm'] + s:terminals
+    else
+        let s:terminals += ['xterm']
     endif
-    if exists("g:vimrplugin_term")
-        if !executable(g:vimrplugin_term)
-            call RWarningMsgInp("'" . g:vimrplugin_term . "' not found. Please change the value of 'vimrplugin_term' in your vimrc.")
-            unlet g:vimrplugin_term
+    for s:term in s:terminals
+        if executable(s:term)
+            let g:vimrplugin_term = s:term
+            break
         endif
-    endif
-    if !exists("g:vimrplugin_term")
-        for term in s:terminals
-            if executable(term)
-                let g:vimrplugin_term = term
-                break
-            endif
-        endfor
-        unlet term
-    endif
+    endfor
+    unlet s:term
     unlet s:terminals
 endif
 
diff --git a/r-plugin/setcompldir.vim b/r-plugin/setcompldir.vim
index 77102f0..e14c385 100644
--- a/r-plugin/setcompldir.vim
+++ b/r-plugin/setcompldir.vim
@@ -1,4 +1,50 @@
 
+" g:rplugin_home should be the directory where the r-plugin files are.  For
+" users following the installation instructions it will be at ~/.vim or
+" ~/vimfiles, that is, the same value of g:rplugin_uservimfiles. However the
+" variables will have different values if the plugin is installed somewhere
+" else in the runtimepath.
+let g:rplugin_home = expand(":h:h")
+
+" g:rplugin_uservimfiles must be a writable directory. It will be g:rplugin_home
+" unless it's not writable. Then it wil be ~/.vim or ~/vimfiles.
+if filewritable(g:rplugin_home) == 2
+    let g:rplugin_uservimfiles = g:rplugin_home
+else
+    let g:rplugin_uservimfiles = split(&runtimepath, ",")[0]
+endif
+
+" From changelog.vim, with bug fixed by "Si" ("i5ivem")
+" Windows logins can include domain, e.g: 'DOMAIN\Username', need to remove
+" the backslash from this as otherwise cause file path problems.
+if executable("whoami")
+    let g:rplugin_userlogin = substitute(system('whoami'), "\\", "-", "")
+elseif $USER != ""
+    let g:rplugin_userlogin = $USER
+else
+    call RWarningMsgInp("Could not determine user name.")
+    let g:rplugin_failed = 1
+    finish
+endif
+
+if v:shell_error
+    let g:rplugin_userlogin = 'unknown'
+else
+    let newuline = stridx(g:rplugin_userlogin, "\n")
+    if newuline != -1
+        let g:rplugin_userlogin = strpart(g:rplugin_userlogin, 0, newuline)
+    endif
+    unlet newuline
+endif
+
+if has("win32") || has("win64")
+    let g:rplugin_home = substitute(g:rplugin_home, "\\", "/", "g")
+    let g:rplugin_uservimfiles = substitute(g:rplugin_uservimfiles, "\\", "/", "g")
+    if $USERNAME != ""
+        let g:rplugin_userlogin = substitute($USERNAME, " ", "", "g")
+    endif
+endif
+
 if exists("g:vimrplugin_compldir")
     let g:rplugin_compldir = expand(g:vimrplugin_compldir)
 elseif (has("win32") || has("win64")) && $AppData != "" && isdirectory($AppData)

From 7b6a0fb446339bfb54153cfee248773b2f2fb4b9 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Wed, 24 Dec 2014 18:37:37 -0500
Subject: [PATCH 0893/1050] ~/Library/Caches/Vim-R-plugin as OS X cache dir

---
 r-plugin/setcompldir.vim | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/r-plugin/setcompldir.vim b/r-plugin/setcompldir.vim
index e14c385..27b58ba 100644
--- a/r-plugin/setcompldir.vim
+++ b/r-plugin/setcompldir.vim
@@ -51,6 +51,8 @@ elseif (has("win32") || has("win64")) && $AppData != "" && isdirectory($AppData)
     let g:rplugin_compldir = $AppData . "\\Vim-R-plugin"
 elseif isdirectory(expand("~/.cache"))
     let g:rplugin_compldir = expand("~/.cache/Vim-R-plugin")
+elseif isdirectory(expand("~/Library/Caches"))
+    let g:rplugin_compldir = expand("~/Library/Caches/Vim-R-plugin")
 else
     let g:rplugin_compldir = g:rplugin_uservimfiles . "/r-plugin/objlist/"
 endif

From c9ff55aec9e559d1ce8973c508394c5e0e771ed7 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Wed, 24 Dec 2014 20:01:07 -0500
Subject: [PATCH 0894/1050] Try iTerm and Terminal full paths on OS X

---
 r-plugin/common_global.vim | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 752a0e3..b997bed 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -3263,9 +3263,12 @@ if has("win32") || has("win64") || g:vimrplugin_applescript || g:rplugin_do_tmux
     let g:vimrplugin_term = "xterm"
 endif
 if !exists("g:vimrplugin_term")
-    let s:terminals = ['gnome-terminal', 'konsole', 'xfce4-terminal', 'terminal', 'Eterm', 'rxvt', 'urxvt', 'aterm', 'roxterm', 'terminator', 'lxterminal']
+    let s:terminals = ['gnome-terminal', 'konsole', 'xfce4-terminal', 'terminal',
+                \ 'Eterm', 'rxvt', 'urxvt', 'aterm', 'roxterm', 'terminator', 'lxterminal']
     if has("mac") || has("macvim") || has("gui_macvim")
-        let s:terminals = ['iTerm', 'Terminal', 'Terminal.app', 'xterm'] + s:terminals
+        let s:terminals = ['/Applications/Utilities/iTerm.app/Contents/MacOS/iTerm',
+                    \ '/Applications/Utilities/Terminal.app/Contents/MacOS/Terminal',
+                    \ 'xterm'] + s:terminals
     else
         let s:terminals += ['xterm']
     endif

From f1e7ff1e90cc2a6a6de479f19bb58f4e827a0511 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Thu, 25 Dec 2014 01:14:03 -0500
Subject: [PATCH 0895/1050] Require vimcom 1.1-15.

---
 r-plugin/common_global.vim | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index b997bed..b432ebf 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -933,8 +933,8 @@ function WaitVimComStart()
         let g:rplugin_vimcom_home = vr[1]
         let g:rplugin_vimcomport = vr[2]
         let g:rplugin_r_pid = vr[3]
-        if g:rplugin_vimcom_version != "1.1.14"
-            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.1.14.')
+        if g:rplugin_vimcom_version != "1.1.15"
+            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.1.15.')
             sleep 1
         endif
         if has("nvim")

From 971140204a26f96fdd831aba5220fee45b597067 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Thu, 25 Dec 2014 11:39:38 -0500
Subject: [PATCH 0896/1050] Delete no longer required objlist/README

---
 r-plugin/objlist/README | 7 -------
 1 file changed, 7 deletions(-)
 delete mode 100644 r-plugin/objlist/README

diff --git a/r-plugin/objlist/README b/r-plugin/objlist/README
deleted file mode 100644
index f4df93b..0000000
--- a/r-plugin/objlist/README
+++ /dev/null
@@ -1,7 +0,0 @@
-The omnils_ and fun_ files in this directory are generated by Vim-R-plugin
-and vimcom and are used for omni completion and syntax highlight.
-
-When you load a new version of a library, their files are replaced.
-
-You should manually delete files corresponding to libraries that you no
-longer use.

From 529dad113bd9f982a99a00214c3390a56bbba24d Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Thu, 25 Dec 2014 11:40:49 -0500
Subject: [PATCH 0897/1050] Replace vimrplugin_external_ob with _tmux_ob

---
 ftplugin/rbrowser.vim      |  8 ++---
 r-plugin/common_global.vim | 64 ++++++++++++++++++++++----------------
 2 files changed, 41 insertions(+), 31 deletions(-)

diff --git a/ftplugin/rbrowser.vim b/ftplugin/rbrowser.vim
index d564de7..dad8e86 100644
--- a/ftplugin/rbrowser.vim
+++ b/ftplugin/rbrowser.vim
@@ -56,7 +56,7 @@ function! UpdateOB(what)
     let g:rplugin_upobcnt = 1
 
     let g:rplugin_switchedbuf = 0
-    if g:rplugin_do_tmux_split == 0
+    if g:vimrplugin_tmux_ob == 0
         redir => s:bufl
         silent buffers
         redir END
@@ -342,9 +342,7 @@ endif
 
 au BufEnter  stopinsert
 
-if g:rplugin_do_tmux_split == 0
-    au BufUnload  call g:SendToVimCom("\004Stop updating info [OB BufUnload].")
-else
+if g:vimrplugin_tmux_ob
     au BufUnload  call ObBrBufUnload()
     " Fix problems caused by some plugins
     if exists("g:loaded_surround") && mapcheck("ds", "n") != ""
@@ -353,6 +351,8 @@ else
     if exists("g:loaded_showmarks ")
         autocmd! ShowMarks
     endif
+else
+    au BufUnload  call g:SendToVimCom("\004Stop updating info [OB BufUnload].")
 endif
 
 let s:envstring = tolower($LC_MESSAGES . $LC_ALL . $LANG)
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index b432ebf..92c0295 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -662,13 +662,6 @@ function StartR_TmuxSplit(rcmd)
     if WaitVimComStart()
         call g:SendToVimCom("\005B Update OB [StartR]")
     endif
-    if has("nvim")
-        let g:RBrOpenCloseLs = function("RBrOpenCloseLs_TmuxNeovim")
-        " Force Neovim to update the window size
-        mode
-    else
-        let g:RBrOpenCloseLs = function("RBrOpenCloseLs_TmuxVim")
-    endif
 endfunction
 
 
@@ -695,7 +688,7 @@ function StartR_ExternalTerm(rcmd)
                     \ "set terminal-overrides 'rxvt*:smcup@:rmcup@'" ]
         endif
 
-        if g:vimrplugin_external_ob || !has("gui_running")
+        if g:vimrplugin_tmux_ob || !has("gui_running")
             call extend(cnflines, ['set -g mode-mouse on', 'set -g mouse-select-pane on', 'set -g mouse-resize-pane on'])
         endif
         call writefile(cnflines, g:rplugin_tmpdir . "/tmux.conf")
@@ -1017,6 +1010,14 @@ function StartObjBrowser_Tmux()
         return
     endif
 
+    if has("nvim")
+        let g:RBrOpenCloseLs = function("RBrOpenCloseLs_TmuxNeovim")
+        " Force Neovim to update the window size
+        mode
+    else
+        let g:RBrOpenCloseLs = function("RBrOpenCloseLs_TmuxVim")
+    endif
+
     call g:SendToVimCom("\005G GlobalEnv [OB StartObjBrowser_Tmux]")
     sleep 50m
     call g:SendToVimCom("\005L Libraries [OB StartObjBrowser_Tmux]")
@@ -1061,6 +1062,7 @@ function StartObjBrowser_Tmux()
                 \ 'let b:rplugin_extern_ob = 1',
                 \ 'set shortmess=atI',
                 \ 'set rulerformat=%3(%l%)',
+                \ 'set laststatus=0',
                 \ 'set noruler',
                 \ 'let g:SendCmdToR = function("SendCmdToR_TmuxSplit")',
                 \ 'let g:RBrOpenCloseLs = function("RBrOpenCloseLs_TmuxOB")',
@@ -1212,6 +1214,9 @@ function StartObjBrowser_Vim()
         else
             set splitright
         endif
+        if g:vimrplugin_objbr_place =~ "console"
+            sb R_Output
+        endif
         sil exe "vsplit " . b:objbrtitle
         let &splitright = l:sr
         sil exe "vertical resize " . g:vimrplugin_objbr_w
@@ -1250,7 +1255,7 @@ function RObjBrowser()
     let g:rplugin_running_objbr = 1
 
     if !b:rplugin_extern_ob
-        if g:rplugin_do_tmux_split
+        if g:vimrplugin_tmux_ob
             call StartObjBrowser_Tmux()
         else
             call StartObjBrowser_Vim()
@@ -2994,7 +2999,7 @@ command Rhistory :call ShowRhistory()
 "             rplugin_    for internal parameters
 "==========================================================================
 
-if exists("g:rplugin_compldir")
+if !exists("g:rplugin_compldir")
     runtime r-plugin/setcompldir.vim
 endif
 
@@ -3064,7 +3069,6 @@ call RSetDefaultValue("g:vimrplugin_routnotab",         0)
 call RSetDefaultValue("g:vimrplugin_editor_w",         66)
 call RSetDefaultValue("g:vimrplugin_help_w",           46)
 call RSetDefaultValue("g:vimrplugin_objbr_w",          40)
-call RSetDefaultValue("g:vimrplugin_external_ob",       0)
 call RSetDefaultValue("g:vimrplugin_libcall_send",      1)
 call RSetDefaultValue("g:vimrplugin_i386",              0)
 if has("nvim")
@@ -3180,35 +3184,41 @@ else
     let g:vimrplugin_applescript = 0
 endif
 
-if has("gui_running")
+if has("gui_running") || g:vimrplugin_applescript
     let vimrplugin_only_in_tmux = 0
 endif
 
-if g:vimrplugin_applescript
-    let g:vimrplugin_only_in_tmux = 0
+if has("gui_running") || has("win32") || g:vimrplugin_applescript
+    let g:vimrplugin_tmux_ob = 0
+    if !g:vimrplugin_r_in_buffer
+        if g:vimrplugin_objbr_place =~ "console"
+            let g:vimrplugin_objbr_place = substitute(g:vimrplugin_objbr_place, "console", "script", "")
+        endif
+    endif
+endif
+
+if g:vimrplugin_r_in_buffer
+    let g:vimrplugin_tmux_ob = 0
+    let g:rplugin_do_tmux_split = 0
 endif
 
-if $TMUX != ""
+if $TMUX == ""
+    let g:rplugin_do_tmux_split = 0
+    call RSetDefaultValue("g:vimrplugin_tmux_ob", 0)
+else
     let g:rplugin_do_tmux_split = 1
     let g:vimrplugin_applescript = 0
-else
-    let g:vimrplugin_external_ob = 0
-    let g:rplugin_do_tmux_split = 0
+    call RSetDefaultValue("g:vimrplugin_tmux_ob", 1)
+endif
+if g:vimrplugin_objbr_place =~ "console" && !g:vimrplugin_r_in_buffer
+    let g:vimrplugin_tmux_ob = 1
 endif
 
 
 " ========================================================================
 
-if g:vimrplugin_external_ob == 1
-    let g:vimrplugin_objbr_place = substitute(g:vimrplugin_objbr_place, "script", "console", "")
-endif
-
-if g:vimrplugin_objbr_place =~ "console"
-    let g:vimrplugin_external_ob = 1
-endif
-
 " Check whether Tmux is OK
-if !has("win32") && !has("win64") && !has("gui_win32") && !has("gui_win64") && g:vimrplugin_applescript == 0
+if !has("win32") && !has("win64") && !has("gui_win32") && !has("gui_win64") && !g:vimrplugin_applescript && !g:vimrplugin_r_in_buffer
     if !executable('tmux') && g:vimrplugin_source !~ "screenR"
         call RWarningMsgInp("Please, install the 'Tmux' application to enable the Vim-R-plugin.")
         let g:rplugin_failed = 1

From 2561a0f651908c81aae8a28dfd3ffee1bd2b09f9 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Thu, 25 Dec 2014 11:44:58 -0500
Subject: [PATCH 0898/1050] Update documentation

---
 doc/r-plugin.txt | 194 ++++++++++++++++++++++++++---------------------
 1 file changed, 107 insertions(+), 87 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index c4fc945..fa61da7 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -114,15 +114,25 @@ Before installing the plugin, you should install its dependencies:
 
    Depends:~
 
-   Vim >= 7.4: http://www.vim.org/download.php
-               In addition to the most commonly used features, the plugin
-               requires: |+libcall|, |+clientserver| and |+conceal|.
+   Neovim or Vim:
+       Neovim (development version): https://github.com/neovim/neovim
+       Vim >= 7.4: http://www.vim.org/download.php
 
-	       Note: If you use Neovim, the |+clientserver| and |+libcall|
-	       features are not required.
+       Note: The Vim-R-plugin requires Vim compiled with |+libcall|,
+	    |+clientserver| and |+conceal| features. In Normal mode, do
+	    `:version`  to check if your Vim has these features.
 
-	       Note: If you use Mac OS X, read about the bugs that affect it:
-	       |r-plugin-nox|. The easier solution might be to use Neovim.
+	    The Vim-R-plugin only supports the |+clientserver| based on
+	    Windows and X Server. The Macvim |+clientserver| feature is not
+	    supported.
+
+	    There is no special requirement for Neovim.
+
+	    If you need to use the Vim-R-plugin in a Unix system without the
+	    X Server running (e.g. Mac OS X, Linux Console, and any system
+	    accessed through ssh), you have to use Neovim. If you cannot use
+	    Neovim and need to use Vim in these circumstances, please, read
+	    |r-plugin-nox| and |r-plugin-remote|.
 
    R >= 3.0.0: http://www.r-project.org/
 
@@ -133,7 +143,7 @@ Before installing the plugin, you should install its dependencies:
 		  It is optional if you are using Neovim.
 
    wmctrl:     http://tomas.styblo.name/wmctrl/
-               Required for SyncTeX support in Rnoweb files.
+               Required for better SyncTeX support under X Server.
 
 
    Suggests:~
@@ -175,6 +185,7 @@ You need to activate plugins and indentation according to 'filetype'. You
 should have at least the following options at the top or at near the very top
 of your |vimrc| (but below `set` `runtimepath`, if you have set it):
 >
+   set nocompatible
    syntax enable
    filetype plugin on
    filetype indent on
@@ -360,7 +371,7 @@ Note: It is recommended the use of different keys for  and
  to avoid clashes between filetype plugins and general plugins
 key binds. See |filetype-plugins|, |maplocalleader| and |r-plugin-localleader|.
 
-To use the plugin, open a .R or .Rnw or .Rd file with Vim and type
+To use the plugin, open a .R, .Rnw, .Rd, .Rmd or .Rrst file with Vim and type
 rf. Then, you will be able to use the plugin key bindings to send
 commands to R.
 
@@ -627,10 +638,6 @@ highlighted only if their libraries are loaded by R (but see
 Note: If you have too many loaded packages Vim may be unable to load the list
 of functions for syntax highlight.
 
-
-------------------------------------------------------------------------------
-4.4. Omni completion~
-
 Vim can automatically complete the names of R objects when CTRL-X CTRL-O is
 pressed in insert mode (see |omni-completion| for details). Omni completion
 shows in a pop up menu the name of the object, its class and its environment
@@ -648,7 +655,10 @@ Only the names of objects in .GlobalEnv and in loaded libraries are completed,
 and the |clientserver| feature is required to get the list of loaded libraries
 automatically updated. If either R is not running or Vim is running without
 the |clientserver| feature, only objects of libraries listed in
-|vimrplugin_start_libs| will have their names completed.
+|vimrplugin_start_libs| will have their names completed. When you load a new
+library in R, only the current buffer has the highlighting of function names
+immediately updated. If you have other buffers open, they will be updated when
+you enter them.
 
 Vim uses one file to store the names of .GlobalEnv objects and a list of files
 for all other objects. The .GlobalEnv list is stored in the `$VIMRPLUGIN_TMPDIR`
@@ -658,15 +668,15 @@ them.
 
 
 ------------------------------------------------------------------------------
-4.5. The Object Browser~
+4.4. The Object Browser~
 
-You have to do ro to either start or updated the Object Browser.
-The Object Browser has two views: .GlobalEnv and Libraries. If you either
-press  or double click (GVim or Vim with 'mouse' set to "a") on the
-first line of the Object Browser it will toggle the view between the objects
-in .GlobalEnv and the currently loaded libraries. The Object Browser requires
-the |+clientserver| feature to be automatically updated and the |+conceal|
-feature to correctly align list items.
+You have to do ro to start the Object Browser. The Object Browser
+has two views: .GlobalEnv and Libraries. If you either press  or double
+click (GVim or Vim with 'mouse' set to "a") on the first line of the Object
+Browser it will toggle the view between the objects in .GlobalEnv and the
+currently loaded libraries. The Object Browser requires the |+clientserver|
+feature to be automatically updated and the |+conceal| feature to correctly
+align list items.
 
 In the .GlobalEnv view, if an object has the attribute "label", it will also
 be displayed. Please, see the R help for package vimcom for some options
@@ -699,7 +709,7 @@ have their classes recognized in the GlobalEnv view.
 
 
 ------------------------------------------------------------------------------
-4.6. Commenting and uncommenting lines~
+4.5. Commenting and uncommenting lines~
 
 You can toggle the state of a line as either commented or uncommented by
 typing xx. The string used to comment the line will be "# ",
@@ -709,7 +719,7 @@ typing xx. The string used to comment the line will be "# ",
 You can also add the string "# " to the beginning of a line by typing
 xc and remove it with xu. In this case, you can set
 the value of vimrplugin_rcomment_string to control what string will be added
-to the begining of the line. Example:
+to the beginning of the line. Example:
 >
    let vimrplugin_rcomment_string = "# "
 <
@@ -739,7 +749,7 @@ in a buffer (see |:s| and |pattern-overview|).
 
 ------------------------------------------------------------------------------
 								 *:RBuildTags*
-4.7. Build a tags file to jump to function definitions~
+4.6. Build a tags file to jump to function definitions~
 
 Vim can jump to functions defined in other files if you press CTRL-] over the
 name of a function, but it needs a tags file to be able to find the function
@@ -752,7 +762,7 @@ source code.
 
 ------------------------------------------------------------------------------
 							       *r-plugin-tmux*
-4.8. Tmux usage~
+4.7. Tmux usage~
 
 When running either GVim or Vim in a terminal emulator (Linux/Unix only), the
 Vim-R-plugin will use Tmux to start R in a separate terminal emulator. R will
@@ -776,7 +786,7 @@ Note: Starting GVim within a Tmux session is not supported.
 
 ------------------------------------------------------------------------------
 							 *r-plugin-tmux-setup*
-4.8.1 Tmux configuration~
+4.7.1 Tmux configuration~
 
 If, as recommended, you always prefer to run Tmux before running you have to
 create your `~/.tmux.conf` if it does not exist yet. You may put the lines
@@ -807,7 +817,7 @@ file:
 <
 
 ------------------------------------------------------------------------------
-4.8.2 Key bindings and mouse support~
+4.7.2 Key bindings and mouse support~
 
 The Tmux configuration file suggested above configures Tmux to use vi key
 bindings. It also configures Tmux to react to mouse clicks. You should be able
@@ -860,7 +870,7 @@ you have to type .
 
 
 ------------------------------------------------------------------------------
-4.8.3 Copying and pasting~
+4.7.3 Copying and pasting~
 
 You do not need to copy code from Vim to R because you can use the plugin's
 shortcuts to send the code. For pasting the output of R commands into Vim's
@@ -881,7 +891,7 @@ support in Tmux. You will be able to toggle mouse support on and off by typing
 
 ------------------------------------------------------------------------------
 							     *r-plugin-remote*
-4.8.2 Remote access~
+4.7.2 Remote access~
 
 Note: Neovim does not require the --servername VIM argument. Thus, you also do
 not need to enable the X11 Forwarding for omnicompletion, etc.
@@ -981,27 +991,27 @@ If the Vim-R-plugin indents your code wrongly you may get the correct
 indentation by adding braces and line breaks to it. For example, try to
 indent the code below:
 >
-    # This code will be wrongly indented:
+   # This code will be wrongly indented:
 
-    levels(x) <- ## nl == nL or 1
-        if (nl == nL) as.character(labels)
-        else paste(labels, seq_along(levels), sep = "")
-    class(x) <- c(if(ordered) "ordered", "factor")
+   levels(x) <- ## nl == nL or 1
+       if (nl == nL) as.character(labels)
+       else paste(labels, seq_along(levels), sep = "")
+   class(x) <- c(if(ordered) "ordered", "factor")
 
 
-    # But this one will be correctly indented:
+   # But this one will be correctly indented:
 
-    levels(x) <- ## nl == nL or 1
-        if (nl == nL)
-            as.character(labels)
-        else
-            paste(labels, seq_along(levels), sep = "")
-    class(x) <- c(if(ordered) "ordered", "factor")
+   levels(x) <- ## nl == nL or 1
+       if (nl == nL)
+           as.character(labels)
+       else
+           paste(labels, seq_along(levels), sep = "")
+   class(x) <- c(if(ordered) "ordered", "factor")
 <
 See also:
 
-    https://github.com/jcfaria/Vim-R-plugin/issues/77
-    https://github.com/jcfaria/Vim-R-plugin/blob/master/r-plugin/indent_test.R
+   https://github.com/jcfaria/Vim-R-plugin/issues/77
+   https://github.com/jcfaria/Vim-R-plugin/blob/master/r-plugin/indent_test.R
 
 
 ------------------------------------------------------------------------------
@@ -1023,17 +1033,18 @@ issue is to define the chunk option `cache.lazy=FALSE`.
 ------------------------------------------------------------------------------
 5.7. Wrong message that "R is busy" (Windows only)~
 
-On Windows, when code is sent from Vim to R Console, the vimcom library
-sets the value of the internal variable `r_is_busy` to 1. The value is set
-back to 0 when any code is successfully evaluated. If you send invalid code to
-R, there will be no successful evaluation of code and, thus, the value of
+On Windows, when code is sent from Vim to R Console, the vimcom library sets
+the value of the internal variable `r_is_busy` to 1. The value is set back to
+0 when any code is successfully evaluated. If you send invalid code to R,
+there will be no successful evaluation of code and, thus, the value of
 `r_is_busy` will remain set to 1. Then, if you try to update the object
 browser, see the R documentation for any function, or do other tasks that
-require the hidden evaluation of code by R, the vimcom library will
-refuse to do the tasks to avoid any risk of corrupting R's memory. It will
-tell Vim that "R is busy" and Vim will display this message. Everything should
-work as expected again after any valid code is executed in the R Console.
+require the hidden evaluation of code by R, the vimcom library will refuse to
+do the tasks to avoid any risk of corrupting R's memory. It will tell Vim that
+"R is busy" and Vim will display this message. Everything should work as
+expected again after any valid code is executed in the R Console.
 
+The vimcom library is started with the state `busy`.
 
 ------------------------------------------------------------------------------
 							*r-plugin-SyncTeX-win*
@@ -1043,8 +1054,8 @@ work as expected again after any valid code is executed in the R Console.
 There is no SyncTeX support for Windows and Mac OS X. Both Sumatra (Windows)
 and Skim (Mac OS X) have support for SyncTeX, but the Vim-R-plugin is not
 ready to communicate with them. If you can, please write the necessary code to
-support anyone of them and submit a push request on github:
-https://github.com/jcfaria/Vim-R-plugin
+support Skim and revise the already partially written code for Sumatra submit
+it as a push request on github: https://github.com/jcfaria/Vim-R-plugin
 
 
 ------------------------------------------------------------------------------
@@ -1084,9 +1095,7 @@ When Vim cannot receive messages, the result is:
 
    * Syntax highlight of function names and the list of objects for
      omnicompletion are not immediately updated after you load a new R
-     package. They are updated only after the |CursorHold| event is triggered,
-     that is, after you stay 'updatetime' milliseconds in Normal mode doing
-     nothing. For a workaround, see |vimrplugin_start_libs|.
+     package. For a workaround, see |vimrplugin_start_libs|.
 
 On Linux you may find Vim binaries without the |clientserver| feature if
 you install packages such as vim-nox on Debian/Ubuntu or vim-enhanced on
@@ -1095,18 +1104,28 @@ Hat, you may want to create a symbolic link to "gvim" named "vim". You still
 have to explicitly start the server with the argument |--servername|.
 
 The R package vimcom has support only for Windows and X11 interprocess
-communication systems while MacVim is a Cocoa application, that is,
-vimcom is unable to send messages to MacVim too. For vimcom, running
-MacVim is equivalent to running Vim without the |clientserver| feature.
+communication systems while MacVim is a Cocoa application, that is, vimcom is
+unable to send messages to MacVim. For vimcom, running MacVim is equivalent to
+running Vim without the |clientserver| feature. For this reason, on Mac OS X,
+by default, vimcom is built without support to Vim's |clientserver| feature.
 
 On Mac OS X, to get omnicompletion, syntax highlight of function names and the
-Object Browser working properly, in addition to using Vim built with X11
-support, and not MacVim, you also have to install XQuartz server (X11.app).
-A user reported success with the following procedure:
+Object Browser working properly, you have to do the following:
+
+   1. Install XQuartz server (X11.app)
+
+   2. Build vimcom with the argument `--enable-clientserver`. That is, download
+      vimcom from http://www.lepem.ufc.br/jaa/vimcom.html and do in R:
 >
-   brew install vim --with-client-server
-   tmux
-   /usr/local/Cellar/vim/7.4.273/bin/vim --servername VIM r_script.R
+      install.packages("vimcom_1.2-0.tar.gz", repos = NULL, type = "source",
+                       configure.args = "--enable-clientserver")
+<
+   3. Build Vim with X11 support. A user reported success with the following
+      procedure:
+>
+      brew install vim --with-client-server
+      tmux
+      /usr/local/Cellar/vim/7.4.273/bin/vim --servername VIM r_script.R
 <
 See also: |r-plugin-remote|.
 
@@ -1189,14 +1208,14 @@ is running:
 |vimrplugin_rnowebchunk|       Convert '<' into '<<>>=\n@' in Rnoweb files
 |vimrplugin_objbr_place|       Placement of Object Browser
 |vimrplugin_objbr_w|           Initial width of Object Browser window
-|vimrplugin_external_ob|       Run Object Browser on external terminal
+|vimrplugin_tmux_ob|           Run Object Browser in Tmux pane
 |vimrplugin_vimpager|          Use Vim to see R documentation
 |vimrplugin_editor_w|          Minimum width of R script buffer
 |vimrplugin_help_w|            Desired width of R documentation buffer
 |vimrplugin_i386|              Use 32 bit version of R
 |vimrplugin_r_path|            Directory where R is
 |vimrplugin_r_args|            Arguments to pass to R
-|vimrplugin_start_libs|    Objects for omnicompletion and syntax highlight
+|vimrplugin_start_libs|        Objects for omnicompletion and syntax highlight
 |vimrplugin_routmorecolors|    More syntax highlighting in R output
 |vimrplugin_routnotab|         Show output of R CMD BATCH in new window
 |vimrplugin_indent_commented|  Indent lines commented with the \xx command
@@ -1292,7 +1311,7 @@ it.
 						      *vimrplugin_r_in_buffer*
 6.3. Run R in Neovim buffer (experimental feature)~
 
-Note: This features depends on a pull request not merged yet:
+Note: This feature depends the pull request:
 https://github.com/neovim/neovim/pull/1584
 
 If you are running Neovim and want to try this experimental feature, put in
@@ -1393,7 +1412,7 @@ them converted into `<-`.
 ------------------------------------------------------------------------------
 						      *vimrplugin_objbr_place*
 						      *vimrplugin_objbr_w*
-						      *vimrplugin_external_ob*
+						      *vimrplugin_tmux_ob*
 6.4. Object Browser options~
 
 By default, the object browser will be created with 40 columns. The minimum
@@ -1403,21 +1422,19 @@ browser's default width by setting the value of |vimrplugin_objbr_w| in your
 >
    let vimrplugin_objbr_w = 30
 <
-The Object Browser will always be created by splitting the Vim script window
-if you are running either GVim or Vim not inside a Tmux session. However, if
-running Vim in a terminal emulator inside a Tmux session, the Object Browser
-will be created in an independent Vim instance in a Tmux panel beside the R
-Console. Valid values for the Object Browser placement are "script" or
-"console" and "right" or "left" separated by a comma. Examples:
+The Object Browser is created by splitting the Vim script window, but if Vim
+is running in a terminal emulator inside a Tmux session, the Object Browser
+will be created in an independent Vim instance in a Tmux pane. If you prefer
+the Object Browser always created as a Vim split window, put in your |vimrc|:
+>
+   let vimrplugin_tmux_ob = 0
+<
+Valid values for the Object Browser placement are "script" or "console" and
+"right" or "left" separated by a comma. Examples:
 >
    let vimrplugin_objbr_place = "script,right"
    let vimrplugin_objbr_place = "console,left"
 <
-If vimrplugin_external_ob = 1 and R is running in an external terminal
-emulator, the Object Browser will be placed besides the R Console in the
-external terminal emulator. In this case, the command rh will not
-work on the Object Browser (you will see the message "Cmd not available").
-
 
 ------------------------------------------------------------------------------
 							 *vimrplugin_vimpager*
@@ -2746,6 +2763,7 @@ please read this document from the beginning.
    ~/.vimrc~
 >
    " Minimum required configuration:
+   set nocompatible
    syntax on
    filetype plugin on
    filetype indent on
@@ -2863,21 +2881,23 @@ See also |vimrplugin_r_in_buffer|.
 							       *r-plugin-news*
 10. News~
 
-1.1.1 (2014-12-16)
+1.1.1 (2014-12-23)
 
- * Change commands gn and gN into gn and gN.
+ * Change commands gn and gN to gn and gN.
 
  * New option (Neovim only): vimrplugin_r_in_buffer and :Rhistory.
 
  * New command: :RStop.
 
- * No longer requires +python feature; requires +libcall instead.
+ * No longer require +python feature; require +libcall instead.
+
+ * Remove option vimrplugin_sleeptime.
 
- * Removed option vimrplugin_sleeptime.
+ * Replace option vimrplugin_external_ob with vimrplugin_tmux_ob.
 
- * Removed command :RpluginConfig.
+ * Remove command :RpluginConfig.
 
- * Rename vimrplugin_permanent_libs into vimrplugin_start_libs
+ * Rename vimrplugin_permanent_libs to vimrplugin_start_libs
 
 1.1 (2014-11-13)
 

From eea38e63f2be70a072548d27cb7b9c06675ded30 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Fri, 26 Dec 2014 16:44:10 -0500
Subject: [PATCH 0899/1050] Remove support for Neovim It is easier to maintain
 two separate repositories than keep the support for both Vim and Neovim in
 the same repository. See: https://github.com/jalvesaq/Nvim-R

---
 Makefile                    |   4 +-
 doc/r-plugin.txt            | 177 +++++------------------
 ftplugin/r_rplugin.vim      |   2 +-
 ftplugin/rbrowser.vim       |   2 +-
 ftplugin/rdoc.vim           |   2 +-
 ftplugin/rhelp_rplugin.vim  |   2 +-
 ftplugin/rmd_rplugin.vim    |   2 +-
 ftplugin/rnoweb_rplugin.vim |  27 +---
 ftplugin/rrst_rplugin.vim   |   2 +-
 list_for_vimball            |   2 -
 r-plugin/common_global.vim  | 232 ++++++-------------------------
 r-plugin/functions.vim      |   4 +
 r-plugin/nvimbuffer.vim     | 270 ------------------------------------
 r-plugin/windows.vim        |   3 -
 14 files changed, 98 insertions(+), 633 deletions(-)
 delete mode 100644 r-plugin/nvimbuffer.vim

diff --git a/Makefile b/Makefile
index 0e82848..c8ca34e 100644
--- a/Makefile
+++ b/Makefile
@@ -80,7 +80,6 @@ deb:
 	  - r-plugin/functions.vim\n\
 	  - r-plugin/global_r_plugin.vim\n\
 	  - r-plugin/gui_running.vim\n\
-	  - r-plugin/nvimbuffer.vim\n\
 	  - r-plugin/setcompldir.vim\n\
 	  - r-plugin/synctex_evince_backward.py\n\
 	  - r-plugin/synctex_evince_forward.py\n\
@@ -128,7 +127,8 @@ deb:
 	Architecture: all\n\
 	Maintainer: Jakson Alves de Aquino \n\
 	Installed-Size: $(INSTALLEDSIZE)\n\
-	Depends: vim | vim-gtk | vim-gnome, tmux (>= 1.8), ncurses-term, wmctrl, latexmk, vim-addon-manager, r-base-core\n\
+	Depends: vim | vim-gtk | vim-gnome, tmux (>= 1.8), ncurses-term, vim-addon-manager, r-base-core\n\
+	Suggests: wmctrl, latexmk\n\
 	Enhances: vim\n\
 	Section: text\n\
 	Priority: extra\n\
diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index fa61da7..65e459d 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -25,11 +25,13 @@ For Vim version 7.4
 1. Overview~
 
 This plugin improves Vim's support for editing R code and makes it possible to
-integrate Vim with R.
+integrate Vim with R. If you want to use Neovim and R, see:
 
-It uses some ideas and code from Johannes Ranke's (vim-r-plugin), Eric Van
-Dewoestine's (screen.vim plugin), Vincent Nijs (R.vim for Mac OS X) and some
-ideas from the Tinn-R (Windows only) project.
+   https://github.com/jalvesaq/Nvim-R
+
+The plugin uses some ideas and code from Johannes Ranke's (vim-r-plugin), Eric
+Van Dewoestine's (screen.vim plugin), Vincent Nijs (R.vim for Mac OS X) and
+some ideas from the Tinn-R (Windows only) project.
 
 The latest stable version of this plugin is available at:
 
@@ -114,25 +116,18 @@ Before installing the plugin, you should install its dependencies:
 
    Depends:~
 
-   Neovim or Vim:
-       Neovim (development version): https://github.com/neovim/neovim
-       Vim >= 7.4: http://www.vim.org/download.php
+   Vim >= 7.4: http://www.vim.org/download.php
 
        Note: The Vim-R-plugin requires Vim compiled with |+libcall|,
 	    |+clientserver| and |+conceal| features. In Normal mode, do
 	    `:version`  to check if your Vim has these features.
 
-	    The Vim-R-plugin only supports the |+clientserver| based on
-	    Windows and X Server. The Macvim |+clientserver| feature is not
-	    supported.
-
-	    There is no special requirement for Neovim.
-
 	    If you need to use the Vim-R-plugin in a Unix system without the
-	    X Server running (e.g. Mac OS X, Linux Console, and any system
-	    accessed through ssh), you have to use Neovim. If you cannot use
-	    Neovim and need to use Vim in these circumstances, please, read
-	    |r-plugin-nox| and |r-plugin-remote|.
+	    X Server running (e.g. Linux Console, and any system accessed
+	    through ssh), you have to use Neovim and Nvim-R:
+	    https://github.com/jalvesaq/Nvim-R
+	    If you cannot use Neovim and need to use Vim in these
+	    circumstances, please, read |r-plugin-nox| and |r-plugin-remote|.
 
    R >= 3.0.0: http://www.r-project.org/
 
@@ -140,7 +135,6 @@ Before installing the plugin, you should install its dependencies:
 
    Tmux >= 1.8:   http://tmux.sourceforge.net
                   Tmux is necessary to send commands from Vim to R Console.
-		  It is optional if you are using Neovim.
 
    wmctrl:     http://tomas.styblo.name/wmctrl/
                Required for better SyncTeX support under X Server.
@@ -150,15 +144,11 @@ Before installing the plugin, you should install its dependencies:
 
    colorout:      http://www.lepem.ufc.br/jaa/colorout.html
                   Colorizes the R output.
-		  Not required if you will run R as a Neovim job. See
-		  |vimrplugin_r_in_buffer|.
 
    setwidth:      An R package that can be installed with the command
                   `install.packages("setwidth")`.
                   The library setwidth adjusts the value of `options("width")`
                   whenever the terminal is resized.
-		  Not required if you will run R as a Neovim job. See
-		  |vimrplugin_r_in_buffer|.
 
    ncurses-term:  http://invisible-island.net/ncurses
 		  Might be necessary if you want support for 256 colors at the
@@ -230,10 +220,10 @@ tips on how to configure Bash.
 The Vim configuration also may be improved. See some tips at
 |r-plugin-vimrc-setup|.
 
-Note: On Mac OS X, in both Vim and GVim, the plugin will use AppleScript to
-send commands to the R Console application unless |vimrplugin_applescript| = 0.
-Some users have reported more luck with iTerm than with the default Mac OS X
-terminal emulator.
+Note: On Mac OS X, the plugin will use AppleScript to send commands to the R
+Console application unless |vimrplugin_applescript| = 0. Some users have
+reported more luck with iTerm than with the default Mac OS X terminal
+emulator.
 
 If you want to uninstall the plugin, do
 >
@@ -780,7 +770,6 @@ other for Tmux. Then, it's useful (but not required) to know some Tmux
 commands. After you finished editing the file, you have to type `exit` to quit
 the Tmux session.
 
-Note: Neovim does not require the --servername VIM argument.
 Note: Starting GVim within a Tmux session is not supported.
 
 
@@ -893,9 +882,6 @@ support in Tmux. You will be able to toggle mouse support on and off by typing
 							     *r-plugin-remote*
 4.7.2 Remote access~
 
-Note: Neovim does not require the --servername VIM argument. Thus, you also do
-not need to enable the X11 Forwarding for omnicompletion, etc.
-
 The Vim-R-plugin can not send commands from a local Vim to a remote R, but
 you can access the remote machine through ssh and run Tmux, Vim and R in the
 remote machine. Tmux should not be running in the local machine because some
@@ -1060,16 +1046,12 @@ it as a push request on github: https://github.com/jcfaria/Vim-R-plugin
 
 ------------------------------------------------------------------------------
 								*r-plugin-nox*
-5.9. Bugs that affect Mac OS X, Linux Console and ...~
-
-Note: The bug described in this section does not affect Neovim.
+5.9. Bugs that affect Linux Console and Vim accessed through ssh~
 
-If you use MacVim, run Vim in the Linux Console or start Vim in a terminal
-emulator without the command line argument |--servername|, Vim will not
-receive remote messages and the vimcom package will display one of the
-following messages:
+If you run Vim in the Linux Console or start Vim in a terminal emulator
+without the command line argument |--servername|, Vim will not receive remote
+messages and the vimcom package will display one of the following messages:
 
-   MacVim isn't fully supported by vimcom.
    Vim was built without the 'clientserver' feature.
    Did you pass the --servername argument to Vim?
    There is no X Server running.
@@ -1104,13 +1086,10 @@ Hat, you may want to create a symbolic link to "gvim" named "vim". You still
 have to explicitly start the server with the argument |--servername|.
 
 The R package vimcom has support only for Windows and X11 interprocess
-communication systems while MacVim is a Cocoa application, that is, vimcom is
-unable to send messages to MacVim. For vimcom, running MacVim is equivalent to
-running Vim without the |clientserver| feature. For this reason, on Mac OS X,
-by default, vimcom is built without support to Vim's |clientserver| feature.
-
-On Mac OS X, to get omnicompletion, syntax highlight of function names and the
-Object Browser working properly, you have to do the following:
+communication systems while MacVim is a Cocoa application. For this reason, on
+Mac OS X, by default, vimcom is built without support to Vim's |clientserver|
+feature. If you prefer to use Vim instead of MacVim in Mac OS X, then, you
+should:
 
    1. Install XQuartz server (X11.app)
 
@@ -1202,7 +1181,6 @@ is running:
 |vimrplugin_term|              External terminal to be used
 |vimrplugin_term_cmd|          Complete command to open an external terminal
 |vimrplugin_Rterm|             On Windows, use Rterm.exe
-|vimrplugin_r_in_buffer|       Run R in Neovim buffer
 |vimrplugin_assign|            Convert '_' into ' <- '
 |vimrplugin_assign_map|        Choose what to convert into ' <- '
 |vimrplugin_rnowebchunk|       Convert '<' into '<<>>=\n@' in Rnoweb files
@@ -1307,71 +1285,6 @@ Mode" on either PowerShell or Command Prompt and to send a "Right click" to
 it.
 
 
-------------------------------------------------------------------------------
-						      *vimrplugin_r_in_buffer*
-6.3. Run R in Neovim buffer (experimental feature)~
-
-Note: This feature depends the pull request:
-https://github.com/neovim/neovim/pull/1584
-
-If you are running Neovim and want to try this experimental feature, put in
-your |vimrc|:
->
-   let vimrplugin_r_in_buffer = 1
-<
-R will run as a Neovim job and the output will be displayed in a buffer. If
-the cursor is in the last line of the R_Output buffer and Neovim is in Insert
-mode, an  will submit the line to R evaluation,  will
-complete names of objects,  will complete the names of function
-arguments, and  and  will cycle through the history of sent
-commands. Finally, if you type part of a previously issued command, you can
-press  to complete the line from the history.
-
-Whether you are in the R script buffer or in the R_Output buffer, you can also
-press  in Normal mode to open an R scratch buffer to
-type commands that you want to see evaluated by R but do not want in your
-final script. The keys  and  are mapped in Normal mode to quit the
-scratch buffer.
-
-The R command `history()` will not work, but you can do `:Rhistory` in Neovim
-to open a buffer with the history of commands in a new tab. Commands starting
-with the string "base::source" are not added to the history.
-
-You can set the foreground colors of R output in your |vimrc| when you are
-running Neovim in a terminal emulator. The example below is for a terminal
-emulator that supports 256 colors (see |highlight-ctermfg|):
->
-   if &t_Co == 256
-       let rout_color_input = 247
-       let rout_color_normal = 39
-       let rout_color_number = 51
-       let rout_color_integer = 51
-       let rout_color_float = 51
-       let rout_color_complex = 51
-       let rout_color_negnum = 183
-       let rout_color_negfloat = 183
-       let rout_color_date = 43
-       let rout_color_true = 78
-       let rout_color_false = 203
-       let rout_color_inf = 39
-       let rout_color_constant = 75
-       let rout_color_string = 79
-       let rout_color_stderr = 33
-       let rout_color_error = 15
-       let rout_color_warn = 1
-       let rout_color_index = 186
-   endif
-<
-To know what number corresponds to your preferred color (among the 256
-possibilities), hover you mouse pointer over the table of colors at the end
-of http://www.lepem.ufc.br/jaa/colorout.html
-
-If you prefer that R output is highlighted using you current |:colorscheme|,
-put in your vimrc:
->
-   let rout_follow_colorscheme = 1
-<
-
 ------------------------------------------------------------------------------
 						      *vimrplugin_rnowebchunk*
 	                                              *vimrplugin_assign_map*
@@ -1468,11 +1381,10 @@ The valid values of vimrplugin_vimpager are:
 
    "tab"       : Show the help document in a new tab. If there is already a
                  tab with an R help document tab, use it.
-                 This is the default if vimrplugin_r_in_buffer = 0.
+                 This is the default.
    "vertical"  : Split the window vertically if the editor width is large
                  enough; otherwise, split the window horizontally and attempt
                  to set the window height to at least 20 lines.
-                 This is the default if vimrplugin_r_in_buffer = 1.
    "horizontal": Split the window horizontally.
    "tabnew"    : Show the help document in a new tab.
    "no"        : Do not show R documentation in Vim.
@@ -2057,23 +1969,6 @@ Note: If the PDF document is already open the first time that you jump to it,
 and if Okular was not started with the `--unique` argument, another instance
 of Okular will be started.
 
-Note: If you are using Neovim, the configuration of Okular backward search
-requires additional steps because Neovim does not have the argument
-`--remote-expr`:
-
-   - Copy the file synctex_okular_backward.sh from the Vim-R-plugin directory
-     to your path (for example, ~/bin or /usr/local/bin).
-
-   - Turn the file executable. In the terminal, go to the directory where you
-     have copied the file and do:
->
-     chmod +x synctex_okular_backward.sh
-<
-   - In Okular, put the following in the Custom Editor Command field:
->
-     synctex_okular_backward.sh '%f' %l
-<
-
 ------------------------------------------------------------------------------
 6.34.3 Zathura configuration~
 
@@ -2314,7 +2209,6 @@ directory after the installation:
    r-plugin/functions.vim
    r-plugin/global_r_plugin.vim
    r-plugin/gui_running.vim
-   r-plugin/nvimbuffer.vim
    r-plugin/osx.vim
    r-plugin/r.snippets
    r-plugin/rmd.snippets
@@ -2825,7 +2719,7 @@ please read this document from the beginning.
 <
 
 							 *r-plugin-bash-setup*
-   ~/.bashrc for Vim and Neovim (Unix):~
+   ~/.bashrc for Vim (Unix):~
 >
    # Change the TERM environment variable (to get 256 colors) and make Vim
    # connecting to X Server even if running in a terminal emulator (many of
@@ -2874,31 +2768,30 @@ Shell or VimShell to send commands to R. This integration was removed on
 August 20, 2013. People wanting this integration back into the plugin may want
 to use the old Vim-R-plugin code as a starting point to create scripts to be
 sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details.
-See also |vimrplugin_r_in_buffer|.
 
 
 ==============================================================================
 							       *r-plugin-news*
 10. News~
 
-1.1.1 (2014-12-23)
+1.1.1 (2014-12-26)
 
- * Change commands gn and gN to gn and gN.
-
- * New option (Neovim only): vimrplugin_r_in_buffer and :Rhistory.
+ * Remove support for Neovim. See: https://github.com/jalvesaq/Nvim-R
 
- * New command: :RStop.
+ * Remove option vimrplugin_sleeptime.
 
- * No longer require +python feature; require +libcall instead.
+ * Remove command :RpluginConfig.
 
- * Remove option vimrplugin_sleeptime.
+ * Change commands gn and gN to gn and gN.
 
  * Replace option vimrplugin_external_ob with vimrplugin_tmux_ob.
 
- * Remove command :RpluginConfig.
-
  * Rename vimrplugin_permanent_libs to vimrplugin_start_libs
 
+ * New command: :RStop.
+
+ * No longer require +python feature; require +libcall instead.
+
 1.1 (2014-11-13)
 
  * Version update for Linux/Unix only. May not work on Windows or Mac.
diff --git a/ftplugin/r_rplugin.vim b/ftplugin/r_rplugin.vim
index f65d14e..1c62e65 100644
--- a/ftplugin/r_rplugin.vim
+++ b/ftplugin/r_rplugin.vim
@@ -1,5 +1,5 @@
 
-if exists("g:disable_r_ftplugin")
+if exists("g:disable_r_ftplugin") || has("nvim")
     finish
 endif
 
diff --git a/ftplugin/rbrowser.vim b/ftplugin/rbrowser.vim
index dad8e86..1454ee8 100644
--- a/ftplugin/rbrowser.vim
+++ b/ftplugin/rbrowser.vim
@@ -4,7 +4,7 @@
 
 
 " Only do this when not yet done for this buffer
-if exists("b:did_ftplugin")
+if exists("b:did_ftplugin") || has("nvim")
     finish
 endif
 
diff --git a/ftplugin/rdoc.vim b/ftplugin/rdoc.vim
index 60d0284..1cc87e2 100644
--- a/ftplugin/rdoc.vim
+++ b/ftplugin/rdoc.vim
@@ -4,7 +4,7 @@
 
 
 " Only do this when not yet done for this buffer
-if exists("b:did_rdoc_ftplugin")
+if exists("b:did_rdoc_ftplugin") || has("nvim")
     finish
 endif
 
diff --git a/ftplugin/rhelp_rplugin.vim b/ftplugin/rhelp_rplugin.vim
index d915577..e59c26c 100644
--- a/ftplugin/rhelp_rplugin.vim
+++ b/ftplugin/rhelp_rplugin.vim
@@ -1,5 +1,5 @@
 
-if exists("g:disable_r_ftplugin")
+if exists("g:disable_r_ftplugin") || has("nvim")
     finish
 endif
 
diff --git a/ftplugin/rmd_rplugin.vim b/ftplugin/rmd_rplugin.vim
index 3d3cc97..210f1f1 100644
--- a/ftplugin/rmd_rplugin.vim
+++ b/ftplugin/rmd_rplugin.vim
@@ -1,5 +1,5 @@
 
-if exists("g:disable_r_ftplugin")
+if exists("g:disable_r_ftplugin") || has("nvim")
     finish
 endif
 
diff --git a/ftplugin/rnoweb_rplugin.vim b/ftplugin/rnoweb_rplugin.vim
index 476a823..6bd514c 100644
--- a/ftplugin/rnoweb_rplugin.vim
+++ b/ftplugin/rnoweb_rplugin.vim
@@ -1,5 +1,5 @@
 
-if exists("g:disable_r_ftplugin")
+if exists("g:disable_r_ftplugin") || has("nvim")
     finish
 endif
 
@@ -541,12 +541,7 @@ function! SyncTeX_forward(...)
     if g:rplugin_pdfviewer == "okular"
         call system("okular --unique " . basenm . ".pdf#src:" . texln . substitute(expand("%:p:h"), ' ', '\\ ', 'g') . "/./" . substitute(basenm, ' ', '\\ ', 'g') . ".tex 2> /dev/null >/dev/null &")
     elseif g:rplugin_pdfviewer == "evince"
-        if has("nvim")
-            call jobstart("RnwSyncFor", "python", [g:rplugin_home . "/r-plugin/synctex_evince_forward.py",  basenm . ".pdf", string(texln), basenm . ".tex"])
-            autocmd JobActivity RnwSyncFor call ROnJobActivity()
-        else
-            call system("python " . g:rplugin_home . "/r-plugin/synctex_evince_forward.py '" . basenm . ".pdf' " . texln . " '" . basenm . ".tex' 2> /dev/null >/dev/null &")
-        endif
+        call system("python " . g:rplugin_home . "/r-plugin/synctex_evince_forward.py '" . basenm . ".pdf' " . texln . " '" . basenm . ".tex' 2> /dev/null >/dev/null &")
         if g:rplugin_has_wmctrl
             call system("wmctrl -a '" . basenm . ".pdf'")
         endif
@@ -572,7 +567,8 @@ function! SyncTeX_forward(...)
         endif
     elseif g:rplugin_pdfviewer == "skim"
         " This command is based on Skim wiki (not tested)
-        call system("/Applications/Skim.app/Contents/SharedSupport/displayline " . texln . " '" . basenm . ".pdf' 2> /dev/null >/dev/null &")
+        call system("/Applications/Skim.app/Contents/SharedSupport/displayline " . texln . " '" . basenm . ".pdf' '" . basenm . ".tex' 2> /dev/null >/dev/null &")
+        " Now, add the command to raise Skim window (AppleScript)?
     else
         call RWarningMsg('SyncTeX support for "' . g:rplugin_pdfviewer . '" not implemented.')
     endif
@@ -599,23 +595,12 @@ function! Run_SyncTeX()
         if basedir != '.'
             exe "cd " . substitute(basedir, ' ', '\\ ', 'g')
         endif
-        if has("nvim")
-            call jobstart("RnwSyncTeX", "python", [g:rplugin_home . "/r-plugin/synctex_evince_backward.py", basenm . ".pdf", "nvim"])
-            autocmd JobActivity RnwSyncTeX call ROnJobActivity()
-        else
-            if v:servername != ""
-                call system("python " . g:rplugin_home . "/r-plugin/synctex_evince_backward.py '" . basenm . ".pdf' " . v:servername . " &")
-            endif
+        if v:servername != ""
+            call system("python " . g:rplugin_home . "/r-plugin/synctex_evince_backward.py '" . basenm . ".pdf' " . v:servername . " &")
         endif
         if basedir != '.'
             cd -
         endif
-    elseif has("nvim") && (g:rplugin_pdfviewer == "okular" || g:rplugin_pdfviewer == "zathura") && !exists("g:rplugin_tail_follow")
-        let g:rplugin_tail_follow = 1
-        call writefile([], g:rplugin_tmpdir . "/" . g:rplugin_pdfviewer . "_search")
-        call jobstart("RnwSyncTeX", "tail", ["-f", g:rplugin_tmpdir . "/" . g:rplugin_pdfviewer . "_search"])
-        autocmd JobActivity RnwSyncTeX call ROnJobActivity()
-        autocmd VimLeave * call delete(g:rplugin_tmpdir . "/" . g:rplugin_pdfviewer . "_search") | call delete(g:rplugin_tmpdir . "/synctex_back.sh")
     endif
     exe "cd " . substitute(olddir, ' ', '\\ ', 'g')
 endfunction
diff --git a/ftplugin/rrst_rplugin.vim b/ftplugin/rrst_rplugin.vim
index 854e71c..1bdd07b 100644
--- a/ftplugin/rrst_rplugin.vim
+++ b/ftplugin/rrst_rplugin.vim
@@ -1,5 +1,5 @@
 
-if exists("g:disable_r_ftplugin")
+if exists("g:disable_r_ftplugin") || has("nvim")
     finish
 endif
 
diff --git a/list_for_vimball b/list_for_vimball
index d86cc42..f1efd96 100644
--- a/list_for_vimball
+++ b/list_for_vimball
@@ -21,7 +21,6 @@ indent/rrst.vim
 r-plugin/common_buffer.vim
 r-plugin/common_global.vim
 r-plugin/global_r_plugin.vim
-r-plugin/objlist/README
 r-plugin/r.snippets
 r-plugin/rmd.snippets
 r-plugin/synctex_evince_backward.py
@@ -29,7 +28,6 @@ r-plugin/synctex_evince_forward.py
 r-plugin/synctex_okular_backward.sh
 r-plugin/functions.vim
 r-plugin/gui_running.vim
-r-plugin/nvimbuffer.vim
 r-plugin/osx.vim
 r-plugin/setcompldir.vim
 r-plugin/windows.py
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 92c0295..42ad553 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -666,7 +666,7 @@ endfunction
 
 
 function StartR_ExternalTerm(rcmd)
-    if $DISPLAY == "" && !has("gui_macvim") && !has("nvim")
+    if $DISPLAY == "" && !has("gui_macvim")
         call RWarningMsg("Start 'tmux' before Vim. The X Window system is required to run R in an external terminal.")
         return
     endif
@@ -739,11 +739,8 @@ endfunction
 function StartR(whatr)
     let g:SendToVimCom = function("SendToVimCom_Vim")
 
-    if has("gui_macvim")
-        let $VIMEDITOR_SVRNM = "MacVim"
-    elseif has("nvim")
-        let $VIMEDITOR_SVRNM = "Neovim_" . g:rplugin_myport
-        let g:SendToVimCom = function("SendToVimCom_Neovim")
+    if has("gui_macvim") && v:servername != ""
+        let $VIMEDITOR_SVRNM = "MacVim_" . v:servername
     elseif !has("clientserver")
         let $VIMEDITOR_SVRNM = "NoClientServer"
     elseif v:servername == ""
@@ -775,11 +772,6 @@ function StartR(whatr)
         endif
     endif
 
-    if g:vimrplugin_r_in_buffer
-        call StartR_Neovim()
-        return
-    endif
-
     if g:vimrplugin_applescript
         call StartR_OSX()
         return
@@ -815,16 +807,12 @@ function StartR(whatr)
                         call g:SendCmdToR("\014")
                     endif
                     call VimExprToOB('ResetVimComPort()')
-                    if !has("nvim")
-                        call g:SendToVimCom("\002" . g:rplugin_obsname)
-                    endif
+                    call g:SendToVimCom("\002" . g:rplugin_obsname)
                     call g:SendToVimCom("\005G .GlobalEnv [Restarting R]")
                     call g:SendToVimCom("\005L Libraries [Restarting()]")
                     " vimcom automatically update the libraries view, but not
                     " the GlobalEnv one because vimcom_count_objects() returns 0.
-                    if !has("nvim")
-                        call VimExprToOB('UpdateOB("GlobalEnv")')
-                    endif
+                    call VimExprToOB('UpdateOB("GlobalEnv")')
                 endif
                 return
             elseif IsSendCmdToRFake()
@@ -853,11 +841,7 @@ function StartR(whatr)
         call StartR_ExternalTerm(rcmd)
         if g:vimrplugin_restart && bufloaded(b:objbrtitle)
             call WaitVimComStart()
-            if has("nvim")
-                call g:SendToVimCom("\002" . g:rplugin_myport)
-            else
-                call g:SendToVimCom("\002" . v:servername)
-            endif
+            call g:SendToVimCom("\002" . v:servername)
             call g:SendToVimCom("\005G .GlobalEnv [Restarting R]")
             call g:SendToVimCom("\005L Libraries [Restarting()]")
             if exists("*UpdateOB")
@@ -926,40 +910,10 @@ function WaitVimComStart()
         let g:rplugin_vimcom_home = vr[1]
         let g:rplugin_vimcomport = vr[2]
         let g:rplugin_r_pid = vr[3]
-        if g:rplugin_vimcom_version != "1.1.15"
-            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.1.15.')
+        if g:rplugin_vimcom_version != "1.1.16"
+            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.1.16.')
             sleep 1
         endif
-        if has("nvim")
-            if g:rplugin_clt_job
-                call jobstop(g:rplugin_clt_job)
-                let g:rplugin_clt_job = 0
-            endif
-            if has("win64")
-                let nvc = g:rplugin_vimcom_home . "/bin/x64/nvimclient.exe"
-                let nvs = g:rplugin_vimcom_home . "/bin/x64/nvimserver.exe"
-            elseif has("win32")
-                let nvc = g:rplugin_vimcom_home . "/bin/i386/nvimclient.exe"
-                let nvs = g:rplugin_vimcom_home . "/bin/i386/nvimserver.exe"
-            else
-                let nvc = g:rplugin_vimcom_home . "/bin/nvimclient"
-                let nvs = g:rplugin_vimcom_home . "/bin/nvimserver"
-            endif
-            if filereadable(nvc)
-                let g:rplugin_clt_job = jobstart('vimcom', nvc, [g:rplugin_vimcomport])
-                autocmd JobActivity vimcom call ROnJobActivity()
-            else
-                call RWarningMsg('Application "' . nvc . '" not found.")
-            endif
-            if filereadable(nvs)
-                if !exists("g:rplugin_srv_job")
-                    let g:rplugin_srv_job = jobstart('udpsvr', nvs)
-                    autocmd JobActivity udpsvr call ROnJobActivity()
-                endif
-            else
-                call RWarningMsg('Application "' . nvs . '" not found.')
-            endif
-        endif
         if has("win32")
             let g:rplugin_vimcom_lib = g:rplugin_vimcom_home . "/bin/i386/libVimR.dll"
         elseif has("win64")
@@ -972,7 +926,7 @@ function WaitVimComStart()
         endif
         call delete(g:rplugin_tmpdir . "/vimcom_running_" . $VIMINSTANCEID)
 
-        if !has("nvim") && !has("libcall")
+        if !has("libcall")
             call RWarningMsgInp("+libcall feature is missing: communication with R will be flawed.")
         endif
 
@@ -1010,13 +964,7 @@ function StartObjBrowser_Tmux()
         return
     endif
 
-    if has("nvim")
-        let g:RBrOpenCloseLs = function("RBrOpenCloseLs_TmuxNeovim")
-        " Force Neovim to update the window size
-        mode
-    else
-        let g:RBrOpenCloseLs = function("RBrOpenCloseLs_TmuxVim")
-    endif
+    let g:RBrOpenCloseLs = function("RBrOpenCloseLs_TmuxVim")
 
     call g:SendToVimCom("\005G GlobalEnv [OB StartObjBrowser_Tmux]")
     sleep 50m
@@ -1025,26 +973,16 @@ function StartObjBrowser_Tmux()
 
     " Don't start the Object Browser if it already exists
     if IsExternalOBRunning()
-        if !has("nvim") && (has("gui_macvim") || $DISPLAY == "") && exists("g:rplugin_ob_pane")
-            let slog = system("tmux set-buffer ':silent call UpdateOB(\"both\")\:\' && tmux paste-buffer -t " . g:rplugin_ob_pane . " && tmux select-pane -t " . g:rplugin_ob_pane)
-            if v:shell_error
-                call RWarningMsg(slog)
-            endif
-        endif
         return
     endif
 
     let objbrowserfile = g:rplugin_tmpdir . "/objbrowserInit"
     let tmxs = " "
 
-    if has("nvim")
-        let myservername = g:rplugin_myport
+    if v:servername == ""
+        let myservername = '""'
     else
-        if v:servername == ""
-            let myservername = '""'
-        else
-            let myservername = '"' . v:servername . '"'
-        endif
+        let myservername = '"' . v:servername . '"'
     endif
 
     call writefile([
@@ -1066,20 +1004,13 @@ function StartObjBrowser_Tmux()
                 \ 'set noruler',
                 \ 'let g:SendCmdToR = function("SendCmdToR_TmuxSplit")',
                 \ 'let g:RBrOpenCloseLs = function("RBrOpenCloseLs_TmuxOB")',
-                \ 'if has("nvim")',
-                \ '    let g:SendToVimCom = function("SendToVimCom_Neovim")',
-                \ '    let g:rplugin_clt_job = jobstart("vimcom", "' . g:rplugin_vimcom_home . "/bin/nvimclient" . '", ["' . g:rplugin_vimcomport . '"])',
-                \ '    let g:rplugin_srv_job = jobstart("udpsvr", "' . g:rplugin_vimcom_home . "/bin/nvimserver" . '")',
-                \ '    autocmd JobActivity udpsvr call ROnJobActivity()',
-                \ 'else',
-                \ '    let g:SendToVimCom = function("SendToVimCom_Vim")',
-                \ '    if has("clientserver") && v:servername != ""',
-                \ '        let g:rplugin_vimcomport = ' . g:rplugin_vimcomport,
-                \ '        call g:SendToVimCom("\002" . v:servername)',
-                \ '    endif',
-                \ '    sleep 150m',
-                \ '    call UpdateOB("GlobalEnv")',
-                \ 'endif'], objbrowserfile)
+                \ 'let g:SendToVimCom = function("SendToVimCom_Vim")',
+                \ 'if has("clientserver") && v:servername != ""',
+                \ '    let g:rplugin_vimcomport = ' . g:rplugin_vimcomport,
+                \ '    call g:SendToVimCom("\002" . v:servername)',
+                \ 'endif',
+                \ 'sleep 150m',
+                \ 'call UpdateOB("GlobalEnv")', ], objbrowserfile)
 
     if g:vimrplugin_objbr_place =~ "left"
         let panw = system("tmux list-panes | cat")
@@ -1111,12 +1042,7 @@ function StartObjBrowser_Tmux()
         let obsname = " "
     endif
 
-    if has("nvim")
-        let vimname = "nvim"
-    else
-        let vimname = "vim"
-    endif
-    let cmd = "tmux split-window -h -l " . panewidth . " -t " . obpane . ' "' . vimname . ' ' . obsname . " -c 'source " . substitute(objbrowserfile, ' ', '\\ ', 'g') . "'" . '"'
+    let cmd = "tmux split-window -h -l " . panewidth . " -t " . obpane . ' "vim ' . obsname . " -c 'source " . substitute(objbrowserfile, ' ', '\\ ', 'g') . "'" . '"'
     let rlog = system(cmd)
     if v:shell_error
         let rlog = substitute(rlog, '\n', ' ', 'g')
@@ -1141,21 +1067,17 @@ function StartObjBrowser_Tmux()
         endif
     endif
     if g:rplugin_ob_warn_shown == 0
-        if !has("clientserver") && !has("nvim")
+        if !has("clientserver")
             call RWarningMsg("The +clientserver feature is required to automatically update the Object Browser.")
             sleep 200m
         else
-            if $DISPLAY == "" && !has("nvim")
+            if $DISPLAY == ""
                 call RWarningMsg("The X Window system is required to automatically update the Object Browser.")
                 sleep 200m
             endif
         endif
         let g:rplugin_ob_warn_shown = 1
     endif
-    if has("nvim")
-        " Force Neovim to update the window size
-        mode
-    endif
     return
 endfunction
 
@@ -1172,7 +1094,7 @@ function StartObjBrowser_Vim()
     endif
 
     let wmsg = ""
-    if v:servername == "" && !has("nvim")
+    if v:servername == ""
         if g:rplugin_ob_warn_shown == 0
             if !has("clientserver")
                 let wmsg = "The +clientserver feature is required to automatically update the Object Browser."
@@ -1189,8 +1111,6 @@ function StartObjBrowser_Vim()
         if has("gui_macvim")
             let wmsg ="MacVim cannot automatically updated the Object Browser."
             let g:rplugin_ob_warn_shown = 1
-        elseif has("nvim")
-            call g:SendToVimCom("\002" . g:rplugin_myport)
         else
             call g:SendToVimCom("\002" . v:servername)
         endif
@@ -1266,7 +1186,7 @@ function RObjBrowser()
 endfunction
 
 function VimExprToOB(msg)
-    if !has("nvim") && serverlist() =~ "\\<" . g:rplugin_obsname . "\n"
+    if serverlist() =~ "\\<" . g:rplugin_obsname . "\n"
         return remote_expr(g:rplugin_obsname, a:msg)
     else
         if IsExternalOBRunning()
@@ -1363,7 +1283,7 @@ function RBrOpenCloseLs_TmuxOB(status)
         return
     endif
     call g:SendToVimCom("\007" . a:status)
-    if !has("nvim") && v:servername == ""
+    if v:servername == ""
         call UpdateOB("both")
     endif
 endfunction
@@ -1939,15 +1859,7 @@ function RClearConsole()
             call RWarningMsg(repl)
         endif
     else
-        if g:vimrplugin_r_in_buffer
-            let edbuf = bufname("%")
-            sbuffer R_Output
-            call cursor("$", 1)
-            normal! zt
-            exe "sbuffer " . edbuf
-        else
-            call g:SendCmdToR("\014")
-        endif
+        call g:SendCmdToR("\014")
     endif
 endfunction
 
@@ -2038,18 +1950,7 @@ function RQuit(how)
 
     sleep 50m
     call CloseExternalOB()
-
     call ClearRInfo()
-
-    if has("nvim")
-        if g:rplugin_do_tmux_split
-            " Force Neovim to update the window size
-            sleep 500m
-            mode
-        elseif g:vimrplugin_r_in_buffer
-            bunload R_Output
-        endif
-    endif
 endfunction
 
 " knit the current buffer content
@@ -2244,30 +2145,16 @@ function ShowRDoc(rkeyword)
     let rkeyw = a:rkeyword
     if a:rkeyword =~ "^MULTILIB"
         let msgs = split(a:rkeyword)
-        if has("nvim")
-            let msg = "The topic '" . msgs[-1] . "' was found in more than one library:\n"
-            for idx in range(1, len(msgs) - 2)
-                let msg .= idx . " : " . msgs[idx] . "\n"
-            endfor
-            redraw
-            let chn = input(msg . "Please, select one of them: ")
-            if chn > 0 && chn < (len(msgs) - 1)
-                call delete(g:rplugin_tmpdir . "/eval_reply")
-                call g:SendToVimCom("\x08" . $VIMINSTANCEID . 'vimcom:::vim.help("' . msgs[-1] . '", ' . g:rplugin_htw . 'L, package="' . msgs[chn] . '")')
-            endif
-            return
-        else
-            " Vim cannot receive message from vimcom before replying to this message
-            let flines = ['',
-                        \ 'The topic "' . msgs[-1] . '" was found in more than one library.',
-                        \ 'Press  over one of them to see the R documentation:',
-                        \ '']
-            for idx in range(1, len(msgs) - 2)
-                let flines += [ '   ' . msgs[idx] ]
-            endfor
-            call writefile(flines, g:rplugin_docfile)
-            let rkeyw = msgs[-1]
-        endif
+        " Vim cannot receive message from vimcom before replying to this message
+        let flines = ['',
+                    \ 'The topic "' . msgs[-1] . '" was found in more than one library.',
+                    \ 'Press  over one of them to see the R documentation:',
+                    \ '']
+        for idx in range(1, len(msgs) - 2)
+            let flines += [ '   ' . msgs[idx] ]
+        endfor
+        call writefile(flines, g:rplugin_docfile)
+        let rkeyw = msgs[-1]
     endif
 
     if bufname("%") =~ "Object_Browser" || bufname("%") == "R_Output"
@@ -2422,13 +2309,7 @@ function RSetPDFViewer()
 endfunction
 
 function RStart_Zathura(basenm)
-    if has("nvim")
-        let shcode = ['#!/bin/sh', 'echo "call SyncTeX_backward(' . "'$1'" . ', $2)" >> "' . g:rplugin_tmpdir . '/zathura_search"']
-        call writefile(shcode, g:rplugin_tmpdir . "/synctex_back.sh")
-        let a2 = "a2 = 'sh " . g:rplugin_tmpdir . "/synctex_back.sh %{input} %{line}'"
-    else
-        let a2 = 'a2 = "vim --servername ' . v:servername . " --remote-expr \\\"SyncTeX_backward('%{input}',%{line})\\\"" . '"'
-    endif
+    let a2 = 'a2 = "vim --servername ' . v:servername . " --remote-expr \\\"SyncTeX_backward('%{input}',%{line})\\\"" . '"'
     let pycode = ["import subprocess",
                 \ "import os",
                 \ "import sys",
@@ -2553,7 +2434,7 @@ function RAction(rcmd)
                         if g:rplugin_vim_pane == "none"
                             call RWarningMsg("Cmd not available.")
                         else
-                            if g:rplugin_editor_sname == "" || has("nvim")
+                            if g:rplugin_editor_sname == ""
                                 let slog = system("tmux set-buffer '" . "\\" . ':call AskRDoc("' . rkeyword . '", "' . pkg . '", 0)' . "\' && tmux paste-buffer -t " . g:rplugin_vim_pane . " && tmux select-pane -t " . g:rplugin_vim_pane)
                                 if v:shell_error
                                     call RWarningMsg(slog)
@@ -3071,11 +2952,6 @@ call RSetDefaultValue("g:vimrplugin_help_w",           46)
 call RSetDefaultValue("g:vimrplugin_objbr_w",          40)
 call RSetDefaultValue("g:vimrplugin_libcall_send",      1)
 call RSetDefaultValue("g:vimrplugin_i386",              0)
-if has("nvim")
-    call RSetDefaultValue("g:vimrplugin_r_in_buffer",   0)
-else
-    let g:vimrplugin_r_in_buffer = 0
-endif
 call RSetDefaultValue("g:vimrplugin_vimcom_wait",    5000)
 call RSetDefaultValue("g:vimrplugin_show_args",         0)
 call RSetDefaultValue("g:vimrplugin_never_unmake_menu", 0)
@@ -3083,15 +2959,7 @@ call RSetDefaultValue("g:vimrplugin_insert_mode_cmds",  1)
 call RSetDefaultValue("g:vimrplugin_indent_commented",  1)
 call RSetDefaultValue("g:vimrplugin_source",         "''")
 call RSetDefaultValue("g:vimrplugin_rcomment_string", "'# '")
-if g:vimrplugin_r_in_buffer
-    let g:rplugin_rhistory = [ ]
-    let g:rplugin_rhist_pos = -1
-    let g:rplugin_addedtohist = 0
-    call RSetDefaultValue("g:vimrplugin_vimpager", "'vertical'")
-    autocmd JobActivity Rjob call GetRActivity()
-else
-    call RSetDefaultValue("g:vimrplugin_vimpager",      "'tab'")
-endif
+call RSetDefaultValue("g:vimrplugin_vimpager",      "'tab'")
 call RSetDefaultValue("g:vimrplugin_objbr_place",     "'script,right'")
 call RSetDefaultValue("g:vimrplugin_user_maps_only", 0)
 call RSetDefaultValue("g:vimrplugin_latexcmd", "'default'")
@@ -3190,18 +3058,11 @@ endif
 
 if has("gui_running") || has("win32") || g:vimrplugin_applescript
     let g:vimrplugin_tmux_ob = 0
-    if !g:vimrplugin_r_in_buffer
-        if g:vimrplugin_objbr_place =~ "console"
-            let g:vimrplugin_objbr_place = substitute(g:vimrplugin_objbr_place, "console", "script", "")
-        endif
+    if g:vimrplugin_objbr_place =~ "console"
+        let g:vimrplugin_objbr_place = substitute(g:vimrplugin_objbr_place, "console", "script", "")
     endif
 endif
 
-if g:vimrplugin_r_in_buffer
-    let g:vimrplugin_tmux_ob = 0
-    let g:rplugin_do_tmux_split = 0
-endif
-
 if $TMUX == ""
     let g:rplugin_do_tmux_split = 0
     call RSetDefaultValue("g:vimrplugin_tmux_ob", 0)
@@ -3210,7 +3071,7 @@ else
     let g:vimrplugin_applescript = 0
     call RSetDefaultValue("g:vimrplugin_tmux_ob", 1)
 endif
-if g:vimrplugin_objbr_place =~ "console" && !g:vimrplugin_r_in_buffer
+if g:vimrplugin_objbr_place =~ "console"
     let g:vimrplugin_tmux_ob = 1
 endif
 
@@ -3218,7 +3079,7 @@ endif
 " ========================================================================
 
 " Check whether Tmux is OK
-if !has("win32") && !has("win64") && !has("gui_win32") && !has("gui_win64") && !g:vimrplugin_applescript && !g:vimrplugin_r_in_buffer
+if !has("win32") && !has("win64") && !has("gui_win32") && !has("gui_win64") && !g:vimrplugin_applescript
     if !executable('tmux') && g:vimrplugin_source !~ "screenR"
         call RWarningMsgInp("Please, install the 'Tmux' application to enable the Vim-R-plugin.")
         let g:rplugin_failed = 1
@@ -3268,7 +3129,7 @@ if exists("g:vimrplugin_term")
         let g:vimrplugin_term = "xterm"
     endif
 endif
-if has("win32") || has("win64") || g:vimrplugin_applescript || g:rplugin_do_tmux_split || g:vimrplugin_r_in_buffer
+if has("win32") || has("win64") || g:vimrplugin_applescript || g:rplugin_do_tmux_split
     " No external terminal emulator will be called, so any value is good
     let g:vimrplugin_term = "xterm"
 endif
@@ -3444,9 +3305,6 @@ endif
 if g:vimrplugin_applescript
     runtime r-plugin/osx.vim
 endif
-if has("nvim")
-    runtime r-plugin/nvimbuffer.vim
-endif
 
 if exists("g:vimrplugin_permanent_libs")
     call RWarningMsgInp("The option 'vimrplugin_permanent_libs' was renamed to 'vimrplugin_start_libs'. Please, rename it in your vimrc too.")
diff --git a/r-plugin/functions.vim b/r-plugin/functions.vim
index a6b50a0..f41a4ff 100644
--- a/r-plugin/functions.vim
+++ b/r-plugin/functions.vim
@@ -1,3 +1,7 @@
+if has("nvim")
+    " See https://github.com/jalvesaq/Nvim-R
+    finish
+endif
 
 " Only source this once
 if exists("*RmFromRLibList")
diff --git a/r-plugin/nvimbuffer.vim b/r-plugin/nvimbuffer.vim
deleted file mode 100644
index 84b0322..0000000
--- a/r-plugin/nvimbuffer.vim
+++ /dev/null
@@ -1,270 +0,0 @@
-" This file contains code used only by Neovim
-
-" For debugging
-let g:lastjobdata = []
-
-function GetRActivity()
-    if v:job_data[1] == 'stdout' || v:job_data[1] == 'stderr'
-        let g:lastjobdata += [v:job_data[2]]
-        let edbuf = bufname("%")
-        if edbuf == "R_Output"
-            let isrout = 1
-        else
-            let isrout = 0
-            sbuffer R_Output
-        endif
-
-        " Newline at the beginning disappears after split(). Put it now:
-        if v:job_data[2] =~ "^\x0a"
-            call append("$", "")
-            let g:rplugin_last_r_prompt = ""
-        endif
-
-        " Fix DOS end of line
-        let outstr = substitute(v:job_data[2], "\x0d\x0a", "\x0a", "g")
-
-        let outlst = split(outstr, '\n')
-
-        let lastline = len(outlst) - 1
-        " Newline at the end disappears after split()
-        if v:job_data[2] =~ '\n$'
-            let g:rplugin_last_r_prompt = ""
-            let hasnl = 1
-        else
-            let g:rplugin_last_r_prompt = substitute(outlst[-1], ' *$', '', '')
-            let hasnl = 0
-        endif
-
-        for idx in range(len(outlst))
-            let lin = outlst[idx]
-            " Do carriage return
-            if lin =~ "\x0d"
-                let lin = substitute(lin, ".*\x0d", "", "g")
-                call setline("$", "")
-            endif
-
-            " Prefix ': '  for syntax highlight
-            if v:job_data[1] == 'stderr'
-                let lin = ': ' . lin
-            endif
-
-            " Append characters to current last line
-            call setline("$", getline("$") . lin)
-
-            " Add new line
-            if idx != lastline
-                call append("$", "")
-            endif
-        endfor
-
-        " Add final newline
-        if hasnl
-            call append("$", "")
-        endif
-
-        call cursor("$", 999)
-        if !isrout
-            exe "sbuffer " . edbuf
-        endif
-    else
-        let g:rplugin_rjob = 0
-        let g:rplugin_r_pid = 0
-        let g:SendCmdToR = function('SendCmdToR_fake')
-        if bufname("%") == "R_Output"
-            call append("$", ':    ---  R Finished  ---')
-            call append("$", "")
-            sleep 500m
-            quit
-        endif
-        if mode() == "n"
-            call RWarningMsg("R finished")
-        endif
-    endif
-endfunction
-
-function CompleteFromHistory()
-    if line(".") != line("$")
-        return
-    endif
-
-    let key = substitute(getline("."), '^>', '', '')
-    let key = substitute(key, '^ ', '', '')
-    let key = substitute(key, '^\s*\(.*\)\s*', '\1', '')
-    let histlin = [key]
-    call setline(".", "> ")
-    for lin in g:rplugin_rhistory
-        if lin =~ key
-            let histlin += [lin]
-        endif
-    endfor
-    call complete(3, histlin)
-    return ''
-endfunction
-
-function ShowRhistory()
-    tabnew R_history
-    call setline(".", g:rplugin_rhistory)
-    set ft=r
-endfunction
-
-function AddToRHistory(rcmd)
-    let g:rplugin_rhist_pos += 1
-    let g:rplugin_dyn_rhist_pos = g:rplugin_rhist_pos
-    let g:rplugin_rhistory += [a:rcmd]
-endfunction
-
-function SendCmdToR_Neovim(...)
-    let curbuf = bufname("%")
-    sbuffer R_Output
-    if winwidth(0) != b:winwidth
-        let b:winwidth = winwidth(0)
-        call g:SendToVimCom("\x08" . $VIMINSTANCEID . "options(width=" . b:winwidth . ")", "I")
-    endif
-    if a:0 == 1
-        call setline("$", getline("$") . a:1)
-    endif
-    call append("$", "")
-    call cursor("$", 1)
-    let g:rplugin_addedtohist = 0
-    if a:1 !~ '^base::source('
-        call AddToRHistory(a:1)
-    endif
-    exe "sbuffer " . curbuf
-    let ok = jobsend(g:rplugin_rjob, a:1 . "\n")
-    return ok
-endfunction
-
-function RConsoleArrow(dir)
-    if line(".") != line("$")
-        return
-    endif
-
-    " Check if current last typed line of R_Output is already in history
-    if g:rplugin_addedtohist == 0
-        let lin = substitute(getline("."), '^>', '', '')
-        let lin = substitute(lin, '^ ', '', '')
-        call AddToRHistory(lin)
-        let g:rplugin_addedtohist = 1
-    endif
-
-    if a:dir == "down"
-        let g:rplugin_dyn_rhist_pos += 1
-        if g:rplugin_dyn_rhist_pos > g:rplugin_rhist_pos
-            let g:rplugin_dyn_rhist_pos -= 1
-            return
-        endif
-    else
-        let g:rplugin_dyn_rhist_pos -= 1
-        if g:rplugin_dyn_rhist_pos < 0
-            let g:rplugin_dyn_rhist_pos = 0
-            return
-        endif
-    endif
-    call setline(".", "> " . g:rplugin_rhistory[g:rplugin_dyn_rhist_pos])
-endfunction
-
-function EnterRCmd()
-    if line(".") != line("$")
-        call append(".", "")
-        call cursor(line(".")+1, 1)
-        return
-    endif
-    " First delete the last received prompt:
-    let lin = substitute(getline("."), '^' . g:rplugin_last_r_prompt, '', '')
-    " Now delete one space in the beginning, if there is any:
-    let lin = substitute(lin, '^ ', '', '')
-    call SendCmdToR_Neovim(lin, 0)
-endfunction
-
-function RSetNeovimPort(p)
-    let g:rplugin_myport = a:p
-    if &filetype == "rbrowser" && g:rplugin_do_tmux_split
-        call g:SendToVimCom("\002" . a:p)
-    else
-        call g:SendToVimCom("\001" . a:p)
-    endif
-endfunction
-
-function StartR_Neovim()
-    if string(g:SendCmdToR) != "function('SendCmdToR_fake')"
-        return
-    endif
-    let g:rplugin_do_tmux_split = 0
-
-    let g:SendCmdToR = function('SendCmdToR_Neovim')
-
-    let edbuf = bufname("%")
-    let g:tmp_objbrtitle = b:objbrtitle
-    let g:tmp_curbufname = bufname("%")
-    set switchbuf=useopen
-    if g:vimrplugin_vsplit
-        if g:vimrplugin_rconsole_width > 16 && g:vimrplugin_rconsole_width < (winwidth(0) - 16)
-            silent exe "belowright " . g:vimrplugin_rconsole_width . "vsplit R_Output"
-        else
-            silent belowright vsplit R_Output
-        endif
-    else
-        if g:vimrplugin_rconsole_height > 6 && g:vimrplugin_rconsole_height < (winheight(0) - 6)
-            silent exe "belowright " . g:vimrplugin_rconsole_height . "split R_Output"
-        else
-            silent belowright split R_Output
-        endif
-    endif
-    let b:winwidth = 0
-    set filetype=rout
-    setlocal noswapfile
-    setlocal bufhidden=hide
-    setlocal formatoptions=
-    set buftype=nofile
-    set omnifunc=rcomplete#CompleteR
-    if hasmapto("RCompleteArgs", "i")
-        imap  RCompleteArgs =RCompleteArgs()
-    else
-        imap   =RCompleteArgs()
-    endif
-    let b:objbrtitle = g:tmp_objbrtitle
-    let b:rscript_buffer = g:tmp_curbufname
-    unlet g:tmp_objbrtitle
-    unlet g:tmp_curbufname
-    imap   :call EnterRCmd()A
-    imap   :RStopa
-    imap   :call RConsoleArrow("up")A
-    imap   :call RConsoleArrow("down")A
-    imap   =CompleteFromHistory()
-    call cursor("$", 1)
-    exe "sbuffer " . edbuf
-
-    nmap  :call OpenRScratch()
-
-    let savedterm = $TERM
-    let $TERM="NeovimTerm"
-    let g:rplugin_rjob = jobstart("Rjob", 'R', ['--no-readline', '--interactive'], 'su')
-    exe 'let $TERM="' . savedterm . '"'
-    call WaitVimComStart()
-endfunction
-
-function SendToVimCom_Neovim(...)
-    if g:rplugin_clt_job == 0
-        call RWarningMsg("VimCom client not running.")
-        return
-    endif
-    call jobsend(g:rplugin_clt_job, a:1 . "\n")
-endfunction
-
-function RBrOpenCloseLs_TmuxNeovim(status)
-    " TODO: Discover real value of curview
-    let curview = "GlobalEnv"
-
-    if a:status == 1 && curview == "libraries"
-        if curview == "libraries"
-            echohl WarningMsg
-            echon "GlobalEnv command only."
-            sleep 1
-            echohl Normal
-            normal! :
-            return
-        endif
-    endif
-    call g:SendToVimCom("\007" . a:status)
-endfunction
-
diff --git a/r-plugin/windows.vim b/r-plugin/windows.vim
index c66f46e..eb5ab61 100644
--- a/r-plugin/windows.vim
+++ b/r-plugin/windows.vim
@@ -111,9 +111,6 @@ function InitializePython()
     elseif has("python")
         command! -nargs=+ Py :py 
         command! -nargs=+ PyFile :pyfile 
-    elseif has("nvim")
-        command! -nargs=+ Py :call RWarningMsg("Py command not implemented yet: '" .  . "'")
-        let g:SendToVimCom = function("SendToVimCom_Neovim")
     else
         command! -nargs=+ Py :
         command! -nargs=+ PyFile :

From e4d23710070ef009871a263e43a071382e8bf77c Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Fri, 26 Dec 2014 20:54:53 -0500
Subject: [PATCH 0900/1050] Try to find MacVim binary

---
 r-plugin/common_global.vim | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 42ad553..f8411bf 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -741,6 +741,15 @@ function StartR(whatr)
 
     if has("gui_macvim") && v:servername != ""
         let $VIMEDITOR_SVRNM = "MacVim_" . v:servername
+        let $VIM_BINARY_PATH = "mvim"
+        " Try to find Vim binary (code adapted from mvim script):
+        for du in [ '~/Applications', '~/Applications/vim', '/Applications', '/Applications/vim', '/Applications/Utilities', '/Applications/Utilities/vim' ]
+            let de = expand(du)
+            if isdirectory(de . "/MacVim.app")
+                let $VIM_BINARY_PATH = de . "/MacVim.app/Contents/MacOS/Vim"
+                break
+            endif
+        endfor
     elseif !has("clientserver")
         let $VIMEDITOR_SVRNM = "NoClientServer"
     elseif v:servername == ""

From 5064e81c48ed6321a304fb603a09aed08777626b Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Wed, 31 Dec 2014 15:00:12 -0500
Subject: [PATCH 0901/1050] Always runtime the correct functions.vim Run the
 `runtime` command with the correct functions.vim for either Vim or Neovim
 because the runtime files distributed with the official Vim must be exactly
 the same for Vim and Neovim.

---
 syntax/r.vim | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/syntax/r.vim b/syntax/r.vim
index 82ea7be..9677823 100644
--- a/syntax/r.vim
+++ b/syntax/r.vim
@@ -3,12 +3,11 @@
 " Maintainer:	      Jakson Aquino 
 " Former Maintainers: Vaidotas Zemlys 
 " 		      Tom Payne 
-" Last Change:	      Tue Dec 16, 2014  02:14PM
+" Last Change:	      Wed Dec 31, 2014  12:36AM
 " Filenames:	      *.R *.r *.Rhistory *.Rt
 "
-" NOTE: The highlighting of R functions is defined in the
-" r-plugin/functions.vim, which is part of Vim-R-plugin:
-" http://www.vim.org/scripts/script.php?script_id=2628
+" NOTE: The highlighting of R functions is defined in
+" runtime files created by a filetype plugin, if installed.
 "
 " CONFIGURATION:
 "   syntax folding can be turned on by
@@ -153,9 +152,14 @@ syn match rBraceError "[)}]" contained
 syn match rCurlyError "[)\]]" contained
 syn match rParenError "[\]}]" contained
 
-" Source list of R functions. The list is produced by the Vim-R-plugin
-" http://www.vim.org/scripts/script.php?script_id=2628
-runtime r-plugin/functions.vim
+" Source list of R functions produced by a filetype plugin (if installed)
+if has("nvim")
+  " Nvim-R
+  runtime R/functions.vim
+else
+  " Vim-R-plugin
+  runtime r-plugin/functions.vim
+endif
 
 syn match rDollar display contained "\$"
 syn match rDollar display contained "@"

From cfb2d0bb3281c4b4f057e787100405b28b345cf7 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Wed, 31 Dec 2014 15:08:47 -0500
Subject: [PATCH 0902/1050] Minor changes - Update documentation. - Use only
 ascii characters in syntax/rdoc.vim. - Rename vimrplugin_routmorecolors. -
 Use `uname` to check if the system is Darwin. - Use skim as default pdf
 viewer in Darwin systems.

---
 doc/r-plugin.txt            | 88 ++++++++++++++++++-------------------
 ftplugin/rnoweb_rplugin.vim |  5 +--
 r-plugin/common_global.vim  | 44 ++++++-------------
 r-plugin/functions.vim      |  2 +-
 r-plugin/gui_running.vim    |  2 +-
 r-plugin/osx.vim            |  4 ++
 syntax/rbrowser.vim         |  2 +-
 syntax/rdoc.vim             |  4 +-
 syntax/rout.vim             |  8 ++--
 9 files changed, 71 insertions(+), 88 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 65e459d..7ac9680 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -116,7 +116,7 @@ Before installing the plugin, you should install its dependencies:
 
    Depends:~
 
-   Vim >= 7.4: http://www.vim.org/download.php
+   Vim, GVim or MacVim >= 7.4: http://www.vim.org/download.php
 
        Note: The Vim-R-plugin requires Vim compiled with |+libcall|,
 	    |+clientserver| and |+conceal| features. In Normal mode, do
@@ -1194,7 +1194,6 @@ is running:
 |vimrplugin_r_path|            Directory where R is
 |vimrplugin_r_args|            Arguments to pass to R
 |vimrplugin_start_libs|        Objects for omnicompletion and syntax highlight
-|vimrplugin_routmorecolors|    More syntax highlighting in R output
 |vimrplugin_routnotab|         Show output of R CMD BATCH in new window
 |vimrplugin_indent_commented|  Indent lines commented with the \xx command
 |vimrplugin_notmuxconf|        Don't use a specially built Tmux config file
@@ -1460,23 +1459,9 @@ You may also want to define the value of vimrplugin_start_libs if you are
 running Vim without the |clientserver| feature.
 
 
-------------------------------------------------------------------------------
-						   *vimrplugin_routmorecolors*
-6.10. More colorful syntax highlight of .Rout files~
-
-By default, the R commands in .Rout files are highlighted with the color of
-comments, and only the output of commands has some of its elements highlighted
-(numbers, strings, index of vectors, warnings and errors).
-
-If you prefer that R commands in the R output are highlighted as they are in R
-scripts, put the following in your |vimrc|:
->
-   let vimrplugin_routmorecolors = 1
-<
-
 ------------------------------------------------------------------------------
 							*vimrplugin_routnotab*
-6.11. How to automatically open the .Rout file~
+6.10. Options for .Rout file file type~
 
 After the command ao, Vim will save the current buffer if it has
 any pending changes, run `R CMD BATCH --no-restore --no-save` on the current
@@ -1485,11 +1470,20 @@ file is open in a new split window, put in your |vimrc|:
 >
    let vimrplugin_routnotab = 1
 <
+By default, the R commands in .Rout files are highlighted with the color of
+comments, and only the output of commands has some of its elements highlighted
+(numbers, strings, index of vectors, warnings and errors).
+
+If you prefer that R commands in the R output are highlighted as they are in R
+scripts, put the following in your |vimrc|:
+>
+   let Rout_more_colors = 1
+<
 
 ------------------------------------------------------------------------------
 						 *vimrplugin_indent_commented*
                                                  *r_indent_ess_comments*
-6.12. Indent commented lines~
+6.11. Indent commented lines~
 
 You can type xx to comment out a line or selected lines. If the
 line already starts with a comment string, it will be removed. After adding
@@ -1511,7 +1505,7 @@ table below (see |r-plugin-indenting|):
 
 ------------------------------------------------------------------------------
 						       *vimrplugin_notmuxconf*
-6.13. Tmux configuration (Linux/Unix only)~
+6.12. Tmux configuration (Linux/Unix only)~
 
 
 GVim (or Vim running R in an external terminal emulator) runs Tmux with a
@@ -1531,7 +1525,7 @@ file (~/.tmux.conf).
                                                   *vimrplugin_vsplit*
 			                          *vimrplugin_rconsole_width*
                                                   *vimrplugin_tmux_title*
-6.14. Integration with Tmux (Linux/Unix only)~
+6.13. Integration with Tmux (Linux/Unix only)~
 
 These three options are valid only when Vim is started inside a Tmux session.
 In this case, when you type rf, the terminal will be split in two
@@ -1563,7 +1557,7 @@ or let Tmux set the title automatically. Examples:
 
 ------------------------------------------------------------------------------
                                                       *vimrplugin_applescript*
-6.15. Integration with AppleScript (OS X only)~
+6.14. Integration with AppleScript (OS X only)~
 
 In Mac OS X, the plugin will try to send commands to R gui using AppleScript.
 If you prefer either to run R and Vim in the same terminal emulator split in
@@ -1579,7 +1573,7 @@ Otherwise, R will start in an external terminal emulator.
 ------------------------------------------------------------------------------
 						      *vimrplugin_listmethods*
                                                       *vimrplugin_specialplot*
-6.16. Special R functions~
+6.15. Special R functions~
 
 The R function `args()` lists the arguments of a function, but not the arguments
 of its methods. If you want that the plugin calls the function
@@ -1596,7 +1590,7 @@ after rg if you put the following line in your |vimrc|:
 
 ------------------------------------------------------------------------------
 						       *vimrplugin_maxdeparse*
-6.17. maxdeparse~
+6.16. maxdeparse~
 
 You can set the argument maxdeparse to be passed to R's `source()` function.
 Example:
@@ -1607,7 +1601,7 @@ Example:
 ------------------------------------------------------------------------------
 						       *vimrplugin_sweaveargs*
 						       *vimrplugin_latexcmd*
-6.18. LaTeX command~
+6.17. LaTeX command~
 
 On Windows, the vimcom package calls `tools::texi2dvi()` to build the pdf
 from the generated .tex file. On Linux/Unix, by default, it calls
@@ -1626,7 +1620,7 @@ vimrplugin_sweaveargs variable.
 
 ------------------------------------------------------------------------------
 						  *vimrplugin_rmd_environment*
-6.19. Rmd environment~
+6.18. Rmd environment~
 
 When rendering an Rmd file, the code can be evaluated (and saved) in a
 specified environment.  The default value is `.GlobalEnv` which makes the
@@ -1639,7 +1633,7 @@ you can set
 
 ------------------------------------------------------------------------------
 						*vimrplugin_never_unmake_menu*
-6.20. Never unmake the R menu~
+6.19. Never unmake the R menu~
 
 Use this option if you want that the "R" menu item in GVim is not deleted when
 you change from one buffer to another, for example, when going from an .R file
@@ -1655,7 +1649,7 @@ different file type buffers.
 
 ------------------------------------------------------------------------------
 							    *vimrplugin_map_r*
-6.21. Map 'r'~
+6.20. Map 'r'~
 
 If the variable |vimrplugin_map_r| exists, the plugin will map the letter 'r'
 to send lines to R when there are visually selected lines, for compatibility
@@ -1675,7 +1669,7 @@ Emacs:
 
 ------------------------------------------------------------------------------
 							    *vimrplugin_ca_ck*
-6.22. Add ^A^K to the beginning of commands~
+6.21. Add ^A^K to the beginning of commands~
 
 When one types  in the R Console the cursor goes to the beginning of the
 line and when one types  the characters to the right of the cursor are
@@ -1691,7 +1685,7 @@ in your |vimrc|:
 	                                                *vimrplugin_pdfviewer*
                                                         *vimrplugin_openpdf*
                                                         *vimrplugin_openhtml*
-6.23. Open PDF after processing rnoweb, rmd or rrst files~
+6.22. Open PDF after processing rnoweb, rmd or rrst files~
 
 The plugin can automatically open the pdf file generated by pdflatex, after
 either `Sweave()` or `knit()`. This behavior is controlled by the variable
@@ -1729,7 +1723,7 @@ The html file will be automatically opened if you put the following in your
 			                             *vimrplugin_strict_rst*
                                                      *vimrplugin_rst2pdfpath*
 			                             *vimrplugin_rst2pdfargs*
-6.24. Support to RreStructuredText file~
+6.23. Support to RreStructuredText file~
 
 By default, the Vim-R-plugin sends the command `render_rst(strict=TRUE)` to R
 before using R's `knit()` function to convert an Rrst file into an rst one. If
@@ -1745,7 +1739,7 @@ to R function knit2pdf).
 
 ------------------------------------------------------------------------------
 						 *vimrplugin_insert_mode_cmds*
-6.25. Allow R commands in insert mode~
+6.24. Allow R commands in insert mode~
 
 Vim-R commands are designed to work in insert mode as well as normal mode.
 However, depending on your , this can make it very difficult to
@@ -1765,7 +1759,7 @@ See also: |r-plugin-localleader|.
 ------------------------------------------------------------------------------
 							 *vimrplugin_allnames*
 							 *vimrplugin_rmhidden*
-6.26. Show/remove hidden objects~
+6.25. Show/remove hidden objects~
 
 Hidden objects are not included in the list of objects for omni completion. If
 you prefer to include them, put in your |vimrc|:
@@ -1780,7 +1774,7 @@ you prefer to remove only visible objects, put in your |vimrc|:
 
 ------------------------------------------------------------------------------
 							   *vimrplugin_source*
-6.27. Source additional scripts~
+6.26. Source additional scripts~
 
 This variable should contain a comma separated list of Vim scripts to be
 sourced by the Vim-R-plugin. These scripts may provide additional
@@ -1801,7 +1795,7 @@ features:
 
 ------------------------------------------------------------------------------
 							  *vimrplugin_restart*
-6.28. Restart R if it is already running (Linux/Unix only)~
+6.27. Restart R if it is already running (Linux/Unix only)~
 
 When R is already running and you type one of the commands to start R before
 you have done rq, the Vim-R-plugin does one of the following:
@@ -1819,7 +1813,7 @@ do rf, rv or rc, then, put in your
 
 ------------------------------------------------------------------------------
 							*vimrplugin_show_args*
-6.29. Show extra information during omnicompletion~
+6.28. Show extra information during omnicompletion~
 
 If you want that Vim shows a preview window with the function arguments as you
 do omnicompletion, put in your |vimrc|:
@@ -1833,7 +1827,7 @@ will be shown only if "preview" is also included in your 'completeopt'.
 
 ------------------------------------------------------------------------------
 						      *vimrplugin_vimcom_wait*
-6.30. Time to wait for vimcom loading~
+6.29. Time to wait for vimcom loading~
 
 The Vim-R-plugin waits 5000 milliseconds for vimcom package to be loaded
 during R startup. It then checks whether you are using the correct version of
@@ -1847,7 +1841,7 @@ Note: You should have the line  `library(vimcom)`  in your `~/.Rprofile`.
 
 ------------------------------------------------------------------------------
 							   *vimrplugin_vim_wd*
-6.31 Start R in working directory of Vim~
+6.30 Start R in working directory of Vim~
 
 The Vim-R-plugin starts R in the directory where the current buffer is. If you
 want R's working directory to be the same as Vim's working directory, put in
@@ -1860,7 +1854,7 @@ This option is useful only for those who did not enable 'autochdir'.
 
 ------------------------------------------------------------------------------
 						   *vimrplugin_user_maps_only*
-6.32 Only set key bindings that are user specified~
+6.31 Only set key bindings that are user specified~
 
 The Vim-R-plugin sets many default key bindings.  The user can set custom
 key bindings (|r-plugin-key-bindings|).  If you wish the Vim-R-plugin to only
@@ -1872,7 +1866,7 @@ set those key-bindings specified by the user, put in your vimrc:
 ------------------------------------------------------------------------------
 							   *vimrplugin_tmpdir*
 							 *vimrplugin_compldir*
-6.33 Temporary files directories~
+6.32 Temporary files directories~
 
 You can change the directories where temporary files are created and
 stored by setting in your |vimrc| the values of vimrplugin_tmpdir and
@@ -1890,7 +1884,7 @@ want to know they are, while editing an R file, do in Normal mode:
 
 ------------------------------------------------------------------------------
 							    *r-plugin-SyncTeX*
-6.34 SyncTeX support (Linux only)~
+6.33 SyncTeX support (Linux only)~
 
 SyncTeX is a set of communication systems used by some PDF viewers and by some
 text editors which allow users to jump from a specific line in the text editor
@@ -1930,7 +1924,7 @@ Note: The current knitr package (version 1.7) has at least two limitations:
 
 
 ------------------------------------------------------------------------------
-6.34.1 Evince configuration~
+6.33.1 Evince configuration~
 
 If you have Evince installed, the Vim-R-plugin assumes that you are using it
 to view PDF documents and that you run either GVim or Vim in Gnome-Terminal.
@@ -1943,7 +1937,7 @@ to press gp again.
 
 
 ------------------------------------------------------------------------------
-6.34.2 Okular configuration~
+6.33.2 Okular configuration~
 
 You have to configure Okular to call Vim during backward searches.
 In Okular, click in:
@@ -1970,7 +1964,7 @@ and if Okular was not started with the `--unique` argument, another instance
 of Okular will be started.
 
 ------------------------------------------------------------------------------
-6.34.3 Zathura configuration~
+6.33.3 Zathura configuration~
 
 Zathura (version >= 0.3.1) is also supported. If the terminal emulator is not
 raised during backward search (from PDF to Vim), you have to set the value of
@@ -1984,7 +1978,7 @@ to press gp again.
 ------------------------------------------------------------------------------
                                                        *vimrplugin_vim_window*
 				                       *vimrplugin_synctex*
-6.34.4 Configuring the PDF editor and Vim's window title~
+6.33.4 Configuring the PDF editor and Vim's window title~
 
 If SyncTeX does not work (see above), you may try to set in your |vimrc| the
 values of |vimrplugin_pdfviewer| and vimrplugin_vim_window.
@@ -2774,7 +2768,7 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details.
 							       *r-plugin-news*
 10. News~
 
-1.1.1 (2014-12-26)
+1.1.1 (2014-12-30)
 
  * Remove support for Neovim. See: https://github.com/jalvesaq/Nvim-R
 
@@ -2786,7 +2780,9 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details.
 
  * Replace option vimrplugin_external_ob with vimrplugin_tmux_ob.
 
- * Rename vimrplugin_permanent_libs to vimrplugin_start_libs
+ * Rename vimrplugin_permanent_libs to vimrplugin_start_libs.
+
+ * Rename vimrplugin_routmorecolors to Rout_more_colors.
 
  * New command: :RStop.
 
diff --git a/ftplugin/rnoweb_rplugin.vim b/ftplugin/rnoweb_rplugin.vim
index 6bd514c..231bb5e 100644
--- a/ftplugin/rnoweb_rplugin.vim
+++ b/ftplugin/rnoweb_rplugin.vim
@@ -566,9 +566,8 @@ function! SyncTeX_forward(...)
             silent exe '!start "' . g:rplugin_sumatra_path . '" -reuse-instance -forward-search ' . basenm . '.tex ' . texln . ' -inverse-search "gvim --servername ' . v:servername . " --remote-expr SyncTeX_backward('%f',%l)" . '" "' . basenm . '.pdf"'
         endif
     elseif g:rplugin_pdfviewer == "skim"
-        " This command is based on Skim wiki (not tested)
-        call system("/Applications/Skim.app/Contents/SharedSupport/displayline " . texln . " '" . basenm . ".pdf' '" . basenm . ".tex' 2> /dev/null >/dev/null &")
-        " Now, add the command to raise Skim window (AppleScript)?
+        " This command is based on macvim-skim
+        call system(g:macvim_skim_app_path . '/Contents/SharedSupport/displayline -r ' . texln . ' "' . basenm . '.pdf" "' . basenm . '.tex" 2> /dev/null >/dev/null &')
     else
         call RWarningMsg('SyncTeX support for "' . g:rplugin_pdfviewer . '" not implemented.')
     endif
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index f8411bf..5c04d75 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -666,7 +666,7 @@ endfunction
 
 
 function StartR_ExternalTerm(rcmd)
-    if $DISPLAY == "" && !has("gui_macvim")
+    if $DISPLAY == "" && !g:rplugin_is_darwin
         call RWarningMsg("Start 'tmux' before Vim. The X Window system is required to run R in an external terminal.")
         return
     endif
@@ -1117,12 +1117,7 @@ function StartObjBrowser_Vim()
         endif
         let g:rplugin_ob_warn_shown = 1
     else
-        if has("gui_macvim")
-            let wmsg ="MacVim cannot automatically updated the Object Browser."
-            let g:rplugin_ob_warn_shown = 1
-        else
-            call g:SendToVimCom("\002" . v:servername)
-        endif
+        call g:SendToVimCom("\002" . v:servername)
     endif
 
     " Either load or reload the Object Browser
@@ -2255,24 +2250,18 @@ function RSetPDFViewer()
         " Try to guess what PDF viewer is used:
         if has("win32") || has("win64")
             let g:rplugin_pdfviewer = "sumatra"
+        elseif g:rplugin_is_darwin
+            let g:rplugin_pdfviewer = "skim"
         elseif executable("evince")
             let g:rplugin_pdfviewer = "evince"
         elseif executable("okular")
             let g:rplugin_pdfviewer = "okular"
         else
             let g:rplugin_pdfviewer = "none"
-            if has("gui_macvim") || has("gui_mac") || has("mac") || has("macunix")
-                if $R_PDFVIEWER == ""
-                    let pdfvl = ["open"]
-                else
-                    let pdfvl = [$R_PDFVIEWER, "open"]
-                endif
+            if $R_PDFVIEWER == ""
+                let pdfvl = ["xdg-open"]
             else
-                if $R_PDFVIEWER == ""
-                    let pdfvl = ["xdg-open"]
-                else
-                    let pdfvl = [$R_PDFVIEWER, "xdg-open"]
-                endif
+                let pdfvl = [$R_PDFVIEWER, "xdg-open"]
             endif
             " List from R configure script:
             let pdfvl += ["evince", "okular", "zathura", "xpdf", "gv", "gnome-gv", "ggv", "kpdf", "gpdf", "kghostview,", "acroread", "acroread4"]
@@ -2922,16 +2911,7 @@ if !isdirectory(g:rplugin_tmpdir)
     call mkdir(g:rplugin_tmpdir, "p", 0700)
 endif
 
-" Old name of vimrplugin_assign option
-if exists("g:vimrplugin_underscore")
-    " 07/mar/2014:
-    call RWarningMsgInp("The option vimrplugin_underscore is deprecated. Use vimrplugin_assign instead.")
-endif
-
-if exists("g:vimrplugin_openpdf_quietly")
-    " 25/oct/2014
-    call RWarningMsgInp("The option vimrplugin_openpdf_quietly is deprecated.")
-endif
+let g:rplugin_is_darwin = system("uname") =~ "Darwin"
 
 " Variables whose default value is fixed
 call RSetDefaultValue("g:vimrplugin_map_r",             0)
@@ -3047,7 +3027,7 @@ if has('gui_running')
     let g:rplugin_do_tmux_split = 0
 endif
 
-if has("gui_macvim") || has("gui_mac") || has("mac") || has("macunix")
+if g:rplugin_is_darwin
     let g:rplugin_r64app = 0
     if isdirectory("/Applications/R64.app")
         call RSetDefaultValue("g:vimrplugin_applescript", 1)
@@ -3145,7 +3125,7 @@ endif
 if !exists("g:vimrplugin_term")
     let s:terminals = ['gnome-terminal', 'konsole', 'xfce4-terminal', 'terminal',
                 \ 'Eterm', 'rxvt', 'urxvt', 'aterm', 'roxterm', 'terminator', 'lxterminal']
-    if has("mac") || has("macvim") || has("gui_macvim")
+    if g:rplugin_is_darwin
         let s:terminals = ['/Applications/Utilities/iTerm.app/Contents/MacOS/iTerm',
                     \ '/Applications/Utilities/Terminal.app/Contents/MacOS/Terminal',
                     \ 'xterm'] + s:terminals
@@ -3318,3 +3298,7 @@ endif
 if exists("g:vimrplugin_permanent_libs")
     call RWarningMsgInp("The option 'vimrplugin_permanent_libs' was renamed to 'vimrplugin_start_libs'. Please, rename it in your vimrc too.")
 endif
+
+if exists("g:vimrplugin_routmorecolors")
+    call RWarningMsgInp("The option 'vimrplugin_routmorecolors' was renamed to 'Rout_more_colors'. Please, rename it in your vimrc too.")
+endif
diff --git a/r-plugin/functions.vim b/r-plugin/functions.vim
index f41a4ff..dd7b5af 100644
--- a/r-plugin/functions.vim
+++ b/r-plugin/functions.vim
@@ -1,5 +1,5 @@
+
 if has("nvim")
-    " See https://github.com/jalvesaq/Nvim-R
     finish
 endif
 
diff --git a/r-plugin/gui_running.vim b/r-plugin/gui_running.vim
index 7c727f6..32b0bd5 100644
--- a/r-plugin/gui_running.vim
+++ b/r-plugin/gui_running.vim
@@ -199,7 +199,7 @@ function MakeRMenu()
     if !(has("gui_win32") || has("gui_win64"))
         amenu R.Help\ (plugin).Options.Terminal\ emulator :help vimrplugin_term
     endif
-    if has("gui_macvim") || has("gui_mac") || has("mac") || has("macunix")
+    if g:rplugin_is_darwin
         amenu R.Help\ (plugin).Options.Integration\ with\ Apple\ Script :help vimrplugin_applescript
     endif
     if has("gui_win32") || has("gui_win64")
diff --git a/r-plugin/osx.vim b/r-plugin/osx.vim
index 9b50680..f49d1ee 100644
--- a/r-plugin/osx.vim
+++ b/r-plugin/osx.vim
@@ -50,3 +50,7 @@ function SendCmdToR_OSX(cmd)
     return 1
 endfunction
 
+if !exists(g:macvim_skim_app_path)
+    let g:macvim_skim_app_path = '/Applications/Skim.app'
+endif
+
diff --git a/syntax/rbrowser.vim b/syntax/rbrowser.vim
index 8468f64..a2a9780 100644
--- a/syntax/rbrowser.vim
+++ b/syntax/rbrowser.vim
@@ -1,5 +1,5 @@
 " Vim syntax file
-" Language:	Object browser of Vim-R-plugin
+" Language:	Object browser of R Workspace
 " Maintainer:	Jakson Alves de Aquino (jalvesaq@gmail.com)
 
 if exists("b:current_syntax")
diff --git a/syntax/rdoc.vim b/syntax/rdoc.vim
index 15ec3b8..b691e76 100644
--- a/syntax/rdoc.vim
+++ b/syntax/rdoc.vim
@@ -20,8 +20,8 @@ exec "syn sync minlines=" . rdoc_minlines . " maxlines=" . rdoc_maxlines
 syn match  rdocTitle	      "^[A-Z].*:$"
 syn match  rdocTitle "^\S.*R Documentation$"
 syn match rdocFunction "\([A-Z]\|[a-z]\|\.\|_\)\([A-Z]\|[a-z]\|[0-9]\|\.\|_\)*" contained
-syn region rdocStringS  start="‘" end="’" contains=rdocFunction transparent keepend
-syn region rdocStringS  start="‘" end="’" contains=rdocFunction transparent keepend
+syn region rdocStringS  start="\%u2018" end="\%u2019" contains=rdocFunction transparent keepend
+syn region rdocStringS  start="\%x91" end="\%x92" contains=rdocFunction transparent keepend
 syn region rdocStringD  start='"' skip='\\"' end='"'
 syn match rdocURL `\v<(((https?|ftp|gopher)://|(mailto|file|news):)[^'	<>"]+|(www|web|w3)[a-z0-9_-]*\.[a-z0-9._-]+\.[^'  <>"]+)[a-zA-Z0-9/]`
 syn keyword rdocNote		note Note NOTE note: Note: NOTE: Notes Notes:
diff --git a/syntax/rout.vim b/syntax/rout.vim
index ddd3709..a1d2262 100644
--- a/syntax/rout.vim
+++ b/syntax/rout.vim
@@ -59,11 +59,11 @@ syn match routDate "[0-9][0-9][0-9][0-9][-/][0-9][0-9][-/][0-9][-0-9]"
 syn match routDate "[0-9][0-9][-/][0-9][0-9][-/][0-9][0-9][0-9][-0-9]"
 syn match routDate "[0-9][0-9]:[0-9][0-9]:[0-9][-0-9]"
 
-if !exists("g:vimrplugin_routmorecolors")
-    let g:vimrplugin_routmorecolors = 0
+if !exists("g:Rout_more_colors")
+    let g:Rout_more_colors = 0
 endif
 
-if g:vimrplugin_routmorecolors
+if g:Rout_more_colors
     syn include @routR syntax/r.vim
     syn region routColoredR start="^> " end='$' contains=@routR keepend
     syn region routColoredR start="^+ " end='$' contains=@routR keepend
@@ -144,7 +144,7 @@ if v:lang =~ "^tr"
 endif
 
 " Define the default highlighting.
-if g:vimrplugin_routmorecolors == 0
+if g:Rout_more_colors == 0
     hi def link routInput	Comment
 endif
 

From 48d5fc96753993d7d8e189cf84833d7b46732f48 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sat, 10 Jan 2015 12:11:45 -0500
Subject: [PATCH 0903/1050] Fix bugs on Windows

---
 autoload/rcomplete.vim     |   2 +-
 doc/r-plugin.txt           |   3 +-
 ftplugin/rbrowser.vim      |  12 +---
 list_for_vimball           |   1 -
 r-plugin/common_global.vim |  77 ++++++++++--------------
 r-plugin/osx.vim           |   2 +-
 r-plugin/windows.py        | 119 -------------------------------------
 r-plugin/windows.vim       |  41 +++----------
 8 files changed, 47 insertions(+), 210 deletions(-)
 delete mode 100644 r-plugin/windows.py

diff --git a/autoload/rcomplete.vim b/autoload/rcomplete.vim
index 6b90cb6..6a20196 100644
--- a/autoload/rcomplete.vim
+++ b/autoload/rcomplete.vim
@@ -18,7 +18,7 @@ function BuildROmniList()
 
     call delete(g:rplugin_tmpdir . "/vimbol_finished")
     call delete(g:rplugin_tmpdir . "/eval_reply")
-    call g:SendToVimCom("\x08" . $VIMINSTANCEID . omnilistcmd, "I")
+    call SendToVimCom("\x08" . $VIMINSTANCEID . omnilistcmd)
     if g:rplugin_vimcomport == 0
         sleep 500m
         return
diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 7ac9680..f7c3f2b 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -2210,7 +2210,6 @@ directory after the installation:
    r-plugin/synctex_evince_backward.py
    r-plugin/synctex_evince_forward.py
    r-plugin/synctex_okular_backward.sh
-   r-plugin/windows.py
    r-plugin/windows.vim
    syntax/r.vim
    syntax/rbrowser.vim
@@ -2768,7 +2767,7 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details.
 							       *r-plugin-news*
 10. News~
 
-1.1.1 (2014-12-30)
+1.1.1 (2015-01-10)
 
  * Remove support for Neovim. See: https://github.com/jalvesaq/Nvim-R
 
diff --git a/ftplugin/rbrowser.vim b/ftplugin/rbrowser.vim
index 1454ee8..ba18256 100644
--- a/ftplugin/rbrowser.vim
+++ b/ftplugin/rbrowser.vim
@@ -119,19 +119,13 @@ function! RBrowserDoubleClick()
     " Toggle state of list or data.frame: open X closed
     let key = RBrowserGetName(0, 1)
     if g:rplugin_curview == "GlobalEnv"
-        call g:SendToVimCom("\006" . key)
-        if g:rplugin_lastrpl == "R is busy."
-            call RWarningMsg("R is busy.")
-        endif
+        call SendToVimCom("\006" . key)
     else
         let key = substitute(key, '`', '', "g") 
         if key !~ "^package:"
             let key = "package:" . RBGetPkgName() . '-' . key
         endif
-        call g:SendToVimCom("\006" . key)
-        if g:rplugin_lastrpl == "R is busy."
-            call RWarningMsg("R is busy.")
-        endif
+        call SendToVimCom("\006" . key)
     endif
     if v:servername == "" || has("win32") || has("win64")
         sleep 50m " R needs some time to write the file.
@@ -352,7 +346,7 @@ if g:vimrplugin_tmux_ob
         autocmd! ShowMarks
     endif
 else
-    au BufUnload  call g:SendToVimCom("\004Stop updating info [OB BufUnload].")
+    au BufUnload  call SendToVimCom("\004Stop updating info [OB BufUnload].")
 endif
 
 let s:envstring = tolower($LC_MESSAGES . $LC_ALL . $LANG)
diff --git a/list_for_vimball b/list_for_vimball
index f1efd96..51a0144 100644
--- a/list_for_vimball
+++ b/list_for_vimball
@@ -30,7 +30,6 @@ r-plugin/functions.vim
 r-plugin/gui_running.vim
 r-plugin/osx.vim
 r-plugin/setcompldir.vim
-r-plugin/windows.py
 r-plugin/windows.vim
 syntax/r.vim
 syntax/rbrowser.vim
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 5c04d75..8995981 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -282,7 +282,7 @@ function RCompleteArgs()
                 else
                     let msg = msg . ')'
                 endif
-                call g:SendToVimCom("\x08" . $VIMINSTANCEID . msg, "I")
+                call SendToVimCom("\x08" . $VIMINSTANCEID . msg)
 
                 if g:rplugin_vimcomport > 0
                     let g:rplugin_lastev = ReadEvalReply()
@@ -660,7 +660,7 @@ function StartR_TmuxSplit(rcmd)
         call system("tmux rename-window " . g:vimrplugin_tmux_title)
     endif
     if WaitVimComStart()
-        call g:SendToVimCom("\005B Update OB [StartR]")
+        call SendToVimCom("\005B Update OB [StartR]")
     endif
 endfunction
 
@@ -719,7 +719,7 @@ function StartR_ExternalTerm(rcmd)
     endif
     let g:SendCmdToR = function('SendCmdToR_Term')
     if WaitVimComStart()
-        call g:SendToVimCom("\005B Update OB [StartR]")
+        call SendToVimCom("\005B Update OB [StartR]")
     endif
 endfunction
 
@@ -737,8 +737,6 @@ endfunction
 
 " Start R
 function StartR(whatr)
-    let g:SendToVimCom = function("SendToVimCom_Vim")
-
     if has("gui_macvim") && v:servername != ""
         let $VIMEDITOR_SVRNM = "MacVim_" . v:servername
         let $VIM_BINARY_PATH = "mvim"
@@ -816,9 +814,9 @@ function StartR(whatr)
                         call g:SendCmdToR("\014")
                     endif
                     call VimExprToOB('ResetVimComPort()')
-                    call g:SendToVimCom("\002" . g:rplugin_obsname)
-                    call g:SendToVimCom("\005G .GlobalEnv [Restarting R]")
-                    call g:SendToVimCom("\005L Libraries [Restarting()]")
+                    call SendToVimCom("\002" . g:rplugin_obsname)
+                    call SendToVimCom("\005G .GlobalEnv [Restarting R]")
+                    call SendToVimCom("\005L Libraries [Restarting()]")
                     " vimcom automatically update the libraries view, but not
                     " the GlobalEnv one because vimcom_count_objects() returns 0.
                     call VimExprToOB('UpdateOB("GlobalEnv")')
@@ -850,9 +848,9 @@ function StartR(whatr)
         call StartR_ExternalTerm(rcmd)
         if g:vimrplugin_restart && bufloaded(b:objbrtitle)
             call WaitVimComStart()
-            call g:SendToVimCom("\002" . v:servername)
-            call g:SendToVimCom("\005G .GlobalEnv [Restarting R]")
-            call g:SendToVimCom("\005L Libraries [Restarting()]")
+            call SendToVimCom("\002" . v:servername)
+            call SendToVimCom("\005G .GlobalEnv [Restarting R]")
+            call SendToVimCom("\005L Libraries [Restarting()]")
             if exists("*UpdateOB")
                 call UpdateOB("GlobalEnv")
             endif
@@ -919,8 +917,8 @@ function WaitVimComStart()
         let g:rplugin_vimcom_home = vr[1]
         let g:rplugin_vimcomport = vr[2]
         let g:rplugin_r_pid = vr[3]
-        if g:rplugin_vimcom_version != "1.1.16"
-            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.1.16.')
+        if g:rplugin_vimcom_version != "1.1.17"
+            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.1.17.')
             sleep 1
         endif
         if has("win32")
@@ -975,9 +973,9 @@ function StartObjBrowser_Tmux()
 
     let g:RBrOpenCloseLs = function("RBrOpenCloseLs_TmuxVim")
 
-    call g:SendToVimCom("\005G GlobalEnv [OB StartObjBrowser_Tmux]")
+    call SendToVimCom("\005G GlobalEnv [OB StartObjBrowser_Tmux]")
     sleep 50m
-    call g:SendToVimCom("\005L Libraries [OB StartObjBrowser_Tmux]")
+    call SendToVimCom("\005L Libraries [OB StartObjBrowser_Tmux]")
     sleep 50m
 
     " Don't start the Object Browser if it already exists
@@ -1013,10 +1011,9 @@ function StartObjBrowser_Tmux()
                 \ 'set noruler',
                 \ 'let g:SendCmdToR = function("SendCmdToR_TmuxSplit")',
                 \ 'let g:RBrOpenCloseLs = function("RBrOpenCloseLs_TmuxOB")',
-                \ 'let g:SendToVimCom = function("SendToVimCom_Vim")',
                 \ 'if has("clientserver") && v:servername != ""',
                 \ '    let g:rplugin_vimcomport = ' . g:rplugin_vimcomport,
-                \ '    call g:SendToVimCom("\002" . v:servername)',
+                \ '    call SendToVimCom("\002" . v:servername)',
                 \ 'endif',
                 \ 'sleep 150m',
                 \ 'call UpdateOB("GlobalEnv")', ], objbrowserfile)
@@ -1117,7 +1114,7 @@ function StartObjBrowser_Vim()
         endif
         let g:rplugin_ob_warn_shown = 1
     else
-        call g:SendToVimCom("\002" . v:servername)
+        call SendToVimCom("\002" . v:servername)
     endif
 
     " Either load or reload the Object Browser
@@ -1153,7 +1150,7 @@ function StartObjBrowser_Vim()
         unlet g:tmp_objbrtitle
         unlet g:tmp_tmuxsname
         unlet g:tmp_curbufname
-        call g:SendToVimCom("\005B Update OB [OB init GVIM]")
+        call SendToVimCom("\005B Update OB [OB init GVIM]")
         sleep 50m
         call UpdateOB("GlobalEnv")
     endif
@@ -1223,7 +1220,7 @@ function RBrOpenCloseLs_Vim(status)
 
     " Avoid possibly freezing cross messages between Vim and R
     if exists("g:rplugin_curview") && v:servername != ""
-        call g:SendToVimCom("\005Stop updating info [RBrOpenCloseLs()]")
+        call SendToVimCom("\005Stop updating info [RBrOpenCloseLs()]")
         let stt = a:status
     else
         let stt = a:status + 2
@@ -1237,11 +1234,7 @@ function RBrOpenCloseLs_Vim(status)
         let switchedbuf = 1
     endif
 
-    call g:SendToVimCom("\007" . stt)
-
-    if g:rplugin_lastrpl == "R is busy."
-        call RWarningMsg("R is busy.")
-    endif
+    call SendToVimCom("\007" . stt)
 
     if switchedbuf
         exe "sil noautocmd sb " . g:rplugin_curbuf
@@ -1250,7 +1243,7 @@ function RBrOpenCloseLs_Vim(status)
     if exists("g:rplugin_curview")
         call UpdateOB("both")
         if v:servername != ""
-            call g:SendToVimCom("\002" . v:servername)
+            call SendToVimCom("\002" . v:servername)
         endif
     endif
 endfunction
@@ -1270,11 +1263,7 @@ function RBrOpenCloseLs_TmuxVim(status)
         endif
     endif
 
-    call g:SendToVimCom("\007" . a:status)
-
-    if g:rplugin_lastrpl == "R is busy."
-        call RWarningMsg("R is busy.")
-    endif
+    call SendToVimCom("\007" . a:status)
 endfunction
 
 function RBrOpenCloseLs_TmuxOB(status)
@@ -1286,7 +1275,7 @@ function RBrOpenCloseLs_TmuxOB(status)
         normal! :
         return
     endif
-    call g:SendToVimCom("\007" . a:status)
+    call SendToVimCom("\007" . a:status)
     if v:servername == ""
         call UpdateOB("both")
     endif
@@ -1308,7 +1297,7 @@ function RFormatCode() range
         let wco = 180
     endif
     call delete(g:rplugin_tmpdir . "/eval_reply")
-    call g:SendToVimCom("\x08" . $VIMINSTANCEID . 'formatR::tidy_source("' . g:rplugin_tmpdir . '/unformatted_code", file = "' . g:rplugin_tmpdir . '/formatted_code", width.cutoff = ' . wco . ')', "I")
+    call SendToVimCom("\x08" . $VIMINSTANCEID . 'formatR::tidy_source("' . g:rplugin_tmpdir . '/unformatted_code", file = "' . g:rplugin_tmpdir . '/formatted_code", width.cutoff = ' . wco . ')')
     let g:rplugin_lastev = ReadEvalReply()
     if g:rplugin_lastev == "R is busy." || g:rplugin_lastev == "UNKNOWN" || g:rplugin_lastev =~ "^Error" || g:rplugin_lastev == "INVALID" || g:rplugin_lastev == "ERROR" || g:rplugin_lastev == "EMPTY" || g:rplugin_lastev == "No reply"
         call RWarningMsg(g:rplugin_lastev)
@@ -1327,21 +1316,20 @@ function RInsert(cmd)
 
     call delete(g:rplugin_tmpdir . "/eval_reply")
     call delete(g:rplugin_tmpdir . "/Rinsert")
-    call g:SendToVimCom("\x08" . $VIMINSTANCEID . 'capture.output(' . a:cmd . ', file = "' . g:rplugin_tmpdir . '/Rinsert")')
+    call SendToVimCom("\x08" . $VIMINSTANCEID . 'capture.output(' . a:cmd . ', file = "' . g:rplugin_tmpdir . '/Rinsert")')
     let g:rplugin_lastev = ReadEvalReply()
     if g:rplugin_lastev == "R is busy." || g:rplugin_lastev == "UNKNOWN" || g:rplugin_lastev =~ "^Error" || g:rplugin_lastev == "INVALID" || g:rplugin_lastev == "ERROR" || g:rplugin_lastev == "EMPTY" || g:rplugin_lastev == "No reply"
         call RWarningMsg(g:rplugin_lastev)
+        return 0
     else
         silent exe "read " . substitute(g:rplugin_tmpdir, ' ', '\\ ', 'g') . "/Rinsert"
+        return 1
     endif
 endfunction
 
 function SendLineToRAndInsertOutput()
     let lin = getline(".")
-    call RInsert("print(" . lin . ")")
-    if g:rplugin_lastrpl == "R is busy." || g:rplugin_lastrpl == "UNKNOWN" || g:rplugin_lastrpl =~ "^Error" || g:rplugin_lastrpl == "INVALID" || g:rplugin_lastrpl == "ERROR" || g:rplugin_lastrpl == "EMPTY" || g:rplugin_lastrpl == "No reply"
-        return
-    else
+    if RInsert("print(" . lin . ")")
         let curpos = getpos(".")
         " comment the output
         let ilines = readfile(substitute(g:rplugin_tmpdir, ' ', '\\ ', 'g') . "/Rinsert")
@@ -1854,7 +1842,7 @@ function RClearConsole()
     if (has("win32") || has("win64"))
         if g:vimrplugin_libcall_send
             if !g:vimrplugin_Rterm
-                let repl = libcall(g:rplugin_vimcom_lib, "RClearConsole()", "Rgui")
+                let repl = libcall(g:rplugin_vimcom_lib, "RClearConsole", "Rgui")
             endif
         else
             Py RClearConsolePy()
@@ -2141,7 +2129,7 @@ function AskRDoc(rkeyword, package, getclass)
         let rcmd = 'vimcom:::vim.help("' . a:rkeyword . '", ' . g:rplugin_htw . 'L, ' . classfor . ')'
     endif
 
-    call g:SendToVimCom("\x08" . $VIMINSTANCEID . rcmd, "I")
+    call SendToVimCom("\x08" . $VIMINSTANCEID . rcmd)
 endfunction
 
 " This function is called by vimcom
@@ -2975,13 +2963,13 @@ unlet obpllen
 function RSetMyPort(p)
     let g:rplugin_myport = a:p
     if &filetype == "rbrowser"
-        call g:SendToVimCom("\002" . a:p)
-        call g:SendToVimCom("\005B Update OB [RSetMyPort]")
+        call SendToVimCom("\002" . a:p)
+        call SendToVimCom("\005B Update OB [RSetMyPort]")
     endif
 endfunction
 
 function SendObjPortToVimCom(p)
-    call g:SendToVimCom("\002" . a:p)
+    call SendToVimCom("\002" . a:p)
 endfunction
 
 function ROnJobActivity()
@@ -3001,7 +2989,7 @@ function ROnJobActivity()
     endif
 endfunction
 
-function SendToVimCom_Vim(...)
+function SendToVimCom(...)
     if g:rplugin_vimcomport == 0
         call RWarningMsg("VimCom port is unknown.")
         return
@@ -3224,7 +3212,6 @@ let g:rplugin_myport = 0
 let g:rplugin_vimcomport = 0
 let g:rplugin_vimcom_home = ""
 let g:rplugin_vimcom_version = 0
-let g:rplugin_lastrpl = ""
 let g:rplugin_lastev = ""
 let g:rplugin_last_r_prompt = ""
 let g:rplugin_hasRSFbutton = 0
diff --git a/r-plugin/osx.vim b/r-plugin/osx.vim
index f49d1ee..b640c01 100644
--- a/r-plugin/osx.vim
+++ b/r-plugin/osx.vim
@@ -24,7 +24,7 @@ function StartR_OSX()
     endif
     let g:SendCmdToR = function('SendCmdToR_OSX')
     if WaitVimComStart()
-        call g:SendToVimCom("\005B Update OB [StartR]")
+        call SendToVimCom("\005B Update OB [StartR]")
     endif
 endfunction
 
diff --git a/r-plugin/windows.py b/r-plugin/windows.py
deleted file mode 100644
index a0f077d..0000000
--- a/r-plugin/windows.py
+++ /dev/null
@@ -1,119 +0,0 @@
-
-import os
-import string
-import time
-import vim
-RConsole = 0
-Rterm = False
-
-try:
-    import win32api
-    import win32clipboard
-    import win32com.client
-    import win32con
-    import win32gui
-except ImportError:
-    import platform
-    myPyVersion = platform.python_version()
-    myArch = platform.architecture()
-    vim.command("call RWarningMsgInp('Please install PyWin32. The Python version being used is: " + myPyVersion + " (" + myArch[0] + ")')")
-
-def RightClick():
-    global RConsole
-    myHandle = win32gui.GetForegroundWindow()
-    RaiseRConsole()
-    time.sleep(0.05)
-    lParam = (100 << 16) | 100
-    win32gui.SendMessage(RConsole, win32con.WM_RBUTTONDOWN, 0, lParam)
-    win32gui.SendMessage(RConsole, win32con.WM_RBUTTONUP, 0, lParam)
-    time.sleep(0.05)
-    try:
-        win32gui.SetForegroundWindow(myHandle)
-    except:
-        vim.command("call RWarningMsg('Could not put itself on foreground.')")
-
-def CntrlV():
-    global RConsole
-    win32api.keybd_event(0x11, 0, 0, 0)
-    try:
-        win32api.PostMessage(RConsole, 0x100, 0x56, 0x002F0001)
-    except:
-        vim.command("call RWarningMsg('R Console window not found [1].')")
-        RConsole = 0
-        pass
-    if RConsole:
-        time.sleep(0.05)
-        try:
-            win32api.PostMessage(RConsole, 0x101, 0x56, 0xC02F0001)
-        except:
-            vim.command("call RWarningMsg('R Console window not found [2].')")
-            pass
-    win32api.keybd_event(0x11, 0, 2, 0)
-
-def FindRConsole():
-    global RConsole
-    Rttl = vim.eval("g:vimrplugin_R_window_title")
-    Rtitle = Rttl
-    RConsole = win32gui.FindWindow(None, Rtitle)
-    if RConsole == 0:
-        Rtitle = Rttl + " (64-bit)"
-        RConsole = win32gui.FindWindow(None, Rtitle)
-        if RConsole == 0:
-            Rtitle = Rttl + " (32-bit)"
-            RConsole = win32gui.FindWindow(None, Rtitle)
-            if RConsole == 0:
-                vim.command("call RWarningMsg('Could not find R Console.')")
-    if RConsole:
-        vim.command("let g:rplugin_R_window_ttl = '" + Rtitle + "'")
-
-def SendToRConsole(aString):
-    global RConsole
-    global Rterm
-    SendToVimCom("\003Set R as busy [SendToRConsole()]")
-    if sys.hexversion < 0x03000000:
-        finalString = aString.decode("latin-1") + "\n"
-    else:
-        finalString = aString
-    win32clipboard.OpenClipboard(0)
-    win32clipboard.EmptyClipboard()
-    win32clipboard.SetClipboardText(finalString)
-    win32clipboard.CloseClipboard()
-    if RConsole == 0:
-        FindRConsole()
-    if RConsole:
-        if Rterm:
-            RightClick()
-        else:
-            CntrlV()
-
-def RClearConsolePy():
-    global RConsole
-    global Rterm
-    if Rterm:
-        return
-    if RConsole == 0:
-        FindRConsole()
-    if RConsole:
-        win32api.keybd_event(0x11, 0, 0, 0)
-        try:
-            win32api.PostMessage(RConsole, 0x100, 0x4C, 0x002F0001)
-        except:
-            vim.command("call RWarningMsg('R Console window not found [1].')")
-            RConsole = 0
-            pass
-        if RConsole:
-            time.sleep(0.05)
-            try:
-                win32api.PostMessage(RConsole, 0x101, 0x4C, 0xC02F0001)
-            except:
-                vim.command("call RWarningMsg('R Console window not found [2].')")
-                pass
-        win32api.keybd_event(0x11, 0, 2, 0)
-
-def RaiseRConsole():
-    global RConsole
-    FindRConsole()
-    if RConsole:
-        win32gui.SetForegroundWindow(RConsole)
-        time.sleep(0.1)
-
diff --git a/r-plugin/windows.vim b/r-plugin/windows.vim
index eb5ab61..3858780 100644
--- a/r-plugin/windows.vim
+++ b/r-plugin/windows.vim
@@ -10,6 +10,9 @@ else
     let g:vimrplugin_i386 = 1
 endif
 
+call RSetDefaultValue("g:vimrplugin_sleeptime", 100)
+let g:rplugin_sleeptime = g:vimrplugin_sleeptime . 'm'
+
 if g:vimrplugin_Rterm
     let b:rplugin_R = "Rgui.exe"
 else
@@ -103,26 +106,7 @@ function FindSumatra()
     return 0
 endfunction
 
-function InitializePython()
-    " python3 has priority over python
-    if has("python3")
-        command! -nargs=+ Py :py3 
-        command! -nargs=+ PyFile :py3file 
-    elseif has("python")
-        command! -nargs=+ Py :py 
-        command! -nargs=+ PyFile :pyfile 
-    else
-        command! -nargs=+ Py :
-        command! -nargs=+ PyFile :
-    endif
-    exe "PyFile " . substitute(g:rplugin_home, " ", '\\ ', "g") . '\r-plugin\windows.py'
-    let g:rplugin_python_initialized = 1
-endfunction
-
 function StartR_Windows()
-    if !g:vimrplugin_libcall_send && !g:rplugin_python_initialized
-        call InitializePython()
-    endif
     if string(g:SendCmdToR) != "function('SendCmdToR_fake')"
         let repl = libcall(g:rplugin_vimcom_lib, "IsRRunning", 'No argument')
         if repl =~ "^Yes"
@@ -179,20 +163,13 @@ function SendCmdToR_Windows(cmd)
     else
         let cmd = a:cmd . "\n"
     endif
-    if g:vimrplugin_libcall_send
-        let repl = libcall(g:rplugin_vimcom_lib, "SendToRConsole", cmd)
-        if repl != "OK"
-            call RWarningMsg(repl)
-            call ClearRInfo()
-        endif
-    else
-        let slen = len(cmd)
-        let str = ""
-        for i in range(0, slen)
-            let str = str . printf("\\x%02X", char2nr(cmd[i]))
-        endfor
-        exe "Py" . " SendToRConsole(b'" . str . "')"
+    let repl = libcall(g:rplugin_vimcom_lib, "SendToRConsole", cmd)
+    if repl != "OK"
+        call RWarningMsg(repl)
+        call ClearRInfo()
     endif
+    exe "sleep " . g:rplugin_sleeptime
+    call foreground()
     return 1
 endfunction
 

From 5629f992a4bc5a940bc9a9be5623e5af247c9a17 Mon Sep 17 00:00:00 2001
From: Sebastian Jeworutzki 
Date: Thu, 15 Jan 2015 17:57:03 +0100
Subject: [PATCH 0904/1050] Fix RMakeRmd call for beamer presentations

---
 r-plugin/gui_running.vim | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/r-plugin/gui_running.vim b/r-plugin/gui_running.vim
index 32b0bd5..6c9aa17 100644
--- a/r-plugin/gui_running.vim
+++ b/r-plugin/gui_running.vim
@@ -115,7 +115,7 @@ function MakeRMenu()
         endif
         if &filetype == "rmd" || g:vimrplugin_never_unmake_menu
             call RCreateMenuItem("nvi", 'Command.Knit\ and\ PDF\ (cur\ file)', 'RMakePDFK', 'kp', ':call RMakeRmd("pdf")')
-            call RCreateMenuItem("nvi", 'Command.Knit\ and\ Beamer\ PDF\ (cur\ file)', 'RMakePDFKb', 'kl', ':call RMakeRmd("beamer")')
+            call RCreateMenuItem("nvi", 'Command.Knit\ and\ Beamer\ PDF\ (cur\ file)', 'RMakePDFKb', 'kl', ':call RMakeRmd("beamer_presentation")')
             call RCreateMenuItem("nvi", 'Command.Knit\ and\ HTML\ (cur\ file)', 'RMakeHTML', 'kh', ':call RMakeRmd("html")')
             call RCreateMenuItem("nvi", 'Command.Knit\ and\ ODT\ (cur\ file)', 'RMakeODT', 'ko', ':call RMakeRmd("odt")')
         endif

From e759c0eba7abbba6298dfa5f9adc0cbbe05a346f Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Fri, 16 Jan 2015 00:47:07 -0500
Subject: [PATCH 0905/1050] Support SyncTeX on Windows

---
 doc/r-plugin.txt            | 37 ++++++++++++++++++++++++-------------
 ftplugin/rnoweb_rplugin.vim | 10 +++++++++-
 r-plugin/common_global.vim  | 20 +++-----------------
 r-plugin/windows.vim        |  7 -------
 4 files changed, 36 insertions(+), 38 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index f7c3f2b..71abc81 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -88,7 +88,7 @@ Vim-R-plugin (see |vimrplugin_source|).
       - Send commands with the object under cursor as argument.
       - Call R's `help()` with the object under cursor as argument.
       - Syntax highlighting of the Object Browser.
-  * SyncTeX support on Linux.
+  * SyncTeX support on Linux and Windows.
   * Most of the plugin's behavior is customizable.
 
 For screenshots see: http://www.lepem.ufc.br/jaa/vim-r-plugin.html
@@ -248,7 +248,13 @@ dependencies:
 
     * Vim's version must be >= 7.4: http://www.vim.org/download.php
 
-    * Sumatra PDF (only if you write Rnoweb code).
+    * Only if you write Rnoweb code:
+
+       * Sumatra PDF viewer >= 3.0.
+
+       * MikTeX or other LaTeX distribution.
+
+       * Perl (required to run `latexmk`).
 
 Add the following lines to your `Rprofile`:
 >
@@ -1035,13 +1041,16 @@ The vimcom library is started with the state `busy`.
 ------------------------------------------------------------------------------
 							*r-plugin-SyncTeX-win*
 							*r-plugin-SyncTeX-mac*
-5.8. SyncTeX support is a Linux only feature~
+5.8. SyncTeX support issues~
 
-There is no SyncTeX support for Windows and Mac OS X. Both Sumatra (Windows)
-and Skim (Mac OS X) have support for SyncTeX, but the Vim-R-plugin is not
-ready to communicate with them. If you can, please write the necessary code to
-support Skim and revise the already partially written code for Sumatra submit
-it as a push request on github: https://github.com/jcfaria/Vim-R-plugin
+There is no SyncTeX support for Mac OS X. The Skim pdf viewer has support for
+SyncTeX, but the Vim-R-plugin is not ready to communicate with it. If you can,
+please write the necessary code to support Skim and submit it as a push
+request on github: https://github.com/jcfaria/Vim-R-plugin
+
+On Windows, backward search with Sumatra pop ups a console window (`vim`
+running the required --remote-expr command) and the GVim window is not brougth
+to the foreground.
 
 
 ------------------------------------------------------------------------------
@@ -1603,14 +1612,14 @@ Example:
 						       *vimrplugin_latexcmd*
 6.17. LaTeX command~
 
-On Windows, the vimcom package calls `tools::texi2dvi()` to build the pdf
-from the generated .tex file. On Linux/Unix, by default, it calls
+The vimcom package calls
 >
    latexmk -pdflatex="pdflatex -file-line-error -synctex=1" -pdf
 <
 to produce a pdf document from the .tex file generated by either `Sweave()` or
-`knit()` command. If `latexmk` is not installed, it calls `pdflatex`. You can
-use the option vimrplugin_latexcmd to change this behavior. Examples:
+`knit()` command. If either `latexmk` or `perl` (which is required to run
+`latexmk`) is not installed and in the path, it calls `pdflatex`. You can use
+the option vimrplugin_latexcmd to change this behavior. Examples:
 >
    let vimrplugin_latexcmd = "latex"
    let vimrplugin_latexcmd = 'latexmk -pdf -pdflatex="xelatex %O -synctex=1 %S"'
@@ -2767,7 +2776,7 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details.
 							       *r-plugin-news*
 10. News~
 
-1.1.1 (2015-01-10)
+1.1.1 (2015-01-15)
 
  * Remove support for Neovim. See: https://github.com/jalvesaq/Nvim-R
 
@@ -2787,6 +2796,8 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details.
 
  * No longer require +python feature; require +libcall instead.
 
+ * Support for SyncTeX on Windows.
+
 1.1 (2014-11-13)
 
  * Version update for Linux/Unix only. May not work on Windows or Mac.
diff --git a/ftplugin/rnoweb_rplugin.vim b/ftplugin/rnoweb_rplugin.vim
index 231bb5e..2d54937 100644
--- a/ftplugin/rnoweb_rplugin.vim
+++ b/ftplugin/rnoweb_rplugin.vim
@@ -13,6 +13,14 @@ endif
 " after the global ones:
 runtime r-plugin/common_buffer.vim
 
+if !exists("g:rplugin_has_latexmk")
+  if executable("latexmk") && executable("perl")
+    let g:rplugin_has_latexmk = 1
+  else
+    let g:rplugin_has_latexmk = 0
+  endif
+endif
+
 function! RWriteChunk()
     if getline(".") =~ "^\\s*$" && RnwIsInRCode(0) == 0
         call setline(line("."), "<<>>=")
@@ -563,7 +571,7 @@ function! SyncTeX_forward(...)
         call system("wmctrl -a '" . basenm . ".pdf'")
     elseif g:rplugin_pdfviewer == "sumatra"
         if g:rplugin_sumatra_path != "" || FindSumatra()
-            silent exe '!start "' . g:rplugin_sumatra_path . '" -reuse-instance -forward-search ' . basenm . '.tex ' . texln . ' -inverse-search "gvim --servername ' . v:servername . " --remote-expr SyncTeX_backward('%f',%l)" . '" "' . basenm . '.pdf"'
+            silent exe '!start "' . g:rplugin_sumatra_path . '" -reuse-instance -forward-search ' . basenm . '.tex ' . texln . ' -inverse-search "vim --servername ' . v:servername . " --remote-expr SyncTeX_backward('\\%f',\\%l)" . '" "' . basenm . '.pdf"'
         endif
     elseif g:rplugin_pdfviewer == "skim"
         " This command is based on macvim-skim
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 8995981..f212ebf 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -917,8 +917,8 @@ function WaitVimComStart()
         let g:rplugin_vimcom_home = vr[1]
         let g:rplugin_vimcomport = vr[2]
         let g:rplugin_r_pid = vr[3]
-        if g:rplugin_vimcom_version != "1.1.17"
-            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.1.17.')
+        if g:rplugin_vimcom_version != "1.1.18"
+            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.1.18.')
             sleep 1
         endif
         if has("win32")
@@ -1152,7 +1152,6 @@ function StartObjBrowser_Vim()
         unlet g:tmp_curbufname
         call SendToVimCom("\005B Update OB [OB init GVIM]")
         sleep 50m
-        call UpdateOB("GlobalEnv")
     endif
     if wmsg != ""
         call RWarningMsg(wmsg)
@@ -1220,7 +1219,6 @@ function RBrOpenCloseLs_Vim(status)
 
     " Avoid possibly freezing cross messages between Vim and R
     if exists("g:rplugin_curview") && v:servername != ""
-        call SendToVimCom("\005Stop updating info [RBrOpenCloseLs()]")
         let stt = a:status
     else
         let stt = a:status + 2
@@ -1240,12 +1238,6 @@ function RBrOpenCloseLs_Vim(status)
         exe "sil noautocmd sb " . g:rplugin_curbuf
         exe "set switchbuf=" . savesb
     endif
-    if exists("g:rplugin_curview")
-        call UpdateOB("both")
-        if v:servername != ""
-            call SendToVimCom("\002" . v:servername)
-        endif
-    endif
 endfunction
 
 function RBrOpenCloseLs_TmuxVim(status)
@@ -2345,7 +2337,7 @@ function ROpenPDF(path)
             exe "cd " . substitute(olddir, ' ', '\\ ', 'g')
             return
         elseif g:rplugin_pdfviewer == "sumatra" && (g:rplugin_sumatra_path != "" || FindSumatra())
-            silent exe '!start "' . g:rplugin_sumatra_path . '" -reuse-instance -inverse-search "gvim --servername ' . v:servername . " --remote-expr SyncTeX_backward('%f',%l)" . '" "' . basenm . '.pdf"'
+            silent exe '!start "' . g:rplugin_sumatra_path . '" -reuse-instance -inverse-search "vim --servername ' . v:servername . " --remote-expr SyncTeX_backward('\\%f',\\%l)" . '" "' . basenm . '.pdf"'
             exe "cd " . substitute(olddir, ' ', '\\ ', 'g')
             return
         else
@@ -3076,12 +3068,6 @@ if !has("win32") && !has("win64") && !has("gui_win32") && !has("gui_win64") && !
     unlet s:tmuxversion
 endif
 
-if executable("latexmk")
-    let g:rplugin_has_latexmk = 1
-else
-    let g:rplugin_has_latexmk = 0
-endif
-
 " Start with an empty list of objects in the workspace
 let g:rplugin_globalenvlines = []
 
diff --git a/r-plugin/windows.vim b/r-plugin/windows.vim
index 3858780..bd176d7 100644
--- a/r-plugin/windows.vim
+++ b/r-plugin/windows.vim
@@ -3,13 +3,6 @@
 let g:rplugin_sumatra_path = ""
 let g:rplugin_python_initialized = 0
 
-" Vim and R must have the same architecture
-if has("win64")
-    let g:vimrplugin_i386 = 0
-else
-    let g:vimrplugin_i386 = 1
-endif
-
 call RSetDefaultValue("g:vimrplugin_sleeptime", 100)
 let g:rplugin_sleeptime = g:vimrplugin_sleeptime . 'm'
 

From fd2230c1cdb831546b3184e1a2918819730c7480 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sat, 17 Jan 2015 11:14:21 -0500
Subject: [PATCH 0906/1050] Fix bugs when running MacVim - Make the
 communication from vimcom to Vim work. - Support SyncTeX with Skim. - Make
 the option to run R in external terminal work. - Make the Vim application of
 MacVim run inside Tmux session.

- Also: Do not run latexmk by default on Windows because I couldn't
  discover the correct command line.
---
 doc/r-plugin.txt            | 55 ++++++++++++++++++++++++++-----------
 ftplugin/rnoweb_rplugin.vim | 22 +++++++++++----
 r-plugin/common_global.vim  | 55 ++++++++++++++++++++++++-------------
 r-plugin/osx.vim            |  4 ---
 4 files changed, 91 insertions(+), 45 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 71abc81..c3a8cd1 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -88,7 +88,7 @@ Vim-R-plugin (see |vimrplugin_source|).
       - Send commands with the object under cursor as argument.
       - Call R's `help()` with the object under cursor as argument.
       - Syntax highlighting of the Object Browser.
-  * SyncTeX support on Linux and Windows.
+  * SyncTeX support.
   * Most of the plugin's behavior is customizable.
 
 For screenshots see: http://www.lepem.ufc.br/jaa/vim-r-plugin.html
@@ -1041,16 +1041,10 @@ The vimcom library is started with the state `busy`.
 ------------------------------------------------------------------------------
 							*r-plugin-SyncTeX-win*
 							*r-plugin-SyncTeX-mac*
-5.8. SyncTeX support issues~
-
-There is no SyncTeX support for Mac OS X. The Skim pdf viewer has support for
-SyncTeX, but the Vim-R-plugin is not ready to communicate with it. If you can,
-please write the necessary code to support Skim and submit it as a push
-request on github: https://github.com/jcfaria/Vim-R-plugin
+5.8. SyncTeX on Windows~
 
 On Windows, backward search with Sumatra pop ups a console window (`vim`
-running the required --remote-expr command) and the GVim window is not brougth
-to the foreground.
+running the required --remote-expr command).
 
 
 ------------------------------------------------------------------------------
@@ -1215,6 +1209,7 @@ is running:
 |vimrplugin_specialplot|       Do `vim.plot()` instead of `plot()`
 |vimrplugin_maxdeparse|        Argument to R `source()` function
 |vimrplugin_latexcmd|          Command to run on .tex files
+|vimrplugin_latexmk|           Define wether `latexmk` should be run
 |vimrplugin_sweaveargs|        Arguments do `Sweave()`
 |vimrplugin_rmd_environment|   Environment in which to save evaluated rmd code
 |vimrplugin_never_unmake_menu| Do not unmake the menu when switching buffers
@@ -1610,23 +1605,32 @@ Example:
 ------------------------------------------------------------------------------
 						       *vimrplugin_sweaveargs*
 						       *vimrplugin_latexcmd*
+						       *vimrplugin_latexmk*
 6.17. LaTeX command~
 
-The vimcom package calls
+To produce a pdf document from the .tex file generated by either `Sweave()` or
+`knit()` command, if vimrplugin_latexmk = 1 and both `latexmk` and `perl`
+(which is required to run `latexmk`) are installed and in the path, the vimcom
+package calls:
 >
    latexmk -pdflatex="pdflatex -file-line-error -synctex=1" -pdf
 <
-to produce a pdf document from the .tex file generated by either `Sweave()` or
-`knit()` command. If either `latexmk` or `perl` (which is required to run
-`latexmk`) is not installed and in the path, it calls `pdflatex`. You can use
-the option vimrplugin_latexcmd to change this behavior. Examples:
+Otherwise, it calls:
+>
+   pdflatex -file-line-error -synctex=1
+<
+You can use the options vimrplugin_latexcmd and vimrplugin_latexmk to change
+this behavior. Examples:
 >
+   let vimrplugin_latexmk = 0
    let vimrplugin_latexcmd = "latex"
    let vimrplugin_latexcmd = 'latexmk -pdf -pdflatex="xelatex %O -synctex=1 %S"'
 <
+By default, vimrplugin_latexmk is 0 on Windows and 1 on other systems.
 If you want to pass arguments do the `Sweave()` function, set the value of the
 vimrplugin_sweaveargs variable.
 
+
 ------------------------------------------------------------------------------
 						  *vimrplugin_rmd_environment*
 6.18. Rmd environment~
@@ -1972,6 +1976,7 @@ Note: If the PDF document is already open the first time that you jump to it,
 and if Okular was not started with the `--unique` argument, another instance
 of Okular will be started.
 
+
 ------------------------------------------------------------------------------
 6.33.3 Zathura configuration~
 
@@ -1984,6 +1989,20 @@ for the first time, it will start, but will not jump to desired line; you have
 to press gp again.
 
 
+------------------------------------------------------------------------------
+6.33.4 Skim with MacVim configuration~
+
+You have to configure Skim to call MacVim during backward searches.
+In Skim click in the drop down menu and fill the fields:
+>
+   Skim
+   Settings
+   Sync
+   Preset: Custom
+   Command: /path/to/MacVim/mvim
+   Arguments: --remote-expr "SyncTeX_backward('%file', %line)"
+<
+
 ------------------------------------------------------------------------------
                                                        *vimrplugin_vim_window*
 				                       *vimrplugin_synctex*
@@ -2776,7 +2795,7 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details.
 							       *r-plugin-news*
 10. News~
 
-1.1.1 (2015-01-15)
+1.2 (2015-01-16)
 
  * Remove support for Neovim. See: https://github.com/jalvesaq/Nvim-R
 
@@ -2786,6 +2805,8 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details.
 
  * Change commands gn and gN to gn and gN.
 
+ * Change default value of vimrplugin_openpdf to 2.
+
  * Replace option vimrplugin_external_ob with vimrplugin_tmux_ob.
 
  * Rename vimrplugin_permanent_libs to vimrplugin_start_libs.
@@ -2796,7 +2817,9 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details.
 
  * No longer require +python feature; require +libcall instead.
 
- * Support for SyncTeX on Windows.
+ * Support for SyncTeX on Windows and Mac OS X.
+
+ * New option: vimrplugin_latexmk
 
 1.1 (2014-11-13)
 
diff --git a/ftplugin/rnoweb_rplugin.vim b/ftplugin/rnoweb_rplugin.vim
index 2d54937..1467c8d 100644
--- a/ftplugin/rnoweb_rplugin.vim
+++ b/ftplugin/rnoweb_rplugin.vim
@@ -13,12 +13,17 @@ endif
 " after the global ones:
 runtime r-plugin/common_buffer.vim
 
+if has("win32") || has("win64")
+    call RSetDefaultValue("g:vimrplugin_latexmk", 0)
+else
+    call RSetDefaultValue("g:vimrplugin_latexmk", 1)
+endif
 if !exists("g:rplugin_has_latexmk")
-  if executable("latexmk") && executable("perl")
-    let g:rplugin_has_latexmk = 1
-  else
-    let g:rplugin_has_latexmk = 0
-  endif
+    if g:vimrplugin_latexmk && executable("latexmk") && executable("perl")
+	let g:rplugin_has_latexmk = 1
+    else
+	let g:rplugin_has_latexmk = 0
+    endif
 endif
 
 function! RWriteChunk()
@@ -438,9 +443,14 @@ function! SyncTeX_backward(fname, ln)
     let rnwbn = substitute(rnwf, '.*/', '', '')
     let rnwf = substitute(rnwf, '^\./', '', '')
 
-    if GoToBuf(rnwbn, rnwf, basedir, rnwln) && g:rplugin_has_wmctrl
+    if GoToBuf(rnwbn, rnwf, basedir, rnwln)
+	if g:rplugin_has_wmctrl
         call system("wmctrl -xa " . g:vimrplugin_vim_window)
+	elseif has("gui_running")
+	    call foreground()
     endif
+    endif
+
 endfunction
 
 function! SyncTeX_forward(...)
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index f212ebf..2f218e8 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -699,11 +699,20 @@ function StartR_ExternalTerm(rcmd)
 
     call system("tmux has-session -t " . g:rplugin_tmuxsname)
     if v:shell_error
-        if g:rplugin_termcmd =~ "gnome-terminal" || g:rplugin_termcmd =~ "xfce4-terminal" || g:rplugin_termcmd =~ "terminal" || g:rplugin_termcmd =~ "iterm"
-            let opencmd = printf("%s 'tmux -2 %s new-session -s %s \"%s\"' &", g:rplugin_termcmd, tmuxcnf, g:rplugin_tmuxsname, rcmd)
-        else
-            let opencmd = printf("%s tmux -2 %s new-session -s %s \"%s\" &", g:rplugin_termcmd, tmuxcnf, g:rplugin_tmuxsname, rcmd)
-        endif
+	if g:rplugin_is_darwin
+	    let $VIM_BINARY_PATH = substitute($VIMRUNTIME, "/MacVim.app/Contents/.*", "", "") . "/MacVim.app/Contents/MacOS/Vim"
+	    let rcmd = "VIM_BINARY_PATH=" . substitute($VIM_BINARY_PATH, ' ', '\\ ', 'g') . ' TERM=screen-256color ' . rcmd
+	    let opencmd = printf("tmux -2 %s new-session -s %s '%s'", tmuxcnf, g:rplugin_tmuxsname, rcmd)
+	    call writefile(["#!/bin/sh", opencmd], $VIMRPLUGIN_TMPDIR . "/openR")
+	    call system("chmod +x '" . $VIMRPLUGIN_TMPDIR . "/openR'")
+	    let opencmd = "open '" . $VIMRPLUGIN_TMPDIR . "/openR'"
+	else
+	    if g:rplugin_termcmd =~ "gnome-terminal" || g:rplugin_termcmd =~ "xfce4-terminal" || g:rplugin_termcmd =~ "terminal" || g:rplugin_termcmd =~ "iterm"
+		let opencmd = printf("%s 'tmux -2 %s new-session -s %s \"%s\"' &", g:rplugin_termcmd, tmuxcnf, g:rplugin_tmuxsname, rcmd)
+	    else
+		let opencmd = printf("%s tmux -2 %s new-session -s %s \"%s\" &", g:rplugin_termcmd, tmuxcnf, g:rplugin_tmuxsname, rcmd)
+	    endif
+	endif
     else
         if g:rplugin_termcmd =~ "gnome-terminal" || g:rplugin_termcmd =~ "xfce4-terminal" || g:rplugin_termcmd =~ "terminal" || g:rplugin_termcmd =~ "iterm"
             let opencmd = printf("%s 'tmux -2 %s attach-session -d -t %s' &", g:rplugin_termcmd, tmuxcnf, g:rplugin_tmuxsname)
@@ -739,15 +748,7 @@ endfunction
 function StartR(whatr)
     if has("gui_macvim") && v:servername != ""
         let $VIMEDITOR_SVRNM = "MacVim_" . v:servername
-        let $VIM_BINARY_PATH = "mvim"
-        " Try to find Vim binary (code adapted from mvim script):
-        for du in [ '~/Applications', '~/Applications/vim', '/Applications', '/Applications/vim', '/Applications/Utilities', '/Applications/Utilities/vim' ]
-            let de = expand(du)
-            if isdirectory(de . "/MacVim.app")
-                let $VIM_BINARY_PATH = de . "/MacVim.app/Contents/MacOS/Vim"
-                break
-            endif
-        endfor
+	let $VIM_BINARY_PATH = substitute($VIMRUNTIME, "/MacVim.app/Contents/.*", "", "") . "/MacVim.app/Contents/MacOS/Vim"
     elseif !has("clientserver")
         let $VIMEDITOR_SVRNM = "NoClientServer"
     elseif v:servername == ""
@@ -917,8 +918,8 @@ function WaitVimComStart()
         let g:rplugin_vimcom_home = vr[1]
         let g:rplugin_vimcomport = vr[2]
         let g:rplugin_r_pid = vr[3]
-        if g:rplugin_vimcom_version != "1.1.18"
-            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.1.18.')
+        if g:rplugin_vimcom_version != "1.1.19"
+            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.1.19.')
             sleep 1
         endif
         if has("win32")
@@ -1048,7 +1049,14 @@ function StartObjBrowser_Tmux()
         let obsname = " "
     endif
 
-    let cmd = "tmux split-window -h -l " . panewidth . " -t " . obpane . ' "vim ' . obsname . " -c 'source " . substitute(objbrowserfile, ' ', '\\ ', 'g') . "'" . '"'
+    if g:rplugin_is_darwin && has("gui_macvim")
+	let vimexec = substitute($VIMRUNTIME, "/MacVim.app/Contents/.*", "", "") . "/MacVim.app/Contents/MacOS/Vim"
+        let vimexec = substitute(vimexec, ' ', '\\ ', 'g')
+    else
+        let vimexec = "vim"
+    endif
+
+    let cmd = "tmux split-window -h -l " . panewidth . " -t " . obpane . ' "' . vimexec . ' ' . obsname . " -c 'source " . substitute(objbrowserfile, ' ', '\\ ', 'g') . "'" . '"'
     let rlog = system(cmd)
     if v:shell_error
         let rlog = substitute(rlog, '\n', ' ', 'g')
@@ -2340,10 +2348,12 @@ function ROpenPDF(path)
             silent exe '!start "' . g:rplugin_sumatra_path . '" -reuse-instance -inverse-search "vim --servername ' . v:servername . " --remote-expr SyncTeX_backward('\\%f',\\%l)" . '" "' . basenm . '.pdf"'
             exe "cd " . substitute(olddir, ' ', '\\ ', 'g')
             return
+	elseif g:rplugin_pdfviewer == "skim"
+	    call system(g:macvim_skim_app_path . '/Contents/MacOS/Skim "' . basenm . '.pdf" 2> /dev/null >/dev/null &')
         else
             let pcmd = g:rplugin_pdfviewer . " '" . pdfpath . "' 2>/dev/null >/dev/null &"
-        endif
         call system(pcmd)
+        endif
         if g:rplugin_has_wmctrl
             call system("wmctrl -a '" . basenm . ".pdf'")
         endif
@@ -2877,7 +2887,11 @@ else
         let g:rplugin_tmpdir = substitute(g:rplugin_tmpdir, "\\", "/", "g")
     else
         if isdirectory($TMPDIR)
+	    if $TMPDIR =~ "/$"
+		let g:rplugin_tmpdir = $TMPDIR . "r-plugin-" . g:rplugin_userlogin
+	    else
             let g:rplugin_tmpdir = $TMPDIR . "/r-plugin-" . g:rplugin_userlogin
+	    endif
         elseif isdirectory("/tmp")
             let g:rplugin_tmpdir = "/tmp/r-plugin-" . g:rplugin_userlogin
         else
@@ -2901,7 +2915,7 @@ call RSetDefaultValue("g:vimrplugin_assign",            1)
 call RSetDefaultValue("g:vimrplugin_assign_map",    "'_'")
 call RSetDefaultValue("g:vimrplugin_rnowebchunk",       1)
 call RSetDefaultValue("g:vimrplugin_strict_rst",        1)
-call RSetDefaultValue("g:vimrplugin_openpdf",           0)
+call RSetDefaultValue("g:vimrplugin_openpdf",           2)
 call RSetDefaultValue("g:vimrplugin_synctex",           1)
 call RSetDefaultValue("g:vimrplugin_openhtml",          0)
 call RSetDefaultValue("g:vimrplugin_Rterm",             0)
@@ -3017,6 +3031,9 @@ if g:rplugin_is_darwin
     else
         call RSetDefaultValue("g:vimrplugin_applescript", 0)
     endif
+    if !exists("g:macvim_skim_app_path")
+        let g:macvim_skim_app_path = '/Applications/Skim.app'
+    endif
 else
     let g:vimrplugin_applescript = 0
 endif
diff --git a/r-plugin/osx.vim b/r-plugin/osx.vim
index b640c01..e5a759d 100644
--- a/r-plugin/osx.vim
+++ b/r-plugin/osx.vim
@@ -50,7 +50,3 @@ function SendCmdToR_OSX(cmd)
     return 1
 endfunction
 
-if !exists(g:macvim_skim_app_path)
-    let g:macvim_skim_app_path = '/Applications/Skim.app'
-endif
-

From 547c4b33d4562b286d34fed253b1761ee8b25b0b Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sat, 17 Jan 2015 23:18:24 -0500
Subject: [PATCH 0907/1050] Minor changes  - Document that Windows sleeptime
 should be given in milliseconds.  - Set environment variable VIM_SLEEPTIME to
 be read by libVimR.dll.  - Remove tab spaces from code indentation.

---
 Makefile                   |   2 +-
 doc/r-plugin.txt           |  35 +++++++-----
 ftplugin/rbrowser.vim      |  10 ++--
 r-plugin/common_global.vim | 108 ++++++++++++++++---------------------
 r-plugin/windows.vim       |  11 ++++
 5 files changed, 83 insertions(+), 83 deletions(-)

diff --git a/Makefile b/Makefile
index c8ca34e..556d36f 100644
--- a/Makefile
+++ b/Makefile
@@ -22,7 +22,7 @@
 
 
 PLUGINHOME=`pwd`
-PLUGINVERSION=1.1.1
+PLUGINVERSION=1.2
 DEBIANTIME=`date -R`
 PLUGINRELEASEDATE=`date +"%Y-%m-%d"`
 VIM2HTML=/usr/local/share/vim/vim74/doc/vim2html.pl 
diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index c3a8cd1..1887d0b 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -5,7 +5,7 @@
 Authors: Jakson A. Aquino   
          Jose Claudio Faria 
 
-Version: 1.1.1
+Version: 1.2
 For Vim version 7.4
 
  1. Overview                                    |r-plugin-overview|
@@ -109,9 +109,6 @@ The installation instructions are split in four sections:
 
 If you are using Windows, jump to section 3.2.
 
-If you are an unexperienced Vim user, start a terminal emulator and type in
-it: `vimtutor`
-
 Before installing the plugin, you should install its dependencies:
 
    Depends:~
@@ -233,9 +230,6 @@ If you want to uninstall the plugin, do
 ------------------------------------------------------------------------------
 3.2. Instructions for Windows ~
 
-Note: This version was not tested on Windows. If it does not work well in your
-system, please try version 1.0.
-
 Before installing the plugin, you should install several external
 dependencies:
 
@@ -328,6 +322,9 @@ Did you see the message "VimCom port not found"? This means that R is not
 running, the vimcom package is not installed (or is installed but is not
 loaded), or R was not started by Vim.
 
+If R takes more than 5 seconds to load, you should adjust the value of
+|vimrplugin_vimcom_wait|.
+
 
 ------------------------------------------------------------------------------
 3.4. Optional steps~
@@ -1082,6 +1079,8 @@ When Vim cannot receive messages, the result is:
      omnicompletion are not immediately updated after you load a new R
      package. For a workaround, see |vimrplugin_start_libs|.
 
+   * You cannot see R documentation in a Vim buffer.
+
 On Linux you may find Vim binaries without the |clientserver| feature if
 you install packages such as vim-nox on Debian/Ubuntu or vim-enhanced on
 Fedora/Red Hat. If you want to use Vim in a terminal emulator in Fedora/Red
@@ -1183,6 +1182,7 @@ is running:
 
 |vimrplugin_term|              External terminal to be used
 |vimrplugin_term_cmd|          Complete command to open an external terminal
+|vimrplugin_sleeptime|         Delay while sending commands in MS Windows
 |vimrplugin_Rterm|             On Windows, use Rterm.exe
 |vimrplugin_assign|            Convert '_' into ' <- '
 |vimrplugin_assign_map|        Choose what to convert into ' <- '
@@ -1237,6 +1237,9 @@ is running:
 							     *vimrplugin_term*
 6.1. Terminal emulator (Linux/Unix only)~
 
+Note: The options of this section are ignored on Mac OS X, where the command
+`open` is called to run the default application used to run shell scripts.
+
 The plugin uses the first terminal emulator that it finds in the following
 list:
     1. gnome-terminal,
@@ -1270,9 +1273,17 @@ The last argument must be the one which precedes the command to be executed.
 
 
 ------------------------------------------------------------------------------
-							    *vimrplugin_Rterm*
-6.2. Use Rterm.exe on Windows~
+							*vimrplugin_sleeptime*
+							*vimrplugin_Rterm*
+6.2. Options specific to Windows~
 
+
+The plugin gives to R a small amount of time to process the paste command. The
+default value is 100 miliseconds, but you should experiment different values. The
+example show how to adjust the value of sleeptime in your |vimrc|:
+>
+   let vimrplugin_sleeptime = 30
+<
 If you rather prefer to use Rterm.exe than Rgui.exe, you have to set both the
 "Quick Edit Mode" and the "Insert mode" on either the Windows 7 PowerShell or
 the Windows XP Command Prompt (click on the title bar and choose
@@ -2795,18 +2806,18 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details.
 							       *r-plugin-news*
 10. News~
 
-1.2 (2015-01-16)
+1.2 (2015-01-17)
 
  * Remove support for Neovim. See: https://github.com/jalvesaq/Nvim-R
 
- * Remove option vimrplugin_sleeptime.
-
  * Remove command :RpluginConfig.
 
  * Change commands gn and gN to gn and gN.
 
  * Change default value of vimrplugin_openpdf to 2.
 
+ * Options vimrplugin_sleeptime now should be in miliseconds.
+
  * Replace option vimrplugin_external_ob with vimrplugin_tmux_ob.
 
  * Rename vimrplugin_permanent_libs to vimrplugin_start_libs.
diff --git a/ftplugin/rbrowser.vim b/ftplugin/rbrowser.vim
index ba18256..44e5006 100644
--- a/ftplugin/rbrowser.vim
+++ b/ftplugin/rbrowser.vim
@@ -55,7 +55,7 @@ function! UpdateOB(what)
     endif
     let g:rplugin_upobcnt = 1
 
-    let g:rplugin_switchedbuf = 0
+    let rplugin_switchedbuf = 0
     if g:vimrplugin_tmux_ob == 0
         redir => s:bufl
         silent buffers
@@ -68,7 +68,7 @@ function! UpdateOB(what)
             let savesb = &switchbuf
             set switchbuf=useopen,usetab
             sil noautocmd sb Object_Browser
-            let g:rplugin_switchedbuf = 1
+            let rplugin_switchedbuf = 1
         endif
     endif
 
@@ -95,7 +95,7 @@ function! UpdateOB(what)
         setlocal nomodifiable
     endif
     redraw
-    if g:rplugin_switchedbuf
+    if rplugin_switchedbuf
         exe "sil noautocmd sb " . g:rplugin_curbuf
         exe "set switchbuf=" . savesb
     endif
@@ -127,10 +127,6 @@ function! RBrowserDoubleClick()
         endif
         call SendToVimCom("\006" . key)
     endif
-    if v:servername == "" || has("win32") || has("win64")
-        sleep 50m " R needs some time to write the file.
-        call UpdateOB("both")
-    endif
 endfunction
 
 function! RBrowserRightClick()
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 2f218e8..2d76bf9 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -699,21 +699,25 @@ function StartR_ExternalTerm(rcmd)
 
     call system("tmux has-session -t " . g:rplugin_tmuxsname)
     if v:shell_error
-	if g:rplugin_is_darwin
-	    let $VIM_BINARY_PATH = substitute($VIMRUNTIME, "/MacVim.app/Contents/.*", "", "") . "/MacVim.app/Contents/MacOS/Vim"
-	    let rcmd = "VIM_BINARY_PATH=" . substitute($VIM_BINARY_PATH, ' ', '\\ ', 'g') . ' TERM=screen-256color ' . rcmd
-	    let opencmd = printf("tmux -2 %s new-session -s %s '%s'", tmuxcnf, g:rplugin_tmuxsname, rcmd)
-	    call writefile(["#!/bin/sh", opencmd], $VIMRPLUGIN_TMPDIR . "/openR")
-	    call system("chmod +x '" . $VIMRPLUGIN_TMPDIR . "/openR'")
-	    let opencmd = "open '" . $VIMRPLUGIN_TMPDIR . "/openR'"
-	else
-	    if g:rplugin_termcmd =~ "gnome-terminal" || g:rplugin_termcmd =~ "xfce4-terminal" || g:rplugin_termcmd =~ "terminal" || g:rplugin_termcmd =~ "iterm"
-		let opencmd = printf("%s 'tmux -2 %s new-session -s %s \"%s\"' &", g:rplugin_termcmd, tmuxcnf, g:rplugin_tmuxsname, rcmd)
-	    else
-		let opencmd = printf("%s tmux -2 %s new-session -s %s \"%s\" &", g:rplugin_termcmd, tmuxcnf, g:rplugin_tmuxsname, rcmd)
-	    endif
-	endif
+        if g:rplugin_is_darwin
+            let $VIM_BINARY_PATH = substitute($VIMRUNTIME, "/MacVim.app/Contents/.*", "", "") . "/MacVim.app/Contents/MacOS/Vim"
+            let rcmd = "VIM_BINARY_PATH=" . substitute($VIM_BINARY_PATH, ' ', '\\ ', 'g') . ' TERM=screen-256color ' . rcmd
+            let opencmd = printf("tmux -2 %s new-session -s %s '%s'", tmuxcnf, g:rplugin_tmuxsname, rcmd)
+            call writefile(["#!/bin/sh", opencmd], $VIMRPLUGIN_TMPDIR . "/openR")
+            call system("chmod +x '" . $VIMRPLUGIN_TMPDIR . "/openR'")
+            let opencmd = "open '" . $VIMRPLUGIN_TMPDIR . "/openR'"
+        else
+            if g:rplugin_termcmd =~ "gnome-terminal" || g:rplugin_termcmd =~ "xfce4-terminal" || g:rplugin_termcmd =~ "terminal" || g:rplugin_termcmd =~ "iterm"
+                let opencmd = printf("%s 'tmux -2 %s new-session -s %s \"%s\"' &", g:rplugin_termcmd, tmuxcnf, g:rplugin_tmuxsname, rcmd)
+            else
+                let opencmd = printf("%s tmux -2 %s new-session -s %s \"%s\" &", g:rplugin_termcmd, tmuxcnf, g:rplugin_tmuxsname, rcmd)
+            endif
+        endif
     else
+        if g:rplugin_is_darwin
+            call RWarningMsg("Tmux session with R is already running")
+            return
+        endif
         if g:rplugin_termcmd =~ "gnome-terminal" || g:rplugin_termcmd =~ "xfce4-terminal" || g:rplugin_termcmd =~ "terminal" || g:rplugin_termcmd =~ "iterm"
             let opencmd = printf("%s 'tmux -2 %s attach-session -d -t %s' &", g:rplugin_termcmd, tmuxcnf, g:rplugin_tmuxsname)
         else
@@ -734,12 +738,12 @@ endfunction
 
 function IsSendCmdToRFake()
     if string(g:SendCmdToR) != "function('SendCmdToR_fake')"
-	if exists("g:maplocalleader")
-	    call RWarningMsg("As far as I know, R is already running. Did you quit it from within Vim (" . g:maplocalleader . "rq if not remapped)?")
-	else
-	    call RWarningMsg("As far as I know, R is already running. Did you quit it from within Vim (\\rq if not remapped)?")
-	endif
-	return 1
+        if exists("g:maplocalleader")
+            call RWarningMsg("As far as I know, R is already running. Did you quit it from within Vim (" . g:maplocalleader . "rq if not remapped)?")
+        else
+            call RWarningMsg("As far as I know, R is already running. Did you quit it from within Vim (\\rq if not remapped)?")
+        endif
+        return 1
     endif
     return 0
 endfunction
@@ -748,7 +752,7 @@ endfunction
 function StartR(whatr)
     if has("gui_macvim") && v:servername != ""
         let $VIMEDITOR_SVRNM = "MacVim_" . v:servername
-	let $VIM_BINARY_PATH = substitute($VIMRUNTIME, "/MacVim.app/Contents/.*", "", "") . "/MacVim.app/Contents/MacOS/Vim"
+        let $VIM_BINARY_PATH = substitute($VIMRUNTIME, "/MacVim.app/Contents/.*", "", "") . "/MacVim.app/Contents/MacOS/Vim"
     elseif !has("clientserver")
         let $VIMEDITOR_SVRNM = "NoClientServer"
     elseif v:servername == ""
@@ -824,7 +828,7 @@ function StartR(whatr)
                 endif
                 return
             elseif IsSendCmdToRFake()
-		return
+                return
             endif
         else
             if g:vimrplugin_restart
@@ -1050,7 +1054,7 @@ function StartObjBrowser_Tmux()
     endif
 
     if g:rplugin_is_darwin && has("gui_macvim")
-	let vimexec = substitute($VIMRUNTIME, "/MacVim.app/Contents/.*", "", "") . "/MacVim.app/Contents/MacOS/Vim"
+        let vimexec = substitute($VIMRUNTIME, "/MacVim.app/Contents/.*", "", "") . "/MacVim.app/Contents/MacOS/Vim"
         let vimexec = substitute(vimexec, ' ', '\\ ', 'g')
     else
         let vimexec = "vim"
@@ -1097,16 +1101,6 @@ endfunction
 
 function StartObjBrowser_Vim()
     let g:RBrOpenCloseLs = function("RBrOpenCloseLs_Vim")
-
-    if has("win32") || has("win64")
-	" The vimcom server will stop working if starting the Object
-	" Browser is the first thing the user does.
-	"if !exists("g:rplugin_liblist_filled")
-	"    call RWarningMsg("Please, try again after sending at least one line of code to the R Console.!")
-	"    return
-	"endif
-    endif
-
     let wmsg = ""
     if v:servername == ""
         if g:rplugin_ob_warn_shown == 0
@@ -1838,19 +1832,14 @@ function RSendPartOfLine(direction, correctpos)
 endfunction
 
 " Clear the console screen
-function RClearConsole()
-    if (has("win32") || has("win64"))
-        if g:vimrplugin_libcall_send
-            if !g:vimrplugin_Rterm
-                let repl = libcall(g:rplugin_vimcom_lib, "RClearConsole", "Rgui")
-            endif
-        else
-            Py RClearConsolePy()
-        endif
-        if repl != "OK"
-            call RWarningMsg(repl)
+function RClearConsole(...)
+    if has("win32") || has("win64")
+        if !g:vimrplugin_Rterm
+            let repl = libcall(g:rplugin_vimcom_lib, "RClearConsole", "RConsole")
+            exe "sleep " . g:rplugin_sleeptime
+            call foreground()
         endif
-    else
+    elseif !g:vimrplugin_applescript
         call g:SendCmdToR("\014")
     endif
 endfunction
@@ -2348,8 +2337,8 @@ function ROpenPDF(path)
             silent exe '!start "' . g:rplugin_sumatra_path . '" -reuse-instance -inverse-search "vim --servername ' . v:servername . " --remote-expr SyncTeX_backward('\\%f',\\%l)" . '" "' . basenm . '.pdf"'
             exe "cd " . substitute(olddir, ' ', '\\ ', 'g')
             return
-	elseif g:rplugin_pdfviewer == "skim"
-	    call system(g:macvim_skim_app_path . '/Contents/MacOS/Skim "' . basenm . '.pdf" 2> /dev/null >/dev/null &')
+        elseif g:rplugin_pdfviewer == "skim"
+            call system(g:macvim_skim_app_path . '/Contents/MacOS/Skim "' . basenm . '.pdf" 2> /dev/null >/dev/null &')
         else
             let pcmd = g:rplugin_pdfviewer . " '" . pdfpath . "' 2>/dev/null >/dev/null &"
         call system(pcmd)
@@ -2819,6 +2808,7 @@ function RVimLeave()
     call delete(g:rplugin_tmpdir . "/vimbol_finished")
     call delete(g:rplugin_tmpdir . "/vimcom_running_" . $VIMINSTANCEID)
     call delete(g:rplugin_tmpdir . "/rconsole_hwnd_" . $VIMRPLUGIN_SECRET)
+    call delete(g:rplugin_tmpdir . "/openR'")
 endfunction
 
 function SetRPath()
@@ -2887,11 +2877,11 @@ else
         let g:rplugin_tmpdir = substitute(g:rplugin_tmpdir, "\\", "/", "g")
     else
         if isdirectory($TMPDIR)
-	    if $TMPDIR =~ "/$"
-		let g:rplugin_tmpdir = $TMPDIR . "r-plugin-" . g:rplugin_userlogin
-	    else
-            let g:rplugin_tmpdir = $TMPDIR . "/r-plugin-" . g:rplugin_userlogin
-	    endif
+            if $TMPDIR =~ "/$"
+                let g:rplugin_tmpdir = $TMPDIR . "r-plugin-" . g:rplugin_userlogin
+            else
+                let g:rplugin_tmpdir = $TMPDIR . "/r-plugin-" . g:rplugin_userlogin
+            endif
         elseif isdirectory("/tmp")
             let g:rplugin_tmpdir = "/tmp/r-plugin-" . g:rplugin_userlogin
         else
@@ -2933,7 +2923,6 @@ call RSetDefaultValue("g:vimrplugin_routnotab",         0)
 call RSetDefaultValue("g:vimrplugin_editor_w",         66)
 call RSetDefaultValue("g:vimrplugin_help_w",           46)
 call RSetDefaultValue("g:vimrplugin_objbr_w",          40)
-call RSetDefaultValue("g:vimrplugin_libcall_send",      1)
 call RSetDefaultValue("g:vimrplugin_i386",              0)
 call RSetDefaultValue("g:vimrplugin_vimcom_wait",    5000)
 call RSetDefaultValue("g:vimrplugin_show_args",         0)
@@ -3109,20 +3098,13 @@ if exists("g:vimrplugin_term")
         let g:vimrplugin_term = "xterm"
     endif
 endif
-if has("win32") || has("win64") || g:vimrplugin_applescript || g:rplugin_do_tmux_split
+if has("win32") || has("win64") || g:rplugin_is_darwin || g:rplugin_do_tmux_split
     " No external terminal emulator will be called, so any value is good
     let g:vimrplugin_term = "xterm"
 endif
 if !exists("g:vimrplugin_term")
-    let s:terminals = ['gnome-terminal', 'konsole', 'xfce4-terminal', 'terminal',
-                \ 'Eterm', 'rxvt', 'urxvt', 'aterm', 'roxterm', 'terminator', 'lxterminal']
-    if g:rplugin_is_darwin
-        let s:terminals = ['/Applications/Utilities/iTerm.app/Contents/MacOS/iTerm',
-                    \ '/Applications/Utilities/Terminal.app/Contents/MacOS/Terminal',
-                    \ 'xterm'] + s:terminals
-    else
-        let s:terminals += ['xterm']
-    endif
+    let s:terminals = ['gnome-terminal', 'konsole', 'xfce4-terminal', 'terminal', 'Eterm',
+                \ 'rxvt', 'urxvt', 'aterm', 'roxterm', 'terminator', 'lxterminal', 'xterm']
     for s:term in s:terminals
         if executable(s:term)
             let g:vimrplugin_term = s:term
diff --git a/r-plugin/windows.vim b/r-plugin/windows.vim
index bd176d7..a5cc353 100644
--- a/r-plugin/windows.vim
+++ b/r-plugin/windows.vim
@@ -4,7 +4,18 @@ let g:rplugin_sumatra_path = ""
 let g:rplugin_python_initialized = 0
 
 call RSetDefaultValue("g:vimrplugin_sleeptime", 100)
+
+" Avoid invalid values defined by the user
+exe "let s:sleeptimestr = " . '"' . g:vimrplugin_sleeptime . '"'
+let s:sleeptime = str2nr(s:sleeptimestr)
+if s:sleeptime < 1 || s:sleeptime > 1000
+    let g:vimrplugin_sleeptime = 100
+endif
+unlet s:sleeptimestr
+unlet s:sleeptime
+
 let g:rplugin_sleeptime = g:vimrplugin_sleeptime . 'm'
+exe 'let $VIM_SLEEPTIME = ' . '"' . g:vimrplugin_sleeptime . '"'
 
 if g:vimrplugin_Rterm
     let b:rplugin_R = "Rgui.exe"

From 313ae21a9f42416017ea3fd6fa4c49f5ead3e860 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sun, 18 Jan 2015 15:52:07 -0500
Subject: [PATCH 0908/1050] Version 1.2.

---
 doc/r-plugin.txt            | 292 +++++++++++++++++-------------------
 ftplugin/rmd_rplugin.vim    |   1 -
 ftplugin/rnoweb_rplugin.vim |   4 -
 r-plugin/common_global.vim  |  17 ++-
 r-plugin/gui_running.vim    |  16 +-
 r-plugin/windows.vim        |   6 +-
 6 files changed, 158 insertions(+), 178 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 1887d0b..198ef56 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -97,25 +97,103 @@ For screenshots see: http://www.lepem.ufc.br/jaa/vim-r-plugin.html
 						       *r-plugin-installation*
 3. Installation~
 
-The installation instructions are split in four sections:
+The installation instructions are split in six sections:
 
-   1. Instructions specific for Unix/Linux/OSX
-   2. Instructions specific for Windows
-   3. Troubleshooting
-   4. Optional steps
+   3.1. Preliminary system setup on Windows
+   3.2. Preliminary system setup on Mac OS X
+   3.3. Preliminary system setup on Unix
+   3.4. Plugin installation
+   3.5. Troubleshooting
+   3.6. Optional steps
+
+
+------------------------------------------------------------------------------
+3.1. Preliminary system setup on Windows~
+
+Before installing the plugin, you should install several external
+dependencies:
+
+    * R's version must be >= 3.0.0: http://www.r-project.org/
+
+    * vimcom = 1.2-0: http://www.lepem.ufc.br/jaa/vimcom.html
+
+      Note: If you cannot build vimcom yourself, you will want to
+      download and install the zip file.
+
+    * Vim's version must be >= 7.4: http://www.vim.org/download.php
+
+    * Only if you write Rnoweb code:
+
+       * Sumatra PDF viewer >= 3.0.
+
+       * MikTeX or other LaTeX distribution.
+
+       * Perl (required to run `latexmk`).
+
+Add the following lines to your `Rprofile`:
+>
+   options(vimcom.verbose = 1)
+   library(vimcom)
+<
+If you do not know where your .Rprofile is, do the following command in R
+Console to open it:
+>
+   edit(file = "~/.Rprofile")
+<
 
 ------------------------------------------------------------------------------
-3.1. Instructions for Unix (Linux, OS X, etc.)~
+3.2. Preliminary system setup on Mac OS X~
+
+Before installing the plugin, you should install its dependencies:
+
+   Depends:~
+
+   Cocoa MacVim >= 7.4: https://code.google.com/p/macvim
+
+   R >= 3.0.0: http://www.r-project.org/
+
+   vimcom = 1.2-0: http://www.lepem.ufc.br/jaa/vimcom.html
+
+   Only if you edit Rnoweb files: MacTeX, BasicTeX or other LaTeX system.
+
+If you want to call R.app from MacVim, put in your `~/.Rprofile`:
+>
+   if(interactive()){
+       options(vimcom.verbose = 1) # optional
+       library(vimcom)
+   }
+<
+On Mac OS X, the plugin will use AppleScript to send commands to the R Console
+application unless |vimrplugin_applescript| = 0. In this case, R will run in a
+external terminal emulator. The advantage of running R in a terminal emulator
+is that its output can be colorized by the R package "colorout". If you want
+to try this configuration, install Tmux and the R packages "setwidth" and
+"colorout" (see instructions in section 3.3) and put in your `~/.Rprofile`:
+>
+   if(interactive()){
+       library(colorout)
+       library(setwidth)
+       options(vimcom.verbose = 1) # optional
+       library(vimcom)
+   }
+<
+Note: The plugin is fully functional with MacVim, but the Vim application that
+comes with MacVim does not have the the server side of the 'clientserver'
+feature which is required to have the plugin working properly. If you want to
+run both Vim and R in the same Tmux window in a terminal emulator, you have to
+follow the instructions from section 3.3.
+
 
-If you are using Windows, jump to section 3.2.
+------------------------------------------------------------------------------
+3.3. Preliminary system setup on Unix~
 
 Before installing the plugin, you should install its dependencies:
 
    Depends:~
 
-   Vim, GVim or MacVim >= 7.4: http://www.vim.org/download.php
+   Vim, GVim >= 7.4: http://www.vim.org/download.php
 
-       Note: The Vim-R-plugin requires Vim compiled with |+libcall|,
+      Note: The Vim-R-plugin requires Vim compiled with |+libcall|,
 	    |+clientserver| and |+conceal| features. In Normal mode, do
 	    `:version`  to check if your Vim has these features.
 
@@ -159,7 +237,7 @@ Before installing the plugin, you should install its dependencies:
    installation instructions vary widely and are beyond the scope of this
    documentation.
 
-Put the following lines in your `~/Rprofile`:
+Put the following lines in your `~/.Rprofile`:
 >
    if(interactive()){
        library(colorout)
@@ -168,40 +246,12 @@ Put the following lines in your `~/Rprofile`:
        library(vimcom)
    }
 <
-You need to activate plugins and indentation according to 'filetype'. You
-should have at least the following options at the top or at near the very top
-of your |vimrc| (but below `set` `runtimepath`, if you have set it):
->
-   set nocompatible
-   syntax enable
-   filetype plugin on
-   filetype indent on
-<
-Download the latest version of the plugin from:
-
-    http://www.vim.org/scripts/script.php?script_id=2628
-
-Start a terminal emulator, go to the directory where you have downloaded the
-plugin and type:
->
-   vim Vim-R-plugin.vmb
-<
-Then, in Vim, type:
+Put the following in your `~/.bashrc`:
 >
-   :so %
+   alias vim="vim --servername VIM"
 <
-Press  and the plugin will be installed (because the plugin has many
-files, you have to press the space bar a few times to finish the
-installation). You should, then, quit Vim.
-
-Note: If you need to install the plugin in a non default directory, do
-`:UseVimball` `[path]`. In this case, the configuration of Vim's 'runtimepath'
-must be done before the command "filetype on" in both the system and the user
-|vimrc| files, otherwise, some file types might not be correctly recognized.
-
-The plugin is installed and will be activated next time that you start to edit
-an R script. But you still can improve the plugin performance if you do
-additional configuration mentioned in the paragraphs below.
+Before proceeding, you have to start a new shell session to have the alias
+enabled.
 
 If you start either GVim or Vim in a terminal emulator the plugin will start R
 in a external terminal emulator. If you start Vim inside of a Tmux session,
@@ -214,93 +264,55 @@ If you run Vim in a terminal emulator, it must be started with the argument
 |--servername|. Please, read the section |r-plugin-bash-setup| to know some
 tips on how to configure Bash.
 
-The Vim configuration also may be improved. See some tips at
-|r-plugin-vimrc-setup|.
-
-Note: On Mac OS X, the plugin will use AppleScript to send commands to the R
-Console application unless |vimrplugin_applescript| = 0. Some users have
-reported more luck with iTerm than with the default Mac OS X terminal
-emulator.
-
-If you want to uninstall the plugin, do
->
-   :RmVimball Vim-R-plugin
-<
 
 ------------------------------------------------------------------------------
-3.2. Instructions for Windows ~
-
-Before installing the plugin, you should install several external
-dependencies:
-
-    * R's version must be >= 3.0.0: http://www.r-project.org/
-
-    * vimcom = 1.2-0: http://www.lepem.ufc.br/jaa/vimcom.html
-
-      Note: If you cannot build vimcom yourself, you will want to
-      download and install the zip file.
-
-    * Vim's version must be >= 7.4: http://www.vim.org/download.php
-
-    * Only if you write Rnoweb code:
-
-       * Sumatra PDF viewer >= 3.0.
-
-       * MikTeX or other LaTeX distribution.
+3.4. Plugin installation (instructions for all systems)~
 
-       * Perl (required to run `latexmk`).
-
-Add the following lines to your `Rprofile`:
->
-   options(vimcom.verbose = 1)
-   library(vimcom)
-<
-If you do not know where your .Rprofile is, do the following command in R
-Console to open it:
+You need to activate plugins and indentation according to 'filetype'. You
+should have at least the following options at the top or at near the very top
+of your |vimrc| (but below `set` `runtimepath`, if you have set it):
 >
-   edit(file = "~/.Rprofile")
+   set nocompatible
+   syntax enable
+   filetype plugin on
+   filetype indent on
 <
-You may want to improve the configuration of your |vimrc| for a better use of
-the plugin. Please, see |r-plugin-vimrc-setup|.
-
-Now, download the latest version of `Vim-R-plugin.vmb` from
+Download the latest version of the plugin from:
 
     http://www.vim.org/scripts/script.php?script_id=2628
 
-and open the directory where you have downloaded it, right click on it and
-choose "Edit with Vim".
+If you either are on Windows or prefer to use a graphical interface, start the
+file manager, find the file `Vim-R-plugin.vmb` and open it with GVim or
+MacVim. Otherwise, start a terminal emulator, go to the directory where you
+have downloaded the plugin and type:
 >
+   vim Vim-R-plugin.vmb
+<
 Then, in Vim, type:
 >
    :so %
 <
-Press  and the plugin will be installed (because the plugin has many
-files, you have to press the space bar a few times to finish the
-installation). You should, then, quit Vim.
+Press  to start the installation and press the  bar as many
+times as necessary to finish the installation. You should, then, quit Vim.
 
 Note: If you need to install the plugin in a non default directory, do
 `:UseVimball` `[path]`. In this case, the configuration of Vim's 'runtimepath'
 must be done before the command "filetype on" in both the system and the user
 |vimrc| files, otherwise, some file types might not be correctly recognized.
 
-Start GVim again and edit an R script. You can right click a .R file and
-choose "Edit with Vim" or create a new one with the Normal mode command:
->
-   :e example.R
-<
-If R does not start and you get an error message instead, you may want to
-set the path to your Rgui.exe in your |vimrc|, for example (please adapt to
-your installation)
->
-   let vimrplugin_r_path = 'C:\\Program Files\\R\\R-3.1.2\\bin\\i386'
-<
+The plugin is installed and will be activated next time that you start to edit
+an R script.
+
+You may want to improve the configuration of your |vimrc| for a better use of
+the plugin. Please, see |r-plugin-vimrc-setup|.
+
 If you want to uninstall the plugin, do
 >
    :RmVimball Vim-R-plugin
 <
 
 ------------------------------------------------------------------------------
-3.3. Troubleshooting (if the plugin doesn't work)~
+3.5. Troubleshooting (if the plugin doesn't work)~
 
 Note: The  is '\' by default.
 
@@ -313,6 +325,12 @@ pressing rf should start R.
 Did you see warning messages but they disappeared before you have had time to
 read them? Type the command |:messages| in Normal mode to see them again.
 
+On Windows, if R does not start and you get an error message instead, you may
+want to set the path to your Rgui.exe in your |vimrc|, for example (please
+adapt to your installation):
+>
+   let vimrplugin_r_path = 'C:\\Program Files\\R\\R-3.1.2\\bin\\i386'
+<
 Are you using Debian, Ubuntu or other Debian based Linux distribution? If yes,
 you may prefer to install the Debian package available at:
 
@@ -327,16 +345,16 @@ If R takes more than 5 seconds to load, you should adjust the value of
 
 
 ------------------------------------------------------------------------------
-3.4. Optional steps~
+3.6. Optional steps~
 
-3.4.1 Customize the plugin~
+3.6.1 Customize the plugin~
 
 Please, read the section |r-plugin-options|. Emacs/ESS users should read the
-section Indenting setup (|r-plugin-indenting|) of this document.
+section |r-plugin-indenting| of this document.
 
 
 ------------------------------------------------------------------------------
-3.4.2 Install additional plugins~
+3.6.2 Install additional plugins~
 
 You may be interested in installing additional general plugins to get
 functionality not provided by this file type plugin. ShowMarks and snipMate
@@ -345,13 +363,6 @@ edit Rnoweb files, you may want to try LaTeX-Box for omnicompletion of LaTeX
 code (see |r-plugin-latex-box| for details).
 
 
-------------------------------------------------------------------------------
-3.4.3 Add buttons to GVim~
-
-Please read |r-plugin-toolbar| if you want to add R buttons to GVim's tool
-bar.
-
-
 ==============================================================================
 								*r-plugin-use*
 4. Use~
@@ -443,7 +454,6 @@ Command
   --------------------------------------------------------
   . Sweave (cur file)                                  \sw
   . Sweave and PDF (cur file)                          \sp
-  . Sweave and PDF (cur file, verbose) (Windows)       \sv
   . Sweave, BibTeX and PDF (cur file) (Linux/Unix)     \sb
   --------------------------------------------------------
   . Knit (cur file)                                    \kn
@@ -451,7 +461,6 @@ Command
   . Knit, BibTeX and PDF (cur file) (Linux/Unix)       \kb
   . Knit and Beamer PDF (cur file) (only .Rmd)         \kl
   . Knit and HTML (cur file, verbose) (only .Rmd)      \kh
-  . Knit and PDF (cur file, verbose) (Windows)         \kv
   . Spin (cur file) (only .R)                          \ks
   --------------------------------------------------------
   . Open PDF (cur file)                                \op
@@ -893,7 +902,9 @@ the plugin confuse.
 
 If you need to access Vim in a remote Unix machine through ssh, and if you
 want to get omnicompletion, syntax highlight of function names and the Object
-Browser working properly, then you have to:
+Browser working properly, instead of Vim, it is recommended that you use
+Neovim because it does not require the X Server to be fully functional. You if
+you cannot use Neovim, then you have to:
 
    - Enable X11 Forwarding in the remote machine.
 
@@ -1041,7 +1052,7 @@ The vimcom library is started with the state `busy`.
 5.8. SyncTeX on Windows~
 
 On Windows, backward search with Sumatra pop ups a console window (`vim`
-running the required --remote-expr command).
+running the required --remote-expr command) which quickly disappears.
 
 
 ------------------------------------------------------------------------------
@@ -1183,7 +1194,6 @@ is running:
 |vimrplugin_term|              External terminal to be used
 |vimrplugin_term_cmd|          Complete command to open an external terminal
 |vimrplugin_sleeptime|         Delay while sending commands in MS Windows
-|vimrplugin_Rterm|             On Windows, use Rterm.exe
 |vimrplugin_assign|            Convert '_' into ' <- '
 |vimrplugin_assign_map|        Choose what to convert into ' <- '
 |vimrplugin_rnowebchunk|       Convert '<' into '<<>>=\n@' in Rnoweb files
@@ -1274,29 +1284,17 @@ The last argument must be the one which precedes the command to be executed.
 
 ------------------------------------------------------------------------------
 							*vimrplugin_sleeptime*
-							*vimrplugin_Rterm*
 6.2. Options specific to Windows~
 
 
 The plugin gives to R a small amount of time to process the paste command. The
-default value is 100 miliseconds, but you should experiment different values. The
+default value is 100 milliseconds, but you should experiment different values. The
 example show how to adjust the value of sleeptime in your |vimrc|:
 >
    let vimrplugin_sleeptime = 30
 <
-If you rather prefer to use Rterm.exe than Rgui.exe, you have to set both the
-"Quick Edit Mode" and the "Insert mode" on either the Windows 7 PowerShell or
-the Windows XP Command Prompt (click on the title bar and choose
-"properties"). Then, you should put in your |vimrc|:
->
-   let vimrplugin_Rterm = 1
-<
-Technical details: The plugin copies the code to be sent to R to Windows
-clipboard and, then, sends the key strokes CTRL-V to R Console window.
-However, neither the Windows 7 PowerShell nor the Windows XP Command Prompt
-has a keyboard shortcut to "paste". The solution is to set the "Quick Edit
-Mode" on either PowerShell or Command Prompt and to send a "Right click" to
-it.
+Note: the option vimrplugin_Rterm was disabled because the C code to send
+strings from Vim to Windows PowerShell is not working.
 
 
 ------------------------------------------------------------------------------
@@ -1575,9 +1573,7 @@ or let Tmux set the title automatically. Examples:
 6.14. Integration with AppleScript (OS X only)~
 
 In Mac OS X, the plugin will try to send commands to R gui using AppleScript.
-If you prefer either to run R and Vim in the same terminal emulator split in
-two regions (Vim and R) or to run R in an external terminal emulator, put in
-your |vimrc|:
+If you prefer to run R in an external terminal emulator, put in your |vimrc|:
 >
    let vimrplugin_applescript = 0
 <
@@ -2778,22 +2774,8 @@ Finally, if you want to use vi key bindings in Bash:
 <
 
 ------------------------------------------------------------------------------
-							    *r-plugin-toolbar*
-9.22. Add tool bar icons and hide unused buttons~
-
-If you want to add some R buttons to GVim tool bar download the zip file
-http://www.lepem.ufc.br/jaa/bitmaps.zip and unpack it at either ~/.vim
-(Unix/Linux/Mac OS X) or ~/vimfiles (Windows). You may not see the buttons
-because GVim has too many buttons by default. Then, you may want to edit
-GVim's toolbar and remove the buttons that you never use. Please see the page
-below to know how to hide buttons on the toolbar:
-
-   http://vim.wikia.com/wiki/Hide_toolbar_or_menus_to_see_more_text
 
-
-------------------------------------------------------------------------------
-
-9.23. Integration with GNU Screen, screen plugin, Conque Shell or VimShell~
+9.22. Integration with GNU Screen, screen plugin, Conque Shell or VimShell~
 
 The plugin used to be able to use GNU Screen (through screen plugin), Conque
 Shell or VimShell to send commands to R. This integration was removed on
@@ -2806,12 +2788,14 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details.
 							       *r-plugin-news*
 10. News~
 
-1.2 (2015-01-17)
+1.2 (2015-01-18)
 
  * Remove support for Neovim. See: https://github.com/jalvesaq/Nvim-R
 
  * Remove command :RpluginConfig.
 
+ * Remove option vimrplugin_Rterm.
+
  * Change commands gn and gN to gn and gN.
 
  * Change default value of vimrplugin_openpdf to 2.
diff --git a/ftplugin/rmd_rplugin.vim b/ftplugin/rmd_rplugin.vim
index 210f1f1..de6ea09 100644
--- a/ftplugin/rmd_rplugin.vim
+++ b/ftplugin/rmd_rplugin.vim
@@ -132,7 +132,6 @@ call RCreateMaps("nvi", 'RSetwd',        'rd', ':call RSetWD()')
 " Only .Rmd files use these functions:
 call RCreateMaps("nvi", 'RKnit',          'kn', ':call RKnit()')
 call RCreateMaps("nvi", 'RMakeRmd',       'kr', ':call RMakeRmd("default")')
-call RCreateMaps("nvi", 'RMakeAll',       'ka', ':call RMakeRmd("all")')
 call RCreateMaps("nvi", 'RMakePDFK',      'kp', ':call RMakeRmd("pdf_document")')
 call RCreateMaps("nvi", 'RMakePDFKb',     'kl', ':call RMakeRmd("beamer_presentation")')
 call RCreateMaps("nvi", 'RMakeHTML',      'kh', ':call RMakeRmd("html_document")')
diff --git a/ftplugin/rnoweb_rplugin.vim b/ftplugin/rnoweb_rplugin.vim
index 1467c8d..1bffb43 100644
--- a/ftplugin/rnoweb_rplugin.vim
+++ b/ftplugin/rnoweb_rplugin.vim
@@ -176,10 +176,6 @@ function! RMakePDF(bibtex, knit)
         let pdfcmd = pdfcmd . ", bibtex = TRUE"
     endif
 
-    if a:bibtex == "verbose"
-        let pdfcmd = pdfcmd . ", quiet = FALSE"
-    endif
-
     if g:vimrplugin_openpdf == 0
         let pdfcmd = pdfcmd . ", view = FALSE"
     else
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 2d76bf9..bead03c 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -922,8 +922,8 @@ function WaitVimComStart()
         let g:rplugin_vimcom_home = vr[1]
         let g:rplugin_vimcomport = vr[2]
         let g:rplugin_r_pid = vr[3]
-        if g:rplugin_vimcom_version != "1.1.19"
-            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.1.19.')
+        if g:rplugin_vimcom_version != "1.2.0"
+            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.2.0.')
             sleep 1
         endif
         if has("win32")
@@ -1834,11 +1834,13 @@ endfunction
 " Clear the console screen
 function RClearConsole(...)
     if has("win32") || has("win64")
-        if !g:vimrplugin_Rterm
-            let repl = libcall(g:rplugin_vimcom_lib, "RClearConsole", "RConsole")
-            exe "sleep " . g:rplugin_sleeptime
-            call foreground()
+        if g:vimrplugin_Rterm
+            let repl = libcall(g:rplugin_vimcom_lib, "RClearConsole", "Term")
+        else
+            let repl = libcall(g:rplugin_vimcom_lib, "RClearConsole", "Rgui")
         endif
+        exe "sleep " . g:rplugin_sleeptime
+        call foreground()
     elseif !g:vimrplugin_applescript
         call g:SendCmdToR("\014")
     endif
@@ -2937,6 +2939,9 @@ call RSetDefaultValue("g:vimrplugin_user_maps_only", 0)
 call RSetDefaultValue("g:vimrplugin_latexcmd", "'default'")
 call RSetDefaultValue("g:vimrplugin_rmd_environment", "'.GlobalEnv'")
 
+" The C code in VimCom/src/apps/vimr.c to send strings to RTerm is not working:
+let g:vimrplugin_Rterm = 0
+
 " Look for invalid options
 let objbrplace = split(g:vimrplugin_objbr_place, ",")
 let obpllen = len(objbrplace) - 1
diff --git a/r-plugin/gui_running.vim b/r-plugin/gui_running.vim
index 6c9aa17..d27bdfa 100644
--- a/r-plugin/gui_running.vim
+++ b/r-plugin/gui_running.vim
@@ -93,11 +93,7 @@ function MakeRMenu()
             menu R.Command.-Sep5- 
             call RCreateMenuItem("nvi", 'Command.Sweave\ (cur\ file)', 'RSweave', 'sw', ':call RSweave()')
             call RCreateMenuItem("nvi", 'Command.Sweave\ and\ PDF\ (cur\ file)', 'RMakePDF', 'sp', ':call RMakePDF("nobib", 0)')
-            if has("win32") || has("win64")
-                call RCreateMenuItem("nvi", 'Command.Sweave\ and\ PDF\ (cur\ file,\ verbose)', 'RMakePDF', 'sv', ':call RMakePDF("verbose", 0)')
-            else
-                call RCreateMenuItem("nvi", 'Command.Sweave,\ BibTeX\ and\ PDF\ (cur\ file)', 'RBibTeX', 'sb', ':call RMakePDF("bibtex", 0)')
-            endif
+            call RCreateMenuItem("nvi", 'Command.Sweave,\ BibTeX\ and\ PDF\ (cur\ file)', 'RBibTeX', 'sb', ':call RMakePDF("bibtex", 0)')
         endif
         menu R.Command.-Sep6- 
         if &filetype == "rnoweb"
@@ -107,16 +103,12 @@ function MakeRMenu()
         endif
         if &filetype == "rnoweb" || g:vimrplugin_never_unmake_menu
             call RCreateMenuItem("nvi", 'Command.Knit\ and\ PDF\ (cur\ file)', 'RMakePDFK', 'kp', ':call RMakePDF("nobib", 1)')
-            if has("win32") || has("win64")
-                call RCreateMenuItem("nvi", 'Command.Knit\ and\ PDF\ (cur\ file,\ verbose)', 'RMakePDFKv', 'kv', ':call RMakePDF("verbose", 1)')
-            else
-                call RCreateMenuItem("nvi", 'Command.Knit,\ BibTeX\ and\ PDF\ (cur\ file)', 'RBibTeXK', 'kb', ':call RMakePDF("bibtex", 1)')
-            endif
+            call RCreateMenuItem("nvi", 'Command.Knit,\ BibTeX\ and\ PDF\ (cur\ file)', 'RBibTeXK', 'kb', ':call RMakePDF("bibtex", 1)')
         endif
         if &filetype == "rmd" || g:vimrplugin_never_unmake_menu
-            call RCreateMenuItem("nvi", 'Command.Knit\ and\ PDF\ (cur\ file)', 'RMakePDFK', 'kp', ':call RMakeRmd("pdf")')
+            call RCreateMenuItem("nvi", 'Command.Knit\ and\ PDF\ (cur\ file)', 'RMakePDFK', 'kp', ':call RMakeRmd("pdf_document")')
             call RCreateMenuItem("nvi", 'Command.Knit\ and\ Beamer\ PDF\ (cur\ file)', 'RMakePDFKb', 'kl', ':call RMakeRmd("beamer_presentation")')
-            call RCreateMenuItem("nvi", 'Command.Knit\ and\ HTML\ (cur\ file)', 'RMakeHTML', 'kh', ':call RMakeRmd("html")')
+            call RCreateMenuItem("nvi", 'Command.Knit\ and\ HTML\ (cur\ file)', 'RMakeHTML', 'kh', ':call RMakeRmd("html_document")')
             call RCreateMenuItem("nvi", 'Command.Knit\ and\ ODT\ (cur\ file)', 'RMakeODT', 'ko', ':call RMakeRmd("odt")')
         endif
         if &filetype == "rrst" || g:vimrplugin_never_unmake_menu
diff --git a/r-plugin/windows.vim b/r-plugin/windows.vim
index a5cc353..fa2d471 100644
--- a/r-plugin/windows.vim
+++ b/r-plugin/windows.vim
@@ -167,7 +167,11 @@ function SendCmdToR_Windows(cmd)
     else
         let cmd = a:cmd . "\n"
     endif
-    let repl = libcall(g:rplugin_vimcom_lib, "SendToRConsole", cmd)
+    if g:vimrplugin_Rterm
+        let repl = libcall(g:rplugin_vimcom_lib, "SendToRTerm", cmd)
+    else
+        let repl = libcall(g:rplugin_vimcom_lib, "SendToRConsole", cmd)
+    endif
     if repl != "OK"
         call RWarningMsg(repl)
         call ClearRInfo()

From 562b33ec3a3a8a5ec88e4dac1ae3874d3bf8dc00 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Thu, 22 Jan 2015 22:06:14 -0500
Subject: [PATCH 0909/1050] Restore clipboard contents on Windows

---
 doc/r-plugin.txt           | 50 +++++++++++++++++++-------------------
 r-plugin/common_global.vim | 32 ++++++++++++------------
 r-plugin/osx.vim           |  2 +-
 r-plugin/windows.vim       |  3 +++
 4 files changed, 44 insertions(+), 43 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 198ef56..6184390 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -969,15 +969,7 @@ errors in the code sent to R. Details:
 
 
 ------------------------------------------------------------------------------
-5.2. The clipboard's content is lost (Windows only)~
-
-On Windows, the plugin copies the command that will be sent to R into the
-clipboard. Thus, if you have anything in the clipboard it will be lost while
-using the plugin.
-
-
-------------------------------------------------------------------------------
-5.3. The menu may not reflect some of your custom key bindings~
+5.2. The menu may not reflect some of your custom key bindings~
 
 If you have created a custom key binding for the Vim-R-plugin, the menu in
 GVim will not always reflect the correct key binding if it is not the same for
@@ -985,7 +977,7 @@ Normal, Visual and Insert modes.
 
 
 ------------------------------------------------------------------------------
-5.4. Syntactically correct code may be wrongly indented~
+5.3. Syntactically correct code may be wrongly indented~
 
 If the Vim-R-plugin indents your code wrongly you may get the correct
 indentation by adding braces and line breaks to it. For example, try to
@@ -1015,14 +1007,14 @@ See also:
 
 
 ------------------------------------------------------------------------------
-5.5. Functions are not always correctly sent to R~
+5.4. Functions are not always correctly sent to R~
 
 The plugin is only capable of recognizing functions defined using the `<-`
 operator. See: https://github.com/jcfaria/Vim-R-plugin/issues/94
 
 
 ------------------------------------------------------------------------------
-5.6. Objects Browser does not support knitr cache=TRUE~
+5.5. Objects Browser does not support knitr cache=TRUE~
 
 When processing Rnoweb documents with the knitr package, if the chunk option
 `cache` is `TRUE`, the Object Browser will not be able to detect the classes
@@ -1031,7 +1023,7 @@ issue is to define the chunk option `cache.lazy=FALSE`.
 
 
 ------------------------------------------------------------------------------
-5.7. Wrong message that "R is busy" (Windows only)~
+5.6. Wrong message that "R is busy" (Windows only)~
 
 On Windows, when code is sent from Vim to R Console, the vimcom library sets
 the value of the internal variable `r_is_busy` to 1. The value is set back to
@@ -1048,8 +1040,7 @@ The vimcom library is started with the state `busy`.
 
 ------------------------------------------------------------------------------
 							*r-plugin-SyncTeX-win*
-							*r-plugin-SyncTeX-mac*
-5.8. SyncTeX on Windows~
+5.7. SyncTeX on Windows~
 
 On Windows, backward search with Sumatra pop ups a console window (`vim`
 running the required --remote-expr command) which quickly disappears.
@@ -1057,7 +1048,7 @@ running the required --remote-expr command) which quickly disappears.
 
 ------------------------------------------------------------------------------
 								*r-plugin-nox*
-5.9. Bugs that affect Linux Console and Vim accessed through ssh~
+5.8. Bugs that affect Linux Console and Vim accessed through ssh~
 
 If you run Vim in the Linux Console or start Vim in a terminal emulator
 without the command line argument |--servername|, Vim will not receive remote
@@ -1123,7 +1114,7 @@ See also: |r-plugin-remote|.
 
 
 ------------------------------------------------------------------------------
-5.10. R must be started by Vim~
+5.9. R must be started by Vim~
 
 The communication between Vim and R will work only if R was started by Vim
 through the rf command because the plugin was designed to connect
@@ -1904,7 +1895,7 @@ want to know they are, while editing an R file, do in Normal mode:
 
 ------------------------------------------------------------------------------
 							    *r-plugin-SyncTeX*
-6.33 SyncTeX support (Linux only)~
+6.33 SyncTeX support~
 
 SyncTeX is a set of communication systems used by some PDF viewers and by some
 text editors which allow users to jump from a specific line in the text editor
@@ -1946,6 +1937,8 @@ Note: The current knitr package (version 1.7) has at least two limitations:
 ------------------------------------------------------------------------------
 6.33.1 Evince configuration~
 
+No configuration should be required.
+
 If you have Evince installed, the Vim-R-plugin assumes that you are using it
 to view PDF documents and that you run either GVim or Vim in Gnome-Terminal.
 If you run Vim in another terminal emulator, you have to set the value of
@@ -1987,6 +1980,11 @@ of Okular will be started.
 ------------------------------------------------------------------------------
 6.33.3 Zathura configuration~
 
+No configuration should be required if Evince is not installed. If evince is
+installed, put in your |vimrc|:
+>
+   let vimrplugin_pdfviewer = "zathura"
+<
 Zathura (version >= 0.3.1) is also supported. If the terminal emulator is not
 raised during backward search (from PDF to Vim), you have to set the value of
 |vimrplugin_vim_window|, as explained below.
@@ -1997,7 +1995,7 @@ to press gp again.
 
 
 ------------------------------------------------------------------------------
-6.33.4 Skim with MacVim configuration~
+6.33.4 Skim with MacVim configuration (Mac OS X)~
 
 You have to configure Skim to call MacVim during backward searches.
 In Skim click in the drop down menu and fill the fields:
@@ -2010,10 +2008,16 @@ In Skim click in the drop down menu and fill the fields:
    Arguments: --remote-expr "SyncTeX_backward('%file', %line)"
 <
 
+------------------------------------------------------------------------------
+6.33.5 Sumatra configuration (Windows)~
+
+No configuration is required.
+
+
 ------------------------------------------------------------------------------
                                                        *vimrplugin_vim_window*
 				                       *vimrplugin_synctex*
-6.33.4 Configuring the PDF editor and Vim's window title~
+6.33.6 Configuring the PDF editor and Vim's window title~
 
 If SyncTeX does not work (see above), you may try to set in your |vimrc| the
 values of |vimrplugin_pdfviewer| and vimrplugin_vim_window.
@@ -2041,10 +2045,6 @@ To completely disable SyncTeX support, put in your |vimrc|:
    let vimrplugin_synctex = 0
 <
 
-There is no support for Windows and Mac OS X. See |r-plugin-SyncTeX-win| and
-|r-plugin-SyncTeX-mac|.
-
-
 ==============================================================================
 						       *r-plugin-key-bindings*
 7. Custom key bindings~
@@ -2788,7 +2788,7 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details.
 							       *r-plugin-news*
 10. News~
 
-1.2 (2015-01-18)
+1.2 (2015-01-22)
 
  * Remove support for Neovim. See: https://github.com/jalvesaq/Nvim-R
 
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index bead03c..24fdcdf 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -922,8 +922,8 @@ function WaitVimComStart()
         let g:rplugin_vimcom_home = vr[1]
         let g:rplugin_vimcomport = vr[2]
         let g:rplugin_r_pid = vr[3]
-        if g:rplugin_vimcom_version != "1.2.0"
-            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.2.0.')
+        if g:rplugin_vimcom_version != "1.2.0.1"
+            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.2.0.1.')
             sleep 1
         endif
         if has("win32")
@@ -1914,20 +1914,16 @@ function RQuit(how)
         endif
     endif
 
-    if has("win32") || has("win64")
-        let repl = libcall(g:rplugin_vimcom_lib, "SendQuitMsg", qcmd . "\n")
-    else
-        call g:SendCmdToR(qcmd)
-        if g:rplugin_do_tmux_split
-            if a:how == "save"
-                sleep 200m
-            endif
-            if g:vimrplugin_restart
-                let ca_ck = g:vimrplugin_ca_ck
-                let g:vimrplugin_ca_ck = 0
-                call g:SendCmdToR("exit")
-                let g:vimrplugin_ca_ck = ca_ck
-            endif
+    call g:SendCmdToR(qcmd)
+    if g:rplugin_do_tmux_split
+        if a:how == "save"
+            sleep 200m
+        endif
+        if g:vimrplugin_restart
+            let ca_ck = g:vimrplugin_ca_ck
+            let g:vimrplugin_ca_ck = 0
+            call g:SendCmdToR("exit")
+            let g:vimrplugin_ca_ck = ca_ck
         endif
     endif
 
@@ -2235,6 +2231,8 @@ function RSetPDFViewer()
             let g:rplugin_pdfviewer = "evince"
         elseif executable("okular")
             let g:rplugin_pdfviewer = "okular"
+        elseif executable("zathura")
+            let g:rplugin_pdfviewer = "zathura"
         else
             let g:rplugin_pdfviewer = "none"
             if $R_PDFVIEWER == ""
@@ -2243,7 +2241,7 @@ function RSetPDFViewer()
                 let pdfvl = [$R_PDFVIEWER, "xdg-open"]
             endif
             " List from R configure script:
-            let pdfvl += ["evince", "okular", "zathura", "xpdf", "gv", "gnome-gv", "ggv", "kpdf", "gpdf", "kghostview,", "acroread", "acroread4"]
+            let pdfvl += ["xpdf", "gv", "gnome-gv", "ggv", "kpdf", "gpdf", "kghostview,", "acroread", "acroread4"]
             for prog in pdfvl
                 if executable(prog)
                     let g:rplugin_pdfviewer = prog
diff --git a/r-plugin/osx.vim b/r-plugin/osx.vim
index e5a759d..5675a8e 100644
--- a/r-plugin/osx.vim
+++ b/r-plugin/osx.vim
@@ -13,7 +13,7 @@ function StartR_OSX()
     if b:rplugin_r_args != " "
         " https://github.com/jcfaria/Vim-R-plugin/issues/63
         " https://stat.ethz.ch/pipermail/r-sig-mac/2013-February/009978.html
-        call RWarningMsg('R.app does not support command line arguments. To pass "' . b:rplugin_r_args . '" to R, you must run it in a console. Set "vimrplugin_applescript = 0" (you may need to install XQuartz)')
+        call RWarningMsg('R.app does not support command line arguments. To pass "' . b:rplugin_r_args . '" to R, you must run it in a console. Set "vimrplugin_applescript = 0"')
     endif
     let rlog = system("open " . rcmd)
     if v:shell_error
diff --git a/r-plugin/windows.vim b/r-plugin/windows.vim
index fa2d471..682cccd 100644
--- a/r-plugin/windows.vim
+++ b/r-plugin/windows.vim
@@ -167,6 +167,8 @@ function SendCmdToR_Windows(cmd)
     else
         let cmd = a:cmd . "\n"
     endif
+    let save_clip = getreg('+')
+    call setreg('+', cmd)
     if g:vimrplugin_Rterm
         let repl = libcall(g:rplugin_vimcom_lib, "SendToRTerm", cmd)
     else
@@ -178,6 +180,7 @@ function SendCmdToR_Windows(cmd)
     endif
     exe "sleep " . g:rplugin_sleeptime
     call foreground()
+    call setreg('+', save_clip)
     return 1
 endfunction
 

From 56e31fb2e8734f35974437be9f4c8aed76560ef8 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Fri, 23 Jan 2015 17:49:16 -0500
Subject: [PATCH 0910/1050] Rename b:rsource as g:rplugin_rsource Avoid the
 possibility of b:rsource not being deleted on VimLeave.

---
 r-plugin/common_buffer.vim | 17 -----------------
 r-plugin/common_global.vim | 22 +++++++++-------------
 2 files changed, 9 insertions(+), 30 deletions(-)

diff --git a/r-plugin/common_buffer.vim b/r-plugin/common_buffer.vim
index 70482b6..90ba4fd 100644
--- a/r-plugin/common_buffer.vim
+++ b/r-plugin/common_buffer.vim
@@ -44,23 +44,6 @@ if !exists("b:objbrtitle")
     unlet s:tnr
 endif
 
-
-" Make the file name of files to be sourced
-let b:bname = expand("%:t")
-let b:bname = substitute(b:bname, " ", "",  "g")
-if exists("*getpid") " getpid() was introduced in Vim 7.1.142
-    let b:rsource = g:rplugin_tmpdir . "/Rsource-" . getpid() . "-" . b:bname
-else
-    let b:randnbr = system("echo $RANDOM")
-    let b:randnbr = substitute(b:randnbr, "\n", "", "")
-    if strlen(b:randnbr) == 0
-        let b:randnbr = "NoRandom"
-    endif
-    let b:rsource = g:rplugin_tmpdir . "/Rsource-" . b:randnbr . "-" . b:bname
-    unlet b:randnbr
-endif
-unlet b:bname
-
 if exists("g:rplugin_firstbuffer") && g:rplugin_firstbuffer == ""
     " The file global_r_plugin.vim was copied to ~/.vim/plugin
     let g:rplugin_firstbuffer = expand("%:p")
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 24fdcdf..ec8223f 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -1420,15 +1420,15 @@ function RSourceLines(lines, e)
     if &filetype == "rmd"
         let lines = map(copy(lines), 'substitute(v:val, "^\\`\\`\\?", "", "")')
     endif
-    call writefile(lines, b:rsource)
+    call writefile(lines, g:rplugin_rsource)
     if a:e == "echo"
         if exists("g:vimrplugin_maxdeparse")
-            let rcmd = 'base::source("' . b:rsource . '", echo=TRUE, max.deparse=' . g:vimrplugin_maxdeparse . ')'
+            let rcmd = 'base::source("' . g:rplugin_rsource . '", echo=TRUE, max.deparse=' . g:vimrplugin_maxdeparse . ')'
         else
-            let rcmd = 'base::source("' . b:rsource . '", echo=TRUE)'
+            let rcmd = 'base::source("' . g:rplugin_rsource . '", echo=TRUE)'
         endif
     else
-        let rcmd = 'base::source("' . b:rsource . '")'
+        let rcmd = 'base::source("' . g:rplugin_rsource . '")'
     endif
     let ok = g:SendCmdToR(rcmd)
     return ok
@@ -2341,7 +2341,7 @@ function ROpenPDF(path)
             call system(g:macvim_skim_app_path . '/Contents/MacOS/Skim "' . basenm . '.pdf" 2> /dev/null >/dev/null &')
         else
             let pcmd = g:rplugin_pdfviewer . " '" . pdfpath . "' 2>/dev/null >/dev/null &"
-        call system(pcmd)
+            call system(pcmd)
         endif
         if g:rplugin_has_wmctrl
             call system("wmctrl -a '" . basenm . ".pdf'")
@@ -2790,10 +2790,7 @@ function RBufEnter()
 endfunction
 
 function RVimLeave()
-    if exists("b:rsource")
-        " b:rsource only exists if the filetype of the last buffer is .R*
-        call delete(b:rsource)
-    endif
+    call delete(g:rplugin_rsource)
     call delete(g:rplugin_tmpdir . "/eval_reply")
     call delete(g:rplugin_tmpdir . "/formatted_code")
     call delete(g:rplugin_tmpdir . "/GlobalEnvList_" . $VIMINSTANCEID)
@@ -2895,6 +2892,9 @@ if !isdirectory(g:rplugin_tmpdir)
     call mkdir(g:rplugin_tmpdir, "p", 0700)
 endif
 
+" Make the file name of files to be sourced
+let g:rplugin_rsource = g:rplugin_tmpdir . "/Rsource-" . getpid()
+
 let g:rplugin_is_darwin = system("uname") =~ "Darwin"
 
 " Variables whose default value is fixed
@@ -2966,10 +2966,6 @@ function RSetMyPort(p)
     endif
 endfunction
 
-function SendObjPortToVimCom(p)
-    call SendToVimCom("\002" . a:p)
-endfunction
-
 function ROnJobActivity()
     if v:job_data[1] == 'stdout'
         for cmd in v:job_data[2]

From aa693aaeae5e0f959d910c7bfac7d2bda3ea869e Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Fri, 23 Jan 2015 17:50:29 -0500
Subject: [PATCH 0911/1050] Fix indentation

---
 ftplugin/rnoweb_rplugin.vim | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/ftplugin/rnoweb_rplugin.vim b/ftplugin/rnoweb_rplugin.vim
index 1bffb43..0a6adb1 100644
--- a/ftplugin/rnoweb_rplugin.vim
+++ b/ftplugin/rnoweb_rplugin.vim
@@ -20,9 +20,9 @@ else
 endif
 if !exists("g:rplugin_has_latexmk")
     if g:vimrplugin_latexmk && executable("latexmk") && executable("perl")
-	let g:rplugin_has_latexmk = 1
+        let g:rplugin_has_latexmk = 1
     else
-	let g:rplugin_has_latexmk = 0
+        let g:rplugin_has_latexmk = 0
     endif
 endif
 
@@ -440,13 +440,12 @@ function! SyncTeX_backward(fname, ln)
     let rnwf = substitute(rnwf, '^\./', '', '')
 
     if GoToBuf(rnwbn, rnwf, basedir, rnwln)
-	if g:rplugin_has_wmctrl
-        call system("wmctrl -xa " . g:vimrplugin_vim_window)
-	elseif has("gui_running")
-	    call foreground()
-    endif
+        if g:rplugin_has_wmctrl
+            call system("wmctrl -xa " . g:vimrplugin_vim_window)
+        elseif has("gui_running")
+            call foreground()
+        endif
     endif
-
 endfunction
 
 function! SyncTeX_forward(...)

From 3c2be99ef57ffc14acca34ce4e3453eab01873b9 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sat, 24 Jan 2015 19:40:58 -0500
Subject: [PATCH 0912/1050] New options save_win_pos and arrange_windows

---
 doc/r-plugin.txt           | 30 +++++++++++++++++++++++++++---
 r-plugin/common_global.vim | 21 ++++++++++++++++++---
 r-plugin/windows.vim       |  7 +++++++
 3 files changed, 52 insertions(+), 6 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 6184390..1f90322 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -5,7 +5,7 @@
 Authors: Jakson A. Aquino   
          Jose Claudio Faria 
 
-Version: 1.2
+Version: 1.2.1
 For Vim version 7.4
 
  1. Overview                                    |r-plugin-overview|
@@ -1185,6 +1185,8 @@ is running:
 |vimrplugin_term|              External terminal to be used
 |vimrplugin_term_cmd|          Complete command to open an external terminal
 |vimrplugin_sleeptime|         Delay while sending commands in MS Windows
+|vimrplugin_save_win_pos|      Save positions of R and GVim windows
+|vimrplugin_arrange_windows|   Restore positions of R and GVim windows
 |vimrplugin_assign|            Convert '_' into ' <- '
 |vimrplugin_assign_map|        Choose what to convert into ' <- '
 |vimrplugin_rnowebchunk|       Convert '<' into '<<>>=\n@' in Rnoweb files
@@ -1274,7 +1276,9 @@ The last argument must be the one which precedes the command to be executed.
 
 
 ------------------------------------------------------------------------------
-							*vimrplugin_sleeptime*
+						  *vimrplugin_sleeptime*
+						  *vimrplugin_save_win_pos*
+						  *vimrplugin_arrange_windows*
 6.2. Options specific to Windows~
 
 
@@ -1284,6 +1288,19 @@ example show how to adjust the value of sleeptime in your |vimrc|:
 >
    let vimrplugin_sleeptime = 30
 <
+By default, the Vim-R-plugin will save the positions of R Console and GVim
+windows when you quits R with the rq command, and will restore
+the positions of the windows when you start R. If you do not like this
+behavior, you can put in your |vimrc|:
+>
+   let vimrplugin_save_win_pos = 0
+   let vimrplugin_arrange_windows = 0
+<
+If you want R and GVim windows always in a specific arrangement, regardless of
+their state when you have quited R for the last time, you should arrange them
+in the way you want, quit R, change in your |vimrc| only the value of
+vimrplugin_save_win_pos and, finally, quit Vim.
+
 Note: the option vimrplugin_Rterm was disabled because the C code to send
 strings from Vim to Windows PowerShell is not working.
 
@@ -2788,7 +2805,14 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details.
 							       *r-plugin-news*
 10. News~
 
-1.2 (2015-01-22)
+1.2.1 (2015-01-24)
+
+ * Minor bug fixes.
+
+ * New options for Windows: vimrplugin_save_win_pos and
+   vimrplugin_arrange_windows.
+
+1.2 (2015-01-18)
 
  * Remove support for Neovim. See: https://github.com/jalvesaq/Nvim-R
 
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index ec8223f..7421e51 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -922,8 +922,8 @@ function WaitVimComStart()
         let g:rplugin_vimcom_home = vr[1]
         let g:rplugin_vimcomport = vr[2]
         let g:rplugin_r_pid = vr[3]
-        if g:rplugin_vimcom_version != "1.2.0.1"
-            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.2.0.1.')
+        if g:rplugin_vimcom_version != "1.2.0.2"
+            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.2.0.2.')
             sleep 1
         endif
         if has("win32")
@@ -1914,6 +1914,13 @@ function RQuit(how)
         endif
     endif
 
+    if g:vimrplugin_save_win_pos && v:servername != ""
+        let repl = libcall(g:rplugin_vimcom_lib, "SaveWinPos", $VIMRPLUGIN_COMPLDIR)
+        if repl != "OK"
+            call RWarningMsg(repl)
+        endif
+    endif
+
     call g:SendCmdToR(qcmd)
     if g:rplugin_do_tmux_split
         if a:how == "save"
@@ -2908,7 +2915,6 @@ call RSetDefaultValue("g:vimrplugin_strict_rst",        1)
 call RSetDefaultValue("g:vimrplugin_openpdf",           2)
 call RSetDefaultValue("g:vimrplugin_synctex",           1)
 call RSetDefaultValue("g:vimrplugin_openhtml",          0)
-call RSetDefaultValue("g:vimrplugin_Rterm",             0)
 call RSetDefaultValue("g:vimrplugin_vim_wd",            0)
 call RSetDefaultValue("g:vimrplugin_restart",           0)
 call RSetDefaultValue("g:vimrplugin_vsplit",            0)
@@ -2936,6 +2942,15 @@ call RSetDefaultValue("g:vimrplugin_objbr_place",     "'script,right'")
 call RSetDefaultValue("g:vimrplugin_user_maps_only", 0)
 call RSetDefaultValue("g:vimrplugin_latexcmd", "'default'")
 call RSetDefaultValue("g:vimrplugin_rmd_environment", "'.GlobalEnv'")
+if has("win32") || has("win64")
+    call RSetDefaultValue("g:vimrplugin_Rterm",           0)
+    call RSetDefaultValue("g:vimrplugin_save_win_pos",    1)
+    call RSetDefaultValue("g:vimrplugin_arrange_windows", 1)
+else
+    let g:vimrplugin_Rterm = 0
+    call RSetDefaultValue("g:vimrplugin_save_win_pos",    0)
+    call RSetDefaultValue("g:vimrplugin_arrange_windows", 0)
+endif
 
 " The C code in VimCom/src/apps/vimr.c to send strings to RTerm is not working:
 let g:vimrplugin_Rterm = 0
diff --git a/r-plugin/windows.vim b/r-plugin/windows.vim
index 682cccd..67bb844 100644
--- a/r-plugin/windows.vim
+++ b/r-plugin/windows.vim
@@ -159,6 +159,13 @@ function StartR_Windows()
     endif
     let g:SendCmdToR = function('SendCmdToR_Windows')
     call WaitVimComStart()
+    call foreground()
+    if g:vimrplugin_arrange_windows && v:servername != "" && filereadable(g:rplugin_compldir . "/win_pos")
+        let repl = libcall(g:rplugin_vimcom_lib, "ArrangeWindows", $VIMRPLUGIN_COMPLDIR)
+        if repl != "OK"
+            call RWarningMsg(repl)
+        endif
+    endif
 endfunction
 
 function SendCmdToR_Windows(cmd)

From 2f1d6ac3d1d658a9313d02c7a5b959f97ac51be0 Mon Sep 17 00:00:00 2001
From: jomuller 
Date: Sun, 25 Jan 2015 22:26:53 +0100
Subject: [PATCH 0913/1050] fix #152 Set working directory in OSX when using
 StartR_OSX

---
 r-plugin/osx.vim | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/r-plugin/osx.vim b/r-plugin/osx.vim
index 5675a8e..db5ecd8 100644
--- a/r-plugin/osx.vim
+++ b/r-plugin/osx.vim
@@ -25,6 +25,11 @@ function StartR_OSX()
     let g:SendCmdToR = function('SendCmdToR_OSX')
     if WaitVimComStart()
         call SendToVimCom("\005B Update OB [StartR]")
+        sleep 200m
+        if g:vimrplugin_vim_wd == 0
+            "Set vim's working directory as R working directory
+            call SendToVimCom("\x08" . $VIMINSTANCEID . 'setwd("' . expand("%:p:h") . '")')
+        endif
     endif
 endfunction
 

From 11a276462c99c5ccf87e6d1cef4502ccaebf9be3 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sun, 25 Jan 2015 16:45:28 -0500
Subject: [PATCH 0914/1050] New option: vimrplugin_after_start

---
 doc/r-plugin.txt           | 44 ++++++++++++++++++++++++++++++--------
 r-plugin/common_global.vim |  7 ++++++
 r-plugin/osx.vim           |  5 ++++-
 r-plugin/windows.vim       | 16 ++++++++------
 4 files changed, 56 insertions(+), 16 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 1f90322..5ebc444 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -1230,6 +1230,7 @@ is running:
 |vimrplugin_show_args|         Show extra information during omnicompletion
 |vimrplugin_vimcom_wait|       Time to wait for vimcom loading
 |vimrplugin_vim_wd|            Start R in Vim's working directory
+|vimrplugin_after_start|       System command to execute after R startup
 |vimrplugin_user_maps_only|    Only set user specified key bindings
 |vimrplugin_tmpdir|            Where temporary files are created
 |vimrplugin_compldir|          Where lists for omnicompletion are stored
@@ -1880,9 +1881,32 @@ your |vimrc|:
 This option is useful only for those who did not enable 'autochdir'.
 
 
+------------------------------------------------------------------------------
+						      *vimrplugin_after_start*
+6.31 System command to execute after R startup~
+
+If you want that Vim executes a command right after R startup, set the value
+of vimrplugin_after_start in your |vimrc|.
+
+For example, if you are using GVim and running R in the Gnome-terminal,
+`~/bin` is in your path, and you want to resize and change the positions of
+GVim and the Terminal windows, you may create a script `~/bin/after_R_start`
+with the following contents
+>
+   #!/bin/sh
+   wmctrl -F -r R -e 0,0,200,1200,800
+   wmctrl -r GVIM -e 0,300,40,1200,800
+<
+make the script executable, and put in your |vimrc|:
+>
+   if has("gui_running")
+       let vimrplugin_after_start = "after_R_start"
+   endif
+<
+
 ------------------------------------------------------------------------------
 						   *vimrplugin_user_maps_only*
-6.31 Only set key bindings that are user specified~
+6.32 Only set key bindings that are user specified~
 
 The Vim-R-plugin sets many default key bindings.  The user can set custom
 key bindings (|r-plugin-key-bindings|).  If you wish the Vim-R-plugin to only
@@ -1894,7 +1918,7 @@ set those key-bindings specified by the user, put in your vimrc:
 ------------------------------------------------------------------------------
 							   *vimrplugin_tmpdir*
 							 *vimrplugin_compldir*
-6.32 Temporary files directories~
+6.33 Temporary files directories~
 
 You can change the directories where temporary files are created and
 stored by setting in your |vimrc| the values of vimrplugin_tmpdir and
@@ -1912,7 +1936,7 @@ want to know they are, while editing an R file, do in Normal mode:
 
 ------------------------------------------------------------------------------
 							    *r-plugin-SyncTeX*
-6.33 SyncTeX support~
+6.34 SyncTeX support~
 
 SyncTeX is a set of communication systems used by some PDF viewers and by some
 text editors which allow users to jump from a specific line in the text editor
@@ -1952,7 +1976,7 @@ Note: The current knitr package (version 1.7) has at least two limitations:
 
 
 ------------------------------------------------------------------------------
-6.33.1 Evince configuration~
+6.34.1 Evince configuration~
 
 No configuration should be required.
 
@@ -1967,7 +1991,7 @@ to press gp again.
 
 
 ------------------------------------------------------------------------------
-6.33.2 Okular configuration~
+6.34.2 Okular configuration~
 
 You have to configure Okular to call Vim during backward searches.
 In Okular, click in:
@@ -1995,7 +2019,7 @@ of Okular will be started.
 
 
 ------------------------------------------------------------------------------
-6.33.3 Zathura configuration~
+6.34.3 Zathura configuration~
 
 No configuration should be required if Evince is not installed. If evince is
 installed, put in your |vimrc|:
@@ -2012,7 +2036,7 @@ to press gp again.
 
 
 ------------------------------------------------------------------------------
-6.33.4 Skim with MacVim configuration (Mac OS X)~
+6.34.4 Skim with MacVim configuration (Mac OS X)~
 
 You have to configure Skim to call MacVim during backward searches.
 In Skim click in the drop down menu and fill the fields:
@@ -2026,7 +2050,7 @@ In Skim click in the drop down menu and fill the fields:
 <
 
 ------------------------------------------------------------------------------
-6.33.5 Sumatra configuration (Windows)~
+6.34.5 Sumatra configuration (Windows)~
 
 No configuration is required.
 
@@ -2034,7 +2058,7 @@ No configuration is required.
 ------------------------------------------------------------------------------
                                                        *vimrplugin_vim_window*
 				                       *vimrplugin_synctex*
-6.33.6 Configuring the PDF editor and Vim's window title~
+6.34.6 Configuring the PDF editor and Vim's window title~
 
 If SyncTeX does not work (see above), you may try to set in your |vimrc| the
 values of |vimrplugin_pdfviewer| and vimrplugin_vim_window.
@@ -2809,6 +2833,8 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details.
 
  * Minor bug fixes.
 
+ * New option: vimrplugin_after_start.
+
  * New options for Windows: vimrplugin_save_win_pos and
    vimrplugin_arrange_windows.
 
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 7421e51..ad7acd7 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -661,6 +661,9 @@ function StartR_TmuxSplit(rcmd)
     endif
     if WaitVimComStart()
         call SendToVimCom("\005B Update OB [StartR]")
+        if g:vimrplugin_after_start != ''
+            call system(g:vimrplugin_after_start)
+        endif
     endif
 endfunction
 
@@ -733,6 +736,9 @@ function StartR_ExternalTerm(rcmd)
     let g:SendCmdToR = function('SendCmdToR_Term')
     if WaitVimComStart()
         call SendToVimCom("\005B Update OB [StartR]")
+        if g:vimrplugin_after_start != ''
+            call system(g:vimrplugin_after_start)
+        endif
     endif
 endfunction
 
@@ -2916,6 +2922,7 @@ call RSetDefaultValue("g:vimrplugin_openpdf",           2)
 call RSetDefaultValue("g:vimrplugin_synctex",           1)
 call RSetDefaultValue("g:vimrplugin_openhtml",          0)
 call RSetDefaultValue("g:vimrplugin_vim_wd",            0)
+call RSetDefaultValue("g:vimrplugin_after_start",    "''")
 call RSetDefaultValue("g:vimrplugin_restart",           0)
 call RSetDefaultValue("g:vimrplugin_vsplit",            0)
 call RSetDefaultValue("g:vimrplugin_rconsole_width",   -1)
diff --git a/r-plugin/osx.vim b/r-plugin/osx.vim
index db5ecd8..6887235 100644
--- a/r-plugin/osx.vim
+++ b/r-plugin/osx.vim
@@ -27,9 +27,12 @@ function StartR_OSX()
         call SendToVimCom("\005B Update OB [StartR]")
         sleep 200m
         if g:vimrplugin_vim_wd == 0
-            "Set vim's working directory as R working directory
+            "Set Vim's working directory as R working directory
             call SendToVimCom("\x08" . $VIMINSTANCEID . 'setwd("' . expand("%:p:h") . '")')
         endif
+        if g:vimrplugin_after_start != ''
+            call system(g:vimrplugin_after_start)
+        endif
     endif
 endfunction
 
diff --git a/r-plugin/windows.vim b/r-plugin/windows.vim
index 67bb844..250f160 100644
--- a/r-plugin/windows.vim
+++ b/r-plugin/windows.vim
@@ -158,12 +158,16 @@ function StartR_Windows()
         lcd -
     endif
     let g:SendCmdToR = function('SendCmdToR_Windows')
-    call WaitVimComStart()
-    call foreground()
-    if g:vimrplugin_arrange_windows && v:servername != "" && filereadable(g:rplugin_compldir . "/win_pos")
-        let repl = libcall(g:rplugin_vimcom_lib, "ArrangeWindows", $VIMRPLUGIN_COMPLDIR)
-        if repl != "OK"
-            call RWarningMsg(repl)
+    if WaitVimComStart()
+        call foreground()
+        if g:vimrplugin_arrange_windows && v:servername != "" && filereadable(g:rplugin_compldir . "/win_pos")
+            let repl = libcall(g:rplugin_vimcom_lib, "ArrangeWindows", $VIMRPLUGIN_COMPLDIR)
+            if repl != "OK"
+                call RWarningMsg(repl)
+            endif
+        endif
+        if g:vimrplugin_after_start != ''
+            call system(g:vimrplugin_after_start)
         endif
     endif
 endfunction

From 37e2fb681e18a19748ec9de493ca2d06cd054e9c Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Mon, 26 Jan 2015 19:32:22 -0500
Subject: [PATCH 0915/1050] Graphics explaining Vim--R communication

---
 doc/vimrcom.tex | 163 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 163 insertions(+)
 create mode 100644 doc/vimrcom.tex

diff --git a/doc/vimrcom.tex b/doc/vimrcom.tex
new file mode 100644
index 0000000..d95ebbd
--- /dev/null
+++ b/doc/vimrcom.tex
@@ -0,0 +1,163 @@
+\documentclass[english,ignorenonframetext]{beamer}
+
+% Compile with XeLaTeX:
+\usepackage{fontspec}
+\setmainfont{Liberation Serif}
+
+\usetheme{Warsaw}
+\setbeamercovered{transparent}
+\setbeamertemplate{navigation symbols}{}
+\usepackage{multirow}
+\usepackage{booktabs}
+\newcommand{\autor}{Jakson Alves de Aquino}
+\newcommand{\titulo}{Communication between Vim and R}
+
+\title{\titulo}
+\author{\autor}
+\date{\today}
+
+\usepackage{tikz}
+\date{\today}
+\begin{document}
+
+\begin{frame}[plain]
+  \titlepage
+\end{frame}
+
+\begin{frame}
+\frametitle{The R package \texttt{vimcom}}
+\begin{center}
+\begin{tikzpicture}[node distance=5mm,
+    bola/.style={
+        rectangle,minimum size=4mm,rounded corners,
+        draw, fill=white!80!blue,
+        text height=1.5ex,text depth=.25ex
+    }]
+    \normalsize
+    \node at (3.4, 8) {R code};
+    \node at (9.6, 8) {C code};
+    \node at (8.2, 7) {\textcolor{black!50!green}{vimcom.so}};
+    \node at (11, 7) {\textcolor{black!50!green}{libVimR.so}};
+
+    \small
+    \node [bola] at (2, 7.0) {etags2ctags}; \node [bola] at (4.8, 7.0) {vim.print};
+    \node [bola] at (2, 6.3) {vim.args};    \node [bola] at (4.8, 6.3) {vim.srcdir};
+    \node [bola] at (2, 5.6) {vim.bol};     \node [bola] at (4.8, 5.6) {vim.list.args};
+    \node [bola] at (2, 4.9) {vim.help};    \node [bola] at (4.8, 4.9) {vim.interlace.rmd};
+    \node [bola] at (2, 4.2) {vim.names};   \node [bola] at (4.8, 4.2) {vim.interlace.rnoweb};
+    \node [bola] at (2, 3.5) {vim.plot};    \node [bola] at (4.8, 3.5) {vim.interlace.rrst};
+
+    \node [bola, fill=white!90!black] at (8.2, 6.3) {vim\_client};
+    \node [bola, fill=white!90!black] at (8.2, 5.6) {TCP\_server};
+    \node [bola, fill=white!90!black] at (8.2, 4.9) {list\_libs};
+    \node [bola, fill=white!90!black] at (8.2, 4.2) {list\_env};
+    \node [bola, fill=white!90!black] at (8.2, 3.5) {eval\_expr};
+
+    \node [bola, fill=white!90!black] at (11, 6.3) {send\_to\_vimcom};
+    \normalsize
+\end{tikzpicture}
+\end{center}
+\end{frame}
+
+
+\begin{frame}
+\frametitle{Vim--R communication paths}
+\begin{center}
+    \begin{tikzpicture}
+        \normalsize
+        \draw [thick, fill=white!90!green, rounded corners] (7, 1.5) rectangle (10, 6.5);
+        \draw [thick, fill=white!90!green, rounded corners] (0, 1.5) rectangle (3, 6.5);
+        \only<1>{
+            \node at (1.5, 4) {Vim Editor};
+            \node at (8.5, 4) {R};
+        }
+        \only<2>{
+            \node at (1.5, 4) {MacVim Editor};
+            \node at (8.5, 4) {R.app};
+        }
+        \only<3>{
+            \node at (1.5, 4) {GVim Editor};
+            \node at (8.5, 4) {Rgui};
+        }
+        \small
+        \draw (0, 3) -- (3, 3);
+        \draw (0, 5) -- (3, 5);
+        \footnotesize
+        \only<1>{
+            \node at (1.5, 6.1) {\texttt{\textcolor{black!50!green}{X11}}};
+            \node at (8.5, 6.1) {\texttt{\textcolor{black!50!green}{vimcom.so}}};
+            \node at (8.5, 2.6) {\texttt{\textcolor{black!50!green}{vimcom.so}}};
+            \node at (1.5, 2.6) {\texttt{\textcolor{black!50!green}{libVimR.so}}};
+            \node at (5, 4.3) {\emph{via tmux}};
+        }
+        \only<2>{
+            \node at (1.5, 6.1) {\texttt{\textcolor{black!50!green}{Cocoa}}};
+            \node at (8.5, 6.1) {\texttt{\textcolor{black!50!green}{vimcom.so}}};
+            \node at (8.5, 2.6) {\texttt{\textcolor{black!50!green}{vimcom.so}}};
+            \node at (1.5, 2.6) {\texttt{\textcolor{black!50!green}{libVimR.so}}};
+            \node at (5, 4.3) {\emph{via osascript}};
+        }
+        \only<3>{
+            \node at (1.5, 6.1) {\texttt{\textcolor{black!50!green}{Windows}}};
+            \node at (8.5, 6.1) {\texttt{\textcolor{black!50!green}{vimcom.dll}}};
+            \node at (8.5, 2.6) {\texttt{\textcolor{black!50!green}{vimcom.dll}}};
+            \node at (1.5, 2.6) {\texttt{\textcolor{black!50!green}{libVimR.dll}}};
+            \node at (5, 4.3) {\emph{via clipboard}};
+        }
+
+        \small
+        \only<1>{ \node at (1.5, 5.6) {Vim's server}; }
+        \only<2>{ \node at (1.5, 5.6) {MacVim's server}; }
+        \only<3>{ \node at (1.5, 5.6) {GVim's server}; }
+        \node at (1.5, 2.1) {TCP client};
+
+        \draw (7, 3) -- (10, 3);
+        \draw (7, 5) -- (10, 5);
+        \node at (8.5, 5.6) {TCP client};
+        \node at (8.5, 2.1) {TCP server};
+
+        \footnotesize
+        \draw [->, thick] (3.1, 4.1) -- (6.9, 4.1);
+        \draw [->, thick, blue] (-0.1, 3.8) .. controls (-0.8, 3.8) and (-0.8, 2.25) .. (-0.1, 2.25);
+        \draw [->, thick, red] (-0.1, 5.75) .. controls (-0.8, 5.75) and (-0.8, 4.2) .. (-0.1, 4.2);
+        \draw [->, thick, red] (8.5, 6.6) .. controls (8.5, 7.5) and (1.5, 7.5) .. (1.5, 6.6);
+        \draw [->, thick, blue] (1.5, 1.4) .. controls (1.5, 0.5) and (8.5, 0.5) .. (8.5, 1.4);
+
+        \node [shape=circle, text width=1.5cm, align=center, blue] (tmpf) at (4.5, 2.25) {Temporary files};
+        \draw [->, thick, blue] (6.9, 2.25) -- (tmpf) node[above, midway] {\emph{write}};
+        \draw [->, thick, blue] (tmpf) -- (3.1, 3.9) node[above, sloped, midway] {\emph{read}};
+        \normalsize
+    \end{tikzpicture}
+\end{center}
+\end{frame}
+
+\begin{frame}
+\frametitle{Vim--R communication paths}
+  \frametitle{}
+  \begin{columns}
+    \column{.50\textwidth}
+    \textbf{Black path}
+    \begin{itemize}
+      \item The code that you see being pasted into R Console
+    \end{itemize}
+    \vspace{0.2cm}
+    \textcolor{red}{\textbf{Red path}}
+    \begin{itemize}
+      \item Update synxtax highlight
+      \item Update Object Browser
+      \item \texttt{help()} typed in the R Console
+      \item Open PDF (Rnoweb)
+    \end{itemize}
+    \column{.50\textwidth}
+    \textcolor{blue}{\textbf{Blue path}}
+    \begin{itemize}
+      \item Omnicompletion
+      \item Completion of function arguments
+      \item \texttt{:Rhelp} or \texttt{rh}
+      \item \texttt{:Rinsert}
+      \item \texttt{:Rformat}
+    \end{itemize}
+  \end{columns}
+\end{frame}
+
+\end{document}

From f9ceb084c25a5fae88bbe80b11cd9461bb8cadcb Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Mon, 26 Jan 2015 19:34:19 -0500
Subject: [PATCH 0916/1050] Update documentation

---
 doc/r-plugin.txt | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 5ebc444..36d9686 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -1239,7 +1239,7 @@ is running:
 
 ------------------------------------------------------------------------------
 							     *vimrplugin_term*
-6.1. Terminal emulator (Linux/Unix only)~
+6.1. Terminal emulator (Linux/Unix only, but not Mac OS X)~
 
 Note: The options of this section are ignored on Mac OS X, where the command
 `open` is called to run the default application used to run shell scripts.
@@ -1261,7 +1261,6 @@ If Vim does not select your favorite terminal emulator, you may define it in
 your |vimrc| by setting the variable vimrplugin_term, as shown below:
 >
    let vimrplugin_term = "xterm"
-   let vimrplugin_term = "/Applications/Utilities/Terminal.app/Contents/MacOS/Terminal"
 <
 							 *vimrplugin_term_cmd*
 If your terminal emulator is not listed above, or if you are not satisfied
@@ -1270,7 +1269,6 @@ your |vimrc| the variable vimrplugin_term_cmd, as in the examples below:
 >
    let vimrplugin_term_cmd = "gnome-terminal --title R -e"
    let vimrplugin_term_cmd = "terminator --title R -x"
-   let vimrplugin_term_cmd = "/Applications/Utilities/iTerm.app/Contents/MacOS/iTerm -t R"
 <
 Please, look at the manual of your terminal emulator to know how to call it.
 The last argument must be the one which precedes the command to be executed.
@@ -2829,7 +2827,7 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details.
 							       *r-plugin-news*
 10. News~
 
-1.2.1 (2015-01-24)
+1.2.1 (2015-01-26)
 
  * Minor bug fixes.
 

From f4fc65bc0b746bdda711dd38dc77aa80842f17a6 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Fri, 30 Jan 2015 11:08:06 -0500
Subject: [PATCH 0917/1050] New option: vimrplugin_args_in_stline

---
 doc/r-plugin.txt           | 24 ++++++++++++----
 r-plugin/common_global.vim | 58 ++++++++++++++++++++++++++------------
 2 files changed, 58 insertions(+), 24 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 36d9686..0993ad9 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -1228,6 +1228,7 @@ is running:
 |vimrplugin_source|            Source additional scripts
 |vimrplugin_restart|           Restart R if it is already running
 |vimrplugin_show_args|         Show extra information during omnicompletion
+|vimrplugin_args_in_stline|    Set 'statusline' to function arguments
 |vimrplugin_vimcom_wait|       Time to wait for vimcom loading
 |vimrplugin_vim_wd|            Start R in Vim's working directory
 |vimrplugin_after_start|       System command to execute after R startup
@@ -1840,7 +1841,8 @@ do rf, rv or rc, then, put in your
 
 ------------------------------------------------------------------------------
 							*vimrplugin_show_args*
-6.28. Show extra information during omnicompletion~
+						   *vimrplugin_args_in_stline*
+6.28. Function arguments~
 
 If you want that Vim shows a preview window with the function arguments as you
 do omnicompletion, put in your |vimrc|:
@@ -1851,6 +1853,18 @@ The preview window is not shown by default because it is more convenient to
 run  to complete the function arguments. The preview window
 will be shown only if "preview" is also included in your 'completeopt'.
 
+If you want that function arguments are displayed in Vim's status line when
+you insert `(`, put in your |vimrc|:
+>
+   let vimrplugin_args_in_stline = 1
+<
+The status line is restored when `)` is typed. This option is useful only if
+the window has a status line. See |laststatus|. If the string with the list of
+arguments is longer than the status line width, the list is not displayed
+completely. This argument is incompatible with any plugin that changes the
+status line because it is always restored to the value that it had at Vim's
+startup. Functions of .GlobalEnv do not have their arguments displayed.
+
 
 ------------------------------------------------------------------------------
 						      *vimrplugin_vimcom_wait*
@@ -2827,14 +2841,12 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details.
 							       *r-plugin-news*
 10. News~
 
-1.2.1 (2015-01-26)
+1.2.1 (2015-01-29)
 
  * Minor bug fixes.
 
- * New option: vimrplugin_after_start.
-
- * New options for Windows: vimrplugin_save_win_pos and
-   vimrplugin_arrange_windows.
+ * New options: vimrplugin_after_start, vimrplugin_args_in_stline,
+   vimrplugin_save_win_pos and vimrplugin_arrange_windows.
 
 1.2 (2015-01-18)
 
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index ad7acd7..17995ab 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -2389,6 +2389,40 @@ function RAskHelp(...)
     endif
 endfunction
 
+function DisplayArgs()
+    if &filetype == "r" || b:IsInRCode(0)
+        let rkeyword = RGetKeyWord()
+        let s:sttl_str = g:rplugin_status_line
+        let fargs = "Not a function"
+        for omniL in g:rplugin_omni_lines
+            if omniL =~ '^' . rkeyword . "\x06"
+                let tmp = split(omniL, "\x06")
+                if len(tmp) < 5
+                    break
+                else
+                    let fargs = rkeyword . '(' . tmp[4] . ')'
+                endif
+            endif
+        endfor
+        if fargs !~ "Not a function"
+            let fargs = substitute(fargs, "NO_ARGS", '', 'g')
+            let fargs = substitute(fargs, "\x07", '=', 'g')
+            let s:sttl_str = substitute(fargs, "\x09", ', ', 'g')
+            silent set statusline=%!RArgsStatusLine()
+        endif
+    endif
+    exe "normal! a("
+endfunction
+
+function RArgsStatusLine()
+    return s:sttl_str
+endfunction
+
+function RestoreStatusLine()
+    exe 'set statusline=' . substitute(g:rplugin_status_line, ' ', '\\ ', 'g')
+    normal! a)
+endfunction
+
 function PrintRObject(rkeyword)
     if bufname("%") =~ "Object_Browser"
         let classfor = ""
@@ -2726,6 +2760,10 @@ function RCreateEditMaps()
     if g:vimrplugin_assign == 1 || g:vimrplugin_assign == 2
         silent exe 'imap  ' . g:vimrplugin_assign_map . ' :call ReplaceUnderS()a'
     endif
+    if g:vimrplugin_args_in_stline
+        imap  ( :call DisplayArgs()a
+        imap  ) :call RestoreStatusLine()a
+    endif
     if hasmapto("RCompleteArgs", "i")
         imap  RCompleteArgs =RCompleteArgs()
     else
@@ -2916,6 +2954,7 @@ call RSetDefaultValue("g:vimrplugin_allnames",          0)
 call RSetDefaultValue("g:vimrplugin_rmhidden",          0)
 call RSetDefaultValue("g:vimrplugin_assign",            1)
 call RSetDefaultValue("g:vimrplugin_assign_map",    "'_'")
+call RSetDefaultValue("g:vimrplugin_args_in_stline",    0)
 call RSetDefaultValue("g:vimrplugin_rnowebchunk",       1)
 call RSetDefaultValue("g:vimrplugin_strict_rst",        1)
 call RSetDefaultValue("g:vimrplugin_openpdf",           2)
@@ -2988,23 +3027,6 @@ function RSetMyPort(p)
     endif
 endfunction
 
-function ROnJobActivity()
-    if v:job_data[1] == 'stdout'
-        for cmd in v:job_data[2]
-            if cmd == ""
-                continue
-            endif
-            if cmd =~ "^call " || cmd  =~ "^let "
-                exe cmd
-            else
-                call RWarningMsg("[JobActivity] Unknown command: " . cmd)
-            endif
-        endfor
-    elseif v:job_data[1] == 'stderr'
-        call RWarningMsg('JobActivity error: ' . join(v:job_data[2]))
-    endif
-endfunction
-
 function SendToVimCom(...)
     if g:rplugin_vimcomport == 0
         call RWarningMsg("VimCom port is unknown.")
@@ -3211,8 +3233,8 @@ endif
 let g:rplugin_firstbuffer = expand("%:p")
 let g:rplugin_running_objbr = 0
 let g:rplugin_newliblist = 0
+let g:rplugin_status_line = &statusline
 let g:rplugin_ob_warn_shown = 0
-let g:rplugin_clt_job = 0
 let g:rplugin_r_pid = 0
 let g:rplugin_myport = 0
 let g:rplugin_vimcomport = 0

From 50af806335aa78b90f22d6fc761afca579c2f87b Mon Sep 17 00:00:00 2001
From: jomuller 
Date: Sat, 31 Jan 2015 11:08:51 +0100
Subject: [PATCH 0918/1050] Open R in MacOSX

---
 r-plugin/osx.vim | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/r-plugin/osx.vim b/r-plugin/osx.vim
index db5ecd8..78dad70 100644
--- a/r-plugin/osx.vim
+++ b/r-plugin/osx.vim
@@ -26,8 +26,13 @@ function StartR_OSX()
     if WaitVimComStart()
         call SendToVimCom("\005B Update OB [StartR]")
         sleep 200m
-        if g:vimrplugin_vim_wd == 0
-            "Set vim's working directory as R working directory
+        if g:vimrplugin_vim_wd
+            " If the user want's R's working directory to be the same as Vim's 
+            " working directory, then send a setwd() to R via vimcom at the
+            " start of R.
+            call SendToVimCom("\x08" . $VIMINSTANCEID . 'setwd("' . getcwd() . '")')
+        else
+           " Else, set the R's working directory as the actual buffer one.
             call SendToVimCom("\x08" . $VIMINSTANCEID . 'setwd("' . expand("%:p:h") . '")')
         endif
     endif

From 2445705b0ccffdac357d43df2836528c5d941ad0 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sat, 31 Jan 2015 16:00:08 -0500
Subject: [PATCH 0919/1050] Tip on how to resize MacVim and Terminal on OS X
 The tip is based on information available on the internet and was not tested.

---
 doc/r-plugin.txt | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 0993ad9..ce66497 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -199,7 +199,7 @@ Before installing the plugin, you should install its dependencies:
 
 	    If you need to use the Vim-R-plugin in a Unix system without the
 	    X Server running (e.g. Linux Console, and any system accessed
-	    through ssh), you have to use Neovim and Nvim-R:
+	    through ssh), the best option is to use Neovim and Nvim-R:
 	    https://github.com/jalvesaq/Nvim-R
 	    If you cannot use Neovim and need to use Vim in these
 	    circumstances, please, read |r-plugin-nox| and |r-plugin-remote|.
@@ -1915,6 +1915,13 @@ make the script executable, and put in your |vimrc|:
        let vimrplugin_after_start = "after_R_start"
    endif
 <
+On Mac OS X, if you are using MacVim and R.app, the `~/bin/after_R_start`
+contents might be:
+>
+   #!/bin/sh
+   osascript -e 'tell application "Terminal" to set the bounds of the front window to {0, 200, 1200, 1000}'
+   osascript -e 'tell application "MacVim" to set the bounds of the front window to {300, 40, 1500, 840}'
+<
 
 ------------------------------------------------------------------------------
 						   *vimrplugin_user_maps_only*

From 8a76674a3235fa1cf2664360640a5b69e8134515 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sun, 1 Feb 2015 09:41:28 -0500
Subject: [PATCH 0920/1050] Fix link vimcom -> Vim (no TCP connection)

---
 doc/vimrcom.tex | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/doc/vimrcom.tex b/doc/vimrcom.tex
index d95ebbd..650018e 100644
--- a/doc/vimrcom.tex
+++ b/doc/vimrcom.tex
@@ -92,7 +92,7 @@
         }
         \only<2>{
             \node at (1.5, 6.1) {\texttt{\textcolor{black!50!green}{Cocoa}}};
-            \node at (8.5, 6.1) {\texttt{\textcolor{black!50!green}{vimcom.so}}};
+            \node at (8.5, 6.1) {\texttt{\textcolor{black!50!green}{system()}}};
             \node at (8.5, 2.6) {\texttt{\textcolor{black!50!green}{vimcom.so}}};
             \node at (1.5, 2.6) {\texttt{\textcolor{black!50!green}{libVimR.so}}};
             \node at (5, 4.3) {\emph{via osascript}};
@@ -113,7 +113,9 @@
 
         \draw (7, 3) -- (10, 3);
         \draw (7, 5) -- (10, 5);
-        \node at (8.5, 5.6) {TCP client};
+        \only<1>{ \node at (8.5, 5.6) {X11 client}; }
+        \only<2>{ \node at (8.5, 5.6) {Vim application}; }
+        \only<3>{ \node at (8.5, 5.6) {Windows client}; }
         \node at (8.5, 2.1) {TCP server};
 
         \footnotesize

From cc13bc3e697eabfaf8927cab6d160494f4bded08 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sat, 7 Feb 2015 09:15:05 -0500
Subject: [PATCH 0921/1050] Note on Joris Muller installations instructions

---
 README.md | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/README.md b/README.md
index 1a3dab6..64efa00 100644
--- a/README.md
+++ b/README.md
@@ -12,3 +12,7 @@ Please, read the file *doc/r-plugin.txt* for usage details.
 
 If you decide to use this version, you will also need the development version
 of vimcom: https://github.com/jalvesaq/VimCom
+
+Note: Joris Muller wrote [installation instructions for MacVim] on OS X.
+
+[installation instructions for MacVim]: http://jomuller.fr/?p=413

From 30aa7193020e2e76682f6fbd1f32909134ff2987 Mon Sep 17 00:00:00 2001
From: FvD 
Date: Tue, 10 Feb 2015 19:21:40 -0600
Subject: [PATCH 0922/1050] Made changes following jalvesaq's review

---
 doc/r-plugin.txt | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 89e4648..f3b73b7 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -516,10 +516,10 @@ Rnoweb, RMarkdown or RreStructuredText document), and you use one of the
 commands that send a single line of code to R, then the plugin will send to R
 the command to knit the child document.
 
-After the commands that send sweave or knit the current buffer, Vim will save
-the current buffer if it has any pending changes before performing the tasks.
-After ao, Vim will run "R CMD BATCH --no-restore --no-save" on
-the current file and show the resulting .Rout file in a new tab. Please see
+After the send, sweave and knit commands, Vim will save the current buffer if
+it has any pending changes before performing the tasks.  After
+ao, Vim will run "R CMD BATCH --no-restore --no-save" on the
+current file and show the resulting .Rout file in a new tab. Please see
 |vimrplugin_routnotab| if you prefer that the file is open in a new split
 window. Note: The command ao, silently writes the current buffer
 to its file if it was modified and deletes the .Rout file if it exists.
@@ -671,13 +671,13 @@ them.
 ------------------------------------------------------------------------------
 4.4. The Object Browser~
 
-You have to do ro to either start or update the Object Browser.
-The Object Browser has two views: .GlobalEnv and Libraries. If you either
-press  or double click (GVim or Vim with 'mouse' set to "a") on the
-first line of the Object Browser, you will toggle the view between the objects
-in .GlobalEnv and the currently loaded libraries. The Object Browser requires
-the |+clientserver| feature to be automatically updated and the |+conceal|
-feature to correctly align list items.
+You have to use ro to start the Object Browser. The Object
+Browser has two views: .GlobalEnv and Libraries. If you either press 
+or double click (GVim or Vim with 'mouse' set to "a") on the first line of the
+Object Browser, you will toggle the view between the objects in .GlobalEnv and
+the currently loaded libraries. The Object Browser requires the
+|+clientserver| feature to be automatically updated and the |+conceal| feature
+to correctly align list items.
 
 In the .GlobalEnv view, if an object has the attribute "label", it will also
 be displayed. Please, see the R help for package vimcom for some options

From 0f89c74dec68ce317818f6898b7fb649ca7e4f9f Mon Sep 17 00:00:00 2001
From: FvD 
Date: Wed, 11 Feb 2015 17:51:10 -0600
Subject: [PATCH 0923/1050] Minor corrections in doc

---
 doc/r-plugin.txt | 48 ++++++++++++++++++++++++------------------------
 1 file changed, 24 insertions(+), 24 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index f3b73b7..3b05452 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -517,12 +517,12 @@ commands that send a single line of code to R, then the plugin will send to R
 the command to knit the child document.
 
 After the send, sweave and knit commands, Vim will save the current buffer if
-it has any pending changes before performing the tasks.  After
-ao, Vim will run "R CMD BATCH --no-restore --no-save" on the
-current file and show the resulting .Rout file in a new tab. Please see
-|vimrplugin_routnotab| if you prefer that the file is open in a new split
-window. Note: The command ao, silently writes the current buffer
-to its file if it was modified and deletes the .Rout file if it exists.
+it has any pending changes before performing the tasks. After ao,
+Vim will run "R CMD BATCH --no-restore --no-save" on the current file and show
+the resulting .Rout file in a new tab. Please see |vimrplugin_routnotab| if
+you prefer that the file is open in a new split window. Note: The command
+ao, silently writes the current buffer to its file if it was
+modified and deletes the .Rout file if it exists.
 
 R syntax uses " <- " to assign values to variables which is inconvenient to
 type. In insert mode, typing a single underscore, "_", will write " <- ",
@@ -1023,16 +1023,16 @@ issue is to define the chunk option `cache.lazy=FALSE`.
 ------------------------------------------------------------------------------
 5.6. Wrong message that "R is busy" (Windows only)~
 
-On Windows, when code is sent from Vim to R Console, the vimcom library
-sets the value of the internal variable `r_is_busy` to 1. The value is set
-back to 0 when any code is successfully evaluated. If you send invalid code to
-R, there will be no successful evaluation of code and, thus, the value of
-`r_is_busy` will remain set to 1. If you then try to update the Object
-Browser, see the R documentation for any function, or do other tasks that
-require the hidden evaluation of code by R, the vimcom library will
-refuse to do the tasks to avoid any risk of corrupting R's memory. It will
-tell Vim that "R is busy" and Vim will display this message. Everything should
-work as expected again after any valid code is executed in the R Console.
+On Windows, when code is sent from Vim to R Console, the vimcom library sets
+the value of the internal variable `r_is_busy` to 1. The value is set back to
+0 when any code is successfully evaluated. If you send invalid code to R,
+there will be no successful evaluation of code and the value of `r_is_busy`
+will remain set to 1. If you then try to update the Object Browser, see the R
+documentation for any function, or do other tasks that require the hidden
+evaluation of code by R, the vimcom library will refuse to do the tasks to
+avoid any risk of corrupting R's memory. It will tell Vim that "R is busy" and
+Vim will display this message. Everything should work as expected again after
+any valid code is executed in the R Console.
 
 The vimcom library is started with the state `busy`.
 
@@ -1124,7 +1124,7 @@ VIMINSTANCEID, and VIMRPLUGIN_SECRET. The first one is the path used by the R
 package vimcom to save temporary files used by the Vim-R-plugin to: perform
 omnicompletion, show R documentation in a Vim buffer, and update the Object
 Browser. The two last ones are used by the Vim-R-plugin and by vimcom to know
-that the connections are valid. If you use Vim to start R, but then closes
+that the connections are valid. If you use Vim to start R, but then close
 Vim, some variables will become outdated. Additionally, the Vim-R-plugin sets
 the value of its internal variable SendCmdToR from SendCmdToR_fake to the
 appropriate value when R is successfully started. It is possible to set the
@@ -1390,8 +1390,8 @@ it works, please, read the subsection 6.5.2 below.
 ------------------------------------------------------------------------------
 6.5.2. Details and other options:~
 
-The plugin key bindings will remain active in the documentation buffer, and,
-thus, you will be able to send commands to R as you do while editing an R
+The plugin key bindings will remain active in the documentation buffer
+allowing you to send commands to R as you would do do while editing an R
 script. You can, for example, use rh to jump to another R help
 document.
 
@@ -2126,7 +2126,7 @@ can type |:map| to see the complete list of current mappings, and below is the
 list of the names for custom key bindings (the prefix RE means "echo";
 RD, "cursor down"; RED, both "echo" and "down"):
 
-   Star/Close R~
+   Start/Close R~
    RStart
    RVanillaStart
    RCustomStart
@@ -2259,7 +2259,7 @@ later version.
 
 The Vim-R-plugin is distributed in the hope that it will be useful, but
 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
 details.
 
 A copy of the GNU General Public License is available at
@@ -2552,9 +2552,9 @@ develop a better algorithm in the future.
 9.10. Highlight chunk header as R code~
 
 By default, Vim will highlight chunk headers of RMarkdown and
-RreStructuredText with a single color. When the code is processed by knitr,
-chunk headers should contain valid R code and, thus, you may want to highlight
-them as such. You can do this by putting in your |vimrc|:
+RreStructuredText with a single color. Chunk headers should contain valid R
+code when the code is processed by knitr, so you may want to highlight them as
+such. You can do this by putting in your |vimrc|:
 >
    let rrst_syn_hl_chunk = 1
    let rmd_syn_hl_chunk = 1

From 47e1037013fe347b738f69a465a308b97123aa0d Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Thu, 19 Feb 2015 19:53:10 -0500
Subject: [PATCH 0924/1050] Indent after user defined operator See:
 https://github.com/jcfaria/Vim-R-plugin/issues/160

---
 indent/r.vim | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/indent/r.vim b/indent/r.vim
index 39f037c..df2f952 100644
--- a/indent/r.vim
+++ b/indent/r.vim
@@ -1,7 +1,7 @@
 " Vim indent file
 " Language:	R
 " Author:	Jakson Alves de Aquino 
-" Last Change:	Mon Nov 03, 2014  11:29AM
+" Last Change:	Thu Feb 19, 2015  07:50PM
 
 
 " Only load this indent file when no other was loaded.
@@ -352,6 +352,25 @@ function GetRIndent()
     let post_block = 1
   endif
 
+  " Indent after user defined operator
+  if exists("g:r_indent_op_pattern")
+    let olnum = s:Get_prev_line(lnum)
+    let oline = getline(olnum)
+    if olnum > 0
+      if line =~ g:r_indent_op_pattern
+        if oline =~ g:r_indent_op_pattern
+          return indent(lnum)
+        else
+          return indent(lnum) + &sw
+        endif
+      else
+        if oline =~ g:r_indent_op_pattern
+          return indent(lnum) - &sw
+        endif
+      endif
+    endif
+  endif
+
   let post_fun = 0
   if pb < 0 && line !~ ')\s*[,&|\-\*+<>]$'
     let post_fun = 1

From eff056d0210726a3ff1e1a0aa0ec5c3857fceac2 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Thu, 19 Feb 2015 23:33:50 -0500
Subject: [PATCH 0925/1050] Define the value of r_indent_op_pattern

---
 indent/r.vim | 35 ++++++++++++++++-------------------
 1 file changed, 16 insertions(+), 19 deletions(-)

diff --git a/indent/r.vim b/indent/r.vim
index df2f952..9bb0c5a 100644
--- a/indent/r.vim
+++ b/indent/r.vim
@@ -1,7 +1,7 @@
 " Vim indent file
 " Language:	R
 " Author:	Jakson Alves de Aquino 
-" Last Change:	Thu Feb 19, 2015  07:50PM
+" Last Change:	Thu Feb 19, 2015  11:25PM
 
 
 " Only load this indent file when no other was loaded.
@@ -31,6 +31,9 @@ endif
 if ! exists("g:r_indent_ess_compatible")
   let g:r_indent_ess_compatible = 0
 endif
+if ! exists("g:r_indent_op_pattern")
+  let g:r_indent_op_pattern = '\(+\|-\|\*\|/\|=\|\~\|%[^%]*%\)$'
+endif
 
 function s:RDelete_quotes(line)
   let i = 0
@@ -297,10 +300,6 @@ function GetRIndent()
 
     let bb = s:Get_paren_balance(line, '[', ']')
 
-    if pb == 0 && bb == 0 && (line =~ '.*[,&|\-\*+<>]$' || cline =~ '^\s*[,&|\-\*+<>]')
-      return indent(lnum)
-    endif
-
     if pb > 0
       if &filetype == "rhelp"
         let ind = s:Get_last_paren_idx(line, '(', ')', pb)
@@ -352,21 +351,19 @@ function GetRIndent()
     let post_block = 1
   endif
 
-  " Indent after user defined operator
-  if exists("g:r_indent_op_pattern")
-    let olnum = s:Get_prev_line(lnum)
-    let oline = getline(olnum)
-    if olnum > 0
-      if line =~ g:r_indent_op_pattern
-        if oline =~ g:r_indent_op_pattern
-          return indent(lnum)
-        else
-          return indent(lnum) + &sw
-        endif
+  " Indent after operator pattern
+  let olnum = s:Get_prev_line(lnum)
+  let oline = getline(olnum)
+  if olnum > 0
+    if line =~ g:r_indent_op_pattern
+      if oline =~ g:r_indent_op_pattern
+        return indent(lnum)
       else
-        if oline =~ g:r_indent_op_pattern
-          return indent(lnum) - &sw
-        endif
+        return indent(lnum) + &sw
+      endif
+    else
+      if oline =~ g:r_indent_op_pattern
+        return indent(lnum) - &sw
       endif
     endif
   endif

From 1c3ea48db2c12ffb3b7ca22cef819d21a5ecab38 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Thu, 19 Feb 2015 23:38:55 -0500
Subject: [PATCH 0926/1050] Add code to test indentation after operator

---
 r-plugin/indent_test.R         | 53 +++++++++++++++++++++++++++++-----
 r-plugin/indent_test_noalign.R | 53 +++++++++++++++++++++++++++++-----
 2 files changed, 90 insertions(+), 16 deletions(-)

diff --git a/r-plugin/indent_test.R b/r-plugin/indent_test.R
index 0b2da97..998ea78 100644
--- a/r-plugin/indent_test.R
+++ b/r-plugin/indent_test.R
@@ -542,9 +542,45 @@ test_that('the function works', {
               x <- 0
           })
 
+x <- 1 + 2 + 3 +
+    4 + 5
+x <- 1 - 2 - 3 -
+    4 - 5
+x <- 1 * 2 * 3 *
+    4 * 5
+x <- 1 / 2 / 3 /
+    4 / 5
+y <- x ~
+    x
+y =
+    x
+x <-
+    33
+
+ggplot(data, aes(…)) +
+    geom <- points() +
+    theme <- bw() +
+    scale <- fill <- discrete()
+x <- 0
+
+x = letters %>%
+    sapply(strupper)
+message(x)
+
+flights %>%
+    group <- by(year, month, day) %>%
+    select(arr <- delay, dep <- delay) %>%
+    endop <- "END"
+x <- 0
+
 ############################################################################
 ## indent/r.vim starts to make mistakes here
 
+y = x &
+    x
+y = x |
+    x
+
 test <- this('the function works',
              {
                  x <- 0
@@ -620,14 +656,15 @@ try <- function(expr, silent = FALSE) {
     f
 }
 
-x <- 1 + 2 + 3 +
-    4 + 5
-x <- 1 - 2 - 3 -
-    4 - 5
-x <- 1 * 2 * 3 *
-    4 * 5
-x <- 1 / 2 / 3 /
-    4 / 5
+flights %>%
+    group <- by(year, month, day) %>%
+    select(arr <- delay, dep <- delay) %>%
+    summarise(
+              arr = mean(arr <- delay, na.rm = TRUE),
+              dep = mean(dep <- delay, na.rm = TRUE)
+             ) %>%
+    filter(arr > 30 | dep > 30)
+x <- 0
 
 cat("The End\n")
 
diff --git a/r-plugin/indent_test_noalign.R b/r-plugin/indent_test_noalign.R
index a51030d..7defbaf 100644
--- a/r-plugin/indent_test_noalign.R
+++ b/r-plugin/indent_test_noalign.R
@@ -527,9 +527,45 @@ test_that('the function works',
         x <- 0
     })
 
+x <- 1 + 2 + 3 +
+    4 + 5
+x <- 1 - 2 - 3 -
+    4 - 5
+x <- 1 * 2 * 3 *
+    4 * 5
+x <- 1 / 2 / 3 /
+    4 / 5
+y <- x ~
+    x
+y =
+    x
+x <-
+    33
+
+ggplot(data, aes(…)) +
+    geom <- points() +
+    theme <- bw() +
+    scale <- fill <- discrete()
+x <- 0
+
+x = letters %>%
+    sapply(strupper)
+message(x)
+
+flights %>%
+    group <- by(year, month, day) %>%
+    select(arr <- delay, dep <- delay) %>%
+    endop <- "END"
+x <- 0
+
 ############################################################################
 ## indent/r.vim starts to make mistakes here
 
+y = x &
+    x
+y = x |
+    x
+
 test <- this('the function works', {
         x <- 0
     })
@@ -615,14 +651,15 @@ try <- function(expr, silent = FALSE) {
     f
 }
 
-x <- 1 + 2 + 3 +
-    4 + 5
-x <- 1 - 2 - 3 -
-    4 - 5
-x <- 1 * 2 * 3 *
-    4 * 5
-x <- 1 / 2 / 3 /
-    4 / 5
+flights %>%
+    group <- by(year, month, day) %>%
+    select(arr <- delay, dep <- delay) %>%
+    summarise(
+              arr = mean(arr <- delay, na.rm = TRUE),
+              dep = mean(dep <- delay, na.rm = TRUE)
+             ) %>%
+    filter(arr > 30 | dep > 30)
+x <- 0
 
 cat("The End\n")
 

From 6d322f73625c6d9496337f5863b946314c915008 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Fri, 20 Feb 2015 12:16:41 -0500
Subject: [PATCH 0927/1050] Simplify r_indent_op_pattern

---
 indent/r.vim | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/indent/r.vim b/indent/r.vim
index 9bb0c5a..3d933ed 100644
--- a/indent/r.vim
+++ b/indent/r.vim
@@ -1,7 +1,7 @@
 " Vim indent file
 " Language:	R
 " Author:	Jakson Alves de Aquino 
-" Last Change:	Thu Feb 19, 2015  11:25PM
+" Last Change:	Fri Feb 20, 2015  12:16PM
 
 
 " Only load this indent file when no other was loaded.
@@ -32,7 +32,7 @@ if ! exists("g:r_indent_ess_compatible")
   let g:r_indent_ess_compatible = 0
 endif
 if ! exists("g:r_indent_op_pattern")
-  let g:r_indent_op_pattern = '\(+\|-\|\*\|/\|=\|\~\|%[^%]*%\)$'
+  let g:r_indent_op_pattern = '\(+\|-\|\*\|/\|=\|\~\|%\)$'
 endif
 
 function s:RDelete_quotes(line)

From 9dbc1f43dbe6fe0c6bbd683f92eb3337a05d2b61 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sat, 21 Feb 2015 11:01:43 -0500
Subject: [PATCH 0928/1050] Change how source() is called - Remove option
 vimrplugin_maxdeparse - Remove the "echo" send commands - Add the option
 vimrplugin_source_args

---
 Makefile                     |  2 +-
 doc/r-plugin.txt             | 38 +++++---------------
 ftplugin/r_rplugin.vim       |  3 +-
 ftplugin/rmd_rplugin.vim     | 10 +++---
 ftplugin/rnoweb_rplugin.vim  | 10 +++---
 ftplugin/rrst_rplugin.vim    | 10 +++---
 r-plugin/common_global.vim   | 69 +++++++++++++++---------------------
 r-plugin/global_r_plugin.vim |  6 ++--
 r-plugin/gui_running.vim     | 51 +++++++++++---------------
 9 files changed, 75 insertions(+), 124 deletions(-)

diff --git a/Makefile b/Makefile
index 556d36f..dce5737 100644
--- a/Makefile
+++ b/Makefile
@@ -22,7 +22,7 @@
 
 
 PLUGINHOME=`pwd`
-PLUGINVERSION=1.2
+PLUGINVERSION=1.2.1
 DEBIANTIME=`date -R`
 PLUGINRELEASEDATE=`date +"%Y-%m-%d"`
 VIM2HTML=/usr/local/share/vim/vim74/doc/vim2html.pl 
diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index f3b73b7..7d8c57f 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -396,34 +396,23 @@ Start/Close
 
 Send
   . File                                               \aa
-  . File (echo)                                        \ae
   . File (open .Rout)                                  \ao
   --------------------------------------------------------
   . Block (cur)                                        \bb
-  . Block (cur, echo)                                  \be
   . Block (cur, down)                                  \bd
-  . Block (cur, echo and down)                         \ba
   --------------------------------------------------------
   . Chunk (cur)                                        \cc
-  . Chunk (cur, echo)                                  \ce
   . Chunk (cur, down)                                  \cd
-  . Chunk (cur, echo and down)                         \ca
   . Chunk (from first to here)                         \ch
   --------------------------------------------------------
   . Function (cur)                                     \ff
-  . Function (cur, echo)                               \fe
   . Function (cur and down)                            \fd
-  . Function (cur, echo and down)                      \fa
   --------------------------------------------------------
   . Selection                                          \ss
-  . Selection (echo)                                   \se
   . Selection (and down)                               \sd
-  . Selection (echo and down)                          \sa
   --------------------------------------------------------
   . Paragraph                                          \pp
-  . Paragraph (echo)                                   \pe
   . Paragraph (and down)                               \pd
-  . Paragraph (echo and down)                          \pa
   --------------------------------------------------------
   . Line                                                \l
   . Line (and down)                                     \d
@@ -1208,7 +1197,7 @@ is running:
 |vimrplugin_applescript|       Use osascript in Mac OS X
 |vimrplugin_listmethods|       Do `vim.list.args()` instead of `args()`
 |vimrplugin_specialplot|       Do `vim.plot()` instead of `plot()`
-|vimrplugin_maxdeparse|        Argument to R `source()` function
+|vimrplugin_source_args|       Arguments to R `source()` function
 |vimrplugin_latexcmd|          Command to run on .tex files
 |vimrplugin_latexmk|           Define wether `latexmk` should be run
 |vimrplugin_sweaveargs|        Arguments do `Sweave()`
@@ -1606,13 +1595,12 @@ after rg if you put the following line in your |vimrc|:
 <
 
 ------------------------------------------------------------------------------
-						       *vimrplugin_maxdeparse*
-6.16. maxdeparse~
+						      *vimrplugin_source_args*
+6.16. Arguments to R source() function~
 
-You can set the argument maxdeparse to be passed to R's `source()` function.
-Example:
+You can add arguments to be passed to R's `source()` function. Example:
 >
-   let vimrplugin_maxdeparse = 300
+   let vimrplugin_source_args = "max.deparse.length = 300, echo = TRUE"
 <
 
 ------------------------------------------------------------------------------
@@ -2123,8 +2111,7 @@ The above example shows how to change key binding used to start R from
 
 Only the custom key bindings for Normal mode are shown in Vim's menu, but you
 can type |:map| to see the complete list of current mappings, and below is the
-list of the names for custom key bindings (the prefix RE means "echo";
-RD, "cursor down"; RED, both "echo" and "down"):
+list of the names for custom key bindings (the prefix RD means "cursor down"):
 
    Star/Close R~
    RStart
@@ -2159,21 +2146,13 @@ RD, "cursor down"; RED, both "echo" and "down"):
 
    Send code to R console~
    RSendSelection
-   RESendSelection
    RDSendSelection
-   REDSendSelection
    RSendMBlock
-   RESendMBlock
    RDSendMBlock
-   REDSendMBlock
    RSendParagraph
-   RESendParagraph
    RDSendParagraph
-   REDSendParagraph
    RSendFunction
-   RESendFunction
    RDSendFunction
-   REDSendFunction
    RSendFile
    RESendFile
 
@@ -2194,8 +2173,6 @@ RD, "cursor down"; RED, both "echo" and "down"):
    Support to Sweave and knitr~
    RSendChunk
    RDSendChunk
-   RESendChunk
-   REDSendChunk
    RSendChunkFH (from the first chunk to here)
    RBibTeX    (Sweave)
    RBibTeXK   (Knitr)
@@ -2853,6 +2830,9 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details.
  * New options: vimrplugin_after_start, vimrplugin_args_in_stline,
    vimrplugin_save_win_pos and vimrplugin_arrange_windows.
 
+ * Remove option vimrplugin_maxdeparse, remove the "echo" send
+   commands and add the option vimrplugin_source_args.
+
 1.2 (2015-01-18)
 
  * Remove support for Neovim. See: https://github.com/jalvesaq/Nvim-R
diff --git a/ftplugin/r_rplugin.vim b/ftplugin/r_rplugin.vim
index 1c62e65..fa8cd43 100644
--- a/ftplugin/r_rplugin.vim
+++ b/ftplugin/r_rplugin.vim
@@ -78,8 +78,7 @@ call RCreateStartMaps()
 call RCreateEditMaps()
 
 " Only .R files are sent to R
-call RCreateMaps("ni", 'RSendFile',     'aa', ':call SendFileToR("silent")')
-call RCreateMaps("ni", 'RESendFile',    'ae', ':call SendFileToR("echo")')
+call RCreateMaps("ni", 'RSendFile',     'aa', ':call SendFileToR()')
 call RCreateMaps("ni", 'RShowRout',     'ao', ':call ShowRout()')
 
 " Knitr::spin
diff --git a/ftplugin/rmd_rplugin.vim b/ftplugin/rmd_rplugin.vim
index de6ea09..f967970 100644
--- a/ftplugin/rmd_rplugin.vim
+++ b/ftplugin/rmd_rplugin.vim
@@ -97,7 +97,7 @@ function! RMakeRmd(t)
 endfunction
 
 " Send Rmd chunk to R
-function! SendRmdChunkToR(e, m)
+function! SendRmdChunkToR(m)
     if RmdIsInRCode(0) == 0
         call RWarningMsg("Not inside an R code chunk.")
         return
@@ -105,7 +105,7 @@ function! SendRmdChunkToR(e, m)
     let chunkline = search("^[ \t]*```[ ]*{r", "bncW") + 1
     let docline = search("^[ \t]*```", "ncW") - 1
     let lines = getline(chunkline, docline)
-    let ok = RSourceLines(lines, a:e)
+    let ok = RSourceLines(lines)
     if ok == 0
         return
     endif
@@ -136,10 +136,8 @@ call RCreateMaps("nvi", 'RMakePDFK',      'kp', ':call RMakeRmd("pdf_docum
 call RCreateMaps("nvi", 'RMakePDFKb',     'kl', ':call RMakeRmd("beamer_presentation")')
 call RCreateMaps("nvi", 'RMakeHTML',      'kh', ':call RMakeRmd("html_document")')
 call RCreateMaps("nvi", 'RMakeODT',       'ko', ':call RMakeRmd("odt")')
-call RCreateMaps("ni",  'RSendChunk',     'cc', ':call b:SendChunkToR("silent", "stay")')
-call RCreateMaps("ni",  'RESendChunk',    'ce', ':call b:SendChunkToR("echo", "stay")')
-call RCreateMaps("ni",  'RDSendChunk',    'cd', ':call b:SendChunkToR("silent", "down")')
-call RCreateMaps("ni",  'REDSendChunk',   'ca', ':call b:SendChunkToR("echo", "down")')
+call RCreateMaps("ni",  'RSendChunk',     'cc', ':call b:SendChunkToR("stay")')
+call RCreateMaps("ni",  'RDSendChunk',    'cd', ':call b:SendChunkToR("down")')
 call RCreateMaps("n",  'RNextRChunk',     'gn', ':call b:NextRChunk()')
 call RCreateMaps("n",  'RPreviousRChunk', 'gN', ':call b:PreviousRChunk()')
 
diff --git a/ftplugin/rnoweb_rplugin.vim b/ftplugin/rnoweb_rplugin.vim
index 0a6adb1..31abc62 100644
--- a/ftplugin/rnoweb_rplugin.vim
+++ b/ftplugin/rnoweb_rplugin.vim
@@ -200,7 +200,7 @@ function! RMakePDF(bibtex, knit)
 endfunction
 
 " Send Sweave chunk to R
-function! RnwSendChunkToR(e, m)
+function! RnwSendChunkToR(m)
     if RnwIsInRCode(0) == 0
         call RWarningMsg("Not inside an R code chunk.")
         return
@@ -208,7 +208,7 @@ function! RnwSendChunkToR(e, m)
     let chunkline = search("^<<", "bncW") + 1
     let docline = search("^@", "ncW") - 1
     let lines = getline(chunkline, docline)
-    let ok = RSourceLines(lines, a:e)
+    let ok = RSourceLines(lines)
     if ok == 0
         return
     endif
@@ -273,10 +273,8 @@ call RCreateMaps("nvi", 'RKnit',        'kn', ':call RKnitRnw()')
 call RCreateMaps("nvi", 'RMakePDFK',    'kp', ':call RMakePDF("nobib", 1)')
 call RCreateMaps("nvi", 'RBibTeXK',     'kb', ':call RMakePDF("bibtex", 1)')
 call RCreateMaps("nvi", 'RIndent',      'si', ':call RnwToggleIndentSty()')
-call RCreateMaps("ni",  'RSendChunk',   'cc', ':call b:SendChunkToR("silent", "stay")')
-call RCreateMaps("ni",  'RESendChunk',  'ce', ':call b:SendChunkToR("echo", "stay")')
-call RCreateMaps("ni",  'RDSendChunk',  'cd', ':call b:SendChunkToR("silent", "down")')
-call RCreateMaps("ni",  'REDSendChunk', 'ca', ':call b:SendChunkToR("echo", "down")')
+call RCreateMaps("ni",  'RSendChunk',   'cc', ':call b:SendChunkToR("stay")')
+call RCreateMaps("ni",  'RDSendChunk',  'cd', ':call b:SendChunkToR("down")')
 call RCreateMaps("nvi", 'ROpenPDF',     'op', ':call ROpenPDF("Get Master")')
 if g:vimrplugin_synctex
     call RCreateMaps("ni",  'RSyncFor',     'gp', ':call SyncTeX_forward()')
diff --git a/ftplugin/rrst_rplugin.vim b/ftplugin/rrst_rplugin.vim
index 1bdd07b..113ae6c 100644
--- a/ftplugin/rrst_rplugin.vim
+++ b/ftplugin/rrst_rplugin.vim
@@ -136,7 +136,7 @@ function! RMakePDFrrst()
 endfunction
 
 " Send Rrst chunk to R
-function! SendRrstChunkToR(e, m)
+function! SendRrstChunkToR(m)
     if RrstIsInRCode(0) == 0
         call RWarningMsg("Not inside an R code chunk.")
         return
@@ -144,7 +144,7 @@ function! SendRrstChunkToR(e, m)
     let chunkline = search("^\\.\\. {r", "bncW") + 1
     let docline = search("^\\.\\. \\.\\.", "ncW") - 1
     let lines = getline(chunkline, docline)
-    let ok = RSourceLines(lines, a:e)
+    let ok = RSourceLines(lines)
     if ok == 0
         return
     endif
@@ -174,10 +174,8 @@ call RCreateMaps("nvi", 'RMakePDFK',      'kp', ':call RMakePDFrrst()')
 call RCreateMaps("nvi", 'RMakeHTML',      'kh', ':call RMakeHTMLrrst("html")')
 call RCreateMaps("nvi", 'RMakeODT',       'ko', ':call RMakeHTMLrrst("odt")')
 call RCreateMaps("nvi", 'RIndent',        'si', ':call RrstToggleIndentSty()')
-call RCreateMaps("ni",  'RSendChunk',     'cc', ':call b:SendChunkToR("silent", "stay")')
-call RCreateMaps("ni",  'RESendChunk',    'ce', ':call b:SendChunkToR("echo", "stay")')
-call RCreateMaps("ni",  'RDSendChunk',    'cd', ':call b:SendChunkToR("silent", "down")')
-call RCreateMaps("ni",  'REDSendChunk',   'ca', ':call b:SendChunkToR("echo", "down")')
+call RCreateMaps("ni",  'RSendChunk',     'cc', ':call b:SendChunkToR("stay")')
+call RCreateMaps("ni",  'RDSendChunk',    'cd', ':call b:SendChunkToR("down")')
 call RCreateMaps("n",  'RNextRChunk',     'gn', ':call b:NextRChunk()')
 call RCreateMaps("n",  'RPreviousRChunk', 'gN', ':call b:PreviousRChunk()')
 
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 17995ab..6b9f844 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -1418,7 +1418,7 @@ function RGetKeyWord()
 endfunction
 
 " Send sources to R
-function RSourceLines(lines, e)
+function RSourceLines(lines)
     let lines = a:lines
     if &filetype == "rrst"
         let lines = map(copy(lines), 'substitute(v:val, "^\\.\\. \\?", "", "")')
@@ -1427,37 +1427,33 @@ function RSourceLines(lines, e)
         let lines = map(copy(lines), 'substitute(v:val, "^\\`\\`\\?", "", "")')
     endif
     call writefile(lines, g:rplugin_rsource)
-    if a:e == "echo"
-        if exists("g:vimrplugin_maxdeparse")
-            let rcmd = 'base::source("' . g:rplugin_rsource . '", echo=TRUE, max.deparse=' . g:vimrplugin_maxdeparse . ')'
-        else
-            let rcmd = 'base::source("' . g:rplugin_rsource . '", echo=TRUE)'
-        endif
-    else
+    if g:vimrplugin_source_args == ""
         let rcmd = 'base::source("' . g:rplugin_rsource . '")'
+    else
+        let rcmd = 'base::source("' . g:rplugin_rsource . '", ' . g:vimrplugin_source_args . ')'
     endif
     let ok = g:SendCmdToR(rcmd)
     return ok
 endfunction
 
 " Send file to R
-function SendFileToR(e)
+function SendFileToR()
     update
     let fpath = expand("%:p")
     if has("win32") || has("win64")
         let fpath = substitute(fpath, "\\", "/", "g")
     endif
-    if a:e == "echo"
-        call g:SendCmdToR('base::source("' . fpath . '", echo=TRUE)')
-    else
+    if g:vimrplugin_source_args == ""
         call g:SendCmdToR('base::source("' . fpath . '")')
+    else
+        call g:SendCmdToR('base::source("' . fpath . '", ' . g:vimrplugin_source_args . ')')
     endif
 endfunction
 
 " Send block to R
 " Adapted from marksbrowser plugin
 " Function to get the marks which the cursor is between
-function SendMBlockToR(e, m)
+function SendMBlockToR(m)
     if &filetype != "r" && b:IsInRCode(1) == 0
         return
     endif
@@ -1487,7 +1483,7 @@ function SendMBlockToR(e, m)
         let lineB -= 1
     endif
     let lines = getline(lineA, lineB)
-    let ok = b:SourceLines(lines, a:e)
+    let ok = b:SourceLines(lines)
     if ok == 0
         return
     endif
@@ -1498,7 +1494,7 @@ function SendMBlockToR(e, m)
 endfunction
 
 " Send functions to R
-function SendFunctionToR(e, m)
+function SendFunctionToR(m)
     if &filetype != "r" && b:IsInRCode(1) == 0
         return
     endif
@@ -1550,13 +1546,13 @@ function SendFunctionToR(e, m)
 
     if startline > lastline
         call setpos(".", [0, firstline - 1, 1])
-        call SendFunctionToR(a:e, a:m)
+        call SendFunctionToR(a:m)
         call setpos(".", save_cursor)
         return
     endif
 
     let lines = getline(firstline, lastline)
-    let ok = b:SourceLines(lines, a:e)
+    let ok = b:SourceLines(lines)
     if  ok == 0
         return
     endif
@@ -1567,7 +1563,7 @@ function SendFunctionToR(e, m)
 endfunction
 
 " Send selection to R
-function SendSelectionToR(e, m)
+function SendSelectionToR(m)
     if &filetype != "r" && b:IsInRCode(1) == 0
         if !(&filetype == "rnoweb" && getline(".") =~ "\\Sexpr{")
             return
@@ -1617,7 +1613,7 @@ function SendSelectionToR(e, m)
         let lines[llen] = strpart(lines[llen], 0, j)
     endif
 
-    let ok = b:SourceLines(lines, a:e)
+    let ok = b:SourceLines(lines)
     if ok == 0
         return
     endif
@@ -1630,7 +1626,7 @@ function SendSelectionToR(e, m)
 endfunction
 
 " Send paragraph to R
-function SendParagraphToR(e, m)
+function SendParagraphToR(m)
     if &filetype != "r" && b:IsInRCode(1) == 0
         return
     endif
@@ -1655,7 +1651,7 @@ function SendParagraphToR(e, m)
         endif
     endwhile
     let lines = getline(i, j)
-    let ok = b:SourceLines(lines, a:e)
+    let ok = b:SourceLines(lines)
     if ok == 0
         return
     endif
@@ -1699,7 +1695,7 @@ function SendFHChunkToR()
             " Child R chunk
             if curbuf[idx] =~ chdchk
                 " First run everything up to child chunk and reset buffer
-                call b:SourceLines(codelines, "silent")
+                call b:SourceLines(codelines)
                 let codelines = []
 
                 " Next run child chunk and continue
@@ -1717,7 +1713,7 @@ function SendFHChunkToR()
             let idx += 1
         endif
     endwhile
-    call b:SourceLines(codelines, "silent")
+    call b:SourceLines(codelines)
 endfunction
 
 function KnitChild(line, godown)
@@ -2774,31 +2770,23 @@ endfunction
 function RCreateSendMaps()
     " Block
     "-------------------------------------
-    call RCreateMaps("ni", 'RSendMBlock',     'bb', ':call SendMBlockToR("silent", "stay")')
-    call RCreateMaps("ni", 'RESendMBlock',    'be', ':call SendMBlockToR("echo", "stay")')
-    call RCreateMaps("ni", 'RDSendMBlock',    'bd', ':call SendMBlockToR("silent", "down")')
-    call RCreateMaps("ni", 'REDSendMBlock',   'ba', ':call SendMBlockToR("echo", "down")')
+    call RCreateMaps("ni", 'RSendMBlock',     'bb', ':call SendMBlockToR("stay")')
+    call RCreateMaps("ni", 'RDSendMBlock',    'bd', ':call SendMBlockToR("down")')
 
     " Function
     "-------------------------------------
-    call RCreateMaps("nvi", 'RSendFunction',  'ff', ':call SendFunctionToR("silent", "stay")')
-    call RCreateMaps("nvi", 'RDSendFunction', 'fe', ':call SendFunctionToR("echo", "stay")')
-    call RCreateMaps("nvi", 'RDSendFunction', 'fd', ':call SendFunctionToR("silent", "down")')
-    call RCreateMaps("nvi", 'RDSendFunction', 'fa', ':call SendFunctionToR("echo", "down")')
+    call RCreateMaps("nvi", 'RSendFunction',  'ff', ':call SendFunctionToR("stay")')
+    call RCreateMaps("nvi", 'RDSendFunction', 'fd', ':call SendFunctionToR("down")')
 
     " Selection
     "-------------------------------------
-    call RCreateMaps("v", 'RSendSelection',   'ss', ':call SendSelectionToR("silent", "stay")')
-    call RCreateMaps("v", 'RESendSelection',  'se', ':call SendSelectionToR("echo", "stay")')
-    call RCreateMaps("v", 'RDSendSelection',  'sd', ':call SendSelectionToR("silent", "down")')
-    call RCreateMaps("v", 'REDSendSelection', 'sa', ':call SendSelectionToR("echo", "down")')
+    call RCreateMaps("v", 'RSendSelection',   'ss', ':call SendSelectionToR("stay")')
+    call RCreateMaps("v", 'RDSendSelection',  'sd', ':call SendSelectionToR("down")')
 
     " Paragraph
     "-------------------------------------
-    call RCreateMaps("ni", 'RSendParagraph',   'pp', ':call SendParagraphToR("silent", "stay")')
-    call RCreateMaps("ni", 'RESendParagraph',  'pe', ':call SendParagraphToR("echo", "stay")')
-    call RCreateMaps("ni", 'RDSendParagraph',  'pd', ':call SendParagraphToR("silent", "down")')
-    call RCreateMaps("ni", 'REDSendParagraph', 'pa', ':call SendParagraphToR("echo", "down")')
+    call RCreateMaps("ni", 'RSendParagraph',   'pp', ':call SendParagraphToR("stay")')
+    call RCreateMaps("ni", 'RDSendParagraph',  'pd', ':call SendParagraphToR("down")')
 
     if &filetype == "rnoweb" || &filetype == "rmd" || &filetype == "rrst"
         call RCreateMaps("ni", 'RSendChunkFH', 'ch', ':call SendFHChunkToR()')
@@ -2817,7 +2805,7 @@ function RCreateSendMaps()
 
     " For compatibility with Johannes Ranke's plugin
     if g:vimrplugin_map_r == 1
-        vnoremap  r :call SendSelectionToR("silent", "down")
+        vnoremap  r :call SendSelectionToR("down")
     endif
 endfunction
 
@@ -2961,6 +2949,7 @@ call RSetDefaultValue("g:vimrplugin_openpdf",           2)
 call RSetDefaultValue("g:vimrplugin_synctex",           1)
 call RSetDefaultValue("g:vimrplugin_openhtml",          0)
 call RSetDefaultValue("g:vimrplugin_vim_wd",            0)
+call RSetDefaultValue("g:vimrplugin_source_args",    "''")
 call RSetDefaultValue("g:vimrplugin_after_start",    "''")
 call RSetDefaultValue("g:vimrplugin_restart",           0)
 call RSetDefaultValue("g:vimrplugin_vsplit",            0)
diff --git a/r-plugin/global_r_plugin.vim b/r-plugin/global_r_plugin.vim
index d5f304a..1ba42ca 100644
--- a/r-plugin/global_r_plugin.vim
+++ b/r-plugin/global_r_plugin.vim
@@ -28,13 +28,13 @@ if exists("g:rplugin_did_sourcelines")
 endif
 let g:rplugin_did_sourcelines = 1
 
-function SourceNotDefined(lines, e)
+function SourceNotDefined(lines)
     echohl WarningMsg
     echo 'The function to source "' . &filetype . '" lines is not defined.'
     echohl Normal
 endfunction
 
-function JuliaSourceLines(lines, e)
+function JuliaSourceLines(lines)
     call writefile(a:lines, b:rsource)
     let jcmd = 'include("' . b:rsource . '")'
     let ok = g:SendCmdToR(jcmd)
@@ -57,7 +57,7 @@ function SetExeCmd()
         let b:rplugin_r_args = " "
         let b:quit_command = "quit()"
         let b:SourceLines = function("JuliaSourceLines")
-        call RCreateMaps("ni", 'RSendFile',     'aa', ':call JuliaSourceLines(getline(1, "$"), "silent")')
+        call RCreateMaps("ni", 'RSendFile',     'aa', ':call JuliaSourceLines(getline(1, "$"))')
     elseif &filetype == "python"
         let b:rplugin_R = "python"
         let b:rplugin_r_args = " "
diff --git a/r-plugin/gui_running.vim b/r-plugin/gui_running.vim
index d27bdfa..e300327 100644
--- a/r-plugin/gui_running.vim
+++ b/r-plugin/gui_running.vim
@@ -30,43 +30,32 @@ function MakeRMenu()
     " Send
     "----------------------------------------------------------------------------
     if &filetype == "r" || g:vimrplugin_never_unmake_menu
-        call RCreateMenuItem("ni", 'Send.File', 'RSendFile', 'aa', ':call SendFileToR("silent")')
-        call RCreateMenuItem("ni", 'Send.File\ (echo)', 'RESendFile', 'ae', ':call SendFileToR("echo")')
+        call RCreateMenuItem("ni", 'Send.File', 'RSendFile', 'aa', ':call SendFileToR()')
         call RCreateMenuItem("ni", 'Send.File\ (open\ \.Rout)', 'RShowRout', 'ao', ':call ShowRout()')
     endif
     "-------------------------------
     menu R.Send.-Sep1- 
-    call RCreateMenuItem("ni", 'Send.Block\ (cur)', 'RSendMBlock', 'bb', ':call SendMBlockToR("silent", "stay")')
-    call RCreateMenuItem("ni", 'Send.Block\ (cur,\ echo)', 'RESendMBlock', 'be', ':call SendMBlockToR("echo", "stay")')
-    call RCreateMenuItem("ni", 'Send.Block\ (cur,\ down)', 'RDSendMBlock', 'bd', ':call SendMBlockToR("silent", "down")')
-    call RCreateMenuItem("ni", 'Send.Block\ (cur,\ echo\ and\ down)', 'REDSendMBlock', 'ba', ':call SendMBlockToR("echo", "down")')
+    call RCreateMenuItem("ni", 'Send.Block\ (cur)', 'RSendMBlock', 'bb', ':call SendMBlockToR("stay")')
+    call RCreateMenuItem("ni", 'Send.Block\ (cur,\ down)', 'RDSendMBlock', 'bd', ':call SendMBlockToR("down")')
     "-------------------------------
     if &filetype == "rnoweb" || &filetype == "rmd" || &filetype == "rrst" || g:vimrplugin_never_unmake_menu
         menu R.Send.-Sep2- 
-        call RCreateMenuItem("ni", 'Send.Chunk\ (cur)', 'RSendChunk', 'cc', ':call b:SendChunkToR("silent", "stay")')
-        call RCreateMenuItem("ni", 'Send.Chunk\ (cur,\ echo)', 'RESendChunk', 'ce', ':call b:SendChunkToR("echo", "stay")')
-        call RCreateMenuItem("ni", 'Send.Chunk\ (cur,\ down)', 'RDSendChunk', 'cd', ':call b:SendChunkToR("silent", "down")')
-        call RCreateMenuItem("ni", 'Send.Chunk\ (cur,\ echo\ and\ down)', 'REDSendChunk', 'ca', ':call b:SendChunkToR("echo", "down")')
+        call RCreateMenuItem("ni", 'Send.Chunk\ (cur)', 'RSendChunk', 'cc', ':call b:SendChunkToR("stay")')
+        call RCreateMenuItem("ni", 'Send.Chunk\ (cur,\ down)', 'RDSendChunk', 'cd', ':call b:SendChunkToR("down")')
         call RCreateMenuItem("ni", 'Send.Chunk\ (from\ first\ to\ here)', 'RSendChunkFH', 'ch', ':call SendFHChunkToR()')
     endif
     "-------------------------------
     menu R.Send.-Sep3- 
-    call RCreateMenuItem("ni", 'Send.Function\ (cur)', 'RSendFunction', 'ff', ':call SendFunctionToR("silent", "stay")')
-    call RCreateMenuItem("ni", 'Send.Function\ (cur,\ echo)', 'RESendFunction', 'fe', ':call SendFunctionToR("echo", "stay")')
-    call RCreateMenuItem("ni", 'Send.Function\ (cur\ and\ down)', 'RDSendFunction', 'fd', ':call SendFunctionToR("silent", "down")')
-    call RCreateMenuItem("ni", 'Send.Function\ (cur,\ echo\ and\ down)', 'REDSendFunction', 'fa', ':call SendFunctionToR("echo", "down")')
+    call RCreateMenuItem("ni", 'Send.Function\ (cur)', 'RSendFunction', 'ff', ':call SendFunctionToR("stay")')
+    call RCreateMenuItem("ni", 'Send.Function\ (cur\ and\ down)', 'RDSendFunction', 'fd', ':call SendFunctionToR("down")')
     "-------------------------------
     menu R.Send.-Sep4- 
-    call RCreateMenuItem("v", 'Send.Selection', 'RSendSelection', 'ss', ':call SendSelectionToR("silent", "stay")')
-    call RCreateMenuItem("v", 'Send.Selection\ (echo)', 'RESendSelection', 'se', ':call SendSelectionToR("echo", "stay")')
-    call RCreateMenuItem("v", 'Send.Selection\ (and\ down)', 'RDSendSelection', 'sd', ':call SendSelectionToR("silent", "down")')
-    call RCreateMenuItem("v", 'Send.Selection\ (echo\ and\ down)', 'REDSendSelection', 'sa', ':call SendSelectionToR("echo", "down")')
+    call RCreateMenuItem("v", 'Send.Selection', 'RSendSelection', 'ss', ':call SendSelectionToR("stay")')
+    call RCreateMenuItem("v", 'Send.Selection\ (and\ down)', 'RDSendSelection', 'sd', ':call SendSelectionToR("down")')
     "-------------------------------
     menu R.Send.-Sep5- 
-    call RCreateMenuItem("ni", 'Send.Paragraph', 'RSendParagraph', 'pp', ':call SendParagraphToR("silent", "stay")')
-    call RCreateMenuItem("ni", 'Send.Paragraph\ (echo)', 'RESendParagraph', 'pe', ':call SendParagraphToR("echo", "stay")')
-    call RCreateMenuItem("ni", 'Send.Paragraph\ (and\ down)', 'RDSendParagraph', 'pd', ':call SendParagraphToR("silent", "down")')
-    call RCreateMenuItem("ni", 'Send.Paragraph\ (echo\ and\ down)', 'REDSendParagraph', 'pa', ':call SendParagraphToR("echo", "down")')
+    call RCreateMenuItem("ni", 'Send.Paragraph', 'RSendParagraph', 'pp', ':call SendParagraphToR("stay")')
+    call RCreateMenuItem("ni", 'Send.Paragraph\ (and\ down)', 'RDSendParagraph', 'pd', ':call SendParagraphToR("down")')
     "-------------------------------
     menu R.Send.-Sep6- 
     call RCreateMenuItem("ni0", 'Send.Line', 'RSendLine', 'l', ':call SendLineToR("stay")')
@@ -234,17 +223,17 @@ function MakeRMenu()
         amenu  ToolBar.RClose :call RQuit('no')
         "---------------------------
         if &filetype == "r" || g:vimrplugin_never_unmake_menu
-            nmenu  ToolBar.RSendFile :call SendFileToR("echo")
-            imenu  ToolBar.RSendFile :call SendFileToR("echo")
+            nmenu  ToolBar.RSendFile :call SendFileToR()
+            imenu  ToolBar.RSendFile :call SendFileToR()
             let g:rplugin_hasRSFbutton = 1
         endif
-        nmenu  ToolBar.RSendBlock :call SendMBlockToR("echo", "down")
-        imenu  ToolBar.RSendBlock :call SendMBlockToR("echo", "down")
-        nmenu  ToolBar.RSendFunction :call SendFunctionToR("echo", "down")
-        imenu  ToolBar.RSendFunction :call SendFunctionToR("echo", "down")
-        vmenu  ToolBar.RSendSelection :call SendSelectionToR("echo", "down")
-        nmenu  ToolBar.RSendParagraph :call SendParagraphToR("echo", "down")
-        imenu  ToolBar.RSendParagraph :call SendParagraphToR("echo", "down")
+        nmenu  ToolBar.RSendBlock :call SendMBlockToR("down")
+        imenu  ToolBar.RSendBlock :call SendMBlockToR("down")
+        nmenu  ToolBar.RSendFunction :call SendFunctionToR("down")
+        imenu  ToolBar.RSendFunction :call SendFunctionToR("down")
+        vmenu  ToolBar.RSendSelection :call SendSelectionToR("down")
+        nmenu  ToolBar.RSendParagraph :call SendParagraphToR("down")
+        imenu  ToolBar.RSendParagraph :call SendParagraphToR("down")
         nmenu  ToolBar.RSendLine :call SendLineToR("down")
         imenu  ToolBar.RSendLine :call SendLineToR("down")
         "---------------------------

From 00fa16688ee337871a4634f3356b281c060cfc81 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sat, 21 Feb 2015 23:07:10 -0500
Subject: [PATCH 0929/1050] Remove broken link from README.md

---
 README.md | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/README.md b/README.md
index 64efa00..1a3dab6 100644
--- a/README.md
+++ b/README.md
@@ -12,7 +12,3 @@ Please, read the file *doc/r-plugin.txt* for usage details.
 
 If you decide to use this version, you will also need the development version
 of vimcom: https://github.com/jalvesaq/VimCom
-
-Note: Joris Muller wrote [installation instructions for MacVim] on OS X.
-
-[installation instructions for MacVim]: http://jomuller.fr/?p=413

From 7f359d864e0c0a5aba50eb1475a248973f6f0121 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sun, 22 Feb 2015 13:16:39 -0500
Subject: [PATCH 0930/1050] Avoid segmentation fault at startup

---
 r-plugin/common_global.vim | 27 +++++++++++++++++++++++++--
 r-plugin/functions.vim     |  6 ++++++
 2 files changed, 31 insertions(+), 2 deletions(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 6b9f844..1a61d98 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -608,7 +608,28 @@ function TmuxActivePane()
   endif
 endfunction
 
+function DelayedFillLibList()
+    autocmd! RStarting
+    augroup! RStarting
+    let g:rplugin_starting_R = 0
+    if exists("g:rplugin_fillrliblist_called") && g:rplugin_fillrliblist_called
+        let g:rplugin_fillrliblist_called = 0
+        call FillRLibList()
+    endif
+endfunction
+
 function StartR_TmuxSplit(rcmd)
+    " Vim crashes if the syntax highlight is changed while the window is
+    " being resized, but only if the R syntax is included in another filetype
+    if &filetype != "r"
+        let g:rplugin_starting_R = 1
+        augroup RStarting
+            autocmd!
+            autocmd CursorMoved  call DelayedFillLibList()
+            autocmd CursorMovedI  call DelayedFillLibList()
+        augroup END
+    endif
+
     let g:rplugin_vim_pane = TmuxActivePane()
     let tmuxconf = ['set-environment VIMRPLUGIN_TMPDIR "' . g:rplugin_tmpdir . '"',
                 \ 'set-environment VIMRPLUGIN_COMPLDIR "' . substitute(g:rplugin_compldir, ' ', '\\ ', "g") . '"',
@@ -950,8 +971,9 @@ function WaitVimComStart()
 
         if g:rplugin_do_tmux_split
             " Environment variables persists across Tmux windows.
-            " Leave a hint (to vimcom) that R was not started by Vim:
-            call system("tmux set-environment VIMRPLUGIN_TMPDIR None")
+            " Unset VIMRPLUGIN_TMPDIR to avoid vimcom loading its C library
+            " when R was not started by Vim:
+            call system("tmux set-environment -u VIMRPLUGIN_TMPDIR")
         endif
         return 1
     else
@@ -3233,6 +3255,7 @@ let g:rplugin_lastev = ""
 let g:rplugin_last_r_prompt = ""
 let g:rplugin_hasRSFbutton = 0
 let g:rplugin_tmuxsname = "VimR-" . substitute(localtime(), '.*\(...\)', '\1', '')
+let g:rplugin_starting_R = 0
 
 " SyncTeX options
 let g:rplugin_has_wmctrl = 0
diff --git a/r-plugin/functions.vim b/r-plugin/functions.vim
index dd7b5af..8b24803 100644
--- a/r-plugin/functions.vim
+++ b/r-plugin/functions.vim
@@ -126,6 +126,12 @@ endfunction
 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 
 function FillRLibList()
+    " Avoid crash (segmentation fault)
+    if g:rplugin_starting_R
+        let g:rplugin_fillrliblist_called = 1
+        return
+    endif
+
     " Update the list of objects for omnicompletion
     if filereadable(g:rplugin_tmpdir . "/libnames_" . $VIMINSTANCEID)
         let g:rplugin_lists_to_load = readfile(g:rplugin_tmpdir . "/libnames_" . $VIMINSTANCEID)

From d80fe50553fb908b505fcd53995b41b9e9f2e757 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sun, 22 Feb 2015 13:26:50 -0500
Subject: [PATCH 0931/1050] Send selected inline R code: Rnoweb, Rmd and Rrst

---
 r-plugin/common_global.vim | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 1a61d98..84431a1 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -1586,9 +1586,12 @@ endfunction
 
 " Send selection to R
 function SendSelectionToR(m)
-    if &filetype != "r" && b:IsInRCode(1) == 0
-        if !(&filetype == "rnoweb" && getline(".") =~ "\\Sexpr{")
-            return
+    if &filetype != "r"
+        if b:IsInRCode(0) == 0
+            if (&filetype == "rnoweb" && getline(".") !~ "\\Sexpr{") || (&filetype == "rmd" && getline(".") !~ "`r ") || (&filetype == "rrst" && getline(".") !~ ":r:`")
+                call RWarningMsg("Not inside an R code chunk.")
+                return
+            endif
         endif
     endif
 

From 6060a9f42ab01db549c0737dd6599d5954addc8c Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Thu, 5 Mar 2015 12:45:35 -0500
Subject: [PATCH 0932/1050] Version 1.2.1

---
 Makefile                   |  2 +-
 doc/r-plugin.txt           | 16 +++++++++-------
 r-plugin/common_global.vim |  4 ++--
 3 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/Makefile b/Makefile
index dce5737..37345ec 100644
--- a/Makefile
+++ b/Makefile
@@ -93,7 +93,7 @@ deb:
 	  - syntax/rrst.vim\n\
 	" > /tmp/vim-r-plugin-tmp/usr/share/vim/registry/vim-r-plugin.yaml
 	# Create the copyright
-	echo "Copyright (C) 2011-2014 Jakson Aquino\n\
+	echo "Copyright (C) 2011-2015 Jakson Aquino\n\
 	\n\
 	License: GPLv2+\n\
 	\n\
diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 7d8c57f..b53f3ce 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -115,7 +115,7 @@ dependencies:
 
     * R's version must be >= 3.0.0: http://www.r-project.org/
 
-    * vimcom = 1.2-0: http://www.lepem.ufc.br/jaa/vimcom.html
+    * vimcom = 1.2-1: http://www.lepem.ufc.br/jaa/vimcom.html
 
       Note: If you cannot build vimcom yourself, you will want to
       download and install the zip file.
@@ -152,7 +152,7 @@ Before installing the plugin, you should install its dependencies:
 
    R >= 3.0.0: http://www.r-project.org/
 
-   vimcom = 1.2-0: http://www.lepem.ufc.br/jaa/vimcom.html
+   vimcom = 1.2-1: http://www.lepem.ufc.br/jaa/vimcom.html
 
    Only if you edit Rnoweb files: MacTeX, BasicTeX or other LaTeX system.
 
@@ -206,7 +206,7 @@ Before installing the plugin, you should install its dependencies:
 
    R >= 3.0.0: http://www.r-project.org/
 
-   vimcom = 1.2-0: http://www.lepem.ufc.br/jaa/vimcom.html
+   vimcom = 1.2-1: http://www.lepem.ufc.br/jaa/vimcom.html
 
    Tmux >= 1.8:   http://tmux.sourceforge.net
                   Tmux is necessary to send commands from Vim to R Console.
@@ -989,7 +989,9 @@ the code below:
 <
 See also:
 
+   https://github.com/jcfaria/Vim-R-plugin/issues/37
    https://github.com/jcfaria/Vim-R-plugin/issues/77
+   https://github.com/jcfaria/Vim-R-plugin/issues/158
    https://github.com/jcfaria/Vim-R-plugin/blob/master/r-plugin/indent_test.R
 
 
@@ -1029,8 +1031,8 @@ The vimcom library is started with the state `busy`.
 							*r-plugin-SyncTeX-win*
 5.7. SyncTeX on Windows~
 
-On Windows, backward search with Sumatra pop ups a console window (`vim`
-running the required --remote-expr command) which quickly disappears.
+On Windows, backward search with Sumatra pop ups a console window which
+quickly disappears (it is `vim` running the required `--remote-expr` command).
 
 
 ------------------------------------------------------------------------------
@@ -1087,7 +1089,7 @@ should:
    2. Build vimcom with the argument `--enable-clientserver`. That is, download
       vimcom from http://www.lepem.ufc.br/jaa/vimcom.html and do in R:
 >
-      install.packages("vimcom_1.2-0.tar.gz", repos = NULL, type = "source",
+      install.packages("vimcom_1.2-1.tar.gz", repos = NULL, type = "source",
                        configure.args = "--enable-clientserver")
 <
    3. Build Vim with X11 support. A user reported success with the following
@@ -2823,7 +2825,7 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details.
 							       *r-plugin-news*
 10. News~
 
-1.2.1 (2015-01-29)
+1.2.1 (2015-03-04)
 
  * Minor bug fixes.
 
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 84431a1..28cab65 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -949,8 +949,8 @@ function WaitVimComStart()
         let g:rplugin_vimcom_home = vr[1]
         let g:rplugin_vimcomport = vr[2]
         let g:rplugin_r_pid = vr[3]
-        if g:rplugin_vimcom_version != "1.2.0.2"
-            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.2.0.2.')
+        if g:rplugin_vimcom_version != "1.2.1"
+            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.2.1.')
             sleep 1
         endif
         if has("win32")

From dcb0990dc3541690422b4fb25af8c19f57f5768d Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Tue, 10 Mar 2015 12:06:38 -0400
Subject: [PATCH 0933/1050] Remove option to start R with --vanilla argument
 See: https://github.com/jalvesaq/nvimcom/issues/2

---
 Makefile                   |  2 +-
 doc/r-plugin.txt           | 10 ++++++----
 r-plugin/common_global.vim | 29 ++++++++++++++---------------
 r-plugin/gui_running.vim   |  1 -
 4 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/Makefile b/Makefile
index 37345ec..cae78cd 100644
--- a/Makefile
+++ b/Makefile
@@ -22,7 +22,7 @@
 
 
 PLUGINHOME=`pwd`
-PLUGINVERSION=1.2.1
+PLUGINVERSION=1.2.2
 DEBIANTIME=`date -R`
 PLUGINRELEASEDATE=`date +"%Y-%m-%d"`
 VIM2HTML=/usr/local/share/vim/vim74/doc/vim2html.pl 
diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index b53f3ce..1e7c6aa 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -5,7 +5,7 @@
 Authors: Jakson A. Aquino   
          Jose Claudio Faria 
 
-Version: 1.2.1
+Version: 1.2.2
 For Vim version 7.4
 
  1. Overview                                    |r-plugin-overview|
@@ -387,7 +387,6 @@ rhelp, rrst, rmd).
 Menu entry                                Default shortcut~
 Start/Close
   . Start R (default)                                  \rf
-  . Start R --vanilla                                  \rv
   . Start R (custom)                                   \rc
   --------------------------------------------------------
   . Close R (no save)                                  \rq
@@ -2117,7 +2116,6 @@ list of the names for custom key bindings (the prefix RD means "cursor down"):
 
    Star/Close R~
    RStart
-   RVanillaStart
    RCustomStart
    RClose
    RSaveClose
@@ -2825,7 +2823,11 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details.
 							       *r-plugin-news*
 10. News~
 
-1.2.1 (2015-03-04)
+1.2.2 (2015-03-10)
+
+ * Remove option to start R with the --vanilla argument.
+
+1.2.1 (2015-03-05)
 
  * Minor bug fixes.
 
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 28cab65..bcc22bf 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -801,14 +801,10 @@ function StartR(whatr)
         lcd %:p:h
     endif
 
-    if a:whatr =~ "vanilla"
-        let b:rplugin_r_args = "--vanilla"
-    else
-        if a:whatr =~ "custom"
-            call inputsave()
-            let b:rplugin_r_args = input('Enter parameters for R: ')
-            call inputrestore()
-        endif
+    if a:whatr =~ "custom"
+        call inputsave()
+        let b:rplugin_r_args = input('Enter parameters for R: ')
+        call inputrestore()
     endif
 
     if g:vimrplugin_applescript
@@ -879,12 +875,13 @@ function StartR(whatr)
         endif
         call StartR_ExternalTerm(rcmd)
         if g:vimrplugin_restart && bufloaded(b:objbrtitle)
-            call WaitVimComStart()
-            call SendToVimCom("\002" . v:servername)
-            call SendToVimCom("\005G .GlobalEnv [Restarting R]")
-            call SendToVimCom("\005L Libraries [Restarting()]")
-            if exists("*UpdateOB")
-                call UpdateOB("GlobalEnv")
+            if WaitVimComStart()
+                call SendToVimCom("\002" . v:servername)
+                call SendToVimCom("\005G .GlobalEnv [Restarting R]")
+                call SendToVimCom("\005L Libraries [Restarting()]")
+                if exists("*UpdateOB")
+                    call UpdateOB("GlobalEnv")
+                endif
             endif
         endif
     endif
@@ -928,6 +925,9 @@ function OpenRScratch()
 endfunction
 
 function WaitVimComStart()
+    if b:rplugin_r_args =~ "vanilla"
+        return 0
+    endif
     if g:vimrplugin_vimcom_wait < 300
         g:vimrplugin_vimcom_wait = 300
     endif
@@ -2756,7 +2756,6 @@ function RCreateStartMaps()
     " Start
     "-------------------------------------
     call RCreateMaps("nvi", 'RStart',        'rf', ':call StartR("R")')
-    call RCreateMaps("nvi", 'RVanillaStart', 'rv', ':call StartR("vanilla")')
     call RCreateMaps("nvi", 'RCustomStart',  'rc', ':call StartR("custom")')
 
     " Close
diff --git a/r-plugin/gui_running.vim b/r-plugin/gui_running.vim
index e300327..799885e 100644
--- a/r-plugin/gui_running.vim
+++ b/r-plugin/gui_running.vim
@@ -17,7 +17,6 @@ function MakeRMenu()
     " Start/Close
     "----------------------------------------------------------------------------
     call RCreateMenuItem("nvi", 'Start/Close.Start\ R\ (default)', 'RStart', 'rf', ':call StartR("R")')
-    call RCreateMenuItem("nvi", 'Start/Close.Start\ R\ --vanilla', 'RVanillaStart', 'rv', ':call StartR("vanilla")')
     call RCreateMenuItem("nvi", 'Start/Close.Start\ R\ (custom)', 'RCustomStart', 'rc', ':call StartR("custom")')
     "-------------------------------
     menu R.Start/Close.-Sep1- 

From 74b182c68bb62d36ce5ddd80c8e2ceab0d0b3601 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Z=C3=A9=20Loff?= 
Date: Fri, 20 Mar 2015 12:40:27 +0000
Subject: [PATCH 0934/1050] Fix path "\" substitution on RMakeRmd

---
 ftplugin/rmd_rplugin.vim | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ftplugin/rmd_rplugin.vim b/ftplugin/rmd_rplugin.vim
index f967970..3216364 100644
--- a/ftplugin/rmd_rplugin.vim
+++ b/ftplugin/rmd_rplugin.vim
@@ -82,7 +82,7 @@ function! RMakeRmd(t)
 
     let rmddir = expand("%:p:h")
     if has("win32") || has("win64")
-        let rmddir = substitute(rnwdir, '\\', '/', 'g')
+        let rmddir = substitute(rmddir, '\\', '/', 'g')
     endif
     if a:t == "default"
         let rcmd = 'vim.interlace.rmd("' . expand("%:t") . '", rmddir = "' . rmddir . '"'

From 5ddee1c899eb033515c54698fa9a4da665d3f695 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sun, 22 Mar 2015 09:31:46 -0400
Subject: [PATCH 0935/1050] Fix indentation of @ in rnoweb files

---
 indent/rnoweb.vim | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/indent/rnoweb.vim b/indent/rnoweb.vim
index 1b83e5d..d0cad3d 100644
--- a/indent/rnoweb.vim
+++ b/indent/rnoweb.vim
@@ -1,7 +1,7 @@
 " Vim indent file
 " Language:	Rnoweb
 " Author:	Jakson Alves de Aquino 
-" Last Change:	Thu Jul 10, 2014  07:11PM
+" Last Change:	Sun Mar 22, 2015  09:28AM
 
 
 " Only load this indent file when no other was loaded.
@@ -23,7 +23,8 @@ if exists("*GetRnowebIndent")
 endif
 
 function GetRnowebIndent()
-  if getline(".") =~ "^<<.*>>=$"
+  let curline = getline(".")
+  if curline =~ '^<<.*>>=$' || curline =~ '^\s*@$'
     return 0
   endif
   if search("^<<", "bncW") > search("^@", "bncW")

From 23f5e90195f6787f1c2989e6559ec520ad379bab Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Mon, 23 Mar 2015 19:33:57 -0400
Subject: [PATCH 0936/1050] Update documentation

---
 doc/r-plugin.txt | 68 +++++++++++++++++++++++++++++++++++++++++++++++-
 indent/rrst.vim  |  2 +-
 2 files changed, 68 insertions(+), 2 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 1e7c6aa..4b24b49 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -1599,10 +1599,17 @@ after rg if you put the following line in your |vimrc|:
 						      *vimrplugin_source_args*
 6.16. Arguments to R source() function~
 
+When you send multiple lines of code to R (a selection of lines, a paragraph,
+code between two marks or a R chunk of code), the Vim-R-plugin saves the lines
+in a temporary file and, then, sends to R the command `source()` to read the
+temporary file.
+
 You can add arguments to be passed to R's `source()` function. Example:
 >
    let vimrplugin_source_args = "max.deparse.length = 300, echo = TRUE"
 <
+See |r-plugin-source-echo| if you frequently need to alternate the `echo`
+argument between `TRUE` and `FALSE`.
 
 ------------------------------------------------------------------------------
 						       *vimrplugin_sweaveargs*
@@ -2808,9 +2815,66 @@ Finally, if you want to use vi key bindings in Bash:
    set keymap vi
 <
 
+------------------------------------------------------------------------------
+							*r-plugin-source-echo*
+9.22. Set echo to TRUE or FALSE when sending multiple lines of code too R~
+
+If you want to alternate the `echo` argument of the `source()` function
+between `TRUE` and `FALSE`, then, you might want to create a couple of maps in
+your vimrc. You can use |nmap| to restrict the maps to Normal mode, |autocmd|
+and  to restrict the maps to R code, and  if you prefer that
+the command is not displayed in Vim's command line. In the example below,
+`ee` sets `echo=TRUE` and `ne` sets `echo=FALSE`:
+>
+   autocmd BufNewFile,BufRead *.R* nmap  ee :let vimrplugin_source_args = "echo = TRUE"
+   autocmd BufNewFile,BufRead *.R* nmap  ne :let vimrplugin_source_args = "echo = FALSE"
+<
+If some of your files are named with lowercase "r" extensions, you have to
+repeat the two commands above with `*.r*`.
+
+
+------------------------------------------------------------------------------
+
+9.23. Syntax highlight of .Rout files~
+
+You can set the foreground colors of R output in your |vimrc|. The example
+below is for a terminal emulator that supports 256 colors (see
+|highlight-ctermfg|):
+>
+   if &t_Co == 256
+       let rout_color_input = 247
+       let rout_color_normal = 39
+       let rout_color_number = 51
+       let rout_color_integer = 51
+       let rout_color_float = 51
+       let rout_color_complex = 51
+       let rout_color_negnum = 183
+       let rout_color_negfloat = 183
+       let rout_color_date = 43
+       let rout_color_true = 78
+       let rout_color_false = 203
+       let rout_color_inf = 39
+       let rout_color_constant = 75
+       let rout_color_string = 79
+       let rout_color_stderr = 33
+       let rout_color_error = 15
+       let rout_color_warn = 1
+       let rout_color_index = 186
+   endif
+<
+To know what number corresponds to your preferred color (among the 256
+possibilities), hover you mouse pointer over the table of colors at the end
+of http://www.lepem.ufc.br/jaa/colorout.html
+
+If you prefer that R output is highlighted using you current |:colorscheme|,
+put in your |vimrc|:
+>
+   let rout_follow_colorscheme = 1
+<
+
 ------------------------------------------------------------------------------
 
-9.22. Integration with GNU Screen, screen plugin, Conque Shell or VimShell~
+9.24. Integration with GNU Screen, screen plugin, Conque Shell or VimShell~
 
 The plugin used to be able to use GNU Screen (through screen plugin), Conque
 Shell or VimShell to send commands to R. This integration was removed on
@@ -2827,6 +2891,8 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details.
 
  * Remove option to start R with the --vanilla argument.
 
+ * Minor bug fixes.
+
 1.2.1 (2015-03-05)
 
  * Minor bug fixes.
diff --git a/indent/rrst.vim b/indent/rrst.vim
index 7b8ca09..ea5b9b7 100644
--- a/indent/rrst.vim
+++ b/indent/rrst.vim
@@ -1,7 +1,7 @@
 " Vim indent file
 " Language:	Rrst
 " Author:	Jakson Alves de Aquino 
-" Last Change:	Thu Jul 10, 2014  07:11PM
+" Last Change:	Thu Jul 09, 2014  07:33PM
 
 
 " Only load this indent file when no other was loaded.

From 11fc8313ab1779f6a2ec74644ad6d0481264e7b3 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Tue, 24 Mar 2015 00:22:14 -0400
Subject: [PATCH 0937/1050] Version 1.2.2

---
 doc/r-plugin.txt           | 19 ++++++++++---------
 r-plugin/common_global.vim | 14 +++++++-------
 2 files changed, 17 insertions(+), 16 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 4b24b49..b81f9b0 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -115,7 +115,7 @@ dependencies:
 
     * R's version must be >= 3.0.0: http://www.r-project.org/
 
-    * vimcom = 1.2-1: http://www.lepem.ufc.br/jaa/vimcom.html
+    * vimcom = 1.2-2: http://www.lepem.ufc.br/jaa/vimcom.html
 
       Note: If you cannot build vimcom yourself, you will want to
       download and install the zip file.
@@ -152,7 +152,7 @@ Before installing the plugin, you should install its dependencies:
 
    R >= 3.0.0: http://www.r-project.org/
 
-   vimcom = 1.2-1: http://www.lepem.ufc.br/jaa/vimcom.html
+   vimcom = 1.2-2: http://www.lepem.ufc.br/jaa/vimcom.html
 
    Only if you edit Rnoweb files: MacTeX, BasicTeX or other LaTeX system.
 
@@ -206,7 +206,7 @@ Before installing the plugin, you should install its dependencies:
 
    R >= 3.0.0: http://www.r-project.org/
 
-   vimcom = 1.2-1: http://www.lepem.ufc.br/jaa/vimcom.html
+   vimcom = 1.2-2: http://www.lepem.ufc.br/jaa/vimcom.html
 
    Tmux >= 1.8:   http://tmux.sourceforge.net
                   Tmux is necessary to send commands from Vim to R Console.
@@ -2824,13 +2824,13 @@ between `TRUE` and `FALSE`, then, you might want to create a couple of maps in
 your vimrc. You can use |nmap| to restrict the maps to Normal mode, |autocmd|
 and  to restrict the maps to R code, and  if you prefer that
 the command is not displayed in Vim's command line. In the example below,
-`ee` sets `echo=TRUE` and `ne` sets `echo=FALSE`:
+`ee` sets `echo=TRUE`:
 >
    autocmd BufNewFile,BufRead *.R* nmap  ee :let vimrplugin_source_args = "echo = TRUE"
-   autocmd BufNewFile,BufRead *.R* nmap  ne :let vimrplugin_source_args = "echo = FALSE"
 <
-If some of your files are named with lowercase "r" extensions, you have to
-repeat the two commands above with `*.r*`.
+You can make another map to set `echo=FALSE`, and, if some of your files are
+named with lowercase "r" extensions, you have to repeat the commands with
+`*.r*`.
 
 
 ------------------------------------------------------------------------------
@@ -2887,9 +2887,10 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details.
 							       *r-plugin-news*
 10. News~
 
-1.2.2 (2015-03-10)
+1.2.2 (2015-03-24)
 
- * Remove option to start R with the --vanilla argument.
+ * Remove option to start R with the --vanilla argument. See vimrplugin_r_args
+   for an alternative.
 
  * Minor bug fixes.
 
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index bcc22bf..d96fcdb 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -795,6 +795,11 @@ function StartR(whatr)
     if !exists("b:rplugin_R")
         call SetRPath()
     endif
+    if !exists("g:vimrplugin_r_args")
+        let b:rplugin_r_args = " "
+    else
+        let b:rplugin_r_args = g:vimrplugin_r_args
+    endif
 
     " Change to buffer's directory before starting R
     if g:vimrplugin_vim_wd == 0
@@ -949,8 +954,8 @@ function WaitVimComStart()
         let g:rplugin_vimcom_home = vr[1]
         let g:rplugin_vimcomport = vr[2]
         let g:rplugin_r_pid = vr[3]
-        if g:rplugin_vimcom_version != "1.2.1"
-            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.2.1.')
+        if g:rplugin_vimcom_version != "1.2.2"
+            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.2.2.')
             sleep 1
         endif
         if has("win32")
@@ -2883,11 +2888,6 @@ function SetRPath()
     if !executable(b:rplugin_R)
         call RWarningMsgInp("R executable not found: '" . b:rplugin_R . "'")
     endif
-    if !exists("g:vimrplugin_r_args")
-        let b:rplugin_r_args = " "
-    else
-        let b:rplugin_r_args = g:vimrplugin_r_args
-    endif
 endfunction
 
 function RSourceOtherScripts()

From 75adce71f87b196dd6874f823784743ab0b9466e Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Tue, 24 Mar 2015 18:14:56 -0400
Subject: [PATCH 0938/1050] Update .gitignore

---
 .gitignore | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.gitignore b/.gitignore
index 7569868..be52368 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,4 @@
-doc/tags
+doc/tags*
 r-plugin/objlist/omnils_*
 r-plugin/objlist/fun_*
 r-plugin/tmp*

From efe58c4386bb6999f96a22c991f92e57d4d32ce3 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Tue, 24 Mar 2015 21:36:01 -0400
Subject: [PATCH 0939/1050] Delete two unused environment variables

---
 r-plugin/common_global.vim | 1 -
 r-plugin/windows.vim       | 1 -
 2 files changed, 2 deletions(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index d96fcdb..5dd40c3 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -633,7 +633,6 @@ function StartR_TmuxSplit(rcmd)
     let g:rplugin_vim_pane = TmuxActivePane()
     let tmuxconf = ['set-environment VIMRPLUGIN_TMPDIR "' . g:rplugin_tmpdir . '"',
                 \ 'set-environment VIMRPLUGIN_COMPLDIR "' . substitute(g:rplugin_compldir, ' ', '\\ ', "g") . '"',
-                \ 'set-environment VIM_PANE ' . g:rplugin_vim_pane ,
                 \ 'set-environment VIMEDITOR_SVRNM ' . $VIMEDITOR_SVRNM ,
                 \ 'set-environment VIMINSTANCEID ' . $VIMINSTANCEID ,
                 \ 'set-environment VIMRPLUGIN_SECRET ' . $VIMRPLUGIN_SECRET ]
diff --git a/r-plugin/windows.vim b/r-plugin/windows.vim
index 250f160..31b2c31 100644
--- a/r-plugin/windows.vim
+++ b/r-plugin/windows.vim
@@ -15,7 +15,6 @@ unlet s:sleeptimestr
 unlet s:sleeptime
 
 let g:rplugin_sleeptime = g:vimrplugin_sleeptime . 'm'
-exe 'let $VIM_SLEEPTIME = ' . '"' . g:vimrplugin_sleeptime . '"'
 
 if g:vimrplugin_Rterm
     let b:rplugin_R = "Rgui.exe"

From 955bc63fdac61de528330e04939ff6119f474b0d Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Tue, 24 Mar 2015 22:37:54 -0400
Subject: [PATCH 0940/1050] Jump to Vim pane if R help called from R Console

---
 r-plugin/common_global.vim | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 5dd40c3..7d8834d 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -1169,9 +1169,6 @@ function StartObjBrowser_Vim()
         else
             set splitright
         endif
-        if g:vimrplugin_objbr_place =~ "console"
-            sb R_Output
-        endif
         sil exe "vsplit " . b:objbrtitle
         let &splitright = l:sr
         sil exe "vertical resize " . g:vimrplugin_objbr_w
@@ -2127,7 +2124,7 @@ function AskRDoc(rkeyword, package, getclass)
     endif
 
     let classfor = ""
-    if bufname("%") =~ "Object_Browser" || bufname("%") == "R_Output"
+    if bufname("%") =~ "Object_Browser"
         let savesb = &switchbuf
         set switchbuf=useopen,usetab
         exe "sb " . b:rscript_buffer
@@ -2174,7 +2171,16 @@ function ShowRDoc(rkeyword)
         let rkeyw = msgs[-1]
     endif
 
-    if bufname("%") =~ "Object_Browser" || bufname("%") == "R_Output"
+    " If the help command was triggered in the R Console, jump to Vim pane
+    if g:rplugin_do_tmux_split && !g:rplugin_running_rhelp
+        let slog = system("tmux select-pane -t " . g:rplugin_vim_pane)
+        if v:shell_error
+            call RWarningMsg(slog)
+        endif
+    endif
+    let g:rplugin_running_rhelp = 0
+
+    if bufname("%") =~ "Object_Browser"
         let savesb = &switchbuf
         set switchbuf=useopen,usetab
         exe "sb " . b:rscript_buffer
@@ -2470,6 +2476,7 @@ function RAction(rcmd)
     endif
     if strlen(rkeyword) > 0
         if a:rcmd == "help"
+            let g:rplugin_running_rhelp = 1
             if g:vimrplugin_vimpager == "no"
                 call g:SendCmdToR("help(" . rkeyword . ")")
             else
@@ -3244,6 +3251,7 @@ endif
 
 let g:rplugin_firstbuffer = expand("%:p")
 let g:rplugin_running_objbr = 0
+let g:rplugin_running_rhelp = 0
 let g:rplugin_newliblist = 0
 let g:rplugin_status_line = &statusline
 let g:rplugin_ob_warn_shown = 0

From 3c08af4b8285d6bb8d0767be2372fbc5ea316353 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Thu, 26 Mar 2015 19:52:41 -0400
Subject: [PATCH 0941/1050] Delete no longer useful routStdErr highlight group

---
 syntax/rout.vim | 30 ++++--------------------------
 1 file changed, 4 insertions(+), 26 deletions(-)

diff --git a/syntax/rout.vim b/syntax/rout.vim
index a1d2262..b16742e 100644
--- a/syntax/rout.vim
+++ b/syntax/rout.vim
@@ -65,25 +65,12 @@ endif
 
 if g:Rout_more_colors
     syn include @routR syntax/r.vim
-    syn region routColoredR start="^> " end='$' contains=@routR keepend
-    syn region routColoredR start="^+ " end='$' contains=@routR keepend
+    syn region routColoredR start="^>" end='$' contains=@routR keepend
+    syn region routColoredR start="^+" end='$' contains=@routR keepend
 else
     " Input
-    syn match routInput /^> .*/
-    syn match routInput /^+ .*/
-endif
-
-if has("conceal")
-    setlocal conceallevel=3
-    set concealcursor=n
-    syn match routConceal '^: ' conceal contained
-    syn region routStdErr start='^: ' end="$" contains=routConceal
-    syn region routError start='^: .*Error.*' end='\n:\@!' contains=routConceal
-    syn region routWarn start='^: .*Warn.*' end='\n:\@!' contains=routConceal
-else
-    syn region routStdErr start='^: ' end="$"
-    syn region routError start='^: .*Error.*' end='\n:\@!'
-    syn region routWarn start='^: .*Warn.*' end='\n:\@!'
+    syn match routInput /^>.*/
+    syn match routInput /^+.*/
 endif
 
 " Index of vectors
@@ -148,7 +135,6 @@ if g:Rout_more_colors == 0
     hi def link routInput	Comment
 endif
 
-hi def link routConceal	Ignore
 if exists("g:rout_follow_colorscheme") && g:rout_follow_colorscheme
     " Default when following :colorscheme
     hi def link routNormal	Normal
@@ -164,10 +150,7 @@ if exists("g:rout_follow_colorscheme") && g:rout_follow_colorscheme
     hi def link routInf  	Number
     hi def link routConst	Constant
     hi def link routString	String
-    hi def link routError	Error
-    hi def link routWarn	WarningMsg
     hi def link routIndex	Special
-    hi def link routStdErr	Function
     hi def link routError	ErrorMsg
     hi def link routWarn	WarningMsg
 else
@@ -187,7 +170,6 @@ else
         hi routInf      ctermfg=39
         hi routConst	ctermfg=35
         hi routString	ctermfg=85
-        hi routStdErr	ctermfg=117
         hi routError	ctermfg=15 ctermbg=1
         hi routWarn	ctermfg=1
         hi routIndex	ctermfg=109
@@ -207,7 +189,6 @@ else
         hi routTrue	ctermfg=darkgreen
         hi routConst	ctermfg=magenta
         hi routString	ctermfg=darkcyan
-        hi routStdErr	ctermfg=cyan
         hi routError	ctermfg=white ctermbg=red
         hi routWarn	ctermfg=red
         hi routIndex	ctermfg=darkgreen
@@ -256,9 +237,6 @@ else
     if exists("g:rout_color_string")
         exe "hi routString ctermfg=" . g:rout_color_string
     endif
-    if exists("g:rout_color_stderr")
-        exe "hi routStdErr ctermfg=" . g:rout_color_stderr
-    endif
     if exists("g:rout_color_error")
         exe "hi routError ctermfg=" . g:rout_color_error
     endif

From 18d7a3b521e6c024b65ab0e6a6014708db7fc513 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sat, 28 Mar 2015 16:58:05 -0400
Subject: [PATCH 0942/1050] Set file name for Julia include()

---
 r-plugin/global_r_plugin.vim | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/r-plugin/global_r_plugin.vim b/r-plugin/global_r_plugin.vim
index 1ba42ca..90b0ae4 100644
--- a/r-plugin/global_r_plugin.vim
+++ b/r-plugin/global_r_plugin.vim
@@ -35,8 +35,8 @@ function SourceNotDefined(lines)
 endfunction
 
 function JuliaSourceLines(lines)
-    call writefile(a:lines, b:rsource)
-    let jcmd = 'include("' . b:rsource . '")'
+    call writefile(a:lines, $VIMRPLUGIN_TMPDIR . "/julia_code")
+    let jcmd = 'include("' . $VIMRPLUGIN_TMPDIR . "/julia_code" . '")'
     let ok = g:SendCmdToR(jcmd)
     return ok
 endfunction

From 14d29f978b9f09075a0d93b0f0d420e0958708ad Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Tue, 31 Mar 2015 22:55:08 -0400
Subject: [PATCH 0943/1050] Minor bug fix in indentation of R chunk in Rnoweb
 Also:   - fix date of indent/rrst.vim to match Vim runtime file.   - update
 documentation

---
 doc/r-plugin.txt | 2 ++
 indent/r.vim     | 6 +++++-
 indent/rrst.vim  | 2 +-
 3 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index b81f9b0..a22ca92 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -1356,6 +1356,8 @@ Valid values for the Object Browser placement are "script" or "console" and
    let vimrplugin_objbr_place = "script,right"
    let vimrplugin_objbr_place = "console,left"
 <
+The "console" option is valid only if Vim is running inside of a Tmux session.
+
 
 ------------------------------------------------------------------------------
 							 *vimrplugin_vimpager*
diff --git a/indent/r.vim b/indent/r.vim
index 3d933ed..105f0cd 100644
--- a/indent/r.vim
+++ b/indent/r.vim
@@ -1,7 +1,7 @@
 " Vim indent file
 " Language:	R
 " Author:	Jakson Alves de Aquino 
-" Last Change:	Fri Feb 20, 2015  12:16PM
+" Last Change:	Thu Mar 26, 2015  05:36PM
 
 
 " Only load this indent file when no other was loaded.
@@ -261,6 +261,10 @@ function GetRIndent()
     endif
   endif
 
+  if &filetype == "rnoweb" && line =~ "^<<.*>>="
+    return 0
+  endif
+
   if cline =~ '^\s*{'
     if g:r_indent_ess_compatible && line =~ ')$'
       let nlnum = lnum
diff --git a/indent/rrst.vim b/indent/rrst.vim
index ea5b9b7..8bfa834 100644
--- a/indent/rrst.vim
+++ b/indent/rrst.vim
@@ -1,7 +1,7 @@
 " Vim indent file
 " Language:	Rrst
 " Author:	Jakson Alves de Aquino 
-" Last Change:	Thu Jul 09, 2014  07:33PM
+" Last Change:	Wed Jul 09, 2014  07:33PM
 
 
 " Only load this indent file when no other was loaded.

From fcd3d7335f5cd4a65c32f34f830ef32814fc5728 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Mon, 6 Apr 2015 09:33:27 -0400
Subject: [PATCH 0944/1050] Delete temporary directory on VimLeave

---
 r-plugin/common_global.vim | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 7d8834d..d65f5e9 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -2880,6 +2880,9 @@ function RVimLeave()
     call delete(g:rplugin_tmpdir . "/vimcom_running_" . $VIMINSTANCEID)
     call delete(g:rplugin_tmpdir . "/rconsole_hwnd_" . $VIMRPLUGIN_SECRET)
     call delete(g:rplugin_tmpdir . "/openR'")
+    if executable("rmdir")
+        call system("rmdir '" . g:rplugin_tmpdir . "'")
+    endif
 endfunction
 
 function SetRPath()

From 3692cf7fbc1cfa791daf56e53006f00d89d1ddd7 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Mon, 6 Apr 2015 10:24:56 -0400
Subject: [PATCH 0945/1050] Move some options from ~/.Rprofile to ~/.vimrc

---
 doc/r-plugin.txt           | 57 ++++++++++++++++++++++++++++++++------
 r-plugin/common_global.vim | 42 ++++++++++++++++++++++++++--
 2 files changed, 89 insertions(+), 10 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index a22ca92..341a586 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -1181,6 +1181,10 @@ is running:
 |vimrplugin_objbr_place|       Placement of Object Browser
 |vimrplugin_objbr_w|           Initial width of Object Browser window
 |vimrplugin_tmux_ob|           Run Object Browser in Tmux pane
+|vimrplugin_objbr_opendf|      Display data.frames open in the Object Browser
+|vimrplugin_objbr_openlist|    Display lists open in the Object Browser
+|vimrplugin_objbr_allnames|    Display hidden objects in the Object Browser
+|vimrplugin_objbr_labelerr|    Show error if "label" attribute is invalid
 |vimrplugin_vimpager|          Use Vim to see R documentation
 |vimrplugin_editor_w|          Minimum width of R script buffer
 |vimrplugin_help_w|            Desired width of R documentation buffer
@@ -1201,6 +1205,7 @@ is running:
 |vimrplugin_source_args|       Arguments to R `source()` function
 |vimrplugin_latexcmd|          Command to run on .tex files
 |vimrplugin_latexmk|           Define wether `latexmk` should be run
+|vimrplugin_texerr|            Show a summary of LaTeX errors after compilation
 |vimrplugin_sweaveargs|        Arguments do `Sweave()`
 |vimrplugin_rmd_environment|   Environment in which to save evaluated rmd code
 |vimrplugin_never_unmake_menu| Do not unmake the menu when switching buffers
@@ -1331,9 +1336,13 @@ the value vimrplugin_assign to 2. Then, you will have to type two `_` to get
 them converted into `<-`.
 
 ------------------------------------------------------------------------------
-						      *vimrplugin_objbr_place*
-						      *vimrplugin_objbr_w*
-						      *vimrplugin_tmux_ob*
+						   *vimrplugin_objbr_place*
+						   *vimrplugin_objbr_w*
+						   *vimrplugin_tmux_ob*
+						   *vimrplugin_objbr_opendf*
+						   *vimrplugin_objbr_openlist*
+						   *vimrplugin_objbr_allnames*
+						   *vimrplugin_objbr_labelerr*
 6.4. Object Browser options~
 
 By default, the Object Browser will be created with 40 columns. The minimum
@@ -1358,6 +1367,30 @@ Valid values for the Object Browser placement are "script" or "console" and
 <
 The "console" option is valid only if Vim is running inside of a Tmux session.
 
+Below is an example of setup of some other options in the |vimrc| that control
+the behavior of the Object Browser:
+>
+   let vimrplugin_objbr_opendf = 1    " Show data.frames elements
+   let vimrplugin_objbr_openlist = 0  " Show lists elements
+   let vimrplugin_objbr_allnames = 0  " Show .GlobalEnv hidden objects
+   let vimrplugin_objbr_labelerr = 1  " Warn if label is not a valid text
+<
+Objects whose names start with a "." are hidden by default. If you want that
+they are displayed in the Object Browser, set the value of
+`vimrplugin_objbr_allnames` to `1`.
+
+when a `data.frame` appears in the Object Browser for the first time, its
+elements are immediately displayed, but the elements of a `list` are displayed
+only if it is explicitly opened. The options `vimrplugin_objbr_opendf` and
+`vimrplugin_objbr_openlist` control the initial status (either opened or
+closed) of, respectively, `data.frames` and `lists`. The options are ignored
+for `data.frames` and `lists` of libraries which are always started closed.
+
+If an object R's workspace has the attribute `"label"`, it is displayed in
+Nvim's Object Browser. If the `"label"` attribute is not of class
+`"character"`, and if  `vimrplugin_objbr_labelerr` is `1`, an error message is
+printed in the Object Browser.
+
 
 ------------------------------------------------------------------------------
 							 *vimrplugin_vimpager*
@@ -1372,10 +1405,6 @@ If you do not want to see R documentation in a Vim's buffer, put in your
 >
    let vimrplugin_vimpager = "no"
 <
-And put in your `~/.Rprofile`:
->
-   options(vimcom.vimpager = FALSE)
-<
 If you want to see R documentation in Vim, but are not satisfied with the way
 it works, please, read the subsection 6.5.2 below.
 
@@ -1617,7 +1646,8 @@ argument between `TRUE` and `FALSE`.
 						       *vimrplugin_sweaveargs*
 						       *vimrplugin_latexcmd*
 						       *vimrplugin_latexmk*
-6.17. LaTeX command~
+						       *vimrplugin_texerr*
+6.17. LaTeX options~
 
 To produce a pdf document from the .tex file generated by either `Sweave()` or
 `knit()` command, if vimrplugin_latexmk = 1 and both `latexmk` and `perl`
@@ -1641,6 +1671,11 @@ By default, vimrplugin_latexmk is 0 on Windows and 1 on other systems.
 If you want to pass arguments do the `Sweave()` function, set the value of the
 vimrplugin_sweaveargs variable.
 
+If the value of `vimrplugin_texerr` is `1`, a summary of LaTeX errors
+and warnings are produced by the compilation of the .tex document into .pdf
+file will be output to R Console at the end of the compilation. So, you do not
+have to scroll the R Console seeking for these messages.
+
 
 ------------------------------------------------------------------------------
 						  *vimrplugin_rmd_environment*
@@ -2894,6 +2929,12 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details.
  * Remove option to start R with the --vanilla argument. See vimrplugin_r_args
    for an alternative.
 
+ * News options to control the Object Browser: vimrplugin_objbr_opendf,
+   vimrplugin_objbr_openlist, vimrplugin_objbr_allnames and
+   vimrplugin_objbr_labelerr.
+
+ * New options to control LaTeX compilation: vimrplugin_texerr.
+
  * Minor bug fixes.
 
 1.2.1 (2015-03-05)
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index d65f5e9..aa92f82 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -791,6 +791,38 @@ function StartR(whatr)
     call writefile([], g:rplugin_tmpdir . "/liblist_" . $VIMINSTANCEID)
     call delete(g:rplugin_tmpdir . "/libnames_" . $VIMINSTANCEID)
 
+    if g:vimrplugin_objbr_opendf
+        let start_options = ['options(vimcom.opendf = TRUE)']
+    else
+        let start_options = ['options(vimcom.opendf = FALSE)']
+    endif
+    if g:vimrplugin_objbr_openlist
+        let start_options += ['options(vimcom.openlist = TRUE)']
+    else
+        let start_options += ['options(vimcom.openlist = FALSE)']
+    endif
+    if g:vimrplugin_objbr_allnames
+        let start_options += ['options(vimcom.allnames = TRUE)']
+    else
+        let start_options += ['options(vimcom.allnames = FALSE)']
+    endif
+    if g:vimrplugin_texerr
+        let start_options += ['options(vimcom.texerrs = TRUE)']
+    else
+        let start_options += ['options(vimcom.texerrs = FALSE)']
+    endif
+    if g:vimrplugin_objbr_labelerr
+        let start_options += ['options(vimcom.labelerr = TRUE)']
+    else
+        let start_options += ['options(vimcom.labelerr = FALSE)']
+    endif
+    if g:vimrplugin_vimpager == "no" || !has("clientserver") || v:servername == ""
+        let start_options += ['options(vimcom.vimpager = FALSE)']
+    else
+        let start_options += ['options(vimcom.vimpager = TRUE)']
+    endif
+    call writefile(start_options, g:rplugin_tmpdir . "/start_options.R")
+
     if !exists("b:rplugin_R")
         call SetRPath()
     endif
@@ -953,8 +985,8 @@ function WaitVimComStart()
         let g:rplugin_vimcom_home = vr[1]
         let g:rplugin_vimcomport = vr[2]
         let g:rplugin_r_pid = vr[3]
-        if g:rplugin_vimcom_version != "1.2.2"
-            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.2.2.')
+        if g:rplugin_vimcom_version != "1.2.2.1"
+            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.2.2.1.')
             sleep 1
         endif
         if has("win32")
@@ -2865,6 +2897,7 @@ endfunction
 
 function RVimLeave()
     call delete(g:rplugin_rsource)
+    call delete(g:rplugin_tmpdir . "/start_options.R")
     call delete(g:rplugin_tmpdir . "/eval_reply")
     call delete(g:rplugin_tmpdir . "/formatted_code")
     call delete(g:rplugin_tmpdir . "/GlobalEnvList_" . $VIMINSTANCEID)
@@ -2997,6 +3030,11 @@ call RSetDefaultValue("g:vimrplugin_routnotab",         0)
 call RSetDefaultValue("g:vimrplugin_editor_w",         66)
 call RSetDefaultValue("g:vimrplugin_help_w",           46)
 call RSetDefaultValue("g:vimrplugin_objbr_w",          40)
+call RSetDefaultValue("g:vimrplugin_objbr_opendf",      1)
+call RSetDefaultValue("g:vimrplugin_objbr_openlist",    0)
+call RSetDefaultValue("g:vimrplugin_objbr_allnames",    0)
+call RSetDefaultValue("g:vimrplugin_texerr",            1)
+call RSetDefaultValue("g:vimrplugin_objbr_labelerr",    1)
 call RSetDefaultValue("g:vimrplugin_i386",              0)
 call RSetDefaultValue("g:vimrplugin_vimcom_wait",    5000)
 call RSetDefaultValue("g:vimrplugin_show_args",         0)

From 4c005db88e0b6c28e0ad7b4cc00a0bf0ef34a8de Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Mon, 6 Apr 2015 16:53:49 -0400
Subject: [PATCH 0946/1050] Improve vimrplugin_vim_wd

---
 doc/r-plugin.txt           | 13 ++++++++++---
 r-plugin/common_global.vim | 17 +++++------------
 r-plugin/osx.vim           | 12 ------------
 r-plugin/windows.vim       |  3 ---
 4 files changed, 15 insertions(+), 30 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 341a586..6c83bac 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -1915,14 +1915,21 @@ Note: You should have the line  `library(vimcom)`  in your `~/.Rprofile`.
 							   *vimrplugin_vim_wd*
 6.30 Start R in working directory of Vim~
 
-The Vim-R-plugin starts R in the directory where the current buffer is. If you
-want R's working directory to be the same as Vim's working directory, put in
-your |vimrc|:
+When you are editing an R file (.R, .Rnw, .Rd, .Rmd, .Rrst) and start R, the
+R package vimcom runs the command `setwd()` with the directory of the file
+being edited as argument, that is, the R working directory becomes the same
+directory of the R file. If you want R's working directory to be the same as
+Vim's working directory, put in your |vimrc|:
 >
     let vimrplugin_vim_wd = 1
 <
 This option is useful only for those who did not enable 'autochdir'.
 
+If you prefer that the Vim-R-plugin does not set the working directory in any
+way, put in |vimrc|:
+>
+    let vimrplugin_vim_wd = -1
+<
 
 ------------------------------------------------------------------------------
 						      *vimrplugin_after_start*
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index aa92f82..9d3713b 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -821,6 +821,11 @@ function StartR(whatr)
     else
         let start_options += ['options(vimcom.vimpager = TRUE)']
     endif
+    if g:vimrplugin_vim_wd == 0
+        let start_options += ['setwd("' . expand("%:p:h") . '")']
+    elseif g:vimrplugin_vim_wd == 1
+        let start_options += ['setwd("' . getcwd() . '")']
+    endif
     call writefile(start_options, g:rplugin_tmpdir . "/start_options.R")
 
     if !exists("b:rplugin_R")
@@ -832,11 +837,6 @@ function StartR(whatr)
         let b:rplugin_r_args = g:vimrplugin_r_args
     endif
 
-    " Change to buffer's directory before starting R
-    if g:vimrplugin_vim_wd == 0
-        lcd %:p:h
-    endif
-
     if a:whatr =~ "custom"
         call inputsave()
         let b:rplugin_r_args = input('Enter parameters for R: ')
@@ -855,9 +855,6 @@ function StartR(whatr)
 
     if g:vimrplugin_only_in_tmux && $TMUX_PANE == ""
         call RWarningMsg("Not inside Tmux.")
-        if g:vimrplugin_vim_wd == 0
-            lcd -
-        endif
         return
     endif
 
@@ -922,10 +919,6 @@ function StartR(whatr)
         endif
     endif
 
-    " Go back to original directory:
-    if g:vimrplugin_vim_wd == 0
-        lcd -
-    endif
     echon
 endfunction
 
diff --git a/r-plugin/osx.vim b/r-plugin/osx.vim
index d988c54..33adee6 100644
--- a/r-plugin/osx.vim
+++ b/r-plugin/osx.vim
@@ -19,22 +19,10 @@ function StartR_OSX()
     if v:shell_error
         call RWarningMsg(rlog)
     endif
-    if g:vimrplugin_vim_wd == 0
-        lcd -
-    endif
     let g:SendCmdToR = function('SendCmdToR_OSX')
     if WaitVimComStart()
         call SendToVimCom("\005B Update OB [StartR]")
         sleep 200m
-        if g:vimrplugin_vim_wd
-            " If the user want's R's working directory to be the same as Vim's 
-            " working directory, then send a setwd() to R via vimcom at the
-            " start of R.
-            call SendToVimCom("\x08" . $VIMINSTANCEID . 'setwd("' . getcwd() . '")')
-        else
-           " Else, set the R's working directory as the actual buffer one.
-            call SendToVimCom("\x08" . $VIMINSTANCEID . 'setwd("' . expand("%:p:h") . '")')
-        endif
         if g:vimrplugin_after_start != ''
             call system(g:vimrplugin_after_start)
         endif
diff --git a/r-plugin/windows.vim b/r-plugin/windows.vim
index 31b2c31..d635dc5 100644
--- a/r-plugin/windows.vim
+++ b/r-plugin/windows.vim
@@ -153,9 +153,6 @@ function StartR_Windows()
 
     let $HOME = saved_home
 
-    if g:vimrplugin_vim_wd == 0
-        lcd -
-    endif
     let g:SendCmdToR = function('SendCmdToR_Windows')
     if WaitVimComStart()
         call foreground()

From a4dfbfe74aed4d93b7660940f8bca643cf9bbd16 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Tue, 7 Apr 2015 23:17:40 -0400
Subject: [PATCH 0947/1050] Fix directory path on Windows

---
 r-plugin/common_global.vim | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 9d3713b..8f04ea7 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -821,10 +821,17 @@ function StartR(whatr)
     else
         let start_options += ['options(vimcom.vimpager = TRUE)']
     endif
+    let rwd = ""
     if g:vimrplugin_vim_wd == 0
-        let start_options += ['setwd("' . expand("%:p:h") . '")']
+        let rwd = expand("%:p:h")
     elseif g:vimrplugin_vim_wd == 1
-        let start_options += ['setwd("' . getcwd() . '")']
+        let rwd = getcwd()
+    endif
+    if rwd != ""
+        if has("win32") || has("win64")
+            let rwd = substitute(rwd, '\\', '/', 'g')
+        endif
+        let start_options += ['setwd("' . rwd . '")']
     endif
     call writefile(start_options, g:rplugin_tmpdir . "/start_options.R")
 

From 8c67a9a5b278c13deeb115e8e9529573fd1c50bd Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Wed, 8 Apr 2015 10:58:12 -0400
Subject: [PATCH 0948/1050] Update doc and Makefile

---
 Makefile         |  2 +-
 doc/r-plugin.txt | 22 +++++++++++++---------
 2 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/Makefile b/Makefile
index cae78cd..892e1e4 100644
--- a/Makefile
+++ b/Makefile
@@ -22,7 +22,7 @@
 
 
 PLUGINHOME=`pwd`
-PLUGINVERSION=1.2.2
+PLUGINVERSION=1.2.3
 DEBIANTIME=`date -R`
 PLUGINRELEASEDATE=`date +"%Y-%m-%d"`
 VIM2HTML=/usr/local/share/vim/vim74/doc/vim2html.pl 
diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 6c83bac..2422a18 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -5,7 +5,7 @@
 Authors: Jakson A. Aquino   
          Jose Claudio Faria 
 
-Version: 1.2.2
+Version: 1.2.3
 For Vim version 7.4
 
  1. Overview                                    |r-plugin-overview|
@@ -115,7 +115,7 @@ dependencies:
 
     * R's version must be >= 3.0.0: http://www.r-project.org/
 
-    * vimcom = 1.2-2: http://www.lepem.ufc.br/jaa/vimcom.html
+    * vimcom = 1.2-3: http://www.lepem.ufc.br/jaa/vimcom.html
 
       Note: If you cannot build vimcom yourself, you will want to
       download and install the zip file.
@@ -152,7 +152,7 @@ Before installing the plugin, you should install its dependencies:
 
    R >= 3.0.0: http://www.r-project.org/
 
-   vimcom = 1.2-2: http://www.lepem.ufc.br/jaa/vimcom.html
+   vimcom = 1.2-3: http://www.lepem.ufc.br/jaa/vimcom.html
 
    Only if you edit Rnoweb files: MacTeX, BasicTeX or other LaTeX system.
 
@@ -206,7 +206,7 @@ Before installing the plugin, you should install its dependencies:
 
    R >= 3.0.0: http://www.r-project.org/
 
-   vimcom = 1.2-2: http://www.lepem.ufc.br/jaa/vimcom.html
+   vimcom = 1.2-3: http://www.lepem.ufc.br/jaa/vimcom.html
 
    Tmux >= 1.8:   http://tmux.sourceforge.net
                   Tmux is necessary to send commands from Vim to R Console.
@@ -2931,16 +2931,20 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details.
 							       *r-plugin-news*
 10. News~
 
-1.2.2 (2015-03-24)
-
- * Remove option to start R with the --vanilla argument. See vimrplugin_r_args
-   for an alternative.
+1.2.3 (2015-04-07)
 
  * News options to control the Object Browser: vimrplugin_objbr_opendf,
    vimrplugin_objbr_openlist, vimrplugin_objbr_allnames and
    vimrplugin_objbr_labelerr.
 
- * New options to control LaTeX compilation: vimrplugin_texerr.
+ * New option to control LaTeX compilation: vimrplugin_texerr.
+
+ * Fix setting of R working directory on Mac OS X.
+
+1.2.2 (2015-03-24)
+
+ * Remove option to start R with the --vanilla argument. See vimrplugin_r_args
+   for an alternative.
 
  * Minor bug fixes.
 

From 3383bddc806b9126c072d70fff84ba613534fb83 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Wed, 8 Apr 2015 13:22:55 -0400
Subject: [PATCH 0949/1050] Delete official runtime files See:
 https://github.com/jalvesaq/R-Vim-runtime

---
 Makefile                    |  14 -
 doc/r-plugin.txt            |  60 +----
 ftplugin/r.vim              |  31 ---
 ftplugin/r_rplugin.vim      |   7 +
 ftplugin/rdoc.vim           |   4 +-
 ftplugin/rhelp.vim          |  29 --
 ftplugin/rhelp_rplugin.vim  |  13 +-
 ftplugin/rmd.vim            |  43 ---
 ftplugin/rmd_rplugin.vim    |  13 +-
 ftplugin/rnoweb.vim         |  40 ---
 ftplugin/rnoweb_rplugin.vim |  13 +-
 ftplugin/rrst.vim           |  37 ---
 ftplugin/rrst_rplugin.vim   |  13 +-
 indent/r.vim                | 515 ------------------------------------
 indent/rhelp.vim            | 107 --------
 indent/rmd.vim              |  46 ----
 indent/rnoweb.vim           |  36 ---
 indent/rrst.vim             |  46 ----
 list_for_vimball            |  14 -
 syntax/r.vim                | 236 -----------------
 syntax/rhelp.vim            | 249 -----------------
 syntax/rmd.vim              |  87 ------
 syntax/rrst.vim             |  47 ----
 23 files changed, 64 insertions(+), 1636 deletions(-)
 delete mode 100644 ftplugin/r.vim
 delete mode 100644 ftplugin/rhelp.vim
 delete mode 100644 ftplugin/rmd.vim
 delete mode 100644 ftplugin/rnoweb.vim
 delete mode 100644 ftplugin/rrst.vim
 delete mode 100644 indent/r.vim
 delete mode 100644 indent/rhelp.vim
 delete mode 100644 indent/rmd.vim
 delete mode 100644 indent/rnoweb.vim
 delete mode 100644 indent/rrst.vim
 delete mode 100644 syntax/r.vim
 delete mode 100644 syntax/rhelp.vim
 delete mode 100644 syntax/rmd.vim
 delete mode 100644 syntax/rrst.vim

diff --git a/Makefile b/Makefile
index 892e1e4..b465980 100644
--- a/Makefile
+++ b/Makefile
@@ -58,23 +58,13 @@ deb:
 	  - autoload/rcomplete.vim\n\
 	  - doc/r-plugin.txt\n\
 	  - ftdetect/r.vim\n\
-	  - ftplugin/r.vim\n\
 	  - ftplugin/r_rplugin.vim\n\
 	  - ftplugin/rbrowser.vim\n\
 	  - ftplugin/rdoc.vim\n\
-	  - ftplugin/rhelp.vim\n\
 	  - ftplugin/rhelp_rplugin.vim\n\
-	  - ftplugin/rmd.vim\n\
 	  - ftplugin/rmd_rplugin.vim\n\
-	  - ftplugin/rnoweb.vim\n\
 	  - ftplugin/rnoweb_rplugin.vim\n\
-	  - ftplugin/rrst.vim\n\
 	  - ftplugin/rrst_rplugin.vim\n\
-	  - indent/r.vim\n\
-	  - indent/rhelp.vim\n\
-	  - indent/rmd.vim\n\
-	  - indent/rnoweb.vim\n\
-	  - indent/rrst.vim\n\
 	  - r-plugin/common_buffer.vim\n\
 	  - r-plugin/common_global.vim\n\
 	  - r-plugin/functions.vim\n\
@@ -84,13 +74,9 @@ deb:
 	  - r-plugin/synctex_evince_backward.py\n\
 	  - r-plugin/synctex_evince_forward.py\n\
 	  - r-plugin/synctex_okular_backward.sh\n\
-	  - syntax/r.vim\n\
 	  - syntax/rbrowser.vim\n\
 	  - syntax/rdoc.vim\n\
-	  - syntax/rhelp.vim\n\
-	  - syntax/rmd.vim\n\
 	  - syntax/rout.vim\n\
-	  - syntax/rrst.vim\n\
 	" > /tmp/vim-r-plugin-tmp/usr/share/vim/registry/vim-r-plugin.yaml
 	# Create the copyright
 	echo "Copyright (C) 2011-2015 Jakson Aquino\n\
diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 2422a18..9b880ef 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -963,46 +963,14 @@ Normal, Visual and Insert modes.
 
 
 ------------------------------------------------------------------------------
-5.3. Syntactically correct code may be wrongly indented~
-
-If the Vim-R-plugin indents your code wrongly you may get the correct
-indentation by adding braces and line breaks to it. For example, try to indent
-the code below:
->
-   # This code will be wrongly indented:
-
-   levels(x) <- ## nl == nL or 1
-       if (nl == nL) as.character(labels)
-       else paste(labels, seq_along(levels), sep = "")
-   class(x) <- c(if(ordered) "ordered", "factor")
-
-
-   # But this one will be correctly indented:
-
-   levels(x) <- ## nl == nL or 1
-       if (nl == nL)
-           as.character(labels)
-       else
-           paste(labels, seq_along(levels), sep = "")
-   class(x) <- c(if(ordered) "ordered", "factor")
-<
-See also:
-
-   https://github.com/jcfaria/Vim-R-plugin/issues/37
-   https://github.com/jcfaria/Vim-R-plugin/issues/77
-   https://github.com/jcfaria/Vim-R-plugin/issues/158
-   https://github.com/jcfaria/Vim-R-plugin/blob/master/r-plugin/indent_test.R
-
-
-------------------------------------------------------------------------------
-5.4. Functions are not always correctly sent to R~
+5.3. Functions are not always correctly sent to R~
 
 The plugin is only capable of recognizing functions defined using the `<-`
 operator. See: https://github.com/jcfaria/Vim-R-plugin/issues/94
 
 
 ------------------------------------------------------------------------------
-5.5. Objects Browser does not support knitr cache=TRUE~
+5.4. Objects Browser does not support knitr cache=TRUE~
 
 When processing Rnoweb documents with the knitr package, if the chunk option
 `cache` is `TRUE`, the Object Browser will not be able to detect the classes
@@ -1011,7 +979,7 @@ issue is to define the chunk option `cache.lazy=FALSE`.
 
 
 ------------------------------------------------------------------------------
-5.6. Wrong message that "R is busy" (Windows only)~
+5.5. Wrong message that "R is busy" (Windows only)~
 
 On Windows, when code is sent from Vim to R Console, the vimcom library
 sets the value of the internal variable `r_is_busy` to 1. The value is set
@@ -1028,7 +996,7 @@ The vimcom library is started with the state `busy`.
 
 ------------------------------------------------------------------------------
 							*r-plugin-SyncTeX-win*
-5.7. SyncTeX on Windows~
+5.6. SyncTeX on Windows~
 
 On Windows, backward search with Sumatra pop ups a console window which
 quickly disappears (it is `vim` running the required `--remote-expr` command).
@@ -1036,7 +1004,7 @@ quickly disappears (it is `vim` running the required `--remote-expr` command).
 
 ------------------------------------------------------------------------------
 								*r-plugin-nox*
-5.8. Bugs that affect Linux Console and Vim accessed through ssh~
+5.7. Bugs that affect Linux Console and Vim accessed through ssh~
 
 If you run Vim in the Linux Console or start Vim in a terminal emulator
 without the command line argument |--servername|, Vim will not receive remote
@@ -1102,7 +1070,7 @@ See also: |r-plugin-remote|.
 
 
 ------------------------------------------------------------------------------
-5.9. R must be started by Vim~
+5.8. R must be started by Vim~
 
 The communication between Vim and R will work only if R was started by Vim
 through the rf command because the plugin was designed to connect
@@ -2302,23 +2270,13 @@ directory after the installation:
    autoload/rcomplete.vim
    doc/r-plugin.txt
    ftdetect/r.vim
-   ftplugin/r.vim
    ftplugin/r_rplugin.vim
    ftplugin/rbrowser.vim
    ftplugin/rdoc.vim
-   ftplugin/rhelp.vim
    ftplugin/rhelp_rplugin.vim
-   ftplugin/rmd.vim
    ftplugin/rmd_rplugin.vim
-   ftplugin/rnoweb.vim
    ftplugin/rnoweb_rplugin.vim
-   ftplugin/rrst.vim
    ftplugin/rrst_rplugin.vim
-   indent/r.vim
-   indent/rhelp.vim
-   indent/rmd.vim
-   indent/rnoweb.vim
-   indent/rrst.vim
    r-plugin/common_buffer.vim
    r-plugin/common_global.vim
    r-plugin/functions.vim
@@ -2332,13 +2290,9 @@ directory after the installation:
    r-plugin/synctex_evince_forward.py
    r-plugin/synctex_okular_backward.sh
    r-plugin/windows.vim
-   syntax/r.vim
    syntax/rbrowser.vim
    syntax/rdoc.vim
-   syntax/rhelp.vim
-   syntax/rmd.vim
    syntax/rout.vim
-   syntax/rrst.vim
 
 
 ==============================================================================
@@ -2931,7 +2885,7 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details.
 							       *r-plugin-news*
 10. News~
 
-1.2.3 (2015-04-07)
+1.2.3 (2015-04-08)
 
  * News options to control the Object Browser: vimrplugin_objbr_opendf,
    vimrplugin_objbr_openlist, vimrplugin_objbr_allnames and
diff --git a/ftplugin/r.vim b/ftplugin/r.vim
deleted file mode 100644
index 43b208b..0000000
--- a/ftplugin/r.vim
+++ /dev/null
@@ -1,31 +0,0 @@
-" Vim filetype plugin file
-" Language: R
-" Maintainer: Jakson Alves de Aquino 
-" Last Change:	Sun Feb 23, 2014  04:07PM
-
-" Only do this when not yet done for this buffer
-if exists("b:did_ftplugin")
-  finish
-endif
-
-" Don't load another plugin for this buffer
-let b:did_ftplugin = 1
-
-let s:cpo_save = &cpo
-set cpo&vim
-
-setlocal iskeyword=@,48-57,_,.
-setlocal formatoptions-=t
-setlocal commentstring=#\ %s
-setlocal comments=:#',:###,:##,:#
-
-if has("gui_win32") && !exists("b:browsefilter")
-  let b:browsefilter = "R Source Files (*.R)\t*.R\n" .
-        \ "Files that include R (*.Rnw *.Rd *.Rmd *.Rrst)\t*.Rnw;*.Rd;*.Rmd;*.Rrst\n" .
-        \ "All Files (*.*)\t*.*\n"
-endif
-
-let b:undo_ftplugin = "setl cms< com< fo< isk< | unlet! b:browsefilter"
-
-let &cpo = s:cpo_save
-unlet s:cpo_save
diff --git a/ftplugin/r_rplugin.vim b/ftplugin/r_rplugin.vim
index fa8cd43..395963a 100644
--- a/ftplugin/r_rplugin.vim
+++ b/ftplugin/r_rplugin.vim
@@ -13,6 +13,13 @@ endif
 " need be defined after the global ones:
 runtime r-plugin/common_buffer.vim
 
+if !exists("b:did_ftplugin")
+    if !exists("g:rplugin_runtime_warn")
+        call RWarningMsgInp("Your runtime files seems to be outdated.\nSee: https://github.com/jalvesaq/R-Vim-runtime")
+    endif
+    let g:rplugin_runtime_warn = 1
+endif
+
 " Run R CMD BATCH on current file and load the resulting .Rout in a split
 " window
 function! ShowRout()
diff --git a/ftplugin/rdoc.vim b/ftplugin/rdoc.vim
index 1cc87e2..a875323 100644
--- a/ftplugin/rdoc.vim
+++ b/ftplugin/rdoc.vim
@@ -4,12 +4,12 @@
 
 
 " Only do this when not yet done for this buffer
-if exists("b:did_rdoc_ftplugin") || has("nvim")
+if exists("b:did_ftplugin") || has("nvim")
     finish
 endif
 
 " Don't load another plugin for this buffer
-let b:did_rdoc_ftplugin = 1
+let b:did_ftplugin = 1
 
 let s:cpo_save = &cpo
 set cpo&vim
diff --git a/ftplugin/rhelp.vim b/ftplugin/rhelp.vim
deleted file mode 100644
index 9b72fb4..0000000
--- a/ftplugin/rhelp.vim
+++ /dev/null
@@ -1,29 +0,0 @@
-" Vim filetype plugin file
-" Language: R help file
-" Maintainer: Jakson Alves de Aquino 
-" Last Change:	Wed Jul 09, 2014  06:23PM
-
-" Only do this when not yet done for this buffer
-if exists("b:did_ftplugin")
-  finish
-endif
-
-" Don't load another plugin for this buffer
-let b:did_ftplugin = 1
-
-let s:cpo_save = &cpo
-set cpo&vim
-
-setlocal iskeyword=@,48-57,_,.
-
-if has("gui_win32") && !exists("b:browsefilter")
-  let b:browsefilter = "R Source Files (*.R *.Rnw *.Rd *.Rmd *.Rrst)\t*.R;*.Rnw;*.Rd;*.Rmd;*.Rrst\n" .
-        \ "All Files (*.*)\t*.*\n"
-endif
-
-let b:undo_ftplugin = "setl isk< | unlet! b:browsefilter"
-
-let &cpo = s:cpo_save
-unlet s:cpo_save
-
-" vim: sw=2
diff --git a/ftplugin/rhelp_rplugin.vim b/ftplugin/rhelp_rplugin.vim
index e59c26c..20f51d3 100644
--- a/ftplugin/rhelp_rplugin.vim
+++ b/ftplugin/rhelp_rplugin.vim
@@ -13,6 +13,13 @@ endif
 " defined after the global ones:
 runtime r-plugin/common_buffer.vim
 
+if !exists("b:did_ftplugin")
+    if !exists("g:rplugin_runtime_warn")
+        call RWarningMsgInp("Your runtime files seems to be outdated.\nSee: https://github.com/jalvesaq/R-Vim-runtime")
+    endif
+    let g:rplugin_runtime_warn = 1
+endif
+
 function! RhelpIsInRCode(vrb)
     let lastsec = search('^\\[a-z][a-z]*{', "bncW")
     let secname = getline(lastsec)
@@ -46,4 +53,8 @@ endif
 
 call RSourceOtherScripts()
 
-let b:undo_ftplugin .= " | unlet! b:IsInRCode b:SourceLines"
+if exists("b:undo_ftplugin")
+    let b:undo_ftplugin .= " | unlet! b:IsInRCode b:SourceLines"
+else
+    let b:undo_ftplugin = " | unlet! b:IsInRCode b:SourceLines"
+endif
diff --git a/ftplugin/rmd.vim b/ftplugin/rmd.vim
deleted file mode 100644
index 55723ff..0000000
--- a/ftplugin/rmd.vim
+++ /dev/null
@@ -1,43 +0,0 @@
-" Vim filetype plugin file
-" Language: R help file
-" Maintainer: Jakson Alves de Aquino 
-" Last Change:	Wed Jul 09, 2014  06:23PM
-" Original work by Alex Zvoleff (adjusted for rmd by Michel Kuhlmann)
-
-" Only do this when not yet done for this buffer
-if exists("b:did_ftplugin")
-  finish
-endif
-
-runtime! ftplugin/html.vim ftplugin/html_*.vim ftplugin/html/*.vim
-
-setlocal comments=fb:*,fb:-,fb:+,n:> commentstring=>\ %s
-setlocal formatoptions+=tcqln
-setlocal formatlistpat=^\\s*\\d\\+\\.\\s\\+\\\|^\\s*[-*+]\\s\\+
-setlocal iskeyword=@,48-57,_,.
-
-let s:cpo_save = &cpo
-set cpo&vim
-
-" Enables pandoc if it is installed
-unlet! b:did_ftplugin
-runtime ftplugin/pandoc.vim
-
-" Don't load another plugin for this buffer
-let b:did_ftplugin = 1
-
-if has("gui_win32") && !exists("b:browsefilter")
-  let b:browsefilter = "R Source Files (*.R *.Rnw *.Rd *.Rmd *.Rrst)\t*.R;*.Rnw;*.Rd;*.Rmd;*.Rrst\n" .
-        \ "All Files (*.*)\t*.*\n"
-endif
-
-if exists('b:undo_ftplugin')
-  let b:undo_ftplugin .= " | setl cms< com< fo< flp< isk< | unlet! b:browsefilter"
-else
-  let b:undo_ftplugin = "setl cms< com< fo< flp< isk< | unlet! b:browsefilter"
-endif
-
-let &cpo = s:cpo_save
-unlet s:cpo_save
-
-" vim: sw=2
diff --git a/ftplugin/rmd_rplugin.vim b/ftplugin/rmd_rplugin.vim
index 3216364..33e64d8 100644
--- a/ftplugin/rmd_rplugin.vim
+++ b/ftplugin/rmd_rplugin.vim
@@ -14,6 +14,13 @@ endif
 " be defined after the global ones:
 runtime r-plugin/common_buffer.vim
 
+if !exists("b:did_ftplugin")
+    if !exists("g:rplugin_runtime_warn")
+        call RWarningMsgInp("Your runtime files seems to be outdated.\nSee: https://github.com/jalvesaq/R-Vim-runtime")
+    endif
+    let g:rplugin_runtime_warn = 1
+endif
+
 function! RmdIsInRCode(vrb)
     let chunkline = search("^[ \t]*```[ ]*{r", "bncW")
     let docline = search("^[ \t]*```$", "bncW")
@@ -154,4 +161,8 @@ call RSetPDFViewer()
 
 call RSourceOtherScripts()
 
-let b:undo_ftplugin .= " | unlet! b:IsInRCode b:SourceLines b:PreviousRChunk b:NextRChunk b:SendChunkToR"
+if exists("b:undo_ftplugin")
+    let b:undo_ftplugin .= " | unlet! b:IsInRCode b:SourceLines b:PreviousRChunk b:NextRChunk b:SendChunkToR"
+else
+    let b:undo_ftplugin = " | unlet! b:IsInRCode b:SourceLines b:PreviousRChunk b:NextRChunk b:SendChunkToR"
+endif
diff --git a/ftplugin/rnoweb.vim b/ftplugin/rnoweb.vim
deleted file mode 100644
index baf53d0..0000000
--- a/ftplugin/rnoweb.vim
+++ /dev/null
@@ -1,40 +0,0 @@
-" Vim filetype plugin file
-" Language: Rnoweb
-" Maintainer: Jakson Alves de Aquino 
-" Last Change:	Wed Jul 09, 2014  06:23PM
-
-" Only do this when not yet done for this buffer
-if exists("b:did_ftplugin")
-  finish
-endif
-
-let s:cpo_save = &cpo
-set cpo&vim
-
-runtime! ftplugin/tex.vim
-
-" Don't load another plugin for this buffer
-let b:did_ftplugin = 1
-
-" Enables Vim-Latex-Suite, LaTeX-Box if installed
-runtime ftplugin/tex_*.vim
-
-setlocal iskeyword=@,48-57,_,.
-setlocal suffixesadd=.bib,.tex
-setlocal comments=b:%,b:#,b:##,b:###,b:#'
-
-if has("gui_win32") && !exists("b:browsefilter")
-  let b:browsefilter = "R Source Files (*.R *.Rnw *.Rd *.Rmd *.Rrst)\t*.R;*.Rnw;*.Rd;*.Rmd;*.Rrst\n" .
-        \ "All Files (*.*)\t*.*\n"
-endif
-
-if exists('b:undo_ftplugin')
-  let b:undo_ftplugin .= " | setl isk< sua< com< | unlet! b:browsefilter"
-else
-  let b:undo_ftplugin = "setl isk< sua< com< | unlet! b:browsefilter"
-endif
-
-let &cpo = s:cpo_save
-unlet s:cpo_save
-
-" vim: sw=2
diff --git a/ftplugin/rnoweb_rplugin.vim b/ftplugin/rnoweb_rplugin.vim
index 31abc62..99a03f3 100644
--- a/ftplugin/rnoweb_rplugin.vim
+++ b/ftplugin/rnoweb_rplugin.vim
@@ -13,6 +13,13 @@ endif
 " after the global ones:
 runtime r-plugin/common_buffer.vim
 
+if !exists("b:did_ftplugin")
+    if !exists("g:rplugin_runtime_warn")
+        call RWarningMsgInp("Your runtime files seems to be outdated.\nSee: https://github.com/jalvesaq/R-Vim-runtime")
+    endif
+    let g:rplugin_runtime_warn = 1
+endif
+
 if has("win32") || has("win64")
     call RSetDefaultValue("g:vimrplugin_latexmk", 0)
 else
@@ -641,4 +648,8 @@ endif
 
 call RSourceOtherScripts()
 
-let b:undo_ftplugin .= " | unlet! b:IsInRCode b:SourceLines b:PreviousRChunk b:NextRChunk b:SendChunkToR"
+if exists("b:undo_ftplugin")
+    let b:undo_ftplugin .= " | unlet! b:IsInRCode b:SourceLines b:PreviousRChunk b:NextRChunk b:SendChunkToR"
+else
+    let b:undo_ftplugin = " | unlet! b:IsInRCode b:SourceLines b:PreviousRChunk b:NextRChunk b:SendChunkToR"
+endif
diff --git a/ftplugin/rrst.vim b/ftplugin/rrst.vim
deleted file mode 100644
index 8140169..0000000
--- a/ftplugin/rrst.vim
+++ /dev/null
@@ -1,37 +0,0 @@
-" Vim filetype plugin file
-" Language: reStructuredText documentation format with R code
-" Maintainer: Jakson Alves de Aquino 
-" Last Change:	Wed Jul 09, 2014  06:23PM
-" Original work by Alex Zvoleff
-
-" Only do this when not yet done for this buffer
-if exists("b:did_ftplugin")
-  finish
-endif
-
-" Don't load another plugin for this buffer
-let b:did_ftplugin = 1
-
-let s:cpo_save = &cpo
-set cpo&vim
-
-setlocal comments=fb:*,fb:-,fb:+,n:> commentstring=>\ %s
-setlocal formatoptions+=tcqln
-setlocal formatlistpat=^\\s*\\d\\+\\.\\s\\+\\\|^\\s*[-*+]\\s\\+
-setlocal iskeyword=@,48-57,_,.
-
-if has("gui_win32") && !exists("b:browsefilter")
-  let b:browsefilter = "R Source Files (*.R *.Rnw *.Rd *.Rmd *.Rrst)\t*.R;*.Rnw;*.Rd;*.Rmd;*.Rrst\n" .
-        \ "All Files (*.*)\t*.*\n"
-endif
-
-if exists('b:undo_ftplugin')
-  let b:undo_ftplugin .= " | setl cms< com< fo< flp< isk< | unlet! b:browsefilter"
-else
-  let b:undo_ftplugin = "setl cms< com< fo< flp< isk< | unlet! b:browsefilter"
-endif
-
-let &cpo = s:cpo_save
-unlet s:cpo_save
-
-" vim: sw=2
diff --git a/ftplugin/rrst_rplugin.vim b/ftplugin/rrst_rplugin.vim
index 113ae6c..309e30d 100644
--- a/ftplugin/rrst_rplugin.vim
+++ b/ftplugin/rrst_rplugin.vim
@@ -13,6 +13,13 @@ endif
 " defined after the global ones:
 runtime r-plugin/common_buffer.vim
 
+if !exists("b:did_ftplugin")
+    if !exists("g:rplugin_runtime_warn")
+        call RWarningMsgInp("Your runtime files seems to be outdated.\nSee: https://github.com/jalvesaq/R-Vim-runtime")
+    endif
+    let g:rplugin_runtime_warn = 1
+endif
+
 function! RrstIsInRCode(vrb)
     let chunkline = search("^\\.\\. {r", "bncW")
     let docline = search("^\\.\\. \\.\\.", "bncW")
@@ -189,4 +196,8 @@ let g:rplugin_has_rst2pdf = 0
 
 call RSourceOtherScripts()
 
-let b:undo_ftplugin .= " | unlet! b:IsInRCode b:SourceLines b:PreviousRChunk b:NextRChunk b:SendChunkToR"
+if exists("b:undo_ftplugin")
+    let b:undo_ftplugin .= " | unlet! b:IsInRCode b:SourceLines b:PreviousRChunk b:NextRChunk b:SendChunkToR"
+else
+    let b:undo_ftplugin = " | unlet! b:IsInRCode b:SourceLines b:PreviousRChunk b:NextRChunk b:SendChunkToR"
+endif
diff --git a/indent/r.vim b/indent/r.vim
deleted file mode 100644
index 105f0cd..0000000
--- a/indent/r.vim
+++ /dev/null
@@ -1,515 +0,0 @@
-" Vim indent file
-" Language:	R
-" Author:	Jakson Alves de Aquino 
-" Last Change:	Thu Mar 26, 2015  05:36PM
-
-
-" Only load this indent file when no other was loaded.
-if exists("b:did_indent")
-  finish
-endif
-let b:did_indent = 1
-
-setlocal indentkeys=0{,0},:,!^F,o,O,e
-setlocal indentexpr=GetRIndent()
-
-" Only define the function once.
-if exists("*GetRIndent")
-  finish
-endif
-
-" Options to make the indentation more similar to Emacs/ESS:
-if !exists("g:r_indent_align_args")
-  let g:r_indent_align_args = 1
-endif
-if !exists("g:r_indent_ess_comments")
-  let g:r_indent_ess_comments = 0
-endif
-if !exists("g:r_indent_comment_column")
-  let g:r_indent_comment_column = 40
-endif
-if ! exists("g:r_indent_ess_compatible")
-  let g:r_indent_ess_compatible = 0
-endif
-if ! exists("g:r_indent_op_pattern")
-  let g:r_indent_op_pattern = '\(+\|-\|\*\|/\|=\|\~\|%\)$'
-endif
-
-function s:RDelete_quotes(line)
-  let i = 0
-  let j = 0
-  let line1 = ""
-  let llen = strlen(a:line)
-  while i < llen
-    if a:line[i] == '"'
-      let i += 1
-      let line1 = line1 . 's'
-      while !(a:line[i] == '"' && ((i > 1 && a:line[i-1] == '\' && a:line[i-2] == '\') || a:line[i-1] != '\')) && i < llen
-        let i += 1
-      endwhile
-      if a:line[i] == '"'
-        let i += 1
-      endif
-    else
-      if a:line[i] == "'"
-        let i += 1
-        let line1 = line1 . 's'
-        while !(a:line[i] == "'" && ((i > 1 && a:line[i-1] == '\' && a:line[i-2] == '\') || a:line[i-1] != '\')) && i < llen
-          let i += 1
-        endwhile
-        if a:line[i] == "'"
-          let i += 1
-        endif
-      else
-        if a:line[i] == "`"
-          let i += 1
-          let line1 = line1 . 's'
-          while a:line[i] != "`" && i < llen
-            let i += 1
-          endwhile
-          if a:line[i] == "`"
-            let i += 1
-          endif
-        endif
-      endif
-    endif
-    if i == llen
-      break
-    endif
-    let line1 = line1 . a:line[i]
-    let j += 1
-    let i += 1
-  endwhile
-  return line1
-endfunction
-
-" Convert foo(bar()) int foo()
-function s:RDelete_parens(line)
-  if s:Get_paren_balance(a:line, "(", ")") != 0
-    return a:line
-  endif
-  let i = 0
-  let j = 0
-  let line1 = ""
-  let llen = strlen(a:line)
-  while i < llen
-    let line1 = line1 . a:line[i]
-    if a:line[i] == '('
-      let nop = 1
-      while nop > 0 && i < llen
-        let i += 1
-        if a:line[i] == ')'
-          let nop -= 1
-        else
-          if a:line[i] == '('
-            let nop += 1
-          endif
-        endif
-      endwhile
-      let line1 = line1 . a:line[i]
-    endif
-    let i += 1
-  endwhile
-  return line1
-endfunction
-
-function! s:Get_paren_balance(line, o, c)
-  let line2 = substitute(a:line, a:o, "", "g")
-  let openp = strlen(a:line) - strlen(line2)
-  let line3 = substitute(line2, a:c, "", "g")
-  let closep = strlen(line2) - strlen(line3)
-  return openp - closep
-endfunction
-
-function! s:Get_matching_brace(linenr, o, c, delbrace)
-  let line = SanitizeRLine(getline(a:linenr))
-  if a:delbrace == 1
-    let line = substitute(line, '{$', "", "")
-  endif
-  let pb = s:Get_paren_balance(line, a:o, a:c)
-  let i = a:linenr
-  while pb != 0 && i > 1
-    let i -= 1
-    let pb += s:Get_paren_balance(SanitizeRLine(getline(i)), a:o, a:c)
-  endwhile
-  return i
-endfunction
-
-" This function is buggy because there 'if's without 'else'
-" It must be rewritten relying more on indentation
-function! s:Get_matching_if(linenr, delif)
-  let line = SanitizeRLine(getline(a:linenr))
-  if a:delif
-    let line = substitute(line, "if", "", "g")
-  endif
-  let elsenr = 0
-  let i = a:linenr
-  let ifhere = 0
-  while i > 0
-    let line2 = substitute(line, '\', "xxx", "g")
-    let elsenr += strlen(line) - strlen(line2)
-    if line =~ '.*\s*if\s*()' || line =~ '.*\s*if\s*()'
-      let elsenr -= 1
-      if elsenr == 0
-        let ifhere = i
-        break
-      endif
-    endif
-    let i -= 1
-    let line = SanitizeRLine(getline(i))
-  endwhile
-  if ifhere
-    return ifhere
-  else
-    return a:linenr
-  endif
-endfunction
-
-function! s:Get_last_paren_idx(line, o, c, pb)
-  let blc = a:pb
-  let line = substitute(a:line, '\t', s:curtabstop, "g")
-  let theidx = -1
-  let llen = strlen(line)
-  let idx = 0
-  while idx < llen
-    if line[idx] == a:o
-      let blc -= 1
-      if blc == 0
-        let theidx = idx
-      endif
-    else
-      if line[idx] == a:c
-        let blc += 1
-      endif
-    endif
-    let idx += 1
-  endwhile
-  return theidx + 1
-endfunction
-
-" Get previous relevant line. Search back until getting a line that isn't
-" comment or blank
-function s:Get_prev_line(lineno)
-  let lnum = a:lineno - 1
-  let data = getline( lnum )
-  while lnum > 0 && (data =~ '^\s*#' || data =~ '^\s*$')
-    let lnum = lnum - 1
-    let data = getline( lnum )
-  endwhile
-  return lnum
-endfunction
-
-" This function is also used by r-plugin/common_global.vim
-" Delete from '#' to the end of the line, unless the '#' is inside a string.
-function SanitizeRLine(line)
-  let newline = s:RDelete_quotes(a:line)
-  let newline = s:RDelete_parens(newline)
-  let newline = substitute(newline, '#.*', "", "")
-  let newline = substitute(newline, '\s*$', "", "")
-  if &filetype == "rhelp" && newline =~ '^\\method{.*}{.*}(.*'
-    let newline = substitute(newline, '^\\method{\(.*\)}{.*}', '\1', "")
-  endif
-  return newline
-endfunction
-
-function GetRIndent()
-
-  let clnum = line(".")    " current line
-
-  let cline = getline(clnum)
-  if cline =~ '^\s*#'
-    if g:r_indent_ess_comments == 1
-      if cline =~ '^\s*###'
-        return 0
-      endif
-      if cline !~ '^\s*##'
-        return g:r_indent_comment_column
-      endif
-    endif
-  endif
-
-  let cline = SanitizeRLine(cline)
-
-  if cline =~ '^\s*}' || cline =~ '^\s*}\s*)$'
-    let indline = s:Get_matching_brace(clnum, '{', '}', 1)
-    if indline > 0 && indline != clnum
-      let iline = SanitizeRLine(getline(indline))
-      if s:Get_paren_balance(iline, "(", ")") == 0 || iline =~ '(\s*{$'
-        return indent(indline)
-      else
-        let indline = s:Get_matching_brace(indline, '(', ')', 1)
-        return indent(indline)
-      endif
-    endif
-  endif
-
-  " Find the first non blank line above the current line
-  let lnum = s:Get_prev_line(clnum)
-  " Hit the start of the file, use zero indent.
-  if lnum == 0
-    return 0
-  endif
-
-  let line = SanitizeRLine(getline(lnum))
-
-  if &filetype == "rhelp"
-    if cline =~ '^\\dontshow{' || cline =~ '^\\dontrun{' || cline =~ '^\\donttest{' || cline =~ '^\\testonly{'
-      return 0
-    endif
-    if line =~ '^\\examples{' || line =~ '^\\usage{' || line =~ '^\\dontshow{' || line =~ '^\\dontrun{' || line =~ '^\\donttest{' || line =~ '^\\testonly{'
-      return 0
-    endif
-  endif
-
-  if &filetype == "rnoweb" && line =~ "^<<.*>>="
-    return 0
-  endif
-
-  if cline =~ '^\s*{'
-    if g:r_indent_ess_compatible && line =~ ')$'
-      let nlnum = lnum
-      let nline = line
-      while s:Get_paren_balance(nline, '(', ')') < 0
-        let nlnum = s:Get_prev_line(nlnum)
-        let nline = SanitizeRLine(getline(nlnum)) . nline
-      endwhile
-      if nline =~ '^\s*function\s*(' && indent(nlnum) == &sw
-        return 0
-      endif
-    endif
-    if s:Get_paren_balance(line, "(", ")") == 0
-      return indent(lnum)
-    endif
-  endif
-
-  " line is an incomplete command:
-  if line =~ '\<\(if\|while\|for\|function\)\s*()$' || line =~ '\ 0 && line =~ '{$'
-      return s:Get_last_paren_idx(line, '(', ')', pb) + &sw
-    endif
-
-    let bb = s:Get_paren_balance(line, '[', ']')
-
-    if pb > 0
-      if &filetype == "rhelp"
-        let ind = s:Get_last_paren_idx(line, '(', ')', pb)
-      else
-        let ind = s:Get_last_paren_idx(getline(lnum), '(', ')', pb)
-      endif
-      return ind
-    endif
-
-    if pb < 0 && line =~ '.*[,&|\-\*+<>]$'
-      let lnum = s:Get_prev_line(lnum)
-      while pb < 1 && lnum > 0
-        let line = SanitizeRLine(getline(lnum))
-        let line = substitute(line, '\t', s:curtabstop, "g")
-        let ind = strlen(line)
-        while ind > 0
-          if line[ind] == ')'
-            let pb -= 1
-          else
-            if line[ind] == '('
-              let pb += 1
-            endif
-          endif
-          if pb == 1
-            return ind + 1
-          endif
-          let ind -= 1
-        endwhile
-        let lnum -= 1
-      endwhile
-      return 0
-    endif
-
-    if bb > 0
-      let ind = s:Get_last_paren_idx(getline(lnum), '[', ']', bb)
-      return ind
-    endif
-  endif
-
-  let post_block = 0
-  if line =~ '}$'
-    let lnum = s:Get_matching_brace(lnum, '{', '}', 0)
-    let line = SanitizeRLine(getline(lnum))
-    if lnum > 0 && line =~ '^\s*{'
-      let lnum = s:Get_prev_line(lnum)
-      let line = SanitizeRLine(getline(lnum))
-    endif
-    let pb = s:Get_paren_balance(line, '(', ')')
-    let post_block = 1
-  endif
-
-  " Indent after operator pattern
-  let olnum = s:Get_prev_line(lnum)
-  let oline = getline(olnum)
-  if olnum > 0
-    if line =~ g:r_indent_op_pattern
-      if oline =~ g:r_indent_op_pattern
-        return indent(lnum)
-      else
-        return indent(lnum) + &sw
-      endif
-    else
-      if oline =~ g:r_indent_op_pattern
-        return indent(lnum) - &sw
-      endif
-    endif
-  endif
-
-  let post_fun = 0
-  if pb < 0 && line !~ ')\s*[,&|\-\*+<>]$'
-    let post_fun = 1
-    while pb < 0 && lnum > 0
-      let lnum -= 1
-      let linepiece = SanitizeRLine(getline(lnum))
-      let pb += s:Get_paren_balance(linepiece, "(", ")")
-      let line = linepiece . line
-    endwhile
-    if line =~ '{$' && post_block == 0
-      return indent(lnum) + &sw
-    endif
-
-    " Now we can do some tests again
-    if cline =~ '^\s*{'
-      return indent(lnum)
-    endif
-    if post_block == 0
-      let newl = SanitizeRLine(line)
-      if newl =~ '\<\(if\|while\|for\|function\)\s*()$' || newl =~ '\ 0
-      let lnum -= 1
-      let linepiece = SanitizeRLine(getline(lnum))
-      let bb += s:Get_paren_balance(linepiece, "[", "]")
-      let line = linepiece . line
-    endwhile
-    let line = s:RDelete_parens(line)
-  endif
-
-  let plnum = s:Get_prev_line(lnum)
-  let ppost_else = 0
-  if plnum > 0
-    let pline = SanitizeRLine(getline(plnum))
-    let ppost_block = 0
-    if pline =~ '}$'
-      let ppost_block = 1
-      let plnum = s:Get_matching_brace(plnum, '{', '}', 0)
-      let pline = SanitizeRLine(getline(plnum))
-      if pline =~ '^\s*{$' && plnum > 0
-        let plnum = s:Get_prev_line(plnum)
-        let pline = SanitizeRLine(getline(plnum))
-      endif
-    endif
-
-    if pline =~ 'else$'
-      let ppost_else = 1
-      let plnum = s:Get_matching_if(plnum, 0)
-      let pline = SanitizeRLine(getline(plnum))
-    endif
-
-    if pline =~ '^\s*else\s*if\s*('
-      let pplnum = s:Get_prev_line(plnum)
-      let ppline = SanitizeRLine(getline(pplnum))
-      while ppline =~ '^\s*else\s*if\s*(' || ppline =~ '^\s*if\s*()\s*\S$'
-        let plnum = pplnum
-        let pline = ppline
-        let pplnum = s:Get_prev_line(plnum)
-        let ppline = SanitizeRLine(getline(pplnum))
-      endwhile
-      while ppline =~ '\<\(if\|while\|for\|function\)\s*()$' || ppline =~ '\ 0
-        let plnum -= 1
-        let linepiece = SanitizeRLine(getline(plnum))
-        let ppb += s:Get_paren_balance(linepiece, "(", ")")
-        let pline = linepiece . pline
-      endwhile
-      let pline = s:RDelete_parens(pline)
-    endif
-  endif
-
-  let ind = indent(lnum)
-  let pind = indent(plnum)
-
-  if g:r_indent_align_args == 0 && pb != 0
-    let ind += pb * &sw
-    return ind
-  endif
-
-  if g:r_indent_align_args == 0 && bb != 0
-    let ind += bb * &sw
-    return ind
-  endif
-
-  if ind == pind || (ind == (pind  + &sw) && pline =~ '{$' && ppost_else == 0)
-    return ind
-  endif
-
-  let pline = getline(plnum)
-  let pbb = s:Get_paren_balance(pline, '[', ']')
-
-  while pind < ind && plnum > 0 && ppb == 0 && pbb == 0
-    let ind = pind
-    let plnum = s:Get_prev_line(plnum)
-    let pline = getline(plnum)
-    let ppb = s:Get_paren_balance(pline, '(', ')')
-    let pbb = s:Get_paren_balance(pline, '[', ']')
-    while pline =~ '^\s*else'
-      let plnum = s:Get_matching_if(plnum, 1)
-      let pline = getline(plnum)
-      let ppb = s:Get_paren_balance(pline, '(', ')')
-      let pbb = s:Get_paren_balance(pline, '[', ']')
-    endwhile
-    let pind = indent(plnum)
-    if ind == (pind  + &sw) && pline =~ '{$'
-      return ind
-    endif
-  endwhile
-
-  return ind
-
-endfunction
-
-" vim: sw=2
diff --git a/indent/rhelp.vim b/indent/rhelp.vim
deleted file mode 100644
index 3b37128..0000000
--- a/indent/rhelp.vim
+++ /dev/null
@@ -1,107 +0,0 @@
-" Vim indent file
-" Language:	R Documentation (Help), *.Rd
-" Author:	Jakson Alves de Aquino 
-" Last Change:	Thu Oct 16, 2014  07:07AM
-
-
-" Only load this indent file when no other was loaded.
-if exists("b:did_indent")
-  finish
-endif
-runtime indent/r.vim
-let s:RIndent = function(substitute(&indentexpr, "()", "", ""))
-let b:did_indent = 1
-
-setlocal noautoindent
-setlocal nocindent
-setlocal nosmartindent
-setlocal nolisp
-setlocal indentkeys=0{,0},:,!^F,o,O,e
-setlocal indentexpr=GetCorrectRHelpIndent()
-
-" Only define the functions once.
-if exists("*GetRHelpIndent")
-  finish
-endif
-
-function s:SanitizeRHelpLine(line)
-  let newline = substitute(a:line, '\\\\', "x", "g")
-  let newline = substitute(newline, '\\{', "x", "g")
-  let newline = substitute(newline, '\\}', "x", "g")
-  let newline = substitute(newline, '\\%', "x", "g")
-  let newline = substitute(newline, '%.*', "", "")
-  let newline = substitute(newline, '\s*$', "", "")
-  return newline
-endfunction
-
-function GetRHelpIndent()
-
-  let clnum = line(".")    " current line
-  if clnum == 1
-    return 0
-  endif
-  let cline = getline(clnum)
-
-  if cline =~ '^\s*}\s*$'
-    let i = clnum
-    let bb = -1
-    while bb != 0 && i > 1
-      let i -= 1
-      let line = s:SanitizeRHelpLine(getline(i))
-      let line2 = substitute(line, "{", "", "g")
-      let openb = strlen(line) - strlen(line2)
-      let line3 = substitute(line2, "}", "", "g")
-      let closeb = strlen(line2) - strlen(line3)
-      let bb += openb - closeb
-    endwhile
-    return indent(i)
-  endif
-
-  if cline =~ '^\s*#ifdef\>' || cline =~ '^\s*#endif\>'
-    return 0
-  endif
-
-  let lnum = clnum - 1
-  let line = getline(lnum)
-  if line =~ '^\s*#ifdef\>' || line =~ '^\s*#endif\>'
-    let lnum -= 1
-    let line = getline(lnum)
-  endif
-  while lnum > 1 && (line =~ '^\s*$' || line =~ '^#ifdef' || line =~ '^#endif')
-    let lnum -= 1
-    let line = getline(lnum)
-  endwhile
-  if lnum == 1
-    return 0
-  endif
-  let line = s:SanitizeRHelpLine(line)
-  let line2 = substitute(line, "{", "", "g")
-  let openb = strlen(line) - strlen(line2)
-  let line3 = substitute(line2, "}", "", "g")
-  let closeb = strlen(line2) - strlen(line3)
-  let bb = openb - closeb
-
-  let ind = indent(lnum) + (bb * &sw)
-
-  if line =~ '^\s*}\s*$'
-    let ind = indent(lnum)
-  endif
-
-  if ind < 0
-    return 0
-  endif
-
-  return ind
-endfunction
-
-function GetCorrectRHelpIndent()
-  let lastsection = search('^\\[a-z]*{', "bncW")
-  let secname = getline(lastsection)
-  if secname =~ '^\\usage{' || secname =~ '^\\examples{' || secname =~ '^\\dontshow{' || secname =~ '^\\dontrun{' || secname =~ '^\\donttest{' || secname =~ '^\\testonly{' || secname =~ '^\\method{.*}{.*}('
-    return s:RIndent()
-  else
-    return GetRHelpIndent()
-  endif
-endfunction
-
-" vim: sw=2
diff --git a/indent/rmd.vim b/indent/rmd.vim
deleted file mode 100644
index 9a8a3cb..0000000
--- a/indent/rmd.vim
+++ /dev/null
@@ -1,46 +0,0 @@
-" Vim indent file
-" Language:	Rmd
-" Author:	Jakson Alves de Aquino 
-" Last Change:	Thu Jul 10, 2014  07:11PM
-
-
-" Only load this indent file when no other was loaded.
-if exists("b:did_indent")
-  finish
-endif
-runtime indent/r.vim
-let s:RIndent = function(substitute(&indentexpr, "()", "", ""))
-let b:did_indent = 1
-
-setlocal indentkeys=0{,0},:,!^F,o,O,e
-setlocal indentexpr=GetRmdIndent()
-
-if exists("*GetRmdIndent")
-  finish
-endif
-
-function GetMdIndent()
-  let pline = getline(v:lnum - 1)
-  let cline = getline(v:lnum)
-  if prevnonblank(v:lnum - 1) < v:lnum - 1 || cline =~ '^\s*[-\+\*]\s' || cline =~ '^\s*\d\+\.\s\+'
-    return indent(v:lnum)
-  elseif pline =~ '^\s*[-\+\*]\s'
-    return indent(v:lnum - 1) + 2
-  elseif pline =~ '^\s*\d\+\.\s\+'
-    return indent(v:lnum - 1) + 3
-  endif
-  return indent(prevnonblank(v:lnum - 1))
-endfunction
-
-function GetRmdIndent()
-  if getline(".") =~ '^[ \t]*```{r .*}$' || getline(".") =~ '^[ \t]*```$'
-    return 0
-  endif
-  if search('^[ \t]*```{r', "bncW") > search('^[ \t]*```$', "bncW")
-    return s:RIndent()
-  else
-    return GetMdIndent()
-  endif
-endfunction
-
-" vim: sw=2
diff --git a/indent/rnoweb.vim b/indent/rnoweb.vim
deleted file mode 100644
index d0cad3d..0000000
--- a/indent/rnoweb.vim
+++ /dev/null
@@ -1,36 +0,0 @@
-" Vim indent file
-" Language:	Rnoweb
-" Author:	Jakson Alves de Aquino 
-" Last Change:	Sun Mar 22, 2015  09:28AM
-
-
-" Only load this indent file when no other was loaded.
-if exists("b:did_indent")
-  finish
-endif
-runtime indent/tex.vim
-let s:TeXIndent = function(substitute(&indentexpr, "()", "", ""))
-unlet b:did_indent
-runtime indent/r.vim
-let s:RIndent = function(substitute(&indentexpr, "()", "", ""))
-let b:did_indent = 1
-
-setlocal indentkeys=0{,0},!^F,o,O,e,},=\bibitem,=\item
-setlocal indentexpr=GetRnowebIndent()
-
-if exists("*GetRnowebIndent")
-  finish
-endif
-
-function GetRnowebIndent()
-  let curline = getline(".")
-  if curline =~ '^<<.*>>=$' || curline =~ '^\s*@$'
-    return 0
-  endif
-  if search("^<<", "bncW") > search("^@", "bncW")
-    return s:RIndent()
-  endif
-  return s:TeXIndent()
-endfunction
-
-" vim: sw=2
diff --git a/indent/rrst.vim b/indent/rrst.vim
deleted file mode 100644
index 8bfa834..0000000
--- a/indent/rrst.vim
+++ /dev/null
@@ -1,46 +0,0 @@
-" Vim indent file
-" Language:	Rrst
-" Author:	Jakson Alves de Aquino 
-" Last Change:	Wed Jul 09, 2014  07:33PM
-
-
-" Only load this indent file when no other was loaded.
-if exists("b:did_indent")
-  finish
-endif
-runtime indent/r.vim
-let s:RIndent = function(substitute(&indentexpr, "()", "", ""))
-let b:did_indent = 1
-
-setlocal indentkeys=0{,0},:,!^F,o,O,e
-setlocal indentexpr=GetRrstIndent()
-
-if exists("*GetRrstIndent")
-  finish
-endif
-
-function GetRstIndent()
-  let pline = getline(v:lnum - 1)
-  let cline = getline(v:lnum)
-  if prevnonblank(v:lnum - 1) < v:lnum - 1 || cline =~ '^\s*[-\+\*]\s' || cline =~ '^\s*\d\+\.\s\+'
-    return indent(v:lnum)
-  elseif pline =~ '^\s*[-\+\*]\s'
-    return indent(v:lnum - 1) + 2
-  elseif pline =~ '^\s*\d\+\.\s\+'
-    return indent(v:lnum - 1) + 3
-  endif
-  return indent(prevnonblank(v:lnum - 1))
-endfunction
-
-function GetRrstIndent()
-  if getline(".") =~ '^\.\. {r .*}$' || getline(".") =~ '^\.\. \.\.$'
-    return 0
-  endif
-  if search('^\.\. {r', "bncW") > search('^\.\. \.\.$', "bncW")
-    return s:RIndent()
-  else
-    return GetRstIndent()
-  endif
-endfunction
-
-" vim: sw=2
diff --git a/list_for_vimball b/list_for_vimball
index 51a0144..9eb1a47 100644
--- a/list_for_vimball
+++ b/list_for_vimball
@@ -1,23 +1,13 @@
 autoload/rcomplete.vim
 doc/r-plugin.txt
 ftdetect/r.vim
-ftplugin/r.vim
 ftplugin/r_rplugin.vim
 ftplugin/rbrowser.vim
 ftplugin/rdoc.vim
-ftplugin/rhelp.vim
 ftplugin/rhelp_rplugin.vim
-ftplugin/rmd.vim
 ftplugin/rmd_rplugin.vim
-ftplugin/rnoweb.vim
 ftplugin/rnoweb_rplugin.vim
-ftplugin/rrst.vim
 ftplugin/rrst_rplugin.vim
-indent/r.vim
-indent/rhelp.vim
-indent/rmd.vim
-indent/rnoweb.vim
-indent/rrst.vim
 r-plugin/common_buffer.vim
 r-plugin/common_global.vim
 r-plugin/global_r_plugin.vim
@@ -31,10 +21,6 @@ r-plugin/gui_running.vim
 r-plugin/osx.vim
 r-plugin/setcompldir.vim
 r-plugin/windows.vim
-syntax/r.vim
 syntax/rbrowser.vim
 syntax/rdoc.vim
-syntax/rhelp.vim
-syntax/rmd.vim
 syntax/rout.vim
-syntax/rrst.vim
diff --git a/syntax/r.vim b/syntax/r.vim
deleted file mode 100644
index 9677823..0000000
--- a/syntax/r.vim
+++ /dev/null
@@ -1,236 +0,0 @@
-" Vim syntax file
-" Language:	      R (GNU S)
-" Maintainer:	      Jakson Aquino 
-" Former Maintainers: Vaidotas Zemlys 
-" 		      Tom Payne 
-" Last Change:	      Wed Dec 31, 2014  12:36AM
-" Filenames:	      *.R *.r *.Rhistory *.Rt
-"
-" NOTE: The highlighting of R functions is defined in
-" runtime files created by a filetype plugin, if installed.
-"
-" CONFIGURATION:
-"   syntax folding can be turned on by
-"
-"      let r_syntax_folding = 1
-"
-" Some lines of code were borrowed from Zhuojun Chen.
-
-if exists("b:current_syntax")
-  finish
-endif
-
-setlocal iskeyword=@,48-57,_,.
-
-if exists("g:r_syntax_folding")
-  setlocal foldmethod=syntax
-endif
-
-syn case match
-
-" Comment
-syn match rCommentTodo contained "\(BUG\|FIXME\|NOTE\|TODO\):"
-syn match rComment contains=@Spell,rCommentTodo "#.*"
-
-" Roxygen
-syn match rOKeyword contained "@\(param\|return\|name\|rdname\|examples\|include\|docType\)"
-syn match rOKeyword contained "@\(S3method\|TODO\|aliases\|alias\|assignee\|author\|callGraphDepth\|callGraph\)"
-syn match rOKeyword contained "@\(callGraphPrimitives\|concept\|exportClass\|exportMethod\|exportPattern\|export\|formals\)"
-syn match rOKeyword contained "@\(format\|importClassesFrom\|importFrom\|importMethodsFrom\|import\|keywords\|useDynLib\)"
-syn match rOKeyword contained "@\(method\|noRd\|note\|references\|seealso\|setClass\|slot\|source\|title\|usage\)"
-syn match rOKeyword contained "@\(family\|template\|templateVar\|description\|details\|inheritParams\)"
-syn match rOComment contains=@Spell,rOKeyword "#'.*"
-
-
-if &filetype == "rhelp"
-  " string enclosed in double quotes
-  syn region rString contains=rSpecial,@Spell start=/"/ skip=/\\\\\|\\"/ end=/"/
-  " string enclosed in single quotes
-  syn region rString contains=rSpecial,@Spell start=/'/ skip=/\\\\\|\\'/ end=/'/
-else
-  " string enclosed in double quotes
-  syn region rString contains=rSpecial,rStrError,@Spell start=/"/ skip=/\\\\\|\\"/ end=/"/
-  " string enclosed in single quotes
-  syn region rString contains=rSpecial,rStrError,@Spell start=/'/ skip=/\\\\\|\\'/ end=/'/
-endif
-
-syn match rStrError display contained "\\."
-
-
-" New line, carriage return, tab, backspace, bell, feed, vertical tab, backslash
-syn match rSpecial display contained "\\\(n\|r\|t\|b\|a\|f\|v\|'\|\"\)\|\\\\"
-
-" Hexadecimal and Octal digits
-syn match rSpecial display contained "\\\(x\x\{1,2}\|[0-8]\{1,3}\)"
-
-" Unicode characters
-syn match rSpecial display contained "\\u\x\{1,4}"
-syn match rSpecial display contained "\\U\x\{1,8}"
-syn match rSpecial display contained "\\u{\x\{1,4}}"
-syn match rSpecial display contained "\\U{\x\{1,8}}"
-
-" Statement
-syn keyword rStatement   break next return
-syn keyword rConditional if else
-syn keyword rRepeat      for in repeat while
-
-" Constant (not really)
-syn keyword rConstant T F LETTERS letters month.abb month.name pi
-syn keyword rConstant R.version.string
-
-syn keyword rNumber   NA_integer_ NA_real_ NA_complex_ NA_character_
-
-" Constants
-syn keyword rConstant NULL
-syn keyword rBoolean  FALSE TRUE
-syn keyword rNumber   NA Inf NaN
-
-" integer
-syn match rInteger "\<\d\+L"
-syn match rInteger "\<0x\([0-9]\|[a-f]\|[A-F]\)\+L"
-syn match rInteger "\<\d\+[Ee]+\=\d\+L"
-
-" number with no fractional part or exponent
-syn match rNumber "\<\d\+\>"
-" hexadecimal number
-syn match rNumber "\<0x\([0-9]\|[a-f]\|[A-F]\)\+"
-
-" floating point number with integer and fractional parts and optional exponent
-syn match rFloat "\<\d\+\.\d*\([Ee][-+]\=\d\+\)\="
-" floating point number with no integer part and optional exponent
-syn match rFloat "\<\.\d\+\([Ee][-+]\=\d\+\)\="
-" floating point number with no fractional part and optional exponent
-syn match rFloat "\<\d\+[Ee][-+]\=\d\+"
-
-" complex number
-syn match rComplex "\<\d\+i"
-syn match rComplex "\<\d\++\d\+i"
-syn match rComplex "\<0x\([0-9]\|[a-f]\|[A-F]\)\+i"
-syn match rComplex "\<\d\+\.\d*\([Ee][-+]\=\d\+\)\=i"
-syn match rComplex "\<\.\d\+\([Ee][-+]\=\d\+\)\=i"
-syn match rComplex "\<\d\+[Ee][-+]\=\d\+i"
-
-syn match rAssign    '='
-syn match rOperator    "&"
-syn match rOperator    '-'
-syn match rOperator    '\*'
-syn match rOperator    '+'
-if &filetype != "rmd" && &filetype != "rrst"
-  syn match rOperator    "[|!<>^~/:]"
-else
-  syn match rOperator    "[|!<>^~`/:]"
-endif
-syn match rOperator    "%\{2}\|%\S\{-}%"
-syn match rOperator '\([!><]\)\@<=='
-syn match rOperator '=='
-syn match rOpError  '\*\{3}'
-syn match rOpError  '//'
-syn match rOpError  '&&&'
-syn match rOpError  '|||'
-syn match rOpError  '<<'
-syn match rOpError  '>>'
-
-syn match rAssign "<\{1,2}-"
-syn match rAssign "->\{1,2}"
-
-" Special
-syn match rDelimiter "[,;:]"
-
-" Error
-if exists("g:r_syntax_folding")
-  syn region rRegion matchgroup=Delimiter start=/(/ matchgroup=Delimiter end=/)/ transparent contains=ALLBUT,rError,rBraceError,rCurlyError fold
-  syn region rRegion matchgroup=Delimiter start=/{/ matchgroup=Delimiter end=/}/ transparent contains=ALLBUT,rError,rBraceError,rParenError fold
-  syn region rRegion matchgroup=Delimiter start=/\[/ matchgroup=Delimiter end=/]/ transparent contains=ALLBUT,rError,rCurlyError,rParenError fold
-else
-  syn region rRegion matchgroup=Delimiter start=/(/ matchgroup=Delimiter end=/)/ transparent contains=ALLBUT,rError,rBraceError,rCurlyError
-  syn region rRegion matchgroup=Delimiter start=/{/ matchgroup=Delimiter end=/}/ transparent contains=ALLBUT,rError,rBraceError,rParenError
-  syn region rRegion matchgroup=Delimiter start=/\[/ matchgroup=Delimiter end=/]/ transparent contains=ALLBUT,rError,rCurlyError,rParenError
-endif
-
-syn match rError      "[)\]}]"
-syn match rBraceError "[)}]" contained
-syn match rCurlyError "[)\]]" contained
-syn match rParenError "[\]}]" contained
-
-" Source list of R functions produced by a filetype plugin (if installed)
-if has("nvim")
-  " Nvim-R
-  runtime R/functions.vim
-else
-  " Vim-R-plugin
-  runtime r-plugin/functions.vim
-endif
-
-syn match rDollar display contained "\$"
-syn match rDollar display contained "@"
-
-" List elements will not be highlighted as functions:
-syn match rLstElmt "\$[a-zA-Z0-9\\._]*" contains=rDollar
-syn match rLstElmt "@[a-zA-Z0-9\\._]*" contains=rDollar
-
-" Functions that may add new objects
-syn keyword rPreProc     library require attach detach source
-
-if &filetype == "rhelp"
-  syn match rHelpIdent '\\method'
-  syn match rHelpIdent '\\S4method'
-endif
-
-" Type
-syn keyword rType array category character complex double function integer list logical matrix numeric vector data.frame
-
-" Name of object with spaces
-if &filetype != "rmd" && &filetype != "rrst"
-  syn region rNameWSpace start="`" end="`"
-endif
-
-if &filetype == "rhelp"
-  syn match rhPreProc "^#ifdef.*"
-  syn match rhPreProc "^#endif.*"
-  syn match rhSection "\\dontrun\>"
-endif
-
-if exists("r_syn_minlines")
-  exe "syn sync minlines=" . r_syn_minlines
-else
-  syn sync minlines=40
-endif
-
-" Define the default highlighting.
-hi def link rAssign      Statement
-hi def link rBoolean     Boolean
-hi def link rBraceError  Error
-hi def link rComment     Comment
-hi def link rCommentTodo Todo
-hi def link rOComment    Comment
-hi def link rComplex     Number
-hi def link rConditional Conditional
-hi def link rConstant    Constant
-hi def link rCurlyError  Error
-hi def link rDelimiter   Delimiter
-hi def link rDollar      SpecialChar
-hi def link rError       Error
-hi def link rFloat       Float
-hi def link rFunction    Function
-hi def link rHelpIdent   Identifier
-hi def link rhPreProc    PreProc
-hi def link rhSection    PreCondit
-hi def link rInteger     Number
-hi def link rLstElmt     Normal
-hi def link rNameWSpace  Normal
-hi def link rNumber      Number
-hi def link rOperator    Operator
-hi def link rOpError     Error
-hi def link rParenError  Error
-hi def link rPreProc     PreProc
-hi def link rRepeat      Repeat
-hi def link rSpecial     SpecialChar
-hi def link rStatement   Statement
-hi def link rString      String
-hi def link rStrError    Error
-hi def link rType        Type
-hi def link rOKeyword    Title
-
-let b:current_syntax="r"
-
-" vim: ts=8 sw=2
diff --git a/syntax/rhelp.vim b/syntax/rhelp.vim
deleted file mode 100644
index 32c91ad..0000000
--- a/syntax/rhelp.vim
+++ /dev/null
@@ -1,249 +0,0 @@
-" Vim syntax file
-" Language:    R Help File
-" Maintainer: Jakson Aquino 
-" Former Maintainer: Johannes Ranke 
-" Last Change: Wed Jul 09, 2014  10:28PM
-" Remarks:     - Includes R syntax highlighting in the appropriate
-"                sections if an r.vim file is in the same directory or in the
-"                default debian location.
-"              - There is no Latex markup in equations
-"              - Thanks to Will Gray for finding and fixing a bug
-"              - No support for \if, \ifelse and \out as I don't understand
-"                them and have no examples at hand (help welcome).
-"              - No support for \var tag within quoted string (dito)
-
-" Version Clears: {{{1
-" For version 5.x: Clear all syntax items
-" For version 6.x and 7.x: Quit when a syntax file was already loaded
-if version < 600 
-  syntax clear
-elseif exists("b:current_syntax")
-  finish
-endif 
-
-setlocal iskeyword=@,48-57,_,.
-
-syn case match
-
-" R help identifiers {{{1
-syn region rhelpIdentifier matchgroup=rhelpSection	start="\\name{" end="}" 
-syn region rhelpIdentifier matchgroup=rhelpSection	start="\\alias{" end="}" 
-syn region rhelpIdentifier matchgroup=rhelpSection	start="\\pkg{" end="}" contains=rhelpLink
-syn region rhelpIdentifier matchgroup=rhelpSection start="\\method{" end="}" contained
-syn region rhelpIdentifier matchgroup=rhelpSection start="\\Rdversion{" end="}"
-
-" Highlighting of R code using an existing r.vim syntax file if available {{{1
-syn include @R syntax/r.vim
-
-" Strings {{{1
-syn region rhelpString start=/"/ skip=/\\"/ end=/"/ contains=rhelpSpecialChar,rhelpCodeSpecial,rhelpLink contained
-
-" Special characters in R strings
-syn match rhelpCodeSpecial display contained "\\\\\(n\|r\|t\|b\|a\|f\|v\|'\|\"\)\|\\\\"
-
-" Special characters  ( \$ \& \% \# \{ \} \_)
-syn match rhelpSpecialChar        "\\[$&%#{}_]"
-
-
-" R code {{{1
-syn match rhelpDots		"\\dots" containedin=@R
-syn region rhelpRcode matchgroup=Delimiter start="\\examples{" matchgroup=Delimiter transparent end="}" contains=@R,rhelpLink,rhelpIdentifier,rhelpString,rhelpSpecialChar,rhelpSection
-syn region rhelpRcode matchgroup=Delimiter start="\\usage{" matchgroup=Delimiter transparent end="}" contains=@R,rhelpIdentifier,rhelpS4method
-syn region rhelpRcode matchgroup=Delimiter start="\\synopsis{" matchgroup=Delimiter transparent end="}" contains=@R
-syn region rhelpRcode matchgroup=Delimiter start="\\special{" matchgroup=Delimiter transparent end="}" contains=@R
-
-if v:version > 703
-  syn region rhelpRcode matchgroup=Delimiter start="\\code{" skip='\\\@1"
-syn match rhelpKeyword	"\\ge"
-syn match rhelpKeyword	"\\le"
-syn match rhelpKeyword	"\\alpha"
-syn match rhelpKeyword	"\\beta"
-syn match rhelpKeyword	"\\gamma"
-syn match rhelpKeyword	"\\delta"
-syn match rhelpKeyword	"\\epsilon"
-syn match rhelpKeyword	"\\zeta"
-syn match rhelpKeyword	"\\eta"
-syn match rhelpKeyword	"\\theta"
-syn match rhelpKeyword	"\\iota"
-syn match rhelpKeyword	"\\kappa"
-syn match rhelpKeyword	"\\lambda"
-syn match rhelpKeyword	"\\mu"
-syn match rhelpKeyword	"\\nu"
-syn match rhelpKeyword	"\\xi"
-syn match rhelpKeyword	"\\omicron"
-syn match rhelpKeyword	"\\pi"
-syn match rhelpKeyword	"\\rho"
-syn match rhelpKeyword	"\\sigma"
-syn match rhelpKeyword	"\\tau"
-syn match rhelpKeyword	"\\upsilon"
-syn match rhelpKeyword	"\\phi"
-syn match rhelpKeyword	"\\chi"
-syn match rhelpKeyword	"\\psi"
-syn match rhelpKeyword	"\\omega"
-syn match rhelpKeyword	"\\Alpha"
-syn match rhelpKeyword	"\\Beta"
-syn match rhelpKeyword	"\\Gamma"
-syn match rhelpKeyword	"\\Delta"
-syn match rhelpKeyword	"\\Epsilon"
-syn match rhelpKeyword	"\\Zeta"
-syn match rhelpKeyword	"\\Eta"
-syn match rhelpKeyword	"\\Theta"
-syn match rhelpKeyword	"\\Iota"
-syn match rhelpKeyword	"\\Kappa"
-syn match rhelpKeyword	"\\Lambda"
-syn match rhelpKeyword	"\\Mu"
-syn match rhelpKeyword	"\\Nu"
-syn match rhelpKeyword	"\\Xi"
-syn match rhelpKeyword	"\\Omicron"
-syn match rhelpKeyword	"\\Pi"
-syn match rhelpKeyword	"\\Rho"
-syn match rhelpKeyword	"\\Sigma"
-syn match rhelpKeyword	"\\Tau"
-syn match rhelpKeyword	"\\Upsilon"
-syn match rhelpKeyword	"\\Phi"
-syn match rhelpKeyword	"\\Chi"
-syn match rhelpKeyword	"\\Psi"
-syn match rhelpKeyword	"\\Omega"
-
-" Links {{{1
-syn region rhelpLink matchgroup=rhelpSection start="\\link{" end="}" contained keepend extend
-syn region rhelpLink matchgroup=rhelpSection start="\\link\[.\{-}\]{" end="}" contained keepend extend
-syn region rhelpLink matchgroup=rhelpSection start="\\linkS4class{" end="}" contained keepend extend
-
-" Verbatim like {{{1
-if v:version > 703
-  syn region rhelpVerbatim matchgroup=rhelpType start="\\samp{" skip='\\\@1"
-syn match rhelpType		"\\strong\>"
-syn match rhelpType		"\\bold\>"
-syn match rhelpType		"\\sQuote\>"
-syn match rhelpType		"\\dQuote\>"
-syn match rhelpType		"\\preformatted\>"
-syn match rhelpType		"\\kbd\>"
-syn match rhelpType		"\\eqn\>"
-syn match rhelpType		"\\deqn\>"
-syn match rhelpType		"\\file\>"
-syn match rhelpType		"\\email\>"
-syn match rhelpType		"\\url\>"
-syn match rhelpType		"\\href\>"
-syn match rhelpType		"\\var\>"
-syn match rhelpType		"\\env\>"
-syn match rhelpType		"\\option\>"
-syn match rhelpType		"\\command\>"
-syn match rhelpType		"\\newcommand\>"
-syn match rhelpType		"\\renewcommand\>"
-syn match rhelpType		"\\dfn\>"
-syn match rhelpType		"\\cite\>"
-syn match rhelpType		"\\acronym\>"
-
-" rhelp sections {{{1
-syn match rhelpSection		"\\encoding\>"
-syn match rhelpSection		"\\title\>"
-syn match rhelpSection		"\\item\>"
-syn match rhelpSection		"\\description\>"
-syn match rhelpSection		"\\concept\>"
-syn match rhelpSection		"\\arguments\>"
-syn match rhelpSection		"\\details\>"
-syn match rhelpSection		"\\value\>"
-syn match rhelpSection		"\\references\>"
-syn match rhelpSection		"\\note\>"
-syn match rhelpSection		"\\author\>"
-syn match rhelpSection		"\\seealso\>"
-syn match rhelpSection		"\\keyword\>"
-syn match rhelpSection		"\\docType\>"
-syn match rhelpSection		"\\format\>"
-syn match rhelpSection		"\\source\>"
-syn match rhelpSection    "\\itemize\>"
-syn match rhelpSection    "\\describe\>"
-syn match rhelpSection    "\\enumerate\>"
-syn match rhelpSection    "\\item "
-syn match rhelpSection    "\\item$"
-syn match rhelpSection		"\\tabular{[lcr]*}"
-syn match rhelpSection		"\\dontrun\>"
-syn match rhelpSection		"\\dontshow\>"
-syn match rhelpSection		"\\testonly\>"
-syn match rhelpSection		"\\donttest\>"
-
-" Freely named Sections {{{1
-syn region rhelpFreesec matchgroup=Delimiter start="\\section{" matchgroup=Delimiter transparent end="}"
-syn region rhelpFreesubsec matchgroup=Delimiter start="\\subsection{" matchgroup=Delimiter transparent end="}" 
-
-syn match rhelpDelimiter "{\|\[\|(\|)\|\]\|}"
-
-" R help file comments {{{1
-syn match rhelpComment /%.*$/
-
-" Error {{{1
-syn region rhelpRegion matchgroup=Delimiter start=/(/ matchgroup=Delimiter end=/)/ contains=@Spell,rhelpCodeSpecial,rhelpComment,rhelpDelimiter,rhelpDots,rhelpFreesec,rhelpFreesubsec,rhelpIdentifier,rhelpKeyword,rhelpLink,rhelpPreProc,rhelpRComment,rhelpRcode,rhelpRegion,rhelpS4method,rhelpSection,rhelpSexpr,rhelpSpecialChar,rhelpString,rhelpType,rhelpVerbatim
-syn region rhelpRegion matchgroup=Delimiter start=/{/ matchgroup=Delimiter end=/}/ contains=@Spell,rhelpCodeSpecial,rhelpComment,rhelpDelimiter,rhelpDots,rhelpFreesec,rhelpFreesubsec,rhelpIdentifier,rhelpKeyword,rhelpLink,rhelpPreProc,rhelpRComment,rhelpRcode,rhelpRegion,rhelpS4method,rhelpSection,rhelpSexpr,rhelpSpecialChar,rhelpString,rhelpType,rhelpVerbatim
-syn region rhelpRegion matchgroup=Delimiter start=/\[/ matchgroup=Delimiter end=/]/ contains=@Spell,rhelpCodeSpecial,rhelpComment,rhelpDelimiter,rhelpDots,rhelpFreesec,rhelpFreesubsec,rhelpIdentifier,rhelpKeyword,rhelpLink,rhelpPreProc,rhelpRComment,rhelpRcode,rhelpRegion,rhelpS4method,rhelpSection,rhelpSexpr,rhelpSpecialChar,rhelpString,rhelpType,rhelpVerbatim
-syn match rhelpError      /[)\]}]/
-syn match rhelpBraceError /[)}]/ contained
-syn match rhelpCurlyError /[)\]]/ contained
-syn match rhelpParenError /[\]}]/ contained
-
-syntax sync match rhelpSyncRcode grouphere rhelpRcode "\\examples{"
-
-" Define the default highlighting {{{1
-" For version 5.7 and earlier: only when not done already
-" For version 5.8 and later: only when an item doesn't have highlighting yet
-if version >= 508 || !exists("did_rhelp_syntax_inits")
-  if version < 508
-    let did_rhelp_syntax_inits = 1
-    command -nargs=+ HiLink hi link 
-  else
-    command -nargs=+ HiLink hi def link 
-  endif
-  HiLink rhelpVerbatim    String
-  HiLink rhelpDelimiter   Delimiter
-  HiLink rhelpIdentifier  Identifier
-  HiLink rhelpString      String
-  HiLink rhelpCodeSpecial Special
-  HiLink rhelpKeyword     Keyword
-  HiLink rhelpDots        Keyword
-  HiLink rhelpLink        Underlined
-  HiLink rhelpType        Type
-  HiLink rhelpSection     PreCondit
-  HiLink rhelpError       Error
-  HiLink rhelpBraceError  Error
-  HiLink rhelpCurlyError  Error
-  HiLink rhelpParenError  Error
-  HiLink rhelpPreProc     PreProc
-  HiLink rhelpDelimiter   Delimiter
-  HiLink rhelpComment     Comment
-  HiLink rhelpRComment    Comment
-  HiLink rhelpSpecialChar SpecialChar
-  delcommand HiLink
-endif 
-
-let   b:current_syntax = "rhelp"
-
-" vim: foldmethod=marker sw=2
diff --git a/syntax/rmd.vim b/syntax/rmd.vim
deleted file mode 100644
index 6f1b847..0000000
--- a/syntax/rmd.vim
+++ /dev/null
@@ -1,87 +0,0 @@
-" markdown Text with R statements
-" Language: markdown with R code chunks
-" Last Change: Wed Jul 09, 2014  10:29PM
-"
-" CONFIGURATION:
-"   To highlight chunk headers as R code, put in your vimrc:
-"   let rmd_syn_hl_chunk = 1
-
-" for portability
-if version < 600
-  syntax clear
-elseif exists("b:current_syntax")
-  finish
-endif
-
-" load all of pandoc info
-runtime syntax/pandoc.vim
-if exists("b:current_syntax")
-  let rmdIsPandoc = 1
-  unlet b:current_syntax
-else
-  let rmdIsPandoc = 0
-  runtime syntax/markdown.vim
-  if exists("b:current_syntax")
-    unlet b:current_syntax
-  endif
-endif
-
-" load all of the r syntax highlighting rules into @R
-syntax include @R syntax/r.vim
-if exists("b:current_syntax")
-  unlet b:current_syntax
-endif
-
-if exists("g:rmd_syn_hl_chunk")
-  " highlight R code inside chunk header
-  syntax match rmdChunkDelim "^[ \t]*```{r" contained
-  syntax match rmdChunkDelim "}$" contained
-else
-  syntax match rmdChunkDelim "^[ \t]*```{r.*}$" contained
-endif
-syntax match rmdChunkDelim "^[ \t]*```$" contained
-syntax region rmdChunk start="^[ \t]*``` *{r.*}$" end="^[ \t]*```$" contains=@R,rmdChunkDelim keepend fold
-
-" also match and syntax highlight in-line R code
-syntax match rmdEndInline "`" contained
-syntax match rmdBeginInline "`r " contained
-syntax region rmdrInline start="`r "  end="`" contains=@R,rmdBeginInline,rmdEndInline keepend
-
-" match slidify special marker
-syntax match rmdSlidifySpecial "\*\*\*"
-
-
-if rmdIsPandoc == 0
-  syn match rmdBlockQuote /^\s*>.*\n\(.*\n\@"	contains=@texMathZoneGroup
-  " Region
-  syntax match rmdLaTeXRegDelim "\$\$" contained
-  syntax match rmdLaTeXRegDelim "\$\$latex$" contained
-  syntax region rmdLaTeXRegion start="^\$\$" skip="\\\$" end="\$\$$" contains=@LaTeX,rmdLaTeXSt,rmdLaTeXRegDelim keepend
-  syntax region rmdLaTeXRegion2 start="^\\\[" end="\\\]" contains=@LaTeX,rmdLaTeXSt,rmdLaTeXRegDelim keepend
-  hi def link rmdLaTeXSt Statement
-  hi def link rmdLaTeXInlDelim Special
-  hi def link rmdLaTeXRegDelim Special
-endif
-
-setlocal iskeyword=@,48-57,_,.
-
-syn sync match rmdSyncChunk grouphere rmdChunk "^[ \t]*``` *{r"
-
-hi def link rmdChunkDelim Special
-hi def link rmdBeginInline Special
-hi def link rmdEndInline Special
-hi def link rmdBlockQuote Comment
-hi def link rmdSlidifySpecial Special
-
-let b:current_syntax = "rmd"
-
-" vim: ts=8 sw=2
diff --git a/syntax/rrst.vim b/syntax/rrst.vim
deleted file mode 100644
index 4667b3a..0000000
--- a/syntax/rrst.vim
+++ /dev/null
@@ -1,47 +0,0 @@
-" reStructured Text with R statements
-" Language: reST with R code chunks
-" Maintainer: Alex Zvoleff, azvoleff@mail.sdsu.edu
-" Last Change: Wed Jul 09, 2014  10:29PM
-"
-" CONFIGURATION:
-"   To highlight chunk headers as R code, put in your vimrc:
-"   let rrst_syn_hl_chunk = 1
-
-" for portability
-if version < 600
-  syntax clear
-elseif exists("b:current_syntax")
-  finish
-endif
-
-" load all of the rst info
-runtime syntax/rst.vim
-unlet b:current_syntax
-
-" load all of the r syntax highlighting rules into @R
-syntax include @R syntax/r.vim
-
-setlocal iskeyword=@,48-57,_,.
-
-" highlight R chunks
-if exists("g:rrst_syn_hl_chunk")
-  " highlight R code inside chunk header
-  syntax match rrstChunkDelim "^\.\. {r" contained
-  syntax match rrstChunkDelim "}$" contained
-else
-  syntax match rrstChunkDelim "^\.\. {r .*}$" contained
-endif
-syntax match rrstChunkDelim "^\.\. \.\.$" contained
-syntax region rrstChunk start="^\.\. {r.*}$" end="^\.\. \.\.$" contains=@R,rrstChunkDelim keepend transparent fold
-
-" also highlight in-line R code
-syntax match rrstInlineDelim "`" contained
-syntax match rrstInlineDelim ":r:" contained
-syntax region rrstInline start=":r: *`" skip=/\\\\\|\\`/ end="`" contains=@R,rrstInlineDelim keepend
-
-hi def link rrstChunkDelim Special
-hi def link rrstInlineDelim Special
-
-let b:current_syntax = "rrst"
-
-" vim: ts=8 sw=2

From b8eb37363580d63dd665400ddd193b71a8133c26 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Wed, 8 Apr 2015 22:00:23 -0400
Subject: [PATCH 0950/1050] Delete indent_test.R and indent_test_noalign.R

---
 doc/r-plugin.txt               |   3 +
 r-plugin/indent_test.R         | 671 ---------------------------------
 r-plugin/indent_test_noalign.R | 666 --------------------------------
 3 files changed, 3 insertions(+), 1337 deletions(-)
 delete mode 100644 r-plugin/indent_test.R
 delete mode 100644 r-plugin/indent_test_noalign.R

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 9b880ef..e9fc34d 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -2887,6 +2887,9 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details.
 
 1.2.3 (2015-04-08)
 
+ * Official runtime files were deleted. See:
+   https://github.com/jalvesaq/R-Vim-runtime
+
  * News options to control the Object Browser: vimrplugin_objbr_opendf,
    vimrplugin_objbr_openlist, vimrplugin_objbr_allnames and
    vimrplugin_objbr_labelerr.
diff --git a/r-plugin/indent_test.R b/r-plugin/indent_test.R
deleted file mode 100644
index 998ea78..0000000
--- a/r-plugin/indent_test.R
+++ /dev/null
@@ -1,671 +0,0 @@
-## This is a nonsense code indented in a way that I think is correct.
-## Both Vim-R-plugin and Emacs/ESS make (different) mistakes when indenting it.
-## The following options are in the ~/.vimrc:
-##
-## set expandtab
-## set shiftwidth=4
-## let r_indent_ess_comments = 1
-## let r_indent_align_args = 1
-##
-## and the following is in the ~/.emacs
-##
-## (add-hook 'ess-mode-hook
-##                   (lambda ()
-##                         (ess-set-style 'C++)))
-##
-## If you want to improve the indent/r.vim script, you may want to test your new
-## indentation algorithm with this R script: Make a copy of this file, open it
-## with Vim, do gg=G, quit and use vimdiff to see what is wrong.
-
-
-for(i in 1:10){
-    if(T){
-        a <- 1:10
-    }
-    else {
-        a <- 2:11
-        b <- 2:10
-    }
-}
-
-if(T)
-
-    sim
-
-acabou
-
-x <- DT[really_long_row_subsetting_variable,
-        really_long_column_subsetting_variable,
-        by = really_long_by_statement]
-
-
-asas
-if(T)
-    asas
-asas
-asas
-asas
-
-lkdlks
-if(T)
-                                        # comment
-    andada
-ksldks
-kslksd
-
-if (!(attr in urls))
-    value = escape_txt_chars(value)
-## more commented code here.
-
-while(T) {
-    lskdlsks
-}
-
-if(FALSE){
-}
-
-ff <- "hist"
-mm <- methods(ff)
-l <- length(mm)
-for(i in 1:l){
-    if(exists(mm[i])){
-        arglist <- formals(mm[i])
-        if(nothing('ksjs#asq')) # ls()
-            a <- b
-        k <- length(arglist)
-        if(k > 0){
-            argnames <- names(arglist)
-            for(j in 1:k)
-                cat(ff, mm[i], argnames[j], "\n")
-        }
-        vcov <- if(length(coef))
-            solve(oout$he)
-        else
-            matrix(numeric(0L), 0L, 0L)
-        vcov <-
-            if(length(coef))
-                solve(oout$he)
-            else
-                matrix(numeric(0L), 0L, 0L)
-        xxx
-        www
-    }
-}
-
-if(T)
-{
-    lskdlsks
-    kdlsks
-
-    maes <- subset(b, (age < 40) & (sex == "Female") &
-                   ((condfam == "Reference person") | (condfam == "Spouse")) &
-                   (tipom > 0), select = c("uf", "sex", "age", "fam.cond", "col",
-                                           "school", "urban", "income", "fam.income",
-                                           "tipom", "peso"))
-
-    maes$tipom <- factor(maes$tipom, levels = c(1, 2), labels = c("Casada", "Solteira"))
-    label(maes$tipom) <- "Tipo de mãe"
-                                        # Comment here
-
-    if(T)
-        a <- b
-    else
-        c <- d
-    fim()
-    comeco
-}
-
-while(T)
-{
-    if(T){
-
-                                        # Another comment here
-        kdlskd
-    } else {
-        dksldk
-        iwd <- as.integer(substr(fmt, Iind + 1, regexpr('[\\.\\)]', fmt) - 1))
-        iwd <- as.integer(substr(fmt, Iind + 1, regexpr("\\.\\", fmt) - 1))
-        iwd <- as.integer(substr(fmt, Iind + 1, regexpr('[\\.\\(]', fmt) - 1))
-        sklsdk
-    }
-}
-
-if(nothing){
-    if(everything)
-    {
-        a <- b
-}}
-
-x <- a
-for(i1 in lista1)
-    for(i2 in lista2)
-        for(i3 in lista3)
-            for(i4 in lista4)
-                cat(i1, i2, i3, i4, "\n")
-
-for(i1 in lista1)
-    for(i2 in lista2)
-        for(i3 in lista3)
-            for(i4 in lista4)
-                cat(i1, i2, i3, i4, "\n")
-
-if(T)
-{
-    if (is.environment(object))
-    {
-        ls()
-    }
-    else
-    {
-        ls()
-    }
-}
-
-if(nothing('ksjs#asq')) ls()
-a <- b
-
-if(inherits(pfit, "try#error")) return(NA)
-else {
-    zz <- 2*(pfit@min - fitted@min)
-    a <- b
-}
-
-nothing <- function(x)
-{
-    if(x == "everything")
-        x <- "nothing"
-    x
-}
-
-if (T)
-{
-    if(T)
-        for(i  in 1:2)
-        {
-            cat(i, "\n")
-        }
-    x
-}
-
-if(F)
-{
-    if(T)
-        for(i in 1:2){
-            x <- 1
-        }
-    x
-}
-
-latlon.format <- function(lat, lon, digits=max(6, getOption("digits") - 1))
-{
-    n <- length(lon)
-    rval <- vector("character", n)
-    if (!is.numeric(lat) || !is.numeric(lon))
-        return ("(non-numeric lat or lon)")
-    for (i in 1:n) {
-        if (is.na(lat[i]) || is.na(lon[i]))
-            rval[i] <- ""
-        else
-            rval[i] <- paste(format(abs(lat[i]), digits=digits),
-                             if (lat[i] > 0) "N  " else "S  ",
-                             format(abs(lon[i]), digits=digits),
-                             if (lon[i] > 0) "E" else "W",
-                             sep="")
-        n <- lon
-    }
-    rval
-}
-
-                                        # indent-test-dk-01.R
-if (type == "fill") {
-    land <- c("#FBC784","#F1C37A","#E6B670","#DCA865","#D19A5C",
-              "#C79652","#BD9248","#B38E3E","#A98A34")
-    water <- c("#E1FCF7","#BFF2EC","#A0E8E4","#83DEDE","#68CDD4",
-               "#4FBBC9","#38A7BF","#2292B5","#0F7CAB")
-} else {
-    land <- c("#FBC784","#F1C37A","#E6B670","#DCA865","#D19A5C",
-              "#C79652","#BD9248","#B38E3E","#A98A34")
-    water <- c("#A4FCE3","#72EFE9","#4FE3ED","#47DCF2","#46D7F6",
-               "#3FC0DF","#3FC0DF","#3BB7D3","#36A5C3","#3194B4",
-               "#2A7CA4","#205081","#16255E","#100C2F")
-}
-
-lon.format <- function(lon, digits=max(6, getOption("digits") - 1))
-{
-    n <- length(lon)
-    if (n < 1) return("")
-    rval <- vector("character", n)
-    for (i in 1:n)
-        if (is.na(lon[i]))
-            rval[i] <-  ""
-        else
-            rval[i] <- paste(format(abs(lon[i]), digits=digits),
-                             if (lon[i] > 0) "E" else "S",
-                             sep="")
-    rval
-}
-
-structure(do.something(name = name, exit = NULL, handler = handler,
-                       description = description, test = test,
-                       interactive = interactive),
-          class = "restart")
-
-## store info for loading name space for loadingNamespaceInfo to read
-"__LoadingNamespaceInfo__" <- list(libname = package.lib,
-                                   pkgname = package)
-
-if(any(missingMethods))
-    stop(gettextf("in '%s' methods for export not found: %s",
-                  package,
-                  paste(expMethods[missingMethods],
-                        collapse = ", ")),
-         domain = NA)
-
-if(www){
-    if(R_version_built_under < "2.10.0")
-        stop(gettextf("package '%s' was built before R 2.10.0: please re-install it",
-                      basename(pkgpath)), call. = FALSE, domain = NA)
-    ## we need to ensure that S4 dispatch is on now if the package
-    ## will require it, or the exports will be incomplete.
-    dependsMethods <- "methods" %in% names(pkgInfo$Depends)
-    if(dependsMethods) loadNamespace("methods")
-}
-
-makeRestart <- function(name = "",
-                        handler = function(...) NULL,
-                        description = "",
-                        test = function(c) TRUE,
-                        interactive = NULL) {
-    structure(list(name = name, exit = NULL, handler = handler,
-                   description = description, test = test,
-                   interactive = interactive),
-              class = "restart")
-}
-
-sapply(seq_along(symNames),
-       function(i) {
-           ## could vectorize this outside of the loop
-           ## and assign to different variable to
-           ## maintain the original names.
-           varName <- names(symNames)[i]
-           origVarName <- symNames[i]
-           if(exists(varName, envir = env))
-               warning("failed to assign NativeSymbolInfo for ",
-                       origVarName,
-                       ifelse(origVarName != varName,
-                              paste(" to", varName), ""),
-                       " since ", varName,
-                       " is already defined in the ", package,
-                       " namespace")
-           else
-               assign(varName, symbols[[origVarName]],
-                      envir = env)
-
-       })
-
-if(xx == aa &&
-   yy == bb)
-    cat(xx, yy)
-cat(aa, bb)
-
-something <- function()
-{
-    if (file.exists(nsFile))
-        directives <- if (!is.na(enc) &&
-                          ! Sys.getlocale("LC_CTYPE") %in% c("C", "POSIX")) {
-            con <- file(nsFile, encoding=enc)
-            on.exit(close(con))
-            parse(con)
-        } else parse(nsFile)
-    else if (mustExist)
-        stop(gettextf("package '%s' has no NAMESPACE file", package),
-             domain = NA)
-    x
-}
-
-print.difftime <- function(x, digits = getOption("digits"), ...)
-{
-    if(is.array(x) || length(x) > 1L) {
-        cat("Time differences in ", attr(x, "units"), "\n", sep="")
-        y <- unclass(x); attr(y, "units") <- NULL
-        print(y)
-    }
-    else
-        cat("Time difference of ", format(unclass(x), digits=digits), " ",
-            attr(x, "units"), "\n", sep="")
-
-    invisible(x)
-}
-
-print.difftime <- function(x, digits = getOption("digits"), ...)
-{
-    if(is.array(x) || length(x) > 1L) {
-        cat("Time differences in ", attr(x, "units"), "\n", sep="")
-        y <- unclass(x); attr(y, "units") <- NULL
-        print(y)
-    } else
-        cat("Time difference of ", format(unclass(x), digits=digits), " ",
-            attr(x, "units"), "\n", sep="")
-
-    invisible(x)
-}
-
-namespaceImport <- function(self, ...)
-    for (ns in list(...)) namespaceImportFrom(self, asNamespace(ns))
-
-x
-
-as.function.default <- function (x, envir = parent.frame(), ...)
-    if (is.function(x)) x else .Internal(as.function.default(x, envir))
-
-as.array <- function(x, ...)
-    UseMethod("as.array")
-
-bquote <- function(expr, where=parent.frame())
-{
-    unquote <- function(e)
-        if (length(e) <= 1L) e
-        else if (e[[1L]] == as.name(".")) eval(e[[2L]], where)
-        else if (is.pairlist(e)) as.pairlist(lapply(e,unquote))
-        else as.call(lapply(e,unquote))
-
-    unquote(substitute(expr))
-}
-
-bquote <- function(expr, where=parent.frame())
-{
-    unquote <- function(e)
-        if (length(e) <= 1L) e else
-            if (e[[1L]] == as.name(".")) eval(e[[2L]], where) else
-                if (is.pairlist(e)) as.pairlist(lapply(e,unquote)) else
-                    as.call(lapply(e,unquote))
-
-    unquote(substitute(expr))
-}
-
-for (i in 1:num.stations) {
-    thetime <- stn.time[select[1]] # e. g. 2222
-    time[i] <- as.numeric(as.POSIXct(paste(substr(thedate,1,4),
-                                           " ",
-                                           substr(thetime,1,2),
-                                           ":",
-                                           substr(thetime,3,4),
-                                           ":00",sep=""),tz="UTC")) - trefn
-    stn[i] <- sub("^ *", "", station.id[select[1]])
-    lat[i] <- latitude[select[1]]
-}
-
-bquote <-
-    function(expr, where=parent.frame())
-    {
-        unquote <- function(e)
-            if (length(e) <= 1L) e else
-                if (e[[1L]] == as.name(".")) eval(e[[2L]], where) else
-                    if (is.pairlist(e)) as.pairlist(lapply(e,unquote)) else
-                        as.call(lapply(e,unquote))
-
-        unquote(substitute(expr))
-    }
-
-attr.all.equal <- function(target, current,
-                           check.attributes = TRUE,
-                           check.names = TRUE, ...)
-{
-    ##--- "all.equal(.)" for attributes ---
-    ##---  Auxiliary in all.equal(.) methods --- return NULL or character()
-    msg <- NULL
-    if(mode(target) != mode(current))
-        msg <- paste("Modes: ", mode(target), ", ", mode(current), sep = "")
-    cat(msg)
-}
-
-"::" <- function(pkg, name) {
-    pkg <- as.character(substitute(pkg))
-    name <- as.character(substitute(name))
-    ns <- tryCatch(asNamespace(pkg), hasNoNamespaceError = function(e) NULL)
-    if (is.null(ns)) {
-        pos <- match(paste("package", pkg, sep=":"), search(), 0L)
-        if (pos == 0)
-            stop(gettextf("package %s has no name space and is not on the search path"), sQuote(pkg), domain = NA)
-        get(name, pos = pos, inherits = FALSE)
-    }
-    else getExportedValue(pkg, name)
-}
-
-topenv <- function(envir = parent.frame(),
-                   matchThisEnv = getOption("topLevelEnvironment")) {
-    while (! identical(envir, emptyenv())) {
-        nm <- attributes(envir)[["names", exact = TRUE]]
-        if ((is.character(nm) && length(grep("^package:" , nm))) ||
-            ## matchThisEnv is used in sys.source
-            identical(envir, matchThisEnv) ||
-            identical(envir, .GlobalEnv) ||
-            identical(envir, baseenv()) ||
-            .Internal(isNamespaceEnv(envir)) ||
-            ## packages except base and those with a separate namespace have .packageName
-            exists(".packageName", envir = envir, inherits = FALSE))
-            return(envir)
-        else envir <- parent.env(envir)
-    }
-    return(.GlobalEnv)
-}
-
-nsInfoFilePath <- file.path(pkgpath, "Meta", "nsInfo.rds")
-nsInfo <- if(file.exists(nsInfoFilePath)) .readRDS(nsInfoFilePath)
-    else parseNamespaceFile(package, package.lib, mustExist = FALSE)
-
-pkgInfoFP <- file.path(pkgpath, "Meta", "package.rds")
-
-foo <- function(){
-    xxx
-    .knownS3Generics <- local({
-
-        ## include the S3 group generics here
-        baseGenerics <- c("Math", "Ops", "Summary", "Complex",
-                          "as.character", "as.data.frame", "as.environment", "as.matrix", "as.vector",
-                          "cbind", "labels", "print", "rbind", "rep", "seq", "seq.int",
-                          "solve", "summary", "t")
-
-        utilsGenerics <- c("edit", "str")
-    })
-    xxx
-    tt <- try({
-        ns <- loadNamespace(package, c(which.lib.loc, lib.loc),
-                            keep.source = keep.source)
-        dataPath <- file.path(which.lib.loc, package, "data")
-        env <- attachNamespace(ns, pos = pos,
-                               dataPath = dataPath, deps)
-    })
-    xxx
-}
-
-foo <- function(){
-    xxx
-    paths <- c(paths,
-               dirs[file.info(dirs)$isdir &
-                    file.exists(file.path(dirs,
-                                          "DESCRIPTION"))])
-    xxx
-    if(nzchar(r_arch)
-       ## back-compatibility fix: remove before 2.12.0
-       ## && (.Platform$OS.type != "windows" || r_arch != "i386")
-       && file.exists(file.path(pkgpath, "libs"))
-       && !file.exists(file.path(pkgpath, "libs", r_arch)))
-        stop(gettextf("package '%s' is not installed for 'arch=%s'",
-                      pkgname, r_arch),
-             call. = FALSE, domain = NA)
-    xxx
-    if(!package %in% c("datasets", "grDevices", "graphics", "methods",
-                       "splines", "stats", "stats4", "tcltk", "tools",
-                       "utils") &&
-       isTRUE(getOption("checkPackageLicense", FALSE)))
-        checkLicense(package, pkgInfo, pkgpath)
-    xxx
-    res <- .Fortran("dqrdc2",
-                    qr=x,
-                    n,
-                    n,
-                    p,
-                    as.double(tol),
-                    rank=integer(1L),
-                    qraux = double(p),
-                    pivot = as.integer(1L:p),
-                    double(2*p),
-                    PACKAGE="base")[c(1,6,7,8)]# c("qr", "rank", "qraux", "pivot")
-    if(!is.null(cn <- colnames(x)))
-        colnames(res$qr) <- cn[res$pivot]
-    class(res) <- "qr"
-    res
-}
-
-if(TRUE){
-    x <- xx[, c("abc", "bdc", "cde", "def", "efg", "fgh", "ghi", "hij", "ijk",
-                "jkl", "klm", "lmn", "mno", "nop")]
-    x <- NULL
-}
-
-test <- this('the function works',
-             {
-                 x <- 0
-             })
-
-test <- this('the function works', {
-                 x <- 0
-             })
-
-test_that('the function works',
-          {
-              x <- 0
-          })
-
-test_that('the function works', {
-              x <- 0
-          })
-
-x <- 1 + 2 + 3 +
-    4 + 5
-x <- 1 - 2 - 3 -
-    4 - 5
-x <- 1 * 2 * 3 *
-    4 * 5
-x <- 1 / 2 / 3 /
-    4 / 5
-y <- x ~
-    x
-y =
-    x
-x <-
-    33
-
-ggplot(data, aes(…)) +
-    geom <- points() +
-    theme <- bw() +
-    scale <- fill <- discrete()
-x <- 0
-
-x = letters %>%
-    sapply(strupper)
-message(x)
-
-flights %>%
-    group <- by(year, month, day) %>%
-    select(arr <- delay, dep <- delay) %>%
-    endop <- "END"
-x <- 0
-
-############################################################################
-## indent/r.vim starts to make mistakes here
-
-y = x &
-    x
-y = x |
-    x
-
-test <- this('the function works',
-             {
-                 x <- 0
-             }
-            )
-
-that('the function works', {
-         x <- 0
-     })
-
-test_that('my unit test', {
-              if (some <- condition)
-                  result
-              else
-                  other <- result
-          })
-
-data.frame <- function(..., row.names = NULL, check.rows = FALSE, check.names = TRUE,
-                       stringsAsFactors = default.stringsAsFactors())
-{
-    data.row.names <-
-        if(check.rows && is.null(row.names))
-            function(current, new, i) {
-                if(is.character(current)) new <- as.character(new)
-                stop(gettextf("mismatch of row names in arguments of 'data.frame\', item %d", i), domain = NA)
-            }
-        else function(current, new, i) {
-            if(is.null(current)) {
-                if(anyDuplicated(new)) {
-                    warning("some row.names duplicated: ",
-                            paste(which(duplicated(new)), collapse=","),
-                            " --> row.names NOT used")
-                    current
-                } else new
-            } else current
-        }
-    xxx
-}
-
-
-foo <- function(){
-    xxx
-    if (ismat) for (i in seq_len(differences)) r <- r[i1, , drop = FALSE] -
-        r[-nrow(r):-(nrow(r) - lag + 1), , drop = FALSE]
-    else for (i in seq_len(differences))
-        r <- r[i1] - r[-length(r):-(length(r) - lag + 1L)]
-    r
-    if(is.null(width)) width <- 0L
-    else if(width < 0L) { flag <- "-"; width <- -width }
-    format.default(x, width=width,
-                   justify = if(flag=="-") "left" else "right")
-    xxx
-}
-
-try <- function(expr, silent = FALSE) {
-    if(file == "") file <- stdin()
-    else {
-        if (isTRUE(keep.source))
-            srcfile <- srcfile(file, encoding = encoding)
-        file <- file(file, "r", encoding = encoding)
-    }
-    xxx
-    tryCatch(expr, error = function(e) {
-                 call <- conditionCall(e)
-                 xxx
-             },
-             xxx)
-    xxx
-    levels(f) <- ## nl == nL or 1
-        if (nl == nL) as.character(labels)
-        else paste(labels, seq_along(levels), sep="")
-    class(f) <- c(if(ordered)"ordered", "factor")
-    f
-}
-
-flights %>%
-    group <- by(year, month, day) %>%
-    select(arr <- delay, dep <- delay) %>%
-    summarise(
-              arr = mean(arr <- delay, na.rm = TRUE),
-              dep = mean(dep <- delay, na.rm = TRUE)
-             ) %>%
-    filter(arr > 30 | dep > 30)
-x <- 0
-
-cat("The End\n")
-
-## vim: expandtab sw=4 cursorcolumn
diff --git a/r-plugin/indent_test_noalign.R b/r-plugin/indent_test_noalign.R
deleted file mode 100644
index 7defbaf..0000000
--- a/r-plugin/indent_test_noalign.R
+++ /dev/null
@@ -1,666 +0,0 @@
-## This is a nonsense code indented in a way that I think is correct.
-## The following options are in the ~/.vimrc:
-##
-## set expandtab
-## set shiftwidth=4
-## let r_indent_ess_comments = 0
-## let r_indent_align_args = 0
-##
-## If you want to improve the indent/r.vim script, you may want to test your new
-## indentation algorithm with this R script: Make a copy of this file, open it
-## with Vim, do gg=G, quit and use vimdiff to see what is wrong.
-
-
-for(i in 1:10){
-    if(T){
-        a <- 1:10
-    }
-    else {
-        a <- 2:11
-        b <- 2:10
-    }
-}
-
-if(T)
-
-    sim
-
-acabou
-
-x <- DT[really_long_row_subsetting_variable,
-    really_long_column_subsetting_variable,
-    by = really_long_by_statement]
-
-
-asas
-if(T)
-    asas
-asas
-asas
-asas
-
-lkdlks
-if(T)
-    # comment
-    andada
-ksldks
-kslksd
-
-if (!(attr in urls))
-    value = escape_txt_chars(value)
-## more commented code here.
-
-while(T) {
-    lskdlsks
-}
-
-if(FALSE){
-}
-
-ff <- "hist"
-mm <- methods(ff)
-l <- length(mm)
-for(i in 1:l){
-    if(exists(mm[i])){
-        arglist <- formals(mm[i])
-        if(nothing('ksjs#asq')) # ls()
-            a <- b
-        k <- length(arglist)
-        if(k > 0){
-            argnames <- names(arglist)
-            for(j in 1:k)
-                cat(ff, mm[i], argnames[j], "\n")
-        }
-        vcov <- if(length(coef))
-            solve(oout$he)
-        else
-            matrix(numeric(0L), 0L, 0L)
-        vcov <-
-            if(length(coef))
-                solve(oout$he)
-            else
-                matrix(numeric(0L), 0L, 0L)
-        xxx
-        www
-    }
-}
-
-if(T)
-{
-    lskdlsks
-    kdlsks
-
-    maes <- subset(b, (age < 40) & (sex == "Female") &
-        ((condfam == "Reference person") | (condfam == "Spouse")) &
-        (tipom > 0), select = c("uf", "sex", "age", "fam.cond", "col",
-            "school", "urban", "income", "fam.income",
-            "tipom", "peso"))
-
-    maes$tipom <- factor(maes$tipom, levels = c(1, 2), labels = c("Casada", "Solteira"))
-    label(maes$tipom) <- "Tipo de mãe"
-    # Comment here
-
-    if(T)
-        a <- b
-    else
-        c <- d
-    fim()
-    comeco
-}
-
-while(T)
-{
-    if(T){
-
-        # Another comment here
-        kdlskd
-    } else {
-        dksldk
-        iwd <- as.integer(substr(fmt, Iind + 1, regexpr('[\\.\\)]', fmt) - 1))
-        iwd <- as.integer(substr(fmt, Iind + 1, regexpr("\\.\\", fmt) - 1))
-        iwd <- as.integer(substr(fmt, Iind + 1, regexpr('[\\.\\(]', fmt) - 1))
-        sklsdk
-    }
-}
-
-if(nothing){
-    if(everything)
-    {
-        a <- b
-}}
-
-x <- a
-for(i1 in lista1)
-    for(i2 in lista2)
-        for(i3 in lista3)
-            for(i4 in lista4)
-                cat(i1, i2, i3, i4, "\n")
-
-for(i1 in lista1)
-    for(i2 in lista2)
-        for(i3 in lista3)
-            for(i4 in lista4)
-                cat(i1, i2, i3, i4, "\n")
-
-if(T)
-{
-    if (is.environment(object))
-    {
-        ls()
-    }
-    else
-    {
-        ls()
-    }
-}
-
-if(nothing('ksjs#asq')) ls()
-a <- b
-
-if(inherits(pfit, "try#error")) return(NA)
-else {
-    zz <- 2*(pfit@min - fitted@min)
-    a <- b
-}
-
-nothing <- function(x)
-{
-    if(x == "everything")
-        x <- "nothing"
-    x
-}
-
-if (T)
-{
-    if(T)
-        for(i  in 1:2)
-        {
-            cat(i, "\n")
-        }
-    x
-}
-
-if(F)
-{
-    if(T)
-        for(i in 1:2){
-            x <- 1
-        }
-    x
-}
-
-latlon.format <- function(lat, lon, digits=max(6, getOption("digits") - 1))
-{
-    n <- length(lon)
-    rval <- vector("character", n)
-    if (!is.numeric(lat) || !is.numeric(lon))
-        return ("(non-numeric lat or lon)")
-    for (i in 1:n) {
-        if (is.na(lat[i]) || is.na(lon[i]))
-            rval[i] <- ""
-        else
-            rval[i] <- paste(format(abs(lat[i]), digits=digits),
-                if (lat[i] > 0) "N  " else "S  ",
-                format(abs(lon[i]), digits=digits),
-                if (lon[i] > 0) "E" else "W",
-                sep="")
-        n <- lon
-    }
-    rval
-}
-
-# indent-test-dk-01.R
-if (type == "fill") {
-    land <- c("#FBC784","#F1C37A","#E6B670","#DCA865","#D19A5C",
-        "#C79652","#BD9248","#B38E3E","#A98A34")
-    water <- c("#E1FCF7","#BFF2EC","#A0E8E4","#83DEDE","#68CDD4",
-        "#4FBBC9","#38A7BF","#2292B5","#0F7CAB")
-} else {
-    land <- c("#FBC784","#F1C37A","#E6B670","#DCA865","#D19A5C",
-        "#C79652","#BD9248","#B38E3E","#A98A34")
-    water <- c("#A4FCE3","#72EFE9","#4FE3ED","#47DCF2","#46D7F6",
-        "#3FC0DF","#3FC0DF","#3BB7D3","#36A5C3","#3194B4",
-        "#2A7CA4","#205081","#16255E","#100C2F")
-}
-
-lon.format <- function(lon, digits=max(6, getOption("digits") - 1))
-{
-    n <- length(lon)
-    if (n < 1) return("")
-    rval <- vector("character", n)
-    for (i in 1:n)
-        if (is.na(lon[i]))
-            rval[i] <-  ""
-        else
-            rval[i] <- paste(format(abs(lon[i]), digits=digits),
-                if (lon[i] > 0) "E" else "S",
-                sep="")
-    rval
-}
-
-structure(do.something(name = name, exit = NULL, handler = handler,
-        description = description, test = test,
-        interactive = interactive),
-    class = "restart")
-
-## store info for loading name space for loadingNamespaceInfo to read
-"__LoadingNamespaceInfo__" <- list(libname = package.lib,
-    pkgname = package)
-
-if(any(missingMethods))
-    stop(gettextf("in '%s' methods for export not found: %s",
-            package,
-            paste(expMethods[missingMethods],
-                collapse = ", ")),
-        domain = NA)
-
-if(www){
-    if(R_version_built_under < "2.10.0")
-        stop(gettextf("package '%s' was built before R 2.10.0: please re-install it",
-                basename(pkgpath)), call. = FALSE, domain = NA)
-    ## we need to ensure that S4 dispatch is on now if the package
-    ## will require it, or the exports will be incomplete.
-    dependsMethods <- "methods" %in% names(pkgInfo$Depends)
-    if(dependsMethods) loadNamespace("methods")
-}
-
-makeRestart <- function(name = "",
-    handler = function(...) NULL,
-    description = "",
-    test = function(c) TRUE,
-    interactive = NULL) {
-    structure(list(name = name, exit = NULL, handler = handler,
-            description = description, test = test,
-            interactive = interactive),
-        class = "restart")
-}
-
-sapply(seq_along(symNames),
-    function(i) {
-        ## could vectorize this outside of the loop
-        ## and assign to different variable to
-        ## maintain the original names.
-        varName <- names(symNames)[i]
-        origVarName <- symNames[i]
-        if(exists(varName, envir = env))
-            warning("failed to assign NativeSymbolInfo for ",
-                origVarName,
-                ifelse(origVarName != varName,
-                    paste(" to", varName), ""),
-                " since ", varName,
-                " is already defined in the ", package,
-                " namespace")
-        else
-            assign(varName, symbols[[origVarName]],
-                envir = env)
-
-    })
-
-if(xx == aa &&
-    yy == bb)
-    cat(xx, yy)
-cat(aa, bb)
-
-something <- function()
-{
-    if (file.exists(nsFile))
-        directives <- if (!is.na(enc) &&
-            ! Sys.getlocale("LC_CTYPE") %in% c("C", "POSIX")) {
-            con <- file(nsFile, encoding=enc)
-            on.exit(close(con))
-            parse(con)
-        } else parse(nsFile)
-    else if (mustExist)
-        stop(gettextf("package '%s' has no NAMESPACE file", package),
-            domain = NA)
-    x
-}
-
-print.difftime <- function(x, digits = getOption("digits"), ...)
-{
-    if(is.array(x) || length(x) > 1L) {
-        cat("Time differences in ", attr(x, "units"), "\n", sep="")
-        y <- unclass(x); attr(y, "units") <- NULL
-        print(y)
-    }
-    else
-        cat("Time difference of ", format(unclass(x), digits=digits), " ",
-            attr(x, "units"), "\n", sep="")
-
-    invisible(x)
-}
-
-print.difftime <- function(x, digits = getOption("digits"), ...)
-{
-    if(is.array(x) || length(x) > 1L) {
-        cat("Time differences in ", attr(x, "units"), "\n", sep="")
-        y <- unclass(x); attr(y, "units") <- NULL
-        print(y)
-    } else
-        cat("Time difference of ", format(unclass(x), digits=digits), " ",
-            attr(x, "units"), "\n", sep="")
-
-    invisible(x)
-}
-
-namespaceImport <- function(self, ...)
-    for (ns in list(...)) namespaceImportFrom(self, asNamespace(ns))
-
-x
-
-as.function.default <- function (x, envir = parent.frame(), ...)
-    if (is.function(x)) x else .Internal(as.function.default(x, envir))
-
-as.array <- function(x, ...)
-    UseMethod("as.array")
-
-bquote <- function(expr, where=parent.frame())
-{
-    unquote <- function(e)
-        if (length(e) <= 1L) e
-        else if (e[[1L]] == as.name(".")) eval(e[[2L]], where)
-        else if (is.pairlist(e)) as.pairlist(lapply(e,unquote))
-        else as.call(lapply(e,unquote))
-
-    unquote(substitute(expr))
-}
-
-bquote <- function(expr, where=parent.frame())
-{
-    unquote <- function(e)
-        if (length(e) <= 1L) e else
-            if (e[[1L]] == as.name(".")) eval(e[[2L]], where) else
-                if (is.pairlist(e)) as.pairlist(lapply(e,unquote)) else
-                    as.call(lapply(e,unquote))
-
-    unquote(substitute(expr))
-}
-
-for (i in 1:num.stations) {
-    thetime <- stn.time[select[1]] # e. g. 2222
-    time[i] <- as.numeric(as.POSIXct(paste(substr(thedate,1,4),
-                " ",
-                substr(thetime,1,2),
-                ":",
-                substr(thetime,3,4),
-                ":00",sep=""),tz="UTC")) - trefn
-    stn[i] <- sub("^ *", "", station.id[select[1]])
-    lat[i] <- latitude[select[1]]
-}
-
-bquote <-
-    function(expr, where=parent.frame())
-    {
-        unquote <- function(e)
-            if (length(e) <= 1L) e else
-                if (e[[1L]] == as.name(".")) eval(e[[2L]], where) else
-                    if (is.pairlist(e)) as.pairlist(lapply(e,unquote)) else
-                        as.call(lapply(e,unquote))
-
-        unquote(substitute(expr))
-    }
-
-attr.all.equal <- function(target, current,
-    check.attributes = TRUE,
-    check.names = TRUE, ...)
-{
-    ##--- "all.equal(.)" for attributes ---
-    ##---  Auxiliary in all.equal(.) methods --- return NULL or character()
-    msg <- NULL
-    if(mode(target) != mode(current))
-        msg <- paste("Modes: ", mode(target), ", ", mode(current), sep = "")
-    cat(msg)
-}
-
-"::" <- function(pkg, name) {
-    pkg <- as.character(substitute(pkg))
-    name <- as.character(substitute(name))
-    ns <- tryCatch(asNamespace(pkg), hasNoNamespaceError = function(e) NULL)
-    if (is.null(ns)) {
-        pos <- match(paste("package", pkg, sep=":"), search(), 0L)
-        if (pos == 0)
-            stop(gettextf("package %s has no name space and is not on the search path"), sQuote(pkg), domain = NA)
-        get(name, pos = pos, inherits = FALSE)
-    }
-    else getExportedValue(pkg, name)
-}
-
-topenv <- function(envir = parent.frame(),
-    matchThisEnv = getOption("topLevelEnvironment")) {
-    while (! identical(envir, emptyenv())) {
-        nm <- attributes(envir)[["names", exact = TRUE]]
-        if ((is.character(nm) && length(grep("^package:" , nm))) ||
-            ## matchThisEnv is used in sys.source
-            identical(envir, matchThisEnv) ||
-            identical(envir, .GlobalEnv) ||
-            identical(envir, baseenv()) ||
-            .Internal(isNamespaceEnv(envir)) ||
-            ## packages except base and those with a separate namespace have .packageName
-            exists(".packageName", envir = envir, inherits = FALSE))
-            return(envir)
-        else envir <- parent.env(envir)
-    }
-    return(.GlobalEnv)
-}
-
-nsInfoFilePath <- file.path(pkgpath, "Meta", "nsInfo.rds")
-nsInfo <- if(file.exists(nsInfoFilePath)) .readRDS(nsInfoFilePath)
-    else parseNamespaceFile(package, package.lib, mustExist = FALSE)
-
-pkgInfoFP <- file.path(pkgpath, "Meta", "package.rds")
-
-foo <- function(){
-    xxx
-    .knownS3Generics <- local({
-
-        ## include the S3 group generics here
-        baseGenerics <- c("Math", "Ops", "Summary", "Complex",
-            "as.character", "as.data.frame", "as.environment", "as.matrix", "as.vector",
-            "cbind", "labels", "print", "rbind", "rep", "seq", "seq.int",
-            "solve", "summary", "t")
-
-        utilsGenerics <- c("edit", "str")
-    })
-    xxx
-    tt <- try({
-        ns <- loadNamespace(package, c(which.lib.loc, lib.loc),
-            keep.source = keep.source)
-        dataPath <- file.path(which.lib.loc, package, "data")
-        env <- attachNamespace(ns, pos = pos,
-            dataPath = dataPath, deps)
-    })
-    xxx
-}
-
-foo <- function(){
-    xxx
-    paths <- c(paths,
-        dirs[file.info(dirs)$isdir &
-            file.exists(file.path(dirs,
-                    "DESCRIPTION"))])
-    xxx
-    if(nzchar(r_arch)
-        ## back-compatibility fix: remove before 2.12.0
-        ## && (.Platform$OS.type != "windows" || r_arch != "i386")
-        && file.exists(file.path(pkgpath, "libs"))
-        && !file.exists(file.path(pkgpath, "libs", r_arch)))
-        stop(gettextf("package '%s' is not installed for 'arch=%s'",
-                pkgname, r_arch),
-            call. = FALSE, domain = NA)
-    xxx
-    if(!package %in% c("datasets", "grDevices", "graphics", "methods",
-            "splines", "stats", "stats4", "tcltk", "tools",
-            "utils") &&
-        isTRUE(getOption("checkPackageLicense", FALSE)))
-        checkLicense(package, pkgInfo, pkgpath)
-    xxx
-    res <- .Fortran("dqrdc2",
-        qr=x,
-        n,
-        n,
-        p,
-        as.double(tol),
-        rank=integer(1L),
-        qraux = double(p),
-        pivot = as.integer(1L:p),
-        double(2*p),
-        PACKAGE="base")[c(1,6,7,8)]# c("qr", "rank", "qraux", "pivot")
-    if(!is.null(cn <- colnames(x)))
-        colnames(res$qr) <- cn[res$pivot]
-    class(res) <- "qr"
-    res
-}
-
-if(TRUE){
-    x <- xx[, c("abc", "bdc", "cde", "def", "efg", "fgh", "ghi", "hij", "ijk",
-        "jkl", "klm", "lmn", "mno", "nop")]
-    x <- NULL
-}
-
-test <- this('the function works',
-    {
-        x <- 0
-    })
-
-test_that('the function works',
-    {
-        x <- 0
-    })
-
-x <- 1 + 2 + 3 +
-    4 + 5
-x <- 1 - 2 - 3 -
-    4 - 5
-x <- 1 * 2 * 3 *
-    4 * 5
-x <- 1 / 2 / 3 /
-    4 / 5
-y <- x ~
-    x
-y =
-    x
-x <-
-    33
-
-ggplot(data, aes(…)) +
-    geom <- points() +
-    theme <- bw() +
-    scale <- fill <- discrete()
-x <- 0
-
-x = letters %>%
-    sapply(strupper)
-message(x)
-
-flights %>%
-    group <- by(year, month, day) %>%
-    select(arr <- delay, dep <- delay) %>%
-    endop <- "END"
-x <- 0
-
-############################################################################
-## indent/r.vim starts to make mistakes here
-
-y = x &
-    x
-y = x |
-    x
-
-test <- this('the function works', {
-        x <- 0
-    })
-
-test_that('the function works', {
-        x <- 0
-    })
-
-test <- this('the function works',
-    {
-        x <- 0
-    }
-)
-
-that('the function works', {
-        x <- 0
-    }
-)
-
-test_that('my unit test', {
-        if (some <- condition)
-            result
-        else
-             other <- result
-    }
-)
-
-data.frame <- function(..., row.names = NULL, check.rows = FALSE, check.names = TRUE,
-    stringsAsFactors = default.stringsAsFactors())
-{
-    data.row.names <-
-        if(check.rows && is.null(row.names))
-            function(current, new, i) {
-                if(is.character(current)) new <- as.character(new)
-                stop(gettextf("mismatch of row names in arguments of 'data.frame\', item %d", i), domain = NA)
-            }
-        else function(current, new, i) {
-            if(is.null(current)) {
-                if(anyDuplicated(new)) {
-                    warning("some row.names duplicated: ",
-                        paste(which(duplicated(new)), collapse=","),
-                        " --> row.names NOT used")
-                    current
-                } else new
-            } else current
-        }
-    xxx
-}
-
-
-foo <- function(){
-    xxx
-    if (ismat) for (i in seq_len(differences)) r <- r[i1, , drop = FALSE] -
-        r[-nrow(r):-(nrow(r) - lag + 1), , drop = FALSE]
-    else for (i in seq_len(differences))
-        r <- r[i1] - r[-length(r):-(length(r) - lag + 1L)]
-    r
-    if(is.null(width)) width <- 0L
-    else if(width < 0L) { flag <- "-"; width <- -width }
-    format.default(x, width=width,
-        justify = if(flag=="-") "left" else "right")
-    xxx
-}
-
-try <- function(expr, silent = FALSE) {
-    if(file == "") file <- stdin()
-    else {
-        if (isTRUE(keep.source))
-            srcfile <- srcfile(file, encoding = encoding)
-        file <- file(file, "r", encoding = encoding)
-    }
-    xxx
-    tryCatch(expr, error = function(e) {
-            call <- conditionCall(e)
-            xxx
-        },
-        xxx)
-    xxx
-    levels(f) <- ## nl == nL or 1
-        if (nl == nL) as.character(labels)
-        else paste(labels, seq_along(levels), sep="")
-    class(f) <- c(if(ordered)"ordered", "factor")
-    f
-}
-
-flights %>%
-    group <- by(year, month, day) %>%
-    select(arr <- delay, dep <- delay) %>%
-    summarise(
-              arr = mean(arr <- delay, na.rm = TRUE),
-              dep = mean(dep <- delay, na.rm = TRUE)
-             ) %>%
-    filter(arr > 30 | dep > 30)
-x <- 0
-
-cat("The End\n")
-
-## vim: expandtab sw=4 cursorcolumn

From c17f17ee569051b3909dc618bb3c2481029fdfb2 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Thu, 9 Apr 2015 17:42:49 -0400
Subject: [PATCH 0951/1050] Version 1.2.3

---
 Makefile                   | 1 +
 doc/r-plugin.txt           | 2 +-
 r-plugin/common_global.vim | 4 ++--
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index b465980..e9cd055 100644
--- a/Makefile
+++ b/Makefile
@@ -168,6 +168,7 @@ htmldoc:
 	    sed -i -e 's/\( *\)\(http\S*\)/\1\2<\/a>/' r-plugin.html ;\
 	    sed -i -e 's/<\/pre>
/  --------------------------------------------------------\n/' r-plugin.html ;\
 	    mv r-plugin.html vim-stylesheet.css /tmp )
+	rm -f doc/tags-te
 
 all: vimball deb htmldoc
 
diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index e9fc34d..336a63e 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -2885,7 +2885,7 @@ sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details.
 							       *r-plugin-news*
 10. News~
 
-1.2.3 (2015-04-08)
+1.2.3 (2015-04-09)
 
  * Official runtime files were deleted. See:
    https://github.com/jalvesaq/R-Vim-runtime
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 8f04ea7..729df37 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -985,8 +985,8 @@ function WaitVimComStart()
         let g:rplugin_vimcom_home = vr[1]
         let g:rplugin_vimcomport = vr[2]
         let g:rplugin_r_pid = vr[3]
-        if g:rplugin_vimcom_version != "1.2.2.1"
-            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.2.2.1.')
+        if g:rplugin_vimcom_version != "1.2.3"
+            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.2.3.')
             sleep 1
         endif
         if has("win32")

From e7014629f795e5e65d2981c9b089d474d010e6e0 Mon Sep 17 00:00:00 2001
From: Johannes Ranke 
Date: Fri, 17 Apr 2015 17:11:04 +0200
Subject: [PATCH 0952/1050] Hint to use the Shift key for copying from tmux

The solution with toggling mouse support did not work for me, but
when I press the Shift key, the mouse selection ends up in the X
clipboard.
---
 doc/r-plugin.txt | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 336a63e..cf46d72 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -870,12 +870,10 @@ pane and, then, paste.
 
 However, if you want to copy something from either Vim or R to another
 application not running inside Tmux, Tmux may prevent the X server from
-capturing the text selected by the mouse. The solution is to disable mouse
-support in Tmux. You will be able to toggle mouse support on and off by typing
-m if you add the following line to your ~/.tmux.conf:
->
-   bind m run-shell '( if [ "mode-mouse off" = "$(tmux show-window-option mode-mouse)" ]; then toggle=on; else toggle=off; fi; tmux display-message "mouse $toggle"; tmux set-option -w mode-mouse $toggle ; for cmd in mouse-select-pane mouse-resize-pane mouse-select-window; do tmux set-option -g $cmd $toggle ; done;) > /dev/null 2>&1'
-<
+capturing the text selected by the mouse. The solution is to press
+the  key while selecting text with the mouse, so the selected
+text is transferred to the X server clipboard and can be inserted using
+the middle mouse button.
 
 ------------------------------------------------------------------------------
 							     *r-plugin-remote*

From 57d58a89f4bfa1e419edc4fe6a91acecb9a92b90 Mon Sep 17 00:00:00 2001
From: Johannes Ranke 
Date: Fri, 17 Apr 2015 23:52:28 +0200
Subject: [PATCH 0953/1050] Make the tmux copy paste tip a bit more generic

---
 doc/r-plugin.txt | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index cf46d72..bc372fa 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -870,10 +870,11 @@ pane and, then, paste.
 
 However, if you want to copy something from either Vim or R to another
 application not running inside Tmux, Tmux may prevent the X server from
-capturing the text selected by the mouse. The solution is to press
-the  key while selecting text with the mouse, so the selected
-text is transferred to the X server clipboard and can be inserted using
-the middle mouse button.
+capturing the text selected by the mouse. This can be prevented by
+pressing the  key, as it suspends the capturing of mouse events
+by tmux. If you keep  pressed while selecting text with the mouse, 
+it will be available in the X server clipboard and can be inserted
+using the middle mouse button.
 
 ------------------------------------------------------------------------------
 							     *r-plugin-remote*

From 80bf2e7564a0db4e0cab793aa730b5980806df10 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Fri, 17 Apr 2015 19:20:39 -0500
Subject: [PATCH 0954/1050] Make comment symbols follow indent settings See
 https://github.com/jcfaria/Vim-R-plugin/issues/170

---
 doc/r-plugin.txt           | 81 ++++++++------------------------------
 r-plugin/common_global.vim | 17 +++++++-
 2 files changed, 31 insertions(+), 67 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index bc372fa..0cf8961 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -1161,6 +1161,7 @@ is running:
 |vimrplugin_start_libs|        Objects for omnicompletion and syntax highlight
 |vimrplugin_routnotab|         Show output of R CMD BATCH in new window
 |vimrplugin_indent_commented|  Indent lines commented with the \xx command
+|vimrplugin_rcomment_string|   String to comment code with \xx and \o
 |vimrplugin_notmuxconf|        Don't use a specially built Tmux config file
 |vimrplugin_rconsole_height|   The number of lines of R Console (Tmux split)
 |vimrplugin_vsplit|            Make Tmux split the window vertically
@@ -1490,6 +1491,7 @@ scripts, put the following in your |vimrc|:
 ------------------------------------------------------------------------------
 						 *vimrplugin_indent_commented*
                                                  *r_indent_ess_comments*
+						 *vimrplugin_rcomment_string*
 6.11. Indent commented lines~
 
 You can type xx to comment out a line or selected lines. If the
@@ -1509,6 +1511,12 @@ table below (see |r-plugin-indenting|):
                  1                        1                ##
                  0                        1                ###
 <
+The string used to comment text with xc, xu,
+xx and o is defined by vimrplugin_rcomment_string.
+Example:
+>
+   let vimrplugin_rcomment_string = "# "
+<
 
 ------------------------------------------------------------------------------
 						       *vimrplugin_notmuxconf*
@@ -2635,32 +2643,7 @@ on top" or a similar option provided by your desktop manager.
 
 
 ------------------------------------------------------------------------------
-							     *r-plugin-global*
-9.17. Turn the R-plugin into a global plugin (Linux/Unix only)~
-
-The Vim-R-plugin is a file type plugin. If you want its functionality
-available for all file types, then put in your |vimrc|:
->
-   runtime r-plugin/global_r_plugin.vim
-<
-You will then be able to type rf to start and rq to
-quit different command line interpreters and d, l, ss, bb, etc to
-send code to the interpreter. If you want support for a language other than
-Julia, Python, Haskell, Ruby and Lisp, you have to set the values of
-vimrplugin_exe and vimrplugin_quit in two Vim auto commands in your |vimrc|,
-BEFORE the `runtime` command above. Example:
->
-   autocmd FileType matlab let vimrplugin_exe = "octave" | let vimrplugin_quit = "quit"
-   autocmd BufNewFile,BufRead *.m let vimrplugin_exe = "octave" | let vimrplugin_quit = "quit"
-<
-If you use GVim, you may also want to set |vimrplugin_never_unmake_menu| in
-your |vimrc|:
->
-   let vimrplugin_never_unmake_menu = 1
-<
-
-------------------------------------------------------------------------------
-9.18. Disable syntax highlight of R functions~
+9.17. Disable syntax highlight of R functions~
 
 If you want to disable the syntax highlight of R functions put in your
 |vimrc|:
@@ -2668,27 +2651,9 @@ If you want to disable the syntax highlight of R functions put in your
    autocmd Syntax * syntax clear rFunction
 <
 
-------------------------------------------------------------------------------
-							      *r-plugin-knitr*
-9.19. Tips for knitr users~
-
-If you are using knitr with option cache=TRUE, you may want from time to time
-to delete all objects in R workspace and all files in the cache directory. If
-you want to use kr in Normal mode for this, put in your |vimrc|:
->
-   nmap kr :call g:SendCmdToR('rm(list=ls(all.names=TRUE)); unlink("cache/*")')
-<
-When generating pdfs out of Rmd-files, you can send options to pandoc. State
-them in your vimrc. For example
-
-   let vimrplugin_pandoc_args = "--toc -V lang=german"
-
-will produce a german document with a table of contents.
-
-
 ------------------------------------------------------------------------------
 							  *r-plugin-latex-box*
-9.20. Integration with LaTeX-Box~
+9.18. Integration with LaTeX-Box~
 
 LaTeX-Box does not automatically recognize Rnoweb files as a valid LaTeX file.
 You have to tell LaTeX-BoX that the .tex file compiled by either `knitr()` or
@@ -2711,7 +2676,7 @@ See also: |vimrplugin_latexcmd|.
 
 ------------------------------------------------------------------------------
 							*r-plugin-quick-setup*
-9.21. Suggested setup for the Vim-R-plugin~
+9.19. Suggested setup for the Vim-R-plugin~
 
 Please, look at section |r-plugin-options| if you want information about the
 Vim-r-plugin customization.
@@ -2814,25 +2779,22 @@ Finally, if you want to use vi key bindings in Bash:
 
 ------------------------------------------------------------------------------
 							*r-plugin-source-echo*
-9.22. Set echo to TRUE or FALSE when sending multiple lines of code too R~
+9.20. Set echo to TRUE or FALSE when sending multiple lines of code too R~
 
 If you want to alternate the `echo` argument of the `source()` function
 between `TRUE` and `FALSE`, then, you might want to create a couple of maps in
 your vimrc. You can use |nmap| to restrict the maps to Normal mode, |autocmd|
 and  to restrict the maps to R code, and  if you prefer that
 the command is not displayed in Vim's command line. In the example below,
-`ee` sets `echo=TRUE`:
+`et` sets `echo=TRUE` and `ef` sets `echo=FALSE`:
 >
-   autocmd BufNewFile,BufRead *.R* nmap  ee :let vimrplugin_source_args = "echo = TRUE"
+   autocmd BufNewFile,BufRead *.R* nmap  et :let vimrplugin_source_args = "echo = TRUE"
+   autocmd BufNewFile,BufRead *.R* nmap  ef :let vimrplugin_source_args = "echo = FALSE"
 <
-You can make another map to set `echo=FALSE`, and, if some of your files are
-named with lowercase "r" extensions, you have to repeat the commands with
-`*.r*`.
-
 
 ------------------------------------------------------------------------------
 
-9.23. Syntax highlight of .Rout files~
+9.21. Syntax highlight of .Rout files~
 
 You can set the foreground colors of R output in your |vimrc|. The example
 below is for a terminal emulator that supports 256 colors (see
@@ -2869,17 +2831,6 @@ put in your |vimrc|:
    let rout_follow_colorscheme = 1
 <
 
-------------------------------------------------------------------------------
-
-9.24. Integration with GNU Screen, screen plugin, Conque Shell or VimShell~
-
-The plugin used to be able to use GNU Screen (through screen plugin), Conque
-Shell or VimShell to send commands to R. This integration was removed on
-August 20, 2013. People wanting this integration back into the plugin may want
-to use the old Vim-R-plugin code as a starting point to create scripts to be
-sourced by the Vim-R-plugin. Please look at |vimrplugin_source| for details.
-
-
 ==============================================================================
 							       *r-plugin-news*
 10. News~
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 729df37..b75623a 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -3040,14 +3040,27 @@ call RSetDefaultValue("g:vimrplugin_vimcom_wait",    5000)
 call RSetDefaultValue("g:vimrplugin_show_args",         0)
 call RSetDefaultValue("g:vimrplugin_never_unmake_menu", 0)
 call RSetDefaultValue("g:vimrplugin_insert_mode_cmds",  1)
-call RSetDefaultValue("g:vimrplugin_indent_commented",  1)
 call RSetDefaultValue("g:vimrplugin_source",         "''")
-call RSetDefaultValue("g:vimrplugin_rcomment_string", "'# '")
 call RSetDefaultValue("g:vimrplugin_vimpager",      "'tab'")
 call RSetDefaultValue("g:vimrplugin_objbr_place",     "'script,right'")
 call RSetDefaultValue("g:vimrplugin_user_maps_only", 0)
 call RSetDefaultValue("g:vimrplugin_latexcmd", "'default'")
 call RSetDefaultValue("g:vimrplugin_rmd_environment", "'.GlobalEnv'")
+call RSetDefaultValue("g:vimrplugin_indent_commented",  1)
+
+if !exists("g:r_indent_ess_comments")
+    let g:r_indent_ess_comments = 0
+endif
+if g:r_indent_ess_comments
+    if g:vimrplugin_indent_commented
+        call RSetDefaultValue("g:vimrplugin_rcomment_string", "'## '")
+    else
+        call RSetDefaultValue("g:vimrplugin_rcomment_string", "'### '")
+    endif
+else
+    call RSetDefaultValue("g:vimrplugin_rcomment_string", "'# '")
+endif
+
 if has("win32") || has("win64")
     call RSetDefaultValue("g:vimrplugin_Rterm",           0)
     call RSetDefaultValue("g:vimrplugin_save_win_pos",    1)

From 9449c1b302c2565e638e921c3562d774a565d74d Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Fri, 17 Apr 2015 22:22:40 -0500
Subject: [PATCH 0955/1050] Add a space before '^-' for tmux set-buffer See:
 https://github.com/jcfaria/Vim-R-plugin/issues/170#issuecomment-93683943 A
 backslash does not do the trick.

---
 r-plugin/common_global.vim | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index b75623a..fa6b701 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -1415,6 +1415,9 @@ function SendCmdToR_TmuxSplit(cmd)
         call RWarningMsg("Missing internal variable: g:rplugin_rconsole_pane")
     endif
     let str = substitute(cmd, "'", "'\\\\''", "g")
+    if str =~ '^-'
+        let str = ' ' . str
+    endif
     let scmd = "tmux set-buffer '" . str . "\' && tmux paste-buffer -t " . g:rplugin_rconsole_pane
     let rlog = system(scmd)
     if v:shell_error

From 4a6aeb40fcb086a3ae51ce8db5d05df50df017e4 Mon Sep 17 00:00:00 2001
From: Johannes Ranke 
Date: Sat, 18 Apr 2015 15:33:39 +0200
Subject: [PATCH 0956/1050] Some more explanation for copying from tmux

Thanks @zeloff for comment
---
 doc/r-plugin.txt | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 0cf8961..ad703dc 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -874,7 +874,8 @@ capturing the text selected by the mouse. This can be prevented by
 pressing the  key, as it suspends the capturing of mouse events
 by tmux. If you keep  pressed while selecting text with the mouse, 
 it will be available in the X server clipboard and can be inserted
-using the middle mouse button.
+into other windows using the middle mouse button. It can of course also be
+inserted into a tmux window using  and the middle mouse button.
 
 ------------------------------------------------------------------------------
 							     *r-plugin-remote*

From 426f2a63d4538e5b8732605ba3ca2b68a771229e Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sun, 19 Apr 2015 14:47:34 -0500
Subject: [PATCH 0957/1050] Delete R/global_R_plugin.vim See:
 https://github.com/jalvesaq/vimcmdline

---
 Makefile                     |  1 -
 doc/r-plugin.txt             |  3 +-
 list_for_vimball             |  1 -
 r-plugin/common_buffer.vim   |  5 ---
 r-plugin/global_r_plugin.vim | 86 ------------------------------------
 5 files changed, 1 insertion(+), 95 deletions(-)
 delete mode 100644 r-plugin/global_r_plugin.vim

diff --git a/Makefile b/Makefile
index e9cd055..f3deca4 100644
--- a/Makefile
+++ b/Makefile
@@ -68,7 +68,6 @@ deb:
 	  - r-plugin/common_buffer.vim\n\
 	  - r-plugin/common_global.vim\n\
 	  - r-plugin/functions.vim\n\
-	  - r-plugin/global_r_plugin.vim\n\
 	  - r-plugin/gui_running.vim\n\
 	  - r-plugin/setcompldir.vim\n\
 	  - r-plugin/synctex_evince_backward.py\n\
diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index ad703dc..db8d841 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -872,7 +872,7 @@ However, if you want to copy something from either Vim or R to another
 application not running inside Tmux, Tmux may prevent the X server from
 capturing the text selected by the mouse. This can be prevented by
 pressing the  key, as it suspends the capturing of mouse events
-by tmux. If you keep  pressed while selecting text with the mouse, 
+by tmux. If you keep  pressed while selecting text with the mouse,
 it will be available in the X server clipboard and can be inserted
 into other windows using the middle mouse button. It can of course also be
 inserted into a tmux window using  and the middle mouse button.
@@ -2288,7 +2288,6 @@ directory after the installation:
    r-plugin/common_buffer.vim
    r-plugin/common_global.vim
    r-plugin/functions.vim
-   r-plugin/global_r_plugin.vim
    r-plugin/gui_running.vim
    r-plugin/osx.vim
    r-plugin/r.snippets
diff --git a/list_for_vimball b/list_for_vimball
index 9eb1a47..74d43c1 100644
--- a/list_for_vimball
+++ b/list_for_vimball
@@ -10,7 +10,6 @@ ftplugin/rnoweb_rplugin.vim
 ftplugin/rrst_rplugin.vim
 r-plugin/common_buffer.vim
 r-plugin/common_global.vim
-r-plugin/global_r_plugin.vim
 r-plugin/r.snippets
 r-plugin/rmd.snippets
 r-plugin/synctex_evince_backward.py
diff --git a/r-plugin/common_buffer.vim b/r-plugin/common_buffer.vim
index 90ba4fd..ea36274 100644
--- a/r-plugin/common_buffer.vim
+++ b/r-plugin/common_buffer.vim
@@ -44,11 +44,6 @@ if !exists("b:objbrtitle")
     unlet s:tnr
 endif
 
-if exists("g:rplugin_firstbuffer") && g:rplugin_firstbuffer == ""
-    " The file global_r_plugin.vim was copied to ~/.vim/plugin
-    let g:rplugin_firstbuffer = expand("%:p")
-endif
-
 let g:rplugin_lastft = &filetype
 
 if !exists("g:SendCmdToR")
diff --git a/r-plugin/global_r_plugin.vim b/r-plugin/global_r_plugin.vim
deleted file mode 100644
index 90b0ae4..0000000
--- a/r-plugin/global_r_plugin.vim
+++ /dev/null
@@ -1,86 +0,0 @@
-
-runtime r-plugin/common_global.vim
-if exists("g:rplugin_failed")
-    finish
-endif
-
-" Default IsInRCode function when the plugin is used as a global plugin
-function! DefaultIsInRCode(vrb)
-    return 1
-endfunction
-
-let b:IsInRCode = function("DefaultIsInRCode")
-
-call RCreateStartMaps()
-call RCreateEditMaps()
-call RCreateSendMaps()
-call RControlMaps()
-
-" Menu R
-if g:vimrplugin_never_unmake_menu && has("gui_running")
-    call MakeRMenu()
-endif
-
-call RSourceOtherScripts()
-
-if exists("g:rplugin_did_sourcelines")
-    finish
-endif
-let g:rplugin_did_sourcelines = 1
-
-function SourceNotDefined(lines)
-    echohl WarningMsg
-    echo 'The function to source "' . &filetype . '" lines is not defined.'
-    echohl Normal
-endfunction
-
-function JuliaSourceLines(lines)
-    call writefile(a:lines, $VIMRPLUGIN_TMPDIR . "/julia_code")
-    let jcmd = 'include("' . $VIMRPLUGIN_TMPDIR . "/julia_code" . '")'
-    let ok = g:SendCmdToR(jcmd)
-    return ok
-endfunction
-
-function SetExeCmd()
-    runtime r-plugin/common_buffer.vim
-    if exists("g:vimrplugin_exe") && exists("g:vimrplugin_quit")
-        let b:rplugin_R = g:vimrplugin_exe
-        if exists("g:vimrplugin_args")
-            let b:rplugin_r_args = g:vimrplugin_args
-        else
-            let b:rplugin_r_args = " "
-        endif
-        let b:quit_command = g:vimrplugin_quit
-        let b:SourceLines = function("SourceNotDefined")
-    elseif &filetype == "julia"
-        let b:rplugin_R = "julia"
-        let b:rplugin_r_args = " "
-        let b:quit_command = "quit()"
-        let b:SourceLines = function("JuliaSourceLines")
-        call RCreateMaps("ni", 'RSendFile',     'aa', ':call JuliaSourceLines(getline(1, "$"))')
-    elseif &filetype == "python"
-        let b:rplugin_R = "python"
-        let b:rplugin_r_args = " "
-        let b:quit_command = "quit()"
-        let b:SourceLines = function("SourceNotDefined")
-    elseif &filetype == "haskell"
-        let b:rplugin_R = "ghci"
-        let b:rplugin_r_args = " "
-        let b:quit_command = ":quit"
-        let b:SourceLines = function("SourceNotDefined")
-    elseif &filetype == "ruby"
-        let b:rplugin_R = "irb"
-        let b:rplugin_r_args = " "
-        let b:quit_command = "quit"
-        let b:SourceLines = function("SourceNotDefined")
-    elseif &filetype == "lisp"
-        let b:rplugin_R = "clisp"
-        let b:rplugin_r_args = " "
-        let b:quit_command = "(quit)"
-        let b:SourceLines = function("SourceNotDefined")
-    endif
-endfunction
-
-autocmd FileType * call SetExeCmd()
-call SetExeCmd()
-

From 9ecae8c1d5b6c8d646dddf87f46087986ebab3e3 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Tue, 21 Apr 2015 08:40:11 -0400
Subject: [PATCH 0958/1050] Source ftplugin/*.vim if necessary Avoid warning
 about R-Vim-runtime if the files of R-Vim-runtime are installed but are going
 to be sourced only after the Vim-R-plugin files.

---
 ftplugin/r_rplugin.vim      | 5 +++--
 ftplugin/rhelp_rplugin.vim  | 7 ++++---
 ftplugin/rmd_rplugin.vim    | 7 ++++---
 ftplugin/rnoweb_rplugin.vim | 7 ++++---
 ftplugin/rrst_rplugin.vim   | 7 ++++---
 5 files changed, 19 insertions(+), 14 deletions(-)

diff --git a/ftplugin/r_rplugin.vim b/ftplugin/r_rplugin.vim
index 395963a..24449e7 100644
--- a/ftplugin/r_rplugin.vim
+++ b/ftplugin/r_rplugin.vim
@@ -13,8 +13,9 @@ endif
 " need be defined after the global ones:
 runtime r-plugin/common_buffer.vim
 
-if !exists("b:did_ftplugin")
-    if !exists("g:rplugin_runtime_warn")
+if !exists("b:did_ftplugin") && !exists("g:rplugin_runtime_warn")
+    runtime ftplugin/r.vim
+    if !exists("b:did_ftplugin")
         call RWarningMsgInp("Your runtime files seems to be outdated.\nSee: https://github.com/jalvesaq/R-Vim-runtime")
     endif
     let g:rplugin_runtime_warn = 1
diff --git a/ftplugin/rhelp_rplugin.vim b/ftplugin/rhelp_rplugin.vim
index 20f51d3..60dd982 100644
--- a/ftplugin/rhelp_rplugin.vim
+++ b/ftplugin/rhelp_rplugin.vim
@@ -13,11 +13,12 @@ endif
 " defined after the global ones:
 runtime r-plugin/common_buffer.vim
 
-if !exists("b:did_ftplugin")
-    if !exists("g:rplugin_runtime_warn")
+if !exists("b:did_ftplugin") && !exists("g:rplugin_runtime_warn")
+    runtime ftplugin/rhelp.vim
+    if !exists("b:did_ftplugin")
         call RWarningMsgInp("Your runtime files seems to be outdated.\nSee: https://github.com/jalvesaq/R-Vim-runtime")
+        let g:rplugin_runtime_warn = 1
     endif
-    let g:rplugin_runtime_warn = 1
 endif
 
 function! RhelpIsInRCode(vrb)
diff --git a/ftplugin/rmd_rplugin.vim b/ftplugin/rmd_rplugin.vim
index 33e64d8..cc08f4c 100644
--- a/ftplugin/rmd_rplugin.vim
+++ b/ftplugin/rmd_rplugin.vim
@@ -14,11 +14,12 @@ endif
 " be defined after the global ones:
 runtime r-plugin/common_buffer.vim
 
-if !exists("b:did_ftplugin")
-    if !exists("g:rplugin_runtime_warn")
+if !exists("b:did_ftplugin") && !exists("g:rplugin_runtime_warn")
+    runtime ftplugin/rmd.vim
+    if !exists("b:did_ftplugin")
         call RWarningMsgInp("Your runtime files seems to be outdated.\nSee: https://github.com/jalvesaq/R-Vim-runtime")
+        let g:rplugin_runtime_warn = 1
     endif
-    let g:rplugin_runtime_warn = 1
 endif
 
 function! RmdIsInRCode(vrb)
diff --git a/ftplugin/rnoweb_rplugin.vim b/ftplugin/rnoweb_rplugin.vim
index 99a03f3..503f5f3 100644
--- a/ftplugin/rnoweb_rplugin.vim
+++ b/ftplugin/rnoweb_rplugin.vim
@@ -13,11 +13,12 @@ endif
 " after the global ones:
 runtime r-plugin/common_buffer.vim
 
-if !exists("b:did_ftplugin")
-    if !exists("g:rplugin_runtime_warn")
+if !exists("b:did_ftplugin") && !exists("g:rplugin_runtime_warn")
+    runtime ftplugin/rnoweb.vim
+    if !exists("b:did_ftplugin")
         call RWarningMsgInp("Your runtime files seems to be outdated.\nSee: https://github.com/jalvesaq/R-Vim-runtime")
+        let g:rplugin_runtime_warn = 1
     endif
-    let g:rplugin_runtime_warn = 1
 endif
 
 if has("win32") || has("win64")
diff --git a/ftplugin/rrst_rplugin.vim b/ftplugin/rrst_rplugin.vim
index 309e30d..5dfc3f0 100644
--- a/ftplugin/rrst_rplugin.vim
+++ b/ftplugin/rrst_rplugin.vim
@@ -13,11 +13,12 @@ endif
 " defined after the global ones:
 runtime r-plugin/common_buffer.vim
 
-if !exists("b:did_ftplugin")
-    if !exists("g:rplugin_runtime_warn")
+if !exists("b:did_ftplugin") && !exists("g:rplugin_runtime_warn")
+    runtime ftplugin/rrst.vim
+    if !exists("b:did_ftplugin")
         call RWarningMsgInp("Your runtime files seems to be outdated.\nSee: https://github.com/jalvesaq/R-Vim-runtime")
+        let g:rplugin_runtime_warn = 1
     endif
-    let g:rplugin_runtime_warn = 1
 endif
 
 function! RrstIsInRCode(vrb)

From a5fae3b92560feeb2bb577132cbb6496ed080d4e Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Tue, 21 Apr 2015 18:08:39 -0400
Subject: [PATCH 0959/1050] Ask if user wants to install vimcom Only in the
 released version (Vimball), in addition to warning the user about the need to
 update vimcom, ask whether the correct version of vimcom should be installed
 immediately. Also: update the documentation.

---
 Makefile                   |  4 +++-
 doc/r-plugin.txt           |  7 ++++++-
 r-plugin/common_global.vim | 14 ++++++++++----
 3 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/Makefile b/Makefile
index f3deca4..ff2aa86 100644
--- a/Makefile
+++ b/Makefile
@@ -22,7 +22,7 @@
 
 
 PLUGINHOME=`pwd`
-PLUGINVERSION=1.2.3
+PLUGINVERSION=1.2.4
 DEBIANTIME=`date -R`
 PLUGINRELEASEDATE=`date +"%Y-%m-%d"`
 VIM2HTML=/usr/local/share/vim/vim74/doc/vim2html.pl 
@@ -33,6 +33,8 @@ vimball:
 	sed -i -e "s/^Version: [0-9].[0-9].[0-9].[0-9]/Version: $(PLUGINVERSION)/" doc/r-plugin.txt
 	sed -i -e "s/^$(PLUGINVERSION) (201[0-9]-[0-9][0-9]-[0-9][0-9])$$/$(PLUGINVERSION) ($(PLUGINRELEASEDATE))/" doc/r-plugin.txt
 	vim -c "%MkVimball Vim-R-plugin ." -c "q" list_for_vimball
+	sed -i -e "s/call RWarningMsg('This version of Vim-R-plugin requires/\" call RWarningMsg('This version of Vim-R-plugin requires/" Vim-R-plugin.vmb
+	sed -i -e 's/" vmb only: //' Vim-R-plugin.vmb
 	mv Vim-R-plugin.vmb /tmp
 
 deb:
diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index db8d841..5d6cb2a 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -5,7 +5,7 @@
 Authors: Jakson A. Aquino   
          Jose Claudio Faria 
 
-Version: 1.2.3
+Version: 1.2.4
 For Vim version 7.4
 
  1. Overview                                    |r-plugin-overview|
@@ -2835,6 +2835,11 @@ put in your |vimrc|:
 							       *r-plugin-news*
 10. News~
 
+1.2.4 (2015-04-21)
+
+ * Deleted r-plugin/global_R_plugin.vim. See:
+   https://github.com/jalvesaq/vimcmdline
+
 1.2.3 (2015-04-09)
 
  * Official runtime files were deleted. See:
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index fa6b701..21eb259 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -985,10 +985,6 @@ function WaitVimComStart()
         let g:rplugin_vimcom_home = vr[1]
         let g:rplugin_vimcomport = vr[2]
         let g:rplugin_r_pid = vr[3]
-        if g:rplugin_vimcom_version != "1.2.3"
-            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.2.3.')
-            sleep 1
-        endif
         if has("win32")
             let g:rplugin_vimcom_lib = g:rplugin_vimcom_home . "/bin/i386/libVimR.dll"
         elseif has("win64")
@@ -999,6 +995,16 @@ function WaitVimComStart()
         if !filereadable(g:rplugin_vimcom_lib)
             call RWarningMsgInp('Could not find "' . g:rplugin_vimcom_lib . '".')
         endif
+        if g:rplugin_vimcom_version != "1.2.3"
+            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.2.3.') | sleep 1
+            " vmb only: if input('This version of Vim-R-plugin requires vimcom 1.2-3. Do you want to install it now? [y/n] ') == 'y'
+            " vmb only:     if has("win32") || has("win64")
+            " vmb only:         call g:SendCmdToR('install.packages("http://www.lepem.ufc.br/jaa/vimr/vimcom_1.2-3.zip", repos=NULL, type="binary")')
+            " vmb only:     else
+            " vmb only:         call g:SendCmdToR('install.packages("http://www.lepem.ufc.br/jaa/vimr/vimcom_1.2-3.tar.gz", repos=NULL, type="source")')
+            " vmb only:     endif
+            " vmb only: endif
+        endif
         call delete(g:rplugin_tmpdir . "/vimcom_running_" . $VIMINSTANCEID)
 
         if !has("libcall")

From a8d46160ba4951747183b425306546de1a4cd6da Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Tue, 21 Apr 2015 22:19:43 -0400
Subject: [PATCH 0960/1050] Avoid duplicated tag when running :helptags The
 string *.R* is mistakenly interpreted by  :helptags  as an address to be
 linked.

---
 doc/r-plugin.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 5d6cb2a..9420fa1 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -2786,10 +2786,10 @@ between `TRUE` and `FALSE`, then, you might want to create a couple of maps in
 your vimrc. You can use |nmap| to restrict the maps to Normal mode, |autocmd|
 and  to restrict the maps to R code, and  if you prefer that
 the command is not displayed in Vim's command line. In the example below,
-`et` sets `echo=TRUE` and `ef` sets `echo=FALSE`:
+`et` sets `echo=TRUE` and you could also create `ef`
+to set `echo=FALSE`:
 >
    autocmd BufNewFile,BufRead *.R* nmap  et :let vimrplugin_source_args = "echo = TRUE"
-   autocmd BufNewFile,BufRead *.R* nmap  ef :let vimrplugin_source_args = "echo = FALSE"
 <
 
 ------------------------------------------------------------------------------

From 2d29bae5682617cf2520a99b5eeddf7570494953 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Wed, 22 Apr 2015 12:18:18 -0400
Subject: [PATCH 0961/1050] Do not ask if should install vimcom The message was
 too invasive and the installation could fail on Windows.

---
 Makefile                   |  2 --
 r-plugin/common_global.vim | 13 +++++--------
 2 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/Makefile b/Makefile
index ff2aa86..9d33615 100644
--- a/Makefile
+++ b/Makefile
@@ -33,8 +33,6 @@ vimball:
 	sed -i -e "s/^Version: [0-9].[0-9].[0-9].[0-9]/Version: $(PLUGINVERSION)/" doc/r-plugin.txt
 	sed -i -e "s/^$(PLUGINVERSION) (201[0-9]-[0-9][0-9]-[0-9][0-9])$$/$(PLUGINVERSION) ($(PLUGINRELEASEDATE))/" doc/r-plugin.txt
 	vim -c "%MkVimball Vim-R-plugin ." -c "q" list_for_vimball
-	sed -i -e "s/call RWarningMsg('This version of Vim-R-plugin requires/\" call RWarningMsg('This version of Vim-R-plugin requires/" Vim-R-plugin.vmb
-	sed -i -e 's/" vmb only: //' Vim-R-plugin.vmb
 	mv Vim-R-plugin.vmb /tmp
 
 deb:
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 21eb259..6b3e5b5 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -821,6 +821,8 @@ function StartR(whatr)
     else
         let start_options += ['options(vimcom.vimpager = TRUE)']
     endif
+    let start_options += ['if(utils::packageVersion("vimcom") != "1.2.3") warning("Your version of Vim-R-plugin requires vimcom-1.2-3.", call. = FALSE)']
+
     let rwd = ""
     if g:vimrplugin_vim_wd == 0
         let rwd = expand("%:p:h")
@@ -996,14 +998,8 @@ function WaitVimComStart()
             call RWarningMsgInp('Could not find "' . g:rplugin_vimcom_lib . '".')
         endif
         if g:rplugin_vimcom_version != "1.2.3"
-            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.2.3.') | sleep 1
-            " vmb only: if input('This version of Vim-R-plugin requires vimcom 1.2-3. Do you want to install it now? [y/n] ') == 'y'
-            " vmb only:     if has("win32") || has("win64")
-            " vmb only:         call g:SendCmdToR('install.packages("http://www.lepem.ufc.br/jaa/vimr/vimcom_1.2-3.zip", repos=NULL, type="binary")')
-            " vmb only:     else
-            " vmb only:         call g:SendCmdToR('install.packages("http://www.lepem.ufc.br/jaa/vimr/vimcom_1.2-3.tar.gz", repos=NULL, type="source")')
-            " vmb only:     endif
-            " vmb only: endif
+            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.2.3.')
+            sleep 1
         endif
         call delete(g:rplugin_tmpdir . "/vimcom_running_" . $VIMINSTANCEID)
 
@@ -1017,6 +1013,7 @@ function WaitVimComStart()
             " when R was not started by Vim:
             call system("tmux set-environment -u VIMRPLUGIN_TMPDIR")
         endif
+        call delete(g:rplugin_tmpdir . "/start_options.R")
         return 1
     else
         call RWarningMsg("The package vimcom wasn't loaded yet.")

From 708becfe5cb2a3d215a46922a056cf7e2dc33880 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Wed, 22 Apr 2015 12:35:42 -0400
Subject: [PATCH 0962/1050] version 1.2.4

---
 doc/r-plugin.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 9420fa1..161cf1c 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -2835,7 +2835,7 @@ put in your |vimrc|:
 							       *r-plugin-news*
 10. News~
 
-1.2.4 (2015-04-21)
+1.2.4 (2015-04-22)
 
  * Deleted r-plugin/global_R_plugin.vim. See:
    https://github.com/jalvesaq/vimcmdline

From ddb77d74721b2f42c2a5d180c3d6ded1567e1be3 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Tue, 28 Apr 2015 17:09:56 -0400
Subject: [PATCH 0963/1050] Bring back the echo send commands Some users need
 the send commands that add the echo=TRUE argument to source().

---
 Makefile                    |  2 +-
 doc/r-plugin.txt            | 51 ++++++++++++++++-----------
 ftplugin/r_rplugin.vim      |  3 +-
 ftplugin/rmd_rplugin.vim    | 10 +++---
 ftplugin/rnoweb_rplugin.vim | 10 +++---
 ftplugin/rrst_rplugin.vim   | 10 +++---
 r-plugin/common_global.vim  | 69 +++++++++++++++++++++----------------
 r-plugin/gui_running.vim    | 51 ++++++++++++++++-----------
 8 files changed, 122 insertions(+), 84 deletions(-)

diff --git a/Makefile b/Makefile
index 9d33615..ef3daa8 100644
--- a/Makefile
+++ b/Makefile
@@ -22,7 +22,7 @@
 
 
 PLUGINHOME=`pwd`
-PLUGINVERSION=1.2.4
+PLUGINVERSION=1.2.5
 DEBIANTIME=`date -R`
 PLUGINRELEASEDATE=`date +"%Y-%m-%d"`
 VIM2HTML=/usr/local/share/vim/vim74/doc/vim2html.pl 
diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 161cf1c..ae62a52 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -5,7 +5,7 @@
 Authors: Jakson A. Aquino   
          Jose Claudio Faria 
 
-Version: 1.2.4
+Version: 1.2.5
 For Vim version 7.4
 
  1. Overview                                    |r-plugin-overview|
@@ -395,23 +395,34 @@ Start/Close
 
 Send
   . File                                               \aa
+  . File (echo)                                        \ae
   . File (open .Rout)                                  \ao
   --------------------------------------------------------
   . Block (cur)                                        \bb
+  . Block (cur, echo)                                  \be
   . Block (cur, down)                                  \bd
+  . Block (cur, echo and down)                         \ba
   --------------------------------------------------------
   . Chunk (cur)                                        \cc
+  . Chunk (cur, echo)                                  \ce
   . Chunk (cur, down)                                  \cd
+  . Chunk (cur, echo and down)                         \ca
   . Chunk (from first to here)                         \ch
   --------------------------------------------------------
   . Function (cur)                                     \ff
+  . Function (cur, echo)                               \fe
   . Function (cur and down)                            \fd
+  . Function (cur, echo and down)                      \fa
   --------------------------------------------------------
   . Selection                                          \ss
+  . Selection (echo)                                   \se
   . Selection (and down)                               \sd
+  . Selection (echo and down)                          \sa
   --------------------------------------------------------
   . Paragraph                                          \pp
+  . Paragraph (echo)                                   \pe
   . Paragraph (and down)                               \pd
+  . Paragraph (echo and down)                          \pa
   --------------------------------------------------------
   . Line                                                \l
   . Line (and down)                                     \d
@@ -1613,10 +1624,8 @@ temporary file.
 
 You can add arguments to be passed to R's `source()` function. Example:
 >
-   let vimrplugin_source_args = "max.deparse.length = 300, echo = TRUE"
+   let vimrplugin_source_args = "max.deparse.length = 300"
 <
-See |r-plugin-source-echo| if you frequently need to alternate the `echo`
-argument between `TRUE` and `FALSE`.
 
 ------------------------------------------------------------------------------
 						       *vimrplugin_sweaveargs*
@@ -2139,7 +2148,8 @@ The above example shows how to change key binding used to start R from
 
 Only the custom key bindings for Normal mode are shown in Vim's menu, but you
 can type |:map| to see the complete list of current mappings, and below is the
-list of the names for custom key bindings (the prefix RD means "cursor down"):
+list of the names for custom key bindings (the prefix RE means "echo";
+RD, "cursor down"; RED, both "echo" and "down"):
 
    Star/Close R~
    RStart
@@ -2173,13 +2183,21 @@ list of the names for custom key bindings (the prefix RD means "cursor down"):
 
    Send code to R console~
    RSendSelection
+   RESendSelection
    RDSendSelection
+   REDSendSelection
    RSendMBlock
+   RESendMBlock
    RDSendMBlock
+   REDSendMBlock
    RSendParagraph
+   RESendParagraph
    RDSendParagraph
+   REDSendParagraph
    RSendFunction
+   RESendFunction
    RDSendFunction
+   REDSendFunction
    RSendFile
    RESendFile
 
@@ -2200,6 +2218,8 @@ list of the names for custom key bindings (the prefix RD means "cursor down"):
    Support to Sweave and knitr~
    RSendChunk
    RDSendChunk
+   RESendChunk
+   REDSendChunk
    RSendChunkFH (from the first chunk to here)
    RBibTeX    (Sweave)
    RBibTeXK   (Knitr)
@@ -2778,23 +2798,8 @@ Finally, if you want to use vi key bindings in Bash:
 <
 
 ------------------------------------------------------------------------------
-							*r-plugin-source-echo*
-9.20. Set echo to TRUE or FALSE when sending multiple lines of code too R~
 
-If you want to alternate the `echo` argument of the `source()` function
-between `TRUE` and `FALSE`, then, you might want to create a couple of maps in
-your vimrc. You can use |nmap| to restrict the maps to Normal mode, |autocmd|
-and  to restrict the maps to R code, and  if you prefer that
-the command is not displayed in Vim's command line. In the example below,
-`et` sets `echo=TRUE` and you could also create `ef`
-to set `echo=FALSE`:
->
-   autocmd BufNewFile,BufRead *.R* nmap  et :let vimrplugin_source_args = "echo = TRUE"
-<
-
-------------------------------------------------------------------------------
-
-9.21. Syntax highlight of .Rout files~
+9.20. Syntax highlight of .Rout files~
 
 You can set the foreground colors of R output in your |vimrc|. The example
 below is for a terminal emulator that supports 256 colors (see
@@ -2835,6 +2840,10 @@ put in your |vimrc|:
 							       *r-plugin-news*
 10. News~
 
+1.2.5
+
+ * Bring back the "echo" send commands because some users need them.
+
 1.2.4 (2015-04-22)
 
  * Deleted r-plugin/global_R_plugin.vim. See:
diff --git a/ftplugin/r_rplugin.vim b/ftplugin/r_rplugin.vim
index 24449e7..3da9ef8 100644
--- a/ftplugin/r_rplugin.vim
+++ b/ftplugin/r_rplugin.vim
@@ -86,7 +86,8 @@ call RCreateStartMaps()
 call RCreateEditMaps()
 
 " Only .R files are sent to R
-call RCreateMaps("ni", 'RSendFile',     'aa', ':call SendFileToR()')
+call RCreateMaps("ni", 'RSendFile',     'aa', ':call SendFileToR("silent")')
+call RCreateMaps("ni", 'RESendFile',    'ae', ':call SendFileToR("echo")')
 call RCreateMaps("ni", 'RShowRout',     'ao', ':call ShowRout()')
 
 " Knitr::spin
diff --git a/ftplugin/rmd_rplugin.vim b/ftplugin/rmd_rplugin.vim
index cc08f4c..9a3fbdc 100644
--- a/ftplugin/rmd_rplugin.vim
+++ b/ftplugin/rmd_rplugin.vim
@@ -105,7 +105,7 @@ function! RMakeRmd(t)
 endfunction
 
 " Send Rmd chunk to R
-function! SendRmdChunkToR(m)
+function! SendRmdChunkToR(e, m)
     if RmdIsInRCode(0) == 0
         call RWarningMsg("Not inside an R code chunk.")
         return
@@ -113,7 +113,7 @@ function! SendRmdChunkToR(m)
     let chunkline = search("^[ \t]*```[ ]*{r", "bncW") + 1
     let docline = search("^[ \t]*```", "ncW") - 1
     let lines = getline(chunkline, docline)
-    let ok = RSourceLines(lines)
+    let ok = RSourceLines(lines, a:e)
     if ok == 0
         return
     endif
@@ -144,8 +144,10 @@ call RCreateMaps("nvi", 'RMakePDFK',      'kp', ':call RMakeRmd("pdf_docum
 call RCreateMaps("nvi", 'RMakePDFKb',     'kl', ':call RMakeRmd("beamer_presentation")')
 call RCreateMaps("nvi", 'RMakeHTML',      'kh', ':call RMakeRmd("html_document")')
 call RCreateMaps("nvi", 'RMakeODT',       'ko', ':call RMakeRmd("odt")')
-call RCreateMaps("ni",  'RSendChunk',     'cc', ':call b:SendChunkToR("stay")')
-call RCreateMaps("ni",  'RDSendChunk',    'cd', ':call b:SendChunkToR("down")')
+call RCreateMaps("ni",  'RSendChunk',     'cc', ':call b:SendChunkToR("silent", "stay")')
+call RCreateMaps("ni",  'RESendChunk',    'ce', ':call b:SendChunkToR("echo", "stay")')
+call RCreateMaps("ni",  'RDSendChunk',    'cd', ':call b:SendChunkToR("silent", "down")')
+call RCreateMaps("ni",  'REDSendChunk',   'ca', ':call b:SendChunkToR("echo", "down")')
 call RCreateMaps("n",  'RNextRChunk',     'gn', ':call b:NextRChunk()')
 call RCreateMaps("n",  'RPreviousRChunk', 'gN', ':call b:PreviousRChunk()')
 
diff --git a/ftplugin/rnoweb_rplugin.vim b/ftplugin/rnoweb_rplugin.vim
index 503f5f3..d0e8fc3 100644
--- a/ftplugin/rnoweb_rplugin.vim
+++ b/ftplugin/rnoweb_rplugin.vim
@@ -208,7 +208,7 @@ function! RMakePDF(bibtex, knit)
 endfunction
 
 " Send Sweave chunk to R
-function! RnwSendChunkToR(m)
+function! RnwSendChunkToR(e, m)
     if RnwIsInRCode(0) == 0
         call RWarningMsg("Not inside an R code chunk.")
         return
@@ -216,7 +216,7 @@ function! RnwSendChunkToR(m)
     let chunkline = search("^<<", "bncW") + 1
     let docline = search("^@", "ncW") - 1
     let lines = getline(chunkline, docline)
-    let ok = RSourceLines(lines)
+    let ok = RSourceLines(lines, a:e)
     if ok == 0
         return
     endif
@@ -281,8 +281,10 @@ call RCreateMaps("nvi", 'RKnit',        'kn', ':call RKnitRnw()')
 call RCreateMaps("nvi", 'RMakePDFK',    'kp', ':call RMakePDF("nobib", 1)')
 call RCreateMaps("nvi", 'RBibTeXK',     'kb', ':call RMakePDF("bibtex", 1)')
 call RCreateMaps("nvi", 'RIndent',      'si', ':call RnwToggleIndentSty()')
-call RCreateMaps("ni",  'RSendChunk',   'cc', ':call b:SendChunkToR("stay")')
-call RCreateMaps("ni",  'RDSendChunk',  'cd', ':call b:SendChunkToR("down")')
+call RCreateMaps("ni",  'RSendChunk',   'cc', ':call b:SendChunkToR("silent", "stay")')
+call RCreateMaps("ni",  'RESendChunk',  'ce', ':call b:SendChunkToR("echo", "stay")')
+call RCreateMaps("ni",  'RDSendChunk',  'cd', ':call b:SendChunkToR("silent", "down")')
+call RCreateMaps("ni",  'REDSendChunk', 'ca', ':call b:SendChunkToR("echo", "down")')
 call RCreateMaps("nvi", 'ROpenPDF',     'op', ':call ROpenPDF("Get Master")')
 if g:vimrplugin_synctex
     call RCreateMaps("ni",  'RSyncFor',     'gp', ':call SyncTeX_forward()')
diff --git a/ftplugin/rrst_rplugin.vim b/ftplugin/rrst_rplugin.vim
index 5dfc3f0..e144ad2 100644
--- a/ftplugin/rrst_rplugin.vim
+++ b/ftplugin/rrst_rplugin.vim
@@ -144,7 +144,7 @@ function! RMakePDFrrst()
 endfunction
 
 " Send Rrst chunk to R
-function! SendRrstChunkToR(m)
+function! SendRrstChunkToR(e, m)
     if RrstIsInRCode(0) == 0
         call RWarningMsg("Not inside an R code chunk.")
         return
@@ -152,7 +152,7 @@ function! SendRrstChunkToR(m)
     let chunkline = search("^\\.\\. {r", "bncW") + 1
     let docline = search("^\\.\\. \\.\\.", "ncW") - 1
     let lines = getline(chunkline, docline)
-    let ok = RSourceLines(lines)
+    let ok = RSourceLines(lines, a:e)
     if ok == 0
         return
     endif
@@ -182,8 +182,10 @@ call RCreateMaps("nvi", 'RMakePDFK',      'kp', ':call RMakePDFrrst()')
 call RCreateMaps("nvi", 'RMakeHTML',      'kh', ':call RMakeHTMLrrst("html")')
 call RCreateMaps("nvi", 'RMakeODT',       'ko', ':call RMakeHTMLrrst("odt")')
 call RCreateMaps("nvi", 'RIndent',        'si', ':call RrstToggleIndentSty()')
-call RCreateMaps("ni",  'RSendChunk',     'cc', ':call b:SendChunkToR("stay")')
-call RCreateMaps("ni",  'RDSendChunk',    'cd', ':call b:SendChunkToR("down")')
+call RCreateMaps("ni",  'RSendChunk',     'cc', ':call b:SendChunkToR("silent", "stay")')
+call RCreateMaps("ni",  'RESendChunk',    'ce', ':call b:SendChunkToR("echo", "stay")')
+call RCreateMaps("ni",  'RDSendChunk',    'cd', ':call b:SendChunkToR("silent", "down")')
+call RCreateMaps("ni",  'REDSendChunk',   'ca', ':call b:SendChunkToR("echo", "down")')
 call RCreateMaps("n",  'RNextRChunk',     'gn', ':call b:NextRChunk()')
 call RCreateMaps("n",  'RPreviousRChunk', 'gN', ':call b:PreviousRChunk()')
 
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 6b3e5b5..ff17e9f 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -1479,7 +1479,7 @@ function RGetKeyWord()
 endfunction
 
 " Send sources to R
-function RSourceLines(lines)
+function RSourceLines(lines, e)
     let lines = a:lines
     if &filetype == "rrst"
         let lines = map(copy(lines), 'substitute(v:val, "^\\.\\. \\?", "", "")')
@@ -1488,33 +1488,36 @@ function RSourceLines(lines)
         let lines = map(copy(lines), 'substitute(v:val, "^\\`\\`\\?", "", "")')
     endif
     call writefile(lines, g:rplugin_rsource)
-    if g:vimrplugin_source_args == ""
-        let rcmd = 'base::source("' . g:rplugin_rsource . '")'
-    else
-        let rcmd = 'base::source("' . g:rplugin_rsource . '", ' . g:vimrplugin_source_args . ')'
+    let sargs = ""
+    if g:vimrplugin_source_args != ""
+        let sargs = ", " . g:vimrplugin_source_args
+    endif
+    if a:e == "echo"
+        let sargs .= ', echo=TRUE'
     endif
+    let rcmd = 'base::source("' . g:rplugin_rsource . '"' . sargs . ')'
     let ok = g:SendCmdToR(rcmd)
     return ok
 endfunction
 
 " Send file to R
-function SendFileToR()
+function SendFileToR(e)
     update
     let fpath = expand("%:p")
     if has("win32") || has("win64")
         let fpath = substitute(fpath, "\\", "/", "g")
     endif
-    if g:vimrplugin_source_args == ""
-        call g:SendCmdToR('base::source("' . fpath . '")')
+    if a:e == "echo"
+        call g:SendCmdToR('base::source("' . fpath . '", echo=TRUE)')
     else
-        call g:SendCmdToR('base::source("' . fpath . '", ' . g:vimrplugin_source_args . ')')
+        call g:SendCmdToR('base::source("' . fpath . '")')
     endif
 endfunction
 
 " Send block to R
 " Adapted from marksbrowser plugin
 " Function to get the marks which the cursor is between
-function SendMBlockToR(m)
+function SendMBlockToR(e, m)
     if &filetype != "r" && b:IsInRCode(1) == 0
         return
     endif
@@ -1544,7 +1547,7 @@ function SendMBlockToR(m)
         let lineB -= 1
     endif
     let lines = getline(lineA, lineB)
-    let ok = b:SourceLines(lines)
+    let ok = b:SourceLines(lines, a:e)
     if ok == 0
         return
     endif
@@ -1555,7 +1558,7 @@ function SendMBlockToR(m)
 endfunction
 
 " Send functions to R
-function SendFunctionToR(m)
+function SendFunctionToR(e, m)
     if &filetype != "r" && b:IsInRCode(1) == 0
         return
     endif
@@ -1607,13 +1610,13 @@ function SendFunctionToR(m)
 
     if startline > lastline
         call setpos(".", [0, firstline - 1, 1])
-        call SendFunctionToR(a:m)
+        call SendFunctionToR(a:e, a:m)
         call setpos(".", save_cursor)
         return
     endif
 
     let lines = getline(firstline, lastline)
-    let ok = b:SourceLines(lines)
+    let ok = b:SourceLines(lines, a:e)
     if  ok == 0
         return
     endif
@@ -1624,7 +1627,7 @@ function SendFunctionToR(m)
 endfunction
 
 " Send selection to R
-function SendSelectionToR(m)
+function SendSelectionToR(e, m)
     if &filetype != "r"
         if b:IsInRCode(0) == 0
             if (&filetype == "rnoweb" && getline(".") !~ "\\Sexpr{") || (&filetype == "rmd" && getline(".") !~ "`r ") || (&filetype == "rrst" && getline(".") !~ ":r:`")
@@ -1677,7 +1680,7 @@ function SendSelectionToR(m)
         let lines[llen] = strpart(lines[llen], 0, j)
     endif
 
-    let ok = b:SourceLines(lines)
+    let ok = b:SourceLines(lines, a:e)
     if ok == 0
         return
     endif
@@ -1690,7 +1693,7 @@ function SendSelectionToR(m)
 endfunction
 
 " Send paragraph to R
-function SendParagraphToR(m)
+function SendParagraphToR(e, m)
     if &filetype != "r" && b:IsInRCode(1) == 0
         return
     endif
@@ -1715,7 +1718,7 @@ function SendParagraphToR(m)
         endif
     endwhile
     let lines = getline(i, j)
-    let ok = b:SourceLines(lines)
+    let ok = b:SourceLines(lines, a:e)
     if ok == 0
         return
     endif
@@ -1759,7 +1762,7 @@ function SendFHChunkToR()
             " Child R chunk
             if curbuf[idx] =~ chdchk
                 " First run everything up to child chunk and reset buffer
-                call b:SourceLines(codelines)
+                call b:SourceLines(codelines, "silent")
                 let codelines = []
 
                 " Next run child chunk and continue
@@ -1777,7 +1780,7 @@ function SendFHChunkToR()
             let idx += 1
         endif
     endwhile
-    call b:SourceLines(codelines)
+    call b:SourceLines(codelines, "silent")
 endfunction
 
 function KnitChild(line, godown)
@@ -2843,23 +2846,31 @@ endfunction
 function RCreateSendMaps()
     " Block
     "-------------------------------------
-    call RCreateMaps("ni", 'RSendMBlock',     'bb', ':call SendMBlockToR("stay")')
-    call RCreateMaps("ni", 'RDSendMBlock',    'bd', ':call SendMBlockToR("down")')
+    call RCreateMaps("ni", 'RSendMBlock',     'bb', ':call SendMBlockToR("silent", "stay")')
+    call RCreateMaps("ni", 'RESendMBlock',    'be', ':call SendMBlockToR("echo", "stay")')
+    call RCreateMaps("ni", 'RDSendMBlock',    'bd', ':call SendMBlockToR("silent", "down")')
+    call RCreateMaps("ni", 'REDSendMBlock',   'ba', ':call SendMBlockToR("echo", "down")')
 
     " Function
     "-------------------------------------
-    call RCreateMaps("nvi", 'RSendFunction',  'ff', ':call SendFunctionToR("stay")')
-    call RCreateMaps("nvi", 'RDSendFunction', 'fd', ':call SendFunctionToR("down")')
+    call RCreateMaps("nvi", 'RSendFunction',  'ff', ':call SendFunctionToR("silent", "stay")')
+    call RCreateMaps("nvi", 'RDSendFunction', 'fe', ':call SendFunctionToR("echo", "stay")')
+    call RCreateMaps("nvi", 'RDSendFunction', 'fd', ':call SendFunctionToR("silent", "down")')
+    call RCreateMaps("nvi", 'RDSendFunction', 'fa', ':call SendFunctionToR("echo", "down")')
 
     " Selection
     "-------------------------------------
-    call RCreateMaps("v", 'RSendSelection',   'ss', ':call SendSelectionToR("stay")')
-    call RCreateMaps("v", 'RDSendSelection',  'sd', ':call SendSelectionToR("down")')
+    call RCreateMaps("v", 'RSendSelection',   'ss', ':call SendSelectionToR("silent", "stay")')
+    call RCreateMaps("v", 'RESendSelection',  'se', ':call SendSelectionToR("echo", "stay")')
+    call RCreateMaps("v", 'RDSendSelection',  'sd', ':call SendSelectionToR("silent", "down")')
+    call RCreateMaps("v", 'REDSendSelection', 'sa', ':call SendSelectionToR("echo", "down")')
 
     " Paragraph
     "-------------------------------------
-    call RCreateMaps("ni", 'RSendParagraph',   'pp', ':call SendParagraphToR("stay")')
-    call RCreateMaps("ni", 'RDSendParagraph',  'pd', ':call SendParagraphToR("down")')
+    call RCreateMaps("ni", 'RSendParagraph',   'pp', ':call SendParagraphToR("silent", "stay")')
+    call RCreateMaps("ni", 'RESendParagraph',  'pe', ':call SendParagraphToR("echo", "stay")')
+    call RCreateMaps("ni", 'RDSendParagraph',  'pd', ':call SendParagraphToR("silent", "down")')
+    call RCreateMaps("ni", 'REDSendParagraph', 'pa', ':call SendParagraphToR("echo", "down")')
 
     if &filetype == "rnoweb" || &filetype == "rmd" || &filetype == "rrst"
         call RCreateMaps("ni", 'RSendChunkFH', 'ch', ':call SendFHChunkToR()')
@@ -2878,7 +2889,7 @@ function RCreateSendMaps()
 
     " For compatibility with Johannes Ranke's plugin
     if g:vimrplugin_map_r == 1
-        vnoremap  r :call SendSelectionToR("down")
+        vnoremap  r :call SendSelectionToR("silent", "down")
     endif
 endfunction
 
diff --git a/r-plugin/gui_running.vim b/r-plugin/gui_running.vim
index 799885e..e35b977 100644
--- a/r-plugin/gui_running.vim
+++ b/r-plugin/gui_running.vim
@@ -29,32 +29,43 @@ function MakeRMenu()
     " Send
     "----------------------------------------------------------------------------
     if &filetype == "r" || g:vimrplugin_never_unmake_menu
-        call RCreateMenuItem("ni", 'Send.File', 'RSendFile', 'aa', ':call SendFileToR()')
+        call RCreateMenuItem("ni", 'Send.File', 'RSendFile', 'aa', ':call SendFileToR("silent")')
+        call RCreateMenuItem("ni", 'Send.File\ (echo)', 'RESendFile', 'ae', ':call SendFileToR("echo")')
         call RCreateMenuItem("ni", 'Send.File\ (open\ \.Rout)', 'RShowRout', 'ao', ':call ShowRout()')
     endif
     "-------------------------------
     menu R.Send.-Sep1- 
-    call RCreateMenuItem("ni", 'Send.Block\ (cur)', 'RSendMBlock', 'bb', ':call SendMBlockToR("stay")')
-    call RCreateMenuItem("ni", 'Send.Block\ (cur,\ down)', 'RDSendMBlock', 'bd', ':call SendMBlockToR("down")')
+    call RCreateMenuItem("ni", 'Send.Block\ (cur)', 'RSendMBlock', 'bb', ':call SendMBlockToR("silent", "stay")')
+    call RCreateMenuItem("ni", 'Send.Block\ (cur,\ echo)', 'RESendMBlock', 'be', ':call SendMBlockToR("echo", "stay")')
+    call RCreateMenuItem("ni", 'Send.Block\ (cur,\ down)', 'RDSendMBlock', 'bd', ':call SendMBlockToR("silent", "down")')
+    call RCreateMenuItem("ni", 'Send.Block\ (cur,\ echo\ and\ down)', 'REDSendMBlock', 'ba', ':call SendMBlockToR("echo", "down")')
     "-------------------------------
     if &filetype == "rnoweb" || &filetype == "rmd" || &filetype == "rrst" || g:vimrplugin_never_unmake_menu
         menu R.Send.-Sep2- 
-        call RCreateMenuItem("ni", 'Send.Chunk\ (cur)', 'RSendChunk', 'cc', ':call b:SendChunkToR("stay")')
-        call RCreateMenuItem("ni", 'Send.Chunk\ (cur,\ down)', 'RDSendChunk', 'cd', ':call b:SendChunkToR("down")')
+        call RCreateMenuItem("ni", 'Send.Chunk\ (cur)', 'RSendChunk', 'cc', ':call b:SendChunkToR("silent", "stay")')
+        call RCreateMenuItem("ni", 'Send.Chunk\ (cur,\ echo)', 'RESendChunk', 'ce', ':call b:SendChunkToR("echo", "stay")')
+        call RCreateMenuItem("ni", 'Send.Chunk\ (cur,\ down)', 'RDSendChunk', 'cd', ':call b:SendChunkToR("silent", "down")')
+        call RCreateMenuItem("ni", 'Send.Chunk\ (cur,\ echo\ and\ down)', 'REDSendChunk', 'ca', ':call b:SendChunkToR("echo", "down")')
         call RCreateMenuItem("ni", 'Send.Chunk\ (from\ first\ to\ here)', 'RSendChunkFH', 'ch', ':call SendFHChunkToR()')
     endif
     "-------------------------------
     menu R.Send.-Sep3- 
-    call RCreateMenuItem("ni", 'Send.Function\ (cur)', 'RSendFunction', 'ff', ':call SendFunctionToR("stay")')
-    call RCreateMenuItem("ni", 'Send.Function\ (cur\ and\ down)', 'RDSendFunction', 'fd', ':call SendFunctionToR("down")')
+    call RCreateMenuItem("ni", 'Send.Function\ (cur)', 'RSendFunction', 'ff', ':call SendFunctionToR("silent", "stay")')
+    call RCreateMenuItem("ni", 'Send.Function\ (cur,\ echo)', 'RESendFunction', 'fe', ':call SendFunctionToR("echo", "stay")')
+    call RCreateMenuItem("ni", 'Send.Function\ (cur\ and\ down)', 'RDSendFunction', 'fd', ':call SendFunctionToR("silent", "down")')
+    call RCreateMenuItem("ni", 'Send.Function\ (cur,\ echo\ and\ down)', 'REDSendFunction', 'fa', ':call SendFunctionToR("echo", "down")')
     "-------------------------------
     menu R.Send.-Sep4- 
-    call RCreateMenuItem("v", 'Send.Selection', 'RSendSelection', 'ss', ':call SendSelectionToR("stay")')
-    call RCreateMenuItem("v", 'Send.Selection\ (and\ down)', 'RDSendSelection', 'sd', ':call SendSelectionToR("down")')
+    call RCreateMenuItem("v", 'Send.Selection', 'RSendSelection', 'ss', ':call SendSelectionToR("silent", "stay")')
+    call RCreateMenuItem("v", 'Send.Selection\ (echo)', 'RESendSelection', 'se', ':call SendSelectionToR("echo", "stay")')
+    call RCreateMenuItem("v", 'Send.Selection\ (and\ down)', 'RDSendSelection', 'sd', ':call SendSelectionToR("silent", "down")')
+    call RCreateMenuItem("v", 'Send.Selection\ (echo\ and\ down)', 'REDSendSelection', 'sa', ':call SendSelectionToR("echo", "down")')
     "-------------------------------
     menu R.Send.-Sep5- 
-    call RCreateMenuItem("ni", 'Send.Paragraph', 'RSendParagraph', 'pp', ':call SendParagraphToR("stay")')
-    call RCreateMenuItem("ni", 'Send.Paragraph\ (and\ down)', 'RDSendParagraph', 'pd', ':call SendParagraphToR("down")')
+    call RCreateMenuItem("ni", 'Send.Paragraph', 'RSendParagraph', 'pp', ':call SendParagraphToR("silent", "stay")')
+    call RCreateMenuItem("ni", 'Send.Paragraph\ (echo)', 'RESendParagraph', 'pe', ':call SendParagraphToR("echo", "stay")')
+    call RCreateMenuItem("ni", 'Send.Paragraph\ (and\ down)', 'RDSendParagraph', 'pd', ':call SendParagraphToR("silent", "down")')
+    call RCreateMenuItem("ni", 'Send.Paragraph\ (echo\ and\ down)', 'REDSendParagraph', 'pa', ':call SendParagraphToR("echo", "down")')
     "-------------------------------
     menu R.Send.-Sep6- 
     call RCreateMenuItem("ni0", 'Send.Line', 'RSendLine', 'l', ':call SendLineToR("stay")')
@@ -222,17 +233,17 @@ function MakeRMenu()
         amenu  ToolBar.RClose :call RQuit('no')
         "---------------------------
         if &filetype == "r" || g:vimrplugin_never_unmake_menu
-            nmenu  ToolBar.RSendFile :call SendFileToR()
-            imenu  ToolBar.RSendFile :call SendFileToR()
+            nmenu  ToolBar.RSendFile :call SendFileToR("echo")
+            imenu  ToolBar.RSendFile :call SendFileToR("echo")
             let g:rplugin_hasRSFbutton = 1
         endif
-        nmenu  ToolBar.RSendBlock :call SendMBlockToR("down")
-        imenu  ToolBar.RSendBlock :call SendMBlockToR("down")
-        nmenu  ToolBar.RSendFunction :call SendFunctionToR("down")
-        imenu  ToolBar.RSendFunction :call SendFunctionToR("down")
-        vmenu  ToolBar.RSendSelection :call SendSelectionToR("down")
-        nmenu  ToolBar.RSendParagraph :call SendParagraphToR("down")
-        imenu  ToolBar.RSendParagraph :call SendParagraphToR("down")
+        nmenu  ToolBar.RSendBlock :call SendMBlockToR("echo", "down")
+        imenu  ToolBar.RSendBlock :call SendMBlockToR("echo", "down")
+        nmenu  ToolBar.RSendFunction :call SendFunctionToR("echo", "down")
+        imenu  ToolBar.RSendFunction :call SendFunctionToR("echo", "down")
+        vmenu  ToolBar.RSendSelection :call SendSelectionToR("echo", "down")
+        nmenu  ToolBar.RSendParagraph :call SendParagraphToR("echo", "down")
+        imenu  ToolBar.RSendParagraph :call SendParagraphToR("echo", "down")
         nmenu  ToolBar.RSendLine :call SendLineToR("down")
         imenu  ToolBar.RSendLine :call SendLineToR("down")
         "---------------------------

From b8209ee9251950b68d97255c709c08509f3a7f9e Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Thu, 30 Apr 2015 14:06:31 -0400
Subject: [PATCH 0964/1050] New command to evaluate selection and get output
 The output of the evaluated code is inserted in a new tab, and the key
 binding to trigger the command is so.

---
 doc/r-plugin.txt           |  4 ++++
 r-plugin/common_global.vim | 39 ++++++++++++++++++++++++++++----------
 r-plugin/gui_running.vim   |  1 +
 3 files changed, 34 insertions(+), 10 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index ae62a52..c72d558 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -418,6 +418,7 @@ Send
   . Selection (echo)                                   \se
   . Selection (and down)                               \sd
   . Selection (echo and down)                          \sa
+  . Selection (evaluate and insert output in new tab)  \so
   --------------------------------------------------------
   . Paragraph                                          \pp
   . Paragraph (echo)                                   \pe
@@ -2186,6 +2187,7 @@ RD, "cursor down"; RED, both "echo" and "down"):
    RESendSelection
    RDSendSelection
    REDSendSelection
+   RSendSelAndInsertOutput
    RSendMBlock
    RESendMBlock
    RDSendMBlock
@@ -2842,6 +2844,8 @@ put in your |vimrc|:
 
 1.2.5
 
+ * New command to evaluate selection and get output in newtab: \so
+
  * Bring back the "echo" send commands because some users need them.
 
 1.2.4 (2015-04-22)
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index ff17e9f..4a70611 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -1367,19 +1367,23 @@ function RFormatCode() range
     echo (a:lastline - a:firstline + 1) . " lines formatted."
 endfunction
 
-function RInsert(cmd)
+function RInsert(...)
     if g:rplugin_vimcomport == 0
         return
     endif
 
     call delete(g:rplugin_tmpdir . "/eval_reply")
     call delete(g:rplugin_tmpdir . "/Rinsert")
-    call SendToVimCom("\x08" . $VIMINSTANCEID . 'capture.output(' . a:cmd . ', file = "' . g:rplugin_tmpdir . '/Rinsert")')
+    call SendToVimCom("\x08" . $VIMINSTANCEID . 'capture.output(' . a:1 . ', file = "' . g:rplugin_tmpdir . '/Rinsert")')
     let g:rplugin_lastev = ReadEvalReply()
     if g:rplugin_lastev == "R is busy." || g:rplugin_lastev == "UNKNOWN" || g:rplugin_lastev =~ "^Error" || g:rplugin_lastev == "INVALID" || g:rplugin_lastev == "ERROR" || g:rplugin_lastev == "EMPTY" || g:rplugin_lastev == "No reply"
         call RWarningMsg(g:rplugin_lastev)
         return 0
     else
+        if a:0 == 2 && a:2 == "newtab"
+            tabnew
+            set ft=rout
+        endif
         silent exe "read " . substitute(g:rplugin_tmpdir, ' ', '\\ ', 'g') . "/Rinsert"
         return 1
     endif
@@ -1479,8 +1483,8 @@ function RGetKeyWord()
 endfunction
 
 " Send sources to R
-function RSourceLines(lines, e)
-    let lines = a:lines
+function RSourceLines(...)
+    let lines = a:1
     if &filetype == "rrst"
         let lines = map(copy(lines), 'substitute(v:val, "^\\.\\. \\?", "", "")')
     endif
@@ -1492,7 +1496,14 @@ function RSourceLines(lines, e)
     if g:vimrplugin_source_args != ""
         let sargs = ", " . g:vimrplugin_source_args
     endif
-    if a:e == "echo"
+
+    if a:0 == 3 && a:3 == "NewtabInsert"
+        let rcmd = 'base::source("' . g:rplugin_rsource . '", echo=TRUE)'
+        call RInsert(rcmd, "newtab")
+        return 1
+    endif
+
+    if a:2 == "echo"
         let sargs .= ', echo=TRUE'
     endif
     let rcmd = 'base::source("' . g:rplugin_rsource . '"' . sargs . ')'
@@ -1627,7 +1638,7 @@ function SendFunctionToR(e, m)
 endfunction
 
 " Send selection to R
-function SendSelectionToR(e, m)
+function SendSelectionToR(...)
     if &filetype != "r"
         if b:IsInRCode(0) == 0
             if (&filetype == "rnoweb" && getline(".") !~ "\\Sexpr{") || (&filetype == "rmd" && getline(".") !~ "`r ") || (&filetype == "rrst" && getline(".") !~ ":r:`")
@@ -1643,7 +1654,7 @@ function SendSelectionToR(e, m)
         let l = getline("'<")
         let line = strpart(l, i, j)
         let ok = g:SendCmdToR(line)
-        if ok && a:m =~ "down"
+        if ok && a:2 =~ "down"
             call GoDown()
         endif
         return
@@ -1680,12 +1691,17 @@ function SendSelectionToR(e, m)
         let lines[llen] = strpart(lines[llen], 0, j)
     endif
 
-    let ok = b:SourceLines(lines, a:e)
+    if a:0 == 3 && a:3 == "NewtabInsert"
+        let ok = b:SourceLines(lines, a:1, "NewtabInsert")
+    else
+        let ok = b:SourceLines(lines, a:1)
+    endif
+
     if ok == 0
         return
     endif
 
-    if a:m == "down"
+    if a:2 == "down"
         call GoDown()
     else
         normal! gv
@@ -2880,13 +2896,16 @@ function RCreateSendMaps()
     "-------------------------------------
     call RCreateMaps("ni", 'RSendLine', 'l', ':call SendLineToR("stay")')
     call RCreateMaps('ni0', 'RDSendLine', 'd', ':call SendLineToR("down")')
-    call RCreateMaps('ni0', 'RDSendLineAndInsertOutput', 'o', ':call SendLineToRAndInsertOutput()')
     call RCreateMaps('i', 'RSendLAndOpenNewOne', 'q', ':call SendLineToR("newline")')
     call RCreateMaps('n', 'RNLeftPart', 'r', ':call RSendPartOfLine("left", 0)')
     call RCreateMaps('n', 'RNRightPart', 'r', ':call RSendPartOfLine("right", 0)')
     call RCreateMaps('i', 'RILeftPart', 'r', 'l:call RSendPartOfLine("left", 1)')
     call RCreateMaps('i', 'RIRightPart', 'r', 'l:call RSendPartOfLine("right", 1)')
 
+    " *Run and insert output*
+    call RCreateMaps('ni0', 'RDSendLineAndInsertOutput', 'o', ':call SendLineToRAndInsertOutput()')
+    call RCreateMaps('v', 'RSendSelAndInsertOutput', 'so', ':call SendSelectionToR("echo", "stay", "NewtabInsert")')
+
     " For compatibility with Johannes Ranke's plugin
     if g:vimrplugin_map_r == 1
         vnoremap  r :call SendSelectionToR("silent", "down")
diff --git a/r-plugin/gui_running.vim b/r-plugin/gui_running.vim
index e35b977..09a30d7 100644
--- a/r-plugin/gui_running.vim
+++ b/r-plugin/gui_running.vim
@@ -60,6 +60,7 @@ function MakeRMenu()
     call RCreateMenuItem("v", 'Send.Selection\ (echo)', 'RESendSelection', 'se', ':call SendSelectionToR("echo", "stay")')
     call RCreateMenuItem("v", 'Send.Selection\ (and\ down)', 'RDSendSelection', 'sd', ':call SendSelectionToR("silent", "down")')
     call RCreateMenuItem("v", 'Send.Selection\ (echo\ and\ down)', 'REDSendSelection', 'sa', ':call SendSelectionToR("echo", "down")')
+    call RCreateMenuItem("v", 'Send.Selection\ (and\ insert\ output)', 'RSendSelAndInsertOutput', 'so', ':call SendSelectionToR("echo", "stay", "NewtabInsert")')
     "-------------------------------
     menu R.Send.-Sep5- 
     call RCreateMenuItem("ni", 'Send.Paragraph', 'RSendParagraph', 'pp', ':call SendParagraphToR("silent", "stay")')

From 2850d97e85e629dec48cff41981737bcea2f98d0 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Thu, 30 Apr 2015 14:28:30 -0400
Subject: [PATCH 0965/1050] Replace b:SourceLines with RSourceLines The
 variable was created for use with r-plugin/global_r_plugin.vim which was
 deleted from the plugin.

---
 ftplugin/r_rplugin.vim      |  8 ++------
 ftplugin/rbrowser.vim       |  2 --
 ftplugin/rdoc.vim           |  1 -
 ftplugin/rhelp_rplugin.vim  |  5 ++---
 ftplugin/rmd_rplugin.vim    |  5 ++---
 ftplugin/rnoweb_rplugin.vim |  8 ++------
 ftplugin/rrst_rplugin.vim   |  5 ++---
 r-plugin/common_global.vim  | 14 +++++++-------
 8 files changed, 17 insertions(+), 31 deletions(-)

diff --git a/ftplugin/r_rplugin.vim b/ftplugin/r_rplugin.vim
index 3da9ef8..eca0752 100644
--- a/ftplugin/r_rplugin.vim
+++ b/ftplugin/r_rplugin.vim
@@ -75,10 +75,6 @@ endfunction
 
 let b:IsInRCode = function("DefaultIsInRCode")
 
-" Pointer to function that must be different if the plugin is used as a
-" global one:
-let b:SourceLines = function("RSourceLines")
-
 "==========================================================================
 " Key bindings and menu items
 
@@ -108,7 +104,7 @@ endif
 call RSourceOtherScripts()
 
 if exists("b:undo_ftplugin")
-    let b:undo_ftplugin .= " | unlet! b:IsInRCode b:SourceLines"
+    let b:undo_ftplugin .= " | unlet! b:IsInRCode"
 else
-    let b:undo_ftplugin = "unlet! b:IsInRCode b:SourceLines"   
+    let b:undo_ftplugin = "unlet! b:IsInRCode"
 endif
diff --git a/ftplugin/rbrowser.vim b/ftplugin/rbrowser.vim
index 44e5006..5ed6fae 100644
--- a/ftplugin/rbrowser.vim
+++ b/ftplugin/rbrowser.vim
@@ -355,8 +355,6 @@ unlet s:envstring
 
 call setline(1, ".GlobalEnv | Libraries")
 
-let b:SourceLines = function("RSourceLines")
-
 call RSourceOtherScripts()
 
 let &cpo = s:cpo_save
diff --git a/ftplugin/rdoc.vim b/ftplugin/rdoc.vim
index a875323..403b6f1 100644
--- a/ftplugin/rdoc.vim
+++ b/ftplugin/rdoc.vim
@@ -101,7 +101,6 @@ function! RdocIsInRCode(vrb)
 endfunction
 
 let b:IsInRCode = function("RdocIsInRCode")
-let b:SourceLines = function("RSourceLines")
 
 "==========================================================================
 " Key bindings and menu items
diff --git a/ftplugin/rhelp_rplugin.vim b/ftplugin/rhelp_rplugin.vim
index 60dd982..9168e09 100644
--- a/ftplugin/rhelp_rplugin.vim
+++ b/ftplugin/rhelp_rplugin.vim
@@ -35,7 +35,6 @@ function! RhelpIsInRCode(vrb)
 endfunction
 
 let b:IsInRCode = function("RhelpIsInRCode")
-let b:SourceLines = function("RSourceLines")
 
 "==========================================================================
 " Key bindings and menu items
@@ -55,7 +54,7 @@ endif
 call RSourceOtherScripts()
 
 if exists("b:undo_ftplugin")
-    let b:undo_ftplugin .= " | unlet! b:IsInRCode b:SourceLines"
+    let b:undo_ftplugin .= " | unlet! b:IsInRCode"
 else
-    let b:undo_ftplugin = " | unlet! b:IsInRCode b:SourceLines"
+    let b:undo_ftplugin = " | unlet! b:IsInRCode"
 endif
diff --git a/ftplugin/rmd_rplugin.vim b/ftplugin/rmd_rplugin.vim
index 9a3fbdc..9ddb4cc 100644
--- a/ftplugin/rmd_rplugin.vim
+++ b/ftplugin/rmd_rplugin.vim
@@ -126,7 +126,6 @@ let b:IsInRCode = function("RmdIsInRCode")
 let b:PreviousRChunk = function("RmdPreviousChunk")
 let b:NextRChunk = function("RmdNextChunk")
 let b:SendChunkToR = function("SendRmdChunkToR")
-let b:SourceLines = function("RSourceLines")
 
 "==========================================================================
 " Key bindings and menu items
@@ -165,7 +164,7 @@ call RSetPDFViewer()
 call RSourceOtherScripts()
 
 if exists("b:undo_ftplugin")
-    let b:undo_ftplugin .= " | unlet! b:IsInRCode b:SourceLines b:PreviousRChunk b:NextRChunk b:SendChunkToR"
+    let b:undo_ftplugin .= " | unlet! b:IsInRCode b:PreviousRChunk b:NextRChunk b:SendChunkToR"
 else
-    let b:undo_ftplugin = " | unlet! b:IsInRCode b:SourceLines b:PreviousRChunk b:NextRChunk b:SendChunkToR"
+    let b:undo_ftplugin = " | unlet! b:IsInRCode b:PreviousRChunk b:NextRChunk b:SendChunkToR"
 endif
diff --git a/ftplugin/rnoweb_rplugin.vim b/ftplugin/rnoweb_rplugin.vim
index d0e8fc3..659a034 100644
--- a/ftplugin/rnoweb_rplugin.vim
+++ b/ftplugin/rnoweb_rplugin.vim
@@ -254,10 +254,6 @@ let b:PreviousRChunk = function("RnwPreviousChunk")
 let b:NextRChunk = function("RnwNextChunk")
 let b:SendChunkToR = function("RnwSendChunkToR")
 
-" Pointers to functions that must be different if the plugin is used as a
-" global one:
-let b:SourceLines = function("RSourceLines")
-
 let b:pdf_opened = 0
 
 
@@ -652,7 +648,7 @@ endif
 call RSourceOtherScripts()
 
 if exists("b:undo_ftplugin")
-    let b:undo_ftplugin .= " | unlet! b:IsInRCode b:SourceLines b:PreviousRChunk b:NextRChunk b:SendChunkToR"
+    let b:undo_ftplugin .= " | unlet! b:IsInRCode b:PreviousRChunk b:NextRChunk b:SendChunkToR"
 else
-    let b:undo_ftplugin = " | unlet! b:IsInRCode b:SourceLines b:PreviousRChunk b:NextRChunk b:SendChunkToR"
+    let b:undo_ftplugin = " | unlet! b:IsInRCode b:PreviousRChunk b:NextRChunk b:SendChunkToR"
 endif
diff --git a/ftplugin/rrst_rplugin.vim b/ftplugin/rrst_rplugin.vim
index e144ad2..bd25abc 100644
--- a/ftplugin/rrst_rplugin.vim
+++ b/ftplugin/rrst_rplugin.vim
@@ -165,7 +165,6 @@ let b:IsInRCode = function("RrstIsInRCode")
 let b:PreviousRChunk = function("RrstPreviousChunk")
 let b:NextRChunk = function("RrstNextChunk")
 let b:SendChunkToR = function("SendRrstChunkToR")
-let b:SourceLines = function("RSourceLines")
 
 "==========================================================================
 " Key bindings and menu items
@@ -200,7 +199,7 @@ let g:rplugin_has_rst2pdf = 0
 call RSourceOtherScripts()
 
 if exists("b:undo_ftplugin")
-    let b:undo_ftplugin .= " | unlet! b:IsInRCode b:SourceLines b:PreviousRChunk b:NextRChunk b:SendChunkToR"
+    let b:undo_ftplugin .= " | unlet! b:IsInRCode b:PreviousRChunk b:NextRChunk b:SendChunkToR"
 else
-    let b:undo_ftplugin = " | unlet! b:IsInRCode b:SourceLines b:PreviousRChunk b:NextRChunk b:SendChunkToR"
+    let b:undo_ftplugin = " | unlet! b:IsInRCode b:PreviousRChunk b:NextRChunk b:SendChunkToR"
 endif
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 4a70611..aea0380 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -1558,7 +1558,7 @@ function SendMBlockToR(e, m)
         let lineB -= 1
     endif
     let lines = getline(lineA, lineB)
-    let ok = b:SourceLines(lines, a:e)
+    let ok = RSourceLines(lines, a:e)
     if ok == 0
         return
     endif
@@ -1627,7 +1627,7 @@ function SendFunctionToR(e, m)
     endif
 
     let lines = getline(firstline, lastline)
-    let ok = b:SourceLines(lines, a:e)
+    let ok = RSourceLines(lines, a:e)
     if  ok == 0
         return
     endif
@@ -1692,9 +1692,9 @@ function SendSelectionToR(...)
     endif
 
     if a:0 == 3 && a:3 == "NewtabInsert"
-        let ok = b:SourceLines(lines, a:1, "NewtabInsert")
+        let ok = RSourceLines(lines, a:1, "NewtabInsert")
     else
-        let ok = b:SourceLines(lines, a:1)
+        let ok = RSourceLines(lines, a:1)
     endif
 
     if ok == 0
@@ -1734,7 +1734,7 @@ function SendParagraphToR(e, m)
         endif
     endwhile
     let lines = getline(i, j)
-    let ok = b:SourceLines(lines, a:e)
+    let ok = RSourceLines(lines, a:e)
     if ok == 0
         return
     endif
@@ -1778,7 +1778,7 @@ function SendFHChunkToR()
             " Child R chunk
             if curbuf[idx] =~ chdchk
                 " First run everything up to child chunk and reset buffer
-                call b:SourceLines(codelines, "silent")
+                call RSourceLines(codelines, "silent")
                 let codelines = []
 
                 " Next run child chunk and continue
@@ -1796,7 +1796,7 @@ function SendFHChunkToR()
             let idx += 1
         endif
     endwhile
-    call b:SourceLines(codelines, "silent")
+    call RSourceLines(codelines, "silent")
 endfunction
 
 function KnitChild(line, godown)

From 5b5287dc69938da0fa835164c49f2adaf56695c1 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Thu, 30 Apr 2015 19:13:35 -0400
Subject: [PATCH 0966/1050] Require vimcom 1.2-4

---
 r-plugin/common_global.vim | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index aea0380..4e13c0e 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -821,7 +821,7 @@ function StartR(whatr)
     else
         let start_options += ['options(vimcom.vimpager = TRUE)']
     endif
-    let start_options += ['if(utils::packageVersion("vimcom") != "1.2.3") warning("Your version of Vim-R-plugin requires vimcom-1.2-3.", call. = FALSE)']
+    let start_options += ['if(utils::packageVersion("vimcom") != "1.2.4") warning("Your version of Vim-R-plugin requires vimcom-1.2-4.", call. = FALSE)']
 
     let rwd = ""
     if g:vimrplugin_vim_wd == 0
@@ -997,8 +997,8 @@ function WaitVimComStart()
         if !filereadable(g:rplugin_vimcom_lib)
             call RWarningMsgInp('Could not find "' . g:rplugin_vimcom_lib . '".')
         endif
-        if g:rplugin_vimcom_version != "1.2.3"
-            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.2.3.')
+        if g:rplugin_vimcom_version != "1.2.4"
+            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.2.4.')
             sleep 1
         endif
         call delete(g:rplugin_tmpdir . "/vimcom_running_" . $VIMINSTANCEID)

From cdab3fbdb44baae8c7981f38fcb403d91d654905 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Fri, 1 May 2015 23:26:58 -0400
Subject: [PATCH 0967/1050] Require vimcom 1.2-4.1

---
 r-plugin/common_global.vim | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 4e13c0e..8369a44 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -821,7 +821,7 @@ function StartR(whatr)
     else
         let start_options += ['options(vimcom.vimpager = TRUE)']
     endif
-    let start_options += ['if(utils::packageVersion("vimcom") != "1.2.4") warning("Your version of Vim-R-plugin requires vimcom-1.2-4.", call. = FALSE)']
+    let start_options += ['if(utils::packageVersion("vimcom") != "1.2.4.1") warning("Your version of Vim-R-plugin requires vimcom-1.2-4.1.", call. = FALSE)']
 
     let rwd = ""
     if g:vimrplugin_vim_wd == 0
@@ -997,8 +997,8 @@ function WaitVimComStart()
         if !filereadable(g:rplugin_vimcom_lib)
             call RWarningMsgInp('Could not find "' . g:rplugin_vimcom_lib . '".')
         endif
-        if g:rplugin_vimcom_version != "1.2.4"
-            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.2.4.')
+        if g:rplugin_vimcom_version != "1.2.4.1"
+            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.2.4.1.')
             sleep 1
         endif
         call delete(g:rplugin_tmpdir . "/vimcom_running_" . $VIMINSTANCEID)

From 45fbae3f25d97e2615784aaca24af71cc8392f29 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sun, 3 May 2015 11:23:06 -0400
Subject: [PATCH 0968/1050] Run evince_backward.py only once for each rnw

---
 ftplugin/rnoweb_rplugin.vim | 47 ++++++++++++++++++++-----------------
 1 file changed, 26 insertions(+), 21 deletions(-)

diff --git a/ftplugin/rnoweb_rplugin.vim b/ftplugin/rnoweb_rplugin.vim
index 659a034..1c6d9ec 100644
--- a/ftplugin/rnoweb_rplugin.vim
+++ b/ftplugin/rnoweb_rplugin.vim
@@ -595,28 +595,33 @@ function! SyncTeX_SetPID(spid)
     exe 'autocmd VimLeave * call system("kill ' . a:spid . '")'
 endfunction
 
-function! Run_SyncTeX()
-    if $DISPLAY == "" || g:rplugin_pdfviewer == "none" || exists("b:did_synctex")
-        return
-    endif
-    let b:did_synctex = 1
-
+function! Run_EvinceBackward()
     let olddir = getcwd()
     if olddir != expand("%:p:h")
-        exe "cd " . substitute(expand("%:p:h"), ' ', '\\ ', 'g')
+        try
+            exe "cd " . substitute(expand("%:p:h"), ' ', '\\ ', 'g')
+        catch /.*/
+            return
+        endtry
     endif
-
-    if g:rplugin_pdfviewer == "evince"
-        let [basenm, basedir] = SyncTeX_GetMaster()
-        if basedir != '.'
-            exe "cd " . substitute(basedir, ' ', '\\ ', 'g')
-        endif
-        if v:servername != ""
-            call system("python " . g:rplugin_home . "/r-plugin/synctex_evince_backward.py '" . basenm . ".pdf' " . v:servername . " &")
-        endif
-        if basedir != '.'
-            cd -
-        endif
+    let [basenm, basedir] = SyncTeX_GetMaster()
+    if basedir != '.'
+        exe "cd " . substitute(basedir, ' ', '\\ ', 'g')
+    endif
+    let did_evince = 0
+    if !exists("g:rplugin_evince_list")
+        let g:rplugin_evince_list = []
+    else
+        for bb in g:rplugin_evince_list
+            if bb == basenm
+                let did_evince = 1
+                break
+            endif
+        endfor
+    endif
+    if !did_evince
+        call add(g:rplugin_evince_list, basenm)
+        call system("python " . g:rplugin_home . "/r-plugin/synctex_evince_backward.py '" . basenm . ".pdf' " . v:servername . " &")
     endif
     exe "cd " . substitute(olddir, ' ', '\\ ', 'g')
 endfunction
@@ -640,8 +645,8 @@ if g:rplugin_pdfviewer != "none"
         unlet s:key_list
         unlet s:has_key
     endif
-    if g:vimrplugin_synctex
-        call Run_SyncTeX()
+    if g:vimrplugin_synctex && g:rplugin_pdfviewer == "evince" && $DISPLAY != "" && v:servername != ""
+        call Run_EvinceBackward()
     endif
 endif
 

From baef3d0969993eed2fb9d582448cfbdfd44e42bd Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Mon, 4 May 2015 17:40:41 -0400
Subject: [PATCH 0969/1050] Don't wait for either \ao or \so See:
 https://github.com/jcfaria/Vim-R-plugin/issues/173

---
 ftplugin/r_rplugin.vim     | 34 +++++++++++++++++++++-------------
 r-plugin/common_global.vim | 23 ++++++++++++++++++++---
 2 files changed, 41 insertions(+), 16 deletions(-)

diff --git a/ftplugin/r_rplugin.vim b/ftplugin/r_rplugin.vim
index eca0752..4b12562 100644
--- a/ftplugin/r_rplugin.vim
+++ b/ftplugin/r_rplugin.vim
@@ -43,22 +43,30 @@ function! ShowRout()
         let rcmd = b:rplugin_R . " CMD BATCH --no-restore --no-save '" . expand("%") . "' '" . b:routfile . "'"
     endif
 
-    echon "Please wait for: " . rcmd
-    redraw
-    let rlog = system(rcmd)
-    if v:shell_error && rlog != ""
-        call RWarningMsg('Error: "' . rlog . '"')
-        sleep 1
-    endif
-    if filereadable(b:routfile)
-        if g:vimrplugin_routnotab == 1
-            exe "split " . b:routfile
+    if has("win32") || has("win64") || v:servername == ""
+        echon "Please wait for: " . rcmd
+        redraw
+        let rlog = system(rcmd)
+        if v:shell_error && rlog != ""
+            call RWarningMsg('Error: "' . rlog . '"')
+            sleep 1
+        endif
+        if filereadable(b:routfile)
+            if g:vimrplugin_routnotab == 1
+                exe "split " . b:routfile
+            else
+                exe "tabnew " . b:routfile
+            endif
+            set filetype=rout
         else
-            exe "tabnew " . b:routfile
+            call RWarningMsg("The file '" . b:routfile . "' is not readable.")
         endif
-        set filetype=rout
     else
-        call RWarningMsg("The file '" . b:routfile . "' is not readable.")
+        let shlines = [rcmd,
+                    \ 'vim --servername ' . v:servername . " --remote-expr '" . 'GetROutput("' . b:routfile . '")' . "'",
+                    \ 'rm "' . g:rplugin_tmpdir . '/runRcmdbatch.sh' . '"']
+        call writefile(shlines, g:rplugin_tmpdir . '/runRcmdbatch.sh')
+        call system('sh "' .  g:rplugin_tmpdir . '/runRcmdbatch.sh" >/dev/null 2>/dev/null &')
     endif
 endfunction
 
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 8369a44..43ae70f 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -1394,7 +1394,7 @@ function SendLineToRAndInsertOutput()
     if RInsert("print(" . lin . ")")
         let curpos = getpos(".")
         " comment the output
-        let ilines = readfile(substitute(g:rplugin_tmpdir, ' ', '\\ ', 'g') . "/Rinsert")
+        let ilines = readfile(g:rplugin_tmpdir . "/Rinsert")
         for iln in ilines
             call RSimpleCommentLine("normal", "c")
             normal! j
@@ -1482,6 +1482,24 @@ function RGetKeyWord()
     return rkeyword
 endfunction
 
+function GetROutput(outf)
+    if a:outf =~ g:rplugin_tmpdir
+        let tnum = 1
+        while bufexists("so" . tnum)
+            let tnum += 1
+        endwhile
+        exe 'tabnew so' . tnum
+        exe 'read ' . substitute(a:outf, " ", '\\ ', 'g')
+        set filetype=rout
+        setlocal buftype=nofile
+        setlocal noswapfile
+    else
+        exe 'tabnew ' . substitute(a:outf, " ", '\\ ', 'g')
+    endif
+    normal! gT
+    redraw
+endfunction
+
 " Send sources to R
 function RSourceLines(...)
     let lines = a:1
@@ -1498,8 +1516,7 @@ function RSourceLines(...)
     endif
 
     if a:0 == 3 && a:3 == "NewtabInsert"
-        let rcmd = 'base::source("' . g:rplugin_rsource . '", echo=TRUE)'
-        call RInsert(rcmd, "newtab")
+        call SendToVimCom("\x08" . $VIMINSTANCEID . 'vimcom:::vim_capture_source_output("' . g:rplugin_rsource . '", "' . g:rplugin_tmpdir . '/Rinsert")')
         return 1
     endif
 

From a02a0bf5749f28c6f432cc67af538e0d5e3ed631 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Mon, 4 May 2015 17:59:30 -0400
Subject: [PATCH 0970/1050] View data.frame and matrix objects New command: \rv
 New options: vimrplugin_csv_warn, vimrplugin_df_viewer and
 vimrplugin_csv_app.

---
 doc/r-plugin.txt           | 64 +++++++++++++++++++++++++++++---------
 r-plugin/common_global.vim | 41 ++++++++++++++++++++++++
 2 files changed, 90 insertions(+), 15 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index c72d558..c551b08 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -357,10 +357,10 @@ section |r-plugin-indenting| of this document.
 3.6.2 Install additional plugins~
 
 You may be interested in installing additional general plugins to get
-functionality not provided by this file type plugin. ShowMarks and snipMate
-are particularly interesting. Please read |r-plugin-tips| for details. If you
-edit Rnoweb files, you may want to try LaTeX-Box for omnicompletion of LaTeX
-code (see |r-plugin-latex-box| for details).
+functionality not provided by this file type plugin. Particularly interesting
+are vim-signature, csv.vim and snipMate. Please read |r-plugin-tips| for
+details. If you edit Rnoweb files, you may want to try LaTeX-Box for
+omnicompletion of LaTeX code (see |r-plugin-latex-box| for details).
 
 
 ==============================================================================
@@ -441,6 +441,7 @@ Command
   . Print (cur)                                        \rp
   . Names (cur)                                        \rn
   . Structure (cur)                                    \rt
+  . View data.frame (cur)                              \rv
   --------------------------------------------------------
   . Arguments (cur)                                    \ra
   . Example (cur)                                      \re
@@ -549,6 +550,14 @@ in each case:
    summary(x)
    summary(m)
 <
+If the object under the cursor is a data.frame or a matrix, rv
+will show it in a new tab. If the csv.vim plugin is not installed, the
+Vim-R-plugin will warn you about that (see |r-plugin-df-view|). Specially
+useful commands from the csv.vim plugin are |:CSVHeader|, |:ArrangeColumn| and
+|:CSVHiColumn|. It can be installed from:
+
+   http://www.vim.org/scripts/script.php?script_id=2830
+
 When completing object names (CTRL-X CTRL-O) and function arguments (CTRL-X
 CTRL-A) you have to press CTRL-N to go foward in the list and CTRL-P to go
 backward (see |popupmenu-completion|). Note: if using Vim in a terminal
@@ -1209,6 +1218,7 @@ is running:
 |vimrplugin_user_maps_only|    Only set user specified key bindings
 |vimrplugin_tmpdir|            Where temporary files are created
 |vimrplugin_compldir|          Where lists for omnicompletion are stored
+|r-plugin-df-view|             Options for visualizing a data.frame or matrix
 |r-plugin-SyncTeX|             Options for SyncTeX
 
 
@@ -1977,9 +1987,35 @@ want to know they are, while editing an R file, do in Normal mode:
    :echo g:rplugin_compldir
 <
 
+------------------------------------------------------------------------------
+							    *r-plugin-df-view*
+6.34 View a data.frame or matrix~
+
+The csv.vim plugin helps to visualize and edit csv files, and if it is not
+installed, the Vim-R-plugin will warn you about that when you do
+rv. If you do not want to install the csv.vim plugin, put in your
+|vimrc|:
+>
+   let vimrplugin_csv_warn = 0
+<
+If you rather prefer to see the table in a graphical viewer, you should set
+the value of vimrplugin_csv_app in your |vimrc|. Examples:
+>
+   let vimrplugin_csv_app = "localc"
+   let vimrplugin_csv_app = "c:/Program Files (x86)/LibreOffice 4/program/scalc.exe"
+<
+There is also the option of configuring the Vim-R-plugin to run an R command
+to display the data. Example:
+>
+   let vimrplugin_df_viewer = "relimp::showData(%s, font = 'Courier 14')"
+<
+The value of vimrplugin_df_viewer is a string and the substring `%s` is
+replaced by the name of the object under the cursor.
+
+
 ------------------------------------------------------------------------------
 							    *r-plugin-SyncTeX*
-6.34 SyncTeX support~
+6.35 SyncTeX support~
 
 SyncTeX is a set of communication systems used by some PDF viewers and by some
 text editors which allow users to jump from a specific line in the text editor
@@ -2213,6 +2249,7 @@ RD, "cursor down"; RED, both "echo" and "down"):
    RObjectNames
    RObjectPr
    RObjectStr
+   RViewDF
    RSetwd
    RSummary
    RListSpace
@@ -2359,17 +2396,11 @@ mark, the plugin will send from the mark to the end of the file. The mark
 above the cursor is included and the mark below is excluded from the block to
 be sent to R. To create a mark, press m in Normal mode.
 
-We recommended the use of ShowMarks plugin which show what lines have marks
-defined. The plugin is available at:
+We recommended the use of vim-signature which show what lines have marks
+defined. The plugin are available at:
 
-   http://www.vim.org/scripts/script.php?script_id=152
+   https://github.com/kshenoy/vim-signature
 
-You may want to add the following two lines to your |vimrc| to customize
-ShowMarks behavior:
->
-   let marksCloseWhenSelected = 0
-   let showmarks_include = "abcdefghijklmnopqrstuvwxyz"
-<
 
 ------------------------------------------------------------------------------
 							   *r-plugin-snippets*
@@ -2842,10 +2873,13 @@ put in your |vimrc|:
 							       *r-plugin-news*
 10. News~
 
-1.2.5
+1.2.5 (2015-05-02)
 
  * New command to evaluate selection and get output in newtab: \so
 
+ * New command (\rv) and new options (vimrplugin_csv_warn,
+   vimrplugin_csv_app and vimrplugin_df_viewer).
+
  * Bring back the "echo" send commands because some users need them.
 
 1.2.4 (2015-04-22)
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 43ae70f..ce89b74 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -1482,6 +1482,34 @@ function RGetKeyWord()
     return rkeyword
 endfunction
 
+function RViewDF(oname)
+    if exists("g:vimrplugin_csv_app")
+        if !executable(g:vimrplugin_csv_app)
+            call RWarningMsg('vimrplugin_csv_app ("' . g:vimrplugin_csv_app . '") is not executable')
+            return
+        endif
+        normal! :
+        call system('cp "' . g:rplugin_tmpdir . '/Rinsert" "' . a:oname . '.csv"')
+        if has("win32") || has("win64")
+            silent exe '!start "' . g:vimrplugin_csv_app . '" "' . a:oname . '.csv"'
+        else
+            call system(g:vimrplugin_csv_app . ' "' . a:oname . '.csv" >/dev/null 2>/dev/null &')
+        endif
+        return
+    endif
+    echo 'Opening "' . a:oname . '.csv"'
+    silent exe 'tabnew ' . a:oname . '.csv'
+    silent 1,$d
+    silent exe 'read ' . substitute(g:rplugin_tmpdir, " ", '\\ ', 'g') . '/Rinsert'
+    silent 1d
+    set filetype=csv
+    set nomodified
+    redraw
+    if !exists(":CSVTable") && g:vimrplugin_csv_warn
+        call RWarningMsg("csv.vim is not installed (http://www.vim.org/scripts/script.php?script_id=2830)")
+    endif
+endfunction
+
 function GetROutput(outf)
     if a:outf =~ g:rplugin_tmpdir
         let tnum = 1
@@ -2602,6 +2630,16 @@ function RAction(rcmd)
             call g:SendCmdToR(raction)
             return
         endif
+        if a:rcmd == "viewdf"
+            if exists("g:vimrplugin_df_viewer")
+                call g:SendCmdToR(printf(g:vimrplugin_df_viewer, rkeyword))
+            else
+                echo "Wait..."
+                call delete(g:rplugin_tmpdir . "/Rinsert")
+                call SendToVimCom("\x08" . $VIMINSTANCEID . 'vimcom:::vim_viewdf("' . rkeyword . '")')
+            endif
+            return
+        endif
 
         let raction = rfun . "(" . rkeyword . ")"
         call g:SendCmdToR(raction)
@@ -2734,6 +2772,7 @@ function RControlMenu()
     call RCreateMenuItem("nvi", 'Command.Print\ (cur)', 'RObjectPr', 'rp', ':call RAction("print")')
     call RCreateMenuItem("nvi", 'Command.Names\ (cur)', 'RObjectNames', 'rn', ':call RAction("vim.names")')
     call RCreateMenuItem("nvi", 'Command.Structure\ (cur)', 'RObjectStr', 'rt', ':call RAction("str")')
+    call RCreateMenuItem("nvi", 'Command.View\ data\.frame\ (cur)', 'RViewDF', 'rv', ':call RAction("viewdf")')
     "-------------------------------
     menu R.Command.-Sep2- 
     call RCreateMenuItem("nvi", 'Command.Arguments\ (cur)', 'RShowArgs', 'ra', ':call RAction("args")')
@@ -2759,6 +2798,7 @@ function RControlMaps()
     call RCreateMaps("nvi", 'RObjectPr',     'rp', ':call RAction("print")')
     call RCreateMaps("nvi", 'RObjectNames',  'rn', ':call RAction("vim.names")')
     call RCreateMaps("nvi", 'RObjectStr',    'rt', ':call RAction("str")')
+    call RCreateMaps("nvi", 'RViewDF',    'rv', ':call RAction("viewdf")')
 
     " Arguments, example, help
     "-------------------------------------
@@ -3072,6 +3112,7 @@ call RSetDefaultValue("g:vimrplugin_source_args",    "''")
 call RSetDefaultValue("g:vimrplugin_after_start",    "''")
 call RSetDefaultValue("g:vimrplugin_restart",           0)
 call RSetDefaultValue("g:vimrplugin_vsplit",            0)
+call RSetDefaultValue("g:vimrplugin_csv_warn",          1)
 call RSetDefaultValue("g:vimrplugin_rconsole_width",   -1)
 call RSetDefaultValue("g:vimrplugin_rconsole_height",  15)
 call RSetDefaultValue("g:vimrplugin_tmux_title", "'VimR'")

From e66fbe0b5dabbb5c696f3b384bc1f28aeeea5e2b Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Tue, 5 May 2015 09:02:51 -0400
Subject: [PATCH 0971/1050] Set rout colors when gui running

---
 syntax/rout.vim | 25 ++++++++++++++++++++++---
 1 file changed, 22 insertions(+), 3 deletions(-)

diff --git a/syntax/rout.vim b/syntax/rout.vim
index b16742e..f28487f 100644
--- a/syntax/rout.vim
+++ b/syntax/rout.vim
@@ -154,8 +154,27 @@ if exists("g:rout_follow_colorscheme") && g:rout_follow_colorscheme
     hi def link routError	ErrorMsg
     hi def link routWarn	WarningMsg
 else
-    if &t_Co == 256
-        " Defalt 256 colors scheme for R output:
+    if has("gui_running")
+        " Default 256 colors scheme for R output:
+        hi routInput	guifg=#9e9e9e
+        hi routNormal	guifg=#00d700
+        hi routNumber	guifg=#ffaf00
+        hi routInteger	guifg=#ffaf00
+        hi routFloat	guifg=#ffaf00
+        hi routComplex	guifg=#ffaf00
+        hi routNegNum	guifg=#ff875f
+        hi routNegFlt	guifg=#ff875f
+        hi routDate	guifg=#d7af5f
+        hi routFalse	guifg=#ff5f5f
+        hi routTrue	guifg=#5fd787
+        hi routInf      guifg=#00afff
+        hi routConst	guifg=#00af5f
+        hi routString	guifg=#5fffaf
+        hi routError	guifg=#ffffff guibg=#c00000
+        hi routWarn	guifg=#c00000
+        hi routIndex	guifg=#87afaf
+    elseif &t_Co == 256
+        " Default 256 colors scheme for R output:
         hi routInput	ctermfg=247
         hi routNormal	ctermfg=40
         hi routNumber	ctermfg=214
@@ -174,7 +193,7 @@ else
         hi routWarn	ctermfg=1
         hi routIndex	ctermfg=109
     else
-        " Defalt 16 colors scheme for R output:
+        " Default 16 colors scheme for R output:
         hi routInput	ctermfg=gray
         hi routNormal	ctermfg=darkgreen
         hi routNumber	ctermfg=darkyellow

From ff2e971ad9d06a867f9e5a80d811d2074df1748f Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Tue, 5 May 2015 09:25:05 -0400
Subject: [PATCH 0972/1050] Change how colors are customized in rout files

---
 doc/r-plugin.txt | 54 +++++++++++++++++++++++-------------------------
 syntax/rout.vim  | 34 +++++++++++++++---------------
 2 files changed, 43 insertions(+), 45 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index c551b08..7a7f975 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -2055,7 +2055,7 @@ Note: The current knitr package (version 1.7) has at least two limitations:
 
 
 ------------------------------------------------------------------------------
-6.34.1 Evince configuration~
+6.35.1 Evince configuration~
 
 No configuration should be required.
 
@@ -2070,7 +2070,7 @@ to press gp again.
 
 
 ------------------------------------------------------------------------------
-6.34.2 Okular configuration~
+6.35.2 Okular configuration~
 
 You have to configure Okular to call Vim during backward searches.
 In Okular, click in:
@@ -2098,7 +2098,7 @@ of Okular will be started.
 
 
 ------------------------------------------------------------------------------
-6.34.3 Zathura configuration~
+6.35.3 Zathura configuration~
 
 No configuration should be required if Evince is not installed. If evince is
 installed, put in your |vimrc|:
@@ -2115,7 +2115,7 @@ to press gp again.
 
 
 ------------------------------------------------------------------------------
-6.34.4 Skim with MacVim configuration (Mac OS X)~
+6.35.4 Skim with MacVim configuration (Mac OS X)~
 
 You have to configure Skim to call MacVim during backward searches.
 In Skim click in the drop down menu and fill the fields:
@@ -2129,7 +2129,7 @@ In Skim click in the drop down menu and fill the fields:
 <
 
 ------------------------------------------------------------------------------
-6.34.5 Sumatra configuration (Windows)~
+6.35.5 Sumatra configuration (Windows)~
 
 No configuration is required.
 
@@ -2137,7 +2137,7 @@ No configuration is required.
 ------------------------------------------------------------------------------
                                                        *vimrplugin_vim_window*
 				                       *vimrplugin_synctex*
-6.34.6 Configuring the PDF editor and Vim's window title~
+6.35.6 Configuring the PDF editor and Vim's window title~
 
 If SyncTeX does not work (see above), you may try to set in your |vimrc| the
 values of |vimrplugin_pdfviewer| and vimrplugin_vim_window.
@@ -2397,7 +2397,7 @@ above the cursor is included and the mark below is excluded from the block to
 be sent to R. To create a mark, press m in Normal mode.
 
 We recommended the use of vim-signature which show what lines have marks
-defined. The plugin are available at:
+defined. The plugins are available at:
 
    https://github.com/kshenoy/vim-signature
 
@@ -2835,28 +2835,26 @@ Finally, if you want to use vi key bindings in Bash:
 9.20. Syntax highlight of .Rout files~
 
 You can set the foreground colors of R output in your |vimrc|. The example
-below is for a terminal emulator that supports 256 colors (see
-|highlight-ctermfg|):
+below is for a terminal emulator that supports 256 colors (see |:highlight|):
 >
    if &t_Co == 256
-       let rout_color_input = 247
-       let rout_color_normal = 39
-       let rout_color_number = 51
-       let rout_color_integer = 51
-       let rout_color_float = 51
-       let rout_color_complex = 51
-       let rout_color_negnum = 183
-       let rout_color_negfloat = 183
-       let rout_color_date = 43
-       let rout_color_true = 78
-       let rout_color_false = 203
-       let rout_color_inf = 39
-       let rout_color_constant = 75
-       let rout_color_string = 79
-       let rout_color_stderr = 33
-       let rout_color_error = 15
-       let rout_color_warn = 1
-       let rout_color_index = 186
+       let rout_color_input    = 'ctermfg=247'
+       let rout_color_normal   = 'ctermfg=39'
+       let rout_color_number   = 'ctermfg=51'
+       let rout_color_integer  = 'ctermfg=51'
+       let rout_color_float    = 'ctermfg=51'
+       let rout_color_complex  = 'ctermfg=51'
+       let rout_color_negnum   = 'ctermfg=183'
+       let rout_color_negfloat = 'ctermfg=183'
+       let rout_color_date     = 'ctermfg=43'
+       let rout_color_true     = 'ctermfg=78'
+       let rout_color_false    = 'ctermfg=203'
+       let rout_color_inf      = 'ctermfg=39'
+       let rout_color_constant = 'ctermfg=75'
+       let rout_color_string   = 'ctermfg=79'
+       let rout_color_error    = 'ctermfg=15 ctermbg=1'
+       let rout_color_warn     = 'ctermfg=1'
+       let rout_color_index    = 'ctermfg=186'
    endif
 <
 To know what number corresponds to your preferred color (among the 256
@@ -2873,7 +2871,7 @@ put in your |vimrc|:
 							       *r-plugin-news*
 10. News~
 
-1.2.5 (2015-05-02)
+1.2.5 (2015-05-04)
 
  * New command to evaluate selection and get output in newtab: \so
 
diff --git a/syntax/rout.vim b/syntax/rout.vim
index f28487f..0c38a03 100644
--- a/syntax/rout.vim
+++ b/syntax/rout.vim
@@ -215,55 +215,55 @@ else
 
     " Change colors under user request:
     if exists("g:rout_color_input")
-        exe "hi routInput ctermfg=" . g:rout_color_input
+        exe "hi routInput " . g:rout_color_input
     endif
     if exists("g:rout_color_normal")
-        exe "hi routNormal ctermfg=" . g:rout_color_normal
+        exe "hi routNormal " . g:rout_color_normal
     endif
     if exists("g:rout_color_number")
-        exe "hi routNumber ctermfg=" . g:rout_color_number
+        exe "hi routNumber " . g:rout_color_number
     endif
     if exists("g:rout_color_integer")
-        exe "hi routInteger ctermfg=" . g:rout_color_integer
+        exe "hi routInteger " . g:rout_color_integer
     endif
     if exists("g:rout_color_float")
-        exe "hi routFloat ctermfg=" . g:rout_color_float
+        exe "hi routFloat " . g:rout_color_float
     endif
     if exists("g:rout_color_complex")
-        exe "hi routComplex ctermfg=" . g:rout_color_complex
+        exe "hi routComplex " . g:rout_color_complex
     endif
     if exists("g:rout_color_negnum")
-        exe "hi routNegNum ctermfg=" . g:rout_color_negnum
+        exe "hi routNegNum " . g:rout_color_negnum
     endif
     if exists("g:rout_color_negfloat")
-        exe "hi routNegFlt ctermfg=" . g:rout_color_negfloat
+        exe "hi routNegFlt " . g:rout_color_negfloat
     endif
     if exists("g:rout_color_date")
-        exe "hi routDate ctermfg=" . g:rout_color_date
+        exe "hi routDate " . g:rout_color_date
     endif
     if exists("g:rout_color_false")
-        exe "hi routFalse ctermfg=" . g:rout_color_false
+        exe "hi routFalse " . g:rout_color_false
     endif
     if exists("g:rout_color_true")
-        exe "hi routTrue ctermfg=" . g:rout_color_true
+        exe "hi routTrue " . g:rout_color_true
     endif
     if exists("g:rout_color_inf")
-        exe "hi routInf ctermfg=" . g:rout_color_inf
+        exe "hi routInf " . g:rout_color_inf
     endif
     if exists("g:rout_color_constant")
-        exe "hi routConst ctermfg=" . g:rout_color_constant
+        exe "hi routConst " . g:rout_color_constant
     endif
     if exists("g:rout_color_string")
-        exe "hi routString ctermfg=" . g:rout_color_string
+        exe "hi routString " . g:rout_color_string
     endif
     if exists("g:rout_color_error")
-        exe "hi routError ctermfg=" . g:rout_color_error
+        exe "hi routError " . g:rout_color_error
     endif
     if exists("g:rout_color_warn")
-        exe "hi routWarn ctermfg=" . g:rout_color_warn
+        exe "hi routWarn " . g:rout_color_warn
     endif
     if exists("g:rout_color_index")
-        exe "hi routIndex ctermfg=" . g:rout_color_index
+        exe "hi routIndex " . g:rout_color_index
     endif
 endif
 

From b07a29416d072eeaea1fc39825003dbbf083eed0 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Tue, 5 May 2015 09:40:36 -0400
Subject: [PATCH 0973/1050] Replace b:rplugin_R with g:rplugin_R The use of
 'b:' was due to the now deleted global_r_plugin.vim.

---
 ftplugin/r_rplugin.vim     |  6 +----
 r-plugin/common_global.vim | 48 +++++++++++++++++++-------------------
 r-plugin/windows.vim       |  5 ----
 3 files changed, 25 insertions(+), 34 deletions(-)

diff --git a/ftplugin/r_rplugin.vim b/ftplugin/r_rplugin.vim
index 4b12562..3b661dd 100644
--- a/ftplugin/r_rplugin.vim
+++ b/ftplugin/r_rplugin.vim
@@ -30,17 +30,13 @@ function! ShowRout()
         call delete(b:routfile)
     endif
 
-    if !exists("b:rplugin_R")
-        call SetRPath()
-    endif
-
     " if not silent, the user will have to type 
     silent update
 
     if has("win32") || has("win64")
         let rcmd = 'Rcmd.exe BATCH --no-restore --no-save "' . expand("%") . '" "' . b:routfile . '"'
     else
-        let rcmd = b:rplugin_R . " CMD BATCH --no-restore --no-save '" . expand("%") . "' '" . b:routfile . "'"
+        let rcmd = g:rplugin_R . " CMD BATCH --no-restore --no-save '" . expand("%") . "' '" . b:routfile . "'"
     endif
 
     if has("win32") || has("win64") || v:servername == ""
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index ce89b74..503450d 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -837,9 +837,6 @@ function StartR(whatr)
     endif
     call writefile(start_options, g:rplugin_tmpdir . "/start_options.R")
 
-    if !exists("b:rplugin_R")
-        call SetRPath()
-    endif
     if !exists("g:vimrplugin_r_args")
         let b:rplugin_r_args = " "
     else
@@ -904,9 +901,9 @@ function StartR(whatr)
     endif
 
     if b:rplugin_r_args == " "
-        let rcmd = b:rplugin_R
+        let rcmd = g:rplugin_R
     else
-        let rcmd = b:rplugin_R . " " . b:rplugin_r_args
+        let rcmd = g:rplugin_R . " " . b:rplugin_r_args
     endif
 
     if g:rplugin_do_tmux_split
@@ -2937,6 +2934,7 @@ function RCreateSendMaps()
     call RCreateMaps("v", 'RESendSelection',  'se', ':call SendSelectionToR("echo", "stay")')
     call RCreateMaps("v", 'RDSendSelection',  'sd', ':call SendSelectionToR("silent", "down")')
     call RCreateMaps("v", 'REDSendSelection', 'sa', ':call SendSelectionToR("echo", "down")')
+    call RCreateMaps('v', 'RSendSelAndInsertOutput', 'so', ':call SendSelectionToR("echo", "stay", "NewtabInsert")')
 
     " Paragraph
     "-------------------------------------
@@ -2953,16 +2951,13 @@ function RCreateSendMaps()
     "-------------------------------------
     call RCreateMaps("ni", 'RSendLine', 'l', ':call SendLineToR("stay")')
     call RCreateMaps('ni0', 'RDSendLine', 'd', ':call SendLineToR("down")')
+    call RCreateMaps('ni0', 'RDSendLineAndInsertOutput', 'o', ':call SendLineToRAndInsertOutput()')
     call RCreateMaps('i', 'RSendLAndOpenNewOne', 'q', ':call SendLineToR("newline")')
     call RCreateMaps('n', 'RNLeftPart', 'r', ':call RSendPartOfLine("left", 0)')
     call RCreateMaps('n', 'RNRightPart', 'r', ':call RSendPartOfLine("right", 0)')
     call RCreateMaps('i', 'RILeftPart', 'r', 'l:call RSendPartOfLine("left", 1)')
     call RCreateMaps('i', 'RIRightPart', 'r', 'l:call RSendPartOfLine("right", 1)')
 
-    " *Run and insert output*
-    call RCreateMaps('ni0', 'RDSendLineAndInsertOutput', 'o', ':call SendLineToRAndInsertOutput()')
-    call RCreateMaps('v', 'RSendSelAndInsertOutput', 'so', ':call SendSelectionToR("echo", "stay", "NewtabInsert")')
-
     " For compatibility with Johannes Ranke's plugin
     if g:vimrplugin_map_r == 1
         vnoremap  r :call SendSelectionToR("silent", "down")
@@ -3011,20 +3006,6 @@ function RVimLeave()
     endif
 endfunction
 
-function SetRPath()
-    if exists("g:vimrplugin_r_path")
-        let b:rplugin_R = expand(g:vimrplugin_r_path)
-        if isdirectory(b:rplugin_R)
-            let b:rplugin_R = b:rplugin_R . "/R"
-        endif
-    else
-        let b:rplugin_R = "R"
-    endif
-    if !executable(b:rplugin_R)
-        call RWarningMsgInp("R executable not found: '" . b:rplugin_R . "'")
-    endif
-endfunction
-
 function RSourceOtherScripts()
     if exists("g:vimrplugin_source")
         let flist = split(g:vimrplugin_source, ",")
@@ -3469,9 +3450,28 @@ if has("win32") || has("win64")
     runtime r-plugin/windows.vim
     let g:rplugin_has_icons = len(globpath(&rtp, "bitmaps/RStart.bmp")) > 0
 else
-    call SetRPath()
     let g:rplugin_has_icons = len(globpath(&rtp, "bitmaps/RStart.png")) > 0
 endif
+
+" Set the value of R path
+if exists("g:vimrplugin_r_path")
+    let g:rplugin_R = expand(g:vimrplugin_r_path)
+    if isdirectory(g:rplugin_R)
+        let g:rplugin_R = g:rplugin_R . "/R"
+    endif
+elseif has("win32") || has("win64")
+    if g:vimrplugin_Rterm
+        let g:rplugin_R = "Rgui.exe"
+    else
+        let g:rplugin_R = "Rterm.exe"
+    endif
+else
+    let g:rplugin_R = "R"
+endif
+if !executable(g:rplugin_R)
+    call RWarningMsgInp("R executable not found: '" . g:rplugin_R . "'")
+endif
+
 if has("gui_running")
     runtime r-plugin/gui_running.vim
 endif
diff --git a/r-plugin/windows.vim b/r-plugin/windows.vim
index d635dc5..810889a 100644
--- a/r-plugin/windows.vim
+++ b/r-plugin/windows.vim
@@ -16,11 +16,6 @@ unlet s:sleeptime
 
 let g:rplugin_sleeptime = g:vimrplugin_sleeptime . 'm'
 
-if g:vimrplugin_Rterm
-    let b:rplugin_R = "Rgui.exe"
-else
-    let b:rplugin_R = "Rterm.exe"
-endif
 if !exists("g:rplugin_rpathadded")
     if exists("g:vimrplugin_r_path")
         if !isdirectory(g:vimrplugin_r_path)

From 855edb24863586b2f506b905d3f390ad4b2f2a7d Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Wed, 6 May 2015 08:26:52 -0400
Subject: [PATCH 0974/1050] Version 1.2.5

---
 doc/r-plugin.txt           | 25 +++++++++++++------------
 r-plugin/common_global.vim |  7 +++----
 2 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 7a7f975..6bfca19 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -115,7 +115,7 @@ dependencies:
 
     * R's version must be >= 3.0.0: http://www.r-project.org/
 
-    * vimcom = 1.2-3: http://www.lepem.ufc.br/jaa/vimcom.html
+    * vimcom = 1.2-5: http://www.lepem.ufc.br/jaa/vimcom.html
 
       Note: If you cannot build vimcom yourself, you will want to
       download and install the zip file.
@@ -152,7 +152,7 @@ Before installing the plugin, you should install its dependencies:
 
    R >= 3.0.0: http://www.r-project.org/
 
-   vimcom = 1.2-3: http://www.lepem.ufc.br/jaa/vimcom.html
+   vimcom = 1.2-5: http://www.lepem.ufc.br/jaa/vimcom.html
 
    Only if you edit Rnoweb files: MacTeX, BasicTeX or other LaTeX system.
 
@@ -206,7 +206,7 @@ Before installing the plugin, you should install its dependencies:
 
    R >= 3.0.0: http://www.r-project.org/
 
-   vimcom = 1.2-3: http://www.lepem.ufc.br/jaa/vimcom.html
+   vimcom = 1.2-5: http://www.lepem.ufc.br/jaa/vimcom.html
 
    Tmux >= 1.8:   http://tmux.sourceforge.net
                   Tmux is necessary to send commands from Vim to R Console.
@@ -689,14 +689,13 @@ the currently loaded libraries. The Object Browser requires the
 to correctly align list items.
 
 In the .GlobalEnv view, if an object has the attribute "label", it will also
-be displayed. Please, see the R help for package vimcom for some options
-to control the Object Browser behavior. In the Object Browser window, while in
-Normal mode, you can either press  or double click (GVim only) over a
-data.frame or list to show/hide its elements (not if viewing the content of
-loaded libraries). If you are running R in an environment where the string
-UTF-8 is part of either LC_MESSAGES or LC_ALL variables, unicode line drawing
-characters will be used to draw lines in the Object Browser. This is the case
-of most Linux distributions.
+be displayed. In the Object Browser window, while in Normal mode, you can
+either press  or double click (GVim only) over a data.frame or list to
+show/hide its elements (not if viewing the content of loaded libraries). If
+you are running R in an environment where the string UTF-8 is part of either
+LC_MESSAGES or LC_ALL variables, unicode line drawing characters will be used
+to draw lines in the Object Browser. This is the case of most Linux
+distributions.
 
 In the Libraries view, you can either double click or press  on a
 library name to see its objects. In the Object Browser the libraries have the
@@ -2871,10 +2870,12 @@ put in your |vimrc|:
 							       *r-plugin-news*
 10. News~
 
-1.2.5 (2015-05-04)
+1.2.5 (2015-05-06)
 
  * New command to evaluate selection and get output in newtab: \so
 
+ * The command \ao no longer blocks Vim.
+
  * New command (\rv) and new options (vimrplugin_csv_warn,
    vimrplugin_csv_app and vimrplugin_df_viewer).
 
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 503450d..757ffc6 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -821,7 +821,7 @@ function StartR(whatr)
     else
         let start_options += ['options(vimcom.vimpager = TRUE)']
     endif
-    let start_options += ['if(utils::packageVersion("vimcom") != "1.2.4.1") warning("Your version of Vim-R-plugin requires vimcom-1.2-4.1.", call. = FALSE)']
+    let start_options += ['if(utils::packageVersion("vimcom") != "1.2.5") warning("Your version of Vim-R-plugin requires vimcom-1.2-5.", call. = FALSE)']
 
     let rwd = ""
     if g:vimrplugin_vim_wd == 0
@@ -994,8 +994,8 @@ function WaitVimComStart()
         if !filereadable(g:rplugin_vimcom_lib)
             call RWarningMsgInp('Could not find "' . g:rplugin_vimcom_lib . '".')
         endif
-        if g:rplugin_vimcom_version != "1.2.4.1"
-            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.2.4.1.')
+        if g:rplugin_vimcom_version != "1.2.5"
+            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.2.5.')
             sleep 1
         endif
         call delete(g:rplugin_tmpdir . "/vimcom_running_" . $VIMINSTANCEID)
@@ -3025,7 +3025,6 @@ command RBuildTags :call g:SendCmdToR('rtags(ofile = "TAGS")')
 command -nargs=? -complete=customlist,RLisObjs Rhelp :call RAskHelp()
 command -nargs=? -complete=dir RSourceDir :call RSourceDirectory()
 command RStop :call StopR()
-command Rhistory :call ShowRhistory()
 
 
 "==========================================================================

From dc56a6d1b66e8cf5408e9371f4b54556ea24d034 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Fri, 8 May 2015 23:16:04 -0400
Subject: [PATCH 0975/1050] Move all menu functions to rplugin/gui_running.vim

---
 ftplugin/rbrowser.vim      | 10 -----
 r-plugin/common_global.vim | 74 ---------------------------------
 r-plugin/gui_running.vim   | 84 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 84 insertions(+), 84 deletions(-)

diff --git a/ftplugin/rbrowser.vim b/ftplugin/rbrowser.vim
index 5ed6fae..29d36e4 100644
--- a/ftplugin/rbrowser.vim
+++ b/ftplugin/rbrowser.vim
@@ -295,16 +295,6 @@ function! RBrowserGetName(cleantail, cleantick)
     endif
 endfunction
 
-function! MakeRBrowserMenu()
-    let g:rplugin_curbuf = bufname("%")
-    if g:rplugin_hasmenu == 1
-        return
-    endif
-    menutranslate clear
-    call RControlMenu()
-    call RBrowserMenu()
-endfunction
-
 function! ObBrBufUnload()
     if exists("g:rplugin_editor_sname")
         call system("tmux select-pane -t " . g:rplugin_vim_pane)
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 757ffc6..58cc6fc 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -2643,12 +2643,6 @@ function RAction(rcmd)
     endif
 endfunction
 
-if exists('g:maplocalleader')
-    let s:tll = '' . g:maplocalleader
-else
-    let s:tll = '\\'
-endif
-
 redir => s:ikblist
 silent imap
 redir END
@@ -2715,74 +2709,6 @@ function RVMapCmd(plug)
     endfor
 endfunction
 
-function RCreateMenuItem(type, label, plug, combo, target)
-    if a:type =~ '0'
-        let tg = a:target . '0'
-        let il = 'i'
-    else
-        let tg = a:target . ''
-        let il = 'a'
-    endif
-    if a:type =~ "n"
-        if hasmapto(a:plug, "n")
-            let boundkey = RNMapCmd(a:plug)
-            exec 'nmenu  &R.' . a:label . '' . boundkey . ' ' . tg
-        else
-            exec 'nmenu  &R.' . a:label . s:tll . a:combo . ' ' . tg
-        endif
-    endif
-    if a:type =~ "v"
-        if hasmapto(a:plug, "v")
-            let boundkey = RVMapCmd(a:plug)
-            exec 'vmenu  &R.' . a:label . '' . boundkey . ' ' . '' . tg
-        else
-            exec 'vmenu  &R.' . a:label . s:tll . a:combo . ' ' . '' . tg
-        endif
-    endif
-    if a:type =~ "i"
-        if hasmapto(a:plug, "i")
-            let boundkey = RIMapCmd(a:plug)
-            exec 'imenu  &R.' . a:label . '' . boundkey . ' ' . '' . tg . il
-        else
-            exec 'imenu  &R.' . a:label . s:tll . a:combo . ' ' . '' . tg . il
-        endif
-    endif
-endfunction
-
-function RBrowserMenu()
-    call RCreateMenuItem("nvi", 'Object\ browser.Show/Update', 'RUpdateObjBrowser', 'ro', ':call RObjBrowser()')
-    call RCreateMenuItem("nvi", 'Object\ browser.Expand\ (all\ lists)', 'ROpenLists', 'r=', ':call g:RBrOpenCloseLs(1)')
-    call RCreateMenuItem("nvi", 'Object\ browser.Collapse\ (all\ lists)', 'RCloseLists', 'r-', ':call g:RBrOpenCloseLs(0)')
-    if &filetype == "rbrowser"
-        imenu  R.Object\ browser.Toggle\ (cur)Enter :call RBrowserDoubleClick()
-        nmenu  R.Object\ browser.Toggle\ (cur)Enter :call RBrowserDoubleClick()
-    endif
-    let g:rplugin_hasmenu = 1
-endfunction
-
-function RControlMenu()
-    call RCreateMenuItem("nvi", 'Command.List\ space', 'RListSpace', 'rl', ':call g:SendCmdToR("ls()")')
-    call RCreateMenuItem("nvi", 'Command.Clear\ console\ screen', 'RClearConsole', 'rr', ':call RClearConsole()')
-    call RCreateMenuItem("nvi", 'Command.Clear\ all', 'RClearAll', 'rm', ':call RClearAll()')
-    "-------------------------------
-    menu R.Command.-Sep1- 
-    call RCreateMenuItem("nvi", 'Command.Print\ (cur)', 'RObjectPr', 'rp', ':call RAction("print")')
-    call RCreateMenuItem("nvi", 'Command.Names\ (cur)', 'RObjectNames', 'rn', ':call RAction("vim.names")')
-    call RCreateMenuItem("nvi", 'Command.Structure\ (cur)', 'RObjectStr', 'rt', ':call RAction("str")')
-    call RCreateMenuItem("nvi", 'Command.View\ data\.frame\ (cur)', 'RViewDF', 'rv', ':call RAction("viewdf")')
-    "-------------------------------
-    menu R.Command.-Sep2- 
-    call RCreateMenuItem("nvi", 'Command.Arguments\ (cur)', 'RShowArgs', 'ra', ':call RAction("args")')
-    call RCreateMenuItem("nvi", 'Command.Example\ (cur)', 'RShowEx', 're', ':call RAction("example")')
-    call RCreateMenuItem("nvi", 'Command.Help\ (cur)', 'RHelp', 'rh', ':call RAction("help")')
-    "-------------------------------
-    menu R.Command.-Sep3- 
-    call RCreateMenuItem("nvi", 'Command.Summary\ (cur)', 'RSummary', 'rs', ':call RAction("summary")')
-    call RCreateMenuItem("nvi", 'Command.Plot\ (cur)', 'RPlot', 'rg', ':call RAction("plot")')
-    call RCreateMenuItem("nvi", 'Command.Plot\ and\ summary\ (cur)', 'RSPlot', 'rb', ':call RAction("plotsumm")')
-    let g:rplugin_hasmenu = 1
-endfunction
-
 function RControlMaps()
     " List space, clear console, clear all
     "-------------------------------------
diff --git a/r-plugin/gui_running.vim b/r-plugin/gui_running.vim
index 09a30d7..cc753d8 100644
--- a/r-plugin/gui_running.vim
+++ b/r-plugin/gui_running.vim
@@ -5,6 +5,80 @@ if exists("g:did_r_plugin_gui_running")
 endif
 let g:did_r_plugin_gui_running = 1
 
+if exists('g:maplocalleader')
+    let s:tll = '' . g:maplocalleader
+else
+    let s:tll = '\\'
+endif
+
+function RCreateMenuItem(type, label, plug, combo, target)
+    if a:type =~ '0'
+        let tg = a:target . '0'
+        let il = 'i'
+    else
+        let tg = a:target . ''
+        let il = 'a'
+    endif
+    if a:type =~ "n"
+        if hasmapto(a:plug, "n")
+            let boundkey = RNMapCmd(a:plug)
+            exec 'nmenu  &R.' . a:label . '' . boundkey . ' ' . tg
+        else
+            exec 'nmenu  &R.' . a:label . s:tll . a:combo . ' ' . tg
+        endif
+    endif
+    if a:type =~ "v"
+        if hasmapto(a:plug, "v")
+            let boundkey = RVMapCmd(a:plug)
+            exec 'vmenu  &R.' . a:label . '' . boundkey . ' ' . '' . tg
+        else
+            exec 'vmenu  &R.' . a:label . s:tll . a:combo . ' ' . '' . tg
+        endif
+    endif
+    if a:type =~ "i"
+        if hasmapto(a:plug, "i")
+            let boundkey = RIMapCmd(a:plug)
+            exec 'imenu  &R.' . a:label . '' . boundkey . ' ' . '' . tg . il
+        else
+            exec 'imenu  &R.' . a:label . s:tll . a:combo . ' ' . '' . tg . il
+        endif
+    endif
+endfunction
+
+function RBrowserMenu()
+    call RCreateMenuItem("nvi", 'Object\ browser.Show/Update', 'RUpdateObjBrowser', 'ro', ':call RObjBrowser()')
+    call RCreateMenuItem("nvi", 'Object\ browser.Expand\ (all\ lists)', 'ROpenLists', 'r=', ':call g:RBrOpenCloseLs(1)')
+    call RCreateMenuItem("nvi", 'Object\ browser.Collapse\ (all\ lists)', 'RCloseLists', 'r-', ':call g:RBrOpenCloseLs(0)')
+    if &filetype == "rbrowser"
+        imenu  R.Object\ browser.Toggle\ (cur)Enter :call RBrowserDoubleClick()
+        nmenu  R.Object\ browser.Toggle\ (cur)Enter :call RBrowserDoubleClick()
+    endif
+    let g:rplugin_hasmenu = 1
+endfunction
+
+function RControlMenu()
+    call RCreateMenuItem("nvi", 'Command.List\ space', 'RListSpace', 'rl', ':call g:SendCmdToR("ls()")')
+    call RCreateMenuItem("nvi", 'Command.Clear\ console\ screen', 'RClearConsole', 'rr', ':call RClearConsole()')
+    call RCreateMenuItem("nvi", 'Command.Clear\ all', 'RClearAll', 'rm', ':call RClearAll()')
+    "-------------------------------
+    menu R.Command.-Sep1- 
+    call RCreateMenuItem("nvi", 'Command.Print\ (cur)', 'RObjectPr', 'rp', ':call RAction("print")')
+    call RCreateMenuItem("nvi", 'Command.Names\ (cur)', 'RObjectNames', 'rn', ':call RAction("vim.names")')
+    call RCreateMenuItem("nvi", 'Command.Structure\ (cur)', 'RObjectStr', 'rt', ':call RAction("str")')
+    call RCreateMenuItem("nvi", 'Command.View\ data\.frame\ (cur)', 'RViewDF', 'rv', ':call RAction("viewdf")')
+    "-------------------------------
+    menu R.Command.-Sep2- 
+    call RCreateMenuItem("nvi", 'Command.Arguments\ (cur)', 'RShowArgs', 'ra', ':call RAction("args")')
+    call RCreateMenuItem("nvi", 'Command.Example\ (cur)', 'RShowEx', 're', ':call RAction("example")')
+    call RCreateMenuItem("nvi", 'Command.Help\ (cur)', 'RHelp', 'rh', ':call RAction("help")')
+    "-------------------------------
+    menu R.Command.-Sep3- 
+    call RCreateMenuItem("nvi", 'Command.Summary\ (cur)', 'RSummary', 'rs', ':call RAction("summary")')
+    call RCreateMenuItem("nvi", 'Command.Plot\ (cur)', 'RPlot', 'rg', ':call RAction("plot")')
+    call RCreateMenuItem("nvi", 'Command.Plot\ and\ summary\ (cur)', 'RSPlot', 'rb', ':call RAction("plotsumm")')
+    let g:rplugin_hasmenu = 1
+endfunction
+
 function MakeRMenu()
     if g:rplugin_hasmenu == 1
         return
@@ -300,3 +374,13 @@ function UnMakeRMenu()
     endif
 endfunction
 
+function MakeRBrowserMenu()
+    let g:rplugin_curbuf = bufname("%")
+    if g:rplugin_hasmenu == 1
+        return
+    endif
+    menutranslate clear
+    call RControlMenu()
+    call RBrowserMenu()
+endfunction
+

From 2ec00943df2aaf1dc8e7c480e9d7fb2483c74151 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Wed, 13 May 2015 16:56:50 -0400
Subject: [PATCH 0976/1050] The screenR.vim has new maintainer and address

---
 doc/r-plugin.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 6bfca19..e576cb0 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -1844,7 +1844,7 @@ features:
    https://github.com/mllg/vim-devtools-plugin
 
    Basic integration with GNU screen~
-   https://github.com/jalvesaq/screenR
+   https://github.com/ssayols/screenR
 
 
 ------------------------------------------------------------------------------

From eebe4f4a4990e88e68222b033c882352e4fd1d69 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Fri, 15 May 2015 20:58:24 -0400
Subject: [PATCH 0977/1050] Remove option vimrplugin_vim_window

---
 doc/r-plugin.txt            | 90 ++++++++++++-------------------------
 ftplugin/rnoweb_rplugin.vim |  4 +-
 r-plugin/common_global.vim  | 16 ++-----
 3 files changed, 34 insertions(+), 76 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index e576cb0..a3ef468 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -5,7 +5,7 @@
 Authors: Jakson A. Aquino   
          Jose Claudio Faria 
 
-Version: 1.2.5
+Version: 1.2.6
 For Vim version 7.4
 
  1. Overview                                    |r-plugin-overview|
@@ -2021,12 +2021,15 @@ text editors which allow users to jump from a specific line in the text editor
 to the corresponding line in the PDF viewer and vice-versa. The Vim-R-plugin
 has support for Evince, Zathura and Okular SyncTeX systems.
 
+To completely disable SyncTeX support, put in your |vimrc|:
+>
+   let vimrplugin_synctex = 0
+<
 The application `wmctrl` is required to raise both the PDF viewer and Vim
-windows. Limitation: the Vim-R-plugin may raise the wrong terminal window or
-GVim window if there is more than one open.
+windows.
 
-No configuration is required if you use Evince, Gnome-Terminal, the knitr
-package, and single file Rnoweb documents. Otherwise, keep reading...
+No configuration is required if you use Evince and the knitr package, and
+single file Rnoweb documents. Otherwise, keep reading...
 
 If you use `Sweave()` rather than `knit()`, you must put in your Rnoweb
 document:
@@ -2044,7 +2047,7 @@ document.
 Note: The current knitr package (version 1.7) has at least two limitations:
 
    - It has no SyncTeX support for child documents. The correspondence data
-     point to lines right below child chunks in the master document and not to
+     point to lines just below child chunks in the master document and not to
      somewhere in the child documents themselves. See:
      https://github.com/yihui/knitr/issues/225
 
@@ -2058,11 +2061,6 @@ Note: The current knitr package (version 1.7) has at least two limitations:
 
 No configuration should be required.
 
-If you have Evince installed, the Vim-R-plugin assumes that you are using it
-to view PDF documents and that you run either GVim or Vim in Gnome-Terminal.
-If you run Vim in another terminal emulator, you have to set the value of
-|vimrplugin_vim_window|, as explained below.
-
 Note: If Evince is not started yet when you try to jump to the PDF document
 for the first time, it will start, but will not jump to desired line; you have
 to press gp again.
@@ -2084,13 +2082,10 @@ In the command above, replace `vim` with `gvim` if you use GVim.
 
 If Evince is not installed in your system, the Vim-R-plugin will automatically
 use Okular as the PDF viewer. Otherwise, you have to set the value of
-|vimrplugin_pdfviewer| to "okular".
-
-If the Vim-R-plugin is set to use Okular as the PDF viewer, it assumes that
-you run either GVim or Vim in Konsole. If you run Vim in another terminal
-emulator, you have to set the value of |vimrplugin_vim_window|, as explained
-below.
-
+|vimrplugin_pdfviewer| to "okular":
+>
+   let vimrplugin_pdfviewer = "okular"
+<
 Note: If the PDF document is already open the first time that you jump to it,
 and if Okular was not started with the `--unique` argument, another instance
 of Okular will be started.
@@ -2104,9 +2099,7 @@ installed, put in your |vimrc|:
 >
    let vimrplugin_pdfviewer = "zathura"
 <
-Zathura (version >= 0.3.1) is also supported. If the terminal emulator is not
-raised during backward search (from PDF to Vim), you have to set the value of
-|vimrplugin_vim_window|, as explained below.
+Zathura version must be >= 0.3.1.
 
 Note: If Zathura is not started yet when you try to jump to the PDF document
 for the first time, it will start, but will not jump to desired line; you have
@@ -2133,37 +2126,6 @@ In Skim click in the drop down menu and fill the fields:
 No configuration is required.
 
 
-------------------------------------------------------------------------------
-                                                       *vimrplugin_vim_window*
-				                       *vimrplugin_synctex*
-6.35.6 Configuring the PDF editor and Vim's window title~
-
-If SyncTeX does not work (see above), you may try to set in your |vimrc| the
-values of |vimrplugin_pdfviewer| and vimrplugin_vim_window.
-
-The valid values for |vimrplugin_pdfviewer| are "evince", "okular" and
-"zathura".
-
-To know the correct value of vimrplugin_vim_window, type in the terminal
-emulator:
->
-   wmctrl -xl
-<
-This command will list the windows currently running under the X Window
-system. You must set the value of vimrplugin_vim_window as a string that is
-part of the title of the window where Vim is running ("GVim", "Terminal",
-"Konsole", "yourlogin", "vim", etc).
-
-Example of |vimrc| configuration:
->
-   let vimrplugin_pdfviewer = "okular"
-   let vimrplugin_vim_window = "XTerm"
-<
-To completely disable SyncTeX support, put in your |vimrc|:
->
-   let vimrplugin_synctex = 0
-<
-
 ==============================================================================
 						       *r-plugin-key-bindings*
 7. Custom key bindings~
@@ -2838,19 +2800,19 @@ below is for a terminal emulator that supports 256 colors (see |:highlight|):
 >
    if &t_Co == 256
        let rout_color_input    = 'ctermfg=247'
-       let rout_color_normal   = 'ctermfg=39'
-       let rout_color_number   = 'ctermfg=51'
-       let rout_color_integer  = 'ctermfg=51'
-       let rout_color_float    = 'ctermfg=51'
-       let rout_color_complex  = 'ctermfg=51'
-       let rout_color_negnum   = 'ctermfg=183'
-       let rout_color_negfloat = 'ctermfg=183'
-       let rout_color_date     = 'ctermfg=43'
+       let rout_color_normal   = 'ctermfg=202'
+       let rout_color_number   = 'ctermfg=214'
+       let rout_color_integer  = 'ctermfg=214'
+       let rout_color_float    = 'ctermfg=214'
+       let rout_color_complex  = 'ctermfg=214'
+       let rout_color_negnum   = 'ctermfg=209'
+       let rout_color_negfloat = 'ctermfg=209'
+       let rout_color_date     = 'ctermfg=184'
        let rout_color_true     = 'ctermfg=78'
        let rout_color_false    = 'ctermfg=203'
        let rout_color_inf      = 'ctermfg=39'
-       let rout_color_constant = 'ctermfg=75'
-       let rout_color_string   = 'ctermfg=79'
+       let rout_color_constant = 'ctermfg=179'
+       let rout_color_string   = 'ctermfg=172'
        let rout_color_error    = 'ctermfg=15 ctermbg=1'
        let rout_color_warn     = 'ctermfg=1'
        let rout_color_index    = 'ctermfg=186'
@@ -2870,6 +2832,10 @@ put in your |vimrc|:
 							       *r-plugin-news*
 10. News~
 
+1.2.6
+
+ * Remove option vimrplugin_vim_window (use $WINDOWID instead).
+
 1.2.5 (2015-05-06)
 
  * New command to evaluate selection and get output in newtab: \so
diff --git a/ftplugin/rnoweb_rplugin.vim b/ftplugin/rnoweb_rplugin.vim
index 1c6d9ec..593321a 100644
--- a/ftplugin/rnoweb_rplugin.vim
+++ b/ftplugin/rnoweb_rplugin.vim
@@ -444,8 +444,8 @@ function! SyncTeX_backward(fname, ln)
     let rnwf = substitute(rnwf, '^\./', '', '')
 
     if GoToBuf(rnwbn, rnwf, basedir, rnwln)
-        if g:rplugin_has_wmctrl
-            call system("wmctrl -xa " . g:vimrplugin_vim_window)
+        if g:rplugin_has_wmctrl && v:windowid != 0
+            call system("wmctrl -ia " . v:windowid)
         elseif has("gui_running")
             call foreground()
         endif
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 58cc6fc..1daebe8 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -2412,18 +2412,6 @@ function RSetPDFViewer()
             endif
         endif
     endif
-
-    " Try to guess the title of the window where Vim is running:
-    if has("gui_running")
-        call RSetDefaultValue("g:vimrplugin_vim_window", "'GVim'")
-    elseif g:rplugin_pdfviewer == "evince"
-        call RSetDefaultValue("g:vimrplugin_vim_window", "'Terminal'")
-    elseif g:rplugin_pdfviewer == "okular"
-        call RSetDefaultValue("g:vimrplugin_vim_window", "'Konsole'")
-    else
-        call RSetDefaultValue("g:vimrplugin_vim_window", "'term'")
-    endif
-
 endfunction
 
 function RStart_Zathura(basenm)
@@ -3411,3 +3399,7 @@ endif
 if exists("g:vimrplugin_routmorecolors")
     call RWarningMsgInp("The option 'vimrplugin_routmorecolors' was renamed to 'Rout_more_colors'. Please, rename it in your vimrc too.")
 endif
+
+if exists("g:vimrplugin_vim_window")
+    call RWarningMsgInp("The option 'vimrplugin_vim_window' is deprecated. Please, remove it from your vimrc.")
+endif

From e33145229a6e7b1d27f956f305a0046537d38586 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sun, 17 May 2015 18:40:29 -0400
Subject: [PATCH 0978/1050] Delete synctex_okular_backward.sh used by nvim

---
 Makefile                            | 3 +--
 list_for_vimball                    | 1 -
 r-plugin/synctex_okular_backward.sh | 6 ------
 3 files changed, 1 insertion(+), 9 deletions(-)
 delete mode 100644 r-plugin/synctex_okular_backward.sh

diff --git a/Makefile b/Makefile
index ef3daa8..73aeda3 100644
--- a/Makefile
+++ b/Makefile
@@ -22,7 +22,7 @@
 
 
 PLUGINHOME=`pwd`
-PLUGINVERSION=1.2.5
+PLUGINVERSION=1.2.6
 DEBIANTIME=`date -R`
 PLUGINRELEASEDATE=`date +"%Y-%m-%d"`
 VIM2HTML=/usr/local/share/vim/vim74/doc/vim2html.pl 
@@ -72,7 +72,6 @@ deb:
 	  - r-plugin/setcompldir.vim\n\
 	  - r-plugin/synctex_evince_backward.py\n\
 	  - r-plugin/synctex_evince_forward.py\n\
-	  - r-plugin/synctex_okular_backward.sh\n\
 	  - syntax/rbrowser.vim\n\
 	  - syntax/rdoc.vim\n\
 	  - syntax/rout.vim\n\
diff --git a/list_for_vimball b/list_for_vimball
index 74d43c1..d133f1a 100644
--- a/list_for_vimball
+++ b/list_for_vimball
@@ -14,7 +14,6 @@ r-plugin/r.snippets
 r-plugin/rmd.snippets
 r-plugin/synctex_evince_backward.py
 r-plugin/synctex_evince_forward.py
-r-plugin/synctex_okular_backward.sh
 r-plugin/functions.vim
 r-plugin/gui_running.vim
 r-plugin/osx.vim
diff --git a/r-plugin/synctex_okular_backward.sh b/r-plugin/synctex_okular_backward.sh
deleted file mode 100644
index 926386d..0000000
--- a/r-plugin/synctex_okular_backward.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/bin/sh
-
-# This script is required to do backward search from Okular to Neovim
-
-echo "call SyncTeX_backward('$1', $2)" >> "$VIMRPLUGIN_TMPDIR/okular_search"
-

From 10b1dd1200e008e795a6657ebebd1deefbf6f6b2 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sun, 17 May 2015 18:46:18 -0400
Subject: [PATCH 0979/1050] Allow spaces in file names for Evince SyncTeX

---
 ftplugin/rnoweb_rplugin.vim         |  7 +------
 r-plugin/synctex_evince_backward.py | 22 ++++++++++------------
 r-plugin/synctex_evince_forward.py  |  5 +++--
 3 files changed, 14 insertions(+), 20 deletions(-)

diff --git a/ftplugin/rnoweb_rplugin.vim b/ftplugin/rnoweb_rplugin.vim
index 593321a..3680bca 100644
--- a/ftplugin/rnoweb_rplugin.vim
+++ b/ftplugin/rnoweb_rplugin.vim
@@ -399,8 +399,7 @@ function! GoToBuf(rnwbn, rnwf, basedir, rnwln)
 endfunction
 
 function! SyncTeX_backward(fname, ln)
-    let flnm = substitute(a:fname, 'file://', '', '') " Evince
-    let flnm = substitute(flnm, '/\./', '/', '')      " Okular
+    let flnm = substitute(a:fname, '/\./', '/', '')      " Okular
     let basenm = substitute(flnm, "\....$", "", "")   " Delete extension
     if basenm =~ "/"
         let basedir = substitute(basenm, '\(.*\)/.*', '\1', '')
@@ -457,10 +456,6 @@ function! SyncTeX_forward(...)
     let lnum = 0
     let rnwf = expand("%:t")
 
-    if g:rplugin_pdfviewer == "evince" && expand("%:p") =~ " "
-        call RWarningMsg('SyncTeX may not work because there is space in the file path "' . expand("%:p") . '".')
-    endif
-
     let olddir = getcwd()
     if olddir != expand("%:p:h")
         exe "cd " . substitute(expand("%:p:h"), ' ', '\\ ', 'g')
diff --git a/r-plugin/synctex_evince_backward.py b/r-plugin/synctex_evince_backward.py
index bd3cd69..a1963d3 100644
--- a/r-plugin/synctex_evince_backward.py
+++ b/r-plugin/synctex_evince_backward.py
@@ -110,22 +110,20 @@ def on_window_close(self):
         self.status = CLOSED
 
     def on_sync_source(self, input_file, source_link, timestamp):
-        if vimnm == "nvim":
-            sys.stdout.write("call SyncTeX_backward('" + input_file + "', " + str(source_link[0]) + ")\n")
-            sys.stdout.flush()
-        else:
-            os.system(vimexec + ' --servername ' + vimnm + ' --remote-expr "' + "SyncTeX_backward('" + input_file + "', " + str(source_link[0]) + ')"')
+        input_file = input_file.replace("file://", "")
+        input_file = input_file.replace("%20", " ")
+        os.system(vimexec + ' --servername ' + vimnm + ' --remote-expr "' + "SyncTeX_backward('" + input_file + "', " + str(source_link[0]) + ')"')
 
 path_output = os.getcwd() + '/' + sys.argv[1]
+path_output = path_output.replace(" ", "%20")
 
 vimnm = sys.argv[2]
-if vimnm != "nvim":
-    if vimnm.find("GVIM") == 0:
-        vimexec = "gvim"
-    else:
-        vimexec = "vim"
-    time.sleep(1)
-    os.system(vimexec + ' --servername ' + vimnm + ' --remote-expr "SyncTeX_SetPID(' + str(os.getpid()) + ')"')
+if vimnm.find("GVIM") == 0:
+    vimexec = "gvim"
+else:
+    vimexec = "vim"
+time.sleep(1)
+os.system(vimexec + ' --servername ' + vimnm + ' --remote-expr "SyncTeX_SetPID(' + str(os.getpid()) + ')"')
 
 
 dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
diff --git a/r-plugin/synctex_evince_forward.py b/r-plugin/synctex_evince_forward.py
index ee4fc35..4d84ceb 100644
--- a/r-plugin/synctex_evince_forward.py
+++ b/r-plugin/synctex_evince_forward.py
@@ -125,9 +125,10 @@ def _syncview_handler(self, window_list):
         self._handler = None
         return True
 
-path_output  = os.getcwd() + '/' + sys.argv[1]
+path_output = os.getcwd() + '/' + sys.argv[1]
+path_output = path_output.replace(" ", "%20")
 line_number = int(sys.argv[2])
-path_input   = os.getcwd() + '/' + sys.argv[3]
+path_input = os.getcwd() + '/' + sys.argv[3]
 
 dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
 

From 0e43be411b1541764460856985c6032717e1ffb7 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sun, 17 May 2015 18:47:57 -0400
Subject: [PATCH 0980/1050] Set 'nolist' in the Object Browser

---
 ftplugin/rbrowser.vim | 1 +
 1 file changed, 1 insertion(+)

diff --git a/ftplugin/rbrowser.vim b/ftplugin/rbrowser.vim
index 29d36e4..c65197e 100644
--- a/ftplugin/rbrowser.vim
+++ b/ftplugin/rbrowser.vim
@@ -27,6 +27,7 @@ setlocal noswapfile
 setlocal buftype=nofile
 setlocal nowrap
 setlocal iskeyword=@,48-57,_,.
+setlocal nolist
 
 if !exists("g:rplugin_hasmenu")
     let g:rplugin_hasmenu = 0

From 5646f1ab95ad83df3eb10d6daf0b5c88a9e42764 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sat, 30 May 2015 23:50:29 -0400
Subject: [PATCH 0981/1050] Omnicompletion of S4 slot names

---
 autoload/rcomplete.vim | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/autoload/rcomplete.vim b/autoload/rcomplete.vim
index 6a20196..8501234 100644
--- a/autoload/rcomplete.vim
+++ b/autoload/rcomplete.vim
@@ -52,7 +52,7 @@ fun! rcomplete#CompleteR(findstart, base)
     if a:findstart
         let line = getline('.')
         let start = col('.') - 1
-        while start > 0 && (line[start - 1] =~ '\w' || line[start - 1] =~ '\.' || line[start - 1] =~ '\$')
+        while start > 0 && (line[start - 1] =~ '\w' || line[start - 1] =~ '\.' || line[start - 1] =~ '\$' || line[start - 1] =~ '@')
             let start -= 1
         endwhile
         call BuildROmniList()
@@ -77,6 +77,10 @@ fun! rcomplete#CompleteR(findstart, base)
                 if a:base !~ '\$' && line =~ '\$'
                     continue
                 endif
+                " Skip slots of S4 objects unless the user is really looking for them.
+                if a:base !~ '@' && line =~ '@'
+                    continue
+                endif
                 let tmp1 = split(line, "\x06", 1)
                 if g:vimrplugin_show_args
                     let info = tmp1[4]

From cc00ca7c8eed0718163913a7d89b96cbeb1a5bbb Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sat, 30 May 2015 23:51:41 -0400
Subject: [PATCH 0982/1050] Delete unnecessary | from b:undo_ftplugin

---
 ftplugin/rhelp_rplugin.vim  | 2 +-
 ftplugin/rmd_rplugin.vim    | 2 +-
 ftplugin/rnoweb_rplugin.vim | 2 +-
 ftplugin/rrst_rplugin.vim   | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/ftplugin/rhelp_rplugin.vim b/ftplugin/rhelp_rplugin.vim
index 9168e09..2748dcd 100644
--- a/ftplugin/rhelp_rplugin.vim
+++ b/ftplugin/rhelp_rplugin.vim
@@ -56,5 +56,5 @@ call RSourceOtherScripts()
 if exists("b:undo_ftplugin")
     let b:undo_ftplugin .= " | unlet! b:IsInRCode"
 else
-    let b:undo_ftplugin = " | unlet! b:IsInRCode"
+    let b:undo_ftplugin = "unlet! b:IsInRCode"
 endif
diff --git a/ftplugin/rmd_rplugin.vim b/ftplugin/rmd_rplugin.vim
index 9ddb4cc..b538084 100644
--- a/ftplugin/rmd_rplugin.vim
+++ b/ftplugin/rmd_rplugin.vim
@@ -166,5 +166,5 @@ call RSourceOtherScripts()
 if exists("b:undo_ftplugin")
     let b:undo_ftplugin .= " | unlet! b:IsInRCode b:PreviousRChunk b:NextRChunk b:SendChunkToR"
 else
-    let b:undo_ftplugin = " | unlet! b:IsInRCode b:PreviousRChunk b:NextRChunk b:SendChunkToR"
+    let b:undo_ftplugin = "unlet! b:IsInRCode b:PreviousRChunk b:NextRChunk b:SendChunkToR"
 endif
diff --git a/ftplugin/rnoweb_rplugin.vim b/ftplugin/rnoweb_rplugin.vim
index 3680bca..8e2da70 100644
--- a/ftplugin/rnoweb_rplugin.vim
+++ b/ftplugin/rnoweb_rplugin.vim
@@ -650,5 +650,5 @@ call RSourceOtherScripts()
 if exists("b:undo_ftplugin")
     let b:undo_ftplugin .= " | unlet! b:IsInRCode b:PreviousRChunk b:NextRChunk b:SendChunkToR"
 else
-    let b:undo_ftplugin = " | unlet! b:IsInRCode b:PreviousRChunk b:NextRChunk b:SendChunkToR"
+    let b:undo_ftplugin = "unlet! b:IsInRCode b:PreviousRChunk b:NextRChunk b:SendChunkToR"
 endif
diff --git a/ftplugin/rrst_rplugin.vim b/ftplugin/rrst_rplugin.vim
index bd25abc..570c41c 100644
--- a/ftplugin/rrst_rplugin.vim
+++ b/ftplugin/rrst_rplugin.vim
@@ -201,5 +201,5 @@ call RSourceOtherScripts()
 if exists("b:undo_ftplugin")
     let b:undo_ftplugin .= " | unlet! b:IsInRCode b:PreviousRChunk b:NextRChunk b:SendChunkToR"
 else
-    let b:undo_ftplugin = " | unlet! b:IsInRCode b:PreviousRChunk b:NextRChunk b:SendChunkToR"
+    let b:undo_ftplugin = "unlet! b:IsInRCode b:PreviousRChunk b:NextRChunk b:SendChunkToR"
 endif

From 3ce1fa471bad0d6e5f2594578b9dc5f2c9583202 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sun, 31 May 2015 16:45:55 -0400
Subject: [PATCH 0983/1050] Omnicompletion of any level in lists The
 omnicompletion was working only for the first level of lists.

---
 autoload/rcomplete.vim     | 6 +++---
 r-plugin/common_global.vim | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/autoload/rcomplete.vim b/autoload/rcomplete.vim
index 8501234..9350f31 100644
--- a/autoload/rcomplete.vim
+++ b/autoload/rcomplete.vim
@@ -5,7 +5,7 @@
 
 " Tell R to create a list of objects file listing all currently available
 " objects in its environment. The file is necessary for omni completion.
-function BuildROmniList()
+function BuildROmniList(pattern)
     if string(g:SendCmdToR) == "function('SendCmdToR_fake')"
         return
     endif
@@ -14,7 +14,7 @@ function BuildROmniList()
     if g:vimrplugin_allnames == 1
         let omnilistcmd = omnilistcmd . ', allnames = TRUE'
     endif
-    let omnilistcmd = omnilistcmd . ')'
+    let omnilistcmd = omnilistcmd . ', pattern = "' . a:pattern . '")'
 
     call delete(g:rplugin_tmpdir . "/vimbol_finished")
     call delete(g:rplugin_tmpdir . "/eval_reply")
@@ -55,9 +55,9 @@ fun! rcomplete#CompleteR(findstart, base)
         while start > 0 && (line[start - 1] =~ '\w' || line[start - 1] =~ '\.' || line[start - 1] =~ '\$' || line[start - 1] =~ '@')
             let start -= 1
         endwhile
-        call BuildROmniList()
         return start
     else
+        call BuildROmniList(a:base)
         let resp = []
         if strlen(a:base) == 0
             return resp
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 1daebe8..bd2e33d 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -821,7 +821,7 @@ function StartR(whatr)
     else
         let start_options += ['options(vimcom.vimpager = TRUE)']
     endif
-    let start_options += ['if(utils::packageVersion("vimcom") != "1.2.5") warning("Your version of Vim-R-plugin requires vimcom-1.2-5.", call. = FALSE)']
+    let start_options += ['if(utils::packageVersion("vimcom") != "1.2.6") warning("Your version of Vim-R-plugin requires vimcom-1.2-6.", call. = FALSE)']
 
     let rwd = ""
     if g:vimrplugin_vim_wd == 0
@@ -994,8 +994,8 @@ function WaitVimComStart()
         if !filereadable(g:rplugin_vimcom_lib)
             call RWarningMsgInp('Could not find "' . g:rplugin_vimcom_lib . '".')
         endif
-        if g:rplugin_vimcom_version != "1.2.5"
-            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.2.5.')
+        if g:rplugin_vimcom_version != "1.2.6"
+            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.2.6.')
             sleep 1
         endif
         call delete(g:rplugin_tmpdir . "/vimcom_running_" . $VIMINSTANCEID)

From 504ee710cc9fde90b29935cb0b0d9e84c947d731 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sun, 31 May 2015 17:18:42 -0400
Subject: [PATCH 0984/1050] Quote function name to vim.list.args()

---
 r-plugin/common_global.vim | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index bd2e33d..07f7a09 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -2600,8 +2600,13 @@ function RAction(rcmd)
             return
         endif
         let rfun = a:rcmd
-        if a:rcmd == "args" && g:vimrplugin_listmethods == 1
-            let rfun = "vim.list.args"
+        if a:rcmd == "args"
+          if g:vimrplugin_listmethods == 1
+            call g:SendCmdToR('vim.list.args("' . rkeyword . '")')
+          else
+            call g:SendCmdToR('args("' . rkeyword . '")')
+          endif
+          return
         endif
         if a:rcmd == "plot" && g:vimrplugin_specialplot == 1
             let rfun = "vim.plot"

From ba8e64f81fe8ec1f7ce1f75f8ef79c8ce2947dd6 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sun, 31 May 2015 23:10:31 -0400
Subject: [PATCH 0985/1050] Recognize lazy load objects

---
 syntax/rbrowser.vim | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/syntax/rbrowser.vim b/syntax/rbrowser.vim
index a2a9780..098f573 100644
--- a/syntax/rbrowser.vim
+++ b/syntax/rbrowser.vim
@@ -19,7 +19,8 @@ if has("conceal")
     syn match rbrowserList	"\[#.*\t" contains=rbrowserDelim,rbrowserTab
     syn match rbrowserLogical	"%#.*\t" contains=rbrowserDelim,rbrowserTab
     syn match rbrowserLibrary	"##.*\t" contains=rbrowserDelim,rbrowserTab
-    syn match rbrowserS4  	"<#.*\t" contains=rbrowserDelim,rbrowserTab
+    syn match rbrowserS4	"<#.*\t" contains=rbrowserDelim,rbrowserTab
+    syn match rbrowserLazy	"&#.*\t" contains=rbrowserDelim,rbrowserTab
     syn match rbrowserUnknown	"=#.*\t" contains=rbrowserDelim,rbrowserTab
 else
     syn match rbrowserNumeric	"{.*\t" contains=rbrowserDelim,rbrowserTab
@@ -29,7 +30,8 @@ else
     syn match rbrowserList	"\[.*\t" contains=rbrowserDelim,rbrowserTab
     syn match rbrowserLogical	"%.*\t" contains=rbrowserDelim,rbrowserTab
     syn match rbrowserLibrary	"#.*\t" contains=rbrowserDelim,rbrowserTab
-    syn match rbrowserS4	        "<.*\t" contains=rbrowserDelim,rbrowserTab
+    syn match rbrowserS4	"<.*\t" contains=rbrowserDelim,rbrowserTab
+    syn match rbrowserLazy	"&.*\t" contains=rbrowserDelim,rbrowserTab
     syn match rbrowserUnknown	"=.*\t" contains=rbrowserDelim,rbrowserTab
 endif
 syn match rbrowserEnv		"^.GlobalEnv "
@@ -48,9 +50,9 @@ endif
 syn match rbrowserTab contained "\t"
 syn match rbrowserErr /Error: label isn't "character"./
 if has("conceal")
-    syn match rbrowserDelim contained /'#\|"#\|(#\|\[#\|{#\|%#\|##\|<#\|=#/ conceal
+    syn match rbrowserDelim contained /'#\|"#\|(#\|\[#\|{#\|%#\|##\|<#\|&#\|=#/ conceal
 else
-    syn match rbrowserDelim contained /'\|"\|(\|\[\|{\|%\|#\|<\|=/
+    syn match rbrowserDelim contained /'\|"\|(\|\[\|{\|%\|#\|<\|&\|=/
 endif
 
 hi def link rbrowserEnv		Statement
@@ -62,7 +64,8 @@ hi def link rbrowserLibrary	PreProc
 hi def link rbrowserLink	Comment
 hi def link rbrowserLogical	Boolean
 hi def link rbrowserFunction	Function
-hi def link rbrowserS4  	Statement
+hi def link rbrowserS4		Statement
+hi def link rbrowserLazy	Comment
 hi def link rbrowserUnknown	Normal
 hi def link rbrowserWarn	WarningMsg
 hi def link rbrowserErr 	ErrorMsg

From eca7de3964ca05da17f2b24c01d3f6689567ad9a Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Mon, 1 Jun 2015 18:45:02 -0400
Subject: [PATCH 0986/1050] Improve support for lazy load objects Prefix the
 character '&' to the name of the object before sending it to vimcom to allow
 the recognition that this is a lazy load object that must be immediately
 loaded to be properly highlighted in the Object Browser.

---
 ftplugin/rbrowser.vim | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/ftplugin/rbrowser.vim b/ftplugin/rbrowser.vim
index c65197e..9a1ec92 100644
--- a/ftplugin/rbrowser.vim
+++ b/ftplugin/rbrowser.vim
@@ -120,7 +120,11 @@ function! RBrowserDoubleClick()
     " Toggle state of list or data.frame: open X closed
     let key = RBrowserGetName(0, 1)
     if g:rplugin_curview == "GlobalEnv"
-        call SendToVimCom("\006" . key)
+        if getline(".") =~ "&#.*\t"
+            call SendToVimCom("\006&" . key)
+        else
+            call SendToVimCom("\006" . key)
+        endif
     else
         let key = substitute(key, '`', '', "g") 
         if key !~ "^package:"

From 341ff307cc14d3c58604e3a1543e8a6538ea93bf Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Mon, 1 Jun 2015 18:59:31 -0400
Subject: [PATCH 0987/1050] Update documentation

---
 doc/r-plugin.txt | 60 +++++++++++++++++++++++-------------------------
 1 file changed, 29 insertions(+), 31 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index a3ef468..fc7463c 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -115,7 +115,7 @@ dependencies:
 
     * R's version must be >= 3.0.0: http://www.r-project.org/
 
-    * vimcom = 1.2-5: http://www.lepem.ufc.br/jaa/vimcom.html
+    * vimcom = 1.2-6: http://www.lepem.ufc.br/jaa/vimcom.html
 
       Note: If you cannot build vimcom yourself, you will want to
       download and install the zip file.
@@ -152,7 +152,7 @@ Before installing the plugin, you should install its dependencies:
 
    R >= 3.0.0: http://www.r-project.org/
 
-   vimcom = 1.2-5: http://www.lepem.ufc.br/jaa/vimcom.html
+   vimcom = 1.2-6: http://www.lepem.ufc.br/jaa/vimcom.html
 
    Only if you edit Rnoweb files: MacTeX, BasicTeX or other LaTeX system.
 
@@ -206,7 +206,7 @@ Before installing the plugin, you should install its dependencies:
 
    R >= 3.0.0: http://www.r-project.org/
 
-   vimcom = 1.2-5: http://www.lepem.ufc.br/jaa/vimcom.html
+   vimcom = 1.2-6: http://www.lepem.ufc.br/jaa/vimcom.html
 
    Tmux >= 1.8:   http://tmux.sourceforge.net
                   Tmux is necessary to send commands from Vim to R Console.
@@ -698,24 +698,31 @@ to draw lines in the Object Browser. This is the case of most Linux
 distributions.
 
 In the Libraries view, you can either double click or press  on a
-library name to see its objects. In the Object Browser the libraries have the
+library name to see its objects. In the Object Browser, the libraries have the
 color defined by the PreProc highlighting group. The other objects have
 their colors defined by the return value of some R functions. Each line in the
-table below shows a highlighting group and the corresponding R function (if
-any) used to classify the objects:
+table below shows a highlighting group and the corresponding type of R object:
 
 	 PreProc	libraries
-	 Number		is.numeric()
-	 String		is.character()
-	 Special	is.factor()
-	 Boolean	is.logical()
-	 Type		is.list()
-	 Function	is.function()
-	 Statement	isS4()
-
-One limitation is that objects made available by the command `data()` may not
-have their classes recognized in the GlobalEnv view.
+	 Number		numeric
+	 String		character
+	 Special	factor
+	 Boolean	logical
+	 Type		list
+	 Function	function
+	 Statement	s4
+	 Comment	promise (lazy load object)
 
+One limitation of the Object Browser is that objects made available by the
+command `data()` are only links to the actual objects (promises of lazily
+loading the object when needed) and their real classes are not recognized in
+the GlobalEnv view. The same problem happens when the `knitr` option
+`cache.lazy=TRUE`. If you press  over the name of the object in the
+Object Browser, it will be actually loaded by the command (ran in the
+background):
+>
+   obj <- obj
+<
 
 ------------------------------------------------------------------------------
 4.5. Commenting and uncommenting lines~
@@ -990,16 +997,7 @@ operator. See: https://github.com/jcfaria/Vim-R-plugin/issues/94
 
 
 ------------------------------------------------------------------------------
-5.4. Objects Browser does not support knitr cache=TRUE~
-
-When processing Rnoweb documents with the knitr package, if the chunk option
-`cache` is `TRUE`, the Object Browser will not be able to detect the classes
-of objects because knitr uses R's lazy load feature. The workaround for this
-issue is to define the chunk option `cache.lazy=FALSE`.
-
-
-------------------------------------------------------------------------------
-5.5. Wrong message that "R is busy" (Windows only)~
+5.4. Wrong message that "R is busy" (Windows only)~
 
 On Windows, when code is sent from Vim to R Console, the vimcom library
 sets the value of the internal variable `r_is_busy` to 1. The value is set
@@ -1014,9 +1012,10 @@ work as expected again after any valid code is executed in the R Console.
 
 The vimcom library is started with the state `busy`.
 
+
 ------------------------------------------------------------------------------
 							*r-plugin-SyncTeX-win*
-5.6. SyncTeX on Windows~
+5.5. SyncTeX on Windows~
 
 On Windows, backward search with Sumatra pop ups a console window which
 quickly disappears (it is `vim` running the required `--remote-expr` command).
@@ -1024,7 +1023,7 @@ quickly disappears (it is `vim` running the required `--remote-expr` command).
 
 ------------------------------------------------------------------------------
 								*r-plugin-nox*
-5.7. Bugs that affect Linux Console and Vim accessed through ssh~
+5.6. Bugs that affect Linux Console and Vim accessed through ssh~
 
 If you run Vim in the Linux Console or start Vim in a terminal emulator
 without the command line argument |--servername|, Vim will not receive remote
@@ -1090,7 +1089,7 @@ See also: |r-plugin-remote|.
 
 
 ------------------------------------------------------------------------------
-5.8. R must be started by Vim~
+5.7. R must be started by Vim~
 
 The communication between Vim and R will work only if R was started by Vim
 through the rf command because the plugin was designed to connect
@@ -2315,7 +2314,6 @@ directory after the installation:
    r-plugin/setcompldir.vim
    r-plugin/synctex_evince_backward.py
    r-plugin/synctex_evince_forward.py
-   r-plugin/synctex_okular_backward.sh
    r-plugin/windows.vim
    syntax/rbrowser.vim
    syntax/rdoc.vim
@@ -2832,7 +2830,7 @@ put in your |vimrc|:
 							       *r-plugin-news*
 10. News~
 
-1.2.6
+1.2.6 (2015-06-01)
 
  * Remove option vimrplugin_vim_window (use $WINDOWID instead).
 

From e43de066c9151935f0b11b1a5d05b620c9bbe663 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Tue, 9 Jun 2015 15:48:46 -0400
Subject: [PATCH 0988/1050] Check has("win64") first to find the correct dll
 Fix #175

---
 r-plugin/common_global.vim | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 07f7a09..8ef1952 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -984,10 +984,10 @@ function WaitVimComStart()
         let g:rplugin_vimcom_home = vr[1]
         let g:rplugin_vimcomport = vr[2]
         let g:rplugin_r_pid = vr[3]
-        if has("win32")
-            let g:rplugin_vimcom_lib = g:rplugin_vimcom_home . "/bin/i386/libVimR.dll"
-        elseif has("win64")
+        if has("win64")
             let g:rplugin_vimcom_lib = g:rplugin_vimcom_home . "/bin/x64/libVimR.dll"
+        elseif has("win32")
+            let g:rplugin_vimcom_lib = g:rplugin_vimcom_home . "/bin/i386/libVimR.dll"
         else
             let g:rplugin_vimcom_lib = g:rplugin_vimcom_home . "/bin/libVimR.so"
         endif
@@ -3175,8 +3175,8 @@ if !has("win32") && !has("win64") && !has("gui_win32") && !has("gui_win64") && !
     if strlen(s:tmuxversion) != 3
         let s:tmuxversion = "1.0"
     endif
-    if s:tmuxversion < "1.5" && g:vimrplugin_source !~ "screenR"
-        call RWarningMsgInp("Vim-R-plugin requires Tmux >= 1.5")
+    if s:tmuxversion < "1.8" && g:vimrplugin_source !~ "screenR"
+        call RWarningMsgInp("Vim-R-plugin requires Tmux >= 1.8")
         let g:rplugin_failed = 1
         finish
     endif

From a0bdcc735d9720cfbba4077c6d64d18ab82c7fc9 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Thu, 11 Jun 2015 09:20:52 -0400
Subject: [PATCH 0989/1050] Replace & with & when generating html doc

---
 Makefile | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Makefile b/Makefile
index 73aeda3..d7e68d7 100644
--- a/Makefile
+++ b/Makefile
@@ -162,6 +162,7 @@ htmldoc:
 	    sed -i -e 's/<\/a>|/<\/a>/g' r-plugin.html ;\
 	    sed -i -e 's/||/<\/code>/g' r-plugin.html ;\
+	    sed -i -e 's/&term/\&term/g' r-plugin.html ;\
 	    sed -i -e 's/`//g' r-plugin.html ;\
 	    sed -i -e 's/\( *\)\(http\S*\)/\1\2<\/a>/' r-plugin.html ;\
 	    sed -i -e 's/<\/pre>
/  --------------------------------------------------------\n/' r-plugin.html ;\

From 96f5d5e701ec15a908b21c44456b6d118fe85535 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Fri, 12 Jun 2015 10:57:45 -0400
Subject: [PATCH 0990/1050] Version 1.2.6

---
 doc/r-plugin.txt | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index fc7463c..ef4e020 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -2830,10 +2830,14 @@ put in your |vimrc|:
 							       *r-plugin-news*
 10. News~
 
-1.2.6 (2015-06-01)
+1.2.6 (2015-06-12)
+
+ * Improve support for lazy load objects in the Object Browser.
 
  * Remove option vimrplugin_vim_window (use $WINDOWID instead).
 
+ * Fix bug that prevented GVim 64 bit of finding libVimR.dll.
+
 1.2.5 (2015-05-06)
 
  * New command to evaluate selection and get output in newtab: \so

From ffdb0551c96727f4cb26f8ad62386a6e984fa87f Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sun, 14 Jun 2015 09:25:33 -0400
Subject: [PATCH 0991/1050] Warn that MacVim's Vim cannot receive msg from R
 Also always allow the Object Browser be open in a Tmux split pane if running
 inside Tmux.

---
 r-plugin/common_global.vim | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 8ef1952..1ac80e7 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -782,6 +782,9 @@ function StartR(whatr)
     elseif !has("clientserver")
         let $VIMEDITOR_SVRNM = "NoClientServer"
     elseif v:servername == ""
+        if has("gui_macvim") && !has("gui_running")
+            call RWarningMsg("The Vim application that comes with MacVim cannot receive messages from R.")
+        endif
         let $VIMEDITOR_SVRNM = "NoServerName"
     else
         let $VIMEDITOR_SVRNM = v:servername
@@ -3140,13 +3143,6 @@ if has("gui_running") || g:vimrplugin_applescript
     let vimrplugin_only_in_tmux = 0
 endif
 
-if has("gui_running") || has("win32") || g:vimrplugin_applescript
-    let g:vimrplugin_tmux_ob = 0
-    if g:vimrplugin_objbr_place =~ "console"
-        let g:vimrplugin_objbr_place = substitute(g:vimrplugin_objbr_place, "console", "script", "")
-    endif
-endif
-
 if $TMUX == ""
     let g:rplugin_do_tmux_split = 0
     call RSetDefaultValue("g:vimrplugin_tmux_ob", 0)
@@ -3155,6 +3151,14 @@ else
     let g:vimrplugin_applescript = 0
     call RSetDefaultValue("g:vimrplugin_tmux_ob", 1)
 endif
+
+if has("gui_running") || has("win32") || g:vimrplugin_applescript || !g:rplugin_do_tmux_split
+    let g:vimrplugin_tmux_ob = 0
+    if g:vimrplugin_objbr_place =~ "console"
+        let g:vimrplugin_objbr_place = substitute(g:vimrplugin_objbr_place, "console", "script", "")
+    endif
+endif
+
 if g:vimrplugin_objbr_place =~ "console"
     let g:vimrplugin_tmux_ob = 1
 endif

From de831f34f0ac07fd092ee10579d50952dd7c182a Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sun, 14 Jun 2015 10:39:24 -0400
Subject: [PATCH 0992/1050] Postpone the redraw of Obj. Br. while updating it

---
 ftplugin/rbrowser.vim | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ftplugin/rbrowser.vim b/ftplugin/rbrowser.vim
index 9a1ec92..f9710f3 100644
--- a/ftplugin/rbrowser.vim
+++ b/ftplugin/rbrowser.vim
@@ -95,11 +95,11 @@ function! UpdateOB(what)
     if bufname("%") =~ "Object_Browser" || b:rplugin_extern_ob
         setlocal nomodifiable
     endif
-    redraw
     if rplugin_switchedbuf
         exe "sil noautocmd sb " . g:rplugin_curbuf
         exe "set switchbuf=" . savesb
     endif
+    redraw
     let g:rplugin_upobcnt = 0
     return "End of UpdateOB()"
 endfunction

From f5d66aeb2291658f6fe6f1c5533fe75e4f4be717 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sun, 14 Jun 2015 11:00:15 -0400
Subject: [PATCH 0993/1050] Do not call redraw after updating the OB The redraw
 crashes Vim when Vim runs in a terminal emulator and R in an external
 terminal.

---
 ftplugin/rbrowser.vim | 1 -
 1 file changed, 1 deletion(-)

diff --git a/ftplugin/rbrowser.vim b/ftplugin/rbrowser.vim
index f9710f3..04e2db1 100644
--- a/ftplugin/rbrowser.vim
+++ b/ftplugin/rbrowser.vim
@@ -99,7 +99,6 @@ function! UpdateOB(what)
         exe "sil noautocmd sb " . g:rplugin_curbuf
         exe "set switchbuf=" . savesb
     endif
-    redraw
     let g:rplugin_upobcnt = 0
     return "End of UpdateOB()"
 endfunction

From 0335844b6b43cc75cac8fde6faa5ccd3b8e56a1f Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Mon, 15 Jun 2015 00:16:14 -0400
Subject: [PATCH 0994/1050] Always delay highlight update on R startup Perhaps
 this solves issue #168

---
 r-plugin/common_global.vim | 24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 1ac80e7..77949ad 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -619,17 +619,6 @@ function DelayedFillLibList()
 endfunction
 
 function StartR_TmuxSplit(rcmd)
-    " Vim crashes if the syntax highlight is changed while the window is
-    " being resized, but only if the R syntax is included in another filetype
-    if &filetype != "r"
-        let g:rplugin_starting_R = 1
-        augroup RStarting
-            autocmd!
-            autocmd CursorMoved  call DelayedFillLibList()
-            autocmd CursorMovedI  call DelayedFillLibList()
-        augroup END
-    endif
-
     let g:rplugin_vim_pane = TmuxActivePane()
     let tmuxconf = ['set-environment VIMRPLUGIN_TMPDIR "' . g:rplugin_tmpdir . '"',
                 \ 'set-environment VIMRPLUGIN_COMPLDIR "' . substitute(g:rplugin_compldir, ' ', '\\ ', "g") . '"',
@@ -852,6 +841,8 @@ function StartR(whatr)
         call inputrestore()
     endif
 
+    let g:rplugin_starting_R = 1
+
     if g:vimrplugin_applescript
         call StartR_OSX()
         return
@@ -1014,6 +1005,17 @@ function WaitVimComStart()
             call system("tmux set-environment -u VIMRPLUGIN_TMPDIR")
         endif
         call delete(g:rplugin_tmpdir . "/start_options.R")
+
+        " Vim may crash when the syntax highlight is changed while the window
+        " is being resized, although only if the R syntax is included in
+        " another filetype. To guarantee a safer startup, we delay the
+        " highlight of functions for all cases:
+        augroup RStarting
+            autocmd!
+            autocmd CursorMoved  call DelayedFillLibList()
+            autocmd CursorMovedI  call DelayedFillLibList()
+        augroup END
+
         return 1
     else
         call RWarningMsg("The package vimcom wasn't loaded yet.")

From 5952dcd59978e4a1907ff119a98ff0d55a52c6cd Mon Sep 17 00:00:00 2001
From: FvD 
Date: Wed, 11 Feb 2015 17:51:10 -0600
Subject: [PATCH 0995/1050] Minor corrections in doc

---
 doc/r-plugin.txt | 48 ++++++++++++++++++++++++------------------------
 1 file changed, 24 insertions(+), 24 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index ef4e020..9b190ad 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -518,12 +518,12 @@ commands that send a single line of code to R, then the plugin will send to R
 the command to knit the child document.
 
 After the send, sweave and knit commands, Vim will save the current buffer if
-it has any pending changes before performing the tasks.  After
-ao, Vim will run "R CMD BATCH --no-restore --no-save" on the
-current file and show the resulting .Rout file in a new tab. Please see
-|vimrplugin_routnotab| if you prefer that the file is open in a new split
-window. Note: The command ao, silently writes the current buffer
-to its file if it was modified and deletes the .Rout file if it exists.
+it has any pending changes before performing the tasks. After ao,
+Vim will run "R CMD BATCH --no-restore --no-save" on the current file and show
+the resulting .Rout file in a new tab. Please see |vimrplugin_routnotab| if
+you prefer that the file is open in a new split window. Note: The command
+ao, silently writes the current buffer to its file if it was
+modified and deletes the .Rout file if it exists.
 
 R syntax uses " <- " to assign values to variables which is inconvenient to
 type. In insert mode, typing a single underscore, "_", will write " <- ",
@@ -999,16 +999,16 @@ operator. See: https://github.com/jcfaria/Vim-R-plugin/issues/94
 ------------------------------------------------------------------------------
 5.4. Wrong message that "R is busy" (Windows only)~
 
-On Windows, when code is sent from Vim to R Console, the vimcom library
-sets the value of the internal variable `r_is_busy` to 1. The value is set
-back to 0 when any code is successfully evaluated. If you send invalid code to
-R, there will be no successful evaluation of code and, thus, the value of
-`r_is_busy` will remain set to 1. If you then try to update the Object
-Browser, see the R documentation for any function, or do other tasks that
-require the hidden evaluation of code by R, the vimcom library will
-refuse to do the tasks to avoid any risk of corrupting R's memory. It will
-tell Vim that "R is busy" and Vim will display this message. Everything should
-work as expected again after any valid code is executed in the R Console.
+On Windows, when code is sent from Vim to R Console, the vimcom library sets
+the value of the internal variable `r_is_busy` to 1. The value is set back to
+0 when any code is successfully evaluated. If you send invalid code to R,
+there will be no successful evaluation of code and the value of `r_is_busy`
+will remain set to 1. If you then try to update the Object Browser, see the R
+documentation for any function, or do other tasks that require the hidden
+evaluation of code by R, the vimcom library will refuse to do the tasks to
+avoid any risk of corrupting R's memory. It will tell Vim that "R is busy" and
+Vim will display this message. Everything should work as expected again after
+any valid code is executed in the R Console.
 
 The vimcom library is started with the state `busy`.
 
@@ -1101,7 +1101,7 @@ VIMINSTANCEID, and VIMRPLUGIN_SECRET. The first one is the path used by the R
 package vimcom to save temporary files used by the Vim-R-plugin to: perform
 omnicompletion, show R documentation in a Vim buffer, and update the Object
 Browser. The two last ones are used by the Vim-R-plugin and by vimcom to know
-that the connections are valid. If you use Vim to start R, but then closes
+that the connections are valid. If you use Vim to start R, but then close
 Vim, some variables will become outdated. Additionally, the Vim-R-plugin sets
 the value of its internal variable SendCmdToR from SendCmdToR_fake to the
 appropriate value when R is successfully started. It is possible to set the
@@ -1400,8 +1400,8 @@ it works, please, read the subsection 6.5.2 below.
 ------------------------------------------------------------------------------
 6.5.2. Details and other options:~
 
-The plugin key bindings will remain active in the documentation buffer, and,
-thus, you will be able to send commands to R as you do while editing an R
+The plugin key bindings will remain active in the documentation buffer
+allowing you to send commands to R as you would do do while editing an R
 script. You can, for example, use rh to jump to another R help
 document.
 
@@ -2148,7 +2148,7 @@ can type |:map| to see the complete list of current mappings, and below is the
 list of the names for custom key bindings (the prefix RE means "echo";
 RD, "cursor down"; RED, both "echo" and "down"):
 
-   Star/Close R~
+   Start/Close R~
    RStart
    RCustomStart
    RClose
@@ -2282,7 +2282,7 @@ later version.
 
 The Vim-R-plugin is distributed in the hope that it will be useful, but
 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
 details.
 
 A copy of the GNU General Public License is available at
@@ -2553,9 +2553,9 @@ develop a better algorithm in the future.
 9.10. Highlight chunk header as R code~
 
 By default, Vim will highlight chunk headers of RMarkdown and
-RreStructuredText with a single color. When the code is processed by knitr,
-chunk headers should contain valid R code and, thus, you may want to highlight
-them as such. You can do this by putting in your |vimrc|:
+RreStructuredText with a single color. Chunk headers should contain valid R
+code when the code is processed by knitr, so you may want to highlight them as
+such. You can do this by putting in your |vimrc|:
 >
    let rrst_syn_hl_chunk = 1
    let rmd_syn_hl_chunk = 1

From 009db675e284a3139e15b12429cad40be5137274 Mon Sep 17 00:00:00 2001
From: frans 
Date: Fri, 21 Aug 2015 10:34:47 -0600
Subject: [PATCH 0996/1050] Fixes regular expression to identify triple
 back-ticks in Rmd

See issue #14 in Nvim-R for additional details.
---
 r-plugin/common_global.vim | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 77949ad..d3057aa 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -1537,7 +1537,7 @@ function RSourceLines(...)
         let lines = map(copy(lines), 'substitute(v:val, "^\\.\\. \\?", "", "")')
     endif
     if &filetype == "rmd"
-        let lines = map(copy(lines), 'substitute(v:val, "^\\`\\`\\?", "", "")')
+        let lines = map(copy(lines), 'substitute(v:val, "^(\\`\\`)\\?", "", "")')
     endif
     call writefile(lines, g:rplugin_rsource)
     let sargs = ""
@@ -1898,7 +1898,7 @@ function SendLineToR(godown)
             call KnitChild(line, a:godown)
             return
         endif
-        let line = substitute(line, "^\\`\\`\\?", "", "")
+        let line = substitute(line, "^(\\`\\`)\\?", "", "")
         if RmdIsInRCode(1) == 0
             return
         endif

From 6661cf2423431dba769ec9c5d3354aeaf7a1c83c Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Fri, 11 Sep 2015 11:10:52 -0300
Subject: [PATCH 0997/1050] Make \aa use vimrplugin_source_args

---
 r-plugin/common_global.vim | 26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index d3057aa..a33883d 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -1530,6 +1530,17 @@ function GetROutput(outf)
     redraw
 endfunction
 
+function GetSourceArgs(e)
+    let sargs = ""
+    if g:vimrplugin_source_args != ""
+        let sargs = ", " . g:vimrplugin_source_args
+    endif
+    if a:e == "echo"
+        let sargs .= ', echo=TRUE'
+    endif
+    return sargs
+endfunction
+
 " Send sources to R
 function RSourceLines(...)
     let lines = a:1
@@ -1540,19 +1551,13 @@ function RSourceLines(...)
         let lines = map(copy(lines), 'substitute(v:val, "^(\\`\\`)\\?", "", "")')
     endif
     call writefile(lines, g:rplugin_rsource)
-    let sargs = ""
-    if g:vimrplugin_source_args != ""
-        let sargs = ", " . g:vimrplugin_source_args
-    endif
 
     if a:0 == 3 && a:3 == "NewtabInsert"
         call SendToVimCom("\x08" . $VIMINSTANCEID . 'vimcom:::vim_capture_source_output("' . g:rplugin_rsource . '", "' . g:rplugin_tmpdir . '/Rinsert")')
         return 1
     endif
 
-    if a:2 == "echo"
-        let sargs .= ', echo=TRUE'
-    endif
+    let sargs = GetSourceArgs(a:2)
     let rcmd = 'base::source("' . g:rplugin_rsource . '"' . sargs . ')'
     let ok = g:SendCmdToR(rcmd)
     return ok
@@ -1565,11 +1570,8 @@ function SendFileToR(e)
     if has("win32") || has("win64")
         let fpath = substitute(fpath, "\\", "/", "g")
     endif
-    if a:e == "echo"
-        call g:SendCmdToR('base::source("' . fpath . '", echo=TRUE)')
-    else
-        call g:SendCmdToR('base::source("' . fpath . '")')
-    endif
+    let sargs = GetSourceArgs(a:e)
+    call g:SendCmdToR('base::source("' . fpath .  '"' . sargs . ')')
 endfunction
 
 " Send block to R

From 443813f0f2f2101bb8bfac1adc1b1fa2e3b2daf1 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Tue, 29 Sep 2015 17:07:59 -0300
Subject: [PATCH 0998/1050] Set updatetime=100 for external Object Browser
 Perhaps because of patch 7.4.866, Vim no longer updates the Object Browser
 immediately. Decreasing the value of 'updatetime' makes the update fast
 again, but I am doing it only when the Object Browser is running in its own
 Vim instance because I think it is better to avoid messing with user options.

---
 r-plugin/common_global.vim | 1 +
 1 file changed, 1 insertion(+)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index a33883d..3f1c417 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -1083,6 +1083,7 @@ function StartObjBrowser_Tmux()
                 \ 'set rulerformat=%3(%l%)',
                 \ 'set laststatus=0',
                 \ 'set noruler',
+                \ 'set updatetime=100',
                 \ 'let g:SendCmdToR = function("SendCmdToR_TmuxSplit")',
                 \ 'let g:RBrOpenCloseLs = function("RBrOpenCloseLs_TmuxOB")',
                 \ 'if has("clientserver") && v:servername != ""',

From 685c684d75214ba533c656bd679aa027d48988c4 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Fri, 2 Oct 2015 22:10:03 -0300
Subject: [PATCH 0999/1050] Use non R omnifunc in Rnw, Rmd and Rrst If not
 inside a chunk of R code, the CompleteR function will call the 'omnifunc'
 that was defined before common_buffer.vim was sourced.

---
 autoload/rcomplete.vim     | 7 ++++---
 r-plugin/common_buffer.vim | 3 +++
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/autoload/rcomplete.vim b/autoload/rcomplete.vim
index 9350f31..0309462 100644
--- a/autoload/rcomplete.vim
+++ b/autoload/rcomplete.vim
@@ -45,9 +45,10 @@ function BuildROmniList(pattern)
 endfunction
 
 fun! rcomplete#CompleteR(findstart, base)
-    if &filetype == "rnoweb" && RnwIsInRCode(0) == 0 && exists("*LatexBox_Complete")
-        let texbegin = LatexBox_Complete(a:findstart, a:base)
-        return texbegin
+    if ((&filetype == "rnoweb" && RnwIsInRCode(0) == 0) || (&filetype == "rmd" && RmdIsInRCode(0) == 0) || (&filetype == "rrst" && RrstIsInRCode(0) == 0)) && b:rplugin_nonr_omnifunc != ""
+        let Ofun = function(b:rplugin_nonr_omnifunc)
+        let thebegin = Ofun(a:findstart, a:base)
+        return thebegin
     endif
     if a:findstart
         let line = getline('.')
diff --git a/r-plugin/common_buffer.vim b/r-plugin/common_buffer.vim
index ea36274..7d5a868 100644
--- a/r-plugin/common_buffer.vim
+++ b/r-plugin/common_buffer.vim
@@ -25,6 +25,9 @@
 
 " Set completion with CTRL-X CTRL-O to autoloaded function.
 if exists('&ofu')
+    if &filetype == "rnoweb" || &filetype == "rrst" || &filetype == "rmd"
+        let b:rplugin_nonr_omnifunc = &omnifunc
+    endif
     if &filetype == "r" || &filetype == "rnoweb" || &filetype == "rdoc" || &filetype == "rhelp" || &filetype == "rrst" || &filetype == "rmd"
         setlocal omnifunc=rcomplete#CompleteR
     endif

From 6f0090cb5464360d3d4c69db12abdbaa1b05ffb8 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sat, 3 Oct 2015 12:34:03 -0300
Subject: [PATCH 1000/1050] Improve omni completion of Rhelp files

---
 autoload/rcomplete.vim     |  2 +-
 ftplugin/rhelp_rplugin.vim | 39 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 40 insertions(+), 1 deletion(-)

diff --git a/autoload/rcomplete.vim b/autoload/rcomplete.vim
index 0309462..e3b046e 100644
--- a/autoload/rcomplete.vim
+++ b/autoload/rcomplete.vim
@@ -45,7 +45,7 @@ function BuildROmniList(pattern)
 endfunction
 
 fun! rcomplete#CompleteR(findstart, base)
-    if ((&filetype == "rnoweb" && RnwIsInRCode(0) == 0) || (&filetype == "rmd" && RmdIsInRCode(0) == 0) || (&filetype == "rrst" && RrstIsInRCode(0) == 0)) && b:rplugin_nonr_omnifunc != ""
+    if (&filetype == "rnoweb" || &filetype == "rmd" || &filetype == "rrst" || &filetype == "rhelp") && b:IsInRCode(0) == 0 && b:rplugin_nonr_omnifunc != ""
         let Ofun = function(b:rplugin_nonr_omnifunc)
         let thebegin = Ofun(a:findstart, a:base)
         return thebegin
diff --git a/ftplugin/rhelp_rplugin.vim b/ftplugin/rhelp_rplugin.vim
index 2748dcd..8212131 100644
--- a/ftplugin/rhelp_rplugin.vim
+++ b/ftplugin/rhelp_rplugin.vim
@@ -34,7 +34,46 @@ function! RhelpIsInRCode(vrb)
     endif
 endfunction
 
+function! RhelpComplete(findstart, base)
+    if a:findstart
+        let line = getline('.')
+        let start = col('.') - 1
+        while start > 0 && (line[start - 1] =~ '\w' || line[start - 1] == '\')
+            let start -= 1
+        endwhile
+        return start
+    else
+        let resp = []
+        let hwords = ['\Alpha', '\Beta', '\Chi', '\Delta', '\Epsilon',
+                    \ '\Eta', '\Gamma', '\Iota', '\Kappa', '\Lambda', '\Mu', '\Nu',
+                    \ '\Omega', '\Omicron', '\Phi', '\Pi', '\Psi', '\R', '\Rdversion',
+                    \ '\Rho', '\S4method', '\Sexpr', '\Sigma', '\Tau', '\Theta', '\Upsilon',
+                    \ '\Xi', '\Zeta', '\acronym', '\alias', '\alpha', '\arguments',
+                    \ '\author', '\beta', '\bold', '\chi', '\cite', '\code', '\command',
+                    \ '\concept', '\cr', '\dQuote', '\delta', '\deqn', '\describe',
+                    \ '\description', '\details', '\dfn', '\docType', '\dontrun', '\dontshow',
+                    \ '\donttest', '\dots', '\email', '\emph', '\encoding', '\enumerate',
+                    \ '\env', '\epsilon', '\eqn', '\eta', '\examples', '\file', '\format',
+                    \ '\gamma', '\ge', '\href', '\iota', '\item', '\itemize', '\kappa',
+                    \ '\kbd', '\keyword', '\lambda', '\ldots', '\le',
+                    \ '\link', '\linkS4class', '\method', '\mu', '\name', '\newcommand',
+                    \ '\note', '\nu', '\omega', '\omicron', '\option', '\phi', '\pi',
+                    \ '\pkg', '\preformatted', '\psi', '\references', '\renewcommand', '\rho',
+                    \ '\sQuote', '\samp', '\section', '\seealso', '\sigma', '\source',
+                    \ '\special', '\strong', '\subsection', '\synopsis', '\tab', '\tabular',
+                    \ '\tau', '\testonly', '\theta', '\title', '\upsilon', '\url', '\usage',
+                    \ '\value', '\var', '\verb', '\xi', '\zeta']
+        for word in hwords
+            if word =~ '^' . escape(a:base, '\')
+                call add(resp, {'word': word})
+            endif
+        endfor
+        return resp
+    endif
+endfunction
+
 let b:IsInRCode = function("RhelpIsInRCode")
+let b:rplugin_nonr_omnifunc = "RhelpComplete"
 
 "==========================================================================
 " Key bindings and menu items

From afc2807e2aebed7e09d866d74ef8fe3837d90b86 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sat, 10 Oct 2015 11:07:10 -0300
Subject: [PATCH 1001/1050] Set encoding of start_zathura.py

---
 r-plugin/common_global.vim | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 3f1c417..9bb7d3b 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -2424,7 +2424,8 @@ endfunction
 
 function RStart_Zathura(basenm)
     let a2 = 'a2 = "vim --servername ' . v:servername . " --remote-expr \\\"SyncTeX_backward('%{input}',%{line})\\\"" . '"'
-    let pycode = ["import subprocess",
+    let pycode = ["# -*- coding: " . &encoding . " -*-",
+                \ "import subprocess",
                 \ "import os",
                 \ "import sys",
                 \ "FNULL = open(os.devnull, 'w')",

From 26aea154ecd318b0e9f3870ca776e5d321697ef2 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sat, 10 Oct 2015 19:07:08 -0300
Subject: [PATCH 1002/1050] Warn if starting Zathura failed

---
 r-plugin/common_global.vim | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 9bb7d3b..f867ff4 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -2436,7 +2436,11 @@ function RStart_Zathura(basenm)
                 \ "sys.stdout.write(str(zpid))" ]
     call writefile(pycode, g:rplugin_tmpdir . "/start_zathura.py")
     let pid = system("python '" . g:rplugin_tmpdir . "/start_zathura.py" . "'")
-    let g:rplugin_zathura_pid[a:basenm] = pid
+    if pid == 0
+        call RWarningMsg("Failed to run Zathura: " . substitute(pid, "\n", " ", "g"))
+    else
+        let g:rplugin_zathura_pid[a:basenm] = pid
+    endif
     call delete(g:rplugin_tmpdir . "/start_zathura.py")
 endfunction
 

From 918a2c11204d10ad399c33c1c84c3fda705e06ad Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sun, 11 Oct 2015 18:55:22 -0300
Subject: [PATCH 1003/1050] Call independent Tmux when R in external terminal
 When running R in an external terminal, call Tmux with the -L argument to
 make it independent on any other Tmux session eventually running.

---
 r-plugin/common_global.vim | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index f867ff4..e86b90b 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -709,20 +709,20 @@ function StartR_ExternalTerm(rcmd)
 
     let rcmd = 'VIMRPLUGIN_TMPDIR=' . substitute(g:rplugin_tmpdir, ' ', '\\ ', 'g') . ' VIMRPLUGIN_COMPLDIR=' . substitute(g:rplugin_compldir, ' ', '\\ ', 'g') . ' VIMINSTANCEID=' . $VIMINSTANCEID . ' VIMRPLUGIN_SECRET=' . $VIMRPLUGIN_SECRET . ' VIMEDITOR_SVRNM=' . $VIMEDITOR_SVRNM . ' ' . a:rcmd
 
-    call system("tmux has-session -t " . g:rplugin_tmuxsname)
+    call system("tmux -L vimr has-session -t " . g:rplugin_tmuxsname)
     if v:shell_error
         if g:rplugin_is_darwin
             let $VIM_BINARY_PATH = substitute($VIMRUNTIME, "/MacVim.app/Contents/.*", "", "") . "/MacVim.app/Contents/MacOS/Vim"
             let rcmd = "VIM_BINARY_PATH=" . substitute($VIM_BINARY_PATH, ' ', '\\ ', 'g') . ' TERM=screen-256color ' . rcmd
-            let opencmd = printf("tmux -2 %s new-session -s %s '%s'", tmuxcnf, g:rplugin_tmuxsname, rcmd)
+            let opencmd = printf("tmux -L vimr -2 %s new-session -s %s '%s'", tmuxcnf, g:rplugin_tmuxsname, rcmd)
             call writefile(["#!/bin/sh", opencmd], $VIMRPLUGIN_TMPDIR . "/openR")
             call system("chmod +x '" . $VIMRPLUGIN_TMPDIR . "/openR'")
             let opencmd = "open '" . $VIMRPLUGIN_TMPDIR . "/openR'"
         else
             if g:rplugin_termcmd =~ "gnome-terminal" || g:rplugin_termcmd =~ "xfce4-terminal" || g:rplugin_termcmd =~ "terminal" || g:rplugin_termcmd =~ "iterm"
-                let opencmd = printf("%s 'tmux -2 %s new-session -s %s \"%s\"' &", g:rplugin_termcmd, tmuxcnf, g:rplugin_tmuxsname, rcmd)
+                let opencmd = printf("%s 'tmux -L vimr -2 %s new-session -s %s \"%s\"' &", g:rplugin_termcmd, tmuxcnf, g:rplugin_tmuxsname, rcmd)
             else
-                let opencmd = printf("%s tmux -2 %s new-session -s %s \"%s\" &", g:rplugin_termcmd, tmuxcnf, g:rplugin_tmuxsname, rcmd)
+                let opencmd = printf("%s tmux -L vimr -2 %s new-session -s %s \"%s\" &", g:rplugin_termcmd, tmuxcnf, g:rplugin_tmuxsname, rcmd)
             endif
         endif
     else
@@ -731,9 +731,9 @@ function StartR_ExternalTerm(rcmd)
             return
         endif
         if g:rplugin_termcmd =~ "gnome-terminal" || g:rplugin_termcmd =~ "xfce4-terminal" || g:rplugin_termcmd =~ "terminal" || g:rplugin_termcmd =~ "iterm"
-            let opencmd = printf("%s 'tmux -2 %s attach-session -d -t %s' &", g:rplugin_termcmd, tmuxcnf, g:rplugin_tmuxsname)
+            let opencmd = printf("%s 'tmux -L vimr -2 %s attach-session -d -t %s' &", g:rplugin_termcmd, tmuxcnf, g:rplugin_tmuxsname)
         else
-            let opencmd = printf("%s tmux -2 %s attach-session -d -t %s &", g:rplugin_termcmd, tmuxcnf, g:rplugin_tmuxsname)
+            let opencmd = printf("%s tmux -L vimr -2 %s attach-session -d -t %s &", g:rplugin_termcmd, tmuxcnf, g:rplugin_tmuxsname)
         endif
     endif
 
@@ -1449,7 +1449,7 @@ function SendCmdToR_Term(cmd)
 
     " Send the command to R running in an external terminal emulator
     let str = substitute(cmd, "'", "'\\\\''", "g")
-    let scmd = "tmux set-buffer '" . str . "\' && tmux paste-buffer -t " . g:rplugin_tmuxsname . '.0'
+    let scmd = "tmux -L vimr set-buffer '" . str . "\' && tmux -L vimr paste-buffer -t " . g:rplugin_tmuxsname . '.0'
     let rlog = system(scmd)
     if v:shell_error
         let rlog = substitute(rlog, '\n', ' ', 'g')
@@ -3162,7 +3162,8 @@ else
     call RSetDefaultValue("g:vimrplugin_tmux_ob", 1)
 endif
 
-if has("gui_running") || has("win32") || g:vimrplugin_applescript || !g:rplugin_do_tmux_split
+if has("gui_running") || has("win32") || g:vimrplugin_applescript
+    let g:rplugin_do_tmux_split = 0
     let g:vimrplugin_tmux_ob = 0
     if g:vimrplugin_objbr_place =~ "console"
         let g:vimrplugin_objbr_place = substitute(g:vimrplugin_objbr_place, "console", "script", "")

From 6173840873e6b2ea70c93d6c7bc4fa0f4573bdb7 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Mon, 12 Oct 2015 15:30:00 -0300
Subject: [PATCH 1004/1050] Update tips on how to get 256 colors

---
 doc/r-plugin.txt | 40 +++++++++++++++++-----------------------
 1 file changed, 17 insertions(+), 23 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 9b190ad..55e6c0b 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -2586,13 +2586,7 @@ Vim breaks the R code automatically put in your |vimrc|:
 
 If you want 256 colors support in Vim, install the package ncurses-term. Then
 put in your `~/.bashrc` the lines suggested at |r-plugin-bash-setup|.
-Finally, put in your |vimrc|:
->
-   if &term =~ "xterm" || &term =~ "256" || $DISPLAY != ""
-       set t_Co=256
-   endif
-   colorscheme your_preferred_color_scheme
-<
+
 You have to search the internet for color schemes supporting 256 colors,
 download and copy them to ~/.vim/colors. You may use the command
 |:colorscheme| to try them one by one before setting your preference in your
@@ -2738,11 +2732,6 @@ please read this document from the beginning.
    " schemes that supports 256 colors in the terminal emulator. Then,
    " uncomment the code below to set you color scheme:
    "colorscheme not_defined
-
-   " Use 256 colors even if in a terminal emulator:
-   if &term =~ "xterm" || &term =~ "256" || $DISPLAY != ""
-       set t_Co=256
-   endif
 <
 
 							    *r-plugin-R-setup*
@@ -2763,25 +2752,30 @@ please read this document from the beginning.
 <
 
 							 *r-plugin-bash-setup*
-   ~/.bashrc for Vim (Unix):~
+   ~/.bashrc (Linux, Mac OS X, and other Unix systems):~
 >
-   # Change the TERM environment variable (to get 256 colors) and make Vim
-   # connecting to X Server even if running in a terminal emulator (many of
-   # the plugin features depend on this).
+   # Change the TERM environment variable (to get 256 colors) even if you are
+   # accessing your system through ssh and using either Tmux or GNU Screen:
+   if [ "$TERM" = "xterm" ] || [ "$TERM" = "xterm-256color" ]
+   then
+       export TERM=xterm-256color
+       export HAS_256_COLORS=yes
+   fi
+   if [ "$TERM" = "screen" ] && [ "$HAS_256_COLORS" = "yes" ]
+   then
+       export TERM=screen-256color
+   fi
+
+   # Make Vim connect to X Server even if the gui is not running (many of the
+   # plugin features depend on this).
    if [ "x$DISPLAY" != "x" ]
    then
-       if [ "screen" = "$TERM" ]
-       then
-           export TERM=screen-256color
-       else
-           export TERM=xterm-256color
-       fi
        alias vim='vim --servername VIM'
    fi
 <
 
 
-Finally, if you want to use vi key bindings in Bash:
+Finally, if you want to use vi key bindings in Bash or other shell:
 
    ~/.inputrc~
 >

From 20ffc326c67525cffee15fd21adb65898c393e85 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Tue, 13 Oct 2015 07:12:42 -0300
Subject: [PATCH 1005/1050] Warn if --servername was not passed to Vim

---
 r-plugin/common_global.vim | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index e86b90b..f494229 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -918,8 +918,13 @@ function StartR(whatr)
             endif
         endif
     endif
-
-    echon
+    if has("clientserver") && v:servername == "" && $DISPLAY != ""
+        call RWarningMsgInp("You have to restart Vim with the --servername argument otherwise Vim cannot receive messages from R.")
+        redraw
+        call RWarningMsg('Example: "vim --servername VIM ' . bufname("%") . '"')
+    else
+        echon
+    endif
 endfunction
 
 " To be called by edit() in R running in Neovim buffer.

From 0c860b5e735f5aa1cd8dcc8fa7522c3f9d25dc31 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Wed, 14 Oct 2015 15:25:47 -0300
Subject: [PATCH 1006/1050] Minor improvement in documentation

---
 doc/r-plugin.txt | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 55e6c0b..367ee4e 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -253,23 +253,25 @@ Put the following in your `~/.bashrc`:
 Before proceeding, you have to start a new shell session to have the alias
 enabled.
 
-If you start either GVim or Vim in a terminal emulator the plugin will start R
-in a external terminal emulator. If you start Vim inside of a Tmux session,
-the plugin will split the Tmux window in two and start R in the other pane.
-
-The recommended way of running the plugin on Linux is running Vim inside a
-Tmux session. Please, read |r-plugin-tmux| for details.
+If you start Vim in a terminal emulator, inside of a Tmux session, the plugin
+will split the Tmux window in two and start R in the other pane. This is the
+recommended way of running the plugin on Linux (read |r-plugin-tmux| for
+details). If you either use GVim or Vim not inside a Tmux session the plugin
+will start R in a external terminal emulator. This is useful if you have two
+monitors.
 
 If you run Vim in a terminal emulator, it must be started with the argument
-|--servername|. Please, read the section |r-plugin-bash-setup| to know some
-tips on how to configure Bash.
+|--servername| to enable the 'clientserver' feature (please, read the section
+|r-plugin-bash-setup| to know some tips on how to configure Bash). This is not
+necessary with GVim because it always runs with the 'clientserver' feature
+enabled.
 
 
 ------------------------------------------------------------------------------
 3.4. Plugin installation (instructions for all systems)~
 
 You need to activate plugins and indentation according to 'filetype'. You
-should have at least the following options at the top or at near the very top
+should have at least the following options at the top or near the very top
 of your |vimrc| (but below `set` `runtimepath`, if you have set it):
 >
    set nocompatible

From 7ce01e3b6322d7f958c065c984719d7dbeb6e694 Mon Sep 17 00:00:00 2001
From: Michael Lerch 
Date: Sat, 17 Oct 2015 09:37:37 -0600
Subject: [PATCH 1007/1050] Fix typo

---
 doc/r-plugin.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 367ee4e..d218ba1 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -1664,7 +1664,7 @@ this behavior. Examples:
    let vimrplugin_latexcmd = 'latexmk -pdf -pdflatex="xelatex %O -synctex=1 %S"'
 <
 By default, vimrplugin_latexmk is 0 on Windows and 1 on other systems.
-If you want to pass arguments do the `Sweave()` function, set the value of the
+If you want to pass arguments to the `Sweave()` function, set the value of the
 vimrplugin_sweaveargs variable.
 
 If the value of `vimrplugin_texerr` is `1`, a summary of LaTeX errors

From 3546ecf714d7a04680338e8f159d5919062abf9f Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Tue, 20 Oct 2015 08:08:26 -0300
Subject: [PATCH 1008/1050] Send ROxygen lines

---
 r-plugin/common_global.vim | 36 +++++++++++++++++++++++++++++-------
 1 file changed, 29 insertions(+), 7 deletions(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index f494229..7ce76d0 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -561,12 +561,30 @@ function CountBraces(line)
     return result
 endfunction
 
+function CleanOxygenLine(line)
+    let cline = a:line
+    if cline =~ "^\s*#\\{1,2}'"
+        let synName = synIDattr(synID(line("."), col("."), 1), "name")
+        if synName == "rOExamples"
+            let cline = substitute(cline, "^\s*#\\{1,2}'", "", "")
+        endif
+    endif
+    return cline
+endfunction
+
+function CleanCurrentLine()
+    let curline = substitute(getline("."), '^\s*', "", "")
+    if &filetype == "r"
+        let curline = CleanOxygenLine(curline)
+    endif
+    return curline
+endfunction
+
 " Skip empty lines and lines whose first non blank char is '#'
 function GoDown()
     if &filetype == "rnoweb"
         let curline = getline(".")
-        let fc = curline[0]
-        if fc == '@'
+        if curline[0] == '@'
             call RnwNextChunk()
             return
         endif
@@ -586,14 +604,12 @@ function GoDown()
 
     let i = line(".") + 1
     call cursor(i, 1)
-    let curline = substitute(getline("."), '^\s*', "", "")
-    let fc = curline[0]
+    let curline = CleanCurrentLine()
     let lastLine = line("$")
-    while i < lastLine && (fc == '#' || strlen(curline) == 0)
+    while i < lastLine && (curline[0] == '#' || strlen(curline) == 0)
         let i = i + 1
         call cursor(i, 1)
-        let curline = substitute(getline("."), '^\s*', "", "")
-        let fc = curline[0]
+        let curline = CleanCurrentLine()
     endwhile
 endfunction
 
@@ -1746,6 +1762,8 @@ function SendSelectionToR(...)
         let lines[llen] = strpart(lines[llen], 0, j)
     endif
 
+    let lines = map(copy(lines), 'substitute(v:val, "^#' . "'" . '", "", "")')
+
     if a:0 == 3 && a:3 == "NewtabInsert"
         let ok = RSourceLines(lines, a:1, "NewtabInsert")
     else
@@ -1945,6 +1963,10 @@ function SendLineToR(godown)
         return
     endif
 
+    if &filetype == "r"
+        let line = CleanOxygenLine(line)
+    endif
+
     let ok = g:SendCmdToR(line)
     if ok
         if a:godown =~ "down"

From 136738faad9966079e3c05c140845ed594299c25 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Wed, 21 Oct 2015 06:10:34 -0300
Subject: [PATCH 1009/1050] Send ROxygen lines

---
 r-plugin/common_global.vim | 36 +++++++++++++++++++++++++++++-------
 1 file changed, 29 insertions(+), 7 deletions(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index f494229..7ce76d0 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -561,12 +561,30 @@ function CountBraces(line)
     return result
 endfunction
 
+function CleanOxygenLine(line)
+    let cline = a:line
+    if cline =~ "^\s*#\\{1,2}'"
+        let synName = synIDattr(synID(line("."), col("."), 1), "name")
+        if synName == "rOExamples"
+            let cline = substitute(cline, "^\s*#\\{1,2}'", "", "")
+        endif
+    endif
+    return cline
+endfunction
+
+function CleanCurrentLine()
+    let curline = substitute(getline("."), '^\s*', "", "")
+    if &filetype == "r"
+        let curline = CleanOxygenLine(curline)
+    endif
+    return curline
+endfunction
+
 " Skip empty lines and lines whose first non blank char is '#'
 function GoDown()
     if &filetype == "rnoweb"
         let curline = getline(".")
-        let fc = curline[0]
-        if fc == '@'
+        if curline[0] == '@'
             call RnwNextChunk()
             return
         endif
@@ -586,14 +604,12 @@ function GoDown()
 
     let i = line(".") + 1
     call cursor(i, 1)
-    let curline = substitute(getline("."), '^\s*', "", "")
-    let fc = curline[0]
+    let curline = CleanCurrentLine()
     let lastLine = line("$")
-    while i < lastLine && (fc == '#' || strlen(curline) == 0)
+    while i < lastLine && (curline[0] == '#' || strlen(curline) == 0)
         let i = i + 1
         call cursor(i, 1)
-        let curline = substitute(getline("."), '^\s*', "", "")
-        let fc = curline[0]
+        let curline = CleanCurrentLine()
     endwhile
 endfunction
 
@@ -1746,6 +1762,8 @@ function SendSelectionToR(...)
         let lines[llen] = strpart(lines[llen], 0, j)
     endif
 
+    let lines = map(copy(lines), 'substitute(v:val, "^#' . "'" . '", "", "")')
+
     if a:0 == 3 && a:3 == "NewtabInsert"
         let ok = RSourceLines(lines, a:1, "NewtabInsert")
     else
@@ -1945,6 +1963,10 @@ function SendLineToR(godown)
         return
     endif
 
+    if &filetype == "r"
+        let line = CleanOxygenLine(line)
+    endif
+
     let ok = g:SendCmdToR(line)
     if ok
         if a:godown =~ "down"

From 9b90b73bf0912b519b79805e2a84e6e4bcf86973 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Wed, 21 Oct 2015 06:42:00 -0300
Subject: [PATCH 1010/1050] Replace imap with inoremap See
 https://github.com/jalvesaq/Nvim-R/issues/12

---
 ftplugin/rnoweb_rplugin.vim |  2 +-
 r-plugin/common_global.vim  | 10 +++++-----
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/ftplugin/rnoweb_rplugin.vim b/ftplugin/rnoweb_rplugin.vim
index 8e2da70..9dad92e 100644
--- a/ftplugin/rnoweb_rplugin.vim
+++ b/ftplugin/rnoweb_rplugin.vim
@@ -244,7 +244,7 @@ endfunction
 
 if g:vimrplugin_rnowebchunk == 1
     " Write code chunk in rnoweb files
-    imap  < :call RWriteChunk()a
+    inoremap  < :call RWriteChunk()a
 endif
 
 " Pointers to functions whose purposes are the same in rnoweb, rrst, rmd,
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 7ce76d0..8186bd2 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -2859,16 +2859,16 @@ function RCreateEditMaps()
     call RCreateMaps("v", 'RRightComment',    ';', ':call MovePosRCodeComment("selection")')
     " Replace 'underline' with '<-'
     if g:vimrplugin_assign == 1 || g:vimrplugin_assign == 2
-        silent exe 'imap  ' . g:vimrplugin_assign_map . ' :call ReplaceUnderS()a'
+        silent exe 'inoremap  ' . g:vimrplugin_assign_map . ' :call ReplaceUnderS()a'
     endif
     if g:vimrplugin_args_in_stline
-        imap  ( :call DisplayArgs()a
-        imap  ) :call RestoreStatusLine()a
+        inoremap  ( :call DisplayArgs()a
+        inoremap  ) :call RestoreStatusLine()a
     endif
     if hasmapto("RCompleteArgs", "i")
-        imap  RCompleteArgs =RCompleteArgs()
+        inoremap  RCompleteArgs =RCompleteArgs()
     else
-        imap   =RCompleteArgs()
+        inoremap   =RCompleteArgs()
     endif
 endfunction
 

From 69f8526bf24bd5e9c23a97c5e4d38280973357b2 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sat, 31 Oct 2015 18:27:43 -0300
Subject: [PATCH 1011/1050] Use the value of $XDG_CACHE_HOME if it is set

---
 r-plugin/setcompldir.vim | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/r-plugin/setcompldir.vim b/r-plugin/setcompldir.vim
index 27b58ba..27cad20 100644
--- a/r-plugin/setcompldir.vim
+++ b/r-plugin/setcompldir.vim
@@ -49,6 +49,8 @@ if exists("g:vimrplugin_compldir")
     let g:rplugin_compldir = expand(g:vimrplugin_compldir)
 elseif (has("win32") || has("win64")) && $AppData != "" && isdirectory($AppData)
     let g:rplugin_compldir = $AppData . "\\Vim-R-plugin"
+elseif $XDG_CACHE_HOME != "" && isdirectory($XDG_CACHE_HOME)
+    let g:rplugin_compldir = $XDG_CACHE_HOME . "/Vim-R-plugin"
 elseif isdirectory(expand("~/.cache"))
     let g:rplugin_compldir = expand("~/.cache/Vim-R-plugin")
 elseif isdirectory(expand("~/Library/Caches"))

From 60f50514c3bca8fe5173b4a269c9c41d0253e19c Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Mon, 23 Nov 2015 07:14:55 -0300
Subject: [PATCH 1012/1050] Close #191

---
 doc/r-plugin.txt | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index d218ba1..0ec325c 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -817,9 +817,12 @@ file:
 
    # Options enable mouse support in Tmux
    set -g terminal-overrides 'xterm*:smcup@:rmcup@'
+   # For Tmux < 2.1
    set -g mode-mouse on
    set -g mouse-select-pane on
    set -g mouse-resize-pane on
+   # For Tmux >= 2.1
+   set -g mouse on
 
    # Act more like vim:
    set-window-option -g mode-keys vi

From 1bcdc679b7ac0256ffecaa17ace26338511ce80f Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Mon, 23 Nov 2015 19:25:37 -0300
Subject: [PATCH 1013/1050] Change mouse setting for Tmux >= 2.1

---
 r-plugin/common_global.vim | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 8186bd2..7bf2db6 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -717,7 +717,11 @@ function StartR_ExternalTerm(rcmd)
         endif
 
         if g:vimrplugin_tmux_ob || !has("gui_running")
-            call extend(cnflines, ['set -g mode-mouse on', 'set -g mouse-select-pane on', 'set -g mouse-resize-pane on'])
+            if g:rplugin_tmux_version < "2.1"
+                call extend(cnflines, ['set -g mode-mouse on', 'set -g mouse-select-pane on', 'set -g mouse-resize-pane on'])
+            else
+                call extend(cnflines, ['set -g mouse on'])
+            endif
         endif
         call writefile(cnflines, g:rplugin_tmpdir . "/tmux.conf")
         let tmuxcnf = '-f "' . g:rplugin_tmpdir . "/tmux.conf" . '"'
@@ -3212,17 +3216,16 @@ if !has("win32") && !has("win64") && !has("gui_win32") && !has("gui_win64") && !
         finish
     endif
 
-    let s:tmuxversion = system("tmux -V")
-    let s:tmuxversion = substitute(s:tmuxversion, '.*tmux \([0-9]\.[0-9]\).*', '\1', '')
-    if strlen(s:tmuxversion) != 3
-        let s:tmuxversion = "1.0"
+    let g:rplugin_tmux_version = system("tmux -V")
+    let g:rplugin_tmux_version = substitute(g:rplugin_tmux_version, '.*tmux \([0-9]\.[0-9]\).*', '\1', '')
+    if strlen(g:rplugin_tmux_version) != 3
+        let g:rplugin_tmux_version = "1.0"
     endif
-    if s:tmuxversion < "1.8" && g:vimrplugin_source !~ "screenR"
+    if g:rplugin_tmux_version < "1.8" && g:vimrplugin_source !~ "screenR"
         call RWarningMsgInp("Vim-R-plugin requires Tmux >= 1.8")
         let g:rplugin_failed = 1
         finish
     endif
-    unlet s:tmuxversion
 endif
 
 " Start with an empty list of objects in the workspace

From c298b33f8121eaaff71db74ec41dba4d17df386f Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Wed, 25 Nov 2015 07:15:12 -0300
Subject: [PATCH 1014/1050] About \o - Explain how \o works. - Warn that it
 does not work with a selection of lines.

---
 doc/r-plugin.txt           | 4 ++++
 r-plugin/common_global.vim | 1 +
 2 files changed, 5 insertions(+)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 0ec325c..f4da262 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -514,6 +514,10 @@ line currently under the cursor you should type d. If you want to
 see what lines are being sourced when sending a selection of lines, you can
 use either se or sa instead of ss.
 
+The command o runs in the background the R command `print(line)`,
+where `line` is the line under cursor, and adds the output as commented lines
+to the source code.
+
 If the cursor is over the header of an R chunk with the `child` option (from
 Rnoweb, RMarkdown or RreStructuredText document), and you use one of the
 commands that send a single line of code to R, then the plugin will send to R
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 7bf2db6..6bfeed4 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -2915,6 +2915,7 @@ function RCreateSendMaps()
     call RCreateMaps("ni", 'RSendLine', 'l', ':call SendLineToR("stay")')
     call RCreateMaps('ni0', 'RDSendLine', 'd', ':call SendLineToR("down")')
     call RCreateMaps('ni0', 'RDSendLineAndInsertOutput', 'o', ':call SendLineToRAndInsertOutput()')
+    call RCreateMaps('v', 'RDSendLineAndInsertOutput', 'o', ':call RWarningMsg("This command does not work over a selection of lines.")')
     call RCreateMaps('i', 'RSendLAndOpenNewOne', 'q', ':call SendLineToR("newline")')
     call RCreateMaps('n', 'RNLeftPart', 'r', ':call RSendPartOfLine("left", 0)')
     call RCreateMaps('n', 'RNRightPart', 'r', ':call RSendPartOfLine("right", 0)')

From 9c78d2cb1db40055bd73e1d655ea659f358d58df Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Fri, 27 Nov 2015 07:54:30 -0300
Subject: [PATCH 1015/1050] Version 1.2.7

---
 Makefile                   |  2 +-
 doc/r-plugin.txt           | 12 ++++++++----
 r-plugin/common_global.vim | 11 +++++++----
 3 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/Makefile b/Makefile
index d7e68d7..3964599 100644
--- a/Makefile
+++ b/Makefile
@@ -22,7 +22,7 @@
 
 
 PLUGINHOME=`pwd`
-PLUGINVERSION=1.2.6
+PLUGINVERSION=1.2.7
 DEBIANTIME=`date -R`
 PLUGINRELEASEDATE=`date +"%Y-%m-%d"`
 VIM2HTML=/usr/local/share/vim/vim74/doc/vim2html.pl 
diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index f4da262..9a347ee 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -5,7 +5,7 @@
 Authors: Jakson A. Aquino   
          Jose Claudio Faria 
 
-Version: 1.2.6
+Version: 1.2.7
 For Vim version 7.4
 
  1. Overview                                    |r-plugin-overview|
@@ -115,7 +115,7 @@ dependencies:
 
     * R's version must be >= 3.0.0: http://www.r-project.org/
 
-    * vimcom = 1.2-6: http://www.lepem.ufc.br/jaa/vimcom.html
+    * vimcom = 1.2-7: http://www.lepem.ufc.br/jaa/vimcom.html
 
       Note: If you cannot build vimcom yourself, you will want to
       download and install the zip file.
@@ -152,7 +152,7 @@ Before installing the plugin, you should install its dependencies:
 
    R >= 3.0.0: http://www.r-project.org/
 
-   vimcom = 1.2-6: http://www.lepem.ufc.br/jaa/vimcom.html
+   vimcom = 1.2-7: http://www.lepem.ufc.br/jaa/vimcom.html
 
    Only if you edit Rnoweb files: MacTeX, BasicTeX or other LaTeX system.
 
@@ -206,7 +206,7 @@ Before installing the plugin, you should install its dependencies:
 
    R >= 3.0.0: http://www.r-project.org/
 
-   vimcom = 1.2-6: http://www.lepem.ufc.br/jaa/vimcom.html
+   vimcom = 1.2-7: http://www.lepem.ufc.br/jaa/vimcom.html
 
    Tmux >= 1.8:   http://tmux.sourceforge.net
                   Tmux is necessary to send commands from Vim to R Console.
@@ -2833,6 +2833,10 @@ put in your |vimrc|:
 							       *r-plugin-news*
 10. News~
 
+1.2.7 (2015-11-27)
+
+ * Fix incompatibility with Tmux 2.1.
+
 1.2.6 (2015-06-12)
 
  * Improve support for lazy load objects in the Object Browser.
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 6bfeed4..8eee611 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -833,7 +833,7 @@ function StartR(whatr)
     else
         let start_options += ['options(vimcom.vimpager = TRUE)']
     endif
-    let start_options += ['if(utils::packageVersion("vimcom") != "1.2.6") warning("Your version of Vim-R-plugin requires vimcom-1.2-6.", call. = FALSE)']
+    let start_options += ['if(utils::packageVersion("vimcom") != "1.2.7") warning("Your version of Vim-R-plugin requires vimcom-1.2-7.", call. = FALSE)']
 
     let rwd = ""
     if g:vimrplugin_vim_wd == 0
@@ -1013,8 +1013,8 @@ function WaitVimComStart()
         if !filereadable(g:rplugin_vimcom_lib)
             call RWarningMsgInp('Could not find "' . g:rplugin_vimcom_lib . '".')
         endif
-        if g:rplugin_vimcom_version != "1.2.6"
-            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.2.6.')
+        if g:rplugin_vimcom_version != "1.2.7"
+            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.2.7.')
             sleep 1
         endif
         call delete(g:rplugin_tmpdir . "/vimcom_running_" . $VIMINSTANCEID)
@@ -3187,7 +3187,10 @@ endif
 
 if $TMUX == ""
     let g:rplugin_do_tmux_split = 0
-    call RSetDefaultValue("g:vimrplugin_tmux_ob", 0)
+    let g:vimrplugin_tmux_ob = 0
+    if g:vimrplugin_objbr_place =~ "console"
+        let g:vimrplugin_objbr_place = substitute(g:vimrplugin_objbr_place, "console", "script", "")
+    endif
 else
     let g:rplugin_do_tmux_split = 1
     let g:vimrplugin_applescript = 0

From 2d4a6219a8fe79a6f8e7ff749bd49f40a2f3bae6 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Mon, 30 Nov 2015 22:59:18 -0200
Subject: [PATCH 1016/1050] Gnome-terminal no longer has --title

---
 r-plugin/common_global.vim | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 8eee611..a35e5b6 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -3284,9 +3284,9 @@ let g:rplugin_termcmd = g:vimrplugin_term . " -e"
 if g:vimrplugin_term == "gnome-terminal" || g:vimrplugin_term == "xfce4-terminal" || g:vimrplugin_term == "terminal" || g:vimrplugin_term == "lxterminal"
     " Cannot set gnome-terminal icon: http://bugzilla.gnome.org/show_bug.cgi?id=126081
     if g:vimrplugin_vim_wd
-        let g:rplugin_termcmd = g:vimrplugin_term . " --title R -e"
+        let g:rplugin_termcmd = g:vimrplugin_term . " -e"
     else
-        let g:rplugin_termcmd = g:vimrplugin_term . " --working-directory='" . expand("%:p:h") . "' --title R -e"
+        let g:rplugin_termcmd = g:vimrplugin_term . " --working-directory='" . expand("%:p:h") . "' -e"
     endif
 endif
 

From 289da96cf7503c0bd8fe7fc9bdfe60849e4ea272 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Mon, 30 Nov 2015 22:59:56 -0200
Subject: [PATCH 1017/1050] Add space to lines beginning with - Close #195

---
 r-plugin/common_global.vim | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index a35e5b6..2afa049 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -1474,6 +1474,9 @@ function SendCmdToR_Term(cmd)
 
     " Send the command to R running in an external terminal emulator
     let str = substitute(cmd, "'", "'\\\\''", "g")
+    if str =~ '^-'
+        let str = ' ' . str
+    endif
     let scmd = "tmux -L vimr set-buffer '" . str . "\' && tmux -L vimr paste-buffer -t " . g:rplugin_tmuxsname . '.0'
     let rlog = system(scmd)
     if v:shell_error

From 9a8efdff38021cc5979f96f9bb2c4c18972d8d85 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Tue, 1 Dec 2015 22:35:28 -0200
Subject: [PATCH 1018/1050] New valid value for vimrplugin_assign (3) Close
 #194

---
 doc/r-plugin.txt           | 10 +++++++++-
 r-plugin/common_buffer.vim |  3 +++
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 9a347ee..f825abd 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -1331,7 +1331,15 @@ To completely disable this feature, put in your |vimrc|:
 <
 If you need to type many object names with underscores, you may want to change
 the value vimrplugin_assign to 2. Then, you will have to type two `_` to get
-them converted into `<-`.
+them converted into `<-`. Alternatively, if the value of vimrplugin_assign is
+3, the plugin will run the following command in each buffer containing R code
+(R, Rnoweb, Rhelp, Rrst, and Rmd):
+>
+   iabb  _ <-
+<
+That is, the underscore will be replaced with the assign operator only if it
+is preceded by a space and followed by a non-word character.
+
 
 ------------------------------------------------------------------------------
 						   *vimrplugin_objbr_place*
diff --git a/r-plugin/common_buffer.vim b/r-plugin/common_buffer.vim
index 7d5a868..46bda40 100644
--- a/r-plugin/common_buffer.vim
+++ b/r-plugin/common_buffer.vim
@@ -62,3 +62,6 @@ if exists("*RCheckLibList")
     autocmd BufEnter  call RCheckLibList()
 endif
 
+if g:vimrplugin_assign == 3
+    iabb  _ <-
+endif

From 2dfb1c97cddbcd379af7c9ccb8a229d4163a2922 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Fri, 11 Dec 2015 20:57:45 -0300
Subject: [PATCH 1019/1050] Replace RGetClassFor with RGetFirstObjClass Avoid
 \rh, \rp and argument completion failure when there is a mistake capturing
 the first argument passed to the function whose help is searched.

---
 r-plugin/common_global.vim | 94 ++++++++++++++++++++++----------------
 1 file changed, 55 insertions(+), 39 deletions(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 2afa049..9c858d3 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -149,7 +149,11 @@ function! ReadEvalReply()
         echon "\r                 "
         redraw
     endif
-    return reply
+    if reply == "No reply" || reply =~ "^Error" || reply == "INVALID" || reply == "ERROR" || reply == "EMPTY" || reply == "NO_ARGS" || reply == "NOT_EXISTS" || reply == ""
+        return "R error: " . reply
+    else
+        return reply
+    endif
 endfunction
 
 function! CompleteChunkOptions()
@@ -257,9 +261,7 @@ function RCompleteArgs()
         if np == 0
             call cursor(lnum, idx)
             let rkeyword0 = RGetKeyWord()
-            let classfor = RGetClassFor(rkeyword0)
-            let classfor = substitute(classfor, '\\', "", "g")
-            let classfor = substitute(classfor, '\(.\)"\(.\)', '\1\\"\2', "g")
+            let objclass = RGetFirstObjClass(rkeyword0)
             let rkeyword = '^' . rkeyword0 . "\x06"
             call cursor(cpos[1], cpos[2])
 
@@ -267,10 +269,10 @@ function RCompleteArgs()
             if string(g:SendCmdToR) != "function('SendCmdToR_fake')"
                 call delete(g:rplugin_tmpdir . "/eval_reply")
                 let msg = 'vimcom:::vim.args("'
-                if classfor == ""
+                if objclass == ""
                     let msg = msg . rkeyword0 . '", "' . argkey . '"'
                 else
-                    let msg = msg . rkeyword0 . '", "' . argkey . '", classfor = ' . classfor
+                    let msg = msg . rkeyword0 . '", "' . argkey . '", objclass = ' . objclass
                 endif
                 if rkeyword0 == "library" || rkeyword0 == "require"
                     let isfirst = IsFirstRArg(lnum, cpos)
@@ -286,7 +288,7 @@ function RCompleteArgs()
 
                 if g:rplugin_vimcomport > 0
                     let g:rplugin_lastev = ReadEvalReply()
-                    if g:rplugin_lastev != "NOT_EXISTS" && g:rplugin_lastev != "NO_ARGS" && g:rplugin_lastev != "R is busy." && g:rplugin_lastev != "NOANSWER" && g:rplugin_lastev != "INVALID" && g:rplugin_lastev != "" && g:rplugin_lastev != "No reply"
+                    if g:rplugin_lastev !~ "^R error: "
                         let args = []
                         if g:rplugin_lastev[0] == "\x04" && len(split(g:rplugin_lastev, "\x04")) == 1
                             return ''
@@ -833,7 +835,7 @@ function StartR(whatr)
     else
         let start_options += ['options(vimcom.vimpager = TRUE)']
     endif
-    let start_options += ['if(utils::packageVersion("vimcom") != "1.2.7") warning("Your version of Vim-R-plugin requires vimcom-1.2-7.", call. = FALSE)']
+    let start_options += ['if(utils::packageVersion("vimcom") != "1.2.7.1") warning("Your version of Vim-R-plugin requires vimcom-1.2-7.1.", call. = FALSE)']
 
     let rwd = ""
     if g:vimrplugin_vim_wd == 0
@@ -1013,8 +1015,8 @@ function WaitVimComStart()
         if !filereadable(g:rplugin_vimcom_lib)
             call RWarningMsgInp('Could not find "' . g:rplugin_vimcom_lib . '".')
         endif
-        if g:rplugin_vimcom_version != "1.2.7"
-            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.2.7.')
+        if g:rplugin_vimcom_version != "1.2.7.1"
+            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.2.7.1.')
             sleep 1
         endif
         call delete(g:rplugin_tmpdir . "/vimcom_running_" . $VIMINSTANCEID)
@@ -1385,7 +1387,7 @@ function RFormatCode() range
     call delete(g:rplugin_tmpdir . "/eval_reply")
     call SendToVimCom("\x08" . $VIMINSTANCEID . 'formatR::tidy_source("' . g:rplugin_tmpdir . '/unformatted_code", file = "' . g:rplugin_tmpdir . '/formatted_code", width.cutoff = ' . wco . ')')
     let g:rplugin_lastev = ReadEvalReply()
-    if g:rplugin_lastev == "R is busy." || g:rplugin_lastev == "UNKNOWN" || g:rplugin_lastev =~ "^Error" || g:rplugin_lastev == "INVALID" || g:rplugin_lastev == "ERROR" || g:rplugin_lastev == "EMPTY" || g:rplugin_lastev == "No reply"
+    if g:rplugin_lastev =~ "^R error: "
         call RWarningMsg(g:rplugin_lastev)
         return
     endif
@@ -1404,7 +1406,7 @@ function RInsert(...)
     call delete(g:rplugin_tmpdir . "/Rinsert")
     call SendToVimCom("\x08" . $VIMINSTANCEID . 'capture.output(' . a:1 . ', file = "' . g:rplugin_tmpdir . '/Rinsert")')
     let g:rplugin_lastev = ReadEvalReply()
-    if g:rplugin_lastev == "R is busy." || g:rplugin_lastev == "UNKNOWN" || g:rplugin_lastev =~ "^Error" || g:rplugin_lastev == "INVALID" || g:rplugin_lastev == "ERROR" || g:rplugin_lastev == "EMPTY" || g:rplugin_lastev == "No reply"
+    if g:rplugin_lastev =~ "^R error: "
         call RWarningMsg(g:rplugin_lastev)
         return 0
     else
@@ -2172,8 +2174,8 @@ function SetRTextWidth(rkeyword)
     endif
 endfunction
 
-function RGetClassFor(rkeyword)
-    let classfor = ""
+function RGetFirstObjClass(rkeyword)
+    let firstobj = ""
     let line = substitute(getline("."), '#.*', '', "")
     let begin = col(".")
     if strlen(line) > begin
@@ -2184,7 +2186,7 @@ function RGetClassFor(rkeyword)
         endwhile
         let line = piece
         if line !~ '^\k*\s*('
-            return classfor
+            return firstobj
         endif
         let begin = 1
         let linelen = strlen(line)
@@ -2218,7 +2220,7 @@ function RGetClassFor(rkeyword)
                     let len = strlen(line)
                 endif
             endwhile
-            let classfor = strpart(line, 0, idx)
+            let firstobj = strpart(line, 0, idx)
         elseif line =~ '^\(\k\|\$\)*\s*[' || line =~ '^\(k\|\$\)*\s*=\s*\(\k\|\$\)*\s*[.*('
             let idx = 0
             while line[idx] != '['
@@ -2243,18 +2245,38 @@ function RGetClassFor(rkeyword)
                     let len = strlen(line)
                 endif
             endwhile
-            let classfor = strpart(line, 0, idx)
+            let firstobj = strpart(line, 0, idx)
         else
-            let classfor = substitute(line, ').*', '', "")
-            let classfor = substitute(classfor, ',.*', '', "")
-            let classfor = substitute(classfor, ' .*', '', "")
+            let firstobj = substitute(line, ').*', '', "")
+            let firstobj = substitute(firstobj, ',.*', '', "")
+            let firstobj = substitute(firstobj, ' .*', '', "")
         endif
     endif
-    if classfor =~ "^'" && classfor =~ "'$"
-        let classfor = substitute(classfor, "^'", '"', "")
-        let classfor = substitute(classfor, "'$", '"', "")
+
+    " Fix some problems
+    if firstobj =~ '^"' && firstobj !~ '"$'
+        let firstobj = firstobj . '"'
+    elseif firstobj =~ "^'" && firstobj !~ "'$"
+        let firstobj = firstobj . "'"
+    endif
+    if firstobj =~ "^'" && firstobj =~ "'$"
+        let firstobj = substitute(firstobj, "^'", '"', "")
+        let firstobj = substitute(firstobj, "'$", '"', "")
+    endif
+    if firstobj =~ '='
+        let firstobj = "eval(expression(" . firstobj . "))"
     endif
-    return classfor
+
+    let objclass = ""
+    call SendToVimCom("\x08" . $VIMINSTANCEID . "class(" . firstobj . ")")
+    if g:rplugin_vimcomport > 0
+        let g:rplugin_lastev = ReadEvalReply()
+        if g:rplugin_lastev !~ "^R error: "
+            let objclass = '"' . g:rplugin_lastev . '"'
+        endif
+    endif
+
+    return objclass
 endfunction
 
 " Show R's help doc in Vim's buffer
@@ -2264,7 +2286,7 @@ function AskRDoc(rkeyword, package, getclass)
         call delete(g:rplugin_docfile)
     endif
 
-    let classfor = ""
+    let objclass = ""
     if bufname("%") =~ "Object_Browser"
         let savesb = &switchbuf
         set switchbuf=useopen,usetab
@@ -2272,24 +2294,18 @@ function AskRDoc(rkeyword, package, getclass)
         exe "set switchbuf=" . savesb
     else
         if a:getclass
-            let classfor = RGetClassFor(a:rkeyword)
+            let objclass = RGetFirstObjClass(a:rkeyword)
         endif
     endif
 
-    if classfor =~ '='
-        let classfor = "eval(expression(" . classfor . "))"
-    endif
-
     call SetRTextWidth(a:rkeyword)
 
-    if classfor == "" && a:package == ""
+    if objclass == "" && a:package == ""
         let rcmd = 'vimcom:::vim.help("' . a:rkeyword . '", ' . g:rplugin_htw . 'L)'
     elseif a:package != ""
         let rcmd = 'vimcom:::vim.help("' . a:rkeyword . '", ' . g:rplugin_htw . 'L, package="' . a:package  . '")'
     else
-        let classfor = substitute(classfor, '\\', "", "g")
-        let classfor = substitute(classfor, '\(.\)"\(.\)', '\1\\"\2', "g")
-        let rcmd = 'vimcom:::vim.help("' . a:rkeyword . '", ' . g:rplugin_htw . 'L, ' . classfor . ')'
+        let rcmd = 'vimcom:::vim.help("' . a:rkeyword . '", ' . g:rplugin_htw . 'L, ' . objclass . ')'
     endif
 
     call SendToVimCom("\x08" . $VIMINSTANCEID . rcmd)
@@ -2590,14 +2606,14 @@ endfunction
 
 function PrintRObject(rkeyword)
     if bufname("%") =~ "Object_Browser"
-        let classfor = ""
+        let objclass = ""
     else
-        let classfor = RGetClassFor(a:rkeyword)
+        let objclass = RGetFirstObjClass(a:rkeyword)
     endif
-    if classfor == ""
+    if objclass == ""
         call g:SendCmdToR("print(" . a:rkeyword . ")")
     else
-        call g:SendCmdToR('vim.print("' . a:rkeyword . '", ' . classfor . ")")
+        call g:SendCmdToR('vim.print("' . a:rkeyword . '", ' . objclass . ")")
     endif
 endfunction
 
@@ -3323,7 +3339,7 @@ if g:vimrplugin_term == "roxterm"
 endif
 
 if g:vimrplugin_term == "xterm" || g:vimrplugin_term == "uxterm"
-    let g:rplugin_termcmd = g:vimrplugin_term . " -xrm '*iconPixmap: " . g:rplugin_home . "/bitmaps/ricon.xbm' -e"
+    let g:rplugin_termcmd = g:vimrplugin_term . " -e"
 endif
 
 if g:vimrplugin_term == "rxvt" || g:vimrplugin_term == "urxvt"

From e8c8b359066d5eb508997a9b773600c7aa1acedf Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Fri, 11 Dec 2015 23:02:42 -0300
Subject: [PATCH 1020/1050] New option: vimrplugin_set_home_env

---
 doc/r-plugin.txt     | 21 +++++++++++++++++----
 r-plugin/windows.vim | 29 +++++++++++++++++------------
 2 files changed, 34 insertions(+), 16 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index f825abd..8f7e4a7 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -1170,6 +1170,7 @@ is running:
 |vimrplugin_term_cmd|          Complete command to open an external terminal
 |vimrplugin_sleeptime|         Delay while sending commands in MS Windows
 |vimrplugin_save_win_pos|      Save positions of R and GVim windows
+|vimrplugin_set_home_env|      Set the value of $HOME for R
 |vimrplugin_arrange_windows|   Restore positions of R and GVim windows
 |vimrplugin_assign|            Convert '_' into ' <- '
 |vimrplugin_assign_map|        Choose what to convert into ' <- '
@@ -1269,6 +1270,7 @@ The last argument must be the one which precedes the command to be executed.
 ------------------------------------------------------------------------------
 						  *vimrplugin_sleeptime*
 						  *vimrplugin_save_win_pos*
+						  *vimrplugin_set_home_env*
 						  *vimrplugin_arrange_windows*
 6.2. Options specific to Windows~
 
@@ -1280,7 +1282,7 @@ example show how to adjust the value of sleeptime in your |vimrc|:
    let vimrplugin_sleeptime = 30
 <
 By default, the Vim-R-plugin will save the positions of R Console and GVim
-windows when you quits R with the rq command, and will restore
+windows when you quit R with the rq command, and it will restore
 the positions of the windows when you start R. If you do not like this
 behavior, you can put in your |vimrc|:
 >
@@ -1292,8 +1294,15 @@ their state when you have quited R for the last time, you should arrange them
 in the way you want, quit R, change in your |vimrc| only the value of
 vimrplugin_save_win_pos and, finally, quit Vim.
 
-Note: the option vimrplugin_Rterm was disabled because the C code to send
-strings from Vim to Windows PowerShell is not working.
+The plugin sets `$HOME` as the Windows register value for "Personal" "Shell
+Folders" which is the same value set by R. However, if you have set `$HOME`
+yourself with the intention of changing the default value of `$HOME` assumed
+by R, you will want to put in your |vimrc|:
+>
+   let vimrplugin_set_home_env = 0
+<
+Note: the old option vimrplugin_Rterm was deprecated because the C code to
+send strings from Vim to Windows PowerShell is not working.
 
 
 ------------------------------------------------------------------------------
@@ -2841,7 +2850,11 @@ put in your |vimrc|:
 							       *r-plugin-news*
 10. News~
 
-1.2.7 (2015-11-27)
+1.2.8 (2015-12-11)
+
+ * New opton (Windows only): vimrplugin_set_home_env.
+
+1.2.7 (2015-12-11)
 
  * Fix incompatibility with Tmux 2.1.
 
diff --git a/r-plugin/windows.vim b/r-plugin/windows.vim
index 810889a..043bd46 100644
--- a/r-plugin/windows.vim
+++ b/r-plugin/windows.vim
@@ -4,6 +4,7 @@ let g:rplugin_sumatra_path = ""
 let g:rplugin_python_initialized = 0
 
 call RSetDefaultValue("g:vimrplugin_sleeptime", 100)
+call RSetDefaultValue("g:vimrplugin_set_home_env", 1)
 
 " Avoid invalid values defined by the user
 exe "let s:sleeptimestr = " . '"' . g:vimrplugin_sleeptime . '"'
@@ -127,26 +128,30 @@ function StartR_Windows()
         return
     endif
 
-    " R and Vim use different values for the $HOME variable.
-    let saved_home = $HOME
-    let prs = system('reg.exe QUERY "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v "Personal"')
-    if len(prs) > 0
-        let g:rdebug_reg_personal = prs
-        let prs = substitute(prs, '.*REG_SZ\s*', '', '')
-        let prs = substitute(prs, '\n', '', 'g')
-        let prs = substitute(prs, '\s*$', '', 'g')
-        let $HOME = prs
-    endif
-
     let rcmd = g:rplugin_Rgui
     if g:vimrplugin_Rterm
         let rcmd = substitute(rcmd, "Rgui", "Rterm", "")
     endif
     let rcmd = '"' . rcmd . '" ' . g:vimrplugin_r_args
 
+    " R and Vim use different values for the $HOME variable.
+    if g:vimrplugin_set_home_env
+        let saved_home = $HOME
+        let prs = system('reg.exe QUERY "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v "Personal"')
+        if len(prs) > 0
+            let g:rdebug_reg_personal = prs
+            let prs = substitute(prs, '.*REG_SZ\s*', '', '')
+            let prs = substitute(prs, '\n', '', 'g')
+            let prs = substitute(prs, '\s*$', '', 'g')
+            let $HOME = prs
+        endif
+    endif
+
     silent exe "!start " . rcmd
 
-    let $HOME = saved_home
+    if g:vimrplugin_set_home_env
+        let $HOME = saved_home
+    endif
 
     let g:SendCmdToR = function('SendCmdToR_Windows')
     if WaitVimComStart()

From c80242b3e3925c2e78a05b0aae91d1017fc9e217 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sat, 12 Dec 2015 09:05:39 -0300
Subject: [PATCH 1021/1050] Call vim.getclass() instead of class()

---
 r-plugin/common_global.vim | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 9c858d3..cb2545b 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -835,7 +835,7 @@ function StartR(whatr)
     else
         let start_options += ['options(vimcom.vimpager = TRUE)']
     endif
-    let start_options += ['if(utils::packageVersion("vimcom") != "1.2.7.1") warning("Your version of Vim-R-plugin requires vimcom-1.2-7.1.", call. = FALSE)']
+    let start_options += ['if(utils::packageVersion("vimcom") != "1.2.7.2") warning("Your version of Vim-R-plugin requires vimcom-1.2-7.2.", call. = FALSE)']
 
     let rwd = ""
     if g:vimrplugin_vim_wd == 0
@@ -1015,8 +1015,8 @@ function WaitVimComStart()
         if !filereadable(g:rplugin_vimcom_lib)
             call RWarningMsgInp('Could not find "' . g:rplugin_vimcom_lib . '".')
         endif
-        if g:rplugin_vimcom_version != "1.2.7.1"
-            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.2.7.1.')
+        if g:rplugin_vimcom_version != "1.2.7.2"
+            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.2.7.2.')
             sleep 1
         endif
         call delete(g:rplugin_tmpdir . "/vimcom_running_" . $VIMINSTANCEID)
@@ -2268,7 +2268,7 @@ function RGetFirstObjClass(rkeyword)
     endif
 
     let objclass = ""
-    call SendToVimCom("\x08" . $VIMINSTANCEID . "class(" . firstobj . ")")
+    call SendToVimCom("\x08" . $VIMINSTANCEID . "vimcom:::vim.getclass(" . firstobj . ")")
     if g:rplugin_vimcomport > 0
         let g:rplugin_lastev = ReadEvalReply()
         if g:rplugin_lastev !~ "^R error: "

From f80701c93fdaf2729333f6e17f2d82d438fa7d2a Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Fri, 18 Dec 2015 13:34:20 -0300
Subject: [PATCH 1022/1050] Call SendLineToR if single whole line is selected
 Close #197

---
 r-plugin/common_global.vim | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index cb2545b..7b05050 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -1733,6 +1733,10 @@ function SendSelectionToR(...)
         let j = col("'>") - i
         let l = getline("'<")
         let line = strpart(l, i, j)
+        if strlen(l) == strlen(line)
+            call SendLineToR(a:2)
+            return
+        endif
         let ok = g:SendCmdToR(line)
         if ok && a:2 =~ "down"
             call GoDown()

From b281dc299ed1bafa1738d68263fa7c0942b4383d Mon Sep 17 00:00:00 2001
From: Johannes Ranke 
Date: Fri, 18 Dec 2015 17:35:03 +0100
Subject: [PATCH 1023/1050] Fix variants of sending selected roxygen example
 code

---
 r-plugin/common_global.vim | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index cb2545b..cdca9bb 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -1733,6 +1733,7 @@ function SendSelectionToR(...)
         let j = col("'>") - i
         let l = getline("'<")
         let line = strpart(l, i, j)
+        let line = CleanOxygenLine(line)
         let ok = g:SendCmdToR(line)
         if ok && a:2 =~ "down"
             call GoDown()
@@ -1771,7 +1772,9 @@ function SendSelectionToR(...)
         let lines[llen] = strpart(lines[llen], 0, j)
     endif
 
-    let lines = map(copy(lines), 'substitute(v:val, "^#' . "'" . '", "", "")')
+    for idx in range(0, len(lines) - 1)
+      let lines[idx] = CleanOxygenLine(lines[idx])
+    endfor
 
     if a:0 == 3 && a:3 == "NewtabInsert"
         let ok = RSourceLines(lines, a:1, "NewtabInsert")

From 7124e418b2a21d8a48296f0a0bf9262cb1f0d215 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Fri, 18 Dec 2015 16:24:17 -0300
Subject: [PATCH 1024/1050] Identify ROxygen in multiline selection sent to R
 Only strip #' from lines within the example section

---
 r-plugin/common_global.vim | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index cdca9bb..6ce5882 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -1772,9 +1772,14 @@ function SendSelectionToR(...)
         let lines[llen] = strpart(lines[llen], 0, j)
     endif
 
+    let curpos = getpos(".")
+    let curline = line("'<")
     for idx in range(0, len(lines) - 1)
-      let lines[idx] = CleanOxygenLine(lines[idx])
+        call setpos(".", [0, curline, 1, 0])
+        let lines[idx] = CleanOxygenLine(lines[idx])
+        let curline += 1
     endfor
+    call setpos(".", curpos)
 
     if a:0 == 3 && a:3 == "NewtabInsert"
         let ok = RSourceLines(lines, a:1, "NewtabInsert")

From d32a70af6f5c590208b2a18263025579cecadcbe Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sat, 19 Dec 2015 14:57:46 -0300
Subject: [PATCH 1025/1050] Standardize code indentation

---
 r-plugin/common_global.vim | 57 +++++++++++++++++++-------------------
 1 file changed, 29 insertions(+), 28 deletions(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 6ce5882..ea03554 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -126,7 +126,7 @@ function ReplaceUnderS()
     endif
 endfunction
 
-function! ReadEvalReply()
+function ReadEvalReply()
     let reply = "No reply"
     let haswaitwarn = 0
     let ii = 0
@@ -156,7 +156,7 @@ function! ReadEvalReply()
     endif
 endfunction
 
-function! CompleteChunkOptions()
+function CompleteChunkOptions()
     let cline = getline(".")
     let cpos = getpos(".")
     let idx1 = cpos[2] - 2
@@ -201,11 +201,11 @@ function! CompleteChunkOptions()
     call sort(ktopt)
 
     for kopt in ktopt
-      if kopt =~ newbase
-        let tmp1 = split(kopt, ";")
-        let tmp2 = {'word': tmp1[0], 'menu': tmp1[1]}
-        call add(rr, tmp2)
-      endif
+        if kopt =~ newbase
+            let tmp1 = split(kopt, ";")
+            let tmp2 = {'word': tmp1[0], 'menu': tmp1[1]}
+            call add(rr, tmp2)
+        endif
     endfor
     call complete(idx1 + 1, rr)
 endfunction
@@ -617,23 +617,24 @@ endfunction
 
 " Adapted from screen plugin:
 function TmuxActivePane()
-  let line = system("tmux list-panes | grep \'(active)$'")
-  let paneid = matchstr(line, '\v\%\d+ \(active\)')
-  if !empty(paneid)
-    return matchstr(paneid, '\v^\%\d+')
-  else
-    return matchstr(line, '\v^\d+')
-  endif
+    let line = system("tmux list-panes | grep \'(active)$'")
+    let paneid = matchstr(line, '\v\%\d+ \(active\)')
+    if !empty(paneid)
+        return matchstr(paneid, '\v^\%\d+')
+    else
+        return matchstr(line, '\v^\d+')
+    endif
 endfunction
 
 function DelayedFillLibList()
     autocmd! RStarting
     augroup! RStarting
-    let g:rplugin_starting_R = 0
-    if exists("g:rplugin_fillrliblist_called") && g:rplugin_fillrliblist_called
-        let g:rplugin_fillrliblist_called = 0
-        call FillRLibList()
-    endif
+        let g:rplugin_starting_R = 0
+        if exists("g:rplugin_fillrliblist_called") && g:rplugin_fillrliblist_called
+            let g:rplugin_fillrliblist_called = 0
+            call FillRLibList()
+        endif
+    augroup END
 endfunction
 
 function StartR_TmuxSplit(rcmd)
@@ -715,7 +716,7 @@ function StartR_ExternalTerm(rcmd)
 
         if g:vimrplugin_term == "rxvt" || g:vimrplugin_term == "urxvt"
             let cnflines = cnflines + [
-                    \ "set terminal-overrides 'rxvt*:smcup@:rmcup@'" ]
+                        \ "set terminal-overrides 'rxvt*:smcup@:rmcup@'" ]
         endif
 
         if g:vimrplugin_tmux_ob || !has("gui_running")
@@ -1874,7 +1875,7 @@ function SendFHChunkToR()
                 " Next run child chunk and continue
                 call KnitChild(curbuf[idx], 'stay')
                 let idx += 1
-            " Regular R chunk
+                " Regular R chunk
             else
                 let idx += 1
                 while curbuf[idx] !~ endchk && idx < here
@@ -2119,7 +2120,7 @@ function RQuit(how)
 endfunction
 
 " knit the current buffer content
-function! RKnit()
+function RKnit()
     update
     if has("win32") || has("win64")
         call g:SendCmdToR('require(knitr); .vim_oldwd <- getwd(); setwd("' . substitute(expand("%:p:h"), '\\', '/', 'g') . '"); knit("' . expand("%:t") . '"); setwd(.vim_oldwd); rm(.vim_oldwd)')
@@ -2672,12 +2673,12 @@ function RAction(rcmd)
         endif
         let rfun = a:rcmd
         if a:rcmd == "args"
-          if g:vimrplugin_listmethods == 1
-            call g:SendCmdToR('vim.list.args("' . rkeyword . '")')
-          else
-            call g:SendCmdToR('args("' . rkeyword . '")')
-          endif
-          return
+            if g:vimrplugin_listmethods == 1
+                call g:SendCmdToR('vim.list.args("' . rkeyword . '")')
+            else
+                call g:SendCmdToR('args("' . rkeyword . '")')
+            endif
+            return
         endif
         if a:rcmd == "plot" && g:vimrplugin_specialplot == 1
             let rfun = "vim.plot"

From aa838f07720c37f08e8775e574ebba5179f48192 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Wed, 23 Dec 2015 13:34:54 -0300
Subject: [PATCH 1026/1050] Avoid vimcom failure if current dir name is UTF-8
 See: https://github.com/jalvesaq/VimCom/issues/29

---
 r-plugin/common_global.vim | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index ea03554..bdea849 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -845,10 +845,17 @@ function StartR(whatr)
         let rwd = getcwd()
     endif
     if rwd != ""
-        if has("win32") || has("win64")
+        if has("win32")
             let rwd = substitute(rwd, '\\', '/', 'g')
         endif
-        let start_options += ['setwd("' . rwd . '")']
+        if has("win32") && &encoding == "utf-8"
+            let start_options += ['.vim.rwd <- "' . rwd . '"']
+            let start_options += ['Encoding(.vim.rwd) <- "UTF-8"']
+            let start_options += ['setwd(.vim.rwd)']
+            let start_options += ['rm(.vim.rwd)']
+        else
+            let start_options += ['setwd("' . rwd . '")']
+        endif
     endif
     call writefile(start_options, g:rplugin_tmpdir . "/start_options.R")
 

From 6987bf038fcbe4df5dddf345d0c06691f5a7b0d0 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sat, 23 Jan 2016 07:35:03 -0300
Subject: [PATCH 1027/1050] Fix English grammar in variable name

---
 ftplugin/rnoweb_rplugin.vim | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/ftplugin/rnoweb_rplugin.vim b/ftplugin/rnoweb_rplugin.vim
index 9dad92e..04600b6 100644
--- a/ftplugin/rnoweb_rplugin.vim
+++ b/ftplugin/rnoweb_rplugin.vim
@@ -188,8 +188,8 @@ function! RMakePDF(bibtex, knit)
         let pdfcmd = pdfcmd . ", view = FALSE"
     else
         if g:vimrplugin_openpdf == 1
-            if b:pdf_opened == 0
-                let b:pdf_opened = 1
+            if b:pdf_is_open == 0
+                let b:pdf_is_open = 1
             else
                 let pdfcmd = pdfcmd . ", view = FALSE"
             endif
@@ -254,7 +254,7 @@ let b:PreviousRChunk = function("RnwPreviousChunk")
 let b:NextRChunk = function("RnwNextChunk")
 let b:SendChunkToR = function("RnwSendChunkToR")
 
-let b:pdf_opened = 0
+let b:pdf_is_open = 0
 
 
 "==========================================================================

From b07faa37e13288ee99645a88aa7356bc96ef1c38 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Wed, 27 Jan 2016 18:45:19 -0300
Subject: [PATCH 1028/1050] Tmux does not have -V option on OpenBSD See:
 https://github.com/jcfaria/Vim-R-plugin/issues/200

---
 r-plugin/common_global.vim | 23 ++++++++++++++---------
 1 file changed, 14 insertions(+), 9 deletions(-)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index bdea849..34fa88a 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -3255,15 +3255,20 @@ if !has("win32") && !has("win64") && !has("gui_win32") && !has("gui_win64") && !
         finish
     endif
 
-    let g:rplugin_tmux_version = system("tmux -V")
-    let g:rplugin_tmux_version = substitute(g:rplugin_tmux_version, '.*tmux \([0-9]\.[0-9]\).*', '\1', '')
-    if strlen(g:rplugin_tmux_version) != 3
-        let g:rplugin_tmux_version = "1.0"
-    endif
-    if g:rplugin_tmux_version < "1.8" && g:vimrplugin_source !~ "screenR"
-        call RWarningMsgInp("Vim-R-plugin requires Tmux >= 1.8")
-        let g:rplugin_failed = 1
-        finish
+    if system("uname") =~ "OpenBSD"
+        " Tmux does not have -V option on OpenBSD: https://github.com/jcfaria/Vim-R-plugin/issues/200
+        let g:rplugin_tmux_version = "2.1"
+    else
+        let g:rplugin_tmux_version = system("tmux -V")
+        let g:rplugin_tmux_version = substitute(g:rplugin_tmux_version, '.*tmux \([0-9]\.[0-9]\).*', '\1', '')
+        if strlen(g:rplugin_tmux_version) != 3
+            let g:rplugin_tmux_version = "1.0"
+        endif
+        if g:rplugin_tmux_version < "1.8" && g:vimrplugin_source !~ "screenR"
+            call RWarningMsgInp("Vim-R-plugin requires Tmux >= 1.8")
+            let g:rplugin_failed = 1
+            finish
+        endif
     endif
 endif
 

From c657fbb1fbc0a3a53422b721473d70f1fe0b5e3b Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Fri, 29 Jan 2016 07:53:43 -0300
Subject: [PATCH 1029/1050] Update web links in r-plugin.txt

---
 doc/r-plugin.txt | 28 +++++++++++++++-------------
 1 file changed, 15 insertions(+), 13 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 8f7e4a7..c50d424 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -91,7 +91,6 @@ Vim-R-plugin (see |vimrplugin_source|).
   * SyncTeX support.
   * Most of the plugin's behavior is customizable.
 
-For screenshots see: http://www.lepem.ufc.br/jaa/vim-r-plugin.html
 
 ==============================================================================
 						       *r-plugin-installation*
@@ -115,7 +114,7 @@ dependencies:
 
     * R's version must be >= 3.0.0: http://www.r-project.org/
 
-    * vimcom = 1.2-7: http://www.lepem.ufc.br/jaa/vimcom.html
+    * vimcom = 1.2-7: https://github.com/jalvesaq/VimCom/releases
 
       Note: If you cannot build vimcom yourself, you will want to
       download and install the zip file.
@@ -152,7 +151,7 @@ Before installing the plugin, you should install its dependencies:
 
    R >= 3.0.0: http://www.r-project.org/
 
-   vimcom = 1.2-7: http://www.lepem.ufc.br/jaa/vimcom.html
+   vimcom = 1.2-7: https://github.com/jalvesaq/VimCom/releases
 
    Only if you edit Rnoweb files: MacTeX, BasicTeX or other LaTeX system.
 
@@ -206,7 +205,7 @@ Before installing the plugin, you should install its dependencies:
 
    R >= 3.0.0: http://www.r-project.org/
 
-   vimcom = 1.2-7: http://www.lepem.ufc.br/jaa/vimcom.html
+   vimcom = 1.2-7: https://github.com/jalvesaq/VimCom/releases
 
    Tmux >= 1.8:   http://tmux.sourceforge.net
                   Tmux is necessary to send commands from Vim to R Console.
@@ -217,7 +216,7 @@ Before installing the plugin, you should install its dependencies:
 
    Suggests:~
 
-   colorout:      http://www.lepem.ufc.br/jaa/colorout.html
+   colorout:      https://github.com/jalvesaq/colorout/releases
                   Colorizes the R output.
 
    setwidth:      An R package that can be installed with the command
@@ -331,12 +330,12 @@ On Windows, if R does not start and you get an error message instead, you may
 want to set the path to your Rgui.exe in your |vimrc|, for example (please
 adapt to your installation):
 >
-   let vimrplugin_r_path = 'C:\\Program Files\\R\\R-3.1.2\\bin\\i386'
+   let vimrplugin_r_path = 'C:\\Program Files\\R\\R-3.2.2\\bin\\i386'
 <
 Are you using Debian, Ubuntu or other Debian based Linux distribution? If yes,
 you may prefer to install the Debian package available at:
 
-   http://www.lepem.ufc.br/jaa/vim-r-plugin.html
+   https://drive.google.com/open?id=0ByMBQcSs9G7KYkotRGpRYjlLVDg
 
 Did you see the message "VimCom port not found"? This means that R is not
 running, the vimcom package is not installed (or is installed but is not
@@ -1082,9 +1081,9 @@ should:
    1. Install XQuartz server (X11.app)
 
    2. Build vimcom with the argument `--enable-clientserver`. That is, download
-      vimcom from http://www.lepem.ufc.br/jaa/vimcom.html and do in R:
+      vimcom from https://github.com/jalvesaq/VimCom/releases and do in R:
 >
-      install.packages("vimcom_1.2-1.tar.gz", repos = NULL, type = "source",
+      install.packages("vimcom_1.2-7.tar.gz", repos = NULL, type = "source",
                        configure.args = "--enable-clientserver")
 <
    3. Build Vim with X11 support. A user reported success with the following
@@ -2837,9 +2836,12 @@ below is for a terminal emulator that supports 256 colors (see |:highlight|):
    endif
 <
 To know what number corresponds to your preferred color (among the 256
-possibilities), hover you mouse pointer over the table of colors at the end
-of http://www.lepem.ufc.br/jaa/colorout.html
-
+possibilities), hover you mouse pointer over the table of colors made in R by
+the following command:
+>
+   library("colorout")
+   show256Colors()
+<
 If you prefer that R output is highlighted using you current |:colorscheme|,
 put in your |vimrc|:
 >
@@ -2854,7 +2856,7 @@ put in your |vimrc|:
 
  * New opton (Windows only): vimrplugin_set_home_env.
 
-1.2.7 (2015-12-11)
+1.2.7 (2015-11-27)
 
  * Fix incompatibility with Tmux 2.1.
 

From 8d12dea273e27fcfef9c0942d11e1097b2f78098 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sun, 31 Jan 2016 11:15:44 -0300
Subject: [PATCH 1030/1050] Add note on Neovim to README.md

---
 README.md | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/README.md b/README.md
index 1a3dab6..c3c618a 100644
--- a/README.md
+++ b/README.md
@@ -1,14 +1,13 @@
-### Vim-R-plugin
+# Vim-R-plugin
 
-This is the development code of Vim-R-plugin. You may want to adjust Vim's
-**runtimepath** in your **~/.vimrc** as in the example below:
-
-    set runtimepath=~/Vim-R-plugin,~/.vim,$VIMRUNTIME,~/.vim/after
-
-Stable versions are released at
-http://www.vim.org/scripts/script.php?script_id=2628
+Note: If your operating system is a Unix variant (Linux, Mac OS X, or other),
+you may prefer [Neovim](https://github.com/neovim/neovim) +
+[Nvim-R](https://github.com/jalvesaq/Nvim-R) +
+[nvimcom](https://github.com/jalvesaq/nvimcom).
 
+Stable versions of Vim-R-plugin are released at
+[vim.org](http://www.vim.org/scripts/script.php?script_id=2628).
 Please, read the file *doc/r-plugin.txt* for usage details.
 
 If you decide to use this version, you will also need the development version
-of vimcom: https://github.com/jalvesaq/VimCom
+of [vimcom](https://github.com/jalvesaq/VimCom).

From bb2a6d57a03c528e2b4d81fd7b0957f6a2b88223 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sat, 6 Feb 2016 15:53:49 -0300
Subject: [PATCH 1031/1050] Better recognition of items in section "Arguments"

---
 syntax/rdoc.vim | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/syntax/rdoc.vim b/syntax/rdoc.vim
index b691e76..9f94c63 100644
--- a/syntax/rdoc.vim
+++ b/syntax/rdoc.vim
@@ -32,7 +32,7 @@ syn match rdocPackName "^[A-Za-z][A-Za-z0-9\.]*" contained
 syn match rdocFuncName "::[A-Za-z0-9\.\-_]*" contained
 
 syn region rdocArgReg matchgroup=rdocArgTitle start="^Arguments:" matchgroup=NONE end="^\t" contains=rdocArgItems,rdocArgTitle,rdocPackage,rdocFuncName,rdocStringS keepend transparent
-syn match rdocArgItems "\n\n\s*\([A-Z]\|[a-z]\|[0-9]\|\.\|_\)*:" contains=rdocArg contained transparent
+syn region rdocArgItems start="\n\n" end=":" contains=rdocArg contained transparent
 syn match rdocArg "\([A-Z]\|[a-z]\|[0-9]\|\.\|_\)*" contained
 
 syn include @rdocR syntax/r.vim

From c21e7dc01f5c1ebb9ddd4b52af0ca6c6fd639dd0 Mon Sep 17 00:00:00 2001
From: Kenneth Lim 
Date: Sat, 6 Feb 2016 21:20:18 +0000
Subject: [PATCH 1032/1050] Add word document render option for Rmarkdown
 plugin

---
 doc/r-plugin.txt         | 1 +
 ftplugin/rmd_rplugin.vim | 3 ++-
 r-plugin/gui_running.vim | 1 +
 3 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index c50d424..a0cf5f4 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -462,6 +462,7 @@ Command
   . Knit and PDF (cur file)                            \kp
   . Knit, BibTeX and PDF (cur file) (Linux/Unix)       \kb
   . Knit and Beamer PDF (cur file) (only .Rmd)         \kl
+  . Knit and Word Document (cur file) (only .Rmd)      \kw
   . Knit and HTML (cur file, verbose) (only .Rmd)      \kh
   . Spin (cur file) (only .R)                          \ks
   --------------------------------------------------------
diff --git a/ftplugin/rmd_rplugin.vim b/ftplugin/rmd_rplugin.vim
index b538084..00a008e 100644
--- a/ftplugin/rmd_rplugin.vim
+++ b/ftplugin/rmd_rplugin.vim
@@ -97,7 +97,7 @@ function! RMakeRmd(t)
     else
         let rcmd = 'vim.interlace.rmd("' . expand("%:t") . '", outform = "' . a:t .'", rmddir = "' . rmddir . '"'
     endif
-    if (g:vimrplugin_openhtml  == 0 && a:t == "html_document") || (g:vimrplugin_openpdf == 0 && (a:t == "pdf_document" || a:t == "beamer_presentation"))
+    if (g:vimrplugin_openhtml  == 0 && a:t == "html_document") || (g:vimrplugin_openpdf == 0 && (a:t == "pdf_document" || a:t == "beamer_presentation" || a:t == "word_document"))
         let rcmd .= ", view = FALSE"
     endif
     let rcmd = rcmd . ', envir = ' . g:vimrplugin_rmd_environment . ')'
@@ -141,6 +141,7 @@ call RCreateMaps("nvi", 'RKnit',          'kn', ':call RKnit()')
 call RCreateMaps("nvi", 'RMakeRmd',       'kr', ':call RMakeRmd("default")')
 call RCreateMaps("nvi", 'RMakePDFK',      'kp', ':call RMakeRmd("pdf_document")')
 call RCreateMaps("nvi", 'RMakePDFKb',     'kl', ':call RMakeRmd("beamer_presentation")')
+call RCreateMaps("nvi", 'RMakePDFKw',     'kw', ':call RMakeRmd("word_document")')
 call RCreateMaps("nvi", 'RMakeHTML',      'kh', ':call RMakeRmd("html_document")')
 call RCreateMaps("nvi", 'RMakeODT',       'ko', ':call RMakeRmd("odt")')
 call RCreateMaps("ni",  'RSendChunk',     'cc', ':call b:SendChunkToR("silent", "stay")')
diff --git a/r-plugin/gui_running.vim b/r-plugin/gui_running.vim
index cc753d8..ccf2587 100644
--- a/r-plugin/gui_running.vim
+++ b/r-plugin/gui_running.vim
@@ -182,6 +182,7 @@ function MakeRMenu()
         if &filetype == "rmd" || g:vimrplugin_never_unmake_menu
             call RCreateMenuItem("nvi", 'Command.Knit\ and\ PDF\ (cur\ file)', 'RMakePDFK', 'kp', ':call RMakeRmd("pdf_document")')
             call RCreateMenuItem("nvi", 'Command.Knit\ and\ Beamer\ PDF\ (cur\ file)', 'RMakePDFKb', 'kl', ':call RMakeRmd("beamer_presentation")')
+            call RCreateMenuItem("nvi", 'Command.Knit\ and\ Word\ Document\ (cur\ file)', 'RMakePDFKw', 'kw', ':call RMakeRmd("word_document")')
             call RCreateMenuItem("nvi", 'Command.Knit\ and\ HTML\ (cur\ file)', 'RMakeHTML', 'kh', ':call RMakeRmd("html_document")')
             call RCreateMenuItem("nvi", 'Command.Knit\ and\ ODT\ (cur\ file)', 'RMakeODT', 'ko', ':call RMakeRmd("odt")')
         endif

From f38719b09a04ae70f7c8e85e68fa980d74522ed0 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sat, 6 Feb 2016 21:35:50 -0300
Subject: [PATCH 1033/1050] Change  name for Word document (Rmd)

---
 doc/r-plugin.txt         | 4 +++-
 ftplugin/rmd_rplugin.vim | 2 +-
 r-plugin/gui_running.vim | 2 +-
 3 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index a0cf5f4..82fa84d 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -462,6 +462,7 @@ Command
   . Knit and PDF (cur file)                            \kp
   . Knit, BibTeX and PDF (cur file) (Linux/Unix)       \kb
   . Knit and Beamer PDF (cur file) (only .Rmd)         \kl
+  . Knit and Open Document (cur file) (only .Rmd)      \ko
   . Knit and Word Document (cur file) (only .Rmd)      \kw
   . Knit and HTML (cur file, verbose) (only .Rmd)      \kh
   . Spin (cur file) (only .R)                          \ks
@@ -2251,10 +2252,11 @@ RD, "cursor down"; RED, both "echo" and "down"):
    RSweave
    RKnit
    RMakeHTML
-   RMakeODT
    RMakePDF   (Sweave)
    RMakePDFK  (Knitr)
    RMakePDFKb (.Rmd, beamer)
+   RMakeODT   (.Rmd, Open document)
+   RMakeWord  (.Rmd, Word document)
    RMakeRmd   (rmarkdown default)
    RMakeAll   (rmarkdown all in yaml)
    ROpenPDF
diff --git a/ftplugin/rmd_rplugin.vim b/ftplugin/rmd_rplugin.vim
index 00a008e..cd18765 100644
--- a/ftplugin/rmd_rplugin.vim
+++ b/ftplugin/rmd_rplugin.vim
@@ -141,7 +141,7 @@ call RCreateMaps("nvi", 'RKnit',          'kn', ':call RKnit()')
 call RCreateMaps("nvi", 'RMakeRmd',       'kr', ':call RMakeRmd("default")')
 call RCreateMaps("nvi", 'RMakePDFK',      'kp', ':call RMakeRmd("pdf_document")')
 call RCreateMaps("nvi", 'RMakePDFKb',     'kl', ':call RMakeRmd("beamer_presentation")')
-call RCreateMaps("nvi", 'RMakePDFKw',     'kw', ':call RMakeRmd("word_document")')
+call RCreateMaps("nvi", 'RMakeWord',      'kw', ':call RMakeRmd("word_document")')
 call RCreateMaps("nvi", 'RMakeHTML',      'kh', ':call RMakeRmd("html_document")')
 call RCreateMaps("nvi", 'RMakeODT',       'ko', ':call RMakeRmd("odt")')
 call RCreateMaps("ni",  'RSendChunk',     'cc', ':call b:SendChunkToR("silent", "stay")')
diff --git a/r-plugin/gui_running.vim b/r-plugin/gui_running.vim
index ccf2587..f95e228 100644
--- a/r-plugin/gui_running.vim
+++ b/r-plugin/gui_running.vim
@@ -182,7 +182,7 @@ function MakeRMenu()
         if &filetype == "rmd" || g:vimrplugin_never_unmake_menu
             call RCreateMenuItem("nvi", 'Command.Knit\ and\ PDF\ (cur\ file)', 'RMakePDFK', 'kp', ':call RMakeRmd("pdf_document")')
             call RCreateMenuItem("nvi", 'Command.Knit\ and\ Beamer\ PDF\ (cur\ file)', 'RMakePDFKb', 'kl', ':call RMakeRmd("beamer_presentation")')
-            call RCreateMenuItem("nvi", 'Command.Knit\ and\ Word\ Document\ (cur\ file)', 'RMakePDFKw', 'kw', ':call RMakeRmd("word_document")')
+            call RCreateMenuItem("nvi", 'Command.Knit\ and\ Word\ Document\ (cur\ file)', 'RMakeWord', 'kw', ':call RMakeRmd("word_document")')
             call RCreateMenuItem("nvi", 'Command.Knit\ and\ HTML\ (cur\ file)', 'RMakeHTML', 'kh', ':call RMakeRmd("html_document")')
             call RCreateMenuItem("nvi", 'Command.Knit\ and\ ODT\ (cur\ file)', 'RMakeODT', 'ko', ':call RMakeRmd("odt")')
         endif

From dada3ced622f543b4c66061e8516cdcd882004d9 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Mon, 8 Feb 2016 08:33:26 -0300
Subject: [PATCH 1034/1050] Make the code of syntax/rout.vim more compact

---
 syntax/rout.vim | 148 +++++++++++-------------------------------------
 1 file changed, 33 insertions(+), 115 deletions(-)

diff --git a/syntax/rout.vim b/syntax/rout.vim
index 0c38a03..f380c23 100644
--- a/syntax/rout.vim
+++ b/syntax/rout.vim
@@ -38,13 +38,13 @@ syn match routNumber "\<0x\([0-9]\|[a-f]\|[A-F]\)\+"
 
 " floating point number with integer and fractional parts and optional exponent
 syn match routFloat "\<\d\+\.\d*\([Ee][-+]\=\d\+\)\="
-syn match routNegFlt "-\<\d\+\.\d*\([Ee][-+]\=\d\+\)\="
+syn match routNegFloat "-\<\d\+\.\d*\([Ee][-+]\=\d\+\)\="
 " floating point number with no integer part and optional exponent
 syn match routFloat "\<\.\d\+\([Ee][-+]\=\d\+\)\="
-syn match routNegFlt "-\<\.\d\+\([Ee][-+]\=\d\+\)\="
+syn match routNegFloat "-\<\.\d\+\([Ee][-+]\=\d\+\)\="
 " floating point number with no fractional part and optional exponent
 syn match routFloat "\<\d\+[Ee][-+]\=\d\+"
-syn match routNegFlt "-\<\d\+[Ee][-+]\=\d\+"
+syn match routNegFloat "-\<\d\+[Ee][-+]\=\d\+"
 
 " complex number
 syn match routComplex "\<\d\+i"
@@ -143,7 +143,7 @@ if exists("g:rout_follow_colorscheme") && g:rout_follow_colorscheme
     hi def link routFloat	Float
     hi def link routComplex	Number
     hi def link routNegNum	Number
-    hi def link routNegFlt	Float
+    hi def link routNegFloat	Float
     hi def link routDate	Number
     hi def link routTrue	Boolean
     hi def link routFalse	Boolean
@@ -154,117 +154,35 @@ if exists("g:rout_follow_colorscheme") && g:rout_follow_colorscheme
     hi def link routError	ErrorMsg
     hi def link routWarn	WarningMsg
 else
-    if has("gui_running")
-        " Default 256 colors scheme for R output:
-        hi routInput	guifg=#9e9e9e
-        hi routNormal	guifg=#00d700
-        hi routNumber	guifg=#ffaf00
-        hi routInteger	guifg=#ffaf00
-        hi routFloat	guifg=#ffaf00
-        hi routComplex	guifg=#ffaf00
-        hi routNegNum	guifg=#ff875f
-        hi routNegFlt	guifg=#ff875f
-        hi routDate	guifg=#d7af5f
-        hi routFalse	guifg=#ff5f5f
-        hi routTrue	guifg=#5fd787
-        hi routInf      guifg=#00afff
-        hi routConst	guifg=#00af5f
-        hi routString	guifg=#5fffaf
-        hi routError	guifg=#ffffff guibg=#c00000
-        hi routWarn	guifg=#c00000
-        hi routIndex	guifg=#87afaf
-    elseif &t_Co == 256
-        " Default 256 colors scheme for R output:
-        hi routInput	ctermfg=247
-        hi routNormal	ctermfg=40
-        hi routNumber	ctermfg=214
-        hi routInteger	ctermfg=214
-        hi routFloat	ctermfg=214
-        hi routComplex	ctermfg=214
-        hi routNegNum	ctermfg=209
-        hi routNegFlt	ctermfg=209
-        hi routDate	ctermfg=179
-        hi routFalse	ctermfg=203
-        hi routTrue	ctermfg=78
-        hi routInf      ctermfg=39
-        hi routConst	ctermfg=35
-        hi routString	ctermfg=85
-        hi routError	ctermfg=15 ctermbg=1
-        hi routWarn	ctermfg=1
-        hi routIndex	ctermfg=109
-    else
-        " Default 16 colors scheme for R output:
-        hi routInput	ctermfg=gray
-        hi routNormal	ctermfg=darkgreen
-        hi routNumber	ctermfg=darkyellow
-        hi routInteger	ctermfg=darkyellow
-        hi routFloat	ctermfg=darkyellow
-        hi routComplex	ctermfg=darkyellow
-        hi routNegNum	ctermfg=darkyellow
-        hi routNegFlt	ctermfg=darkyellow
-        hi routDate	ctermfg=darkyellow
-        hi routInf	ctermfg=darkyellow
-        hi routFalse	ctermfg=magenta
-        hi routTrue	ctermfg=darkgreen
-        hi routConst	ctermfg=magenta
-        hi routString	ctermfg=darkcyan
-        hi routError	ctermfg=white ctermbg=red
-        hi routWarn	ctermfg=red
-        hi routIndex	ctermfg=darkgreen
-    endif
-
-    " Change colors under user request:
-    if exists("g:rout_color_input")
-        exe "hi routInput " . g:rout_color_input
-    endif
-    if exists("g:rout_color_normal")
-        exe "hi routNormal " . g:rout_color_normal
-    endif
-    if exists("g:rout_color_number")
-        exe "hi routNumber " . g:rout_color_number
-    endif
-    if exists("g:rout_color_integer")
-        exe "hi routInteger " . g:rout_color_integer
-    endif
-    if exists("g:rout_color_float")
-        exe "hi routFloat " . g:rout_color_float
-    endif
-    if exists("g:rout_color_complex")
-        exe "hi routComplex " . g:rout_color_complex
-    endif
-    if exists("g:rout_color_negnum")
-        exe "hi routNegNum " . g:rout_color_negnum
-    endif
-    if exists("g:rout_color_negfloat")
-        exe "hi routNegFlt " . g:rout_color_negfloat
-    endif
-    if exists("g:rout_color_date")
-        exe "hi routDate " . g:rout_color_date
-    endif
-    if exists("g:rout_color_false")
-        exe "hi routFalse " . g:rout_color_false
-    endif
-    if exists("g:rout_color_true")
-        exe "hi routTrue " . g:rout_color_true
-    endif
-    if exists("g:rout_color_inf")
-        exe "hi routInf " . g:rout_color_inf
-    endif
-    if exists("g:rout_color_constant")
-        exe "hi routConst " . g:rout_color_constant
-    endif
-    if exists("g:rout_color_string")
-        exe "hi routString " . g:rout_color_string
-    endif
-    if exists("g:rout_color_error")
-        exe "hi routError " . g:rout_color_error
-    endif
-    if exists("g:rout_color_warn")
-        exe "hi routWarn " . g:rout_color_warn
-    endif
-    if exists("g:rout_color_index")
-        exe "hi routIndex " . g:rout_color_index
-    endif
+    function s:SetGroupColor(group, cgui, c256, c16)
+        if exists("g:rout_color_" . tolower(a:group))
+            exe "hi rout" . a:group . eval("g:rout_color_" . tolower(a:group))
+        elseif has("gui_running")
+            exe "hi rout" . a:group . "guifg=" . a:cgui
+        elseif &t_Co == 256
+            exe "hi rout" . a:group . "ctermfg=" . a:c256
+        else
+            exe "hi rout" . a:group . "ctermfg=" . a:c16
+        endif
+    endfunction
+    call s:SetGroupColor("Input ",    "#9e9e9e",               "247",          "gray")
+    call s:SetGroupColor("Normal ",   "#00d700",               "40",           "darkgreen")
+    call s:SetGroupColor("Number ",   "#ffaf00",               "214",          "darkyellow")
+    call s:SetGroupColor("Integer ",  "#ffaf00",               "214",          "darkyellow")
+    call s:SetGroupColor("Float ",    "#ffaf00",               "214",          "darkyellow")
+    call s:SetGroupColor("Complex ",  "#ffaf00",               "214",          "darkyellow")
+    call s:SetGroupColor("NegNum ",   "#ff875f",               "209",          "darkyellow")
+    call s:SetGroupColor("NegFloat ", "#ff875f",               "209",          "darkyellow")
+    call s:SetGroupColor("Date ",     "#d7af5f",               "179",          "darkyellow")
+    call s:SetGroupColor("False ",    "#ff5f5f",               "203",          "darkyellow")
+    call s:SetGroupColor("True ",     "#5fd787",               "78",           "magenta")
+    call s:SetGroupColor("Inf ",      "#00afff",               "39",           "darkgreen")
+    call s:SetGroupColor("Const ",    "#00af5f",               "35",           "magenta")
+    call s:SetGroupColor("String ",   "#5fffaf",               "85",           "darkcyan")
+    call s:SetGroupColor("Error ",    "#ffffff guibg=#c00000", "15 ctermbg=1", "white ctermbg=red")
+    call s:SetGroupColor("Warn ",     "#c00000",               "1",            "red")
+    call s:SetGroupColor("Index ",    "#87afaf",               "109",          "darkgreen")
+    delfunction s:SetGroupColor
 endif
 
 let   b:current_syntax = "rout"

From d726d619f12a10fb5ac7967d373837735cff60f0 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sat, 20 Feb 2016 14:27:57 -0300
Subject: [PATCH 1035/1050] Version 1.2.8

---
 Makefile                   |  2 +-
 doc/r-plugin.txt           | 41 +++++++++++++++++++++++---------------
 r-plugin/common_global.vim |  6 +++---
 3 files changed, 29 insertions(+), 20 deletions(-)

diff --git a/Makefile b/Makefile
index 3964599..63c04a3 100644
--- a/Makefile
+++ b/Makefile
@@ -22,7 +22,7 @@
 
 
 PLUGINHOME=`pwd`
-PLUGINVERSION=1.2.7
+PLUGINVERSION=1.2.8
 DEBIANTIME=`date -R`
 PLUGINRELEASEDATE=`date +"%Y-%m-%d"`
 VIM2HTML=/usr/local/share/vim/vim74/doc/vim2html.pl 
diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 82fa84d..1612cc6 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -5,7 +5,7 @@
 Authors: Jakson A. Aquino   
          Jose Claudio Faria 
 
-Version: 1.2.7
+Version: 1.2.8
 For Vim version 7.4
 
  1. Overview                                    |r-plugin-overview|
@@ -25,13 +25,14 @@ For Vim version 7.4
 1. Overview~
 
 This plugin improves Vim's support for editing R code and makes it possible to
-integrate Vim with R. If you want to use Neovim and R, see:
+integrate Vim with R. On Unix (Linux, Mac OS X, etc), the combination Neovim +
+Nvim-R + nvimcom works better. Please, see:
 
    https://github.com/jalvesaq/Nvim-R
 
-The plugin uses some ideas and code from Johannes Ranke's (vim-r-plugin), Eric
-Van Dewoestine's (screen.vim plugin), Vincent Nijs (R.vim for Mac OS X) and
-some ideas from the Tinn-R (Windows only) project.
+This plugin uses some ideas and code from Johannes Ranke's (vim-r-plugin),
+Eric Van Dewoestine's (screen.vim plugin), Vincent Nijs (R.vim for Mac OS X)
+and some ideas from the Tinn-R (Windows only) project.
 
 The latest stable version of this plugin is available at:
 
@@ -114,12 +115,13 @@ dependencies:
 
     * R's version must be >= 3.0.0: http://www.r-project.org/
 
-    * vimcom = 1.2-7: https://github.com/jalvesaq/VimCom/releases
+    * vimcom = 1.2-8: https://github.com/jalvesaq/VimCom/releases
 
       Note: If you cannot build vimcom yourself, you will want to
       download and install the zip file.
 
     * Vim's version must be >= 7.4: http://www.vim.org/download.php
+      To get the latest version, look for Vim "without Cream".
 
     * Only if you write Rnoweb code:
 
@@ -132,7 +134,8 @@ dependencies:
 Add the following lines to your `Rprofile`:
 >
    options(vimcom.verbose = 1)
-   library(vimcom)
+   if(Sys.getenv("VIMRPLUGIN_TMPDIR") != "")
+       library(vimcom)
 <
 If you do not know where your .Rprofile is, do the following command in R
 Console to open it:
@@ -151,7 +154,7 @@ Before installing the plugin, you should install its dependencies:
 
    R >= 3.0.0: http://www.r-project.org/
 
-   vimcom = 1.2-7: https://github.com/jalvesaq/VimCom/releases
+   vimcom = 1.2-8: https://github.com/jalvesaq/VimCom/releases
 
    Only if you edit Rnoweb files: MacTeX, BasicTeX or other LaTeX system.
 
@@ -159,7 +162,8 @@ If you want to call R.app from MacVim, put in your `~/.Rprofile`:
 >
    if(interactive()){
        options(vimcom.verbose = 1) # optional
-       library(vimcom)
+       if(Sys.getenv("VIMRPLUGIN_TMPDIR") != "")
+           library(vimcom)
    }
 <
 On Mac OS X, the plugin will use AppleScript to send commands to the R Console
@@ -173,7 +177,8 @@ to try this configuration, install Tmux and the R packages "setwidth" and
        library(colorout)
        library(setwidth)
        options(vimcom.verbose = 1) # optional
-       library(vimcom)
+       if(Sys.getenv("VIMRPLUGIN_TMPDIR") != "")
+           library(vimcom)
    }
 <
 Note: The plugin is fully functional with MacVim, but the Vim application that
@@ -205,7 +210,7 @@ Before installing the plugin, you should install its dependencies:
 
    R >= 3.0.0: http://www.r-project.org/
 
-   vimcom = 1.2-7: https://github.com/jalvesaq/VimCom/releases
+   vimcom = 1.2-8: https://github.com/jalvesaq/VimCom/releases
 
    Tmux >= 1.8:   http://tmux.sourceforge.net
                   Tmux is necessary to send commands from Vim to R Console.
@@ -242,7 +247,8 @@ Put the following lines in your `~/.Rprofile`:
        library(colorout)
        library(setwidth)
        options(vimcom.verbose = 1) # optional
-       library(vimcom)
+       if(Sys.getenv("VIMRPLUGIN_TMPDIR") != "")
+           library(vimcom)
    }
 <
 Put the following in your `~/.bashrc`:
@@ -1085,7 +1091,7 @@ should:
    2. Build vimcom with the argument `--enable-clientserver`. That is, download
       vimcom from https://github.com/jalvesaq/VimCom/releases and do in R:
 >
-      install.packages("vimcom_1.2-7.tar.gz", repos = NULL, type = "source",
+      install.packages("vimcom_1.2-8.tar.gz", repos = NULL, type = "source",
                        configure.args = "--enable-clientserver")
 <
    3. Build Vim with X11 support. A user reported success with the following
@@ -2770,7 +2776,8 @@ please read this document from the beginning.
        # Load the required libraries:
        library(colorout)
        library(setwidth)
-       library(vimcom)
+       if(Sys.getenv("VIMRPLUGIN_TMPDIR") != "")
+           library(vimcom)
 
        # Use the text based web browser w3m to navigate through R docs
        # in Linux Console after help.start():
@@ -2855,9 +2862,11 @@ put in your |vimrc|:
 							       *r-plugin-news*
 10. News~
 
-1.2.8 (2015-12-11)
+1.2.8 (2016-02-20)
+
+ * New option (Windows only): vimrplugin_set_home_env.
 
- * New opton (Windows only): vimrplugin_set_home_env.
+ * Fix bug on Windows: R starting minimized after trying to quit R minimized.
 
 1.2.7 (2015-11-27)
 
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 34fa88a..7eff36e 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -836,7 +836,7 @@ function StartR(whatr)
     else
         let start_options += ['options(vimcom.vimpager = TRUE)']
     endif
-    let start_options += ['if(utils::packageVersion("vimcom") != "1.2.7.2") warning("Your version of Vim-R-plugin requires vimcom-1.2-7.2.", call. = FALSE)']
+    let start_options += ['if(utils::packageVersion("vimcom") != "1.2.8") warning("Your version of Vim-R-plugin requires vimcom-1.2-8.", call. = FALSE)']
 
     let rwd = ""
     if g:vimrplugin_vim_wd == 0
@@ -1023,8 +1023,8 @@ function WaitVimComStart()
         if !filereadable(g:rplugin_vimcom_lib)
             call RWarningMsgInp('Could not find "' . g:rplugin_vimcom_lib . '".')
         endif
-        if g:rplugin_vimcom_version != "1.2.7.2"
-            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.2.7.2.')
+        if g:rplugin_vimcom_version != "1.2.8"
+            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.2.8.')
             sleep 1
         endif
         call delete(g:rplugin_tmpdir . "/vimcom_running_" . $VIMINSTANCEID)

From 5bb5df8c8fda7d64bfed61788b980d591762deda Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Fri, 4 Mar 2016 09:22:06 -0300
Subject: [PATCH 1036/1050] Use +channel instead of +clientserver

---
 Makefile                            |    3 +-
 doc/r-plugin.txt                    |  305 ++------
 doc/vimrcom.tex                     |  165 -----
 ftplugin/r_rplugin.vim              |   35 +-
 ftplugin/rbrowser.vim               |   16 +-
 ftplugin/rnoweb_rplugin.vim         |   10 +-
 r-plugin/common_global.vim          | 1059 ++++++---------------------
 r-plugin/extern_term.vim            |  186 +++++
 r-plugin/gui_running.vim            |    4 +-
 r-plugin/osx.vim                    |    2 -
 r-plugin/setcompldir.vim            |    2 +-
 r-plugin/synctex_evince_backward.py |   13 +-
 r-plugin/tmux.vim                   |   28 +
 r-plugin/tmux_split.vim             |  204 ++++++
 r-plugin/windows.vim                |   17 +-
 15 files changed, 728 insertions(+), 1321 deletions(-)
 delete mode 100644 doc/vimrcom.tex
 create mode 100644 r-plugin/extern_term.vim
 create mode 100644 r-plugin/tmux.vim
 create mode 100644 r-plugin/tmux_split.vim

diff --git a/Makefile b/Makefile
index 63c04a3..d2f8a26 100644
--- a/Makefile
+++ b/Makefile
@@ -22,7 +22,7 @@
 
 
 PLUGINHOME=`pwd`
-PLUGINVERSION=1.2.8
+PLUGINVERSION=1.2.9
 DEBIANTIME=`date -R`
 PLUGINRELEASEDATE=`date +"%Y-%m-%d"`
 VIM2HTML=/usr/local/share/vim/vim74/doc/vim2html.pl 
@@ -167,7 +167,6 @@ htmldoc:
 	    sed -i -e 's/\( *\)\(http\S*\)/\1\2<\/a>/' r-plugin.html ;\
 	    sed -i -e 's/<\/pre>
/  --------------------------------------------------------\n/' r-plugin.html ;\
 	    mv r-plugin.html vim-stylesheet.css /tmp )
-	rm -f doc/tags-te
 
 all: vimball deb htmldoc
 
diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 1612cc6..b92f7f2 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -5,8 +5,8 @@
 Authors: Jakson A. Aquino   
          Jose Claudio Faria 
 
-Version: 1.2.8
-For Vim version 7.4
+Version: 1.2.9
+For Vim version >= 7.4.1425
 
  1. Overview                                    |r-plugin-overview|
  2. Main features                               |r-plugin-features|
@@ -100,11 +100,10 @@ Vim-R-plugin (see |vimrplugin_source|).
 The installation instructions are split in six sections:
 
    3.1. Preliminary system setup on Windows
-   3.2. Preliminary system setup on Mac OS X
-   3.3. Preliminary system setup on Unix
-   3.4. Plugin installation
-   3.5. Troubleshooting
-   3.6. Optional steps
+   3.2. Preliminary system setup on Unix
+   3.3. Plugin installation
+   3.4. Troubleshooting
+   3.5. Optional steps
 
 
 ------------------------------------------------------------------------------
@@ -115,12 +114,12 @@ dependencies:
 
     * R's version must be >= 3.0.0: http://www.r-project.org/
 
-    * vimcom = 1.2-8: https://github.com/jalvesaq/VimCom/releases
+    * vimcom = 1.2-9: https://github.com/jalvesaq/VimCom/releases
 
       Note: If you cannot build vimcom yourself, you will want to
       download and install the zip file.
 
-    * Vim's version must be >= 7.4: http://www.vim.org/download.php
+    * Vim's version must be >= 7.4.1425: http://www.vim.org/download.php
       To get the latest version, look for Vim "without Cream".
 
     * Only if you write Rnoweb code:
@@ -144,73 +143,21 @@ Console to open it:
 <
 
 ------------------------------------------------------------------------------
-3.2. Preliminary system setup on Mac OS X~
+3.2. Preliminary system setup on Unix (Linux, Mac OS X, etc)~
 
 Before installing the plugin, you should install its dependencies:
 
    Depends:~
 
-   Cocoa MacVim >= 7.4: https://code.google.com/p/macvim
-
-   R >= 3.0.0: http://www.r-project.org/
-
-   vimcom = 1.2-8: https://github.com/jalvesaq/VimCom/releases
-
-   Only if you edit Rnoweb files: MacTeX, BasicTeX or other LaTeX system.
-
-If you want to call R.app from MacVim, put in your `~/.Rprofile`:
->
-   if(interactive()){
-       options(vimcom.verbose = 1) # optional
-       if(Sys.getenv("VIMRPLUGIN_TMPDIR") != "")
-           library(vimcom)
-   }
-<
-On Mac OS X, the plugin will use AppleScript to send commands to the R Console
-application unless |vimrplugin_applescript| = 0. In this case, R will run in a
-external terminal emulator. The advantage of running R in a terminal emulator
-is that its output can be colorized by the R package "colorout". If you want
-to try this configuration, install Tmux and the R packages "setwidth" and
-"colorout" (see instructions in section 3.3) and put in your `~/.Rprofile`:
->
-   if(interactive()){
-       library(colorout)
-       library(setwidth)
-       options(vimcom.verbose = 1) # optional
-       if(Sys.getenv("VIMRPLUGIN_TMPDIR") != "")
-           library(vimcom)
-   }
-<
-Note: The plugin is fully functional with MacVim, but the Vim application that
-comes with MacVim does not have the the server side of the 'clientserver'
-feature which is required to have the plugin working properly. If you want to
-run both Vim and R in the same Tmux window in a terminal emulator, you have to
-follow the instructions from section 3.3.
+   Vim, GVim >= 7.4.1425: http://www.vim.org/download.php
 
-
-------------------------------------------------------------------------------
-3.3. Preliminary system setup on Unix~
-
-Before installing the plugin, you should install its dependencies:
-
-   Depends:~
-
-   Vim, GVim >= 7.4: http://www.vim.org/download.php
-
-      Note: The Vim-R-plugin requires Vim compiled with |+libcall|,
-	    |+clientserver| and |+conceal| features. In Normal mode, do
-	    `:version`  to check if your Vim has these features.
-
-	    If you need to use the Vim-R-plugin in a Unix system without the
-	    X Server running (e.g. Linux Console, and any system accessed
-	    through ssh), the best option is to use Neovim and Nvim-R:
-	    https://github.com/jalvesaq/Nvim-R
-	    If you cannot use Neovim and need to use Vim in these
-	    circumstances, please, read |r-plugin-nox| and |r-plugin-remote|.
+      Note: The Vim-R-plugin requires Vim compiled with |+channel| and
+	    |+conceal| features. In Normal mode, do `:version`  to check if
+	    your Vim has these features.
 
    R >= 3.0.0: http://www.r-project.org/
 
-   vimcom = 1.2-8: https://github.com/jalvesaq/VimCom/releases
+   vimcom = 1.2-9: https://github.com/jalvesaq/VimCom/releases
 
    Tmux >= 1.8:   http://tmux.sourceforge.net
                   Tmux is necessary to send commands from Vim to R Console.
@@ -251,10 +198,6 @@ Put the following lines in your `~/.Rprofile`:
            library(vimcom)
    }
 <
-Put the following in your `~/.bashrc`:
->
-   alias vim="vim --servername VIM"
-<
 Before proceeding, you have to start a new shell session to have the alias
 enabled.
 
@@ -265,15 +208,9 @@ details). If you either use GVim or Vim not inside a Tmux session the plugin
 will start R in a external terminal emulator. This is useful if you have two
 monitors.
 
-If you run Vim in a terminal emulator, it must be started with the argument
-|--servername| to enable the 'clientserver' feature (please, read the section
-|r-plugin-bash-setup| to know some tips on how to configure Bash). This is not
-necessary with GVim because it always runs with the 'clientserver' feature
-enabled.
-
 
 ------------------------------------------------------------------------------
-3.4. Plugin installation (instructions for all systems)~
+3.3. Plugin installation (instructions for all systems)~
 
 You need to activate plugins and indentation according to 'filetype'. You
 should have at least the following options at the top or near the very top
@@ -319,7 +256,7 @@ If you want to uninstall the plugin, do
 <
 
 ------------------------------------------------------------------------------
-3.5. Troubleshooting (if the plugin doesn't work)~
+3.4. Troubleshooting (if the plugin doesn't work)~
 
 Note: The  is '\' by default.
 
@@ -352,16 +289,16 @@ If R takes more than 5 seconds to load, you should adjust the value of
 
 
 ------------------------------------------------------------------------------
-3.6. Optional steps~
+3.5. Optional steps~
 
-3.6.1 Customize the plugin~
+3.5.1 Customize the plugin~
 
 Please, read the section |r-plugin-options|. Emacs/ESS users should read the
 section |r-plugin-indenting| of this document.
 
 
 ------------------------------------------------------------------------------
-3.6.2 Install additional plugins~
+3.5.2 Install additional plugins~
 
 You may be interested in installing additional general plugins to get
 functionality not provided by this file type plugin. Particularly interesting
@@ -674,10 +611,8 @@ complete the name of a data.frame, the columns are not shown. But when the
 data.frame name is already complete, and you have inserted the '$' symbol,
 omni completion will show the column names.
 
-Only the names of objects in .GlobalEnv and in loaded libraries are completed,
-and the |clientserver| feature is required to get the list of loaded libraries
-automatically updated. If either R is not running or Vim is running without
-the |clientserver| feature, only objects of libraries listed in
+Only the names of objects in .GlobalEnv and in loaded libraries are completed.
+If either R is not running, only objects of libraries listed in
 |vimrplugin_start_libs| will have their names completed. When you load a new
 library in R, only the current buffer has the highlighting of function names
 immediately updated. If you have other buffers open, they will be updated when
@@ -686,7 +621,7 @@ you enter them.
 Vim uses one file to store the names of .GlobalEnv objects and a list of files
 for all other objects. The .GlobalEnv list is stored in the `$VIMRPLUGIN_TMPDIR`
 directory and is deleted when you quits Vim. The other files are stored in the
-`$VIMRPLUGIN_COMPLDIR` directory and remain available until you manually delete
+`$VIMR_COMPLDIR` directory and remain available until you manually delete
 them.
 
 
@@ -697,9 +632,8 @@ You have to use ro to start the Object Browser. The Object
 Browser has two views: .GlobalEnv and Libraries. If you either press 
 or double click (GVim or Vim with 'mouse' set to "a") on the first line of the
 Object Browser, you will toggle the view between the objects in .GlobalEnv and
-the currently loaded libraries. The Object Browser requires the
-|+clientserver| feature to be automatically updated and the |+conceal| feature
-to correctly align list items.
+the currently loaded libraries. The Object Browser requires the |+conceal|
+feature to correctly align list items.
 
 In the .GlobalEnv view, if an object has the attribute "label", it will also
 be displayed. In the Object Browser window, while in Normal mode, you can
@@ -801,7 +735,7 @@ section refers to the case of starting R when Vim already is in a Tmux
 session, that is, if you do:
 >
    tmux
-   vim --servername VIM filename.R
+   vim filename.R
    exit
 <
 In this case, the terminal window is split in two regions: one for Vim and the
@@ -930,29 +864,6 @@ remote machine. Tmux should not be running in the local machine because some
 environment variables could pass from the local to the remote Tmux and confuse
 the plugin.
 
-If you need to access Vim in a remote Unix machine through ssh, and if you
-want to get omnicompletion, syntax highlight of function names and the Object
-Browser working properly, instead of Vim, it is recommended that you use
-Neovim because it does not require the X Server to be fully functional. If
-you cannot use Neovim, then you have to:
-
-   - Enable X11 Forwarding in the remote machine.
-
-   - Have Vim in the remote machine compiled with |clientserver| feature.
-
-   - Have the X Server running in the local machine.
-
-   - Pass either the `-X` or the `-Y` argument to ssh, as in the examples
-     below:
->
-     ssh -X yourlogin@remote.address
-     ssh -Y yourlogin@remote.address
-<
-   - Start Tmux and, then, Vim with the |--servername| argument:
->
-     tmux
-     vim --servername VIM script.R
-<
 With Tmux, you can detach the Vim-R session and reattach it later (but the
 connection with the XServer could be lost in the process). This is useful if
 you plan to begin the use the Vim-R-plugin in a machine and later move to
@@ -1009,7 +920,10 @@ Normal, Visual and Insert modes.
 5.3. Functions are not always correctly sent to R~
 
 The plugin is only capable of recognizing functions defined using the `<-`
-operator. See: https://github.com/jcfaria/Vim-R-plugin/issues/94
+operator. Also, only current function scope is sent to R. See:
+
+   https://github.com/jcfaria/Vim-R-plugin/issues/94
+   https://github.com/jalvesaq/Nvim-R/issues/34
 
 
 ------------------------------------------------------------------------------
@@ -1034,86 +948,19 @@ The vimcom library is started with the state `busy`.
 5.5. SyncTeX on Windows~
 
 On Windows, backward search with Sumatra pop ups a console window which
-quickly disappears (it is `vim` running the required `--remote-expr` command).
+quickly disappears (it is `vclientserver` running the required command).
 
 
 ------------------------------------------------------------------------------
-								*r-plugin-nox*
-5.6. Bugs that affect Linux Console and Vim accessed through ssh~
-
-If you run Vim in the Linux Console or start Vim in a terminal emulator
-without the command line argument |--servername|, Vim will not receive remote
-messages and the vimcom package will display one of the following messages:
-
-   Vim was built without the 'clientserver' feature.
-   Did you pass the --servername argument to Vim?
-   There is no X Server running.
-   Vim's servername is unknown.
-
-To avoid the message, you should start vim with the |--servername| argument,
-as below:
->
-   vim --servername VIM script.R
-<
-To avoid having to type this argument every time that you start Vim, please,
-look at the example in |r-plugin-bash-setup|.
-
-If the |--servername| argument does not work in your case, you can put the
-following line in your `~/.Rprofile` to suppress the message:
->
-   options(vimcom.verbose = -1)
-<
-When Vim cannot receive messages, the result is:
-
-   * The Object Browser is not automatically updated. You have to do
-     ro to update it manually.
-
-   * Syntax highlight of function names and the list of objects for
-     omnicompletion are not immediately updated after you load a new R
-     package. For a workaround, see |vimrplugin_start_libs|.
-
-   * You cannot see R documentation in a Vim buffer.
-
-On Linux you may find Vim binaries without the |clientserver| feature if
-you install packages such as vim-nox on Debian/Ubuntu or vim-enhanced on
-Fedora/Red Hat. If you want to use Vim in a terminal emulator in Fedora/Red
-Hat, you may want to create a symbolic link to "gvim" named "vim". You still
-have to explicitly start the server with the argument |--servername|.
-
-The R package vimcom has support only for Windows and X11 interprocess
-communication systems while MacVim is a Cocoa application. For this reason, on
-Mac OS X, by default, vimcom is built without support to Vim's |clientserver|
-feature. If you prefer to use Vim instead of MacVim in Mac OS X, then, you
-should:
-
-   1. Install XQuartz server (X11.app)
-
-   2. Build vimcom with the argument `--enable-clientserver`. That is, download
-      vimcom from https://github.com/jalvesaq/VimCom/releases and do in R:
->
-      install.packages("vimcom_1.2-8.tar.gz", repos = NULL, type = "source",
-                       configure.args = "--enable-clientserver")
-<
-   3. Build Vim with X11 support. A user reported success with the following
-      procedure:
->
-      brew install vim --with-client-server
-      tmux
-      /usr/local/Cellar/vim/7.4.273/bin/vim --servername VIM r_script.R
-<
-See also: |r-plugin-remote|.
-
-
-------------------------------------------------------------------------------
-5.7. R must be started by Vim~
+5.6. R must be started by Vim~
 
 The communication between Vim and R will work only if R was started by Vim
 through the rf command because the plugin was designed to connect
 each Vim instance with its own R instance.
 
 If you start R before Vim, it will not inherit from Vim the environment
-variables VIMRPLUGIN_TMPDIR, VIMRPLUGIN_COMPLDIR, VIMEDITOR_SVRNM,
-VIMINSTANCEID, and VIMRPLUGIN_SECRET. The first one is the path used by the R
+variables VIMRPLUGIN_TMPDIR, VIMR_COMPLDIR, VIMEDITOR_SVRNM,
+VIMINSTANCEID, and VIMR_SECRET. The first one is the path used by the R
 package vimcom to save temporary files used by the Vim-R-plugin to: perform
 omnicompletion, show R documentation in a Vim buffer, and update the Object
 Browser. The two last ones are used by the Vim-R-plugin and by vimcom to know
@@ -1131,17 +978,17 @@ try the following (not all procedures are necessary for all cases):
    :echo g:rplugin_tmpdir
    :echo g:rplugin_compldir
    :echo $VIMINSTANCEID
-   :echo $VIMRPLUGIN_SECRET
+   :echo $VIMR_SECRET
    :echo $VIMEDITOR_SVRNM
 <
    In R do:
 >
    detach("package:vimcom", unload = TRUE)
-   Sys.setenv(VIMRPLUGIN_TMPDIR="T")    # where "T" is what Vim has echoed
-   Sys.setenv(VIMINSTANCEID="I")        # where "I" is what Vim has echoed
-   Sys.setenv(VIMRPLUGIN_SECRET"="S")   # where "S" is what Vim has echoed
-   Sys.setenv(VIMEDITOR_SVRNM"="N")     # where "N" is what Vim has echoed
-   Sys.setenv(VIMRPLUGIN_COMPLDIR"="C") # where "C" is what Vim has echoed
+   Sys.setenv(VIMRPLUGIN_TMPDIR="T") # where "T" is what Vim has echoed
+   Sys.setenv(VIMINSTANCEID="I")     # where "I" is what Vim has echoed
+   Sys.setenv(VIMR_SECRET"="S")      # where "S" is what Vim has echoed
+   Sys.setenv(VIMEDITOR_SVRNM"="N")  # where "N" is what Vim has echoed
+   Sys.setenv(VIMR_COMPLDIR"="C")    # where "C" is what Vim has echoed
    library(vimcom)
 <
 If you are running R in a terminal emulator (Linux/Unix) Vim still needs to
@@ -1224,7 +1071,6 @@ is running:
 |vimrplugin_allnames|          Show names which begin with a dot
 |vimrplugin_rmhidden|          Remove hidden objects from R workspace
 |vimrplugin_source|            Source additional scripts
-|vimrplugin_restart|           Restart R if it is already running
 |vimrplugin_show_args|         Show extra information during omnicompletion
 |vimrplugin_args_in_stline|    Set 'statusline' to function arguments
 |vimrplugin_vimcom_wait|       Time to wait for vimcom loading
@@ -1517,9 +1363,6 @@ value of vimrplugin_start_libs:
 >
    let vimrplugin_start_libs = "base,stats,graphics,grDevices,utils,methods"
 <
-You may also want to define the value of vimrplugin_start_libs if you are
-running Vim without the |clientserver| feature.
-
 
 ------------------------------------------------------------------------------
 							*vimrplugin_routnotab*
@@ -1879,24 +1722,6 @@ features:
    https://github.com/ssayols/screenR
 
 
-------------------------------------------------------------------------------
-							  *vimrplugin_restart*
-6.27. Restart R if it is already running (Linux/Unix only)~
-
-When R is already running and you type one of the commands to start R before
-you have done rq, the Vim-R-plugin does one of the following:
-(a) If R is in an external terminal emulator, the terminal is closed, a new
-one is opened with the same R session running in it. (b) If both Vim and R are
-running in different Tmux regions of the same terminal emulator, the plugin
-warns that R is already running.
-
-If instead of the default behavior, you prefer to quit and restart R when you
-do rf, rv or rc, then, put in your
-|vimrc|:
->
-   let vimrplugin_restart = 1
-<
-
 ------------------------------------------------------------------------------
 							*vimrplugin_show_args*
 						   *vimrplugin_args_in_stline*
@@ -2108,7 +1933,7 @@ In Okular, click in:
    Configure Okular
    Editor
    Dropdown menu: Custom Text Editor
-         Command: vim --remote-expr "SyncTeX_backward('%f', %l)"
+         Command: vclientserver '%f' %l
 
 In the command above, replace `vim` with `gvim` if you use GVim.
 
@@ -2141,15 +1966,15 @@ to press gp again.
 ------------------------------------------------------------------------------
 6.35.4 Skim with MacVim configuration (Mac OS X)~
 
-You have to configure Skim to call MacVim during backward searches.
+You have to configure Skim to call `vclientserver` during backward searches.
 In Skim click in the drop down menu and fill the fields:
 >
    Skim
    Settings
    Sync
    Preset: Custom
-   Command: /path/to/MacVim/mvim
-   Arguments: --remote-expr "SyncTeX_backward('%file', %line)"
+   Command: vclientserver
+   Arguments: '%file' %line
 <
 
 ------------------------------------------------------------------------------
@@ -2380,18 +2205,19 @@ and in your |vimrc| (see |vimrplugin_vimpager|):
 							  *r-plugin-showmarks*
 9.3. How do marked blocks work?~
 
-Vim allows you to put several marks (bookmarks) in buffers. The most commonly
-used marks are the lowercase alphabet letters. If the cursor is between any
-two marks, the plugin will send the lines between them to R if you press
-bb. If the cursor is above the first mark, the plugin will send
-from the beginning of the file to the mark. If the cursor is below the last
-mark, the plugin will send from the mark to the end of the file. The mark
+Vim allows you to put several marks (bookmarks) in buffers (see |mark|). The
+most commonly used marks are the lowercase alphabet letters. If the cursor is
+between any two marks, the plugin will send the lines between them to R if you
+press bb. If the cursor is above the first mark, the plugin will
+send from the beginning of the file to the mark. If the cursor is below the
+last mark, the plugin will send from the mark to the end of the file. The mark
 above the cursor is included and the mark below is excluded from the block to
 be sent to R. To create a mark, press m in Normal mode.
 
-We recommended the use of vim-signature which show what lines have marks
-defined. The plugins are available at:
+We recommended the use of either ShowMarks or vim-signature which show what
+lines have marks defined. The plugins are available at:
 
+   http://www.vim.org/scripts/script.php?script_id=152
    https://github.com/kshenoy/vim-signature
 
 
@@ -2435,21 +2261,6 @@ mappings are particularly problematic. See:
 
    https://github.com/jcfaria/Vim-R-plugin/issues/111
 
-You can also use Vim's 'clientserver' feature to send remote messages to Vim.
-For example, if you want a keyboard shortcut that sends to Vim the command to
-send the current line to R and go down to the next line of code, then use your
-desktop configuration tools to create a global shortcut to the following
-command:
->
-   vim --remote-expr 'SendLineToR("down")'
-<
-The command above will work properly only if there is a single Vim instance
-running. Otherwise, the |--servername| argument would have to be used to send
-the message to the correct Vim instance. If the command works properly, you
-will be able to send lines of code from Vim to R even if the window
-currently focused is not the Vim's window (either the terminal emulator where
-Vim is running or GVim).
-
 
 ------------------------------------------------------------------------------
 							*r-plugin-localleader*
@@ -2801,12 +2612,6 @@ please read this document from the beginning.
        export TERM=screen-256color
    fi
 
-   # Make Vim connect to X Server even if the gui is not running (many of the
-   # plugin features depend on this).
-   if [ "x$DISPLAY" != "x" ]
-   then
-       alias vim='vim --servername VIM'
-   fi
 <
 
 
@@ -2862,6 +2667,12 @@ put in your |vimrc|:
 							       *r-plugin-news*
 10. News~
 
+1.2.9 (2016-03-04)
+
+ * Delete option vimrplugin_restart
+
+ * Use the +channel feature instead of +clientserver.
+
 1.2.8 (2016-02-20)
 
  * New option (Windows only): vimrplugin_set_home_env.
diff --git a/doc/vimrcom.tex b/doc/vimrcom.tex
deleted file mode 100644
index 650018e..0000000
--- a/doc/vimrcom.tex
+++ /dev/null
@@ -1,165 +0,0 @@
-\documentclass[english,ignorenonframetext]{beamer}
-
-% Compile with XeLaTeX:
-\usepackage{fontspec}
-\setmainfont{Liberation Serif}
-
-\usetheme{Warsaw}
-\setbeamercovered{transparent}
-\setbeamertemplate{navigation symbols}{}
-\usepackage{multirow}
-\usepackage{booktabs}
-\newcommand{\autor}{Jakson Alves de Aquino}
-\newcommand{\titulo}{Communication between Vim and R}
-
-\title{\titulo}
-\author{\autor}
-\date{\today}
-
-\usepackage{tikz}
-\date{\today}
-\begin{document}
-
-\begin{frame}[plain]
-  \titlepage
-\end{frame}
-
-\begin{frame}
-\frametitle{The R package \texttt{vimcom}}
-\begin{center}
-\begin{tikzpicture}[node distance=5mm,
-    bola/.style={
-        rectangle,minimum size=4mm,rounded corners,
-        draw, fill=white!80!blue,
-        text height=1.5ex,text depth=.25ex
-    }]
-    \normalsize
-    \node at (3.4, 8) {R code};
-    \node at (9.6, 8) {C code};
-    \node at (8.2, 7) {\textcolor{black!50!green}{vimcom.so}};
-    \node at (11, 7) {\textcolor{black!50!green}{libVimR.so}};
-
-    \small
-    \node [bola] at (2, 7.0) {etags2ctags}; \node [bola] at (4.8, 7.0) {vim.print};
-    \node [bola] at (2, 6.3) {vim.args};    \node [bola] at (4.8, 6.3) {vim.srcdir};
-    \node [bola] at (2, 5.6) {vim.bol};     \node [bola] at (4.8, 5.6) {vim.list.args};
-    \node [bola] at (2, 4.9) {vim.help};    \node [bola] at (4.8, 4.9) {vim.interlace.rmd};
-    \node [bola] at (2, 4.2) {vim.names};   \node [bola] at (4.8, 4.2) {vim.interlace.rnoweb};
-    \node [bola] at (2, 3.5) {vim.plot};    \node [bola] at (4.8, 3.5) {vim.interlace.rrst};
-
-    \node [bola, fill=white!90!black] at (8.2, 6.3) {vim\_client};
-    \node [bola, fill=white!90!black] at (8.2, 5.6) {TCP\_server};
-    \node [bola, fill=white!90!black] at (8.2, 4.9) {list\_libs};
-    \node [bola, fill=white!90!black] at (8.2, 4.2) {list\_env};
-    \node [bola, fill=white!90!black] at (8.2, 3.5) {eval\_expr};
-
-    \node [bola, fill=white!90!black] at (11, 6.3) {send\_to\_vimcom};
-    \normalsize
-\end{tikzpicture}
-\end{center}
-\end{frame}
-
-
-\begin{frame}
-\frametitle{Vim--R communication paths}
-\begin{center}
-    \begin{tikzpicture}
-        \normalsize
-        \draw [thick, fill=white!90!green, rounded corners] (7, 1.5) rectangle (10, 6.5);
-        \draw [thick, fill=white!90!green, rounded corners] (0, 1.5) rectangle (3, 6.5);
-        \only<1>{
-            \node at (1.5, 4) {Vim Editor};
-            \node at (8.5, 4) {R};
-        }
-        \only<2>{
-            \node at (1.5, 4) {MacVim Editor};
-            \node at (8.5, 4) {R.app};
-        }
-        \only<3>{
-            \node at (1.5, 4) {GVim Editor};
-            \node at (8.5, 4) {Rgui};
-        }
-        \small
-        \draw (0, 3) -- (3, 3);
-        \draw (0, 5) -- (3, 5);
-        \footnotesize
-        \only<1>{
-            \node at (1.5, 6.1) {\texttt{\textcolor{black!50!green}{X11}}};
-            \node at (8.5, 6.1) {\texttt{\textcolor{black!50!green}{vimcom.so}}};
-            \node at (8.5, 2.6) {\texttt{\textcolor{black!50!green}{vimcom.so}}};
-            \node at (1.5, 2.6) {\texttt{\textcolor{black!50!green}{libVimR.so}}};
-            \node at (5, 4.3) {\emph{via tmux}};
-        }
-        \only<2>{
-            \node at (1.5, 6.1) {\texttt{\textcolor{black!50!green}{Cocoa}}};
-            \node at (8.5, 6.1) {\texttt{\textcolor{black!50!green}{system()}}};
-            \node at (8.5, 2.6) {\texttt{\textcolor{black!50!green}{vimcom.so}}};
-            \node at (1.5, 2.6) {\texttt{\textcolor{black!50!green}{libVimR.so}}};
-            \node at (5, 4.3) {\emph{via osascript}};
-        }
-        \only<3>{
-            \node at (1.5, 6.1) {\texttt{\textcolor{black!50!green}{Windows}}};
-            \node at (8.5, 6.1) {\texttt{\textcolor{black!50!green}{vimcom.dll}}};
-            \node at (8.5, 2.6) {\texttt{\textcolor{black!50!green}{vimcom.dll}}};
-            \node at (1.5, 2.6) {\texttt{\textcolor{black!50!green}{libVimR.dll}}};
-            \node at (5, 4.3) {\emph{via clipboard}};
-        }
-
-        \small
-        \only<1>{ \node at (1.5, 5.6) {Vim's server}; }
-        \only<2>{ \node at (1.5, 5.6) {MacVim's server}; }
-        \only<3>{ \node at (1.5, 5.6) {GVim's server}; }
-        \node at (1.5, 2.1) {TCP client};
-
-        \draw (7, 3) -- (10, 3);
-        \draw (7, 5) -- (10, 5);
-        \only<1>{ \node at (8.5, 5.6) {X11 client}; }
-        \only<2>{ \node at (8.5, 5.6) {Vim application}; }
-        \only<3>{ \node at (8.5, 5.6) {Windows client}; }
-        \node at (8.5, 2.1) {TCP server};
-
-        \footnotesize
-        \draw [->, thick] (3.1, 4.1) -- (6.9, 4.1);
-        \draw [->, thick, blue] (-0.1, 3.8) .. controls (-0.8, 3.8) and (-0.8, 2.25) .. (-0.1, 2.25);
-        \draw [->, thick, red] (-0.1, 5.75) .. controls (-0.8, 5.75) and (-0.8, 4.2) .. (-0.1, 4.2);
-        \draw [->, thick, red] (8.5, 6.6) .. controls (8.5, 7.5) and (1.5, 7.5) .. (1.5, 6.6);
-        \draw [->, thick, blue] (1.5, 1.4) .. controls (1.5, 0.5) and (8.5, 0.5) .. (8.5, 1.4);
-
-        \node [shape=circle, text width=1.5cm, align=center, blue] (tmpf) at (4.5, 2.25) {Temporary files};
-        \draw [->, thick, blue] (6.9, 2.25) -- (tmpf) node[above, midway] {\emph{write}};
-        \draw [->, thick, blue] (tmpf) -- (3.1, 3.9) node[above, sloped, midway] {\emph{read}};
-        \normalsize
-    \end{tikzpicture}
-\end{center}
-\end{frame}
-
-\begin{frame}
-\frametitle{Vim--R communication paths}
-  \frametitle{}
-  \begin{columns}
-    \column{.50\textwidth}
-    \textbf{Black path}
-    \begin{itemize}
-      \item The code that you see being pasted into R Console
-    \end{itemize}
-    \vspace{0.2cm}
-    \textcolor{red}{\textbf{Red path}}
-    \begin{itemize}
-      \item Update synxtax highlight
-      \item Update Object Browser
-      \item \texttt{help()} typed in the R Console
-      \item Open PDF (Rnoweb)
-    \end{itemize}
-    \column{.50\textwidth}
-    \textcolor{blue}{\textbf{Blue path}}
-    \begin{itemize}
-      \item Omnicompletion
-      \item Completion of function arguments
-      \item \texttt{:Rhelp} or \texttt{rh}
-      \item \texttt{:Rinsert}
-      \item \texttt{:Rformat}
-    \end{itemize}
-  \end{columns}
-\end{frame}
-
-\end{document}
diff --git a/ftplugin/r_rplugin.vim b/ftplugin/r_rplugin.vim
index 3b661dd..dca39c1 100644
--- a/ftplugin/r_rplugin.vim
+++ b/ftplugin/r_rplugin.vim
@@ -39,30 +39,23 @@ function! ShowRout()
         let rcmd = g:rplugin_R . " CMD BATCH --no-restore --no-save '" . expand("%") . "' '" . b:routfile . "'"
     endif
 
-    if has("win32") || has("win64") || v:servername == ""
-        echon "Please wait for: " . rcmd
-        redraw
-        let rlog = system(rcmd)
-        if v:shell_error && rlog != ""
-            call RWarningMsg('Error: "' . rlog . '"')
-            sleep 1
-        endif
-        if filereadable(b:routfile)
-            if g:vimrplugin_routnotab == 1
-                exe "split " . b:routfile
-            else
-                exe "tabnew " . b:routfile
-            endif
-            set filetype=rout
+    " TODO: Run R as a job and don't wait for the output
+    echon "Please wait for: " . rcmd
+    redraw
+    let rlog = system(rcmd)
+    if v:shell_error && rlog != ""
+        call RWarningMsg('Error: "' . rlog . '"')
+        sleep 1
+    endif
+    if filereadable(b:routfile)
+        if g:vimrplugin_routnotab == 1
+            exe "split " . b:routfile
         else
-            call RWarningMsg("The file '" . b:routfile . "' is not readable.")
+            exe "tabnew " . b:routfile
         endif
+        set filetype=rout
     else
-        let shlines = [rcmd,
-                    \ 'vim --servername ' . v:servername . " --remote-expr '" . 'GetROutput("' . b:routfile . '")' . "'",
-                    \ 'rm "' . g:rplugin_tmpdir . '/runRcmdbatch.sh' . '"']
-        call writefile(shlines, g:rplugin_tmpdir . '/runRcmdbatch.sh')
-        call system('sh "' .  g:rplugin_tmpdir . '/runRcmdbatch.sh" >/dev/null 2>/dev/null &')
+        call RWarningMsg("The file '" . b:routfile . "' is not readable.")
     endif
 endfunction
 
diff --git a/ftplugin/rbrowser.vim b/ftplugin/rbrowser.vim
index 04e2db1..23cc0de 100644
--- a/ftplugin/rbrowser.vim
+++ b/ftplugin/rbrowser.vim
@@ -108,10 +108,10 @@ function! RBrowserDoubleClick()
     if line(".") == 1
         if g:rplugin_curview == "libraries"
             let g:rplugin_curview = "GlobalEnv"
-            call UpdateOB("GlobalEnv")
+            call SendToVimCom("\004G RBrowserDoubleClick")
         else
             let g:rplugin_curview = "libraries"
-            call UpdateOB("libraries")
+            call SendToVimCom("\004L RBrowserDoubleClick")
         endif
         return
     endif
@@ -300,8 +300,12 @@ function! RBrowserGetName(cleantail, cleantick)
 endfunction
 
 function! ObBrBufUnload()
-    if exists("g:rplugin_editor_sname")
-        call system("tmux select-pane -t " . g:rplugin_vim_pane)
+    if g:vimrplugin_tmux_ob
+        if exists("g:rplugin_editor_sname")
+            call system("tmux select-pane -t " . g:rplugin_vim_pane)
+        endif
+    elseif g:rplugin_vimcomport
+        call SendToVimCom("\004Stop updating info [OB BufUnload].")
     endif
 endfunction
 
@@ -327,7 +331,6 @@ endif
 au BufEnter  stopinsert
 
 if g:vimrplugin_tmux_ob
-    au BufUnload  call ObBrBufUnload()
     " Fix problems caused by some plugins
     if exists("g:loaded_surround") && mapcheck("ds", "n") != ""
         nunmap ds
@@ -335,9 +338,8 @@ if g:vimrplugin_tmux_ob
     if exists("g:loaded_showmarks ")
         autocmd! ShowMarks
     endif
-else
-    au BufUnload  call SendToVimCom("\004Stop updating info [OB BufUnload].")
 endif
+au BufUnload  call ObBrBufUnload()
 
 let s:envstring = tolower($LC_MESSAGES . $LC_ALL . $LANG)
 if s:envstring =~ "utf-8" || s:envstring =~ "utf8"
diff --git a/ftplugin/rnoweb_rplugin.vim b/ftplugin/rnoweb_rplugin.vim
index 04600b6..4b721da 100644
--- a/ftplugin/rnoweb_rplugin.vim
+++ b/ftplugin/rnoweb_rplugin.vim
@@ -575,7 +575,8 @@ function! SyncTeX_forward(...)
         call system("wmctrl -a '" . basenm . ".pdf'")
     elseif g:rplugin_pdfviewer == "sumatra"
         if g:rplugin_sumatra_path != "" || FindSumatra()
-            silent exe '!start "' . g:rplugin_sumatra_path . '" -reuse-instance -forward-search ' . basenm . '.tex ' . texln . ' -inverse-search "vim --servername ' . v:servername . " --remote-expr SyncTeX_backward('\\%f',\\%l)" . '" "' . basenm . '.pdf"'
+            silent exe '!start "' . g:rplugin_sumatra_path . '" -reuse-instance -forward-search ' . basenm . '.tex ' . texln .
+                        \ ' -inverse-search "vclientserver.exe %%f %%l" ' . basenm . '.pdf"'
         endif
     elseif g:rplugin_pdfviewer == "skim"
         " This command is based on macvim-skim
@@ -616,7 +617,10 @@ function! Run_EvinceBackward()
     endif
     if !did_evince
         call add(g:rplugin_evince_list, basenm)
-        call system("python " . g:rplugin_home . "/r-plugin/synctex_evince_backward.py '" . basenm . ".pdf' " . v:servername . " &")
+        call job_start(["python",
+                    \ g:rplugin_home . "/r-plugin/synctex_evince_backward.py",
+                    \ basenm . ".pdf"],
+                    \ {'out-cb': 'ROnJobStdout', 'err-cb': "ROnJobStderr"})
     endif
     exe "cd " . substitute(olddir, ' ', '\\ ', 'g')
 endfunction
@@ -640,7 +644,7 @@ if g:rplugin_pdfviewer != "none"
         unlet s:key_list
         unlet s:has_key
     endif
-    if g:vimrplugin_synctex && g:rplugin_pdfviewer == "evince" && $DISPLAY != "" && v:servername != ""
+    if g:vimrplugin_synctex && g:rplugin_pdfviewer == "evince" && $DISPLAY != ""
         call Run_EvinceBackward()
     endif
 endif
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 7eff36e..40d3318 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -59,8 +59,8 @@ function RWarningMsgInp(wmsg)
     let &shortmess = savedsm
 endfunction
 
-if v:version < 704
-    call RWarningMsgInp("The Vim-R-plugin requires Vim >= 7.4.")
+if !exists("*job_getchannel")
+    call RWarningMsgInp("The Vim-R-plugin requires Vim >= 7.4.1453")
     let g:rplugin_failed = 1
     finish
 endif
@@ -615,17 +615,6 @@ function GoDown()
     endwhile
 endfunction
 
-" Adapted from screen plugin:
-function TmuxActivePane()
-    let line = system("tmux list-panes | grep \'(active)$'")
-    let paneid = matchstr(line, '\v\%\d+ \(active\)')
-    if !empty(paneid)
-        return matchstr(paneid, '\v^\%\d+')
-    else
-        return matchstr(line, '\v^\d+')
-    endif
-endfunction
-
 function DelayedFillLibList()
     autocmd! RStarting
     augroup! RStarting
@@ -637,143 +626,6 @@ function DelayedFillLibList()
     augroup END
 endfunction
 
-function StartR_TmuxSplit(rcmd)
-    let g:rplugin_vim_pane = TmuxActivePane()
-    let tmuxconf = ['set-environment VIMRPLUGIN_TMPDIR "' . g:rplugin_tmpdir . '"',
-                \ 'set-environment VIMRPLUGIN_COMPLDIR "' . substitute(g:rplugin_compldir, ' ', '\\ ', "g") . '"',
-                \ 'set-environment VIMEDITOR_SVRNM ' . $VIMEDITOR_SVRNM ,
-                \ 'set-environment VIMINSTANCEID ' . $VIMINSTANCEID ,
-                \ 'set-environment VIMRPLUGIN_SECRET ' . $VIMRPLUGIN_SECRET ]
-    if &t_Co == 256
-        call extend(tmuxconf, ['set default-terminal "' . $TERM . '"'])
-    endif
-    call writefile(tmuxconf, g:rplugin_tmpdir . "/tmux" . $VIMINSTANCEID . ".conf")
-    call system("tmux source-file '" . g:rplugin_tmpdir . "/tmux" . $VIMINSTANCEID . ".conf" . "'")
-    call delete(g:rplugin_tmpdir . "/tmux" . $VIMINSTANCEID . ".conf")
-    let tcmd = "tmux split-window "
-    if g:vimrplugin_vsplit
-        if g:vimrplugin_rconsole_width == -1
-            let tcmd .= "-h"
-        else
-            let tcmd .= "-h -l " . g:vimrplugin_rconsole_width
-        endif
-    else
-        let tcmd .= "-l " . g:vimrplugin_rconsole_height
-    endif
-    if !g:vimrplugin_restart
-        " Let Tmux automatically kill the panel when R quits.
-        let tcmd .= " '" . a:rcmd . "'"
-    endif
-    let rlog = system(tcmd)
-    if v:shell_error
-        call RWarningMsg(rlog)
-        return
-    endif
-    let g:rplugin_rconsole_pane = TmuxActivePane()
-    let rlog = system("tmux select-pane -t " . g:rplugin_vim_pane)
-    if v:shell_error
-        call RWarningMsg(rlog)
-        return
-    endif
-    let g:SendCmdToR = function('SendCmdToR_TmuxSplit')
-    if g:vimrplugin_restart
-        sleep 200m
-        let ca_ck = g:vimrplugin_ca_ck
-        let g:vimrplugin_ca_ck = 0
-        call g:SendCmdToR(a:rcmd)
-        let g:vimrplugin_ca_ck = ca_ck
-    endif
-    let g:rplugin_last_rcmd = a:rcmd
-    if g:vimrplugin_tmux_title != "automatic" && g:vimrplugin_tmux_title != ""
-        call system("tmux rename-window " . g:vimrplugin_tmux_title)
-    endif
-    if WaitVimComStart()
-        call SendToVimCom("\005B Update OB [StartR]")
-        if g:vimrplugin_after_start != ''
-            call system(g:vimrplugin_after_start)
-        endif
-    endif
-endfunction
-
-
-function StartR_ExternalTerm(rcmd)
-    if $DISPLAY == "" && !g:rplugin_is_darwin
-        call RWarningMsg("Start 'tmux' before Vim. The X Window system is required to run R in an external terminal.")
-        return
-    endif
-
-    if g:vimrplugin_notmuxconf
-        let tmuxcnf = ' '
-    else
-        " Create a custom tmux.conf
-        let cnflines = ['set-option -g prefix C-a',
-                    \ 'unbind-key C-b',
-                    \ 'bind-key C-a send-prefix',
-                    \ 'set-window-option -g mode-keys vi',
-                    \ 'set -g status off',
-                    \ 'set -g default-terminal "screen-256color"',
-                    \ "set -g terminal-overrides 'xterm*:smcup@:rmcup@'" ]
-
-        if g:vimrplugin_term == "rxvt" || g:vimrplugin_term == "urxvt"
-            let cnflines = cnflines + [
-                        \ "set terminal-overrides 'rxvt*:smcup@:rmcup@'" ]
-        endif
-
-        if g:vimrplugin_tmux_ob || !has("gui_running")
-            if g:rplugin_tmux_version < "2.1"
-                call extend(cnflines, ['set -g mode-mouse on', 'set -g mouse-select-pane on', 'set -g mouse-resize-pane on'])
-            else
-                call extend(cnflines, ['set -g mouse on'])
-            endif
-        endif
-        call writefile(cnflines, g:rplugin_tmpdir . "/tmux.conf")
-        let tmuxcnf = '-f "' . g:rplugin_tmpdir . "/tmux.conf" . '"'
-    endif
-
-    let rcmd = 'VIMRPLUGIN_TMPDIR=' . substitute(g:rplugin_tmpdir, ' ', '\\ ', 'g') . ' VIMRPLUGIN_COMPLDIR=' . substitute(g:rplugin_compldir, ' ', '\\ ', 'g') . ' VIMINSTANCEID=' . $VIMINSTANCEID . ' VIMRPLUGIN_SECRET=' . $VIMRPLUGIN_SECRET . ' VIMEDITOR_SVRNM=' . $VIMEDITOR_SVRNM . ' ' . a:rcmd
-
-    call system("tmux -L vimr has-session -t " . g:rplugin_tmuxsname)
-    if v:shell_error
-        if g:rplugin_is_darwin
-            let $VIM_BINARY_PATH = substitute($VIMRUNTIME, "/MacVim.app/Contents/.*", "", "") . "/MacVim.app/Contents/MacOS/Vim"
-            let rcmd = "VIM_BINARY_PATH=" . substitute($VIM_BINARY_PATH, ' ', '\\ ', 'g') . ' TERM=screen-256color ' . rcmd
-            let opencmd = printf("tmux -L vimr -2 %s new-session -s %s '%s'", tmuxcnf, g:rplugin_tmuxsname, rcmd)
-            call writefile(["#!/bin/sh", opencmd], $VIMRPLUGIN_TMPDIR . "/openR")
-            call system("chmod +x '" . $VIMRPLUGIN_TMPDIR . "/openR'")
-            let opencmd = "open '" . $VIMRPLUGIN_TMPDIR . "/openR'"
-        else
-            if g:rplugin_termcmd =~ "gnome-terminal" || g:rplugin_termcmd =~ "xfce4-terminal" || g:rplugin_termcmd =~ "terminal" || g:rplugin_termcmd =~ "iterm"
-                let opencmd = printf("%s 'tmux -L vimr -2 %s new-session -s %s \"%s\"' &", g:rplugin_termcmd, tmuxcnf, g:rplugin_tmuxsname, rcmd)
-            else
-                let opencmd = printf("%s tmux -L vimr -2 %s new-session -s %s \"%s\" &", g:rplugin_termcmd, tmuxcnf, g:rplugin_tmuxsname, rcmd)
-            endif
-        endif
-    else
-        if g:rplugin_is_darwin
-            call RWarningMsg("Tmux session with R is already running")
-            return
-        endif
-        if g:rplugin_termcmd =~ "gnome-terminal" || g:rplugin_termcmd =~ "xfce4-terminal" || g:rplugin_termcmd =~ "terminal" || g:rplugin_termcmd =~ "iterm"
-            let opencmd = printf("%s 'tmux -L vimr -2 %s attach-session -d -t %s' &", g:rplugin_termcmd, tmuxcnf, g:rplugin_tmuxsname)
-        else
-            let opencmd = printf("%s tmux -L vimr -2 %s attach-session -d -t %s &", g:rplugin_termcmd, tmuxcnf, g:rplugin_tmuxsname)
-        endif
-    endif
-
-    let rlog = system(opencmd)
-    if v:shell_error
-        call RWarningMsg(rlog)
-        return
-    endif
-    let g:SendCmdToR = function('SendCmdToR_Term')
-    if WaitVimComStart()
-        call SendToVimCom("\005B Update OB [StartR]")
-        if g:vimrplugin_after_start != ''
-            call system(g:vimrplugin_after_start)
-        endif
-    endif
-endfunction
-
 function IsSendCmdToRFake()
     if string(g:SendCmdToR) != "function('SendCmdToR_fake')"
         if exists("g:maplocalleader")
@@ -788,20 +640,6 @@ endfunction
 
 " Start R
 function StartR(whatr)
-    if has("gui_macvim") && v:servername != ""
-        let $VIMEDITOR_SVRNM = "MacVim_" . v:servername
-        let $VIM_BINARY_PATH = substitute($VIMRUNTIME, "/MacVim.app/Contents/.*", "", "") . "/MacVim.app/Contents/MacOS/Vim"
-    elseif !has("clientserver")
-        let $VIMEDITOR_SVRNM = "NoClientServer"
-    elseif v:servername == ""
-        if has("gui_macvim") && !has("gui_running")
-            call RWarningMsg("The Vim application that comes with MacVim cannot receive messages from R.")
-        endif
-        let $VIMEDITOR_SVRNM = "NoServerName"
-    else
-        let $VIMEDITOR_SVRNM = v:servername
-    endif
-
     call writefile([], g:rplugin_tmpdir . "/globenv_" . $VIMINSTANCEID)
     call writefile([], g:rplugin_tmpdir . "/liblist_" . $VIMINSTANCEID)
     call delete(g:rplugin_tmpdir . "/libnames_" . $VIMINSTANCEID)
@@ -831,12 +669,12 @@ function StartR(whatr)
     else
         let start_options += ['options(vimcom.labelerr = FALSE)']
     endif
-    if g:vimrplugin_vimpager == "no" || !has("clientserver") || v:servername == ""
+    if g:vimrplugin_vimpager == "no"
         let start_options += ['options(vimcom.vimpager = FALSE)']
     else
         let start_options += ['options(vimcom.vimpager = TRUE)']
     endif
-    let start_options += ['if(utils::packageVersion("vimcom") != "1.2.8") warning("Your version of Vim-R-plugin requires vimcom-1.2-8.", call. = FALSE)']
+    let start_options += ['if(utils::packageVersion("vimcom") != "1.2.9") warning("Your version of Vim-R-plugin requires vimcom-1.2-9.", call. = FALSE)']
 
     let rwd = ""
     if g:vimrplugin_vim_wd == 0
@@ -888,40 +726,8 @@ function StartR(whatr)
         return
     endif
 
-    " R was already started. Should restart it or warn?
-    if string(g:SendCmdToR) != "function('SendCmdToR_fake')"
-        if g:rplugin_do_tmux_split
-            if g:vimrplugin_restart
-                call g:SendCmdToR('quit(save = "no")')
-                sleep 100m
-                call delete(g:rplugin_tmpdir . "/vimcom_running_" . $VIMINSTANCEID)
-                let ca_ck = g:vimrplugin_ca_ck
-                let g:vimrplugin_ca_ck = 0
-                call g:SendCmdToR(g:rplugin_last_rcmd)
-                let g:vimrplugin_ca_ck = ca_ck
-                if IsExternalOBRunning()
-                    if WaitVimComStart()
-                        sleep 100m
-                        call g:SendCmdToR("\014")
-                    endif
-                    call VimExprToOB('ResetVimComPort()')
-                    call SendToVimCom("\002" . g:rplugin_obsname)
-                    call SendToVimCom("\005G .GlobalEnv [Restarting R]")
-                    call SendToVimCom("\005L Libraries [Restarting()]")
-                    " vimcom automatically update the libraries view, but not
-                    " the GlobalEnv one because vimcom_count_objects() returns 0.
-                    call VimExprToOB('UpdateOB("GlobalEnv")')
-                endif
-                return
-            elseif IsSendCmdToRFake()
-                return
-            endif
-        else
-            if g:vimrplugin_restart
-                call RQuit("restartR")
-                call ResetVimComPort()
-            endif
-        endif
+    if IsSendCmdToRFake()
+        return
     endif
 
     if b:rplugin_r_args == " "
@@ -933,44 +739,10 @@ function StartR(whatr)
     if g:rplugin_do_tmux_split
         call StartR_TmuxSplit(rcmd)
     else
-        if g:vimrplugin_restart && bufloaded(b:objbrtitle)
-            call delete(g:rplugin_tmpdir . "/vimcom_running_" . $VIMINSTANCEID)
-        endif
         call StartR_ExternalTerm(rcmd)
-        if g:vimrplugin_restart && bufloaded(b:objbrtitle)
-            if WaitVimComStart()
-                call SendToVimCom("\002" . v:servername)
-                call SendToVimCom("\005G .GlobalEnv [Restarting R]")
-                call SendToVimCom("\005L Libraries [Restarting()]")
-                if exists("*UpdateOB")
-                    call UpdateOB("GlobalEnv")
-                endif
-            endif
-        endif
-    endif
-    if has("clientserver") && v:servername == "" && $DISPLAY != ""
-        call RWarningMsgInp("You have to restart Vim with the --servername argument otherwise Vim cannot receive messages from R.")
-        redraw
-        call RWarningMsg('Example: "vim --servername VIM ' . bufname("%") . '"')
-    else
-        echon
     endif
 endfunction
 
-" To be called by edit() in R running in Neovim buffer.
-function ShowRObject(fname)
-    call RWarningMsg("ShowRObject not implemented yet: '" . a:fname . "'")
-    let fcont = readfile(a:fname)
-    let s:finalA = g:rplugin_tmpdir . "/vimcom_edit_" . $VIMINSTANCEID . "_A"
-    let finalB = g:rplugin_tmpdir . "/vimcom_edit_" . $VIMINSTANCEID . "_B"
-    let finalB = substitute(finalB, ' ', '\\ ', 'g')
-    exe "tabnew " . finalB
-    call setline(".", fcont)
-    set ft=r
-    stopinsert
-    autocmd BufUnload  call delete(s:finalA) | unlet s:finalA | startinsert
-endfunction
-
 " Send SIGINT to R
 function StopR()
     if g:rplugin_r_pid
@@ -978,16 +750,6 @@ function StopR()
     endif
 endfunction
 
-function OpenRScratch()
-    below 6split R_Scratch
-    set filetype=r
-    setlocal noswapfile
-    set buftype=nofile
-    nmap   :quit
-    nmap  q :quit
-    startinsert
-endfunction
-
 function WaitVimComStart()
     if b:rplugin_r_args =~ "vanilla"
         return 0
@@ -1013,25 +775,60 @@ function WaitVimComStart()
         let g:rplugin_vimcom_home = vr[1]
         let g:rplugin_vimcomport = vr[2]
         let g:rplugin_r_pid = vr[3]
+        let $RCONSOLE = vr[4]
         if has("win64")
+            let g:rplugin_vclntsrvr = g:rplugin_vimcom_home . "/bin/x64/vclientserver.exe"
             let g:rplugin_vimcom_lib = g:rplugin_vimcom_home . "/bin/x64/libVimR.dll"
         elseif has("win32")
+            let g:rplugin_vclntsrvr = g:rplugin_vimcom_home . "/bin/i386/vclientserver.exe"
             let g:rplugin_vimcom_lib = g:rplugin_vimcom_home . "/bin/i386/libVimR.dll"
         else
-            let g:rplugin_vimcom_lib = g:rplugin_vimcom_home . "/bin/libVimR.so"
+            let g:rplugin_vclntsrvr = g:rplugin_vimcom_home . "/bin/vclientserver"
+        endif
+
+        if isdirectory(g:rplugin_vimcom_home . "/bin/x64")
+            let vimcom_bin_dir = g:rplugin_vimcom_home . "/bin/x64"
+        elseif isdirectory(g:rplugin_vimcom_home . "/bin/i386")
+            let vimcom_bin_dir = g:rplugin_vimcom_home . "/bin/i386"
+        else
+            let vimcom_bin_dir = g:rplugin_vimcom_home . "/bin"
         endif
-        if !filereadable(g:rplugin_vimcom_lib)
-            call RWarningMsgInp('Could not find "' . g:rplugin_vimcom_lib . '".')
+        if $PATH !~ vimcom_bin_dir
+            if has("win32")
+                let $PATH = vimcom_bin_dir . ';' . $PATH
+            else
+                let $PATH = vimcom_bin_dir . ':' . $PATH
+            endif
+        endif
+
+        if filereadable(g:rplugin_vclntsrvr)
+            " Set vimcom port in the vclientserver
+            let $VIMCOMPORT = g:rplugin_vimcomport
+            " Set RConsole window ID in vclientserver to ArrangeWindows()
+            if has("win32")
+                if $RCONSOLE == "0"
+                    call RWarningMsg("vimcom did not save R window ID")
+                endif
+                if $WINDOWID == ""
+                    if v:windowid == 0
+                        call RWarningMsg("GVim did not define $WINDOWID")
+                    else
+                        let $WINDOWID = v:windowid
+                    endif
+                endif
+            endif
+            let vcs_job = job_start([g:rplugin_vclntsrvr],
+                        \ {'out-cb': 'ROnJobStdout', 'err-cb': "ROnJobStderr"})
+            let g:rplugin_channel = job_getchannel(vcs_job)
+        else
+            call RWarningMsgInp('Could not find "' . g:rplugin_vclntsrvr . '".')
         endif
-        if g:rplugin_vimcom_version != "1.2.8"
-            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.2.8.')
+        if g:rplugin_vimcom_version != "1.2.9"
+            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.2.9.')
             sleep 1
         endif
         call delete(g:rplugin_tmpdir . "/vimcom_running_" . $VIMINSTANCEID)
 
-        if !has("libcall")
-            call RWarningMsgInp("+libcall feature is missing: communication with R will be flawed.")
-        endif
 
         if g:rplugin_do_tmux_split
             " Environment variables persists across Tmux windows.
@@ -1059,170 +856,9 @@ function WaitVimComStart()
     endif
 endfunction
 
-function IsExternalOBRunning()
-    if exists("g:rplugin_ob_pane")
-        let plst = system("tmux list-panes | cat")
-        if plst =~ g:rplugin_ob_pane
-            return 1
-        endif
-    endif
-    return 0
-endfunction
-
-function ResetVimComPort()
-    let g:rplugin_vimcomport = 0
-endfunction
-
-function StartObjBrowser_Tmux()
-    if b:rplugin_extern_ob
-        " This is the Object Browser
-        echoerr "StartObjBrowser_Tmux() called."
-        return
-    endif
-
-    let g:RBrOpenCloseLs = function("RBrOpenCloseLs_TmuxVim")
-
-    call SendToVimCom("\005G GlobalEnv [OB StartObjBrowser_Tmux]")
-    sleep 50m
-    call SendToVimCom("\005L Libraries [OB StartObjBrowser_Tmux]")
-    sleep 50m
-
-    " Don't start the Object Browser if it already exists
-    if IsExternalOBRunning()
-        return
-    endif
-
-    let objbrowserfile = g:rplugin_tmpdir . "/objbrowserInit"
-    let tmxs = " "
-
-    if v:servername == ""
-        let myservername = '""'
-    else
-        let myservername = '"' . v:servername . '"'
-    endif
-
-    call writefile([
-                \ 'let g:rplugin_editor_sname = ' . myservername,
-                \ 'let g:rplugin_vim_pane = "' . g:rplugin_vim_pane . '"',
-                \ 'let g:rplugin_rconsole_pane = "' . g:rplugin_rconsole_pane . '"',
-                \ 'let $VIMINSTANCEID = "' . $VIMINSTANCEID . '"',
-                \ 'let showmarks_enable = 0',
-                \ 'let g:rplugin_tmuxsname = "' . g:rplugin_tmuxsname . '"',
-                \ 'let b:rscript_buffer = "' . bufname("%") . '"',
-                \ 'set filetype=rbrowser',
-                \ 'let g:rplugin_vimcom_home = "' . g:rplugin_vimcom_home . '"',
-                \ 'let g:rplugin_vimcom_lib = "' . g:rplugin_vimcom_lib . '"',
-                \ 'let b:objbrtitle = "' . b:objbrtitle . '"',
-                \ 'let b:rplugin_extern_ob = 1',
-                \ 'set shortmess=atI',
-                \ 'set rulerformat=%3(%l%)',
-                \ 'set laststatus=0',
-                \ 'set noruler',
-                \ 'set updatetime=100',
-                \ 'let g:SendCmdToR = function("SendCmdToR_TmuxSplit")',
-                \ 'let g:RBrOpenCloseLs = function("RBrOpenCloseLs_TmuxOB")',
-                \ 'if has("clientserver") && v:servername != ""',
-                \ '    let g:rplugin_vimcomport = ' . g:rplugin_vimcomport,
-                \ '    call SendToVimCom("\002" . v:servername)',
-                \ 'endif',
-                \ 'sleep 150m',
-                \ 'call UpdateOB("GlobalEnv")', ], objbrowserfile)
-
-    if g:vimrplugin_objbr_place =~ "left"
-        let panw = system("tmux list-panes | cat")
-        if g:vimrplugin_objbr_place =~ "console"
-            " Get the R Console width:
-            let panw = substitute(panw, '.*[0-9]: \[\([0-9]*\)x[0-9]*.\{-}' . g:rplugin_rconsole_pane . '\>.*', '\1', "")
-        else
-            " Get the Vim width
-            let panw = substitute(panw, '.*[0-9]: \[\([0-9]*\)x[0-9]*.\{-}' . g:rplugin_vim_pane . '\>.*', '\1', "")
-        endif
-        let panewidth = panw - g:vimrplugin_objbr_w
-        " Just to be safe: If the above code doesn't work as expected
-        " and we get a spurious value:
-        if panewidth < 30 || panewidth > 180
-            let panewidth = 80
-        endif
-    else
-        let panewidth = g:vimrplugin_objbr_w
-    endif
-    if g:vimrplugin_objbr_place =~ "console"
-        let obpane = g:rplugin_rconsole_pane
-    else
-        let obpane = g:rplugin_vim_pane
-    endif
-
-    if has("clientserver")
-        let obsname = "--servername " . g:rplugin_obsname
-    else
-        let obsname = " "
-    endif
-
-    if g:rplugin_is_darwin && has("gui_macvim")
-        let vimexec = substitute($VIMRUNTIME, "/MacVim.app/Contents/.*", "", "") . "/MacVim.app/Contents/MacOS/Vim"
-        let vimexec = substitute(vimexec, ' ', '\\ ', 'g')
-    else
-        let vimexec = "vim"
-    endif
-
-    let cmd = "tmux split-window -h -l " . panewidth . " -t " . obpane . ' "' . vimexec . ' ' . obsname . " -c 'source " . substitute(objbrowserfile, ' ', '\\ ', 'g') . "'" . '"'
-    let rlog = system(cmd)
-    if v:shell_error
-        let rlog = substitute(rlog, '\n', ' ', 'g')
-        let rlog = substitute(rlog, '\r', ' ', 'g')
-        call RWarningMsg(rlog)
-        let g:rplugin_running_objbr = 0
-        return 0
-    endif
-
-    let g:rplugin_ob_pane = TmuxActivePane()
-    let rlog = system("tmux select-pane -t " . g:rplugin_vim_pane)
-    if v:shell_error
-        call RWarningMsg(rlog)
-        return 0
-    endif
-
-    if g:vimrplugin_objbr_place =~ "left"
-        if g:vimrplugin_objbr_place =~ "console"
-            call system("tmux swap-pane -d -s " . g:rplugin_rconsole_pane . " -t " . g:rplugin_ob_pane)
-        else
-            call system("tmux swap-pane -d -s " . g:rplugin_vim_pane . " -t " . g:rplugin_ob_pane)
-        endif
-    endif
-    if g:rplugin_ob_warn_shown == 0
-        if !has("clientserver")
-            call RWarningMsg("The +clientserver feature is required to automatically update the Object Browser.")
-            sleep 200m
-        else
-            if $DISPLAY == ""
-                call RWarningMsg("The X Window system is required to automatically update the Object Browser.")
-                sleep 200m
-            endif
-        endif
-        let g:rplugin_ob_warn_shown = 1
-    endif
-    return
-endfunction
-
 function StartObjBrowser_Vim()
-    let g:RBrOpenCloseLs = function("RBrOpenCloseLs_Vim")
     let wmsg = ""
-    if v:servername == ""
-        if g:rplugin_ob_warn_shown == 0
-            if !has("clientserver")
-                let wmsg = "The +clientserver feature is required to automatically update the Object Browser."
-            else
-                if $DISPLAY == "" && !(has("win32") || has("win64"))
-                    let wmsg = "The X Window system is required to automatically update the Object Browser."
-                else
-                    let wmsg ="The Object Browser will not be automatically updated because Vim's client/server was not started."
-                endif
-            endif
-        endif
-        let g:rplugin_ob_warn_shown = 1
-    else
-        call SendToVimCom("\002" . v:servername)
-    endif
+    call SendToVimCom("\002" . g:rplugin_myport)
 
     " Either load or reload the Object Browser
     let savesb = &switchbuf
@@ -1254,7 +890,6 @@ function StartObjBrowser_Vim()
         unlet g:tmp_objbrtitle
         unlet g:tmp_tmuxsname
         unlet g:tmp_curbufname
-        call SendToVimCom("\005B Update OB [OB init GVIM]")
         sleep 50m
     endif
     if wmsg != ""
@@ -1289,91 +924,26 @@ function RObjBrowser()
     return
 endfunction
 
-function VimExprToOB(msg)
-    if serverlist() =~ "\\<" . g:rplugin_obsname . "\n"
-        return remote_expr(g:rplugin_obsname, a:msg)
-    else
-        if IsExternalOBRunning()
-            let slog = system("tmux set-buffer ':call " . a:msg . "\' && tmux paste-buffer -t " . g:rplugin_ob_pane)
-            if v:shell_error
-                call RWarningMsg(slog)
-            endif
-            return "NoVimServer"
-        endif
-        return "NoOBRunning"
-    endif
+function RBrOpenCloseLs(stt)
+    call SendToVimCom("\007" . a:stt)
 endfunction
 
-function RBrOpenCloseLs_Vim(status)
-    if a:status == 1
-        if exists("g:rplugin_curview")
-            let curview = g:rplugin_curview
-        else
-            let curview = "GlobalEnv"
-        endif
-        if curview == "libraries"
-            echohl WarningMsg
-            echon "GlobalEnv command only."
-            sleep 1
-            echohl Normal
-            normal! :
-            return
-        endif
-    endif
-
-    " Avoid possibly freezing cross messages between Vim and R
-    if exists("g:rplugin_curview") && v:servername != ""
-        let stt = a:status
-    else
-        let stt = a:status + 2
-    endif
-
-    let switchedbuf = 0
-    if buflisted("Object_Browser") && g:rplugin_curbuf != "Object_Browser"
-        let savesb = &switchbuf
-        set switchbuf=useopen,usetab
-        sil noautocmd sb Object_Browser
-        let switchedbuf = 1
-    endif
-
-    call SendToVimCom("\007" . stt)
-
-    if switchedbuf
-        exe "sil noautocmd sb " . g:rplugin_curbuf
-        exe "set switchbuf=" . savesb
-    endif
-endfunction
-
-function RBrOpenCloseLs_TmuxVim(status)
-    if a:status == 1
-        if IsExternalOBRunning() && has("clientserver") && $DISPLAY != "" && serverlist() =~ "\\<" . g:rplugin_obsname . "\n"
-            let curview = remote_expr(g:rplugin_obsname, 'g:rplugin_curview')
-            if curview == "libraries"
-                echohl WarningMsg
-                echon "GlobalEnv command only."
-                sleep 1
-                echohl Normal
-                normal! :
-                return
-            endif
-        endif
+function SendToVimCom(cmd)
+    if g:rplugin_vimcomport == 0
+        call RWarningMsg("VimCom port is unknown.")
+        call RWarningMsg(a:cmd)
+        return
     endif
-
-    call SendToVimCom("\007" . a:status)
+    call ch_sendraw(g:rplugin_channel, "\002" . a:cmd . "\n")
 endfunction
 
-function RBrOpenCloseLs_TmuxOB(status)
-    if a:status == 1 && g:rplugin_curview == "libraries"
-        echohl WarningMsg
-        echon "GlobalEnv command only."
-        sleep 1
-        echohl Normal
-        normal! :
-        return
-    endif
-    call SendToVimCom("\007" . a:status)
-    if v:servername == ""
-        call UpdateOB("both")
+function RSetMyPort(p)
+    let g:rplugin_myport = a:p
+    let $VIMR_PORT = a:p
+    if &filetype == "rbrowser" && g:rplugin_do_tmux_split
+        call SendToVimCom("\002" . g:rplugin_myport)
+    elseif g:rplugin_vimcomport
+        call SendToVimCom("\001" . g:rplugin_myport)
     endif
 endfunction
 
@@ -1448,57 +1018,6 @@ function SendCmdToR_fake(cmd)
     return 0
 endfunction
 
-function SendCmdToR_TmuxSplit(cmd)
-    if g:vimrplugin_ca_ck
-        let cmd = "\001" . "\013" . a:cmd
-    else
-        let cmd = a:cmd
-    endif
-
-    if !exists("g:rplugin_rconsole_pane")
-        " Should never happen
-        call RWarningMsg("Missing internal variable: g:rplugin_rconsole_pane")
-    endif
-    let str = substitute(cmd, "'", "'\\\\''", "g")
-    if str =~ '^-'
-        let str = ' ' . str
-    endif
-    let scmd = "tmux set-buffer '" . str . "\' && tmux paste-buffer -t " . g:rplugin_rconsole_pane
-    let rlog = system(scmd)
-    if v:shell_error
-        let rlog = substitute(rlog, "\n", " ", "g")
-        let rlog = substitute(rlog, "\r", " ", "g")
-        call RWarningMsg(rlog)
-        call ClearRInfo()
-        return 0
-    endif
-    return 1
-endfunction
-
-function SendCmdToR_Term(cmd)
-    if g:vimrplugin_ca_ck
-        let cmd = "\001" . "\013" . a:cmd
-    else
-        let cmd = a:cmd
-    endif
-
-    " Send the command to R running in an external terminal emulator
-    let str = substitute(cmd, "'", "'\\\\''", "g")
-    if str =~ '^-'
-        let str = ' ' . str
-    endif
-    let scmd = "tmux -L vimr set-buffer '" . str . "\' && tmux -L vimr paste-buffer -t " . g:rplugin_tmuxsname . '.0'
-    let rlog = system(scmd)
-    if v:shell_error
-        let rlog = substitute(rlog, '\n', ' ', 'g')
-        let rlog = substitute(rlog, '\r', ' ', 'g')
-        call RWarningMsg(rlog)
-        call ClearRInfo()
-        return 0
-    endif
-    return 1
-endfunction
-
 " Get the word either under or after the cursor.
 " Works for word(| where | is the cursor position.
 function RGetKeyWord()
@@ -1523,6 +1042,24 @@ function RGetKeyWord()
     return rkeyword
 endfunction
 
+function GetROutput(outf)
+    if a:outf =~ g:rplugin_tmpdir
+        let tnum = 1
+        while bufexists("so" . tnum)
+            let tnum += 1
+        endwhile
+        exe 'tabnew so' . tnum
+        exe 'read ' . substitute(a:outf, " ", '\\ ', 'g')
+        set filetype=rout
+        setlocal buftype=nofile
+        setlocal noswapfile
+    else
+        exe 'tabnew ' . substitute(a:outf, " ", '\\ ', 'g')
+    endif
+    normal! gT
+    redraw
+endfunction
+
 function RViewDF(oname)
     if exists("g:vimrplugin_csv_app")
         if !executable(g:vimrplugin_csv_app)
@@ -1551,24 +1088,6 @@ function RViewDF(oname)
     endif
 endfunction
 
-function GetROutput(outf)
-    if a:outf =~ g:rplugin_tmpdir
-        let tnum = 1
-        while bufexists("so" . tnum)
-            let tnum += 1
-        endwhile
-        exe 'tabnew so' . tnum
-        exe 'read ' . substitute(a:outf, " ", '\\ ', 'g')
-        set filetype=rout
-        setlocal buftype=nofile
-        setlocal noswapfile
-    else
-        exe 'tabnew ' . substitute(a:outf, " ", '\\ ', 'g')
-    endif
-    normal! gT
-    redraw
-endfunction
-
 function GetSourceArgs(e)
     let sargs = ""
     if g:vimrplugin_source_args != ""
@@ -1606,7 +1125,7 @@ endfunction
 function SendFileToR(e)
     update
     let fpath = expand("%:p")
-    if has("win32") || has("win64")
+    if has("win32")
         let fpath = substitute(fpath, "\\", "/", "g")
     endif
     let sargs = GetSourceArgs(a:e)
@@ -2020,13 +1539,8 @@ endfunction
 
 " Clear the console screen
 function RClearConsole(...)
-    if has("win32") || has("win64")
-        if g:vimrplugin_Rterm
-            let repl = libcall(g:rplugin_vimcom_lib, "RClearConsole", "Term")
-        else
-            let repl = libcall(g:rplugin_vimcom_lib, "RClearConsole", "Rgui")
-        endif
-        exe "sleep " . g:rplugin_sleeptime
+    if has("win32")
+        call ch_sendraw(g:rplugin_channel, "\006\n")
         call foreground()
     elseif !g:vimrplugin_applescript
         call g:SendCmdToR("\014")
@@ -2054,14 +1568,6 @@ function RSetWD()
     sleep 100m
 endfunction
 
-function CloseExternalOB()
-    if IsExternalOBRunning()
-        call system("tmux kill-pane -t " . g:rplugin_ob_pane)
-        unlet g:rplugin_ob_pane
-        sleep 250m
-    endif
-endfunction
-
 function ClearRInfo()
     if exists("g:rplugin_rconsole_pane")
         unlet g:rplugin_rconsole_pane
@@ -2072,7 +1578,7 @@ function ClearRInfo()
     call delete(g:rplugin_tmpdir . "/libnames_" . $VIMINSTANCEID)
     call delete(g:rplugin_tmpdir . "/GlobalEnvList_" . $VIMINSTANCEID)
     call delete(g:rplugin_tmpdir . "/vimcom_running_" . $VIMINSTANCEID)
-    call delete(g:rplugin_tmpdir . "/rconsole_hwnd_" . $VIMRPLUGIN_SECRET)
+    call delete(g:rplugin_tmpdir . "/rconsole_hwnd_" . $VIMR_SECRET)
     let g:SendCmdToR = function('SendCmdToR_fake')
     let g:rplugin_r_pid = 0
     let g:rplugin_vimcomport = 0
@@ -2080,17 +1586,15 @@ function ClearRInfo()
     if g:rplugin_do_tmux_split && g:vimrplugin_tmux_title != "automatic" && g:vimrplugin_tmux_title != ""
         call system("tmux set automatic-rename on")
     endif
+
+    if bufloaded(b:objbrtitle)
+        exe "bunload! " . b:objbrtitle
+        sleep 30m
+    endif
 endfunction
 
 " Quit R
 function RQuit(how)
-    if a:how != "restartR"
-        if bufloaded(b:objbrtitle)
-            exe "bunload! " . b:objbrtitle
-            sleep 30m
-        endif
-    endif
-
     if exists("b:quit_command")
         let qcmd = b:quit_command
     else
@@ -2101,28 +1605,20 @@ function RQuit(how)
         endif
     endif
 
-    if g:vimrplugin_save_win_pos && v:servername != ""
-        let repl = libcall(g:rplugin_vimcom_lib, "SaveWinPos", $VIMRPLUGIN_COMPLDIR)
-        if repl != "OK"
-            call RWarningMsg(repl)
-        endif
+    if g:vimrplugin_save_win_pos
+        " SaveWinPos
+        call ch_sendraw(g:rplugin_channel, "\004" . $VIMR_COMPLDIR . "\n")
     endif
 
     call g:SendCmdToR(qcmd)
-    if g:rplugin_do_tmux_split
-        if a:how == "save"
-            sleep 200m
-        endif
-        if g:vimrplugin_restart
-            let ca_ck = g:vimrplugin_ca_ck
-            let g:vimrplugin_ca_ck = 0
-            call g:SendCmdToR("exit")
-            let g:vimrplugin_ca_ck = ca_ck
-        endif
+    if g:rplugin_do_tmux_split && a:how == "save"
+        sleep 200m
     endif
 
     sleep 50m
-    call CloseExternalOB()
+    if g:rplugin_do_tmux_split
+        call CloseExternalOB()
+    endif
     call ClearRInfo()
 endfunction
 
@@ -2435,6 +1931,79 @@ function ShowRDoc(rkeyword)
     stopinsert
 endfunction
 
+function ROpenPDF(path)
+    if a:path == "Get Master"
+        let tmpvar = SyncTeX_GetMaster()
+        let pdfpath = tmpvar[1] . '/' . tmpvar[0] . '.pdf'
+    else
+        let pdfpath = a:path
+    endif
+    let basenm = substitute(substitute(pdfpath, '.*/', '', ''), '\.pdf$', '', '')
+
+    let olddir = getcwd()
+    if olddir != expand("%:p:h")
+        exe "cd " . substitute(expand("%:p:h"), ' ', '\\ ', 'g')
+    endif
+
+    if !filereadable(basenm . ".pdf")
+        call RWarningMsg('File not found: "' . basenm . '.pdf".')
+        exe "cd " . substitute(olddir, ' ', '\\ ', 'g')
+        return
+    endif
+    if g:rplugin_pdfviewer == "none"
+        call RWarningMsg("Could not find a PDF viewer, and vimrplugin_pdfviewer is not defined.")
+    else
+        if g:rplugin_pdfviewer == "okular"
+            let pcmd = "okular --unique '" .  pdfpath . "' 2>/dev/null >/dev/null &"
+            call system(pcmd)
+        elseif g:rplugin_pdfviewer == "zathura"
+            if system("wmctrl -xl") =~ 'Zathura.*' . basenm . '.pdf' && g:rplugin_zathura_pid[basenm] != 0
+                call system("wmctrl -a '" . basenm . ".pdf'")
+            else
+                let g:rplugin_zathura_pid[basenm] = 0
+                call RStart_Zathura(basenm)
+            endif
+            exe "cd " . substitute(olddir, ' ', '\\ ', 'g')
+            return
+        elseif g:rplugin_pdfviewer == "sumatra" && (g:rplugin_sumatra_path != "" || FindSumatra())
+            silent exe '!start "' . g:rplugin_sumatra_path . '" -reuse-instance -inverse-search "vclientserver.exe ' . "\\%f \\%l" . '" "' . basenm . '.pdf"'
+            exe "cd " . substitute(olddir, ' ', '\\ ', 'g')
+            return
+        elseif g:rplugin_pdfviewer == "skim"
+            call system(g:macvim_skim_app_path . '/Contents/MacOS/Skim "' . basenm . '.pdf" 2> /dev/null >/dev/null &')
+        else
+            let pcmd = g:rplugin_pdfviewer . " '" . pdfpath . "' 2>/dev/null >/dev/null &"
+            call system(pcmd)
+        endif
+        if g:rplugin_has_wmctrl
+            call system("wmctrl -a '" . basenm . ".pdf'")
+        endif
+    endif
+    exe "cd " . substitute(olddir, ' ', '\\ ', 'g')
+endfunction
+
+function RStart_Zathura(basenm)
+    let a2 = 'a2 = "vclientserver ' . "'%{input}' %{line}" . '"'
+    let pycode = ["# -*- coding: " . &encoding . " -*-",
+                \ "import subprocess",
+                \ "import os",
+                \ "import sys",
+                \ "FNULL = open(os.devnull, 'w')",
+                \ "a1 = '--synctex-editor-command'",
+                \ a2,
+                \ "a3 = '" . a:basenm . ".pdf'",
+                \ "zpid = subprocess.Popen(['zathura', a1, a2, a3], stdout = FNULL, stderr = FNULL).pid",
+                \ "sys.stdout.write(str(zpid))" ]
+    call writefile(pycode, g:rplugin_tmpdir . "/start_zathura.py")
+    let pid = system("python '" . g:rplugin_tmpdir . "/start_zathura.py" . "'")
+    if pid == 0
+        call RWarningMsg("Failed to run Zathura: " . substitute(pid, "\n", " ", "g"))
+    else
+        let g:rplugin_zathura_pid[a:basenm] = pid
+    endif
+    call delete(g:rplugin_tmpdir . "/start_zathura.py")
+endfunction
+
 function RSetPDFViewer()
     if exists("g:vimrplugin_pdfviewer") && g:vimrplugin_pdfviewer != "none"
         let g:rplugin_pdfviewer = tolower(g:vimrplugin_pdfviewer)
@@ -2444,12 +2013,12 @@ function RSetPDFViewer()
             let g:rplugin_pdfviewer = "sumatra"
         elseif g:rplugin_is_darwin
             let g:rplugin_pdfviewer = "skim"
+        elseif executable("zathura")
+            let g:rplugin_pdfviewer = "zathura"
         elseif executable("evince")
             let g:rplugin_pdfviewer = "evince"
         elseif executable("okular")
             let g:rplugin_pdfviewer = "okular"
-        elseif executable("zathura")
-            let g:rplugin_pdfviewer = "zathura"
         else
             let g:rplugin_pdfviewer = "none"
             if $R_PDFVIEWER == ""
@@ -2488,79 +2057,6 @@ function RSetPDFViewer()
     endif
 endfunction
 
-function RStart_Zathura(basenm)
-    let a2 = 'a2 = "vim --servername ' . v:servername . " --remote-expr \\\"SyncTeX_backward('%{input}',%{line})\\\"" . '"'
-    let pycode = ["# -*- coding: " . &encoding . " -*-",
-                \ "import subprocess",
-                \ "import os",
-                \ "import sys",
-                \ "FNULL = open(os.devnull, 'w')",
-                \ "a1 = '--synctex-editor-command'",
-                \ a2,
-                \ "a3 = '" . a:basenm . ".pdf'",
-                \ "zpid = subprocess.Popen(['zathura', a1, a2, a3], stdout = FNULL, stderr = FNULL).pid",
-                \ "sys.stdout.write(str(zpid))" ]
-    call writefile(pycode, g:rplugin_tmpdir . "/start_zathura.py")
-    let pid = system("python '" . g:rplugin_tmpdir . "/start_zathura.py" . "'")
-    if pid == 0
-        call RWarningMsg("Failed to run Zathura: " . substitute(pid, "\n", " ", "g"))
-    else
-        let g:rplugin_zathura_pid[a:basenm] = pid
-    endif
-    call delete(g:rplugin_tmpdir . "/start_zathura.py")
-endfunction
-
-function ROpenPDF(path)
-    if a:path == "Get Master"
-        let tmpvar = SyncTeX_GetMaster()
-        let pdfpath = tmpvar[1] . '/' . tmpvar[0] . '.pdf'
-    else
-        let pdfpath = a:path
-    endif
-    let basenm = substitute(substitute(pdfpath, '.*/', '', ''), '\.pdf$', '', '')
-
-    let olddir = getcwd()
-    if olddir != expand("%:p:h")
-        exe "cd " . substitute(expand("%:p:h"), ' ', '\\ ', 'g')
-    endif
-
-    if !filereadable(basenm . ".pdf")
-        call RWarningMsg('File not found: "' . basenm . '.pdf".')
-        exe "cd " . substitute(olddir, ' ', '\\ ', 'g')
-        return
-    endif
-    if g:rplugin_pdfviewer == "none"
-        call RWarningMsg("Could not find a PDF viewer, and vimrplugin_pdfviewer is not defined.")
-    else
-        if g:rplugin_pdfviewer == "okular"
-            let pcmd = "okular --unique '" .  pdfpath . "' 2>/dev/null >/dev/null &"
-        elseif g:rplugin_pdfviewer == "zathura"
-            if system("wmctrl -xl") =~ 'Zathura.*' . basenm . '.pdf' && g:rplugin_zathura_pid[basenm] != 0
-                call system("wmctrl -a '" . basenm . ".pdf'")
-            else
-                let g:rplugin_zathura_pid[basenm] = 0
-                call RStart_Zathura(basenm)
-            endif
-            exe "cd " . substitute(olddir, ' ', '\\ ', 'g')
-            return
-        elseif g:rplugin_pdfviewer == "sumatra" && (g:rplugin_sumatra_path != "" || FindSumatra())
-            silent exe '!start "' . g:rplugin_sumatra_path . '" -reuse-instance -inverse-search "vim --servername ' . v:servername . " --remote-expr SyncTeX_backward('\\%f',\\%l)" . '" "' . basenm . '.pdf"'
-            exe "cd " . substitute(olddir, ' ', '\\ ', 'g')
-            return
-        elseif g:rplugin_pdfviewer == "skim"
-            call system(g:macvim_skim_app_path . '/Contents/MacOS/Skim "' . basenm . '.pdf" 2> /dev/null >/dev/null &')
-        else
-            let pcmd = g:rplugin_pdfviewer . " '" . pdfpath . "' 2>/dev/null >/dev/null &"
-            call system(pcmd)
-        endif
-        if g:rplugin_has_wmctrl
-            call system("wmctrl -a '" . basenm . ".pdf'")
-        endif
-    endif
-    exe "cd " . substitute(olddir, ' ', '\\ ', 'g')
-endfunction
-
-
 function RSourceDirectory(...)
     if has("win32") || has("win64")
         let dir = substitute(a:1, '\\', '/', "g")
@@ -2642,32 +2138,19 @@ function RAction(rcmd)
     endif
     if strlen(rkeyword) > 0
         if a:rcmd == "help"
-            let g:rplugin_running_rhelp = 1
             if g:vimrplugin_vimpager == "no"
                 call g:SendCmdToR("help(" . rkeyword . ")")
             else
+                if !b:rplugin_extern_ob
+                    let g:rplugin_running_rhelp = 1
+                endif
                 if bufname("%") =~ "Object_Browser" || b:rplugin_extern_ob
                     if g:rplugin_curview == "libraries"
                         let pkg = RBGetPkgName()
                     else
                         let pkg = ""
                     endif
-                    if b:rplugin_extern_ob
-                        if g:rplugin_vim_pane == "none"
-                            call RWarningMsg("Cmd not available.")
-                        else
-                            if g:rplugin_editor_sname == ""
-                                let slog = system("tmux set-buffer '" . "\\" . ':call AskRDoc("' . rkeyword . '", "' . pkg . '", 0)' . "\' && tmux paste-buffer -t " . g:rplugin_vim_pane . " && tmux select-pane -t " . g:rplugin_vim_pane)
-                                if v:shell_error
-                                    call RWarningMsg(slog)
-                                endif
-                            else
-                                silent exe 'call remote_expr("' . g:rplugin_editor_sname . '", ' . "'AskRDoc(" . '"' . rkeyword . '", "' . pkg . '", 0)' . "')"
-                            endif
-                        endif
-                    else
-                        call AskRDoc(rkeyword, pkg, 0)
-                    endif
+                    call AskRDoc(rkeyword, pkg, 0)
                     return
                 endif
                 call AskRDoc(rkeyword, "", 1)
@@ -2810,8 +2293,8 @@ function RControlMaps()
     " Build list of objects for omni completion
     "-------------------------------------
     call RCreateMaps("nvi", 'RUpdateObjBrowser', 'ro', ':call RObjBrowser()')
-    call RCreateMaps("nvi", 'ROpenLists',        'r=', ':call g:RBrOpenCloseLs(1)')
-    call RCreateMaps("nvi", 'RCloseLists',       'r-', ':call g:RBrOpenCloseLs(0)')
+    call RCreateMaps("nvi", 'ROpenLists',        'r=', ':call RBrOpenCloseLs(1)')
+    call RCreateMaps("nvi", 'RCloseLists',       'r-', ':call RBrOpenCloseLs(0)')
 endfunction
 
 
@@ -2998,7 +2481,7 @@ function RVimLeave()
     call delete(g:rplugin_tmpdir . "/unformatted_code")
     call delete(g:rplugin_tmpdir . "/vimbol_finished")
     call delete(g:rplugin_tmpdir . "/vimcom_running_" . $VIMINSTANCEID)
-    call delete(g:rplugin_tmpdir . "/rconsole_hwnd_" . $VIMRPLUGIN_SECRET)
+    call delete(g:rplugin_tmpdir . "/rconsole_hwnd_" . $VIMR_SECRET)
     call delete(g:rplugin_tmpdir . "/openR'")
     if executable("rmdir")
         call system("rmdir '" . g:rplugin_tmpdir . "'")
@@ -3018,6 +2501,20 @@ function RSourceOtherScripts()
     endif
 endfunction
 
+function ROnJobStdout(job_id, msg)
+    let cmd = substitute(a:msg, '\n', '', 'g')
+    let cmd = substitute(a:msg, '\r', '', 'g')
+    if cmd =~ "^call " || cmd =~ "^let "
+        exe cmd
+    else
+        call RWarningMsg('[Job] Unknown command: "' . cmd . '"')
+    endif
+endfunction
+
+function ROnJobStderr(job_id, msg)
+    call RWarningMsg('[Job] ' . substitute(a:msg, '\n', ' ', 'g'))
+endfunction
+
 command -nargs=1 -complete=customlist,RLisObjs Rinsert :call RInsert()
 command -range=% Rformat ,:call RFormatCode()
 command RBuildTags :call g:SendCmdToR('rtags(ofile = "TAGS")')
@@ -3089,7 +2586,6 @@ call RSetDefaultValue("g:vimrplugin_openhtml",          0)
 call RSetDefaultValue("g:vimrplugin_vim_wd",            0)
 call RSetDefaultValue("g:vimrplugin_source_args",    "''")
 call RSetDefaultValue("g:vimrplugin_after_start",    "''")
-call RSetDefaultValue("g:vimrplugin_restart",           0)
 call RSetDefaultValue("g:vimrplugin_vsplit",            0)
 call RSetDefaultValue("g:vimrplugin_csv_warn",          1)
 call RSetDefaultValue("g:vimrplugin_rconsole_width",   -1)
@@ -3165,25 +2661,6 @@ endfor
 unlet objbrplace
 unlet obpllen
 
-function RSetMyPort(p)
-    let g:rplugin_myport = a:p
-    if &filetype == "rbrowser"
-        call SendToVimCom("\002" . a:p)
-        call SendToVimCom("\005B Update OB [RSetMyPort]")
-    endif
-endfunction
-
-function SendToVimCom(...)
-    if g:rplugin_vimcomport == 0
-        call RWarningMsg("VimCom port is unknown.")
-        return
-    endif
-    let repl = libcall(g:rplugin_vimcom_lib, "SendToVimCom", g:rplugin_vimcomport . " " . a:1)
-    if repl != "OK"
-        call RWarningMsg(repl)
-    endif
-endfunction
-
 
 " ^K (\013) cleans from cursor to the right and ^U (\025) cleans from cursor
 " to the left. However, ^U causes a beep if there is nothing to clean. The
@@ -3247,31 +2724,6 @@ endif
 
 " ========================================================================
 
-" Check whether Tmux is OK
-if !has("win32") && !has("win64") && !has("gui_win32") && !has("gui_win64") && !g:vimrplugin_applescript
-    if !executable('tmux') && g:vimrplugin_source !~ "screenR"
-        call RWarningMsgInp("Please, install the 'Tmux' application to enable the Vim-R-plugin.")
-        let g:rplugin_failed = 1
-        finish
-    endif
-
-    if system("uname") =~ "OpenBSD"
-        " Tmux does not have -V option on OpenBSD: https://github.com/jcfaria/Vim-R-plugin/issues/200
-        let g:rplugin_tmux_version = "2.1"
-    else
-        let g:rplugin_tmux_version = system("tmux -V")
-        let g:rplugin_tmux_version = substitute(g:rplugin_tmux_version, '.*tmux \([0-9]\.[0-9]\).*', '\1', '')
-        if strlen(g:rplugin_tmux_version) != 3
-            let g:rplugin_tmux_version = "1.0"
-        endif
-        if g:rplugin_tmux_version < "1.8" && g:vimrplugin_source !~ "screenR"
-            call RWarningMsgInp("Vim-R-plugin requires Tmux >= 1.8")
-            let g:rplugin_failed = 1
-            finish
-        endif
-    endif
-endif
-
 " Start with an empty list of objects in the workspace
 let g:rplugin_globalenvlines = []
 
@@ -3288,90 +2740,6 @@ endif
 " List of marks that the plugin seeks to find the block to be sent to R
 let s:all_marks = "abcdefghijklmnopqrstuvwxyz"
 
-
-" Choose a terminal (code adapted from screen.vim)
-if exists("g:vimrplugin_term")
-    if !executable(g:vimrplugin_term)
-        call RWarningMsgInp("'" . g:vimrplugin_term . "' not found. Please change the value of 'vimrplugin_term' in your vimrc.")
-        let g:vimrplugin_term = "xterm"
-    endif
-endif
-if has("win32") || has("win64") || g:rplugin_is_darwin || g:rplugin_do_tmux_split
-    " No external terminal emulator will be called, so any value is good
-    let g:vimrplugin_term = "xterm"
-endif
-if !exists("g:vimrplugin_term")
-    let s:terminals = ['gnome-terminal', 'konsole', 'xfce4-terminal', 'terminal', 'Eterm',
-                \ 'rxvt', 'urxvt', 'aterm', 'roxterm', 'terminator', 'lxterminal', 'xterm']
-    for s:term in s:terminals
-        if executable(s:term)
-            let g:vimrplugin_term = s:term
-            break
-        endif
-    endfor
-    unlet s:term
-    unlet s:terminals
-endif
-
-if !exists("g:vimrplugin_term") && !exists("g:vimrplugin_term_cmd")
-    call RWarningMsgInp("Please, set the variable 'g:vimrplugin_term_cmd' in your .vimrc. Read the plugin documentation for details.")
-    let g:rplugin_failed = 1
-    finish
-endif
-
-let g:rplugin_termcmd = g:vimrplugin_term . " -e"
-
-if g:vimrplugin_term == "gnome-terminal" || g:vimrplugin_term == "xfce4-terminal" || g:vimrplugin_term == "terminal" || g:vimrplugin_term == "lxterminal"
-    " Cannot set gnome-terminal icon: http://bugzilla.gnome.org/show_bug.cgi?id=126081
-    if g:vimrplugin_vim_wd
-        let g:rplugin_termcmd = g:vimrplugin_term . " -e"
-    else
-        let g:rplugin_termcmd = g:vimrplugin_term . " --working-directory='" . expand("%:p:h") . "' -e"
-    endif
-endif
-
-if g:vimrplugin_term == "terminator"
-    if g:vimrplugin_vim_wd
-        let g:rplugin_termcmd = "terminator --title R -x"
-    else
-        let g:rplugin_termcmd = "terminator --working-directory='" . expand("%:p:h") . "' --title R -x"
-    endif
-endif
-
-if g:vimrplugin_term == "konsole"
-    if g:vimrplugin_vim_wd
-        let g:rplugin_termcmd = "konsole --icon " . g:rplugin_home . "/bitmaps/ricon.png -e"
-    else
-        let g:rplugin_termcmd = "konsole --workdir '" . expand("%:p:h") . "' --icon " . g:rplugin_home . "/bitmaps/ricon.png -e"
-    endif
-endif
-
-if g:vimrplugin_term == "Eterm"
-    let g:rplugin_termcmd = "Eterm --icon " . g:rplugin_home . "/bitmaps/ricon.png -e"
-endif
-
-if g:vimrplugin_term == "roxterm"
-    " Cannot set icon: http://bugzilla.gnome.org/show_bug.cgi?id=126081
-    if g:vimrplugin_vim_wd
-        let g:rplugin_termcmd = "roxterm --title R -e"
-    else
-        let g:rplugin_termcmd = "roxterm --directory='" . expand("%:p:h") . "' --title R -e"
-    endif
-endif
-
-if g:vimrplugin_term == "xterm" || g:vimrplugin_term == "uxterm"
-    let g:rplugin_termcmd = g:vimrplugin_term . " -e"
-endif
-
-if g:vimrplugin_term == "rxvt" || g:vimrplugin_term == "urxvt"
-    let g:rplugin_termcmd = g:vimrplugin_term . " -cd '" . expand("%:p:h") . "' -title R -xrm '*iconPixmap: " . g:rplugin_home . "/bitmaps/ricon.xbm' -e"
-endif
-
-" Override default settings:
-if exists("g:vimrplugin_term_cmd")
-    let g:rplugin_termcmd = g:vimrplugin_term_cmd
-endif
-
 if filewritable('/dev/null')
     let g:rplugin_null = "'/dev/null'"
 elseif has("win32") && filewritable('NUL')
@@ -3390,7 +2758,6 @@ let g:rplugin_running_objbr = 0
 let g:rplugin_running_rhelp = 0
 let g:rplugin_newliblist = 0
 let g:rplugin_status_line = &statusline
-let g:rplugin_ob_warn_shown = 0
 let g:rplugin_r_pid = 0
 let g:rplugin_myport = 0
 let g:rplugin_vimcomport = 0
@@ -3436,15 +2803,13 @@ if &filetype == "rbrowser"
         call RWarningMsgInp("VIMINSTANCEID is undefined")
     endif
 else
-    let $VIMRPLUGIN_SECRET = GetRandomNumber(16)
+    let $VIMR_SECRET = GetRandomNumber(16)
     let $VIMINSTANCEID = substitute(g:rplugin_firstbuffer . GetRandomNumber(16), '\W', '', 'g')
     if strlen($VIMINSTANCEID) > 64
         let $VIMINSTANCEID = substitute($VIMINSTANCEID, '.*\(...............................................................\)', '\1', '')
     endif
 endif
 
-let g:rplugin_obsname = toupper(substitute(substitute(expand("%:r"), '\W', '', 'g'), "_", "", "g"))
-
 let g:rplugin_docfile = g:rplugin_tmpdir . "/Rdoc"
 
 " Create an empty file to avoid errors if the user do Ctrl-X Ctrl-O before
@@ -3453,13 +2818,6 @@ if &filetype != "rbrowser"
     call writefile([], g:rplugin_tmpdir . "/GlobalEnvList_" . $VIMINSTANCEID)
 endif
 
-if has("win32") || has("win64")
-    runtime r-plugin/windows.vim
-    let g:rplugin_has_icons = len(globpath(&rtp, "bitmaps/RStart.bmp")) > 0
-else
-    let g:rplugin_has_icons = len(globpath(&rtp, "bitmaps/RStart.png")) > 0
-endif
-
 " Set the value of R path
 if exists("g:vimrplugin_r_path")
     let g:rplugin_R = expand(g:vimrplugin_r_path)
@@ -3475,25 +2833,26 @@ elseif has("win32") || has("win64")
 else
     let g:rplugin_R = "R"
 endif
-if !executable(g:rplugin_R)
-    call RWarningMsgInp("R executable not found: '" . g:rplugin_R . "'")
-endif
 
-if has("gui_running")
-    runtime r-plugin/gui_running.vim
+if has("win32")
+    runtime r-plugin/windows.vim
+    let g:rplugin_has_icons = len(globpath(&rtp, "bitmaps/RStart.bmp")) > 0
+else
+    let g:rplugin_has_icons = len(globpath(&rtp, "bitmaps/RStart.png")) > 0
 endif
+
 if g:vimrplugin_applescript
     runtime r-plugin/osx.vim
 endif
 
-if exists("g:vimrplugin_permanent_libs")
-    call RWarningMsgInp("The option 'vimrplugin_permanent_libs' was renamed to 'vimrplugin_start_libs'. Please, rename it in your vimrc too.")
+if !has("win32") && !g:vimrplugin_applescript
+    runtime r-plugin/tmux.vim
 endif
 
-if exists("g:vimrplugin_routmorecolors")
-    call RWarningMsgInp("The option 'vimrplugin_routmorecolors' was renamed to 'Rout_more_colors'. Please, rename it in your vimrc too.")
+if has("gui_running")
+    runtime r-plugin/gui_running.vim
 endif
 
-if exists("g:vimrplugin_vim_window")
-    call RWarningMsgInp("The option 'vimrplugin_vim_window' is deprecated. Please, remove it from your vimrc.")
+if !executable(g:rplugin_R)
+    call RWarningMsgInp("R executable not found: '" . g:rplugin_R . "'")
 endif
diff --git a/r-plugin/extern_term.vim b/r-plugin/extern_term.vim
new file mode 100644
index 0000000..db53184
--- /dev/null
+++ b/r-plugin/extern_term.vim
@@ -0,0 +1,186 @@
+
+function StartR_ExternalTerm(rcmd)
+    if $DISPLAY == "" && !g:rplugin_is_darwin
+        call RWarningMsg("Start 'tmux' before Vim. The X Window system is required to run R in an external terminal.")
+        return
+    endif
+
+    if g:vimrplugin_notmuxconf
+        let tmuxcnf = ' '
+    else
+        " Create a custom tmux.conf
+        let cnflines = ['set-option -g prefix C-a',
+                    \ 'unbind-key C-b',
+                    \ 'bind-key C-a send-prefix',
+                    \ 'set-window-option -g mode-keys vi',
+                    \ 'set -g status off',
+                    \ 'set -g default-terminal "screen-256color"',
+                    \ "set -g terminal-overrides 'xterm*:smcup@:rmcup@'" ]
+
+        if g:vimrplugin_term == "rxvt" || g:vimrplugin_term == "urxvt"
+            let cnflines = cnflines + [
+                        \ "set terminal-overrides 'rxvt*:smcup@:rmcup@'" ]
+        endif
+
+        if g:vimrplugin_tmux_ob || !has("gui_running")
+            if g:rplugin_tmux_version < "2.1"
+                call extend(cnflines, ['set -g mode-mouse on', 'set -g mouse-select-pane on', 'set -g mouse-resize-pane on'])
+            else
+                call extend(cnflines, ['set -g mouse on'])
+            endif
+        endif
+        call writefile(cnflines, g:rplugin_tmpdir . "/tmux.conf")
+        let tmuxcnf = '-f "' . g:rplugin_tmpdir . "/tmux.conf" . '"'
+    endif
+
+    let rcmd = 'VIMRPLUGIN_TMPDIR=' . substitute(g:rplugin_tmpdir, ' ', '\\ ', 'g') . ' VIMR_COMPLDIR=' . substitute(g:rplugin_compldir, ' ', '\\ ', 'g') . ' VIMINSTANCEID=' . $VIMINSTANCEID . ' VIMR_SECRET=' . $VIMR_SECRET . ' VIMEDITOR_SVRNM=' . $VIMEDITOR_SVRNM . ' ' . a:rcmd
+
+    call system("tmux -L vimr has-session -t " . g:rplugin_tmuxsname)
+    if v:shell_error
+        if g:rplugin_is_darwin
+            let opencmd = printf("tmux -L vimr -2 %s new-session -s %s 'TERM=screen-256color %s'", tmuxcnf, g:rplugin_tmuxsname, rcmd)
+            call writefile(["#!/bin/sh", opencmd], $VIMRPLUGIN_TMPDIR . "/openR")
+            call system("chmod +x '" . $VIMRPLUGIN_TMPDIR . "/openR'")
+            let opencmd = "open '" . $VIMRPLUGIN_TMPDIR . "/openR'"
+        else
+            if g:rplugin_termcmd =~ "gnome-terminal" || g:rplugin_termcmd =~ "xfce4-terminal" || g:rplugin_termcmd =~ "terminal" || g:rplugin_termcmd =~ "iterm"
+                let opencmd = printf("%s 'tmux -L vimr -2 %s new-session -s %s \"%s\"' &", g:rplugin_termcmd, tmuxcnf, g:rplugin_tmuxsname, rcmd)
+            else
+                let opencmd = printf("%s tmux -L vimr -2 %s new-session -s %s \"%s\" &", g:rplugin_termcmd, tmuxcnf, g:rplugin_tmuxsname, rcmd)
+            endif
+        endif
+    else
+        if g:rplugin_is_darwin
+            call RWarningMsg("Tmux session with R is already running")
+            return
+        endif
+        if g:rplugin_termcmd =~ "gnome-terminal" || g:rplugin_termcmd =~ "xfce4-terminal" || g:rplugin_termcmd =~ "terminal" || g:rplugin_termcmd =~ "iterm"
+            let opencmd = printf("%s 'tmux -L vimr -2 %s attach-session -d -t %s' &", g:rplugin_termcmd, tmuxcnf, g:rplugin_tmuxsname)
+        else
+            let opencmd = printf("%s tmux -L vimr -2 %s attach-session -d -t %s &", g:rplugin_termcmd, tmuxcnf, g:rplugin_tmuxsname)
+        endif
+    endif
+
+    let rlog = system(opencmd)
+    if v:shell_error
+        call RWarningMsg(rlog)
+        return
+    endif
+    let g:SendCmdToR = function('SendCmdToR_Term')
+    if WaitVimComStart()
+        if g:vimrplugin_after_start != ''
+            call system(g:vimrplugin_after_start)
+        endif
+    endif
+endfunction
+
+function SendCmdToR_Term(cmd)
+    if g:vimrplugin_ca_ck
+        let cmd = "\001" . "\013" . a:cmd
+    else
+        let cmd = a:cmd
+    endif
+
+    " Send the command to R running in an external terminal emulator
+    let str = substitute(cmd, "'", "'\\\\''", "g")
+    if str =~ '^-'
+        let str = ' ' . str
+    endif
+    let scmd = "tmux -L vimr set-buffer '" . str . "\' && tmux -L vimr paste-buffer -t " . g:rplugin_tmuxsname . '.0'
+    let rlog = system(scmd)
+    if v:shell_error
+        let rlog = substitute(rlog, '\n', ' ', 'g')
+        let rlog = substitute(rlog, '\r', ' ', 'g')
+        call RWarningMsg(rlog)
+        call ClearRInfo()
+        return 0
+    endif
+    return 1
+endfunction
+
+if g:rplugin_is_darwin
+    finish
+endif
+
+" Choose a terminal (code adapted from screen.vim)
+if exists("g:vimrplugin_term")
+    if !executable(g:vimrplugin_term)
+        call RWarningMsgInp("'" . g:vimrplugin_term . "' not found. Please change the value of 'vimrplugin_term' in your vimrc.")
+        let g:vimrplugin_term = "xterm"
+    endif
+endif
+if has("win32") || has("win64") || g:rplugin_is_darwin || g:rplugin_do_tmux_split
+    " No external terminal emulator will be called, so any value is good
+    let g:vimrplugin_term = "xterm"
+endif
+if !exists("g:vimrplugin_term")
+    let s:terminals = ['gnome-terminal', 'konsole', 'xfce4-terminal', 'terminal', 'Eterm',
+                \ 'rxvt', 'urxvt', 'aterm', 'roxterm', 'terminator', 'lxterminal', 'xterm']
+    for s:term in s:terminals
+        if executable(s:term)
+            let g:vimrplugin_term = s:term
+            break
+        endif
+    endfor
+    unlet s:term
+    unlet s:terminals
+endif
+
+if !exists("g:vimrplugin_term") && !exists("g:vimrplugin_term_cmd")
+    call RWarningMsgInp("Please, set the variable 'g:vimrplugin_term_cmd' in your .vimrc. Read the plugin documentation for details.")
+    let g:rplugin_failed = 1
+    finish
+endif
+
+let g:rplugin_termcmd = g:vimrplugin_term . " -e"
+
+if g:vimrplugin_term == "gnome-terminal" || g:vimrplugin_term == "xfce4-terminal" || g:vimrplugin_term == "terminal" || g:vimrplugin_term == "lxterminal"
+    " Cannot set gnome-terminal icon: http://bugzilla.gnome.org/show_bug.cgi?id=126081
+    if g:vimrplugin_vim_wd
+        let g:rplugin_termcmd = g:vimrplugin_term . " -e"
+    else
+        let g:rplugin_termcmd = g:vimrplugin_term . " --working-directory='" . expand("%:p:h") . "' -e"
+    endif
+endif
+
+if g:vimrplugin_term == "terminator"
+    if g:vimrplugin_vim_wd
+        let g:rplugin_termcmd = "terminator --title R -x"
+    else
+        let g:rplugin_termcmd = "terminator --working-directory='" . expand("%:p:h") . "' --title R -x"
+    endif
+endif
+
+if g:vimrplugin_term == "konsole"
+    if g:vimrplugin_vim_wd
+        let g:rplugin_termcmd = "konsole --icon " . g:rplugin_home . "/bitmaps/ricon.png -e"
+    else
+        let g:rplugin_termcmd = "konsole --workdir '" . expand("%:p:h") . "' --icon " . g:rplugin_home . "/bitmaps/ricon.png -e"
+    endif
+endif
+
+if g:vimrplugin_term == "Eterm"
+    let g:rplugin_termcmd = "Eterm --icon " . g:rplugin_home . "/bitmaps/ricon.png -e"
+endif
+
+if g:vimrplugin_term == "roxterm"
+    " Cannot set icon: http://bugzilla.gnome.org/show_bug.cgi?id=126081
+    if g:vimrplugin_vim_wd
+        let g:rplugin_termcmd = "roxterm --title R -e"
+    else
+        let g:rplugin_termcmd = "roxterm --directory='" . expand("%:p:h") . "' --title R -e"
+    endif
+endif
+
+if g:vimrplugin_term == "xterm" || g:vimrplugin_term == "uxterm"
+    let g:rplugin_termcmd = g:vimrplugin_term . " -e"
+endif
+
+if g:vimrplugin_term == "rxvt" || g:vimrplugin_term == "urxvt"
+    let g:rplugin_termcmd = g:vimrplugin_term . " -cd '" . expand("%:p:h") . "' -title R -xrm '*iconPixmap: " . g:rplugin_home . "/bitmaps/ricon.xbm' -e"
+endif
+
+" Override default settings:
+if exists("g:vimrplugin_term_cmd")
+    let g:rplugin_termcmd = g:vimrplugin_term_cmd
+endif
diff --git a/r-plugin/gui_running.vim b/r-plugin/gui_running.vim
index f95e228..4f3eae8 100644
--- a/r-plugin/gui_running.vim
+++ b/r-plugin/gui_running.vim
@@ -47,8 +47,8 @@ endfunction
 
 function RBrowserMenu()
     call RCreateMenuItem("nvi", 'Object\ browser.Show/Update', 'RUpdateObjBrowser', 'ro', ':call RObjBrowser()')
-    call RCreateMenuItem("nvi", 'Object\ browser.Expand\ (all\ lists)', 'ROpenLists', 'r=', ':call g:RBrOpenCloseLs(1)')
-    call RCreateMenuItem("nvi", 'Object\ browser.Collapse\ (all\ lists)', 'RCloseLists', 'r-', ':call g:RBrOpenCloseLs(0)')
+    call RCreateMenuItem("nvi", 'Object\ browser.Expand\ (all\ lists)', 'ROpenLists', 'r=', ':call RBrOpenCloseLs(1)')
+    call RCreateMenuItem("nvi", 'Object\ browser.Collapse\ (all\ lists)', 'RCloseLists', 'r-', ':call RBrOpenCloseLs(0)')
     if &filetype == "rbrowser"
         imenu  R.Object\ browser.Toggle\ (cur)Enter :call RBrowserDoubleClick()
         nmenu  R.Object\ browser.Toggle\ (cur)Enter :call RBrowserDoubleClick()
diff --git a/r-plugin/osx.vim b/r-plugin/osx.vim
index 33adee6..70119f6 100644
--- a/r-plugin/osx.vim
+++ b/r-plugin/osx.vim
@@ -21,8 +21,6 @@ function StartR_OSX()
     endif
     let g:SendCmdToR = function('SendCmdToR_OSX')
     if WaitVimComStart()
-        call SendToVimCom("\005B Update OB [StartR]")
-        sleep 200m
         if g:vimrplugin_after_start != ''
             call system(g:vimrplugin_after_start)
         endif
diff --git a/r-plugin/setcompldir.vim b/r-plugin/setcompldir.vim
index 27cad20..b6557d4 100644
--- a/r-plugin/setcompldir.vim
+++ b/r-plugin/setcompldir.vim
@@ -73,5 +73,5 @@ if !isdirectory(g:rplugin_compldir)
         call writefile(readme, g:rplugin_compldir . "/README")
     endif
 endif
-let $VIMRPLUGIN_COMPLDIR = g:rplugin_compldir
+let $VIMR_COMPLDIR = g:rplugin_compldir
 
diff --git a/r-plugin/synctex_evince_backward.py b/r-plugin/synctex_evince_backward.py
index a1963d3..e0cf0a3 100644
--- a/r-plugin/synctex_evince_backward.py
+++ b/r-plugin/synctex_evince_backward.py
@@ -112,19 +112,14 @@ def on_window_close(self):
     def on_sync_source(self, input_file, source_link, timestamp):
         input_file = input_file.replace("file://", "")
         input_file = input_file.replace("%20", " ")
-        os.system(vimexec + ' --servername ' + vimnm + ' --remote-expr "' + "SyncTeX_backward('" + input_file + "', " + str(source_link[0]) + ')"')
+        sys.stdout.write("call SyncTeX_backward('" + input_file + "', " + str(source_link[0]) + ")\n")
+        sys.stdout.flush()
 
 path_output = os.getcwd() + '/' + sys.argv[1]
 path_output = path_output.replace(" ", "%20")
 
-vimnm = sys.argv[2]
-if vimnm.find("GVIM") == 0:
-    vimexec = "gvim"
-else:
-    vimexec = "vim"
-time.sleep(1)
-os.system(vimexec + ' --servername ' + vimnm + ' --remote-expr "SyncTeX_SetPID(' + str(os.getpid()) + ')"')
-
+sys.stdout.write("call SyncTeX_SetPID('" + str(os.getpid()) + "')\n")
+sys.stdout.flush()
 
 dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
 
diff --git a/r-plugin/tmux.vim b/r-plugin/tmux.vim
new file mode 100644
index 0000000..a0c914b
--- /dev/null
+++ b/r-plugin/tmux.vim
@@ -0,0 +1,28 @@
+" Check whether Tmux is OK
+if !executable('tmux') && g:vimrplugin_source !~ "screenR"
+    call RWarningMsgInp("Please, install the 'Tmux' application to enable the Vim-R-plugin.")
+    let g:rplugin_failed = 1
+    finish
+endif
+
+if system("uname") =~ "OpenBSD"
+    " Tmux does not have -V option on OpenBSD: https://github.com/jcfaria/Vim-R-plugin/issues/200
+    let g:rplugin_tmux_version = "2.1"
+else
+    let g:rplugin_tmux_version = system("tmux -V")
+    let g:rplugin_tmux_version = substitute(g:rplugin_tmux_version, '.*tmux \([0-9]\.[0-9]\).*', '\1', '')
+    if strlen(g:rplugin_tmux_version) != 3
+        let g:rplugin_tmux_version = "1.0"
+    endif
+    if g:rplugin_tmux_version < "1.8" && g:vimrplugin_source !~ "screenR"
+        call RWarningMsgInp("Vim-R-plugin requires Tmux >= 1.8")
+        let g:rplugin_failed = 1
+        finish
+    endif
+endif
+
+if g:rplugin_do_tmux_split
+    runtime r-plugin/tmux_split.vim
+else
+    runtime r-plugin/extern_term.vim
+endif
diff --git a/r-plugin/tmux_split.vim b/r-plugin/tmux_split.vim
new file mode 100644
index 0000000..ac88249
--- /dev/null
+++ b/r-plugin/tmux_split.vim
@@ -0,0 +1,204 @@
+
+" Adapted from screen plugin:
+function TmuxActivePane()
+    let line = system("tmux list-panes | grep \'(active)$'")
+    let paneid = matchstr(line, '\v\%\d+ \(active\)')
+    if !empty(paneid)
+        return matchstr(paneid, '\v^\%\d+')
+    else
+        return matchstr(line, '\v^\d+')
+    endif
+endfunction
+
+function StartR_TmuxSplit(rcmd)
+    let g:rplugin_vim_pane = TmuxActivePane()
+    let tmuxconf = ['set-environment VIMRPLUGIN_TMPDIR "' . g:rplugin_tmpdir . '"',
+                \ 'set-environment VIMR_COMPLDIR "' . substitute(g:rplugin_compldir, ' ', '\\ ', "g") . '"',
+                \ 'set-environment VIMEDITOR_SVRNM ' . $VIMEDITOR_SVRNM ,
+                \ 'set-environment VIMINSTANCEID ' . $VIMINSTANCEID ,
+                \ 'set-environment VIMR_SECRET ' . $VIMR_SECRET ]
+    if &t_Co == 256
+        call extend(tmuxconf, ['set default-terminal "' . $TERM . '"'])
+    endif
+    call writefile(tmuxconf, g:rplugin_tmpdir . "/tmux" . $VIMINSTANCEID . ".conf")
+    call system("tmux source-file '" . g:rplugin_tmpdir . "/tmux" . $VIMINSTANCEID . ".conf" . "'")
+    call delete(g:rplugin_tmpdir . "/tmux" . $VIMINSTANCEID . ".conf")
+    let tcmd = "tmux split-window "
+    if g:vimrplugin_vsplit
+        if g:vimrplugin_rconsole_width == -1
+            let tcmd .= "-h"
+        else
+            let tcmd .= "-h -l " . g:vimrplugin_rconsole_width
+        endif
+    else
+        let tcmd .= "-l " . g:vimrplugin_rconsole_height
+    endif
+
+    " Let Tmux automatically kill the panel when R quits.
+    let tcmd .= " '" . a:rcmd . "'"
+
+    let rlog = system(tcmd)
+    if v:shell_error
+        call RWarningMsg(rlog)
+        return
+    endif
+    let g:rplugin_rconsole_pane = TmuxActivePane()
+    let rlog = system("tmux select-pane -t " . g:rplugin_vim_pane)
+    if v:shell_error
+        call RWarningMsg(rlog)
+        return
+    endif
+    let g:SendCmdToR = function('SendCmdToR_TmuxSplit')
+    let g:rplugin_last_rcmd = a:rcmd
+    if g:vimrplugin_tmux_title != "automatic" && g:vimrplugin_tmux_title != ""
+        call system("tmux rename-window " . g:vimrplugin_tmux_title)
+    endif
+    if WaitVimComStart()
+        if g:vimrplugin_after_start != ''
+            call system(g:vimrplugin_after_start)
+        endif
+    endif
+endfunction
+
+function StartObjBrowser_Tmux()
+    if b:rplugin_extern_ob
+        " This is the Object Browser
+        echoerr "StartObjBrowser_Tmux() called."
+        return
+    endif
+
+
+    " Don't start the Object Browser if it already exists
+    if IsExternalOBRunning()
+        return
+    endif
+
+    let objbrowserfile = g:rplugin_tmpdir . "/objbrowserInit"
+    let tmxs = " "
+
+    call writefile([
+                \ 'let g:rplugin_vim_pane = "' . g:rplugin_vim_pane . '"',
+                \ 'let g:rplugin_rconsole_pane = "' . g:rplugin_rconsole_pane . '"',
+                \ 'let $VIMINSTANCEID = "' . $VIMINSTANCEID . '"',
+                \ 'let $VIMCOMPORT = "' . g:rplugin_vimcomport . '"',
+                \ 'let showmarks_enable = 0',
+                \ 'let g:rplugin_tmuxsname = "' . g:rplugin_tmuxsname . '"',
+                \ 'let b:rscript_buffer = "' . bufname("%") . '"',
+                \ 'set filetype=rbrowser',
+                \ 'let g:rplugin_vimcom_home = "' . g:rplugin_vimcom_home . '"',
+                \ 'let g:rplugin_vclntsrvr = "' . g:rplugin_vclntsrvr . '"',
+                \ 'let b:objbrtitle = "' . b:objbrtitle . '"',
+                \ 'let b:rplugin_extern_ob = 1',
+                \ 'set shortmess=atI',
+                \ 'set rulerformat=%3(%l%)',
+                \ 'set laststatus=0',
+                \ 'set noruler',
+                \ 'set updatetime=100',
+                \ 'let g:SendCmdToR = function("SendCmdToR_TmuxSplit")',
+                \ 'let g:rplugin_vimcomport = ' . g:rplugin_vimcomport,
+                \ 'let vcs_job = job_start([g:rplugin_vclntsrvr], {"out-cb": "ROnJobStdout", "err-cb": "ROnJobStderr"})',
+                \ 'let g:rplugin_channel = job_getchannel(vcs_job)',
+                \ 'sleep 150m'],
+                \ objbrowserfile)
+
+    if g:vimrplugin_objbr_place =~ "left"
+        let panw = system("tmux list-panes | cat")
+        if g:vimrplugin_objbr_place =~ "console"
+            " Get the R Console width:
+            let panw = substitute(panw, '.*[0-9]: \[\([0-9]*\)x[0-9]*.\{-}' . g:rplugin_rconsole_pane . '\>.*', '\1', "")
+        else
+            " Get the Vim width
+            let panw = substitute(panw, '.*[0-9]: \[\([0-9]*\)x[0-9]*.\{-}' . g:rplugin_vim_pane . '\>.*', '\1', "")
+        endif
+        let panewidth = panw - g:vimrplugin_objbr_w
+        " Just to be safe: If the above code doesn't work as expected
+        " and we get a spurious value:
+        if panewidth < 30 || panewidth > 180
+            let panewidth = 80
+        endif
+    else
+        let panewidth = g:vimrplugin_objbr_w
+    endif
+    if g:vimrplugin_objbr_place =~ "console"
+        let obpane = g:rplugin_rconsole_pane
+    else
+        let obpane = g:rplugin_vim_pane
+    endif
+
+    if g:rplugin_is_darwin && has("gui_macvim")
+        let vimexec = substitute($VIMRUNTIME, "/MacVim.app/Contents/.*", "", "") . "/MacVim.app/Contents/MacOS/Vim"
+        let vimexec = substitute(vimexec, ' ', '\\ ', 'g')
+    else
+        let vimexec = "vim"
+    endif
+
+    let cmd = "tmux split-window -h -l " . panewidth . " -t " . obpane . ' "' . vimexec . " -c 'source " . substitute(objbrowserfile, ' ', '\\ ', 'g') . "'" . '"'
+    let rlog = system(cmd)
+    if v:shell_error
+        let rlog = substitute(rlog, '\n', ' ', 'g')
+        let rlog = substitute(rlog, '\r', ' ', 'g')
+        call RWarningMsg(rlog)
+        let g:rplugin_running_objbr = 0
+        return 0
+    endif
+
+    let g:rplugin_ob_pane = TmuxActivePane()
+    let rlog = system("tmux select-pane -t " . g:rplugin_vim_pane)
+    if v:shell_error
+        call RWarningMsg(rlog)
+        return 0
+    endif
+
+    if g:vimrplugin_objbr_place =~ "left"
+        if g:vimrplugin_objbr_place =~ "console"
+            call system("tmux swap-pane -d -s " . g:rplugin_rconsole_pane . " -t " . g:rplugin_ob_pane)
+        else
+            call system("tmux swap-pane -d -s " . g:rplugin_vim_pane . " -t " . g:rplugin_ob_pane)
+        endif
+    endif
+endfunction
+
+function SendCmdToR_TmuxSplit(cmd)
+    if g:vimrplugin_ca_ck
+        let cmd = "\001" . "\013" . a:cmd
+    else
+        let cmd = a:cmd
+    endif
+
+    if !exists("g:rplugin_rconsole_pane")
+        " Should never happen
+        call RWarningMsg("Missing internal variable: g:rplugin_rconsole_pane")
+    endif
+    let str = substitute(cmd, "'", "'\\\\''", "g")
+    if str =~ '^-'
+        let str = ' ' . str
+    endif
+    let scmd = "tmux set-buffer '" . str . "\' && tmux paste-buffer -t " . g:rplugin_rconsole_pane
+    let rlog = system(scmd)
+    if v:shell_error
+        let rlog = substitute(rlog, "\n", " ", "g")
+        let rlog = substitute(rlog, "\r", " ", "g")
+        call RWarningMsg(rlog)
+        call ClearRInfo()
+        return 0
+    endif
+    return 1
+endfunction
+
+function CloseExternalOB()
+    if IsExternalOBRunning()
+        call system("tmux kill-pane -t " . g:rplugin_ob_pane)
+        unlet g:rplugin_ob_pane
+        sleep 250m
+    endif
+endfunction
+
+function IsExternalOBRunning()
+    if exists("g:rplugin_ob_pane")
+        let plst = system("tmux list-panes | cat")
+        if plst =~ g:rplugin_ob_pane
+            return 1
+        endif
+    endif
+    return 0
+endfunction
diff --git a/r-plugin/windows.vim b/r-plugin/windows.vim
index 043bd46..a235b20 100644
--- a/r-plugin/windows.vim
+++ b/r-plugin/windows.vim
@@ -156,11 +156,8 @@ function StartR_Windows()
     let g:SendCmdToR = function('SendCmdToR_Windows')
     if WaitVimComStart()
         call foreground()
-        if g:vimrplugin_arrange_windows && v:servername != "" && filereadable(g:rplugin_compldir . "/win_pos")
-            let repl = libcall(g:rplugin_vimcom_lib, "ArrangeWindows", $VIMRPLUGIN_COMPLDIR)
-            if repl != "OK"
-                call RWarningMsg(repl)
-            endif
+        if g:vimrplugin_arrange_windows && filereadable(g:rplugin_compldir . "/win_pos")
+            call ch_sendraw(g:rplugin_channel, "\005" . g:rplugin_compldir . "\n")
         endif
         if g:vimrplugin_after_start != ''
             call system(g:vimrplugin_after_start)
@@ -176,18 +173,14 @@ function SendCmdToR_Windows(cmd)
     endif
     let save_clip = getreg('+')
     call setreg('+', cmd)
-    if g:vimrplugin_Rterm
-        let repl = libcall(g:rplugin_vimcom_lib, "SendToRTerm", cmd)
-    else
-        let repl = libcall(g:rplugin_vimcom_lib, "SendToRConsole", cmd)
-    endif
+
+    let repl = libcall(g:rplugin_vimcom_lib, "SendToRConsole", cmd)
     if repl != "OK"
         call RWarningMsg(repl)
         call ClearRInfo()
     endif
-    exe "sleep " . g:rplugin_sleeptime
     call foreground()
+
     call setreg('+', save_clip)
     return 1
 endfunction
-

From a253b0811ad612126e2213a791f8c7614f4361c6 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sun, 6 Mar 2016 15:03:45 -0300
Subject: [PATCH 1037/1050] Eliminate the need of library(vimcom) in Rprofile

---
 doc/r-plugin.txt           | 18 ------------------
 r-plugin/common_global.vim |  6 ++++++
 2 files changed, 6 insertions(+), 18 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index b92f7f2..0fdcd1a 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -130,17 +130,6 @@ dependencies:
 
        * Perl (required to run `latexmk`).
 
-Add the following lines to your `Rprofile`:
->
-   options(vimcom.verbose = 1)
-   if(Sys.getenv("VIMRPLUGIN_TMPDIR") != "")
-       library(vimcom)
-<
-If you do not know where your .Rprofile is, do the following command in R
-Console to open it:
->
-   edit(file = "~/.Rprofile")
-<
 
 ------------------------------------------------------------------------------
 3.2. Preliminary system setup on Unix (Linux, Mac OS X, etc)~
@@ -193,9 +182,6 @@ Put the following lines in your `~/.Rprofile`:
    if(interactive()){
        library(colorout)
        library(setwidth)
-       options(vimcom.verbose = 1) # optional
-       if(Sys.getenv("VIMRPLUGIN_TMPDIR") != "")
-           library(vimcom)
    }
 <
 Before proceeding, you have to start a new shell session to have the alias
@@ -1760,8 +1746,6 @@ higher value for the variable in your |vimrc|. Example:
 >
    let vimrplugin_vimcom_wait = 10000
 <
-Note: You should have the line  `library(vimcom)`  in your `~/.Rprofile`.
-
 
 ------------------------------------------------------------------------------
 							   *vimrplugin_vim_wd*
@@ -2587,8 +2571,6 @@ please read this document from the beginning.
        # Load the required libraries:
        library(colorout)
        library(setwidth)
-       if(Sys.getenv("VIMRPLUGIN_TMPDIR") != "")
-           library(vimcom)
 
        # Use the text based web browser w3m to navigate through R docs
        # in Linux Console after help.start():
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 40d3318..acd5ff1 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -644,6 +644,12 @@ function StartR(whatr)
     call writefile([], g:rplugin_tmpdir . "/liblist_" . $VIMINSTANCEID)
     call delete(g:rplugin_tmpdir . "/libnames_" . $VIMINSTANCEID)
 
+    if $R_DEFAULT_PACKAGES == ""
+        let $R_DEFAULT_PACKAGES = "datasets,utils,grDevices,graphics,stats,methods,vimcom"
+    elseif $R_DEFAULT_PACKAGES !~ "vimcom"
+        let $R_DEFAULT_PACKAGES .= ",vimcom"
+    endif
+
     if g:vimrplugin_objbr_opendf
         let start_options = ['options(vimcom.opendf = TRUE)']
     else

From d89aaf464152ec18530b554f269f967e7cb64efd Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Tue, 8 Mar 2016 20:57:56 -0300
Subject: [PATCH 1038/1050] R_DEFAULT_PACKAGES in tmux_split and extern_term

---
 r-plugin/extern_term.vim | 2 +-
 r-plugin/tmux_split.vim  | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/r-plugin/extern_term.vim b/r-plugin/extern_term.vim
index db53184..8b83bc0 100644
--- a/r-plugin/extern_term.vim
+++ b/r-plugin/extern_term.vim
@@ -33,7 +33,7 @@ function StartR_ExternalTerm(rcmd)
         let tmuxcnf = '-f "' . g:rplugin_tmpdir . "/tmux.conf" . '"'
     endif
 
-    let rcmd = 'VIMRPLUGIN_TMPDIR=' . substitute(g:rplugin_tmpdir, ' ', '\\ ', 'g') . ' VIMR_COMPLDIR=' . substitute(g:rplugin_compldir, ' ', '\\ ', 'g') . ' VIMINSTANCEID=' . $VIMINSTANCEID . ' VIMR_SECRET=' . $VIMR_SECRET . ' VIMEDITOR_SVRNM=' . $VIMEDITOR_SVRNM . ' ' . a:rcmd
+    let rcmd = 'VIMRPLUGIN_TMPDIR=' . substitute(g:rplugin_tmpdir, ' ', '\\ ', 'g') . ' VIMR_COMPLDIR=' . substitute(g:rplugin_compldir, ' ', '\\ ', 'g') . ' VIMINSTANCEID=' . $VIMINSTANCEID . ' VIMR_SECRET=' . $VIMR_SECRET . ' VIMEDITOR_SVRNM=' . $VIMEDITOR_SVRNM . ' R_DEFAULT_PACKAGES=' . $R_DEFAULT_PACKAGES . ' ' . a:rcmd
 
     call system("tmux -L vimr has-session -t " . g:rplugin_tmuxsname)
     if v:shell_error
diff --git a/r-plugin/tmux_split.vim b/r-plugin/tmux_split.vim
index ac88249..97b7626 100644
--- a/r-plugin/tmux_split.vim
+++ b/r-plugin/tmux_split.vim
@@ -16,7 +16,8 @@ function StartR_TmuxSplit(rcmd)
                 \ 'set-environment VIMR_COMPLDIR "' . substitute(g:rplugin_compldir, ' ', '\\ ', "g") . '"',
                 \ 'set-environment VIMEDITOR_SVRNM ' . $VIMEDITOR_SVRNM ,
                 \ 'set-environment VIMINSTANCEID ' . $VIMINSTANCEID ,
-                \ 'set-environment VIMR_SECRET ' . $VIMR_SECRET ]
+                \ 'set-environment VIMR_SECRET ' . $VIMR_SECRET ,
+                \ 'set-environment R_DEFAULT_PACKAGES ' . $R_DEFAULT_PACKAGES ]
     if &t_Co == 256
         call extend(tmuxconf, ['set default-terminal "' . $TERM . '"'])
     endif

From d184b12b7015c39eb87c3fd2dea233a2f155fab4 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Tue, 8 Mar 2016 20:59:41 -0300
Subject: [PATCH 1039/1050] New option: vimrplugin_hi_fun The new option
 requires an updated R-Vim-runtime

---
 doc/r-plugin.txt           | 38 +++++++++++++++++++-------------------
 r-plugin/common_buffer.vim |  5 +++++
 r-plugin/common_global.vim |  7 +++++++
 3 files changed, 31 insertions(+), 19 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 0fdcd1a..d666b41 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -1827,9 +1827,18 @@ want to know they are, while editing an R file, do in Normal mode:
    :echo g:rplugin_compldir
 <
 
+------------------------------------------------------------------------------
+9.34. Disable syntax highlight of R functions~
+
+If you want to disable the syntax highlight of R functions put in your
+|vimrc|:
+>
+   let vimrplugin_hi_fun = 0
+<
+
 ------------------------------------------------------------------------------
 							    *r-plugin-df-view*
-6.34 View a data.frame or matrix~
+6.35 View a data.frame or matrix~
 
 The csv.vim plugin helps to visualize and edit csv files, and if it is not
 installed, the Vim-R-plugin will warn you about that when you do
@@ -1855,7 +1864,7 @@ replaced by the name of the object under the cursor.
 
 ------------------------------------------------------------------------------
 							    *r-plugin-SyncTeX*
-6.35 SyncTeX support~
+6.36 SyncTeX support~
 
 SyncTeX is a set of communication systems used by some PDF viewers and by some
 text editors which allow users to jump from a specific line in the text editor
@@ -1898,7 +1907,7 @@ Note: The current knitr package (version 1.7) has at least two limitations:
 
 
 ------------------------------------------------------------------------------
-6.35.1 Evince configuration~
+6.36.1 Evince configuration~
 
 No configuration should be required.
 
@@ -1908,7 +1917,7 @@ to press gp again.
 
 
 ------------------------------------------------------------------------------
-6.35.2 Okular configuration~
+6.36.2 Okular configuration~
 
 You have to configure Okular to call Vim during backward searches.
 In Okular, click in:
@@ -1933,7 +1942,7 @@ of Okular will be started.
 
 
 ------------------------------------------------------------------------------
-6.35.3 Zathura configuration~
+6.36.3 Zathura configuration~
 
 No configuration should be required if Evince is not installed. If evince is
 installed, put in your |vimrc|:
@@ -1948,7 +1957,7 @@ to press gp again.
 
 
 ------------------------------------------------------------------------------
-6.35.4 Skim with MacVim configuration (Mac OS X)~
+6.36.4 Skim with MacVim configuration (Mac OS X)~
 
 You have to configure Skim to call `vclientserver` during backward searches.
 In Skim click in the drop down menu and fill the fields:
@@ -1962,7 +1971,7 @@ In Skim click in the drop down menu and fill the fields:
 <
 
 ------------------------------------------------------------------------------
-6.35.5 Sumatra configuration (Windows)~
+6.36.5 Sumatra configuration (Windows)~
 
 No configuration is required.
 
@@ -2477,18 +2486,9 @@ useful tip is to click on the title bar of the debug window and choose "Always
 on top" or a similar option provided by your desktop manager.
 
 
-------------------------------------------------------------------------------
-9.17. Disable syntax highlight of R functions~
-
-If you want to disable the syntax highlight of R functions put in your
-|vimrc|:
->
-   autocmd Syntax * syntax clear rFunction
-<
-
 ------------------------------------------------------------------------------
 							  *r-plugin-latex-box*
-9.18. Integration with LaTeX-Box~
+9.17. Integration with LaTeX-Box~
 
 LaTeX-Box does not automatically recognize Rnoweb files as a valid LaTeX file.
 You have to tell LaTeX-BoX that the .tex file compiled by either `knitr()` or
@@ -2511,7 +2511,7 @@ See also: |vimrplugin_latexcmd|.
 
 ------------------------------------------------------------------------------
 							*r-plugin-quick-setup*
-9.19. Suggested setup for the Vim-R-plugin~
+9.18. Suggested setup for the Vim-R-plugin~
 
 Please, look at section |r-plugin-options| if you want information about the
 Vim-r-plugin customization.
@@ -2607,7 +2607,7 @@ Finally, if you want to use vi key bindings in Bash or other shell:
 
 ------------------------------------------------------------------------------
 
-9.20. Syntax highlight of .Rout files~
+9.19. Syntax highlight of .Rout files~
 
 You can set the foreground colors of R output in your |vimrc|. The example
 below is for a terminal emulator that supports 256 colors (see |:highlight|):
diff --git a/r-plugin/common_buffer.vim b/r-plugin/common_buffer.vim
index 46bda40..d3a1dc8 100644
--- a/r-plugin/common_buffer.vim
+++ b/r-plugin/common_buffer.vim
@@ -62,6 +62,11 @@ if exists("*RCheckLibList")
     autocmd BufEnter  call RCheckLibList()
 endif
 
+if g:vimrplugin_hi_fun
+    runtime r-plugin/functions.vim
+    autocmd Syntax  runtime r-plugin/functions.vim
+endif
+
 if g:vimrplugin_assign == 3
     iabb  _ <-
 endif
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index acd5ff1..f772914 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -2623,6 +2623,13 @@ call RSetDefaultValue("g:vimrplugin_latexcmd", "'default'")
 call RSetDefaultValue("g:vimrplugin_rmd_environment", "'.GlobalEnv'")
 call RSetDefaultValue("g:vimrplugin_indent_commented",  1)
 
+call RSetDefaultValue("g:vimrplugin_hi_fun",            1)
+if !g:vimrplugin_hi_fun
+    " Declare empty function to be called by vimcom
+    function FillRLibList()
+    endfunction
+endif
+
 if !exists("g:r_indent_ess_comments")
     let g:r_indent_ess_comments = 0
 endif

From 52da09ba21df0646a6f52ec9c3ae7a8a4240aba6 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Wed, 9 Mar 2016 05:29:42 -0300
Subject: [PATCH 1040/1050] Rename functions.vim as hi_fun.vim Reason: make
 option vimrplugin_hi_fun to work even with outdated syntax/r.vim that still
 runs functions.vim.

---
 Makefile                               | 2 +-
 doc/r-plugin.txt                       | 2 +-
 list_for_vimball                       | 2 +-
 r-plugin/common_buffer.vim             | 4 ++--
 r-plugin/{functions.vim => hi_fun.vim} | 0
 5 files changed, 5 insertions(+), 5 deletions(-)
 rename r-plugin/{functions.vim => hi_fun.vim} (100%)

diff --git a/Makefile b/Makefile
index d2f8a26..69ae938 100644
--- a/Makefile
+++ b/Makefile
@@ -67,7 +67,7 @@ deb:
 	  - ftplugin/rrst_rplugin.vim\n\
 	  - r-plugin/common_buffer.vim\n\
 	  - r-plugin/common_global.vim\n\
-	  - r-plugin/functions.vim\n\
+	  - r-plugin/hi_fun.vim\n\
 	  - r-plugin/gui_running.vim\n\
 	  - r-plugin/setcompldir.vim\n\
 	  - r-plugin/synctex_evince_backward.py\n\
diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index d666b41..a8056ad 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -2158,7 +2158,7 @@ directory after the installation:
    ftplugin/rrst_rplugin.vim
    r-plugin/common_buffer.vim
    r-plugin/common_global.vim
-   r-plugin/functions.vim
+   r-plugin/hi_fun.vim
    r-plugin/gui_running.vim
    r-plugin/osx.vim
    r-plugin/r.snippets
diff --git a/list_for_vimball b/list_for_vimball
index d133f1a..3cba15c 100644
--- a/list_for_vimball
+++ b/list_for_vimball
@@ -14,7 +14,7 @@ r-plugin/r.snippets
 r-plugin/rmd.snippets
 r-plugin/synctex_evince_backward.py
 r-plugin/synctex_evince_forward.py
-r-plugin/functions.vim
+r-plugin/hi_fun.vim
 r-plugin/gui_running.vim
 r-plugin/osx.vim
 r-plugin/setcompldir.vim
diff --git a/r-plugin/common_buffer.vim b/r-plugin/common_buffer.vim
index d3a1dc8..84b77bb 100644
--- a/r-plugin/common_buffer.vim
+++ b/r-plugin/common_buffer.vim
@@ -63,8 +63,8 @@ if exists("*RCheckLibList")
 endif
 
 if g:vimrplugin_hi_fun
-    runtime r-plugin/functions.vim
-    autocmd Syntax  runtime r-plugin/functions.vim
+    runtime r-plugin/hi_fun.vim
+    autocmd Syntax  runtime r-plugin/hi_fun.vim
 endif
 
 if g:vimrplugin_assign == 3
diff --git a/r-plugin/functions.vim b/r-plugin/hi_fun.vim
similarity index 100%
rename from r-plugin/functions.vim
rename to r-plugin/hi_fun.vim

From 69aac5baff03c7945c4a3af5ed1bb22a91a9dfcf Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Wed, 9 Mar 2016 13:41:48 -0300
Subject: [PATCH 1041/1050] Revert file name to functions.vim Reason: the code
 was not working with nested R code.

---
 Makefile                               | 2 +-
 doc/r-plugin.txt                       | 6 +++---
 list_for_vimball                       | 2 +-
 r-plugin/common_buffer.vim             | 5 -----
 r-plugin/common_global.vim             | 7 ++++---
 r-plugin/{hi_fun.vim => functions.vim} | 0
 6 files changed, 9 insertions(+), 13 deletions(-)
 rename r-plugin/{hi_fun.vim => functions.vim} (100%)

diff --git a/Makefile b/Makefile
index 69ae938..d2f8a26 100644
--- a/Makefile
+++ b/Makefile
@@ -67,7 +67,7 @@ deb:
 	  - ftplugin/rrst_rplugin.vim\n\
 	  - r-plugin/common_buffer.vim\n\
 	  - r-plugin/common_global.vim\n\
-	  - r-plugin/hi_fun.vim\n\
+	  - r-plugin/functions.vim\n\
 	  - r-plugin/gui_running.vim\n\
 	  - r-plugin/setcompldir.vim\n\
 	  - r-plugin/synctex_evince_backward.py\n\
diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index a8056ad..c710f53 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -1833,7 +1833,7 @@ want to know they are, while editing an R file, do in Normal mode:
 If you want to disable the syntax highlight of R functions put in your
 |vimrc|:
 >
-   let vimrplugin_hi_fun = 0
+   let R_hi_fun = 0
 <
 
 ------------------------------------------------------------------------------
@@ -2158,7 +2158,7 @@ directory after the installation:
    ftplugin/rrst_rplugin.vim
    r-plugin/common_buffer.vim
    r-plugin/common_global.vim
-   r-plugin/hi_fun.vim
+   r-plugin/functions.vim
    r-plugin/gui_running.vim
    r-plugin/osx.vim
    r-plugin/r.snippets
@@ -2649,7 +2649,7 @@ put in your |vimrc|:
 							       *r-plugin-news*
 10. News~
 
-1.2.9 (2016-03-04)
+1.2.9 (2016-03-09)
 
  * Delete option vimrplugin_restart
 
diff --git a/list_for_vimball b/list_for_vimball
index 3cba15c..d133f1a 100644
--- a/list_for_vimball
+++ b/list_for_vimball
@@ -14,7 +14,7 @@ r-plugin/r.snippets
 r-plugin/rmd.snippets
 r-plugin/synctex_evince_backward.py
 r-plugin/synctex_evince_forward.py
-r-plugin/hi_fun.vim
+r-plugin/functions.vim
 r-plugin/gui_running.vim
 r-plugin/osx.vim
 r-plugin/setcompldir.vim
diff --git a/r-plugin/common_buffer.vim b/r-plugin/common_buffer.vim
index 84b77bb..46bda40 100644
--- a/r-plugin/common_buffer.vim
+++ b/r-plugin/common_buffer.vim
@@ -62,11 +62,6 @@ if exists("*RCheckLibList")
     autocmd BufEnter  call RCheckLibList()
 endif
 
-if g:vimrplugin_hi_fun
-    runtime r-plugin/hi_fun.vim
-    autocmd Syntax  runtime r-plugin/hi_fun.vim
-endif
-
 if g:vimrplugin_assign == 3
     iabb  _ <-
 endif
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index f772914..7480ee8 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -2509,7 +2509,7 @@ endfunction
 
 function ROnJobStdout(job_id, msg)
     let cmd = substitute(a:msg, '\n', '', 'g')
-    let cmd = substitute(a:msg, '\r', '', 'g')
+    let cmd = substitute(cmd, '\r', '', 'g')
     if cmd =~ "^call " || cmd =~ "^let "
         exe cmd
     else
@@ -2623,8 +2623,9 @@ call RSetDefaultValue("g:vimrplugin_latexcmd", "'default'")
 call RSetDefaultValue("g:vimrplugin_rmd_environment", "'.GlobalEnv'")
 call RSetDefaultValue("g:vimrplugin_indent_commented",  1)
 
-call RSetDefaultValue("g:vimrplugin_hi_fun",            1)
-if !g:vimrplugin_hi_fun
+" This option is used in syntax/r.vim which is not part of Vim-R-plugin
+call RSetDefaultValue("g:R_hi_fun", 1)
+if !g:R_hi_fun
     " Declare empty function to be called by vimcom
     function FillRLibList()
     endfunction
diff --git a/r-plugin/hi_fun.vim b/r-plugin/functions.vim
similarity index 100%
rename from r-plugin/hi_fun.vim
rename to r-plugin/functions.vim

From 2b758e14cfe09d0694cb9f1900f7ed51b050735f Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Wed, 9 Mar 2016 22:26:17 -0300
Subject: [PATCH 1042/1050] Disable the plugin if Nvim-R is installed

---
 ftplugin/r_rplugin.vim      | 5 +++++
 ftplugin/rbrowser.vim       | 5 +++++
 ftplugin/rdoc.vim           | 5 +++++
 ftplugin/rhelp_rplugin.vim  | 5 +++++
 ftplugin/rmd_rplugin.vim    | 4 ++++
 ftplugin/rnoweb_rplugin.vim | 5 +++++
 ftplugin/rrst_rplugin.vim   | 5 +++++
 7 files changed, 34 insertions(+)

diff --git a/ftplugin/r_rplugin.vim b/ftplugin/r_rplugin.vim
index dca39c1..3bd60fc 100644
--- a/ftplugin/r_rplugin.vim
+++ b/ftplugin/r_rplugin.vim
@@ -3,6 +3,11 @@ if exists("g:disable_r_ftplugin") || has("nvim")
     finish
 endif
 
+runtime R/flag.vim
+if exists("g:NvimR_installed")
+    finish
+endif
+
 " Source scripts common to R, Rnoweb, Rhelp, Rmd, Rrst and rdoc files:
 runtime r-plugin/common_global.vim
 if exists("g:rplugin_failed")
diff --git a/ftplugin/rbrowser.vim b/ftplugin/rbrowser.vim
index 23cc0de..0239b88 100644
--- a/ftplugin/rbrowser.vim
+++ b/ftplugin/rbrowser.vim
@@ -8,6 +8,11 @@ if exists("b:did_ftplugin") || has("nvim")
     finish
 endif
 
+runtime R/flag.vim
+if exists("g:NvimR_installed")
+    finish
+endif
+
 let g:rplugin_upobcnt = 0
 
 " Don't load another plugin for this buffer
diff --git a/ftplugin/rdoc.vim b/ftplugin/rdoc.vim
index 403b6f1..423f1d5 100644
--- a/ftplugin/rdoc.vim
+++ b/ftplugin/rdoc.vim
@@ -8,6 +8,11 @@ if exists("b:did_ftplugin") || has("nvim")
     finish
 endif
 
+runtime R/flag.vim
+if exists("g:NvimR_installed")
+    finish
+endif
+
 " Don't load another plugin for this buffer
 let b:did_ftplugin = 1
 
diff --git a/ftplugin/rhelp_rplugin.vim b/ftplugin/rhelp_rplugin.vim
index 8212131..66fbcd4 100644
--- a/ftplugin/rhelp_rplugin.vim
+++ b/ftplugin/rhelp_rplugin.vim
@@ -3,6 +3,11 @@ if exists("g:disable_r_ftplugin") || has("nvim")
     finish
 endif
 
+runtime R/flag.vim
+if exists("g:NvimR_installed")
+    finish
+endif
+
 " Source scripts common to R, Rnoweb, Rhelp and rdoc files:
 runtime r-plugin/common_global.vim
 if exists("g:rplugin_failed")
diff --git a/ftplugin/rmd_rplugin.vim b/ftplugin/rmd_rplugin.vim
index cd18765..e454634 100644
--- a/ftplugin/rmd_rplugin.vim
+++ b/ftplugin/rmd_rplugin.vim
@@ -3,6 +3,10 @@ if exists("g:disable_r_ftplugin") || has("nvim")
     finish
 endif
 
+runtime R/flag.vim
+if exists("g:NvimR_installed")
+    finish
+endif
 
 " Source scripts common to R, Rrst, Rnoweb, Rhelp and Rdoc:
 runtime r-plugin/common_global.vim
diff --git a/ftplugin/rnoweb_rplugin.vim b/ftplugin/rnoweb_rplugin.vim
index 4b721da..d144d01 100644
--- a/ftplugin/rnoweb_rplugin.vim
+++ b/ftplugin/rnoweb_rplugin.vim
@@ -3,6 +3,11 @@ if exists("g:disable_r_ftplugin") || has("nvim")
     finish
 endif
 
+runtime R/flag.vim
+if exists("g:NvimR_installed")
+    finish
+endif
+
 " Source scripts common to R, Rnoweb, Rhelp and Rdoc:
 runtime r-plugin/common_global.vim
 if exists("g:rplugin_failed")
diff --git a/ftplugin/rrst_rplugin.vim b/ftplugin/rrst_rplugin.vim
index 570c41c..0ae8cd5 100644
--- a/ftplugin/rrst_rplugin.vim
+++ b/ftplugin/rrst_rplugin.vim
@@ -3,6 +3,11 @@ if exists("g:disable_r_ftplugin") || has("nvim")
     finish
 endif
 
+runtime R/flag.vim
+if exists("g:NvimR_installed")
+    finish
+endif
+
 " Source scripts common to R, Rrst, Rnoweb, Rhelp and Rdoc:
 runtime r-plugin/common_global.vim
 if exists("g:rplugin_failed")

From 31d0533eb3be3e0f48c5c1838d3ec76ecd70d5b9 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Wed, 9 Mar 2016 22:30:50 -0300
Subject: [PATCH 1043/1050] Delete no longer used variable

---
 r-plugin/windows.vim | 1 -
 1 file changed, 1 deletion(-)

diff --git a/r-plugin/windows.vim b/r-plugin/windows.vim
index a235b20..d97548b 100644
--- a/r-plugin/windows.vim
+++ b/r-plugin/windows.vim
@@ -1,7 +1,6 @@
 " This file contains code used only on Windows
 
 let g:rplugin_sumatra_path = ""
-let g:rplugin_python_initialized = 0
 
 call RSetDefaultValue("g:vimrplugin_sleeptime", 100)
 call RSetDefaultValue("g:vimrplugin_set_home_env", 1)

From c66957387f4dbb79e782b6bd9334fce03dc2c5fd Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Thu, 10 Mar 2016 12:16:59 -0300
Subject: [PATCH 1044/1050] Warn that both +job and +channel are required

---
 doc/r-plugin.txt           | 2 +-
 r-plugin/common_global.vim | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index c710f53..c9f3eac 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -140,7 +140,7 @@ Before installing the plugin, you should install its dependencies:
 
    Vim, GVim >= 7.4.1425: http://www.vim.org/download.php
 
-      Note: The Vim-R-plugin requires Vim compiled with |+channel| and
+      Note: The Vim-R-plugin requires Vim compiled with |+channel|, |+job| and
 	    |+conceal| features. In Normal mode, do `:version`  to check if
 	    your Vim has these features.
 
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 7480ee8..0bc7845 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -60,7 +60,7 @@ function RWarningMsgInp(wmsg)
 endfunction
 
 if !exists("*job_getchannel")
-    call RWarningMsgInp("The Vim-R-plugin requires Vim >= 7.4.1453")
+    call RWarningMsgInp("The Vim-R-plugin requires Vim >= 7.4.1468 with both +channel and +job features enabled.")
     let g:rplugin_failed = 1
     finish
 endif

From df6662c0588a4a3898120e02f0ae832a2a6e1245 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Thu, 10 Mar 2016 12:20:41 -0300
Subject: [PATCH 1045/1050] Don't run functions.vim if Nvim-R is installed

---
 r-plugin/functions.vim | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/r-plugin/functions.vim b/r-plugin/functions.vim
index 8b24803..ca24a82 100644
--- a/r-plugin/functions.vim
+++ b/r-plugin/functions.vim
@@ -3,6 +3,11 @@ if has("nvim")
     finish
 endif
 
+runtime R/flag.vim
+if exists("g:NvimR_installed")
+    finish
+endif
+
 " Only source this once
 if exists("*RmFromRLibList")
     if len(g:rplugin_lists_to_load) > 0

From 57d2c7013440107cb8f5484be0e679c4348c6a1d Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Fri, 11 Mar 2016 18:18:28 -0300
Subject: [PATCH 1046/1050] Version 1.2.9

---
 doc/r-plugin.txt | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index c9f3eac..37acfb8 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -139,6 +139,7 @@ Before installing the plugin, you should install its dependencies:
    Depends:~
 
    Vim, GVim >= 7.4.1425: http://www.vim.org/download.php
+	                  You might have to look for "Vim without Cream".
 
       Note: The Vim-R-plugin requires Vim compiled with |+channel|, |+job| and
 	    |+conceal| features. In Normal mode, do `:version`  to check if
@@ -2649,7 +2650,7 @@ put in your |vimrc|:
 							       *r-plugin-news*
 10. News~
 
-1.2.9 (2016-03-09)
+1.2.9 (2016-03-11)
 
  * Delete option vimrplugin_restart
 

From b41c3538c7e43aa45f6cb027eeff85797cc147ae Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Sat, 12 Mar 2016 07:30:54 -0300
Subject: [PATCH 1047/1050] Version 1.3.0

---
 Makefile                   |  5 ++++-
 doc/r-plugin.txt           | 11 ++++++++---
 list_for_vimball           |  9 ++++++---
 r-plugin/common_global.vim |  6 +++---
 4 files changed, 21 insertions(+), 10 deletions(-)

diff --git a/Makefile b/Makefile
index d2f8a26..a1d8a6a 100644
--- a/Makefile
+++ b/Makefile
@@ -22,7 +22,7 @@
 
 
 PLUGINHOME=`pwd`
-PLUGINVERSION=1.2.9
+PLUGINVERSION=1.3.0
 DEBIANTIME=`date -R`
 PLUGINRELEASEDATE=`date +"%Y-%m-%d"`
 VIM2HTML=/usr/local/share/vim/vim74/doc/vim2html.pl 
@@ -72,6 +72,9 @@ deb:
 	  - r-plugin/setcompldir.vim\n\
 	  - r-plugin/synctex_evince_backward.py\n\
 	  - r-plugin/synctex_evince_forward.py\n\
+	  - r-plugin/tmux.vim\n\
+	  - r-plugin/tmux_split.vim\n\
+	  - r-plugin/extern_term.vim\n\
 	  - syntax/rbrowser.vim\n\
 	  - syntax/rdoc.vim\n\
 	  - syntax/rout.vim\n\
diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 37acfb8..9f1c400 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -5,7 +5,7 @@
 Authors: Jakson A. Aquino   
          Jose Claudio Faria 
 
-Version: 1.2.9
+Version: 1.3.0
 For Vim version >= 7.4.1425
 
  1. Overview                                    |r-plugin-overview|
@@ -114,7 +114,7 @@ dependencies:
 
     * R's version must be >= 3.0.0: http://www.r-project.org/
 
-    * vimcom = 1.2-9: https://github.com/jalvesaq/VimCom/releases
+    * vimcom = 1.3: https://github.com/jalvesaq/VimCom/releases
 
       Note: If you cannot build vimcom yourself, you will want to
       download and install the zip file.
@@ -147,7 +147,7 @@ Before installing the plugin, you should install its dependencies:
 
    R >= 3.0.0: http://www.r-project.org/
 
-   vimcom = 1.2-9: https://github.com/jalvesaq/VimCom/releases
+   vimcom = 1.3: https://github.com/jalvesaq/VimCom/releases
 
    Tmux >= 1.8:   http://tmux.sourceforge.net
                   Tmux is necessary to send commands from Vim to R Console.
@@ -2650,6 +2650,11 @@ put in your |vimrc|:
 							       *r-plugin-news*
 10. News~
 
+1.3.0 (2016-03-12)
+
+ * Fix missing files in vimball: r-plugin/tmux.vim, r-plugin/tmux_split.vim
+   and r-plugin/extern_term.vim.
+
 1.2.9 (2016-03-11)
 
  * Delete option vimrplugin_restart
diff --git a/list_for_vimball b/list_for_vimball
index d133f1a..0740a65 100644
--- a/list_for_vimball
+++ b/list_for_vimball
@@ -8,6 +8,9 @@ ftplugin/rhelp_rplugin.vim
 ftplugin/rmd_rplugin.vim
 ftplugin/rnoweb_rplugin.vim
 ftplugin/rrst_rplugin.vim
+syntax/rbrowser.vim
+syntax/rdoc.vim
+syntax/rout.vim
 r-plugin/common_buffer.vim
 r-plugin/common_global.vim
 r-plugin/r.snippets
@@ -19,6 +22,6 @@ r-plugin/gui_running.vim
 r-plugin/osx.vim
 r-plugin/setcompldir.vim
 r-plugin/windows.vim
-syntax/rbrowser.vim
-syntax/rdoc.vim
-syntax/rout.vim
+r-plugin/extern_term.vim
+r-plugin/tmux.vim
+r-plugin/tmux_split.vim
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 0bc7845..914d82a 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -680,7 +680,7 @@ function StartR(whatr)
     else
         let start_options += ['options(vimcom.vimpager = TRUE)']
     endif
-    let start_options += ['if(utils::packageVersion("vimcom") != "1.2.9") warning("Your version of Vim-R-plugin requires vimcom-1.2-9.", call. = FALSE)']
+    let start_options += ['if(utils::packageVersion("vimcom") != "1.3") warning("Your version of Vim-R-plugin requires vimcom-1.3.", call. = FALSE)']
 
     let rwd = ""
     if g:vimrplugin_vim_wd == 0
@@ -829,8 +829,8 @@ function WaitVimComStart()
         else
             call RWarningMsgInp('Could not find "' . g:rplugin_vclntsrvr . '".')
         endif
-        if g:rplugin_vimcom_version != "1.2.9"
-            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.2.9.')
+        if g:rplugin_vimcom_version != "1.3"
+            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.3.')
             sleep 1
         endif
         call delete(g:rplugin_tmpdir . "/vimcom_running_" . $VIMINSTANCEID)

From 2248025a4b06de91ca2b1040c232d8464dc1770c Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Mon, 14 Mar 2016 05:40:36 -0300
Subject: [PATCH 1048/1050] Warn if there are duplicated files Duplicated files
 will exist if the user has installed both the vimball and the git repository.

---
 r-plugin/common_global.vim | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 914d82a..3d293ff 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -2870,3 +2870,15 @@ endif
 if !executable(g:rplugin_R)
     call RWarningMsgInp("R executable not found: '" . g:rplugin_R . "'")
 endif
+
+" Check if there is more than one copy of Nvim-R
+" (e.g. from the Vimballl and from a plugin manager)
+let s:ff = split(substitute(globpath(&rtp, "r-plugin/functions.vim"), "functions.vim", "", "g"), "\n")
+let s:ft = split(globpath(&rtp, "ftplugin/r*_rplugin.vim"), "\n")
+if len(s:ff) > 1 || len(s:ft) > 5
+    call RWarningMsgInp("It seems that Vim-R-plugin is installed in more than one place.\n" .
+                \ "Please, remove one of them to avoid conflicts.\n" .
+                \ "Below is a list of some of the possibly duplicated directories and files:\n" . join(s:ff, "\n") . "\n" . join(s:ft, "\n") . "\n")
+endif
+unlet s:ff
+unlet s:ft

From d52549d40169d9df47f21d6c479bbe60710b3f86 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Wed, 16 Mar 2016 09:46:24 -0300
Subject: [PATCH 1049/1050] Version 1.3.1

---
 Makefile                    |  2 +-
 doc/r-plugin.txt            | 18 +++++++++++-------
 ftplugin/rnoweb_rplugin.vim |  2 +-
 r-plugin/common_global.vim  | 13 +++++++------
 r-plugin/tmux_split.vim     |  2 +-
 5 files changed, 21 insertions(+), 16 deletions(-)

diff --git a/Makefile b/Makefile
index a1d8a6a..bceeefb 100644
--- a/Makefile
+++ b/Makefile
@@ -22,7 +22,7 @@
 
 
 PLUGINHOME=`pwd`
-PLUGINVERSION=1.3.0
+PLUGINVERSION=1.3.1
 DEBIANTIME=`date -R`
 PLUGINRELEASEDATE=`date +"%Y-%m-%d"`
 VIM2HTML=/usr/local/share/vim/vim74/doc/vim2html.pl 
diff --git a/doc/r-plugin.txt b/doc/r-plugin.txt
index 9f1c400..0fdf920 100644
--- a/doc/r-plugin.txt
+++ b/doc/r-plugin.txt
@@ -5,8 +5,8 @@
 Authors: Jakson A. Aquino   
          Jose Claudio Faria 
 
-Version: 1.3.0
-For Vim version >= 7.4.1425
+Version: 1.3.1
+For Vim version >= 7.4.1579
 
  1. Overview                                    |r-plugin-overview|
  2. Main features                               |r-plugin-features|
@@ -114,12 +114,12 @@ dependencies:
 
     * R's version must be >= 3.0.0: http://www.r-project.org/
 
-    * vimcom = 1.3: https://github.com/jalvesaq/VimCom/releases
+    * vimcom = 1.3-1: https://github.com/jalvesaq/VimCom/releases
 
       Note: If you cannot build vimcom yourself, you will want to
       download and install the zip file.
 
-    * Vim's version must be >= 7.4.1425: http://www.vim.org/download.php
+    * Vim's version must be >= 7.4.1579: http://www.vim.org/download.php
       To get the latest version, look for Vim "without Cream".
 
     * Only if you write Rnoweb code:
@@ -138,16 +138,16 @@ Before installing the plugin, you should install its dependencies:
 
    Depends:~
 
-   Vim, GVim >= 7.4.1425: http://www.vim.org/download.php
+   Vim, GVim >= 7.4.1579: http://www.vim.org/download.php
 	                  You might have to look for "Vim without Cream".
 
       Note: The Vim-R-plugin requires Vim compiled with |+channel|, |+job| and
-	    |+conceal| features. In Normal mode, do `:version`  to check if
+	    |+conceal| features. In Normal mode, do `:version` to check if
 	    your Vim has these features.
 
    R >= 3.0.0: http://www.r-project.org/
 
-   vimcom = 1.3: https://github.com/jalvesaq/VimCom/releases
+   vimcom = 1.3-1: https://github.com/jalvesaq/VimCom/releases
 
    Tmux >= 1.8:   http://tmux.sourceforge.net
                   Tmux is necessary to send commands from Vim to R Console.
@@ -2650,6 +2650,10 @@ put in your |vimrc|:
 							       *r-plugin-news*
 10. News~
 
+1.3.1 (2016-03-16)
+
+ * Require vimcom 1.3-1 and Vim >= 7.4.1579.
+
 1.3.0 (2016-03-12)
 
  * Fix missing files in vimball: r-plugin/tmux.vim, r-plugin/tmux_split.vim
diff --git a/ftplugin/rnoweb_rplugin.vim b/ftplugin/rnoweb_rplugin.vim
index d144d01..151ef5e 100644
--- a/ftplugin/rnoweb_rplugin.vim
+++ b/ftplugin/rnoweb_rplugin.vim
@@ -625,7 +625,7 @@ function! Run_EvinceBackward()
         call job_start(["python",
                     \ g:rplugin_home . "/r-plugin/synctex_evince_backward.py",
                     \ basenm . ".pdf"],
-                    \ {'out-cb': 'ROnJobStdout', 'err-cb': "ROnJobStderr"})
+                    \ {'out_cb': 'ROnJobStdout', 'err_cb': "ROnJobStderr"})
     endif
     exe "cd " . substitute(olddir, ' ', '\\ ', 'g')
 endfunction
diff --git a/r-plugin/common_global.vim b/r-plugin/common_global.vim
index 3d293ff..97e05cd 100644
--- a/r-plugin/common_global.vim
+++ b/r-plugin/common_global.vim
@@ -59,12 +59,13 @@ function RWarningMsgInp(wmsg)
     let &shortmess = savedsm
 endfunction
 
-if !exists("*job_getchannel")
-    call RWarningMsgInp("The Vim-R-plugin requires Vim >= 7.4.1468 with both +channel and +job features enabled.")
+if !exists("*job_getchannel") || !has("patch-7.4.1579")
+    call RWarningMsgInp("The Vim-R-plugin requires Vim >= 7.4.1579 with both +channel and +job features enabled.")
     let g:rplugin_failed = 1
     finish
 endif
 
+
 " Set default value of some variables:
 function RSetDefaultValue(var, val)
     if !exists(a:var)
@@ -680,7 +681,7 @@ function StartR(whatr)
     else
         let start_options += ['options(vimcom.vimpager = TRUE)']
     endif
-    let start_options += ['if(utils::packageVersion("vimcom") != "1.3") warning("Your version of Vim-R-plugin requires vimcom-1.3.", call. = FALSE)']
+    let start_options += ['if(utils::packageVersion("vimcom") != "1.3.1") warning("Your version of Vim-R-plugin requires vimcom-1.3-1.", call. = FALSE)']
 
     let rwd = ""
     if g:vimrplugin_vim_wd == 0
@@ -824,13 +825,13 @@ function WaitVimComStart()
                 endif
             endif
             let vcs_job = job_start([g:rplugin_vclntsrvr],
-                        \ {'out-cb': 'ROnJobStdout', 'err-cb': "ROnJobStderr"})
+                        \ {'out_cb': 'ROnJobStdout', 'err_cb': "ROnJobStderr"})
             let g:rplugin_channel = job_getchannel(vcs_job)
         else
             call RWarningMsgInp('Could not find "' . g:rplugin_vclntsrvr . '".')
         endif
-        if g:rplugin_vimcom_version != "1.3"
-            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.3.')
+        if g:rplugin_vimcom_version != "1.3.1"
+            call RWarningMsg('This version of Vim-R-plugin requires vimcom 1.3-1.')
             sleep 1
         endif
         call delete(g:rplugin_tmpdir . "/vimcom_running_" . $VIMINSTANCEID)
diff --git a/r-plugin/tmux_split.vim b/r-plugin/tmux_split.vim
index 97b7626..173cc96 100644
--- a/r-plugin/tmux_split.vim
+++ b/r-plugin/tmux_split.vim
@@ -97,7 +97,7 @@ function StartObjBrowser_Tmux()
                 \ 'set updatetime=100',
                 \ 'let g:SendCmdToR = function("SendCmdToR_TmuxSplit")',
                 \ 'let g:rplugin_vimcomport = ' . g:rplugin_vimcomport,
-                \ 'let vcs_job = job_start([g:rplugin_vclntsrvr], {"out-cb": "ROnJobStdout", "err-cb": "ROnJobStderr"})',
+                \ 'let vcs_job = job_start([g:rplugin_vclntsrvr], {"out_cb": "ROnJobStdout", "err_cb": "ROnJobStderr"})',
                 \ 'let g:rplugin_channel = job_getchannel(vcs_job)',
                 \ 'sleep 150m'],
                 \ objbrowserfile)

From fcf3713a5bd5d499ea41d8bf460486a77477e198 Mon Sep 17 00:00:00 2001
From: Jakson Alves de Aquino 
Date: Wed, 16 Mar 2016 11:29:28 -0300
Subject: [PATCH 1050/1050] Warn that Vim-R-plugin was replaced by Nvim-R

---
 README.md | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)

diff --git a/README.md b/README.md
index c3c618a..86abe96 100644
--- a/README.md
+++ b/README.md
@@ -1,13 +1,5 @@
-# Vim-R-plugin
+# Vim-R-plugin - DO NOT INSTALL THIS PLUGIN
 
-Note: If your operating system is a Unix variant (Linux, Mac OS X, or other),
-you may prefer [Neovim](https://github.com/neovim/neovim) +
-[Nvim-R](https://github.com/jalvesaq/Nvim-R) +
-[nvimcom](https://github.com/jalvesaq/nvimcom).
+This plugin is no longer being maintained. It was superseded by 
+[Nvim-R](https://github.com/jalvesaq/Nvim-R).
 
-Stable versions of Vim-R-plugin are released at
-[vim.org](http://www.vim.org/scripts/script.php?script_id=2628).
-Please, read the file *doc/r-plugin.txt* for usage details.
-
-If you decide to use this version, you will also need the development version
-of [vimcom](https://github.com/jalvesaq/VimCom).