@@ -11,27 +11,38 @@ if &cp || exists('g:loaded_notes')
1111 finish
1212endif
1313
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
1627
1728" Define the default location where the user's notes are saved?
1829if ! exists (' g:notes_directory' )
19- let g: notes_directory = s: plugindir . ' / user'
30+ let g: notes_directory = xolox#misc#path#merge ( s: localdir , ' user' )
2031endif
2132
2233" Define the default location of the shadow directory with predefined notes?
2334if ! exists (' g:notes_shadowdir' )
24- let g: notes_shadowdir = s: plugindir . ' / shadow'
35+ let g: notes_shadowdir = xolox#misc#path#merge ( s: systemdir , ' shadow' )
2536endif
2637
2738" Define the default location for the full text index.
2839if ! 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' )
3041endif
3142
3243" Define the default location for the keyword scanner script.
3344if ! 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' )
3546endif
3647
3748" Define the default suffix for note filenames.
4152
4253" Define the default location for the tag name index (used for completion).
4354if ! 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' )
4556endif
4657
4758" Define the default action when a note's filename and title are out of sync.
0 commit comments