Because I am new to Windows I was wondering if this could be done. Git works well with *nix toolset—it was designed around it. Because I am using Windows and its shell right now I was hoping it could do the same. Git for Windows does include a Bash shell and a number of *nix tools, however, I was hoping if it would be reasonable to use just the native tools.
The regular PowerShell has to be used. PowerShell ISE is for making scripts and some programs will only run on the regular PowerShell (e.g. Vim for instance). If PowerShell ANSI colors are desired to be edited they have to be done so manually—theme support is only available to PowerShell ISE.
Here are the Properties I edit:
Options Command History Buffer size to 1000, easy for processor to do Command History Discard Old Duplicates Text Selection Enable line wrapping selection Layout Screen Buffer Size Height to 8000 or large number Screen Buffer Size Wrap text on resize
PowerShell configuration create:
test-path $profile # config. existance test new-item -itemtype file -path $profile # config. creation
(Warning: After I created the profile I tried text redirection to add text to the file. This led me on a long path learning about file encoding. Text redirection uses a
Out-File cmdlet that uses the system’s current ANSI code page which is mainly UTF-16LE (with BOM) for most Windows users now. Since I am mainly a Linux user I use UTF-8 without a BOM. The only help that appears to be reasonable to use UTF-8 without a BOM is to use this function but this will create Windows line endings. Using a regular text editor appears to be the only solution for me. More can be read about it here.
Scripts on Windows require that the ExecutionPolicy to allow them. The profile is considered a script. The current execution policy can be obtained by typing
Get-ExecutionPolicy. The execution policy help pages can be viewed by typing
help about_signing. I choose to use
RemoteSigned where only remote scripts have to be signed:
To edit the console colors here are all the variables that can be edited:
[enum]::GetNames([System.ConsoleColor]) # colors available print $host.ui.rawui # colors fore/back-ground print $host.ui.rawui.foregroundcolor = "Green" $host.privatedata # colors for errors print $host.privatedata.errorbackgroundcolor = "darkcyan"
The PowerShell syntax highlighting can altered. To see the set values type
get-psreadlineoption. To set them type
set-psreadlineoption -tokenkind comment gray....
Vim is a good text editor to work with Git for me. I hope to be able to continue using it. However, PowerShell uses unique ANSI colors and I lacked the know-how to map together Vim’s and PowerShell’s (like this other user). PowerShell itself is only a 16 color terminal which is good enough with a good Vim colorscheme. I edited PowerShell’s colors to match the ANSI colors (this post) shows how they line up. My Vim colorschemes look better now but how Vim is handling the background color and maybe other things the colorschemes look off still. I have yet to resolve this.
- executable installer download
- installation options:
Vim executables # gvim and runtime files are likely desired Vim console # vim.exe for console version _vimrc # configuration with many basic settings plugin directrys native lang # english default (for other languages) .bat files # vim shortcuts... unrecognized in PowerShell
- installation location can be for allusers or local (e.g.
C:\Program Files (x86)\Vimor
$HOME\AppData\Local\). I recommend local as configuration files can be tucked there and because local data can only be edited by the local user.
For Vim to be recognized in PowerShell I create an alias (allusers may install
Set-Alias vim "C:\Program Files (x86)\Vim\vim80\vim.exe". I be recognized every time PowerShell is launched I added it to the
I also created a hackish $MYVIMRC setting so UTF-8 is used. Here is how it works: UCS [Unicode Character Set] is used as part of UTF-8 and UTF-16, so I set the characters that Vim uses to UTF-8).
fileencoding can now be left blank for discovery and will adopt
&encoding (UTF-8) otherwise:
if has ("multi_byte") if &termencoding == "" " characters the keyboard uses, null=basic of $enc let &termencoding = &encoding endif set encoding=utf-8 " characters that Vim uses setglobal fileencoding= " encoding of the file, null=discovr else=encoding "setglobal bomb " byte-order-mark used for discovery, leaves mark endif
When installing Git I used all the default settings.
After the install, I was able to use Git normally. I had wondered if Git would be tied to a number of *nix tools for it to be able to function: thank goodness it appears from all uses I have done that it can run on its own. I am happily using Git from PowerShell now.