├── .gitignore ├── Documents └── WindowsPowerShell │ └── Microsoft.PowerShell_profile.ps1 ├── LICENSE.txt ├── README.md └── sync.ps1 /.gitignore: -------------------------------------------------------------------------------- 1 | *.swp 2 | *~ 3 | *.last-run 4 | -------------------------------------------------------------------------------- /Documents/WindowsPowerShell/Microsoft.PowerShell_profile.ps1: -------------------------------------------------------------------------------- 1 | import-module z 2 | 3 | function .. { cd .. } 4 | function ... { cd .. ; cd .. } 5 | function .... { cd .. ; cd .. ; cd .. } 6 | function ..... { cd .. ; cd .. ; cd .. ; cd .. } 7 | function home { cd $env:USERPROFILE } 8 | 9 | Import-Module posh-git 10 | 11 | Set-PSReadlineKeyHandler -Key UpArrow -Function HistorySearchBackward 12 | Set-PSReadlineKeyHandler -Key DownArrow -Function HistorySearchForward 13 | Set-PSReadLineKeyHandler -Chord Ctrl+a -Function BeginningOfLine 14 | Set-PSReadLineKeyHandler -Chord Ctrl+e -Function EndOfLine 15 | Set-PSReadLineKeyHandler -Chord Alt+LeftArrow -Function BackwardWord 16 | Set-PSReadLineKeyHandler -Chord Alt+RightArrow -Function NextWord 17 | Set-PSReadlineOption -BellStyle None 18 | 19 | function Test-Administrator 20 | { 21 | $user = [Security.Principal.WindowsIdentity]::GetCurrent(); 22 | (New-Object Security.Principal.WindowsPrincipal $user).IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator) 23 | } 24 | 25 | # Set up a simple prompt, adding the git prompt parts inside git repos 26 | function global:prompt { 27 | $realLASTEXITCODE = $LASTEXITCODE 28 | 29 | Write-Host($pwd.ProviderPath) -nonewline -ForegroundColor Gray 30 | 31 | Write-VcsStatus 32 | Write-Host 33 | $global:LASTEXITCODE = $realLASTEXITCODE 34 | if (Test-Administrator) { 35 | Write-Host -NoNewline -ForegroundColor Red "Administrator $env:USERNAME " 36 | } 37 | return "$ " 38 | } 39 | 40 | function t { 41 | wsl.exe -d Ubuntu-20.04 ~/bin/t 42 | } 43 | 44 | # Start-SshAgent -Quiet 45 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Stefan Scherer 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # dotfiles-windows 2 | 3 | Add some tweaks into my PowerShell. 4 | Inspired by for MacOS. 5 | For Unix I prefer my . 6 | 7 | ## Installation 8 | ``` 9 | git clone https://github.com/StefanScherer/dotfiles-windows ; cd dotfiles-windows ; .\sync.ps1 10 | ``` 11 | 12 | To update later on, just run the sync again. 13 | 14 | ## Features 15 | 16 | ### Aliases 17 | 18 | * **..**: one dir up 19 | * **...**: two dirs up 20 | * **....**: three dirs up 21 | * **.....**: four dirs up 22 | * **home**: go into users home directory 23 | * **t**: toggle theme between dark mode and light mode. Depends on WSL 2 [~bin/t](https://github.com/StefanScherer/dotfiles/blob/master/bin/t) script 24 | * **z**: change to one of your favorite project folder 25 | 26 | # Licensing 27 | Copyright (c) 2014 Stefan Scherer 28 | 29 | MIT License, see LICENSE.txt for more details. 30 | -------------------------------------------------------------------------------- /sync.ps1: -------------------------------------------------------------------------------- 1 | if (!(Test-Path $env:USERPROFILE\Documents\WindowsPowerShell)) { 2 | mkdir $env:USERPROFILE\Documents\WindowsPowerShell 3 | } 4 | 5 | if (!(Test-Path $env:USERPROFILE\Documents\WindowsPowerShell\Modules\z)) { 6 | Install-Module z -Scope CurrentUser -AllowClobber 7 | } 8 | 9 | if (!(Test-Path $env:USERPROFILE\Documents\WindowsPowerShell\Modules\posh-git)) { 10 | Install-Module posh-git -Scope CurrentUser 11 | } 12 | 13 | 14 | copy Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1 $env:USERPROFILE\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1 15 | --------------------------------------------------------------------------------