From d90cf5935c316747d0005bbbb55be9ef570346b5 Mon Sep 17 00:00:00 2001 From: Wang Shidong Date: Sat, 1 Feb 2020 12:45:52 +0800 Subject: [PATCH] Improve lang#r layer (#3322) --- autoload/SpaceVim/layers/lang/r.vim | 9 +++++---- autoload/SpaceVim/plugins/projectmanager.vim | 4 +++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/autoload/SpaceVim/layers/lang/r.vim b/autoload/SpaceVim/layers/lang/r.vim index 45c10c5f2..e62d1cd7a 100644 --- a/autoload/SpaceVim/layers/lang/r.vim +++ b/autoload/SpaceVim/layers/lang/r.vim @@ -18,14 +18,15 @@ function! SpaceVim#layers#lang#r#set_variable(var) abort endfunction function! SpaceVim#layers#lang#r#config() abort - call SpaceVim#plugins#runner#reg_runner('r', 'R --vanilla <%s') + call add(g:spacevim_project_rooter_patterns, '.Rprofile') + call SpaceVim#plugins#runner#reg_runner('r', 'R <%s') call SpaceVim#mapping#space#regesit_lang_mappings('r', function('s:language_specified_mappings')) if !empty(s:r_repl_command) - call SpaceVim#plugins#repl#reg('r',s:r_repl_command) + call SpaceVim#plugins#repl#reg('r',s:r_repl_command) else - call SpaceVim#plugins#repl#reg('r', 'r') + call SpaceVim#plugins#repl#reg('r', 'r') endif - + endfunction function! s:language_specified_mappings() abort diff --git a/autoload/SpaceVim/plugins/projectmanager.vim b/autoload/SpaceVim/plugins/projectmanager.vim index 0a64a6d7b..6cbc498ea 100644 --- a/autoload/SpaceVim/plugins/projectmanager.vim +++ b/autoload/SpaceVim/plugins/projectmanager.vim @@ -168,7 +168,9 @@ function! s:find_root_directory() abort let dir = SpaceVim#util#findFileInParent(pattern, fd) endif let ftype = getftype(dir) - if ( ftype ==# 'dir' || ftype ==# 'file' ) && dir !=# expand('~/.SpaceVim.d/') + if ( ftype ==# 'dir' || ftype ==# 'file' ) + \ && dir !=# expand('~/.SpaceVim.d/') + \ && dir !=# expand('~/.Rprofile') let dir = s:FILE.unify_path(fnamemodify(dir, ':p')) if ftype ==# 'dir' let dir = fnamemodify(dir, ':h:h')