1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-23 17:40:06 +08:00

Improve lang#r layer (#3322)

This commit is contained in:
Wang Shidong 2020-02-01 12:45:52 +08:00 committed by GitHub
parent 32cdadba17
commit d90cf5935c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 5 deletions

View File

@ -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

View File

@ -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')