安装spf13-vim on Windows10

安装之前

1.系统为 windows10  Version 1607 64位 企业版 

2.参考 http://www.codeweblog.com/gvim-64%E4%BD%8D-windows-7-%E5%AE%89%E8%A3%85%E8%BF%87%E7%A8%8B-%E4%BD%BF%E7%94%A8spf13%E9%85%8D%E7%BD%AE/

3.已经安装了git version 2.9.0.windows.1 和 vim 8.0(链接:http://pan.baidu.com/s/1bLmjH8 密码:vz8b) 都在D盘。

上面百度网盘的vim8我配置好支持lua,带ctags下载直接可以。详情请至 http://www.cnblogs.com/eastegg/p/6196525.html 查看关于lua的问题。

4.将要用到 git curl vim spf13-vim(当然) Vundle  

 

开始安装

1. Curl , 一般来说curl在安装git的时候已经一起装了。 一般来说 git 直接可以调用,而 curl 可能不行,所以要在Git 的 cmd 目录下建立 curl.cmd (我瞎猜的)。

我的是 d:\Program Files\Git\cmd\curl.cmd ,内容是

 1 @rem Do not use "echo off" to not affect any child calls.
 2 @setlocal
 3 
 4 @rem Get the abolute path to the parent directory, which is assumed to be the
 5 @rem Git installation root.
 6 @for /F "delims=" %%I in ("%~dp0..") do @set git_install_root=%%~fI
 7 @set PATH=%git_install_root%\bin;%git_install_root%\mingw\bin;%PATH%
 8 
 9 @if not exist "%HOME%" @set HOME=%HOMEDRIVE%%HOMEPATH%
10 @if not exist "%HOME%" @set HOME=%USERPROFILE%
11 
12 @curl.exe %*

需要注意的是 64位 git 的 Curl 在 mingw64\bin 而不是 mingw\bin 。所以第七行我改了一下

@set PATH=%git_install_root%\bin;%git_install_root%\mingw64\bin;%PATH%

改完运行了下,发现在 cmd 中可以像 git 一样直接用 curl 了。

 

2.之前在网上查了可以用 windows 包管理:Chocolatey 来安装。但是装上后单位网总是超时,索性直接从 github 上 clone 了。

装到哪里,就在哪里用 cmd 运行 git clone -b 3.0 https://github.com/spf13/spf13-vim.git 

然后进入 spf13-vim 目录,管理员身份运行 spf13-vim-windows-install.cmd。如果安装路径没有空格什么的不需要转译,到这里算装完了。

 1 REM    Copyright 2014 Steve Francia
 2 REM 
 3 REM    Licensed under the Apache License, Version 2.0 (the "License");
 4 REM    you may not use this file except in compliance with the License.
 5 REM    You may obtain a copy of the License at
 6 REM 
 7 REM        http://www.apache.org/licenses/LICENSE-2.0
 8 REM 
 9 REM    Unless required by applicable law or agreed to in writing, software
10 REM    distributed under the License is distributed on an "AS IS" BASIS,
11 REM    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 REM    See the License for the specific language governing permissions and
13 REM    limitations under the License.
14 
15 
16 @if not exist "%HOME%" @set HOME=%HOMEDRIVE%%HOMEPATH%
17 @if not exist "%HOME%" @set HOME=%USERPROFILE%
18 
19 @set APP_PATH=%HOME%\.spf13-vim-3
20 IF NOT EXIST "%APP_PATH%" (
21     call git clone -b 3.0 https://github.com/spf13/spf13-vim.git "%APP_PATH%"
22 ) ELSE (
23     @set ORIGINAL_DIR=%CD%
24     echo updating spf13-vim
25     chdir /d "%APP_PATH%"
26     call git pull
27     chdir /d "%ORIGINAL_DIR%"
28     call cd "%APP_PATH%"
29 )
30 
31 call mklink "%HOME%\.vimrc" "%APP_PATH%\.vimrc"
32 call mklink "%HOME%\_vimrc" "%APP_PATH%\.vimrc"
33 call mklink "%HOME%\.vimrc.fork" "%APP_PATH%\.vimrc.fork"
34 call mklink "%HOME%\.vimrc.bundles" "%APP_PATH%\.vimrc.bundles"
35 call mklink "%HOME%\.vimrc.bundles.fork" "%APP_PATH%\.vimrc.bundles.fork"
36 call mklink "%HOME%\.vimrc.before" "%APP_PATH%\.vimrc.before"
37 call mklink "%HOME%\.vimrc.before.fork" "%APP_PATH%\.vimrc.before.fork"
38 call mklink /J "%HOME%\.vim" "%APP_PATH%\.vim"
39 
40 IF NOT EXIST "%APP_PATH%\.vim\bundle" (
41     call mkdir "%APP_PATH%\.vim\bundle"
42 )
43 
44 IF NOT EXIST "%HOME%/.vim/bundle/vundle" (
45     call git clone https://github.com/gmarik/vundle.git "%HOME%/.vim/bundle/vundle"
46 ) ELSE (
47   call cd "%HOME%/.vim/bundle/vundle"
48   call git pull
49   call cd %HOME%
50 )
51 
52 call vim -u "%APP_PATH%/.vimrc.bundles" +BundleInstall! +BundleClean +qall

 

我的安装路径是 Program Files (x86) 23行的 %CD% 是要被“”包围才能正常赋值,因为我的路径有空格XC 所以改成

@set ORIGINAL_DIR=“%CD%”

 于是下面引用的 ORIGINAL_DIR 的27行也要修改,不改的话会变成前后都有括号

chdir /d %ORIGINAL_DIR%

 

 

 

ps:项目地址 https://github.com/spf13/spf13-vim 另外时间长了地址可能会变,到时候再在 github 里搜吧。

 

3.等 vim 的 bundle 安装完插件就结束了。剩下的就是自定义配置了

 

4.第二次安装出现了缺少ctags的错误,后发现直接下载ctags后。把解压目录放入系统环境变量可解决问题。

 

posted @ 2016-09-30 11:17  eastegg  阅读(2071)  评论(0编辑  收藏  举报