@@ -31,6 +31,18 @@ function is_ubuntu1604()
3131 fi
3232}
3333
34+
35+ # 判断是否是Debian版本
36+ function is_debian()
37+ {
38+ version=$( lsb_release -is)
39+ if [ " ${version} " == " Debian" ]; then
40+ echo 1
41+ else
42+ echo 0
43+ fi
44+ }
45+
3446# 在ubuntu上源代码安装vim
3547function compile_vim_on_ubuntu()
3648{
@@ -114,15 +126,20 @@ function install_prepare_software_on_centos()
114126# 安装ubuntu发行版必要软件
115127function install_prepare_software_on_ubuntu()
116128{
117- sudo apt-get install -y ctags build-essential cmake python-dev python3-dev fontconfig curl libfile-next-perl ack-grep
129+ sudo apt-get update
130+ sudo apt-get install -y ctags build-essential cmake python python-dev python3-dev fontconfig curl libfile-next-perl ack-grep
118131 ubuntu_1604=` is_ubuntu1604`
132+ debian=` is_debian`
119133 echo ${ubuntu_1604}
120134
121135 if [ ${ubuntu_1604} == 1 ]; then
122- echo " ubuntu 16.04 LTS"
136+ echo " Ubuntu 16.04 LTS"
137+ compile_vim_on_ubuntu
138+ elif [ ${debian} == 1 ]; then
139+ echo " Debian"
123140 compile_vim_on_ubuntu
124141 else
125- echo " not ubuntu 16.04 LTS"
142+ echo " Not ubuntu 16.04 LTS"
126143 sudo apt-get install -y vim
127144 fi
128145}
@@ -189,13 +206,33 @@ function compile_ycm_on_linux()
189206 ./install.py --clang-completer
190207}
191208
192- # mac编译ycm插件
193- function compile_ycm_on_mac ()
209+ # macos编译ycm, 原始方法
210+ function compile_ycm_on_mac_legacy ()
194211{
195212 cd ~ /.vim/plugged/YouCompleteMe
196213 ./install.py --clang-completer --system-libclang
197214}
198215
216+ # macos编译ycm, Mojave上的方法
217+ function compile_ycm_on_mac_mojave()
218+ {
219+ echo " Installing macOS_10.14 sdk headers..."
220+ xcode-select --install
221+ open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg
222+ cd ~ /.vim/plugged/YouCompleteMe
223+ ./install.py --clang-completer
224+ }
225+
226+ # 在MacOS上编译ycm
227+ function compile_ycm_on_mac()
228+ {
229+ mac_version=$( sw_vers | grep ProductVersion | cut -d ' .' -f 2 -f 3)
230+ fix_macos_version_list=(14.1 14.2 14.3 14.4)
231+ echo " ${fix_macos_version_list[@]} " | grep -wq " $mac_version " && \
232+ compile_ycm_on_mac_mojave || \
233+ compile_ycm_on_mac_legacy
234+ }
235+
199236# 打印logo
200237function print_logo()
201238{
@@ -263,7 +300,7 @@ function install_vimplus_on_archlinux()
263300function install_vimplus_on_linux()
264301{
265302 type=` get_linux_platform_type`
266- echo " linux platform type: " ${type}
303+ echo " Linux platform type: " ${type}
267304
268305 if [ ${type} == " ubuntu" ]; then
269306 install_vimplus_on_ubuntu
@@ -272,22 +309,22 @@ function install_vimplus_on_linux()
272309 elif [ ${type} == " archlinux" ]; then
273310 install_vimplus_on_archlinux
274311 else
275- echo " not support this linux platform type: " ${type}
312+ echo " Not support this linux platform type: " ${type}
276313 fi
277314}
278315
279316# main函数
280317function main()
281318{
282319 type=` get_platform_type`
283- echo " platform type: " ${type}
320+ echo " Platform type: " ${type}
284321
285322 if [ ${type} == " Darwin" ]; then
286323 install_vimplus_on_mac
287324 elif [ ${type} == " Linux" ]; then
288325 install_vimplus_on_linux
289326 else
290- echo " not support platform type: " ${type}
327+ echo " Not support platform type: " ${type}
291328 fi
292329}
293330
0 commit comments