Showing posts with label vim powershell. Show all posts
Showing posts with label vim powershell. Show all posts

Tuesday, April 30, 2013

Vim with PowerShell installation

Tired of the old command line? Or you like to use vim in a linux/unix cmd mode?  Powershell is installed by default in windows 7. It has better screen size compared to cmd.

You can now use vim on powershell. I am new to powershell and after googling for minutes, I found out that vim can work on powershell.


First you need to run powershell in Admin.

Just type this to create a new powershell profile:


new-item -path $profile -itemtype file -force


Also:
Set-ExecutionPolicy RemoteSigned
This would allow the profile to be executed smoothly.

To open the profile in Notepad, type:
notepad $profile
Then Insert these text:

$VIMPATH    = "C:\Program Files\Vim\vim73\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
}
Some Bonus: You can create a shortcut in your desktop to run the vim powershell.

Just create a shortcut link of powershell and edit the target to:
%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe vim

You'll load vim in no time. Next time I'll try to check if msys works on this so we can use grep on powershell vim :)
Screen shot


Sources:
http://stackoverflow.com/questions/4037939/powershell-execution-of-scripts-is-disabled-on-this-system
http://msdn.microsoft.com/en-us/library/bb613488(VS.85).aspx
http://juliankay.com/development/setting-up-vim-to-work-with-powershell/