1 " Author: Eric Van Dewoestine
4 " Plugin which bootstraps the eclim environment.
8 " Copyright (C) 2005 - 2010 Eric Van Dewoestine
10 " This program is free software: you can redistribute it and/or modify
11 " it under the terms of the GNU General Public License as published by
12 " the Free Software Foundation, either version 3 of the License, or
13 " (at your option) any later version.
15 " This program is distributed in the hope that it will be useful,
16 " but WITHOUT ANY WARRANTY; without even the implied warranty of
17 " MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 " GNU General Public License for more details.
20 " You should have received a copy of the GNU General Public License
21 " along with this program. If not, see <http://www.gnu.org/licenses/>.
25 " Command Declarations {{{
26 if !exists(":EclimValidate")
27 command EclimValidate :call <SID>Validate()
32 " Validates some settings and environment values required by eclim.
33 " NOTE: don't add command-line continuation characters anywhere in the
34 " function, just in case the user has &compatible set.
35 function! s:Validate()
38 let ver = strpart(v:version, 0, 1) . '.' . strpart(v:version, 2)
39 echom "Error: Your vim version is " . ver . "."
40 echom " Eclim requires version 7.x.x"
46 " Check 'compatible' option.
48 call add(errors, "Error: You have 'compatible' set:")
49 call add(errors, " Eclim requires 'set nocompatible' in your vimrc.")
50 call add(errors, " Type \":help 'compatible'\" for more details.")
53 " Check filetype support
57 let ftsupport = substitute(ftsupport, '\n', '', 'g')
58 if ftsupport !~ 'detection:ON' || ftsupport !~ 'plugin:ON'
61 while string(chose) !~ '1\|2'
63 echo "Filetype plugin support looks to be disabled, but due to possible"
64 echo "language differences, please check the following line manually."
66 echo "Does it have detection and plugin 'ON'?"
69 let chose = input("Please Choose (1 or 2): ")
72 call add(errors, "Error: Eclim requires filetype plugins to be enabled.")
73 call add(errors, " Please add 'filetype plugin indent on' to your vimrc.")
74 call add(errors, " Type \":help filetype-plugin-on\" for more details.")
82 echom "Result: OK, required settings are valid."
91 " exit early if unsupported vim version, compatible is set, or eclim is
93 if v:version < 700 || &compatible || exists("g:EclimDisabled")
98 " Gets the base directory where the eclim vim scripts are located.
99 function! EclimBaseDir()
100 if !exists("g:EclimBaseDir")
101 let savewig = &wildignore
103 let file = findfile('plugin/eclim.vim', escape(&runtimepath, ' '))
104 let &wildignore = savewig
107 echoe 'Unable to determine eclim basedir. ' .
108 \ 'Please report this issue on the eclim user mailing list.'
109 let g:EclimBaseDir = ''
110 return g:EclimBaseDir
112 let basedir = substitute(fnamemodify(file, ':p:h:h'), '\', '/', 'g')
114 let g:EclimBaseDir = escape(basedir, ' ')
117 return g:EclimBaseDir
123 " add eclim dir to runtime path.
124 let basedir = EclimBaseDir()
129 exec 'set runtimepath+=' .
130 \ basedir . '/eclim,' .
131 \ basedir . '/eclim/after'
133 " Alternate version which inserts the eclim path just after the currently
134 " executing runtime path element and puts the eclim/after path at the very
136 "let paths = split(&rtp, ',')
140 " if tolower(path) == tolower(basedir)
145 "let tail = paths[index :]
148 " exec 'set runtimepath-=' . escape(path, ' ')
151 "exec 'set runtimepath+=' . basedir . '/eclim'
154 " exec 'set runtimepath+=' . escape(path, ' ')
157 "exec 'set runtimepath+=' . basedir . '/eclim/after'
159 " need to be manually sourced
160 runtime! eclim/plugin/*.vim
161 runtime! eclim/after/plugin/*.vim
166 " vim:ft=vim:fdm=marker