需要在电脑上先安装Git,找到Git的安装目录,"./usr/bin/" 为Git内置vim的位置: "C:/Program Files/Git/usr/bin/vim.exe"
打开windows Powershell的位置:"C:/Windows/System32/WindowsPowerShell/v1.0", 在此路径下添加一个名为profile.ps1的文件,打开编辑,输入文本:
# There's usually much more than this in my profile! $SCRIPTPATH = "C:Program FilesGitusrsharevim" # 此行根据$VIMPATH寻找相应vim路径即可 $VIMPATH = "C:Program FilesGitusrinvim.exe" # 此行为1中vim.exe路径 Set-Alias vi $VIMPATH Set-Alias vim $VIMPATH # for editing your PowerShell profile Function Edit-Profile { vim $profile } # for editing your Vim settings Function Edit-Vimrc { vim $home\_vimrc }
最后, 以管理员权限打开Powershell,输入:
Set-ExecutionPolicy RemoteSigned