0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

PowerShellでvimを使えるようにする

Posted at

キッティング用に書いておきます。

前提条件

Windows10 Pro(64bit)

Vim本体をダウンロード

香り屋Vimのzipをダウンロード
https://www.kaoriya.net/software/vim/
PCに合わせて選択する。今回は64bitを選択

本家vim.orgから__Win32 console executable__のzip版をダウンロードでも可
https://www.vim.org/download.php

ダウンロードしたzipを任意のディレクトリに解凍して、

 C:\Users\%USERNAME%\tools\vim\

にコピー

VimにPATHを通す

ユーザー環境変数に以下のディレクトリを追加

C:\Users\%USERNAME%\tools\vim\

スクリプトを実行可能にする

PowerShellで.ps1が実行可能か判定する

PS C:\Users\%USERNAME%> get-executionpolicy

と叩き

PS C:\Users\%USERNAME%> get-executionpolicy
RemoteSigned

と返ってくるならスクリプトが実行可能

もしここで、

PS C:\Users\%USERNAME%> get-executionpolicy
Restricted

と返ってくるならPowerShell上でスクリプトが実行不能。

そのため、以下をPowerShellにて叩き、RemoteSignedの権限に設定する。

set-executionpolicy remotesigned

これで再度get-executionpolicyを叩いてRemoteSignedが返ってきたらスクリプトが実行可能となる。

PowerShellのプロファイルを作成しておく

プロファイルの存在を確認

PS C:\Users\%USERNAME%> $profile
C:\Users\%USERNAME%\Documents\PowerShell\Microsoft.PowerShell_profile.ps1

と返ってくる。

もし該当のディレクトリがない場合は

PS C:\Users\%USERNAME%> $mkdir C:\Users\%USERNAME%\Documents\PowerShell

上記のようにディレクトリを作成する。

PS C:\Users\%USERNAME%> $cd C:\Users\%USERNAME%\Documents\PowerShell
PS C:\Users\%USERNAME%\Documents\PowerShell> $New-Item -type file Microsoft.PowerShell_profile.ps1

Microsoft.PowerShell_profile.ps1を作成する。

任意のエディタでMicrosoft.PowerShell_profile.ps1を開いて編集。

PowerShellからVimを実行する

PowerShellを開いて、任意のディレクトリで

PS C:\Users\%USERNAME%> $vim -v

などと打ってみてバージョンが出たらOK。

0
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?