FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Vim-R-plugin/r-plugin/setcompldir.vim at master · vim-scripts/Vim-R-plugin · GitHub
vim-scripts
/
Vim-R-plugin
Public
Notifications
You must be signed in to change notification settings
Fork
57
Star
121
Code
Pull requests
3
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
Vim-R-plugin
/
r-plugin
/
setcompldir.vim
Copy path
More file actions
More file actions
Latest commit
History
History
History
77 lines (69 loc) · 3.04 KB
Breadcrumbs
Vim-R-plugin
/
r-plugin
/
setcompldir.vim
Copy path
File metadata and controls
77 lines (69 loc) · 3.04 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
"
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
(
"
<sfile>: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
)
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
"
))
let
g:
rplugin_compldir
=
expand
(
"
~/Library/Caches/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
Back
|
FazBrowse Home
|
New Git URL