From 13ef1cb8bbeacb61eae286fdacca91d15609654d Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Wed, 26 Oct 2016 19:29:41 +0200 Subject: Manage Rprofile Fix the code to decide if Nvim-R will work. This is not tested with vim 8 though. --- .gitignore | 1 + Rprofile | 20 ++++++++++++++++++++ install | 2 +- vimrc | 19 +++++++++---------- 4 files changed, 31 insertions(+), 11 deletions(-) create mode 100644 Rprofile diff --git a/.gitignore b/.gitignore index 08978c7..3750a9f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ bak VimCom +test.R diff --git a/Rprofile b/Rprofile new file mode 100644 index 0000000..5b77822 --- /dev/null +++ b/Rprofile @@ -0,0 +1,20 @@ +options(pdfviewer="okular") +options(browser="firefox") + +# R package repositories +local({ + r <- getOption("repos") + r["CRAN"] <- "https://cran.rstudio.com" + #r["CRAN"] <- "http://cran.at.r-project.org" # if https does not work + #r["eddelbuettel"] <- "https://eddelbuettel.github.io/drat" + #r["ghrr"] <- "https://ghrr.github.io/drat" + options(repos = r) +}) + +if (interactive()) { + library(colorout) + library(setwidth) + # vimcom will generally only be installed on boxes where this is necessary + if (requireNamespace("vimcom")) options(vimcom.verbose = 1) + # However, vimcom does not get in the way of Nvim-R if it is loaded +} diff --git a/install b/install index 544df8f..0eed1fb 100755 --- a/install +++ b/install @@ -6,7 +6,7 @@ cd $(dirname $BASH_SOURCE) BASE=$(pwd) # dotfiles to install -for dotfile in bashrc vimrc gitconfig tmux.conf reportbugrc; do +for dotfile in bashrc vimrc gitconfig Rprofile tmux.conf reportbugrc; do mkdir -pv bak [ -e ~/.$dotfile ] && mv -v ~/.$dotfile bak/.$dotfile ln -sfv $BASE/$dotfile ~/.$dotfile diff --git a/vimrc b/vimrc index b18e91b..e1f7033 100644 --- a/vimrc +++ b/vimrc @@ -22,25 +22,24 @@ Plug 'jalvesaq/R-Vim-runtime' Plug 'jranke/vim-pandoc', { 'branch': 'rmd' } Plug 'vim-pandoc/vim-pandoc-syntax' " R plugin {{{2 -if !exists("*job_getchannel") - " for vim versions <= 7.4.1453 use the legacy plugin +" for vim versions <= 7.4.1453 use the legacy plugin +if !has('nvim') && !exists("*job_getchannel") Plug 'jcfaria/Vim-R-plugin', { 'commit': 'd726d619f12a10fb5ac7967d373837735cff60f0' } + + let vimrplugin_map_r = 1 " is silent per default, therefore tried + "vnoremap r *@:call SendSelectionToR("echo", "down") + " but this does not work as expected + + let vimrplugin_assign = 0 + let rmd_syn_hl_chunk = 1 "let vimrplugin_vsplit = 0 "let vimrplugin_rconsole_width = 100 - "let vimrplugin_pdfviewer = "/usr/bin/okular" "let vimrplugin_openpdf = 0 - let vimrplugin_assign = 0 "let vimrplugin_objbr_place = "script,left" - let rmd_syn_hl_chunk = 1 - - let vimrplugin_map_r = 1 " is silent per default, therefore tried - "vnoremap r *@:call SendSelectionToR("echo", "down") - " but this does not work as expected else Plug 'jalvesaq/Nvim-R' vmap r :call SendSelectionToR("echo", "down") - "let R_source_args = "print.eval = TRUE" let R_vsplit = 1 let R_assign = 0 endif -- cgit v1.2.1