@@ -11,27 +11,38 @@ if &cp || exists('g:loaded_notes')
11
11
finish
12
12
endif
13
13
14
- " Make sure the default paths below are compatible with Pathogen.
15
- let s: plugindir = expand (' <sfile>:p:h' ) . ' /../misc/notes'
14
+ " This is a bit tricky: We want to be compatible with Pathogen which installs
15
+ " plug-ins as "bundles" under ~/.vim/bundle/*/ so we use a relative path to
16
+ " make sure we 'stay inside the bundle'. However if the notes.vim plug-in is
17
+ " installed system wide the user probably won't have permission to write
18
+ " inside the installation directory, so we have to switch to $HOME then.
19
+ let s: systemdir = xolox#misc#path#absolute (expand (' <sfile>:p:h' ) . ' /../misc/notes' )
20
+ if filewritable (s: systemdir ) == 2
21
+ let s: localdir = s: systemdir
22
+ elseif xolox#misc#os#is_win ()
23
+ let s: localdir = xolox#misc#path#absolute (' ~/vimfiles/misc/notes' )
24
+ else
25
+ let s: localdir = xolox#misc#path#absolute (' ~/.vim/misc/notes' )
26
+ endif
16
27
17
28
" Define the default location where the user's notes are saved?
18
29
if ! exists (' g:notes_directory' )
19
- let g: notes_directory = s: plugindir . ' / user'
30
+ let g: notes_directory = xolox#misc#path#merge ( s: localdir , ' user' )
20
31
endif
21
32
22
33
" Define the default location of the shadow directory with predefined notes?
23
34
if ! exists (' g:notes_shadowdir' )
24
- let g: notes_shadowdir = s: plugindir . ' / shadow'
35
+ let g: notes_shadowdir = xolox#misc#path#merge ( s: systemdir , ' shadow' )
25
36
endif
26
37
27
38
" Define the default location for the full text index.
28
39
if ! exists (' g:notes_indexfile' )
29
- let g: notes_indexfile = s: plugindir . ' / index.pickle'
40
+ let g: notes_indexfile = xolox#misc#path#merge ( s: localdir , ' index.pickle' )
30
41
endif
31
42
32
43
" Define the default location for the keyword scanner script.
33
44
if ! exists (' g:notes_indexscript' )
34
- let g: notes_indexscript = s: plugindir . ' / search-notes.py'
45
+ let g: notes_indexscript = xolox#misc#path#merge ( s: systemdir , ' search-notes.py' )
35
46
endif
36
47
37
48
" Define the default suffix for note filenames.
41
52
42
53
" Define the default location for the tag name index (used for completion).
43
54
if ! exists (' g:notes_tagsindex' )
44
- let g: notes_tagsindex = s: plugindir . ' / tags.txt'
55
+ let g: notes_tagsindex = xolox#misc#path#merge ( s: localdir , ' tags.txt' )
45
56
endif
46
57
47
58
" Define the default action when a note's filename and title are out of sync.
0 commit comments