Check in!
This commit is contained in:
commit
7415aa1543
14 changed files with 130 additions and 0 deletions
11
Install.ps1
Normal file
11
Install.ps1
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
# Run all scripts in the install folder
|
||||||
|
$list = @()
|
||||||
|
Get-ChildItem -Path install -Filter:*.ps1 -EA:Ignore | ForEach-Object {
|
||||||
|
$list += $_.BaseName
|
||||||
|
. $_.FullName
|
||||||
|
}
|
||||||
|
Write-Output "Installed: [$($list -join "] [")]"
|
||||||
|
|
||||||
|
# Add to profile
|
||||||
|
$loadscript = Join-Path (Get-Location) "Load.ps1"
|
||||||
|
". $loadscript" | Add-Content -Path $Profile -Encoding UTF8
|
13
LICENSE
Normal file
13
LICENSE
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
Copyright (c) 2020, Gatti Alessandro <hamcha@crunchy.rocks>
|
||||||
|
|
||||||
|
Permission to use, copy, modify, and/or distribute this software for any
|
||||||
|
purpose with or without fee is hereby granted, provided that the above
|
||||||
|
copyright notice and this permission notice appear in all copies.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||||
|
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||||
|
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||||
|
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||||
|
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||||
|
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||||
|
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
11
Load.ps1
Normal file
11
Load.ps1
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
$list = @()
|
||||||
|
Get-ChildItem -Path (Join-Path $PSScriptRoot mods) -Filter:*.ps1 -EA:Ignore | ForEach-Object {
|
||||||
|
$list += $_.BaseName
|
||||||
|
. $_.FullName
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Output "Loaded: [$($list -join "] [")]"
|
||||||
|
|
||||||
|
$Env:PATH += [System.IO.Path]::PathSeparator + "$(Join-Path $PSScriptRoot scripts)"
|
||||||
|
|
||||||
|
. (Join-Path $PSScriptRoot Vars.ps1)
|
46
README.md
Normal file
46
README.md
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
# The MPGA profile
|
||||||
|
|
||||||
|
Make Powershell Great Again!
|
||||||
|
|
||||||
|
This project will install and load the following mods
|
||||||
|
|
||||||
|
- [posh-git](htts://github.com/dahlbyk/posh-git) (Git extensions)
|
||||||
|
- [oh-my-posh](https://github.com/JanDeDobbeleer/oh-my-posh) (Theming)
|
||||||
|
- [Pscx](https://github.com/Pscx/Pscx) (Community extensions)
|
||||||
|
- [Get-ChildItemColor](https://github.com/joonro/Get-ChildItemColor) (Colored ls/gci)
|
||||||
|
|
||||||
|
and apply some changes:
|
||||||
|
|
||||||
|
- Zsh-like Tab auto-complete (with menus)
|
||||||
|
- Better CTRL word navigation
|
||||||
|
|
||||||
|
Some scripts are also included:
|
||||||
|
|
||||||
|
- `time.ps1` Returns execution time of the last command
|
||||||
|
|
||||||
|
## Getting started
|
||||||
|
|
||||||
|
### Requirements
|
||||||
|
|
||||||
|
- Powershell v6+
|
||||||
|
|
||||||
|
### Installation
|
||||||
|
|
||||||
|
Clone or extract somewhere, maybe inside your profile dir?
|
||||||
|
Where's your profile? Check `$Profile` in powershell.
|
||||||
|
|
||||||
|
Install all modules by running `Install.ps1`. No administrator shell required, everything is installed in the user context!
|
||||||
|
|
||||||
|
Close and reopen the shell and you should be done!
|
||||||
|
|
||||||
|
## Customization
|
||||||
|
|
||||||
|
`Vars.ps1` contains some extra options you might want to change. Or just add more stuff there (or better yet, in your `$profile`).
|
||||||
|
|
||||||
|
If you don't want a particular module, just delete the file off the `install` and `mods` folder. Then it will not be installed/loaded!
|
||||||
|
|
||||||
|
The `scripts` folder is added to the `PATH` during load, you can add/remove scripts there and they will be in `PATH` but only when using this profile!
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
Everything is released under ISC (see `LICENSE`).
|
5
Vars.ps1
Normal file
5
Vars.ps1
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
# Set oh-my-posh theme
|
||||||
|
#
|
||||||
|
# See https://github.com/JanDeDobbeleer/oh-my-posh#themes
|
||||||
|
# for other themes and extra options
|
||||||
|
Set-Theme Robbyrussell
|
4
install/git.ps1
Normal file
4
install/git.ps1
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
# Install and add posh-git to profile
|
||||||
|
PowerShellGet\Install-Module posh-git -Scope CurrentUser -Force
|
||||||
|
Import-Module posh-git
|
||||||
|
Add-PoshGitToProfile
|
1
install/ls-colors.ps1
Normal file
1
install/ls-colors.ps1
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Install-Module -Scope CurrentUser -AllowClobber Get-ChildItemColor
|
3
install/oh-my-posh.ps1
Normal file
3
install/oh-my-posh.ps1
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
Install-Module -Name PSReadLine -Scope CurrentUser -Force -SkipPublisherCheck
|
||||||
|
Install-Module posh-git -Scope CurrentUser
|
||||||
|
Install-Module oh-my-posh -Scope CurrentUser
|
1
install/pscx.ps1
Normal file
1
install/pscx.ps1
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Install-Module Pscx -Scope CurrentUser
|
1
mods/ls-colors.ps1
Normal file
1
mods/ls-colors.ps1
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Import-Module Get-ChildItemColor
|
1
mods/posh-git.ps1
Normal file
1
mods/posh-git.ps1
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Import-Module posh-git
|
3
mods/pscx.ps1
Normal file
3
mods/pscx.ps1
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
Import-Module Pscx -arg (Join-Path (Split-Path $Profile) Pscx.UserPreferences.ps1) -EA Ignore
|
||||||
|
|
||||||
|
New-Alias -name vs -Value Import-VisualStudioVars
|
27
mods/readline.ps1
Normal file
27
mods/readline.ps1
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
# Set better CTRL bindings
|
||||||
|
Set-PSReadlineOption -EditMode Emacs
|
||||||
|
Set-PSReadlineKeyHandler "Ctrl+Delete" KillWord
|
||||||
|
Set-PSReadlineKeyHandler "Ctrl+Backspace" BackwardKillWord
|
||||||
|
Set-PSReadlineKeyHandler "Ctrl+LeftArrow" BackwardWord
|
||||||
|
Set-PSReadlineKeyHandler "Ctrl+RightArrow" NextWord
|
||||||
|
|
||||||
|
# Set the autocomplete handler to a menu one, similar to how ZSH does it
|
||||||
|
Set-PSReadlineKeyHandler -Key Tab -Function MenuComplete
|
||||||
|
|
||||||
|
# Work around an RS5/PSReadline-2.0.0+beta2 bug (Spacebar is not marked Vital)
|
||||||
|
Set-PSReadlineKeyHandler "Shift+SpaceBar" -ScriptBlock {
|
||||||
|
[Microsoft.Powershell.PSConsoleReadLine]::Insert(' ')
|
||||||
|
}
|
||||||
|
|
||||||
|
# Syntax highlighting!
|
||||||
|
If ($PSEdition -eq "Core") {
|
||||||
|
Set-PSReadlineOption -Colors @{
|
||||||
|
Type = "`e[38;5;85m";
|
||||||
|
String = "`e[38;5;130m";
|
||||||
|
Number = "`e[38;5;220m";
|
||||||
|
Variable = "`e[38;5;191m";
|
||||||
|
Command = "`e[38;5;117m";
|
||||||
|
Operator = "`e[38;5;213m";
|
||||||
|
Parameter = "`e[38;5;239m";
|
||||||
|
}
|
||||||
|
}
|
3
scripts/time.ps1
Normal file
3
scripts/time.ps1
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
$command = Get-History -Count 1
|
||||||
|
$delta = $command.EndExecutionTime - $command.StartExecutionTime
|
||||||
|
Write-Output "Last command took $($delta.TotalMilliseconds) ms ($($delta.Days)d $($delta.Hours)h $($delta.Minutes)m $($delta.Seconds)s $($delta.Milliseconds)ms)"
|
Loading…
Reference in a new issue