Powershell 配置 Vim (已安装Git)

  • 需求:Powershell能使用Vim
  • 环境:win10家庭版,Git已安装(内置Vim)

流程shell

  1. 找到Git安装目录,"./usr/bin/" 为Git内置vim的位置: "C:/Program Files/Git/usr/bin/vim.exe"
  2. 打开windows Powershell的位置:"C:/Windows/System32/WindowsPowerShell/v1.0", 在此路径下添加一个名为profile.ps1的文件,打开编辑,输入文本:vim

    # There's usually much more than this in my profile!
    $SCRIPTPATH = "C:\Program Files\Git\usr\share\vim"    # 此行根据$VIMPATH寻找相应vim路径便可
    $VIMPATH    = "C:\Program Files\Git\usr\bin\vim.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
    }
  3. Done, 以管理员权限打开Powershell,输入:windows

    Set-ExecutionPolicy RemoteSigned

    y肯定以后,vim即可以使用了。this

Tips:code

  • 寻找文件可用Everything
相关文章
相关标签/搜索